@weasel-js/core 1.9.4 → 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 (1191) hide show
  1. package/CHANGELOG.md +918 -0
  2. package/README.md +38 -3
  3. package/dist/WeaselProvider.js +5 -7
  4. package/dist/WeaselProvider.js.map +1 -1
  5. package/dist/affordances/composeAffordanceLayer.js +92 -84
  6. package/dist/affordances/composeAffordanceLayer.js.map +1 -1
  7. package/dist/affordances/cornerResize.js +3 -2
  8. package/dist/affordances/cornerResize.js.map +1 -1
  9. package/dist/affordances/hitAffordanceRegions.js +71 -101
  10. package/dist/affordances/hitAffordanceRegions.js.map +1 -1
  11. package/dist/affordances/pathAnchors.js +50 -28
  12. package/dist/affordances/pathAnchors.js.map +1 -1
  13. package/dist/affordances/rotateCursor.js +12 -0
  14. package/dist/affordances/rotateCursor.js.map +1 -0
  15. package/dist/affordances/rotationHandle.js +44 -46
  16. package/dist/affordances/rotationHandle.js.map +1 -1
  17. package/dist/animation/behaviors/coast.js +21 -0
  18. package/dist/animation/behaviors/coast.js.map +1 -0
  19. package/dist/animation/behaviors/coastByWrite.js +107 -0
  20. package/dist/animation/behaviors/coastByWrite.js.map +1 -0
  21. package/dist/animation/behaviors/coastOnTargets.js +94 -0
  22. package/dist/animation/behaviors/coastOnTargets.js.map +1 -0
  23. package/dist/animation/behaviors/momentum.js +48 -136
  24. package/dist/animation/behaviors/momentum.js.map +1 -1
  25. package/dist/animation/clipTargets.js +12 -0
  26. package/dist/animation/clipTargets.js.map +1 -0
  27. package/dist/animation/index.js +15 -20
  28. package/dist/animation/poseHelpers.js +112 -33
  29. package/dist/animation/poseHelpers.js.map +1 -1
  30. package/dist/animation/poseTarget.js +115 -0
  31. package/dist/animation/poseTarget.js.map +1 -0
  32. package/dist/animation/reflow.js +113 -83
  33. package/dist/animation/reflow.js.map +1 -1
  34. package/dist/animation/rewind.js +66 -0
  35. package/dist/animation/rewind.js.map +1 -0
  36. package/dist/animation/rig/bindRig.js +85 -53
  37. package/dist/animation/rig/bindRig.js.map +1 -1
  38. package/dist/animation/rig/rigNode.js +99 -0
  39. package/dist/animation/rig/rigNode.js.map +1 -0
  40. package/dist/animation/rig/rigSeat.js +59 -0
  41. package/dist/animation/rig/rigSeat.js.map +1 -0
  42. package/dist/animation/rig/skinBinding.js +64 -0
  43. package/dist/animation/rig/skinBinding.js.map +1 -0
  44. package/dist/animation/rig/useRig.js +31 -16
  45. package/dist/animation/rig/useRig.js.map +1 -1
  46. package/dist/animation/wrappers/animateLifecycle.js +8 -7
  47. package/dist/animation/wrappers/animateLifecycle.js.map +1 -1
  48. package/dist/animation/wrappers/animateOnSetPose.js +31 -31
  49. package/dist/animation/wrappers/animateOnSetPose.js.map +1 -1
  50. package/dist/animation/wrappers/instantPose.js.map +1 -1
  51. package/dist/animation/writtenPoseTarget.js +33 -0
  52. package/dist/animation/writtenPoseTarget.js.map +1 -0
  53. package/dist/autoPoseDescriptor-DHg5KqaJ.d.ts +27 -0
  54. package/dist/barrel/canvas.js +32 -0
  55. package/dist/barrel/chrome.js +10 -10
  56. package/dist/barrel/input.js +16 -17
  57. package/dist/barrel/interactions.js +34 -37
  58. package/dist/barrel/paint.js +11 -18
  59. package/dist/barrel/paths.js +13 -19
  60. package/dist/barrel/renderer.js +14 -20
  61. package/dist/barrel/routing.js +54 -47
  62. package/dist/barrel/scene.js +37 -0
  63. package/dist/barrel/text.js +9 -18
  64. package/dist/barrel/viewport.js +44 -51
  65. package/dist/canvas/Canvas.js +270 -475
  66. package/dist/canvas/Canvas.js.map +1 -1
  67. package/dist/canvas/CanvasView.js +168 -190
  68. package/dist/canvas/CanvasView.js.map +1 -1
  69. package/dist/canvas/CursorCoordsHud.js +24 -25
  70. package/dist/canvas/CursorCoordsHud.js.map +1 -1
  71. package/dist/canvas/DrawCanvas.js +39 -56
  72. package/dist/canvas/DrawCanvas.js.map +1 -1
  73. package/dist/canvas/ModalityHud.js.map +1 -1
  74. package/dist/canvas/NodeShape.js +28 -29
  75. package/dist/canvas/NodeShape.js.map +1 -1
  76. package/dist/canvas/PickHud.js.map +1 -1
  77. package/dist/canvas/SceneCanvas/DevHuds.js +40 -0
  78. package/dist/canvas/SceneCanvas/DevHuds.js.map +1 -0
  79. package/dist/canvas/SceneCanvas/GestureDispatcherMounter.js +66 -107
  80. package/dist/canvas/SceneCanvas/GestureDispatcherMounter.js.map +1 -1
  81. package/dist/canvas/SceneCanvas/PointerProviderIfRoot.js +33 -36
  82. package/dist/canvas/SceneCanvas/PointerProviderIfRoot.js.map +1 -1
  83. package/dist/canvas/SceneCanvas/StandardActionsRegistrar.js +38 -50
  84. package/dist/canvas/SceneCanvas/StandardActionsRegistrar.js.map +1 -1
  85. package/dist/canvas/SceneCanvas/ToolKeybindingsMounter.js +3 -3
  86. package/dist/canvas/SceneCanvas/ToolKeybindingsMounter.js.map +1 -1
  87. package/dist/canvas/SceneCanvas/coordTrace.js +37 -1
  88. package/dist/canvas/SceneCanvas/coordTrace.js.map +1 -1
  89. package/dist/canvas/SceneCanvas/defaultNodeProperties.js +319 -270
  90. package/dist/canvas/SceneCanvas/defaultNodeProperties.js.map +1 -1
  91. package/dist/canvas/SceneCanvas/defaultNodeRouting.js +1 -1
  92. package/dist/canvas/SceneCanvas/defaultNodeRouting.js.map +1 -1
  93. package/dist/canvas/SceneCanvas/dispatcherGestureBounds.js.map +1 -1
  94. package/dist/canvas/SceneCanvas/features.js +71 -62
  95. package/dist/canvas/SceneCanvas/features.js.map +1 -1
  96. package/dist/canvas/SceneCanvas/insertPreviewCommands.js +97 -0
  97. package/dist/canvas/SceneCanvas/insertPreviewCommands.js.map +1 -0
  98. package/dist/canvas/SceneCanvas/isDev.js.map +1 -1
  99. package/dist/canvas/SceneCanvas/poseGeometry.js +33 -37
  100. package/dist/canvas/SceneCanvas/poseGeometry.js.map +1 -1
  101. package/dist/canvas/SceneCanvas/props.js +15 -14
  102. package/dist/canvas/SceneCanvas/props.js.map +1 -1
  103. package/dist/canvas/SceneCanvas/scenePointQuery.js +50 -0
  104. package/dist/canvas/SceneCanvas/scenePointQuery.js.map +1 -0
  105. package/dist/canvas/SceneCanvas/shapeGeneratorProperties.js +52 -0
  106. package/dist/canvas/SceneCanvas/shapeGeneratorProperties.js.map +1 -0
  107. package/dist/canvas/SceneCanvas/toolRegistry.js +23 -0
  108. package/dist/canvas/SceneCanvas/toolRegistry.js.map +1 -0
  109. package/dist/canvas/SceneCanvas/useActionTunings.js +17 -0
  110. package/dist/canvas/SceneCanvas/useActionTunings.js.map +1 -0
  111. package/dist/canvas/SceneCanvas/useActionsPropResolver.js +6 -1
  112. package/dist/canvas/SceneCanvas/useActionsPropResolver.js.map +1 -1
  113. package/dist/canvas/SceneCanvas/useBuiltinShapeTools.js.map +1 -1
  114. package/dist/canvas/SceneCanvas/useBuiltinTools.js +21 -0
  115. package/dist/canvas/SceneCanvas/useBuiltinTools.js.map +1 -0
  116. package/dist/canvas/SceneCanvas/useCanvasCamera.js +46 -0
  117. package/dist/canvas/SceneCanvas/useCanvasCamera.js.map +1 -0
  118. package/dist/canvas/SceneCanvas/useCanvasDispatcher.js +20 -0
  119. package/dist/canvas/SceneCanvas/useCanvasDispatcher.js.map +1 -0
  120. package/dist/canvas/SceneCanvas/useCanvasSelection.js +16 -0
  121. package/dist/canvas/SceneCanvas/useCanvasSelection.js.map +1 -0
  122. package/dist/canvas/SceneCanvas/useCanvasTools.js +67 -0
  123. package/dist/canvas/SceneCanvas/useCanvasTools.js.map +1 -0
  124. package/dist/canvas/SceneCanvas/useDispatcherOverlayLayer.js +49 -113
  125. package/dist/canvas/SceneCanvas/useDispatcherOverlayLayer.js.map +1 -1
  126. package/dist/canvas/SceneCanvas/useHeldModifiers.js +20 -0
  127. package/dist/canvas/SceneCanvas/useHeldModifiers.js.map +1 -0
  128. package/dist/canvas/SceneCanvas/useNodeAtPoint.js +26 -0
  129. package/dist/canvas/SceneCanvas/useNodeAtPoint.js.map +1 -0
  130. package/dist/canvas/SceneCanvas/useNodeKinds.js +26 -0
  131. package/dist/canvas/SceneCanvas/useNodeKinds.js.map +1 -0
  132. package/dist/canvas/SceneCanvas/usePreviewGhostLayer.js +51 -41
  133. package/dist/canvas/SceneCanvas/usePreviewGhostLayer.js.map +1 -1
  134. package/dist/canvas/SceneCanvas/useSceneCanvasHandle.js +47 -0
  135. package/dist/canvas/SceneCanvas/useSceneCanvasHandle.js.map +1 -0
  136. package/dist/canvas/SceneCanvas/useSceneCanvasLayers.js +66 -0
  137. package/dist/canvas/SceneCanvas/useSceneCanvasLayers.js.map +1 -0
  138. package/dist/canvas/SceneCanvas/useSceneChrome.js +59 -0
  139. package/dist/canvas/SceneCanvas/useSceneChrome.js.map +1 -0
  140. package/dist/canvas/SceneCanvas/useSceneRedrawSources.js +23 -0
  141. package/dist/canvas/SceneCanvas/useSceneRedrawSources.js.map +1 -0
  142. package/dist/canvas/SceneCanvas/useSceneSelectTool.js +65 -101
  143. package/dist/canvas/SceneCanvas/useSceneSelectTool.js.map +1 -1
  144. package/dist/canvas/SceneCanvas/useSceneSlotLayers.js +37 -0
  145. package/dist/canvas/SceneCanvas/useSceneSlotLayers.js.map +1 -0
  146. package/dist/canvas/SceneCanvas/useSelectionOverlayLayer.js +38 -0
  147. package/dist/canvas/SceneCanvas/useSelectionOverlayLayer.js.map +1 -0
  148. package/dist/canvas/SceneCanvas/useViewLayerGate.js +20 -0
  149. package/dist/canvas/SceneCanvas/useViewLayerGate.js.map +1 -0
  150. package/dist/canvas/SceneCanvas/useViewportActions.js +9 -1
  151. package/dist/canvas/SceneCanvas/useViewportActions.js.map +1 -1
  152. package/dist/canvas/SceneCanvas/worldPointAt.js +8 -0
  153. package/dist/canvas/SceneCanvas/worldPointAt.js.map +1 -0
  154. package/dist/canvas/SceneCanvas.js +301 -708
  155. package/dist/canvas/SceneCanvas.js.map +1 -1
  156. package/dist/canvas/SceneViewCanvas.js +41 -47
  157. package/dist/canvas/SceneViewCanvas.js.map +1 -1
  158. package/dist/canvas/SurfaceCanvas.js +40 -0
  159. package/dist/canvas/SurfaceCanvas.js.map +1 -0
  160. package/dist/canvas/adapterDerivedPath.js +26 -0
  161. package/dist/canvas/adapterDerivedPath.js.map +1 -0
  162. package/dist/canvas/adapterPickSource.js +34 -0
  163. package/dist/canvas/adapterPickSource.js.map +1 -0
  164. package/dist/canvas/affordanceAt.js +12 -2
  165. package/dist/canvas/affordanceAt.js.map +1 -1
  166. package/dist/canvas/buildSceneLayer.js +81 -61
  167. package/dist/canvas/buildSceneLayer.js.map +1 -1
  168. package/dist/canvas/buildSceneTree.js +56 -34
  169. package/dist/canvas/buildSceneTree.js.map +1 -1
  170. package/dist/canvas/canvasRenderer.js +40 -44
  171. package/dist/canvas/canvasRenderer.js.map +1 -1
  172. package/dist/canvas/colorOverrides.js.map +1 -1
  173. package/dist/canvas/copiesAbove.js +27 -0
  174. package/dist/canvas/copiesAbove.js.map +1 -0
  175. package/dist/canvas/defaultDrawOne.js +25 -24
  176. package/dist/canvas/defaultDrawOne.js.map +1 -1
  177. package/dist/canvas/deps/areaSelect.js +4 -4
  178. package/dist/canvas/deps/areaSelect.js.map +1 -1
  179. package/dist/canvas/deps/debug.js.map +1 -1
  180. package/dist/canvas/deps/editAnchors.js +47 -71
  181. package/dist/canvas/deps/editAnchors.js.map +1 -1
  182. package/dist/canvas/deps/geometryProjection.js.map +1 -1
  183. package/dist/canvas/deps/hitTestArea.js +45 -25
  184. package/dist/canvas/deps/hitTestArea.js.map +1 -1
  185. package/dist/canvas/deps/insert.js +149 -104
  186. package/dist/canvas/deps/insert.js.map +1 -1
  187. package/dist/canvas/deps/lassoSelect.js +5 -5
  188. package/dist/canvas/deps/lassoSelect.js.map +1 -1
  189. package/dist/canvas/deps/layout.js +9 -15
  190. package/dist/canvas/deps/layout.js.map +1 -1
  191. package/dist/canvas/deps/poseDescriptor.js +1 -1
  192. package/dist/canvas/deps/poseDescriptor.js.map +1 -1
  193. package/dist/canvas/deps/resizePolicy.js.map +1 -1
  194. package/dist/canvas/deps/slice.js +44 -45
  195. package/dist/canvas/deps/slice.js.map +1 -1
  196. package/dist/canvas/deps/textEdit.js +8 -8
  197. package/dist/canvas/deps/textEdit.js.map +1 -1
  198. package/dist/canvas/deps/view.js.map +1 -1
  199. package/dist/canvas/derivedPath.js +69 -43
  200. package/dist/canvas/derivedPath.js.map +1 -1
  201. package/dist/canvas/drawEnvelope.js +8 -4
  202. package/dist/canvas/drawEnvelope.js.map +1 -1
  203. package/dist/canvas/getNodeAtPoint.js +2 -6
  204. package/dist/canvas/getNodeAtPoint.js.map +1 -1
  205. package/dist/canvas/hud.module.js.map +1 -1
  206. package/dist/canvas/insertPreviewExtent.js +33 -31
  207. package/dist/canvas/insertPreviewExtent.js.map +1 -1
  208. package/dist/canvas/layerOrder.js.map +1 -1
  209. package/dist/canvas/layerSlots.js +6 -1
  210. package/dist/canvas/layerSlots.js.map +1 -1
  211. package/dist/canvas/nodeShapes/derivedPainter.js +12 -12
  212. package/dist/canvas/nodeShapes/derivedPainter.js.map +1 -1
  213. package/dist/canvas/nodeShapes/imagePainter.js +10 -10
  214. package/dist/canvas/nodeShapes/imagePainter.js.map +1 -1
  215. package/dist/canvas/nodeShapes/memo.js.map +1 -1
  216. package/dist/canvas/nodeShapes/nodePaint.js +34 -23
  217. package/dist/canvas/nodeShapes/nodePaint.js.map +1 -1
  218. package/dist/canvas/nodeShapes/pathPainter.js +23 -22
  219. package/dist/canvas/nodeShapes/pathPainter.js.map +1 -1
  220. package/dist/canvas/nodeShapes/poseBox.js +6 -6
  221. package/dist/canvas/nodeShapes/poseBox.js.map +1 -1
  222. package/dist/canvas/nodeShapes/rectFallbackPainter.js +8 -8
  223. package/dist/canvas/nodeShapes/rectFallbackPainter.js.map +1 -1
  224. package/dist/canvas/nodeShapes/shapePainter.js +16 -16
  225. package/dist/canvas/nodeShapes/shapePainter.js.map +1 -1
  226. package/dist/canvas/nodeShapes/textPainter.js +1 -1
  227. package/dist/canvas/nodeShapes/textPainter.js.map +1 -1
  228. package/dist/canvas/overChildren.js +29 -0
  229. package/dist/canvas/overChildren.js.map +1 -0
  230. package/dist/canvas/overlayRoleStrokes.js.map +1 -1
  231. package/dist/canvas/paintCull.js +6 -8
  232. package/dist/canvas/paintCull.js.map +1 -1
  233. package/dist/{features/cursor → canvas}/paintedCursorLayer.js +2 -2
  234. package/dist/canvas/paintedCursorLayer.js.map +1 -0
  235. package/dist/canvas/pickReach.js +23 -0
  236. package/dist/canvas/pickReach.js.map +1 -0
  237. package/dist/canvas/pickWalk.js +43 -70
  238. package/dist/canvas/pickWalk.js.map +1 -1
  239. package/dist/canvas/planeClips.js +18 -19
  240. package/dist/canvas/planeClips.js.map +1 -1
  241. package/dist/canvas/poseCascade.js +41 -0
  242. package/dist/canvas/poseCascade.js.map +1 -0
  243. package/dist/canvas/poseRotation.js +1 -3
  244. package/dist/canvas/poseRotation.js.map +1 -1
  245. package/dist/canvas/rasterReadback.js +22 -0
  246. package/dist/canvas/rasterReadback.js.map +1 -0
  247. package/dist/canvas/renderDebugSnapshot.js +12 -12
  248. package/dist/canvas/renderDebugSnapshot.js.map +1 -1
  249. package/dist/canvas/renderNeeds.js +3 -3
  250. package/dist/canvas/renderNeeds.js.map +1 -1
  251. package/dist/canvas/renderSceneToPixels.js +64 -83
  252. package/dist/canvas/renderSceneToPixels.js.map +1 -1
  253. package/dist/canvas/sceneAdapter.js +59 -144
  254. package/dist/canvas/sceneAdapter.js.map +1 -1
  255. package/dist/canvas/sceneClipboard.js +1 -1
  256. package/dist/canvas/sceneClipboard.js.map +1 -1
  257. package/dist/canvas/sceneLayerPaint.js +4 -4
  258. package/dist/canvas/sceneLayerPaint.js.map +1 -1
  259. package/dist/canvas/sceneSlotWiring.js +10 -9
  260. package/dist/canvas/sceneSlotWiring.js.map +1 -1
  261. package/dist/canvas/sceneViewRender.js +37 -42
  262. package/dist/canvas/sceneViewRender.js.map +1 -1
  263. package/dist/canvas/slopsDebugLayer.js +4 -4
  264. package/dist/canvas/slopsDebugLayer.js.map +1 -1
  265. package/dist/canvas/useCanvasRenderer.js +23 -11
  266. package/dist/canvas/useCanvasRenderer.js.map +1 -1
  267. package/dist/canvas/useCanvasSurface.js +31 -0
  268. package/dist/canvas/useCanvasSurface.js.map +1 -0
  269. package/dist/canvas/useCanvasView.js +51 -44
  270. package/dist/canvas/useCanvasView.js.map +1 -1
  271. package/dist/canvas/useFrameLoop.js +11 -12
  272. package/dist/canvas/useFrameLoop.js.map +1 -1
  273. package/dist/canvas/useHostAnchor.js +35 -33
  274. package/dist/canvas/useHostAnchor.js.map +1 -1
  275. package/dist/canvas/useLateContentRedraw.js +8 -8
  276. package/dist/canvas/useLateContentRedraw.js.map +1 -1
  277. package/dist/canvas/useSceneAdapter.js +22 -0
  278. package/dist/canvas/useSceneAdapter.js.map +1 -0
  279. package/dist/canvas/useSceneLayerList.js +4 -14
  280. package/dist/canvas/useSceneLayerList.js.map +1 -1
  281. package/dist/canvas/useSurfaceInput.js +39 -0
  282. package/dist/canvas/useSurfaceInput.js.map +1 -0
  283. package/dist/canvas/useToolCursor.js +29 -0
  284. package/dist/canvas/useToolCursor.js.map +1 -0
  285. package/dist/canvas/useViewHelpers.js +46 -85
  286. package/dist/canvas/useViewHelpers.js.map +1 -1
  287. package/dist/canvas/viewInputs.js.map +1 -1
  288. package/dist/canvas/viewRegistry.js +40 -34
  289. package/dist/canvas/viewRegistry.js.map +1 -1
  290. package/dist/canvas/watchElementMove.js +43 -0
  291. package/dist/canvas/watchElementMove.js.map +1 -0
  292. package/dist/canvas/wrapNodeOutput.js +7 -2
  293. package/dist/canvas/wrapNodeOutput.js.map +1 -1
  294. package/dist/clipboard.d.ts +7 -14
  295. package/dist/{types-B4iJRHC3.d.ts → clone-C0eADtS0.d.ts} +129 -84
  296. package/dist/clone.d.ts +4 -8
  297. package/dist/clone.js +0 -2
  298. package/dist/core/device/targets.js.map +1 -1
  299. package/dist/core/device/useDeviceProfile.js +13 -13
  300. package/dist/core/device/useDeviceProfile.js.map +1 -1
  301. package/dist/{interactions/actions/resize → core/geometry}/autoPoseDescriptor.js +8 -7
  302. package/dist/core/geometry/autoPoseDescriptor.js.map +1 -0
  303. package/dist/core/geometry/pathPoseDescriptor.js +88 -0
  304. package/dist/core/geometry/pathPoseDescriptor.js.map +1 -0
  305. package/dist/core/geometry/poseDescriptor.js +102 -29
  306. package/dist/core/geometry/poseDescriptor.js.map +1 -1
  307. package/dist/core/geometry/regionHit.js +35 -37
  308. package/dist/core/geometry/regionHit.js.map +1 -1
  309. package/dist/core/geometry/targetFrame.js +94 -0
  310. package/dist/core/geometry/targetFrame.js.map +1 -0
  311. package/dist/core/geometry/unionBounds.js +4 -5
  312. package/dist/core/geometry/unionBounds.js.map +1 -1
  313. package/dist/core/layers/backgroundFill.js +31 -0
  314. package/dist/core/layers/backgroundFill.js.map +1 -0
  315. package/dist/{features/groups → core/layers}/children.js +2 -4
  316. package/dist/core/layers/children.js.map +1 -0
  317. package/dist/{features/focus → core/layers}/gateLayer.js +2 -2
  318. package/dist/core/layers/gateLayer.js.map +1 -0
  319. package/dist/core/layers/layerGroup.js +40 -0
  320. package/dist/core/layers/layerGroup.js.map +1 -0
  321. package/dist/core/layers/render.js +50 -76
  322. package/dist/core/layers/render.js.map +1 -1
  323. package/dist/core/ops/create.js +2 -2
  324. package/dist/core/ops/create.js.map +1 -1
  325. package/dist/core/ops/createHistory.js +9 -9
  326. package/dist/core/ops/createHistory.js.map +1 -1
  327. package/dist/core/ops/delete.js +19 -23
  328. package/dist/core/ops/delete.js.map +1 -1
  329. package/dist/core/ops/reorder/index.js +3 -7
  330. package/dist/core/ops/reorder/index.js.map +1 -1
  331. package/dist/core/ops/reorder/setChildOrder.js +2 -4
  332. package/dist/core/ops/reorder/setChildOrder.js.map +1 -1
  333. package/dist/core/ops/reparent.js +0 -1
  334. package/dist/core/ops/reparent.js.map +1 -1
  335. package/dist/core/ops/slot.js +3 -6
  336. package/dist/core/ops/slot.js.map +1 -1
  337. package/dist/core/pages/fitViewToPage.js +15 -0
  338. package/dist/core/pages/fitViewToPage.js.map +1 -0
  339. package/dist/core/pages/pages.js +65 -0
  340. package/dist/core/pages/pages.js.map +1 -0
  341. package/dist/core/pages/pagesLayer.js +27 -0
  342. package/dist/core/pages/pagesLayer.js.map +1 -0
  343. package/dist/core/paint/meshKind.js +16 -0
  344. package/dist/core/paint/meshKind.js.map +1 -0
  345. package/dist/{features/meshPaint/lazyKind.js → core/paint/meshKindLazy.js} +104 -93
  346. package/dist/core/paint/meshKindLazy.js.map +1 -0
  347. package/dist/core/paint/paintKindEntry.js +8 -0
  348. package/dist/core/paint/paintKindEntry.js.map +1 -0
  349. package/dist/core/paint/paintKinds.js +144 -0
  350. package/dist/core/paint/paintKinds.js.map +1 -0
  351. package/dist/core/paint/registerMesh.js +7 -0
  352. package/dist/core/paint/registerMesh.js.map +1 -0
  353. package/dist/core/scene/NodeProperties.js.map +1 -1
  354. package/dist/core/scene/NodeRouting.js.map +1 -1
  355. package/dist/core/scene/arrivalWindow.js +65 -64
  356. package/dist/core/scene/arrivalWindow.js.map +1 -1
  357. package/dist/core/scene/boundOps.js +40 -0
  358. package/dist/core/scene/boundOps.js.map +1 -0
  359. package/dist/core/scene/composeFrame.js +9 -6
  360. package/dist/core/scene/composeFrame.js.map +1 -1
  361. package/dist/core/scene/composePose.js +105 -0
  362. package/dist/core/scene/composePose.js.map +1 -0
  363. package/dist/core/scene/depMemo.js +31 -6
  364. package/dist/core/scene/depMemo.js.map +1 -1
  365. package/dist/core/scene/derivedPath.js +19 -20
  366. package/dist/core/scene/derivedPath.js.map +1 -1
  367. package/dist/core/scene/editMode.js +26 -0
  368. package/dist/core/scene/editMode.js.map +1 -0
  369. package/dist/core/scene/effectivePose.js +42 -39
  370. package/dist/core/scene/effectivePose.js.map +1 -1
  371. package/dist/core/scene/fieldEdits.js +98 -0
  372. package/dist/core/scene/fieldEdits.js.map +1 -0
  373. package/dist/core/scene/historyFacade.js +122 -70
  374. package/dist/core/scene/historyFacade.js.map +1 -1
  375. package/dist/core/scene/historyForm.js +6 -0
  376. package/dist/core/scene/historyForm.js.map +1 -0
  377. package/dist/core/scene/kitOps.js +83 -71
  378. package/dist/core/scene/kitOps.js.map +1 -1
  379. package/dist/core/scene/kitRegistry.js.map +1 -1
  380. package/dist/core/scene/layerStack.js +105 -12
  381. package/dist/core/scene/layerStack.js.map +1 -1
  382. package/dist/core/scene/layoutPass.js +58 -59
  383. package/dist/core/scene/layoutPass.js.map +1 -1
  384. package/dist/{features/groups → core/scene}/nestedHit.js +3 -3
  385. package/dist/core/scene/nestedHit.js.map +1 -0
  386. package/dist/core/scene/nodeFnFields.js +16 -9
  387. package/dist/core/scene/nodeFnFields.js.map +1 -1
  388. package/dist/core/scene/nodeMemo.js.map +1 -1
  389. package/dist/core/scene/nodeStore.js +72 -71
  390. package/dist/core/scene/nodeStore.js.map +1 -1
  391. package/dist/core/scene/notifier.js +37 -0
  392. package/dist/core/scene/notifier.js.map +1 -0
  393. package/dist/core/scene/opTable.js +50 -0
  394. package/dist/core/scene/opTable.js.map +1 -0
  395. package/dist/core/scene/outerOps.js +67 -0
  396. package/dist/core/scene/outerOps.js.map +1 -0
  397. package/dist/core/scene/poseHold.js +39 -0
  398. package/dist/core/scene/poseHold.js.map +1 -0
  399. package/dist/core/scene/poseOverrides.js +44 -36
  400. package/dist/core/scene/poseOverrides.js.map +1 -1
  401. package/dist/core/scene/poseSnapshot.js.map +1 -1
  402. package/dist/core/scene/reconcileSpecs.js +4 -3
  403. package/dist/core/scene/reconcileSpecs.js.map +1 -1
  404. package/dist/core/scene/recorder.js +86 -0
  405. package/dist/core/scene/recorder.js.map +1 -0
  406. package/dist/core/scene/renderOrder.js.map +1 -1
  407. package/dist/core/scene/scene.js +81 -690
  408. package/dist/core/scene/scene.js.map +1 -1
  409. package/dist/core/scene/sceneEdits.js +58 -0
  410. package/dist/core/scene/sceneEdits.js.map +1 -0
  411. package/dist/core/scene/sceneMutators.js +49 -0
  412. package/dist/core/scene/sceneMutators.js.map +1 -0
  413. package/dist/core/scene/scenePoseAdapter.js +16 -0
  414. package/dist/core/scene/scenePoseAdapter.js.map +1 -0
  415. package/dist/core/scene/sceneRecording.js +91 -0
  416. package/dist/core/scene/sceneRecording.js.map +1 -0
  417. package/dist/core/scene/sceneSelection.js +28 -0
  418. package/dist/core/scene/sceneSelection.js.map +1 -0
  419. package/dist/core/scene/sceneState.js +49 -0
  420. package/dist/core/scene/sceneState.js.map +1 -0
  421. package/dist/core/scene/serialization.js +8 -5
  422. package/dist/core/scene/serialization.js.map +1 -1
  423. package/dist/core/scene/staleReplay.js +51 -0
  424. package/dist/core/scene/staleReplay.js.map +1 -0
  425. package/dist/core/scene/statedFields.js +9 -0
  426. package/dist/core/scene/statedFields.js.map +1 -0
  427. package/dist/core/scene/treeEdits.js +127 -0
  428. package/dist/core/scene/treeEdits.js.map +1 -0
  429. package/dist/core/scene/treeReads.js +26 -0
  430. package/dist/core/scene/treeReads.js.map +1 -0
  431. package/dist/core/scene/types.js.map +1 -1
  432. package/dist/{features/groups → core/scene}/unionOfChildren.js +3 -3
  433. package/dist/core/scene/unionOfChildren.js.map +1 -0
  434. package/dist/core/scene/unitScopes.js +13 -0
  435. package/dist/core/scene/unitScopes.js.map +1 -0
  436. package/dist/core/scene/useScene.js.map +1 -1
  437. package/dist/core/selection/readOnlySelection.js +32 -0
  438. package/dist/core/selection/readOnlySelection.js.map +1 -0
  439. package/dist/core/selection/usePublishSceneSelection.js +26 -0
  440. package/dist/core/selection/usePublishSceneSelection.js.map +1 -0
  441. package/dist/core/selection/useSelection.js +34 -25
  442. package/dist/core/selection/useSelection.js.map +1 -1
  443. package/dist/core/shapeKinds.js.map +1 -1
  444. package/dist/core/stylus/stylus.js.map +1 -1
  445. package/dist/core/stylus/usePointerStylus.js.map +1 -1
  446. package/dist/core/usePaintKinds.js +1 -1
  447. package/dist/core/usePaintKinds.js.map +1 -1
  448. package/dist/core/viewport/clientToWorld.js.map +1 -1
  449. package/dist/core/viewport/fitViewToBounds.js.map +1 -1
  450. package/dist/core/viewport/parallax.js.map +1 -1
  451. package/dist/core/viewport/screenSlop.js +11 -11
  452. package/dist/core/viewport/screenSlop.js.map +1 -1
  453. package/dist/core/viewport/useCanvasSize.js.map +1 -1
  454. package/dist/core/viewport/useDecayLoop.js +31 -33
  455. package/dist/core/viewport/useDecayLoop.js.map +1 -1
  456. package/dist/core/viewport/useNodeOverlayFrame.js +84 -0
  457. package/dist/core/viewport/useNodeOverlayFrame.js.map +1 -0
  458. package/dist/core/viewport/useViewAnimation.js +113 -53
  459. package/dist/core/viewport/useViewAnimation.js.map +1 -1
  460. package/dist/core/viewport/view.js +14 -11
  461. package/dist/core/viewport/view.js.map +1 -1
  462. package/dist/core/viewport/wheelHandler.js.map +1 -1
  463. package/dist/core/viewport/zoomAt.js +11 -2
  464. package/dist/core/viewport/zoomAt.js.map +1 -1
  465. package/dist/{cornerHandles-CtCb8a3G.d.ts → cornerHandles-BSKbyuvQ.d.ts} +11 -24
  466. package/dist/debug/createDebugOverlayLayer.js +100 -100
  467. package/dist/debug/createDebugOverlayLayer.js.map +1 -1
  468. package/dist/debug/createDebugSink.js.map +1 -1
  469. package/dist/debug/frameStats.js.map +1 -1
  470. package/dist/debug/useDebugSink.js +52 -0
  471. package/dist/debug/useDebugSink.js.map +1 -0
  472. package/dist/features/chrome-caps/buildChromeCtx.js.map +1 -1
  473. package/dist/features/chrome-caps/conditions.js.map +1 -1
  474. package/dist/features/chrome-caps/defaults.js.map +1 -1
  475. package/dist/features/chrome-caps/resolve.js.map +1 -1
  476. package/dist/features/chrome-caps/useChromeCaps.js +54 -0
  477. package/dist/features/chrome-caps/useChromeCaps.js.map +1 -0
  478. package/dist/features/chrome-caps/useHoverTracking.js.map +1 -1
  479. package/dist/features/ingestion/contentHandlers.js +25 -19
  480. package/dist/features/ingestion/contentHandlers.js.map +1 -1
  481. package/dist/features/ingestion/imageHandler.js +21 -24
  482. package/dist/features/ingestion/imageHandler.js.map +1 -1
  483. package/dist/features/ingestion/openFilePicker.js.map +1 -1
  484. package/dist/features/ingestion/placement.js +16 -0
  485. package/dist/features/ingestion/placement.js.map +1 -0
  486. package/dist/features/ingestion/svgHandler.js +5 -0
  487. package/dist/features/ingestion/svgHandler.js.map +1 -1
  488. package/dist/features/ingestion/textHandler.js +28 -0
  489. package/dist/features/ingestion/textHandler.js.map +1 -0
  490. package/dist/features/ingestion/useCanvasIngestion.js +48 -0
  491. package/dist/features/ingestion/useCanvasIngestion.js.map +1 -0
  492. package/dist/features/ingestion/weaselJsonHandler.js +5 -0
  493. package/dist/features/ingestion/weaselJsonHandler.js.map +1 -1
  494. package/dist/features/longPress/longPressFeedback.js.map +1 -1
  495. package/dist/features/modes/modeLayers.js +7 -7
  496. package/dist/features/modes/modeLayers.js.map +1 -1
  497. package/dist/features/paths/editablePath.js +63 -0
  498. package/dist/features/paths/editablePath.js.map +1 -0
  499. package/dist/features/paths/index.js +9 -16
  500. package/dist/features/paths/pathEditState.js +41 -0
  501. package/dist/features/paths/pathEditState.js.map +1 -0
  502. package/dist/features/paths/pathEditingOverlayLayer.js +36 -38
  503. package/dist/features/paths/pathEditingOverlayLayer.js.map +1 -1
  504. package/dist/features/paths/pathLayer.js +3 -2
  505. package/dist/features/paths/pathLayer.js.map +1 -1
  506. package/dist/features/paths/penPreviewLayer.js +86 -88
  507. package/dist/features/paths/penPreviewLayer.js.map +1 -1
  508. package/dist/features/paths/shapeGenerator.js +89 -0
  509. package/dist/features/paths/shapeGenerator.js.map +1 -0
  510. package/dist/features/paths/usePathEdit.js +34 -0
  511. package/dist/features/paths/usePathEdit.js.map +1 -0
  512. package/dist/features/poseRun/usePoseRun.js +44 -57
  513. package/dist/features/poseRun/usePoseRun.js.map +1 -1
  514. package/dist/features/selection/overlay.js +170 -178
  515. package/dist/features/selection/overlay.js.map +1 -1
  516. package/dist/features/text/index.js +6 -0
  517. package/dist/features/text/textLayer.js +1 -1
  518. package/dist/features/text/textLayer.js.map +1 -1
  519. package/dist/features/text/useSceneTextEdit.js +119 -88
  520. package/dist/features/text/useSceneTextEdit.js.map +1 -1
  521. package/dist/features/viewports/viewResolver.js +28 -24
  522. package/dist/features/viewports/viewResolver.js.map +1 -1
  523. package/dist/features/viewports/viewportLayer.js +25 -36
  524. package/dist/features/viewports/viewportLayer.js.map +1 -1
  525. package/dist/icons/SliceIcon.js +24 -0
  526. package/dist/icons/SliceIcon.js.map +1 -0
  527. package/dist/index.d.ts +5200 -8777
  528. package/dist/index.js +284 -320
  529. package/dist/input/keyState.js +14 -14
  530. package/dist/interactions/actions/actionShortcuts.js.map +1 -1
  531. package/dist/interactions/actions/{defaults/align.js → align/action.js} +15 -16
  532. package/dist/interactions/actions/align/action.js.map +1 -0
  533. package/dist/interactions/actions/align/align.js +24 -24
  534. package/dist/interactions/actions/align/align.js.map +1 -1
  535. package/dist/interactions/actions/booleans/action.js +65 -0
  536. package/dist/interactions/actions/booleans/action.js.map +1 -0
  537. package/dist/interactions/actions/booleans/booleans.js +74 -83
  538. package/dist/interactions/actions/booleans/booleans.js.map +1 -1
  539. package/dist/interactions/actions/booleans/operands.js +40 -0
  540. package/dist/interactions/actions/booleans/operands.js.map +1 -0
  541. package/dist/interactions/actions/booleans/pieces.js +45 -0
  542. package/dist/interactions/actions/booleans/pieces.js.map +1 -0
  543. package/dist/interactions/actions/booleans/placement.js +24 -0
  544. package/dist/interactions/actions/booleans/placement.js.map +1 -0
  545. package/dist/interactions/actions/booleans/useBooleans.js +11 -9
  546. package/dist/interactions/actions/booleans/useBooleans.js.map +1 -1
  547. package/dist/interactions/actions/booleans/useBooleansAdapter.js.map +1 -1
  548. package/dist/interactions/actions/{defaults/clipboard.js → clipboard/action.js} +19 -19
  549. package/dist/interactions/actions/clipboard/action.js.map +1 -0
  550. package/dist/interactions/actions/clipboard/clipboardOps.js +15 -15
  551. package/dist/interactions/actions/clipboard/clipboardOps.js.map +1 -1
  552. package/dist/interactions/actions/clipboard/wireFormat.js.map +1 -1
  553. package/dist/interactions/actions/clone/action.js +103 -0
  554. package/dist/interactions/actions/clone/action.js.map +1 -0
  555. package/dist/interactions/actions/clone/behaviors.js +52 -0
  556. package/dist/interactions/actions/clone/behaviors.js.map +1 -0
  557. package/dist/interactions/actions/defaultCommitAdapter.js +10 -37
  558. package/dist/interactions/actions/defaultCommitAdapter.js.map +1 -1
  559. package/dist/interactions/actions/defaults/anchorEditing.js +69 -74
  560. package/dist/interactions/actions/defaults/anchorEditing.js.map +1 -1
  561. package/dist/interactions/actions/defaults/anchorHandles.js +42 -0
  562. package/dist/interactions/actions/defaults/anchorHandles.js.map +1 -0
  563. package/dist/interactions/actions/defaults/anchorJoin.js +92 -0
  564. package/dist/interactions/actions/defaults/anchorJoin.js.map +1 -0
  565. package/dist/interactions/actions/defaults/areaSelect.js.map +1 -1
  566. package/dist/interactions/actions/defaults/bendSegment.js +46 -0
  567. package/dist/interactions/actions/defaults/bendSegment.js.map +1 -0
  568. package/dist/interactions/actions/defaults/cancelGesture.js.map +1 -1
  569. package/dist/interactions/actions/defaults/clearSelection.js.map +1 -1
  570. package/dist/interactions/actions/defaults/copySubtree.js +1 -1
  571. package/dist/interactions/actions/defaults/copySubtree.js.map +1 -1
  572. package/dist/interactions/actions/defaults/createPaintAction.js.map +1 -1
  573. package/dist/interactions/actions/defaults/delete.js.map +1 -1
  574. package/dist/interactions/actions/defaults/duplicate.js +36 -21
  575. package/dist/interactions/actions/defaults/duplicate.js.map +1 -1
  576. package/dist/interactions/actions/defaults/enterPathEdit.js +19 -7
  577. package/dist/interactions/actions/defaults/enterPathEdit.js.map +1 -1
  578. package/dist/interactions/actions/defaults/enterTextEdit.js.map +1 -1
  579. package/dist/interactions/actions/defaults/group.js +35 -40
  580. package/dist/interactions/actions/defaults/group.js.map +1 -1
  581. package/dist/interactions/actions/defaults/icons/anchorIcons.js +75 -0
  582. package/dist/interactions/actions/defaults/icons/anchorIcons.js.map +1 -0
  583. package/dist/interactions/actions/defaults/icons/booleanIcons.js +24 -1
  584. package/dist/interactions/actions/defaults/icons/booleanIcons.js.map +1 -1
  585. package/dist/interactions/actions/defaults/icons/editIcons.js +35 -8
  586. package/dist/interactions/actions/defaults/icons/editIcons.js.map +1 -1
  587. package/dist/interactions/actions/defaults/icons/outlineIcons.js +39 -1
  588. package/dist/interactions/actions/defaults/icons/outlineIcons.js.map +1 -1
  589. package/dist/interactions/actions/defaults/ingest.js +19 -15
  590. package/dist/interactions/actions/defaults/ingest.js.map +1 -1
  591. package/dist/interactions/actions/defaults/insertPathAnchor.js +18 -34
  592. package/dist/interactions/actions/defaults/insertPathAnchor.js.map +1 -1
  593. package/dist/interactions/actions/defaults/nudge.js +43 -39
  594. package/dist/interactions/actions/defaults/nudge.js.map +1 -1
  595. package/dist/interactions/actions/defaults/pinchZoom.js +29 -29
  596. package/dist/interactions/actions/defaults/pinchZoom.js.map +1 -1
  597. package/dist/interactions/actions/defaults/requiresSelection.js.map +1 -1
  598. package/dist/interactions/actions/defaults/segmentUnder.js +22 -0
  599. package/dist/interactions/actions/defaults/segmentUnder.js.map +1 -0
  600. package/dist/interactions/actions/defaults/setFill.js +9 -3
  601. package/dist/interactions/actions/defaults/setFill.js.map +1 -1
  602. package/dist/interactions/actions/defaults/setFillOpacity.js +4 -1
  603. package/dist/interactions/actions/defaults/setFillOpacity.js.map +1 -1
  604. package/dist/interactions/actions/defaults/setStroke.js.map +1 -1
  605. package/dist/interactions/actions/defaults/sliceOps.js +20 -22
  606. package/dist/interactions/actions/defaults/sliceOps.js.map +1 -1
  607. package/dist/interactions/actions/defaults/toolActivate.js.map +1 -1
  608. package/dist/interactions/actions/defaults/toolResetToDefault.js.map +1 -1
  609. package/dist/interactions/actions/defaults/viewportDragPan.js +1 -1
  610. package/dist/interactions/actions/defaults/viewportDragPan.js.map +1 -1
  611. package/dist/interactions/actions/defaults/viewportWheelPan.js.map +1 -1
  612. package/dist/interactions/actions/defaults/viewportZoom.js +82 -79
  613. package/dist/interactions/actions/defaults/viewportZoom.js.map +1 -1
  614. package/dist/interactions/actions/{defaults/distribute.js → distribute/action.js} +18 -19
  615. package/dist/interactions/actions/distribute/action.js.map +1 -0
  616. package/dist/interactions/actions/distribute/distribute.js +15 -15
  617. package/dist/interactions/actions/distribute/distribute.js.map +1 -1
  618. package/dist/interactions/actions/edit-anchors/action.js +101 -0
  619. package/dist/interactions/actions/edit-anchors/action.js.map +1 -0
  620. package/dist/interactions/actions/edit-anchors/geometry.js +2 -4
  621. package/dist/interactions/actions/edit-anchors/geometry.js.map +1 -1
  622. package/dist/interactions/actions/edit-anchors/preview.js +26 -0
  623. package/dist/interactions/actions/edit-anchors/preview.js.map +1 -0
  624. package/dist/interactions/actions/edit-anchors/symmetry.js +11 -0
  625. package/dist/interactions/actions/edit-anchors/symmetry.js.map +1 -0
  626. package/dist/interactions/actions/flip/action.js +124 -0
  627. package/dist/interactions/actions/flip/action.js.map +1 -0
  628. package/dist/interactions/actions/flip/helpers.js +1 -1
  629. package/dist/interactions/actions/flip/helpers.js.map +1 -1
  630. package/dist/interactions/actions/geometryProjection.js.map +1 -1
  631. package/dist/interactions/actions/gestureFrames.js +18 -0
  632. package/dist/interactions/actions/gestureFrames.js.map +1 -0
  633. package/dist/interactions/actions/gestureLifecycle.js +47 -20
  634. package/dist/interactions/actions/gestureLifecycle.js.map +1 -1
  635. package/dist/interactions/actions/insert/action.js +79 -0
  636. package/dist/interactions/actions/insert/action.js.map +1 -0
  637. package/dist/interactions/actions/insert/commit.js +28 -0
  638. package/dist/interactions/actions/insert/commit.js.map +1 -0
  639. package/dist/interactions/actions/insert/extras.js +65 -0
  640. package/dist/interactions/actions/insert/extras.js.map +1 -0
  641. package/dist/interactions/actions/insert/frame.js +55 -0
  642. package/dist/interactions/actions/insert/frame.js.map +1 -0
  643. package/dist/interactions/actions/insert/geometry.js +35 -0
  644. package/dist/interactions/actions/insert/geometry.js.map +1 -0
  645. package/dist/interactions/actions/insert/repositionAction.js +31 -0
  646. package/dist/interactions/actions/insert/repositionAction.js.map +1 -0
  647. package/dist/interactions/actions/insert/rotateAction.js +21 -0
  648. package/dist/interactions/actions/insert/rotateAction.js.map +1 -0
  649. package/dist/interactions/actions/insert/session.js +59 -0
  650. package/dist/interactions/actions/insert/session.js.map +1 -0
  651. package/dist/interactions/actions/insert/shape.js +34 -0
  652. package/dist/interactions/actions/insert/shape.js.map +1 -0
  653. package/dist/interactions/actions/lasso-select/action.js +143 -0
  654. package/dist/interactions/actions/lasso-select/action.js.map +1 -0
  655. package/dist/interactions/actions/move/action.js +91 -0
  656. package/dist/interactions/actions/move/action.js.map +1 -0
  657. package/dist/interactions/actions/move/behaviors/layoutDrop.js +51 -0
  658. package/dist/interactions/actions/move/behaviors/layoutDrop.js.map +1 -0
  659. package/dist/interactions/actions/move/behaviors/reparentOnDrop.js +15 -0
  660. package/dist/interactions/actions/move/behaviors/reparentOnDrop.js.map +1 -0
  661. package/dist/interactions/actions/move/behaviors/snapToContainer.js +35 -28
  662. package/dist/interactions/actions/move/behaviors/snapToContainer.js.map +1 -1
  663. package/dist/interactions/actions/move/capture.js +108 -0
  664. package/dist/interactions/actions/move/capture.js.map +1 -0
  665. package/dist/interactions/actions/move/commit/index.js +41 -0
  666. package/dist/interactions/actions/move/commit/index.js.map +1 -0
  667. package/dist/interactions/actions/move/commit/layoutDrop.js +44 -0
  668. package/dist/interactions/actions/move/commit/layoutDrop.js.map +1 -0
  669. package/dist/interactions/actions/move/commit/layoutRelease.js +100 -0
  670. package/dist/interactions/actions/move/commit/layoutRelease.js.map +1 -0
  671. package/dist/interactions/actions/move/commit/rebase.js +18 -0
  672. package/dist/interactions/actions/move/commit/rebase.js.map +1 -0
  673. package/dist/interactions/actions/move/commit/reparent.js +65 -0
  674. package/dist/interactions/actions/move/commit/reparent.js.map +1 -0
  675. package/dist/interactions/actions/move/delta.js +51 -0
  676. package/dist/interactions/actions/move/delta.js.map +1 -0
  677. package/dist/interactions/actions/move/frame.js +47 -0
  678. package/dist/interactions/actions/move/frame.js.map +1 -0
  679. package/dist/interactions/actions/move/gestureAdapter.js +15 -40
  680. package/dist/interactions/actions/move/gestureAdapter.js.map +1 -1
  681. package/dist/interactions/actions/move/landedDescendants.js +8 -8
  682. package/dist/interactions/actions/move/layout/container.js +94 -0
  683. package/dist/interactions/actions/move/layout/container.js.map +1 -0
  684. package/dist/interactions/actions/move/layout/dragged.js +58 -0
  685. package/dist/interactions/actions/move/layout/dragged.js.map +1 -0
  686. package/dist/interactions/actions/move/layout/dropPass.js +122 -0
  687. package/dist/interactions/actions/move/layout/dropPass.js.map +1 -0
  688. package/dist/interactions/actions/move/layout/exits.js +38 -0
  689. package/dist/interactions/actions/move/layout/exits.js.map +1 -0
  690. package/dist/interactions/actions/move/layout/glide.js +48 -0
  691. package/dist/interactions/actions/move/layout/glide.js.map +1 -0
  692. package/dist/interactions/actions/move/session.js +63 -0
  693. package/dist/interactions/actions/move/session.js.map +1 -0
  694. package/dist/interactions/actions/move/translate.js +61 -0
  695. package/dist/interactions/actions/move/translate.js.map +1 -0
  696. package/dist/interactions/actions/outlines/createOutlines.js +17 -64
  697. package/dist/interactions/actions/outlines/createOutlines.js.map +1 -1
  698. package/dist/interactions/actions/outlines/createOutlinesAction.js +51 -0
  699. package/dist/interactions/actions/outlines/createOutlinesAction.js.map +1 -0
  700. package/dist/interactions/actions/outlines/outlineStroke.js +72 -0
  701. package/dist/interactions/actions/outlines/outlineStroke.js.map +1 -0
  702. package/dist/interactions/actions/outlines/outlineStrokeAction.js +37 -0
  703. package/dist/interactions/actions/outlines/outlineStrokeAction.js.map +1 -0
  704. package/dist/interactions/actions/outlines/replaceWithPaths.js +54 -0
  705. package/dist/interactions/actions/outlines/replaceWithPaths.js.map +1 -0
  706. package/dist/interactions/actions/outlines/strokeRegion.js +27 -0
  707. package/dist/interactions/actions/outlines/strokeRegion.js.map +1 -0
  708. package/dist/interactions/actions/pathCommands/cutJoin.js +102 -0
  709. package/dist/interactions/actions/pathCommands/cutJoin.js.map +1 -0
  710. package/dist/interactions/actions/pathCommands/livePathEdit.js +64 -0
  711. package/dist/interactions/actions/pathCommands/livePathEdit.js.map +1 -0
  712. package/dist/interactions/actions/pathCommands/pathNodes.js +99 -0
  713. package/dist/interactions/actions/pathCommands/pathNodes.js.map +1 -0
  714. package/dist/interactions/actions/pathCommands/simplifyOffset.js +42 -0
  715. package/dist/interactions/actions/pathCommands/simplifyOffset.js.map +1 -0
  716. package/dist/interactions/actions/planeInput.js.map +1 -1
  717. package/dist/interactions/actions/pointerState.js +12 -0
  718. package/dist/interactions/actions/pointerState.js.map +1 -0
  719. package/dist/interactions/actions/poseDescriptorDep.js +1 -1
  720. package/dist/interactions/actions/poseDescriptorDep.js.map +1 -1
  721. package/dist/interactions/actions/poseFrame.js +26 -26
  722. package/dist/interactions/actions/poseFrame.js.map +1 -1
  723. package/dist/interactions/actions/resize/action.js +66 -0
  724. package/dist/interactions/actions/resize/action.js.map +1 -0
  725. package/dist/interactions/actions/resize/behaviors/lockAspect.js.map +1 -1
  726. package/dist/interactions/actions/resize/boxFrame.js +16 -0
  727. package/dist/interactions/actions/resize/boxFrame.js.map +1 -0
  728. package/dist/interactions/actions/resize/capture.js +85 -0
  729. package/dist/interactions/actions/resize/capture.js.map +1 -0
  730. package/dist/interactions/actions/resize/commit.js +69 -0
  731. package/dist/interactions/actions/resize/commit.js.map +1 -0
  732. package/dist/interactions/actions/resize/frame.js +88 -0
  733. package/dist/interactions/actions/resize/frame.js.map +1 -0
  734. package/dist/interactions/actions/resize/pointSnap.js +111 -0
  735. package/dist/interactions/actions/resize/pointSnap.js.map +1 -0
  736. package/dist/interactions/actions/resize/replay.js +47 -0
  737. package/dist/interactions/actions/resize/replay.js.map +1 -0
  738. package/dist/interactions/actions/resize/ruleBounds.js +9 -0
  739. package/dist/interactions/actions/resize/ruleBounds.js.map +1 -0
  740. package/dist/interactions/actions/resize/session.js +63 -0
  741. package/dist/interactions/actions/resize/session.js.map +1 -0
  742. package/dist/interactions/actions/resolveOverlays.js +2 -1
  743. package/dist/interactions/actions/resolveOverlays.js.map +1 -1
  744. package/dist/interactions/actions/resolvePreviews.js.map +1 -1
  745. package/dist/interactions/actions/rotate/action.js +71 -0
  746. package/dist/interactions/actions/rotate/action.js.map +1 -0
  747. package/dist/interactions/actions/rotate/behaviors/index.js +7 -0
  748. package/dist/interactions/actions/rotate/behaviors/index.js.map +1 -0
  749. package/dist/interactions/actions/rotate/behaviors/snapRotation.js +12 -0
  750. package/dist/interactions/actions/rotate/behaviors/snapRotation.js.map +1 -0
  751. package/dist/interactions/actions/rotate/commit.js +40 -0
  752. package/dist/interactions/actions/rotate/commit.js.map +1 -0
  753. package/dist/interactions/actions/rotate/frame.js +65 -0
  754. package/dist/interactions/actions/rotate/frame.js.map +1 -0
  755. package/dist/interactions/actions/rotate/handle.js +12 -12
  756. package/dist/interactions/actions/rotate/handle.js.map +1 -1
  757. package/dist/interactions/actions/rotate/replay.js +22 -0
  758. package/dist/interactions/actions/rotate/replay.js.map +1 -0
  759. package/dist/interactions/actions/rotate/session.js +102 -0
  760. package/dist/interactions/actions/rotate/session.js.map +1 -0
  761. package/dist/interactions/actions/spatialReference.js.map +1 -1
  762. package/dist/interactions/actions/transform-again/action.js +63 -0
  763. package/dist/interactions/actions/transform-again/action.js.map +1 -0
  764. package/dist/interactions/actions/transform-again/memory.js +35 -0
  765. package/dist/interactions/actions/transform-again/memory.js.map +1 -0
  766. package/dist/interactions/actions/useStandardActions.js +84 -61
  767. package/dist/interactions/actions/useStandardActions.js.map +1 -1
  768. package/dist/interactions/gestures/pointerDrag/pointerDrag.js +61 -42
  769. package/dist/interactions/gestures/pointerDrag/pointerDrag.js.map +1 -1
  770. package/dist/interactions/gestures/shared/originProjection.js +1 -1
  771. package/dist/interactions/gestures/shared/originProjection.js.map +1 -1
  772. package/dist/interactions/gestures/shared/screenTolerance.js +8 -2
  773. package/dist/interactions/gestures/shared/screenTolerance.js.map +1 -1
  774. package/dist/interactions/gestures/shared/snap.js.map +1 -1
  775. package/dist/math-CYUjoyyU.d.ts +33 -0
  776. package/dist/math.d.ts +5 -2
  777. package/dist/math.js +6 -6
  778. package/dist/mesh.d.ts +4 -268
  779. package/dist/mesh.js +3 -7
  780. package/dist/move.d.ts +6 -4
  781. package/dist/{originProjection-gHnOup4e.d.ts → originProjection-CoNVpITV.d.ts} +1 -1
  782. package/dist/patterns-builtin.d.ts +1 -118
  783. package/dist/patterns-builtin.js +2 -3
  784. package/dist/poseDescriptor-Bqk-11Rl.d.ts +73 -0
  785. package/dist/renderer.d.ts +1 -92
  786. package/dist/renderer.js +2 -19
  787. package/dist/resize.d.ts +11 -22
  788. package/dist/resize.js +1 -1
  789. package/dist/style.css +1 -1
  790. package/dist/test-hook/install.js.map +1 -1
  791. package/dist/test-hook/useTestHook.js +22 -0
  792. package/dist/test-hook/useTestHook.js.map +1 -0
  793. package/dist/test-seams-D0pyV3pR.d.ts +149 -0
  794. package/dist/test-seams.d.ts +4 -4
  795. package/dist/test-seams.js +2 -2
  796. package/dist/tools/builtin/bone/boneActions.js +130 -0
  797. package/dist/tools/builtin/bone/boneActions.js.map +1 -0
  798. package/dist/tools/builtin/bone/boneOverlay.js +58 -0
  799. package/dist/tools/builtin/bone/boneOverlay.js.map +1 -0
  800. package/dist/tools/builtin/bone/placedRig.js +24 -0
  801. package/dist/tools/builtin/bone/placedRig.js.map +1 -0
  802. package/dist/tools/builtin/bone/rigEditState.js +21 -0
  803. package/dist/tools/builtin/bone/rigEditState.js.map +1 -0
  804. package/dist/tools/builtin/bone/useBoneTool.js +98 -0
  805. package/dist/tools/builtin/bone/useBoneTool.js.map +1 -0
  806. package/dist/tools/builtin/ellipse/useEllipseTool.js +16 -15
  807. package/dist/tools/builtin/ellipse/useEllipseTool.js.map +1 -1
  808. package/dist/tools/builtin/eyedropper/useEyedropperTool.js.map +1 -1
  809. package/dist/tools/builtin/hand/useHandTool.js.map +1 -1
  810. package/dist/tools/builtin/image/useImageTool.js.map +1 -1
  811. package/dist/tools/builtin/lasso/useLassoTool.js.map +1 -1
  812. package/dist/tools/builtin/line/useLineTool.js +16 -15
  813. package/dist/tools/builtin/line/useLineTool.js.map +1 -1
  814. package/dist/tools/builtin/pen/usePenTool.js +162 -164
  815. package/dist/tools/builtin/pen/usePenTool.js.map +1 -1
  816. package/dist/tools/builtin/pencil/usePencilTool.js.map +1 -1
  817. package/dist/tools/builtin/pickTopMostHit.js +11 -14
  818. package/dist/tools/builtin/pickTopMostHit.js.map +1 -1
  819. package/dist/tools/builtin/polygon/usePolygonTool.js +17 -15
  820. package/dist/tools/builtin/polygon/usePolygonTool.js.map +1 -1
  821. package/dist/tools/builtin/rect/useRectTool.js +15 -14
  822. package/dist/tools/builtin/rect/useRectTool.js.map +1 -1
  823. package/dist/tools/builtin/select/adapterPointQuery.js +40 -0
  824. package/dist/tools/builtin/select/adapterPointQuery.js.map +1 -0
  825. package/dist/tools/builtin/select/selectionContributions.js +5 -5
  826. package/dist/tools/builtin/select/selectionContributions.js.map +1 -1
  827. package/dist/tools/builtin/select/useSelectTool.js +44 -71
  828. package/dist/tools/builtin/select/useSelectTool.js.map +1 -1
  829. package/dist/tools/builtin/shared/pointerFollower.js.map +1 -1
  830. package/dist/tools/builtin/slice/useSliceTool.js +69 -72
  831. package/dist/tools/builtin/slice/useSliceTool.js.map +1 -1
  832. package/dist/tools/builtin/star/useStarTool.js +18 -16
  833. package/dist/tools/builtin/star/useStarTool.js.map +1 -1
  834. package/dist/tools/builtin/text/useTextTool.js +10 -2
  835. package/dist/tools/builtin/text/useTextTool.js.map +1 -1
  836. package/dist/tools/builtin/weight/useWeightTool.js +77 -0
  837. package/dist/tools/builtin/weight/useWeightTool.js.map +1 -0
  838. package/dist/tools/builtin/weight/weightActions.js +112 -0
  839. package/dist/tools/builtin/weight/weightActions.js.map +1 -0
  840. package/dist/tools/builtin/weight/weightOverlay.js +61 -0
  841. package/dist/tools/builtin/weight/weightOverlay.js.map +1 -0
  842. package/dist/tools/overlayBinding.js.map +1 -1
  843. package/dist/tools/useKeybindings.js +20 -14
  844. package/dist/tools/useKeybindings.js.map +1 -1
  845. package/dist/{types-k-5Oqh-U.d.ts → types-DBbbCy0i.d.ts} +103 -176
  846. package/dist/util/paint.js +1 -1
  847. package/dist/util/paint.js.map +1 -1
  848. package/dist/version.js +1 -1
  849. package/package.json +26 -21
  850. package/dist/animation/colorHelpers.js +0 -135
  851. package/dist/animation/colorHelpers.js.map +0 -1
  852. package/dist/animation/colorRegistry.js +0 -37
  853. package/dist/animation/colorRegistry.js.map +0 -1
  854. package/dist/animation/engine/axes.js +0 -36
  855. package/dist/animation/engine/axes.js.map +0 -1
  856. package/dist/animation/engine/codec.js +0 -170
  857. package/dist/animation/engine/codec.js.map +0 -1
  858. package/dist/animation/engine/integrator.js +0 -12
  859. package/dist/animation/engine/integrator.js.map +0 -1
  860. package/dist/animation/loop.js +0 -60
  861. package/dist/animation/loop.js.map +0 -1
  862. package/dist/animation/observe.js +0 -23
  863. package/dist/animation/observe.js.map +0 -1
  864. package/dist/animation/rig/blendPoses.js +0 -43
  865. package/dist/animation/rig/blendPoses.js.map +0 -1
  866. package/dist/animation/rig/mirrorPose.js +0 -19
  867. package/dist/animation/rig/mirrorPose.js.map +0 -1
  868. package/dist/animation/rig/resolveSkeleton.js +0 -33
  869. package/dist/animation/rig/resolveSkeleton.js.map +0 -1
  870. package/dist/animation/rig/solveIk.js +0 -103
  871. package/dist/animation/rig/solveIk.js.map +0 -1
  872. package/dist/animation/rig/types.js +0 -12
  873. package/dist/animation/rig/types.js.map +0 -1
  874. package/dist/animation/slew.js +0 -27
  875. package/dist/animation/slew.js.map +0 -1
  876. package/dist/animation/stagger.js +0 -146
  877. package/dist/animation/stagger.js.map +0 -1
  878. package/dist/animation/timeline/booking.js +0 -114
  879. package/dist/animation/timeline/booking.js.map +0 -1
  880. package/dist/animation/timeline/createTimeline.js +0 -125
  881. package/dist/animation/timeline/createTimeline.js.map +0 -1
  882. package/dist/animation/timeline/sampleTrack.js +0 -79
  883. package/dist/animation/timeline/sampleTrack.js.map +0 -1
  884. package/dist/animation/useAnimator.js +0 -388
  885. package/dist/animation/useAnimator.js.map +0 -1
  886. package/dist/autoPoseDescriptor-Ct7yqivU.d.ts +0 -108
  887. package/dist/builtins-DPcdghtB.d.ts +0 -1223
  888. package/dist/canvas/MinimapCanvas.js +0 -140
  889. package/dist/canvas/MinimapCanvas.js.map +0 -1
  890. package/dist/canvas/deps/poseComposition.js +0 -11
  891. package/dist/canvas/deps/poseComposition.js.map +0 -1
  892. package/dist/canvas/minimapMath.js +0 -82
  893. package/dist/canvas/minimapMath.js.map +0 -1
  894. package/dist/canvas/toolPreview.js +0 -39
  895. package/dist/canvas/toolPreview.js.map +0 -1
  896. package/dist/core/adapters/arrayAdapter.js +0 -94
  897. package/dist/core/adapters/arrayAdapter.js.map +0 -1
  898. package/dist/core/adapters/useArrayAdapter.js +0 -13
  899. package/dist/core/adapters/useArrayAdapter.js.map +0 -1
  900. package/dist/core/fillInPoseFrame.js +0 -102
  901. package/dist/core/fillInPoseFrame.js.map +0 -1
  902. package/dist/core/geometry/poseFrame.js +0 -44
  903. package/dist/core/geometry/poseFrame.js.map +0 -1
  904. package/dist/core/geometry/poseRotation.js +0 -58
  905. package/dist/core/geometry/poseRotation.js.map +0 -1
  906. package/dist/core/gradient.js +0 -136
  907. package/dist/core/gradient.js.map +0 -1
  908. package/dist/core/markerInset.js +0 -24
  909. package/dist/core/markerInset.js.map +0 -1
  910. package/dist/core/mixed.js +0 -6
  911. package/dist/core/mixed.js.map +0 -1
  912. package/dist/core/paintKinds.js +0 -156
  913. package/dist/core/paintKinds.js.map +0 -1
  914. package/dist/core/scene/pickability.js +0 -6
  915. package/dist/core/scene/pickability.js.map +0 -1
  916. package/dist/core/strokeMarkerShapes.js +0 -139
  917. package/dist/core/strokeMarkerShapes.js.map +0 -1
  918. package/dist/core/strokeMarkers.js +0 -28
  919. package/dist/core/strokeMarkers.js.map +0 -1
  920. package/dist/core/viewport/meanScale.js +0 -8
  921. package/dist/core/viewport/meanScale.js.map +0 -1
  922. package/dist/core/viewport/pxExtent.js +0 -42
  923. package/dist/core/viewport/pxExtent.js.map +0 -1
  924. package/dist/features/cursor/paintedCursorLayer.js.map +0 -1
  925. package/dist/features/focus/gateLayer.js.map +0 -1
  926. package/dist/features/focus/useCanvasFocus.js +0 -29
  927. package/dist/features/focus/useCanvasFocus.js.map +0 -1
  928. package/dist/features/groups/children.js.map +0 -1
  929. package/dist/features/groups/composePose.js +0 -67
  930. package/dist/features/groups/composePose.js.map +0 -1
  931. package/dist/features/groups/nestedHit.js.map +0 -1
  932. package/dist/features/groups/unionOfChildren.js.map +0 -1
  933. package/dist/features/images/imageCache.js +0 -104
  934. package/dist/features/images/imageCache.js.map +0 -1
  935. package/dist/features/ingestion/index.js +0 -8
  936. package/dist/features/meshPaint/bake.js +0 -79
  937. package/dist/features/meshPaint/bake.js.map +0 -1
  938. package/dist/features/meshPaint/bakeCache.js +0 -59
  939. package/dist/features/meshPaint/bakeCache.js.map +0 -1
  940. package/dist/features/meshPaint/handles.js +0 -86
  941. package/dist/features/meshPaint/handles.js.map +0 -1
  942. package/dist/features/meshPaint/lazyKind.js.map +0 -1
  943. package/dist/features/meshPaint/meshPaint.js +0 -239
  944. package/dist/features/meshPaint/meshPaint.js.map +0 -1
  945. package/dist/features/meshPaint/meshShader.js +0 -6
  946. package/dist/features/meshPaint/meshShader.js.map +0 -1
  947. package/dist/features/meshPaint/register.js +0 -7
  948. package/dist/features/meshPaint/register.js.map +0 -1
  949. package/dist/features/meshPaint/surface.js +0 -110
  950. package/dist/features/meshPaint/surface.js.map +0 -1
  951. package/dist/features/minimap/actions.js +0 -53
  952. package/dist/features/minimap/actions.js.map +0 -1
  953. package/dist/features/minimap/createMinimapContribution.js +0 -96
  954. package/dist/features/minimap/createMinimapContribution.js.map +0 -1
  955. package/dist/features/minimap/layers.js +0 -85
  956. package/dist/features/minimap/layers.js.map +0 -1
  957. package/dist/features/overlays/useNodeOverlayFrame.js +0 -103
  958. package/dist/features/overlays/useNodeOverlayFrame.js.map +0 -1
  959. package/dist/features/parallax/createParallaxLayer.js +0 -26
  960. package/dist/features/parallax/createParallaxLayer.js.map +0 -1
  961. package/dist/features/parallax/createParallaxPlane.js +0 -22
  962. package/dist/features/parallax/createParallaxPlane.js.map +0 -1
  963. package/dist/features/paths/anchorEdits.js +0 -167
  964. package/dist/features/paths/anchorEdits.js.map +0 -1
  965. package/dist/features/paths/anchors.js +0 -159
  966. package/dist/features/paths/anchors.js.map +0 -1
  967. package/dist/features/paths/booleans.js +0 -2
  968. package/dist/features/paths/markerCommands.js +0 -149
  969. package/dist/features/paths/markerCommands.js.map +0 -1
  970. package/dist/features/paths/markerSites.js +0 -59
  971. package/dist/features/paths/markerSites.js.map +0 -1
  972. package/dist/features/paths/markers.js +0 -95
  973. package/dist/features/paths/markers.js.map +0 -1
  974. package/dist/features/paths/nearestAnchor.js +0 -36
  975. package/dist/features/paths/nearestAnchor.js.map +0 -1
  976. package/dist/features/paths/pathInWorld.js +0 -41
  977. package/dist/features/paths/pathInWorld.js.map +0 -1
  978. package/dist/features/paths/poseDescriptor.js +0 -39
  979. package/dist/features/paths/poseDescriptor.js.map +0 -1
  980. package/dist/features/paths/strokeToPath.js +0 -40
  981. package/dist/features/paths/strokeToPath.js.map +0 -1
  982. package/dist/features/paths/tessellate/dash.js +0 -52
  983. package/dist/features/paths/tessellate/dash.js.map +0 -1
  984. package/dist/features/paths/tessellate/insets.js +0 -32
  985. package/dist/features/paths/tessellate/insets.js.map +0 -1
  986. package/dist/features/paths/tessellate/metric.js +0 -72
  987. package/dist/features/paths/tessellate/metric.js.map +0 -1
  988. package/dist/features/paths/tessellate/stroke.js +0 -170
  989. package/dist/features/paths/tessellate/stroke.js.map +0 -1
  990. package/dist/features/paths/tessellate/vertexWidths.js +0 -32
  991. package/dist/features/paths/tessellate/vertexWidths.js.map +0 -1
  992. package/dist/features/patterns/commandPaint.js +0 -18
  993. package/dist/features/patterns/commandPaint.js.map +0 -1
  994. package/dist/features/patterns/index.js +0 -11
  995. package/dist/features/patterns/index.js.map +0 -1
  996. package/dist/features/patterns/patterns-builtin.js +0 -38
  997. package/dist/features/patterns/patterns-builtin.js.map +0 -1
  998. package/dist/features/patterns/rasterizeTile.js +0 -17
  999. package/dist/features/patterns/rasterizeTile.js.map +0 -1
  1000. package/dist/features/patterns/resolveSpec.js +0 -65
  1001. package/dist/features/patterns/resolveSpec.js.map +0 -1
  1002. package/dist/features/patterns/tileGeometry.js +0 -158
  1003. package/dist/features/patterns/tileGeometry.js.map +0 -1
  1004. package/dist/features/pointer/PointerContext.js +0 -45
  1005. package/dist/features/pointer/PointerContext.js.map +0 -1
  1006. package/dist/features/selection/SelectionContext.js +0 -51
  1007. package/dist/features/selection/SelectionContext.js.map +0 -1
  1008. package/dist/features/simulation/createSimulation.js +0 -61
  1009. package/dist/features/simulation/createSimulation.js.map +0 -1
  1010. package/dist/features/simulation/types.js +0 -6
  1011. package/dist/features/simulation/types.js.map +0 -1
  1012. package/dist/features/simulation/useSimulation.js +0 -74
  1013. package/dist/features/simulation/useSimulation.js.map +0 -1
  1014. package/dist/features/text/domOffsets.js +0 -82
  1015. package/dist/features/text/domOffsets.js.map +0 -1
  1016. package/dist/features/text/domRuns.js +0 -230
  1017. package/dist/features/text/domRuns.js.map +0 -1
  1018. package/dist/features/text/fitTextPose.js +0 -38
  1019. package/dist/features/text/fitTextPose.js.map +0 -1
  1020. package/dist/features/text/hitTest.js +0 -48
  1021. package/dist/features/text/hitTest.js.map +0 -1
  1022. package/dist/features/text/isTextData.js +0 -8
  1023. package/dist/features/text/isTextData.js.map +0 -1
  1024. package/dist/features/text/overlayDirection.js +0 -15
  1025. package/dist/features/text/overlayDirection.js.map +0 -1
  1026. package/dist/features/text/renderLabel.js +0 -14
  1027. package/dist/features/text/renderLabel.js.map +0 -1
  1028. package/dist/features/text/runs/effectiveRangeStyle.js +0 -66
  1029. package/dist/features/text/runs/effectiveRangeStyle.js.map +0 -1
  1030. package/dist/features/text/runs/flagRange.js +0 -53
  1031. package/dist/features/text/runs/flagRange.js.map +0 -1
  1032. package/dist/features/text/runs/rangeStyle.js +0 -133
  1033. package/dist/features/text/runs/rangeStyle.js.map +0 -1
  1034. package/dist/features/text/textCommand.js +0 -60
  1035. package/dist/features/text/textCommand.js.map +0 -1
  1036. package/dist/features/text/textToPath.js +0 -181
  1037. package/dist/features/text/textToPath.js.map +0 -1
  1038. package/dist/features/text/useTextEdit.js +0 -491
  1039. package/dist/features/text/useTextEdit.js.map +0 -1
  1040. package/dist/features/tiling/createTiledLayer.js +0 -65
  1041. package/dist/features/tiling/createTiledLayer.js.map +0 -1
  1042. package/dist/features/tiling/tiledProject.js +0 -14
  1043. package/dist/features/tiling/tiledProject.js.map +0 -1
  1044. package/dist/interactions/actions/clone/behaviors/cloneByAltDrag.js +0 -26
  1045. package/dist/interactions/actions/clone/behaviors/cloneByAltDrag.js.map +0 -1
  1046. package/dist/interactions/actions/defaults/align.js.map +0 -1
  1047. package/dist/interactions/actions/defaults/booleans.js +0 -52
  1048. package/dist/interactions/actions/defaults/booleans.js.map +0 -1
  1049. package/dist/interactions/actions/defaults/clipboard.js.map +0 -1
  1050. package/dist/interactions/actions/defaults/clone.js +0 -91
  1051. package/dist/interactions/actions/defaults/clone.js.map +0 -1
  1052. package/dist/interactions/actions/defaults/createOutlines.js +0 -47
  1053. package/dist/interactions/actions/defaults/createOutlines.js.map +0 -1
  1054. package/dist/interactions/actions/defaults/distribute.js.map +0 -1
  1055. package/dist/interactions/actions/defaults/editAnchors.js +0 -100
  1056. package/dist/interactions/actions/defaults/editAnchors.js.map +0 -1
  1057. package/dist/interactions/actions/defaults/flip.js +0 -125
  1058. package/dist/interactions/actions/defaults/flip.js.map +0 -1
  1059. package/dist/interactions/actions/defaults/insert.js +0 -287
  1060. package/dist/interactions/actions/defaults/insert.js.map +0 -1
  1061. package/dist/interactions/actions/defaults/lassoSelect.js +0 -153
  1062. package/dist/interactions/actions/defaults/lassoSelect.js.map +0 -1
  1063. package/dist/interactions/actions/defaults/move.js +0 -778
  1064. package/dist/interactions/actions/defaults/move.js.map +0 -1
  1065. package/dist/interactions/actions/defaults/resize.js +0 -341
  1066. package/dist/interactions/actions/defaults/resize.js.map +0 -1
  1067. package/dist/interactions/actions/defaults/rotate.js +0 -185
  1068. package/dist/interactions/actions/defaults/rotate.js.map +0 -1
  1069. package/dist/interactions/actions/previewOverrides.js +0 -25
  1070. package/dist/interactions/actions/previewOverrides.js.map +0 -1
  1071. package/dist/interactions/actions/resize/autoPoseDescriptor.js.map +0 -1
  1072. package/dist/layout/arrivals.js +0 -36
  1073. package/dist/layout/arrivals.js.map +0 -1
  1074. package/dist/math-J-ACHyEg.d.ts +0 -159
  1075. package/dist/registerProgram-T9S_PfAX.d.ts +0 -208
  1076. package/dist/renderer/DrawCommand.js +0 -6
  1077. package/dist/renderer/DrawCommand.js.map +0 -1
  1078. package/dist/renderer/WeaselRenderer.js +0 -333
  1079. package/dist/renderer/WeaselRenderer.js.map +0 -1
  1080. package/dist/renderer/batchClip.js +0 -46
  1081. package/dist/renderer/batchClip.js.map +0 -1
  1082. package/dist/renderer/cache/GLImageCache.js +0 -74
  1083. package/dist/renderer/cache/GLImageCache.js.map +0 -1
  1084. package/dist/renderer/cache/GLMeshCache.js +0 -102
  1085. package/dist/renderer/cache/GLMeshCache.js.map +0 -1
  1086. package/dist/renderer/cache/GLTextureCache.js +0 -68
  1087. package/dist/renderer/cache/GLTextureCache.js.map +0 -1
  1088. package/dist/renderer/cache/GradientRampAtlas.js +0 -82
  1089. package/dist/renderer/cache/GradientRampAtlas.js.map +0 -1
  1090. package/dist/renderer/cache/cache.js +0 -13
  1091. package/dist/renderer/cache/cache.js.map +0 -1
  1092. package/dist/renderer/cache/markerCommandCache.js +0 -63
  1093. package/dist/renderer/cache/markerCommandCache.js.map +0 -1
  1094. package/dist/renderer/cache/outlineMeshCache.js +0 -15
  1095. package/dist/renderer/cache/outlineMeshCache.js.map +0 -1
  1096. package/dist/renderer/cache/outlineStrokeMeshCache.js +0 -36
  1097. package/dist/renderer/cache/outlineStrokeMeshCache.js.map +0 -1
  1098. package/dist/renderer/cache/strokeMeshCache.js +0 -55
  1099. package/dist/renderer/cache/strokeMeshCache.js.map +0 -1
  1100. package/dist/renderer/cullDrawCommands.js +0 -90
  1101. package/dist/renderer/cullDrawCommands.js.map +0 -1
  1102. package/dist/renderer/draw/batch.js +0 -133
  1103. package/dist/renderer/draw/batch.js.map +0 -1
  1104. package/dist/renderer/draw/clip.js +0 -89
  1105. package/dist/renderer/draw/clip.js.map +0 -1
  1106. package/dist/renderer/draw/customShader.js +0 -230
  1107. package/dist/renderer/draw/customShader.js.map +0 -1
  1108. package/dist/renderer/draw/drawTriangles.js +0 -8
  1109. package/dist/renderer/draw/drawTriangles.js.map +0 -1
  1110. package/dist/renderer/draw/effects.js +0 -28
  1111. package/dist/renderer/draw/effects.js.map +0 -1
  1112. package/dist/renderer/draw/flushBatch.js +0 -35
  1113. package/dist/renderer/draw/flushBatch.js.map +0 -1
  1114. package/dist/renderer/draw/gradient.js +0 -90
  1115. package/dist/renderer/draw/gradient.js.map +0 -1
  1116. package/dist/renderer/draw/image.js +0 -38
  1117. package/dist/renderer/draw/image.js.map +0 -1
  1118. package/dist/renderer/draw/mesh.js +0 -16
  1119. package/dist/renderer/draw/mesh.js.map +0 -1
  1120. package/dist/renderer/draw/paintBind.js +0 -70
  1121. package/dist/renderer/draw/paintBind.js.map +0 -1
  1122. package/dist/renderer/draw/pathPaint.js +0 -142
  1123. package/dist/renderer/draw/pathPaint.js.map +0 -1
  1124. package/dist/renderer/draw/scratchPass.js +0 -83
  1125. package/dist/renderer/draw/scratchPass.js.map +0 -1
  1126. package/dist/renderer/draw/stencil.js +0 -28
  1127. package/dist/renderer/draw/stencil.js.map +0 -1
  1128. package/dist/renderer/draw/text.js +0 -167
  1129. package/dist/renderer/draw/text.js.map +0 -1
  1130. package/dist/renderer/draw/uniforms.js +0 -77
  1131. package/dist/renderer/draw/uniforms.js.map +0 -1
  1132. package/dist/renderer/draw.js +0 -79
  1133. package/dist/renderer/draw.js.map +0 -1
  1134. package/dist/renderer/drawBatch.js +0 -198
  1135. package/dist/renderer/drawBatch.js.map +0 -1
  1136. package/dist/renderer/effects/EffectTargets.js +0 -48
  1137. package/dist/renderer/effects/EffectTargets.js.map +0 -1
  1138. package/dist/renderer/effects/builtins.js +0 -31
  1139. package/dist/renderer/effects/builtins.js.map +0 -1
  1140. package/dist/renderer/effects/composite.js +0 -11
  1141. package/dist/renderer/effects/composite.js.map +0 -1
  1142. package/dist/renderer/effects/effectPrelude.js +0 -10
  1143. package/dist/renderer/effects/effectPrelude.js.map +0 -1
  1144. package/dist/renderer/effects/types.js +0 -10
  1145. package/dist/renderer/effects/types.js.map +0 -1
  1146. package/dist/renderer/glyphOutlineMesh.js +0 -67
  1147. package/dist/renderer/glyphOutlineMesh.js.map +0 -1
  1148. package/dist/renderer/index.js +0 -20
  1149. package/dist/renderer/math/color.js +0 -321
  1150. package/dist/renderer/math/color.js.map +0 -1
  1151. package/dist/renderer/math/mat3.js +0 -80
  1152. package/dist/renderer/math/mat3.js.map +0 -1
  1153. package/dist/renderer/math/patternSpace.js +0 -22
  1154. package/dist/renderer/math/patternSpace.js.map +0 -1
  1155. package/dist/renderer/math/viewToMat3.js +0 -19
  1156. package/dist/renderer/math/viewToMat3.js.map +0 -1
  1157. package/dist/renderer/paintResources.js +0 -18
  1158. package/dist/renderer/paintResources.js.map +0 -1
  1159. package/dist/renderer/paintScratch.js +0 -37
  1160. package/dist/renderer/paintScratch.js.map +0 -1
  1161. package/dist/renderer/shaders/ShaderProgram.js +0 -74
  1162. package/dist/renderer/shaders/ShaderProgram.js.map +0 -1
  1163. package/dist/renderer/shaders/batchFill.js +0 -119
  1164. package/dist/renderer/shaders/batchFill.js.map +0 -1
  1165. package/dist/renderer/shaders/customPrelude.js +0 -34
  1166. package/dist/renderer/shaders/customPrelude.js.map +0 -1
  1167. package/dist/renderer/shaders/extractUniformNames.js +0 -184
  1168. package/dist/renderer/shaders/extractUniformNames.js.map +0 -1
  1169. package/dist/renderer/shaders/glyphPaint.js +0 -61
  1170. package/dist/renderer/shaders/glyphPaint.js.map +0 -1
  1171. package/dist/renderer/shaders/gradFill.js +0 -31
  1172. package/dist/renderer/shaders/gradFill.js.map +0 -1
  1173. package/dist/renderer/shaders/pathFill.js +0 -14
  1174. package/dist/renderer/shaders/pathFill.js.map +0 -1
  1175. package/dist/renderer/shaders/patternFill.js +0 -25
  1176. package/dist/renderer/shaders/patternFill.js.map +0 -1
  1177. package/dist/renderer/shaders/registerProgram.js +0 -18
  1178. package/dist/renderer/shaders/registerProgram.js.map +0 -1
  1179. package/dist/renderer/spriteSheet.js +0 -14
  1180. package/dist/renderer/spriteSheet.js.map +0 -1
  1181. package/dist/renderer/state/GroupState.js +0 -77
  1182. package/dist/renderer/state/GroupState.js.map +0 -1
  1183. package/dist/renderer/strokeLengths.js +0 -50
  1184. package/dist/renderer/strokeLengths.js.map +0 -1
  1185. package/dist/renderer/syntheticItalic.js +0 -6
  1186. package/dist/renderer/syntheticItalic.js.map +0 -1
  1187. package/dist/renderer/textures/registerTexture.js +0 -34
  1188. package/dist/renderer/textures/registerTexture.js.map +0 -1
  1189. package/dist/scheduling/useVisibleRaf.js +0 -69
  1190. package/dist/scheduling/useVisibleRaf.js.map +0 -1
  1191. package/dist/test-seams-DM2B87-g.d.ts +0 -356
@@ -1 +1 @@
1
- {"version":3,"file":"useDecayLoop.js","names":["SPRING_DAMPING","useDecayLoop","stateRef","useRef","frameLoop","useVisibleRaf","now","useCallback","cancel","tick","s","dt","f","dx","dy","newX","newY","minX","maxX","minY","maxY","start","config","velocity","minSpeed","initialPosition","useEffect"],"sources":["../../../src/core/viewport/useDecayLoop.ts"],"sourcesContent":["import { useCallback, useEffect, useRef } from 'react';\nimport { useVisibleRaf } from '../../scheduling/useVisibleRaf';\n\n/** Per-axis limits on a view's position. Any side may be left open. */\nexport interface PanBounds {\n minX?: number;\n maxX?: number;\n minY?: number;\n maxY?: number;\n}\n\n/** Momentum settings for a pan: how quickly a flung view slows, when it stops,\n * and what happens at the pan limits. The `DecayLoopConfig` fields a caller\n * chooses up front, without the per-gesture `velocity` / `onTick`. */\nexport interface InertiaConfig {\n friction?: number;\n minSpeed?: number;\n /** What to do when inertial pan reaches `bounds`. Default: no clamping. */\n boundary?: 'stop' | 'bounce' | 'spring';\n /** View-coordinate limits for boundary clamping. Requires `boundary` to take effect. */\n bounds?: PanBounds;\n}\n\n/** How a decay should run: its starting velocity, how fast it slows, and what\n * happens if it reaches the pan limits. */\nexport interface DecayLoopConfig {\n velocity: { vx: number; vy: number };\n friction?: number;\n minSpeed?: number;\n /** Bounds for boundary clamping. Requires `boundary` to take effect. */\n viewBounds?: PanBounds;\n /**\n * What to do when the accumulated position hits `viewBounds`. Default: no clamping.\n * - `'stop'`: clamp at boundary, kill velocity component.\n * - `'bounce'`: linear reflection — flip velocity sign, magnitude preserved.\n * - `'spring'`: damped reflection — flip velocity sign and shrink magnitude\n * by `SPRING_DAMPING` per bounce so the motion settles naturally.\n */\n boundary?: 'stop' | 'bounce' | 'spring';\n /** Starting position for internal boundary tracking. Required when `viewBounds` is set. */\n initialPosition?: { x: number; y: number };\n onTick: (dx: number, dy: number) => void;\n onEnd?: () => void;\n}\n\n/**\n * Fraction of velocity preserved per `'spring'` bounce. 0.5 means each bounce\n * loses half its energy, giving a quick visible settle (typically 2–4 bounces\n * before `minSpeed` cuts the loop). Fixed for v1; a future `bounceDamping`\n * config option could expose this if a consumer needs control.\n */\nconst SPRING_DAMPING = 0.5;\n\n/** A rAF loop that coasts a value to a stop under friction, reporting the\n * per-frame delta. What turns a released pan drag into momentum scrolling. */\nexport function useDecayLoop() {\n const stateRef = useRef<{\n vx: number; vy: number;\n friction: number; minSpeed: number;\n lastTime: number | null;\n posX: number; posY: number;\n viewBounds: PanBounds | undefined;\n boundary: 'stop' | 'bounce' | 'spring' | undefined;\n onTick: (dx: number, dy: number) => void;\n onEnd?: () => void;\n } | null>(null);\n\n const frameLoop = useVisibleRaf(\n (now: number) => { tick(now); },\n {\n // Coasting does not continue while suspended: dropping `lastTime` makes\n // the resuming frame seed a fresh interval instead of applying an hour of\n // friction at once, which would end the decay before it was seen.\n onResume: useCallback(() => {\n if (stateRef.current) stateRef.current.lastTime = null;\n }, []),\n },\n );\n\n const cancel = useCallback(() => {\n frameLoop.cancel();\n stateRef.current = null;\n }, [frameLoop]);\n\n const tick = useCallback((now: number) => {\n const s = stateRef.current;\n if (!s) return;\n if (s.lastTime === null) {\n s.lastTime = now;\n frameLoop.request();\n return;\n }\n const dt = Math.min(now - s.lastTime, 64); // cap at 64ms to avoid huge jumps\n s.lastTime = now;\n // Time-normalize friction to 60fps baseline\n const f = Math.pow(s.friction, dt / 16.67);\n s.vx *= f;\n s.vy *= f;\n const speed = Math.sqrt(s.vx * s.vx + s.vy * s.vy);\n if (speed < s.minSpeed) {\n stateRef.current = null;\n frameLoop.cancel();\n s.onEnd?.();\n return;\n }\n let dx = s.vx * dt;\n let dy = s.vy * dt;\n if (s.viewBounds && s.boundary) {\n const { minX, maxX, minY, maxY } = s.viewBounds;\n const newX = s.posX + dx;\n const newY = s.posY + dy;\n if (s.boundary === 'stop') {\n if (minX !== undefined && newX < minX) { dx = minX - s.posX; s.vx = 0; }\n else if (maxX !== undefined && newX > maxX) { dx = maxX - s.posX; s.vx = 0; }\n if (minY !== undefined && newY < minY) { dy = minY - s.posY; s.vy = 0; }\n else if (maxY !== undefined && newY > maxY) { dy = maxY - s.posY; s.vy = 0; }\n } else if (s.boundary === 'spring') {\n // Damped reflection: flip sign AND scale magnitude by SPRING_DAMPING so\n // each bounce loses energy. Once |v| < minSpeed the outer loop ends.\n if (minX !== undefined && newX < minX) { dx = minX - s.posX; s.vx = Math.abs(s.vx) * SPRING_DAMPING; }\n else if (maxX !== undefined && newX > maxX) { dx = maxX - s.posX; s.vx = -Math.abs(s.vx) * SPRING_DAMPING; }\n if (minY !== undefined && newY < minY) { dy = minY - s.posY; s.vy = Math.abs(s.vy) * SPRING_DAMPING; }\n else if (maxY !== undefined && newY > maxY) { dy = maxY - s.posY; s.vy = -Math.abs(s.vy) * SPRING_DAMPING; }\n } else {\n if (minX !== undefined && newX < minX) { dx = minX - s.posX; s.vx = Math.abs(s.vx); }\n else if (maxX !== undefined && newX > maxX) { dx = maxX - s.posX; s.vx = -Math.abs(s.vx); }\n if (minY !== undefined && newY < minY) { dy = minY - s.posY; s.vy = Math.abs(s.vy); }\n else if (maxY !== undefined && newY > maxY) { dy = maxY - s.posY; s.vy = -Math.abs(s.vy); }\n }\n s.posX += dx;\n s.posY += dy;\n }\n s.onTick(dx, dy);\n frameLoop.request();\n }, [frameLoop]);\n\n const start = useCallback((config: DecayLoopConfig) => {\n cancel();\n const { velocity, friction = 0.92, minSpeed = 0.01, viewBounds, boundary, initialPosition, onTick, onEnd } = config;\n const speed = Math.sqrt(velocity.vx ** 2 + velocity.vy ** 2);\n if (speed < minSpeed) { onEnd?.(); return; }\n stateRef.current = {\n vx: velocity.vx, vy: velocity.vy, friction, minSpeed, lastTime: null,\n posX: initialPosition?.x ?? 0, posY: initialPosition?.y ?? 0,\n viewBounds, boundary,\n onTick, onEnd,\n };\n frameLoop.request();\n }, [cancel, frameLoop]);\n\n useEffect(() => () => { cancel(); }, [cancel]);\n\n return { start, cancel };\n}\n"],"mappings":";;;AAmDA,IAAMA,IAAiB;AAIvB,SAAgBC,IAAe;CAC7B,IAAMC,IAAWC,EASP,IAAI,GAERC,IAAYC,GACf,MAAgB;EAAE,EAAKC,CAAG;CAAG,GAC9B,EAIE,UAAUC,QAAkB;EAC1B,AAAIL,EAAS,YAAS,EAAS,QAAQ,WAAW;CACpD,GAAG,CAAC,CAAC,EACP,CACF,GAEMM,IAASD,QAAkB;EAE/B,AADAH,EAAU,OAAO,GACjB,EAAS,UAAU;CACrB,GAAG,CAACA,CAAS,CAAC,GAERK,IAAOF,GAAa,MAAgB;EACxC,IAAMG,IAAIR,EAAS;EACnB,I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AACI,GAAQJ,CAAS,CAAC;CAItB,OAFAsB,cAAsB;EAAE,EAAO;CAAG,GAAG,CAAClB,CAAM,CAAC,GAEtC;EAAE;EAAO;CAAO;AACzB"}
1
+ {"version":3,"file":"useDecayLoop.js","names":["SPRING_DAMPING","useDecayLoop","stateRef","useRef","tick","useCallback","s","now","frameLoop","dt","f","dx","dy","newX","newY","minX","maxX","minY","maxY","useVisibleRaf","cancel","start","config","velocity","minSpeed","initialPosition","useEffect"],"sources":["../../../src/core/viewport/useDecayLoop.ts"],"sourcesContent":["import { useCallback, useEffect, useRef } from 'react';\nimport { useVisibleRaf, type VisibleRaf } from '@weasel-js/react';\n\n/** Per-axis limits on a view's position. Any side may be left open. */\nexport interface PanBounds {\n minX?: number;\n maxX?: number;\n minY?: number;\n maxY?: number;\n}\n\n/** Momentum settings for a pan: how quickly a flung view slows, when it stops,\n * and what happens at the pan limits. The `DecayLoopConfig` fields a caller\n * chooses up front, without the per-gesture `velocity` / `onTick`. */\nexport interface InertiaConfig {\n friction?: number;\n minSpeed?: number;\n /** What to do when inertial pan reaches `bounds`. Default: no clamping. */\n boundary?: 'stop' | 'bounce' | 'spring';\n /** View-coordinate limits for boundary clamping. Requires `boundary` to take effect. */\n bounds?: PanBounds;\n}\n\n/** How a decay should run: its starting velocity, how fast it slows, and what\n * happens if it reaches the pan limits. */\nexport interface DecayLoopConfig {\n velocity: { vx: number; vy: number };\n friction?: number;\n minSpeed?: number;\n /** Bounds for boundary clamping. Requires `boundary` to take effect. */\n viewBounds?: PanBounds;\n /**\n * What to do when the accumulated position hits `viewBounds`. Default: no clamping.\n * - `'stop'`: clamp at boundary, kill velocity component.\n * - `'bounce'`: linear reflection — flip velocity sign, magnitude preserved.\n * - `'spring'`: damped reflection — flip velocity sign and shrink magnitude\n * by `SPRING_DAMPING` per bounce so the motion settles naturally.\n */\n boundary?: 'stop' | 'bounce' | 'spring';\n /** Starting position for internal boundary tracking. Required when `viewBounds` is set. */\n initialPosition?: { x: number; y: number };\n onTick: (dx: number, dy: number) => void;\n onEnd?: () => void;\n}\n\n/**\n * Fraction of velocity preserved per `'spring'` bounce. 0.5 means each bounce\n * loses half its energy, giving a quick visible settle (typically 2–4 bounces\n * before `minSpeed` cuts the loop). Fixed for v1; a future `bounceDamping`\n * config option could expose this if a consumer needs control.\n */\nconst SPRING_DAMPING = 0.5;\n\n/** A rAF loop that coasts a value to a stop under friction, reporting the\n * per-frame delta. What turns a released pan drag into momentum scrolling. */\nexport function useDecayLoop() {\n const stateRef = useRef<{\n vx: number; vy: number;\n friction: number; minSpeed: number;\n lastTime: number | null;\n posX: number; posY: number;\n viewBounds: PanBounds | undefined;\n boundary: 'stop' | 'bounce' | 'spring' | undefined;\n onTick: (dx: number, dy: number) => void;\n onEnd?: () => void;\n } | null>(null);\n\n const tick = useCallback((now: number, frameLoop: VisibleRaf) => {\n const s = stateRef.current;\n if (!s) return;\n if (s.lastTime === null) {\n s.lastTime = now;\n frameLoop.request();\n return;\n }\n const dt = Math.min(now - s.lastTime, 64); // cap at 64ms to avoid huge jumps\n s.lastTime = now;\n // Time-normalize friction to 60fps baseline\n const f = Math.pow(s.friction, dt / 16.67);\n s.vx *= f;\n s.vy *= f;\n const speed = Math.sqrt(s.vx * s.vx + s.vy * s.vy);\n if (speed < s.minSpeed) {\n stateRef.current = null;\n frameLoop.cancel();\n s.onEnd?.();\n return;\n }\n let dx = s.vx * dt;\n let dy = s.vy * dt;\n if (s.viewBounds && s.boundary) {\n const { minX, maxX, minY, maxY } = s.viewBounds;\n const newX = s.posX + dx;\n const newY = s.posY + dy;\n if (s.boundary === 'stop') {\n if (minX !== undefined && newX < minX) { dx = minX - s.posX; s.vx = 0; }\n else if (maxX !== undefined && newX > maxX) { dx = maxX - s.posX; s.vx = 0; }\n if (minY !== undefined && newY < minY) { dy = minY - s.posY; s.vy = 0; }\n else if (maxY !== undefined && newY > maxY) { dy = maxY - s.posY; s.vy = 0; }\n } else if (s.boundary === 'spring') {\n // Damped reflection: flip sign AND scale magnitude by SPRING_DAMPING so\n // each bounce loses energy. Once |v| < minSpeed the outer loop ends.\n if (minX !== undefined && newX < minX) { dx = minX - s.posX; s.vx = Math.abs(s.vx) * SPRING_DAMPING; }\n else if (maxX !== undefined && newX > maxX) { dx = maxX - s.posX; s.vx = -Math.abs(s.vx) * SPRING_DAMPING; }\n if (minY !== undefined && newY < minY) { dy = minY - s.posY; s.vy = Math.abs(s.vy) * SPRING_DAMPING; }\n else if (maxY !== undefined && newY > maxY) { dy = maxY - s.posY; s.vy = -Math.abs(s.vy) * SPRING_DAMPING; }\n } else {\n if (minX !== undefined && newX < minX) { dx = minX - s.posX; s.vx = Math.abs(s.vx); }\n else if (maxX !== undefined && newX > maxX) { dx = maxX - s.posX; s.vx = -Math.abs(s.vx); }\n if (minY !== undefined && newY < minY) { dy = minY - s.posY; s.vy = Math.abs(s.vy); }\n else if (maxY !== undefined && newY > maxY) { dy = maxY - s.posY; s.vy = -Math.abs(s.vy); }\n }\n s.posX += dx;\n s.posY += dy;\n }\n s.onTick(dx, dy);\n frameLoop.request();\n }, []);\n\n const frameLoop = useVisibleRaf(\n tick,\n {\n // Coasting does not continue while suspended: dropping `lastTime` makes\n // the resuming frame seed a fresh interval instead of applying an hour of\n // friction at once, which would end the decay before it was seen.\n onResume: useCallback(() => {\n if (stateRef.current) stateRef.current.lastTime = null;\n }, []),\n },\n );\n\n const cancel = useCallback(() => {\n frameLoop.cancel();\n stateRef.current = null;\n }, [frameLoop]);\n\n const start = useCallback((config: DecayLoopConfig) => {\n cancel();\n const { velocity, friction = 0.92, minSpeed = 0.01, viewBounds, boundary, initialPosition, onTick, onEnd } = config;\n const speed = Math.sqrt(velocity.vx ** 2 + velocity.vy ** 2);\n if (speed < minSpeed) { onEnd?.(); return; }\n stateRef.current = {\n vx: velocity.vx, vy: velocity.vy, friction, minSpeed, lastTime: null,\n posX: initialPosition?.x ?? 0, posY: initialPosition?.y ?? 0,\n viewBounds, boundary,\n onTick, onEnd,\n };\n frameLo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AAG,CAACA,CAAS,CAAC,GAERa,IAAQhB,GAAa,MAA4B;EACrD,EAAO;EACP,IAAM,EAAE,aAAU,cAAW,KAAM,cAAW,KAAM,eAAY,aAAU,oBAAiB,WAAQ,aAAUiB;EAE7G,IADc,KAAK,KAAKC,EAAS,MAAM,IAAIA,EAAS,MAAM,CACtD,IAAQC,GAAU;GAAE,IAAQ;GAAG;EAAQ;EAO3C,AANA,EAAS,UAAU;GACjB,IAAID,EAAS;GAAI,IAAIA,EAAS;GAAI;GAAU;GAAU,UAAU;GAChE,MAAME,GAAiB,KAAK;GAAG,MAAMA,GAAiB,KAAK;GAC3D;GAAY;GACZ;GAAQ;EACV,GACAjB,EAAU,QAAQ;CACpB,GAAG,CAACY,GAAQZ,CAAS,CAAC;CAItB,OAFAkB,cAAsB;EAAE,EAAO;CAAG,GAAG,CAACN,CAAM,CAAC,GAEtC;EAAE;EAAO;CAAO;AACzB"}
@@ -0,0 +1,84 @@
1
+ import { useCanvasSize as e } from "./useCanvasSize.js";
2
+ import { composeWorldPose as t } from "../scene/composeFrame.js";
3
+ import { composeRectPose as n } from "../scene/composePose.js";
4
+ import { effectivePose as r } from "../scene/effectivePose.js";
5
+ import { applyToPoint as i, invert as a, multiply as o, poseFrameOf as s } from "@weasel-js/geom";
6
+ import { useCallback as c, useInsertionEffect as l, useRef as u } from "react";
7
+ //#region src/core/viewport/useNodeOverlayFrame.ts
8
+ function d(t, n, r, d = {}) {
9
+ let { width: h, height: g } = e(n), { view: _, compose: v } = d, y = c(() => {
10
+ let e = p(t, r, v);
11
+ if (!e) return null;
12
+ let n = s(e), i = m(f(_));
13
+ return n ? o(i, n) : i;
14
+ }, [
15
+ t,
16
+ r,
17
+ v,
18
+ _
19
+ ]), b = c((e) => {
20
+ let t = y();
21
+ if (!t) return e;
22
+ let [n, r] = i(t, e.x, e.y);
23
+ return {
24
+ x: n,
25
+ y: r
26
+ };
27
+ }, [y]), x = u(null), S = c((e) => {
28
+ let t = y(), n = t && a(t);
29
+ n && (x.current = n);
30
+ let [r, o] = i(n ?? x.current, e.x, e.y);
31
+ return {
32
+ x: r,
33
+ y: o
34
+ };
35
+ }, [y]), C = p(t, r, v), w = C && h !== 0 && g !== 0 ? y() : null, T = w && a(w);
36
+ return l(() => {
37
+ T && (x.current = T);
38
+ }), !C || !T ? null : {
39
+ box: {
40
+ x: C.x,
41
+ y: C.y,
42
+ width: C.width,
43
+ height: C.height
44
+ },
45
+ toScreen: b,
46
+ toLocal: S,
47
+ width: h,
48
+ height: g
49
+ };
50
+ }
51
+ function f(e) {
52
+ return typeof e == "function" ? e() : e;
53
+ }
54
+ function p(e, i, a) {
55
+ if (i == null) return null;
56
+ let o = e.nodes;
57
+ return o.has(i) ? t({
58
+ getPose: (t) => r(e, o.get(t)),
59
+ getParent: (e) => o.get(e)?.parent ?? null
60
+ }, i, a ?? n) : null;
61
+ }
62
+ function m(e) {
63
+ if (!e) return [
64
+ 1,
65
+ 0,
66
+ 0,
67
+ 1,
68
+ 0,
69
+ 0
70
+ ];
71
+ let { x: t, y: n } = e.scale;
72
+ return [
73
+ t,
74
+ 0,
75
+ 0,
76
+ n,
77
+ -e.x * t,
78
+ -e.y * n
79
+ ];
80
+ }
81
+ //#endregion
82
+ export { d as useNodeOverlayFrame };
83
+
84
+ //# sourceMappingURL=useNodeOverlayFrame.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useNodeOverlayFrame.js","names":["useNodeOverlayFrame","useCanvasSize","containerRef","options","project","useCallback","box","worldBoxOf","scene","nodeId","compose","frame","poseFrameOf","toView","viewMatrix","resolveView","view","multiply","toScreen","m","p","x","y","applyToPoint","lastInverse","useRef","toLocal","inverse","invert","width","height","useInsertionEffect","nodes","composeWorldPose","effectivePose","id","composeRectPose","sx","sy"],"sources":["../../../src/core/viewport/useNodeOverlayFrame.ts"],"sourcesContent":["/**\n * `useNodeOverlayFrame` — the coordinate frame a DOM overlay pinned to one\n * scene node needs: the node's world box, the projection from that box's\n * frame into overlay pixels, and the overlay's measured size.\n *\n * `toScreen` maps the node's **unrotated world box** frame, which is the\n * frame `fillInPoseFrame` resolves a `units: 'bounds'` paint into and the\n * one `pathInPoseFrame` projects geometry into. The pose's rotation and\n * `transform` live in this hook, not in those: a node's stored geometry is\n * in its box by definition.\n */\nimport { useCallback, useInsertionEffect, useRef, type RefObject } from 'react';\nimport { applyToPoint, invert, multiply, poseFrameOf, type Affine } from '@weasel-js/geom';\nimport type { Node, RectPose, Scene } from '../scene/types';\nimport { useCanvasSize } from './useCanvasSize';\nimport type { View } from './view';\nimport { composeRectPose, composeWorldPose } from 'core/scene/composePose';\nimport { effectivePose } from 'core/scene/effectivePose';\n\n/** Structural point, matching every other `{ x, y }` the kit passes across a\n * boundary. */\nexport interface OverlayPoint {\n x: number;\n y: number;\n}\n\n/** The overlay frame for one node. `null` from the hook means there is no\n * frame yet — no node, or nothing measured to draw it on. */\nexport interface NodeOverlayFrame {\n /** The node's composed world box, **unrotated**: the frame `toScreen` maps\n * from, and the box to hand `fillInPoseFrame` / `fillToBoundsFrame`. */\n box: { x: number; y: number; width: number; height: number };\n /** Node box frame → overlay pixels: the pose's rotation and `transform`,\n * then the view. */\n toScreen: (p: OverlayPoint) => OverlayPoint;\n /** Overlay pixels → node box frame. Inverts `toScreen`; while a live view\n * flattens an axis, it keeps the last mapping that had an inverse. */\n toLocal: (p: OverlayPoint) => OverlayPoint;\n /** The container's size in CSS pixels — the overlay's own box. */\n width: number;\n height: number;\n}\n\n/** Options for `useNodeOverlayFrame`. */\nexport interface UseNodeOverlayFrameOptions<TPose> {\n /**\n * Current viewport. A thunk is re-read on every projection, which is what\n * an uncontrolled `SceneCanvas` needs — its camera moves without a render,\n * so pass the handle's `getView`. Omit it and world units are handed\n * through as screen pixels.\n */\n view?: View | (() => View);\n /** Fold a child pose into its parent's frame. Default `composeRectPose`. */\n compose?: (parent: TPose, child: TPose) => TPose;\n}\n\n/**\n * Resolve the overlay frame for `nodeId` against `containerRef` — the element\n * the overlay is positioned in, which must be the canvas's own box for the\n * projection to land.\n *\n * Returns `null` when there is no node under `nodeId`, when the container has\n * not been measured, or when the view or the pose's `transform` collapses an\n * axis to zero.\n */\nexport function useNodeOverlayFrame<TData, TLayer extends string, TPose extends RectPose>(\n scene: Scene<TData, TLayer, TPose>,\n containerRef: RefObject<HTMLElement | null>,\n nodeId: string | null | undefined,\n options: UseNodeOverlayFrameOptions<TPose> = {},\n): NodeOverlayFrame | null {\n const { width, height } = useCanvasSize(containerRef);\n const { view, compose } = options;\n\n const project = useCallback((): Affine | null => {\n const box = worldBoxOf(scene, nodeId, compose);\n if (!box) return null;\n const frame = poseFrameOf(box);\n const toView = viewMatrix(resolveView(view));\n return frame ? multiply(toView, frame) : toView;\n }, [scene, nodeId, compose, view]);\n\n const toScreen = useCallback((p: OverlayPoint): OverlayPoint => {\n const m = project();\n if (!m) return p;\n const [x, y] = applyToPoint(m, p.x, p.y);\n return { x, y };\n }, [project]);\n\n const lastInverse = useRef<Affine | null>(null);\n\n const toLocal = useCallback((p: OverlayPoint): OverlayPoint => {\n const m = project();\n const inverse = m && invert(m);\n if (inverse) lastInverse.current = inverse;\n // Published by the commit that handed this toLocal out, so there is one.\n const [x, y] = applyToPoint(inverse ?? lastInverse.current!, p.x, p.y);\n return { x, y };\n }, [project]);\n\n const box = worldBoxOf(scene, nodeId, compose);\n const m = box && width !== 0 && height !== 0 ? project() : null;\n const inverse = m && invert(m);\n useInsertionEffect(() => {\n if (inverse) lastInverse.current = inverse;\n });\n\n if (!box || !inverse) return null;\n return { box: { x: box.x, y: box.y, width: box.width, height: box.height }, toScreen, toLocal, width, height };\n}\n\nfunction resolveView(view: View | (() => View) | undefined): View | undefined {\n return typeof view === 'function' ? view() : view;\n}\n\nfunction worldBoxOf<TData, TLayer extends string, TPose extends RectPose>(\n scene: Scene<TData, TLayer, TPose>,\n nodeId: string | null | undefined,\n compose: ((parent: TPose, child: TPose) => TPose) | undefined,\n): TPose | null {\n if (nodeId == null) return null;\n const nodes = scene.nodes as ReadonlyMap<string, Node<TData, TLayer, TPose>>;\n if (!nodes.has(nodeId)) return null;\n // `effectivePose`, not `node.pose`: an overlay tracks what the renderer\n // draws, and a gesture override or a derived pose is exactly the difference.\n const adapter = {\n getPose: (id: string) => effectivePose(scene, nodes.get(id)!),\n getParent: (id: string) => nodes.get(id)?.parent ?? null,\n };\n return composeWorldPose(adapter, nodeId, compose ?? composeRectPose);\n}\n\n/** World → overlay pixels: `screen = (world − view) × view.scale`. */\nfunction viewMatrix(view: View | undefined): Affine {\n if (!view) return [1, 0, 0, 1, 0, 0];\n const { x: sx, y: sy } = view.scale;\n return [sx, 0, 0, sy, -view.x * sx, -view.y * sy];\n}\n"],"mappings":";;;;;;;AAiEA,SAAgBA,EACd,GACA,GACA,GACA,IAA6C,CAAC,GACrB;CACzB,IAAM,EAAE,UAAO,cAAWC,EAAcC,CAAY,GAC9C,EAAE,SAAM,eAAYC,GAEpBC,IAAUC,QAAiC;EAC/C,IAAMC,IAAMC,EAAWC,GAAOC,GAAQC,CAAO;EAC7C,IAAI,CAACJ,GAAK,OAAO;EACjB,IAAMK,IAAQC,EAAYN,CAAG,GACvBO,IAASC,EAAWC,EAAYC,CAAI,CAAC;EAC3C,OAAOL,IAAQM,EAASJ,GAAQF,CAAK,IAAIE;CAC3C,GAAG;EAACL;EAAOC;EAAQC;EAASM;CAAI,CAAC,GAE3BE,IAAWb,GAAa,MAAkC;EAC9D,IAAMc,IAAIf,EAAQ;EAClB,IAAI,CAACe,GAAG,OAAOC;EACf,IAAM,CAACC,GAAGC,KAAKC,EAAaJ,GAAGC,EAAE,GAAGA,EAAE,CAAC;EACvC,OAAO;GAAE;GAAG;EAAE;CAChB,GAAG,CAAChB,CAAO,CAAC,GAENoB,IAAcC,EAAsB,IAAI,GAExCC,IAAUrB,GAAa,MAAkC;EAC7D,IAAMc,IAAIf,EAAQ,GACZuB,IAAUR,KAAKS,EAAOT,CAAC;EAC7B,AAAIQ,MAAS,EAAY,UAAUA;EAEnC,IA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fitViewToBounds as t } from "./fitViewToBounds.js";
3
3
  import { interpolateView as n } from "./interpolateView.js";
4
- import { useAnimator as r } from "../../animation/useAnimator.js";
5
- import { easeOutCubic as i } from "@weasel-js/geom";
6
- import { useId as a, useMemo as o, useRef as s } from "react";
7
- import { useLatest as c } from "@weasel-js/react";
4
+ import { easeOutCubic as r } from "@weasel-js/geom";
5
+ import { useId as i, useMemo as a, useRef as o } from "react";
6
+ import { useLatest as s } from "@weasel-js/react";
7
+ import { createTarget as c, useAnimator as l } from "@weasel-js/animator";
8
8
  //#region src/core/viewport/useViewAnimation.ts
9
- var l = "view", u = 250;
10
- function d(e, t) {
11
- let n = r();
12
- return f(e, t ?? n);
9
+ var u = "view", d = 250, f = {
10
+ count: 4,
11
+ names: [
12
+ "x",
13
+ "y",
14
+ "scale.x",
15
+ "scale.y"
16
+ ],
17
+ to: (e) => [
18
+ e.x,
19
+ e.y,
20
+ e.scale.x,
21
+ e.scale.y
22
+ ],
23
+ from: (e) => ({
24
+ x: e[0],
25
+ y: e[1],
26
+ scale: {
27
+ x: e[2],
28
+ y: e[3]
29
+ }
30
+ }),
31
+ add: (e, t) => ({
32
+ x: e.x + t[0],
33
+ y: e.y + t[1],
34
+ scale: {
35
+ x: e.scale.x + t[2],
36
+ y: e.scale.y + t[3]
37
+ }
38
+ }),
39
+ write: (e, t, n) => {
40
+ t[n] = e.x, t[n + 1] = e.y, t[n + 2] = e.scale.x, t[n + 3] = e.scale.y;
41
+ }
42
+ };
43
+ function p(e, t) {
44
+ let n = l();
45
+ return m(e, t ?? n);
13
46
  }
14
- function f(r, d) {
15
- let f = `${l}:${a()}`, p = c(r), m = c(d), h = s(null), g = s(!1);
16
- return o(() => {
17
- let r = () => m.current.isActive(f), a = () => r() ? h.current : null, o = () => {
18
- m.current.cancelKey(f), h.current = null;
19
- }, s = (t, r = {}) => {
20
- let s = p.current.get(), c = e(typeof t == "function" ? t(a() ?? s) : t);
21
- o(), h.current = c, m.current.tween({
22
- from: s,
23
- to: c,
24
- ms: r.ms ?? u,
25
- easing: r.easing ?? i,
26
- interpolator: r.interpolator ?? n,
27
- cancelKey: f,
28
- onTick: (e) => {
29
- g.current = !0;
30
- try {
31
- p.current.set(e);
32
- } finally {
33
- g.current = !1;
34
- }
35
- },
36
- onDone: () => {
37
- h.current = null, r.onDone?.();
38
- }
39
- });
40
- };
41
- return {
42
- animate: s,
43
- animateToBounds: (e, n, r = {}) => {
44
- let i = p.current.get(), a = t(e, n, i, r);
45
- a !== i && s(a, r);
46
- },
47
- stop: o,
48
- isAnimating: r,
49
- target: a,
50
- stopIfExternal: () => {
51
- g.current || o();
52
- }
53
- };
54
- }, [
55
- f,
56
- p,
57
- m
47
+ function m(e, t) {
48
+ let n = `${u}:${i()}`, r = s(e), c = s(t), l = o(null), d = o(!1);
49
+ return a(() => h(n, r, c, l, d), [
50
+ n,
51
+ r,
52
+ c
58
53
  ]);
59
54
  }
55
+ function h(i, a, o, s, l) {
56
+ let u = null, p = null, m = () => {
57
+ if (u) return u;
58
+ let e = a.current.get();
59
+ return p ? f.from(f.to(e).map((e, t) => e - p[t])) : e;
60
+ }, h = (t) => {
61
+ l.current = !0;
62
+ try {
63
+ a.current.set(e(t));
64
+ } finally {
65
+ l.current = !1;
66
+ }
67
+ }, g = c({
68
+ axes: f,
69
+ get: m,
70
+ set: (e) => {
71
+ u = e, p = null;
72
+ },
73
+ show: (e) => {
74
+ if (g.active) {
75
+ u || (u = m(), p = null), h(e);
76
+ return;
77
+ }
78
+ let t = u;
79
+ u = p = null, t && h(t);
80
+ }
81
+ }), _ = () => o.current.isActive(i), v = () => _() ? s.current : null, y = () => {
82
+ o.current.cancelKey(i), s.current = null;
83
+ }, b = () => {
84
+ y(), g.active || (u = p = null);
85
+ }, x = (t, a = {}) => {
86
+ let c = e(typeof t == "function" ? t(v() ?? m()) : t);
87
+ s.current = c, o.current.tween({
88
+ target: g,
89
+ to: c,
90
+ ms: a.ms ?? d,
91
+ easing: a.easing ?? r,
92
+ interpolator: a.interpolator ?? n,
93
+ cancelKey: i,
94
+ onDone: () => {
95
+ s.current = null, h(g.read()), g.active || (u = p = null), a.onDone?.();
96
+ }
97
+ });
98
+ };
99
+ return {
100
+ animate: x,
101
+ animateToBounds: (e, n, r = {}) => {
102
+ let i = a.current.get(), o = t(e, n, i, r);
103
+ o !== i && x(o, r);
104
+ },
105
+ stop: b,
106
+ isAnimating: _,
107
+ target: v,
108
+ stopIfExternal: () => {
109
+ if (!l.current) {
110
+ if (y(), g.active) {
111
+ let e = f.to(g.read()), t = f.to(m());
112
+ p = e.map((e, n) => e - t[n]);
113
+ } else p = null;
114
+ u = null;
115
+ }
116
+ },
117
+ viewTarget: g
118
+ };
119
+ }
60
120
  //#endregion
61
- export { l as VIEW_ANIMATION_KEY, d as useViewAnimation, f as useViewAnimationOn };
121
+ export { u as VIEW_ANIMATION_KEY, p as useViewAnimation, m as useViewAnimationOn, f as viewAxes };
62
122
 
63
123
  //# sourceMappingURL=useViewAnimation.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"useViewAnimation.js","names":["VIEW_ANIMATION_KEY","DEFAULT_MS","useViewAnimation","own","useAnimator","useViewAnimationOn","view","animator","key","useId","viewRef","useLatest","animatorRef","targetRef","useRef","writingRef","useMemo","isAnimating","target","stop","animate","from","resolved","normalizeView","to","opts","easeOutCubic","interpolateView","v","current","fitted","fitViewToBounds","bounds","dims"],"sources":["../../../src/core/viewport/useViewAnimation.ts"],"sourcesContent":["import { useId, useMemo, useRef } from 'react';\nimport { useLatest } from '@weasel-js/react';\nimport { useAnimator } from '../../animation/useAnimator';\nimport { easeOutCubic } from '@weasel-js/geom';\nimport type { Animator, EasingSpec, InterpolatorFactory } from '../../animation/types';\nimport { interpolateView } from './interpolateView';\nimport { fitViewToBounds } from './fitViewToBounds';\nimport type { Bounds, FitViewToBoundsOptions, ViewportDims } from './fitViewToBounds';\nimport { normalizeView, type View } from './view';\n\n/** Cancel-key prefix. Each hook instance appends its own id, so two runners\n * sharing an animator do not cancel each other. */\nexport const VIEW_ANIMATION_KEY = 'view';\n\nconst DEFAULT_MS = 250;\n\n/** How the camera should move. */\nexport interface ViewAnimationOptions {\n /** Duration in ms. Default 250. */\n ms?: number;\n /** Easing curve. Default `easeOutCubic`. */\n easing?: EasingSpec;\n /** Replace the kit's log-scale / fixed-anchor curve. */\n interpolator?: InterpolatorFactory<View>;\n /** Fires when the target is reached. Not called on cancel. */\n onDone?: () => void;\n}\n\n/** Options accepted by {@link ViewAnimationApi.animateToBounds}. */\nexport interface AnimateToBoundsOptions extends FitViewToBoundsOptions, ViewAnimationOptions {}\n\n/** What the runner reads and writes. On `<SceneCanvas>` this is the same\n * channel `view.set` uses, so a camera animation on an uncontrolled canvas\n * costs no React render. */\nexport interface ViewChannel {\n get(): View;\n set(v: View): void;\n}\n\n/** The camera animation surface. One animation at a time. */\nexport interface ViewAnimationApi {\n /** Glide from the live view to `to`. A thunk receives the pending target when\n * one is in flight, so successive discrete steps compound. */\n animate(to: View | ((base: View) => View), opts?: ViewAnimationOptions): void;\n /** `fitViewToBounds` composed with `animate`. */\n animateToBounds(bounds: Bounds, dims: ViewportDims, opts?: AnimateToBoundsOptions): void;\n /** Cancel. The view stays where it is — no jump to the target. */\n stop(): void;\n isAnimating(): boolean;\n /** Where the in-flight animation is heading, or null when none is. */\n target(): View | null;\n /** Cancel unless the write that prompted this came from the runner's own\n * per-frame write. Feed it from every channel that can move the camera. */\n stopIfExternal(): void;\n}\n\n/**\n * Animate the viewport `View`. Runs on the kit's {@link Animator} — pass one to\n * share a canvas's animator, or omit it and the hook makes its own. A caller\n * that always has one should use {@link useViewAnimationOn}, which builds none.\n *\n * Every animation from one instance registers under that instance's cancel key,\n * so starting one cancels whatever *it* had in flight, and each starts from the\n * *live* view rather than a captured value — an interrupted camera never jumps.\n * Two instances on one animator are independent.\n */\nexport function useViewAnimation(view: ViewChannel, animator?: Animator): ViewAnimationApi {\n const own = useAnimator();\n return useViewAnimationOn(view, animator ?? own);\n}\n\n/** {@link useViewAnimation} on an animator the caller owns. Constructs no\n * animator of its own, so the camera runs on exactly the one passed. */\nexport function useViewAnimationOn(view: ViewChannel, animator: Animator): ViewAnimationApi {\n const key = `${VIEW_ANIMATION_KEY}:${useId()}`;\n const viewRef = useLatest(view);\n const animatorRef = useLatest(animator);\n const targetRef = useRef<View | null>(null);\n const writingRef = useRef(false);\n\n return useMemo<ViewAnimationApi>(() => {\n const isAnimating = () => animatorRef.current.isActive(key);\n const target = () => (isAnimating() ? targetRef.current : null);\n const stop = () => {\n animatorRef.current.cancelKey(key);\n targetRef.current = null;\n };\n\n const animate: ViewAnimationApi['animate'] = (to, opts = {}) => {\n const from = viewRef.current.get();\n const resolved = normalizeView(typeof to === 'function' ? to(target() ?? from) : to);\n stop();\n targetRef.current = resolved;\n animatorRef.current.tween<View>({\n from,\n to: resolved,\n ms: opts.ms ?? DEFAULT_MS,\n easing: opts.easing ?? easeOutCubic,\n interpolator: opts.interpolator ?? interpolateView,\n cancelKey: key,\n onTick: (v) => {\n writingRef.current = true;\n try { viewRef.current.set(v); } finally { writingRef.current = false; }\n },\n onDone: () => {\n targetRef.current = null;\n opts.onDone?.();\n },\n });\n };\n\n return {\n animate,\n animateToBounds: (bounds, dims, opts = {}) => {\n const current = viewRef.current.get();\n const fitted = fitViewToBounds(bounds, dims, current, opts);\n if (fitted === current) return; // helper bailed (zero-area bounds/viewport)\n animate(fitted, opts);\n },\n stop,\n isAnimating,\n target,\n stopIfExternal: () => { if (!writingRef.current) stop(); },\n };\n }, [key, viewRef, animatorRef]);\n}\n"],"mappings":";;;;;;;;AAYA,IAAaA,IAAqB,QAE5BC,IAAa;AAoDnB,SAAgBC,EAAiB,GAAmB,GAAuC;CACzF,IAAMC,IAAMC,EAAY;CACxB,OAAOC,EAAmBC,GAAMC,KAAYJ,CAAG;AACjD;AAIA,SAAgBE,EAAmB,GAAmB,GAAsC;CAC1F,IAAMG,IAAM,GAAGR,EAAmB,GAAGS,EAAM,KACrCC,IAAUC,EAAU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","a","d","at","useViewAnimation","own","useAnimator","useViewAnimationOn","view","animator","key","useId","viewRef","useLatest","animatorRef","targetRef","useRef","writingRef","useMemo","createViewAnimation","committed","offset","base","live","n","i","write","normalizeView","viewTarget","createTarget","landed","isAnimating","target","cancel","stop","animate","resolved","to","opts","easeOutCubic","interpolateView","current","fitted","fitViewToBounds","bounds","dims","shown","under"],"sources":["../../../src/core/viewport/useViewAnimation.ts"],"sourcesContent":["import { useId, useMemo, useRef } from 'react';\nimport { useLatest } from '@weasel-js/react';\nimport { useAnimator } from '@weasel-js/animator';\nimport { easeOutCubic } from '@weasel-js/geom';\nimport type { Animator, EasingSpec, InterpolatorFactory } from '@weasel-js/animator';\nimport { createTarget, type Target, type TargetAxes } from '@weasel-js/animator';\nimport { interpolateView } from './interpolateView';\nimport { fitViewToBounds } from './fitViewToBounds';\nimport type { Bounds, FitViewToBoundsOptions, ViewportDims } from './fitViewToBounds';\nimport { normalizeView, type View } from './view';\n\n/** Cancel-key prefix. Each hook instance appends its own id, so two runners\n * sharing an animator do not cancel each other. */\nexport const VIEW_ANIMATION_KEY = 'view';\n\nconst DEFAULT_MS = 250;\n\n/** How the camera should move. */\nexport interface ViewAnimationOptions {\n /** Duration in ms. Default 250. */\n ms?: number;\n /** Easing curve. Default `easeOutCubic`. */\n easing?: EasingSpec;\n /** Replace the kit's log-scale / fixed-anchor curve. */\n interpolator?: InterpolatorFactory<View>;\n /** Fires when the target is reached. Not called on cancel. */\n onDone?: () => void;\n}\n\n/** Options accepted by {@link ViewAnimationApi.animateToBounds}. */\nexport interface AnimateToBoundsOptions extends FitViewToBoundsOptions, ViewAnimationOptions {}\n\n/** What the runner reads and writes. On `<SceneCanvas>` this is the same\n * channel `view.set` uses, so a camera animation on an uncontrolled canvas\n * costs no React render. */\nexport interface ViewChannel {\n get(): View;\n set(v: View): void;\n}\n\n/** The camera animation surface. Its own animations run one at a time. */\nexport interface ViewAnimationApi {\n /** Glide from the live view to `to`. A thunk receives the pending target when\n * one is in flight, so successive discrete steps compound. */\n animate(to: View | ((base: View) => View), opts?: ViewAnimationOptions): void;\n /** `fitViewToBounds` composed with `animate`. */\n animateToBounds(bounds: Bounds, dims: ViewportDims, opts?: AnimateToBoundsOptions): void;\n /** Cancel. The view stays where it is — no jump to the target. */\n stop(): void;\n isAnimating(): boolean;\n /** Where the in-flight animation is heading, or null when none is. */\n target(): View | null;\n /** Cancel unless the write that prompted this came from the runner's own\n * per-frame write. Feed it from every channel that can move the camera. */\n stopIfExternal(): void;\n /**\n * The view as a {@link Target}, for running another animation on it: a shake\n * or a nudge adds to a camera animation in flight, and neither cancels the\n * other. Move it with the animator this runner was given, and without this\n * runner's cancel key. `stop` and an outside write leave such an animation\n * running.\n */\n readonly viewTarget: Target<View>;\n}\n\n/** A `View` as the four numbers an animation moves: `x`, `y`, `scale.x`, `scale.y`. */\nexport const viewAxes: TargetAxes<View> = {\n count: 4,\n names: ['x', 'y', 'scale.x', 'scale.y'],\n to: (v) => [v.x, v.y, v.scale.x, v.scale.y],\n from: (a) => ({ x: a[0]!, y: a[1]!, scale: { x: a[2]!, y: a[3]! } }),\n add: (v, d) => ({ x: v.x + d[0]!, y: v.y + d[1]!, scale: { x: v.scale.x + d[2]!, y: v.scale.y + d[3]! } }),\n write: (v, out, at) => {\n out[at] = v.x;\n out[at + 1] = v.y;\n out[at + 2] = v.scale.x;\n out[at + 3] = v.scale.y;\n },\n};\n\n/**\n * Animate the viewport `View`. Runs on the kit's {@link Animator} — pass one to\n * share a canvas's animator, or omit it and the hook makes its own. A caller\n * that always has one should use {@link useViewAnimationOn}, which builds none.\n *\n * Every animation from one instance registers under that instance's cancel key,\n * so starting one cancels whatever *it* had in flight, and each starts from where\n * the last one was rather than a captured value — an interrupted camera never jumps.\n * Two instances on one animator are independent. The view is a target\n * ({@link ViewAnimationApi.viewTarget}), so other animations can add to the camera's.\n */\nexport function useViewAnimation(view: ViewChannel, animator?: Animator): ViewAnimationApi {\n const own = useAnimator();\n return useViewAnimationOn(view, animator ?? own);\n}\n\n/** {@link useViewAnimation} on an animator the caller owns. Constructs no\n * animator of its own, so the camera runs on exactly the one passed. */\nexport function useViewAnimationOn(view: ViewChannel, animator: Animator): ViewAnimationApi {\n const key = `${VIEW_ANIMATION_KEY}:${useId()}`;\n const viewRef = useLatest(view);\n const animatorRef = useLatest(animator);\n /** Where this runner's own animation is heading. */\n const targetRef = useRef<View | null>(null);\n const writingRef = useRef(false);\n\n return useMemo(\n () => createViewAnimation(key, viewRef, animatorRef, targetRef, writingRef),\n [key, viewRef, animatorRef],\n );\n}\n\n/** The runner behind {@link useViewAnimationOn}. */\nfunction createViewAnimation(\n key: string,\n viewRef: { readonly current: ViewChannel },\n animatorRef: { readonly current: Animator },\n targetRef: { current: View | null },\n writingRef: { current: boolean },\n): ViewAnimationApi {\n // The value the target's animations add to. While any is in flight it is kept here, apart\n // from the channel, which holds the folded view; null says to work it out from the channel.\n let committed: View | null = null;\n /** What the animations in flight added to the channel's view when `committed` was dropped. */\n let offset: number[] | null = null;\n const base = (): View => {\n if (committed) return committed;\n const live = viewRef.current.get();\n return offset ? viewAxes.from(viewAxes.to(live).map((n, i) => n - offset![i]!)) : live;\n };\n const write = (v: View): void => {\n writingRef.current = true;\n try { viewRef.current.set(normalizeView(v)); } finally { writingRef.current = false; }\n };\n const viewTarget: Target<View> = createTarget<View>({\n axes: viewAxes,\n get: base,\n set: (v) => { committed = v; offset = null; },\n show: (v) => {\n if (viewTarget.active) {\n if (!committed) { committed = base(); offset = null; }\n write(v);\n return;\n }\n // At rest. A stop or an outside write left the view as it stands; a finish lands it.\n const landed = committed;\n committed = offset = null;\n if (landed) write(landed);\n },\n });\n\n const isAnimating = () => animatorRef.current.isActive(key);\n const target = () => (isAnimating() ? targetRef.current : null);\n /** Cancels this runner's animation; whatever else moves the view goes on from where it was. */\n const cancel = (): void => {\n animatorRef.current.cancelKey(key);\n targetRef.current = null;\n };\n const stop = () => {\n cancel();\n if (!viewTarget.active) committed = offset = null;\n };\n\n const animate: ViewAnimationApi['animate'] = (to, opts = {}) => {\n const resolved = normalizeView(typeof to === 'function' ? to(target() ?? base()) : to);\n targetRef.current = resolved;\n animatorRef.current.tween<View>({\n target: viewTarget,\n to: resolved,\n ms: opts.ms ?? DEFAULT_MS,\n easing: opts.easing ?? easeOutCubic,\n interpolator: opts.interpolator ?? interpolateView,\n cancelKey: key,\n onDone: () => {\n targetRef.current = null;\n // Ahead of the frame's own write, so `onDone` reads the view it finished on.\n write(viewTarget.read());\n if (!viewTarget.active) committed = offset = null;\n opts.onDone?.();\n },\n });\n };\n\n return {\n animate,\n animateToBounds: (bounds, dims, opts = {}) => {\n const current = viewRef.current.get();\n const fitted = fitViewToBounds(bounds, dims, current, opts);\n if (fitted === current) return; // helper bailed (zero-area bounds/viewport)\n animate(fitted, opts);\n },\n stop,\n isAnimating,\n target,\n stopIfExternal: () => {\n if (writingRef.current) return;\n cancel();\n // The writer read the folded view, so what is still in flight stays on top of its write.\n if (viewTarget.active) {\n const shown = viewAxes.to(viewTarget.read());\n const under = viewAxes.to(base());\n offset = shown.map((n, i) => n - under[i]!);\n } else {\n offset = null;\n }\n committed = null;\n },\n viewTarget,\n };\n}\n"],"mappings":";;;;;;;;AAaA,IAAaA,IAAqB,QAE5BC,IAAa,KAmDNC,IAA6B;CACxC,OAAO;CACP,OAAO;EAAC;EAAK;EAAK;EAAW;CAAS;CACtC,KAAK,MAAM;EAACC,EAAE;EAAGA,EAAE;EAAGA,EAAE,MAAM;EAAGA,EAAE,MAAM;CAAC;CAC1C,OAAO,OAAO;EAAE,GAAGC,EAAE;EAAK,GAAGA,EAAE;EAAK,OAAO;GAAE,GAAGA,EAAE;GAAK,GAAGA,EAAE;EAAI;CAAE;CAClE,MAAM,GAAG,OAAO;EAAE,GAAGD,EAAE,IAAIE,EAAE;EAAK,GAAGF,EAAE,IAAIE,EAAE;EAAK,OAAO;GAAE,GAAGF,EAAE,MAAM,IAAIE,EAAE;GAAK,GAAGF,EAAE,MAAM,IAAIE,E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wB,EAAM,KAAK,GAAG,MAAMtB,IAAIuB,EAAMtB,EAAG;IAC5C,OACE,IAAS;IAEX,IAAY;GAFD;EAGb;EACA;CACF;AACF"}
@@ -1,5 +1,5 @@
1
- import { meanScale as e } from "./meanScale.js";
2
- import { normalizeZoom as t, warnInvalidView as n } from "./zoomBounds.js";
1
+ import { normalizeZoom as e, warnInvalidView as t } from "./zoomBounds.js";
2
+ import { meanScale as n } from "@weasel-js/geom";
3
3
  //#region src/core/viewport/view.ts
4
4
  function r(e) {
5
5
  return {
@@ -11,11 +11,14 @@ function r(e) {
11
11
  }
12
12
  };
13
13
  }
14
- function i(t) {
15
- return e(t.scale);
14
+ function i(e) {
15
+ return n(e.scale);
16
16
  }
17
- function a(e) {
18
- let t = o(e.scale.x), n = o(e.scale.y), r = s(e.x), i = s(e.y);
17
+ function a(e, t) {
18
+ return e.x === t.x && e.y === t.y && e.scale.x === t.scale.x && e.scale.y === t.scale.y;
19
+ }
20
+ function o(e) {
21
+ let t = s(e.scale.x), n = s(e.scale.y), r = c(e.x), i = c(e.y);
19
22
  return t === e.scale.x && n === e.scale.y && r === e.x && i === e.y ? e : {
20
23
  x: r,
21
24
  y: i,
@@ -25,13 +28,13 @@ function a(e) {
25
28
  }
26
29
  };
27
30
  }
28
- function o(e) {
29
- return e < 0 && e > -Infinity ? -t(-e) : t(e);
31
+ function s(t) {
32
+ return t < 0 && t > -Infinity ? -e(-t) : e(t);
30
33
  }
31
- function s(e) {
32
- return Number.isFinite(e) ? e : (n(`a position of ${e}`), 0);
34
+ function c(e) {
35
+ return Number.isFinite(e) ? e : (t(`a position of ${e}`), 0);
33
36
  }
34
37
  //#endregion
35
- export { a as normalizeView, r as viewToTransform, i as viewZoom };
38
+ export { o as normalizeView, a as sameView, r as viewToTransform, i as viewZoom };
36
39
 
37
40
  //# sourceMappingURL=view.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"view.js","names":["viewToTransform","view","viewZoom","meanScale","normalizeView","sx","normalizeAxis","sy","x","finiteTranslation","y","s","normalizeZoom","v","warnInvalidView"],"sources":["../../../src/core/viewport/view.ts"],"sourcesContent":["import type { ViewTransform } from './viewTransform';\nimport type { View } from '@weasel-js/routing';\nimport { meanScale } from './meanScale';\nimport { normalizeZoom, warnInvalidView } from './zoomBounds';\n\n/**\n * `View` is declared in `@weasel-js/routing` — the dispatcher and every\n * viewport action are typed in it. Re-exported here, where core's own call\n * sites have always named it.\n *\n * Core holds the invariant behind the shape: every view the kit keeps is\n * total, so each `scale` axis is finite with a magnitude of at least\n * `ZOOM_FLOOR` and `x` / `y` are finite. A negative axis is a flipped one\n * (y-up), not a degenerate one, and keeps its sign. Canvases, views and\n * animations pass what they are given through {@link normalizeView}, so\n * screen/world conversion never divides by zero.\n *\n * `scale` is always a 2-vector. Input convenience types {@link ZoomFactor}\n * and {@link ZoomBound} let callers pass a scalar when they want both axes\n * treated the same.\n */\nexport type { View };\n\n/**\n * Input convenience for zoom primitives. A `number` is treated as a\n * uniform factor applied to both axes; a `{x, y}` vector applies\n * per-axis factors.\n */\nexport type ZoomFactor = number | { x: number; y: number };\n\n/**\n * Input convenience for zoom-clamp ranges. A `number` is applied as the\n * same bound on both axes; a `{x, y}` vector applies per-axis bounds.\n */\nexport type ZoomBound = number | { x: number; y: number };\n\n/**\n * Bridge `View` into the legacy `ViewTransform` shape so chrome can keep\n * calling `worldToScreen` / `screenToWorld`. `View` and `ViewTransform`\n * use opposite sign conventions for the translation half (`view.x` is\n * camera position; `panX` is canvas translation), so the adapter flips\n * the sign and multiplies by per-axis scale.\n */\nexport function viewToTransform(view: View): ViewTransform {\n // `+ 0` coerces `-0 → 0` without swallowing NaN (matches viewToMat3).\n return {\n panX: -view.x * view.scale.x + 0,\n panY: -view.y * view.scale.y + 0,\n zoom: { x: view.scale.x, y: view.scale.y },\n };\n}\n\n/**\n * How far `view` is zoomed in, as one number — the geometric mean of its two\n * axes, so a uniform view reports its own scale and a stretched one reports\n * the scale that covers the same area.\n *\n * What a `RuleCtx` carries, because the only rule that asks about the\n * viewport asks for a threshold rather than a camera.\n */\nexport function viewZoom(view: View): number {\n return meanScale(view.scale);\n}\n\n/**\n * `view` inside the invariant {@link View} documents: a zero or non-finite\n * scale axis becomes `ZOOM_FLOOR`, a negative one keeps its sign, and a\n * non-finite translation becomes 0. Returns `view` itself when it already\n * holds, so a valid view keeps its identity.\n */\nexport function normalizeView(view: View): View {\n const sx = normalizeAxis(view.scale.x);\n const sy = normalizeAxis(view.scale.y);\n const x = finiteTranslation(view.x);\n const y = finiteTranslation(view.y);\n if (sx === view.scale.x && sy === view.scale.y && x === view.x && y === view.y) return view;\n return { x, y, scale: { x: sx, y: sy } };\n}\n\nfunction normalizeAxis(s: number): number {\n return s < 0 && s > -Infinity ? -normalizeZoom(-s) : normalizeZoom(s);\n}\n\nfunction finiteTranslation(v: number): number {\n if (Number.isFinite(v)) return v;\n warnInvalidView(`a position of ${v}`);\n return 0;\n}\n"],"mappings":";;;AA2CA,SAAgBA,EAAgB,GAA2B;CAEzD,OAAO;EACL,MAAM,CAACC,EAAK,IAAIA,EAAK,MAAM,IAAI;EAC/B,MAAM,CAACA,EAAK,IAAIA,EAAK,MAAM,IAAI;EAC/B,MAAM;GAAE,GAAGA,EAAK,MAAM;GAAG,GAAGA,EAAK,MAAM;EAAE;CAC3C;AACF;AAUA,SAAgBC,EAAS,GAAoB;CAC3C,OAAOC,EAAUF,EAAK,KAAK;AAC7B;AAQA,SAAgBG,EAAc,GAAkB;CAC9C,IAAMC,IAAKC,EAAcL,EAAK,MAAM,CAAC,GAC/BM,IAAKD,EAAcL,EAAK,MAAM,CAAC,GAC/BO,IAAIC,EAAkBR,EAAK,CAAC,GAC5BS,IAAID,EAAkBR,EAAK,CAAC;CAElC,OADII,MAAOJ,EAAK,MAAM,KAAKM,MAAON,EAAK,MAAM,KAAKO,MAAMP,EAAK,KAAKS,MAAMT,EAAK,IAAUA,IAChF;EAAE;EAAG;EAAG,OAAO;GAAE,GAAGI;GAAI,GAAGE;EAAG;CAAE;AACzC;AAEA,SAASD,EAAc,GAAmB;CACxC,OAAOK,IAAI,KAAKA,IAAI,YAAY,CAACC,EAAc,CAACD,CAAC,IAAIC,EAAcD,CAAC;AACtE;AAEA,SAASF,EAAkB,GAAmB;CAG5C,OAFI,OAAO,SAASI,CAAC,IAAUA,KAC/BC,EAAgB,iBAAiBD,GAAG,GAC7B;AACT"}
1
+ {"version":3,"file":"view.js","names":["normalizeZoom","normalizeZoom$1","viewToTransform","view","viewZoom","meanScale","sameView","a","b","normalizeView","sx","normalizeAxis","sy","x","finiteTranslation","y","s","v","warnInvalidView"],"sources":["../../../src/core/viewport/view.ts"],"sourcesContent":["import type { ViewTransform } from './viewTransform';\nimport type { View } from '@weasel-js/routing';\nimport { meanScale } from '@weasel-js/geom';\nimport { normalizeZoom, warnInvalidView } from './zoomBounds';\n\n/**\n * Every view the kit keeps is total: each `scale` axis is finite with a\n * magnitude of at least `ZOOM_FLOOR` and `x` / `y` are finite. A negative\n * axis is a flipped one (y-up), not a degenerate one, and keeps its sign.\n * Canvases, views, and animations pass what they are given through\n * {@link normalizeView}, so screen/world conversion never divides by zero.\n */\nexport type { View };\n\n/** A zoom factor: a `number` applies to both axes, a `{x, y}` vector per axis. */\nexport type ZoomFactor = number | { x: number; y: number };\n\n/** A zoom-clamp bound: a `number` applies to both axes, a `{x, y}` vector per axis. */\nexport type ZoomBound = number | { x: number; y: number };\n\n/**\n * Bridge `View` into the legacy `ViewTransform` shape. The two use opposite\n * sign conventions for the translation half: `view.x` is camera position;\n * `panX` is canvas translation.\n */\nexport function viewToTransform(view: View): ViewTransform {\n // `+ 0` coerces `-0 → 0` without swallowing NaN (matches viewToMat3).\n return {\n panX: -view.x * view.scale.x + 0,\n panY: -view.y * view.scale.y + 0,\n zoom: { x: view.scale.x, y: view.scale.y },\n };\n}\n\n/**\n * How far `view` is zoomed in, as one number — the geometric mean of its two\n * axes, so a uniform view reports its own scale and a stretched one reports\n * the scale that covers the same area.\n */\nexport function viewZoom(view: View): number {\n return meanScale(view.scale);\n}\n\n/** Whether two views are the same camera, whatever objects hold them. */\nexport function sameView(a: View, b: View): boolean {\n return a.x === b.x && a.y === b.y && a.scale.x === b.scale.x && a.scale.y === b.scale.y;\n}\n\n/**\n * `view` inside the invariant {@link View} documents: a zero or non-finite\n * scale axis becomes `ZOOM_FLOOR`, a negative one keeps its sign, and a\n * non-finite translation becomes 0. Returns `view` itself when it already\n * holds, so a valid view keeps its identity.\n */\nexport function normalizeView(view: View): View {\n const sx = normalizeAxis(view.scale.x);\n const sy = normalizeAxis(view.scale.y);\n const x = finiteTranslation(view.x);\n const y = finiteTranslation(view.y);\n if (sx === view.scale.x && sy === view.scale.y && x === view.x && y === view.y) return view;\n return { x, y, scale: { x: sx, y: sy } };\n}\n\nfunction normalizeAxis(s: number): number {\n return s < 0 && s > -Infinity ? -normalizeZoom(-s) : normalizeZoom(s);\n}\n\nfunction finiteTranslation(v: number): number {\n if (Number.isFinite(v)) return v;\n warnInvalidView(`a position of ${v}`);\n return 0;\n}\n"],"mappings":";;;AAyBA,SAAgBE,EAAgB,GAA2B;CAEzD,OAAO;EACL,MAAM,CAACC,EAAK,IAAIA,EAAK,MAAM,IAAI;EAC/B,MAAM,CAACA,EAAK,IAAIA,EAAK,MAAM,IAAI;EAC/B,MAAM;GAAE,GAAGA,EAAK,MAAM;GAAG,GAAGA,EAAK,MAAM;EAAE;CAC3C;AACF;AAOA,SAAgBC,EAAS,GAAoB;CAC3C,OAAOC,EAAUF,EAAK,KAAK;AAC7B;AAGA,SAAgBG,EAAS,GAAS,GAAkB;CAClD,OAAOC,EAAE,MAAMC,EAAE,KAAKD,EAAE,MAAMC,EAAE,KAAKD,EAAE,MAAM,MAAMC,EAAE,MAAM,KAAKD,EAAE,MAAM,MAAMC,EAAE,MAAM;AACxF;AAQA,SAAgBC,EAAc,GAAkB;CAC9C,IAAMC,IAAKC,EAAcR,EAAK,MAAM,CAAC,GAC/BS,IAAKD,EAAcR,EAAK,MAAM,CAAC,GAC/BU,IAAIC,EAAkBX,EAAK,CAAC,GAC5BY,IAAID,EAAkBX,EAAK,CAAC;CAElC,OADIO,MAAOP,EAAK,MAAM,KAAKS,MAAOT,EAAK,MAAM,KAAKU,MAAMV,EAAK,KAAKY,MAAMZ,EAAK,IAAUA,IAChF;EAAE;EAAG;EAAG,OAAO;GAAE,GAAGO;GAAI,GAAGE;EAAG;CAAE;AACzC;AAEA,SAASD,EAAc,GAAmB;CACxC,OAAOK,IAAI,KAAKA,IAAI,YAAY,CAAChB,EAAc,CAACgB,CAAC,IAAIhB,EAAcgB,CAAC;AACtE;AAEA,SAASF,EAAkB,GAAmB;CAG5C,OAFI,OAAO,SAASG,CAAC,IAAUA,KAC/BC,EAAgB,iBAAiBD,GAAG,GAC7B;AACT"}
@@ -1 +1 @@
1
- {"version":3,"file":"wheelHandler.js","names":["WHEEL_ZOOM_STEP","wheelZoomFactor","deltaY","wheelZoom","zoomAt","view","anchor","clamp","wheelPan","axis","opts","swapped","screenX","delta","screenY","computeWheelAction","input"],"sources":["../../../src/core/viewport/wheelHandler.ts"],"sourcesContent":["/**\n * The kit's one wheel convention, as pure functions over `View`.\n *\n * ## Modifiers\n * - bare wheel → pan\n * - shift+wheel → horizontal pan (mouse wheels emit only `deltaY`)\n * - Cmd/Ctrl+wheel → zoom, anchored under the pointer. Ctrl also covers the\n * trackpad pinch, which browsers deliver as ctrl+wheel.\n *\n * ## Coordinates\n * `View.x` / `View.y` are world-space, so a pan delta — screen pixels, as the\n * DOM reports them — is divided by `View.scale` before it lands. The zoom\n * anchor is canvas-local: client coords minus the canvas's bounding rect.\n *\n * `viewport.wheelPan` and `viewport.zoom` are the wired form of these, and\n * call them rather than restating the math.\n */\n\nimport type { View } from './view';\nimport { zoomAt, type ZoomClampOpts } from './zoomAt';\n\n/** Multiplicative zoom applied per 100 px of wheel `deltaY`. */\nexport const WHEEL_ZOOM_STEP = 1.1;\n\n/** A wheel event, decoupled from the DOM `WheelEvent` shape for testability. */\nexport interface WheelInput {\n deltaX: number;\n deltaY: number;\n /** Zoom anchor, canvas-local: client coords minus the canvas's rect. */\n x: number;\n y: number;\n shiftKey?: boolean;\n ctrlKey?: boolean;\n metaKey?: boolean;\n}\n\n/** Which axes a wheel pan is allowed to move, and whether `deltaY` is routed\n * into the x axis (shift+wheel). An axis lock outranks `swapAxis`. */\nexport interface WheelPanOpts {\n axis?: 'both' | 'x' | 'y';\n swapAxis?: boolean;\n}\n\n/** Zoom multiplier for one wheel sample. Reciprocal in `deltaY`, so scrolling\n * a distance and back returns to the scale you started from. */\nexport function wheelZoomFactor(deltaY: number): number {\n return Math.pow(WHEEL_ZOOM_STEP, -deltaY / 100);\n}\n\n/** Zoom one wheel sample about `anchor` (canvas-local pixels). */\nexport function wheelZoom(\n view: View,\n anchor: { x: number; y: number },\n deltaY: number,\n clamp?: ZoomClampOpts,\n): View {\n return zoomAt(view, anchor, wheelZoomFactor(deltaY), clamp);\n}\n\n/** Pan by one wheel sample. `delta` is in screen pixels. */\nexport function wheelPan(\n view: View,\n delta: { deltaX: number; deltaY: number },\n opts: WheelPanOpts = {},\n): View {\n const axis = opts.axis ?? 'both';\n const swapped = opts.swapAxis === true;\n // Shift+wheel wants a horizontal pan, but a mouse wheel only emits deltaY.\n const screenX = swapped ? (delta.deltaX !== 0 ? delta.deltaX : delta.deltaY) : delta.deltaX;\n const screenY = swapped ? 0 : delta.deltaY;\n return {\n scale: view.scale,\n x: view.x + (axis === 'y' ? 0 : screenX / view.scale.x),\n y: view.y + (axis === 'x' ? 0 : screenY / view.scale.y),\n };\n}\n\n/** Pure reducer: the whole wheel convention in one call. */\nexport function computeWheelAction(\n view: View,\n input: WheelInput,\n clamp?: ZoomClampOpts,\n opts: Pick<WheelPanOpts, 'axis'> = {},\n): View {\n if (input.ctrlKey || input.metaKey) {\n return wheelZoom(view, { x: input.x, y: input.y }, input.deltaY, clamp);\n }\n return wheelPan(view, input, { axis: opts.axis, swapAxis: input.shiftKey === true });\n}\n"],"mappings":";;AAsBA,IAAaA,IAAkB;AAuB/B,SAAgBC,EAAgB,GAAwB;CACtD,OAAgBD,MAAiB,CAACE,IAAS;AAC7C;AAGA,SAAgBC,EACd,GACA,GACA,GACA,GACM;CACN,OAAOC,EAAOC,GAAMC,GAAQL,EAAgBC,CAAM,GAAGK,CAAK;AAC5D;AAGA,SAAgBC,EACd,GACA,GACA,IAAqB,CAAC,GAChB;CACN,IAAMC,IAAOC,EAAK,QAAQ,QACpBC,IAAUD,EAAK,aAAa,IAE5BE,IAAUD,KAAWE,EAAM,WAAW,IAAmBA,EAAM,SAArBA,EAAM,QAChDC,IAAUH,IAAU,IAAIE,EAAM;CACpC,OAAO;EACL,OAAOR,EAAK;EACZ,GAAGA,EAAK,KAAKI,MAAS,MAAM,IAAIG,IAAUP,EAAK,MAAM;EACrD,GAAGA,EAAK,KAAKI,MAAS,MAAM,IAAIK,IAAUT,EAAK,MAAM;CACvD;AACF;AAGA,SAAgBU,EACd,GACA,GACA,GACA,IAAmC,CAAC,GAC9B;CAIN,OAHIC,EAAM,WAAWA,EAAM,UAClBb,EAAUE,GAAM;EAAE,GAAGW,EAAM;EAAG,GAAGA,EAAM;CAAE,GAAGA,EAAM,QAAQT,CAAK,IAEjEC,EAASH,GAAMW,GAAO;EAAE,MAAMN,EAAK;EAAM,UAAUM,EAAM,aAAa;CAAK,CAAC;AACrF"}
1
+ {"version":3,"file":"wheelHandler.js","names":["WHEEL_ZOOM_STEP","wheelZoomFactor","deltaY","wheelZoom","zoomAt","view","anchor","clamp","wheelPan","axis","opts","swapped","screenX","delta","screenY","computeWheelAction","input"],"sources":["../../../src/core/viewport/wheelHandler.ts"],"sourcesContent":["/**\n * The kit's one wheel convention, as pure functions over `View`.\n *\n * ## Modifiers\n * - bare wheel → pan\n * - shift+wheel → horizontal pan (mouse wheels emit only `deltaY`)\n * - Cmd/Ctrl+wheel → zoom, anchored under the pointer. Ctrl also covers the\n * trackpad pinch, which browsers deliver as ctrl+wheel.\n *\n * ## Coordinates\n * `View.x` / `View.y` are world-space, so a pan delta — screen pixels, as the\n * DOM reports them — is divided by `View.scale` before it lands. The zoom\n * anchor is canvas-local: client coords minus the canvas's bounding rect.\n */\n\nimport type { View } from './view';\nimport { zoomAt, type ZoomClampOpts } from './zoomAt';\n\n/** Multiplicative zoom applied per 100 px of wheel `deltaY`. */\nexport const WHEEL_ZOOM_STEP = 1.1;\n\n/** A wheel event, decoupled from the DOM `WheelEvent` shape for testability. */\nexport interface WheelInput {\n deltaX: number;\n deltaY: number;\n /** Zoom anchor, canvas-local: client coords minus the canvas's rect. */\n x: number;\n y: number;\n shiftKey?: boolean;\n ctrlKey?: boolean;\n metaKey?: boolean;\n}\n\n/** Which axes a wheel pan is allowed to move, and whether `deltaY` is routed\n * into the x axis (shift+wheel). An axis lock outranks `swapAxis`. */\nexport interface WheelPanOpts {\n axis?: 'both' | 'x' | 'y';\n swapAxis?: boolean;\n}\n\n/** Zoom multiplier for one wheel sample. Reciprocal in `deltaY`, so scrolling\n * a distance and back returns to the scale you started from. */\nexport function wheelZoomFactor(deltaY: number): number {\n return Math.pow(WHEEL_ZOOM_STEP, -deltaY / 100);\n}\n\n/** Zoom one wheel sample about `anchor` (canvas-local pixels). */\nexport function wheelZoom(\n view: View,\n anchor: { x: number; y: number },\n deltaY: number,\n clamp?: ZoomClampOpts,\n): View {\n return zoomAt(view, anchor, wheelZoomFactor(deltaY), clamp);\n}\n\n/** Pan by one wheel sample. `delta` is in screen pixels. */\nexport function wheelPan(\n view: View,\n delta: { deltaX: number; deltaY: number },\n opts: WheelPanOpts = {},\n): View {\n const axis = opts.axis ?? 'both';\n const swapped = opts.swapAxis === true;\n // Shift+wheel wants a horizontal pan, but a mouse wheel only emits deltaY.\n const screenX = swapped ? (delta.deltaX !== 0 ? delta.deltaX : delta.deltaY) : delta.deltaX;\n const screenY = swapped ? 0 : delta.deltaY;\n return {\n scale: view.scale,\n x: view.x + (axis === 'y' ? 0 : screenX / view.scale.x),\n y: view.y + (axis === 'x' ? 0 : screenY / view.scale.y),\n };\n}\n\n/** Pure reducer: the whole wheel convention in one call. */\nexport function computeWheelAction(\n view: View,\n input: WheelInput,\n clamp?: ZoomClampOpts,\n opts: Pick<WheelPanOpts, 'axis'> = {},\n): View {\n if (input.ctrlKey || input.metaKey) {\n return wheelZoom(view, { x: input.x, y: input.y }, input.deltaY, clamp);\n }\n return wheelPan(view, input, { axis: opts.axis, swapAxis: input.shiftKey === true });\n}\n"],"mappings":";;AAmBA,IAAaA,IAAkB;AAuB/B,SAAgBC,EAAgB,GAAwB;CACtD,OAAgBD,MAAiB,CAACE,IAAS;AAC7C;AAGA,SAAgBC,EACd,GACA,GACA,GACA,GACM;CACN,OAAOC,EAAOC,GAAMC,GAAQL,EAAgBC,CAAM,GAAGK,CAAK;AAC5D;AAGA,SAAgBC,EACd,GACA,GACA,IAAqB,CAAC,GAChB;CACN,IAAMC,IAAOC,EAAK,QAAQ,QACpBC,IAAUD,EAAK,aAAa,IAE5BE,IAAUD,KAAWE,EAAM,WAAW,IAAmBA,EAAM,SAArBA,EAAM,QAChDC,IAAUH,IAAU,IAAIE,EAAM;CACpC,OAAO;EACL,OAAOR,EAAK;EACZ,GAAGA,EAAK,KAAKI,MAAS,MAAM,IAAIG,IAAUP,EAAK,MAAM;EACrD,GAAGA,EAAK,KAAKI,MAAS,MAAM,IAAIK,IAAUT,EAAK,MAAM;CACvD;AACF;AAGA,SAAgBU,EACd,GACA,GACA,GACA,IAAmC,CAAC,GAC9B;CAIN,OAHIC,EAAM,WAAWA,EAAM,UAClBb,EAAUE,GAAM;EAAE,GAAGW,EAAM;EAAG,GAAGA,EAAM;CAAE,GAAGA,EAAM,QAAQT,CAAK,IAEjEC,EAASH,GAAMW,GAAO;EAAE,MAAMN,EAAK;EAAM,UAAUM,EAAM,aAAa;CAAK,CAAC;AACrF"}
@@ -5,7 +5,16 @@ function i(e, t, r) {
5
5
  let i = n(Math.min(r, Math.max(t, Math.abs(e))));
6
6
  return e < 0 ? -i : i;
7
7
  }
8
- function a(n, a, o, s) {
8
+ function a(e, t) {
9
+ return t === "x" ? {
10
+ x: e,
11
+ y: 1
12
+ } : t === "y" ? {
13
+ x: 1,
14
+ y: e
15
+ } : e;
16
+ }
17
+ function o(n, a, o, s) {
9
18
  let c = r(n), l = typeof o == "number" ? o : o.x, u = typeof o == "number" ? o : o.y, d = typeof s?.min == "number" ? s.min : s?.min?.x ?? t, f = typeof s?.min == "number" ? s.min : s?.min?.y ?? t, p = typeof s?.max == "number" ? s.max : s?.max?.x ?? e, m = typeof s?.max == "number" ? s.max : s?.max?.y ?? e, h = i(c.scale.x * l, d, p), g = i(c.scale.y * u, f, m), _ = a.x / c.scale.x + c.x, v = a.y / c.scale.y + c.y;
10
19
  return {
11
20
  scale: {
@@ -17,6 +26,6 @@ function a(n, a, o, s) {
17
26
  };
18
27
  }
19
28
  //#endregion
20
- export { a as zoomAt };
29
+ export { a as axisZoomFactor, o as zoomAt };
21
30
 
22
31
  //# sourceMappingURL=zoomAt.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"zoomAt.js","names":["clampScale","magnitude","normalizeZoom","max","min","scale","zoomAt","view","normalizeView","input","fx","factor","fy","minX","opts","DEFAULT_MIN_ZOOM","minY","maxX","DEFAULT_MAX_ZOOM","maxY","nextX","nextY","worldX","anchor","worldY"],"sources":["../../../src/core/viewport/zoomAt.ts"],"sourcesContent":["import { normalizeView, type View, type ZoomFactor, type ZoomBound } from './view';\nimport { DEFAULT_MIN_ZOOM, DEFAULT_MAX_ZOOM, normalizeZoom } from './zoomBounds';\n\n/** Optional clamp bounds for `zoomAt`. Defaults: {@link DEFAULT_MIN_ZOOM} /\n * {@link DEFAULT_MAX_ZOOM} (per axis). */\nexport interface ZoomClampOpts {\n min?: ZoomBound;\n max?: ZoomBound;\n}\n\n/** Bound a scale's *magnitude*, keeping its direction. `scale.y < 0` is how a\n * `View` spells a y-up camera, so clamping the signed value against positive\n * bounds would flip the axis and collapse the zoom rather than limit it. */\nfunction clampScale(scale: number, min: number, max: number): number {\n const magnitude = normalizeZoom(Math.min(max, Math.max(min, Math.abs(scale))));\n return scale < 0 ? -magnitude : magnitude;\n}\n\n/**\n * Pure zoom primitive. Returns a new `View` whose `scale` is multiplied\n * by `factor` (per-axis, clamped) and whose translation is adjusted so\n * that the world point currently under `anchor` (screen coords relative\n * to the canvas top-left) stays under the same screen pixel after the\n * zoom — independently on each axis.\n *\n * `factor: number` means \"apply uniformly to both axes\". `factor: {x, y}`\n * applies per-axis factors. Likewise for `opts.min` / `opts.max`.\n */\nexport function zoomAt(\n input: View,\n anchor: { x: number; y: number },\n factor: ZoomFactor,\n opts?: ZoomClampOpts,\n): View {\n const view = normalizeView(input);\n const fx = typeof factor === 'number' ? factor : factor.x;\n const fy = typeof factor === 'number' ? factor : factor.y;\n const minX = typeof opts?.min === 'number' ? opts.min : opts?.min?.x ?? DEFAULT_MIN_ZOOM;\n const minY = typeof opts?.min === 'number' ? opts.min : opts?.min?.y ?? DEFAULT_MIN_ZOOM;\n const maxX = typeof opts?.max === 'number' ? opts.max : opts?.max?.x ?? DEFAULT_MAX_ZOOM;\n const maxY = typeof opts?.max === 'number' ? opts.max : opts?.max?.y ?? DEFAULT_MAX_ZOOM;\n\n const nextX = clampScale(view.scale.x * fx, minX, maxX);\n const nextY = clampScale(view.scale.y * fy, minY, maxY);\n\n const worldX = anchor.x / view.scale.x + view.x;\n const worldY = anchor.y / view.scale.y + view.y;\n return {\n scale: { x: nextX, y: nextY },\n x: worldX - anchor.x / nextX,\n y: worldY - anchor.y / nextY,\n };\n}\n"],"mappings":";;;AAaA,SAASA,EAAW,GAAe,GAAa,GAAqB;CACnE,IAAMC,IAAYC,EAAc,KAAK,IAAIC,GAAK,KAAK,IAAIC,GAAK,KAAK,IAAIC,CAAK,CAAC,CAAC,CAAC;CAC7E,OAAOA,IAAQ,IAAI,CAACJ,IAAYA;AAClC;AAYA,SAAgBK,EACd,GACA,GACA,GACA,GACM;CACN,IAAMC,IAAOC,EAAcC,CAAK,GAC1BC,IAAK,OAAOC,KAAW,WAAWA,IAASA,EAAO,GAClDC,IAAK,OAAOD,KAAW,WAAWA,IAASA,EAAO,GAClDE,IAAO,OAAOC,GAAM,OAAQ,WAAWA,EAAK,MAAMA,GAAM,KAAK,KAAKC,GAClEC,IAAO,OAAOF,GAAM,OAAQ,WAAWA,EAAK,MAAMA,GAAM,KAAK,KAAKC,GAClEE,IAAO,OAAOH,GAAM,OAAQ,WAAWA,EAAK,MAAMA,GAAM,KAAK,KAAKI,GAClEC,IAAO,OAAOL,GAAM,OAAQ,WAAWA,EAAK,MAAMA,GAAM,KAAK,KAAKI,GAElEE,IAAQpB,EAAWO,EAAK,MAAM,IAAIG,GAAIG,GAAMI,CAAI,GAChDI,IAAQrB,EAAWO,EAAK,MAAM,IAAIK,GAAII,GAAMG,CAAI,GAEhDG,IAASC,EAAO,IAAIhB,EAAK,MAAM,IAAIA,EAAK,GACxCiB,IAASD,EAAO,IAAIhB,EAAK,MAAM,IAAIA,EAAK;CAC9C,OAAO;EACL,OAAO;GAAE,GAAGa;GAAO,GAAGC;EAAM;EAC5B,GAAGC,IAASC,EAAO,IAAIH;EACvB,GAAGI,IAASD,EAAO,IAAIF;CACzB;AACF"}
1
+ {"version":3,"file":"zoomAt.js","names":["clampScale","magnitude","normalizeZoom","max","min","scale","axisZoomFactor","axis","factor","zoomAt","view","normalizeView","input","fx","fy","minX","opts","DEFAULT_MIN_ZOOM","minY","maxX","DEFAULT_MAX_ZOOM","maxY","nextX","nextY","worldX","anchor","worldY"],"sources":["../../../src/core/viewport/zoomAt.ts"],"sourcesContent":["import { normalizeView, type View, type ZoomFactor, type ZoomBound } from './view';\nimport { DEFAULT_MIN_ZOOM, DEFAULT_MAX_ZOOM, normalizeZoom } from './zoomBounds';\n\n/** Optional clamp bounds for `zoomAt`. Defaults: {@link DEFAULT_MIN_ZOOM} /\n * {@link DEFAULT_MAX_ZOOM} (per axis). */\nexport interface ZoomClampOpts {\n min?: ZoomBound;\n max?: ZoomBound;\n}\n\n/** Bound a scale's *magnitude*, keeping its direction. `scale.y < 0` is how a\n * `View` spells a y-up camera, so clamping the signed value against positive\n * bounds would flip the axis and collapse the zoom rather than limit it. */\nfunction clampScale(scale: number, min: number, max: number): number {\n const magnitude = normalizeZoom(Math.min(max, Math.max(min, Math.abs(scale))));\n return scale < 0 ? -magnitude : magnitude;\n}\n\n/** Which axes a zoom scales. */\nexport type ZoomAxis = 'both' | 'x' | 'y';\n\n/** `factor` held to one axis: the other axis's factor is 1, so `zoomAt` leaves\n * its scale and its translation where they were. */\nexport function axisZoomFactor(factor: number, axis: ZoomAxis): ZoomFactor {\n if (axis === 'x') return { x: factor, y: 1 };\n if (axis === 'y') return { x: 1, y: factor };\n return factor;\n}\n\n/**\n * Pure zoom primitive. Returns a new `View` whose `scale` is multiplied\n * by `factor` (per-axis, clamped) and whose translation is adjusted so\n * that the world point currently under `anchor` (screen coords relative\n * to the canvas top-left) stays under the same screen pixel after the\n * zoom — independently on each axis.\n *\n * `factor: number` means \"apply uniformly to both axes\". `factor: {x, y}`\n * applies per-axis factors. Likewise for `opts.min` / `opts.max`.\n */\nexport function zoomAt(\n input: View,\n anchor: { x: number; y: number },\n factor: ZoomFactor,\n opts?: ZoomClampOpts,\n): View {\n const view = normalizeView(input);\n const fx = typeof factor === 'number' ? factor : factor.x;\n const fy = typeof factor === 'number' ? factor : factor.y;\n const minX = typeof opts?.min === 'number' ? opts.min : opts?.min?.x ?? DEFAULT_MIN_ZOOM;\n const minY = typeof opts?.min === 'number' ? opts.min : opts?.min?.y ?? DEFAULT_MIN_ZOOM;\n const maxX = typeof opts?.max === 'number' ? opts.max : opts?.max?.x ?? DEFAULT_MAX_ZOOM;\n const maxY = typeof opts?.max === 'number' ? opts.max : opts?.max?.y ?? DEFAULT_MAX_ZOOM;\n\n const nextX = clampScale(view.scale.x * fx, minX, maxX);\n const nextY = clampScale(view.scale.y * fy, minY, maxY);\n\n const worldX = anchor.x / view.scale.x + view.x;\n const worldY = anchor.y / view.scale.y + view.y;\n return {\n scale: { x: nextX, y: nextY },\n x: worldX - anchor.x / nextX,\n y: worldY - anchor.y / nextY,\n };\n}\n"],"mappings":";;;AAaA,SAASA,EAAW,GAAe,GAAa,GAAqB;CACnE,IAAMC,IAAYC,EAAc,KAAK,IAAIC,GAAK,KAAK,IAAIC,GAAK,KAAK,IAAIC,CAAK,CAAC,CAAC,CAAC;CAC7E,OAAOA,IAAQ,IAAI,CAACJ,IAAYA;AAClC;AAOA,SAAgBK,EAAe,GAAgB,GAA4B;CAGzE,OAFIC,MAAS,MAAY;EAAE,GAAGC;EAAQ,GAAG;CAAE,IACvCD,MAAS,MAAY;EAAE,GAAG;EAAG,GAAGC;CAAO,IACpCA;AACT;AAYA,SAAgBC,EACd,GACA,GACA,GACA,GACM;CACN,IAAMC,IAAOC,EAAcC,CAAK,GAC1BC,IAAK,OAAOL,KAAW,WAAWA,IAASA,EAAO,GAClDM,IAAK,OAAON,KAAW,WAAWA,IAASA,EAAO,GAClDO,IAAO,OAAOC,GAAM,OAAQ,WAAWA,EAAK,MAAMA,GAAM,KAAK,KAAKC,GAClEC,IAAO,OAAOF,GAAM,OAAQ,WAAWA,EAAK,MAAMA,GAAM,KAAK,KAAKC,GAClEE,IAAO,OAAOH,GAAM,OAAQ,WAAWA,EAAK,MAAMA,GAAM,KAAK,KAAKI,GAClEC,IAAO,OAAOL,GAAM,OAAQ,WAAWA,EAAK,MAAMA,GAAM,KAAK,KAAKI,GAElEE,IAAQtB,EAAWU,EAAK,MAAM,IAAIG,GAAIE,GAAMI,CAAI,GAChDI,IAAQvB,EAAWU,EAAK,MAAM,IAAII,GAAII,GAAMG,CAAI,GAEhDG,IAASC,EAAO,IAAIf,EAAK,MAAM,IAAIA,EAAK,GACxCgB,IAASD,EAAO,IAAIf,EAAK,MAAM,IAAIA,EAAK;CAC9C,OAAO;EACL,OAAO;GAAE,GAAGY;GAAO,GAAGC;EAAM;EAC5B,GAAGC,IAASC,EAAO,IAAIH;EACvB,GAAGI,IAASD,EAAO,IAAIF;CACzB;AACF"}
@@ -1,4 +1,4 @@
1
- import { B as BoundsConstraint, P as PointSnapBehavior } from './types-B4iJRHC3.js';
1
+ import { B as BoundsConstraint, P as PointSnapBehavior } from './clone-C0eADtS0.js';
2
2
  import { Bounds, ResizeAnchor } from '@weasel-js/routing';
3
3
 
4
4
  /** Option surface for the `resize` action. */
@@ -22,33 +22,20 @@ interface UseResizeOptions<TPose> {
22
22
  /** Fired once per `onGestureStart`: `true` when the resize wrote to the
23
23
  * document, `false` on cancel, a behavior abort, or no change. */
24
24
  onGestureEnd?: (committed: boolean) => void;
25
- /** Optional: expand the incoming id into leaf ids before pose lookups.
26
- * Used for group expansion: when the
27
- * gesture is started against a group id, the kit
28
- * resizes by computing the union AABB of the leaves' origin bounds,
29
- * running the compute pipeline on that union rect (group bounds), and
30
- * remapping each leaf via `geometry.remapBounds(leaf, originGroupBounds,
31
- * proposedGroupBounds)`.
32
- *
33
- * When `expandIds` is omitted or returns the original single id, the
34
- * gesture takes the single-leaf path (the leaf's own bounds become both
35
- * the origin and the target of the same `remapBounds` call).
36
- *
37
- * Called once at `start()`. Returning `[]` aborts the gesture cleanly. */
25
+ /** Expand the incoming id into leaf ids, for resizing a group: the kit
26
+ * resizes the union AABB of the leaves' bounds and remaps each leaf into
27
+ * the result. Called once at `start()`. Returning `[]` aborts the gesture
28
+ * cleanly. */
38
29
  expandIds?: (ids: string[]) => string[];
39
30
  /** Behaviors that operate on world-space anchor points. Fire after
40
- * `behaviors[]` (bounds-frame). Each behavior receives a `PointSnapContext`
41
- * with world-space frame points and returns at most one `PointSnapResult`;
42
- * the hook back-solves the local pose so the chosen frame's world point
43
- * lands on the snap target. First non-null result wins. */
31
+ * `behaviors[]`. The first non-null `PointSnapResult` wins, and the pose
32
+ * is back-solved so the chosen frame's world point lands on the snap
33
+ * target. */
44
34
  pointSnapBehaviors?: TPose extends Bounds ? PointSnapBehavior<TPose>[] : never;
45
35
  /** Per-node resizability predicate. Returns `false` for nodes that should
46
- * never show resize handles (and thus can't start a resize gesture) — e.g.
47
- * fixed-footprint icons, locked layers. `<SceneCanvas>` folds this over the
48
- * current selection into the `selectionResizable` rule-ctx flag, so the
49
- * default `selection.resize-handles` chrome rule hides handles whenever any
50
- * selected node is non-resizable (which also disables the affordance, since
51
- * visible==hittable). Default: every node resizable. */
36
+ * never show resize handles (and thus can't start a resize gesture). The
37
+ * handles hide whenever any selected node is non-resizable. Default: every
38
+ * node resizable. */
52
39
  resizable?: (id: string) => boolean;
53
40
  }
54
41