@weasel-js/core 1.9.4 → 1.10.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (1191) hide show
  1. package/CHANGELOG.md +918 -0
  2. package/README.md +38 -3
  3. package/dist/WeaselProvider.js +5 -7
  4. package/dist/WeaselProvider.js.map +1 -1
  5. package/dist/affordances/composeAffordanceLayer.js +92 -84
  6. package/dist/affordances/composeAffordanceLayer.js.map +1 -1
  7. package/dist/affordances/cornerResize.js +3 -2
  8. package/dist/affordances/cornerResize.js.map +1 -1
  9. package/dist/affordances/hitAffordanceRegions.js +71 -101
  10. package/dist/affordances/hitAffordanceRegions.js.map +1 -1
  11. package/dist/affordances/pathAnchors.js +50 -28
  12. package/dist/affordances/pathAnchors.js.map +1 -1
  13. package/dist/affordances/rotateCursor.js +12 -0
  14. package/dist/affordances/rotateCursor.js.map +1 -0
  15. package/dist/affordances/rotationHandle.js +44 -46
  16. package/dist/affordances/rotationHandle.js.map +1 -1
  17. package/dist/animation/behaviors/coast.js +21 -0
  18. package/dist/animation/behaviors/coast.js.map +1 -0
  19. package/dist/animation/behaviors/coastByWrite.js +107 -0
  20. package/dist/animation/behaviors/coastByWrite.js.map +1 -0
  21. package/dist/animation/behaviors/coastOnTargets.js +94 -0
  22. package/dist/animation/behaviors/coastOnTargets.js.map +1 -0
  23. package/dist/animation/behaviors/momentum.js +48 -136
  24. package/dist/animation/behaviors/momentum.js.map +1 -1
  25. package/dist/animation/clipTargets.js +12 -0
  26. package/dist/animation/clipTargets.js.map +1 -0
  27. package/dist/animation/index.js +15 -20
  28. package/dist/animation/poseHelpers.js +112 -33
  29. package/dist/animation/poseHelpers.js.map +1 -1
  30. package/dist/animation/poseTarget.js +115 -0
  31. package/dist/animation/poseTarget.js.map +1 -0
  32. package/dist/animation/reflow.js +113 -83
  33. package/dist/animation/reflow.js.map +1 -1
  34. package/dist/animation/rewind.js +66 -0
  35. package/dist/animation/rewind.js.map +1 -0
  36. package/dist/animation/rig/bindRig.js +85 -53
  37. package/dist/animation/rig/bindRig.js.map +1 -1
  38. package/dist/animation/rig/rigNode.js +99 -0
  39. package/dist/animation/rig/rigNode.js.map +1 -0
  40. package/dist/animation/rig/rigSeat.js +59 -0
  41. package/dist/animation/rig/rigSeat.js.map +1 -0
  42. package/dist/animation/rig/skinBinding.js +64 -0
  43. package/dist/animation/rig/skinBinding.js.map +1 -0
  44. package/dist/animation/rig/useRig.js +31 -16
  45. package/dist/animation/rig/useRig.js.map +1 -1
  46. package/dist/animation/wrappers/animateLifecycle.js +8 -7
  47. package/dist/animation/wrappers/animateLifecycle.js.map +1 -1
  48. package/dist/animation/wrappers/animateOnSetPose.js +31 -31
  49. package/dist/animation/wrappers/animateOnSetPose.js.map +1 -1
  50. package/dist/animation/wrappers/instantPose.js.map +1 -1
  51. package/dist/animation/writtenPoseTarget.js +33 -0
  52. package/dist/animation/writtenPoseTarget.js.map +1 -0
  53. package/dist/autoPoseDescriptor-DHg5KqaJ.d.ts +27 -0
  54. package/dist/barrel/canvas.js +32 -0
  55. package/dist/barrel/chrome.js +10 -10
  56. package/dist/barrel/input.js +16 -17
  57. package/dist/barrel/interactions.js +34 -37
  58. package/dist/barrel/paint.js +11 -18
  59. package/dist/barrel/paths.js +13 -19
  60. package/dist/barrel/renderer.js +14 -20
  61. package/dist/barrel/routing.js +54 -47
  62. package/dist/barrel/scene.js +37 -0
  63. package/dist/barrel/text.js +9 -18
  64. package/dist/barrel/viewport.js +44 -51
  65. package/dist/canvas/Canvas.js +270 -475
  66. package/dist/canvas/Canvas.js.map +1 -1
  67. package/dist/canvas/CanvasView.js +168 -190
  68. package/dist/canvas/CanvasView.js.map +1 -1
  69. package/dist/canvas/CursorCoordsHud.js +24 -25
  70. package/dist/canvas/CursorCoordsHud.js.map +1 -1
  71. package/dist/canvas/DrawCanvas.js +39 -56
  72. package/dist/canvas/DrawCanvas.js.map +1 -1
  73. package/dist/canvas/ModalityHud.js.map +1 -1
  74. package/dist/canvas/NodeShape.js +28 -29
  75. package/dist/canvas/NodeShape.js.map +1 -1
  76. package/dist/canvas/PickHud.js.map +1 -1
  77. package/dist/canvas/SceneCanvas/DevHuds.js +40 -0
  78. package/dist/canvas/SceneCanvas/DevHuds.js.map +1 -0
  79. package/dist/canvas/SceneCanvas/GestureDispatcherMounter.js +66 -107
  80. package/dist/canvas/SceneCanvas/GestureDispatcherMounter.js.map +1 -1
  81. package/dist/canvas/SceneCanvas/PointerProviderIfRoot.js +33 -36
  82. package/dist/canvas/SceneCanvas/PointerProviderIfRoot.js.map +1 -1
  83. package/dist/canvas/SceneCanvas/StandardActionsRegistrar.js +38 -50
  84. package/dist/canvas/SceneCanvas/StandardActionsRegistrar.js.map +1 -1
  85. package/dist/canvas/SceneCanvas/ToolKeybindingsMounter.js +3 -3
  86. package/dist/canvas/SceneCanvas/ToolKeybindingsMounter.js.map +1 -1
  87. package/dist/canvas/SceneCanvas/coordTrace.js +37 -1
  88. package/dist/canvas/SceneCanvas/coordTrace.js.map +1 -1
  89. package/dist/canvas/SceneCanvas/defaultNodeProperties.js +319 -270
  90. package/dist/canvas/SceneCanvas/defaultNodeProperties.js.map +1 -1
  91. package/dist/canvas/SceneCanvas/defaultNodeRouting.js +1 -1
  92. package/dist/canvas/SceneCanvas/defaultNodeRouting.js.map +1 -1
  93. package/dist/canvas/SceneCanvas/dispatcherGestureBounds.js.map +1 -1
  94. package/dist/canvas/SceneCanvas/features.js +71 -62
  95. package/dist/canvas/SceneCanvas/features.js.map +1 -1
  96. package/dist/canvas/SceneCanvas/insertPreviewCommands.js +97 -0
  97. package/dist/canvas/SceneCanvas/insertPreviewCommands.js.map +1 -0
  98. package/dist/canvas/SceneCanvas/isDev.js.map +1 -1
  99. package/dist/canvas/SceneCanvas/poseGeometry.js +33 -37
  100. package/dist/canvas/SceneCanvas/poseGeometry.js.map +1 -1
  101. package/dist/canvas/SceneCanvas/props.js +15 -14
  102. package/dist/canvas/SceneCanvas/props.js.map +1 -1
  103. package/dist/canvas/SceneCanvas/scenePointQuery.js +50 -0
  104. package/dist/canvas/SceneCanvas/scenePointQuery.js.map +1 -0
  105. package/dist/canvas/SceneCanvas/shapeGeneratorProperties.js +52 -0
  106. package/dist/canvas/SceneCanvas/shapeGeneratorProperties.js.map +1 -0
  107. package/dist/canvas/SceneCanvas/toolRegistry.js +23 -0
  108. package/dist/canvas/SceneCanvas/toolRegistry.js.map +1 -0
  109. package/dist/canvas/SceneCanvas/useActionTunings.js +17 -0
  110. package/dist/canvas/SceneCanvas/useActionTunings.js.map +1 -0
  111. package/dist/canvas/SceneCanvas/useActionsPropResolver.js +6 -1
  112. package/dist/canvas/SceneCanvas/useActionsPropResolver.js.map +1 -1
  113. package/dist/canvas/SceneCanvas/useBuiltinShapeTools.js.map +1 -1
  114. package/dist/canvas/SceneCanvas/useBuiltinTools.js +21 -0
  115. package/dist/canvas/SceneCanvas/useBuiltinTools.js.map +1 -0
  116. package/dist/canvas/SceneCanvas/useCanvasCamera.js +46 -0
  117. package/dist/canvas/SceneCanvas/useCanvasCamera.js.map +1 -0
  118. package/dist/canvas/SceneCanvas/useCanvasDispatcher.js +20 -0
  119. package/dist/canvas/SceneCanvas/useCanvasDispatcher.js.map +1 -0
  120. package/dist/canvas/SceneCanvas/useCanvasSelection.js +16 -0
  121. package/dist/canvas/SceneCanvas/useCanvasSelection.js.map +1 -0
  122. package/dist/canvas/SceneCanvas/useCanvasTools.js +67 -0
  123. package/dist/canvas/SceneCanvas/useCanvasTools.js.map +1 -0
  124. package/dist/canvas/SceneCanvas/useDispatcherOverlayLayer.js +49 -113
  125. package/dist/canvas/SceneCanvas/useDispatcherOverlayLayer.js.map +1 -1
  126. package/dist/canvas/SceneCanvas/useHeldModifiers.js +20 -0
  127. package/dist/canvas/SceneCanvas/useHeldModifiers.js.map +1 -0
  128. package/dist/canvas/SceneCanvas/useNodeAtPoint.js +26 -0
  129. package/dist/canvas/SceneCanvas/useNodeAtPoint.js.map +1 -0
  130. package/dist/canvas/SceneCanvas/useNodeKinds.js +26 -0
  131. package/dist/canvas/SceneCanvas/useNodeKinds.js.map +1 -0
  132. package/dist/canvas/SceneCanvas/usePreviewGhostLayer.js +51 -41
  133. package/dist/canvas/SceneCanvas/usePreviewGhostLayer.js.map +1 -1
  134. package/dist/canvas/SceneCanvas/useSceneCanvasHandle.js +47 -0
  135. package/dist/canvas/SceneCanvas/useSceneCanvasHandle.js.map +1 -0
  136. package/dist/canvas/SceneCanvas/useSceneCanvasLayers.js +66 -0
  137. package/dist/canvas/SceneCanvas/useSceneCanvasLayers.js.map +1 -0
  138. package/dist/canvas/SceneCanvas/useSceneChrome.js +59 -0
  139. package/dist/canvas/SceneCanvas/useSceneChrome.js.map +1 -0
  140. package/dist/canvas/SceneCanvas/useSceneRedrawSources.js +23 -0
  141. package/dist/canvas/SceneCanvas/useSceneRedrawSources.js.map +1 -0
  142. package/dist/canvas/SceneCanvas/useSceneSelectTool.js +65 -101
  143. package/dist/canvas/SceneCanvas/useSceneSelectTool.js.map +1 -1
  144. package/dist/canvas/SceneCanvas/useSceneSlotLayers.js +37 -0
  145. package/dist/canvas/SceneCanvas/useSceneSlotLayers.js.map +1 -0
  146. package/dist/canvas/SceneCanvas/useSelectionOverlayLayer.js +38 -0
  147. package/dist/canvas/SceneCanvas/useSelectionOverlayLayer.js.map +1 -0
  148. package/dist/canvas/SceneCanvas/useViewLayerGate.js +20 -0
  149. package/dist/canvas/SceneCanvas/useViewLayerGate.js.map +1 -0
  150. package/dist/canvas/SceneCanvas/useViewportActions.js +9 -1
  151. package/dist/canvas/SceneCanvas/useViewportActions.js.map +1 -1
  152. package/dist/canvas/SceneCanvas/worldPointAt.js +8 -0
  153. package/dist/canvas/SceneCanvas/worldPointAt.js.map +1 -0
  154. package/dist/canvas/SceneCanvas.js +301 -708
  155. package/dist/canvas/SceneCanvas.js.map +1 -1
  156. package/dist/canvas/SceneViewCanvas.js +41 -47
  157. package/dist/canvas/SceneViewCanvas.js.map +1 -1
  158. package/dist/canvas/SurfaceCanvas.js +40 -0
  159. package/dist/canvas/SurfaceCanvas.js.map +1 -0
  160. package/dist/canvas/adapterDerivedPath.js +26 -0
  161. package/dist/canvas/adapterDerivedPath.js.map +1 -0
  162. package/dist/canvas/adapterPickSource.js +34 -0
  163. package/dist/canvas/adapterPickSource.js.map +1 -0
  164. package/dist/canvas/affordanceAt.js +12 -2
  165. package/dist/canvas/affordanceAt.js.map +1 -1
  166. package/dist/canvas/buildSceneLayer.js +81 -61
  167. package/dist/canvas/buildSceneLayer.js.map +1 -1
  168. package/dist/canvas/buildSceneTree.js +56 -34
  169. package/dist/canvas/buildSceneTree.js.map +1 -1
  170. package/dist/canvas/canvasRenderer.js +40 -44
  171. package/dist/canvas/canvasRenderer.js.map +1 -1
  172. package/dist/canvas/colorOverrides.js.map +1 -1
  173. package/dist/canvas/copiesAbove.js +27 -0
  174. package/dist/canvas/copiesAbove.js.map +1 -0
  175. package/dist/canvas/defaultDrawOne.js +25 -24
  176. package/dist/canvas/defaultDrawOne.js.map +1 -1
  177. package/dist/canvas/deps/areaSelect.js +4 -4
  178. package/dist/canvas/deps/areaSelect.js.map +1 -1
  179. package/dist/canvas/deps/debug.js.map +1 -1
  180. package/dist/canvas/deps/editAnchors.js +47 -71
  181. package/dist/canvas/deps/editAnchors.js.map +1 -1
  182. package/dist/canvas/deps/geometryProjection.js.map +1 -1
  183. package/dist/canvas/deps/hitTestArea.js +45 -25
  184. package/dist/canvas/deps/hitTestArea.js.map +1 -1
  185. package/dist/canvas/deps/insert.js +149 -104
  186. package/dist/canvas/deps/insert.js.map +1 -1
  187. package/dist/canvas/deps/lassoSelect.js +5 -5
  188. package/dist/canvas/deps/lassoSelect.js.map +1 -1
  189. package/dist/canvas/deps/layout.js +9 -15
  190. package/dist/canvas/deps/layout.js.map +1 -1
  191. package/dist/canvas/deps/poseDescriptor.js +1 -1
  192. package/dist/canvas/deps/poseDescriptor.js.map +1 -1
  193. package/dist/canvas/deps/resizePolicy.js.map +1 -1
  194. package/dist/canvas/deps/slice.js +44 -45
  195. package/dist/canvas/deps/slice.js.map +1 -1
  196. package/dist/canvas/deps/textEdit.js +8 -8
  197. package/dist/canvas/deps/textEdit.js.map +1 -1
  198. package/dist/canvas/deps/view.js.map +1 -1
  199. package/dist/canvas/derivedPath.js +69 -43
  200. package/dist/canvas/derivedPath.js.map +1 -1
  201. package/dist/canvas/drawEnvelope.js +8 -4
  202. package/dist/canvas/drawEnvelope.js.map +1 -1
  203. package/dist/canvas/getNodeAtPoint.js +2 -6
  204. package/dist/canvas/getNodeAtPoint.js.map +1 -1
  205. package/dist/canvas/hud.module.js.map +1 -1
  206. package/dist/canvas/insertPreviewExtent.js +33 -31
  207. package/dist/canvas/insertPreviewExtent.js.map +1 -1
  208. package/dist/canvas/layerOrder.js.map +1 -1
  209. package/dist/canvas/layerSlots.js +6 -1
  210. package/dist/canvas/layerSlots.js.map +1 -1
  211. package/dist/canvas/nodeShapes/derivedPainter.js +12 -12
  212. package/dist/canvas/nodeShapes/derivedPainter.js.map +1 -1
  213. package/dist/canvas/nodeShapes/imagePainter.js +10 -10
  214. package/dist/canvas/nodeShapes/imagePainter.js.map +1 -1
  215. package/dist/canvas/nodeShapes/memo.js.map +1 -1
  216. package/dist/canvas/nodeShapes/nodePaint.js +34 -23
  217. package/dist/canvas/nodeShapes/nodePaint.js.map +1 -1
  218. package/dist/canvas/nodeShapes/pathPainter.js +23 -22
  219. package/dist/canvas/nodeShapes/pathPainter.js.map +1 -1
  220. package/dist/canvas/nodeShapes/poseBox.js +6 -6
  221. package/dist/canvas/nodeShapes/poseBox.js.map +1 -1
  222. package/dist/canvas/nodeShapes/rectFallbackPainter.js +8 -8
  223. package/dist/canvas/nodeShapes/rectFallbackPainter.js.map +1 -1
  224. package/dist/canvas/nodeShapes/shapePainter.js +16 -16
  225. package/dist/canvas/nodeShapes/shapePainter.js.map +1 -1
  226. package/dist/canvas/nodeShapes/textPainter.js +1 -1
  227. package/dist/canvas/nodeShapes/textPainter.js.map +1 -1
  228. package/dist/canvas/overChildren.js +29 -0
  229. package/dist/canvas/overChildren.js.map +1 -0
  230. package/dist/canvas/overlayRoleStrokes.js.map +1 -1
  231. package/dist/canvas/paintCull.js +6 -8
  232. package/dist/canvas/paintCull.js.map +1 -1
  233. package/dist/{features/cursor → canvas}/paintedCursorLayer.js +2 -2
  234. package/dist/canvas/paintedCursorLayer.js.map +1 -0
  235. package/dist/canvas/pickReach.js +23 -0
  236. package/dist/canvas/pickReach.js.map +1 -0
  237. package/dist/canvas/pickWalk.js +43 -70
  238. package/dist/canvas/pickWalk.js.map +1 -1
  239. package/dist/canvas/planeClips.js +18 -19
  240. package/dist/canvas/planeClips.js.map +1 -1
  241. package/dist/canvas/poseCascade.js +41 -0
  242. package/dist/canvas/poseCascade.js.map +1 -0
  243. package/dist/canvas/poseRotation.js +1 -3
  244. package/dist/canvas/poseRotation.js.map +1 -1
  245. package/dist/canvas/rasterReadback.js +22 -0
  246. package/dist/canvas/rasterReadback.js.map +1 -0
  247. package/dist/canvas/renderDebugSnapshot.js +12 -12
  248. package/dist/canvas/renderDebugSnapshot.js.map +1 -1
  249. package/dist/canvas/renderNeeds.js +3 -3
  250. package/dist/canvas/renderNeeds.js.map +1 -1
  251. package/dist/canvas/renderSceneToPixels.js +64 -83
  252. package/dist/canvas/renderSceneToPixels.js.map +1 -1
  253. package/dist/canvas/sceneAdapter.js +59 -144
  254. package/dist/canvas/sceneAdapter.js.map +1 -1
  255. package/dist/canvas/sceneClipboard.js +1 -1
  256. package/dist/canvas/sceneClipboard.js.map +1 -1
  257. package/dist/canvas/sceneLayerPaint.js +4 -4
  258. package/dist/canvas/sceneLayerPaint.js.map +1 -1
  259. package/dist/canvas/sceneSlotWiring.js +10 -9
  260. package/dist/canvas/sceneSlotWiring.js.map +1 -1
  261. package/dist/canvas/sceneViewRender.js +37 -42
  262. package/dist/canvas/sceneViewRender.js.map +1 -1
  263. package/dist/canvas/slopsDebugLayer.js +4 -4
  264. package/dist/canvas/slopsDebugLayer.js.map +1 -1
  265. package/dist/canvas/useCanvasRenderer.js +23 -11
  266. package/dist/canvas/useCanvasRenderer.js.map +1 -1
  267. package/dist/canvas/useCanvasSurface.js +31 -0
  268. package/dist/canvas/useCanvasSurface.js.map +1 -0
  269. package/dist/canvas/useCanvasView.js +51 -44
  270. package/dist/canvas/useCanvasView.js.map +1 -1
  271. package/dist/canvas/useFrameLoop.js +11 -12
  272. package/dist/canvas/useFrameLoop.js.map +1 -1
  273. package/dist/canvas/useHostAnchor.js +35 -33
  274. package/dist/canvas/useHostAnchor.js.map +1 -1
  275. package/dist/canvas/useLateContentRedraw.js +8 -8
  276. package/dist/canvas/useLateContentRedraw.js.map +1 -1
  277. package/dist/canvas/useSceneAdapter.js +22 -0
  278. package/dist/canvas/useSceneAdapter.js.map +1 -0
  279. package/dist/canvas/useSceneLayerList.js +4 -14
  280. package/dist/canvas/useSceneLayerList.js.map +1 -1
  281. package/dist/canvas/useSurfaceInput.js +39 -0
  282. package/dist/canvas/useSurfaceInput.js.map +1 -0
  283. package/dist/canvas/useToolCursor.js +29 -0
  284. package/dist/canvas/useToolCursor.js.map +1 -0
  285. package/dist/canvas/useViewHelpers.js +46 -85
  286. package/dist/canvas/useViewHelpers.js.map +1 -1
  287. package/dist/canvas/viewInputs.js.map +1 -1
  288. package/dist/canvas/viewRegistry.js +40 -34
  289. package/dist/canvas/viewRegistry.js.map +1 -1
  290. package/dist/canvas/watchElementMove.js +43 -0
  291. package/dist/canvas/watchElementMove.js.map +1 -0
  292. package/dist/canvas/wrapNodeOutput.js +7 -2
  293. package/dist/canvas/wrapNodeOutput.js.map +1 -1
  294. package/dist/clipboard.d.ts +7 -14
  295. package/dist/{types-B4iJRHC3.d.ts → clone-C0eADtS0.d.ts} +129 -84
  296. package/dist/clone.d.ts +4 -8
  297. package/dist/clone.js +0 -2
  298. package/dist/core/device/targets.js.map +1 -1
  299. package/dist/core/device/useDeviceProfile.js +13 -13
  300. package/dist/core/device/useDeviceProfile.js.map +1 -1
  301. package/dist/{interactions/actions/resize → core/geometry}/autoPoseDescriptor.js +8 -7
  302. package/dist/core/geometry/autoPoseDescriptor.js.map +1 -0
  303. package/dist/core/geometry/pathPoseDescriptor.js +88 -0
  304. package/dist/core/geometry/pathPoseDescriptor.js.map +1 -0
  305. package/dist/core/geometry/poseDescriptor.js +102 -29
  306. package/dist/core/geometry/poseDescriptor.js.map +1 -1
  307. package/dist/core/geometry/regionHit.js +35 -37
  308. package/dist/core/geometry/regionHit.js.map +1 -1
  309. package/dist/core/geometry/targetFrame.js +94 -0
  310. package/dist/core/geometry/targetFrame.js.map +1 -0
  311. package/dist/core/geometry/unionBounds.js +4 -5
  312. package/dist/core/geometry/unionBounds.js.map +1 -1
  313. package/dist/core/layers/backgroundFill.js +31 -0
  314. package/dist/core/layers/backgroundFill.js.map +1 -0
  315. package/dist/{features/groups → core/layers}/children.js +2 -4
  316. package/dist/core/layers/children.js.map +1 -0
  317. package/dist/{features/focus → core/layers}/gateLayer.js +2 -2
  318. package/dist/core/layers/gateLayer.js.map +1 -0
  319. package/dist/core/layers/layerGroup.js +40 -0
  320. package/dist/core/layers/layerGroup.js.map +1 -0
  321. package/dist/core/layers/render.js +50 -76
  322. package/dist/core/layers/render.js.map +1 -1
  323. package/dist/core/ops/create.js +2 -2
  324. package/dist/core/ops/create.js.map +1 -1
  325. package/dist/core/ops/createHistory.js +9 -9
  326. package/dist/core/ops/createHistory.js.map +1 -1
  327. package/dist/core/ops/delete.js +19 -23
  328. package/dist/core/ops/delete.js.map +1 -1
  329. package/dist/core/ops/reorder/index.js +3 -7
  330. package/dist/core/ops/reorder/index.js.map +1 -1
  331. package/dist/core/ops/reorder/setChildOrder.js +2 -4
  332. package/dist/core/ops/reorder/setChildOrder.js.map +1 -1
  333. package/dist/core/ops/reparent.js +0 -1
  334. package/dist/core/ops/reparent.js.map +1 -1
  335. package/dist/core/ops/slot.js +3 -6
  336. package/dist/core/ops/slot.js.map +1 -1
  337. package/dist/core/pages/fitViewToPage.js +15 -0
  338. package/dist/core/pages/fitViewToPage.js.map +1 -0
  339. package/dist/core/pages/pages.js +65 -0
  340. package/dist/core/pages/pages.js.map +1 -0
  341. package/dist/core/pages/pagesLayer.js +27 -0
  342. package/dist/core/pages/pagesLayer.js.map +1 -0
  343. package/dist/core/paint/meshKind.js +16 -0
  344. package/dist/core/paint/meshKind.js.map +1 -0
  345. package/dist/{features/meshPaint/lazyKind.js → core/paint/meshKindLazy.js} +104 -93
  346. package/dist/core/paint/meshKindLazy.js.map +1 -0
  347. package/dist/core/paint/paintKindEntry.js +8 -0
  348. package/dist/core/paint/paintKindEntry.js.map +1 -0
  349. package/dist/core/paint/paintKinds.js +144 -0
  350. package/dist/core/paint/paintKinds.js.map +1 -0
  351. package/dist/core/paint/registerMesh.js +7 -0
  352. package/dist/core/paint/registerMesh.js.map +1 -0
  353. package/dist/core/scene/NodeProperties.js.map +1 -1
  354. package/dist/core/scene/NodeRouting.js.map +1 -1
  355. package/dist/core/scene/arrivalWindow.js +65 -64
  356. package/dist/core/scene/arrivalWindow.js.map +1 -1
  357. package/dist/core/scene/boundOps.js +40 -0
  358. package/dist/core/scene/boundOps.js.map +1 -0
  359. package/dist/core/scene/composeFrame.js +9 -6
  360. package/dist/core/scene/composeFrame.js.map +1 -1
  361. package/dist/core/scene/composePose.js +105 -0
  362. package/dist/core/scene/composePose.js.map +1 -0
  363. package/dist/core/scene/depMemo.js +31 -6
  364. package/dist/core/scene/depMemo.js.map +1 -1
  365. package/dist/core/scene/derivedPath.js +19 -20
  366. package/dist/core/scene/derivedPath.js.map +1 -1
  367. package/dist/core/scene/editMode.js +26 -0
  368. package/dist/core/scene/editMode.js.map +1 -0
  369. package/dist/core/scene/effectivePose.js +42 -39
  370. package/dist/core/scene/effectivePose.js.map +1 -1
  371. package/dist/core/scene/fieldEdits.js +98 -0
  372. package/dist/core/scene/fieldEdits.js.map +1 -0
  373. package/dist/core/scene/historyFacade.js +122 -70
  374. package/dist/core/scene/historyFacade.js.map +1 -1
  375. package/dist/core/scene/historyForm.js +6 -0
  376. package/dist/core/scene/historyForm.js.map +1 -0
  377. package/dist/core/scene/kitOps.js +83 -71
  378. package/dist/core/scene/kitOps.js.map +1 -1
  379. package/dist/core/scene/kitRegistry.js.map +1 -1
  380. package/dist/core/scene/layerStack.js +105 -12
  381. package/dist/core/scene/layerStack.js.map +1 -1
  382. package/dist/core/scene/layoutPass.js +58 -59
  383. package/dist/core/scene/layoutPass.js.map +1 -1
  384. package/dist/{features/groups → core/scene}/nestedHit.js +3 -3
  385. package/dist/core/scene/nestedHit.js.map +1 -0
  386. package/dist/core/scene/nodeFnFields.js +16 -9
  387. package/dist/core/scene/nodeFnFields.js.map +1 -1
  388. package/dist/core/scene/nodeMemo.js.map +1 -1
  389. package/dist/core/scene/nodeStore.js +72 -71
  390. package/dist/core/scene/nodeStore.js.map +1 -1
  391. package/dist/core/scene/notifier.js +37 -0
  392. package/dist/core/scene/notifier.js.map +1 -0
  393. package/dist/core/scene/opTable.js +50 -0
  394. package/dist/core/scene/opTable.js.map +1 -0
  395. package/dist/core/scene/outerOps.js +67 -0
  396. package/dist/core/scene/outerOps.js.map +1 -0
  397. package/dist/core/scene/poseHold.js +39 -0
  398. package/dist/core/scene/poseHold.js.map +1 -0
  399. package/dist/core/scene/poseOverrides.js +44 -36
  400. package/dist/core/scene/poseOverrides.js.map +1 -1
  401. package/dist/core/scene/poseSnapshot.js.map +1 -1
  402. package/dist/core/scene/reconcileSpecs.js +4 -3
  403. package/dist/core/scene/reconcileSpecs.js.map +1 -1
  404. package/dist/core/scene/recorder.js +86 -0
  405. package/dist/core/scene/recorder.js.map +1 -0
  406. package/dist/core/scene/renderOrder.js.map +1 -1
  407. package/dist/core/scene/scene.js +81 -690
  408. package/dist/core/scene/scene.js.map +1 -1
  409. package/dist/core/scene/sceneEdits.js +58 -0
  410. package/dist/core/scene/sceneEdits.js.map +1 -0
  411. package/dist/core/scene/sceneMutators.js +49 -0
  412. package/dist/core/scene/sceneMutators.js.map +1 -0
  413. package/dist/core/scene/scenePoseAdapter.js +16 -0
  414. package/dist/core/scene/scenePoseAdapter.js.map +1 -0
  415. package/dist/core/scene/sceneRecording.js +91 -0
  416. package/dist/core/scene/sceneRecording.js.map +1 -0
  417. package/dist/core/scene/sceneSelection.js +28 -0
  418. package/dist/core/scene/sceneSelection.js.map +1 -0
  419. package/dist/core/scene/sceneState.js +49 -0
  420. package/dist/core/scene/sceneState.js.map +1 -0
  421. package/dist/core/scene/serialization.js +8 -5
  422. package/dist/core/scene/serialization.js.map +1 -1
  423. package/dist/core/scene/staleReplay.js +51 -0
  424. package/dist/core/scene/staleReplay.js.map +1 -0
  425. package/dist/core/scene/statedFields.js +9 -0
  426. package/dist/core/scene/statedFields.js.map +1 -0
  427. package/dist/core/scene/treeEdits.js +127 -0
  428. package/dist/core/scene/treeEdits.js.map +1 -0
  429. package/dist/core/scene/treeReads.js +26 -0
  430. package/dist/core/scene/treeReads.js.map +1 -0
  431. package/dist/core/scene/types.js.map +1 -1
  432. package/dist/{features/groups → core/scene}/unionOfChildren.js +3 -3
  433. package/dist/core/scene/unionOfChildren.js.map +1 -0
  434. package/dist/core/scene/unitScopes.js +13 -0
  435. package/dist/core/scene/unitScopes.js.map +1 -0
  436. package/dist/core/scene/useScene.js.map +1 -1
  437. package/dist/core/selection/readOnlySelection.js +32 -0
  438. package/dist/core/selection/readOnlySelection.js.map +1 -0
  439. package/dist/core/selection/usePublishSceneSelection.js +26 -0
  440. package/dist/core/selection/usePublishSceneSelection.js.map +1 -0
  441. package/dist/core/selection/useSelection.js +34 -25
  442. package/dist/core/selection/useSelection.js.map +1 -1
  443. package/dist/core/shapeKinds.js.map +1 -1
  444. package/dist/core/stylus/stylus.js.map +1 -1
  445. package/dist/core/stylus/usePointerStylus.js.map +1 -1
  446. package/dist/core/usePaintKinds.js +1 -1
  447. package/dist/core/usePaintKinds.js.map +1 -1
  448. package/dist/core/viewport/clientToWorld.js.map +1 -1
  449. package/dist/core/viewport/fitViewToBounds.js.map +1 -1
  450. package/dist/core/viewport/parallax.js.map +1 -1
  451. package/dist/core/viewport/screenSlop.js +11 -11
  452. package/dist/core/viewport/screenSlop.js.map +1 -1
  453. package/dist/core/viewport/useCanvasSize.js.map +1 -1
  454. package/dist/core/viewport/useDecayLoop.js +31 -33
  455. package/dist/core/viewport/useDecayLoop.js.map +1 -1
  456. package/dist/core/viewport/useNodeOverlayFrame.js +84 -0
  457. package/dist/core/viewport/useNodeOverlayFrame.js.map +1 -0
  458. package/dist/core/viewport/useViewAnimation.js +113 -53
  459. package/dist/core/viewport/useViewAnimation.js.map +1 -1
  460. package/dist/core/viewport/view.js +14 -11
  461. package/dist/core/viewport/view.js.map +1 -1
  462. package/dist/core/viewport/wheelHandler.js.map +1 -1
  463. package/dist/core/viewport/zoomAt.js +11 -2
  464. package/dist/core/viewport/zoomAt.js.map +1 -1
  465. package/dist/{cornerHandles-CtCb8a3G.d.ts → cornerHandles-BSKbyuvQ.d.ts} +11 -24
  466. package/dist/debug/createDebugOverlayLayer.js +100 -100
  467. package/dist/debug/createDebugOverlayLayer.js.map +1 -1
  468. package/dist/debug/createDebugSink.js.map +1 -1
  469. package/dist/debug/frameStats.js.map +1 -1
  470. package/dist/debug/useDebugSink.js +52 -0
  471. package/dist/debug/useDebugSink.js.map +1 -0
  472. package/dist/features/chrome-caps/buildChromeCtx.js.map +1 -1
  473. package/dist/features/chrome-caps/conditions.js.map +1 -1
  474. package/dist/features/chrome-caps/defaults.js.map +1 -1
  475. package/dist/features/chrome-caps/resolve.js.map +1 -1
  476. package/dist/features/chrome-caps/useChromeCaps.js +54 -0
  477. package/dist/features/chrome-caps/useChromeCaps.js.map +1 -0
  478. package/dist/features/chrome-caps/useHoverTracking.js.map +1 -1
  479. package/dist/features/ingestion/contentHandlers.js +25 -19
  480. package/dist/features/ingestion/contentHandlers.js.map +1 -1
  481. package/dist/features/ingestion/imageHandler.js +21 -24
  482. package/dist/features/ingestion/imageHandler.js.map +1 -1
  483. package/dist/features/ingestion/openFilePicker.js.map +1 -1
  484. package/dist/features/ingestion/placement.js +16 -0
  485. package/dist/features/ingestion/placement.js.map +1 -0
  486. package/dist/features/ingestion/svgHandler.js +5 -0
  487. package/dist/features/ingestion/svgHandler.js.map +1 -1
  488. package/dist/features/ingestion/textHandler.js +28 -0
  489. package/dist/features/ingestion/textHandler.js.map +1 -0
  490. package/dist/features/ingestion/useCanvasIngestion.js +48 -0
  491. package/dist/features/ingestion/useCanvasIngestion.js.map +1 -0
  492. package/dist/features/ingestion/weaselJsonHandler.js +5 -0
  493. package/dist/features/ingestion/weaselJsonHandler.js.map +1 -1
  494. package/dist/features/longPress/longPressFeedback.js.map +1 -1
  495. package/dist/features/modes/modeLayers.js +7 -7
  496. package/dist/features/modes/modeLayers.js.map +1 -1
  497. package/dist/features/paths/editablePath.js +63 -0
  498. package/dist/features/paths/editablePath.js.map +1 -0
  499. package/dist/features/paths/index.js +9 -16
  500. package/dist/features/paths/pathEditState.js +41 -0
  501. package/dist/features/paths/pathEditState.js.map +1 -0
  502. package/dist/features/paths/pathEditingOverlayLayer.js +36 -38
  503. package/dist/features/paths/pathEditingOverlayLayer.js.map +1 -1
  504. package/dist/features/paths/pathLayer.js +3 -2
  505. package/dist/features/paths/pathLayer.js.map +1 -1
  506. package/dist/features/paths/penPreviewLayer.js +86 -88
  507. package/dist/features/paths/penPreviewLayer.js.map +1 -1
  508. package/dist/features/paths/shapeGenerator.js +89 -0
  509. package/dist/features/paths/shapeGenerator.js.map +1 -0
  510. package/dist/features/paths/usePathEdit.js +34 -0
  511. package/dist/features/paths/usePathEdit.js.map +1 -0
  512. package/dist/features/poseRun/usePoseRun.js +44 -57
  513. package/dist/features/poseRun/usePoseRun.js.map +1 -1
  514. package/dist/features/selection/overlay.js +170 -178
  515. package/dist/features/selection/overlay.js.map +1 -1
  516. package/dist/features/text/index.js +6 -0
  517. package/dist/features/text/textLayer.js +1 -1
  518. package/dist/features/text/textLayer.js.map +1 -1
  519. package/dist/features/text/useSceneTextEdit.js +119 -88
  520. package/dist/features/text/useSceneTextEdit.js.map +1 -1
  521. package/dist/features/viewports/viewResolver.js +28 -24
  522. package/dist/features/viewports/viewResolver.js.map +1 -1
  523. package/dist/features/viewports/viewportLayer.js +25 -36
  524. package/dist/features/viewports/viewportLayer.js.map +1 -1
  525. package/dist/icons/SliceIcon.js +24 -0
  526. package/dist/icons/SliceIcon.js.map +1 -0
  527. package/dist/index.d.ts +5200 -8777
  528. package/dist/index.js +284 -320
  529. package/dist/input/keyState.js +14 -14
  530. package/dist/interactions/actions/actionShortcuts.js.map +1 -1
  531. package/dist/interactions/actions/{defaults/align.js → align/action.js} +15 -16
  532. package/dist/interactions/actions/align/action.js.map +1 -0
  533. package/dist/interactions/actions/align/align.js +24 -24
  534. package/dist/interactions/actions/align/align.js.map +1 -1
  535. package/dist/interactions/actions/booleans/action.js +65 -0
  536. package/dist/interactions/actions/booleans/action.js.map +1 -0
  537. package/dist/interactions/actions/booleans/booleans.js +74 -83
  538. package/dist/interactions/actions/booleans/booleans.js.map +1 -1
  539. package/dist/interactions/actions/booleans/operands.js +40 -0
  540. package/dist/interactions/actions/booleans/operands.js.map +1 -0
  541. package/dist/interactions/actions/booleans/pieces.js +45 -0
  542. package/dist/interactions/actions/booleans/pieces.js.map +1 -0
  543. package/dist/interactions/actions/booleans/placement.js +24 -0
  544. package/dist/interactions/actions/booleans/placement.js.map +1 -0
  545. package/dist/interactions/actions/booleans/useBooleans.js +11 -9
  546. package/dist/interactions/actions/booleans/useBooleans.js.map +1 -1
  547. package/dist/interactions/actions/booleans/useBooleansAdapter.js.map +1 -1
  548. package/dist/interactions/actions/{defaults/clipboard.js → clipboard/action.js} +19 -19
  549. package/dist/interactions/actions/clipboard/action.js.map +1 -0
  550. package/dist/interactions/actions/clipboard/clipboardOps.js +15 -15
  551. package/dist/interactions/actions/clipboard/clipboardOps.js.map +1 -1
  552. package/dist/interactions/actions/clipboard/wireFormat.js.map +1 -1
  553. package/dist/interactions/actions/clone/action.js +103 -0
  554. package/dist/interactions/actions/clone/action.js.map +1 -0
  555. package/dist/interactions/actions/clone/behaviors.js +52 -0
  556. package/dist/interactions/actions/clone/behaviors.js.map +1 -0
  557. package/dist/interactions/actions/defaultCommitAdapter.js +10 -37
  558. package/dist/interactions/actions/defaultCommitAdapter.js.map +1 -1
  559. package/dist/interactions/actions/defaults/anchorEditing.js +69 -74
  560. package/dist/interactions/actions/defaults/anchorEditing.js.map +1 -1
  561. package/dist/interactions/actions/defaults/anchorHandles.js +42 -0
  562. package/dist/interactions/actions/defaults/anchorHandles.js.map +1 -0
  563. package/dist/interactions/actions/defaults/anchorJoin.js +92 -0
  564. package/dist/interactions/actions/defaults/anchorJoin.js.map +1 -0
  565. package/dist/interactions/actions/defaults/areaSelect.js.map +1 -1
  566. package/dist/interactions/actions/defaults/bendSegment.js +46 -0
  567. package/dist/interactions/actions/defaults/bendSegment.js.map +1 -0
  568. package/dist/interactions/actions/defaults/cancelGesture.js.map +1 -1
  569. package/dist/interactions/actions/defaults/clearSelection.js.map +1 -1
  570. package/dist/interactions/actions/defaults/copySubtree.js +1 -1
  571. package/dist/interactions/actions/defaults/copySubtree.js.map +1 -1
  572. package/dist/interactions/actions/defaults/createPaintAction.js.map +1 -1
  573. package/dist/interactions/actions/defaults/delete.js.map +1 -1
  574. package/dist/interactions/actions/defaults/duplicate.js +36 -21
  575. package/dist/interactions/actions/defaults/duplicate.js.map +1 -1
  576. package/dist/interactions/actions/defaults/enterPathEdit.js +19 -7
  577. package/dist/interactions/actions/defaults/enterPathEdit.js.map +1 -1
  578. package/dist/interactions/actions/defaults/enterTextEdit.js.map +1 -1
  579. package/dist/interactions/actions/defaults/group.js +35 -40
  580. package/dist/interactions/actions/defaults/group.js.map +1 -1
  581. package/dist/interactions/actions/defaults/icons/anchorIcons.js +75 -0
  582. package/dist/interactions/actions/defaults/icons/anchorIcons.js.map +1 -0
  583. package/dist/interactions/actions/defaults/icons/booleanIcons.js +24 -1
  584. package/dist/interactions/actions/defaults/icons/booleanIcons.js.map +1 -1
  585. package/dist/interactions/actions/defaults/icons/editIcons.js +35 -8
  586. package/dist/interactions/actions/defaults/icons/editIcons.js.map +1 -1
  587. package/dist/interactions/actions/defaults/icons/outlineIcons.js +39 -1
  588. package/dist/interactions/actions/defaults/icons/outlineIcons.js.map +1 -1
  589. package/dist/interactions/actions/defaults/ingest.js +19 -15
  590. package/dist/interactions/actions/defaults/ingest.js.map +1 -1
  591. package/dist/interactions/actions/defaults/insertPathAnchor.js +18 -34
  592. package/dist/interactions/actions/defaults/insertPathAnchor.js.map +1 -1
  593. package/dist/interactions/actions/defaults/nudge.js +43 -39
  594. package/dist/interactions/actions/defaults/nudge.js.map +1 -1
  595. package/dist/interactions/actions/defaults/pinchZoom.js +29 -29
  596. package/dist/interactions/actions/defaults/pinchZoom.js.map +1 -1
  597. package/dist/interactions/actions/defaults/requiresSelection.js.map +1 -1
  598. package/dist/interactions/actions/defaults/segmentUnder.js +22 -0
  599. package/dist/interactions/actions/defaults/segmentUnder.js.map +1 -0
  600. package/dist/interactions/actions/defaults/setFill.js +9 -3
  601. package/dist/interactions/actions/defaults/setFill.js.map +1 -1
  602. package/dist/interactions/actions/defaults/setFillOpacity.js +4 -1
  603. package/dist/interactions/actions/defaults/setFillOpacity.js.map +1 -1
  604. package/dist/interactions/actions/defaults/setStroke.js.map +1 -1
  605. package/dist/interactions/actions/defaults/sliceOps.js +20 -22
  606. package/dist/interactions/actions/defaults/sliceOps.js.map +1 -1
  607. package/dist/interactions/actions/defaults/toolActivate.js.map +1 -1
  608. package/dist/interactions/actions/defaults/toolResetToDefault.js.map +1 -1
  609. package/dist/interactions/actions/defaults/viewportDragPan.js +1 -1
  610. package/dist/interactions/actions/defaults/viewportDragPan.js.map +1 -1
  611. package/dist/interactions/actions/defaults/viewportWheelPan.js.map +1 -1
  612. package/dist/interactions/actions/defaults/viewportZoom.js +82 -79
  613. package/dist/interactions/actions/defaults/viewportZoom.js.map +1 -1
  614. package/dist/interactions/actions/{defaults/distribute.js → distribute/action.js} +18 -19
  615. package/dist/interactions/actions/distribute/action.js.map +1 -0
  616. package/dist/interactions/actions/distribute/distribute.js +15 -15
  617. package/dist/interactions/actions/distribute/distribute.js.map +1 -1
  618. package/dist/interactions/actions/edit-anchors/action.js +101 -0
  619. package/dist/interactions/actions/edit-anchors/action.js.map +1 -0
  620. package/dist/interactions/actions/edit-anchors/geometry.js +2 -4
  621. package/dist/interactions/actions/edit-anchors/geometry.js.map +1 -1
  622. package/dist/interactions/actions/edit-anchors/preview.js +26 -0
  623. package/dist/interactions/actions/edit-anchors/preview.js.map +1 -0
  624. package/dist/interactions/actions/edit-anchors/symmetry.js +11 -0
  625. package/dist/interactions/actions/edit-anchors/symmetry.js.map +1 -0
  626. package/dist/interactions/actions/flip/action.js +124 -0
  627. package/dist/interactions/actions/flip/action.js.map +1 -0
  628. package/dist/interactions/actions/flip/helpers.js +1 -1
  629. package/dist/interactions/actions/flip/helpers.js.map +1 -1
  630. package/dist/interactions/actions/geometryProjection.js.map +1 -1
  631. package/dist/interactions/actions/gestureFrames.js +18 -0
  632. package/dist/interactions/actions/gestureFrames.js.map +1 -0
  633. package/dist/interactions/actions/gestureLifecycle.js +47 -20
  634. package/dist/interactions/actions/gestureLifecycle.js.map +1 -1
  635. package/dist/interactions/actions/insert/action.js +79 -0
  636. package/dist/interactions/actions/insert/action.js.map +1 -0
  637. package/dist/interactions/actions/insert/commit.js +28 -0
  638. package/dist/interactions/actions/insert/commit.js.map +1 -0
  639. package/dist/interactions/actions/insert/extras.js +65 -0
  640. package/dist/interactions/actions/insert/extras.js.map +1 -0
  641. package/dist/interactions/actions/insert/frame.js +55 -0
  642. package/dist/interactions/actions/insert/frame.js.map +1 -0
  643. package/dist/interactions/actions/insert/geometry.js +35 -0
  644. package/dist/interactions/actions/insert/geometry.js.map +1 -0
  645. package/dist/interactions/actions/insert/repositionAction.js +31 -0
  646. package/dist/interactions/actions/insert/repositionAction.js.map +1 -0
  647. package/dist/interactions/actions/insert/rotateAction.js +21 -0
  648. package/dist/interactions/actions/insert/rotateAction.js.map +1 -0
  649. package/dist/interactions/actions/insert/session.js +59 -0
  650. package/dist/interactions/actions/insert/session.js.map +1 -0
  651. package/dist/interactions/actions/insert/shape.js +34 -0
  652. package/dist/interactions/actions/insert/shape.js.map +1 -0
  653. package/dist/interactions/actions/lasso-select/action.js +143 -0
  654. package/dist/interactions/actions/lasso-select/action.js.map +1 -0
  655. package/dist/interactions/actions/move/action.js +91 -0
  656. package/dist/interactions/actions/move/action.js.map +1 -0
  657. package/dist/interactions/actions/move/behaviors/layoutDrop.js +51 -0
  658. package/dist/interactions/actions/move/behaviors/layoutDrop.js.map +1 -0
  659. package/dist/interactions/actions/move/behaviors/reparentOnDrop.js +15 -0
  660. package/dist/interactions/actions/move/behaviors/reparentOnDrop.js.map +1 -0
  661. package/dist/interactions/actions/move/behaviors/snapToContainer.js +35 -28
  662. package/dist/interactions/actions/move/behaviors/snapToContainer.js.map +1 -1
  663. package/dist/interactions/actions/move/capture.js +108 -0
  664. package/dist/interactions/actions/move/capture.js.map +1 -0
  665. package/dist/interactions/actions/move/commit/index.js +41 -0
  666. package/dist/interactions/actions/move/commit/index.js.map +1 -0
  667. package/dist/interactions/actions/move/commit/layoutDrop.js +44 -0
  668. package/dist/interactions/actions/move/commit/layoutDrop.js.map +1 -0
  669. package/dist/interactions/actions/move/commit/layoutRelease.js +100 -0
  670. package/dist/interactions/actions/move/commit/layoutRelease.js.map +1 -0
  671. package/dist/interactions/actions/move/commit/rebase.js +18 -0
  672. package/dist/interactions/actions/move/commit/rebase.js.map +1 -0
  673. package/dist/interactions/actions/move/commit/reparent.js +65 -0
  674. package/dist/interactions/actions/move/commit/reparent.js.map +1 -0
  675. package/dist/interactions/actions/move/delta.js +51 -0
  676. package/dist/interactions/actions/move/delta.js.map +1 -0
  677. package/dist/interactions/actions/move/frame.js +47 -0
  678. package/dist/interactions/actions/move/frame.js.map +1 -0
  679. package/dist/interactions/actions/move/gestureAdapter.js +15 -40
  680. package/dist/interactions/actions/move/gestureAdapter.js.map +1 -1
  681. package/dist/interactions/actions/move/landedDescendants.js +8 -8
  682. package/dist/interactions/actions/move/layout/container.js +94 -0
  683. package/dist/interactions/actions/move/layout/container.js.map +1 -0
  684. package/dist/interactions/actions/move/layout/dragged.js +58 -0
  685. package/dist/interactions/actions/move/layout/dragged.js.map +1 -0
  686. package/dist/interactions/actions/move/layout/dropPass.js +122 -0
  687. package/dist/interactions/actions/move/layout/dropPass.js.map +1 -0
  688. package/dist/interactions/actions/move/layout/exits.js +38 -0
  689. package/dist/interactions/actions/move/layout/exits.js.map +1 -0
  690. package/dist/interactions/actions/move/layout/glide.js +48 -0
  691. package/dist/interactions/actions/move/layout/glide.js.map +1 -0
  692. package/dist/interactions/actions/move/session.js +63 -0
  693. package/dist/interactions/actions/move/session.js.map +1 -0
  694. package/dist/interactions/actions/move/translate.js +61 -0
  695. package/dist/interactions/actions/move/translate.js.map +1 -0
  696. package/dist/interactions/actions/outlines/createOutlines.js +17 -64
  697. package/dist/interactions/actions/outlines/createOutlines.js.map +1 -1
  698. package/dist/interactions/actions/outlines/createOutlinesAction.js +51 -0
  699. package/dist/interactions/actions/outlines/createOutlinesAction.js.map +1 -0
  700. package/dist/interactions/actions/outlines/outlineStroke.js +72 -0
  701. package/dist/interactions/actions/outlines/outlineStroke.js.map +1 -0
  702. package/dist/interactions/actions/outlines/outlineStrokeAction.js +37 -0
  703. package/dist/interactions/actions/outlines/outlineStrokeAction.js.map +1 -0
  704. package/dist/interactions/actions/outlines/replaceWithPaths.js +54 -0
  705. package/dist/interactions/actions/outlines/replaceWithPaths.js.map +1 -0
  706. package/dist/interactions/actions/outlines/strokeRegion.js +27 -0
  707. package/dist/interactions/actions/outlines/strokeRegion.js.map +1 -0
  708. package/dist/interactions/actions/pathCommands/cutJoin.js +102 -0
  709. package/dist/interactions/actions/pathCommands/cutJoin.js.map +1 -0
  710. package/dist/interactions/actions/pathCommands/livePathEdit.js +64 -0
  711. package/dist/interactions/actions/pathCommands/livePathEdit.js.map +1 -0
  712. package/dist/interactions/actions/pathCommands/pathNodes.js +99 -0
  713. package/dist/interactions/actions/pathCommands/pathNodes.js.map +1 -0
  714. package/dist/interactions/actions/pathCommands/simplifyOffset.js +42 -0
  715. package/dist/interactions/actions/pathCommands/simplifyOffset.js.map +1 -0
  716. package/dist/interactions/actions/planeInput.js.map +1 -1
  717. package/dist/interactions/actions/pointerState.js +12 -0
  718. package/dist/interactions/actions/pointerState.js.map +1 -0
  719. package/dist/interactions/actions/poseDescriptorDep.js +1 -1
  720. package/dist/interactions/actions/poseDescriptorDep.js.map +1 -1
  721. package/dist/interactions/actions/poseFrame.js +26 -26
  722. package/dist/interactions/actions/poseFrame.js.map +1 -1
  723. package/dist/interactions/actions/resize/action.js +66 -0
  724. package/dist/interactions/actions/resize/action.js.map +1 -0
  725. package/dist/interactions/actions/resize/behaviors/lockAspect.js.map +1 -1
  726. package/dist/interactions/actions/resize/boxFrame.js +16 -0
  727. package/dist/interactions/actions/resize/boxFrame.js.map +1 -0
  728. package/dist/interactions/actions/resize/capture.js +85 -0
  729. package/dist/interactions/actions/resize/capture.js.map +1 -0
  730. package/dist/interactions/actions/resize/commit.js +69 -0
  731. package/dist/interactions/actions/resize/commit.js.map +1 -0
  732. package/dist/interactions/actions/resize/frame.js +88 -0
  733. package/dist/interactions/actions/resize/frame.js.map +1 -0
  734. package/dist/interactions/actions/resize/pointSnap.js +111 -0
  735. package/dist/interactions/actions/resize/pointSnap.js.map +1 -0
  736. package/dist/interactions/actions/resize/replay.js +47 -0
  737. package/dist/interactions/actions/resize/replay.js.map +1 -0
  738. package/dist/interactions/actions/resize/ruleBounds.js +9 -0
  739. package/dist/interactions/actions/resize/ruleBounds.js.map +1 -0
  740. package/dist/interactions/actions/resize/session.js +63 -0
  741. package/dist/interactions/actions/resize/session.js.map +1 -0
  742. package/dist/interactions/actions/resolveOverlays.js +2 -1
  743. package/dist/interactions/actions/resolveOverlays.js.map +1 -1
  744. package/dist/interactions/actions/resolvePreviews.js.map +1 -1
  745. package/dist/interactions/actions/rotate/action.js +71 -0
  746. package/dist/interactions/actions/rotate/action.js.map +1 -0
  747. package/dist/interactions/actions/rotate/behaviors/index.js +7 -0
  748. package/dist/interactions/actions/rotate/behaviors/index.js.map +1 -0
  749. package/dist/interactions/actions/rotate/behaviors/snapRotation.js +12 -0
  750. package/dist/interactions/actions/rotate/behaviors/snapRotation.js.map +1 -0
  751. package/dist/interactions/actions/rotate/commit.js +40 -0
  752. package/dist/interactions/actions/rotate/commit.js.map +1 -0
  753. package/dist/interactions/actions/rotate/frame.js +65 -0
  754. package/dist/interactions/actions/rotate/frame.js.map +1 -0
  755. package/dist/interactions/actions/rotate/handle.js +12 -12
  756. package/dist/interactions/actions/rotate/handle.js.map +1 -1
  757. package/dist/interactions/actions/rotate/replay.js +22 -0
  758. package/dist/interactions/actions/rotate/replay.js.map +1 -0
  759. package/dist/interactions/actions/rotate/session.js +102 -0
  760. package/dist/interactions/actions/rotate/session.js.map +1 -0
  761. package/dist/interactions/actions/spatialReference.js.map +1 -1
  762. package/dist/interactions/actions/transform-again/action.js +63 -0
  763. package/dist/interactions/actions/transform-again/action.js.map +1 -0
  764. package/dist/interactions/actions/transform-again/memory.js +35 -0
  765. package/dist/interactions/actions/transform-again/memory.js.map +1 -0
  766. package/dist/interactions/actions/useStandardActions.js +84 -61
  767. package/dist/interactions/actions/useStandardActions.js.map +1 -1
  768. package/dist/interactions/gestures/pointerDrag/pointerDrag.js +61 -42
  769. package/dist/interactions/gestures/pointerDrag/pointerDrag.js.map +1 -1
  770. package/dist/interactions/gestures/shared/originProjection.js +1 -1
  771. package/dist/interactions/gestures/shared/originProjection.js.map +1 -1
  772. package/dist/interactions/gestures/shared/screenTolerance.js +8 -2
  773. package/dist/interactions/gestures/shared/screenTolerance.js.map +1 -1
  774. package/dist/interactions/gestures/shared/snap.js.map +1 -1
  775. package/dist/math-CYUjoyyU.d.ts +33 -0
  776. package/dist/math.d.ts +5 -2
  777. package/dist/math.js +6 -6
  778. package/dist/mesh.d.ts +4 -268
  779. package/dist/mesh.js +3 -7
  780. package/dist/move.d.ts +6 -4
  781. package/dist/{originProjection-gHnOup4e.d.ts → originProjection-CoNVpITV.d.ts} +1 -1
  782. package/dist/patterns-builtin.d.ts +1 -118
  783. package/dist/patterns-builtin.js +2 -3
  784. package/dist/poseDescriptor-Bqk-11Rl.d.ts +73 -0
  785. package/dist/renderer.d.ts +1 -92
  786. package/dist/renderer.js +2 -19
  787. package/dist/resize.d.ts +11 -22
  788. package/dist/resize.js +1 -1
  789. package/dist/style.css +1 -1
  790. package/dist/test-hook/install.js.map +1 -1
  791. package/dist/test-hook/useTestHook.js +22 -0
  792. package/dist/test-hook/useTestHook.js.map +1 -0
  793. package/dist/test-seams-D0pyV3pR.d.ts +149 -0
  794. package/dist/test-seams.d.ts +4 -4
  795. package/dist/test-seams.js +2 -2
  796. package/dist/tools/builtin/bone/boneActions.js +130 -0
  797. package/dist/tools/builtin/bone/boneActions.js.map +1 -0
  798. package/dist/tools/builtin/bone/boneOverlay.js +58 -0
  799. package/dist/tools/builtin/bone/boneOverlay.js.map +1 -0
  800. package/dist/tools/builtin/bone/placedRig.js +24 -0
  801. package/dist/tools/builtin/bone/placedRig.js.map +1 -0
  802. package/dist/tools/builtin/bone/rigEditState.js +21 -0
  803. package/dist/tools/builtin/bone/rigEditState.js.map +1 -0
  804. package/dist/tools/builtin/bone/useBoneTool.js +98 -0
  805. package/dist/tools/builtin/bone/useBoneTool.js.map +1 -0
  806. package/dist/tools/builtin/ellipse/useEllipseTool.js +16 -15
  807. package/dist/tools/builtin/ellipse/useEllipseTool.js.map +1 -1
  808. package/dist/tools/builtin/eyedropper/useEyedropperTool.js.map +1 -1
  809. package/dist/tools/builtin/hand/useHandTool.js.map +1 -1
  810. package/dist/tools/builtin/image/useImageTool.js.map +1 -1
  811. package/dist/tools/builtin/lasso/useLassoTool.js.map +1 -1
  812. package/dist/tools/builtin/line/useLineTool.js +16 -15
  813. package/dist/tools/builtin/line/useLineTool.js.map +1 -1
  814. package/dist/tools/builtin/pen/usePenTool.js +162 -164
  815. package/dist/tools/builtin/pen/usePenTool.js.map +1 -1
  816. package/dist/tools/builtin/pencil/usePencilTool.js.map +1 -1
  817. package/dist/tools/builtin/pickTopMostHit.js +11 -14
  818. package/dist/tools/builtin/pickTopMostHit.js.map +1 -1
  819. package/dist/tools/builtin/polygon/usePolygonTool.js +17 -15
  820. package/dist/tools/builtin/polygon/usePolygonTool.js.map +1 -1
  821. package/dist/tools/builtin/rect/useRectTool.js +15 -14
  822. package/dist/tools/builtin/rect/useRectTool.js.map +1 -1
  823. package/dist/tools/builtin/select/adapterPointQuery.js +40 -0
  824. package/dist/tools/builtin/select/adapterPointQuery.js.map +1 -0
  825. package/dist/tools/builtin/select/selectionContributions.js +5 -5
  826. package/dist/tools/builtin/select/selectionContributions.js.map +1 -1
  827. package/dist/tools/builtin/select/useSelectTool.js +44 -71
  828. package/dist/tools/builtin/select/useSelectTool.js.map +1 -1
  829. package/dist/tools/builtin/shared/pointerFollower.js.map +1 -1
  830. package/dist/tools/builtin/slice/useSliceTool.js +69 -72
  831. package/dist/tools/builtin/slice/useSliceTool.js.map +1 -1
  832. package/dist/tools/builtin/star/useStarTool.js +18 -16
  833. package/dist/tools/builtin/star/useStarTool.js.map +1 -1
  834. package/dist/tools/builtin/text/useTextTool.js +10 -2
  835. package/dist/tools/builtin/text/useTextTool.js.map +1 -1
  836. package/dist/tools/builtin/weight/useWeightTool.js +77 -0
  837. package/dist/tools/builtin/weight/useWeightTool.js.map +1 -0
  838. package/dist/tools/builtin/weight/weightActions.js +112 -0
  839. package/dist/tools/builtin/weight/weightActions.js.map +1 -0
  840. package/dist/tools/builtin/weight/weightOverlay.js +61 -0
  841. package/dist/tools/builtin/weight/weightOverlay.js.map +1 -0
  842. package/dist/tools/overlayBinding.js.map +1 -1
  843. package/dist/tools/useKeybindings.js +20 -14
  844. package/dist/tools/useKeybindings.js.map +1 -1
  845. package/dist/{types-k-5Oqh-U.d.ts → types-DBbbCy0i.d.ts} +103 -176
  846. package/dist/util/paint.js +1 -1
  847. package/dist/util/paint.js.map +1 -1
  848. package/dist/version.js +1 -1
  849. package/package.json +26 -21
  850. package/dist/animation/colorHelpers.js +0 -135
  851. package/dist/animation/colorHelpers.js.map +0 -1
  852. package/dist/animation/colorRegistry.js +0 -37
  853. package/dist/animation/colorRegistry.js.map +0 -1
  854. package/dist/animation/engine/axes.js +0 -36
  855. package/dist/animation/engine/axes.js.map +0 -1
  856. package/dist/animation/engine/codec.js +0 -170
  857. package/dist/animation/engine/codec.js.map +0 -1
  858. package/dist/animation/engine/integrator.js +0 -12
  859. package/dist/animation/engine/integrator.js.map +0 -1
  860. package/dist/animation/loop.js +0 -60
  861. package/dist/animation/loop.js.map +0 -1
  862. package/dist/animation/observe.js +0 -23
  863. package/dist/animation/observe.js.map +0 -1
  864. package/dist/animation/rig/blendPoses.js +0 -43
  865. package/dist/animation/rig/blendPoses.js.map +0 -1
  866. package/dist/animation/rig/mirrorPose.js +0 -19
  867. package/dist/animation/rig/mirrorPose.js.map +0 -1
  868. package/dist/animation/rig/resolveSkeleton.js +0 -33
  869. package/dist/animation/rig/resolveSkeleton.js.map +0 -1
  870. package/dist/animation/rig/solveIk.js +0 -103
  871. package/dist/animation/rig/solveIk.js.map +0 -1
  872. package/dist/animation/rig/types.js +0 -12
  873. package/dist/animation/rig/types.js.map +0 -1
  874. package/dist/animation/slew.js +0 -27
  875. package/dist/animation/slew.js.map +0 -1
  876. package/dist/animation/stagger.js +0 -146
  877. package/dist/animation/stagger.js.map +0 -1
  878. package/dist/animation/timeline/booking.js +0 -114
  879. package/dist/animation/timeline/booking.js.map +0 -1
  880. package/dist/animation/timeline/createTimeline.js +0 -125
  881. package/dist/animation/timeline/createTimeline.js.map +0 -1
  882. package/dist/animation/timeline/sampleTrack.js +0 -79
  883. package/dist/animation/timeline/sampleTrack.js.map +0 -1
  884. package/dist/animation/useAnimator.js +0 -388
  885. package/dist/animation/useAnimator.js.map +0 -1
  886. package/dist/autoPoseDescriptor-Ct7yqivU.d.ts +0 -108
  887. package/dist/builtins-DPcdghtB.d.ts +0 -1223
  888. package/dist/canvas/MinimapCanvas.js +0 -140
  889. package/dist/canvas/MinimapCanvas.js.map +0 -1
  890. package/dist/canvas/deps/poseComposition.js +0 -11
  891. package/dist/canvas/deps/poseComposition.js.map +0 -1
  892. package/dist/canvas/minimapMath.js +0 -82
  893. package/dist/canvas/minimapMath.js.map +0 -1
  894. package/dist/canvas/toolPreview.js +0 -39
  895. package/dist/canvas/toolPreview.js.map +0 -1
  896. package/dist/core/adapters/arrayAdapter.js +0 -94
  897. package/dist/core/adapters/arrayAdapter.js.map +0 -1
  898. package/dist/core/adapters/useArrayAdapter.js +0 -13
  899. package/dist/core/adapters/useArrayAdapter.js.map +0 -1
  900. package/dist/core/fillInPoseFrame.js +0 -102
  901. package/dist/core/fillInPoseFrame.js.map +0 -1
  902. package/dist/core/geometry/poseFrame.js +0 -44
  903. package/dist/core/geometry/poseFrame.js.map +0 -1
  904. package/dist/core/geometry/poseRotation.js +0 -58
  905. package/dist/core/geometry/poseRotation.js.map +0 -1
  906. package/dist/core/gradient.js +0 -136
  907. package/dist/core/gradient.js.map +0 -1
  908. package/dist/core/markerInset.js +0 -24
  909. package/dist/core/markerInset.js.map +0 -1
  910. package/dist/core/mixed.js +0 -6
  911. package/dist/core/mixed.js.map +0 -1
  912. package/dist/core/paintKinds.js +0 -156
  913. package/dist/core/paintKinds.js.map +0 -1
  914. package/dist/core/scene/pickability.js +0 -6
  915. package/dist/core/scene/pickability.js.map +0 -1
  916. package/dist/core/strokeMarkerShapes.js +0 -139
  917. package/dist/core/strokeMarkerShapes.js.map +0 -1
  918. package/dist/core/strokeMarkers.js +0 -28
  919. package/dist/core/strokeMarkers.js.map +0 -1
  920. package/dist/core/viewport/meanScale.js +0 -8
  921. package/dist/core/viewport/meanScale.js.map +0 -1
  922. package/dist/core/viewport/pxExtent.js +0 -42
  923. package/dist/core/viewport/pxExtent.js.map +0 -1
  924. package/dist/features/cursor/paintedCursorLayer.js.map +0 -1
  925. package/dist/features/focus/gateLayer.js.map +0 -1
  926. package/dist/features/focus/useCanvasFocus.js +0 -29
  927. package/dist/features/focus/useCanvasFocus.js.map +0 -1
  928. package/dist/features/groups/children.js.map +0 -1
  929. package/dist/features/groups/composePose.js +0 -67
  930. package/dist/features/groups/composePose.js.map +0 -1
  931. package/dist/features/groups/nestedHit.js.map +0 -1
  932. package/dist/features/groups/unionOfChildren.js.map +0 -1
  933. package/dist/features/images/imageCache.js +0 -104
  934. package/dist/features/images/imageCache.js.map +0 -1
  935. package/dist/features/ingestion/index.js +0 -8
  936. package/dist/features/meshPaint/bake.js +0 -79
  937. package/dist/features/meshPaint/bake.js.map +0 -1
  938. package/dist/features/meshPaint/bakeCache.js +0 -59
  939. package/dist/features/meshPaint/bakeCache.js.map +0 -1
  940. package/dist/features/meshPaint/handles.js +0 -86
  941. package/dist/features/meshPaint/handles.js.map +0 -1
  942. package/dist/features/meshPaint/lazyKind.js.map +0 -1
  943. package/dist/features/meshPaint/meshPaint.js +0 -239
  944. package/dist/features/meshPaint/meshPaint.js.map +0 -1
  945. package/dist/features/meshPaint/meshShader.js +0 -6
  946. package/dist/features/meshPaint/meshShader.js.map +0 -1
  947. package/dist/features/meshPaint/register.js +0 -7
  948. package/dist/features/meshPaint/register.js.map +0 -1
  949. package/dist/features/meshPaint/surface.js +0 -110
  950. package/dist/features/meshPaint/surface.js.map +0 -1
  951. package/dist/features/minimap/actions.js +0 -53
  952. package/dist/features/minimap/actions.js.map +0 -1
  953. package/dist/features/minimap/createMinimapContribution.js +0 -96
  954. package/dist/features/minimap/createMinimapContribution.js.map +0 -1
  955. package/dist/features/minimap/layers.js +0 -85
  956. package/dist/features/minimap/layers.js.map +0 -1
  957. package/dist/features/overlays/useNodeOverlayFrame.js +0 -103
  958. package/dist/features/overlays/useNodeOverlayFrame.js.map +0 -1
  959. package/dist/features/parallax/createParallaxLayer.js +0 -26
  960. package/dist/features/parallax/createParallaxLayer.js.map +0 -1
  961. package/dist/features/parallax/createParallaxPlane.js +0 -22
  962. package/dist/features/parallax/createParallaxPlane.js.map +0 -1
  963. package/dist/features/paths/anchorEdits.js +0 -167
  964. package/dist/features/paths/anchorEdits.js.map +0 -1
  965. package/dist/features/paths/anchors.js +0 -159
  966. package/dist/features/paths/anchors.js.map +0 -1
  967. package/dist/features/paths/booleans.js +0 -2
  968. package/dist/features/paths/markerCommands.js +0 -149
  969. package/dist/features/paths/markerCommands.js.map +0 -1
  970. package/dist/features/paths/markerSites.js +0 -59
  971. package/dist/features/paths/markerSites.js.map +0 -1
  972. package/dist/features/paths/markers.js +0 -95
  973. package/dist/features/paths/markers.js.map +0 -1
  974. package/dist/features/paths/nearestAnchor.js +0 -36
  975. package/dist/features/paths/nearestAnchor.js.map +0 -1
  976. package/dist/features/paths/pathInWorld.js +0 -41
  977. package/dist/features/paths/pathInWorld.js.map +0 -1
  978. package/dist/features/paths/poseDescriptor.js +0 -39
  979. package/dist/features/paths/poseDescriptor.js.map +0 -1
  980. package/dist/features/paths/strokeToPath.js +0 -40
  981. package/dist/features/paths/strokeToPath.js.map +0 -1
  982. package/dist/features/paths/tessellate/dash.js +0 -52
  983. package/dist/features/paths/tessellate/dash.js.map +0 -1
  984. package/dist/features/paths/tessellate/insets.js +0 -32
  985. package/dist/features/paths/tessellate/insets.js.map +0 -1
  986. package/dist/features/paths/tessellate/metric.js +0 -72
  987. package/dist/features/paths/tessellate/metric.js.map +0 -1
  988. package/dist/features/paths/tessellate/stroke.js +0 -170
  989. package/dist/features/paths/tessellate/stroke.js.map +0 -1
  990. package/dist/features/paths/tessellate/vertexWidths.js +0 -32
  991. package/dist/features/paths/tessellate/vertexWidths.js.map +0 -1
  992. package/dist/features/patterns/commandPaint.js +0 -18
  993. package/dist/features/patterns/commandPaint.js.map +0 -1
  994. package/dist/features/patterns/index.js +0 -11
  995. package/dist/features/patterns/index.js.map +0 -1
  996. package/dist/features/patterns/patterns-builtin.js +0 -38
  997. package/dist/features/patterns/patterns-builtin.js.map +0 -1
  998. package/dist/features/patterns/rasterizeTile.js +0 -17
  999. package/dist/features/patterns/rasterizeTile.js.map +0 -1
  1000. package/dist/features/patterns/resolveSpec.js +0 -65
  1001. package/dist/features/patterns/resolveSpec.js.map +0 -1
  1002. package/dist/features/patterns/tileGeometry.js +0 -158
  1003. package/dist/features/patterns/tileGeometry.js.map +0 -1
  1004. package/dist/features/pointer/PointerContext.js +0 -45
  1005. package/dist/features/pointer/PointerContext.js.map +0 -1
  1006. package/dist/features/selection/SelectionContext.js +0 -51
  1007. package/dist/features/selection/SelectionContext.js.map +0 -1
  1008. package/dist/features/simulation/createSimulation.js +0 -61
  1009. package/dist/features/simulation/createSimulation.js.map +0 -1
  1010. package/dist/features/simulation/types.js +0 -6
  1011. package/dist/features/simulation/types.js.map +0 -1
  1012. package/dist/features/simulation/useSimulation.js +0 -74
  1013. package/dist/features/simulation/useSimulation.js.map +0 -1
  1014. package/dist/features/text/domOffsets.js +0 -82
  1015. package/dist/features/text/domOffsets.js.map +0 -1
  1016. package/dist/features/text/domRuns.js +0 -230
  1017. package/dist/features/text/domRuns.js.map +0 -1
  1018. package/dist/features/text/fitTextPose.js +0 -38
  1019. package/dist/features/text/fitTextPose.js.map +0 -1
  1020. package/dist/features/text/hitTest.js +0 -48
  1021. package/dist/features/text/hitTest.js.map +0 -1
  1022. package/dist/features/text/isTextData.js +0 -8
  1023. package/dist/features/text/isTextData.js.map +0 -1
  1024. package/dist/features/text/overlayDirection.js +0 -15
  1025. package/dist/features/text/overlayDirection.js.map +0 -1
  1026. package/dist/features/text/renderLabel.js +0 -14
  1027. package/dist/features/text/renderLabel.js.map +0 -1
  1028. package/dist/features/text/runs/effectiveRangeStyle.js +0 -66
  1029. package/dist/features/text/runs/effectiveRangeStyle.js.map +0 -1
  1030. package/dist/features/text/runs/flagRange.js +0 -53
  1031. package/dist/features/text/runs/flagRange.js.map +0 -1
  1032. package/dist/features/text/runs/rangeStyle.js +0 -133
  1033. package/dist/features/text/runs/rangeStyle.js.map +0 -1
  1034. package/dist/features/text/textCommand.js +0 -60
  1035. package/dist/features/text/textCommand.js.map +0 -1
  1036. package/dist/features/text/textToPath.js +0 -181
  1037. package/dist/features/text/textToPath.js.map +0 -1
  1038. package/dist/features/text/useTextEdit.js +0 -491
  1039. package/dist/features/text/useTextEdit.js.map +0 -1
  1040. package/dist/features/tiling/createTiledLayer.js +0 -65
  1041. package/dist/features/tiling/createTiledLayer.js.map +0 -1
  1042. package/dist/features/tiling/tiledProject.js +0 -14
  1043. package/dist/features/tiling/tiledProject.js.map +0 -1
  1044. package/dist/interactions/actions/clone/behaviors/cloneByAltDrag.js +0 -26
  1045. package/dist/interactions/actions/clone/behaviors/cloneByAltDrag.js.map +0 -1
  1046. package/dist/interactions/actions/defaults/align.js.map +0 -1
  1047. package/dist/interactions/actions/defaults/booleans.js +0 -52
  1048. package/dist/interactions/actions/defaults/booleans.js.map +0 -1
  1049. package/dist/interactions/actions/defaults/clipboard.js.map +0 -1
  1050. package/dist/interactions/actions/defaults/clone.js +0 -91
  1051. package/dist/interactions/actions/defaults/clone.js.map +0 -1
  1052. package/dist/interactions/actions/defaults/createOutlines.js +0 -47
  1053. package/dist/interactions/actions/defaults/createOutlines.js.map +0 -1
  1054. package/dist/interactions/actions/defaults/distribute.js.map +0 -1
  1055. package/dist/interactions/actions/defaults/editAnchors.js +0 -100
  1056. package/dist/interactions/actions/defaults/editAnchors.js.map +0 -1
  1057. package/dist/interactions/actions/defaults/flip.js +0 -125
  1058. package/dist/interactions/actions/defaults/flip.js.map +0 -1
  1059. package/dist/interactions/actions/defaults/insert.js +0 -287
  1060. package/dist/interactions/actions/defaults/insert.js.map +0 -1
  1061. package/dist/interactions/actions/defaults/lassoSelect.js +0 -153
  1062. package/dist/interactions/actions/defaults/lassoSelect.js.map +0 -1
  1063. package/dist/interactions/actions/defaults/move.js +0 -778
  1064. package/dist/interactions/actions/defaults/move.js.map +0 -1
  1065. package/dist/interactions/actions/defaults/resize.js +0 -341
  1066. package/dist/interactions/actions/defaults/resize.js.map +0 -1
  1067. package/dist/interactions/actions/defaults/rotate.js +0 -185
  1068. package/dist/interactions/actions/defaults/rotate.js.map +0 -1
  1069. package/dist/interactions/actions/previewOverrides.js +0 -25
  1070. package/dist/interactions/actions/previewOverrides.js.map +0 -1
  1071. package/dist/interactions/actions/resize/autoPoseDescriptor.js.map +0 -1
  1072. package/dist/layout/arrivals.js +0 -36
  1073. package/dist/layout/arrivals.js.map +0 -1
  1074. package/dist/math-J-ACHyEg.d.ts +0 -159
  1075. package/dist/registerProgram-T9S_PfAX.d.ts +0 -208
  1076. package/dist/renderer/DrawCommand.js +0 -6
  1077. package/dist/renderer/DrawCommand.js.map +0 -1
  1078. package/dist/renderer/WeaselRenderer.js +0 -333
  1079. package/dist/renderer/WeaselRenderer.js.map +0 -1
  1080. package/dist/renderer/batchClip.js +0 -46
  1081. package/dist/renderer/batchClip.js.map +0 -1
  1082. package/dist/renderer/cache/GLImageCache.js +0 -74
  1083. package/dist/renderer/cache/GLImageCache.js.map +0 -1
  1084. package/dist/renderer/cache/GLMeshCache.js +0 -102
  1085. package/dist/renderer/cache/GLMeshCache.js.map +0 -1
  1086. package/dist/renderer/cache/GLTextureCache.js +0 -68
  1087. package/dist/renderer/cache/GLTextureCache.js.map +0 -1
  1088. package/dist/renderer/cache/GradientRampAtlas.js +0 -82
  1089. package/dist/renderer/cache/GradientRampAtlas.js.map +0 -1
  1090. package/dist/renderer/cache/cache.js +0 -13
  1091. package/dist/renderer/cache/cache.js.map +0 -1
  1092. package/dist/renderer/cache/markerCommandCache.js +0 -63
  1093. package/dist/renderer/cache/markerCommandCache.js.map +0 -1
  1094. package/dist/renderer/cache/outlineMeshCache.js +0 -15
  1095. package/dist/renderer/cache/outlineMeshCache.js.map +0 -1
  1096. package/dist/renderer/cache/outlineStrokeMeshCache.js +0 -36
  1097. package/dist/renderer/cache/outlineStrokeMeshCache.js.map +0 -1
  1098. package/dist/renderer/cache/strokeMeshCache.js +0 -55
  1099. package/dist/renderer/cache/strokeMeshCache.js.map +0 -1
  1100. package/dist/renderer/cullDrawCommands.js +0 -90
  1101. package/dist/renderer/cullDrawCommands.js.map +0 -1
  1102. package/dist/renderer/draw/batch.js +0 -133
  1103. package/dist/renderer/draw/batch.js.map +0 -1
  1104. package/dist/renderer/draw/clip.js +0 -89
  1105. package/dist/renderer/draw/clip.js.map +0 -1
  1106. package/dist/renderer/draw/customShader.js +0 -230
  1107. package/dist/renderer/draw/customShader.js.map +0 -1
  1108. package/dist/renderer/draw/drawTriangles.js +0 -8
  1109. package/dist/renderer/draw/drawTriangles.js.map +0 -1
  1110. package/dist/renderer/draw/effects.js +0 -28
  1111. package/dist/renderer/draw/effects.js.map +0 -1
  1112. package/dist/renderer/draw/flushBatch.js +0 -35
  1113. package/dist/renderer/draw/flushBatch.js.map +0 -1
  1114. package/dist/renderer/draw/gradient.js +0 -90
  1115. package/dist/renderer/draw/gradient.js.map +0 -1
  1116. package/dist/renderer/draw/image.js +0 -38
  1117. package/dist/renderer/draw/image.js.map +0 -1
  1118. package/dist/renderer/draw/mesh.js +0 -16
  1119. package/dist/renderer/draw/mesh.js.map +0 -1
  1120. package/dist/renderer/draw/paintBind.js +0 -70
  1121. package/dist/renderer/draw/paintBind.js.map +0 -1
  1122. package/dist/renderer/draw/pathPaint.js +0 -142
  1123. package/dist/renderer/draw/pathPaint.js.map +0 -1
  1124. package/dist/renderer/draw/scratchPass.js +0 -83
  1125. package/dist/renderer/draw/scratchPass.js.map +0 -1
  1126. package/dist/renderer/draw/stencil.js +0 -28
  1127. package/dist/renderer/draw/stencil.js.map +0 -1
  1128. package/dist/renderer/draw/text.js +0 -167
  1129. package/dist/renderer/draw/text.js.map +0 -1
  1130. package/dist/renderer/draw/uniforms.js +0 -77
  1131. package/dist/renderer/draw/uniforms.js.map +0 -1
  1132. package/dist/renderer/draw.js +0 -79
  1133. package/dist/renderer/draw.js.map +0 -1
  1134. package/dist/renderer/drawBatch.js +0 -198
  1135. package/dist/renderer/drawBatch.js.map +0 -1
  1136. package/dist/renderer/effects/EffectTargets.js +0 -48
  1137. package/dist/renderer/effects/EffectTargets.js.map +0 -1
  1138. package/dist/renderer/effects/builtins.js +0 -31
  1139. package/dist/renderer/effects/builtins.js.map +0 -1
  1140. package/dist/renderer/effects/composite.js +0 -11
  1141. package/dist/renderer/effects/composite.js.map +0 -1
  1142. package/dist/renderer/effects/effectPrelude.js +0 -10
  1143. package/dist/renderer/effects/effectPrelude.js.map +0 -1
  1144. package/dist/renderer/effects/types.js +0 -10
  1145. package/dist/renderer/effects/types.js.map +0 -1
  1146. package/dist/renderer/glyphOutlineMesh.js +0 -67
  1147. package/dist/renderer/glyphOutlineMesh.js.map +0 -1
  1148. package/dist/renderer/index.js +0 -20
  1149. package/dist/renderer/math/color.js +0 -321
  1150. package/dist/renderer/math/color.js.map +0 -1
  1151. package/dist/renderer/math/mat3.js +0 -80
  1152. package/dist/renderer/math/mat3.js.map +0 -1
  1153. package/dist/renderer/math/patternSpace.js +0 -22
  1154. package/dist/renderer/math/patternSpace.js.map +0 -1
  1155. package/dist/renderer/math/viewToMat3.js +0 -19
  1156. package/dist/renderer/math/viewToMat3.js.map +0 -1
  1157. package/dist/renderer/paintResources.js +0 -18
  1158. package/dist/renderer/paintResources.js.map +0 -1
  1159. package/dist/renderer/paintScratch.js +0 -37
  1160. package/dist/renderer/paintScratch.js.map +0 -1
  1161. package/dist/renderer/shaders/ShaderProgram.js +0 -74
  1162. package/dist/renderer/shaders/ShaderProgram.js.map +0 -1
  1163. package/dist/renderer/shaders/batchFill.js +0 -119
  1164. package/dist/renderer/shaders/batchFill.js.map +0 -1
  1165. package/dist/renderer/shaders/customPrelude.js +0 -34
  1166. package/dist/renderer/shaders/customPrelude.js.map +0 -1
  1167. package/dist/renderer/shaders/extractUniformNames.js +0 -184
  1168. package/dist/renderer/shaders/extractUniformNames.js.map +0 -1
  1169. package/dist/renderer/shaders/glyphPaint.js +0 -61
  1170. package/dist/renderer/shaders/glyphPaint.js.map +0 -1
  1171. package/dist/renderer/shaders/gradFill.js +0 -31
  1172. package/dist/renderer/shaders/gradFill.js.map +0 -1
  1173. package/dist/renderer/shaders/pathFill.js +0 -14
  1174. package/dist/renderer/shaders/pathFill.js.map +0 -1
  1175. package/dist/renderer/shaders/patternFill.js +0 -25
  1176. package/dist/renderer/shaders/patternFill.js.map +0 -1
  1177. package/dist/renderer/shaders/registerProgram.js +0 -18
  1178. package/dist/renderer/shaders/registerProgram.js.map +0 -1
  1179. package/dist/renderer/spriteSheet.js +0 -14
  1180. package/dist/renderer/spriteSheet.js.map +0 -1
  1181. package/dist/renderer/state/GroupState.js +0 -77
  1182. package/dist/renderer/state/GroupState.js.map +0 -1
  1183. package/dist/renderer/strokeLengths.js +0 -50
  1184. package/dist/renderer/strokeLengths.js.map +0 -1
  1185. package/dist/renderer/syntheticItalic.js +0 -6
  1186. package/dist/renderer/syntheticItalic.js.map +0 -1
  1187. package/dist/renderer/textures/registerTexture.js +0 -34
  1188. package/dist/renderer/textures/registerTexture.js.map +0 -1
  1189. package/dist/scheduling/useVisibleRaf.js +0 -69
  1190. package/dist/scheduling/useVisibleRaf.js.map +0 -1
  1191. package/dist/test-seams-DM2B87-g.d.ts +0 -356
@@ -0,0 +1,29 @@
1
+ import { useLayoutEffect as e } from "react";
2
+ import { resolveCursorTier as t } from "@weasel-js/cursor";
3
+ //#region src/canvas/useToolCursor.ts
4
+ function n(e) {
5
+ let n = e.hotkeyEngaged ?? e.active, r = n === null ? void 0 : e.registry[n];
6
+ if (r?.cursor) {
7
+ if (typeof r.cursor != "function") return t(r.cursor);
8
+ try {
9
+ return t(r.cursor());
10
+ } catch {
11
+ return;
12
+ }
13
+ }
14
+ }
15
+ function r(t, r, i, a) {
16
+ let o = r ? n(r) : void 0, s = o === void 0 ? "" : o.kind === "css" ? `css|${o.css}` : `${o.glyph}|${o.angle}|${o.size}|${o.worldRadius}`;
17
+ e(() => {
18
+ t.setBase(o ?? null, a ?? "");
19
+ }, [
20
+ t,
21
+ s,
22
+ i,
23
+ a
24
+ ]);
25
+ }
26
+ //#endregion
27
+ export { r as useToolCursor };
28
+
29
+ //# sourceMappingURL=useToolCursor.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useToolCursor.js","names":["resolveToolsCursor","id","tools","tool","resolveCursorTier","useToolCursor","tier","key","rest","sink","element"],"sources":["../../src/canvas/useToolCursor.ts"],"sourcesContent":["import { useLayoutEffect } from 'react';\nimport { resolveCursorTier, type CursorSink, type ResolvedCursor } from '@weasel-js/cursor';\nimport type { ToolsApi } from '../tools/overlayBinding';\n\nfunction resolveToolsCursor(tools: ToolsApi): ResolvedCursor | undefined {\n const id = tools.hotkeyEngaged ?? tools.active;\n const tool = id === null ? undefined : tools.registry[id];\n if (!tool?.cursor) return undefined;\n if (typeof tool.cursor !== 'function') return resolveCursorTier(tool.cursor);\n try {\n return resolveCursorTier(tool.cursor());\n } catch {\n return undefined;\n }\n}\n\n/**\n * Writes the active tool's cursor to `sink` as its base, and `rest` (the\n * element's own cursor) for when the tool declares none.\n *\n * `element` is what the sink writes to, named so the base is written again\n * when a detached surface's input element arrives a render late.\n */\nexport function useToolCursor(\n sink: CursorSink,\n tools: ToolsApi | undefined,\n element: HTMLElement | null | undefined,\n rest: string | undefined,\n): void {\n const tier = tools ? resolveToolsCursor(tools) : undefined;\n // Keyed on the value, not the object: the tier is rebuilt every render.\n const key = tier === undefined\n ? ''\n : tier.kind === 'css'\n ? `css|${tier.css}`\n : `${tier.glyph}|${tier.angle}|${tier.size}|${tier.worldRadius}`;\n useLayoutEffect(() => {\n sink.setBase(tier ?? null, rest ?? '');\n // `tier` is a fresh object each render; the key is its identity.\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [sink, key, element, rest]);\n}\n"],"mappings":";;;AAIA,SAASA,EAAmB,GAA6C;CACvE,IAAMC,IAAKC,EAAM,iBAAiBA,EAAM,QAClCC,IAAOF,MAAO,OAAO,KAAA,IAAYC,EAAM,SAASD;CACtD,IAAKE,GAAM,QACX;MAAI,OAAOA,EAAK,UAAW,YAAY,OAAOC,EAAkBD,EAAK,MAAM;EAC3E,IAAI;GACF,OAAOC,EAAkBD,EAAK,OAAO,CAAC;EACxC,QAAQ;GACN;EACF;CAL2E;AAM7E;AASA,SAAgBE,EACd,GACA,GACA,GACA,GACM;CACN,IAAMC,IAAOJ,IAAQF,EAAmBE,CAAK,IAAI,KAAA,GAE3CK,IAAMD,MAAS,KAAA,IACjB,KACAA,EAAK,SAAS,QACZ,OAAOA,EAAK,QACZ,GAAGA,EAAK,MAAM,GAAGA,EAAK,MAAM,GAAGA,EAAK,KAAK,GAAGA,EAAK;CACvD,QAAsB;EACpB,EAAK,QAAQA,KAAQ,MAAME,KAAQ,EAAE;CAGvC,GAAG;EAACC;EAAMF;EAAKG;EAASF;CAAI,CAAC;AAC/B"}
@@ -1,73 +1,41 @@
1
1
  import { unionAABB as e } from "../core/geometry/unionBounds.js";
2
- import { aggregatePreviewIds as t, firstPreviewBounds as n, firstPreviewPose as r, toolPreviewSources as i } from "./toolPreview.js";
3
- import { buildChromeState as a } from "../core/selection/chromeState.js";
4
- import { useCallback as o, useMemo as s } from "react";
5
- import { useLatest as c } from "@weasel-js/react";
2
+ import { framedBounds as t } from "../core/geometry/poseDescriptor.js";
3
+ import { buildChromeState as n } from "../core/selection/chromeState.js";
4
+ import { useCallback as r, useMemo as i } from "react";
5
+ import { useLatest as a } from "@weasel-js/react";
6
6
  //#region src/canvas/useViewHelpers.ts
7
- var l = () => {}, u = () => !0;
8
- function d(e, t) {
7
+ var o = () => {}, s = () => !0;
8
+ function c(e, t) {
9
9
  return typeof e.getWorldPose == "function" ? e.getWorldPose(t) : e.getPose(t);
10
10
  }
11
- function f(f) {
12
- let { adapter: p, geometry: m, boundsOf: h, boundsOfPose: g, selection: _, tools: v, gestureSource: y, previewPoseExtra: b, previewIdsExtra: x, getIsVisible: S } = f, C = o((e, t) => g ? g(e, t) : m.getBounds(t), [g, m]), w = s(() => {
13
- if (h) return h;
14
- if (p) return (e) => {
11
+ function l(l) {
12
+ let { adapter: u, geometry: d, boundsOf: f, boundsOfPose: p, selection: m, gestureSource: h, previewPoseExtra: g, getIsVisible: _ } = l, v = r((e, n) => p ? p(e, n) : t(n, d), [p, d]), y = i(() => {
13
+ if (f) return f;
14
+ if (u) return (e) => {
15
15
  try {
16
- let t = d(p, e), n = m.getBounds(t), r = m.getRotation?.(t);
17
- return r ? {
18
- ...n,
19
- rotation: r
20
- } : n;
16
+ return t(c(u, e), d);
21
17
  } catch {
22
18
  return null;
23
19
  }
24
20
  };
25
21
  }, [
26
- h,
27
- p,
28
- m
29
- ]), T = o((e) => {
30
- if (!p) return null;
22
+ f,
23
+ u,
24
+ d
25
+ ]), b = r((e) => {
26
+ if (!u) return null;
31
27
  try {
32
- return d(p, e);
28
+ return c(u, e);
33
29
  } catch {
34
30
  return null;
35
31
  }
36
- }, [p]), E = _.length > 1, D = c({
37
- previewPoseExtra: b,
38
- previewIdsExtra: x
39
- }), O = s(() => h ?? w, [h, w]), k = o((e) => {
40
- if (v) {
41
- let t = r(v, e);
42
- if (t != null) return t;
43
- }
44
- let t = D.current.previewPoseExtra;
45
- if (t) {
46
- let n = t(e);
47
- if (n != null) return n;
48
- }
49
- return null;
50
- }, [v, D]), A = o((e) => {
51
- if (v) {
52
- let t = n(v, e);
53
- if (t) return t;
54
- let i = r(v, e);
55
- if (i != null) return C(e, i);
56
- }
57
- let t = D.current.previewPoseExtra;
58
- if (t) {
59
- let n = t(e);
60
- if (n != null) return C(e, n);
61
- }
62
- return null;
63
- }, [
64
- v,
65
- C,
66
- D
67
- ]), j = o((e) => A(e) || (O ? O(e) : null), [A, O]), M = s(() => a({
68
- selection: _,
69
- multiActive: E,
70
- effectiveBoundsOf: j,
32
+ }, [u]), x = m.length > 1, S = a(g), C = i(() => f ?? y, [f, y]), w = r((e) => S.current?.(e) ?? null, [S]), T = r((e) => {
33
+ let t = w(e);
34
+ return t == null ? null : v(e, t);
35
+ }, [w, v]), E = r((e) => T(e) || (C ? C(e) : null), [T, C]), D = i(() => n({
36
+ selection: m,
37
+ multiActive: x,
38
+ effectiveBoundsOf: E,
71
39
  modifiers: {
72
40
  alt: !1,
73
41
  shift: !1,
@@ -75,46 +43,39 @@ function f(f) {
75
43
  ctrl: !1
76
44
  },
77
45
  canRotate: (e) => {
78
- if (!m.supportsRotation) return !0;
79
- let t = T(e);
80
- return t == null || m.supportsRotation(t);
46
+ if (!d.supportsRotation) return !0;
47
+ let t = b(e);
48
+ return t == null || d.supportsRotation(t);
81
49
  }
82
50
  }), [
83
- _,
84
- E,
85
- j,
86
51
  m,
87
- T
52
+ x,
53
+ E,
54
+ d,
55
+ b
88
56
  ]);
89
57
  return {
90
58
  helpers: {
91
- getEffectivePose: (e) => k(e) ?? T(e),
92
- getEffectiveBounds: j,
59
+ getEffectivePose: (e) => w(e) ?? b(e),
60
+ getEffectiveBounds: E,
93
61
  getGestureBounds: () => {
94
- let n = t(v), r = y?.ids();
95
- if (r) for (let e of r) n.add(e);
96
- let i = [];
97
- for (let e of n) i.push(A(e));
98
- let a = y?.bounds();
99
- if (a) for (let e of a) i.push(e);
100
- return e(i);
62
+ let t = [];
63
+ for (let e of new Set(h?.ids() ?? [])) t.push(T(e));
64
+ let n = h?.bounds();
65
+ if (n) for (let e of n) t.push(e);
66
+ return e(t);
101
67
  },
102
- subscribeGestures: (e) => y?.subscribe(e) ?? l,
103
- getGestureVersion: () => y?.getVersion() ?? 0,
104
- getChromeState: () => M,
105
- getPreviewSources: () => [...i(v), ...y?.previewSources() ?? []],
106
- getGestureOverlays: () => y?.overlays() ?? [],
107
- getIsVisible: () => S?.() ?? u
68
+ subscribeGestures: (e) => h?.subscribe(e) ?? o,
69
+ getGestureVersion: () => h?.getVersion() ?? 0,
70
+ getChromeState: () => D,
71
+ getPreviewSources: () => h?.previewSources() ?? [],
72
+ getGestureOverlays: () => h?.overlays() ?? [],
73
+ getIsVisible: () => _?.() ?? s
108
74
  },
109
- chromeState: M,
110
- committedPoseOf: T,
111
- effectiveBoundsOf: O,
112
- previewToolPose: k,
113
- previewToolBounds: A,
114
- previewExtraRef: D
75
+ chromeState: D
115
76
  };
116
77
  }
117
78
  //#endregion
118
- export { f as useViewHelpers };
79
+ export { l as useViewHelpers };
119
80
 
120
81
  //# sourceMappingURL=useViewHelpers.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"useViewHelpers.js","names":["noOpUnsubscribe","alwaysVisible","worldPoseOf","adapter","id","useViewHelpers","opts","boxOf","useCallback","boundsOfPose","pose","geometry","baseBoundsOf","useMemo","boundsOf","b","rot","committedPoseOf","multiActive","selection","previewExtraRef","useLatest","effectiveBoundsOf","previewToolPose","tools","p","firstPreviewPose","extra","previewToolBounds","firstPreviewBounds","boundsWithPreview","chromeState","buildChromeState","ids","aggregatePreviewIds","extraIds","gestureSource","parts","extraBounds","unionAABB","fn","toolPreviewSources","getIsVisible"],"sources":["../../src/canvas/useViewHelpers.ts"],"sourcesContent":["import { useCallback, useMemo } from 'react';\nimport { useLatest } from '@weasel-js/react';\nimport { firstPreviewPose, firstPreviewBounds, aggregatePreviewIds, toolPreviewSources } from './toolPreview';\nimport type { GestureSource, GesturePreviewSource } from './gestureBounds';\nimport type { OngoingOverlay } from '@weasel-js/routing';\nimport { unionAABB } from 'core/geometry/unionBounds';\nimport { buildChromeState, type ChromeState } from 'core/selection/chromeState';\nimport type { PoseDescriptor } from 'interactions/actions/resize/geometry';\nimport type { NodeId } from 'core/scene/types';\nimport type { ToolsApi } from '../tools/overlayBinding';\nimport type { DebugSink } from '../debug/types';\nimport type { Bounds } from 'core/viewport/fitViewToBounds';\n\nconst noOpUnsubscribe = (): void => {};\n\nconst alwaysVisible = (): boolean => true;\n\n/**\n * The half of {@link CanvasHelpers} that belongs to one view — everything\n * answered by a camera's own tools, gestures and selection. A canvas hosting\n * several viewports needs one of these per view; the surface half is shared.\n */\nexport interface CanvasViewHelpers<TPose> {\n /** Pose currently displayed for `id` — drag/resize/rotate overlay if active,\n * otherwise the committed pose from the adapter. Returns `null` if the id\n * isn't known. */\n getEffectivePose(id: string): TPose | null;\n /** Overlay-aware bounds for `id`. */\n getEffectiveBounds(id: string): Bounds | null;\n /**\n * World-space AABB of everything the in-flight gesture proposes — the\n * displaced poses of nodes being moved / resized / rotated / cloned, plus\n * any nascent insert that has no scene node yet. `null` when no gesture is\n * in flight.\n *\n * This reports the *gesture*, not the document: committed content the\n * gesture isn't touching is excluded, so a consumer that wants the union\n * with the rest of the scene still walks its own ids through\n * `getEffectiveBounds`. It exists because every other lookup here is keyed\n * by node id, which can't answer \"where is the shape the user is drawing\n * right now\" — a drag-to-insert has no id until pointer-up.\n *\n * Select-only gestures are deliberately excluded: a marquee or lasso has\n * geometry but proposes no content, and a consumer sizing itself to the\n * gesture must not grow because the user swept a selection rectangle.\n *\n * The result is a plain AABB — never rotated. Rotated parts are folded in\n * by their rotated extent (a union of several oriented boxes has no single\n * orientation to report).\n */\n getGestureBounds(): Bounds | null;\n /**\n * Subscribe to the gesture layer's change signal — the other half of the\n * `useSyncExternalStore` contract for everything on this object that moves\n * during a drag (`getEffectivePose`, `getEffectiveBounds`,\n * `getGestureBounds`). Returns an unsubscribe.\n *\n * Fires once per dispatcher pump: gesture start, every pointermove that\n * reaches an in-flight handle, end, and cancel — plus UI-driven ongoing\n * actions (a slider bound to an ongoing action pumps the same way). It\n * fires on the pump, not on a diff: a pump that changed nothing observable\n * still notifies, so don't hang expensive work directly off the callback.\n *\n * It does **not** cover committed scene edits (subscribe to the scene for\n * those) or previews a consumer's own tool publishes from React state\n * (that tool re-renders on its own).\n *\n * Without a gesture source wired — a bare `<Canvas>` — this is a no-op\n * subscription that never fires.\n */\n subscribeGestures(fn: () => void): () => void;\n /**\n * Monotonic counter bumped on exactly the events `subscribeGestures` fires\n * on. Pair the two for `useSyncExternalStore`:\n *\n * ```ts\n * const gestureVersion = useSyncExternalStore(\n * useCallback((cb) => helpersRef.current?.subscribeGestures(cb) ?? (() => {}), []),\n * () => helpersRef.current?.getGestureVersion() ?? 0,\n * );\n * ```\n *\n * Starts at 0 and only increases. `0` is also what a bare `<Canvas>` with\n * no gesture source reports, forever.\n */\n getGestureVersion(): number;\n /** Returns the live ChromeState built once per render. Affordances and\n * custom layers that need overlay-aware selection state (selection ids,\n * bounds, multi-union AABB, modifier flags) read from this. */\n getChromeState(): ChromeState;\n /**\n * Everything publishing an in-flight preview for this view, in resolution\n * order: tool-side first (hotkey → active → registry → ambient), then the\n * handles in flight on this view's dispatcher. Readers take the first\n * non-null answer per id.\n *\n * A ghost layer must read this off its draw envelope rather than close over\n * a dispatcher: one layer array paints every view, so a closure ghosts view\n * zero's drag into every panel.\n */\n getPreviewSources(): readonly GesturePreviewSource[];\n /** Overlay shapes this view's in-flight handles publish — marquee, lasso,\n * insert preview, raw commands. Same envelope rule as\n * {@link CanvasViewHelpers.getPreviewSources}. */\n getGestureOverlays(): readonly OngoingOverlay[];\n /**\n * Chrome-caps visibility predicate, keyed by chrome id. Overlay layers and\n * affordances call it per element to decide whether to draw / hit-test.\n *\n * The rule table is the surface's; the context it resolves against is this\n * view's selection, camera and in-flight action — so the predicate belongs\n * here rather than on {@link CanvasSurfaceHelpers}. Unwired, it is the\n * universal `() => true`.\n */\n getIsVisible(): (id: string) => boolean;\n}\n\n/**\n * The half of {@link CanvasHelpers} that belongs to the surface — one GL\n * context, one debug sink, however many views are drawn on it.\n */\nexport interface CanvasSurfaceHelpers {\n /** Active debug sink, when `<Canvas debug=...>` is enabled. Layers that\n * want to participate in `hitboxes`/`bounds`/etc. visualization can\n * call into this from their `draw` callback. Returns `null` when\n * debug is off — no-op for production renders. */\n getDebug(): DebugSink | null;\n}\n\n/** Live overlay-aware lookups exposed to custom layers via `helpersRef`.\n * What a layer receives as its `data` argument, unchanged: the two halves\n * are split so a per-view set can be built independently of the surface's,\n * not to make layers ask for one. */\nexport interface CanvasHelpers<TPose> extends CanvasViewHelpers<TPose>, CanvasSurfaceHelpers {\n /**\n * The view this draw is for: a `<CanvasView>` id, or `null` for the\n * surface's own camera. One layer array paints every view, so a layer that\n * belongs in some views and not others — a minimap's indicator — declines\n * the rest by this id.\n */\n readonly viewId: string | null;\n}\n\nexport interface UseViewHelpersOpts<TPose> {\n /** Only `getPose` is read here — the narrow slice keeps this hook off the\n * full adapter contract. */\n adapter: { getPose(id: string): TPose } | undefined;\n geometry: PoseDescriptor<TPose>;\n /** Consumer-supplied bounds resolver. Falls back to the adapter's pose. */\n boundsOf: ((id: string) => Bounds | null) | undefined;\n /** Bounds of `id` drawn at an in-flight `pose`. Falls back to the\n * geometry's box of that pose, which is wrong wherever the surface draws a\n * node somewhere its pose does not say — a parallax plane. */\n boundsOfPose?: ((id: string, pose: TPose) => Bounds | null) | undefined;\n selection: readonly NodeId[];\n tools: ToolsApi | undefined;\n gestureSource: GestureSource | undefined;\n /** Dispatcher-published preview overlays, read through a ref so a change\n * mid-gesture doesn't rebuild the memos that depend on them. */\n previewPoseExtra: ((id: string) => unknown) | undefined;\n previewIdsExtra: (() => Iterable<string> | null) | undefined;\n /** Chrome-caps predicate for this view. Absent means everything is visible. */\n getIsVisible?: (() => (id: string) => boolean) | undefined;\n}\n\nexport interface ViewHelpersBundle<TPose> {\n helpers: CanvasViewHelpers<TPose>;\n chromeState: ChromeState;\n /** Committed pose straight from the adapter, no overlay applied. */\n committedPoseOf(id: string): TPose | null;\n /** Bounds resolver after the `boundsOf` / adapter fallback, before previews. */\n effectiveBoundsOf: ((id: string) => Bounds | null) | undefined;\n previewToolPose(id: string): TPose | null;\n previewToolBounds(id: string): Bounds | null;\n /** Live dispatcher preview extras, for callers outside this bundle. */\n previewExtraRef: React.MutableRefObject<{\n previewPoseExtra: ((id: string) => unknown) | undefined;\n previewIdsExtra: (() => Iterable<string> | null) | undefined;\n }>;\n}\n\n/**\n * Build one view's overlay-aware state: its chrome and the lookups its layers\n * draw and hit-test against.\n *\n * This is a hook, so it runs once per component. That is the point — N views\n * cannot be a loop inside one component, but they can be N components each\n * calling this once.\n */\n/** The composed pose when the adapter resolves one, its stored pose otherwise.\n * Adapters predating `getWorldPose` are absolute-pose, where the two agree. */\nfunction worldPoseOf<TPose>(\n adapter: { getPose(id: string): TPose; getWorldPose?(id: string): TPose },\n id: string,\n): TPose {\n return typeof adapter.getWorldPose === 'function' ? adapter.getWorldPose(id) : adapter.getPose(id);\n}\n\nexport function useViewHelpers<TPose>(\n opts: UseViewHelpersOpts<TPose>,\n): ViewHelpersBundle<TPose> {\n const {\n adapter, geometry, boundsOf, boundsOfPose, selection, tools, gestureSource,\n previewPoseExtra, previewIdsExtra, getIsVisible,\n } = opts;\n const boxOf = useCallback(\n (id: string, pose: TPose): Bounds | null =>\n (boundsOfPose ? boundsOfPose(id, pose) : geometry.getBounds(pose)),\n [boundsOfPose, geometry],\n );\n\n const baseBoundsOf = useMemo(() => {\n if (boundsOf) return boundsOf;\n if (!adapter) return undefined;\n return (id: string): Bounds | null => {\n try {\n // World: chrome is drawn over the picture, so it has to agree with\n // where the renderer put the node, not with where its pose is stored.\n const pose = worldPoseOf(adapter, id);\n const b = geometry.getBounds(pose);\n const rot = geometry.getRotation?.(pose);\n return rot ? { ...b, rotation: rot } : b;\n } catch {\n return null;\n }\n };\n }, [boundsOf, adapter, geometry]);\n\n const committedPoseOf = useCallback((id: string): TPose | null => {\n if (!adapter) return null;\n try {\n return worldPoseOf(adapter, id);\n } catch {\n return null;\n }\n }, [adapter]);\n\n const multiActive = selection.length > 1;\n\n const previewExtraRef = useLatest({ previewPoseExtra, previewIdsExtra });\n\n const effectiveBoundsOf = useMemo(() => boundsOf ?? baseBoundsOf, [boundsOf, baseBoundsOf]);\n\n // The live overlay a gesture proposes for `id`: the active tool's published\n // preview first, then the dispatcher's preview extras. `null` when nothing\n // is mid-gesture — callers fall through to committed state.\n const previewToolPose = useCallback((id: string): TPose | null => {\n if (tools) {\n const p = firstPreviewPose(tools, id);\n if (p != null) return p as TPose;\n }\n const extra = previewExtraRef.current.previewPoseExtra;\n if (extra) {\n const p = extra(id);\n if (p != null) return p as TPose;\n }\n return null;\n }, [tools, previewExtraRef]);\n const previewToolBounds = useCallback((id: string): Bounds | null => {\n if (tools) {\n const b = firstPreviewBounds(tools, id);\n if (b) return b;\n const p = firstPreviewPose(tools, id);\n if (p != null) return boxOf(id, p as TPose);\n }\n const extra = previewExtraRef.current.previewPoseExtra;\n if (extra) {\n const p = extra(id);\n if (p != null) return boxOf(id, p as TPose);\n }\n return null;\n }, [tools, boxOf, previewExtraRef]);\n\n /**\n * Bounds for `id` with any in-flight gesture folded in — what the user can\n * see, not what is committed. Both the chrome state and the layer helpers\n * answer bounds questions with this, so resize handles cannot end up a frame\n * away from the shape they belong to.\n */\n const boundsWithPreview = useCallback((id: string): Bounds | null => {\n const previewed = previewToolBounds(id);\n if (previewed) return previewed;\n return effectiveBoundsOf ? effectiveBoundsOf(id) : null;\n }, [previewToolBounds, effectiveBoundsOf]);\n\n const chromeState: ChromeState = useMemo(\n () => buildChromeState({\n selection,\n multiActive,\n effectiveBoundsOf: boundsWithPreview,\n modifiers: { alt: false, shift: false, meta: false, ctrl: false },\n // Rotation-capability predicate. Reads the committed pose (gestures\n // don't change descriptor capability) and asks the geometry. Absent\n // adapter / unknown ids fall back to `true` so the affordance stays\n // visible — preserves pre-existing behavior for consumers that wire\n // bounds without an adapter.\n canRotate: (id) => {\n if (!geometry.supportsRotation) return true;\n const pose = committedPoseOf(id);\n if (pose == null) return true;\n return geometry.supportsRotation(pose);\n },\n }),\n [selection, multiActive, boundsWithPreview, geometry, committedPoseOf],\n );\n\n const helpers: CanvasViewHelpers<TPose> = {\n getEffectivePose: (id: string): TPose | null => {\n const tp = previewToolPose(id);\n if (tp != null) return tp;\n return committedPoseOf(id);\n },\n getEffectiveBounds: boundsWithPreview,\n getGestureBounds: (): Bounds | null => {\n // In-flight ids come from both preview sources the ghost layer walks:\n // tool-published `previewIds()` and the dispatcher's in-flight handles\n // (via `gestureSource.ids()`). Using the same sets keeps this from\n // disagreeing with what the user sees ghosted.\n const ids = aggregatePreviewIds(tools);\n const extraIds = gestureSource?.ids();\n if (extraIds) for (const id of extraIds) ids.add(id);\n\n const parts: (Bounds | null)[] = [];\n for (const id of ids) parts.push(previewToolBounds(id));\n // Nascent inserts have no id to look up — they arrive as ready-made\n // world AABBs.\n const extraBounds = gestureSource?.bounds();\n if (extraBounds) for (const b of extraBounds) parts.push(b);\n return unionAABB(parts);\n },\n subscribeGestures: (fn: () => void): (() => void) =>\n gestureSource?.subscribe(fn) ?? noOpUnsubscribe,\n getGestureVersion: (): number => gestureSource?.getVersion() ?? 0,\n getChromeState: () => chromeState,\n getPreviewSources: (): readonly GesturePreviewSource[] => [\n ...toolPreviewSources(tools),\n ...(gestureSource?.previewSources() ?? []),\n ],\n getGestureOverlays: (): readonly OngoingOverlay[] => gestureSource?.overlays() ?? [],\n getIsVisible: (): ((id: string) => boolean) => getIsVisible?.() ?? alwaysVisible,\n };\n\n return {\n helpers,\n chromeState,\n committedPoseOf,\n effectiveBoundsOf,\n previewToolPose,\n previewToolBounds,\n previewExtraRef,\n };\n}\n"],"mappings":";;;;;;AAaA,IAAMA,UAA8B,CAAC,GAE/BC,UAA+B;AAgLrC,SAASC,EACP,GACA,GACO;CACP,OAAO,OAAOC,EAAQ,gBAAiB,aAAaA,EAAQ,aAAaC,CAAE,IAAID,EAAQ,QAAQC,CAAE;AACnG;AAEA,SAAgBC,EACd,GAC0B;CAC1B,IAAM,EACJ,YAAS,aAAU,aAAU,iBAAc,cAAW,UAAO,kBAC7D,qBAAkB,oBAAiB,oBACjCC,GACEC,IAAQC,GACX,GAAY,MACVC,IAAeA,EAAaL,GAAIM,CAAI,IAAIC,EAAS,UAAUD,CAAI,GAClE,CAACD,GAAcE,CAAQ,CACzB,GAEMC,IAAeC,QAAc;EACjC,IAAIC,GAAU,OAAOA;EACrB,IAAKX,GACL,QAAQ,MAA8B;GACpC,IAAI;IAGF,IAAMO,IAAOR,EAAYC,GAASC,CAAE,GAC9BW,IAAIJ,EAAS,UAAUD,CAAI,GAC3BM,IAAML,EAAS,cAAcD,CAAI;IACvC,OAAOM,IAAM;KAAE,GAAGD;KAAG,UAAUC;IAAI,IAAID;GACzC,QAAQ;IACN,OAAO;GACT;EACF;CACF,GAAG;EAACD;EAAUX;EAASQ;CAAQ,CAAC,GAE1BM,IAAkBT,GAAa,MAA6B;EAChE,IAAI,CAACL,GAAS,OAAO;EACrB,IAAI;GACF,OAAOD,EAAYC,GAASC,CAAE;EAChC,QAAQ;GACN,OAAO;EACT;CACF,GAAG,CAACD,CAAO,CAAC,GAENe,IAAcC,EAAU,SAAS,GAEjCC,IAAkBC,EAAU;EAAE;EAAkB;CAAgB,CAAC,GAEjEC,IAAoBT,QAAcC,KAAYF,GAAc,CAACE,GAAUF,CAAY,CAAC,GAKpFW,IAAkBf,GAAa,MAA6B;EAChE,IAAIgB,GAAO;GACT,IAAMC,IAAIC,EAAiBF,GAAOpB,CAAE;GACpC,IAAIqB,KAAK,MAAM,OAAOA;EACxB;EACA,IAAME,IAAQP,EAAgB,QAAQ;EACtC,IAAIO,GAAO;GACT,IAAMF,IAAIE,EAAMvB,CAAE;GAClB,IAAIqB,KAAK,MAAM,OAAOA;EACxB;EACA,OAAO;CACT,GAAG,CAACD,GAAOJ,CAAe,CAAC,GACrBQ,IAAoBpB,GAAa,MAA8B;EACnE,IAAIgB,GAAO;GACT,IAAMT,IAAIc,EAAmBL,GAAOpB,CAAE;GACtC,IAAIW,GAAG,OAAOA;GACd,IAAMU,IAAIC,EAAiBF,GAAOpB,CAAE;GACpC,IAAIqB,KAAK,MAAM,OAAOlB,EAAMH,GAAIqB,CAAU;EAC5C;EACA,IAAME,IAAQP,EAAgB,QAAQ;EACtC,IAAIO,GAAO;GACT,IAAMF,IAAIE,EAAMvB,CAAE;GAClB,IAAIqB,KAAK,MAAM,OAAOlB,EAAMH,GAAIqB,CAAU;EAC5C;EACA,OAAO;CACT,GAAG;EAACD;EAAOjB;EAAOa;CAAe,CAAC,GAQ5BU,IAAoBtB,GAAa,MACnBoB,EAAkBxB,CAChC,MACGkB,IAAoBA,EAAkBlB,CAAE,IAAI,OAClD,CAACwB,GAAmBN,CAAiB,CAAC,GAEnCS,IAA2BlB,QACzBmB,EAAiB;EACrB;EACA;EACA,mBAAmBF;EACnB,WAAW;GAAE,KAAK;GAAO,OAAO;GAAO,MAAM;GAAO,MAAM;EAAM;EAMhE,YAAY,MAAO;GACjB,IAAI,CAACnB,EAAS,kBAAkB,OAAO;GACvC,IAAMD,IAAOO,EAAgBb,CAAE;GAE/B,OADIM,KAAQ,QACLC,EAAS,iBAAiBD,CAAI;EACvC;CACF,CAAC,GACD;EAACS;EAAWD;EAAaY;EAAmBnB;EAAUM;CAAe,CACvE;CAsCA,OAAO;EACL,SAAA;GApCA,mBAAmB,MACNM,EAAgBnB,CACvB,KACGa,EAAgBb,CAAE;GAE3B,oBAAoB0B;GACpB,wBAAuC;IAKrC,IAAMG,IAAMC,EAAoBV,CAAK,GAC/BW,IAAWC,GAAe,IAAI;IACpC,IAAID,GAAU,KAAK,IAAM/B,KAAM+B,GAAU,EAAI,IAAI/B,CAAE;IAEnD,IAAMiC,IAA2B,CAAC;IAClC,KAAK,IAAMjC,KAAM6B,GAAK,EAAM,KAAKL,EAAkBxB,CAAE,CAAC;IAGtD,IAAMkC,IAAcF,GAAe,OAAO;IAC1C,IAAIE,GAAa,KAAK,IAAMvB,KAAKuB,GAAa,EAAM,KAAKvB,CAAC;IAC1D,OAAOwB,EAAUF,CAAK;GACxB;GACA,oBAAoB,MAClBD,GAAe,UAAUI,CAAE,KAAKxC;GAClC,yBAAiCoC,GAAe,WAAW,KAAK;GAChE,sBAAsBL;GACtB,yBAA0D,CACxD,GAAGU,EAAmBjB,CAAK,GAC3B,GAAIY,GAAe,eAAe,KAAK,CAAC,CAC1C;GACA,0BAAqDA,GAAe,SAAS,KAAK,CAAC;GACnF,oBAA+CM,IAAe,KAAKzC;EAInE;EACA;EACA;EACA;EACA;EACA;EACA;CACF;AACF"}
1
+ {"version":3,"file":"useViewHelpers.js","names":["noOpUnsubscribe","alwaysVisible","worldPoseOf","adapter","id","useViewHelpers","opts","boxOf","useCallback","boundsOfPose","pose","framedBounds","geometry","baseBoundsOf","useMemo","boundsOf","committedPoseOf","multiActive","selection","previewPoseExtraRef","useLatest","previewPoseExtra","effectiveBoundsOf","previewPoseOf","previewBoundsOf","p","boundsWithPreview","chromeState","buildChromeState","parts","gestureSource","extraBounds","b","unionAABB","fn","getIsVisible"],"sources":["../../src/canvas/useViewHelpers.ts"],"sourcesContent":["import { useCallback, useMemo } from 'react';\nimport { framedBounds } from 'core/geometry/poseDescriptor';\nimport { useLatest } from '@weasel-js/react';\nimport type { GestureSource, GesturePreviewSource } from './gestureBounds';\nimport type { OngoingOverlay } from '@weasel-js/routing';\nimport { unionAABB } from 'core/geometry/unionBounds';\nimport { buildChromeState, type ChromeState } from 'core/selection/chromeState';\nimport type { PoseDescriptor } from 'interactions/actions/resize/geometry';\nimport type { NodeId } from 'core/scene/types';\nimport type { DebugSink } from '../debug/types';\nimport type { Bounds } from 'core/viewport/fitViewToBounds';\n\nconst noOpUnsubscribe = (): void => {};\n\nconst alwaysVisible = (): boolean => true;\n\n/**\n * The half of {@link CanvasHelpers} that belongs to one view — everything\n * answered by a camera's own tools, gestures and selection. A canvas hosting\n * several viewports needs one of these per view; the surface half is shared.\n */\nexport interface CanvasViewHelpers<TPose> {\n /** Pose currently displayed for `id` — drag/resize/rotate overlay if active,\n * otherwise the committed pose from the adapter. Returns `null` if the id\n * isn't known. */\n getEffectivePose(id: string): TPose | null;\n /** Overlay-aware bounds for `id`. */\n getEffectiveBounds(id: string): Bounds | null;\n /**\n * World-space AABB of everything the in-flight gesture proposes — the\n * displaced poses of nodes being moved / resized / rotated / cloned, plus\n * any nascent insert that has no scene node yet. `null` when no gesture is\n * in flight.\n *\n * This reports the *gesture*, not the document: committed content the\n * gesture isn't touching is excluded. Select-only gestures are excluded\n * too: a marquee or lasso has geometry but proposes no content.\n *\n * The result is a plain AABB — never rotated. Rotated parts are folded in\n * by their rotated extent.\n */\n getGestureBounds(): Bounds | null;\n /**\n * Subscribe to the gesture layer's change signal, for everything on this\n * object that moves during a drag (`getEffectivePose`, `getEffectiveBounds`,\n * `getGestureBounds`). Returns an unsubscribe.\n *\n * Fires once per dispatcher pump: gesture start, every pointermove that\n * reaches an in-flight handle, end, and cancel — plus UI-driven ongoing\n * actions. It fires on the pump, not on a diff: a pump that changed nothing\n * observable still notifies, so don't hang expensive work directly off the\n * callback.\n *\n * It does **not** cover committed scene edits (subscribe to the scene for\n * those) or previews a consumer's own tool publishes from React state.\n * Without a gesture source wired — a bare `<Canvas>` — it never fires.\n */\n subscribeGestures(fn: () => void): () => void;\n /**\n * Monotonic counter bumped on exactly the events `subscribeGestures` fires\n * on. Pair the two for `useSyncExternalStore`:\n *\n * ```ts\n * const gestureVersion = useSyncExternalStore(\n * useCallback((cb) => helpersRef.current?.subscribeGestures(cb) ?? (() => {}), []),\n * () => helpersRef.current?.getGestureVersion() ?? 0,\n * );\n * ```\n *\n * Starts at 0 and only increases. `0` is also what a bare `<Canvas>` with\n * no gesture source reports, forever.\n */\n getGestureVersion(): number;\n /** The live ChromeState built once per render: overlay-aware selection\n * state for affordances and custom layers. */\n getChromeState(): ChromeState;\n /**\n * Everything publishing an in-flight preview for this view: the handles in\n * flight on its dispatcher, in dispatch order. Readers take the first\n * non-null answer per id.\n *\n * A ghost layer must read this off its draw envelope rather than close over\n * a dispatcher: one layer array paints every view, so a closure ghosts view\n * zero's drag into every panel.\n */\n getPreviewSources(): readonly GesturePreviewSource[];\n /** Overlay shapes this view's in-flight handles publish — marquee, lasso,\n * insert preview, raw commands. Same envelope rule as\n * {@link CanvasViewHelpers.getPreviewSources}. */\n getGestureOverlays(): readonly OngoingOverlay[];\n /**\n * Chrome-caps visibility predicate, keyed by chrome id. Overlay layers and\n * affordances call it per element to decide whether to draw / hit-test.\n * Unwired, it is the universal `() => true`.\n */\n getIsVisible(): (id: string) => boolean;\n}\n\n/**\n * The half of {@link CanvasHelpers} that belongs to the surface — one GL\n * context, one debug sink, however many views are drawn on it.\n */\nexport interface CanvasSurfaceHelpers {\n /** Active debug sink, when `<Canvas debug=...>` is enabled, for layers to\n * call from their `draw` callback. `null` when debug is off. */\n getDebug(): DebugSink | null;\n}\n\n/** Live overlay-aware lookups exposed to custom layers via `helpersRef`, and\n * what a layer receives as its `data` argument. */\nexport interface CanvasHelpers<TPose> extends CanvasViewHelpers<TPose>, CanvasSurfaceHelpers {\n /**\n * The view this draw is for: a `<CanvasView>` id, or `null` for the\n * surface's own camera. One layer array paints every view, so a layer that\n * belongs in some views and not others — a minimap's indicator — declines\n * the rest by this id.\n */\n readonly viewId: string | null;\n}\n\n/** What a view's pose and bounds lookups read of an adapter. */\nexport interface ViewPoseAdapter<TPose> {\n getPose(id: string): TPose;\n /** Where the node is drawn, when the adapter composes poses. An adapter\n * without it stores absolute poses, where the two agree. */\n getWorldPose?(id: string): TPose;\n}\n\nexport interface UseViewHelpersOpts<TPose> {\n adapter: ViewPoseAdapter<TPose> | undefined;\n geometry: PoseDescriptor<TPose>;\n /** Consumer-supplied bounds resolver. Falls back to the adapter's pose. */\n boundsOf: ((id: string) => Bounds | null) | undefined;\n /** Bounds of `id` drawn at an in-flight `pose`. Falls back to the\n * geometry's box of that pose, which is wrong wherever the surface draws a\n * node somewhere its pose does not say — a parallax plane. */\n boundsOfPose?: ((id: string, pose: TPose) => Bounds | null) | undefined;\n selection: readonly NodeId[];\n gestureSource: GestureSource | undefined;\n /** The dispatcher's preview pose for an id, read through a ref so a change\n * mid-gesture doesn't rebuild the memos that depend on it. */\n previewPoseExtra: ((id: string) => unknown) | undefined;\n /** Chrome-caps predicate for this view. Absent means everything is visible. */\n getIsVisible?: (() => (id: string) => boolean) | undefined;\n}\n\nexport interface ViewHelpersBundle<TPose> {\n helpers: CanvasViewHelpers<TPose>;\n chromeState: ChromeState;\n}\n\nfunction worldPoseOf<TPose>(adapter: ViewPoseAdapter<TPose>, id: string): TPose {\n return typeof adapter.getWorldPose === 'function' ? adapter.getWorldPose(id) : adapter.getPose(id);\n}\n\n/**\n * Build one view's overlay-aware state: its chrome and the lookups its layers\n * draw and hit-test against. A canvas with N views mounts N components each\n * calling this once.\n */\nexport function useViewHelpers<TPose>(\n opts: UseViewHelpersOpts<TPose>,\n): ViewHelpersBundle<TPose> {\n const {\n adapter, geometry, boundsOf, boundsOfPose, selection, gestureSource,\n previewPoseExtra, getIsVisible,\n } = opts;\n const boxOf = useCallback(\n (id: string, pose: TPose): Bounds | null =>\n (boundsOfPose ? boundsOfPose(id, pose) : framedBounds(pose, geometry)),\n [boundsOfPose, geometry],\n );\n\n const baseBoundsOf = useMemo(() => {\n if (boundsOf) return boundsOf;\n if (!adapter) return undefined;\n return (id: string): Bounds | null => {\n try {\n // World: chrome is drawn over the picture, so it has to agree with\n // where the renderer put the node, not with where its pose is stored.\n return framedBounds(worldPoseOf(adapter, id), geometry);\n } catch {\n return null;\n }\n };\n }, [boundsOf, adapter, geometry]);\n\n const committedPoseOf = useCallback((id: string): TPose | null => {\n if (!adapter) return null;\n try {\n return worldPoseOf(adapter, id);\n } catch {\n return null;\n }\n }, [adapter]);\n\n const multiActive = selection.length > 1;\n\n const previewPoseExtraRef = useLatest(previewPoseExtra);\n\n const effectiveBoundsOf = useMemo(() => boundsOf ?? baseBoundsOf, [boundsOf, baseBoundsOf]);\n\n const previewPoseOf = useCallback((id: string): TPose | null => {\n const p = previewPoseExtraRef.current?.(id);\n return p != null ? (p as TPose) : null;\n }, [previewPoseExtraRef]);\n const previewBoundsOf = useCallback((id: string): Bounds | null => {\n const p = previewPoseOf(id);\n return p != null ? boxOf(id, p) : null;\n }, [previewPoseOf, boxOf]);\n\n /**\n * Bounds for `id` with any in-flight gesture folded in — what the user can\n * see, not what is committed. Both the chrome state and the layer helpers\n * answer bounds questions with this, so resize handles cannot end up a frame\n * away from the shape they belong to.\n */\n const boundsWithPreview = useCallback((id: string): Bounds | null => {\n const previewed = previewBoundsOf(id);\n if (previewed) return previewed;\n return effectiveBoundsOf ? effectiveBoundsOf(id) : null;\n }, [previewBoundsOf, effectiveBoundsOf]);\n\n const chromeState: ChromeState = useMemo(\n () => buildChromeState({\n selection,\n multiActive,\n effectiveBoundsOf: boundsWithPreview,\n modifiers: { alt: false, shift: false, meta: false, ctrl: false },\n // Absent adapter / unknown ids fall back to `true` so the affordance\n // stays visible for consumers that wire bounds without an adapter.\n canRotate: (id) => {\n if (!geometry.supportsRotation) return true;\n const pose = committedPoseOf(id);\n if (pose == null) return true;\n return geometry.supportsRotation(pose);\n },\n }),\n [selection, multiActive, boundsWithPreview, geometry, committedPoseOf],\n );\n\n const helpers: CanvasViewHelpers<TPose> = {\n getEffectivePose: (id: string): TPose | null => {\n return previewPoseOf(id) ?? committedPoseOf(id);\n },\n getEffectiveBounds: boundsWithPreview,\n getGestureBounds: (): Bounds | null => {\n // The same id sets the ghost layer walks, so this cannot disagree with\n // what the user sees ghosted.\n const parts: (Bounds | null)[] = [];\n for (const id of new Set(gestureSource?.ids() ?? [])) parts.push(previewBoundsOf(id));\n const extraBounds = gestureSource?.bounds();\n if (extraBounds) for (const b of extraBounds) parts.push(b);\n return unionAABB(parts);\n },\n subscribeGestures: (fn: () => void): (() => void) =>\n gestureSource?.subscribe(fn) ?? noOpUnsubscribe,\n getGestureVersion: (): number => gestureSource?.getVersion() ?? 0,\n getChromeState: () => chromeState,\n getPreviewSources: (): readonly GesturePreviewSource[] => gestureSource?.previewSources() ?? [],\n getGestureOverlays: (): readonly OngoingOverlay[] => gestureSource?.overlays() ?? [],\n getIsVisible: (): ((id: string) => boolean) => getIsVisible?.() ?? alwaysVisible,\n };\n\n return { helpers, chromeState };\n}\n"],"mappings":";;;;;;AAYA,IAAMA,UAA8B,CAAC,GAE/BC,UAA+B;AAyIrC,SAASC,EAAmB,GAAiC,GAAmB;CAC9E,OAAO,OAAOC,EAAQ,gBAAiB,aAAaA,EAAQ,aAAaC,CAAE,IAAID,EAAQ,QAAQC,CAAE;AACnG;AAOA,SAAgBC,EACd,GAC0B;CAC1B,IAAM,EACJ,YAAS,aAAU,aAAU,iBAAc,cAAW,kBACtD,qBAAkB,oBAChBC,GACEC,IAAQC,GACX,GAAY,MACVC,IAAeA,EAAaL,GAAIM,CAAI,IAAIC,EAAaD,GAAME,CAAQ,GACtE,CAACH,GAAcG,CAAQ,CACzB,GAEMC,IAAeC,QAAc;EACjC,IAAIC,GAAU,OAAOA;EACrB,IAAKZ,GACL,QAAQ,MAA8B;GACpC,IAAI;IAGF,OAAOQ,EAAaT,EAAYC,GAASC,CAAE,GAAGQ,CAAQ;GACxD,QAAQ;IACN,OAAO;GACT;EACF;CACF,GAAG;EAACG;EAAUZ;EAASS;CAAQ,CAAC,GAE1BI,IAAkBR,GAAa,MAA6B;EAChE,IAAI,CAACL,GAAS,OAAO;EACrB,IAAI;GACF,OAAOD,EAAYC,GAASC,CAAE;EAChC,QAAQ;GACN,OAAO;EACT;CACF,GAAG,CAACD,CAAO,CAAC,GAENc,IAAcC,EAAU,SAAS,GAEjCC,IAAsBC,EAAUC,CAAgB,GAEhDC,IAAoBR,QAAcC,KAAYF,GAAc,CAACE,GAAUF,CAAY,CAAC,GAEpFU,IAAgBf,GAAa,MACvBW,EAAoB,UAAUf,CAAE,KACR,MACjC,CAACe,CAAmB,CAAC,GAClBK,IAAkBhB,GAAa,MAA8B;EACjE,IAAMiB,IAAIF,EAAcnB,CAAE;EAC1B,OAAOqB,KAAK,OAAsB,OAAflB,EAAMH,GAAIqB,CAAC;CAChC,GAAG,CAACF,GAAehB,CAAK,CAAC,GAQnBmB,IAAoBlB,GAAa,MACnBgB,EAAgBpB,CAC9B,MACGkB,IAAoBA,EAAkBlB,CAAE,IAAI,OAClD,CAACoB,GAAiBF,CAAiB,CAAC,GAEjCK,IAA2Bb,QACzBc,EAAiB;EACrB;EACA;EACA,mBAAmBF;EACnB,WAAW;GAAE,KAAK;GAAO,OAAO;GAAO,MAAM;GAAO,MAAM;EAAM;EAGhE,YAAY,MAAO;GACjB,IAAI,CAACd,EAAS,kBAAkB,OAAO;GACvC,IAAMF,IAAOM,EAAgBZ,CAAE;GAE/B,OADIM,KAAQ,QACLE,EAAS,iBAAiBF,CAAI;EACvC;CACF,CAAC,GACD;EAACQ;EAAWD;EAAaS;EAAmBd;EAAUI;CAAe,CACvE;CAyBA,OAAO;EAAE,SAAA;GAtBP,mBAAmB,MACVO,EAAcnB,CAAE,KAAKY,EAAgBZ,CAAE;GAEhD,oBAAoBsB;GACpB,wBAAuC;IAGrC,IAAMG,IAA2B,CAAC;IAClC,KAAK,IAAMzB,KAAM,IAAI,IAAI0B,GAAe,IAAI,KAAK,CAAC,CAAC,GAAG,EAAM,KAAKN,EAAgBpB,CAAE,CAAC;IACpF,IAAM2B,IAAcD,GAAe,OAAO;IAC1C,IAAIC,GAAa,KAAK,IAAMC,KAAKD,GAAa,EAAM,KAAKC,CAAC;IAC1D,OAAOC,EAAUJ,CAAK;GACxB;GACA,oBAAoB,MAClBC,GAAe,UAAUI,CAAE,KAAKlC;GAClC,yBAAiC8B,GAAe,WAAW,KAAK;GAChE,sBAAsBH;GACtB,yBAA0DG,GAAe,eAAe,KAAK,CAAC;GAC9F,0BAAqDA,GAAe,SAAS,KAAK,CAAC;GACnF,oBAA+CK,IAAe,KAAKlC;EAG5D;EAAS;CAAY;AAChC"}
@@ -1 +1 @@
1
- {"version":3,"file":"viewInputs.js","names":["ViewInputsContext","createContext","ViewInputsProvider","useOptionalViewInputs","useContext"],"sources":["../../src/canvas/viewInputs.tsx"],"sourcesContent":["/**\n * What {@link useViewHelpers} needs that belongs to the surface rather than to\n * one view: the adapter, the geometry, the bounds resolver and the tools.\n *\n * These are read during a view's render, so they travel as context rather than\n * on the `SurfaceHandle`, which is not attached until an effect runs.\n */\nimport { createContext, useContext, type ReactNode } from 'react';\nimport type { UseViewHelpersOpts } from './useViewHelpers';\nimport type { SelectionApi } from 'core/selection/useSelection';\nimport type { NodeId } from 'core/scene/types';\nimport type { View } from 'core/viewport/view';\nimport type { Bounds } from 'core/viewport/fitViewToBounds';\nimport type { PlaneMap } from 'core/viewport/parallax';\nimport type { RuleCtx } from 'features/chrome-caps';\nimport type { PickView } from './SceneCanvas/useSceneSelectTool';\n\n/**\n * The part of a chrome-caps rule context that belongs to one view. Everything\n * else a `RuleCtx` carries — mode, capabilities, device, focus — is the\n * surface's and the same for every view drawn on it.\n */\nexport interface ViewRuleInputs {\n selection: readonly NodeId[];\n view: View;\n /** What that view's dispatcher currently has in flight. */\n action: { kind: string | null; id: string | null };\n}\n\n/**\n * @internal Provided by the surface, consumed by `<CanvasView>`.\n *\n * The scene-shaped half only. What a gesture is doing right now is read from\n * the asking view's own dispatcher, not from here.\n */\nexport interface SurfaceViewInputs\n extends Pick<UseViewHelpersOpts<unknown>, 'adapter' | 'geometry' | 'tools'> {\n /** A node's box for chrome, drawn under `view` — the camera of the view\n * asking, since a node on a parallax plane lands somewhere else in each. */\n boundsOf: ((id: string, view?: View | null) => Bounds | null) | undefined;\n /** How `view`'s world maps into the parallax plane `id` is drawn through,\n * or null when its layer moves with the camera. */\n planeOfNode?: ((id: string, view?: View | null) => PlaneMap | null) | undefined;\n /** `boundsOf` for `id` drawn at an in-flight `pose`, under `view`. */\n boundsOfPose?: ((id: string, pose: unknown, view?: View | null) => Bounds | null) | undefined;\n /** Every id under a world point, bottom-first. `view` is the view the\n * point was produced under — a screen-pixel tolerance cannot be converted\n * without its scale, nor a layer judged without its paint, and the world\n * point carries neither. */\n pickEvery?: (worldX: number, worldY: number, view?: PickView | null) => string[];\n /** The one id a click resolves to, collapsing parent/child the way the\n * select tool does. Falls back to `pickEvery`'s last when absent. */\n pickBest?: (worldX: number, worldY: number, view?: PickView | null) => string | null;\n /** A hit node's routing-trait kind, so `target: 'kind:text'` bindings match. */\n kindOfNode?: (id: string) => string | undefined;\n /**\n * The surface's chrome-caps rule table, evaluated against a view's own\n * context. The rules are surface-wide on purpose — one consumer table, one\n * set of kit defaults — but a rule keyed on selection, camera or the\n * in-flight action answers differently per view, so the caller supplies the\n * context and both the paint gate and the dispatcher's eligibility filter\n * read the same one.\n */\n chromeCaps?: {\n /** `undefined` when the surface gates nothing — no mode registry wired,\n * which is what `<SceneCanvas>` reports for its own view too. */\n ruleCtx(inputs: ViewRuleInputs): RuleCtx | undefined;\n isVisible(inputs: ViewRuleInputs): (id: string) => boolean;\n };\n /** The surface's selection, which a view shares unless it was given one of\n * its own. */\n selectionApi: SelectionApi;\n /** The rotate badge the surface's selection overlay paints, which every\n * view drawing that overlay has to make grabbable where it is drawn. */\n rotationBadge?: { distancePx: number; sizePx: number } | null;\n}\n\nconst ViewInputsContext = createContext<SurfaceViewInputs | null>(null);\n\n/** @internal */\nexport function ViewInputsProvider(\n { value, children }: { value: SurfaceViewInputs; children: ReactNode },\n) {\n return <ViewInputsContext.Provider value={value}>{children}</ViewInputsContext.Provider>;\n}\n\n/** The hosting surface's view-helper inputs, or `null` outside one. */\nexport function useOptionalViewInputs(): SurfaceViewInputs | null {\n return useContext(ViewInputsContext);\n}\n"],"mappings":";;;AA6EA,IAAMA,IAAoBC,EAAwC,IAAI;AAGtE,SAAgBC,EACd,EAAE,UAAO,eACT;CACA,OAAO,kBAACF,EAAkB,UAAnB;EAAmC;EAAQ;CAAqC,CAAA;AACzF;AAGA,SAAgBG,IAAkD;CAChE,OAAOC,EAAWJ,CAAiB;AACrC"}
1
+ {"version":3,"file":"viewInputs.js","names":["ViewInputsContext","createContext","ViewInputsProvider","useOptionalViewInputs","useContext"],"sources":["../../src/canvas/viewInputs.tsx"],"sourcesContent":["/**\n * What {@link useViewHelpers} needs that belongs to the surface rather than to\n * one view: the adapter, the geometry and the bounds resolver.\n *\n * These are read during a view's render, so they travel as context rather than\n * on the `SurfaceHandle`, which is not attached until an effect runs.\n */\nimport { createContext, useContext, type ReactNode } from 'react';\nimport type { UseViewHelpersOpts } from './useViewHelpers';\nimport type { SelectionApi } from 'core/selection/useSelection';\nimport type { View } from 'core/viewport/view';\nimport type { Bounds } from 'core/viewport/fitViewToBounds';\nimport type { PlaneMap } from 'core/viewport/parallax';\nimport type { ChromeCaps } from 'features/chrome-caps/useChromeCaps';\nimport type { PickView } from './SceneCanvas/useSceneSelectTool';\n\nexport type { ViewRuleInputs } from 'features/chrome-caps/useChromeCaps';\n\n/**\n * @internal Provided by the surface, consumed by `<CanvasView>`.\n *\n * The scene-shaped half only. What a gesture is doing right now is read from\n * the asking view's own dispatcher, not from here.\n */\nexport interface SurfaceViewInputs\n extends Pick<UseViewHelpersOpts<unknown>, 'adapter' | 'geometry'> {\n /** A node's box for chrome, drawn under `view` — the camera of the view\n * asking, since a node on a parallax plane lands somewhere else in each. */\n boundsOf: ((id: string, view?: View | null) => Bounds | null) | undefined;\n /** How `view`'s world maps into the parallax plane `id` is drawn through,\n * or null when its layer moves with the camera. */\n planeOfNode?: ((id: string, view?: View | null) => PlaneMap | null) | undefined;\n /** `boundsOf` for `id` drawn at an in-flight `pose`, under `view`. */\n boundsOfPose?: ((id: string, pose: unknown, view?: View | null) => Bounds | null) | undefined;\n /** Every id under a world point, bottom-first. `view` is the view the\n * point was produced under — a screen-pixel tolerance cannot be converted\n * without its scale, nor a layer judged without its paint, and the world\n * point carries neither. */\n pickEvery?: (worldX: number, worldY: number, view?: PickView | null) => string[];\n /** The one id a click resolves to, collapsing parent/child the way the\n * select tool does. Falls back to `pickEvery`'s last when absent. */\n pickBest?: (worldX: number, worldY: number, view?: PickView | null) => string | null;\n /** A hit node's routing-trait kind, so `target: 'kind:text'` bindings match. */\n kindOfNode?: (id: string) => string | undefined;\n /** The surface's chrome-caps rule table, evaluated against a view's own\n * context. */\n chromeCaps?: ChromeCaps;\n /** The surface's selection, which a view shares unless it was given one of\n * its own. */\n selectionApi: SelectionApi;\n /** The rotate badge the surface's selection overlay paints, which every\n * view drawing that overlay has to make grabbable where it is drawn. */\n rotationBadge?: { distancePx: number; sizePx: number } | null;\n}\n\nconst ViewInputsContext = createContext<SurfaceViewInputs | null>(null);\n\n/** @internal */\nexport function ViewInputsProvider(\n { value, children }: { value: SurfaceViewInputs; children: ReactNode },\n) {\n return <ViewInputsContext.Provider value={value}>{children}</ViewInputsContext.Provider>;\n}\n\n/** The hosting surface's view-helper inputs, or `null` outside one. */\nexport function useOptionalViewInputs(): SurfaceViewInputs | null {\n return useContext(ViewInputsContext);\n}\n"],"mappings":";;;AAuDA,IAAMA,IAAoBC,EAAwC,IAAI;AAGtE,SAAgBC,EACd,EAAE,UAAO,eACT;CACA,OAAO,kBAACF,EAAkB,UAAnB;EAAmC;EAAQ;CAAqC,CAAA;AACzF;AAGA,SAAgBG,IAAkD;CAChE,OAAOC,EAAWJ,CAAiB;AACrC"}
@@ -1,53 +1,59 @@
1
1
  import { createViewResolver as e } from "../features/viewports/viewResolver.js";
2
2
  import { createContext as t, useContext as n, useMemo as r, useRef as i } from "react";
3
- import { jsx as a } from "react/jsx-runtime";
3
+ import { createEmitter as a } from "@weasel-js/registry";
4
+ import { jsx as o } from "react/jsx-runtime";
4
5
  //#region src/canvas/viewRegistry.tsx
5
- var o = t(null);
6
- function s({ children: t }) {
7
- let n = i(/* @__PURE__ */ new Map()), s = i(0), c = i(0), d = i(/* @__PURE__ */ new Set()), f = i(null), p = r(() => {
8
- let t = () => {
9
- c.current++;
10
- for (let e of d.current) e();
11
- }, r = () => [...n.current.keys()].sort((e, t) => e.order - t.order || n.current.get(e) - n.current.get(t));
6
+ function s(e, t, n) {
7
+ if (!e) return {
8
+ x: t,
9
+ y: n
10
+ };
11
+ let [r, i] = e.clientToWorld(t, n), a = e.view();
12
+ return {
13
+ x: (r - a.x) * a.scale.x,
14
+ y: (i - a.y) * a.scale.y
15
+ };
16
+ }
17
+ var c = t(null);
18
+ function l({ children: t }) {
19
+ let n = i(/* @__PURE__ */ new Map()), l = i(0), u = i(0), p = i(null), m = r(() => {
20
+ let t = a(), r = () => {
21
+ u.current++, t.emit();
22
+ }, i = () => [...n.current.keys()].sort((e, t) => e.order - t.order || n.current.get(e) - n.current.get(t));
12
23
  return {
13
24
  resolver: e({
14
25
  views: () => {
15
- let e = f.current, t = e?.view() ?? u, n = e?.dims() ?? l;
16
- return r().filter((e) => e.interactive).map((e) => e.layer.resolvable(t, n));
17
- },
18
- root: () => f.current?.view() ?? u,
19
- canvasOrigin: () => f.current?.origin() ?? {
20
- left: 0,
21
- top: 0
26
+ let e = p.current, t = e?.view() ?? f, n = e?.dims() ?? d;
27
+ return i().filter((e) => e.interactive).map((e) => e.layer.resolvable(t, n));
22
28
  },
23
- occluded: (e, t) => f.current?.claimsAbove(e, t) ?? !1
24
- }),
25
- register: (e) => (n.current.set(e, s.current++), t(), () => {
26
- n.current.delete(e), t();
29
+ root: () => p.current?.view() ?? f,
30
+ toLocal: (e, t) => s(p.current, e, t),
31
+ occluded: (e, t) => p.current?.claimsAbove(e, t) ?? !1
27
32
  }),
28
- list: r,
29
- getVersion: () => c.current,
30
- subscribe: (e) => (d.current.add(e), () => {
31
- d.current.delete(e);
33
+ register: (e) => (n.current.set(e, l.current++), r(), () => {
34
+ n.current.delete(e), r();
32
35
  }),
33
- surface: () => f.current,
34
- attachSurface: (e) => {
35
- f.current = e;
36
- }
36
+ list: i,
37
+ getVersion: () => u.current,
38
+ subscribe: t.subscribe,
39
+ surface: () => p.current,
40
+ attachSurface: (e) => (p.current = e, () => {
41
+ p.current === e && (p.current = null);
42
+ })
37
43
  };
38
44
  }, []);
39
- return /* @__PURE__ */ a(o.Provider, {
40
- value: p,
45
+ return /* @__PURE__ */ o(c.Provider, {
46
+ value: m,
41
47
  children: t
42
48
  });
43
49
  }
44
- function c() {
45
- return n(o);
50
+ function u() {
51
+ return n(c);
46
52
  }
47
- var l = {
53
+ var d = {
48
54
  width: 0,
49
55
  height: 0
50
- }, u = {
56
+ }, f = {
51
57
  x: 0,
52
58
  y: 0,
53
59
  scale: {
@@ -56,6 +62,6 @@ var l = {
56
62
  }
57
63
  };
58
64
  //#endregion
59
- export { u as IDENTITY_VIEW, l as UNMEASURED_DIMS, s as ViewRegistryProvider, c as useOptionalViewRegistry };
65
+ export { f as IDENTITY_VIEW, d as UNMEASURED_DIMS, l as ViewRegistryProvider, s as surfaceLocal, u as useOptionalViewRegistry };
60
66
 
61
67
  //# sourceMappingURL=viewRegistry.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"viewRegistry.js","names":["ViewRegistryContext","createContext","ViewRegistryProvider","entriesRef","useRef","seqRef","versionRef","listenersRef","surfaceRef","registry","useMemo","changed","fn","ordered","a","b","createViewResolver","surface","view","IDENTITY_VIEW","dims","UNMEASURED_DIMS","r","x","y","reg","handle","useOptionalViewRegistry","useContext"],"sources":["../../src/canvas/viewRegistry.tsx"],"sourcesContent":["/**\n * The seam between a canvas surface and the views drawn on it.\n *\n * Traffic runs both ways: the surface attaches a handle onto its frame and its\n * layer stack, and each view registers what it contributes back — the viewport\n * node it paints into and the record the gesture dispatcher routes its events\n * to. Both sides are thunks, read at draw and dispatch time, so neither can\n * serve the other a frame that has already moved.\n */\nimport { createContext, useContext, useMemo, useRef, type ReactNode } from 'react';\nimport type { Dims, RenderLayer } from 'core/layers/render';\nimport type { LayerHit } from 'affordances/types';\nimport type { ChromeState } from 'core/selection/chromeState';\nimport type { View } from 'core/viewport/view';\nimport type { ViewportLayer } from 'features/viewports/viewportLayer';\nimport type { DispatcherViewTarget } from '@weasel-js/routing/internal';\nimport { createViewResolver, type ViewResolver } from 'features/viewports/viewResolver';\n\n/**\n * What a view needs from the surface hosting it.\n *\n * @internal Attached by the surface, read by `<CanvasView>`.\n */\nexport interface SurfaceHandle {\n /** Client-space origin of the canvas element. */\n origin(): { left: number; top: number };\n /** The outer camera. */\n view(): View;\n /** The canvas's CSS-pixel size. */\n dims(): Dims;\n /** The stack a view paints through its own camera, unless it narrows it. */\n layers(): readonly RenderLayer<unknown>[];\n requestRedraw(): void;\n /** The canvas's own view chrome — its selection, its overlay-aware bounds.\n * What a `<CanvasView>` answers for itself, answered for view zero. */\n chromeState(): ChromeState;\n /** Hit-test the externally registered layers at a world point, against the\n * frame and draw envelope of whichever view is asking. The public\n * `hitTestExtras` is this with the canvas's own frame and envelope. */\n hitTestExtras(\n worldX: number,\n worldY: number,\n view: View,\n dims: Dims,\n data: unknown,\n /** Consider only these layers — the ones the asking view paints. A layer\n * asked on a frame it was not drawn in answers for the wrong pixels. */\n only?: readonly RenderLayer<unknown>[],\n ): { layerId: string; hit: LayerHit } | null;\n /** Whether a registered layer claims a canvas-local point on the surface's\n * own frame. Registered layers paint over every view, so such a point is\n * theirs even inside a view's rect. */\n claimsAbove(x: number, y: number): boolean;\n}\n\n/**\n * What one view contributes to the surface hosting it.\n *\n * @internal Written by `<CanvasView>`, read by the surface. Consumers declare\n * a view, not a registration.\n */\nexport interface ViewRegistration {\n id: string;\n /**\n * Paint and hit order, low to high. Views declared as props take their array\n * index; a view mounted as a child takes `Infinity`, so it lands after them\n * however React happens to order the mount effects.\n */\n order: number;\n /** The viewport node this view paints into. Its `resolvable` is what routes\n * input here. */\n layer: ViewportLayer<unknown>;\n /** `false` keeps input over the view on the canvas beneath it. */\n interactive: boolean;\n /** `false` leaves `layer` for a host to draw — a HUD window's interior — so\n * the surface does not paint it too. */\n paint: boolean;\n /** Everything about dispatching to this view except its id. */\n target: Omit<DispatcherViewTarget, 'id'>;\n /** Whether a scene layer reaches the screen in this view. For input that\n * reaches a view without a dispatch — hover — so it judges this view's\n * paint rather than the surface's. */\n layerIsPainted(layerId: string): boolean;\n}\n\n/** @internal */\nexport interface ViewRegistry {\n /** Returns an unregister. */\n register(reg: ViewRegistration): () => void;\n /** Live registrations in paint order. */\n list(): readonly ViewRegistration[];\n /** Bumped whenever the list changes. Pair with {@link ViewRegistry.subscribe}\n * for `useSyncExternalStore`. */\n getVersion(): number;\n subscribe(fn: () => void): () => void;\n /** Which view a client point belongs to, sticky for a captured pointer.\n * One per surface: every caller that routes input — the dispatcher, pinch,\n * hover — must agree about where a point landed. */\n readonly resolver: ViewResolver;\n /** The hosting surface, or `null` before one attaches. */\n surface(): SurfaceHandle | null;\n attachSurface(handle: SurfaceHandle): void;\n}\n\nconst ViewRegistryContext = createContext<ViewRegistry | null>(null);\n\n/** Mounts the registry for one surface. `<SceneCanvas>` mounts one; a view\n * declaring itself as a child must be inside it. */\nexport function ViewRegistryProvider({ children }: { children: ReactNode }) {\n const entriesRef = useRef(new Map<ViewRegistration, number>());\n const seqRef = useRef(0);\n const versionRef = useRef(0);\n const listenersRef = useRef(new Set<() => void>());\n const surfaceRef = useRef<SurfaceHandle | null>(null);\n\n const registry = useMemo<ViewRegistry>(() => {\n const changed = (): void => {\n versionRef.current++;\n for (const fn of listenersRef.current) fn();\n };\n const ordered = (): ViewRegistration[] => [...entriesRef.current.keys()].sort((a, b) => (\n a.order - b.order || entriesRef.current.get(a)! - entriesRef.current.get(b)!\n ));\n const resolver = createViewResolver({\n views: () => {\n const surface = surfaceRef.current;\n const view = surface?.view() ?? IDENTITY_VIEW;\n const dims = surface?.dims() ?? UNMEASURED_DIMS;\n return ordered().filter((r) => r.interactive).map((r) => r.layer.resolvable(view, dims));\n },\n root: () => surfaceRef.current?.view() ?? IDENTITY_VIEW,\n canvasOrigin: () => surfaceRef.current?.origin() ?? { left: 0, top: 0 },\n occluded: (x, y) => surfaceRef.current?.claimsAbove(x, y) ?? false,\n });\n return {\n resolver,\n register: (reg) => {\n entriesRef.current.set(reg, seqRef.current++);\n changed();\n return () => { entriesRef.current.delete(reg); changed(); };\n },\n list: ordered,\n getVersion: () => versionRef.current,\n subscribe: (fn) => {\n listenersRef.current.add(fn);\n return () => { listenersRef.current.delete(fn); };\n },\n surface: () => surfaceRef.current,\n attachSurface: (handle) => { surfaceRef.current = handle; },\n };\n }, []);\n\n return <ViewRegistryContext.Provider value={registry}>{children}</ViewRegistryContext.Provider>;\n}\n\n/** The surface's view registry, or `null` outside one. */\nexport function useOptionalViewRegistry(): ViewRegistry | null {\n return useContext(ViewRegistryContext);\n}\n\n/** The `Dims` a surface reports before it has measured itself. */\nexport const UNMEASURED_DIMS: Dims = { width: 0, height: 0 };\n\n/** The camera a view resolves against before its surface attaches. */\nexport const IDENTITY_VIEW: View = { x: 0, y: 0, scale: { x: 1, y: 1 } };\n"],"mappings":";;;;AAwGA,IAAMA,IAAsBC,EAAmC,IAAI;AAInE,SAAgBC,EAAqB,EAAE,eAAqC;CAC1E,IAAMC,IAAaC,kBAAO,IAAI,IAA8B,CAAC,GACvDC,IAASD,EAAO,CAAC,GACjBE,IAAaF,EAAO,CAAC,GACrBG,IAAeH,kBAAO,IAAI,IAAgB,CAAC,GAC3CI,IAAaJ,EAA6B,IAAI,GAE9CK,IAAWC,QAA4B;EAC3C,IAAMC,UAAsB;GAC1B,EAAW;GACX,KAAK,IAAMC,KAAML,EAAa,SAAS,EAAG;EAC5C,GACMM,UAAoC,CAAC,GAAGV,EAAW,QAAQ,KAAK,CAAC,CAAC,CAAC,MAAM,GAAG,MAChFW,EAAE,QAAQC,EAAE,SAASZ,EAAW,QAAQ,IAAIW,CAAC,IAAKX,EAAW,QAAQ,IAAIY,CAAC,CAC3E;EAYD,OAAO;GACL,UAZeC,EAAmB;IAClC,aAAa;KACX,IAAMC,IAAUT,EAAW,SACrBU,IAAOD,GAAS,KAAK,KAAKE,GAC1BC,IAAOH,GAAS,KAAK,KAAKI;KAChC,OAAOR,EAAQ,CAAC,CAAC,QAAQ,MAAMS,EAAE,WAAW,CAAC,CAAC,KAAK,MAAMA,EAAE,MAAM,WAAWJ,GAAME,CAAI,CAAC;IACzF;IACA,YAAYZ,EAAW,SAAS,KAAK,KAAKW;IAC1C,oBAAoBX,EAAW,SAAS,OAAO,KAAK;KAAE,MAAM;KAAG,KAAK;IAAE;IACtE,WAAW,GAAG,MAAMA,EAAW,SAAS,YAAYe,GAAGC,CAAC,KAAK;GAC/D,CAEE;GACA,WAAW,OACTrB,EAAW,QAAQ,IAAIsB,GAAK,EAAO,SAAS,GAC5Cd,EAAQ,SACK;IAAkC,AAAhCR,EAAW,QAAQ,OAAOsB,CAAG,GAAGd,EAAQ;GAAG;GAE5D,MAAME;GACN,kBAAkBP,EAAW;GAC7B,YAAY,OACVC,EAAa,QAAQ,IAAIK,CAAE,SACd;IAAE,EAAa,QAAQ,OAAOA,CAAE;GAAG;GAElD,eAAeJ,EAAW;GAC1B,gBAAgB,MAAW;IAAE,EAAW,UAAUkB;GAAQ;EAC5D;CACF,GAAG,CAAC,CAAC;CAEL,OAAO,kBAAC1B,EAAoB,UAArB;EAA8B,OAAOS;EAAW;CAAuC,CAAA;AAChG;AAGA,SAAgBkB,IAA+C;CAC7D,OAAOC,EAAW5B,CAAmB;AACvC;AAGA,IAAaqB,IAAwB;CAAE,OAAO;CAAG,QAAQ;AAAE,GAG9CF,IAAsB;CAAE,GAAG;CAAG,GAAG;CAAG,OAAO;EAAE,GAAG;EAAG,GAAG;CAAE;AAAE"}
1
+ {"version":3,"file":"viewRegistry.js","names":["surfaceLocal","surface","clientX","clientY","worldX","worldY","view","ViewRegistryContext","createContext","ViewRegistryProvider","entriesRef","useRef","seqRef","versionRef","surfaceRef","registry","useMemo","listeners","createEmitter","changed","ordered","a","b","createViewResolver","IDENTITY_VIEW","dims","UNMEASURED_DIMS","r","x","y","reg","handle","useOptionalViewRegistry","useContext"],"sources":["../../src/canvas/viewRegistry.tsx"],"sourcesContent":["/**\n * The seam between a canvas surface and the views drawn on it.\n *\n * Traffic runs both ways: the surface attaches a handle onto its frame and its\n * layer stack, and each view registers what it contributes back — the viewport\n * node it paints into and the record the gesture dispatcher routes its events\n * to. Both sides are thunks, read at draw and dispatch time, so neither can\n * serve the other a frame that has already moved.\n */\nimport { createContext, useContext, useMemo, useRef, type ReactNode } from 'react';\nimport type { Dims, RenderLayer } from 'core/layers/render';\nimport type { LayerHit } from 'affordances/types';\nimport type { ChromeState } from 'core/selection/chromeState';\nimport type { View } from 'core/viewport/view';\nimport type { ViewportLayer } from 'features/viewports/viewportLayer';\nimport type { DispatcherViewTarget } from '@weasel-js/routing/internal';\nimport { createViewResolver, type ViewResolver } from 'features/viewports/viewResolver';\nimport { createEmitter } from '@weasel-js/registry';\n\n/**\n * What a view needs from the surface hosting it.\n *\n * @internal Attached by the surface, read by `<CanvasView>`.\n */\nexport interface SurfaceHandle {\n /** A client point in the surface's own world — the conversion the surface\n * itself makes, its `clientToWorld` override included. */\n clientToWorld(clientX: number, clientY: number): [number, number];\n /** The outer camera. */\n view(): View;\n /** The canvas's CSS-pixel size. */\n dims(): Dims;\n /** The stack a view paints through its own camera, unless it narrows it. */\n layers(): readonly RenderLayer<unknown>[];\n requestRedraw(): void;\n /** The canvas's own view chrome — its selection, its overlay-aware bounds.\n * What a `<CanvasView>` answers for itself, answered for view zero. */\n chromeState(): ChromeState;\n /** Hit-test the externally registered layers at a world point, against the\n * frame and draw envelope of whichever view is asking. The public\n * `hitTestExtras` is this with the canvas's own frame and envelope. */\n hitTestExtras(\n worldX: number,\n worldY: number,\n view: View,\n dims: Dims,\n data: unknown,\n /** Consider only these layers — the ones the asking view paints. A layer\n * asked on a frame it was not drawn in answers for the wrong pixels. */\n only?: readonly RenderLayer<unknown>[],\n ): { layerId: string; hit: LayerHit } | null;\n /** Whether a registered layer claims a canvas-local point on the surface's\n * own frame. Registered layers paint over every view, so such a point is\n * theirs even inside a view's rect. */\n claimsAbove(x: number, y: number): boolean;\n}\n\n/**\n * A client point in the surface's CSS pixels, from its top-left: the surface's\n * own world point put back through its camera, so a `clientToWorld` override\n * reaches every view declared on it.\n *\n * @internal\n */\nexport function surfaceLocal(\n surface: Pick<SurfaceHandle, 'clientToWorld' | 'view'> | null,\n clientX: number,\n clientY: number,\n): { x: number; y: number } {\n if (!surface) return { x: clientX, y: clientY };\n const [worldX, worldY] = surface.clientToWorld(clientX, clientY);\n const view = surface.view();\n return { x: (worldX - view.x) * view.scale.x, y: (worldY - view.y) * view.scale.y };\n}\n\n/**\n * What one view contributes to the surface hosting it.\n *\n * @internal Written by `<CanvasView>`, read by the surface. Consumers declare\n * a view, not a registration.\n */\nexport interface ViewRegistration {\n id: string;\n /**\n * Paint and hit order, low to high. Views declared as props take their array\n * index; a view mounted as a child takes `Infinity`, so it lands after them\n * however React happens to order the mount effects.\n */\n order: number;\n /** The viewport node this view paints into. Its `resolvable` is what routes\n * input here. */\n layer: ViewportLayer<unknown>;\n /** `false` keeps input over the view on the canvas beneath it. */\n interactive: boolean;\n /** `false` leaves `layer` for a host to draw — a HUD window's interior — so\n * the surface does not paint it too. */\n paint: boolean;\n /** Everything about dispatching to this view except its id. */\n target: Omit<DispatcherViewTarget, 'id'>;\n /** Whether a scene layer reaches the screen in this view. For input that\n * reaches a view without a dispatch — hover — so it judges this view's\n * paint rather than the surface's. */\n layerIsPainted(layerId: string): boolean;\n}\n\n/** @internal */\nexport interface ViewRegistry {\n /** Returns an unregister. */\n register(reg: ViewRegistration): () => void;\n /** Live registrations in paint order. */\n list(): readonly ViewRegistration[];\n /** Bumped whenever the list changes. Pair with {@link ViewRegistry.subscribe}\n * for `useSyncExternalStore`. */\n getVersion(): number;\n subscribe(fn: () => void): () => void;\n /** Which view a client point belongs to, sticky for a captured pointer.\n * One per surface: every caller that routes input — the dispatcher, pinch,\n * hover — must agree about where a point landed. */\n readonly resolver: ViewResolver;\n /** The hosting surface, or `null` before one attaches. */\n surface(): SurfaceHandle | null;\n /** Returns a detach, which leaves a handle attached since alone. */\n attachSurface(handle: SurfaceHandle): () => void;\n}\n\nconst ViewRegistryContext = createContext<ViewRegistry | null>(null);\n\n/** Mounts the registry for one surface. `<SceneCanvas>` mounts one; a view\n * declaring itself as a child must be inside it. */\nexport function ViewRegistryProvider({ children }: { children: ReactNode }) {\n const entriesRef = useRef(new Map<ViewRegistration, number>());\n const seqRef = useRef(0);\n const versionRef = useRef(0);\n const surfaceRef = useRef<SurfaceHandle | null>(null);\n\n const registry = useMemo<ViewRegistry>(() => {\n const listeners = createEmitter();\n const changed = (): void => {\n versionRef.current++;\n listeners.emit();\n };\n const ordered = (): ViewRegistration[] => [...entriesRef.current.keys()].sort((a, b) => (\n a.order - b.order || entriesRef.current.get(a)! - entriesRef.current.get(b)!\n ));\n const resolver = createViewResolver({\n views: () => {\n const surface = surfaceRef.current;\n const view = surface?.view() ?? IDENTITY_VIEW;\n const dims = surface?.dims() ?? UNMEASURED_DIMS;\n return ordered().filter((r) => r.interactive).map((r) => r.layer.resolvable(view, dims));\n },\n root: () => surfaceRef.current?.view() ?? IDENTITY_VIEW,\n toLocal: (clientX, clientY) => surfaceLocal(surfaceRef.current, clientX, clientY),\n occluded: (x, y) => surfaceRef.current?.claimsAbove(x, y) ?? false,\n });\n return {\n resolver,\n register: (reg) => {\n entriesRef.current.set(reg, seqRef.current++);\n changed();\n return () => { entriesRef.current.delete(reg); changed(); };\n },\n list: ordered,\n getVersion: () => versionRef.current,\n subscribe: listeners.subscribe,\n surface: () => surfaceRef.current,\n attachSurface: (handle) => {\n surfaceRef.current = handle;\n return () => { if (surfaceRef.current === handle) surfaceRef.current = null; };\n },\n };\n }, []);\n\n return <ViewRegistryContext.Provider value={registry}>{children}</ViewRegistryContext.Provider>;\n}\n\n/** The surface's view registry, or `null` outside one. */\nexport function useOptionalViewRegistry(): ViewRegistry | null {\n return useContext(ViewRegistryContext);\n}\n\n/** The `Dims` a surface reports before it has measured itself. */\nexport const UNMEASURED_DIMS: Dims = { width: 0, height: 0 };\n\n/** The camera a view resolves against before its surface attaches. */\nexport const IDENTITY_VIEW: View = { x: 0, y: 0, scale: { x: 1, y: 1 } };\n"],"mappings":";;;;;AAgEA,SAAgBA,EACd,GACA,GACA,GAC0B;CAC1B,IAAI,CAACC,GAAS,OAAO;EAAE,GAAGC;EAAS,GAAGC;CAAQ;CAC9C,IAAM,CAACC,GAAQC,KAAUJ,EAAQ,cAAcC,GAASC,CAAO,GACzDG,IAAOL,EAAQ,KAAK;CAC1B,OAAO;EAAE,IAAIG,IAASE,EAAK,KAAKA,EAAK,MAAM;EAAG,IAAID,IAASC,EAAK,KAAKA,EAAK,MAAM;CAAE;AACpF;AAoDA,IAAMC,IAAsBC,EAAmC,IAAI;AAInE,SAAgBC,EAAqB,EAAE,eAAqC;CAC1E,IAAMC,IAAaC,kBAAO,IAAI,IAA8B,CAAC,GACvDC,IAASD,EAAO,CAAC,GACjBE,IAAaF,EAAO,CAAC,GACrBG,IAAaH,EAA6B,IAAI,GAE9CI,IAAWC,QAA4B;EAC3C,IAAMC,IAAYC,EAAc,GAC1BC,UAAsB;GAE1B,AADA,EAAW,WACXF,EAAU,KAAK;EACjB,GACMG,UAAoC,CAAC,GAAGV,EAAW,QAAQ,KAAK,CAAC,CAAC,CAAC,MAAM,GAAG,MAChFW,EAAE,QAAQC,EAAE,SAASZ,EAAW,QAAQ,IAAIW,CAAC,IAAKX,EAAW,QAAQ,IAAIY,CAAC,CAC3E;EAYD,OAAO;GACL,UAZeC,EAAmB;IAClC,aAAa;KACX,IAAMtB,IAAUa,EAAW,SACrBR,IAAOL,GAAS,KAAK,KAAKuB,GAC1BC,IAAOxB,GAAS,KAAK,KAAKyB;KAChC,OAAON,EAAQ,CAAC,CAAC,QAAQ,MAAMO,EAAE,WAAW,CAAC,CAAC,KAAK,MAAMA,EAAE,MAAM,WAAWrB,GAAMmB,CAAI,CAAC;IACzF;IACA,YAAYX,EAAW,SAAS,KAAK,KAAKU;IAC1C,UAAU,GAAS,MAAYxB,EAAac,EAAW,SAASZ,GAASC,CAAO;IAChF,WAAW,GAAG,MAAMW,EAAW,SAAS,YAAYc,GAAGC,CAAC,KAAK;GAC/D,CAEE;GACA,WAAW,OACTnB,EAAW,QAAQ,IAAIoB,GAAK,EAAO,SAAS,GAC5CX,EAAQ,SACK;IAAkC,AAAhCT,EAAW,QAAQ,OAAOoB,CAAG,GAAGX,EAAQ;GAAG;GAE5D,MAAMC;GACN,kBAAkBP,EAAW;GAC7B,WAAWI,EAAU;GACrB,eAAeH,EAAW;GAC1B,gBAAgB,OACd,EAAW,UAAUiB,SACR;IAAE,AAAIjB,EAAW,YAAYiB,MAAQ,EAAW,UAAU;GAAM;EAEjF;CACF,GAAG,CAAC,CAAC;CAEL,OAAO,kBAACxB,EAAoB,UAArB;EAA8B,OAAOQ;EAAW;CAAuC,CAAA;AAChG;AAGA,SAAgBiB,IAA+C;CAC7D,OAAOC,EAAW1B,CAAmB;AACvC;AAGA,IAAamB,IAAwB;CAAE,OAAO;CAAG,QAAQ;AAAE,GAG9CF,IAAsB;CAAE,GAAG;CAAG,GAAG;CAAG,OAAO;EAAE,GAAG;EAAG,GAAG;CAAE;AAAE"}
@@ -0,0 +1,43 @@
1
+ //#region src/canvas/watchElementMove.ts
2
+ function e(e, t) {
3
+ if (typeof IntersectionObserver > "u") return () => {};
4
+ let n = e.ownerDocument.documentElement, r = null, i = null, a, o = () => {
5
+ clearTimeout(a), r?.disconnect(), r = null, i?.disconnect(), i = null;
6
+ }, s = () => {
7
+ typeof ResizeObserver < "u" && (i = new ResizeObserver(() => {
8
+ let n = e.getBoundingClientRect();
9
+ n.width !== 0 && n.height !== 0 && (t(), c(1));
10
+ }), i.observe(e));
11
+ }, c = (i) => {
12
+ o();
13
+ let l = e.getBoundingClientRect();
14
+ if (l.width === 0 || l.height === 0) {
15
+ s();
16
+ return;
17
+ }
18
+ let u = [
19
+ Math.floor(l.top),
20
+ Math.floor(n.clientWidth - l.right),
21
+ Math.floor(n.clientHeight - l.bottom),
22
+ Math.floor(l.left)
23
+ ], d = (e) => Math.abs(e.left - l.left) > .5 || Math.abs(e.top - l.top) > .5 || Math.abs(e.width - l.width) > .5 || Math.abs(e.height - l.height) > .5, f = !0;
24
+ r = new IntersectionObserver((n) => {
25
+ let r = n[0].intersectionRatio;
26
+ if (f ? n.length > 1 || d(n[0].boundingClientRect) : r !== i) {
27
+ t(), c(1);
28
+ return;
29
+ }
30
+ f = !1, r !== i && (r === 0 ? a = setTimeout(() => {
31
+ d(e.getBoundingClientRect()) && t(), c(1e-7);
32
+ }, 1e3) : c(r));
33
+ }, {
34
+ rootMargin: u.map((e) => `${-e}px`).join(" "),
35
+ threshold: Math.max(0, Math.min(1, i)) || 1
36
+ }), r.observe(e);
37
+ };
38
+ return c(1), o;
39
+ }
40
+ //#endregion
41
+ export { e as watchElementMove };
42
+
43
+ //# sourceMappingURL=watchElementMove.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"watchElementMove.js","names":["watchElementMove","root","element","observer","sized","retry","stop","awaitSize","box","onMove","frame","insets","movedTo","now","first","ratio","entries","threshold","inset"],"sources":["../../src/canvas/watchElementMove.ts"],"sourcesContent":["/**\n * Call `onMove` when `element`'s box moves in the viewport for a reason no\n * event reports: a sibling collapsing, content loading above it. A scroll or a\n * resize of the element may also call it; a caller already listening for those\n * hears a second, harmless report. Returns the function that stops watching.\n *\n * There is no observer for position, so this frames the element's current box\n * with an `IntersectionObserver` whose root margin is that box exactly. Any move\n * changes how much of the element the frame holds, which the observer reports,\n * and the frame is then rebuilt around the new box.\n *\n * A frame only watches from its first report on, so that report is checked\n * against the box the frame was built around: a move in between is reported too.\n */\nexport function watchElementMove(element: Element, onMove: () => void): () => void {\n if (typeof IntersectionObserver === 'undefined') return () => {};\n const root = element.ownerDocument.documentElement;\n let observer: IntersectionObserver | null = null;\n let sized: ResizeObserver | null = null;\n let retry: ReturnType<typeof setTimeout> | undefined;\n\n const stop = (): void => {\n clearTimeout(retry);\n observer?.disconnect();\n observer = null;\n sized?.disconnect();\n sized = null;\n };\n\n /** A box with no area cannot be framed, so wait for it to have one. */\n const awaitSize = (): void => {\n if (typeof ResizeObserver === 'undefined') return;\n sized = new ResizeObserver(() => {\n const box = element.getBoundingClientRect();\n if (box.width === 0 || box.height === 0) return;\n onMove();\n frame(1);\n });\n sized.observe(element);\n };\n\n const frame = (threshold: number): void => {\n stop();\n const box = element.getBoundingClientRect();\n if (box.width === 0 || box.height === 0) {\n awaitSize();\n return;\n }\n const insets = [\n Math.floor(box.top),\n Math.floor(root.clientWidth - box.right),\n Math.floor(root.clientHeight - box.bottom),\n Math.floor(box.left),\n ];\n // Half a pixel of slack: two measurements that disagreed by rounding would report every\n // frame, and the floored frame cannot see a move that small anyway.\n const movedTo = (now: DOMRectReadOnly): boolean =>\n Math.abs(now.left - box.left) > 0.5 || Math.abs(now.top - box.top) > 0.5\n || Math.abs(now.width - box.width) > 0.5 || Math.abs(now.height - box.height) > 0.5;\n let first = true;\n observer = new IntersectionObserver(\n (entries) => {\n const ratio = entries[0].intersectionRatio;\n const moved = first\n ? entries.length > 1 || movedTo(entries[0].boundingClientRect)\n : ratio !== threshold;\n if (moved) {\n onMove();\n frame(1);\n return;\n }\n first = false;\n if (ratio === threshold) return;\n // A box partly off the root never reaches the threshold asked for, so\n // ask for what it does reach. One wholly off it reports zero for\n // every frame, wherever it goes; look again once it may have come back.\n if (ratio !== 0) frame(ratio);\n else {\n retry = setTimeout(() => {\n if (movedTo(element.getBoundingClientRect())) onMove();\n frame(1e-7);\n }, 1000);\n }\n },\n { rootMargin: insets.map((inset) => `${-inset}px`).join(' '), threshold: Math.max(0, Math.min(1, threshold)) || 1 },\n );\n observer.observe(element);\n };\n\n frame(1);\n return stop;\n}\n"],"mappings":";AAcA,SAAgBA,EAAiB,GAAkB,GAAgC;CACjF,IAAI,OAAO,uBAAyB,KAAa,aAAa,CAAC;CAC/D,IAAMC,IAAOC,EAAQ,cAAc,iBAC/BC,IAAwC,MACxCC,IAA+B,MAC/BC,GAEEC,UAAmB;EAKvB,AAJA,aAAaD,CAAK,GAClBF,GAAU,WAAW,GACrB,IAAW,MACXC,GAAO,WAAW,GAClB,IAAQ;CACV,GAGMG,UAAwB;EAC5B,AAAI,OAAO,iBAAmB,QAC9B,IAAQ,IAAI,qBAAqB;GAC/B,IAAMC,IAAMN,EAAQ,sBAAsB;GAC1C,AAAIM,EAAI,UAAU,KAAKA,EAAI,WAAW,MACtCC,EAAO,GACPC,EAAM,CAAC;EACT,CAAC,GACDN,EAAM,QAAQF,CAAO;CACvB,GAEMQ,KAAS,MAA4B;EACzC,EAAK;EACL,IAAMF,IAAMN,EAAQ,sBAAsB;EAC1C,IAAIM,EAAI,UAAU,KAAKA,EAAI,WAAW,GAAG;GACvC,EAAU;GACV;EACF;EACA,IAAMG,IAAS;GACb,KAAK,MAAMH,EAAI,GAAG;GAClB,KAAK,MAAMP,EAAK,cAAcO,EAAI,KAAK;GACvC,KAAK,MAAMP,EAAK,eAAeO,EAAI,MAAM;GACzC,KAAK,MAAMA,EAAI,IAAI;EACrB,GAGMI,KAAW,MACf,KAAK,IAAIC,EAAI,OAAOL,EAAI,IAAI,IAAI,MAAO,KAAK,IAAIK,EAAI,MAAML,EAAI,GAAG,IAAI,MAClE,KAAK,IAAIK,EAAI,QAAQL,EAAI,KAAK,IAAI,MAAO,KAAK,IAAIK,EAAI,SAASL,EAAI,MAAM,IAAI,IAC9EM,IAAQ;EA2BZ,AA1BA,IAAW,IAAI,sBACZ,MAAY;GACX,IAAMC,IAAQC,EAAQ,EAAE,CAAC;GAIzB,IAHcF,IACVE,EAAQ,SAAS,KAAKJ,EAAQI,EAAQ,EAAE,CAAC,kBAAkB,IAC3DD,MAAUE,GACH;IAET,AADAR,EAAO,GACPC,EAAM,CAAC;IACP;GACF;GAEA,AADA,IAAQ,IACJK,MAAUE,MAIVF,MAAU,IAEZ,IAAQ,iBAAiB;IAEvB,AADIH,EAAQV,EAAQ,sBAAsB,CAAC,KAAGO,EAAO,GACrDC,EAAM,IAAI;GACZ,GAAG,GAAI,IALQA,EAAMK,CAAK;EAO9B,GACA;GAAE,YAAYJ,EAAO,KAAK,MAAU,GAAG,CAACO,EAAM,GAAG,CAAC,CAAC,KAAK,GAAG;GAAG,WAAW,KAAK,IAAI,GAAG,KAAK,IAAI,GAAGD,CAAS,CAAC,KAAK;EAAE,CACpH,GACAd,EAAS,QAAQD,CAAO;CAC1B;CAGA,OADAQ,EAAM,CAAC,GACAJ;AACT"}
@@ -1,6 +1,11 @@
1
1
  import { wrapWithPoseRotation as e } from "./poseRotation.js";
2
+ import { overChildren as t, splitOverChildren as n } from "./overChildren.js";
2
3
  //#region src/canvas/wrapNodeOutput.ts
3
- function t(t, n, r) {
4
+ function r(e, r, a) {
5
+ let { under: o, over: s } = n(e), c = i(o, r, a);
6
+ return s.length > 0 ? [...c, t(i(s, r, a))] : c;
7
+ }
8
+ function i(t, n, r) {
4
9
  let i = e(t, n);
5
10
  return r !== 1 && i.length > 0 ? [{
6
11
  kind: "group",
@@ -9,6 +14,6 @@ function t(t, n, r) {
9
14
  }] : i;
10
15
  }
11
16
  //#endregion
12
- export { t as wrapNodeOutput };
17
+ export { r as wrapNodeOutput };
13
18
 
14
19
  //# sourceMappingURL=wrapNodeOutput.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"wrapNodeOutput.js","names":["wrapNodeOutput","rotated","wrapWithPoseRotation","cmds","pose","alpha"],"sources":["../../src/canvas/wrapNodeOutput.ts"],"sourcesContent":["/**\n * The per-node wraps a scene render applies on top of whatever `drawOne`\n * returned — pose rotation, then a per-id alpha multiplier. They sit outside\n * `drawOne` on purpose: consumer-supplied painters get rotation and dimming\n * without having to reimplement either.\n *\n * Shared by the main canvas (`buildSceneLayer`) and the detached renders\n * (`buildSceneViewCommands`) so a scene painted off-screen matches the same\n * scene painted on it.\n */\nimport type { DrawCommand } from '../renderer';\nimport { wrapWithPoseRotation } from './poseRotation';\n\n/** Rotate `cmds` about the pose's AABB center and multiply by `alpha`.\n * Both wraps are skipped when they would be no-ops (zero/absent rotation,\n * alpha exactly 1, empty command list), so an upright opaque node emits the\n * painter's commands untouched. Alpha nests OUTSIDE rotation. */\nexport function wrapNodeOutput(\n cmds: DrawCommand[],\n pose: unknown,\n alpha: number,\n): DrawCommand[] {\n const rotated = wrapWithPoseRotation(cmds, pose);\n if (alpha !== 1 && rotated.length > 0) {\n return [{ kind: 'group', alpha, children: rotated }];\n }\n return rotated;\n}\n"],"mappings":";;AAiBA,SAAgBA,EACd,GACA,GACA,GACe;CACf,IAAMC,IAAUC,EAAqBC,GAAMC,CAAI;CAI/C,OAHIC,MAAU,KAAKJ,EAAQ,SAAS,IAC3B,CAAC;EAAE,MAAM;EAAS;EAAO,UAAUA;CAAQ,CAAC,IAE9CA;AACT"}
1
+ {"version":3,"file":"wrapNodeOutput.js","names":["wrapNodeOutput","splitOverChildren","cmds","wrapped","wrapPart","under","pose","alpha","over","overChildren","rotated","wrapWithPoseRotation"],"sources":["../../src/canvas/wrapNodeOutput.ts"],"sourcesContent":["/**\n * The per-node wraps a scene render applies on top of whatever `drawOne`\n * returned — pose rotation, then a per-id alpha multiplier. They sit outside\n * `drawOne` on purpose: consumer-supplied painters get rotation and dimming\n * without having to reimplement either.\n *\n * Shared by the main canvas (`buildSceneLayer`) and the detached renders\n * (`buildSceneViewCommands`) so a scene painted off-screen matches the same\n * scene painted on it.\n */\nimport type { DrawCommand } from '@weasel-js/renderer';\nimport { wrapWithPoseRotation } from './poseRotation';\nimport { overChildren, splitOverChildren } from './overChildren';\n\n/** Rotate `cmds` about the pose's AABB center and multiply by `alpha`.\n * Both wraps are skipped when they would be no-ops (zero/absent rotation,\n * alpha exactly 1, empty command list), so an upright opaque node emits the\n * painter's commands untouched. Alpha nests OUTSIDE rotation. */\nexport function wrapNodeOutput(\n cmds: DrawCommand[],\n pose: unknown,\n alpha: number,\n): DrawCommand[] {\n const { under, over } = splitOverChildren(cmds);\n const wrapped = wrapPart(under, pose, alpha);\n // What a painter asked to draw over the node's children is wrapped apart, so it is still over them.\n return over.length > 0 ? [...wrapped, overChildren(wrapPart(over, pose, alpha))] : wrapped;\n}\n\nfunction wrapPart(cmds: DrawCommand[], pose: unknown, alpha: number): DrawCommand[] {\n const rotated = wrapWithPoseRotation(cmds, pose);\n if (alpha !== 1 && rotated.length > 0) {\n return [{ kind: 'group', alpha, children: rotated }];\n }\n return rotated;\n}\n"],"mappings":";;;AAkBA,SAAgBA,EACd,GACA,GACA,GACe;CACf,IAAM,EAAE,UAAO,YAASC,EAAkBC,CAAI,GACxCC,IAAUC,EAASC,GAAOC,GAAMC,CAAK;CAE3C,OAAOC,EAAK,SAAS,IAAI,CAAC,GAAGL,GAASM,EAAaL,EAASI,GAAMF,GAAMC,CAAK,CAAC,CAAC,IAAIJ;AACrF;AAEA,SAASC,EAAS,GAAqB,GAAe,GAA8B;CAClF,IAAMM,IAAUC,EAAqBT,GAAMI,CAAI;CAI/C,OAHIC,MAAU,KAAKG,EAAQ,SAAS,IAC3B,CAAC;EAAE,MAAM;EAAS;EAAO,UAAUA;CAAQ,CAAC,IAE9CA;AACT"}
@@ -1,7 +1,9 @@
1
1
  import { NodeId } from '@weasel-js/routing';
2
- import { e as PasteOmission, k as ClipboardSnapshot, I as InsertAdapter } from './types-k-5Oqh-U.js';
2
+ import { d as PasteOmission, j as ClipboardSnapshot, I as InsertAdapter } from './types-DBbbCy0i.js';
3
3
  import '@weasel-js/history';
4
4
  import '@weasel-js/geom';
5
+ import './poseDescriptor-Bqk-11Rl.js';
6
+ import '@weasel-js/animator';
5
7
 
6
8
  type Replacer$1 = (key: string, value: unknown) => unknown;
7
9
  /** Options for `useClipboardOps`. */
@@ -74,12 +76,7 @@ declare function sniffWeaselClipboardText(text: string): boolean;
74
76
  /**
75
77
  * Embed a weasel clipboard payload in an SVG document as a `<metadata>`
76
78
  * child of the root — legal SVG 1.1, ignored by external tools — so one
77
- * `text/plain` flavor serves both audiences: external tools parse the SVG,
78
- * weasel extracts the JSON for full fidelity on draw→draw DOM paste.
79
- *
80
- * The payload rides in CDATA so JSON's `<` / `&` need no entity escaping; a
81
- * literal `]]>` inside the payload is split across CDATA sections
82
- * (`]]]]><![CDATA[>`), which {@link extractWeaselClipboardFromSvg} rejoins.
79
+ * `text/plain` flavor serves both audiences.
83
80
  *
84
81
  * Intended for OUR serializer's output only (`serializeSvg` — single
85
82
  * `<svg ...>` open tag, XML-escaped attributes). When no open tag is found
@@ -87,13 +84,9 @@ declare function sniffWeaselClipboardText(text: string): boolean;
87
84
  */
88
85
  declare function embedWeaselMetadataInSvg(svgText: string, payloadText: string): string;
89
86
  /**
90
- * Recover an embedded weasel clipboard payload from SVG text: read the first
91
- * `<metadata>` block, rejoin its CDATA sections (concatenation restores the
92
- * `]]>` split by {@link embedWeaselMetadataInSvg}; plain non-CDATA content
93
- * passes through as-is), and return the payload text iff it sniffs as the
94
- * weasel wire format — else null (external/non-weasel metadata declines).
95
- *
96
- * A text scan, not an XML parse — the payload is small and ours.
87
+ * The weasel clipboard payload embedded in SVG text by
88
+ * {@link embedWeaselMetadataInSvg}, or null when the first `<metadata>` block
89
+ * is absent or not the weasel wire format. A text scan, not an XML parse.
97
90
  */
98
91
  declare function extractWeaselClipboardFromSvg(svgText: string): string | null;
99
92
  /** Parse wire text to snapshot items, or null when malformed/mismatched