@weasel-js/core 1.10.0 → 1.10.1

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 (327) hide show
  1. package/CHANGELOG.md +168 -0
  2. package/README.md +33 -0
  3. package/dist/affordances/composeAffordanceLayer.js +21 -21
  4. package/dist/affordances/composeAffordanceLayer.js.map +1 -1
  5. package/dist/affordances/hitAffordanceRegions.js +48 -32
  6. package/dist/affordances/hitAffordanceRegions.js.map +1 -1
  7. package/dist/affordances/pathAnchors.js +50 -28
  8. package/dist/affordances/pathAnchors.js.map +1 -1
  9. package/dist/affordances/rotateCursor.js +12 -0
  10. package/dist/affordances/rotateCursor.js.map +1 -0
  11. package/dist/affordances/rotationHandle.js +40 -43
  12. package/dist/affordances/rotationHandle.js.map +1 -1
  13. package/dist/animation/rig/rigNode.js +9 -3
  14. package/dist/animation/rig/rigNode.js.map +1 -1
  15. package/dist/animation/rig/rigSeat.js +46 -13
  16. package/dist/animation/rig/rigSeat.js.map +1 -1
  17. package/dist/animation/rig/skinBinding.js +22 -14
  18. package/dist/animation/rig/skinBinding.js.map +1 -1
  19. package/dist/barrel/canvas.js +29 -28
  20. package/dist/barrel/interactions.js +33 -32
  21. package/dist/barrel/paths.js +11 -10
  22. package/dist/barrel/routing.js +49 -48
  23. package/dist/barrel/scene.js +10 -10
  24. package/dist/barrel/viewport.js +24 -21
  25. package/dist/canvas/Canvas.js +6 -17
  26. package/dist/canvas/Canvas.js.map +1 -1
  27. package/dist/canvas/CanvasView.js +34 -37
  28. package/dist/canvas/CanvasView.js.map +1 -1
  29. package/dist/canvas/CursorCoordsHud.js +3 -3
  30. package/dist/canvas/CursorCoordsHud.js.map +1 -1
  31. package/dist/canvas/DrawCanvas.js +3 -3
  32. package/dist/canvas/DrawCanvas.js.map +1 -1
  33. package/dist/canvas/SceneCanvas/PointerProviderIfRoot.js +24 -23
  34. package/dist/canvas/SceneCanvas/PointerProviderIfRoot.js.map +1 -1
  35. package/dist/canvas/SceneCanvas/StandardActionsRegistrar.js +40 -49
  36. package/dist/canvas/SceneCanvas/StandardActionsRegistrar.js.map +1 -1
  37. package/dist/canvas/SceneCanvas/defaultNodeProperties.js +297 -259
  38. package/dist/canvas/SceneCanvas/defaultNodeProperties.js.map +1 -1
  39. package/dist/canvas/SceneCanvas/features.js +3 -24
  40. package/dist/canvas/SceneCanvas/features.js.map +1 -1
  41. package/dist/canvas/SceneCanvas/insertPreviewCommands.js +97 -0
  42. package/dist/canvas/SceneCanvas/insertPreviewCommands.js.map +1 -0
  43. package/dist/canvas/SceneCanvas/poseGeometry.js.map +1 -1
  44. package/dist/canvas/SceneCanvas/props.js.map +1 -1
  45. package/dist/canvas/SceneCanvas/scenePointQuery.js +50 -0
  46. package/dist/canvas/SceneCanvas/scenePointQuery.js.map +1 -0
  47. package/dist/canvas/SceneCanvas/shapeGeneratorProperties.js +52 -0
  48. package/dist/canvas/SceneCanvas/shapeGeneratorProperties.js.map +1 -0
  49. package/dist/canvas/SceneCanvas/useActionTunings.js +17 -0
  50. package/dist/canvas/SceneCanvas/useActionTunings.js.map +1 -0
  51. package/dist/canvas/SceneCanvas/useCanvasCamera.js +37 -29
  52. package/dist/canvas/SceneCanvas/useCanvasCamera.js.map +1 -1
  53. package/dist/canvas/SceneCanvas/useCanvasDispatcher.js +11 -11
  54. package/dist/canvas/SceneCanvas/useCanvasDispatcher.js.map +1 -1
  55. package/dist/canvas/SceneCanvas/useDispatcherOverlayLayer.js +45 -109
  56. package/dist/canvas/SceneCanvas/useDispatcherOverlayLayer.js.map +1 -1
  57. package/dist/canvas/SceneCanvas/usePreviewGhostLayer.js +49 -41
  58. package/dist/canvas/SceneCanvas/usePreviewGhostLayer.js.map +1 -1
  59. package/dist/canvas/SceneCanvas/useSceneSelectTool.js +64 -96
  60. package/dist/canvas/SceneCanvas/useSceneSelectTool.js.map +1 -1
  61. package/dist/canvas/SceneCanvas/worldPointAt.js +3 -4
  62. package/dist/canvas/SceneCanvas/worldPointAt.js.map +1 -1
  63. package/dist/canvas/SceneCanvas.js +77 -80
  64. package/dist/canvas/SceneCanvas.js.map +1 -1
  65. package/dist/canvas/SceneViewCanvas.js +3 -3
  66. package/dist/canvas/SceneViewCanvas.js.map +1 -1
  67. package/dist/canvas/SurfaceCanvas.js +40 -0
  68. package/dist/canvas/SurfaceCanvas.js.map +1 -0
  69. package/dist/canvas/adapterDerivedPath.js +13 -13
  70. package/dist/canvas/adapterDerivedPath.js.map +1 -1
  71. package/dist/canvas/adapterPickSource.js +34 -0
  72. package/dist/canvas/adapterPickSource.js.map +1 -0
  73. package/dist/canvas/affordanceAt.js +1 -1
  74. package/dist/canvas/affordanceAt.js.map +1 -1
  75. package/dist/canvas/buildSceneLayer.js.map +1 -1
  76. package/dist/canvas/buildSceneTree.js +56 -34
  77. package/dist/canvas/buildSceneTree.js.map +1 -1
  78. package/dist/canvas/copiesAbove.js +27 -0
  79. package/dist/canvas/copiesAbove.js.map +1 -0
  80. package/dist/canvas/defaultDrawOne.js +24 -23
  81. package/dist/canvas/defaultDrawOne.js.map +1 -1
  82. package/dist/canvas/deps/editAnchors.js +45 -50
  83. package/dist/canvas/deps/editAnchors.js.map +1 -1
  84. package/dist/canvas/deps/hitTestArea.js +30 -15
  85. package/dist/canvas/deps/hitTestArea.js.map +1 -1
  86. package/dist/canvas/deps/insert.js +134 -100
  87. package/dist/canvas/deps/insert.js.map +1 -1
  88. package/dist/canvas/deps/layout.js +9 -15
  89. package/dist/canvas/deps/layout.js.map +1 -1
  90. package/dist/canvas/derivedPath.js +53 -29
  91. package/dist/canvas/derivedPath.js.map +1 -1
  92. package/dist/canvas/insertPreviewExtent.js +33 -31
  93. package/dist/canvas/insertPreviewExtent.js.map +1 -1
  94. package/dist/canvas/overChildren.js +29 -0
  95. package/dist/canvas/overChildren.js.map +1 -0
  96. package/dist/canvas/paintedCursorLayer.js.map +1 -1
  97. package/dist/canvas/pickReach.js +23 -0
  98. package/dist/canvas/pickReach.js.map +1 -0
  99. package/dist/canvas/pickWalk.js +51 -80
  100. package/dist/canvas/pickWalk.js.map +1 -1
  101. package/dist/canvas/sceneAdapter.js +14 -35
  102. package/dist/canvas/sceneAdapter.js.map +1 -1
  103. package/dist/canvas/sceneSlotWiring.js +11 -10
  104. package/dist/canvas/sceneSlotWiring.js.map +1 -1
  105. package/dist/canvas/sceneViewRender.js +38 -44
  106. package/dist/canvas/sceneViewRender.js.map +1 -1
  107. package/dist/canvas/useCanvasView.js +42 -44
  108. package/dist/canvas/useCanvasView.js.map +1 -1
  109. package/dist/canvas/useSceneAdapter.js +22 -0
  110. package/dist/canvas/useSceneAdapter.js.map +1 -0
  111. package/dist/canvas/useSurfaceInput.js +13 -16
  112. package/dist/canvas/useSurfaceInput.js.map +1 -1
  113. package/dist/canvas/viewRegistry.js +31 -23
  114. package/dist/canvas/viewRegistry.js.map +1 -1
  115. package/dist/canvas/wrapNodeOutput.js +7 -2
  116. package/dist/canvas/wrapNodeOutput.js.map +1 -1
  117. package/dist/clipboard.d.ts +1 -1
  118. package/dist/{clone-2a5hVbBd.d.ts → clone-C0eADtS0.d.ts} +13 -13
  119. package/dist/clone.d.ts +2 -2
  120. package/dist/core/geometry/poseDescriptor.js +49 -23
  121. package/dist/core/geometry/poseDescriptor.js.map +1 -1
  122. package/dist/core/geometry/regionHit.js +2 -2
  123. package/dist/core/geometry/regionHit.js.map +1 -1
  124. package/dist/core/geometry/targetFrame.js.map +1 -1
  125. package/dist/core/layers/children.js +1 -3
  126. package/dist/core/layers/children.js.map +1 -1
  127. package/dist/core/ops/create.js +2 -2
  128. package/dist/core/ops/create.js.map +1 -1
  129. package/dist/core/ops/delete.js +19 -23
  130. package/dist/core/ops/delete.js.map +1 -1
  131. package/dist/core/ops/reorder/index.js +3 -7
  132. package/dist/core/ops/reorder/index.js.map +1 -1
  133. package/dist/core/ops/reorder/setChildOrder.js +2 -4
  134. package/dist/core/ops/reorder/setChildOrder.js.map +1 -1
  135. package/dist/core/ops/reparent.js +0 -1
  136. package/dist/core/ops/reparent.js.map +1 -1
  137. package/dist/core/ops/slot.js +3 -6
  138. package/dist/core/ops/slot.js.map +1 -1
  139. package/dist/core/pages/fitViewToPage.js +15 -0
  140. package/dist/core/pages/fitViewToPage.js.map +1 -0
  141. package/dist/core/pages/pages.js +65 -0
  142. package/dist/core/pages/pages.js.map +1 -0
  143. package/dist/core/pages/pagesLayer.js +27 -0
  144. package/dist/core/pages/pagesLayer.js.map +1 -0
  145. package/dist/core/paint/meshKindLazy.js +2 -2
  146. package/dist/core/paint/meshKindLazy.js.map +1 -1
  147. package/dist/core/scene/NodeProperties.js.map +1 -1
  148. package/dist/core/scene/composeFrame.js.map +1 -1
  149. package/dist/core/scene/composePose.js +58 -20
  150. package/dist/core/scene/composePose.js.map +1 -1
  151. package/dist/core/scene/effectivePose.js +5 -1
  152. package/dist/core/scene/effectivePose.js.map +1 -1
  153. package/dist/core/scene/historyFacade.js +19 -13
  154. package/dist/core/scene/historyFacade.js.map +1 -1
  155. package/dist/core/scene/nodeFnFields.js +7 -0
  156. package/dist/core/scene/nodeFnFields.js.map +1 -1
  157. package/dist/core/scene/outerOps.js +2 -1
  158. package/dist/core/scene/outerOps.js.map +1 -1
  159. package/dist/core/scene/reconcileSpecs.js +1 -1
  160. package/dist/core/scene/reconcileSpecs.js.map +1 -1
  161. package/dist/core/scene/sceneRecording.js +2 -1
  162. package/dist/core/scene/sceneRecording.js.map +1 -1
  163. package/dist/core/scene/types.js.map +1 -1
  164. package/dist/core/viewport/screenSlop.js.map +1 -1
  165. package/dist/core/viewport/useDecayLoop.js +28 -30
  166. package/dist/core/viewport/useDecayLoop.js.map +1 -1
  167. package/dist/core/viewport/useNodeOverlayFrame.js.map +1 -1
  168. package/dist/core/viewport/useViewAnimation.js +70 -69
  169. package/dist/core/viewport/useViewAnimation.js.map +1 -1
  170. package/dist/core/viewport/view.js +8 -5
  171. package/dist/core/viewport/view.js.map +1 -1
  172. package/dist/core/viewport/zoomAt.js +11 -2
  173. package/dist/core/viewport/zoomAt.js.map +1 -1
  174. package/dist/{cornerHandles-BEshc4z3.d.ts → cornerHandles-BSKbyuvQ.d.ts} +1 -1
  175. package/dist/features/paths/editablePath.js +24 -8
  176. package/dist/features/paths/editablePath.js.map +1 -1
  177. package/dist/features/paths/index.js +4 -4
  178. package/dist/features/paths/shapeGenerator.js +89 -0
  179. package/dist/features/paths/shapeGenerator.js.map +1 -0
  180. package/dist/features/paths/usePathEdit.js +13 -13
  181. package/dist/features/poseRun/usePoseRun.js +25 -25
  182. package/dist/features/poseRun/usePoseRun.js.map +1 -1
  183. package/dist/features/text/useSceneTextEdit.js +82 -64
  184. package/dist/features/text/useSceneTextEdit.js.map +1 -1
  185. package/dist/features/viewports/viewResolver.js +28 -24
  186. package/dist/features/viewports/viewResolver.js.map +1 -1
  187. package/dist/icons/SliceIcon.js +24 -0
  188. package/dist/icons/SliceIcon.js.map +1 -0
  189. package/dist/index.d.ts +956 -581
  190. package/dist/index.js +260 -251
  191. package/dist/interactions/actions/align/align.js +9 -9
  192. package/dist/interactions/actions/align/align.js.map +1 -1
  193. package/dist/interactions/actions/booleans/booleans.js +18 -18
  194. package/dist/interactions/actions/booleans/booleans.js.map +1 -1
  195. package/dist/interactions/actions/booleans/operands.js.map +1 -1
  196. package/dist/interactions/actions/clone/action.js +35 -30
  197. package/dist/interactions/actions/clone/action.js.map +1 -1
  198. package/dist/interactions/actions/defaults/anchorEditing.js +56 -59
  199. package/dist/interactions/actions/defaults/anchorEditing.js.map +1 -1
  200. package/dist/interactions/actions/defaults/anchorHandles.js +42 -0
  201. package/dist/interactions/actions/defaults/anchorHandles.js.map +1 -0
  202. package/dist/interactions/actions/defaults/anchorJoin.js +92 -0
  203. package/dist/interactions/actions/defaults/anchorJoin.js.map +1 -0
  204. package/dist/interactions/actions/defaults/bendSegment.js +46 -0
  205. package/dist/interactions/actions/defaults/bendSegment.js.map +1 -0
  206. package/dist/interactions/actions/defaults/copySubtree.js +1 -1
  207. package/dist/interactions/actions/defaults/copySubtree.js.map +1 -1
  208. package/dist/interactions/actions/defaults/duplicate.js +32 -17
  209. package/dist/interactions/actions/defaults/duplicate.js.map +1 -1
  210. package/dist/interactions/actions/defaults/enterPathEdit.js +19 -7
  211. package/dist/interactions/actions/defaults/enterPathEdit.js.map +1 -1
  212. package/dist/interactions/actions/defaults/icons/anchorIcons.js +75 -0
  213. package/dist/interactions/actions/defaults/icons/anchorIcons.js.map +1 -0
  214. package/dist/interactions/actions/defaults/icons/editIcons.js +35 -8
  215. package/dist/interactions/actions/defaults/icons/editIcons.js.map +1 -1
  216. package/dist/interactions/actions/defaults/insertPathAnchor.js +16 -31
  217. package/dist/interactions/actions/defaults/insertPathAnchor.js.map +1 -1
  218. package/dist/interactions/actions/defaults/nudge.js +28 -23
  219. package/dist/interactions/actions/defaults/nudge.js.map +1 -1
  220. package/dist/interactions/actions/defaults/pinchZoom.js +29 -29
  221. package/dist/interactions/actions/defaults/pinchZoom.js.map +1 -1
  222. package/dist/interactions/actions/defaults/segmentUnder.js +22 -0
  223. package/dist/interactions/actions/defaults/segmentUnder.js.map +1 -0
  224. package/dist/interactions/actions/defaults/viewportZoom.js +82 -79
  225. package/dist/interactions/actions/defaults/viewportZoom.js.map +1 -1
  226. package/dist/interactions/actions/distribute/distribute.js +8 -8
  227. package/dist/interactions/actions/distribute/distribute.js.map +1 -1
  228. package/dist/interactions/actions/edit-anchors/action.js +58 -55
  229. package/dist/interactions/actions/edit-anchors/action.js.map +1 -1
  230. package/dist/interactions/actions/edit-anchors/preview.js +26 -0
  231. package/dist/interactions/actions/edit-anchors/preview.js.map +1 -0
  232. package/dist/interactions/actions/edit-anchors/symmetry.js +11 -0
  233. package/dist/interactions/actions/edit-anchors/symmetry.js.map +1 -0
  234. package/dist/interactions/actions/flip/action.js.map +1 -1
  235. package/dist/interactions/actions/geometryProjection.js.map +1 -1
  236. package/dist/interactions/actions/insert/action.js +37 -30
  237. package/dist/interactions/actions/insert/action.js.map +1 -1
  238. package/dist/interactions/actions/insert/frame.js +9 -2
  239. package/dist/interactions/actions/insert/frame.js.map +1 -1
  240. package/dist/interactions/actions/insert/repositionAction.js +31 -0
  241. package/dist/interactions/actions/insert/repositionAction.js.map +1 -0
  242. package/dist/interactions/actions/lasso-select/action.js +32 -32
  243. package/dist/interactions/actions/move/action.js +29 -25
  244. package/dist/interactions/actions/move/action.js.map +1 -1
  245. package/dist/interactions/actions/move/behaviors/snapToContainer.js +12 -6
  246. package/dist/interactions/actions/move/behaviors/snapToContainer.js.map +1 -1
  247. package/dist/interactions/actions/move/capture.js +32 -23
  248. package/dist/interactions/actions/move/capture.js.map +1 -1
  249. package/dist/interactions/actions/move/frame.js +2 -14
  250. package/dist/interactions/actions/move/frame.js.map +1 -1
  251. package/dist/interactions/actions/move/session.js +1 -1
  252. package/dist/interactions/actions/move/session.js.map +1 -1
  253. package/dist/interactions/actions/move/translate.js.map +1 -1
  254. package/dist/interactions/actions/outlines/createOutlines.js.map +1 -1
  255. package/dist/interactions/actions/outlines/replaceWithPaths.js +13 -13
  256. package/dist/interactions/actions/outlines/replaceWithPaths.js.map +1 -1
  257. package/dist/interactions/actions/outlines/strokeRegion.js.map +1 -1
  258. package/dist/interactions/actions/pathCommands/cutJoin.js +102 -0
  259. package/dist/interactions/actions/pathCommands/cutJoin.js.map +1 -0
  260. package/dist/interactions/actions/pathCommands/livePathEdit.js +64 -0
  261. package/dist/interactions/actions/pathCommands/livePathEdit.js.map +1 -0
  262. package/dist/interactions/actions/pathCommands/pathNodes.js +99 -0
  263. package/dist/interactions/actions/pathCommands/pathNodes.js.map +1 -0
  264. package/dist/interactions/actions/pathCommands/simplifyOffset.js +42 -0
  265. package/dist/interactions/actions/pathCommands/simplifyOffset.js.map +1 -0
  266. package/dist/interactions/actions/resize/action.js +31 -20
  267. package/dist/interactions/actions/resize/action.js.map +1 -1
  268. package/dist/interactions/actions/resize/commit.js.map +1 -1
  269. package/dist/interactions/actions/resize/frame.js +29 -15
  270. package/dist/interactions/actions/resize/frame.js.map +1 -1
  271. package/dist/interactions/actions/resize/replay.js +47 -0
  272. package/dist/interactions/actions/resize/replay.js.map +1 -0
  273. package/dist/interactions/actions/resize/session.js +49 -35
  274. package/dist/interactions/actions/resize/session.js.map +1 -1
  275. package/dist/interactions/actions/resolveOverlays.js +2 -1
  276. package/dist/interactions/actions/resolveOverlays.js.map +1 -1
  277. package/dist/interactions/actions/rotate/action.js +40 -25
  278. package/dist/interactions/actions/rotate/action.js.map +1 -1
  279. package/dist/interactions/actions/rotate/frame.js +1 -1
  280. package/dist/interactions/actions/rotate/frame.js.map +1 -1
  281. package/dist/interactions/actions/rotate/replay.js +22 -0
  282. package/dist/interactions/actions/rotate/replay.js.map +1 -0
  283. package/dist/interactions/actions/rotate/session.js +42 -32
  284. package/dist/interactions/actions/rotate/session.js.map +1 -1
  285. package/dist/interactions/actions/transform-again/action.js +63 -0
  286. package/dist/interactions/actions/transform-again/action.js.map +1 -0
  287. package/dist/interactions/actions/transform-again/memory.js +35 -0
  288. package/dist/interactions/actions/transform-again/memory.js.map +1 -0
  289. package/dist/interactions/actions/useStandardActions.js +101 -83
  290. package/dist/interactions/actions/useStandardActions.js.map +1 -1
  291. package/dist/move.d.ts +4 -4
  292. package/dist/{originProjection-PPT88jZv.d.ts → originProjection-CoNVpITV.d.ts} +1 -1
  293. package/dist/resize.d.ts +3 -3
  294. package/dist/style.css +1 -1
  295. package/dist/tools/builtin/ellipse/useEllipseTool.js +16 -15
  296. package/dist/tools/builtin/ellipse/useEllipseTool.js.map +1 -1
  297. package/dist/tools/builtin/line/useLineTool.js +16 -15
  298. package/dist/tools/builtin/line/useLineTool.js.map +1 -1
  299. package/dist/tools/builtin/pen/usePenTool.js +111 -111
  300. package/dist/tools/builtin/pen/usePenTool.js.map +1 -1
  301. package/dist/tools/builtin/pickTopMostHit.js +11 -14
  302. package/dist/tools/builtin/pickTopMostHit.js.map +1 -1
  303. package/dist/tools/builtin/polygon/usePolygonTool.js +17 -15
  304. package/dist/tools/builtin/polygon/usePolygonTool.js.map +1 -1
  305. package/dist/tools/builtin/rect/useRectTool.js +15 -14
  306. package/dist/tools/builtin/rect/useRectTool.js.map +1 -1
  307. package/dist/tools/builtin/select/adapterPointQuery.js +22 -18
  308. package/dist/tools/builtin/select/adapterPointQuery.js.map +1 -1
  309. package/dist/tools/builtin/select/selectionContributions.js +1 -1
  310. package/dist/tools/builtin/select/selectionContributions.js.map +1 -1
  311. package/dist/tools/builtin/select/useSelectTool.js +2 -1
  312. package/dist/tools/builtin/select/useSelectTool.js.map +1 -1
  313. package/dist/tools/builtin/slice/useSliceTool.js +42 -40
  314. package/dist/tools/builtin/slice/useSliceTool.js.map +1 -1
  315. package/dist/tools/builtin/star/useStarTool.js +18 -16
  316. package/dist/tools/builtin/star/useStarTool.js.map +1 -1
  317. package/dist/tools/builtin/text/useTextTool.js +2 -2
  318. package/dist/tools/builtin/text/useTextTool.js.map +1 -1
  319. package/dist/{types-CIKDwlsP.d.ts → types-DBbbCy0i.d.ts} +22 -15
  320. package/dist/version.js +1 -1
  321. package/package.json +22 -22
  322. package/dist/canvas/surface.module.js +0 -6
  323. package/dist/canvas/surface.module.js.map +0 -1
  324. package/dist/canvas/surfaceBox.js +0 -16
  325. package/dist/canvas/surfaceBox.js.map +0 -1
  326. package/dist/layout/arrivals.js +0 -33
  327. package/dist/layout/arrivals.js.map +0 -1
@@ -1,4 +1,4 @@
1
- import { M as MoveBehavior } from './clone-2a5hVbBd.js';
1
+ import { M as MoveBehavior } from './clone-C0eADtS0.js';
2
2
 
3
3
  /** Option surface for the `move` action. */
4
4
 
package/dist/resize.d.ts CHANGED
@@ -1,10 +1,10 @@
1
- export { C as CORNER_ANCHORS, a as CornerAnchor, b as CornerHandle, U as UseResizeOptions, c as cornerPoint, d as cornerResizeHandles, f as fixedCornerOf, h as hitCornerHandle } from './cornerHandles-BEshc4z3.js';
1
+ export { C as CORNER_ANCHORS, a as CornerAnchor, b as CornerHandle, U as UseResizeOptions, c as cornerPoint, d as cornerResizeHandles, f as fixedCornerOf, h as hitCornerHandle } from './cornerHandles-BSKbyuvQ.js';
2
2
  export { P as PoseDescriptor, R as RECT_POSE_DESCRIPTOR, a as ROTATED_POSE_DESCRIPTOR, p as poseDescriptorForNode } from './poseDescriptor-Bqk-11Rl.js';
3
- import { B as BoundsConstraint } from './clone-2a5hVbBd.js';
3
+ import { B as BoundsConstraint } from './clone-C0eADtS0.js';
4
4
  import { Bounds, ModifierState } from '@weasel-js/routing';
5
5
  export { A as AUTO_POSE_DESCRIPTOR, i as isPathLike, a as isRectPose } from './autoPoseDescriptor-DHg5KqaJ.js';
6
6
  import '@weasel-js/animator';
7
- import './types-CIKDwlsP.js';
7
+ import './types-DBbbCy0i.js';
8
8
  import '@weasel-js/history';
9
9
  import '@weasel-js/geom';
10
10
 
package/dist/style.css CHANGED
@@ -1,2 +1,2 @@
1
- :where(._surface_c2e145){width:var(--wzl-surface-width);height:var(--wzl-surface-height)}._numeric_25fd0b{font-family:var(--wzl-font-numeric);font-variant-numeric:tabular-nums}._hud_4467cb{z-index:var(--wzl-z-hud,900);color:#e8e8e8;padding:var(--wzl-space-3,6px) var(--wzl-space-4,8px);pointer-events:none;text-align:right;background:#000000b3;border-radius:4px;font:11px/1.4 ui-monospace,SFMono-Regular,Menlo,monospace;position:fixed}._sized_4467cb{min-width:120px;max-width:260px}._readings_4467cb{column-gap:var(--wzl-space-4,8px);grid-template-columns:auto auto;margin:0;display:grid}._readings_4467cb dt{text-align:left}._readings_4467cb dd{white-space:nowrap;margin:0}._muted_4467cb{color:#888}._absent_4467cb{color:#888;font-style:italic}._header_4467cb{margin-bottom:var(--wzl-space-1,2px)}._list_4467cb{flex-direction:column;gap:1px;margin:0;padding:0;list-style:none;display:flex}._item_4467cb{white-space:nowrap;text-overflow:ellipsis;overflow:hidden}._itemBest_4467cb{font-weight:700}._row_4467cb{gap:var(--wzl-space-4,8px);white-space:nowrap;justify-content:flex-end;display:flex}._stack_4467cb{flex-direction:column;align-items:flex-end;display:flex}
1
+ ._numeric_25fd0b{font-family:var(--wzl-font-numeric);font-variant-numeric:tabular-nums}._hud_4467cb{z-index:var(--wzl-z-hud,900);color:#e8e8e8;padding:var(--wzl-space-3,6px) var(--wzl-space-4,8px);pointer-events:none;text-align:right;background:#000000b3;border-radius:4px;font:11px/1.4 ui-monospace,SFMono-Regular,Menlo,monospace;position:fixed}._sized_4467cb{min-width:120px;max-width:260px}._readings_4467cb{column-gap:var(--wzl-space-4,8px);grid-template-columns:auto auto;margin:0;display:grid}._readings_4467cb dt{text-align:left}._readings_4467cb dd{white-space:nowrap;margin:0}._muted_4467cb{color:#888}._absent_4467cb{color:#888;font-style:italic}._header_4467cb{margin-bottom:var(--wzl-space-1,2px)}._list_4467cb{flex-direction:column;gap:1px;margin:0;padding:0;list-style:none;display:flex}._item_4467cb{white-space:nowrap;text-overflow:ellipsis;overflow:hidden}._itemBest_4467cb{font-weight:700}._row_4467cb{gap:var(--wzl-space-4,8px);white-space:nowrap;justify-content:flex-end;display:flex}._stack_4467cb{flex-direction:column;align-items:flex-end;display:flex}
2
2
  /*$vite$:1*/
@@ -1,34 +1,35 @@
1
- import { defineTool as e } from "../../overlayBinding.js";
2
- import t from "../../../icons/EllipseIcon.js";
3
- import { insertBindingBehaviors as n } from "../shared/insertToolOptions.js";
4
- import { useMemo as r } from "react";
5
- import { jsx as i } from "react/jsx-runtime";
6
- import { cursorFor as a } from "@weasel-js/cursor";
1
+ import { INSERT_REPOSITION_BINDING as e } from "../../../interactions/actions/insert/repositionAction.js";
2
+ import { defineTool as t } from "../../overlayBinding.js";
3
+ import n from "../../../icons/EllipseIcon.js";
4
+ import { insertBindingBehaviors as r } from "../shared/insertToolOptions.js";
5
+ import { useMemo as i } from "react";
6
+ import { jsx as a } from "react/jsx-runtime";
7
+ import { cursorFor as o } from "@weasel-js/cursor";
7
8
  //#region src/tools/builtin/ellipse/useEllipseTool.tsx
8
- function o(o = {}) {
9
- let { behaviors: s } = o;
10
- return r(() => e({
9
+ function s(s = {}) {
10
+ let { behaviors: c } = s;
11
+ return i(() => t({
11
12
  id: "ellipse",
12
13
  keybinding: { key: "E" },
13
14
  capabilities: ["creates-shapes"],
14
15
  hookName: "useEllipseTool",
15
- cursor: a("crosshairEllipse", { fallback: "crosshair" }),
16
+ cursor: o("crosshairEllipse", { fallback: "crosshair" }),
16
17
  presentation: {
17
18
  label: "Ellipse",
18
19
  group: "shape",
19
- icon: /* @__PURE__ */ i(t, {})
20
+ icon: /* @__PURE__ */ a(n, {})
20
21
  },
21
22
  bindings: [{
22
23
  spec: { kind: "drag" },
23
24
  actionId: "insert",
24
25
  opts: {
25
26
  params: { kind: "ellipse" },
26
- ...n(s)
27
+ ...r(c)
27
28
  }
28
- }]
29
- }), [s]);
29
+ }, e]
30
+ }), [c]);
30
31
  }
31
32
  //#endregion
32
- export { o as useEllipseTool };
33
+ export { s as useEllipseTool };
33
34
 
34
35
  //# sourceMappingURL=useEllipseTool.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"useEllipseTool.js","names":["EllipseIcon","useEllipseTool","options","useMemo","defineTool","cursorFor","insertBindingBehaviors","behaviors"],"sources":["../../../../src/tools/builtin/ellipse/useEllipseTool.tsx"],"sourcesContent":["import { useMemo } from 'react';\nimport { defineTool } from '../../overlayBinding';\nimport { EllipseIcon } from '../../../icons';\nimport type { Tool } from '../../overlayBinding';\nimport { insertBindingBehaviors, type InsertToolOptions } from '../shared/insertToolOptions';\nimport { cursorFor } from '@weasel-js/cursor';\n\n/**\n * Drag-to-draw ellipse tool. Mirrors `useRectTool`: the `drag` binding\n * routes to `insertAction`, which owns the live preview and commits\n * through the `insert` dep. Alt toggles from-corner ⇄ from-center\n * mid-drag via the action's live modifier read.\n */\nexport function useEllipseTool(options: InsertToolOptions = {}): Tool {\n const { behaviors } = options;\n return useMemo(\n () =>\n defineTool({\n id: 'ellipse',\n keybinding: { key: 'E' },\n capabilities: ['creates-shapes'],\n hookName: 'useEllipseTool',\n cursor: cursorFor('crosshairEllipse', { fallback: 'crosshair' }),\n presentation: {\n label: 'Ellipse',\n group: 'shape',\n icon: <EllipseIcon />,\n },\n bindings: [\n {\n spec: { kind: 'drag' },\n actionId: 'insert',\n opts: { params: { kind: 'ellipse' } , ...insertBindingBehaviors(behaviors) },\n },\n ],\n }),\n [behaviors],\n );\n}\n"],"mappings":";;;;;;;AAaA,SAAgBC,EAAe,IAA6B,CAAC,GAAS;CACpE,IAAM,EAAE,iBAAcC;CACtB,OAAOC,QAEHC,EAAW;EACT,IAAI;EACJ,YAAY,EAAE,KAAK,IAAI;EACvB,cAAc,CAAC,gBAAgB;EAC/B,UAAU;EACV,QAAQC,EAAU,oBAAoB,EAAE,UAAU,YAAY,CAAC;EAC/D,cAAc;GACZ,OAAO;GACP,OAAO;GACP,MAAM,kBAACL,GAAD,CAAc,CAAA;EACtB;EACA,UAAU,CACR;GACE,MAAM,EAAE,MAAM,OAAO;GACrB,UAAU;GACV,MAAM;IAAE,QAAQ,EAAE,MAAM,UAAU;IAAI,GAAGM,EAAuBC,CAAS;GAAE;EAC7E,CACF;CACF,CAAC,GACH,CAACA,CAAS,CACZ;AACF"}
1
+ {"version":3,"file":"useEllipseTool.js","names":["EllipseIcon","useEllipseTool","options","useMemo","defineTool","cursorFor","insertBindingBehaviors","behaviors","INSERT_REPOSITION_BINDING"],"sources":["../../../../src/tools/builtin/ellipse/useEllipseTool.tsx"],"sourcesContent":["import { useMemo } from 'react';\nimport { defineTool } from '../../overlayBinding';\nimport { EllipseIcon } from '../../../icons';\nimport type { Tool } from '../../overlayBinding';\nimport { INSERT_REPOSITION_BINDING } from 'interactions/actions/insert/repositionAction';\nimport { insertBindingBehaviors, type InsertToolOptions } from '../shared/insertToolOptions';\nimport { cursorFor } from '@weasel-js/cursor';\n\n/**\n * Drag-to-draw ellipse tool. Mirrors `useRectTool`: the `drag` binding\n * routes to `insertAction`, which owns the live preview and commits\n * through the `insert` dep. Alt toggles from-corner ⇄ from-center\n * mid-drag via the action's live modifier read.\n */\nexport function useEllipseTool(options: InsertToolOptions = {}): Tool {\n const { behaviors } = options;\n return useMemo(\n () =>\n defineTool({\n id: 'ellipse',\n keybinding: { key: 'E' },\n capabilities: ['creates-shapes'],\n hookName: 'useEllipseTool',\n cursor: cursorFor('crosshairEllipse', { fallback: 'crosshair' }),\n presentation: {\n label: 'Ellipse',\n group: 'shape',\n icon: <EllipseIcon />,\n },\n bindings: [\n {\n spec: { kind: 'drag' },\n actionId: 'insert',\n opts: { params: { kind: 'ellipse' } , ...insertBindingBehaviors(behaviors) },\n },\n INSERT_REPOSITION_BINDING,\n ],\n }),\n [behaviors],\n );\n}\n"],"mappings":";;;;;;;;AAcA,SAAgBC,EAAe,IAA6B,CAAC,GAAS;CACpE,IAAM,EAAE,iBAAcC;CACtB,OAAOC,QAEHC,EAAW;EACT,IAAI;EACJ,YAAY,EAAE,KAAK,IAAI;EACvB,cAAc,CAAC,gBAAgB;EAC/B,UAAU;EACV,QAAQC,EAAU,oBAAoB,EAAE,UAAU,YAAY,CAAC;EAC/D,cAAc;GACZ,OAAO;GACP,OAAO;GACP,MAAM,kBAACL,GAAD,CAAc,CAAA;EACtB;EACA,UAAU,CACR;GACE,MAAM,EAAE,MAAM,OAAO;GACrB,UAAU;GACV,MAAM;IAAE,QAAQ,EAAE,MAAM,UAAU;IAAI,GAAGM,EAAuBC,CAAS;GAAE;EAC7E,GACAC,CACF;CACF,CAAC,GACH,CAACD,CAAS,CACZ;AACF"}
@@ -1,34 +1,35 @@
1
- import { defineTool as e } from "../../overlayBinding.js";
2
- import t from "../../../icons/LineIcon.js";
3
- import { insertBindingBehaviors as n } from "../shared/insertToolOptions.js";
4
- import { useMemo as r } from "react";
5
- import { jsx as i } from "react/jsx-runtime";
6
- import { cursorFor as a } from "@weasel-js/cursor";
1
+ import { INSERT_REPOSITION_BINDING as e } from "../../../interactions/actions/insert/repositionAction.js";
2
+ import { defineTool as t } from "../../overlayBinding.js";
3
+ import n from "../../../icons/LineIcon.js";
4
+ import { insertBindingBehaviors as r } from "../shared/insertToolOptions.js";
5
+ import { useMemo as i } from "react";
6
+ import { jsx as a } from "react/jsx-runtime";
7
+ import { cursorFor as o } from "@weasel-js/cursor";
7
8
  //#region src/tools/builtin/line/useLineTool.tsx
8
- function o(o = {}) {
9
- let { behaviors: s } = o;
10
- return r(() => e({
9
+ function s(s = {}) {
10
+ let { behaviors: c } = s;
11
+ return i(() => t({
11
12
  id: "line",
12
13
  keybinding: { key: "\\" },
13
14
  capabilities: ["creates-shapes"],
14
15
  hookName: "useLineTool",
15
- cursor: a("crosshairLine", { fallback: "crosshair" }),
16
+ cursor: o("crosshairLine", { fallback: "crosshair" }),
16
17
  presentation: {
17
18
  label: "Line",
18
19
  group: "shape",
19
- icon: /* @__PURE__ */ i(t, {})
20
+ icon: /* @__PURE__ */ a(n, {})
20
21
  },
21
22
  bindings: [{
22
23
  spec: { kind: "drag" },
23
24
  actionId: "insert",
24
25
  opts: {
25
26
  params: { kind: "line" },
26
- ...n(s)
27
+ ...r(c)
27
28
  }
28
- }]
29
- }), [s]);
29
+ }, e]
30
+ }), [c]);
30
31
  }
31
32
  //#endregion
32
- export { o as useLineTool };
33
+ export { s as useLineTool };
33
34
 
34
35
  //# sourceMappingURL=useLineTool.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"useLineTool.js","names":["LineIcon","useLineTool","options","useMemo","defineTool","cursorFor","insertBindingBehaviors","behaviors"],"sources":["../../../../src/tools/builtin/line/useLineTool.tsx"],"sourcesContent":["import { useMemo } from 'react';\nimport { defineTool } from '../../overlayBinding';\nimport { LineIcon } from '../../../icons';\nimport type { Tool } from '../../overlayBinding';\nimport { insertBindingBehaviors, type InsertToolOptions } from '../shared/insertToolOptions';\nimport { cursorFor } from '@weasel-js/cursor';\n\n/** An endpoint of a line, in world coordinates. */\nexport interface LinePoint { x: number; y: number }\n\n/**\n * Drag-to-draw line tool. The `drag` binding routes to `insertAction`, which\n * commits through the `insert` dep with `{ kind: 'line', a, b }` endpoints\n * (not the AABB diagonal), so the drag direction is preserved.\n *\n * Shift constrains to 15° increments; alt mirrors the end around the start\n * (the drag is treated as a half-line).\n */\nexport function useLineTool(options: InsertToolOptions = {}): Tool {\n const { behaviors } = options;\n return useMemo(\n () =>\n defineTool({\n id: 'line',\n keybinding: { key: '\\\\' },\n capabilities: ['creates-shapes'],\n hookName: 'useLineTool',\n cursor: cursorFor('crosshairLine', { fallback: 'crosshair' }),\n presentation: {\n label: 'Line',\n group: 'shape',\n icon: <LineIcon />,\n },\n bindings: [\n {\n spec: { kind: 'drag' },\n actionId: 'insert',\n opts: { params: { kind: 'line' } , ...insertBindingBehaviors(behaviors) },\n },\n ],\n }),\n [behaviors],\n );\n}\n"],"mappings":";;;;;;;AAkBA,SAAgBC,EAAY,IAA6B,CAAC,GAAS;CACjE,IAAM,EAAE,iBAAcC;CACtB,OAAOC,QAEHC,EAAW;EACT,IAAI;EACJ,YAAY,EAAE,KAAK,KAAK;EACxB,cAAc,CAAC,gBAAgB;EAC/B,UAAU;EACV,QAAQC,EAAU,iBAAiB,EAAE,UAAU,YAAY,CAAC;EAC5D,cAAc;GACZ,OAAO;GACP,OAAO;GACP,MAAM,kBAACL,GAAD,CAAW,CAAA;EACnB;EACA,UAAU,CACR;GACE,MAAM,EAAE,MAAM,OAAO;GACrB,UAAU;GACV,MAAM;IAAE,QAAQ,EAAE,MAAM,OAAO;IAAI,GAAGM,EAAuBC,CAAS;GAAE;EAC1E,CACF;CACF,CAAC,GACH,CAACA,CAAS,CACZ;AACF"}
1
+ {"version":3,"file":"useLineTool.js","names":["LineIcon","useLineTool","options","useMemo","defineTool","cursorFor","insertBindingBehaviors","behaviors","INSERT_REPOSITION_BINDING"],"sources":["../../../../src/tools/builtin/line/useLineTool.tsx"],"sourcesContent":["import { useMemo } from 'react';\nimport { defineTool } from '../../overlayBinding';\nimport { LineIcon } from '../../../icons';\nimport type { Tool } from '../../overlayBinding';\nimport { INSERT_REPOSITION_BINDING } from 'interactions/actions/insert/repositionAction';\nimport { insertBindingBehaviors, type InsertToolOptions } from '../shared/insertToolOptions';\nimport { cursorFor } from '@weasel-js/cursor';\n\n/** An endpoint of a line, in world coordinates. */\nexport interface LinePoint { x: number; y: number }\n\n/**\n * Drag-to-draw line tool. The `drag` binding routes to `insertAction`, which\n * commits through the `insert` dep with `{ kind: 'line', a, b }` endpoints\n * (not the AABB diagonal), so the drag direction is preserved.\n *\n * Shift constrains to 15° increments; alt mirrors the end around the start\n * (the drag is treated as a half-line).\n */\nexport function useLineTool(options: InsertToolOptions = {}): Tool {\n const { behaviors } = options;\n return useMemo(\n () =>\n defineTool({\n id: 'line',\n keybinding: { key: '\\\\' },\n capabilities: ['creates-shapes'],\n hookName: 'useLineTool',\n cursor: cursorFor('crosshairLine', { fallback: 'crosshair' }),\n presentation: {\n label: 'Line',\n group: 'shape',\n icon: <LineIcon />,\n },\n bindings: [\n {\n spec: { kind: 'drag' },\n actionId: 'insert',\n opts: { params: { kind: 'line' } , ...insertBindingBehaviors(behaviors) },\n },\n INSERT_REPOSITION_BINDING,\n ],\n }),\n [behaviors],\n );\n}\n"],"mappings":";;;;;;;;AAmBA,SAAgBC,EAAY,IAA6B,CAAC,GAAS;CACjE,IAAM,EAAE,iBAAcC;CACtB,OAAOC,QAEHC,EAAW;EACT,IAAI;EACJ,YAAY,EAAE,KAAK,KAAK;EACxB,cAAc,CAAC,gBAAgB;EAC/B,UAAU;EACV,QAAQC,EAAU,iBAAiB,EAAE,UAAU,YAAY,CAAC;EAC5D,cAAc;GACZ,OAAO;GACP,OAAO;GACP,MAAM,kBAACL,GAAD,CAAW,CAAA;EACnB;EACA,UAAU,CACR;GACE,MAAM,EAAE,MAAM,OAAO;GACrB,UAAU;GACV,MAAM;IAAE,QAAQ,EAAE,MAAM,OAAO;IAAI,GAAGM,EAAuBC,CAAS;GAAE;EAC1E,GACAC,CACF;CACF,CAAC,GACH,CAACD,CAAS,CACZ;AACF"}
@@ -6,13 +6,13 @@ import i from "../../../icons/PenIcon.js";
6
6
  import { createPenPreviewLayer as a } from "../../../features/paths/penPreviewLayer.js";
7
7
  import { constrainTo45 as o } from "../../../util/constrainTo45.js";
8
8
  import { createPointerFollower as s } from "../shared/pointerFollower.js";
9
- import { anchorsToPath as c, boundsOfPath as l, nearestPathAnchor as u, pathToAnchors as d, pxExtent as f, reverseAnchors as p, withinPxRadius as m } from "@weasel-js/geom";
10
- import { createElement as h, useCallback as g, useMemo as _, useReducer as v, useRef as y, useState as b } from "react";
11
- import { useLatest as x } from "@weasel-js/react";
12
- import { ActionDisabledReason as S } from "@weasel-js/routing";
13
- import { cursorFor as C } from "@weasel-js/cursor";
9
+ import { anchorsToPath as c, boundsOfPath as l, editAnchorSetTracked as u, nearestPathAnchor as d, pathToAnchors as f, pxExtent as p, reverseAnchors as m, withinPxRadius as h } from "@weasel-js/geom";
10
+ import { createElement as g, useCallback as _, useMemo as v, useReducer as y, useRef as b, useState as x } from "react";
11
+ import { useLatest as S } from "@weasel-js/react";
12
+ import { ActionDisabledReason as C } from "@weasel-js/routing";
13
+ import { cursorFor as w } from "@weasel-js/cursor";
14
14
  //#region src/tools/builtin/pen/usePenTool.ts
15
- function w() {
15
+ function T() {
16
16
  return {
17
17
  finishedSubpaths: [],
18
18
  current: null,
@@ -22,96 +22,96 @@ function w() {
22
22
  continuing: null
23
23
  };
24
24
  }
25
- function T(e) {
25
+ function E(e) {
26
26
  e.finishedSubpaths = [], e.current = null, e.cursor = null, e.draggingHandleAt = null, e.closeHintActive = !1, e.continuing = null;
27
27
  }
28
- function E(e) {
28
+ function D(e) {
29
29
  return (e.current ? e.current.anchors.length : 0) + e.finishedSubpaths.reduce((e, t) => e + t.anchors.length, 0);
30
30
  }
31
- function D(e, t) {
31
+ function O(e, t) {
32
32
  let n = [...e];
33
33
  return t && t.anchors.length > 0 && n.push(t), c(n.map((e) => e.anchors), n.map((e) => e.closed));
34
34
  }
35
- function O(o = {}) {
36
- let { autoSelect: f = !0, autoCommitOnClose: O = !0, closeHitRadius: N = 8, anchorSnapRadius: P = 8, snapPoint: F } = o, I = y(null);
37
- I.current === null && (I.current = w());
38
- let L = x({
39
- autoSelect: f,
40
- autoCommitOnClose: O,
41
- closeHitRadius: N,
42
- anchorSnapRadius: P,
43
- snapPoint: F
44
- }), [, R] = v((e) => e + 1, 0), [z] = b(() => a({ state: I.current })), B = g((t, n, r) => {
35
+ function k(o = {}) {
36
+ let { autoSelect: p = !0, autoCommitOnClose: k = !0, closeHitRadius: P = 8, anchorSnapRadius: F = 8, snapPoint: I } = o, L = b(null);
37
+ L.current === null && (L.current = T());
38
+ let R = S({
39
+ autoSelect: p,
40
+ autoCommitOnClose: k,
41
+ closeHitRadius: P,
42
+ anchorSnapRadius: F,
43
+ snapPoint: I
44
+ }), [, z] = y((e) => e + 1, 0), [B] = x(() => a({ state: L.current })), V = _((t, n, r) => {
45
45
  let i = r.editAnchors, a = t.continuing, o = [...t.finishedSubpaths, ...n ? [n] : []];
46
46
  if (!i || o.length === 0) return;
47
- let { anchors: s, closed: l } = d(D(o, null));
48
- a.reversed && (s[0] = p(s[0]));
49
- let u = d(a.original);
50
- u.anchors.splice(a.sub, 1, s[0]), u.closed.splice(a.sub, 1, l[0]), u.anchors.push(...s.slice(1)), u.closed.push(...l.slice(1));
51
- let f = c(u.anchors, u.closed, a.original);
52
- M(f, a.original) || (i.applyEdit(a.id, f, "Continue path"), L.current.autoSelect && r.selection?.set([e(a.id)]));
53
- }, [L]), V = g((e, t) => {
47
+ let { anchors: s, closed: c } = f(O(o, null));
48
+ a.reversed && (s[0] = m(s[0]));
49
+ let l = u(a.original, (e) => {
50
+ e.anchors.splice(a.sub, 1, s[0]), e.closed.splice(a.sub, 1, c[0]), e.anchors.push(...s.slice(1)), e.closed.push(...c.slice(1));
51
+ });
52
+ N(l.path, a.original) || (i.applyEdit(a.id, l.path, "Continue path", l.origins), R.current.autoSelect && r.selection?.set([e(a.id)]));
53
+ }, [R]), H = _((e, t) => {
54
54
  let n = e.current && e.current.anchors.length > 0 ? e.current : null;
55
55
  if (e.continuing) {
56
- B(e, n, t), T(e);
56
+ V(e, n, t), E(e);
57
57
  return;
58
58
  }
59
59
  let r = n && n.anchors.length >= 2 ? n : null;
60
60
  if (e.finishedSubpaths.length === 0 && !r) {
61
- T(e);
61
+ E(e);
62
62
  return;
63
63
  }
64
- let i = e.finishedSubpaths.every((e) => e.closed) && (r === null || r.closed), a = D(e.finishedSubpaths, r), o = t.insert?.commit(l(a), {
64
+ let i = e.finishedSubpaths.every((e) => e.closed) && (r === null || r.closed), a = O(e.finishedSubpaths, r), o = t.insert?.commit(l(a), {
65
65
  kind: "path",
66
66
  path: a,
67
67
  closed: i
68
68
  }) ?? null;
69
- o !== null && L.current.autoSelect && t.selection?.set([o]), T(e);
70
- }, [B, L]), H = g((e, t, n) => {
69
+ o !== null && R.current.autoSelect && t.selection?.set([o]), E(e);
70
+ }, [V, R]), U = _((e, t, n) => {
71
71
  if (!n || n.end === null || !e.current || e.current.anchors.length === 0) return !1;
72
72
  let r = e.continuing;
73
73
  if (r && n.id === r.id && n.sub === r.sub) return !1;
74
74
  let i = t.scene;
75
75
  return !i && !t.applyOps || !(r ? t.editAnchors?.editOps : t.insert?.build) ? !1 : r?.id === n.id || i?.get(n.id) !== void 0;
76
- }, []), U = g((r, i, a) => {
77
- let o = i.editAnchors, s = i.scene, u = r.current, { anchors: f, closed: m } = d(D([...r.finishedSubpaths, u], null)), h = o.getEditablePath(a.id), g = d(h), _ = a.end === "last" ? p(g.anchors[a.sub]) : g.anchors[a.sub], v = f[f.length - 1], y = v[v.length - 1], b = u.anchors[u.anchors.length - 1].outHandle ?? _[0].outHandle;
78
- b && (y.outHandle = { ...b }), v.push(..._.slice(1));
79
- let x = r.continuing, S = x?.id === a.id, C = S ? {
76
+ }, []), W = _((r, i, a) => {
77
+ let o = i.editAnchors, s = i.scene, d = r.current, { anchors: p, closed: h } = f(O([...r.finishedSubpaths, d], null)), g = o.getEditablePath(a.id), _ = f(g), v = a.end === "last" ? m(_.anchors[a.sub]) : _.anchors[a.sub], y = p[p.length - 1], b = y[y.length - 1], x = d.anchors[d.anchors.length - 1].outHandle ?? v[0].outHandle;
78
+ x && (b.outHandle = { ...x }), y.push(...v.slice(1));
79
+ let S = r.continuing, C = S?.id === a.id, w = C ? {
80
80
  anchors: [],
81
81
  closed: []
82
82
  } : {
83
- anchors: g.anchors.filter((e, t) => t !== a.sub),
84
- closed: g.closed.filter((e, t) => t !== a.sub)
85
- }, w = "Join paths", E = [], O;
86
- if (x) {
87
- x.reversed && (f[0] = p(f[0]));
88
- let e = d(x.original);
89
- e.anchors.splice(x.sub, 1, f[0]), e.closed.splice(x.sub, 1, m[0]), e.anchors.push(...f.slice(1), ...C.anchors), e.closed.push(...m.slice(1), ...C.closed), S && (e.anchors.splice(a.sub, 1), e.closed.splice(a.sub, 1));
90
- let t = c(e.anchors, e.closed, x.original);
91
- E.push(...o.editOps(x.id, t, w)), O = x.id;
83
+ anchors: _.anchors.filter((e, t) => t !== a.sub),
84
+ closed: _.closed.filter((e, t) => t !== a.sub)
85
+ }, T = "Join paths", D = [], k;
86
+ if (S) {
87
+ S.reversed && (p[0] = m(p[0]));
88
+ let e = u(S.original, (e) => {
89
+ e.anchors.splice(S.sub, 1, p[0]), e.closed.splice(S.sub, 1, h[0]), e.anchors.push(...p.slice(1), ...w.anchors), e.closed.push(...h.slice(1), ...w.closed), C && (e.anchors.splice(a.sub, 1), e.closed.splice(a.sub, 1));
90
+ });
91
+ D.push(...o.editOps(S.id, e.path, T, e.origins)), k = S.id;
92
92
  } else {
93
- let e = c([...f, ...C.anchors], [...m, ...C.closed]), t = i.insert.build(l(e), {
93
+ let e = c([...p, ...w.anchors], [...h, ...w.closed]), t = i.insert.build(l(e), {
94
94
  kind: "path",
95
95
  path: e,
96
96
  closed: !1
97
97
  });
98
98
  if (t === null) return;
99
- E.push(...t.ops), O = t.id;
99
+ D.push(...t.ops), k = t.id;
100
100
  }
101
- S || E.push(n({ node: s.get(a.id) }));
102
- let k = i.applyOps;
103
- k ? k(E, w) : s.applyBatch(E, w, t(s)), L.current.autoSelect && i.selection?.set([e(O)]), T(r);
104
- }, [L]), W = g((e, t, n) => {
105
- let r = I.current;
101
+ C || D.push(n({ node: s.get(a.id) }));
102
+ let A = i.applyOps;
103
+ A ? A(D, T) : s.applyBatch(D, T, t(s)), R.current.autoSelect && i.selection?.set([e(k)]), E(r);
104
+ }, [R]), G = _((e, t, n) => {
105
+ let r = L.current;
106
106
  if (r.current || r.finishedSubpaths.length > 0) return !1;
107
- let i = L.current.closeHitRadius, a = A(e), o = u(j(e, t, n, i), {
107
+ let i = R.current.closeHitRadius, a = j(e), o = d(M(e, t, n, i), {
108
108
  x: t,
109
109
  y: n
110
110
  }, i, a, (e) => e.end !== null);
111
111
  if (!o) return !1;
112
- let s = e.editAnchors.getEditablePath(o.id), c = d(s).anchors[o.sub], l = o.end === "first" && c.length > 1;
112
+ let s = e.editAnchors.getEditablePath(o.id), c = f(s).anchors[o.sub], l = o.end === "first" && c.length > 1;
113
113
  return r.current = {
114
- anchors: l ? p(c) : c,
114
+ anchors: l ? m(c) : c,
115
115
  closed: !1
116
116
  }, r.continuing = {
117
117
  id: o.id,
@@ -119,8 +119,8 @@ function O(o = {}) {
119
119
  reversed: l,
120
120
  original: s
121
121
  }, !0;
122
- }, [L]), G = g((e, t) => {
123
- let n = L.current.snapPoint;
122
+ }, [R]), K = _((e, t) => {
123
+ let n = R.current.snapPoint;
124
124
  return n ? n({
125
125
  x: e,
126
126
  y: t
@@ -128,13 +128,13 @@ function O(o = {}) {
128
128
  x: e,
129
129
  y: t
130
130
  };
131
- }, [L]), K = g((e, t, n) => {
132
- let r = L.current.anchorSnapRadius;
131
+ }, [R]), q = _((e, t, n) => {
132
+ let r = R.current.anchorSnapRadius;
133
133
  if (r > 0) {
134
- let i = u(j(e, t, n, r), {
134
+ let i = d(M(e, t, n, r), {
135
135
  x: t,
136
136
  y: n
137
- }, r, A(e));
137
+ }, r, j(e));
138
138
  if (i) return {
139
139
  x: i.x,
140
140
  y: i.y,
@@ -142,20 +142,20 @@ function O(o = {}) {
142
142
  };
143
143
  }
144
144
  return {
145
- ...G(t, n),
145
+ ...K(t, n),
146
146
  hit: null
147
147
  };
148
- }, [G, L]), q = g((e, t, n, r, i) => m(t - r, n - i, L.current.closeHitRadius, A(e)), [L]), J = _(() => {
148
+ }, [K, R]), J = _((e, t, n, r, i) => h(t - r, n - i, R.current.closeHitRadius, j(e)), [R]), Y = v(() => {
149
149
  let e, t = s(() => n()), n = () => {
150
- let n = I.current;
150
+ let n = L.current;
151
151
  !n.current && n.finishedSubpaths.length === 0 && t.unfollow();
152
152
  let r = n.current ? t.pointer()?.get() ?? null : null;
153
- n.cursor = r ? G(r.worldX, r.worldY) : null;
153
+ n.cursor = r ? K(r.worldX, r.worldY) : null;
154
154
  let i = n.current && n.current.anchors.length >= 3 ? n.current.anchors[0] : null;
155
- n.closeHintActive = i !== null && n.cursor !== null && m(i.x - n.cursor.x, i.y - n.cursor.y, L.current.closeHitRadius, e?.get().scale ?? {
155
+ n.closeHintActive = i !== null && n.cursor !== null && h(i.x - n.cursor.x, i.y - n.cursor.y, R.current.closeHitRadius, e?.get().scale ?? {
156
156
  x: 1,
157
157
  y: 1
158
- }), R();
158
+ }), z();
159
159
  };
160
160
  return {
161
161
  refresh: n,
@@ -163,11 +163,11 @@ function O(o = {}) {
163
163
  e = r.view, t.follow(r.pointer), n();
164
164
  },
165
165
  stop() {
166
- t.unfollow(), R();
166
+ t.unfollow(), z();
167
167
  }
168
168
  };
169
- }, [G, L]), Y = _(() => {
170
- let e = () => I.current;
169
+ }, [K, R]), X = v(() => {
170
+ let e = () => L.current;
171
171
  return [
172
172
  {
173
173
  id: "pen.placeAnchor",
@@ -188,26 +188,26 @@ function O(o = {}) {
188
188
  run: (t, n) => {
189
189
  let r = n;
190
190
  if (r?.pressX === void 0 || r.pressY === void 0) return;
191
- if (W(t, r.pressX, r.pressY)) {
192
- J.update(t);
191
+ if (G(t, r.pressX, r.pressY)) {
192
+ Y.update(t);
193
193
  return;
194
194
  }
195
- let { x: i, y: a, hit: o } = K(t, r.pressX, r.pressY), s = e();
195
+ let { x: i, y: a, hit: o } = q(t, r.pressX, r.pressY), s = e();
196
196
  if (s.current && s.current.anchors.length >= 3) {
197
197
  let e = s.current.anchors[0];
198
- if (q(t, e.x, e.y, i, a)) {
199
- s.current.closed = !0, s.finishedSubpaths.push(s.current), s.current = null, s.closeHintActive = !1, L.current.autoCommitOnClose && V(s, t), J.update(t);
198
+ if (J(t, e.x, e.y, i, a)) {
199
+ s.current.closed = !0, s.finishedSubpaths.push(s.current), s.current = null, s.closeHintActive = !1, R.current.autoCommitOnClose && H(s, t), Y.update(t);
200
200
  return;
201
201
  }
202
202
  }
203
- let c = H(s, t, o);
203
+ let c = U(s, t, o);
204
204
  s.current ||= {
205
205
  anchors: [],
206
206
  closed: !1
207
207
  }, s.current.anchors.push({
208
208
  x: i,
209
209
  y: a
210
- }), c && U(s, t, o), J.update(t);
210
+ }), c && W(s, t, o), Y.update(t);
211
211
  }
212
212
  }
213
213
  },
@@ -220,12 +220,12 @@ function O(o = {}) {
220
220
  "insert",
221
221
  "selection"
222
222
  ],
223
- enabled: () => E(e()) >= 2 || S.NotApplicable,
223
+ enabled: () => D(e()) >= 2 || C.NotApplicable,
224
224
  invoker: {
225
225
  timing: "immediate",
226
226
  run: (t, n) => {
227
227
  let r = e();
228
- n?.viaDoubleClick && r.current && (r.current.anchors.pop(), r.current.anchors.length === 0 && (r.current = null)), V(r, t), J.refresh();
228
+ n?.viaDoubleClick && r.current && (r.current.anchors.pop(), r.current.anchors.length === 0 && (r.current = null)), H(r, t), Y.refresh();
229
229
  }
230
230
  }
231
231
  },
@@ -246,10 +246,10 @@ function O(o = {}) {
246
246
  invoker: {
247
247
  timing: "ongoing",
248
248
  start: (t) => {
249
- let n = e(), r = t.drag?.start ?? t.world, i = W(t.deps, r.x, r.y), a = null;
249
+ let n = e(), r = t.drag?.start ?? t.world, i = G(t.deps, r.x, r.y), a = null;
250
250
  if (!i) {
251
- let { x: e, y: i, hit: o } = K(t.deps, r.x, r.y);
252
- H(n, t.deps, o) && (a = o), n.current ||= {
251
+ let { x: e, y: i, hit: o } = q(t.deps, r.x, r.y);
252
+ U(n, t.deps, o) && (a = o), n.current ||= {
253
253
  anchors: [],
254
254
  closed: !1
255
255
  }, n.current.anchors.push({
@@ -259,18 +259,18 @@ function O(o = {}) {
259
259
  }
260
260
  n.draggingHandleAt = n.current.anchors.length - 1, t.modifiers.alt && (n.current.anchors[n.draggingHandleAt].altBroken = !0);
261
261
  let o = !i;
262
- return k(n, t.world, t.modifiers.shift, o, L.current.snapPoint), J.update(t.deps), {
262
+ return A(n, t.world, t.modifiers.shift, o, R.current.snapPoint), Y.update(t.deps), {
263
263
  onMove: (t) => {
264
264
  let n = e();
265
- n.draggingHandleAt !== null && (t.modifiers.alt && n.current && (n.current.anchors[n.draggingHandleAt].altBroken = !0), k(n, t.world, t.modifiers.shift, o, L.current.snapPoint), R());
265
+ n.draggingHandleAt !== null && (t.modifiers.alt && n.current && (n.current.anchors[n.draggingHandleAt].altBroken = !0), A(n, t.world, t.modifiers.shift, o, R.current.snapPoint), z());
266
266
  },
267
267
  onEnd: (n, r) => {
268
268
  let s = e();
269
269
  if (r === "cancel") {
270
- i ? T(s) : s.current && s.draggingHandleAt === s.current.anchors.length - 1 && (s.current.anchors.pop(), s.current.anchors.length === 0 && (s.current = null)), s.draggingHandleAt = null, J.refresh();
270
+ i ? E(s) : s.current && s.draggingHandleAt === s.current.anchors.length - 1 && (s.current.anchors.pop(), s.current.anchors.length === 0 && (s.current = null)), s.draggingHandleAt = null, Y.refresh();
271
271
  return;
272
272
  }
273
- s.draggingHandleAt !== null && (n.modifiers.alt && s.current && (s.current.anchors[s.draggingHandleAt].altBroken = !0), k(s, n.world, n.modifiers.shift, o, L.current.snapPoint), s.draggingHandleAt = null), a && s.current && U(s, t.deps, a), J.refresh();
273
+ s.draggingHandleAt !== null && (n.modifiers.alt && s.current && (s.current.anchors[s.draggingHandleAt].altBroken = !0), A(s, n.world, n.modifiers.shift, o, R.current.snapPoint), s.draggingHandleAt = null), a && s.current && W(s, t.deps, a), Y.refresh();
274
274
  }
275
275
  };
276
276
  }
@@ -285,11 +285,11 @@ function O(o = {}) {
285
285
  "insert",
286
286
  "selection"
287
287
  ],
288
- enabled: () => E(e()) > 0 || S.NotApplicable,
288
+ enabled: () => D(e()) > 0 || C.NotApplicable,
289
289
  invoker: {
290
290
  timing: "immediate",
291
291
  run: (t) => {
292
- V(e(), t), J.refresh();
292
+ H(e(), t), Y.refresh();
293
293
  }
294
294
  }
295
295
  },
@@ -299,43 +299,43 @@ function O(o = {}) {
299
299
  eligible: { capability: "creates-paths" },
300
300
  enabled: () => {
301
301
  let t = e();
302
- return t.current !== null || t.finishedSubpaths.length > 0 || S.NotApplicable;
302
+ return t.current !== null || t.finishedSubpaths.length > 0 || C.NotApplicable;
303
303
  },
304
304
  invoker: {
305
305
  timing: "immediate",
306
306
  run: () => {
307
- T(e()), J.refresh();
307
+ E(e()), Y.refresh();
308
308
  }
309
309
  }
310
310
  }
311
311
  ];
312
312
  }, [
313
- V,
314
- K,
315
- q,
316
- W,
317
313
  H,
318
- U,
319
- L,
314
+ q,
320
315
  J,
321
- R
316
+ G,
317
+ U,
318
+ W,
319
+ R,
320
+ Y,
321
+ z
322
322
  ]);
323
- return _(() => r({
323
+ return v(() => r({
324
324
  id: "pen",
325
325
  keybinding: { key: "P" },
326
326
  capabilities: ["creates-paths"],
327
327
  hookName: "usePenTool",
328
- cursor: () => I.current?.closeHintActive ? "pointer" : C("pen", { fallback: "crosshair" }),
328
+ cursor: () => L.current?.closeHintActive ? "pointer" : w("pen", { fallback: "crosshair" }),
329
329
  presentation: {
330
330
  label: "Pen",
331
- icon: h(i),
331
+ icon: g(i),
332
332
  group: "draw"
333
333
  },
334
- actions: Y,
335
- overlay: z,
334
+ actions: X,
335
+ overlay: B,
336
336
  overlayPosition: "before-selection",
337
337
  onDeactivate: () => {
338
- T(I.current), J.stop();
338
+ E(L.current), Y.stop();
339
339
  },
340
340
  bindings: [
341
341
  {
@@ -396,12 +396,12 @@ function O(o = {}) {
396
396
  }
397
397
  ]
398
398
  }), [
399
+ X,
399
400
  Y,
400
- J,
401
- z
401
+ B
402
402
  ]);
403
403
  }
404
- O.prefs = {
404
+ k.prefs = {
405
405
  name: "Pen",
406
406
  description: "Pen-tool behavior.",
407
407
  children: { autoCommitOnClose: {
@@ -411,7 +411,7 @@ O.prefs = {
411
411
  default: !0
412
412
  } }
413
413
  };
414
- function k(e, t, n, r, i) {
414
+ function A(e, t, n, r, i) {
415
415
  if (e.current === null || e.draggingHandleAt === null) return;
416
416
  let a = e.current.anchors[e.draggingHandleAt], s = i ? i(t) : t, c = s.x - a.x, l = s.y - a.y;
417
417
  if (n) {
@@ -426,16 +426,16 @@ function k(e, t, n, r, i) {
426
426
  y: a.y - l
427
427
  });
428
428
  }
429
- function A(e) {
429
+ function j(e) {
430
430
  return e.view?.get().scale ?? {
431
431
  x: 1,
432
432
  y: 1
433
433
  };
434
434
  }
435
- function j(e, t, n, r) {
435
+ function M(e, t, n, r) {
436
436
  let i = e.areaSelect, a = e.editAnchors;
437
437
  if (!i || !a) return [];
438
- let o = e.view, s = f(r, A(e)), c = i.hitTestArea({
438
+ let o = e.view, s = p(r, j(e)), c = i.hitTestArea({
439
439
  x: t - s.x,
440
440
  y: n - s.y,
441
441
  width: 2 * s.x,
@@ -450,13 +450,13 @@ function j(e, t, n, r) {
450
450
  }
451
451
  return l;
452
452
  }
453
- function M(e, t) {
453
+ function N(e, t) {
454
454
  if (e.commands.length !== t.commands.length || e.coords.length !== t.coords.length) return !1;
455
455
  for (let n = 0; n < e.commands.length; n++) if (e.commands[n] !== t.commands[n]) return !1;
456
456
  for (let n = 0; n < e.coords.length; n++) if (e.coords[n] !== t.coords[n]) return !1;
457
457
  return !0;
458
458
  }
459
459
  //#endregion
460
- export { O as usePenTool };
460
+ export { k as usePenTool };
461
461
 
462
462
  //# sourceMappingURL=usePenTool.js.map