@weasel-js/core 1.9.3 → 1.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (1139) hide show
  1. package/CHANGELOG.md +1106 -0
  2. package/README.md +7 -5
  3. package/dist/WeaselProvider.js +5 -7
  4. package/dist/WeaselProvider.js.map +1 -1
  5. package/dist/affordances/composeAffordanceLayer.js +91 -93
  6. package/dist/affordances/composeAffordanceLayer.js.map +1 -1
  7. package/dist/affordances/cornerResize.js +27 -18
  8. package/dist/affordances/cornerResize.js.map +1 -1
  9. package/dist/affordances/hitAffordanceRegions.js +65 -104
  10. package/dist/affordances/hitAffordanceRegions.js.map +1 -1
  11. package/dist/affordances/pathAnchors.js.map +1 -1
  12. package/dist/affordances/rotationHandle.js +22 -21
  13. package/dist/affordances/rotationHandle.js.map +1 -1
  14. package/dist/animation/behaviors/coast.js +21 -0
  15. package/dist/animation/behaviors/coast.js.map +1 -0
  16. package/dist/animation/behaviors/coastByWrite.js +107 -0
  17. package/dist/animation/behaviors/coastByWrite.js.map +1 -0
  18. package/dist/animation/behaviors/coastOnTargets.js +94 -0
  19. package/dist/animation/behaviors/coastOnTargets.js.map +1 -0
  20. package/dist/animation/behaviors/momentum.js +38 -88
  21. package/dist/animation/behaviors/momentum.js.map +1 -1
  22. package/dist/animation/clipTargets.js +12 -0
  23. package/dist/animation/clipTargets.js.map +1 -0
  24. package/dist/animation/index.js +15 -20
  25. package/dist/animation/poseHelpers.js +112 -33
  26. package/dist/animation/poseHelpers.js.map +1 -1
  27. package/dist/animation/poseTarget.js +115 -0
  28. package/dist/animation/poseTarget.js.map +1 -0
  29. package/dist/animation/reflow.js +113 -83
  30. package/dist/animation/reflow.js.map +1 -1
  31. package/dist/animation/rewind.js +66 -0
  32. package/dist/animation/rewind.js.map +1 -0
  33. package/dist/animation/rig/bindRig.js +85 -53
  34. package/dist/animation/rig/bindRig.js.map +1 -1
  35. package/dist/animation/rig/rigNode.js +93 -0
  36. package/dist/animation/rig/rigNode.js.map +1 -0
  37. package/dist/animation/rig/rigSeat.js +26 -0
  38. package/dist/animation/rig/rigSeat.js.map +1 -0
  39. package/dist/animation/rig/skinBinding.js +56 -0
  40. package/dist/animation/rig/skinBinding.js.map +1 -0
  41. package/dist/animation/rig/useRig.js +31 -16
  42. package/dist/animation/rig/useRig.js.map +1 -1
  43. package/dist/animation/wrappers/animateLifecycle.js +32 -24
  44. package/dist/animation/wrappers/animateLifecycle.js.map +1 -1
  45. package/dist/animation/wrappers/animateOnSetPose.js +31 -29
  46. package/dist/animation/wrappers/animateOnSetPose.js.map +1 -1
  47. package/dist/animation/wrappers/instantPose.js +13 -0
  48. package/dist/animation/wrappers/instantPose.js.map +1 -0
  49. package/dist/animation/writtenPoseTarget.js +33 -0
  50. package/dist/animation/writtenPoseTarget.js.map +1 -0
  51. package/dist/{autoPoseDescriptor-vCdt55xm.d.ts → autoPoseDescriptor-DHg5KqaJ.d.ts} +1 -1
  52. package/dist/barrel/canvas.js +31 -0
  53. package/dist/barrel/chrome.js +16 -0
  54. package/dist/barrel/input.js +18 -0
  55. package/dist/barrel/interactions.js +38 -0
  56. package/dist/barrel/paint.js +11 -0
  57. package/dist/barrel/paths.js +12 -0
  58. package/dist/barrel/renderer.js +14 -0
  59. package/dist/barrel/routing.js +57 -0
  60. package/dist/barrel/scene.js +37 -0
  61. package/dist/barrel/text.js +9 -0
  62. package/dist/barrel/viewport.js +42 -0
  63. package/dist/canvas/Canvas.js +280 -559
  64. package/dist/canvas/Canvas.js.map +1 -1
  65. package/dist/canvas/CanvasView.js +147 -167
  66. package/dist/canvas/CanvasView.js.map +1 -1
  67. package/dist/canvas/CursorCoordsHud.js +53 -49
  68. package/dist/canvas/CursorCoordsHud.js.map +1 -1
  69. package/dist/canvas/DrawCanvas.js +40 -51
  70. package/dist/canvas/DrawCanvas.js.map +1 -1
  71. package/dist/canvas/ModalityHud.js.map +1 -1
  72. package/dist/canvas/NodeShape.js +55 -374
  73. package/dist/canvas/NodeShape.js.map +1 -1
  74. package/dist/canvas/PickHud.js +50 -47
  75. package/dist/canvas/PickHud.js.map +1 -1
  76. package/dist/canvas/SceneCanvas/DevHuds.js +40 -0
  77. package/dist/canvas/SceneCanvas/DevHuds.js.map +1 -0
  78. package/dist/canvas/SceneCanvas/GestureDispatcherMounter.js +126 -0
  79. package/dist/canvas/SceneCanvas/GestureDispatcherMounter.js.map +1 -0
  80. package/dist/canvas/SceneCanvas/PointerProviderIfRoot.js +27 -31
  81. package/dist/canvas/SceneCanvas/PointerProviderIfRoot.js.map +1 -1
  82. package/dist/canvas/SceneCanvas/StandardActionsRegistrar.js +64 -0
  83. package/dist/canvas/SceneCanvas/StandardActionsRegistrar.js.map +1 -0
  84. package/dist/canvas/SceneCanvas/ToolKeybindingsMounter.js +16 -0
  85. package/dist/canvas/SceneCanvas/ToolKeybindingsMounter.js.map +1 -0
  86. package/dist/canvas/SceneCanvas/coordTrace.js +46 -0
  87. package/dist/canvas/SceneCanvas/coordTrace.js.map +1 -0
  88. package/dist/canvas/SceneCanvas/defaultNodeProperties.js +138 -85
  89. package/dist/canvas/SceneCanvas/defaultNodeProperties.js.map +1 -1
  90. package/dist/canvas/SceneCanvas/defaultNodeRouting.js +9 -8
  91. package/dist/canvas/SceneCanvas/defaultNodeRouting.js.map +1 -1
  92. package/dist/canvas/SceneCanvas/dispatcherGestureBounds.js.map +1 -1
  93. package/dist/canvas/SceneCanvas/features.js +74 -43
  94. package/dist/canvas/SceneCanvas/features.js.map +1 -1
  95. package/dist/canvas/SceneCanvas/isDev.js +12 -0
  96. package/dist/canvas/SceneCanvas/isDev.js.map +1 -0
  97. package/dist/canvas/SceneCanvas/poseGeometry.js +31 -34
  98. package/dist/canvas/SceneCanvas/poseGeometry.js.map +1 -1
  99. package/dist/canvas/SceneCanvas/poseRegistrars.js +13 -0
  100. package/dist/canvas/SceneCanvas/poseRegistrars.js.map +1 -0
  101. package/dist/canvas/SceneCanvas/props.js +39 -0
  102. package/dist/canvas/SceneCanvas/props.js.map +1 -0
  103. package/dist/canvas/SceneCanvas/toolRegistry.js +23 -0
  104. package/dist/canvas/SceneCanvas/toolRegistry.js.map +1 -0
  105. package/dist/canvas/SceneCanvas/useActionsPropResolver.js +6 -1
  106. package/dist/canvas/SceneCanvas/useActionsPropResolver.js.map +1 -1
  107. package/dist/canvas/SceneCanvas/useBuiltinShapeTools.js +21 -62
  108. package/dist/canvas/SceneCanvas/useBuiltinShapeTools.js.map +1 -1
  109. package/dist/canvas/SceneCanvas/useBuiltinTools.js +21 -0
  110. package/dist/canvas/SceneCanvas/useBuiltinTools.js.map +1 -0
  111. package/dist/canvas/SceneCanvas/useCanvasCamera.js +38 -0
  112. package/dist/canvas/SceneCanvas/useCanvasCamera.js.map +1 -0
  113. package/dist/canvas/SceneCanvas/useCanvasDispatcher.js +20 -0
  114. package/dist/canvas/SceneCanvas/useCanvasDispatcher.js.map +1 -0
  115. package/dist/canvas/SceneCanvas/useCanvasSelection.js +16 -0
  116. package/dist/canvas/SceneCanvas/useCanvasSelection.js.map +1 -0
  117. package/dist/canvas/SceneCanvas/useCanvasTools.js +67 -0
  118. package/dist/canvas/SceneCanvas/useCanvasTools.js.map +1 -0
  119. package/dist/canvas/SceneCanvas/useDispatcherOverlayLayer.js +29 -29
  120. package/dist/canvas/SceneCanvas/useDispatcherOverlayLayer.js.map +1 -1
  121. package/dist/canvas/SceneCanvas/useHeldModifiers.js +20 -0
  122. package/dist/canvas/SceneCanvas/useHeldModifiers.js.map +1 -0
  123. package/dist/canvas/SceneCanvas/useNodeAtPoint.js +26 -0
  124. package/dist/canvas/SceneCanvas/useNodeAtPoint.js.map +1 -0
  125. package/dist/canvas/SceneCanvas/useNodeKinds.js +26 -0
  126. package/dist/canvas/SceneCanvas/useNodeKinds.js.map +1 -0
  127. package/dist/canvas/SceneCanvas/usePreviewGhostLayer.js +48 -48
  128. package/dist/canvas/SceneCanvas/usePreviewGhostLayer.js.map +1 -1
  129. package/dist/canvas/SceneCanvas/useSceneCanvasHandle.js +47 -0
  130. package/dist/canvas/SceneCanvas/useSceneCanvasHandle.js.map +1 -0
  131. package/dist/canvas/SceneCanvas/useSceneCanvasLayers.js +66 -0
  132. package/dist/canvas/SceneCanvas/useSceneCanvasLayers.js.map +1 -0
  133. package/dist/canvas/SceneCanvas/useSceneChrome.js +59 -0
  134. package/dist/canvas/SceneCanvas/useSceneChrome.js.map +1 -0
  135. package/dist/canvas/SceneCanvas/useSceneRedrawSources.js +23 -0
  136. package/dist/canvas/SceneCanvas/useSceneRedrawSources.js.map +1 -0
  137. package/dist/canvas/SceneCanvas/useSceneSelectTool.js +74 -78
  138. package/dist/canvas/SceneCanvas/useSceneSelectTool.js.map +1 -1
  139. package/dist/canvas/SceneCanvas/useSceneSlotLayers.js +37 -0
  140. package/dist/canvas/SceneCanvas/useSceneSlotLayers.js.map +1 -0
  141. package/dist/canvas/SceneCanvas/useSelectionOverlayLayer.js +38 -0
  142. package/dist/canvas/SceneCanvas/useSelectionOverlayLayer.js.map +1 -0
  143. package/dist/canvas/SceneCanvas/useViewLayerGate.js +20 -0
  144. package/dist/canvas/SceneCanvas/useViewLayerGate.js.map +1 -0
  145. package/dist/canvas/SceneCanvas/useViewportActions.js +9 -1
  146. package/dist/canvas/SceneCanvas/useViewportActions.js.map +1 -1
  147. package/dist/canvas/SceneCanvas/worldPointAt.js +9 -0
  148. package/dist/canvas/SceneCanvas/worldPointAt.js.map +1 -0
  149. package/dist/canvas/SceneCanvas.js +311 -969
  150. package/dist/canvas/SceneCanvas.js.map +1 -1
  151. package/dist/canvas/SceneViewCanvas.js +42 -46
  152. package/dist/canvas/SceneViewCanvas.js.map +1 -1
  153. package/dist/canvas/adapterDerivedPath.js +26 -0
  154. package/dist/canvas/adapterDerivedPath.js.map +1 -0
  155. package/dist/canvas/affordanceAt.js +11 -1
  156. package/dist/canvas/affordanceAt.js.map +1 -1
  157. package/dist/canvas/buildSceneLayer.js +111 -0
  158. package/dist/canvas/buildSceneLayer.js.map +1 -0
  159. package/dist/canvas/buildSceneTree.js +16 -19
  160. package/dist/canvas/buildSceneTree.js.map +1 -1
  161. package/dist/canvas/canvasRenderer.js +67 -55
  162. package/dist/canvas/canvasRenderer.js.map +1 -1
  163. package/dist/canvas/colorOverrides.js.map +1 -1
  164. package/dist/canvas/defaultDrawOne.js +12 -12
  165. package/dist/canvas/defaultDrawOne.js.map +1 -1
  166. package/dist/canvas/deps/areaSelect.js +4 -4
  167. package/dist/canvas/deps/areaSelect.js.map +1 -1
  168. package/dist/canvas/deps/changes.js +13 -0
  169. package/dist/canvas/deps/changes.js.map +1 -0
  170. package/dist/canvas/deps/debug.js.map +1 -1
  171. package/dist/canvas/deps/editAnchors.js +38 -57
  172. package/dist/canvas/deps/editAnchors.js.map +1 -1
  173. package/dist/canvas/deps/geometryProjection.js.map +1 -1
  174. package/dist/canvas/deps/hitTestArea.js +31 -26
  175. package/dist/canvas/deps/hitTestArea.js.map +1 -1
  176. package/dist/canvas/deps/insert.js +130 -91
  177. package/dist/canvas/deps/insert.js.map +1 -1
  178. package/dist/canvas/deps/lassoSelect.js +5 -5
  179. package/dist/canvas/deps/lassoSelect.js.map +1 -1
  180. package/dist/canvas/deps/poseDescriptor.js +1 -1
  181. package/dist/canvas/deps/poseDescriptor.js.map +1 -1
  182. package/dist/canvas/deps/resizePolicy.js.map +1 -1
  183. package/dist/canvas/deps/slice.js +26 -26
  184. package/dist/canvas/deps/slice.js.map +1 -1
  185. package/dist/canvas/deps/textEdit.js +6 -5
  186. package/dist/canvas/deps/textEdit.js.map +1 -1
  187. package/dist/canvas/deps/view.js.map +1 -1
  188. package/dist/canvas/derivedPath.js +47 -22
  189. package/dist/canvas/derivedPath.js.map +1 -1
  190. package/dist/canvas/drawEnvelope.js +8 -4
  191. package/dist/canvas/drawEnvelope.js.map +1 -1
  192. package/dist/canvas/getNodeAtPoint.js +4 -8
  193. package/dist/canvas/getNodeAtPoint.js.map +1 -1
  194. package/dist/canvas/hud.module.js +1 -1
  195. package/dist/canvas/hud.module.js.map +1 -1
  196. package/dist/canvas/insertPreviewExtent.js.map +1 -1
  197. package/dist/canvas/kitRequirements.js +2 -2
  198. package/dist/canvas/kitRequirements.js.map +1 -1
  199. package/dist/canvas/layerOrder.js +13 -6
  200. package/dist/canvas/layerOrder.js.map +1 -1
  201. package/dist/canvas/layerSlots.js +6 -1
  202. package/dist/canvas/layerSlots.js.map +1 -1
  203. package/dist/canvas/nodeShapes/derivedPainter.js +34 -0
  204. package/dist/canvas/nodeShapes/derivedPainter.js.map +1 -0
  205. package/dist/canvas/nodeShapes/imagePainter.js +87 -0
  206. package/dist/canvas/nodeShapes/imagePainter.js.map +1 -0
  207. package/dist/canvas/nodeShapes/memo.js +9 -0
  208. package/dist/canvas/nodeShapes/memo.js.map +1 -0
  209. package/dist/canvas/nodeShapes/nodePaint.js +68 -0
  210. package/dist/canvas/nodeShapes/nodePaint.js.map +1 -0
  211. package/dist/canvas/nodeShapes/pathPainter.js +39 -0
  212. package/dist/canvas/nodeShapes/pathPainter.js.map +1 -0
  213. package/dist/canvas/nodeShapes/poseBox.js +20 -0
  214. package/dist/canvas/nodeShapes/poseBox.js.map +1 -0
  215. package/dist/canvas/nodeShapes/rectFallbackPainter.js +38 -0
  216. package/dist/canvas/nodeShapes/rectFallbackPainter.js.map +1 -0
  217. package/dist/canvas/nodeShapes/shapePainter.js +72 -0
  218. package/dist/canvas/nodeShapes/shapePainter.js.map +1 -0
  219. package/dist/canvas/nodeShapes/textPainter.js +55 -0
  220. package/dist/canvas/nodeShapes/textPainter.js.map +1 -0
  221. package/dist/canvas/overlayRoleStrokes.js.map +1 -1
  222. package/dist/canvas/paintCull.js +11 -14
  223. package/dist/canvas/paintCull.js.map +1 -1
  224. package/dist/{features/cursor → canvas}/paintedCursorLayer.js +2 -2
  225. package/dist/canvas/paintedCursorLayer.js.map +1 -0
  226. package/dist/canvas/pickWalk.js +59 -68
  227. package/dist/canvas/pickWalk.js.map +1 -1
  228. package/dist/canvas/planeClips.js +18 -19
  229. package/dist/canvas/planeClips.js.map +1 -1
  230. package/dist/canvas/poseCascade.js +41 -0
  231. package/dist/canvas/poseCascade.js.map +1 -0
  232. package/dist/canvas/poseRotation.js +9 -23
  233. package/dist/canvas/poseRotation.js.map +1 -1
  234. package/dist/canvas/rasterReadback.js +22 -0
  235. package/dist/canvas/rasterReadback.js.map +1 -0
  236. package/dist/canvas/renderDebugSnapshot.js +11 -11
  237. package/dist/canvas/renderDebugSnapshot.js.map +1 -1
  238. package/dist/canvas/renderNeeds.js +3 -3
  239. package/dist/canvas/renderNeeds.js.map +1 -1
  240. package/dist/canvas/renderSceneToPixels.js +64 -81
  241. package/dist/canvas/renderSceneToPixels.js.map +1 -1
  242. package/dist/canvas/sceneAdapter.js +68 -214
  243. package/dist/canvas/sceneAdapter.js.map +1 -1
  244. package/dist/canvas/sceneClipboard.js +112 -0
  245. package/dist/canvas/sceneClipboard.js.map +1 -0
  246. package/dist/canvas/sceneLayerPaint.js +4 -4
  247. package/dist/canvas/sceneLayerPaint.js.map +1 -1
  248. package/dist/canvas/sceneSlotWiring.js.map +1 -1
  249. package/dist/canvas/sceneViewRender.js +39 -39
  250. package/dist/canvas/sceneViewRender.js.map +1 -1
  251. package/dist/canvas/slopsDebugLayer.js +4 -4
  252. package/dist/canvas/slopsDebugLayer.js.map +1 -1
  253. package/dist/canvas/surface.module.js +6 -0
  254. package/dist/canvas/surface.module.js.map +1 -0
  255. package/dist/canvas/surfaceBox.js +16 -0
  256. package/dist/canvas/surfaceBox.js.map +1 -0
  257. package/dist/canvas/useCanvasRenderer.js +26 -6
  258. package/dist/canvas/useCanvasRenderer.js.map +1 -1
  259. package/dist/canvas/useCanvasSurface.js +31 -0
  260. package/dist/canvas/useCanvasSurface.js.map +1 -0
  261. package/dist/canvas/useCanvasView.js +67 -0
  262. package/dist/canvas/useCanvasView.js.map +1 -0
  263. package/dist/canvas/useFrameLoop.js +39 -31
  264. package/dist/canvas/useFrameLoop.js.map +1 -1
  265. package/dist/canvas/useHostAnchor.js +35 -33
  266. package/dist/canvas/useHostAnchor.js.map +1 -1
  267. package/dist/canvas/useLateContentRedraw.js +8 -8
  268. package/dist/canvas/useLateContentRedraw.js.map +1 -1
  269. package/dist/canvas/useSceneLayerList.js +11 -0
  270. package/dist/canvas/useSceneLayerList.js.map +1 -0
  271. package/dist/canvas/useSurfaceInput.js +42 -0
  272. package/dist/canvas/useSurfaceInput.js.map +1 -0
  273. package/dist/canvas/useToolCursor.js +29 -0
  274. package/dist/canvas/useToolCursor.js.map +1 -0
  275. package/dist/canvas/useViewHelpers.js +46 -85
  276. package/dist/canvas/useViewHelpers.js.map +1 -1
  277. package/dist/canvas/viewInputs.js.map +1 -1
  278. package/dist/canvas/viewRegistry.js +25 -27
  279. package/dist/canvas/viewRegistry.js.map +1 -1
  280. package/dist/canvas/watchElementMove.js +43 -0
  281. package/dist/canvas/watchElementMove.js.map +1 -0
  282. package/dist/canvas/wrapNodeOutput.js.map +1 -1
  283. package/dist/clipboard.d.ts +16 -19
  284. package/dist/{types-B_9g6hMM.d.ts → clone-2a5hVbBd.d.ts} +123 -74
  285. package/dist/clone.d.ts +4 -7
  286. package/dist/clone.js +0 -2
  287. package/dist/core/device/index.js +5 -4
  288. package/dist/core/device/targets.js.map +1 -1
  289. package/dist/core/device/useDeviceProfile.js +38 -44
  290. package/dist/core/device/useDeviceProfile.js.map +1 -1
  291. package/dist/core/device/watchDevicePixelRatio.js +17 -0
  292. package/dist/core/device/watchDevicePixelRatio.js.map +1 -0
  293. package/dist/{interactions/actions/resize → core/geometry}/autoPoseDescriptor.js +8 -7
  294. package/dist/core/geometry/autoPoseDescriptor.js.map +1 -0
  295. package/dist/core/geometry/pathPoseDescriptor.js +88 -0
  296. package/dist/core/geometry/pathPoseDescriptor.js.map +1 -0
  297. package/dist/core/geometry/poseDescriptor.js +68 -19
  298. package/dist/core/geometry/poseDescriptor.js.map +1 -1
  299. package/dist/core/geometry/regionHit.js +31 -34
  300. package/dist/core/geometry/regionHit.js.map +1 -1
  301. package/dist/core/geometry/targetFrame.js +94 -0
  302. package/dist/core/geometry/targetFrame.js.map +1 -0
  303. package/dist/core/geometry/unionBounds.js +30 -29
  304. package/dist/core/geometry/unionBounds.js.map +1 -1
  305. package/dist/core/isPlainObject.js +2 -11
  306. package/dist/core/layers/backgroundFill.js +31 -0
  307. package/dist/core/layers/backgroundFill.js.map +1 -0
  308. package/dist/{features/groups → core/layers}/children.js +1 -1
  309. package/dist/core/layers/children.js.map +1 -0
  310. package/dist/core/layers/gateLayer.js +13 -0
  311. package/dist/core/layers/gateLayer.js.map +1 -0
  312. package/dist/core/layers/layerGroup.js +40 -0
  313. package/dist/core/layers/layerGroup.js.map +1 -0
  314. package/dist/core/layers/render.js +50 -76
  315. package/dist/core/layers/render.js.map +1 -1
  316. package/dist/core/ops/arrange.js +1 -0
  317. package/dist/core/ops/arrange.js.map +1 -1
  318. package/dist/core/ops/create.js +10 -5
  319. package/dist/core/ops/create.js.map +1 -1
  320. package/dist/core/ops/createHistory.js +9 -9
  321. package/dist/core/ops/createHistory.js.map +1 -1
  322. package/dist/core/ops/delete.js +12 -24
  323. package/dist/core/ops/delete.js.map +1 -1
  324. package/dist/core/ops/reorder/index.js +43 -40
  325. package/dist/core/ops/reorder/index.js.map +1 -1
  326. package/dist/core/ops/reorder/setChildOrder.js +34 -0
  327. package/dist/core/ops/reorder/setChildOrder.js.map +1 -0
  328. package/dist/core/paint/meshKind.js +16 -0
  329. package/dist/core/paint/meshKind.js.map +1 -0
  330. package/dist/{features/meshPaint/lazyKind.js → core/paint/meshKindLazy.js} +282 -105
  331. package/dist/core/paint/meshKindLazy.js.map +1 -0
  332. package/dist/core/paint/paintKindEntry.js +8 -0
  333. package/dist/core/paint/paintKindEntry.js.map +1 -0
  334. package/dist/core/paint/paintKinds.js +144 -0
  335. package/dist/core/paint/paintKinds.js.map +1 -0
  336. package/dist/core/paint/registerMesh.js +7 -0
  337. package/dist/core/paint/registerMesh.js.map +1 -0
  338. package/dist/core/scene/NodeProperties.js.map +1 -1
  339. package/dist/core/scene/NodeRouting.js.map +1 -1
  340. package/dist/core/scene/appliedLog.js +37 -0
  341. package/dist/core/scene/appliedLog.js.map +1 -0
  342. package/dist/core/scene/arrivalWindow.js +102 -0
  343. package/dist/core/scene/arrivalWindow.js.map +1 -0
  344. package/dist/core/scene/boundOps.js +40 -0
  345. package/dist/core/scene/boundOps.js.map +1 -0
  346. package/dist/core/scene/composeFrame.js +9 -6
  347. package/dist/core/scene/composeFrame.js.map +1 -1
  348. package/dist/{features/groups → core/scene}/composePose.js +18 -18
  349. package/dist/core/scene/composePose.js.map +1 -0
  350. package/dist/core/scene/depMemo.js +31 -6
  351. package/dist/core/scene/depMemo.js.map +1 -1
  352. package/dist/core/scene/derivedPath.js +19 -20
  353. package/dist/core/scene/derivedPath.js.map +1 -1
  354. package/dist/core/scene/editMode.js +26 -0
  355. package/dist/core/scene/editMode.js.map +1 -0
  356. package/dist/core/scene/effectivePose.js +38 -39
  357. package/dist/core/scene/effectivePose.js.map +1 -1
  358. package/dist/core/scene/fieldEdits.js +98 -0
  359. package/dist/core/scene/fieldEdits.js.map +1 -0
  360. package/dist/core/scene/historyFacade.js +130 -0
  361. package/dist/core/scene/historyFacade.js.map +1 -0
  362. package/dist/core/scene/historyForm.js +6 -0
  363. package/dist/core/scene/historyForm.js.map +1 -0
  364. package/dist/core/scene/kitOps.js +185 -0
  365. package/dist/core/scene/kitOps.js.map +1 -0
  366. package/dist/core/scene/kitRegistry.js.map +1 -1
  367. package/dist/core/scene/layerStack.js +131 -0
  368. package/dist/core/scene/layerStack.js.map +1 -0
  369. package/dist/core/scene/layoutPass.js +58 -59
  370. package/dist/core/scene/layoutPass.js.map +1 -1
  371. package/dist/core/scene/lockGuard.js +37 -0
  372. package/dist/core/scene/lockGuard.js.map +1 -0
  373. package/dist/{features/groups → core/scene}/nestedHit.js +3 -3
  374. package/dist/core/scene/nestedHit.js.map +1 -0
  375. package/dist/core/scene/nodeFnFields.js +10 -11
  376. package/dist/core/scene/nodeFnFields.js.map +1 -1
  377. package/dist/core/scene/nodeMemo.js +45 -19
  378. package/dist/core/scene/nodeMemo.js.map +1 -1
  379. package/dist/core/scene/nodeStore.js +127 -0
  380. package/dist/core/scene/nodeStore.js.map +1 -0
  381. package/dist/core/scene/notifier.js +37 -0
  382. package/dist/core/scene/notifier.js.map +1 -0
  383. package/dist/core/scene/opTable.js +50 -0
  384. package/dist/core/scene/opTable.js.map +1 -0
  385. package/dist/core/scene/outerOps.js +66 -0
  386. package/dist/core/scene/outerOps.js.map +1 -0
  387. package/dist/core/scene/poseFeed.js +38 -38
  388. package/dist/core/scene/poseFeed.js.map +1 -1
  389. package/dist/core/scene/poseHold.js +39 -0
  390. package/dist/core/scene/poseHold.js.map +1 -0
  391. package/dist/core/scene/poseOverrides.js +44 -40
  392. package/dist/core/scene/poseOverrides.js.map +1 -1
  393. package/dist/core/scene/poseSnapshot.js.map +1 -1
  394. package/dist/core/scene/reconcileSpecs.js +3 -2
  395. package/dist/core/scene/reconcileSpecs.js.map +1 -1
  396. package/dist/core/scene/recorder.js +86 -0
  397. package/dist/core/scene/recorder.js.map +1 -0
  398. package/dist/core/scene/renderOrder.js +84 -0
  399. package/dist/core/scene/renderOrder.js.map +1 -0
  400. package/dist/core/scene/scene.js +80 -1266
  401. package/dist/core/scene/scene.js.map +1 -1
  402. package/dist/core/scene/sceneEdits.js +58 -0
  403. package/dist/core/scene/sceneEdits.js.map +1 -0
  404. package/dist/core/scene/sceneMutators.js +49 -0
  405. package/dist/core/scene/sceneMutators.js.map +1 -0
  406. package/dist/core/scene/scenePoseAdapter.js +16 -0
  407. package/dist/core/scene/scenePoseAdapter.js.map +1 -0
  408. package/dist/core/scene/sceneRecording.js +90 -0
  409. package/dist/core/scene/sceneRecording.js.map +1 -0
  410. package/dist/core/scene/sceneSelection.js +28 -0
  411. package/dist/core/scene/sceneSelection.js.map +1 -0
  412. package/dist/core/scene/sceneState.js +49 -0
  413. package/dist/core/scene/sceneState.js.map +1 -0
  414. package/dist/core/scene/serialization.js +71 -0
  415. package/dist/core/scene/serialization.js.map +1 -0
  416. package/dist/core/scene/staleReplay.js +51 -0
  417. package/dist/core/scene/staleReplay.js.map +1 -0
  418. package/dist/core/scene/statedFields.js +9 -0
  419. package/dist/core/scene/statedFields.js.map +1 -0
  420. package/dist/core/scene/treeEdits.js +127 -0
  421. package/dist/core/scene/treeEdits.js.map +1 -0
  422. package/dist/core/scene/treeOrder.js +13 -0
  423. package/dist/core/scene/treeOrder.js.map +1 -0
  424. package/dist/core/scene/treeReads.js +26 -0
  425. package/dist/core/scene/treeReads.js.map +1 -0
  426. package/dist/core/scene/types.js.map +1 -1
  427. package/dist/{features/groups → core/scene}/unionOfChildren.js +3 -3
  428. package/dist/core/scene/unionOfChildren.js.map +1 -0
  429. package/dist/core/scene/unitScopes.js +13 -0
  430. package/dist/core/scene/unitScopes.js.map +1 -0
  431. package/dist/core/scene/useScene.js.map +1 -1
  432. package/dist/core/selection/readOnlySelection.js +32 -0
  433. package/dist/core/selection/readOnlySelection.js.map +1 -0
  434. package/dist/core/selection/usePublishSceneSelection.js +26 -0
  435. package/dist/core/selection/usePublishSceneSelection.js.map +1 -0
  436. package/dist/core/selection/useSelection.js +34 -25
  437. package/dist/core/selection/useSelection.js.map +1 -1
  438. package/dist/core/shapeKinds.js.map +1 -1
  439. package/dist/core/stylus/stylus.js.map +1 -1
  440. package/dist/core/stylus/usePointerStylus.js.map +1 -1
  441. package/dist/core/usePaintKinds.js +1 -1
  442. package/dist/core/usePaintKinds.js.map +1 -1
  443. package/dist/core/viewport/clientToWorld.js.map +1 -1
  444. package/dist/core/viewport/fitViewToBounds.js.map +1 -1
  445. package/dist/core/viewport/parallax.js.map +1 -1
  446. package/dist/core/viewport/screenSlop.js +11 -11
  447. package/dist/core/viewport/screenSlop.js.map +1 -1
  448. package/dist/core/viewport/useCanvasSize.js.map +1 -1
  449. package/dist/core/viewport/useDecayLoop.js +8 -8
  450. package/dist/core/viewport/useDecayLoop.js.map +1 -1
  451. package/dist/core/viewport/useNodeOverlayFrame.js +84 -0
  452. package/dist/core/viewport/useNodeOverlayFrame.js.map +1 -0
  453. package/dist/core/viewport/useViewAnimation.js +102 -43
  454. package/dist/core/viewport/useViewAnimation.js.map +1 -1
  455. package/dist/core/viewport/view.js +9 -9
  456. package/dist/core/viewport/view.js.map +1 -1
  457. package/dist/core/viewport/wheelHandler.js.map +1 -1
  458. package/dist/core/viewport/zoomBounds.js +10 -8
  459. package/dist/core/viewport/zoomBounds.js.map +1 -1
  460. package/dist/{cornerHandles-BCrDp_mH.d.ts → cornerHandles-BEshc4z3.d.ts} +11 -24
  461. package/dist/debug/createDebugOverlayLayer.js +97 -97
  462. package/dist/debug/createDebugOverlayLayer.js.map +1 -1
  463. package/dist/debug/createDebugSink.js.map +1 -1
  464. package/dist/debug/flag.js +2 -41
  465. package/dist/debug/frameStats.js.map +1 -1
  466. package/dist/debug/useDebugSink.js +52 -0
  467. package/dist/debug/useDebugSink.js.map +1 -0
  468. package/dist/features/chrome-caps/buildChromeCtx.js.map +1 -1
  469. package/dist/features/chrome-caps/conditions.js.map +1 -1
  470. package/dist/features/chrome-caps/defaults.js.map +1 -1
  471. package/dist/features/chrome-caps/resolve.js.map +1 -1
  472. package/dist/features/chrome-caps/useChromeCaps.js +54 -0
  473. package/dist/features/chrome-caps/useChromeCaps.js.map +1 -0
  474. package/dist/features/chrome-caps/useHoverTracking.js +22 -17
  475. package/dist/features/chrome-caps/useHoverTracking.js.map +1 -1
  476. package/dist/features/ingestion/contentHandlers.js +28 -19
  477. package/dist/features/ingestion/contentHandlers.js.map +1 -1
  478. package/dist/features/ingestion/imageHandler.js +21 -24
  479. package/dist/features/ingestion/imageHandler.js.map +1 -1
  480. package/dist/features/ingestion/openFilePicker.js.map +1 -1
  481. package/dist/features/ingestion/placement.js +16 -0
  482. package/dist/features/ingestion/placement.js.map +1 -0
  483. package/dist/features/ingestion/registerKitHandlers.js +7 -7
  484. package/dist/features/ingestion/svgHandler.js +5 -0
  485. package/dist/features/ingestion/svgHandler.js.map +1 -1
  486. package/dist/features/ingestion/textHandler.js +28 -0
  487. package/dist/features/ingestion/textHandler.js.map +1 -0
  488. package/dist/features/ingestion/useCanvasIngestion.js +48 -0
  489. package/dist/features/ingestion/useCanvasIngestion.js.map +1 -0
  490. package/dist/features/ingestion/weaselJsonHandler.js +22 -14
  491. package/dist/features/ingestion/weaselJsonHandler.js.map +1 -1
  492. package/dist/features/longPress/longPressFeedback.js.map +1 -1
  493. package/dist/features/modes/modeLayers.js +7 -7
  494. package/dist/features/modes/modeLayers.js.map +1 -1
  495. package/dist/features/paths/editablePath.js +47 -0
  496. package/dist/features/paths/editablePath.js.map +1 -0
  497. package/dist/features/paths/index.js +9 -14
  498. package/dist/features/paths/pathEditState.js +41 -0
  499. package/dist/features/paths/pathEditState.js.map +1 -0
  500. package/dist/features/paths/pathEditingOverlayLayer.js +36 -38
  501. package/dist/features/paths/pathEditingOverlayLayer.js.map +1 -1
  502. package/dist/features/paths/pathLayer.js +3 -2
  503. package/dist/features/paths/pathLayer.js.map +1 -1
  504. package/dist/features/paths/penPreviewLayer.js +86 -88
  505. package/dist/features/paths/penPreviewLayer.js.map +1 -1
  506. package/dist/features/paths/usePathEdit.js +34 -0
  507. package/dist/features/paths/usePathEdit.js.map +1 -0
  508. package/dist/features/poseRun/usePoseRun.js +44 -52
  509. package/dist/features/poseRun/usePoseRun.js.map +1 -1
  510. package/dist/features/selection/overlay.js +171 -179
  511. package/dist/features/selection/overlay.js.map +1 -1
  512. package/dist/features/text/index.js +6 -0
  513. package/dist/features/text/textLayer.js +1 -1
  514. package/dist/features/text/textLayer.js.map +1 -1
  515. package/dist/features/text/useSceneTextEdit.js +100 -93
  516. package/dist/features/text/useSceneTextEdit.js.map +1 -1
  517. package/dist/features/viewports/viewportLayer.js +25 -36
  518. package/dist/features/viewports/viewportLayer.js.map +1 -1
  519. package/dist/index.d.ts +8473 -9141
  520. package/dist/index.js +269 -307
  521. package/dist/input/keyState.js +38 -39
  522. package/dist/input/keyState.js.map +1 -1
  523. package/dist/input/useKeyModifiers.js +11 -0
  524. package/dist/input/useKeyModifiers.js.map +1 -0
  525. package/dist/interactions/actions/actionShortcuts.js.map +1 -1
  526. package/dist/interactions/actions/{defaults/align.js → align/action.js} +18 -20
  527. package/dist/interactions/actions/align/action.js.map +1 -0
  528. package/dist/interactions/actions/align/align.js +20 -20
  529. package/dist/interactions/actions/align/align.js.map +1 -1
  530. package/dist/interactions/actions/booleans/action.js +65 -0
  531. package/dist/interactions/actions/booleans/action.js.map +1 -0
  532. package/dist/interactions/actions/booleans/booleans.js +69 -78
  533. package/dist/interactions/actions/booleans/booleans.js.map +1 -1
  534. package/dist/interactions/actions/booleans/operands.js +40 -0
  535. package/dist/interactions/actions/booleans/operands.js.map +1 -0
  536. package/dist/interactions/actions/booleans/pieces.js +45 -0
  537. package/dist/interactions/actions/booleans/pieces.js.map +1 -0
  538. package/dist/interactions/actions/booleans/placement.js +24 -0
  539. package/dist/interactions/actions/booleans/placement.js.map +1 -0
  540. package/dist/interactions/actions/booleans/useBooleans.js +11 -9
  541. package/dist/interactions/actions/booleans/useBooleans.js.map +1 -1
  542. package/dist/interactions/actions/booleans/useBooleansAdapter.js.map +1 -1
  543. package/dist/interactions/actions/{defaults/clipboard.js → clipboard/action.js} +31 -15
  544. package/dist/interactions/actions/clipboard/action.js.map +1 -0
  545. package/dist/interactions/actions/clipboard/clipboardOps.js +44 -42
  546. package/dist/interactions/actions/clipboard/clipboardOps.js.map +1 -1
  547. package/dist/interactions/actions/clipboard/materializePaste.js +10 -7
  548. package/dist/interactions/actions/clipboard/materializePaste.js.map +1 -1
  549. package/dist/interactions/actions/clipboard/wireFormat.js.map +1 -1
  550. package/dist/interactions/actions/clone/action.js +98 -0
  551. package/dist/interactions/actions/clone/action.js.map +1 -0
  552. package/dist/interactions/actions/clone/behaviors.js +52 -0
  553. package/dist/interactions/actions/clone/behaviors.js.map +1 -0
  554. package/dist/interactions/actions/defaultCommitAdapter.js +7 -32
  555. package/dist/interactions/actions/defaultCommitAdapter.js.map +1 -1
  556. package/dist/interactions/actions/defaults/anchorEditing.js +60 -84
  557. package/dist/interactions/actions/defaults/anchorEditing.js.map +1 -1
  558. package/dist/interactions/actions/defaults/areaSelect.js +35 -38
  559. package/dist/interactions/actions/defaults/areaSelect.js.map +1 -1
  560. package/dist/interactions/actions/defaults/cancelGesture.js.map +1 -1
  561. package/dist/interactions/actions/defaults/clearSelection.js.map +1 -1
  562. package/dist/interactions/actions/defaults/copySubtree.js +40 -0
  563. package/dist/interactions/actions/defaults/copySubtree.js.map +1 -0
  564. package/dist/interactions/actions/defaults/createPaintAction.js.map +1 -1
  565. package/dist/interactions/actions/defaults/delete.js.map +1 -1
  566. package/dist/interactions/actions/defaults/duplicate.js +13 -53
  567. package/dist/interactions/actions/defaults/duplicate.js.map +1 -1
  568. package/dist/interactions/actions/defaults/enterTextEdit.js.map +1 -1
  569. package/dist/interactions/actions/defaults/group.js +40 -50
  570. package/dist/interactions/actions/defaults/group.js.map +1 -1
  571. package/dist/interactions/actions/defaults/icons/booleanIcons.js +24 -1
  572. package/dist/interactions/actions/defaults/icons/booleanIcons.js.map +1 -1
  573. package/dist/interactions/actions/defaults/icons/outlineIcons.js +39 -1
  574. package/dist/interactions/actions/defaults/icons/outlineIcons.js.map +1 -1
  575. package/dist/interactions/actions/defaults/ingest.js +44 -38
  576. package/dist/interactions/actions/defaults/ingest.js.map +1 -1
  577. package/dist/interactions/actions/defaults/insertPathAnchor.js +11 -12
  578. package/dist/interactions/actions/defaults/insertPathAnchor.js.map +1 -1
  579. package/dist/interactions/actions/defaults/nudge.js +40 -69
  580. package/dist/interactions/actions/defaults/nudge.js.map +1 -1
  581. package/dist/interactions/actions/defaults/nudgeSteps.js +37 -0
  582. package/dist/interactions/actions/defaults/nudgeSteps.js.map +1 -0
  583. package/dist/interactions/actions/defaults/pinchZoom.js.map +1 -1
  584. package/dist/interactions/actions/defaults/reorder.js +2 -0
  585. package/dist/interactions/actions/defaults/reorder.js.map +1 -1
  586. package/dist/interactions/actions/defaults/requiresSelection.js.map +1 -1
  587. package/dist/interactions/actions/defaults/setFill.js +14 -8
  588. package/dist/interactions/actions/defaults/setFill.js.map +1 -1
  589. package/dist/interactions/actions/defaults/setFillOpacity.js +7 -4
  590. package/dist/interactions/actions/defaults/setFillOpacity.js.map +1 -1
  591. package/dist/interactions/actions/defaults/setStroke.js +12 -12
  592. package/dist/interactions/actions/defaults/setStroke.js.map +1 -1
  593. package/dist/interactions/actions/defaults/setStrokeOpacity.js +6 -6
  594. package/dist/interactions/actions/defaults/sliceOps.js +8 -10
  595. package/dist/interactions/actions/defaults/sliceOps.js.map +1 -1
  596. package/dist/interactions/actions/defaults/toolActivate.js.map +1 -1
  597. package/dist/interactions/actions/defaults/toolResetToDefault.js.map +1 -1
  598. package/dist/interactions/actions/defaults/viewportDragPan.js +37 -26
  599. package/dist/interactions/actions/defaults/viewportDragPan.js.map +1 -1
  600. package/dist/interactions/actions/defaults/viewportWheelPan.js.map +1 -1
  601. package/dist/interactions/actions/defaults/viewportZoom.js.map +1 -1
  602. package/dist/interactions/actions/distribute/action.js +66 -0
  603. package/dist/interactions/actions/distribute/action.js.map +1 -0
  604. package/dist/interactions/actions/distribute/distribute.js +11 -11
  605. package/dist/interactions/actions/distribute/distribute.js.map +1 -1
  606. package/dist/interactions/actions/{defaults/editAnchors.js → edit-anchors/action.js} +7 -9
  607. package/dist/interactions/actions/edit-anchors/action.js.map +1 -0
  608. package/dist/interactions/actions/edit-anchors/geometry.js +30 -27
  609. package/dist/interactions/actions/edit-anchors/geometry.js.map +1 -1
  610. package/dist/interactions/actions/flip/action.js +124 -0
  611. package/dist/interactions/actions/flip/action.js.map +1 -0
  612. package/dist/interactions/actions/flip/helpers.js +30 -17
  613. package/dist/interactions/actions/flip/helpers.js.map +1 -1
  614. package/dist/interactions/actions/gestureFrames.js +18 -0
  615. package/dist/interactions/actions/gestureFrames.js.map +1 -0
  616. package/dist/interactions/actions/gestureLifecycle.js +47 -20
  617. package/dist/interactions/actions/gestureLifecycle.js.map +1 -1
  618. package/dist/interactions/actions/hitSelection.js +8 -0
  619. package/dist/interactions/actions/hitSelection.js.map +1 -0
  620. package/dist/interactions/actions/insert/action.js +72 -0
  621. package/dist/interactions/actions/insert/action.js.map +1 -0
  622. package/dist/interactions/actions/insert/commit.js +28 -0
  623. package/dist/interactions/actions/insert/commit.js.map +1 -0
  624. package/dist/interactions/actions/insert/extras.js +65 -0
  625. package/dist/interactions/actions/insert/extras.js.map +1 -0
  626. package/dist/interactions/actions/insert/frame.js +48 -0
  627. package/dist/interactions/actions/insert/frame.js.map +1 -0
  628. package/dist/interactions/actions/insert/geometry.js +35 -0
  629. package/dist/interactions/actions/insert/geometry.js.map +1 -0
  630. package/dist/interactions/actions/insert/rotateAction.js +21 -0
  631. package/dist/interactions/actions/insert/rotateAction.js.map +1 -0
  632. package/dist/interactions/actions/insert/session.js +59 -0
  633. package/dist/interactions/actions/insert/session.js.map +1 -0
  634. package/dist/interactions/actions/insert/shape.js +34 -0
  635. package/dist/interactions/actions/insert/shape.js.map +1 -0
  636. package/dist/interactions/actions/lasso-select/action.js +143 -0
  637. package/dist/interactions/actions/lasso-select/action.js.map +1 -0
  638. package/dist/interactions/actions/lasso-select/behaviors/selectFromLasso.js +14 -18
  639. package/dist/interactions/actions/lasso-select/behaviors/selectFromLasso.js.map +1 -1
  640. package/dist/interactions/actions/move/action.js +87 -0
  641. package/dist/interactions/actions/move/action.js.map +1 -0
  642. package/dist/interactions/actions/move/behaviors/layoutDrop.js +51 -0
  643. package/dist/interactions/actions/move/behaviors/layoutDrop.js.map +1 -0
  644. package/dist/interactions/actions/move/behaviors/reparentOnDrop.js +15 -0
  645. package/dist/interactions/actions/move/behaviors/reparentOnDrop.js.map +1 -0
  646. package/dist/interactions/actions/move/behaviors/snapBackOrDelete.js +5 -5
  647. package/dist/interactions/actions/move/behaviors/snapBackOrDelete.js.map +1 -1
  648. package/dist/interactions/actions/move/behaviors/snapToContainer.js +39 -27
  649. package/dist/interactions/actions/move/behaviors/snapToContainer.js.map +1 -1
  650. package/dist/interactions/actions/move/capture.js +99 -0
  651. package/dist/interactions/actions/move/capture.js.map +1 -0
  652. package/dist/interactions/actions/move/commit/index.js +41 -0
  653. package/dist/interactions/actions/move/commit/index.js.map +1 -0
  654. package/dist/interactions/actions/move/commit/layoutDrop.js +44 -0
  655. package/dist/interactions/actions/move/commit/layoutDrop.js.map +1 -0
  656. package/dist/interactions/actions/move/commit/layoutRelease.js +100 -0
  657. package/dist/interactions/actions/move/commit/layoutRelease.js.map +1 -0
  658. package/dist/interactions/actions/move/commit/rebase.js +18 -0
  659. package/dist/interactions/actions/move/commit/rebase.js.map +1 -0
  660. package/dist/interactions/actions/move/commit/reparent.js +65 -0
  661. package/dist/interactions/actions/move/commit/reparent.js.map +1 -0
  662. package/dist/interactions/actions/move/delta.js +51 -0
  663. package/dist/interactions/actions/move/delta.js.map +1 -0
  664. package/dist/interactions/actions/move/frame.js +59 -0
  665. package/dist/interactions/actions/move/frame.js.map +1 -0
  666. package/dist/interactions/actions/move/gestureAdapter.js +22 -30
  667. package/dist/interactions/actions/move/gestureAdapter.js.map +1 -1
  668. package/dist/interactions/actions/move/landedDescendants.js +33 -0
  669. package/dist/interactions/actions/move/landedDescendants.js.map +1 -0
  670. package/dist/interactions/actions/move/layout/container.js +94 -0
  671. package/dist/interactions/actions/move/layout/container.js.map +1 -0
  672. package/dist/interactions/actions/move/layout/dragged.js +58 -0
  673. package/dist/interactions/actions/move/layout/dragged.js.map +1 -0
  674. package/dist/interactions/actions/move/layout/dropPass.js +122 -0
  675. package/dist/interactions/actions/move/layout/dropPass.js.map +1 -0
  676. package/dist/interactions/actions/move/layout/exits.js +38 -0
  677. package/dist/interactions/actions/move/layout/exits.js.map +1 -0
  678. package/dist/interactions/actions/move/layout/glide.js +48 -0
  679. package/dist/interactions/actions/move/layout/glide.js.map +1 -0
  680. package/dist/interactions/actions/move/session.js +63 -0
  681. package/dist/interactions/actions/move/session.js.map +1 -0
  682. package/dist/interactions/actions/move/translate.js +61 -0
  683. package/dist/interactions/actions/move/translate.js.map +1 -0
  684. package/dist/interactions/actions/outlines/createOutlines.js +16 -63
  685. package/dist/interactions/actions/outlines/createOutlines.js.map +1 -1
  686. package/dist/interactions/actions/outlines/createOutlinesAction.js +51 -0
  687. package/dist/interactions/actions/outlines/createOutlinesAction.js.map +1 -0
  688. package/dist/interactions/actions/outlines/outlineStroke.js +72 -0
  689. package/dist/interactions/actions/outlines/outlineStroke.js.map +1 -0
  690. package/dist/interactions/actions/outlines/outlineStrokeAction.js +37 -0
  691. package/dist/interactions/actions/outlines/outlineStrokeAction.js.map +1 -0
  692. package/dist/interactions/actions/outlines/replaceWithPaths.js +54 -0
  693. package/dist/interactions/actions/outlines/replaceWithPaths.js.map +1 -0
  694. package/dist/interactions/actions/outlines/strokeRegion.js +27 -0
  695. package/dist/interactions/actions/outlines/strokeRegion.js.map +1 -0
  696. package/dist/interactions/actions/planeInput.js.map +1 -1
  697. package/dist/interactions/actions/pointerState.js +12 -0
  698. package/dist/interactions/actions/pointerState.js.map +1 -0
  699. package/dist/interactions/actions/poseDescriptorDep.js +16 -4
  700. package/dist/interactions/actions/poseDescriptorDep.js.map +1 -1
  701. package/dist/interactions/actions/poseFrame.js +25 -20
  702. package/dist/interactions/actions/poseFrame.js.map +1 -1
  703. package/dist/interactions/actions/resize/action.js +55 -0
  704. package/dist/interactions/actions/resize/action.js.map +1 -0
  705. package/dist/interactions/actions/resize/behaviors/lockAspect.js.map +1 -1
  706. package/dist/interactions/actions/resize/boxFrame.js +16 -0
  707. package/dist/interactions/actions/resize/boxFrame.js.map +1 -0
  708. package/dist/interactions/actions/resize/capture.js +85 -0
  709. package/dist/interactions/actions/resize/capture.js.map +1 -0
  710. package/dist/interactions/actions/resize/commit.js +69 -0
  711. package/dist/interactions/actions/resize/commit.js.map +1 -0
  712. package/dist/interactions/actions/resize/frame.js +74 -0
  713. package/dist/interactions/actions/resize/frame.js.map +1 -0
  714. package/dist/interactions/actions/resize/pointSnap.js +111 -0
  715. package/dist/interactions/actions/resize/pointSnap.js.map +1 -0
  716. package/dist/interactions/actions/resize/ruleBounds.js +9 -0
  717. package/dist/interactions/actions/resize/ruleBounds.js.map +1 -0
  718. package/dist/interactions/actions/resize/session.js +49 -0
  719. package/dist/interactions/actions/resize/session.js.map +1 -0
  720. package/dist/interactions/actions/resolveOverlays.js.map +1 -1
  721. package/dist/interactions/actions/resolvePreviews.js.map +1 -1
  722. package/dist/interactions/actions/rotate/action.js +56 -0
  723. package/dist/interactions/actions/rotate/action.js.map +1 -0
  724. package/dist/interactions/actions/rotate/behaviors/index.js +7 -0
  725. package/dist/interactions/actions/rotate/behaviors/index.js.map +1 -0
  726. package/dist/interactions/actions/rotate/behaviors/snapRotation.js +12 -0
  727. package/dist/interactions/actions/rotate/behaviors/snapRotation.js.map +1 -0
  728. package/dist/interactions/actions/rotate/commit.js +40 -0
  729. package/dist/interactions/actions/rotate/commit.js.map +1 -0
  730. package/dist/interactions/actions/rotate/frame.js +65 -0
  731. package/dist/interactions/actions/rotate/frame.js.map +1 -0
  732. package/dist/interactions/actions/rotate/handle.js +12 -12
  733. package/dist/interactions/actions/rotate/handle.js.map +1 -1
  734. package/dist/interactions/actions/rotate/session.js +92 -0
  735. package/dist/interactions/actions/rotate/session.js.map +1 -0
  736. package/dist/interactions/actions/selectionSubtree.js +69 -0
  737. package/dist/interactions/actions/selectionSubtree.js.map +1 -0
  738. package/dist/interactions/actions/spatialReference.js.map +1 -1
  739. package/dist/interactions/actions/useStandardActions.js +87 -78
  740. package/dist/interactions/actions/useStandardActions.js.map +1 -1
  741. package/dist/interactions/gestures/dragGesture/dragGesture.js +4 -7
  742. package/dist/interactions/gestures/dragGesture/dragGesture.js.map +1 -1
  743. package/dist/interactions/gestures/dragGesture/dragPointOf.js +23 -0
  744. package/dist/interactions/gestures/dragGesture/dragPointOf.js.map +1 -0
  745. package/dist/interactions/gestures/handleDrag/handleDrag.js +21 -26
  746. package/dist/interactions/gestures/handleDrag/handleDrag.js.map +1 -1
  747. package/dist/interactions/gestures/pointerDrag/pointerDrag.js +62 -41
  748. package/dist/interactions/gestures/pointerDrag/pointerDrag.js.map +1 -1
  749. package/dist/interactions/gestures/shared/originProjection.js +1 -1
  750. package/dist/interactions/gestures/shared/originProjection.js.map +1 -1
  751. package/dist/interactions/gestures/shared/screenTolerance.js +8 -2
  752. package/dist/interactions/gestures/shared/screenTolerance.js.map +1 -1
  753. package/dist/interactions/gestures/shared/snap.js.map +1 -1
  754. package/dist/interactions/gestures/thresholdDrag/thresholdDrag.js +8 -4
  755. package/dist/interactions/gestures/thresholdDrag/thresholdDrag.js.map +1 -1
  756. package/dist/layout/arrivals.js +20 -23
  757. package/dist/layout/arrivals.js.map +1 -1
  758. package/dist/math-CYUjoyyU.d.ts +33 -0
  759. package/dist/math.d.ts +5 -3
  760. package/dist/math.js +6 -6
  761. package/dist/mesh.d.ts +4 -268
  762. package/dist/mesh.js +3 -7
  763. package/dist/move.d.ts +14 -11
  764. package/dist/{originProjection-DEklpDc_.d.ts → originProjection-PPT88jZv.d.ts} +1 -1
  765. package/dist/patterns-builtin.d.ts +1 -118
  766. package/dist/patterns-builtin.js +2 -3
  767. package/dist/{poseDescriptor-D-OH-tu5.d.ts → poseDescriptor-Bqk-11Rl.d.ts} +26 -36
  768. package/dist/renderer.d.ts +1 -91
  769. package/dist/renderer.js +2 -18
  770. package/dist/resize.d.ts +10 -22
  771. package/dist/resize.js +6 -6
  772. package/dist/style.css +1 -1
  773. package/dist/test-hook/install.js +12 -6
  774. package/dist/test-hook/install.js.map +1 -1
  775. package/dist/test-hook/useTestHook.js +22 -0
  776. package/dist/test-hook/useTestHook.js.map +1 -0
  777. package/dist/test-seams-D0pyV3pR.d.ts +149 -0
  778. package/dist/test-seams.d.ts +4 -4
  779. package/dist/test-seams.js +2 -2
  780. package/dist/tools/builtin/bone/boneActions.js +130 -0
  781. package/dist/tools/builtin/bone/boneActions.js.map +1 -0
  782. package/dist/tools/builtin/bone/boneOverlay.js +58 -0
  783. package/dist/tools/builtin/bone/boneOverlay.js.map +1 -0
  784. package/dist/tools/builtin/bone/placedRig.js +24 -0
  785. package/dist/tools/builtin/bone/placedRig.js.map +1 -0
  786. package/dist/tools/builtin/bone/rigEditState.js +21 -0
  787. package/dist/tools/builtin/bone/rigEditState.js.map +1 -0
  788. package/dist/tools/builtin/bone/useBoneTool.js +98 -0
  789. package/dist/tools/builtin/bone/useBoneTool.js.map +1 -0
  790. package/dist/tools/builtin/ellipse/useEllipseTool.js +1 -0
  791. package/dist/tools/builtin/ellipse/useEllipseTool.js.map +1 -1
  792. package/dist/tools/builtin/eyedropper/useEyedropperTool.js.map +1 -1
  793. package/dist/tools/builtin/hand/useHandTool.js +1 -0
  794. package/dist/tools/builtin/hand/useHandTool.js.map +1 -1
  795. package/dist/tools/builtin/image/useImageTool.js.map +1 -1
  796. package/dist/tools/builtin/lasso/useLassoTool.js +11 -11
  797. package/dist/tools/builtin/lasso/useLassoTool.js.map +1 -1
  798. package/dist/tools/builtin/line/useLineTool.js +1 -0
  799. package/dist/tools/builtin/line/useLineTool.js.map +1 -1
  800. package/dist/tools/builtin/pen/usePenTool.js +198 -150
  801. package/dist/tools/builtin/pen/usePenTool.js.map +1 -1
  802. package/dist/tools/builtin/pencil/usePencilTool.js +1 -0
  803. package/dist/tools/builtin/pencil/usePencilTool.js.map +1 -1
  804. package/dist/tools/builtin/pickTopMostHit.js.map +1 -1
  805. package/dist/tools/builtin/polygon/usePolygonTool.js +13 -8
  806. package/dist/tools/builtin/polygon/usePolygonTool.js.map +1 -1
  807. package/dist/tools/builtin/rect/useRectTool.js +1 -0
  808. package/dist/tools/builtin/rect/useRectTool.js.map +1 -1
  809. package/dist/tools/builtin/select/adapterPointQuery.js +36 -0
  810. package/dist/tools/builtin/select/adapterPointQuery.js.map +1 -0
  811. package/dist/tools/builtin/select/selectionContributions.js +25 -24
  812. package/dist/tools/builtin/select/selectionContributions.js.map +1 -1
  813. package/dist/tools/builtin/select/useSelectTool.js +42 -67
  814. package/dist/tools/builtin/select/useSelectTool.js.map +1 -1
  815. package/dist/tools/builtin/shared/pointerFollower.js +17 -0
  816. package/dist/tools/builtin/shared/pointerFollower.js.map +1 -0
  817. package/dist/tools/builtin/slice/useSliceTool.js +72 -82
  818. package/dist/tools/builtin/slice/useSliceTool.js.map +1 -1
  819. package/dist/tools/builtin/star/useStarTool.js +22 -16
  820. package/dist/tools/builtin/star/useStarTool.js.map +1 -1
  821. package/dist/tools/builtin/text/useTextTool.js +9 -0
  822. package/dist/tools/builtin/text/useTextTool.js.map +1 -1
  823. package/dist/tools/builtin/weight/useWeightTool.js +77 -0
  824. package/dist/tools/builtin/weight/useWeightTool.js.map +1 -0
  825. package/dist/tools/builtin/weight/weightActions.js +112 -0
  826. package/dist/tools/builtin/weight/weightActions.js.map +1 -0
  827. package/dist/tools/builtin/weight/weightOverlay.js +61 -0
  828. package/dist/tools/builtin/weight/weightOverlay.js.map +1 -0
  829. package/dist/tools/overlayBinding.js.map +1 -1
  830. package/dist/tools/useKeybindings.js +12 -22
  831. package/dist/tools/useKeybindings.js.map +1 -1
  832. package/dist/{types-A37hYkeR.d.ts → types-CIKDwlsP.d.ts} +113 -169
  833. package/dist/util/color.js +3 -3
  834. package/dist/util/color.js.map +1 -1
  835. package/dist/util/paint.js +1 -1
  836. package/dist/util/paint.js.map +1 -1
  837. package/dist/version.js +1 -1
  838. package/package.json +28 -21
  839. package/dist/animation/colorHelpers.js +0 -135
  840. package/dist/animation/colorHelpers.js.map +0 -1
  841. package/dist/animation/colorRegistry.js +0 -37
  842. package/dist/animation/colorRegistry.js.map +0 -1
  843. package/dist/animation/engine/axes.js +0 -36
  844. package/dist/animation/engine/axes.js.map +0 -1
  845. package/dist/animation/engine/codec.js +0 -170
  846. package/dist/animation/engine/codec.js.map +0 -1
  847. package/dist/animation/engine/integrator.js +0 -12
  848. package/dist/animation/engine/integrator.js.map +0 -1
  849. package/dist/animation/loop.js +0 -62
  850. package/dist/animation/loop.js.map +0 -1
  851. package/dist/animation/observe.js +0 -23
  852. package/dist/animation/observe.js.map +0 -1
  853. package/dist/animation/rig/blendPoses.js +0 -43
  854. package/dist/animation/rig/blendPoses.js.map +0 -1
  855. package/dist/animation/rig/mirrorPose.js +0 -19
  856. package/dist/animation/rig/mirrorPose.js.map +0 -1
  857. package/dist/animation/rig/resolveSkeleton.js +0 -33
  858. package/dist/animation/rig/resolveSkeleton.js.map +0 -1
  859. package/dist/animation/rig/solveIk.js +0 -103
  860. package/dist/animation/rig/solveIk.js.map +0 -1
  861. package/dist/animation/rig/types.js +0 -12
  862. package/dist/animation/rig/types.js.map +0 -1
  863. package/dist/animation/slew.js +0 -27
  864. package/dist/animation/slew.js.map +0 -1
  865. package/dist/animation/stagger.js +0 -138
  866. package/dist/animation/stagger.js.map +0 -1
  867. package/dist/animation/timeline/booking.js +0 -106
  868. package/dist/animation/timeline/booking.js.map +0 -1
  869. package/dist/animation/timeline/createTimeline.js +0 -116
  870. package/dist/animation/timeline/createTimeline.js.map +0 -1
  871. package/dist/animation/timeline/sampleTrack.js +0 -71
  872. package/dist/animation/timeline/sampleTrack.js.map +0 -1
  873. package/dist/animation/useAnimator.js +0 -378
  874. package/dist/animation/useAnimator.js.map +0 -1
  875. package/dist/builtins-C-VgUlWI.d.ts +0 -4514
  876. package/dist/canvas/MinimapCanvas.js +0 -139
  877. package/dist/canvas/MinimapCanvas.js.map +0 -1
  878. package/dist/canvas/deps/poseComposition.js +0 -11
  879. package/dist/canvas/deps/poseComposition.js.map +0 -1
  880. package/dist/canvas/minimapMath.js +0 -80
  881. package/dist/canvas/minimapMath.js.map +0 -1
  882. package/dist/canvas/toolPreview.js +0 -39
  883. package/dist/canvas/toolPreview.js.map +0 -1
  884. package/dist/core/adapters/arrayAdapter.js +0 -85
  885. package/dist/core/adapters/arrayAdapter.js.map +0 -1
  886. package/dist/core/adapters/useArrayAdapter.js +0 -13
  887. package/dist/core/adapters/useArrayAdapter.js.map +0 -1
  888. package/dist/core/fillInPoseFrame.js +0 -102
  889. package/dist/core/fillInPoseFrame.js.map +0 -1
  890. package/dist/core/geometry/poseRotation.js +0 -58
  891. package/dist/core/geometry/poseRotation.js.map +0 -1
  892. package/dist/core/gradient.js +0 -136
  893. package/dist/core/gradient.js.map +0 -1
  894. package/dist/core/isPlainObject.js.map +0 -1
  895. package/dist/core/markerInset.js +0 -24
  896. package/dist/core/markerInset.js.map +0 -1
  897. package/dist/core/mixed.js +0 -6
  898. package/dist/core/mixed.js.map +0 -1
  899. package/dist/core/paintKinds.js +0 -156
  900. package/dist/core/paintKinds.js.map +0 -1
  901. package/dist/core/strokeMarkerShapes.js +0 -139
  902. package/dist/core/strokeMarkerShapes.js.map +0 -1
  903. package/dist/core/strokeMarkers.js +0 -28
  904. package/dist/core/strokeMarkers.js.map +0 -1
  905. package/dist/core/viewport/meanScale.js +0 -8
  906. package/dist/core/viewport/meanScale.js.map +0 -1
  907. package/dist/core/viewport/pxExtent.js +0 -42
  908. package/dist/core/viewport/pxExtent.js.map +0 -1
  909. package/dist/debug/flag.js.map +0 -1
  910. package/dist/features/cursor/paintedCursorLayer.js.map +0 -1
  911. package/dist/features/focus/gateLayer.js +0 -14
  912. package/dist/features/focus/gateLayer.js.map +0 -1
  913. package/dist/features/focus/useCanvasFocus.js +0 -29
  914. package/dist/features/focus/useCanvasFocus.js.map +0 -1
  915. package/dist/features/groups/children.js.map +0 -1
  916. package/dist/features/groups/composePose.js.map +0 -1
  917. package/dist/features/groups/nestedHit.js.map +0 -1
  918. package/dist/features/groups/unionOfChildren.js.map +0 -1
  919. package/dist/features/images/imageCache.js +0 -94
  920. package/dist/features/images/imageCache.js.map +0 -1
  921. package/dist/features/ingestion/index.js +0 -8
  922. package/dist/features/meshPaint/bake.js +0 -79
  923. package/dist/features/meshPaint/bake.js.map +0 -1
  924. package/dist/features/meshPaint/bakeCache.js +0 -59
  925. package/dist/features/meshPaint/bakeCache.js.map +0 -1
  926. package/dist/features/meshPaint/handles.js +0 -86
  927. package/dist/features/meshPaint/handles.js.map +0 -1
  928. package/dist/features/meshPaint/lazyKind.js.map +0 -1
  929. package/dist/features/meshPaint/meshPaint.js +0 -236
  930. package/dist/features/meshPaint/meshPaint.js.map +0 -1
  931. package/dist/features/meshPaint/meshShader.js +0 -6
  932. package/dist/features/meshPaint/meshShader.js.map +0 -1
  933. package/dist/features/meshPaint/register.js +0 -7
  934. package/dist/features/meshPaint/register.js.map +0 -1
  935. package/dist/features/meshPaint/surface.js +0 -110
  936. package/dist/features/meshPaint/surface.js.map +0 -1
  937. package/dist/features/minimap/actions.js +0 -53
  938. package/dist/features/minimap/actions.js.map +0 -1
  939. package/dist/features/minimap/createMinimapContribution.js +0 -96
  940. package/dist/features/minimap/createMinimapContribution.js.map +0 -1
  941. package/dist/features/minimap/layers.js +0 -103
  942. package/dist/features/minimap/layers.js.map +0 -1
  943. package/dist/features/overlays/useNodeOverlayFrame.js +0 -103
  944. package/dist/features/overlays/useNodeOverlayFrame.js.map +0 -1
  945. package/dist/features/parallax/createParallaxLayer.js +0 -26
  946. package/dist/features/parallax/createParallaxLayer.js.map +0 -1
  947. package/dist/features/parallax/createParallaxPlane.js +0 -26
  948. package/dist/features/parallax/createParallaxPlane.js.map +0 -1
  949. package/dist/features/paths/anchorEdits.js +0 -156
  950. package/dist/features/paths/anchorEdits.js.map +0 -1
  951. package/dist/features/paths/anchors.js +0 -154
  952. package/dist/features/paths/anchors.js.map +0 -1
  953. package/dist/features/paths/booleans.js +0 -2
  954. package/dist/features/paths/markerCommands.js +0 -148
  955. package/dist/features/paths/markerCommands.js.map +0 -1
  956. package/dist/features/paths/markerSites.js +0 -59
  957. package/dist/features/paths/markerSites.js.map +0 -1
  958. package/dist/features/paths/markers.js +0 -95
  959. package/dist/features/paths/markers.js.map +0 -1
  960. package/dist/features/paths/nearestAnchor.js +0 -36
  961. package/dist/features/paths/nearestAnchor.js.map +0 -1
  962. package/dist/features/paths/pathInWorld.js +0 -41
  963. package/dist/features/paths/pathInWorld.js.map +0 -1
  964. package/dist/features/paths/poseDescriptor.js +0 -39
  965. package/dist/features/paths/poseDescriptor.js.map +0 -1
  966. package/dist/features/paths/tessellate/dash.js +0 -52
  967. package/dist/features/paths/tessellate/dash.js.map +0 -1
  968. package/dist/features/paths/tessellate/insets.js +0 -32
  969. package/dist/features/paths/tessellate/insets.js.map +0 -1
  970. package/dist/features/paths/tessellate/metric.js +0 -72
  971. package/dist/features/paths/tessellate/metric.js.map +0 -1
  972. package/dist/features/paths/tessellate/stroke.js +0 -170
  973. package/dist/features/paths/tessellate/stroke.js.map +0 -1
  974. package/dist/features/paths/tessellate/vertexWidths.js +0 -32
  975. package/dist/features/paths/tessellate/vertexWidths.js.map +0 -1
  976. package/dist/features/patterns/index.js +0 -23
  977. package/dist/features/patterns/index.js.map +0 -1
  978. package/dist/features/patterns/patterns-builtin.js +0 -38
  979. package/dist/features/patterns/patterns-builtin.js.map +0 -1
  980. package/dist/features/patterns/resolveSpec.js +0 -57
  981. package/dist/features/patterns/resolveSpec.js.map +0 -1
  982. package/dist/features/patterns/tileGeometry.js +0 -158
  983. package/dist/features/patterns/tileGeometry.js.map +0 -1
  984. package/dist/features/pointer/PointerContext.js +0 -45
  985. package/dist/features/pointer/PointerContext.js.map +0 -1
  986. package/dist/features/selection/SelectionContext.js +0 -46
  987. package/dist/features/selection/SelectionContext.js.map +0 -1
  988. package/dist/features/simulation/createSimulation.js +0 -61
  989. package/dist/features/simulation/createSimulation.js.map +0 -1
  990. package/dist/features/simulation/types.js +0 -6
  991. package/dist/features/simulation/types.js.map +0 -1
  992. package/dist/features/simulation/useSimulation.js +0 -74
  993. package/dist/features/simulation/useSimulation.js.map +0 -1
  994. package/dist/features/text/domRuns.js +0 -258
  995. package/dist/features/text/domRuns.js.map +0 -1
  996. package/dist/features/text/fitTextPose.js +0 -38
  997. package/dist/features/text/fitTextPose.js.map +0 -1
  998. package/dist/features/text/hitTest.js +0 -45
  999. package/dist/features/text/hitTest.js.map +0 -1
  1000. package/dist/features/text/renderLabel.js +0 -14
  1001. package/dist/features/text/renderLabel.js.map +0 -1
  1002. package/dist/features/text/runs/effectiveRangeStyle.js +0 -66
  1003. package/dist/features/text/runs/effectiveRangeStyle.js.map +0 -1
  1004. package/dist/features/text/runs/flagRange.js +0 -53
  1005. package/dist/features/text/runs/flagRange.js.map +0 -1
  1006. package/dist/features/text/runs/rangeStyle.js +0 -135
  1007. package/dist/features/text/runs/rangeStyle.js.map +0 -1
  1008. package/dist/features/text/textCommand.js +0 -59
  1009. package/dist/features/text/textCommand.js.map +0 -1
  1010. package/dist/features/text/textToPath.js +0 -181
  1011. package/dist/features/text/textToPath.js.map +0 -1
  1012. package/dist/features/text/useTextEdit.js +0 -467
  1013. package/dist/features/text/useTextEdit.js.map +0 -1
  1014. package/dist/features/tiling/createTiledLayer.js +0 -63
  1015. package/dist/features/tiling/createTiledLayer.js.map +0 -1
  1016. package/dist/features/tiling/tiledProject.js +0 -14
  1017. package/dist/features/tiling/tiledProject.js.map +0 -1
  1018. package/dist/interactions/actions/clone/behaviors/cloneByAltDrag.js +0 -26
  1019. package/dist/interactions/actions/clone/behaviors/cloneByAltDrag.js.map +0 -1
  1020. package/dist/interactions/actions/defaults/align.js.map +0 -1
  1021. package/dist/interactions/actions/defaults/booleans.js +0 -52
  1022. package/dist/interactions/actions/defaults/booleans.js.map +0 -1
  1023. package/dist/interactions/actions/defaults/clipboard.js.map +0 -1
  1024. package/dist/interactions/actions/defaults/clone.js +0 -107
  1025. package/dist/interactions/actions/defaults/clone.js.map +0 -1
  1026. package/dist/interactions/actions/defaults/createOutlines.js +0 -47
  1027. package/dist/interactions/actions/defaults/createOutlines.js.map +0 -1
  1028. package/dist/interactions/actions/defaults/distribute.js +0 -66
  1029. package/dist/interactions/actions/defaults/distribute.js.map +0 -1
  1030. package/dist/interactions/actions/defaults/editAnchors.js.map +0 -1
  1031. package/dist/interactions/actions/defaults/flip.js +0 -119
  1032. package/dist/interactions/actions/defaults/flip.js.map +0 -1
  1033. package/dist/interactions/actions/defaults/freshNodeId.js +0 -10
  1034. package/dist/interactions/actions/defaults/freshNodeId.js.map +0 -1
  1035. package/dist/interactions/actions/defaults/insert.js +0 -288
  1036. package/dist/interactions/actions/defaults/insert.js.map +0 -1
  1037. package/dist/interactions/actions/defaults/lassoSelect.js +0 -156
  1038. package/dist/interactions/actions/defaults/lassoSelect.js.map +0 -1
  1039. package/dist/interactions/actions/defaults/move.js +0 -760
  1040. package/dist/interactions/actions/defaults/move.js.map +0 -1
  1041. package/dist/interactions/actions/defaults/resize.js +0 -335
  1042. package/dist/interactions/actions/defaults/resize.js.map +0 -1
  1043. package/dist/interactions/actions/defaults/rotate.js +0 -184
  1044. package/dist/interactions/actions/defaults/rotate.js.map +0 -1
  1045. package/dist/interactions/actions/previewOverrides.js +0 -25
  1046. package/dist/interactions/actions/previewOverrides.js.map +0 -1
  1047. package/dist/interactions/actions/resize/autoPoseDescriptor.js.map +0 -1
  1048. package/dist/math-Drrw4ewZ.d.ts +0 -160
  1049. package/dist/registerProgram-BMZRDgrh.d.ts +0 -197
  1050. package/dist/renderer/DrawCommand.js +0 -6
  1051. package/dist/renderer/DrawCommand.js.map +0 -1
  1052. package/dist/renderer/WeaselRenderer.js +0 -331
  1053. package/dist/renderer/WeaselRenderer.js.map +0 -1
  1054. package/dist/renderer/batchClip.js +0 -46
  1055. package/dist/renderer/batchClip.js.map +0 -1
  1056. package/dist/renderer/cache/GLImageCache.js +0 -64
  1057. package/dist/renderer/cache/GLImageCache.js.map +0 -1
  1058. package/dist/renderer/cache/GLMeshCache.js +0 -102
  1059. package/dist/renderer/cache/GLMeshCache.js.map +0 -1
  1060. package/dist/renderer/cache/GLTextureCache.js +0 -51
  1061. package/dist/renderer/cache/GLTextureCache.js.map +0 -1
  1062. package/dist/renderer/cache/GradientRampAtlas.js +0 -82
  1063. package/dist/renderer/cache/GradientRampAtlas.js.map +0 -1
  1064. package/dist/renderer/cache/cache.js +0 -13
  1065. package/dist/renderer/cache/cache.js.map +0 -1
  1066. package/dist/renderer/cache/markerCommandCache.js +0 -63
  1067. package/dist/renderer/cache/markerCommandCache.js.map +0 -1
  1068. package/dist/renderer/cache/outlineMeshCache.js +0 -15
  1069. package/dist/renderer/cache/outlineMeshCache.js.map +0 -1
  1070. package/dist/renderer/cache/outlineStrokeMeshCache.js +0 -36
  1071. package/dist/renderer/cache/outlineStrokeMeshCache.js.map +0 -1
  1072. package/dist/renderer/cache/strokeMeshCache.js +0 -55
  1073. package/dist/renderer/cache/strokeMeshCache.js.map +0 -1
  1074. package/dist/renderer/cullDrawCommands.js +0 -90
  1075. package/dist/renderer/cullDrawCommands.js.map +0 -1
  1076. package/dist/renderer/draw.js +0 -1135
  1077. package/dist/renderer/draw.js.map +0 -1
  1078. package/dist/renderer/drawBatch.js +0 -198
  1079. package/dist/renderer/drawBatch.js.map +0 -1
  1080. package/dist/renderer/effects/EffectTargets.js +0 -45
  1081. package/dist/renderer/effects/EffectTargets.js.map +0 -1
  1082. package/dist/renderer/effects/builtins.js +0 -31
  1083. package/dist/renderer/effects/builtins.js.map +0 -1
  1084. package/dist/renderer/effects/composite.js +0 -9
  1085. package/dist/renderer/effects/composite.js.map +0 -1
  1086. package/dist/renderer/effects/effectPrelude.js +0 -10
  1087. package/dist/renderer/effects/effectPrelude.js.map +0 -1
  1088. package/dist/renderer/effects/types.js +0 -10
  1089. package/dist/renderer/effects/types.js.map +0 -1
  1090. package/dist/renderer/glyphOutlineMesh.js +0 -67
  1091. package/dist/renderer/glyphOutlineMesh.js.map +0 -1
  1092. package/dist/renderer/index.js +0 -19
  1093. package/dist/renderer/math/color.js +0 -341
  1094. package/dist/renderer/math/color.js.map +0 -1
  1095. package/dist/renderer/math/mat3.js +0 -76
  1096. package/dist/renderer/math/mat3.js.map +0 -1
  1097. package/dist/renderer/math/patternSpace.js +0 -22
  1098. package/dist/renderer/math/patternSpace.js.map +0 -1
  1099. package/dist/renderer/math/viewToMat3.js +0 -19
  1100. package/dist/renderer/math/viewToMat3.js.map +0 -1
  1101. package/dist/renderer/paintResources.js +0 -18
  1102. package/dist/renderer/paintResources.js.map +0 -1
  1103. package/dist/renderer/paintScratch.js +0 -37
  1104. package/dist/renderer/paintScratch.js.map +0 -1
  1105. package/dist/renderer/shaders/ShaderProgram.js +0 -74
  1106. package/dist/renderer/shaders/ShaderProgram.js.map +0 -1
  1107. package/dist/renderer/shaders/batchFill.js +0 -119
  1108. package/dist/renderer/shaders/batchFill.js.map +0 -1
  1109. package/dist/renderer/shaders/customPrelude.js +0 -34
  1110. package/dist/renderer/shaders/customPrelude.js.map +0 -1
  1111. package/dist/renderer/shaders/extractUniformNames.js +0 -184
  1112. package/dist/renderer/shaders/extractUniformNames.js.map +0 -1
  1113. package/dist/renderer/shaders/glyphPaint.js +0 -61
  1114. package/dist/renderer/shaders/glyphPaint.js.map +0 -1
  1115. package/dist/renderer/shaders/gradFill.js +0 -30
  1116. package/dist/renderer/shaders/gradFill.js.map +0 -1
  1117. package/dist/renderer/shaders/imageFill.js +0 -14
  1118. package/dist/renderer/shaders/imageFill.js.map +0 -1
  1119. package/dist/renderer/shaders/pathFill.js +0 -13
  1120. package/dist/renderer/shaders/pathFill.js.map +0 -1
  1121. package/dist/renderer/shaders/patternFill.js +0 -24
  1122. package/dist/renderer/shaders/patternFill.js.map +0 -1
  1123. package/dist/renderer/shaders/registerProgram.js +0 -18
  1124. package/dist/renderer/shaders/registerProgram.js.map +0 -1
  1125. package/dist/renderer/spriteSheet.js +0 -14
  1126. package/dist/renderer/spriteSheet.js.map +0 -1
  1127. package/dist/renderer/state/GroupState.js +0 -77
  1128. package/dist/renderer/state/GroupState.js.map +0 -1
  1129. package/dist/renderer/strokeLengths.js +0 -50
  1130. package/dist/renderer/strokeLengths.js.map +0 -1
  1131. package/dist/renderer/syntheticItalic.js +0 -6
  1132. package/dist/renderer/syntheticItalic.js.map +0 -1
  1133. package/dist/renderer/textures/registerTexture.js +0 -14
  1134. package/dist/renderer/textures/registerTexture.js.map +0 -1
  1135. package/dist/scheduling/useVisibleRaf.js +0 -69
  1136. package/dist/scheduling/useVisibleRaf.js.map +0 -1
  1137. package/dist/test-seams-CuIxe0xY.d.ts +0 -356
  1138. package/dist/tools/prefs.js +0 -62
  1139. package/dist/tools/prefs.js.map +0 -1
@@ -0,0 +1,74 @@
1
+ import { remapRotatedLeaf as e, translatePoseViaDescriptor as t } from "../../../core/geometry/poseDescriptor.js";
2
+ import { localToWorld as n, worldDeltaToLocal as r } from "../../../core/geometry/targetFrame.js";
3
+ import { fixedCornerOf as i } from "./cornerHandles.js";
4
+ import { carryPose as a, planeOf as o } from "../planeInput.js";
5
+ import { pointerStateOf as s } from "../pointerState.js";
6
+ import { boxFrame as c } from "./boxFrame.js";
7
+ import { boundsForRules as l } from "./ruleBounds.js";
8
+ import { snapPose as u } from "./pointSnap.js";
9
+ import { poseRotationOf as d } from "@weasel-js/geom";
10
+ //#region src/interactions/actions/resize/frame.ts
11
+ function f(e, t, n, i, a) {
12
+ let { x: o, y: s } = r(a, n, i) ?? {
13
+ x: 0,
14
+ y: 0
15
+ }, c = e.x, l = e.y, u = e.width, d = e.height;
16
+ return t.x === "min" ? u = e.width + o : t.x === "max" && (c = e.x + o, u = e.width - o), t.y === "min" ? d = e.height + s : t.y === "max" && (l = e.y + s, d = e.height - s), {
17
+ x: c,
18
+ y: l,
19
+ width: u,
20
+ height: d
21
+ };
22
+ }
23
+ function p(e, t, n, r) {
24
+ let i = r;
25
+ for (let r of e) {
26
+ let e = r.onMove?.(t, {
27
+ pose: i,
28
+ anchor: n
29
+ });
30
+ e && e.pose !== void 0 && (i = {
31
+ x: e.pose.x,
32
+ y: e.pose.y,
33
+ width: e.pose.width,
34
+ height: e.pose.height
35
+ });
36
+ }
37
+ return i;
38
+ }
39
+ function m(t, n, r, i, a) {
40
+ return a && d(n) !== null ? e(n, r, i) : t.remapBounds(n, r, i);
41
+ }
42
+ function h(e, r, a, o) {
43
+ let s = c(a, o);
44
+ if (s.identity) return r;
45
+ let l = i(o, a.anchor), u = n(s, l.x, l.y);
46
+ return t(r, a.fixedWorld.x - u.x, a.fixedWorld.y - u.y, e);
47
+ }
48
+ function g(e, t, n) {
49
+ let r = e.scene.get(t)?.layer;
50
+ return e.poseFrame.local(t, a(e.geometryOf(t), n, r === void 0 ? null : o(e.view, r)));
51
+ }
52
+ function _(e, t, n) {
53
+ let r = n.drag.current, { box: i, gestureCtx: a } = e;
54
+ a.modifiers = { ...n.modifiers }, a.pointer = s(r, n), a.view = t.view(), a.plane = t.plane();
55
+ let o = p(e.constraints, a, i.anchor, f(i.bounds, i.anchor, r.x - e.startWorld.x, r.y - e.startWorld.y, c(i, i.bounds))), d = /* @__PURE__ */ new Map(), _ = (t) => {
56
+ let n = e.startWorlds.get(t);
57
+ if (n !== void 0) return m(e.geometryOf(t), n, i.bounds, o, e.sharedBox);
58
+ };
59
+ if (e.sharedBox) {
60
+ for (let t of e.writeIds) {
61
+ let n = _(t);
62
+ n !== void 0 && d.set(t, g(e, t, n));
63
+ }
64
+ return { previews: d };
65
+ }
66
+ let v = e.writeIds[0], y = e.geometryOf(v), b = _(v);
67
+ if (b === void 0) return { previews: d };
68
+ let x = u(e.pointSnap, y, h(y, b, i, o), i, i.anchor, a.modifiers, a.plane ?? null);
69
+ return d.set(v, g(e, v, x)), a.current = /* @__PURE__ */ new Map([[v, l(y, x)]]), { previews: d };
70
+ }
71
+ //#endregion
72
+ export { _ as nextFrame };
73
+
74
+ //# sourceMappingURL=frame.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"frame.js","names":["computeProposedBounds","dx","dy","worldDeltaToLocal","frame","worldDx","worldDy","nx","ob","ny","nw","nh","anchor","constrain","bounds","proposed","b","constraints","r","gctx","leafPose","sharedBox","poseRotationOf","start","remapRotatedLeaf","src","dst","g","pinFixedCorner","boxFrame","box","pose","newFixedLocal","fixedCornerOf","newFixedWorld","localToWorld","translatePoseViaDescriptor","storedPose","layer","place","id","carryPose","world","planeOf","nextFrame","at","moveCtx","session","pointerStateOf","readers","previews","worldOf","next","remapped","snapPose","boundsForRules"],"sources":["../../../../src/interactions/actions/resize/frame.ts"],"sourcesContent":["import { poseRotationOf } from '@weasel-js/geom';\nimport type { InvocationCtx } from '@weasel-js/routing';\nimport { pointerStateOf } from '../pointerState';\nimport { localToWorld, worldDeltaToLocal, type TargetTransform } from 'core/geometry/targetFrame';\nimport type { NodeId } from 'core/scene/types';\nimport type { Bounds } from 'core/viewport/fitViewToBounds';\nimport type { GestureReaders } from '../../gestures/shared/screenTolerance';\nimport type { BoundsConstraint, GestureContext, ResizeAnchor, RotatedPose } from '../../gestures/types';\nimport { carryPose, planeOf } from '../planeInput';\nimport { fixedCornerOf } from './cornerHandles';\nimport { remapRotatedLeaf, translatePoseViaDescriptor, type PoseDescriptor } from './geometry';\nimport { snapPose } from './pointSnap';\nimport { boundsForRules } from './ruleBounds';\nimport { boxFrame } from './boxFrame';\nimport type { ResizeBox, ResizeFrame, ResizeSession } from './session';\n\n/** `ob` with the edges `anchor` leaves free moved by the drag delta, which is\n * taken into the axes of the frame the box is drawn in first. A frame nothing\n * maps back through moves no edge. */\nfunction computeProposedBounds(\n ob: Bounds,\n anchor: ResizeAnchor,\n worldDx: number,\n worldDy: number,\n frame: TargetTransform,\n): Bounds {\n const { x: dx, y: dy } = worldDeltaToLocal(frame, worldDx, worldDy) ?? { x: 0, y: 0 };\n let nx = ob.x;\n let ny = ob.y;\n let nw = ob.width;\n let nh = ob.height;\n if (anchor.x === 'min') {\n nw = ob.width + dx;\n } else if (anchor.x === 'max') {\n nx = ob.x + dx;\n nw = ob.width - dx;\n }\n if (anchor.y === 'min') {\n nh = ob.height + dy;\n } else if (anchor.y === 'max') {\n ny = ob.y + dy;\n nh = ob.height - dy;\n }\n return { x: nx, y: ny, width: nw, height: nh };\n}\n\n/** `proposed` as the constraints rewrite it, each seeing the one before's. */\nfunction constrain(\n constraints: readonly BoundsConstraint<Bounds>[],\n gctx: GestureContext<Bounds>,\n anchor: ResizeAnchor,\n proposed: Bounds,\n): Bounds {\n let bounds = proposed;\n for (const b of constraints) {\n const r = b.onMove?.(gctx, { pose: bounds, anchor });\n if (!r) continue;\n if (r.pose !== undefined) {\n bounds = { x: r.pose.x, y: r.pose.y, width: r.pose.width, height: r.pose.height };\n }\n }\n return bounds;\n}\n\n/** One write id's world pose with the box taken from `src` to `dst`.\n *\n * A rotated leaf resized with others needs its own frame: `src`/`dst`\n * are world-frame there, unlike the lone path where the drag delta\n * was already projected into the leaf's frame, so the naive affine\n * scales the wrong pair of extents. See `remapRotatedLeaf`. */\nfunction leafPose(\n g: PoseDescriptor<unknown>,\n start: unknown,\n src: Bounds,\n dst: Bounds,\n sharedBox: boolean,\n): unknown {\n if (sharedBox && poseRotationOf(start) !== null) {\n return remapRotatedLeaf(start as RotatedPose, src, dst);\n }\n return g.remapBounds(start, src, dst);\n}\n\n/** `pose` shifted so the corner opposite the dragged one stays where the\n * press found it, which resizing a box whose frame is about its center moves. */\nfunction pinFixedCorner(\n g: PoseDescriptor<unknown>,\n pose: unknown,\n box: Pick<ResizeBox, 'anchor' | 'rotation' | 'transform' | 'fixedWorld'>,\n proposed: Bounds,\n): unknown {\n const frame = boxFrame(box, proposed);\n if (frame.identity) return pose;\n const newFixedLocal = fixedCornerOf(proposed, box.anchor);\n const newFixedWorld = localToWorld(frame, newFixedLocal.x, newFixedLocal.y);\n return translatePoseViaDescriptor(\n pose,\n box.fixedWorld.x - newFixedWorld.x,\n box.fixedWorld.y - newFixedWorld.y,\n g,\n );\n}\n\n/** A world result for `id`, as stored. */\nfunction storedPose(\n place: Pick<ResizeSession, 'scene' | 'poseFrame' | 'view' | 'geometryOf'>,\n id: NodeId,\n world: unknown,\n): unknown {\n const layer = place.scene.get(id)?.layer;\n return place.poseFrame.local(\n id,\n carryPose(place.geometryOf(id), world, layer === undefined ? null : planeOf(place.view, layer)),\n );\n}\n\n/** One move's previews: the box as the drag and the constraints leave it,\n * and every write id's stored pose inside it. A lone target also gets the\n * rotated-resize pin and the point snaps, which a shared box, resized in the\n * AABB frame, does not. `moveCtx` must carry a drag. */\nexport function nextFrame(session: ResizeSession, readers: GestureReaders, moveCtx: InvocationCtx): ResizeFrame {\n const at = moveCtx.drag!.current;\n const { box, gestureCtx: gctx } = session;\n gctx.modifiers = { ...moveCtx.modifiers };\n gctx.pointer = pointerStateOf(at, moveCtx);\n gctx.view = readers.view();\n gctx.plane = readers.plane();\n\n const proposed = constrain(\n session.constraints,\n gctx,\n box.anchor,\n computeProposedBounds(box.bounds, box.anchor, at.x - session.startWorld.x, at.y - session.startWorld.y, boxFrame(box, box.bounds)),\n );\n\n const previews = new Map<NodeId, unknown>();\n const worldOf = (id: NodeId): unknown => {\n const start = session.startWorlds.get(id);\n if (start === undefined) return undefined;\n return leafPose(session.geometryOf(id), start, box.bounds, proposed, session.sharedBox);\n };\n\n if (session.sharedBox) {\n for (const id of session.writeIds) {\n const next = worldOf(id);\n if (next === undefined) continue;\n previews.set(id, storedPose(session, id, next));\n }\n return { previews };\n }\n\n const id = session.writeIds[0];\n const g = session.geometryOf(id);\n const remapped = worldOf(id);\n if (remapped === undefined) return { previews };\n const world = snapPose(\n session.pointSnap,\n g,\n pinFixedCorner(g, remapped, box, proposed),\n box,\n box.anchor,\n gctx.modifiers,\n gctx.plane ?? null,\n );\n previews.set(id, storedPose(session, id, world));\n gctx.current = new Map<string, Bounds>([[id as string, boundsForRules(g, world)]]);\n return { previews };\n}\n"],"mappings":"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"}
@@ -0,0 +1,111 @@
1
+ import { fromPlane as e, toPlane as t } from "../../../core/viewport/parallax.js";
2
+ import { isRectPose as n } from "../../../core/geometry/autoPoseDescriptor.js";
3
+ import { targetCorners as r, worldDeltaToLocal as i } from "../../../core/geometry/targetFrame.js";
4
+ import { boxFrame as a } from "./boxFrame.js";
5
+ import { boundsForRules as o } from "./ruleBounds.js";
6
+ //#region src/interactions/actions/resize/pointSnap.ts
7
+ function s(e, t, n, i, a) {
8
+ let o = e.x + e.width / 2, s = e.y + e.height / 2, [c, l, u, d] = r(e, t), f = null, p = null;
9
+ if (i.x !== "free" && i.y !== "free") {
10
+ let e = i.x === "min" && i.y === "min" ? c : i.x === "max" && i.y === "min" ? l : i.x === "max" && i.y === "max" ? u : d, t = i.x === "min" && i.y === "min" ? u : i.x === "max" && i.y === "min" ? d : i.x === "max" && i.y === "max" ? c : l;
11
+ p = {
12
+ worldX: e.x,
13
+ worldY: e.y
14
+ }, f = {
15
+ worldX: t.x,
16
+ worldY: t.y
17
+ };
18
+ }
19
+ return {
20
+ draggedCorner: f,
21
+ fixedCorner: p,
22
+ center: {
23
+ worldX: o,
24
+ worldY: s
25
+ },
26
+ origin: {
27
+ worldX: c.x,
28
+ worldY: c.y
29
+ },
30
+ rotation: n,
31
+ anchor: i,
32
+ proposed: e,
33
+ modifiers: a
34
+ };
35
+ }
36
+ function c(e, t, n, r) {
37
+ if (n.frame === "center") {
38
+ let t = n.worldX - r.center.worldX, i = n.worldY - r.center.worldY;
39
+ return {
40
+ ...e,
41
+ x: e.x + t,
42
+ y: e.y + i
43
+ };
44
+ }
45
+ if (n.frame === "origin") {
46
+ let t = n.worldX - r.origin.worldX, i = n.worldY - r.origin.worldY;
47
+ return {
48
+ ...e,
49
+ x: e.x + t,
50
+ y: e.y + i
51
+ };
52
+ }
53
+ let a = n.frame === "dragged-corner" ? r.fixedCorner : r.draggedCorner;
54
+ if (!a) return e;
55
+ let o = i(t, n.worldX - a.worldX, n.worldY - a.worldY);
56
+ if (!o) return e;
57
+ let s = Math.abs(o.x), c = Math.abs(o.y), l = (a.worldX + n.worldX) / 2, u = (a.worldY + n.worldY) / 2;
58
+ return {
59
+ ...e,
60
+ x: l - s / 2,
61
+ y: u - c / 2,
62
+ width: s,
63
+ height: c
64
+ };
65
+ }
66
+ function l(t, n) {
67
+ let r = (t) => {
68
+ let r = e(n, {
69
+ x: t.worldX,
70
+ y: t.worldY
71
+ });
72
+ return {
73
+ worldX: r.x,
74
+ worldY: r.y
75
+ };
76
+ };
77
+ return {
78
+ ...t,
79
+ draggedCorner: t.draggedCorner && r(t.draggedCorner),
80
+ fixedCorner: t.fixedCorner && r(t.fixedCorner),
81
+ center: r(t.center),
82
+ origin: r(t.origin)
83
+ };
84
+ }
85
+ function u(e, n) {
86
+ if (!e) return e;
87
+ let r = t(n, {
88
+ x: e.worldX,
89
+ y: e.worldY
90
+ });
91
+ return {
92
+ ...e,
93
+ worldX: r.x,
94
+ worldY: r.y
95
+ };
96
+ }
97
+ function d(e, t, r, i, d, f, p) {
98
+ if (e.length === 0) return r;
99
+ let m = o(t, r), h = a(i, m), g = s(m, h, i.rotation, d, f);
100
+ for (let i of e) {
101
+ let e = p ? u(i.onMove(l(g, p)), p) : i.onMove(g);
102
+ if (!e) continue;
103
+ let a = c(m, h, e, g);
104
+ return n(r) ? a : t.remapBounds(r, m, a);
105
+ }
106
+ return r;
107
+ }
108
+ //#endregion
109
+ export { d as snapPose };
110
+
111
+ //# sourceMappingURL=pointSnap.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pointSnap.js","names":["buildPointSnapContext","cx","pose","cy","tl","tr","br","bl","targetCorners","frame","draggedCorner","fixedCorner","anchor","fixedPt","draggedPt","applyPointSnap","result","dx","ctx","dy","pin","diagonal","worldDeltaToLocal","newWidth","newHeight","newCx","newCy","pointSnapToCamera","cam","w","fromPlane","m","p","pointSnapFromPlane","r","toPlane","snapPose","rules","poseAsRect","boundsForRules","g","boxFrame","box","psCtx","modifiers","rule","plane","snapped","isRectPose"],"sources":["../../../../src/interactions/actions/resize/pointSnap.ts"],"sourcesContent":["import { isRectPose } from 'core/geometry/autoPoseDescriptor';\nimport type { Bounds } from 'core/viewport/fitViewToBounds';\nimport { fromPlane, toPlane, type PlaneMap } from 'core/viewport/parallax';\nimport type {\n ModifierState,\n PointSnapBehavior,\n PointSnapContext,\n PointSnapResult,\n ResizeAnchor,\n} from '../../gestures/types';\nimport { targetCorners, worldDeltaToLocal, type TargetTransform } from 'core/geometry/targetFrame';\nimport { boxFrame } from './boxFrame';\nimport type { ResizeBox } from './session';\nimport type { PoseDescriptor } from './geometry';\nimport { boundsForRules } from './ruleBounds';\n\nfunction buildPointSnapContext<TPose extends Bounds>(\n pose: TPose,\n frame: TargetTransform,\n rotation: number,\n anchor: ResizeAnchor,\n modifiers: ModifierState,\n): PointSnapContext<TPose> {\n const cx = pose.x + pose.width / 2;\n const cy = pose.y + pose.height / 2;\n const [tl, tr, br, bl] = targetCorners(pose, frame);\n\n let draggedCorner: { worldX: number; worldY: number } | null = null;\n let fixedCorner: { worldX: number; worldY: number } | null = null;\n\n if (anchor.x !== 'free' && anchor.y !== 'free') {\n const fixedPt =\n anchor.x === 'min' && anchor.y === 'min' ? tl :\n anchor.x === 'max' && anchor.y === 'min' ? tr :\n anchor.x === 'max' && anchor.y === 'max' ? br : bl;\n const draggedPt =\n anchor.x === 'min' && anchor.y === 'min' ? br :\n anchor.x === 'max' && anchor.y === 'min' ? bl :\n anchor.x === 'max' && anchor.y === 'max' ? tl : tr;\n fixedCorner = { worldX: fixedPt.x, worldY: fixedPt.y };\n draggedCorner = { worldX: draggedPt.x, worldY: draggedPt.y };\n }\n\n return {\n draggedCorner,\n fixedCorner,\n center: { worldX: cx, worldY: cy },\n origin: { worldX: tl.x, worldY: tl.y },\n rotation,\n anchor,\n proposed: pose,\n modifiers,\n };\n}\n\nfunction applyPointSnap<TPose extends Bounds>(\n pose: TPose,\n frame: TargetTransform,\n result: PointSnapResult,\n ctx: PointSnapContext<TPose>,\n): TPose {\n if (result.frame === 'center') {\n const dx = result.worldX - ctx.center.worldX;\n const dy = result.worldY - ctx.center.worldY;\n return { ...pose, x: pose.x + dx, y: pose.y + dy };\n }\n if (result.frame === 'origin') {\n const dx = result.worldX - ctx.origin.worldX;\n const dy = result.worldY - ctx.origin.worldY;\n return { ...pose, x: pose.x + dx, y: pose.y + dy };\n }\n const pin = result.frame === 'dragged-corner' ? ctx.fixedCorner : ctx.draggedCorner;\n if (!pin) return pose;\n // The diagonal from the pinned corner, in the box's own axes.\n const diagonal = worldDeltaToLocal(frame, result.worldX - pin.worldX, result.worldY - pin.worldY);\n if (!diagonal) return pose;\n const newWidth = Math.abs(diagonal.x);\n const newHeight = Math.abs(diagonal.y);\n const newCx = (pin.worldX + result.worldX) / 2;\n const newCy = (pin.worldY + result.worldY) / 2;\n return { ...pose, x: newCx - newWidth / 2, y: newCy - newHeight / 2, width: newWidth, height: newHeight };\n}\n\n/** `ctx`'s points in the camera's world, for a snap rule written against it. */\nfunction pointSnapToCamera<TPose extends Bounds>(\n ctx: PointSnapContext<TPose>,\n m: PlaneMap,\n): PointSnapContext<TPose> {\n const cam = (p: { worldX: number; worldY: number }) => {\n const w = fromPlane(m, { x: p.worldX, y: p.worldY });\n return { worldX: w.x, worldY: w.y };\n };\n return {\n ...ctx,\n draggedCorner: ctx.draggedCorner && cam(ctx.draggedCorner),\n fixedCorner: ctx.fixedCorner && cam(ctx.fixedCorner),\n center: cam(ctx.center),\n origin: cam(ctx.origin),\n };\n}\n\n/** A snap rule's answer, back in the plane the resize works in. */\nfunction pointSnapFromPlane(\n r: PointSnapResult | null | undefined,\n m: PlaneMap,\n): PointSnapResult | null | undefined {\n if (!r) return r;\n const p = toPlane(m, { x: r.worldX, y: r.worldY });\n return { ...r, worldX: p.x, worldY: p.y };\n}\n\n/** `pose` moved so the frame the first answering rule chose lands on its\n * target; `pose` itself when no rule answers. `plane` is the plane the\n * resize works in, null in the camera's own world. */\nexport function snapPose(\n rules: readonly PointSnapBehavior<Bounds>[],\n g: PoseDescriptor<unknown>,\n pose: unknown,\n box: Pick<ResizeBox, 'rotation' | 'transform'>,\n anchor: ResizeAnchor,\n modifiers: ModifierState,\n plane: PlaneMap | null,\n): unknown {\n if (rules.length === 0) return pose;\n const poseAsRect = boundsForRules(g, pose);\n const frame = boxFrame(box, poseAsRect);\n const psCtx = buildPointSnapContext(poseAsRect, frame, box.rotation, anchor, modifiers);\n // Point snaps are the surface's rules over the camera's world, so\n // on a plane their points cross at this boundary.\n for (const rule of rules) {\n const result = plane\n ? pointSnapFromPlane(rule.onMove(pointSnapToCamera(psCtx, plane)), plane)\n : rule.onMove(psCtx);\n if (!result) continue;\n const snapped = applyPointSnap(poseAsRect, frame, result, psCtx);\n return isRectPose(pose) ? snapped : g.remapBounds(pose, poseAsRect, snapped);\n }\n return pose;\n}\n"],"mappings":"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"}
@@ -0,0 +1,9 @@
1
+ import { isRectPose as e } from "../../../core/geometry/autoPoseDescriptor.js";
2
+ //#region src/interactions/actions/resize/ruleBounds.ts
3
+ function t(t, n) {
4
+ return e(n) ? n : t.getBounds(n);
5
+ }
6
+ //#endregion
7
+ export { t as boundsForRules };
8
+
9
+ //# sourceMappingURL=ruleBounds.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ruleBounds.js","names":["boundsForRules","isRectPose","pose","geometry"],"sources":["../../../../src/interactions/actions/resize/ruleBounds.ts"],"sourcesContent":["import { isRectPose } from 'core/geometry/autoPoseDescriptor';\nimport type { Bounds } from 'core/viewport/fitViewToBounds';\nimport type { PoseDescriptor } from './geometry';\n\n/** `pose` as the bounds a constraint or a point snap reads. A pose that is\n * already a box goes through whole, so a `rotation` on it rides along. */\nexport function boundsForRules(geometry: PoseDescriptor<unknown>, pose: unknown): Bounds {\n return isRectPose(pose) ? pose : geometry.getBounds(pose);\n}\n"],"mappings":";;AAMA,SAAgBA,EAAe,GAAmC,GAAuB;CACvF,OAAOC,EAAWC,CAAI,IAAIA,IAAOC,EAAS,UAAUD,CAAI;AAC1D"}
@@ -0,0 +1,49 @@
1
+ import { readGestureLifecycle as e } from "../gestureLifecycle.js";
2
+ import { gestureReaders as t } from "../../gestures/shared/screenTolerance.js";
3
+ import { nodeDescriptors as n, poseDescriptorOf as r } from "../poseDescriptorDep.js";
4
+ import { scenePoseFrame as i } from "../poseFrame.js";
5
+ import { buildGestureContext as a, captureBox as o, captureStarts as s, captureTargets as c, resolvePolicy as l } from "./capture.js";
6
+ //#region src/interactions/actions/resize/session.ts
7
+ function u(u) {
8
+ let d = u.deps.selection, f = u.deps.scene;
9
+ if (!d || !f) return null;
10
+ let p = d.get();
11
+ if (p.length === 0) return null;
12
+ let m = u.drag?.affordance?.anchor;
13
+ if (!m) return null;
14
+ let h = r(u.deps.poseDescriptor), g = u.deps.resizePolicy, { constraints: _, pointSnap: v, expandIds: y } = l(g), b = n(f, h), x = c(f, p, y);
15
+ if (!x) return null;
16
+ let { writeIds: S, isGroupPath: C } = x, w = i(f), T = u.deps.view, E = s(f, S, b, w, T);
17
+ if (E.startPoses.size === 0) return null;
18
+ let { box: D, ruleOrigin: O } = o(E, S, C, m, h, b), k = {
19
+ x: u.drag?.start.x ?? 0,
20
+ y: u.drag?.start.y ?? 0
21
+ }, A = t(u.deps), j = a(u, p, O, k, A);
22
+ for (let e of _) e.onStart?.(j);
23
+ return {
24
+ session: {
25
+ scene: f,
26
+ writeIds: S,
27
+ sharedBox: C || S.length > 1,
28
+ box: D,
29
+ startPoses: E.startPoses,
30
+ startWorlds: E.startWorlds,
31
+ startWorld: k,
32
+ geometryOf: b,
33
+ poseFrame: w,
34
+ view: T,
35
+ constraints: _,
36
+ pointSnap: v,
37
+ gestureCtx: j,
38
+ applyOps: u.deps.applyOps,
39
+ geometryProjection: u.deps.geometryProjection,
40
+ selectionMethods: d.adapterMethods,
41
+ lifecycle: e(g, "Resize", _)
42
+ },
43
+ readers: A
44
+ };
45
+ }
46
+ //#endregion
47
+ export { u as beginResize };
48
+
49
+ //# sourceMappingURL=session.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"session.js","names":["beginResize","selection","ctx","scene","ids","anchor","geometry","poseDescriptorOf","policy","resolvePolicy","geometryOf","nodeDescriptors","targets","captureTargets","expandIds","poseFrame","scenePoseFrame","view","starts","captureStarts","writeIds","captureBox","isGroupPath","startWorld","readers","gestureReaders","gestureCtx","buildGestureContext","ruleOrigin","b","constraints","readGestureLifecycle"],"sources":["../../../../src/interactions/actions/resize/session.ts"],"sourcesContent":["import type { PoseLinear } from '@weasel-js/geom';\nimport type { InvocationCtx } from '@weasel-js/routing';\nimport type { Op } from 'core/ops/types';\nimport type { NodeId, Scene } from 'core/scene/types';\nimport type { SelectionApi } from 'core/selection/useSelection';\nimport type { Bounds } from 'core/viewport/fitViewToBounds';\nimport { gestureReaders, type GestureReaders } from '../../gestures/shared/screenTolerance';\nimport type { BoundsConstraint, GestureContext, PointSnapBehavior, ResizeAnchor } from '../../gestures/types';\nimport type { GeometryProjection } from '../geometryProjection';\nimport { readGestureLifecycle, type GestureLifecycle } from '../gestureLifecycle';\nimport { nodeDescriptors, poseDescriptorOf } from '../poseDescriptorDep';\nimport { scenePoseFrame, type PoseFrame } from '../poseFrame';\nimport { buildGestureContext, captureBox, captureStarts, captureTargets, resolvePolicy } from './capture';\nimport type { PoseDescriptor } from './geometry';\n\n/** The box the drag resizes, as the press found it. */\nexport interface ResizeBox {\n /** The union for a group or a multi-selection, a lone target's own bounds\n * otherwise. The `src` rect every write id is remapped from. */\n readonly bounds: Bounds;\n readonly anchor: ResizeAnchor;\n /** A lone target's rotation; 0 for a group. */\n readonly rotation: number;\n /** A lone target's `transform`; none for a group. */\n readonly transform?: PoseLinear;\n /** World position of the corner opposite the dragged one, which a resize\n * in a turned or skewed frame pins. */\n readonly fixedWorld: { x: number; y: number };\n}\n\n/** What a resize captured at press. Nothing here changes during the drag. */\nexport interface ResizeSession {\n readonly scene: Scene<unknown, string, unknown>;\n /** The ids the gesture writes: the leaf set for a group, else the selection. */\n readonly writeIds: readonly NodeId[];\n /** Whether `box` stands for several write ids, each remapped inside it,\n * rather than being a lone target's own. */\n readonly sharedBox: boolean;\n readonly box: ResizeBox;\n /** Start poses as stored: the `from` of each op. */\n readonly startPoses: ReadonlyMap<NodeId, unknown>;\n /** Start poses in world, the frame the anchor math and the drag share. */\n readonly startWorlds: ReadonlyMap<NodeId, unknown>;\n /** Where the pointer pressed. */\n readonly startWorld: { x: number; y: number };\n readonly geometryOf: (id: NodeId) => PoseDescriptor<unknown>;\n /** World reads and local writes over the scene's composition strategy. */\n readonly poseFrame: PoseFrame<unknown>;\n readonly view: unknown;\n readonly constraints: readonly BoundsConstraint<Bounds>[];\n readonly pointSnap: readonly PointSnapBehavior<Bounds>[];\n /** Reused across the drag; constraints mutate its `scratch`. */\n readonly gestureCtx: GestureContext<Bounds>;\n readonly applyOps?: (ops: Op[], label: string) => void;\n /** When present, the commit maps each leaf's data-held geometry by the\n * affine its pose underwent. */\n readonly geometryProjection?: GeometryProjection;\n readonly selectionMethods: SelectionApi['adapterMethods'] | undefined;\n /** Label, history, and callbacks from the `resizePolicy` dep. */\n readonly lifecycle: GestureLifecycle;\n}\n\n/** What one `onMove` produced. Replaced, not mutated, by the next. */\nexport interface ResizeFrame {\n /** Stored-frame pose of every write id the move reached. */\n readonly previews: Map<NodeId, unknown>;\n}\n\n/** Capture a resize at press. Null when nothing is selected, the press is not\n * on a resize handle, or nothing it would write exists. Runs each\n * constraint's `onStart`. */\nexport function beginResize(\n ctx: InvocationCtx,\n): { session: ResizeSession; readers: GestureReaders } | null {\n const selection = ctx.deps.selection;\n const scene = ctx.deps.scene;\n if (!selection || !scene) return null;\n\n const ids = selection.get() as NodeId[];\n if (ids.length === 0) return null;\n\n const anchor = ctx.drag?.affordance?.anchor;\n if (!anchor) return null;\n\n const geometry = poseDescriptorOf(ctx.deps.poseDescriptor);\n const policy = ctx.deps.resizePolicy;\n const { constraints, pointSnap, expandIds } = resolvePolicy(policy);\n const geometryOf = nodeDescriptors(scene, geometry);\n\n const targets = captureTargets(scene, ids, expandIds);\n if (!targets) return null;\n const { writeIds, isGroupPath } = targets;\n\n // The drag delta is world, so the anchor math runs on world poses — carried\n // into the plane the edit is measured in — and each result is carried back\n // to its node's plane and stored in the node's own parent frame.\n const poseFrame = scenePoseFrame(scene);\n const view = ctx.deps.view;\n const starts = captureStarts(scene, writeIds, geometryOf, poseFrame, view);\n if (starts.startPoses.size === 0) return null;\n\n const { box, ruleOrigin } = captureBox(starts, writeIds, isGroupPath, anchor, geometry, geometryOf);\n const startWorld = { x: ctx.drag?.start.x ?? 0, y: ctx.drag?.start.y ?? 0 };\n const readers = gestureReaders(ctx.deps);\n const gestureCtx = buildGestureContext(ctx, ids, ruleOrigin, startWorld, readers);\n for (const b of constraints) b.onStart?.(gestureCtx);\n\n const session: ResizeSession = {\n scene,\n writeIds,\n sharedBox: isGroupPath || writeIds.length > 1,\n box,\n startPoses: starts.startPoses,\n startWorlds: starts.startWorlds,\n startWorld,\n geometryOf,\n poseFrame,\n view,\n constraints,\n pointSnap,\n gestureCtx,\n applyOps: ctx.deps.applyOps,\n geometryProjection: ctx.deps.geometryProjection,\n selectionMethods: selection.adapterMethods,\n lifecycle: readGestureLifecycle(policy, 'Resize', constraints),\n };\n return { session, readers };\n}\n"],"mappings":";;;;;;AAuEA,SAAgBA,EACd,GAC4D;CAC5D,IAAMC,IAAYC,EAAI,KAAK,WACrBC,IAAQD,EAAI,KAAK;CACvB,IAAI,CAACD,KAAa,CAACE,GAAO,OAAO;CAEjC,IAAMC,IAAMH,EAAU,IAAI;CAC1B,IAAIG,EAAI,WAAW,GAAG,OAAO;CAE7B,IAAMC,IAASH,EAAI,MAAM,YAAY;CACrC,IAAI,CAACG,GAAQ,OAAO;CAEpB,IAAMC,IAAWC,EAAiBL,EAAI,KAAK,cAAc,GACnDM,IAASN,EAAI,KAAK,cAClB,EAAE,gBAAa,cAAW,iBAAcO,EAAcD,CAAM,GAC5DE,IAAaC,EAAgBR,GAAOG,CAAQ,GAE5CM,IAAUC,EAAeV,GAAOC,GAAKU,CAAS;CACpD,IAAI,CAACF,GAAS,OAAO;CACrB,IAAM,EAAE,aAAU,mBAAgBA,GAK5BG,IAAYC,EAAeb,CAAK,GAChCc,IAAOf,EAAI,KAAK,MAChBgB,IAASC,EAAchB,GAAOiB,GAAUV,GAAYK,GAAWE,CAAI;CACzE,IAAIC,EAAO,WAAW,SAAS,GAAG,OAAO;CAEzC,IAAM,EAAE,QAAK,kBAAeG,EAAWH,GAAQE,GAAUE,GAAajB,GAAQC,GAAUI,CAAU,GAC5Fa,IAAa;EAAE,GAAGrB,EAAI,MAAM,MAAM,KAAK;EAAG,GAAGA,EAAI,MAAM,MAAM,KAAK;CAAE,GACpEsB,IAAUC,EAAevB,EAAI,IAAI,GACjCwB,IAAaC,EAAoBzB,GAAKE,GAAKwB,GAAYL,GAAYC,CAAO;CAChF,KAAK,IAAMK,KAAKC,GAAa,EAAE,UAAUJ,CAAU;CAqBnD,OAAO;EAAE,SAAA;GAlBP;GACA;GACA,WAAWJ,KAAeF,EAAS,SAAS;GAC5C;GACA,YAAYF,EAAO;GACnB,aAAaA,EAAO;GACpB;GACA;GACA;GACA;GACA;GACA;GACA;GACA,UAAUhB,EAAI,KAAK;GACnB,oBAAoBA,EAAI,KAAK;GAC7B,kBAAkBD,EAAU;GAC5B,WAAW8B,EAAqBvB,GAAQ,UAAUsB,CAAW;EAEtD;EAAS;CAAQ;AAC5B"}
@@ -1 +1 @@
1
- {"version":3,"file":"resolveOverlays.js","names":["resolveOverlays","out","ov","overlays","x","y","width","height","insertPreviewExtent","bounds","geometry"],"sources":["../../../src/interactions/actions/resolveOverlays.ts"],"sourcesContent":["/**\n * What an in-flight gesture is proposing to paint *beside* the scene, resolved\n * to geometry.\n *\n * The sibling of `resolvePreviews`: that one answers for the ghosts of scene\n * nodes a gesture is displacing, this one for the chrome a gesture draws that\n * is no node at all — a marquee rect, a lasso trail, the outline of a shape\n * being dragged out. `<SceneCanvas>`'s `useDispatcherOverlayLayer` used to be\n * the only thing that knew how to read an `OngoingOverlay`, and it read one\n * straight into `DrawCommand`s, so a consumer with its own renderer got\n * nothing. None of the normalizing is about drawing.\n *\n * What stays out, as in `resolvePreviews`: no view, no screen projection, no\n * `DrawCommand`, no style, no React, no dispatcher. World coordinates only.\n */\n\nimport type { InsertPreviewGeometry } from '../../canvas/insertPreviewExtent';\nimport { insertPreviewExtent } from '../../canvas/insertPreviewExtent';\nimport type { Bounds } from '../../core/viewport/fitViewToBounds';\nimport type { KitInsertShape } from '../../core/shapeKinds';\nimport type { OngoingOverlay, OverlayRole } from '@weasel-js/routing';\n\ntype Point = { x: number; y: number };\n\n/**\n * The chrome-caps id a surface consults before painting each variant. The\n * gating itself is the painter's — two views of one surface may disagree about\n * whether to show an in-flight marquee — but the id is not something a caller\n * should have to guess.\n */\nexport type OverlayVisibilityId =\n | 'action.marquee'\n | 'action.lasso'\n | 'action.insert-preview'\n | 'action.polyline';\n\n/**\n * One in-flight overlay, in world coordinates.\n *\n * Every degenerate overlay is already gone: a marquee of zero size, a lasso\n * under two vertices, a zero-area insert of anything but a pencil, a pencil\n * under two samples, a run of fewer than two points. Whatever is in this list\n * is worth painting.\n */\nexport type ResolvedOverlay =\n | {\n kind: 'marquee';\n visibilityId: 'action.marquee';\n /** The drag normalized: `start`/`current` in either order, one AABB. */\n bounds: Bounds;\n /** Additive intent. Core's 2D layer paints the same rect either way. */\n shiftHeld: boolean;\n }\n | {\n kind: 'lasso';\n visibilityId: 'action.lasso';\n /** The trail so far, at least two long. The region it encloses is the\n * trail closed back to its first vertex. */\n vertices: ReadonlyArray<Point>;\n /** Live pointer position — the trail's last vertex until it advances. */\n current: Point;\n shiftHeld: boolean;\n }\n | {\n kind: 'insertPreview';\n visibilityId: 'action.insert-preview';\n shape: KitInsertShape;\n /** Extent of `geometry`, which for a radial or freehand shape is not the\n * drag rect. See `insertPreviewExtent`. */\n bounds: Bounds;\n geometry: InsertPreviewGeometry;\n /** The drag's anchor — a growth axis to mark. Absent for a pencil, which\n * has none. */\n anchorPoint?: Point;\n /** The action's per-shape payload, verbatim. Carries what geometry\n * cannot: an image insert's `src`, say. */\n extras: unknown;\n }\n | {\n kind: 'polyline';\n visibilityId: 'action.polyline';\n /** The run, at least two long, open — the last point does not join the\n * first. A closed sweep is a `lasso`. */\n points: ReadonlyArray<Point>;\n /** What the run is, for a painter choosing a style. Never defaulted\n * away: `'chrome'` when the action named none. A role the painter has\n * no style for is drawn as plain chrome, not dropped. */\n role: OverlayRole;\n };\n\n/** The overlays worth painting, in the order the handles published them. */\nexport function resolveOverlays(overlays: Iterable<OngoingOverlay>): ResolvedOverlay[] {\n const out: ResolvedOverlay[] = [];\n for (const ov of overlays) {\n switch (ov.kind) {\n case 'marquee': {\n const x = Math.min(ov.start.x, ov.current.x);\n const y = Math.min(ov.start.y, ov.current.y);\n const width = Math.abs(ov.current.x - ov.start.x);\n const height = Math.abs(ov.current.y - ov.start.y);\n if (width === 0 && height === 0) break;\n out.push({\n kind: 'marquee',\n visibilityId: 'action.marquee',\n bounds: { x, y, width, height },\n shiftHeld: ov.shiftHeld,\n });\n break;\n }\n case 'lasso': {\n if (ov.vertices.length < 2) break;\n out.push({\n kind: 'lasso',\n visibilityId: 'action.lasso',\n vertices: ov.vertices,\n current: ov.current,\n shiftHeld: ov.shiftHeld,\n });\n break;\n }\n case 'insertPreview': {\n const { bounds, geometry } = insertPreviewExtent(ov);\n // A pencil can be meaningful at zero AABB — a closed loop, a\n // sub-threshold gesture — where every other shape cannot.\n if (bounds.width === 0 && bounds.height === 0 && ov.shape !== 'pencil') break;\n if (geometry.kind === 'pencil' && geometry.samples.length < 2) break;\n out.push({\n kind: 'insertPreview',\n visibilityId: 'action.insert-preview',\n // Routing types the insert shape as an open string: a\n // consumer-defined kind is legal there and simply gets no live\n // preview. This narrows to the kinds the kit's overlay draws —\n // the `break` above has already rejected everything else.\n shape: ov.shape as KitInsertShape,\n bounds,\n geometry,\n extras: ov.extras,\n ...(ov.anchorPoint && ov.shape !== 'pencil' ? { anchorPoint: ov.anchorPoint } : {}),\n });\n break;\n }\n case 'polyline': {\n if (ov.points.length < 2) break;\n out.push({\n kind: 'polyline',\n visibilityId: 'action.polyline',\n points: ov.points,\n role: ov.role ?? 'chrome',\n });\n break;\n }\n }\n }\n return out;\n}\n"],"mappings":";;AA2FA,SAAgBA,EAAgB,GAAuD;CACrF,IAAMC,IAAyB,CAAC;CAChC,KAAK,IAAMC,KAAMC,GACf,QAAQD,EAAG,MAAX;EACE,KAAK,WAAW;GACd,IAAME,IAAI,KAAK,IAAIF,EAAG,MAAM,GAAGA,EAAG,QAAQ,CAAC,GACrCG,IAAI,KAAK,IAAIH,EAAG,MAAM,GAAGA,EAAG,QAAQ,CAAC,GACrCI,IAAQ,KAAK,IAAIJ,EAAG,QAAQ,IAAIA,EAAG,MAAM,CAAC,GAC1CK,IAAS,KAAK,IAAIL,EAAG,QAAQ,IAAIA,EAAG,MAAM,CAAC;GACjD,IAAII,MAAU,KAAKC,MAAW,GAAG;GACjC,EAAI,KAAK;IACP,MAAM;IACN,cAAc;IACd,QAAQ;KAAE;KAAG;KAAG;KAAO;IAAO;IAC9B,WAAWL,EAAG;GAChB,CAAC;GACD;EACF;EACA,KAAK;GACH,IAAIA,EAAG,SAAS,SAAS,GAAG;GAC5B,EAAI,KAAK;IACP,MAAM;IACN,cAAc;IACd,UAAUA,EAAG;IACb,SAASA,EAAG;IACZ,WAAWA,EAAG;GAChB,CAAC;GACD;EAEF,KAAK,iBAAiB;GACpB,IAAM,EAAE,WAAQ,gBAAaM,EAAoBN,CAAE;GAInD,IADIO,EAAO,UAAU,KAAKA,EAAO,WAAW,KAAKP,EAAG,UAAU,YAC1DQ,EAAS,SAAS,YAAYA,EAAS,QAAQ,SAAS,GAAG;GAC/D,EAAI,KAAK;IACP,MAAM;IACN,cAAc;IAKd,OAAOR,EAAG;IACV;IACA;IACA,QAAQA,EAAG;IACX,GAAIA,EAAG,eAAeA,EAAG,UAAU,WAAW,EAAE,aAAaA,EAAG,YAAY,IAAI,CAAC;GACnF,CAAC;GACD;EACF;EACA,KAAK;GACH,IAAIA,EAAG,OAAO,SAAS,GAAG;GAC1B,EAAI,KAAK;IACP,MAAM;IACN,cAAc;IACd,QAAQA,EAAG;IACX,MAAMA,EAAG,QAAQ;GACnB,CAAC;CAGL;CAEF,OAAOD;AACT"}
1
+ {"version":3,"file":"resolveOverlays.js","names":["resolveOverlays","out","ov","overlays","x","y","width","height","insertPreviewExtent","bounds","geometry"],"sources":["../../../src/interactions/actions/resolveOverlays.ts"],"sourcesContent":["/**\n * What an in-flight gesture is proposing to paint *beside* the scene, resolved\n * to geometry.\n *\n * The sibling of `resolvePreviews`: that one answers for the ghosts of scene\n * nodes a gesture is displacing, this one for the chrome a gesture draws that\n * is no node at all — a marquee rect, a lasso trail, the outline of a shape\n * being dragged out.\n *\n * What stays out, as in `resolvePreviews`: no view, no screen projection, no\n * `DrawCommand`, no style, no React, no dispatcher. World coordinates only.\n */\n\nimport type { InsertPreviewGeometry } from '../../canvas/insertPreviewExtent';\nimport { insertPreviewExtent } from '../../canvas/insertPreviewExtent';\nimport type { Bounds } from '../../core/viewport/fitViewToBounds';\nimport type { KitInsertShape } from '../../core/shapeKinds';\nimport type { OngoingOverlay, OverlayRole } from '@weasel-js/routing';\n\ntype Point = { x: number; y: number };\n\n/**\n * The chrome-caps id a surface consults before painting each variant. The\n * gating itself is the painter's — two views of one surface may disagree about\n * whether to show an in-flight marquee — but the id is not something a caller\n * should have to guess.\n */\nexport type OverlayVisibilityId =\n | 'action.marquee'\n | 'action.lasso'\n | 'action.insert-preview'\n | 'action.polyline';\n\n/**\n * One in-flight overlay, in world coordinates.\n *\n * Every degenerate overlay is already gone: a marquee of zero size, a lasso\n * under two vertices, a zero-area insert of anything but a pencil, a pencil\n * under two samples, a run of fewer than two points. Whatever is in this list\n * is worth painting.\n */\nexport type ResolvedOverlay =\n | {\n kind: 'marquee';\n visibilityId: 'action.marquee';\n /** The drag normalized: `start`/`current` in either order, one AABB. */\n bounds: Bounds;\n /** Additive intent. Core's 2D layer paints the same rect either way. */\n shiftHeld: boolean;\n }\n | {\n kind: 'lasso';\n visibilityId: 'action.lasso';\n /** The trail so far, at least two long. The region it encloses is the\n * trail closed back to its first vertex. */\n vertices: ReadonlyArray<Point>;\n /** Live pointer position — the trail's last vertex until it advances. */\n current: Point;\n shiftHeld: boolean;\n }\n | {\n kind: 'insertPreview';\n visibilityId: 'action.insert-preview';\n shape: KitInsertShape;\n /** Extent of `geometry`, which for a radial or freehand shape is not the\n * drag rect. See `insertPreviewExtent`. */\n bounds: Bounds;\n geometry: InsertPreviewGeometry;\n /** The drag's anchor — a growth axis to mark. Absent for a pencil, which\n * has none. */\n anchorPoint?: Point;\n /** The action's per-shape payload, verbatim. Carries what geometry\n * cannot: an image insert's `src`, say. */\n extras: unknown;\n }\n | {\n kind: 'polyline';\n visibilityId: 'action.polyline';\n /** The run, at least two long, open — the last point does not join the\n * first. A closed sweep is a `lasso`. */\n points: ReadonlyArray<Point>;\n /** What the run is, for a painter choosing a style. Never defaulted\n * away: `'chrome'` when the action named none. A role the painter has\n * no style for is drawn as plain chrome, not dropped. */\n role: OverlayRole;\n };\n\n/** The overlays worth painting, in the order the handles published them. */\nexport function resolveOverlays(overlays: Iterable<OngoingOverlay>): ResolvedOverlay[] {\n const out: ResolvedOverlay[] = [];\n for (const ov of overlays) {\n switch (ov.kind) {\n case 'marquee': {\n const x = Math.min(ov.start.x, ov.current.x);\n const y = Math.min(ov.start.y, ov.current.y);\n const width = Math.abs(ov.current.x - ov.start.x);\n const height = Math.abs(ov.current.y - ov.start.y);\n if (width === 0 && height === 0) break;\n out.push({\n kind: 'marquee',\n visibilityId: 'action.marquee',\n bounds: { x, y, width, height },\n shiftHeld: ov.shiftHeld,\n });\n break;\n }\n case 'lasso': {\n if (ov.vertices.length < 2) break;\n out.push({\n kind: 'lasso',\n visibilityId: 'action.lasso',\n vertices: ov.vertices,\n current: ov.current,\n shiftHeld: ov.shiftHeld,\n });\n break;\n }\n case 'insertPreview': {\n const { bounds, geometry } = insertPreviewExtent(ov);\n // A pencil can be meaningful at zero AABB — a closed loop, a\n // sub-threshold gesture — where every other shape cannot.\n if (bounds.width === 0 && bounds.height === 0 && ov.shape !== 'pencil') break;\n if (geometry.kind === 'pencil' && geometry.samples.length < 2) break;\n out.push({\n kind: 'insertPreview',\n visibilityId: 'action.insert-preview',\n // Routing types the insert shape as an open string; a\n // consumer-defined kind is legal there.\n shape: ov.shape as KitInsertShape,\n bounds,\n geometry,\n extras: ov.extras,\n ...(ov.anchorPoint && ov.shape !== 'pencil' ? { anchorPoint: ov.anchorPoint } : {}),\n });\n break;\n }\n case 'polyline': {\n if (ov.points.length < 2) break;\n out.push({\n kind: 'polyline',\n visibilityId: 'action.polyline',\n points: ov.points,\n role: ov.role ?? 'chrome',\n });\n break;\n }\n }\n }\n return out;\n}\n"],"mappings":";;AAwFA,SAAgBA,EAAgB,GAAuD;CACrF,IAAMC,IAAyB,CAAC;CAChC,KAAK,IAAMC,KAAMC,GACf,QAAQD,EAAG,MAAX;EACE,KAAK,WAAW;GACd,IAAME,IAAI,KAAK,IAAIF,EAAG,MAAM,GAAGA,EAAG,QAAQ,CAAC,GACrCG,IAAI,KAAK,IAAIH,EAAG,MAAM,GAAGA,EAAG,QAAQ,CAAC,GACrCI,IAAQ,KAAK,IAAIJ,EAAG,QAAQ,IAAIA,EAAG,MAAM,CAAC,GAC1CK,IAAS,KAAK,IAAIL,EAAG,QAAQ,IAAIA,EAAG,MAAM,CAAC;GACjD,IAAII,MAAU,KAAKC,MAAW,GAAG;GACjC,EAAI,KAAK;IACP,MAAM;IACN,cAAc;IACd,QAAQ;KAAE;KAAG;KAAG;KAAO;IAAO;IAC9B,WAAWL,EAAG;GAChB,CAAC;GACD;EACF;EACA,KAAK;GACH,IAAIA,EAAG,SAAS,SAAS,GAAG;GAC5B,EAAI,KAAK;IACP,MAAM;IACN,cAAc;IACd,UAAUA,EAAG;IACb,SAASA,EAAG;IACZ,WAAWA,EAAG;GAChB,CAAC;GACD;EAEF,KAAK,iBAAiB;GACpB,IAAM,EAAE,WAAQ,gBAAaM,EAAoBN,CAAE;GAInD,IADIO,EAAO,UAAU,KAAKA,EAAO,WAAW,KAAKP,EAAG,UAAU,YAC1DQ,EAAS,SAAS,YAAYA,EAAS,QAAQ,SAAS,GAAG;GAC/D,EAAI,KAAK;IACP,MAAM;IACN,cAAc;IAGd,OAAOR,EAAG;IACV;IACA;IACA,QAAQA,EAAG;IACX,GAAIA,EAAG,eAAeA,EAAG,UAAU,WAAW,EAAE,aAAaA,EAAG,YAAY,IAAI,CAAC;GACnF,CAAC;GACD;EACF;EACA,KAAK;GACH,IAAIA,EAAG,OAAO,SAAS,GAAG;GAC1B,EAAI,KAAK;IACP,MAAM;IACN,cAAc;IACd,QAAQA,EAAG;IACX,MAAMA,EAAG,QAAQ;GACnB,CAAC;CAGL;CAEF,OAAOD;AACT"}
@@ -1 +1 @@
1
- {"version":3,"file":"resolvePreviews.js","names":["firstNonNull","source","sources","value","read","id","resolvePreviews","list","ids","previewing","opaque","settled","build","node","scene","asNodeId","pose","s","i","data","children","childId","child","roots","parent","root","flattenPreviews","out","walk","entry"],"sources":["../../../src/interactions/actions/resolvePreviews.ts"],"sourcesContent":["/**\n * What an in-flight gesture is proposing, resolved against the committed scene.\n *\n * An ongoing action publishes interim poses on its handle rather than writing\n * them to the scene, and `<SceneCanvas>`'s ghost layer used to be the only\n * thing that knew how to read them: which ids are in flight, which of those are\n * roots, whose preview wins when two sources name the same id, and which are\n * merely displaced rather than dragged. None of that is about drawing, and a\n * consumer with its own renderer needs all of it.\n */\n\nimport type { GesturePreviewSource } from '../../canvas/gestureBounds';\nimport type { Node, NodeId, Scene } from '../../core/scene/types';\nimport { asNodeId } from '../../core/scene/types';\n\n/** One node an in-flight gesture is previewing, as {@link resolvePreviews} returns it. */\nexport interface PreviewNode<TData, TLayer extends string, TPose> {\n id: NodeId;\n /** The node as committed — the gesture has not touched the scene. */\n node: Node<TData, TLayer, TPose>;\n /** The interim pose, or the committed one when only data is in flight. */\n pose: TPose;\n /** The interim data, or the committed one when only the pose is in flight. */\n data: TData;\n /**\n * The gesture is not carrying this one under the pointer — a layout sibling\n * reflowing into its destination slot. It reads better painted settled.\n */\n opaque: boolean;\n /** Previewed descendants, so a container's ghost brings its children. */\n children: PreviewNode<TData, TLayer, TPose>[];\n}\n\n/** First non-null answer across sources: tool-side before dispatcher-side. */\nfunction firstNonNull<T>(\n sources: readonly GesturePreviewSource[],\n id: string,\n read: (source: GesturePreviewSource, id: string) => unknown,\n): T | null {\n for (const source of sources) {\n const value = read(source, id);\n if (value != null) return value as T;\n }\n return null;\n}\n\n/**\n * The previewing subtrees, as roots. A previewed node whose parent is also\n * previewing is a child of that parent's entry rather than a root of its own,\n * which is what lets a caller draw a container and its contents as one thing.\n *\n * An id with no node is skipped: an insert previews before the node it will\n * create exists. So is an id no source has a pose or data for.\n */\nexport function resolvePreviews<TData, TLayer extends string, TPose>(\n sources: Iterable<GesturePreviewSource>,\n scene: Scene<TData, TLayer, TPose>,\n): PreviewNode<TData, TLayer, TPose>[] {\n const list = [...sources];\n const ids = new Set<string>();\n for (const source of list) {\n const previewing = source.previewIds?.();\n if (!previewing) continue;\n for (const id of previewing) ids.add(id);\n }\n if (ids.size === 0) return [];\n\n const opaque = new Set<string>();\n for (const source of list) {\n const settled = source.previewOpaqueIds?.();\n if (!settled) continue;\n for (const id of settled) opaque.add(id);\n }\n\n const build = (id: string): PreviewNode<TData, TLayer, TPose> | null => {\n const node = scene.get(asNodeId(id));\n if (!node) return null;\n const pose = firstNonNull<TPose>(list, id, (s, i) => s.previewPose?.(i));\n const data = firstNonNull<TData>(list, id, (s, i) => s.previewData?.(i));\n if (pose == null && data == null) return null;\n\n const children: PreviewNode<TData, TLayer, TPose>[] = [];\n for (const childId of scene.childrenOf(asNodeId(id))) {\n if (!ids.has(childId)) continue;\n const child = build(childId);\n if (child) children.push(child);\n }\n\n return {\n id: asNodeId(id),\n node,\n pose: pose ?? node.pose,\n data: data ?? node.data,\n opaque: opaque.has(id),\n children,\n };\n };\n\n const roots: PreviewNode<TData, TLayer, TPose>[] = [];\n for (const id of ids) {\n const parent = scene.get(asNodeId(id))?.parent;\n if (parent != null && ids.has(parent)) continue;\n const root = build(id);\n if (root) roots.push(root);\n }\n return roots;\n}\n\n/** Every entry in the forest, parents before their children. */\nexport function flattenPreviews<TData, TLayer extends string, TPose>(\n roots: readonly PreviewNode<TData, TLayer, TPose>[],\n): PreviewNode<TData, TLayer, TPose>[] {\n const out: PreviewNode<TData, TLayer, TPose>[] = [];\n const walk = (entry: PreviewNode<TData, TLayer, TPose>) => {\n out.push(entry);\n for (const child of entry.children) walk(child);\n };\n for (const root of roots) walk(root);\n return out;\n}\n"],"mappings":";;AAkCA,SAASA,EACP,GACA,GACA,GACU;CACV,KAAK,IAAMC,KAAUC,GAAS;EAC5B,IAAMC,IAAQC,EAAKH,GAAQI,CAAE;EAC7B,IAAIF,KAAS,MAAM,OAAOA;CAC5B;CACA,OAAO;AACT;AAUA,SAAgBG,EACd,GACA,GACqC;CACrC,IAAMC,IAAO,CAAC,GAAGL,CAAO,GAClBM,oBAAM,IAAI,IAAY;CAC5B,KAAK,IAAMP,KAAUM,GAAM;EACzB,IAAME,IAAaR,EAAO,aAAa;EACvC,IAAKQ,GACL,KAAK,IAAMJ,KAAMI,GAAY,EAAI,IAAIJ,CAAE;CACzC;CACA,IAAIG,EAAI,SAAS,GAAG,OAAO,CAAC;CAE5B,IAAME,oBAAS,IAAI,IAAY;CAC/B,KAAK,IAAMT,KAAUM,GAAM;EACzB,IAAMI,IAAUV,EAAO,mBAAmB;EAC1C,IAAKU,GACL,KAAK,IAAMN,KAAMM,GAAS,EAAO,IAAIN,CAAE;CACzC;CAEA,IAAMO,KAAS,MAAyD;EACtE,IAAMC,IAAOC,EAAM,IAAIC,EAASV,CAAE,CAAC;EACnC,IAAI,CAACQ,GAAM,OAAO;EAClB,IAAMG,IAAOhB,EAAoBO,GAAMF,IAAK,GAAG,MAAMY,EAAE,cAAcC,CAAC,CAAC,GACjEC,IAAOnB,EAAoBO,GAAMF,IAAK,GAAG,MAAMY,EAAE,cAAcC,CAAC,CAAC;EACvE,IAAIF,KAAQ,QAAQG,KAAQ,MAAM,OAAO;EAEzC,IAAMC,IAAgD,CAAC;EACvD,KAAK,IAAMC,KAAWP,EAAM,WAAWC,EAASV,CAAE,CAAC,GAAG;GACpD,IAAI,CAACG,EAAI,IAAIa,CAAO,GAAG;GACvB,IAAMC,IAAQV,EAAMS,CAAO;GAC3B,AAAIC,KAAOF,EAAS,KAAKE,CAAK;EAChC;EAEA,OAAO;GACL,IAAIP,EAASV,CAAE;GACf;GACA,MAAMW,KAAQH,EAAK;GACnB,MAAMM,KAAQN,EAAK;GACnB,QAAQH,EAAO,IAAIL,CAAE;GACrB;EACF;CACF,GAEMkB,IAA6C,CAAC;CACpD,KAAK,IAAMlB,KAAMG,GAAK;EACpB,IAAMgB,IAASV,EAAM,IAAIC,EAASV,CAAE,CAAC,CAAC,EAAE;EACxC,IAAImB,KAAU,QAAQhB,EAAI,IAAIgB,CAAM,GAAG;EACvC,IAAMC,IAAOb,EAAMP,CAAE;EACrB,AAAIoB,KAAMF,EAAM,KAAKE,CAAI;CAC3B;CACA,OAAOF;AACT;AAGA,SAAgBG,EACd,GACqC;CACrC,IAAMC,IAA2C,CAAC,GAC5CC,KAAQ,MAA6C;EACzD,EAAI,KAAKC,CAAK;EACd,KAAK,IAAMP,KAASO,EAAM,UAAU,EAAKP,CAAK;CAChD;CACA,KAAK,IAAMG,KAAQF,GAAO,EAAKE,CAAI;CACnC,OAAOE;AACT"}
1
+ {"version":3,"file":"resolvePreviews.js","names":["firstNonNull","source","sources","value","read","id","resolvePreviews","list","ids","previewing","opaque","settled","build","node","scene","asNodeId","pose","s","i","data","children","childId","child","roots","parent","root","flattenPreviews","out","walk","entry"],"sources":["../../../src/interactions/actions/resolvePreviews.ts"],"sourcesContent":["/**\n * What an in-flight gesture is proposing, resolved against the committed scene.\n *\n * An ongoing action publishes interim poses on its handle rather than writing\n * them to the scene, and `<SceneCanvas>`'s ghost layer used to be the only\n * thing that knew how to read them: which ids are in flight, which of those are\n * roots, whose preview wins when two sources name the same id, and which are\n * merely displaced rather than dragged. None of that is about drawing, and a\n * consumer with its own renderer needs all of it.\n */\n\nimport type { GesturePreviewSource } from '../../canvas/gestureBounds';\nimport type { Node, NodeId, Scene } from '../../core/scene/types';\nimport { asNodeId } from '../../core/scene/types';\n\n/** One node an in-flight gesture is previewing, as {@link resolvePreviews} returns it. */\nexport interface PreviewNode<TData, TLayer extends string, TPose> {\n id: NodeId;\n /** The node as committed — the gesture has not touched the scene. */\n node: Node<TData, TLayer, TPose>;\n /** The interim pose, or the committed one when only data is in flight. */\n pose: TPose;\n /** The interim data, or the committed one when only the pose is in flight. */\n data: TData;\n /**\n * The gesture is not carrying this one under the pointer — a layout sibling\n * reflowing into its destination slot. It reads better painted settled.\n */\n opaque: boolean;\n /** Previewed descendants, so a container's ghost brings its children. */\n children: PreviewNode<TData, TLayer, TPose>[];\n}\n\n/** First non-null answer across sources, in the order given. */\nfunction firstNonNull<T>(\n sources: readonly GesturePreviewSource[],\n id: string,\n read: (source: GesturePreviewSource, id: string) => unknown,\n): T | null {\n for (const source of sources) {\n const value = read(source, id);\n if (value != null) return value as T;\n }\n return null;\n}\n\n/**\n * The previewing subtrees, as roots. A previewed node whose parent is also\n * previewing is a child of that parent's entry rather than a root of its own,\n * which is what lets a caller draw a container and its contents as one thing.\n *\n * An id with no node is skipped: an insert previews before the node it will\n * create exists. So is an id no source has a pose or data for.\n */\nexport function resolvePreviews<TData, TLayer extends string, TPose>(\n sources: Iterable<GesturePreviewSource>,\n scene: Scene<TData, TLayer, TPose>,\n): PreviewNode<TData, TLayer, TPose>[] {\n const list = [...sources];\n const ids = new Set<string>();\n for (const source of list) {\n const previewing = source.previewIds?.();\n if (!previewing) continue;\n for (const id of previewing) ids.add(id);\n }\n if (ids.size === 0) return [];\n\n const opaque = new Set<string>();\n for (const source of list) {\n const settled = source.previewOpaqueIds?.();\n if (!settled) continue;\n for (const id of settled) opaque.add(id);\n }\n\n const build = (id: string): PreviewNode<TData, TLayer, TPose> | null => {\n const node = scene.get(asNodeId(id));\n if (!node) return null;\n const pose = firstNonNull<TPose>(list, id, (s, i) => s.previewPose?.(i));\n const data = firstNonNull<TData>(list, id, (s, i) => s.previewData?.(i));\n if (pose == null && data == null) return null;\n\n const children: PreviewNode<TData, TLayer, TPose>[] = [];\n for (const childId of scene.childrenOf(asNodeId(id))) {\n if (!ids.has(childId)) continue;\n const child = build(childId);\n if (child) children.push(child);\n }\n\n return {\n id: asNodeId(id),\n node,\n pose: pose ?? node.pose,\n data: data ?? node.data,\n opaque: opaque.has(id),\n children,\n };\n };\n\n const roots: PreviewNode<TData, TLayer, TPose>[] = [];\n for (const id of ids) {\n const parent = scene.get(asNodeId(id))?.parent;\n if (parent != null && ids.has(parent)) continue;\n const root = build(id);\n if (root) roots.push(root);\n }\n return roots;\n}\n\n/** Every entry in the forest, parents before their children. */\nexport function flattenPreviews<TData, TLayer extends string, TPose>(\n roots: readonly PreviewNode<TData, TLayer, TPose>[],\n): PreviewNode<TData, TLayer, TPose>[] {\n const out: PreviewNode<TData, TLayer, TPose>[] = [];\n const walk = (entry: PreviewNode<TData, TLayer, TPose>) => {\n out.push(entry);\n for (const child of entry.children) walk(child);\n };\n for (const root of roots) walk(root);\n return out;\n}\n"],"mappings":";;AAkCA,SAASA,EACP,GACA,GACA,GACU;CACV,KAAK,IAAMC,KAAUC,GAAS;EAC5B,IAAMC,IAAQC,EAAKH,GAAQI,CAAE;EAC7B,IAAIF,KAAS,MAAM,OAAOA;CAC5B;CACA,OAAO;AACT;AAUA,SAAgBG,EACd,GACA,GACqC;CACrC,IAAMC,IAAO,CAAC,GAAGL,CAAO,GAClBM,oBAAM,IAAI,IAAY;CAC5B,KAAK,IAAMP,KAAUM,GAAM;EACzB,IAAME,IAAaR,EAAO,aAAa;EACvC,IAAKQ,GACL,KAAK,IAAMJ,KAAMI,GAAY,EAAI,IAAIJ,CAAE;CACzC;CACA,IAAIG,EAAI,SAAS,GAAG,OAAO,CAAC;CAE5B,IAAME,oBAAS,IAAI,IAAY;CAC/B,KAAK,IAAMT,KAAUM,GAAM;EACzB,IAAMI,IAAUV,EAAO,mBAAmB;EAC1C,IAAKU,GACL,KAAK,IAAMN,KAAMM,GAAS,EAAO,IAAIN,CAAE;CACzC;CAEA,IAAMO,KAAS,MAAyD;EACtE,IAAMC,IAAOC,EAAM,IAAIC,EAASV,CAAE,CAAC;EACnC,IAAI,CAACQ,GAAM,OAAO;EAClB,IAAMG,IAAOhB,EAAoBO,GAAMF,IAAK,GAAG,MAAMY,EAAE,cAAcC,CAAC,CAAC,GACjEC,IAAOnB,EAAoBO,GAAMF,IAAK,GAAG,MAAMY,EAAE,cAAcC,CAAC,CAAC;EACvE,IAAIF,KAAQ,QAAQG,KAAQ,MAAM,OAAO;EAEzC,IAAMC,IAAgD,CAAC;EACvD,KAAK,IAAMC,KAAWP,EAAM,WAAWC,EAASV,CAAE,CAAC,GAAG;GACpD,IAAI,CAACG,EAAI,IAAIa,CAAO,GAAG;GACvB,IAAMC,IAAQV,EAAMS,CAAO;GAC3B,AAAIC,KAAOF,EAAS,KAAKE,CAAK;EAChC;EAEA,OAAO;GACL,IAAIP,EAASV,CAAE;GACf;GACA,MAAMW,KAAQH,EAAK;GACnB,MAAMM,KAAQN,EAAK;GACnB,QAAQH,EAAO,IAAIL,CAAE;GACrB;EACF;CACF,GAEMkB,IAA6C,CAAC;CACpD,KAAK,IAAMlB,KAAMG,GAAK;EACpB,IAAMgB,IAASV,EAAM,IAAIC,EAASV,CAAE,CAAC,CAAC,EAAE;EACxC,IAAImB,KAAU,QAAQhB,EAAI,IAAIgB,CAAM,GAAG;EACvC,IAAMC,IAAOb,EAAMP,CAAE;EACrB,AAAIoB,KAAMF,EAAM,KAAKE,CAAI;CAC3B;CACA,OAAOF;AACT;AAGA,SAAgBG,EACd,GACqC;CACrC,IAAMC,IAA2C,CAAC,GAC5CC,KAAQ,MAA6C;EACzD,EAAI,KAAKC,CAAK;EACd,KAAK,IAAMP,KAASO,EAAM,UAAU,EAAKP,CAAK;CAChD;CACA,KAAK,IAAMG,KAAQF,GAAO,EAAKE,CAAI;CACnC,OAAOE;AACT"}
@@ -0,0 +1,56 @@
1
+ import { closeGesture as e, runBehaviorCancel as t } from "../gestureLifecycle.js";
2
+ import { inPlane as n, selectionLayer as r } from "../planeInput.js";
3
+ import { nextFrame as i } from "./frame.js";
4
+ import { commitRotate as a } from "./commit.js";
5
+ import { beginRotate as o } from "./session.js";
6
+ //#region src/interactions/actions/rotate/action.ts
7
+ var s = n({
8
+ id: "rotate",
9
+ label: "Rotate",
10
+ eligible: { capability: "transforms-selection" },
11
+ requires: [
12
+ "selection",
13
+ "scene",
14
+ "applyOps",
15
+ "poseDescriptor",
16
+ "view"
17
+ ],
18
+ invoker: {
19
+ timing: "ongoing",
20
+ start(n, r) {
21
+ let s = o(n, r);
22
+ if (!s) return {};
23
+ let { session: c, readers: l } = s, u = c.scene.overrides.hold(), d = {
24
+ delta: 0,
25
+ previews: /* @__PURE__ */ new Map()
26
+ };
27
+ return c.lifecycle.start(c.gestureCtx.draggedIds), {
28
+ kind: "rotate",
29
+ onMove(e) {
30
+ d = i(c, l, e), u.set(d.previews);
31
+ },
32
+ onEnd(n, r) {
33
+ let i = !1;
34
+ try {
35
+ r === "commit" ? i = a(c, d) : t(c.behaviors, c.gestureCtx);
36
+ } finally {
37
+ e({
38
+ hold: u,
39
+ previews: d.previews,
40
+ behaviors: c.behaviors,
41
+ ctx: c.gestureCtx,
42
+ lifecycle: c.lifecycle
43
+ }, i);
44
+ }
45
+ },
46
+ previewIds: () => d.previews.keys(),
47
+ previewPose: (e) => d.previews.get(e) ?? null
48
+ };
49
+ }
50
+ },
51
+ enabled: () => !0
52
+ }, r);
53
+ //#endregion
54
+ export { s as rotateAction };
55
+
56
+ //# sourceMappingURL=action.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"action.js","names":["rotateAction","inPlane","begun","beginRotate","ctx","opts","hold","session","frame","nextFrame","readers","moveCtx","committed","reason","commitRotate","runBehaviorCancel","id","selectionLayer"],"sources":["../../../../src/interactions/actions/rotate/action.ts"],"sourcesContent":["import type { Action } from '@weasel-js/routing';\nimport type { BindingOpts, InvocationCtx, OngoingHandle } from '@weasel-js/routing';\nimport type { NodeId } from 'core/scene/types';\nimport { closeGesture, runBehaviorCancel } from '../gestureLifecycle';\nimport { inPlane, selectionLayer } from '../planeInput';\nimport { commitRotate } from './commit';\nimport { nextFrame } from './frame';\nimport { beginRotate, type RotateFrame } from './session';\n\n/**\n * @experimental\n * Pointer-driven rotation of the selection, committed as one undo entry.\n *\n * A pose whose descriptor has no `withRotation`, or reports\n * `supportsRotation` false, is left alone. Behaviors (`opts.behaviors`) see\n * the first rotated node's turned pose; a pose one returns from `onMove` sets\n * the rotation for the whole selection.\n */\nexport const rotateAction: Action & { requires: string[] } = inPlane({\n id: 'rotate',\n label: 'Rotate',\n // No default binding: a bare `{ kind: 'drag' }` makes any drag no active\n // tool claimed rotate a non-empty selection. The rotation handle binds it\n // (`selectionRotateBindings`).\n eligible: { capability: 'transforms-selection' },\n requires: ['selection', 'scene', 'applyOps', 'poseDescriptor', 'view'],\n invoker: {\n timing: 'ongoing',\n start(ctx: InvocationCtx, opts?: BindingOpts): OngoingHandle {\n const begun = beginRotate(ctx, opts);\n if (!begun) return {};\n const { session, readers } = begun;\n const hold = session.scene.overrides.hold();\n let frame: RotateFrame = { delta: 0, previews: new Map() };\n session.lifecycle.start(session.gestureCtx.draggedIds);\n return {\n kind: 'rotate',\n onMove(moveCtx: InvocationCtx): void {\n frame = nextFrame(session, readers, moveCtx);\n hold.set(frame.previews);\n },\n onEnd(_endCtx: InvocationCtx, reason: 'commit' | 'cancel'): void {\n let committed = false;\n try {\n if (reason === 'commit') committed = commitRotate(session, frame);\n else runBehaviorCancel(session.behaviors, session.gestureCtx);\n } finally {\n closeGesture({ hold, previews: frame.previews, behaviors: session.behaviors, ctx: session.gestureCtx, lifecycle: session.lifecycle }, committed);\n }\n },\n previewIds: () => frame.previews.keys(),\n previewPose: (id: string) => frame.previews.get(id as NodeId) ?? null,\n };\n },\n },\n enabled: () => true,\n}, selectionLayer);\n"],"mappings":";;;;;;AAkBA,IAAaA,IAAgDC,EAAQ;CACnE,IAAI;CACJ,OAAO;CAIP,UAAU,EAAE,YAAY,uBAAuB;CAC/C,UAAU;EAAC;EAAa;EAAS;EAAY;EAAkB;CAAM;CACrE,SAAS;EACP,QAAQ;EACR,MAAM,GAAoB,GAAmC;GAC3D,IAAMC,IAAQC,EAAYC,GAAKC,CAAI;GACnC,IAAI,CAACH,GAAO,OAAO,CAAC;GACpB,IAAM,EAAE,YAAS,eAAYA,GACvBI,IAAOC,EAAQ,MAAM,UAAU,KAAK,GACtCC,IAAqB;IAAE,OAAO;IAAG,0BAAU,IAAI,IAAI;GAAE;GAEzD,OADAD,EAAQ,UAAU,MAAMA,EAAQ,WAAW,UAAU,GAC9C;IACL,MAAM;IACN,OAAO,GAA8B;KAEnC,AADA,IAAQE,EAAUF,GAASG,GAASC,CAAO,GAC3CL,EAAK,IAAIE,EAAM,QAAQ;IACzB;IACA,MAAM,GAAwB,GAAmC;KAC/D,IAAII,IAAY;KAChB,IAAI;MACF,AAAIC,MAAW,WAAU,IAAYC,EAAaP,GAASC,CAAK,IAC3DO,EAAkBR,EAAQ,WAAWA,EAAQ,UAAU;KAC9D,UAAU;MACR,EAAa;OAAE;OAAM,UAAUC,EAAM;OAAU,WAAWD,EAAQ;OAAW,KAAKA,EAAQ;OAAY,WAAWA,EAAQ;MAAU,GAAGK,CAAS;KACjJ;IACF;IACA,kBAAkBJ,EAAM,SAAS,KAAK;IACtC,cAAc,MAAeA,EAAM,SAAS,IAAIQ,CAAY,KAAK;GACnE;EACF;CACF;CACA,eAAe;AACjB,GAAGC,CAAc"}
@@ -0,0 +1,7 @@
1
+ import { DEFAULT_ROTATION_SNAP_STEP as e, snapRotationWithModifier as t } from "./snapRotation.js";
2
+ //#region src/interactions/actions/rotate/behaviors/index.ts
3
+ var n = Object.freeze([t()]);
4
+ //#endregion
5
+ export { n as DEFAULT_ROTATE_BEHAVIORS, e as DEFAULT_ROTATION_SNAP_STEP, t as snapRotationWithModifier };
6
+
7
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","names":["DEFAULT_ROTATE_BEHAVIORS","snapRotationWithModifier","DEFAULT_ROTATION_SNAP_STEP"],"sources":["../../../../../src/interactions/actions/rotate/behaviors/index.ts"],"sourcesContent":["export { DEFAULT_ROTATION_SNAP_STEP, snapRotationWithModifier } from './snapRotation';\n\nimport type { RotateBehavior } from '../../../gestures/types';\nimport { snapRotationWithModifier } from './snapRotation';\n\n/** The kit's standard rotate behaviors, applied when a rotate binding names\n * none: shift-drag snaps the angle to 15 degree steps. An explicit\n * `behaviors: []` opts out. Stateless, so one shared frozen instance is safe\n * across every gesture. */\nexport const DEFAULT_ROTATE_BEHAVIORS: readonly RotateBehavior<unknown>[] =\n Object.freeze([snapRotationWithModifier<unknown>()]);\n"],"mappings":";;AASA,IAAaA,IACX,OAAO,OAAO,CAACC,EAAkC,CAAC,CAAC"}
@@ -0,0 +1,12 @@
1
+ //#region src/interactions/actions/rotate/behaviors/snapRotation.ts
2
+ var e = Math.PI / 12;
3
+ function t(t = {}) {
4
+ let { key: n = "shift", step: r = e } = t;
5
+ return { onMove(e, { rotation: t }) {
6
+ if ((n === null || e.modifiers[n]) && r > 0) return { rotation: Math.round(t / r) * r };
7
+ } };
8
+ }
9
+ //#endregion
10
+ export { e as DEFAULT_ROTATION_SNAP_STEP, t as snapRotationWithModifier };
11
+
12
+ //# sourceMappingURL=snapRotation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"snapRotation.js","names":["DEFAULT_ROTATION_SNAP_STEP","snapRotationWithModifier","opts","key","ctx","step","rotation"],"sources":["../../../../../src/interactions/actions/rotate/behaviors/snapRotation.ts"],"sourcesContent":["import type { ModifierState, RotateBehavior } from '../../../gestures/types';\n\n/** The step {@link snapRotationWithModifier} snaps to by default: 15 degrees. */\nexport const DEFAULT_ROTATION_SNAP_STEP = Math.PI / 12;\n\n/**\n * Angle snap: rotate with `key` (default `'shift'`) held to land on a multiple\n * of `step` radians. What snaps is the angle the first rotated node ends at,\n * so a node already at 10 degrees goes to 15, 30, 45; the rest of a\n * multi-selection turns by the same amount. `key: null` snaps every move.\n */\nexport function snapRotationWithModifier<TPose>(opts: {\n key?: keyof ModifierState | null;\n step?: number;\n} = {}): RotateBehavior<TPose> {\n const { key = 'shift', step = DEFAULT_ROTATION_SNAP_STEP } = opts;\n return {\n onMove(ctx, { rotation }) {\n if (key !== null && !ctx.modifiers[key]) return;\n if (!(step > 0)) return;\n return { rotation: Math.round(rotation / step) * step };\n },\n };\n}\n"],"mappings":";AAGA,IAAaA,IAA6B,KAAK,KAAK;AAQpD,SAAgBC,EAAgC,IAG5C,CAAC,GAA0B;CAC7B,IAAM,EAAE,SAAM,SAAS,UAAOD,MAA+BE;CAC7D,OAAO,EACL,OAAO,GAAK,EAAE,eAAY;EACxB,KAAIC,MAAQ,QAASC,EAAI,UAAUD,OAC7BE,IAAO,GACb,OAAO,EAAE,UAAU,KAAK,MAAMC,IAAWD,CAAI,IAAIA,EAAK;CACxD,EACF;AACF"}
@@ -0,0 +1,40 @@
1
+ import { commitGestureOps as e, reduceBehaviorEnd as t } from "../gestureLifecycle.js";
2
+ import { createTransformOp as n } from "../../../core/ops/transform.js";
3
+ import { defaultCommitAdapter as r } from "../defaultCommitAdapter.js";
4
+ import { syncGestureCurrent as i } from "./frame.js";
5
+ //#region src/interactions/actions/rotate/commit.ts
6
+ function a(e, t, r, i) {
7
+ let a = [];
8
+ for (let o of e) {
9
+ let e = r.get(o);
10
+ if (e === void 0) continue;
11
+ let s = t.get(o);
12
+ s !== void 0 && a.push(n({
13
+ id: o,
14
+ from: s,
15
+ to: e,
16
+ label: i
17
+ }));
18
+ }
19
+ return a;
20
+ }
21
+ function o(n, o) {
22
+ let { lifecycle: s } = n, c = {
23
+ scene: n.scene,
24
+ applyOps: n.applyOps,
25
+ adapter: r(n.scene, n.selectionMethods)
26
+ };
27
+ if (n.behaviors.length > 0) {
28
+ i(n.gestureCtx, n.turn, o.delta);
29
+ let r = t(n.behaviors, n.gestureCtx);
30
+ if (r === null) return !1;
31
+ if (r !== void 0) return e(c, s, r);
32
+ }
33
+ if (o.delta === 0) return !1;
34
+ let l = a(n.ids, n.originPoses, o.previews, s.label);
35
+ return l.length !== 0 && e(c, s, l);
36
+ }
37
+ //#endregion
38
+ export { o as commitRotate, a as rotateOps };
39
+
40
+ //# sourceMappingURL=commit.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"commit.js","names":["rotateOps","ops","id","ids","next","previews","from","originPoses","createTransformOp","commitRotate","session","target","defaultCommitAdapter","frame","reduceBehaviorEnd","commitGestureOps","lifecycle"],"sources":["../../../../src/interactions/actions/rotate/commit.ts"],"sourcesContent":["import type { Op } from 'core/ops/types';\nimport { createTransformOp } from 'core/ops/transform';\nimport type { NodeId } from 'core/scene/types';\nimport { defaultCommitAdapter } from '../defaultCommitAdapter';\nimport { commitGestureOps, reduceBehaviorEnd } from '../gestureLifecycle';\nimport { syncGestureCurrent } from './frame';\nimport type { RotateFrame, RotateSession } from './session';\n\n/** One transform op per rotated node: `from` the pose stored at press, `to`\n * its preview. */\nexport function rotateOps(\n ids: readonly NodeId[],\n originPoses: ReadonlyMap<NodeId, unknown>,\n previews: ReadonlyMap<NodeId, unknown>,\n label: string,\n): Op[] {\n const ops: Op[] = [];\n for (const id of ids) {\n const next = previews.get(id);\n if (next === undefined) continue;\n const from = originPoses.get(id);\n if (from === undefined) continue;\n ops.push(createTransformOp<unknown>({ id: id as string, from, to: next, label }));\n }\n return ops;\n}\n\n/** Commit the drag as one batch, so one undo entry. Returns whether anything\n * reached the document. */\nexport function commitRotate(session: RotateSession, frame: RotateFrame): boolean {\n const { lifecycle } = session;\n const target = {\n scene: session.scene,\n applyOps: session.applyOps,\n adapter: defaultCommitAdapter(session.scene, session.selectionMethods),\n };\n if (session.behaviors.length > 0) {\n syncGestureCurrent(session.gestureCtx, session.turn, frame.delta);\n const r = reduceBehaviorEnd(session.behaviors, session.gestureCtx);\n if (r === null) return false;\n if (r !== undefined) return commitGestureOps(target, lifecycle, r);\n }\n if (frame.delta === 0) return false;\n const ops = rotateOps(session.ids, session.originPoses, frame.previews, lifecycle.label);\n if (ops.length === 0) return false;\n return commitGestureOps(target, lifecycle, ops);\n}\n"],"mappings":";;;;;AAUA,SAAgBA,EACd,GACA,GACA,GACA,GACM;CACN,IAAMC,IAAY,CAAC;CACnB,KAAK,IAAMC,KAAMC,GAAK;EACpB,IAAMC,IAAOC,EAAS,IAAIH,CAAE;EAC5B,IAAIE,MAAS,KAAA,GAAW;EACxB,IAAME,IAAOC,EAAY,IAAIL,CAAE;EAC/B,AAAII,MAAS,KAAA,KACbL,EAAI,KAAKO,EAA2B;GAAM;GAAc;GAAM,IAAIJ;GAAM;EAAM,CAAC,CAAC;CAClF;CACA,OAAOH;AACT;AAIA,SAAgBQ,EAAa,GAAwB,GAA6B;CAChF,IAAM,EAAE,iBAAcC,GAChBC,IAAS;EACb,OAAOD,EAAQ;EACf,UAAUA,EAAQ;EAClB,SAASE,EAAqBF,EAAQ,OAAOA,EAAQ,gBAAgB;CACvE;CACA,IAAIA,EAAQ,UAAU,SAAS,GAAG;EAChC,EAAmBA,EAAQ,YAAYA,EAAQ,MAAMG,EAAM,KAAK;EAChE,IAAM,IAAIC,EAAkBJ,EAAQ,WAAWA,EAAQ,UAAU;EACjE,IAAI,MAAM,MAAM,OAAO;EACvB,IAAI,MAAM,KAAA,GAAW,OAAOK,EAAiBJ,GAAQK,GAAW,CAAC;CACnE;CACA,IAAIH,EAAM,UAAU,GAAG,OAAO;CAC9B,IAAMZ,IAAMD,EAAUU,EAAQ,KAAKA,EAAQ,aAAaG,EAAM,UAAUG,EAAU,KAAK;CAEvF,OADIf,EAAI,WAAW,KACZc,EAAiBJ,GAAQK,GAAWf,CAAG;AAChD"}
@@ -0,0 +1,65 @@
1
+ import { translatePoseViaDescriptor as e } from "../../../core/geometry/poseDescriptor.js";
2
+ import { carryPose as t, planeOf as n } from "../planeInput.js";
3
+ import { pointerStateOf as r } from "../pointerState.js";
4
+ //#region src/interactions/actions/rotate/frame.ts
5
+ function i(t, n, r, i) {
6
+ let a = t.withRotation(n.world, n.rotation + r);
7
+ if (!i) return a;
8
+ let o = Math.cos(r), s = Math.sin(r), c = n.center.x - i.x, l = n.center.y - i.y, u = i.x + c * o - l * s, d = i.y + c * s + l * o;
9
+ return e(a, u - n.center.x, d - n.center.y, t);
10
+ }
11
+ function a(e, t) {
12
+ let n = /* @__PURE__ */ new Map(), r = e.useUnionPivot ? e.pivot : null;
13
+ for (let [a, o] of e.origins) n.set(a, i(e.descriptorOf(a), o, t, r));
14
+ return n;
15
+ }
16
+ function o(e, t, n) {
17
+ let r = a(t, n);
18
+ for (let [t, n] of r) e.current.set(t, n);
19
+ return r;
20
+ }
21
+ function s(e, t, n, i, a, s) {
22
+ n.modifiers = { ...a.modifiers }, n.pointer = r(a.world, a), n.view = i.view(), n.plane = i.plane();
23
+ let c = e.origins.keys().next().value, l = e.origins.get(c)?.rotation ?? 0, u = s, d = {
24
+ pose: o(n, e, s).get(c),
25
+ rotation: l + s
26
+ };
27
+ for (let r of t) {
28
+ let t = r.onMove?.(n, d);
29
+ if (!t) continue;
30
+ if (t.rotation !== void 0) {
31
+ u = t.rotation - l, d = {
32
+ pose: o(n, e, u).get(c),
33
+ rotation: t.rotation
34
+ };
35
+ continue;
36
+ }
37
+ if (t.pose === void 0) continue;
38
+ let i = e.descriptorOf(c).getRotation?.(t.pose) ?? 0;
39
+ u = i - l, d = {
40
+ pose: t.pose,
41
+ rotation: i
42
+ };
43
+ }
44
+ return u;
45
+ }
46
+ function c(e, r) {
47
+ let i = /* @__PURE__ */ new Map();
48
+ if (r === 0) return i;
49
+ for (let [o, s] of a(e.turn, r)) {
50
+ let r = e.scene.get(o)?.layer, a = r === void 0 ? null : n(e.view, r);
51
+ i.set(o, e.poseFrame.local(o, t(e.turn.descriptorOf(o), s, a)));
52
+ }
53
+ return i;
54
+ }
55
+ function l(e, t, n) {
56
+ let { pivot: r } = e.turn, i = Math.atan2(n.world.y - r.y, n.world.x - r.x) - e.startPointerAngle, a = e.behaviors.length > 0 ? s(e.turn, e.behaviors, e.gestureCtx, t, n, i) : i;
57
+ return {
58
+ delta: a,
59
+ previews: c(e, a)
60
+ };
61
+ }
62
+ //#endregion
63
+ export { l as nextFrame, o as syncGestureCurrent, a as turnedWorlds };
64
+
65
+ //# sourceMappingURL=frame.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"frame.js","names":["turnPose","rotated","d","origin","delta","pivot","cos","sin","ox","oy","nx","ny","translatePoseViaDescriptor","turnedWorlds","out","turn","id","syncGestureCurrent","turned","pose","shapeDelta","moveCtx","pointerStateOf","readers","primary","originRotation","raw","proposed","gctx","b","behaviors","r","rotation","storedPreviews","previews","session","layer","own","planeOf","carryPose","nextFrame"],"sources":["../../../../src/interactions/actions/rotate/frame.ts"],"sourcesContent":["import type { InvocationCtx } from '@weasel-js/routing';\nimport { pointerStateOf } from '../pointerState';\nimport type { NodeId } from 'core/scene/types';\nimport type { GestureReaders } from '../../gestures/shared/screenTolerance';\nimport type { GestureContext, RotateBehavior, RotateProposed } from '../../gestures/types';\nimport { carryPose, planeOf } from '../planeInput';\nimport { translatePoseViaDescriptor, type PoseDescriptor } from '../resize/geometry';\nimport type { RotateFrame, RotateSession, Turn, TurnOrigin } from './session';\n\n/** `origin` turned by `delta` radians, its center orbiting `pivot` when one\n * is given. */\nfunction turnPose(\n d: PoseDescriptor<unknown>,\n origin: TurnOrigin,\n delta: number,\n pivot: { x: number; y: number } | null,\n): unknown {\n const rotated = d.withRotation!(origin.world, origin.rotation + delta);\n if (!pivot) return rotated;\n const cos = Math.cos(delta);\n const sin = Math.sin(delta);\n const ox = origin.center.x - pivot.x;\n const oy = origin.center.y - pivot.y;\n const nx = pivot.x + ox * cos - oy * sin;\n const ny = pivot.y + ox * sin + oy * cos;\n return translatePoseViaDescriptor(rotated, nx - origin.center.x, ny - origin.center.y, d);\n}\n\n/** Each rotated node's world pose turned by `delta`. */\nexport function turnedWorlds(turn: Turn, delta: number): Map<NodeId, unknown> {\n const out = new Map<NodeId, unknown>();\n const pivot = turn.useUnionPivot ? turn.pivot : null;\n for (const [id, origin] of turn.origins) {\n out.set(id, turnPose(turn.descriptorOf(id), origin, delta, pivot));\n }\n return out;\n}\n\n/** Write the poses a turn by `delta` gives into `gctx.current`. */\nexport function syncGestureCurrent(\n gctx: GestureContext<unknown>,\n turn: Turn,\n delta: number,\n): Map<NodeId, unknown> {\n const turned = turnedWorlds(turn, delta);\n for (const [id, pose] of turned) gctx.current.set(id as string, pose);\n return turned;\n}\n\n/** The pointer's delta as the behaviors reshape it. */\nfunction shapeDelta(\n turn: Turn,\n behaviors: readonly RotateBehavior<unknown>[],\n gctx: GestureContext<unknown>,\n readers: GestureReaders,\n moveCtx: InvocationCtx,\n raw: number,\n): number {\n gctx.modifiers = { ...moveCtx.modifiers };\n gctx.pointer = pointerStateOf(moveCtx.world, moveCtx);\n gctx.view = readers.view();\n gctx.plane = readers.plane();\n const primary = turn.origins.keys().next().value as NodeId;\n const originRotation = turn.origins.get(primary)?.rotation ?? 0;\n let delta = raw;\n let proposed: RotateProposed<unknown> = {\n pose: syncGestureCurrent(gctx, turn, raw).get(primary),\n rotation: originRotation + raw,\n };\n for (const b of behaviors) {\n const r = b.onMove?.(gctx, proposed);\n if (!r) continue;\n if (r.rotation !== undefined) {\n delta = r.rotation - originRotation;\n proposed = { pose: syncGestureCurrent(gctx, turn, delta).get(primary), rotation: r.rotation };\n continue;\n }\n if (r.pose === undefined) continue;\n const rotation = turn.descriptorOf(primary).getRotation?.(r.pose) ?? 0;\n delta = rotation - originRotation;\n proposed = { pose: r.pose, rotation };\n }\n return delta;\n}\n\n/** Every rotated id's stored pose under a turn by `delta`; none at zero. */\nfunction storedPreviews(\n session: Pick<RotateSession, 'scene' | 'turn' | 'poseFrame' | 'view'>,\n delta: number,\n): Map<NodeId, unknown> {\n const previews = new Map<NodeId, unknown>();\n if (delta === 0) return previews;\n for (const [id, turned] of turnedWorlds(session.turn, delta)) {\n const layer = session.scene.get(id)?.layer;\n const own = layer === undefined ? null : planeOf(session.view, layer);\n previews.set(id, session.poseFrame.local(id, carryPose(session.turn.descriptorOf(id), turned, own)));\n }\n return previews;\n}\n\n/** One move's delta and previews: the pointer's angle since press as the\n * behaviors shaped it, and every rotated id's stored pose under it. */\nexport function nextFrame(session: RotateSession, readers: GestureReaders, moveCtx: InvocationCtx): RotateFrame {\n const { pivot } = session.turn;\n const pointerAngle = Math.atan2(moveCtx.world.y - pivot.y, moveCtx.world.x - pivot.x);\n const raw = pointerAngle - session.startPointerAngle;\n const delta = session.behaviors.length > 0\n ? shapeDelta(session.turn, session.behaviors, session.gestureCtx, readers, moveCtx, raw)\n : raw;\n return { delta, previews: storedPreviews(session, delta) };\n}\n"],"mappings":"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"}