@weasel-js/core 1.9.4 → 1.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (1092) hide show
  1. package/CHANGELOG.md +750 -0
  2. package/README.md +5 -3
  3. package/dist/WeaselProvider.js +5 -7
  4. package/dist/WeaselProvider.js.map +1 -1
  5. package/dist/affordances/composeAffordanceLayer.js +91 -83
  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 +54 -100
  10. package/dist/affordances/hitAffordanceRegions.js.map +1 -1
  11. package/dist/affordances/pathAnchors.js.map +1 -1
  12. package/dist/affordances/rotationHandle.js +5 -4
  13. package/dist/affordances/rotationHandle.js.map +1 -1
  14. package/dist/animation/behaviors/coast.js +21 -0
  15. package/dist/animation/behaviors/coast.js.map +1 -0
  16. package/dist/animation/behaviors/coastByWrite.js +107 -0
  17. package/dist/animation/behaviors/coastByWrite.js.map +1 -0
  18. package/dist/animation/behaviors/coastOnTargets.js +94 -0
  19. package/dist/animation/behaviors/coastOnTargets.js.map +1 -0
  20. package/dist/animation/behaviors/momentum.js +48 -136
  21. package/dist/animation/behaviors/momentum.js.map +1 -1
  22. package/dist/animation/clipTargets.js +12 -0
  23. package/dist/animation/clipTargets.js.map +1 -0
  24. package/dist/animation/index.js +15 -20
  25. package/dist/animation/poseHelpers.js +112 -33
  26. package/dist/animation/poseHelpers.js.map +1 -1
  27. package/dist/animation/poseTarget.js +115 -0
  28. package/dist/animation/poseTarget.js.map +1 -0
  29. package/dist/animation/reflow.js +113 -83
  30. package/dist/animation/reflow.js.map +1 -1
  31. package/dist/animation/rewind.js +66 -0
  32. package/dist/animation/rewind.js.map +1 -0
  33. package/dist/animation/rig/bindRig.js +85 -53
  34. package/dist/animation/rig/bindRig.js.map +1 -1
  35. package/dist/animation/rig/rigNode.js +93 -0
  36. package/dist/animation/rig/rigNode.js.map +1 -0
  37. package/dist/animation/rig/rigSeat.js +26 -0
  38. package/dist/animation/rig/rigSeat.js.map +1 -0
  39. package/dist/animation/rig/skinBinding.js +56 -0
  40. package/dist/animation/rig/skinBinding.js.map +1 -0
  41. package/dist/animation/rig/useRig.js +31 -16
  42. package/dist/animation/rig/useRig.js.map +1 -1
  43. package/dist/animation/wrappers/animateLifecycle.js +8 -7
  44. package/dist/animation/wrappers/animateLifecycle.js.map +1 -1
  45. package/dist/animation/wrappers/animateOnSetPose.js +31 -31
  46. package/dist/animation/wrappers/animateOnSetPose.js.map +1 -1
  47. package/dist/animation/wrappers/instantPose.js.map +1 -1
  48. package/dist/animation/writtenPoseTarget.js +33 -0
  49. package/dist/animation/writtenPoseTarget.js.map +1 -0
  50. package/dist/autoPoseDescriptor-DHg5KqaJ.d.ts +27 -0
  51. package/dist/barrel/canvas.js +31 -0
  52. package/dist/barrel/chrome.js +10 -10
  53. package/dist/barrel/input.js +16 -17
  54. package/dist/barrel/interactions.js +35 -39
  55. package/dist/barrel/paint.js +11 -18
  56. package/dist/barrel/paths.js +12 -19
  57. package/dist/barrel/renderer.js +14 -20
  58. package/dist/barrel/routing.js +42 -36
  59. package/dist/barrel/scene.js +37 -0
  60. package/dist/barrel/text.js +9 -18
  61. package/dist/barrel/viewport.js +41 -51
  62. package/dist/canvas/Canvas.js +281 -475
  63. package/dist/canvas/Canvas.js.map +1 -1
  64. package/dist/canvas/CanvasView.js +169 -188
  65. package/dist/canvas/CanvasView.js.map +1 -1
  66. package/dist/canvas/CursorCoordsHud.js +22 -23
  67. package/dist/canvas/CursorCoordsHud.js.map +1 -1
  68. package/dist/canvas/DrawCanvas.js +39 -56
  69. package/dist/canvas/DrawCanvas.js.map +1 -1
  70. package/dist/canvas/ModalityHud.js.map +1 -1
  71. package/dist/canvas/NodeShape.js +28 -29
  72. package/dist/canvas/NodeShape.js.map +1 -1
  73. package/dist/canvas/PickHud.js.map +1 -1
  74. package/dist/canvas/SceneCanvas/DevHuds.js +40 -0
  75. package/dist/canvas/SceneCanvas/DevHuds.js.map +1 -0
  76. package/dist/canvas/SceneCanvas/GestureDispatcherMounter.js +66 -107
  77. package/dist/canvas/SceneCanvas/GestureDispatcherMounter.js.map +1 -1
  78. package/dist/canvas/SceneCanvas/PointerProviderIfRoot.js +27 -31
  79. package/dist/canvas/SceneCanvas/PointerProviderIfRoot.js.map +1 -1
  80. package/dist/canvas/SceneCanvas/StandardActionsRegistrar.js +51 -54
  81. package/dist/canvas/SceneCanvas/StandardActionsRegistrar.js.map +1 -1
  82. package/dist/canvas/SceneCanvas/ToolKeybindingsMounter.js +3 -3
  83. package/dist/canvas/SceneCanvas/ToolKeybindingsMounter.js.map +1 -1
  84. package/dist/canvas/SceneCanvas/coordTrace.js +37 -1
  85. package/dist/canvas/SceneCanvas/coordTrace.js.map +1 -1
  86. package/dist/canvas/SceneCanvas/defaultNodeProperties.js +40 -29
  87. package/dist/canvas/SceneCanvas/defaultNodeProperties.js.map +1 -1
  88. package/dist/canvas/SceneCanvas/defaultNodeRouting.js +1 -1
  89. package/dist/canvas/SceneCanvas/defaultNodeRouting.js.map +1 -1
  90. package/dist/canvas/SceneCanvas/dispatcherGestureBounds.js.map +1 -1
  91. package/dist/canvas/SceneCanvas/features.js +73 -43
  92. package/dist/canvas/SceneCanvas/features.js.map +1 -1
  93. package/dist/canvas/SceneCanvas/isDev.js.map +1 -1
  94. package/dist/canvas/SceneCanvas/poseGeometry.js +33 -37
  95. package/dist/canvas/SceneCanvas/poseGeometry.js.map +1 -1
  96. package/dist/canvas/SceneCanvas/props.js +15 -14
  97. package/dist/canvas/SceneCanvas/props.js.map +1 -1
  98. package/dist/canvas/SceneCanvas/toolRegistry.js +23 -0
  99. package/dist/canvas/SceneCanvas/toolRegistry.js.map +1 -0
  100. package/dist/canvas/SceneCanvas/useActionsPropResolver.js +6 -1
  101. package/dist/canvas/SceneCanvas/useActionsPropResolver.js.map +1 -1
  102. package/dist/canvas/SceneCanvas/useBuiltinShapeTools.js.map +1 -1
  103. package/dist/canvas/SceneCanvas/useBuiltinTools.js +21 -0
  104. package/dist/canvas/SceneCanvas/useBuiltinTools.js.map +1 -0
  105. package/dist/canvas/SceneCanvas/useCanvasCamera.js +38 -0
  106. package/dist/canvas/SceneCanvas/useCanvasCamera.js.map +1 -0
  107. package/dist/canvas/SceneCanvas/useCanvasDispatcher.js +20 -0
  108. package/dist/canvas/SceneCanvas/useCanvasDispatcher.js.map +1 -0
  109. package/dist/canvas/SceneCanvas/useCanvasSelection.js +16 -0
  110. package/dist/canvas/SceneCanvas/useCanvasSelection.js.map +1 -0
  111. package/dist/canvas/SceneCanvas/useCanvasTools.js +67 -0
  112. package/dist/canvas/SceneCanvas/useCanvasTools.js.map +1 -0
  113. package/dist/canvas/SceneCanvas/useDispatcherOverlayLayer.js +29 -29
  114. package/dist/canvas/SceneCanvas/useDispatcherOverlayLayer.js.map +1 -1
  115. package/dist/canvas/SceneCanvas/useHeldModifiers.js +20 -0
  116. package/dist/canvas/SceneCanvas/useHeldModifiers.js.map +1 -0
  117. package/dist/canvas/SceneCanvas/useNodeAtPoint.js +26 -0
  118. package/dist/canvas/SceneCanvas/useNodeAtPoint.js.map +1 -0
  119. package/dist/canvas/SceneCanvas/useNodeKinds.js +26 -0
  120. package/dist/canvas/SceneCanvas/useNodeKinds.js.map +1 -0
  121. package/dist/canvas/SceneCanvas/usePreviewGhostLayer.js +39 -37
  122. package/dist/canvas/SceneCanvas/usePreviewGhostLayer.js.map +1 -1
  123. package/dist/canvas/SceneCanvas/useSceneCanvasHandle.js +47 -0
  124. package/dist/canvas/SceneCanvas/useSceneCanvasHandle.js.map +1 -0
  125. package/dist/canvas/SceneCanvas/useSceneCanvasLayers.js +66 -0
  126. package/dist/canvas/SceneCanvas/useSceneCanvasLayers.js.map +1 -0
  127. package/dist/canvas/SceneCanvas/useSceneChrome.js +59 -0
  128. package/dist/canvas/SceneCanvas/useSceneChrome.js.map +1 -0
  129. package/dist/canvas/SceneCanvas/useSceneRedrawSources.js +23 -0
  130. package/dist/canvas/SceneCanvas/useSceneRedrawSources.js.map +1 -0
  131. package/dist/canvas/SceneCanvas/useSceneSelectTool.js +76 -80
  132. package/dist/canvas/SceneCanvas/useSceneSelectTool.js.map +1 -1
  133. package/dist/canvas/SceneCanvas/useSceneSlotLayers.js +37 -0
  134. package/dist/canvas/SceneCanvas/useSceneSlotLayers.js.map +1 -0
  135. package/dist/canvas/SceneCanvas/useSelectionOverlayLayer.js +38 -0
  136. package/dist/canvas/SceneCanvas/useSelectionOverlayLayer.js.map +1 -0
  137. package/dist/canvas/SceneCanvas/useViewLayerGate.js +20 -0
  138. package/dist/canvas/SceneCanvas/useViewLayerGate.js.map +1 -0
  139. package/dist/canvas/SceneCanvas/useViewportActions.js +9 -1
  140. package/dist/canvas/SceneCanvas/useViewportActions.js.map +1 -1
  141. package/dist/canvas/SceneCanvas/worldPointAt.js +9 -0
  142. package/dist/canvas/SceneCanvas/worldPointAt.js.map +1 -0
  143. package/dist/canvas/SceneCanvas.js +303 -707
  144. package/dist/canvas/SceneCanvas.js.map +1 -1
  145. package/dist/canvas/SceneViewCanvas.js +41 -47
  146. package/dist/canvas/SceneViewCanvas.js.map +1 -1
  147. package/dist/canvas/adapterDerivedPath.js +26 -0
  148. package/dist/canvas/adapterDerivedPath.js.map +1 -0
  149. package/dist/canvas/affordanceAt.js +11 -1
  150. package/dist/canvas/affordanceAt.js.map +1 -1
  151. package/dist/canvas/buildSceneLayer.js +81 -61
  152. package/dist/canvas/buildSceneLayer.js.map +1 -1
  153. package/dist/canvas/buildSceneTree.js.map +1 -1
  154. package/dist/canvas/canvasRenderer.js +40 -44
  155. package/dist/canvas/canvasRenderer.js.map +1 -1
  156. package/dist/canvas/colorOverrides.js.map +1 -1
  157. package/dist/canvas/defaultDrawOne.js +12 -12
  158. package/dist/canvas/defaultDrawOne.js.map +1 -1
  159. package/dist/canvas/deps/areaSelect.js +4 -4
  160. package/dist/canvas/deps/areaSelect.js.map +1 -1
  161. package/dist/canvas/deps/debug.js.map +1 -1
  162. package/dist/canvas/deps/editAnchors.js +49 -68
  163. package/dist/canvas/deps/editAnchors.js.map +1 -1
  164. package/dist/canvas/deps/geometryProjection.js.map +1 -1
  165. package/dist/canvas/deps/hitTestArea.js +31 -26
  166. package/dist/canvas/deps/hitTestArea.js.map +1 -1
  167. package/dist/canvas/deps/insert.js +65 -54
  168. package/dist/canvas/deps/insert.js.map +1 -1
  169. package/dist/canvas/deps/lassoSelect.js +5 -5
  170. package/dist/canvas/deps/lassoSelect.js.map +1 -1
  171. package/dist/canvas/deps/poseDescriptor.js +1 -1
  172. package/dist/canvas/deps/poseDescriptor.js.map +1 -1
  173. package/dist/canvas/deps/resizePolicy.js.map +1 -1
  174. package/dist/canvas/deps/slice.js +44 -45
  175. package/dist/canvas/deps/slice.js.map +1 -1
  176. package/dist/canvas/deps/textEdit.js +8 -8
  177. package/dist/canvas/deps/textEdit.js.map +1 -1
  178. package/dist/canvas/deps/view.js.map +1 -1
  179. package/dist/canvas/derivedPath.js +43 -41
  180. package/dist/canvas/derivedPath.js.map +1 -1
  181. package/dist/canvas/drawEnvelope.js +8 -4
  182. package/dist/canvas/drawEnvelope.js.map +1 -1
  183. package/dist/canvas/getNodeAtPoint.js +2 -6
  184. package/dist/canvas/getNodeAtPoint.js.map +1 -1
  185. package/dist/canvas/hud.module.js.map +1 -1
  186. package/dist/canvas/insertPreviewExtent.js.map +1 -1
  187. package/dist/canvas/layerOrder.js.map +1 -1
  188. package/dist/canvas/layerSlots.js +6 -1
  189. package/dist/canvas/layerSlots.js.map +1 -1
  190. package/dist/canvas/nodeShapes/derivedPainter.js +12 -12
  191. package/dist/canvas/nodeShapes/derivedPainter.js.map +1 -1
  192. package/dist/canvas/nodeShapes/imagePainter.js +10 -10
  193. package/dist/canvas/nodeShapes/imagePainter.js.map +1 -1
  194. package/dist/canvas/nodeShapes/memo.js.map +1 -1
  195. package/dist/canvas/nodeShapes/nodePaint.js +34 -23
  196. package/dist/canvas/nodeShapes/nodePaint.js.map +1 -1
  197. package/dist/canvas/nodeShapes/pathPainter.js +23 -22
  198. package/dist/canvas/nodeShapes/pathPainter.js.map +1 -1
  199. package/dist/canvas/nodeShapes/poseBox.js +6 -6
  200. package/dist/canvas/nodeShapes/poseBox.js.map +1 -1
  201. package/dist/canvas/nodeShapes/rectFallbackPainter.js +8 -8
  202. package/dist/canvas/nodeShapes/rectFallbackPainter.js.map +1 -1
  203. package/dist/canvas/nodeShapes/shapePainter.js +16 -16
  204. package/dist/canvas/nodeShapes/shapePainter.js.map +1 -1
  205. package/dist/canvas/nodeShapes/textPainter.js +1 -1
  206. package/dist/canvas/nodeShapes/textPainter.js.map +1 -1
  207. package/dist/canvas/overlayRoleStrokes.js.map +1 -1
  208. package/dist/canvas/paintCull.js +6 -8
  209. package/dist/canvas/paintCull.js.map +1 -1
  210. package/dist/{features/cursor → canvas}/paintedCursorLayer.js +2 -2
  211. package/dist/canvas/paintedCursorLayer.js.map +1 -0
  212. package/dist/canvas/pickWalk.js +52 -50
  213. package/dist/canvas/pickWalk.js.map +1 -1
  214. package/dist/canvas/planeClips.js +18 -19
  215. package/dist/canvas/planeClips.js.map +1 -1
  216. package/dist/canvas/poseCascade.js +41 -0
  217. package/dist/canvas/poseCascade.js.map +1 -0
  218. package/dist/canvas/poseRotation.js +1 -3
  219. package/dist/canvas/poseRotation.js.map +1 -1
  220. package/dist/canvas/rasterReadback.js +22 -0
  221. package/dist/canvas/rasterReadback.js.map +1 -0
  222. package/dist/canvas/renderDebugSnapshot.js +12 -12
  223. package/dist/canvas/renderDebugSnapshot.js.map +1 -1
  224. package/dist/canvas/renderNeeds.js +3 -3
  225. package/dist/canvas/renderNeeds.js.map +1 -1
  226. package/dist/canvas/renderSceneToPixels.js +64 -83
  227. package/dist/canvas/renderSceneToPixels.js.map +1 -1
  228. package/dist/canvas/sceneAdapter.js +68 -132
  229. package/dist/canvas/sceneAdapter.js.map +1 -1
  230. package/dist/canvas/sceneClipboard.js +1 -1
  231. package/dist/canvas/sceneClipboard.js.map +1 -1
  232. package/dist/canvas/sceneLayerPaint.js +4 -4
  233. package/dist/canvas/sceneLayerPaint.js.map +1 -1
  234. package/dist/canvas/sceneSlotWiring.js +4 -4
  235. package/dist/canvas/sceneSlotWiring.js.map +1 -1
  236. package/dist/canvas/sceneViewRender.js +36 -35
  237. package/dist/canvas/sceneViewRender.js.map +1 -1
  238. package/dist/canvas/slopsDebugLayer.js +4 -4
  239. package/dist/canvas/slopsDebugLayer.js.map +1 -1
  240. package/dist/canvas/surface.module.js +6 -0
  241. package/dist/canvas/surface.module.js.map +1 -0
  242. package/dist/canvas/surfaceBox.js +16 -0
  243. package/dist/canvas/surfaceBox.js.map +1 -0
  244. package/dist/canvas/useCanvasRenderer.js +23 -11
  245. package/dist/canvas/useCanvasRenderer.js.map +1 -1
  246. package/dist/canvas/useCanvasSurface.js +31 -0
  247. package/dist/canvas/useCanvasSurface.js.map +1 -0
  248. package/dist/canvas/useCanvasView.js +46 -37
  249. package/dist/canvas/useCanvasView.js.map +1 -1
  250. package/dist/canvas/useFrameLoop.js +11 -12
  251. package/dist/canvas/useFrameLoop.js.map +1 -1
  252. package/dist/canvas/useHostAnchor.js +35 -33
  253. package/dist/canvas/useHostAnchor.js.map +1 -1
  254. package/dist/canvas/useLateContentRedraw.js +8 -8
  255. package/dist/canvas/useLateContentRedraw.js.map +1 -1
  256. package/dist/canvas/useSceneLayerList.js +4 -14
  257. package/dist/canvas/useSceneLayerList.js.map +1 -1
  258. package/dist/canvas/useSurfaceInput.js +42 -0
  259. package/dist/canvas/useSurfaceInput.js.map +1 -0
  260. package/dist/canvas/useToolCursor.js +29 -0
  261. package/dist/canvas/useToolCursor.js.map +1 -0
  262. package/dist/canvas/useViewHelpers.js +46 -85
  263. package/dist/canvas/useViewHelpers.js.map +1 -1
  264. package/dist/canvas/viewInputs.js.map +1 -1
  265. package/dist/canvas/viewRegistry.js +25 -27
  266. package/dist/canvas/viewRegistry.js.map +1 -1
  267. package/dist/canvas/watchElementMove.js +43 -0
  268. package/dist/canvas/watchElementMove.js.map +1 -0
  269. package/dist/canvas/wrapNodeOutput.js.map +1 -1
  270. package/dist/clipboard.d.ts +7 -14
  271. package/dist/{types-B4iJRHC3.d.ts → clone-2a5hVbBd.d.ts} +122 -77
  272. package/dist/clone.d.ts +4 -8
  273. package/dist/clone.js +0 -2
  274. package/dist/core/device/targets.js.map +1 -1
  275. package/dist/core/device/useDeviceProfile.js +13 -13
  276. package/dist/core/device/useDeviceProfile.js.map +1 -1
  277. package/dist/{interactions/actions/resize → core/geometry}/autoPoseDescriptor.js +8 -7
  278. package/dist/core/geometry/autoPoseDescriptor.js.map +1 -0
  279. package/dist/core/geometry/pathPoseDescriptor.js +88 -0
  280. package/dist/core/geometry/pathPoseDescriptor.js.map +1 -0
  281. package/dist/core/geometry/poseDescriptor.js +61 -14
  282. package/dist/core/geometry/poseDescriptor.js.map +1 -1
  283. package/dist/core/geometry/regionHit.js +35 -37
  284. package/dist/core/geometry/regionHit.js.map +1 -1
  285. package/dist/core/geometry/targetFrame.js +94 -0
  286. package/dist/core/geometry/targetFrame.js.map +1 -0
  287. package/dist/core/geometry/unionBounds.js +4 -5
  288. package/dist/core/geometry/unionBounds.js.map +1 -1
  289. package/dist/core/layers/backgroundFill.js +31 -0
  290. package/dist/core/layers/backgroundFill.js.map +1 -0
  291. package/dist/{features/groups → core/layers}/children.js +1 -1
  292. package/dist/core/layers/children.js.map +1 -0
  293. package/dist/{features/focus → core/layers}/gateLayer.js +2 -2
  294. package/dist/core/layers/gateLayer.js.map +1 -0
  295. package/dist/core/layers/layerGroup.js +40 -0
  296. package/dist/core/layers/layerGroup.js.map +1 -0
  297. package/dist/core/layers/render.js +50 -76
  298. package/dist/core/layers/render.js.map +1 -1
  299. package/dist/core/ops/createHistory.js +9 -9
  300. package/dist/core/ops/createHistory.js.map +1 -1
  301. package/dist/core/ops/delete.js.map +1 -1
  302. package/dist/core/paint/meshKind.js +16 -0
  303. package/dist/core/paint/meshKind.js.map +1 -0
  304. package/dist/{features/meshPaint/lazyKind.js → core/paint/meshKindLazy.js} +103 -92
  305. package/dist/core/paint/meshKindLazy.js.map +1 -0
  306. package/dist/core/paint/paintKindEntry.js +8 -0
  307. package/dist/core/paint/paintKindEntry.js.map +1 -0
  308. package/dist/core/paint/paintKinds.js +144 -0
  309. package/dist/core/paint/paintKinds.js.map +1 -0
  310. package/dist/core/paint/registerMesh.js +7 -0
  311. package/dist/core/paint/registerMesh.js.map +1 -0
  312. package/dist/core/scene/NodeProperties.js.map +1 -1
  313. package/dist/core/scene/NodeRouting.js.map +1 -1
  314. package/dist/core/scene/arrivalWindow.js +65 -64
  315. package/dist/core/scene/arrivalWindow.js.map +1 -1
  316. package/dist/core/scene/boundOps.js +40 -0
  317. package/dist/core/scene/boundOps.js.map +1 -0
  318. package/dist/core/scene/composeFrame.js +9 -6
  319. package/dist/core/scene/composeFrame.js.map +1 -1
  320. package/dist/{features/groups → core/scene}/composePose.js +18 -18
  321. package/dist/core/scene/composePose.js.map +1 -0
  322. package/dist/core/scene/depMemo.js +31 -6
  323. package/dist/core/scene/depMemo.js.map +1 -1
  324. package/dist/core/scene/derivedPath.js +19 -20
  325. package/dist/core/scene/derivedPath.js.map +1 -1
  326. package/dist/core/scene/editMode.js +26 -0
  327. package/dist/core/scene/editMode.js.map +1 -0
  328. package/dist/core/scene/effectivePose.js +38 -39
  329. package/dist/core/scene/effectivePose.js.map +1 -1
  330. package/dist/core/scene/fieldEdits.js +98 -0
  331. package/dist/core/scene/fieldEdits.js.map +1 -0
  332. package/dist/core/scene/historyFacade.js +116 -70
  333. package/dist/core/scene/historyFacade.js.map +1 -1
  334. package/dist/core/scene/historyForm.js +6 -0
  335. package/dist/core/scene/historyForm.js.map +1 -0
  336. package/dist/core/scene/kitOps.js +83 -71
  337. package/dist/core/scene/kitOps.js.map +1 -1
  338. package/dist/core/scene/kitRegistry.js.map +1 -1
  339. package/dist/core/scene/layerStack.js +105 -12
  340. package/dist/core/scene/layerStack.js.map +1 -1
  341. package/dist/core/scene/layoutPass.js +58 -59
  342. package/dist/core/scene/layoutPass.js.map +1 -1
  343. package/dist/{features/groups → core/scene}/nestedHit.js +3 -3
  344. package/dist/core/scene/nestedHit.js.map +1 -0
  345. package/dist/core/scene/nodeFnFields.js +9 -9
  346. package/dist/core/scene/nodeFnFields.js.map +1 -1
  347. package/dist/core/scene/nodeMemo.js.map +1 -1
  348. package/dist/core/scene/nodeStore.js +72 -71
  349. package/dist/core/scene/nodeStore.js.map +1 -1
  350. package/dist/core/scene/notifier.js +37 -0
  351. package/dist/core/scene/notifier.js.map +1 -0
  352. package/dist/core/scene/opTable.js +50 -0
  353. package/dist/core/scene/opTable.js.map +1 -0
  354. package/dist/core/scene/outerOps.js +66 -0
  355. package/dist/core/scene/outerOps.js.map +1 -0
  356. package/dist/core/scene/poseHold.js +39 -0
  357. package/dist/core/scene/poseHold.js.map +1 -0
  358. package/dist/core/scene/poseOverrides.js +44 -36
  359. package/dist/core/scene/poseOverrides.js.map +1 -1
  360. package/dist/core/scene/poseSnapshot.js.map +1 -1
  361. package/dist/core/scene/reconcileSpecs.js +3 -2
  362. package/dist/core/scene/reconcileSpecs.js.map +1 -1
  363. package/dist/core/scene/recorder.js +86 -0
  364. package/dist/core/scene/recorder.js.map +1 -0
  365. package/dist/core/scene/renderOrder.js.map +1 -1
  366. package/dist/core/scene/scene.js +81 -690
  367. package/dist/core/scene/scene.js.map +1 -1
  368. package/dist/core/scene/sceneEdits.js +58 -0
  369. package/dist/core/scene/sceneEdits.js.map +1 -0
  370. package/dist/core/scene/sceneMutators.js +49 -0
  371. package/dist/core/scene/sceneMutators.js.map +1 -0
  372. package/dist/core/scene/scenePoseAdapter.js +16 -0
  373. package/dist/core/scene/scenePoseAdapter.js.map +1 -0
  374. package/dist/core/scene/sceneRecording.js +90 -0
  375. package/dist/core/scene/sceneRecording.js.map +1 -0
  376. package/dist/core/scene/sceneSelection.js +28 -0
  377. package/dist/core/scene/sceneSelection.js.map +1 -0
  378. package/dist/core/scene/sceneState.js +49 -0
  379. package/dist/core/scene/sceneState.js.map +1 -0
  380. package/dist/core/scene/serialization.js +8 -5
  381. package/dist/core/scene/serialization.js.map +1 -1
  382. package/dist/core/scene/staleReplay.js +51 -0
  383. package/dist/core/scene/staleReplay.js.map +1 -0
  384. package/dist/core/scene/statedFields.js +9 -0
  385. package/dist/core/scene/statedFields.js.map +1 -0
  386. package/dist/core/scene/treeEdits.js +127 -0
  387. package/dist/core/scene/treeEdits.js.map +1 -0
  388. package/dist/core/scene/treeReads.js +26 -0
  389. package/dist/core/scene/treeReads.js.map +1 -0
  390. package/dist/core/scene/types.js.map +1 -1
  391. package/dist/{features/groups → core/scene}/unionOfChildren.js +3 -3
  392. package/dist/core/scene/unionOfChildren.js.map +1 -0
  393. package/dist/core/scene/unitScopes.js +13 -0
  394. package/dist/core/scene/unitScopes.js.map +1 -0
  395. package/dist/core/scene/useScene.js.map +1 -1
  396. package/dist/core/selection/readOnlySelection.js +32 -0
  397. package/dist/core/selection/readOnlySelection.js.map +1 -0
  398. package/dist/core/selection/usePublishSceneSelection.js +26 -0
  399. package/dist/core/selection/usePublishSceneSelection.js.map +1 -0
  400. package/dist/core/selection/useSelection.js +34 -25
  401. package/dist/core/selection/useSelection.js.map +1 -1
  402. package/dist/core/shapeKinds.js.map +1 -1
  403. package/dist/core/stylus/stylus.js.map +1 -1
  404. package/dist/core/stylus/usePointerStylus.js.map +1 -1
  405. package/dist/core/usePaintKinds.js +1 -1
  406. package/dist/core/usePaintKinds.js.map +1 -1
  407. package/dist/core/viewport/clientToWorld.js.map +1 -1
  408. package/dist/core/viewport/fitViewToBounds.js.map +1 -1
  409. package/dist/core/viewport/parallax.js.map +1 -1
  410. package/dist/core/viewport/screenSlop.js +11 -11
  411. package/dist/core/viewport/screenSlop.js.map +1 -1
  412. package/dist/core/viewport/useCanvasSize.js.map +1 -1
  413. package/dist/core/viewport/useDecayLoop.js +8 -8
  414. package/dist/core/viewport/useDecayLoop.js.map +1 -1
  415. package/dist/core/viewport/useNodeOverlayFrame.js +84 -0
  416. package/dist/core/viewport/useNodeOverlayFrame.js.map +1 -0
  417. package/dist/core/viewport/useViewAnimation.js +102 -43
  418. package/dist/core/viewport/useViewAnimation.js.map +1 -1
  419. package/dist/core/viewport/view.js +7 -7
  420. package/dist/core/viewport/view.js.map +1 -1
  421. package/dist/core/viewport/wheelHandler.js.map +1 -1
  422. package/dist/{cornerHandles-CtCb8a3G.d.ts → cornerHandles-BEshc4z3.d.ts} +11 -24
  423. package/dist/debug/createDebugOverlayLayer.js +100 -100
  424. package/dist/debug/createDebugOverlayLayer.js.map +1 -1
  425. package/dist/debug/createDebugSink.js.map +1 -1
  426. package/dist/debug/frameStats.js.map +1 -1
  427. package/dist/debug/useDebugSink.js +52 -0
  428. package/dist/debug/useDebugSink.js.map +1 -0
  429. package/dist/features/chrome-caps/buildChromeCtx.js.map +1 -1
  430. package/dist/features/chrome-caps/conditions.js.map +1 -1
  431. package/dist/features/chrome-caps/defaults.js.map +1 -1
  432. package/dist/features/chrome-caps/resolve.js.map +1 -1
  433. package/dist/features/chrome-caps/useChromeCaps.js +54 -0
  434. package/dist/features/chrome-caps/useChromeCaps.js.map +1 -0
  435. package/dist/features/chrome-caps/useHoverTracking.js.map +1 -1
  436. package/dist/features/ingestion/contentHandlers.js +25 -19
  437. package/dist/features/ingestion/contentHandlers.js.map +1 -1
  438. package/dist/features/ingestion/imageHandler.js +21 -24
  439. package/dist/features/ingestion/imageHandler.js.map +1 -1
  440. package/dist/features/ingestion/openFilePicker.js.map +1 -1
  441. package/dist/features/ingestion/placement.js +16 -0
  442. package/dist/features/ingestion/placement.js.map +1 -0
  443. package/dist/features/ingestion/svgHandler.js +5 -0
  444. package/dist/features/ingestion/svgHandler.js.map +1 -1
  445. package/dist/features/ingestion/textHandler.js +28 -0
  446. package/dist/features/ingestion/textHandler.js.map +1 -0
  447. package/dist/features/ingestion/useCanvasIngestion.js +48 -0
  448. package/dist/features/ingestion/useCanvasIngestion.js.map +1 -0
  449. package/dist/features/ingestion/weaselJsonHandler.js +5 -0
  450. package/dist/features/ingestion/weaselJsonHandler.js.map +1 -1
  451. package/dist/features/longPress/longPressFeedback.js.map +1 -1
  452. package/dist/features/modes/modeLayers.js +7 -7
  453. package/dist/features/modes/modeLayers.js.map +1 -1
  454. package/dist/features/paths/editablePath.js +47 -0
  455. package/dist/features/paths/editablePath.js.map +1 -0
  456. package/dist/features/paths/index.js +9 -16
  457. package/dist/features/paths/pathEditState.js +41 -0
  458. package/dist/features/paths/pathEditState.js.map +1 -0
  459. package/dist/features/paths/pathEditingOverlayLayer.js +36 -38
  460. package/dist/features/paths/pathEditingOverlayLayer.js.map +1 -1
  461. package/dist/features/paths/pathLayer.js +3 -2
  462. package/dist/features/paths/pathLayer.js.map +1 -1
  463. package/dist/features/paths/penPreviewLayer.js +86 -88
  464. package/dist/features/paths/penPreviewLayer.js.map +1 -1
  465. package/dist/features/paths/usePathEdit.js +34 -0
  466. package/dist/features/paths/usePathEdit.js.map +1 -0
  467. package/dist/features/poseRun/usePoseRun.js +42 -55
  468. package/dist/features/poseRun/usePoseRun.js.map +1 -1
  469. package/dist/features/selection/overlay.js +170 -178
  470. package/dist/features/selection/overlay.js.map +1 -1
  471. package/dist/features/text/index.js +6 -0
  472. package/dist/features/text/textLayer.js +1 -1
  473. package/dist/features/text/textLayer.js.map +1 -1
  474. package/dist/features/text/useSceneTextEdit.js +95 -82
  475. package/dist/features/text/useSceneTextEdit.js.map +1 -1
  476. package/dist/features/viewports/viewportLayer.js +25 -36
  477. package/dist/features/viewports/viewportLayer.js.map +1 -1
  478. package/dist/index.d.ts +4507 -8459
  479. package/dist/index.js +275 -320
  480. package/dist/input/keyState.js +14 -14
  481. package/dist/interactions/actions/actionShortcuts.js.map +1 -1
  482. package/dist/interactions/actions/{defaults/align.js → align/action.js} +15 -16
  483. package/dist/interactions/actions/align/action.js.map +1 -0
  484. package/dist/interactions/actions/align/align.js +23 -23
  485. package/dist/interactions/actions/align/align.js.map +1 -1
  486. package/dist/interactions/actions/booleans/action.js +65 -0
  487. package/dist/interactions/actions/booleans/action.js.map +1 -0
  488. package/dist/interactions/actions/booleans/booleans.js +69 -78
  489. package/dist/interactions/actions/booleans/booleans.js.map +1 -1
  490. package/dist/interactions/actions/booleans/operands.js +40 -0
  491. package/dist/interactions/actions/booleans/operands.js.map +1 -0
  492. package/dist/interactions/actions/booleans/pieces.js +45 -0
  493. package/dist/interactions/actions/booleans/pieces.js.map +1 -0
  494. package/dist/interactions/actions/booleans/placement.js +24 -0
  495. package/dist/interactions/actions/booleans/placement.js.map +1 -0
  496. package/dist/interactions/actions/booleans/useBooleans.js +11 -9
  497. package/dist/interactions/actions/booleans/useBooleans.js.map +1 -1
  498. package/dist/interactions/actions/booleans/useBooleansAdapter.js.map +1 -1
  499. package/dist/interactions/actions/{defaults/clipboard.js → clipboard/action.js} +19 -19
  500. package/dist/interactions/actions/clipboard/action.js.map +1 -0
  501. package/dist/interactions/actions/clipboard/clipboardOps.js +15 -15
  502. package/dist/interactions/actions/clipboard/clipboardOps.js.map +1 -1
  503. package/dist/interactions/actions/clipboard/wireFormat.js.map +1 -1
  504. package/dist/interactions/actions/clone/action.js +98 -0
  505. package/dist/interactions/actions/clone/action.js.map +1 -0
  506. package/dist/interactions/actions/clone/behaviors.js +52 -0
  507. package/dist/interactions/actions/clone/behaviors.js.map +1 -0
  508. package/dist/interactions/actions/defaultCommitAdapter.js +10 -37
  509. package/dist/interactions/actions/defaultCommitAdapter.js.map +1 -1
  510. package/dist/interactions/actions/defaults/anchorEditing.js +41 -43
  511. package/dist/interactions/actions/defaults/anchorEditing.js.map +1 -1
  512. package/dist/interactions/actions/defaults/areaSelect.js.map +1 -1
  513. package/dist/interactions/actions/defaults/cancelGesture.js.map +1 -1
  514. package/dist/interactions/actions/defaults/clearSelection.js.map +1 -1
  515. package/dist/interactions/actions/defaults/createPaintAction.js.map +1 -1
  516. package/dist/interactions/actions/defaults/delete.js.map +1 -1
  517. package/dist/interactions/actions/defaults/duplicate.js +19 -19
  518. package/dist/interactions/actions/defaults/duplicate.js.map +1 -1
  519. package/dist/interactions/actions/defaults/enterTextEdit.js.map +1 -1
  520. package/dist/interactions/actions/defaults/group.js +35 -40
  521. package/dist/interactions/actions/defaults/group.js.map +1 -1
  522. package/dist/interactions/actions/defaults/icons/booleanIcons.js +24 -1
  523. package/dist/interactions/actions/defaults/icons/booleanIcons.js.map +1 -1
  524. package/dist/interactions/actions/defaults/icons/outlineIcons.js +39 -1
  525. package/dist/interactions/actions/defaults/icons/outlineIcons.js.map +1 -1
  526. package/dist/interactions/actions/defaults/ingest.js +19 -15
  527. package/dist/interactions/actions/defaults/ingest.js.map +1 -1
  528. package/dist/interactions/actions/defaults/insertPathAnchor.js +14 -15
  529. package/dist/interactions/actions/defaults/insertPathAnchor.js.map +1 -1
  530. package/dist/interactions/actions/defaults/nudge.js +30 -31
  531. package/dist/interactions/actions/defaults/nudge.js.map +1 -1
  532. package/dist/interactions/actions/defaults/pinchZoom.js.map +1 -1
  533. package/dist/interactions/actions/defaults/requiresSelection.js.map +1 -1
  534. package/dist/interactions/actions/defaults/setFill.js +9 -3
  535. package/dist/interactions/actions/defaults/setFill.js.map +1 -1
  536. package/dist/interactions/actions/defaults/setFillOpacity.js +4 -1
  537. package/dist/interactions/actions/defaults/setFillOpacity.js.map +1 -1
  538. package/dist/interactions/actions/defaults/setStroke.js.map +1 -1
  539. package/dist/interactions/actions/defaults/sliceOps.js +20 -22
  540. package/dist/interactions/actions/defaults/sliceOps.js.map +1 -1
  541. package/dist/interactions/actions/defaults/toolActivate.js.map +1 -1
  542. package/dist/interactions/actions/defaults/toolResetToDefault.js.map +1 -1
  543. package/dist/interactions/actions/defaults/viewportDragPan.js +1 -1
  544. package/dist/interactions/actions/defaults/viewportDragPan.js.map +1 -1
  545. package/dist/interactions/actions/defaults/viewportWheelPan.js.map +1 -1
  546. package/dist/interactions/actions/defaults/viewportZoom.js.map +1 -1
  547. package/dist/interactions/actions/{defaults/distribute.js → distribute/action.js} +18 -19
  548. package/dist/interactions/actions/distribute/action.js.map +1 -0
  549. package/dist/interactions/actions/distribute/distribute.js +11 -11
  550. package/dist/interactions/actions/distribute/distribute.js.map +1 -1
  551. package/dist/interactions/actions/{defaults/editAnchors.js → edit-anchors/action.js} +19 -21
  552. package/dist/interactions/actions/edit-anchors/action.js.map +1 -0
  553. package/dist/interactions/actions/edit-anchors/geometry.js +2 -4
  554. package/dist/interactions/actions/edit-anchors/geometry.js.map +1 -1
  555. package/dist/interactions/actions/flip/action.js +124 -0
  556. package/dist/interactions/actions/flip/action.js.map +1 -0
  557. package/dist/interactions/actions/flip/helpers.js +1 -1
  558. package/dist/interactions/actions/flip/helpers.js.map +1 -1
  559. package/dist/interactions/actions/gestureFrames.js +18 -0
  560. package/dist/interactions/actions/gestureFrames.js.map +1 -0
  561. package/dist/interactions/actions/gestureLifecycle.js +47 -20
  562. package/dist/interactions/actions/gestureLifecycle.js.map +1 -1
  563. package/dist/interactions/actions/insert/action.js +72 -0
  564. package/dist/interactions/actions/insert/action.js.map +1 -0
  565. package/dist/interactions/actions/insert/commit.js +28 -0
  566. package/dist/interactions/actions/insert/commit.js.map +1 -0
  567. package/dist/interactions/actions/insert/extras.js +65 -0
  568. package/dist/interactions/actions/insert/extras.js.map +1 -0
  569. package/dist/interactions/actions/insert/frame.js +48 -0
  570. package/dist/interactions/actions/insert/frame.js.map +1 -0
  571. package/dist/interactions/actions/insert/geometry.js +35 -0
  572. package/dist/interactions/actions/insert/geometry.js.map +1 -0
  573. package/dist/interactions/actions/insert/rotateAction.js +21 -0
  574. package/dist/interactions/actions/insert/rotateAction.js.map +1 -0
  575. package/dist/interactions/actions/insert/session.js +59 -0
  576. package/dist/interactions/actions/insert/session.js.map +1 -0
  577. package/dist/interactions/actions/insert/shape.js +34 -0
  578. package/dist/interactions/actions/insert/shape.js.map +1 -0
  579. package/dist/interactions/actions/lasso-select/action.js +143 -0
  580. package/dist/interactions/actions/lasso-select/action.js.map +1 -0
  581. package/dist/interactions/actions/move/action.js +87 -0
  582. package/dist/interactions/actions/move/action.js.map +1 -0
  583. package/dist/interactions/actions/move/behaviors/layoutDrop.js +51 -0
  584. package/dist/interactions/actions/move/behaviors/layoutDrop.js.map +1 -0
  585. package/dist/interactions/actions/move/behaviors/reparentOnDrop.js +15 -0
  586. package/dist/interactions/actions/move/behaviors/reparentOnDrop.js.map +1 -0
  587. package/dist/interactions/actions/move/behaviors/snapToContainer.js +24 -23
  588. package/dist/interactions/actions/move/behaviors/snapToContainer.js.map +1 -1
  589. package/dist/interactions/actions/move/capture.js +99 -0
  590. package/dist/interactions/actions/move/capture.js.map +1 -0
  591. package/dist/interactions/actions/move/commit/index.js +41 -0
  592. package/dist/interactions/actions/move/commit/index.js.map +1 -0
  593. package/dist/interactions/actions/move/commit/layoutDrop.js +44 -0
  594. package/dist/interactions/actions/move/commit/layoutDrop.js.map +1 -0
  595. package/dist/interactions/actions/move/commit/layoutRelease.js +100 -0
  596. package/dist/interactions/actions/move/commit/layoutRelease.js.map +1 -0
  597. package/dist/interactions/actions/move/commit/rebase.js +18 -0
  598. package/dist/interactions/actions/move/commit/rebase.js.map +1 -0
  599. package/dist/interactions/actions/move/commit/reparent.js +65 -0
  600. package/dist/interactions/actions/move/commit/reparent.js.map +1 -0
  601. package/dist/interactions/actions/move/delta.js +51 -0
  602. package/dist/interactions/actions/move/delta.js.map +1 -0
  603. package/dist/interactions/actions/move/frame.js +59 -0
  604. package/dist/interactions/actions/move/frame.js.map +1 -0
  605. package/dist/interactions/actions/move/gestureAdapter.js +15 -40
  606. package/dist/interactions/actions/move/gestureAdapter.js.map +1 -1
  607. package/dist/interactions/actions/move/landedDescendants.js +8 -8
  608. package/dist/interactions/actions/move/layout/container.js +94 -0
  609. package/dist/interactions/actions/move/layout/container.js.map +1 -0
  610. package/dist/interactions/actions/move/layout/dragged.js +58 -0
  611. package/dist/interactions/actions/move/layout/dragged.js.map +1 -0
  612. package/dist/interactions/actions/move/layout/dropPass.js +122 -0
  613. package/dist/interactions/actions/move/layout/dropPass.js.map +1 -0
  614. package/dist/interactions/actions/move/layout/exits.js +38 -0
  615. package/dist/interactions/actions/move/layout/exits.js.map +1 -0
  616. package/dist/interactions/actions/move/layout/glide.js +48 -0
  617. package/dist/interactions/actions/move/layout/glide.js.map +1 -0
  618. package/dist/interactions/actions/move/session.js +63 -0
  619. package/dist/interactions/actions/move/session.js.map +1 -0
  620. package/dist/interactions/actions/move/translate.js +61 -0
  621. package/dist/interactions/actions/move/translate.js.map +1 -0
  622. package/dist/interactions/actions/outlines/createOutlines.js +17 -64
  623. package/dist/interactions/actions/outlines/createOutlines.js.map +1 -1
  624. package/dist/interactions/actions/outlines/createOutlinesAction.js +51 -0
  625. package/dist/interactions/actions/outlines/createOutlinesAction.js.map +1 -0
  626. package/dist/interactions/actions/outlines/outlineStroke.js +72 -0
  627. package/dist/interactions/actions/outlines/outlineStroke.js.map +1 -0
  628. package/dist/interactions/actions/outlines/outlineStrokeAction.js +37 -0
  629. package/dist/interactions/actions/outlines/outlineStrokeAction.js.map +1 -0
  630. package/dist/interactions/actions/outlines/replaceWithPaths.js +54 -0
  631. package/dist/interactions/actions/outlines/replaceWithPaths.js.map +1 -0
  632. package/dist/interactions/actions/outlines/strokeRegion.js +27 -0
  633. package/dist/interactions/actions/outlines/strokeRegion.js.map +1 -0
  634. package/dist/interactions/actions/planeInput.js.map +1 -1
  635. package/dist/interactions/actions/pointerState.js +12 -0
  636. package/dist/interactions/actions/pointerState.js.map +1 -0
  637. package/dist/interactions/actions/poseDescriptorDep.js +1 -1
  638. package/dist/interactions/actions/poseDescriptorDep.js.map +1 -1
  639. package/dist/interactions/actions/poseFrame.js +26 -26
  640. package/dist/interactions/actions/poseFrame.js.map +1 -1
  641. package/dist/interactions/actions/resize/action.js +55 -0
  642. package/dist/interactions/actions/resize/action.js.map +1 -0
  643. package/dist/interactions/actions/resize/behaviors/lockAspect.js.map +1 -1
  644. package/dist/interactions/actions/resize/boxFrame.js +16 -0
  645. package/dist/interactions/actions/resize/boxFrame.js.map +1 -0
  646. package/dist/interactions/actions/resize/capture.js +85 -0
  647. package/dist/interactions/actions/resize/capture.js.map +1 -0
  648. package/dist/interactions/actions/resize/commit.js +69 -0
  649. package/dist/interactions/actions/resize/commit.js.map +1 -0
  650. package/dist/interactions/actions/resize/frame.js +74 -0
  651. package/dist/interactions/actions/resize/frame.js.map +1 -0
  652. package/dist/interactions/actions/resize/pointSnap.js +111 -0
  653. package/dist/interactions/actions/resize/pointSnap.js.map +1 -0
  654. package/dist/interactions/actions/resize/ruleBounds.js +9 -0
  655. package/dist/interactions/actions/resize/ruleBounds.js.map +1 -0
  656. package/dist/interactions/actions/resize/session.js +49 -0
  657. package/dist/interactions/actions/resize/session.js.map +1 -0
  658. package/dist/interactions/actions/resolveOverlays.js.map +1 -1
  659. package/dist/interactions/actions/resolvePreviews.js.map +1 -1
  660. package/dist/interactions/actions/rotate/action.js +56 -0
  661. package/dist/interactions/actions/rotate/action.js.map +1 -0
  662. package/dist/interactions/actions/rotate/behaviors/index.js +7 -0
  663. package/dist/interactions/actions/rotate/behaviors/index.js.map +1 -0
  664. package/dist/interactions/actions/rotate/behaviors/snapRotation.js +12 -0
  665. package/dist/interactions/actions/rotate/behaviors/snapRotation.js.map +1 -0
  666. package/dist/interactions/actions/rotate/commit.js +40 -0
  667. package/dist/interactions/actions/rotate/commit.js.map +1 -0
  668. package/dist/interactions/actions/rotate/frame.js +65 -0
  669. package/dist/interactions/actions/rotate/frame.js.map +1 -0
  670. package/dist/interactions/actions/rotate/handle.js +12 -12
  671. package/dist/interactions/actions/rotate/handle.js.map +1 -1
  672. package/dist/interactions/actions/rotate/session.js +92 -0
  673. package/dist/interactions/actions/rotate/session.js.map +1 -0
  674. package/dist/interactions/actions/spatialReference.js.map +1 -1
  675. package/dist/interactions/actions/useStandardActions.js +77 -72
  676. package/dist/interactions/actions/useStandardActions.js.map +1 -1
  677. package/dist/interactions/gestures/pointerDrag/pointerDrag.js +61 -42
  678. package/dist/interactions/gestures/pointerDrag/pointerDrag.js.map +1 -1
  679. package/dist/interactions/gestures/shared/originProjection.js +1 -1
  680. package/dist/interactions/gestures/shared/originProjection.js.map +1 -1
  681. package/dist/interactions/gestures/shared/screenTolerance.js +8 -2
  682. package/dist/interactions/gestures/shared/screenTolerance.js.map +1 -1
  683. package/dist/interactions/gestures/shared/snap.js.map +1 -1
  684. package/dist/layout/arrivals.js +20 -23
  685. package/dist/layout/arrivals.js.map +1 -1
  686. package/dist/math-CYUjoyyU.d.ts +33 -0
  687. package/dist/math.d.ts +5 -2
  688. package/dist/math.js +6 -6
  689. package/dist/mesh.d.ts +4 -268
  690. package/dist/mesh.js +3 -7
  691. package/dist/move.d.ts +6 -4
  692. package/dist/{originProjection-gHnOup4e.d.ts → originProjection-PPT88jZv.d.ts} +1 -1
  693. package/dist/patterns-builtin.d.ts +1 -118
  694. package/dist/patterns-builtin.js +2 -3
  695. package/dist/poseDescriptor-Bqk-11Rl.d.ts +73 -0
  696. package/dist/renderer.d.ts +1 -92
  697. package/dist/renderer.js +2 -19
  698. package/dist/resize.d.ts +11 -22
  699. package/dist/resize.js +1 -1
  700. package/dist/style.css +1 -1
  701. package/dist/test-hook/install.js.map +1 -1
  702. package/dist/test-hook/useTestHook.js +22 -0
  703. package/dist/test-hook/useTestHook.js.map +1 -0
  704. package/dist/test-seams-D0pyV3pR.d.ts +149 -0
  705. package/dist/test-seams.d.ts +4 -4
  706. package/dist/test-seams.js +2 -2
  707. package/dist/tools/builtin/bone/boneActions.js +130 -0
  708. package/dist/tools/builtin/bone/boneActions.js.map +1 -0
  709. package/dist/tools/builtin/bone/boneOverlay.js +58 -0
  710. package/dist/tools/builtin/bone/boneOverlay.js.map +1 -0
  711. package/dist/tools/builtin/bone/placedRig.js +24 -0
  712. package/dist/tools/builtin/bone/placedRig.js.map +1 -0
  713. package/dist/tools/builtin/bone/rigEditState.js +21 -0
  714. package/dist/tools/builtin/bone/rigEditState.js.map +1 -0
  715. package/dist/tools/builtin/bone/useBoneTool.js +98 -0
  716. package/dist/tools/builtin/bone/useBoneTool.js.map +1 -0
  717. package/dist/tools/builtin/ellipse/useEllipseTool.js.map +1 -1
  718. package/dist/tools/builtin/eyedropper/useEyedropperTool.js.map +1 -1
  719. package/dist/tools/builtin/hand/useHandTool.js.map +1 -1
  720. package/dist/tools/builtin/image/useImageTool.js.map +1 -1
  721. package/dist/tools/builtin/lasso/useLassoTool.js.map +1 -1
  722. package/dist/tools/builtin/line/useLineTool.js.map +1 -1
  723. package/dist/tools/builtin/pen/usePenTool.js +161 -163
  724. package/dist/tools/builtin/pen/usePenTool.js.map +1 -1
  725. package/dist/tools/builtin/pencil/usePencilTool.js.map +1 -1
  726. package/dist/tools/builtin/pickTopMostHit.js.map +1 -1
  727. package/dist/tools/builtin/polygon/usePolygonTool.js.map +1 -1
  728. package/dist/tools/builtin/rect/useRectTool.js.map +1 -1
  729. package/dist/tools/builtin/select/adapterPointQuery.js +36 -0
  730. package/dist/tools/builtin/select/adapterPointQuery.js.map +1 -0
  731. package/dist/tools/builtin/select/selectionContributions.js +4 -4
  732. package/dist/tools/builtin/select/selectionContributions.js.map +1 -1
  733. package/dist/tools/builtin/select/useSelectTool.js +43 -71
  734. package/dist/tools/builtin/select/useSelectTool.js.map +1 -1
  735. package/dist/tools/builtin/shared/pointerFollower.js.map +1 -1
  736. package/dist/tools/builtin/slice/useSliceTool.js +67 -72
  737. package/dist/tools/builtin/slice/useSliceTool.js.map +1 -1
  738. package/dist/tools/builtin/star/useStarTool.js.map +1 -1
  739. package/dist/tools/builtin/text/useTextTool.js +8 -0
  740. package/dist/tools/builtin/text/useTextTool.js.map +1 -1
  741. package/dist/tools/builtin/weight/useWeightTool.js +77 -0
  742. package/dist/tools/builtin/weight/useWeightTool.js.map +1 -0
  743. package/dist/tools/builtin/weight/weightActions.js +112 -0
  744. package/dist/tools/builtin/weight/weightActions.js.map +1 -0
  745. package/dist/tools/builtin/weight/weightOverlay.js +61 -0
  746. package/dist/tools/builtin/weight/weightOverlay.js.map +1 -0
  747. package/dist/tools/overlayBinding.js.map +1 -1
  748. package/dist/tools/useKeybindings.js +20 -14
  749. package/dist/tools/useKeybindings.js.map +1 -1
  750. package/dist/{types-k-5Oqh-U.d.ts → types-CIKDwlsP.d.ts} +84 -164
  751. package/dist/util/paint.js +1 -1
  752. package/dist/util/paint.js.map +1 -1
  753. package/dist/version.js +1 -1
  754. package/package.json +26 -21
  755. package/dist/animation/colorHelpers.js +0 -135
  756. package/dist/animation/colorHelpers.js.map +0 -1
  757. package/dist/animation/colorRegistry.js +0 -37
  758. package/dist/animation/colorRegistry.js.map +0 -1
  759. package/dist/animation/engine/axes.js +0 -36
  760. package/dist/animation/engine/axes.js.map +0 -1
  761. package/dist/animation/engine/codec.js +0 -170
  762. package/dist/animation/engine/codec.js.map +0 -1
  763. package/dist/animation/engine/integrator.js +0 -12
  764. package/dist/animation/engine/integrator.js.map +0 -1
  765. package/dist/animation/loop.js +0 -60
  766. package/dist/animation/loop.js.map +0 -1
  767. package/dist/animation/observe.js +0 -23
  768. package/dist/animation/observe.js.map +0 -1
  769. package/dist/animation/rig/blendPoses.js +0 -43
  770. package/dist/animation/rig/blendPoses.js.map +0 -1
  771. package/dist/animation/rig/mirrorPose.js +0 -19
  772. package/dist/animation/rig/mirrorPose.js.map +0 -1
  773. package/dist/animation/rig/resolveSkeleton.js +0 -33
  774. package/dist/animation/rig/resolveSkeleton.js.map +0 -1
  775. package/dist/animation/rig/solveIk.js +0 -103
  776. package/dist/animation/rig/solveIk.js.map +0 -1
  777. package/dist/animation/rig/types.js +0 -12
  778. package/dist/animation/rig/types.js.map +0 -1
  779. package/dist/animation/slew.js +0 -27
  780. package/dist/animation/slew.js.map +0 -1
  781. package/dist/animation/stagger.js +0 -146
  782. package/dist/animation/stagger.js.map +0 -1
  783. package/dist/animation/timeline/booking.js +0 -114
  784. package/dist/animation/timeline/booking.js.map +0 -1
  785. package/dist/animation/timeline/createTimeline.js +0 -125
  786. package/dist/animation/timeline/createTimeline.js.map +0 -1
  787. package/dist/animation/timeline/sampleTrack.js +0 -79
  788. package/dist/animation/timeline/sampleTrack.js.map +0 -1
  789. package/dist/animation/useAnimator.js +0 -388
  790. package/dist/animation/useAnimator.js.map +0 -1
  791. package/dist/autoPoseDescriptor-Ct7yqivU.d.ts +0 -108
  792. package/dist/builtins-DPcdghtB.d.ts +0 -1223
  793. package/dist/canvas/MinimapCanvas.js +0 -140
  794. package/dist/canvas/MinimapCanvas.js.map +0 -1
  795. package/dist/canvas/deps/poseComposition.js +0 -11
  796. package/dist/canvas/deps/poseComposition.js.map +0 -1
  797. package/dist/canvas/minimapMath.js +0 -82
  798. package/dist/canvas/minimapMath.js.map +0 -1
  799. package/dist/canvas/toolPreview.js +0 -39
  800. package/dist/canvas/toolPreview.js.map +0 -1
  801. package/dist/core/adapters/arrayAdapter.js +0 -94
  802. package/dist/core/adapters/arrayAdapter.js.map +0 -1
  803. package/dist/core/adapters/useArrayAdapter.js +0 -13
  804. package/dist/core/adapters/useArrayAdapter.js.map +0 -1
  805. package/dist/core/fillInPoseFrame.js +0 -102
  806. package/dist/core/fillInPoseFrame.js.map +0 -1
  807. package/dist/core/geometry/poseFrame.js +0 -44
  808. package/dist/core/geometry/poseFrame.js.map +0 -1
  809. package/dist/core/geometry/poseRotation.js +0 -58
  810. package/dist/core/geometry/poseRotation.js.map +0 -1
  811. package/dist/core/gradient.js +0 -136
  812. package/dist/core/gradient.js.map +0 -1
  813. package/dist/core/markerInset.js +0 -24
  814. package/dist/core/markerInset.js.map +0 -1
  815. package/dist/core/mixed.js +0 -6
  816. package/dist/core/mixed.js.map +0 -1
  817. package/dist/core/paintKinds.js +0 -156
  818. package/dist/core/paintKinds.js.map +0 -1
  819. package/dist/core/scene/pickability.js +0 -6
  820. package/dist/core/scene/pickability.js.map +0 -1
  821. package/dist/core/strokeMarkerShapes.js +0 -139
  822. package/dist/core/strokeMarkerShapes.js.map +0 -1
  823. package/dist/core/strokeMarkers.js +0 -28
  824. package/dist/core/strokeMarkers.js.map +0 -1
  825. package/dist/core/viewport/meanScale.js +0 -8
  826. package/dist/core/viewport/meanScale.js.map +0 -1
  827. package/dist/core/viewport/pxExtent.js +0 -42
  828. package/dist/core/viewport/pxExtent.js.map +0 -1
  829. package/dist/features/cursor/paintedCursorLayer.js.map +0 -1
  830. package/dist/features/focus/gateLayer.js.map +0 -1
  831. package/dist/features/focus/useCanvasFocus.js +0 -29
  832. package/dist/features/focus/useCanvasFocus.js.map +0 -1
  833. package/dist/features/groups/children.js.map +0 -1
  834. package/dist/features/groups/composePose.js.map +0 -1
  835. package/dist/features/groups/nestedHit.js.map +0 -1
  836. package/dist/features/groups/unionOfChildren.js.map +0 -1
  837. package/dist/features/images/imageCache.js +0 -104
  838. package/dist/features/images/imageCache.js.map +0 -1
  839. package/dist/features/ingestion/index.js +0 -8
  840. package/dist/features/meshPaint/bake.js +0 -79
  841. package/dist/features/meshPaint/bake.js.map +0 -1
  842. package/dist/features/meshPaint/bakeCache.js +0 -59
  843. package/dist/features/meshPaint/bakeCache.js.map +0 -1
  844. package/dist/features/meshPaint/handles.js +0 -86
  845. package/dist/features/meshPaint/handles.js.map +0 -1
  846. package/dist/features/meshPaint/lazyKind.js.map +0 -1
  847. package/dist/features/meshPaint/meshPaint.js +0 -239
  848. package/dist/features/meshPaint/meshPaint.js.map +0 -1
  849. package/dist/features/meshPaint/meshShader.js +0 -6
  850. package/dist/features/meshPaint/meshShader.js.map +0 -1
  851. package/dist/features/meshPaint/register.js +0 -7
  852. package/dist/features/meshPaint/register.js.map +0 -1
  853. package/dist/features/meshPaint/surface.js +0 -110
  854. package/dist/features/meshPaint/surface.js.map +0 -1
  855. package/dist/features/minimap/actions.js +0 -53
  856. package/dist/features/minimap/actions.js.map +0 -1
  857. package/dist/features/minimap/createMinimapContribution.js +0 -96
  858. package/dist/features/minimap/createMinimapContribution.js.map +0 -1
  859. package/dist/features/minimap/layers.js +0 -85
  860. package/dist/features/minimap/layers.js.map +0 -1
  861. package/dist/features/overlays/useNodeOverlayFrame.js +0 -103
  862. package/dist/features/overlays/useNodeOverlayFrame.js.map +0 -1
  863. package/dist/features/parallax/createParallaxLayer.js +0 -26
  864. package/dist/features/parallax/createParallaxLayer.js.map +0 -1
  865. package/dist/features/parallax/createParallaxPlane.js +0 -22
  866. package/dist/features/parallax/createParallaxPlane.js.map +0 -1
  867. package/dist/features/paths/anchorEdits.js +0 -167
  868. package/dist/features/paths/anchorEdits.js.map +0 -1
  869. package/dist/features/paths/anchors.js +0 -159
  870. package/dist/features/paths/anchors.js.map +0 -1
  871. package/dist/features/paths/booleans.js +0 -2
  872. package/dist/features/paths/markerCommands.js +0 -149
  873. package/dist/features/paths/markerCommands.js.map +0 -1
  874. package/dist/features/paths/markerSites.js +0 -59
  875. package/dist/features/paths/markerSites.js.map +0 -1
  876. package/dist/features/paths/markers.js +0 -95
  877. package/dist/features/paths/markers.js.map +0 -1
  878. package/dist/features/paths/nearestAnchor.js +0 -36
  879. package/dist/features/paths/nearestAnchor.js.map +0 -1
  880. package/dist/features/paths/pathInWorld.js +0 -41
  881. package/dist/features/paths/pathInWorld.js.map +0 -1
  882. package/dist/features/paths/poseDescriptor.js +0 -39
  883. package/dist/features/paths/poseDescriptor.js.map +0 -1
  884. package/dist/features/paths/strokeToPath.js +0 -40
  885. package/dist/features/paths/strokeToPath.js.map +0 -1
  886. package/dist/features/paths/tessellate/dash.js +0 -52
  887. package/dist/features/paths/tessellate/dash.js.map +0 -1
  888. package/dist/features/paths/tessellate/insets.js +0 -32
  889. package/dist/features/paths/tessellate/insets.js.map +0 -1
  890. package/dist/features/paths/tessellate/metric.js +0 -72
  891. package/dist/features/paths/tessellate/metric.js.map +0 -1
  892. package/dist/features/paths/tessellate/stroke.js +0 -170
  893. package/dist/features/paths/tessellate/stroke.js.map +0 -1
  894. package/dist/features/paths/tessellate/vertexWidths.js +0 -32
  895. package/dist/features/paths/tessellate/vertexWidths.js.map +0 -1
  896. package/dist/features/patterns/commandPaint.js +0 -18
  897. package/dist/features/patterns/commandPaint.js.map +0 -1
  898. package/dist/features/patterns/index.js +0 -11
  899. package/dist/features/patterns/index.js.map +0 -1
  900. package/dist/features/patterns/patterns-builtin.js +0 -38
  901. package/dist/features/patterns/patterns-builtin.js.map +0 -1
  902. package/dist/features/patterns/rasterizeTile.js +0 -17
  903. package/dist/features/patterns/rasterizeTile.js.map +0 -1
  904. package/dist/features/patterns/resolveSpec.js +0 -65
  905. package/dist/features/patterns/resolveSpec.js.map +0 -1
  906. package/dist/features/patterns/tileGeometry.js +0 -158
  907. package/dist/features/patterns/tileGeometry.js.map +0 -1
  908. package/dist/features/pointer/PointerContext.js +0 -45
  909. package/dist/features/pointer/PointerContext.js.map +0 -1
  910. package/dist/features/selection/SelectionContext.js +0 -51
  911. package/dist/features/selection/SelectionContext.js.map +0 -1
  912. package/dist/features/simulation/createSimulation.js +0 -61
  913. package/dist/features/simulation/createSimulation.js.map +0 -1
  914. package/dist/features/simulation/types.js +0 -6
  915. package/dist/features/simulation/types.js.map +0 -1
  916. package/dist/features/simulation/useSimulation.js +0 -74
  917. package/dist/features/simulation/useSimulation.js.map +0 -1
  918. package/dist/features/text/domOffsets.js +0 -82
  919. package/dist/features/text/domOffsets.js.map +0 -1
  920. package/dist/features/text/domRuns.js +0 -230
  921. package/dist/features/text/domRuns.js.map +0 -1
  922. package/dist/features/text/fitTextPose.js +0 -38
  923. package/dist/features/text/fitTextPose.js.map +0 -1
  924. package/dist/features/text/hitTest.js +0 -48
  925. package/dist/features/text/hitTest.js.map +0 -1
  926. package/dist/features/text/isTextData.js +0 -8
  927. package/dist/features/text/isTextData.js.map +0 -1
  928. package/dist/features/text/overlayDirection.js +0 -15
  929. package/dist/features/text/overlayDirection.js.map +0 -1
  930. package/dist/features/text/renderLabel.js +0 -14
  931. package/dist/features/text/renderLabel.js.map +0 -1
  932. package/dist/features/text/runs/effectiveRangeStyle.js +0 -66
  933. package/dist/features/text/runs/effectiveRangeStyle.js.map +0 -1
  934. package/dist/features/text/runs/flagRange.js +0 -53
  935. package/dist/features/text/runs/flagRange.js.map +0 -1
  936. package/dist/features/text/runs/rangeStyle.js +0 -133
  937. package/dist/features/text/runs/rangeStyle.js.map +0 -1
  938. package/dist/features/text/textCommand.js +0 -60
  939. package/dist/features/text/textCommand.js.map +0 -1
  940. package/dist/features/text/textToPath.js +0 -181
  941. package/dist/features/text/textToPath.js.map +0 -1
  942. package/dist/features/text/useTextEdit.js +0 -491
  943. package/dist/features/text/useTextEdit.js.map +0 -1
  944. package/dist/features/tiling/createTiledLayer.js +0 -65
  945. package/dist/features/tiling/createTiledLayer.js.map +0 -1
  946. package/dist/features/tiling/tiledProject.js +0 -14
  947. package/dist/features/tiling/tiledProject.js.map +0 -1
  948. package/dist/interactions/actions/clone/behaviors/cloneByAltDrag.js +0 -26
  949. package/dist/interactions/actions/clone/behaviors/cloneByAltDrag.js.map +0 -1
  950. package/dist/interactions/actions/defaults/align.js.map +0 -1
  951. package/dist/interactions/actions/defaults/booleans.js +0 -52
  952. package/dist/interactions/actions/defaults/booleans.js.map +0 -1
  953. package/dist/interactions/actions/defaults/clipboard.js.map +0 -1
  954. package/dist/interactions/actions/defaults/clone.js +0 -91
  955. package/dist/interactions/actions/defaults/clone.js.map +0 -1
  956. package/dist/interactions/actions/defaults/createOutlines.js +0 -47
  957. package/dist/interactions/actions/defaults/createOutlines.js.map +0 -1
  958. package/dist/interactions/actions/defaults/distribute.js.map +0 -1
  959. package/dist/interactions/actions/defaults/editAnchors.js.map +0 -1
  960. package/dist/interactions/actions/defaults/flip.js +0 -125
  961. package/dist/interactions/actions/defaults/flip.js.map +0 -1
  962. package/dist/interactions/actions/defaults/insert.js +0 -287
  963. package/dist/interactions/actions/defaults/insert.js.map +0 -1
  964. package/dist/interactions/actions/defaults/lassoSelect.js +0 -153
  965. package/dist/interactions/actions/defaults/lassoSelect.js.map +0 -1
  966. package/dist/interactions/actions/defaults/move.js +0 -778
  967. package/dist/interactions/actions/defaults/move.js.map +0 -1
  968. package/dist/interactions/actions/defaults/resize.js +0 -341
  969. package/dist/interactions/actions/defaults/resize.js.map +0 -1
  970. package/dist/interactions/actions/defaults/rotate.js +0 -185
  971. package/dist/interactions/actions/defaults/rotate.js.map +0 -1
  972. package/dist/interactions/actions/previewOverrides.js +0 -25
  973. package/dist/interactions/actions/previewOverrides.js.map +0 -1
  974. package/dist/interactions/actions/resize/autoPoseDescriptor.js.map +0 -1
  975. package/dist/math-J-ACHyEg.d.ts +0 -159
  976. package/dist/registerProgram-T9S_PfAX.d.ts +0 -208
  977. package/dist/renderer/DrawCommand.js +0 -6
  978. package/dist/renderer/DrawCommand.js.map +0 -1
  979. package/dist/renderer/WeaselRenderer.js +0 -333
  980. package/dist/renderer/WeaselRenderer.js.map +0 -1
  981. package/dist/renderer/batchClip.js +0 -46
  982. package/dist/renderer/batchClip.js.map +0 -1
  983. package/dist/renderer/cache/GLImageCache.js +0 -74
  984. package/dist/renderer/cache/GLImageCache.js.map +0 -1
  985. package/dist/renderer/cache/GLMeshCache.js +0 -102
  986. package/dist/renderer/cache/GLMeshCache.js.map +0 -1
  987. package/dist/renderer/cache/GLTextureCache.js +0 -68
  988. package/dist/renderer/cache/GLTextureCache.js.map +0 -1
  989. package/dist/renderer/cache/GradientRampAtlas.js +0 -82
  990. package/dist/renderer/cache/GradientRampAtlas.js.map +0 -1
  991. package/dist/renderer/cache/cache.js +0 -13
  992. package/dist/renderer/cache/cache.js.map +0 -1
  993. package/dist/renderer/cache/markerCommandCache.js +0 -63
  994. package/dist/renderer/cache/markerCommandCache.js.map +0 -1
  995. package/dist/renderer/cache/outlineMeshCache.js +0 -15
  996. package/dist/renderer/cache/outlineMeshCache.js.map +0 -1
  997. package/dist/renderer/cache/outlineStrokeMeshCache.js +0 -36
  998. package/dist/renderer/cache/outlineStrokeMeshCache.js.map +0 -1
  999. package/dist/renderer/cache/strokeMeshCache.js +0 -55
  1000. package/dist/renderer/cache/strokeMeshCache.js.map +0 -1
  1001. package/dist/renderer/cullDrawCommands.js +0 -90
  1002. package/dist/renderer/cullDrawCommands.js.map +0 -1
  1003. package/dist/renderer/draw/batch.js +0 -133
  1004. package/dist/renderer/draw/batch.js.map +0 -1
  1005. package/dist/renderer/draw/clip.js +0 -89
  1006. package/dist/renderer/draw/clip.js.map +0 -1
  1007. package/dist/renderer/draw/customShader.js +0 -230
  1008. package/dist/renderer/draw/customShader.js.map +0 -1
  1009. package/dist/renderer/draw/drawTriangles.js +0 -8
  1010. package/dist/renderer/draw/drawTriangles.js.map +0 -1
  1011. package/dist/renderer/draw/effects.js +0 -28
  1012. package/dist/renderer/draw/effects.js.map +0 -1
  1013. package/dist/renderer/draw/flushBatch.js +0 -35
  1014. package/dist/renderer/draw/flushBatch.js.map +0 -1
  1015. package/dist/renderer/draw/gradient.js +0 -90
  1016. package/dist/renderer/draw/gradient.js.map +0 -1
  1017. package/dist/renderer/draw/image.js +0 -38
  1018. package/dist/renderer/draw/image.js.map +0 -1
  1019. package/dist/renderer/draw/mesh.js +0 -16
  1020. package/dist/renderer/draw/mesh.js.map +0 -1
  1021. package/dist/renderer/draw/paintBind.js +0 -70
  1022. package/dist/renderer/draw/paintBind.js.map +0 -1
  1023. package/dist/renderer/draw/pathPaint.js +0 -142
  1024. package/dist/renderer/draw/pathPaint.js.map +0 -1
  1025. package/dist/renderer/draw/scratchPass.js +0 -83
  1026. package/dist/renderer/draw/scratchPass.js.map +0 -1
  1027. package/dist/renderer/draw/stencil.js +0 -28
  1028. package/dist/renderer/draw/stencil.js.map +0 -1
  1029. package/dist/renderer/draw/text.js +0 -167
  1030. package/dist/renderer/draw/text.js.map +0 -1
  1031. package/dist/renderer/draw/uniforms.js +0 -77
  1032. package/dist/renderer/draw/uniforms.js.map +0 -1
  1033. package/dist/renderer/draw.js +0 -79
  1034. package/dist/renderer/draw.js.map +0 -1
  1035. package/dist/renderer/drawBatch.js +0 -198
  1036. package/dist/renderer/drawBatch.js.map +0 -1
  1037. package/dist/renderer/effects/EffectTargets.js +0 -48
  1038. package/dist/renderer/effects/EffectTargets.js.map +0 -1
  1039. package/dist/renderer/effects/builtins.js +0 -31
  1040. package/dist/renderer/effects/builtins.js.map +0 -1
  1041. package/dist/renderer/effects/composite.js +0 -11
  1042. package/dist/renderer/effects/composite.js.map +0 -1
  1043. package/dist/renderer/effects/effectPrelude.js +0 -10
  1044. package/dist/renderer/effects/effectPrelude.js.map +0 -1
  1045. package/dist/renderer/effects/types.js +0 -10
  1046. package/dist/renderer/effects/types.js.map +0 -1
  1047. package/dist/renderer/glyphOutlineMesh.js +0 -67
  1048. package/dist/renderer/glyphOutlineMesh.js.map +0 -1
  1049. package/dist/renderer/index.js +0 -20
  1050. package/dist/renderer/math/color.js +0 -321
  1051. package/dist/renderer/math/color.js.map +0 -1
  1052. package/dist/renderer/math/mat3.js +0 -80
  1053. package/dist/renderer/math/mat3.js.map +0 -1
  1054. package/dist/renderer/math/patternSpace.js +0 -22
  1055. package/dist/renderer/math/patternSpace.js.map +0 -1
  1056. package/dist/renderer/math/viewToMat3.js +0 -19
  1057. package/dist/renderer/math/viewToMat3.js.map +0 -1
  1058. package/dist/renderer/paintResources.js +0 -18
  1059. package/dist/renderer/paintResources.js.map +0 -1
  1060. package/dist/renderer/paintScratch.js +0 -37
  1061. package/dist/renderer/paintScratch.js.map +0 -1
  1062. package/dist/renderer/shaders/ShaderProgram.js +0 -74
  1063. package/dist/renderer/shaders/ShaderProgram.js.map +0 -1
  1064. package/dist/renderer/shaders/batchFill.js +0 -119
  1065. package/dist/renderer/shaders/batchFill.js.map +0 -1
  1066. package/dist/renderer/shaders/customPrelude.js +0 -34
  1067. package/dist/renderer/shaders/customPrelude.js.map +0 -1
  1068. package/dist/renderer/shaders/extractUniformNames.js +0 -184
  1069. package/dist/renderer/shaders/extractUniformNames.js.map +0 -1
  1070. package/dist/renderer/shaders/glyphPaint.js +0 -61
  1071. package/dist/renderer/shaders/glyphPaint.js.map +0 -1
  1072. package/dist/renderer/shaders/gradFill.js +0 -31
  1073. package/dist/renderer/shaders/gradFill.js.map +0 -1
  1074. package/dist/renderer/shaders/pathFill.js +0 -14
  1075. package/dist/renderer/shaders/pathFill.js.map +0 -1
  1076. package/dist/renderer/shaders/patternFill.js +0 -25
  1077. package/dist/renderer/shaders/patternFill.js.map +0 -1
  1078. package/dist/renderer/shaders/registerProgram.js +0 -18
  1079. package/dist/renderer/shaders/registerProgram.js.map +0 -1
  1080. package/dist/renderer/spriteSheet.js +0 -14
  1081. package/dist/renderer/spriteSheet.js.map +0 -1
  1082. package/dist/renderer/state/GroupState.js +0 -77
  1083. package/dist/renderer/state/GroupState.js.map +0 -1
  1084. package/dist/renderer/strokeLengths.js +0 -50
  1085. package/dist/renderer/strokeLengths.js.map +0 -1
  1086. package/dist/renderer/syntheticItalic.js +0 -6
  1087. package/dist/renderer/syntheticItalic.js.map +0 -1
  1088. package/dist/renderer/textures/registerTexture.js +0 -34
  1089. package/dist/renderer/textures/registerTexture.js.map +0 -1
  1090. package/dist/scheduling/useVisibleRaf.js +0 -69
  1091. package/dist/scheduling/useVisibleRaf.js.map +0 -1
  1092. package/dist/test-seams-DM2B87-g.d.ts +0 -356
@@ -0,0 +1,23 @@
1
+ import { IS_DEV as e } from "./isDev.js";
2
+ import { featureToolIds as t } from "./features.js";
3
+ import { BUILTIN_TOOL_IDS as n } from "./props.js";
4
+ //#region src/canvas/SceneCanvas/toolRegistry.ts
5
+ function r(r) {
6
+ let { builtins: i, defaultTools: a = [], enabled: o, patch: s, dev: c = e } = r, l = {}, u = t(o);
7
+ for (let e of n) {
8
+ let t = s?.[e];
9
+ t !== !1 && (t === !0 || a.includes(e) || u.has(e)) && (l[e] = i[e]);
10
+ }
11
+ for (let [e, t] of Object.entries(s ?? {})) if (t !== !1) {
12
+ if (t === !0) {
13
+ c && !n.includes(e) && console.warn(`[SceneCanvas] tools.${e}=true is not a known built-in id; ignoring`);
14
+ continue;
15
+ }
16
+ c && e in l && console.warn(`[SceneCanvas] tools prop overrides bundled "${e}" tool`), l[e] = t;
17
+ }
18
+ return l;
19
+ }
20
+ //#endregion
21
+ export { r as resolveToolRegistry };
22
+
23
+ //# sourceMappingURL=toolRegistry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"toolRegistry.js","names":["resolveToolRegistry","IS_DEV","args","registry","preset","featureToolIds","enabled","id","BUILTIN_TOOL_IDS","patched","patch","defaultTools","builtins","value","dev"],"sources":["../../../src/canvas/SceneCanvas/toolRegistry.ts"],"sourcesContent":["import type { Tool } from 'tools/overlayBinding';\nimport { featureToolIds, type BaseFeature } from './features';\nimport { IS_DEV } from './isDev';\nimport { BUILTIN_TOOL_IDS, type BuiltinToolId } from './props';\n\n/** The patch form of `<SceneCanvas tools>`: per id, `true` mounts that\n * built-in, `false` leaves it out, and a tool adds or replaces one. */\nexport type ToolsPatch = Record<string, Tool | true | false>;\n\n/** One tool per built-in id, mounted or not. */\nexport type BuiltinTools = Record<BuiltinToolId, Tool>;\n\nexport interface ResolveToolRegistryArgs {\n builtins: BuiltinTools;\n /** Built-ins asked for by id. */\n defaultTools?: readonly BuiltinToolId[];\n /** The presets the canvas runs with, each bringing the tools its\n * `FEATURE_PRESETS` row names. */\n enabled: ReadonlySet<BaseFeature>;\n patch: ToolsPatch | null;\n /** Whether to warn about a patch entry that is probably a mistake. */\n dev?: boolean;\n}\n\n/**\n * The tool registry a canvas mounts when it is not handed a whole `ToolsApi`.\n *\n * Built-ins come first, in `BUILTIN_TOOL_IDS` order whatever order they were\n * asked for in; a patch tool replaces a mounted one where it stands, and any\n * other is appended in patch order. That order is the palette's.\n */\nexport function resolveToolRegistry(args: ResolveToolRegistryArgs): Record<string, Tool> {\n const { builtins, defaultTools = [], enabled, patch, dev = IS_DEV } = args;\n const registry: Record<string, Tool> = {};\n const preset = featureToolIds(enabled);\n for (const id of BUILTIN_TOOL_IDS) {\n const patched = patch?.[id];\n if (patched === false) continue;\n const asked = patched === true || defaultTools.includes(id) || preset.has(id);\n if (asked) registry[id] = builtins[id];\n }\n for (const [id, value] of Object.entries(patch ?? {})) {\n if (value === false) continue;\n if (value === true) {\n if (dev && !(BUILTIN_TOOL_IDS as readonly string[]).includes(id)) {\n console.warn(`[SceneCanvas] tools.${id}=true is not a known built-in id; ignoring`);\n }\n continue;\n }\n if (dev && id in registry) {\n console.warn(`[SceneCanvas] tools prop overrides bundled \"${id}\" tool`);\n }\n registry[id] = value;\n }\n return registry;\n}\n"],"mappings":";;;;AA+BA,SAAgBA,EAAoB,GAAqD;CACvF,IAAM,EAAE,aAAU,kBAAe,CAAC,GAAG,YAAS,UAAO,SAAMC,MAAWC,GAChEC,IAAiC,CAAC,GAClCC,IAASC,EAAeC,CAAO;CACrC,KAAK,IAAMC,KAAMC,GAAkB;EACjC,IAAMC,IAAUC,IAAQH;EACxB,AAAIE,MAAY,OACFA,MAAY,MAAQE,EAAa,SAASJ,CAAE,KAAKH,EAAO,IAAIG,CAAE,OACjE,EAASA,KAAMK,EAASL;CACrC;CACA,KAAK,IAAM,CAACA,GAAIM,MAAU,OAAO,QAAQH,KAAS,CAAC,CAAC,GAClD,IAAIG,MAAU,IACd;MAAIA,MAAU,IAAM;GAClB,AAAIC,KAAO,CAAEN,EAAuC,SAASD,CAAE,KAC7D,QAAQ,KAAK,uBAAuBA,EAAG,2CAA2C;GAEpF;EACF;EAIA,AAHIO,KAAOP,KAAMJ,KACf,QAAQ,KAAK,+CAA+CI,EAAG,OAAO,GAExE,EAASA,KAAMM;CAJf;CAMF,OAAOV;AACT"}
@@ -42,7 +42,12 @@ function r(r, i) {
42
42
  i
43
43
  ]);
44
44
  }
45
+ function i(e, t) {
46
+ if (e === null) return null;
47
+ let n = { ...e ?? {} };
48
+ return t in n || (n[t] = null), n;
49
+ }
45
50
  //#endregion
46
- export { r as useActionsPropResolver };
51
+ export { i as actionsMuting, r as useActionsPropResolver };
47
52
 
48
53
  //# sourceMappingURL=useActionsPropResolver.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"useActionsPropResolver.js","names":["useActionsPropResolver","reg","useActionsRegistry","actionsRef","useLatest","actions","prop","unregisters","id","a","u","warnedIds","slotId","entry","isFull","existing","_drop","rest","merged","rev"],"sources":["../../../src/canvas/SceneCanvas/useActionsPropResolver.ts"],"sourcesContent":["/**\n * `useActionsPropResolver` — applies the `actions` prop overrides on top of\n * whatever `useStandardActions` registered. Runs after it (caller mounts this\n * hook last). Resolution rules:\n *\n * actions === null → mute every currently-registered action\n * actions[id] === null → mute that id\n * actions[id] = partial → merge onto the existing descriptor (slot wins\n * over entry.id; warns once on mismatch)\n * actions[id] = full (new) → register alongside defaults\n *\n * `null` mutes rather than unregisters: the opt-out belongs to this canvas, so\n * a sibling sharing the registry keeps the action and this canvas's unmount\n * gives it back.\n */\nimport { useEffect } from 'react';\nimport type { ActionsProp } from '@weasel-js/routing';\nimport { useActionsRegistry } from '@weasel-js/routing/react';\nimport { useLatest } from '@weasel-js/react';\nimport type { Action } from '@weasel-js/routing';\n\n/** `rev` re-applies the overrides when it changes — pass whatever changes when\n * the set they sit on is re-registered. */\nexport function useActionsPropResolver(actions: ActionsProp | undefined, rev?: string): void {\n const reg = useActionsRegistry();\n const actionsRef = useLatest(actions);\n\n useEffect(() => {\n if (!reg) return;\n const prop = actionsRef.current;\n\n const unregisters: Array<() => void> = [];\n\n if (prop === null) {\n for (const id of reg.list().map((a) => a.id)) unregisters.push(reg.mute(id));\n return () => { for (const u of unregisters) u(); };\n }\n\n if (!prop) return;\n\n const warnedIds = new Set<string>();\n\n for (const [slotId, entry] of Object.entries(prop)) {\n if (entry === null) {\n unregisters.push(reg.mute(slotId));\n continue;\n }\n\n const isFull = (e: Partial<Action>): e is Action =>\n typeof e.id === 'string' && typeof e.label === 'string' && !!e.invoker;\n const existing = reg.list().find((a) => a.id === slotId);\n\n if (!existing) {\n if (isFull(entry)) {\n unregisters.push(reg.register(entry));\n } else if (!warnedIds.has(slotId)) {\n warnedIds.add(slotId);\n console.warn(\n `weasel actions resolver: actions[\"${slotId}\"] is a partial Action but no default ` +\n `with this id exists. Pass a complete {id, label, invoker} descriptor.`,\n );\n }\n continue;\n }\n\n if (entry.id !== undefined && entry.id !== slotId && !warnedIds.has(`mismatch:${slotId}`)) {\n warnedIds.add(`mismatch:${slotId}`);\n console.warn(\n `weasel actions resolver: actions[\"${slotId}\"].id=\"${entry.id as string}\" mismatches the slot key. ` +\n `Ignoring the id field; the action remains at id=\"${slotId}\".`,\n );\n }\n const { id: _drop, ...rest } = entry;\n void _drop;\n const merged: Action = { ...existing, ...rest };\n // No explicit restore: `register` stacks, so popping `merged` uncovers\n // the descriptor it displaced. Re-registering `existing` here would push\n // a stale snapshot back on top and never take it off again.\n unregisters.push(reg.register(merged));\n }\n\n return () => { for (const u of unregisters) u(); };\n }, [reg, actions, actionsRef, rev]);\n}\n"],"mappings":";;;;AAuBA,SAAgBA,EAAuB,GAAkC,GAAoB;CAC3F,IAAMC,IAAMC,EAAmB,GACzBC,IAAaC,EAAUC,CAAO;CAEpC,QAAgB;EACd,IAAI,CAACJ,GAAK;EACV,IAAMK,IAAOH,EAAW,SAElBI,IAAiC,CAAC;EAExC,IAAID,MAAS,MAAM;GACjB,KAAK,IAAME,KAAMP,EAAI,KAAK,CAAC,CAAC,KAAK,MAAMQ,EAAE,EAAE,GAAG,EAAY,KAAKR,EAAI,KAAKO,CAAE,CAAC;GAC3E,aAAa;IAAE,KAAK,IAAME,KAAKH,GAAa,EAAE;GAAG;EACnD;EAEA,IAAI,CAACD,GAAM;EAEX,IAAMK,oBAAY,IAAI,IAAY;EAElC,KAAK,IAAM,CAACC,GAAQC,MAAU,OAAO,QAAQP,CAAI,GAAG;GAClD,IAAIO,MAAU,MAAM;IAClB,EAAY,KAAKZ,EAAI,KAAKW,CAAM,CAAC;IACjC;GACF;GAEA,IAAME,KAAU,MACd,OAAO,EAAE,MAAO,YAAY,OAAO,EAAE,SAAU,YAAY,CAAC,CAAC,EAAE,SAC3DC,IAAWd,EAAI,KAAK,CAAC,CAAC,MAAM,MAAMQ,EAAE,OAAOG,CAAM;GAEvD,IAAI,CAACG,GAAU;IACb,AAAID,EAAOD,CAAK,IACdN,EAAY,KAAKN,EAAI,SAASY,CAAK,CAAC,IAC1BF,EAAU,IAAIC,CAAM,MAC9BD,EAAU,IAAIC,CAAM,GACpB,QAAQ,KACN,qCAAqCA,EAAO,4GAE9C;IAEF;GACF;GAEA,AAAIC,EAAM,OAAO,KAAA,KAAaA,EAAM,OAAOD,KAAU,CAACD,EAAU,IAAI,YAAYC,GAAQ,MACtFD,EAAU,IAAI,YAAYC,GAAQ,GAClC,QAAQ,KACN,qCAAqCA,EAAO,SAASC,EAAM,GAAa,8EACpBD,EAAO,GAC7D;GAEF,IAAM,EAAE,IAAII,GAAO,GAAGC,MAASJ,GAEzBK,IAAiB;IAAE,GAAGH;IAAU,GAAGE;GAAK;GAI9C,EAAY,KAAKhB,EAAI,SAASiB,CAAM,CAAC;EACvC;EAEA,aAAa;GAAE,KAAK,IAAMR,KAAKH,GAAa,EAAE;EAAG;CACnD,GAAG;EAACN;EAAKI;EAASF;EAAYgB;CAAG,CAAC;AACpC"}
1
+ {"version":3,"file":"useActionsPropResolver.js","names":["useActionsPropResolver","reg","useActionsRegistry","actionsRef","useLatest","actions","prop","unregisters","id","a","u","warnedIds","slotId","entry","isFull","existing","_drop","rest","merged","rev","actionsMuting"],"sources":["../../../src/canvas/SceneCanvas/useActionsPropResolver.ts"],"sourcesContent":["/**\n * Applies the `actions` prop overrides on top of whatever is already\n * registered, so the caller mounts this hook last.\n *\n * actions === null → mute every currently-registered action\n * actions[id] === null → mute that id\n * actions[id] = partial → merge onto the existing descriptor (slot wins\n * over entry.id; warns once on mismatch)\n * actions[id] = full (new) → register alongside defaults\n *\n * `null` mutes rather than unregisters: the opt-out belongs to this canvas, so\n * a sibling sharing the registry keeps the action and this canvas's unmount\n * gives it back.\n */\nimport { useEffect } from 'react';\nimport type { ActionsProp } from '@weasel-js/routing';\nimport { useActionsRegistry } from '@weasel-js/routing/react';\nimport { useLatest } from '@weasel-js/react';\nimport type { Action } from '@weasel-js/routing';\n\n/** `rev` re-applies the overrides when it changes — pass whatever changes when\n * the set they sit on is re-registered. */\nexport function useActionsPropResolver(actions: ActionsProp | undefined, rev?: string): void {\n const reg = useActionsRegistry();\n const actionsRef = useLatest(actions);\n\n useEffect(() => {\n if (!reg) return;\n const prop = actionsRef.current;\n\n const unregisters: Array<() => void> = [];\n\n if (prop === null) {\n for (const id of reg.list().map((a) => a.id)) unregisters.push(reg.mute(id));\n return () => { for (const u of unregisters) u(); };\n }\n\n if (!prop) return;\n\n const warnedIds = new Set<string>();\n\n for (const [slotId, entry] of Object.entries(prop)) {\n if (entry === null) {\n unregisters.push(reg.mute(slotId));\n continue;\n }\n\n const isFull = (e: Partial<Action>): e is Action =>\n typeof e.id === 'string' && typeof e.label === 'string' && !!e.invoker;\n const existing = reg.list().find((a) => a.id === slotId);\n\n if (!existing) {\n if (isFull(entry)) {\n unregisters.push(reg.register(entry));\n } else if (!warnedIds.has(slotId)) {\n warnedIds.add(slotId);\n console.warn(\n `weasel actions resolver: actions[\"${slotId}\"] is a partial Action but no default ` +\n `with this id exists. Pass a complete {id, label, invoker} descriptor.`,\n );\n }\n continue;\n }\n\n if (entry.id !== undefined && entry.id !== slotId && !warnedIds.has(`mismatch:${slotId}`)) {\n warnedIds.add(`mismatch:${slotId}`);\n console.warn(\n `weasel actions resolver: actions[\"${slotId}\"].id=\"${entry.id as string}\" mismatches the slot key. ` +\n `Ignoring the id field; the action remains at id=\"${slotId}\".`,\n );\n }\n const { id: _drop, ...rest } = entry;\n void _drop;\n const merged: Action = { ...existing, ...rest };\n // No explicit restore: `register` stacks, so popping `merged` uncovers\n // the descriptor it displaced. Re-registering `existing` here would push\n // a stale snapshot back on top and never take it off again.\n unregisters.push(reg.register(merged));\n }\n\n return () => { for (const u of unregisters) u(); };\n }, [reg, actions, actionsRef, rev]);\n}\n\n/**\n * `actions` with `id` muted. A caller's own entry for `id` still wins, and\n * `null` (every default muted) is left as it is.\n */\nexport function actionsMuting(actions: ActionsProp | undefined, id: string): ActionsProp {\n if (actions === null) return null;\n const merged = { ...(actions ?? {}) } as Record<string, unknown>;\n if (!(id in merged)) merged[id] = null;\n return merged as ActionsProp;\n}\n"],"mappings":";;;;AAsBA,SAAgBA,EAAuB,GAAkC,GAAoB;CAC3F,IAAMC,IAAMC,EAAmB,GACzBC,IAAaC,EAAUC,CAAO;CAEpC,QAAgB;EACd,IAAI,CAACJ,GAAK;EACV,IAAMK,IAAOH,EAAW,SAElBI,IAAiC,CAAC;EAExC,IAAID,MAAS,MAAM;GACjB,KAAK,IAAME,KAAMP,EAAI,KAAK,CAAC,CAAC,KAAK,MAAMQ,EAAE,EAAE,GAAG,EAAY,KAAKR,EAAI,KAAKO,CAAE,CAAC;GAC3E,aAAa;IAAE,KAAK,IAAME,KAAKH,GAAa,EAAE;GAAG;EACnD;EAEA,IAAI,CAACD,GAAM;EAEX,IAAMK,oBAAY,IAAI,IAAY;EAElC,KAAK,IAAM,CAACC,GAAQC,MAAU,OAAO,QAAQP,CAAI,GAAG;GAClD,IAAIO,MAAU,MAAM;IAClB,EAAY,KAAKZ,EAAI,KAAKW,CAAM,CAAC;IACjC;GACF;GAEA,IAAME,KAAU,MACd,OAAO,EAAE,MAAO,YAAY,OAAO,EAAE,SAAU,YAAY,CAAC,CAAC,EAAE,SAC3DC,IAAWd,EAAI,KAAK,CAAC,CAAC,MAAM,MAAMQ,EAAE,OAAOG,CAAM;GAEvD,IAAI,CAACG,GAAU;IACb,AAAID,EAAOD,CAAK,IACdN,EAAY,KAAKN,EAAI,SAASY,CAAK,CAAC,IAC1BF,EAAU,IAAIC,CAAM,MAC9BD,EAAU,IAAIC,CAAM,GACpB,QAAQ,KACN,qCAAqCA,EAAO,4GAE9C;IAEF;GACF;GAEA,AAAIC,EAAM,OAAO,KAAA,KAAaA,EAAM,OAAOD,KAAU,CAACD,EAAU,IAAI,YAAYC,GAAQ,MACtFD,EAAU,IAAI,YAAYC,GAAQ,GAClC,QAAQ,KACN,qCAAqCA,EAAO,SAASC,EAAM,GAAa,8EACpBD,EAAO,GAC7D;GAEF,IAAM,EAAE,IAAII,GAAO,GAAGC,MAASJ,GAEzBK,IAAiB;IAAE,GAAGH;IAAU,GAAGE;GAAK;GAI9C,EAAY,KAAKhB,EAAI,SAASiB,CAAM,CAAC;EACvC;EAEA,aAAa;GAAE,KAAK,IAAMR,KAAKH,GAAa,EAAE;EAAG;CACnD,GAAG;EAACN;EAAKI;EAASF;EAAYgB;CAAG,CAAC;AACpC;AAMA,SAAgBC,EAAc,GAAkC,GAAyB;CACvF,IAAIf,MAAY,MAAM,OAAO;CAC7B,IAAMa,IAAS,EAAE,GAAIb,KAAW,CAAC,EAAG;CAEpC,OADMG,KAAMU,MAAS,EAAOV,KAAM,OAC3BU;AACT"}
@@ -1 +1 @@
1
- {"version":3,"file":"useBuiltinShapeTools.js","names":["useBuiltinShapeTools","args","snapPoint","options","insert","rect","useRectTool","ellipse","useEllipseTool","line","useLineTool","polygon","usePolygonTool","star","useStarTool","pencil","usePencilTool","usePenTool","useLassoTool","useTextTool"],"sources":["../../../src/canvas/SceneCanvas/useBuiltinShapeTools.tsx"],"sourcesContent":["/**\n * Shape-tool synthesis for `<SceneCanvas>` — calls the kit's per-shape tool\n * hooks; the `insert` dep mints each tool's node. Lets consumers opt into\n * a complete drawing toolset via `<SceneCanvas defaultTools={['rect', 'ellipse']}>`\n * without writing per-tool factory code.\n *\n * All hooks are always called (React rules of hooks) — `<SceneCanvas>` only\n * registers the ones requested via `defaultTools`.\n */\nimport { useEllipseTool } from 'tools/builtin/ellipse/useEllipseTool';\nimport { useLassoTool } from 'tools/builtin/lasso/useLassoTool';\nimport { useLineTool } from 'tools/builtin/line/useLineTool';\nimport { usePencilTool } from 'tools/builtin/pencil/usePencilTool';\nimport { usePenTool } from 'tools/builtin/pen/usePenTool';\nimport { usePolygonTool } from 'tools/builtin/polygon/usePolygonTool';\nimport { useRectTool } from 'tools/builtin/rect/useRectTool';\nimport { useStarTool } from 'tools/builtin/star/useStarTool';\nimport { useTextTool } from 'tools/builtin/text/useTextTool';\nimport type { AnyTool } from 'tools/overlayBinding';\nimport type { InsertToolOptions } from 'tools/builtin/shared/insertToolOptions';\nimport type { LassoHitMode } from 'core/adapters/types';\nimport type { BuiltinShapeToolId } from 'core/shapeKinds';\n\n/** Per-tool option overrides for the built-in shape/lasso tools.\n * Each entry is a narrow subset of the underlying hook's options surface\n * — just the knobs that need consumer control under the bundle pattern. */\nexport interface BuiltinToolOptions {\n lasso?: { mode?: LassoHitMode };\n /** Insert-action options for every drag-to-insert tool (rect / ellipse /\n * line / polygon / star / pencil / text): `behaviors` become each insert\n * binding's `opts.behaviors`, the way `selectTool.move.behaviors` do for\n * move. */\n insert?: InsertToolOptions;\n /** Snap world-space points to the active grid (or any other snap target).\n *\n * Registered as the `snap` dep, which `insertAction` applies to the\n * drag start and current point — so the live preview and the committed\n * geometry agree — and which the pen tool reads for its own anchor\n * placement. Covers every drag-to-insert tool (rect / ellipse / line /\n * polygon / star / text); freehand pencil samples are deliberately left\n * unsnapped. */\n snapPoint?: (p: { x: number; y: number }) => { x: number; y: number };\n}\n\n// `BuiltinShapeToolId` / `KIT_SHAPE_KINDS` derive from the `core/shapeKinds`\n// table, a dependency-free module, so barrel-reachable code can reach them\n// without entering this file's `@weasel-js/core` self-import cycle.\n// Re-exported here so existing importers of this module keep working.\nexport { KIT_SHAPE_KINDS } from 'core/shapeKinds';\nexport type { BuiltinShapeToolId } from 'core/shapeKinds';\n\nexport interface UseBuiltinShapeToolsArgs {\n /** Per-tool option overrides (lasso mode, etc.). */\n options?: BuiltinToolOptions;\n}\n\nexport type BuiltinShapeTools = Record<BuiltinShapeToolId, AnyTool>;\n\n/** Synthesize the full shape-tool registry. Hooks always run; consumers\n * decide via `wants(...)` which to register with `useTools`. */\nexport function useBuiltinShapeTools(args: UseBuiltinShapeToolsArgs = {}): BuiltinShapeTools {\n const { options } = args;\n\n const snapPoint = options?.snapPoint;\n // Every tool here is a declarative shell: the `insert` dep\n // (`useInsertDepSource`) mints the node, so a consumer wanting its own node\n // shape overrides the dep, not the tool.\n const insert = options?.insert ?? {};\n const rect = useRectTool(insert);\n const ellipse = useEllipseTool(insert);\n const line = useLineTool(insert);\n const polygon = usePolygonTool(insert);\n const star = useStarTool(insert);\n const pencil = usePencilTool(insert);\n const pen = usePenTool({ snapPoint });\n const lasso = useLassoTool(options?.lasso ?? {});\n const text = useTextTool(insert);\n return { rect, ellipse, line, polygon, star, pen, pencil, lasso, text };\n}\n"],"mappings":";;;;;;;;;;;AA4DA,SAAgBA,EAAqB,IAAiC,CAAC,GAAsB;CAC3F,IAAM,EAAE,eAAYC,GAEdC,IAAYC,GAAS,WAIrBC,IAASD,GAAS,UAAU,CAAC,GAC7BE,IAAOC,EAAYF,CAAM,GACzBG,IAAUC,EAAeJ,CAAM,GAC/BK,IAAOC,EAAYN,CAAM,GACzBO,IAAUC,EAAeR,CAAM,GAC/BS,IAAOC,EAAYV,CAAM,GACzBW,IAASC,EAAcZ,CAAM;CAInC,OAAO;EAAE;EAAM;EAAS;EAAM;EAAS;EAAM,KAHjCa,EAAW,EAAE,aAAU,CAGU;EAAK;EAAQ,OAF5CC,EAAaf,GAAS,SAAS,CAAC,CAEY;EAAO,MADpDgB,EAAYf,CACwC;CAAK;AACxE"}
1
+ {"version":3,"file":"useBuiltinShapeTools.js","names":["useBuiltinShapeTools","args","snapPoint","options","insert","rect","useRectTool","ellipse","useEllipseTool","line","useLineTool","polygon","usePolygonTool","star","useStarTool","pencil","usePencilTool","usePenTool","useLassoTool","useTextTool"],"sources":["../../../src/canvas/SceneCanvas/useBuiltinShapeTools.tsx"],"sourcesContent":["/**\n * Shape-tool synthesis for `<SceneCanvas>` — calls the kit's per-shape tool\n * hooks; the `insert` dep mints each tool's node. Lets consumers opt into\n * a complete drawing toolset via `<SceneCanvas defaultTools={['rect', 'ellipse']}>`\n * without writing per-tool factory code.\n *\n * All hooks are always called (React rules of hooks) — `resolveToolRegistry`\n * decides which the canvas registers.\n */\nimport { useEllipseTool } from 'tools/builtin/ellipse/useEllipseTool';\nimport { useLassoTool } from 'tools/builtin/lasso/useLassoTool';\nimport { useLineTool } from 'tools/builtin/line/useLineTool';\nimport { usePencilTool } from 'tools/builtin/pencil/usePencilTool';\nimport { usePenTool } from 'tools/builtin/pen/usePenTool';\nimport { usePolygonTool } from 'tools/builtin/polygon/usePolygonTool';\nimport { useRectTool } from 'tools/builtin/rect/useRectTool';\nimport { useStarTool } from 'tools/builtin/star/useStarTool';\nimport { useTextTool } from 'tools/builtin/text/useTextTool';\nimport type { Tool } from 'tools/overlayBinding';\nimport type { InsertToolOptions } from 'tools/builtin/shared/insertToolOptions';\nimport type { LassoHitMode } from 'core/adapters/types';\nimport type { BuiltinShapeToolId } from 'core/shapeKinds';\n\n/** Per-tool option overrides for the built-in shape/lasso tools.\n * Each entry is a narrow subset of the underlying hook's options surface\n * — just the knobs that need consumer control under the bundle pattern. */\nexport interface BuiltinToolOptions {\n lasso?: { mode?: LassoHitMode };\n /** Insert-action options for every drag-to-insert tool (rect / ellipse /\n * line / polygon / star / pencil / text): `behaviors` become each insert\n * binding's `opts.behaviors`, the way `selectTool.move.behaviors` do for\n * move. */\n insert?: InsertToolOptions;\n /** Snap world-space points to the active grid (or any other snap target).\n *\n * Registered as the `snap` dep, which `insertAction` applies to the\n * drag start and current point — so the live preview and the committed\n * geometry agree — and which the pen tool reads for its own anchor\n * placement. Covers every drag-to-insert tool (rect / ellipse / line /\n * polygon / star / text); freehand pencil samples are deliberately left\n * unsnapped. */\n snapPoint?: (p: { x: number; y: number }) => { x: number; y: number };\n}\n\n// `BuiltinShapeToolId` / `KIT_SHAPE_KINDS` derive from the `core/shapeKinds`\n// table, a dependency-free module, so barrel-reachable code can reach them\n// without entering this file's `@weasel-js/core` self-import cycle.\n// Re-exported here so existing importers of this module keep working.\nexport { KIT_SHAPE_KINDS } from 'core/shapeKinds';\nexport type { BuiltinShapeToolId } from 'core/shapeKinds';\n\nexport interface UseBuiltinShapeToolsArgs {\n /** Per-tool option overrides (lasso mode, etc.). */\n options?: BuiltinToolOptions;\n}\n\nexport type BuiltinShapeTools = Record<BuiltinShapeToolId, Tool>;\n\n/** Synthesize the full shape-tool registry. Hooks always run;\n * `useBuiltinTools` registers the ones asked for. */\nexport function useBuiltinShapeTools(args: UseBuiltinShapeToolsArgs = {}): BuiltinShapeTools {\n const { options } = args;\n\n const snapPoint = options?.snapPoint;\n // Every tool here is a declarative shell: the `insert` dep\n // (`useInsertDepSource`) mints the node, so a consumer wanting its own node\n // shape overrides the dep, not the tool.\n const insert = options?.insert ?? {};\n const rect = useRectTool(insert);\n const ellipse = useEllipseTool(insert);\n const line = useLineTool(insert);\n const polygon = usePolygonTool(insert);\n const star = useStarTool(insert);\n const pencil = usePencilTool(insert);\n const pen = usePenTool({ snapPoint });\n const lasso = useLassoTool(options?.lasso ?? {});\n const text = useTextTool(insert);\n return { rect, ellipse, line, polygon, star, pen, pencil, lasso, text };\n}\n"],"mappings":";;;;;;;;;;;AA4DA,SAAgBA,EAAqB,IAAiC,CAAC,GAAsB;CAC3F,IAAM,EAAE,eAAYC,GAEdC,IAAYC,GAAS,WAIrBC,IAASD,GAAS,UAAU,CAAC,GAC7BE,IAAOC,EAAYF,CAAM,GACzBG,IAAUC,EAAeJ,CAAM,GAC/BK,IAAOC,EAAYN,CAAM,GACzBO,IAAUC,EAAeR,CAAM,GAC/BS,IAAOC,EAAYV,CAAM,GACzBW,IAASC,EAAcZ,CAAM;CAInC,OAAO;EAAE;EAAM;EAAS;EAAM;EAAS;EAAM,KAHjCa,EAAW,EAAE,aAAU,CAGU;EAAK;EAAQ,OAF5CC,EAAaf,GAAS,SAAS,CAAC,CAEY;EAAO,MADpDgB,EAAYf,CACwC;CAAK;AACxE"}
@@ -0,0 +1,21 @@
1
+ import { useHandTool as e } from "../../tools/builtin/hand/useHandTool.js";
2
+ import { resolveToolRegistry as t } from "./toolRegistry.js";
3
+ import { useBuiltinShapeTools as n } from "./useBuiltinShapeTools.js";
4
+ //#region src/canvas/SceneCanvas/useBuiltinTools.ts
5
+ function r(r) {
6
+ let { select: i, enabled: a, defaultTools: o, patch: s, toolOptions: c, inertia: l } = r, u = e({ inertia: l }), d = n({ options: c });
7
+ return t({
8
+ builtins: {
9
+ select: i,
10
+ hand: u,
11
+ ...d
12
+ },
13
+ defaultTools: o,
14
+ enabled: a,
15
+ patch: s
16
+ });
17
+ }
18
+ //#endregion
19
+ export { r as useBuiltinTools };
20
+
21
+ //# sourceMappingURL=useBuiltinTools.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useBuiltinTools.js","names":["useBuiltinTools","args","hand","useHandTool","shapes","useBuiltinShapeTools","toolOptions","resolveToolRegistry"],"sources":["../../../src/canvas/SceneCanvas/useBuiltinTools.ts"],"sourcesContent":["import type { InertiaConfig } from 'core/viewport/useDecayLoop';\nimport { useHandTool } from 'tools/builtin/hand';\nimport type { Tool } from 'tools/overlayBinding';\nimport type { BaseFeature } from './features';\nimport type { BuiltinToolId } from './props';\nimport { resolveToolRegistry, type ToolsPatch } from './toolRegistry';\nimport { useBuiltinShapeTools, type BuiltinToolOptions } from './useBuiltinShapeTools';\n\nexport interface UseBuiltinToolsArgs {\n /** The canvas's select tool, which is built from its scene and pickers. */\n select: Tool;\n enabled: ReadonlySet<BaseFeature>;\n defaultTools?: readonly BuiltinToolId[];\n patch: ToolsPatch | null;\n toolOptions?: BuiltinToolOptions;\n /** `viewport.inertia`, which is the hand tool's. */\n inertia?: boolean | InertiaConfig;\n}\n\n/** The registry of tools `<SceneCanvas>` mounts for itself. Every built-in's\n * hook runs on every render; `resolveToolRegistry` decides which are in. */\nexport function useBuiltinTools(args: UseBuiltinToolsArgs): Record<string, Tool> {\n const { select, enabled, defaultTools, patch, toolOptions, inertia } = args;\n const hand = useHandTool({ inertia });\n const shapes = useBuiltinShapeTools({ options: toolOptions });\n return resolveToolRegistry({\n builtins: { select, hand, ...shapes },\n defaultTools,\n enabled,\n patch,\n });\n}\n"],"mappings":";;;;AAqBA,SAAgBA,EAAgB,GAAiD;CAC/E,IAAM,EAAE,WAAQ,YAAS,iBAAc,UAAO,gBAAa,eAAYC,GACjEC,IAAOC,EAAY,EAAE,WAAQ,CAAC,GAC9BC,IAASC,EAAqB,EAAE,SAASC,EAAY,CAAC;CAC5D,OAAOC,EAAoB;EACzB,UAAU;GAAE;GAAQ;GAAM,GAAGH;EAAO;EACpC;EACA;EACA;CACF,CAAC;AACH"}
@@ -0,0 +1,38 @@
1
+ import { useViewAnimationOn as e } from "../../core/viewport/useViewAnimation.js";
2
+ import { useCanvasView as t } from "../useCanvasView.js";
3
+ import { useInsertionEffect as n, useMemo as r, useRef as i } from "react";
4
+ import { useLatest as a } from "@weasel-js/react";
5
+ import { useAnimator as o } from "@weasel-js/animator";
6
+ //#region src/canvas/SceneCanvas/useCanvasCamera.ts
7
+ function s(s) {
8
+ let { view: c, defaultView: l, onViewChange: u, viewBounds: d, width: f, height: p, requestRedraw: m } = s, h = a({
9
+ width: f,
10
+ height: p
11
+ }), g = i(null), _ = t({
12
+ view: c,
13
+ defaultView: l,
14
+ onViewChange: (e) => {
15
+ g.current?.stopIfExternal(), u?.(e);
16
+ },
17
+ viewBounds: d,
18
+ dims: () => h.current,
19
+ requestRedraw: m
20
+ }), v = o(), { viewRef: y, setViewFromInput: b } = _, x = r(() => ({
21
+ get: () => y.current,
22
+ set: b
23
+ }), [y, b]), S = e(x, v);
24
+ return n(() => {
25
+ g.current = S;
26
+ }), {
27
+ viewState: _,
28
+ viewAnimation: S,
29
+ camera: r(() => ({
30
+ target: S.viewTarget,
31
+ animator: v
32
+ }), [S, v])
33
+ };
34
+ }
35
+ //#endregion
36
+ export { s as useCanvasCamera };
37
+
38
+ //# sourceMappingURL=useCanvasCamera.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useCanvasCamera.js","names":["useCanvasCamera","opts","size","useLatest","animationRef","useRef","viewState","useCanvasView","onViewChange","next","animator","useAnimator","channel","useMemo","viewRef","setViewFromInput","viewAnimation","useViewAnimationOn","useInsertionEffect"],"sources":["../../../src/canvas/SceneCanvas/useCanvasCamera.ts"],"sourcesContent":["import { useInsertionEffect, useMemo, useRef } from 'react';\nimport { useAnimator } from '@weasel-js/animator';\nimport { useLatest } from '@weasel-js/react';\nimport { useViewAnimationOn, type ViewAnimationApi } from 'core/viewport/useViewAnimation';\nimport type { SceneCanvasApi } from '../canvasExtension';\nimport { useCanvasView, type CameraProps, type CanvasViewState } from '../useCanvasView';\n\n/**\n * The canvas's camera: the view `<Canvas>` looks through, the runner behind\n * `animateView`, and the target and animator it runs on.\n */\nexport function useCanvasCamera(opts: CameraProps & {\n /** The size the camera looks through, which `viewBounds` clamps against. */\n width: number;\n height: number;\n requestRedraw: () => void;\n}): {\n viewState: CanvasViewState;\n viewAnimation: ViewAnimationApi;\n camera: SceneCanvasApi['camera'];\n} {\n const { view, defaultView, onViewChange, viewBounds, width, height, requestRedraw } = opts;\n const size = useLatest({ width, height });\n const animationRef = useRef<ViewAnimationApi | null>(null);\n const viewState = useCanvasView({\n view,\n defaultView,\n // Every write to the view is reported here, so it is the runner's one\n // interrupt feed.\n onViewChange: (next) => {\n animationRef.current?.stopIfExternal();\n onViewChange?.(next);\n },\n viewBounds,\n dims: () => size.current,\n requestRedraw,\n });\n\n // The camera runs on its own animator, never the `animator` prop's: that prop\n // is the consumer's scene animator, and their `cancelAll()` or `pause()` must\n // not strand a zoom half-finished or freeze the camera.\n const animator = useAnimator();\n const { viewRef, setViewFromInput } = viewState;\n const channel = useMemo(\n () => ({ get: () => viewRef.current, set: setViewFromInput }),\n [viewRef, setViewFromInput],\n );\n const viewAnimation = useViewAnimationOn(channel, animator);\n useInsertionEffect(() => { animationRef.current = viewAnimation; });\n const camera = useMemo(() => ({ target: viewAnimation.viewTarget, animator }), [viewAnimation, animator]);\n return { viewState, viewAnimation, camera };\n}\n"],"mappings":";;;;;;AAWA,SAAgBA,EAAgB,GAS9B;CACA,IAAM,EAAE,SAAM,gBAAa,iBAAc,eAAY,UAAO,WAAQ,qBAAkBC,GAChFC,IAAOC,EAAU;EAAE;EAAO;CAAO,CAAC,GAClCC,IAAeC,EAAgC,IAAI,GACnDC,IAAYC,EAAc;EAC9B;EACA;EAGA,eAAe,MAAS;GAEtB,AADAH,EAAa,SAAS,eAAe,GACrCI,IAAeC,CAAI;EACrB;EACA;EACA,YAAYP,EAAK;EACjB;CACF,CAAC,GAKKQ,IAAWC,EAAY,GACvB,EAAE,YAAS,wBAAqBL,GAChCM,IAAUC,SACP;EAAE,WAAWC,EAAQ;EAAS,KAAKC;CAAiB,IAC3D,CAACD,GAASC,CAAgB,CAC5B,GACMC,IAAgBC,EAAmBL,GAASF,CAAQ;CAG1D,OAFAQ,QAAyB;EAAE,EAAa,UAAUF;CAAe,CAAC,GAE3D;EAAE;EAAW;EAAe,QADpBH,SAAe;GAAE,QAAQG,EAAc;GAAY;EAAS,IAAI,CAACA,GAAeN,CAAQ,CACpE;CAAO;AAC5C"}
@@ -0,0 +1,20 @@
1
+ import { createDispatcherPreviewSources as e, createGestureSource as t } from "./dispatcherGestureBounds.js";
2
+ import { useRef as n, useState as r } from "react";
3
+ import { createDispatcher as i } from "@weasel-js/routing";
4
+ //#region src/canvas/SceneCanvas/useCanvasDispatcher.ts
5
+ function a() {
6
+ let a = n(null), o = n(null);
7
+ o.current ||= i({ getAction: (e) => a.current?.(e) });
8
+ let s = o.current, [c] = r(() => t(() => o.current)), [{ previewIdsExtra: l, previewPoseExtra: u }] = r(() => e(() => o.current));
9
+ return {
10
+ dispatcher: s,
11
+ getActionRef: a,
12
+ gestureSource: c,
13
+ previewIdsExtra: l,
14
+ previewPoseExtra: u
15
+ };
16
+ }
17
+ //#endregion
18
+ export { a as useCanvasDispatcher };
19
+
20
+ //# sourceMappingURL=useCanvasDispatcher.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useCanvasDispatcher.js","names":["useCanvasDispatcher","getActionRef","useRef","dispatcherRef","createDispatcher","id","dispatcher","gestureSource","useState","createGestureSource","createDispatcherPreviewSources"],"sources":["../../../src/canvas/SceneCanvas/useCanvasDispatcher.ts"],"sourcesContent":["import { useRef, useState, type MutableRefObject } from 'react';\nimport { createDispatcher, type Action, type Dispatcher } from '@weasel-js/routing';\nimport type { GestureSource } from '../gestureBounds';\nimport { createDispatcherPreviewSources, createGestureSource } from './dispatcherGestureBounds';\n\n/**\n * One `Dispatcher` for the life of a `<SceneCanvas>`, shared by the gesture\n * mounter that pumps input into it and the layers that walk its in-flight\n * handles, with the lookups those layers and `<Canvas>` read it through.\n */\nexport function useCanvasDispatcher(): {\n dispatcher: Dispatcher;\n /** How the dispatcher resolves an action id at call time. Populated by\n * `StandardActionsRegistrar` once it has the registry in scope. */\n getActionRef: MutableRefObject<((id: string) => Action | undefined) | null>;\n /** In-flight preview ids, nascent-insert bounds, and the pump signal. */\n gestureSource: GestureSource;\n /** Ids whose committed paint an in-flight ghost hides. */\n previewIdsExtra: () => string[];\n /** The pose an in-flight handle proposes for an id. */\n previewPoseExtra: (id: string) => unknown;\n} {\n const getActionRef = useRef<((id: string) => Action | undefined) | null>(null);\n const dispatcherRef = useRef<Dispatcher | null>(null);\n if (!dispatcherRef.current) {\n dispatcherRef.current = createDispatcher({\n getAction: (id) => getActionRef.current?.(id),\n });\n }\n const dispatcher = dispatcherRef.current;\n const [gestureSource] = useState(() => createGestureSource(() => dispatcherRef.current));\n const [{ previewIdsExtra, previewPoseExtra }] = useState(\n () => createDispatcherPreviewSources(() => dispatcherRef.current),\n );\n return { dispatcher, getActionRef, gestureSource, previewIdsExtra, previewPoseExtra };\n}\n"],"mappings":";;;;AAUA,SAAgBA,IAWd;CACA,IAAMC,IAAeC,EAAoD,IAAI,GACvEC,IAAgBD,EAA0B,IAAI;CACpD,AACEC,EAAc,YAAUC,EAAiB,EACvC,YAAY,MAAOH,EAAa,UAAUI,CAAE,EAC9C,CAAC;CAEH,IAAMC,IAAaH,EAAc,SAC3B,CAACI,KAAiBC,QAAeC,QAA0BN,EAAc,OAAO,CAAC,GACjF,CAAC,EAAE,oBAAiB,yBAAsBK,QACxCE,QAAqCP,EAAc,OAAO,CAClE;CACA,OAAO;EAAE;EAAY;EAAc;EAAe;EAAiB;CAAiB;AACtF"}
@@ -0,0 +1,16 @@
1
+ import { useSelection as e } from "../../core/selection/useSelection.js";
2
+ import { readOnlySelection as t } from "../../core/selection/readOnlySelection.js";
3
+ import { usePublishSceneSelection as n } from "../../core/selection/usePublishSceneSelection.js";
4
+ import { useMemo as r } from "react";
5
+ //#region src/canvas/SceneCanvas/useCanvasSelection.ts
6
+ function i(i) {
7
+ let { scene: a, supplied: o, options: s, selectable: c, describeKind: l } = i, u = r(() => ({
8
+ scene: a,
9
+ ...s ?? {}
10
+ }), [a, s]), d = e(u), f = o ?? d, p = c ? f : t(f);
11
+ return n(a, p.current, l), p;
12
+ }
13
+ //#endregion
14
+ export { i as useCanvasSelection };
15
+
16
+ //# sourceMappingURL=useCanvasSelection.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useCanvasSelection.js","names":["useCanvasSelection","args","derivedOptions","useMemo","options","scene","internal","useSelection","base","supplied","selection","selectable","readOnlySelection","usePublishSceneSelection","describeKind"],"sources":["../../../src/canvas/SceneCanvas/useCanvasSelection.ts"],"sourcesContent":["import { useMemo } from 'react';\nimport type { Node, NodeId, Scene } from 'core/scene/types';\nimport { readOnlySelection } from 'core/selection/readOnlySelection';\nimport { usePublishSceneSelection } from 'core/selection/usePublishSceneSelection';\nimport { useSelection, type SelectionApi, type UseSelectionOptions } from 'core/selection/useSelection';\n\n/**\n * The canvas's selection, published to any surrounding selection context.\n *\n * A caller-supplied api wins, and the one built here is then unused. The\n * built one is bound to the scene, so the selection an edit was made under\n * rides on the scene's history entries and undo can put it back.\n *\n * Everything the kit writes selection through (the `selection` dep, the\n * adapter's `setSelection`, ops committed through either) reads the returned\n * api, so on an unselectable canvas every write path here is closed. The\n * caller's own api is not wrapped and still writes.\n */\nexport function useCanvasSelection<TData, TLayer extends string, TPose>(args: {\n scene: Scene<TData, TLayer, TPose>;\n /** `<SceneCanvas selection>`. */\n supplied: SelectionApi | undefined;\n options: UseSelectionOptions | undefined;\n selectable: boolean;\n describeKind: ((node: Node<TData, TLayer, TPose>) => string | undefined) | undefined;\n}): SelectionApi {\n const { scene, supplied, options, selectable, describeKind } = args;\n const derivedOptions = useMemo<UseSelectionOptions>(\n () => ({ scene, ...(options ?? {}) }),\n [scene, options],\n );\n const internal = useSelection(derivedOptions);\n const base = supplied ?? internal;\n const selection = selectable ? base : readOnlySelection(base);\n usePublishSceneSelection(scene, selection.current as readonly NodeId[], describeKind);\n return selection;\n}\n"],"mappings":";;;;;AAkBA,SAAgBA,EAAwD,GAOvD;CACf,IAAM,EAAE,UAAO,aAAU,YAAS,eAAY,oBAAiBC,GACzDC,IAAiBC,SACd;EAAE;EAAO,GAAIC,KAAW,CAAC;CAAG,IACnC,CAACC,GAAOD,CAAO,CACjB,GACME,IAAWC,EAAaL,CAAc,GACtCM,IAAOC,KAAYH,GACnBI,IAAYC,IAAaH,IAAOI,EAAkBJ,CAAI;CAE5D,OADAK,EAAyBR,GAAOK,EAAU,SAA8BI,CAAY,GAC7EJ;AACT"}
@@ -0,0 +1,67 @@
1
+ import { createLongPressFeedbackContribution as e } from "../../features/longPress/longPressFeedback.js";
2
+ import { KIT_STANDARD_ACTION_IDS as t } from "../../interactions/actions/useStandardActions.js";
3
+ import { useTools as n } from "../../tools/overlayBinding.js";
4
+ import { featureActionIds as r, featureAmbient as i, resolveFeatures as a } from "./features.js";
5
+ import { useBuiltinTools as o } from "./useBuiltinTools.js";
6
+ import { useEffect as s, useMemo as c } from "react";
7
+ import { useLatest as l } from "@weasel-js/react";
8
+ //#region src/canvas/SceneCanvas/useCanvasTools.ts
9
+ function u(e) {
10
+ return typeof e.setActive == "function";
11
+ }
12
+ function d(e, t) {
13
+ let n = (e ?? []).join("|");
14
+ return c(() => a(e, { viewport: t }), [n, t]);
15
+ }
16
+ function f(t) {
17
+ let { select: r, enabled: i, tools: a, defaultTools: d, toolOptions: f, inertia: p, ambient: m, initialActiveTool: h, modes: g, onToolsCreated: _ } = t, v = a && u(a) ? a : null, y = o({
18
+ select: r,
19
+ enabled: i,
20
+ defaultTools: d,
21
+ patch: a && !u(a) ? a : null,
22
+ toolOptions: f,
23
+ inertia: p
24
+ }), b = c(() => e(), []), x = t.pressFeedback ?? !0, S = x === !0 ? b : x || null, C = c(() => S ? [...m ?? [], S] : m ?? [], [m, S]), w = n({
25
+ active: h ?? ("select" in y ? "select" : null),
26
+ registry: y,
27
+ ...C.length ? { ambient: C } : {},
28
+ ...g ? { modes: g } : {}
29
+ }), T = v ?? w, E = l(_);
30
+ return s(() => {
31
+ E.current?.(T);
32
+ }, [T, E]), {
33
+ tools: T,
34
+ internal: w,
35
+ takeover: v
36
+ };
37
+ }
38
+ function p(e) {
39
+ let { enabled: n, tools: a, move: o, rotate: s } = e, l = c(() => i(n, {
40
+ move: o,
41
+ rotate: s
42
+ }), [
43
+ n,
44
+ o,
45
+ s
46
+ ]);
47
+ return {
48
+ contributions: l,
49
+ standardActionsExclude: c(() => {
50
+ let e = r(n), i = [
51
+ ...Object.values(a.registry),
52
+ ...a.ambient,
53
+ ...l
54
+ ];
55
+ for (let t of i) for (let n of t.bindings ?? []) e.add(n.actionId);
56
+ return t.filter((t) => !e.has(t));
57
+ }, [
58
+ n,
59
+ a,
60
+ l
61
+ ])
62
+ };
63
+ }
64
+ //#endregion
65
+ export { f as useCanvasTools, d as useEnabledFeatures, p as useFeatureBindings };
66
+
67
+ //# sourceMappingURL=useCanvasTools.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useCanvasTools.js","names":["isToolsApi","tools","useEnabledFeatures","featuresKey","features","useMemo","resolveFeatures","hasViewport","useCanvasTools","toolsProp","args","takeover","registry","useBuiltinTools","defaultPressFeedback","createLongPressFeedbackContribution","feedbackOpt","pressFeedback","mergedAmbient","ambient","internal","useTools","initialActiveTool","modes","onToolsCreatedRef","useLatest","onToolsCreated","useEffect","useFeatureBindings","contributions","featureAmbient","enabled","move","rotate","include","featureActionIds","bound","entry","b","KIT_STANDARD_ACTION_IDS","id"],"sources":["../../../src/canvas/SceneCanvas/useCanvasTools.ts"],"sourcesContent":["import { useEffect, useMemo } from 'react';\nimport { useLatest } from '@weasel-js/react';\nimport { KIT_STANDARD_ACTION_IDS } from 'interactions/actions/useStandardActions';\nimport { createLongPressFeedbackContribution } from '../../features/longPress/longPressFeedback';\nimport { useTools, type Contribution, type Tool, type ToolsApi } from '../../tools/overlayBinding';\nimport {\n featureActionIds,\n featureAmbient,\n resolveFeatures,\n type BaseFeature,\n type Feature,\n type FeatureBindingOptions,\n} from './features';\nimport type { SceneCanvasProps } from './props';\nimport type { ToolsPatch } from './toolRegistry';\nimport { useBuiltinTools } from './useBuiltinTools';\n\ntype Props = SceneCanvasProps<unknown, string, unknown>;\n\n/** Discriminate the polymorphic `tools` prop: `ToolsApi` has `setActive`\n * / `active` / `registry`; the patch record shape has none of those. */\nfunction isToolsApi(tools: ToolsApi | ToolsPatch): tools is ToolsApi {\n return typeof (tools as ToolsApi).setActive === 'function';\n}\n\n/** The presets a canvas runs with. Keyed on the ids, not the array, so an\n * inline `features={['draw']}` does not re-derive every render. */\nexport function useEnabledFeatures(\n features: readonly Feature[] | undefined,\n hasViewport: boolean,\n): ReadonlySet<BaseFeature> {\n const featuresKey = (features ?? []).join('|');\n return useMemo(\n () => resolveFeatures(features, { viewport: hasViewport }),\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [featuresKey, hasViewport],\n );\n}\n\n/**\n * The canvas's tools: a caller's own `ToolsApi` when the `tools` prop is one\n * (the takeover form), and otherwise the built-ins the presets and\n * `defaultTools` name, patched by a `tools` record.\n */\nexport function useCanvasTools(args: {\n /** The canvas's select tool, which is built from its scene and pickers. */\n select: Tool;\n enabled: ReadonlySet<BaseFeature>;\n tools: Props['tools'];\n defaultTools: Props['defaultTools'];\n toolOptions: Props['toolOptions'];\n /** `viewport.inertia`, which is the hand tool's. */\n inertia: NonNullable<Props['viewport']>['inertia'];\n ambient: Props['ambient'];\n /** `longPress.feedback`. Default true, which installs the kit's own. */\n pressFeedback: NonNullable<Props['longPress']>['feedback'];\n initialActiveTool: Props['initialActiveTool'];\n modes: Props['modes'];\n onToolsCreated: Props['onToolsCreated'];\n}): {\n /** What the canvas routes input through: the takeover, or `internal`. */\n tools: ToolsApi;\n /** The canvas's own api, built whether or not a takeover replaces it. */\n internal: ToolsApi;\n takeover: ToolsApi | null;\n} {\n const { select, enabled, tools: toolsProp, defaultTools, toolOptions, inertia, ambient, initialActiveTool, modes, onToolsCreated } = args;\n\n const takeover = toolsProp && isToolsApi(toolsProp) ? toolsProp : null;\n const registry = useBuiltinTools({\n select,\n enabled,\n defaultTools,\n patch: toolsProp && !isToolsApi(toolsProp) ? toolsProp : null,\n toolOptions,\n inertia,\n });\n\n const defaultPressFeedback = useMemo(() => createLongPressFeedbackContribution(), []);\n const feedbackOpt = args.pressFeedback ?? true;\n const pressFeedback = feedbackOpt === true ? defaultPressFeedback : feedbackOpt || null;\n const mergedAmbient = useMemo(\n () => (pressFeedback ? [...(ambient ?? []), pressFeedback] : (ambient ?? [])),\n [ambient, pressFeedback],\n );\n\n const internal = useTools({\n active: initialActiveTool ?? ('select' in registry ? 'select' : null),\n registry,\n ...(mergedAmbient.length ? { ambient: mergedAmbient } : {}),\n ...(modes ? { modes } : {}),\n });\n const tools = takeover ?? internal;\n\n const onToolsCreatedRef = useLatest(onToolsCreated);\n useEffect(() => { onToolsCreatedRef.current?.(tools); }, [tools, onToolsCreatedRef]);\n\n return { tools, internal, takeover };\n}\n\n/**\n * The presets' ambient bindings, and the kit-standard actions the canvas\n * leaves unregistered. The bindings are not tools and sit outside `tools`, so\n * they apply under a takeover too. An action is registered when a preset\n * names it or a tool or contribution on this canvas binds it: a tool brings\n * the actions it routes to, so `defaultTools={['rect']}` works under any preset.\n */\nexport function useFeatureBindings(args: {\n enabled: ReadonlySet<BaseFeature>;\n tools: Pick<ToolsApi, 'registry' | 'ambient'>;\n move: FeatureBindingOptions['move'];\n rotate: FeatureBindingOptions['rotate'];\n}): { contributions: Contribution[]; standardActionsExclude: string[] } {\n const { enabled, tools, move, rotate } = args;\n const contributions = useMemo<Contribution[]>(\n () => featureAmbient(enabled, { move, rotate }),\n [enabled, move, rotate],\n );\n const standardActionsExclude = useMemo(() => {\n const include = featureActionIds(enabled);\n const bound = [...Object.values(tools.registry), ...tools.ambient, ...contributions];\n for (const entry of bound) {\n for (const b of entry.bindings ?? []) include.add(b.actionId);\n }\n return KIT_STANDARD_ACTION_IDS.filter((id) => !include.has(id));\n }, [enabled, tools, contributions]);\n return { contributions, standardActionsExclude };\n}\n"],"mappings":";;;;;;;;AAqBA,SAASA,EAAW,GAAiD;CACnE,OAAO,OAAQC,EAAmB,aAAc;AAClD;AAIA,SAAgBC,EACd,GACA,GAC0B;CAC1B,IAAMC,KAAeC,KAAY,CAAC,EAAA,CAAG,KAAK,GAAG;CAC7C,OAAOC,QACCC,EAAgBF,GAAU,EAAE,UAAUG,EAAY,CAAC,GAEzD,CAACJ,GAAaI,CAAW,CAC3B;AACF;AAOA,SAAgBC,EAAe,GAqB7B;CACA,IAAM,EAAE,WAAQ,YAAS,OAAOC,GAAW,iBAAc,gBAAa,YAAS,YAAS,sBAAmB,UAAO,sBAAmBC,GAE/HC,IAAWF,KAAaT,EAAWS,CAAS,IAAIA,IAAY,MAC5DG,IAAWC,EAAgB;EAC/B;EACA;EACA;EACA,OAAOJ,KAAa,CAACT,EAAWS,CAAS,IAAIA,IAAY;EACzD;EACA;CACF,CAAC,GAEKK,IAAuBT,QAAcU,EAAoC,GAAG,CAAC,CAAC,GAC9EC,IAAcN,EAAK,iBAAiB,IACpCO,IAAgBD,MAAgB,KAAOF,IAAuBE,KAAe,MAC7EE,IAAgBb,QACbY,IAAgB,CAAC,GAAIE,KAAW,CAAC,GAAIF,CAAa,IAAKE,KAAW,CAAC,GAC1E,CAACA,GAASF,CAAa,CACzB,GAEMG,IAAWC,EAAS;EACxB,QAAQC,MAAsB,YAAYV,IAAW,WAAW;EAChE;EACA,GAAIM,EAAc,SAAS,EAAE,SAASA,EAAc,IAAI,CAAC;EACzD,GAAIK,IAAQ,EAAE,SAAM,IAAI,CAAC;CAC3B,CAAC,GACKtB,IAAQU,KAAYS,GAEpBI,IAAoBC,EAAUC,CAAc;CAGlD,OAFAC,QAAgB;EAAE,EAAkB,UAAU1B,CAAK;CAAG,GAAG,CAACA,GAAOuB,CAAiB,CAAC,GAE5E;EAAE;EAAO;EAAU;CAAS;AACrC;AASA,SAAgBI,EAAmB,GAKqC;CACtE,IAAM,EAAE,YAAS,UAAO,SAAM,cAAWlB,GACnCmB,IAAgBxB,QACdyB,EAAeC,GAAS;EAAE;EAAM;CAAO,CAAC,GAC9C;EAACA;EAASC;EAAMC;CAAM,CACxB;CASA,OAAO;EAAE;EAAe,wBARO5B,QAAc;GAC3C,IAAM6B,IAAUC,EAAiBJ,CAAO,GAClCK,IAAQ;IAAC,GAAG,OAAO,OAAOnC,EAAM,QAAQ;IAAG,GAAGA,EAAM;IAAS,GAAG4B;GAAa;GACnF,KAAK,IAAMQ,KAASD,GAClB,KAAK,IAAME,KAAKD,EAAM,YAAY,CAAC,GAAG,EAAQ,IAAIC,EAAE,QAAQ;GAE9D,OAAOC,EAAwB,QAAQ,MAAO,CAACL,EAAQ,IAAIM,CAAE,CAAC;EAChE,GAAG;GAACT;GAAS9B;GAAO4B;EAAa,CACT;CAAuB;AACjD"}
@@ -1,9 +1,9 @@
1
1
  import { viewToTransform as e } from "../../core/viewport/view.js";
2
2
  import { worldToScreen as t } from "../../core/viewport/viewTransform.js";
3
- import { getImageBitmap as n } from "../../features/images/imageCache.js";
4
- import { OVERLAY_ROLE_STROKES as r } from "../overlayRoleStrokes.js";
5
- import { gestureOverlaysFrom as i, isVisibleFrom as a } from "../drawEnvelope.js";
6
- import { resolveOverlays as o } from "../../interactions/actions/resolveOverlays.js";
3
+ import { OVERLAY_ROLE_STROKES as n } from "../overlayRoleStrokes.js";
4
+ import { gestureOverlaysFrom as r, isVisibleFrom as i } from "../drawEnvelope.js";
5
+ import { resolveOverlays as a } from "../../interactions/actions/resolveOverlays.js";
6
+ import { getImageBitmap as o } from "@weasel-js/renderer";
7
7
  import { ellipsePath as s, linePath as c, polygonFromPoints as l, polylineFromPoints as u, rectPath as d, regularPolygonPath as f, starPath as p } from "@weasel-js/geom";
8
8
  import { useEffect as m, useMemo as h, useReducer as g } from "react";
9
9
  import { useLatest as _ } from "@weasel-js/react";
@@ -27,10 +27,10 @@ function b(b) {
27
27
  ...v,
28
28
  ...C.current ?? {}
29
29
  }, _ = {
30
- ...r,
30
+ ...n,
31
31
  ...C.current?.roles ?? {}
32
- }, b = e(h), x = [], S = a(m), w = (e) => !S || S(e);
33
- for (let e of o(i(m))) if (w(e.visibilityId)) {
32
+ }, b = e(h), x = [], S = i(m), w = (e) => !S || S(e);
33
+ for (let e of a(r(m))) if (w(e.visibilityId)) {
34
34
  if (e.kind === "marquee") {
35
35
  let n = e.bounds, [r, i] = t(n.x, n.y, b), a = {
36
36
  kind: "path",
@@ -41,7 +41,7 @@ function b(b) {
41
41
  width: n.width * h.scale.x,
42
42
  height: n.height * h.scale.y
43
43
  },
44
- fill: { color: g.fill },
44
+ fill: { paint: { color: g.fill } },
45
45
  stroke: {
46
46
  paint: { color: g.stroke },
47
47
  width: g.lineWidth,
@@ -52,52 +52,52 @@ function b(b) {
52
52
  continue;
53
53
  }
54
54
  if (e.kind === "insertPreview") {
55
- let r = e.bounds, i = (e, n) => {
55
+ let n = e.bounds, r = (e, n) => {
56
56
  let [r, i] = t(e, n, b);
57
57
  return {
58
58
  x: r,
59
59
  y: i
60
60
  };
61
- }, a = (e) => e.map((e) => i(e.x, e.y)), o = (h.scale.x + h.scale.y) / 2, l = null, m = e.geometry;
61
+ }, i = (e) => e.map((e) => r(e.x, e.y)), a = (h.scale.x + h.scale.y) / 2, l = null, m = e.geometry;
62
62
  switch (m.kind) {
63
63
  case "box": {
64
- let [i, a] = t(r.x, r.y, b), o = r.width * h.scale.x, c = r.height * h.scale.y;
64
+ let [r, i] = t(n.x, n.y, b), a = n.width * h.scale.x, c = n.height * h.scale.y;
65
65
  if (e.shape === "image") {
66
- let t = e.extras, r = t.preview === "outline" || !t.src ? void 0 : n(t.src);
67
- r && x.push({
66
+ let t = e.extras, n = t.preview === "outline" || !t.src ? void 0 : o(t.src);
67
+ n && x.push({
68
68
  kind: "image",
69
- image: r,
70
- x: i,
71
- y: a,
72
- w: o,
69
+ image: n,
70
+ x: r,
71
+ y: i,
72
+ w: a,
73
73
  h: c,
74
74
  opacity: y
75
75
  });
76
76
  }
77
77
  l = e.shape === "ellipse" ? s({
78
- x: i,
79
- y: a,
80
- width: o,
78
+ x: r,
79
+ y: i,
80
+ width: a,
81
81
  height: c
82
- }) : d(i, a, o, c);
82
+ }) : d(r, i, a, c);
83
83
  break;
84
84
  }
85
85
  case "line":
86
- l = c(i(m.a.x, m.a.y), i(m.b.x, m.b.y));
86
+ l = c(r(m.a.x, m.a.y), r(m.b.x, m.b.y));
87
87
  break;
88
88
  case "polygon":
89
- l = f(i(m.center.x, m.center.y), m.radius * o, m.sides, m.rotation);
89
+ l = f(r(m.center.x, m.center.y), m.radius * a, m.sides, m.rotation);
90
90
  break;
91
91
  case "star":
92
- l = p(i(m.center.x, m.center.y), m.outerRadius * o, m.points, m.innerRadius * o, m.rotation);
92
+ l = p(r(m.center.x, m.center.y), m.outerRadius * a, m.points, m.innerRadius * a, m.rotation);
93
93
  break;
94
- case "pencil": l = u(a(m.samples));
94
+ case "pencil": l = u(i(m.samples));
95
95
  }
96
96
  if (!l) continue;
97
97
  let _ = {
98
98
  kind: "path",
99
99
  path: l,
100
- fill: e.shape === "line" || e.shape === "pencil" || e.shape === "image" ? void 0 : { color: g.fill },
100
+ fill: e.shape === "line" || e.shape === "pencil" || e.shape === "image" ? void 0 : { paint: { color: g.fill } },
101
101
  stroke: {
102
102
  paint: { color: g.stroke },
103
103
  width: g.lineWidth,
@@ -105,7 +105,7 @@ function b(b) {
105
105
  }
106
106
  };
107
107
  if (x.push(_), e.anchorPoint) {
108
- let t = i(e.anchorPoint.x, e.anchorPoint.y);
108
+ let t = r(e.anchorPoint.x, e.anchorPoint.y);
109
109
  x.push({
110
110
  kind: "path",
111
111
  path: s({
@@ -114,7 +114,7 @@ function b(b) {
114
114
  width: 8,
115
115
  height: 8
116
116
  }),
117
- fill: { color: g.stroke }
117
+ fill: { paint: { color: g.stroke } }
118
118
  });
119
119
  }
120
120
  continue;
@@ -131,7 +131,7 @@ function b(b) {
131
131
  let r = {
132
132
  kind: "path",
133
133
  path: l(n),
134
- fill: { color: g.fill },
134
+ fill: { paint: { color: g.fill } },
135
135
  stroke: {
136
136
  paint: { color: g.stroke },
137
137
  width: g.lineWidth,
@@ -1 +1 @@
1
- {"version":3,"file":"useDispatcherOverlayLayer.js","names":["DEFAULT_STYLE","PREVIEW_CONTENT_OPACITY","useDispatcherOverlayLayer","args","styleRef","useLatest","style","forceRerender","useReducer","n","useEffect","dispatcher","useMemo","cfg","roles","OVERLAY_ROLE_STROKES","t","viewToTransform","view","out","isVisible","isVisibleFrom","data","passes","id","ov","resolveOverlays","gestureOverlaysFrom","b","sx","sy","worldToScreen","cmd","projectPoint","wx","wy","projectPoints","pts","p","radialScale","pathCmd","geom","sw","sh","e","bmp","getImageBitmap","ellipsePath","rectPath","linePath","regularPolygonPath","starPath","polylineFromPoints","anchorScreen","screenPts","v","polygonFromPoints","stroke","pt"],"sources":["../../../src/canvas/SceneCanvas/useDispatcherOverlayLayer.ts"],"sourcesContent":["/**\n * Dispatcher overlay render layer for `<SceneCanvas>`.\n *\n * Paints the overlay shapes the drawing view's in-flight handles publish,\n * taken off the draw envelope so a panel shows its own gesture rather than\n * the surface's. `resolveOverlays` does the reading — normalizing the drag,\n * sizing the nascent shape, dropping what is degenerate — and everything left\n * here is painting: projection into screen coordinates, the chrome-caps gate,\n * fill/stroke policy, the stroke each overlay role reads as, the anchor dot's\n * size, and the image bitmap.\n *\n * Distinct from `usePreviewGhostLayer`, which paints displaced scene-node\n * silhouettes via `previewIds()` / `previewPose(id)`. The dispatcher\n * overlay layer is for gestures whose visual feedback isn't a moved scene\n * node — marquee rect (area-select), polyline + dashed close-line (lasso),\n * and any future overlay-only chrome an action wants to render.\n *\n * Replaces the per-tool `select-overlay` rendering for the same gestures\n * once the dispatcher path is the sole driver. Until\n * then both run side-by-side; the visuals overlap exactly so the\n * user-visible result is identical.\n */\nimport { useEffect, useMemo, useReducer } from 'react';\nimport { useLatest } from '@weasel-js/react';\nimport type { DrawCommand, PathDrawCommand } from '../../renderer';\nimport type { CommandStroke } from '@weasel-js/paint';\nimport type { RenderLayer } from 'core/layers/render';\nimport { viewToTransform } from 'core/viewport/view';\nimport { worldToScreen } from 'core/viewport/viewTransform';\nimport type { Dispatcher } from '@weasel-js/routing';\nimport {\n polygonFromPoints,\n polylineFromPoints,\n rectPath,\n ellipsePath,\n linePath,\n regularPolygonPath,\n starPath,\n} from '@weasel-js/geom';\nimport { getImageBitmap } from 'features/images/imageCache';\nimport { resolveOverlays } from 'interactions/actions/resolveOverlays';\nimport { gestureOverlaysFrom, isVisibleFrom } from '../drawEnvelope';\nimport { OVERLAY_ROLE_STROKES } from '../overlayRoleStrokes';\n\n/** Style knobs for the dispatcher-overlay layer's marquee + lasso paints.\n * Defaults match the legacy `useSelectTool` `areaSelectOverlayStyle`\n * defaults so the visual swap is invisible to users. */\nexport interface DispatcherOverlayStyle {\n fill?: string;\n stroke?: string;\n dash?: number[];\n lineWidth?: number;\n /** Stroke per `polyline` overlay role, merged over the kit's. A role with\n * no entry here and none of the kit's paints as plain chrome — the\n * `stroke` / `lineWidth` / `dash` above. */\n roles?: Readonly<Record<string, CommandStroke>>;\n}\n\nconst DEFAULT_STYLE: Required<Omit<DispatcherOverlayStyle, 'roles'>> = {\n fill: 'rgba(164, 139, 212, 0.18)',\n stroke: '#a48bd4',\n dash: [3, 3],\n lineWidth: 1,\n};\n\n/** Alpha for content previewed inside an in-flight gesture. Matches the\n * preview-ghost layer, so a dragged node and an uncommitted insert read as\n * equally provisional. */\nconst PREVIEW_CONTENT_OPACITY = 0.85;\n\n\nexport function useDispatcherOverlayLayer(args: {\n /** The surface's dispatcher, subscribed to only so a pump repaints. What\n * gets painted is the drawing view's own `getGestureOverlays()`. */\n dispatcher: Dispatcher | null | undefined;\n style?: DispatcherOverlayStyle;\n}): RenderLayer<unknown> {\n const { dispatcher, style } = args;\n\n const styleRef = useLatest(style);\n\n // Re-render on every dispatcher pump so live overlay (marquee, lasso\n // polyline) tracks pointermove instead of freezing on the first frame.\n const [, forceRerender] = useReducer((n: number) => n + 1, 0);\n useEffect(() => {\n if (!dispatcher) return;\n return dispatcher.subscribe(forceRerender);\n }, [dispatcher]);\n\n return useMemo<RenderLayer<unknown>>(\n () => ({\n id: 'dispatcher-overlay',\n label: 'Dispatcher overlay',\n space: 'screen',\n draw: (data, view) => {\n const cfg = { ...DEFAULT_STYLE, ...(styleRef.current ?? {}) };\n // Merged rather than replaced: naming one role must not delete the\n // kit's others.\n const roles = { ...OVERLAY_ROLE_STROKES, ...(styleRef.current?.roles ?? {}) };\n const t = viewToTransform(view);\n const out: DrawCommand[] = [];\n\n // Chrome-caps gate. Mirrors `composeAffordanceLayer` /\n // `createSelectionOverlayLayer`: pull a visibility predicate off\n // the data envelope and consult it per overlay before pushing draw\n // commands. Absent envelope → every overlay paints. This stays on the\n // painting side: the predicate is a property of the view's envelope,\n // and two views of one surface may answer differently for the same\n // in-flight gesture.\n const isVisible = isVisibleFrom(data);\n const passes = (id: string) => (isVisible ? isVisible(id) : true);\n\n for (const ov of resolveOverlays(gestureOverlaysFrom(data))) {\n if (!passes(ov.visibilityId)) continue;\n\n if (ov.kind === 'marquee') {\n const b = ov.bounds;\n const [sx, sy] = worldToScreen(b.x, b.y, t);\n const sw = b.width * view.scale.x;\n const sh = b.height * view.scale.y;\n const cmd: PathDrawCommand = {\n kind: 'path',\n path: { kind: 'rect', x: sx, y: sy, width: sw, height: sh },\n fill: { color: cfg.fill },\n stroke: { paint: { color: cfg.stroke }, width: cfg.lineWidth, dash: cfg.dash },\n };\n out.push(cmd);\n continue;\n }\n\n if (ov.kind === 'insertPreview') {\n const b = ov.bounds;\n const projectPoint = (wx: number, wy: number): { x: number; y: number } => {\n const [sx, sy] = worldToScreen(wx, wy, t);\n return { x: sx, y: sy };\n };\n const projectPoints = (\n pts: ReadonlyArray<{ x: number; y: number }>,\n ): { x: number; y: number }[] => pts.map((p) => projectPoint(p.x, p.y));\n // Radial shapes inscribe in a square, so a single screen-space\n // radius needs one scale factor; average the axes.\n const radialScale = (view.scale.x + view.scale.y) / 2;\n\n let pathCmd: PathDrawCommand['path'] | null = null;\n const geom = ov.geometry;\n switch (geom.kind) {\n case 'box': {\n const [sx, sy] = worldToScreen(b.x, b.y, t);\n const sw = b.width * view.scale.x;\n const sh = b.height * view.scale.y;\n if (ov.shape === 'image') {\n const e = ov.extras as Partial<{ src: string; preview: string }>;\n // The bitmap when it has decoded, the bare outline until then\n // (or when the tool opted out) — the outline is drawn either\n // way, so the drag always has an edge to read.\n const bmp = e.preview === 'outline' || !e.src\n ? undefined\n : getImageBitmap(e.src);\n if (bmp) {\n out.push({\n kind: 'image',\n image: bmp,\n x: sx, y: sy, w: sw, h: sh,\n opacity: PREVIEW_CONTENT_OPACITY,\n });\n }\n }\n pathCmd = ov.shape === 'ellipse'\n ? ellipsePath({ x: sx, y: sy, width: sw, height: sh })\n : rectPath(sx, sy, sw, sh);\n break;\n }\n case 'line':\n pathCmd = linePath(projectPoint(geom.a.x, geom.a.y), projectPoint(geom.b.x, geom.b.y));\n break;\n case 'polygon':\n pathCmd = regularPolygonPath(\n projectPoint(geom.center.x, geom.center.y),\n geom.radius * radialScale,\n geom.sides,\n geom.rotation,\n );\n break;\n case 'star':\n pathCmd = starPath(\n projectPoint(geom.center.x, geom.center.y),\n geom.outerRadius * radialScale,\n geom.points,\n geom.innerRadius * radialScale,\n geom.rotation,\n );\n break;\n case 'pencil':\n // Genuinely open: `polygonFromPoints` closes the path, and the\n // closing edge from the last sample back to the first reads as\n // a marquee rather than as the stroke being drawn.\n pathCmd = polylineFromPoints(projectPoints(geom.samples));\n break;\n }\n\n if (!pathCmd) continue;\n const cmd: PathDrawCommand = {\n kind: 'path',\n path: pathCmd,\n fill: ov.shape === 'line' || ov.shape === 'pencil' || ov.shape === 'image'\n ? undefined\n : { color: cfg.fill },\n stroke: { paint: { color: cfg.stroke }, width: cfg.lineWidth, dash: cfg.dash },\n };\n out.push(cmd);\n // Anchor dot at the drag's click point. Sells the anchoring\n // visually for radial shapes (polygon/star — no vertex sits\n // at the AABB corner) and for center mode (dot marks the\n // growth axis). 4 CSS-px radius, same stroke color as the\n // ghost so it reads as part of the chrome.\n if (ov.anchorPoint) {\n const anchorScreen = projectPoint(ov.anchorPoint.x, ov.anchorPoint.y);\n out.push({\n kind: 'path',\n path: ellipsePath({\n x: anchorScreen.x - 4,\n y: anchorScreen.y - 4,\n width: 8,\n height: 8,\n }),\n fill: { color: cfg.stroke },\n });\n }\n continue;\n }\n\n if (ov.kind === 'lasso') {\n // Project every vertex to screen coords; build a single polygon\n // path. The polygon already closes (polygonFromPoints adds Z),\n // which renders as the dashed \"close-line\" implicit in the\n // legacy hook's visual. Fill paints the would-be selection\n // region; stroke paints the polyline + close-line.\n const screenPts: { x: number; y: number }[] = [];\n for (const v of ov.vertices) {\n const [sx, sy] = worldToScreen(v.x, v.y, t);\n screenPts.push({ x: sx, y: sy });\n }\n const cmd: PathDrawCommand = {\n kind: 'path',\n path: polygonFromPoints(screenPts),\n fill: { color: cfg.fill },\n stroke: { paint: { color: cfg.stroke }, width: cfg.lineWidth, dash: cfg.dash },\n };\n out.push(cmd);\n continue;\n }\n\n if (ov.kind === 'polyline') {\n const stroke =\n roles[ov.role] ??\n { paint: { color: cfg.stroke }, width: cfg.lineWidth, dash: cfg.dash };\n const screenPts: { x: number; y: number }[] = [];\n for (const pt of ov.points) {\n const [sx, sy] = worldToScreen(pt.x, pt.y, t);\n screenPts.push({ x: sx, y: sy });\n }\n out.push({\n kind: 'path',\n path: polylineFromPoints(screenPts),\n stroke,\n } satisfies PathDrawCommand);\n continue;\n }\n }\n\n if (out.length === 0) return [];\n // Screen-space layer: emit commands directly. The worldToScreen\n // projection above has already mapped every coord into CSS pixels.\n return out;\n },\n }),\n [styleRef],\n );\n}\n"],"mappings":";;;;;;;;;;AA0DA,IAAMA,IAAiE;CACrE,MAAM;CACN,QAAQ;CACR,MAAM,CAAC,GAAG,CAAC;CACX,WAAW;AACb,GAKMC,IAA0B;AAGhC,SAAgBC,EAA0B,GAKjB;CACvB,IAAM,EAAE,eAAY,aAAUC,GAExBC,IAAWC,EAAUC,CAAK,GAI1B,GAAGC,KAAiBC,GAAY,MAAcC,IAAI,GAAG,CAAC;CAM5D,OALAC,QAAgB;EACd,IAAKC,GACL,OAAOA,EAAW,UAAUJ,CAAa;CAC3C,GAAG,CAACI,CAAU,CAAC,GAERC,SACE;EACL,IAAI;EACJ,OAAO;EACP,OAAO;EACP,OAAO,GAAM,MAAS;GACpB,IAAMC,IAAM;IAAE,GAAGb;IAAe,GAAII,EAAS,WAAW,CAAC;GAAG,GAGtDU,IAAQ;IAAE,GAAGC;IAAsB,GAAIX,EAAS,SAAS,SAAS,CAAC;GAAG,GACtEY,IAAIC,EAAgBC,CAAI,GACxBC,IAAqB,CAAC,GAStBC,IAAYC,EAAcC,CAAI,GAC9BC,KAAU,MAAgB,MAAYH,EAAUI,CAAE;GAExD,KAAK,IAAMC,KAAMC,EAAgBC,EAAoBL,CAAI,CAAC,GACxD,IAAKC,EAAOE,EAAG,YAAY,GAE3B;QAAIA,EAAG,SAAS,WAAW;KACzB,IAAMG,IAAIH,EAAG,QACP,CAACI,GAAIC,KAAMC,EAAcH,EAAE,GAAGA,EAAE,GAAGZ,CAAC,GAGpCgB,IAAuB;MAC3B,MAAM;MACN,MAAM;OAAE,MAAM;OAAQ,GAAGH;OAAI,GAAGC;OAAI,OAJ3BF,EAAE,QAAQV,EAAK,MAAM;OAIiB,QAHtCU,EAAE,SAASV,EAAK,MAAM;MAG2B;MAC1D,MAAM,EAAE,OAAOL,EAAI,KAAK;MACxB,QAAQ;OAAE,OAAO,EAAE,OAAOA,EAAI,OAAO;OAAG,OAAOA,EAAI;OAAW,MAAMA,EAAI;MAAK;KAC/E;KACA,EAAI,KAAKmB,CAAG;KACZ;IACF;IAEA,IAAIP,EAAG,SAAS,iBAAiB;KAC/B,IAAMG,IAAIH,EAAG,QACPQ,KAAgB,GAAY,MAAyC;MACzE,IAAM,CAACJ,GAAIC,KAAMC,EAAcG,GAAIC,GAAInB,CAAC;MACxC,OAAO;OAAE,GAAGa;OAAI,GAAGC;MAAG;KACxB,GACMM,KACJ,MAC+BC,EAAI,KAAK,MAAMJ,EAAaK,EAAE,GAAGA,EAAE,CAAC,CAAC,GAGhEC,KAAerB,EAAK,MAAM,IAAIA,EAAK,MAAM,KAAK,GAEhDsB,IAA0C,MACxCC,IAAOhB,EAAG;KAChB,QAAQgB,EAAK,MAAb;MACE,KAAK,OAAO;OACV,IAAM,CAACZ,GAAIC,KAAMC,EAAcH,EAAE,GAAGA,EAAE,GAAGZ,CAAC,GACpC0B,IAAKd,EAAE,QAAQV,EAAK,MAAM,GAC1ByB,IAAKf,EAAE,SAASV,EAAK,MAAM;OACjC,IAAIO,EAAG,UAAU,SAAS;QACxB,IAAMmB,IAAInB,EAAG,QAIPoB,IAAMD,EAAE,YAAY,aAAa,CAACA,EAAE,MACtC,KAAA,IACAE,EAAeF,EAAE,GAAG;QACxB,AAAIC,KACF1B,EAAI,KAAK;SACP,MAAM;SACN,OAAO0B;SACP,GAAGhB;SAAI,GAAGC;SAAI,GAAGY;SAAI,GAAGC;SACxB,SAAS1C;QACX,CAAC;OAEL;OACA,IAAUwB,EAAG,UAAU,YACnBsB,EAAY;QAAE,GAAGlB;QAAI,GAAGC;QAAI,OAAOY;QAAI,QAAQC;OAAG,CAAC,IACnDK,EAASnB,GAAIC,GAAIY,GAAIC,CAAE;OAC3B;MACF;MACA,KAAK;OACH,IAAUM,EAAShB,EAAaQ,EAAK,EAAE,GAAGA,EAAK,EAAE,CAAC,GAAGR,EAAaQ,EAAK,EAAE,GAAGA,EAAK,EAAE,CAAC,CAAC;OACrF;MACF,KAAK;OACH,IAAUS,EACRjB,EAAaQ,EAAK,OAAO,GAAGA,EAAK,OAAO,CAAC,GACzCA,EAAK,SAASF,GACdE,EAAK,OACLA,EAAK,QACP;OACA;MACF,KAAK;OACH,IAAUU,EACRlB,EAAaQ,EAAK,OAAO,GAAGA,EAAK,OAAO,CAAC,GACzCA,EAAK,cAAcF,GACnBE,EAAK,QACLA,EAAK,cAAcF,GACnBE,EAAK,QACP;OACA;MACF,KAAK,UAIH,IAAUW,EAAmBhB,EAAcK,EAAK,OAAO,CAAC;KAE5D;KAEA,IAAI,CAACD,GAAS;KACd,IAAMR,IAAuB;MAC3B,MAAM;MACN,MAAMQ;MACN,MAAMf,EAAG,UAAU,UAAUA,EAAG,UAAU,YAAYA,EAAG,UAAU,UAC/D,KAAA,IACA,EAAE,OAAOZ,EAAI,KAAK;MACtB,QAAQ;OAAE,OAAO,EAAE,OAAOA,EAAI,OAAO;OAAG,OAAOA,EAAI;OAAW,MAAMA,EAAI;MAAK;KAC/E;KAOA,IANAM,EAAI,KAAKa,CAAG,GAMRP,EAAG,aAAa;MAClB,IAAM4B,IAAepB,EAAaR,EAAG,YAAY,GAAGA,EAAG,YAAY,CAAC;MACpE,EAAI,KAAK;OACP,MAAM;OACN,MAAMsB,EAAY;QAChB,GAAGM,EAAa,IAAI;QACpB,GAAGA,EAAa,IAAI;QACpB,OAAO;QACP,QAAQ;OACV,CAAC;OACD,MAAM,EAAE,OAAOxC,EAAI,OAAO;MAC5B,CAAC;KACH;KACA;IACF;IAEA,IAAIY,EAAG,SAAS,SAAS;KAMvB,IAAM6B,IAAwC,CAAC;KAC/C,KAAK,IAAMC,KAAK9B,EAAG,UAAU;MAC3B,IAAM,CAACI,GAAIC,KAAMC,EAAcwB,EAAE,GAAGA,EAAE,GAAGvC,CAAC;MAC1C,EAAU,KAAK;OAAE,GAAGa;OAAI,GAAGC;MAAG,CAAC;KACjC;KACA,IAAME,IAAuB;MAC3B,MAAM;MACN,MAAMwB,EAAkBF,CAAS;MACjC,MAAM,EAAE,OAAOzC,EAAI,KAAK;MACxB,QAAQ;OAAE,OAAO,EAAE,OAAOA,EAAI,OAAO;OAAG,OAAOA,EAAI;OAAW,MAAMA,EAAI;MAAK;KAC/E;KACA,EAAI,KAAKmB,CAAG;KACZ;IACF;IAEA,IAAIP,EAAG,SAAS,YAAY;KAC1B,IAAMgC,IACJ3C,EAAMW,EAAG,SACT;MAAE,OAAO,EAAE,OAAOZ,EAAI,OAAO;MAAG,OAAOA,EAAI;MAAW,MAAMA,EAAI;KAAK,GACjEyC,IAAwC,CAAC;KAC/C,KAAK,IAAMI,KAAMjC,EAAG,QAAQ;MAC1B,IAAM,CAACI,GAAIC,KAAMC,EAAc2B,EAAG,GAAGA,EAAG,GAAG1C,CAAC;MAC5C,EAAU,KAAK;OAAE,GAAGa;OAAI,GAAGC;MAAG,CAAC;KACjC;KACA,EAAI,KAAK;MACP,MAAM;MACN,MAAMsB,EAAmBE,CAAS;MAClC;KACF,CAA2B;KAC3B;IACF;GA3IA;GAiJF,OAHInC,EAAI,WAAW,IAAU,CAAC,IAGvBA;EACT;CACF,IACA,CAACf,CAAQ,CACX;AACF"}
1
+ {"version":3,"file":"useDispatcherOverlayLayer.js","names":["DEFAULT_STYLE","PREVIEW_CONTENT_OPACITY","useDispatcherOverlayLayer","args","styleRef","useLatest","style","forceRerender","useReducer","n","useEffect","dispatcher","useMemo","cfg","roles","OVERLAY_ROLE_STROKES","t","viewToTransform","view","out","isVisible","isVisibleFrom","data","passes","id","ov","resolveOverlays","gestureOverlaysFrom","b","sx","sy","worldToScreen","cmd","projectPoint","wx","wy","projectPoints","pts","p","radialScale","pathCmd","geom","sw","sh","e","bmp","getImageBitmap","ellipsePath","rectPath","linePath","regularPolygonPath","starPath","polylineFromPoints","anchorScreen","screenPts","v","polygonFromPoints","stroke","pt"],"sources":["../../../src/canvas/SceneCanvas/useDispatcherOverlayLayer.ts"],"sourcesContent":["/**\n * Dispatcher overlay render layer for `<SceneCanvas>`.\n *\n * Paints the overlay shapes the drawing view's in-flight handles publish,\n * taken off the draw envelope so a panel shows its own gesture rather than\n * the surface's. `resolveOverlays` does the reading; everything here is\n * painting.\n *\n * Distinct from `usePreviewGhostLayer`, which paints displaced scene-node\n * silhouettes. This layer is for gestures whose visual feedback isn't a moved\n * scene node — a marquee rect, a lasso polyline, an insert preview.\n */\nimport { useEffect, useMemo, useReducer } from 'react';\nimport { useLatest } from '@weasel-js/react';\nimport type { DrawCommand, PathDrawCommand } from '@weasel-js/renderer';\nimport type { CommandStroke } from '@weasel-js/paint';\nimport type { RenderLayer } from 'core/layers/render';\nimport { viewToTransform } from 'core/viewport/view';\nimport { worldToScreen } from 'core/viewport/viewTransform';\nimport type { Dispatcher } from '@weasel-js/routing';\nimport {\n polygonFromPoints,\n polylineFromPoints,\n rectPath,\n ellipsePath,\n linePath,\n regularPolygonPath,\n starPath,\n} from '@weasel-js/geom';\nimport { getImageBitmap } from '@weasel-js/renderer';\nimport { resolveOverlays } from 'interactions/actions/resolveOverlays';\nimport { gestureOverlaysFrom, isVisibleFrom } from '../drawEnvelope';\nimport { OVERLAY_ROLE_STROKES } from '../overlayRoleStrokes';\n\n/** Style knobs for the dispatcher-overlay layer's marquee + lasso paints. */\nexport interface DispatcherOverlayStyle {\n fill?: string;\n stroke?: string;\n dash?: number[];\n lineWidth?: number;\n /** Stroke per `polyline` overlay role, merged over the kit's. A role with\n * no entry here and none of the kit's paints as plain chrome — the\n * `stroke` / `lineWidth` / `dash` above. */\n roles?: Readonly<Record<string, CommandStroke>>;\n}\n\nconst DEFAULT_STYLE: Required<Omit<DispatcherOverlayStyle, 'roles'>> = {\n fill: 'rgba(164, 139, 212, 0.18)',\n stroke: '#a48bd4',\n dash: [3, 3],\n lineWidth: 1,\n};\n\n/** Alpha for content previewed inside an in-flight gesture. Matches the\n * preview-ghost layer, so a dragged node and an uncommitted insert read as\n * equally provisional. */\nconst PREVIEW_CONTENT_OPACITY = 0.85;\n\n\nexport function useDispatcherOverlayLayer(args: {\n /** The surface's dispatcher, subscribed to only so a pump repaints. What\n * gets painted is the drawing view's own `getGestureOverlays()`. */\n dispatcher: Dispatcher | null | undefined;\n style?: DispatcherOverlayStyle;\n}): RenderLayer<unknown> {\n const { dispatcher, style } = args;\n\n const styleRef = useLatest(style);\n\n // Re-render on every dispatcher pump so live overlay (marquee, lasso\n // polyline) tracks pointermove instead of freezing on the first frame.\n const [, forceRerender] = useReducer((n: number) => n + 1, 0);\n useEffect(() => {\n if (!dispatcher) return;\n return dispatcher.subscribe(forceRerender);\n }, [dispatcher]);\n\n return useMemo<RenderLayer<unknown>>(\n () => ({\n id: 'dispatcher-overlay',\n label: 'Dispatcher overlay',\n space: 'screen',\n draw: (data, view) => {\n const cfg = { ...DEFAULT_STYLE, ...(styleRef.current ?? {}) };\n // Merged rather than replaced: naming one role must not delete the\n // kit's others.\n const roles = { ...OVERLAY_ROLE_STROKES, ...(styleRef.current?.roles ?? {}) };\n const t = viewToTransform(view);\n const out: DrawCommand[] = [];\n\n // Chrome-caps gate. Absent envelope → every overlay paints. This stays\n // on the painting side: the predicate is a property of the view's\n // envelope, and two views of one surface may answer differently for\n // the same in-flight gesture.\n const isVisible = isVisibleFrom(data);\n const passes = (id: string) => (isVisible ? isVisible(id) : true);\n\n for (const ov of resolveOverlays(gestureOverlaysFrom(data))) {\n if (!passes(ov.visibilityId)) continue;\n\n if (ov.kind === 'marquee') {\n const b = ov.bounds;\n const [sx, sy] = worldToScreen(b.x, b.y, t);\n const sw = b.width * view.scale.x;\n const sh = b.height * view.scale.y;\n const cmd: PathDrawCommand = {\n kind: 'path',\n path: { kind: 'rect', x: sx, y: sy, width: sw, height: sh },\n fill: { paint: { color: cfg.fill } },\n stroke: { paint: { color: cfg.stroke }, width: cfg.lineWidth, dash: cfg.dash },\n };\n out.push(cmd);\n continue;\n }\n\n if (ov.kind === 'insertPreview') {\n const b = ov.bounds;\n const projectPoint = (wx: number, wy: number): { x: number; y: number } => {\n const [sx, sy] = worldToScreen(wx, wy, t);\n return { x: sx, y: sy };\n };\n const projectPoints = (\n pts: ReadonlyArray<{ x: number; y: number }>,\n ): { x: number; y: number }[] => pts.map((p) => projectPoint(p.x, p.y));\n // Radial shapes inscribe in a square, so a single screen-space\n // radius needs one scale factor; average the axes.\n const radialScale = (view.scale.x + view.scale.y) / 2;\n\n let pathCmd: PathDrawCommand['path'] | null = null;\n const geom = ov.geometry;\n switch (geom.kind) {\n case 'box': {\n const [sx, sy] = worldToScreen(b.x, b.y, t);\n const sw = b.width * view.scale.x;\n const sh = b.height * view.scale.y;\n if (ov.shape === 'image') {\n const e = ov.extras as Partial<{ src: string; preview: string }>;\n // The bitmap when it has decoded, the bare outline until then\n // (or when the tool opted out) — the outline is drawn either\n // way, so the drag always has an edge to read.\n const bmp = e.preview === 'outline' || !e.src\n ? undefined\n : getImageBitmap(e.src);\n if (bmp) {\n out.push({\n kind: 'image',\n image: bmp,\n x: sx, y: sy, w: sw, h: sh,\n opacity: PREVIEW_CONTENT_OPACITY,\n });\n }\n }\n pathCmd = ov.shape === 'ellipse'\n ? ellipsePath({ x: sx, y: sy, width: sw, height: sh })\n : rectPath(sx, sy, sw, sh);\n break;\n }\n case 'line':\n pathCmd = linePath(projectPoint(geom.a.x, geom.a.y), projectPoint(geom.b.x, geom.b.y));\n break;\n case 'polygon':\n pathCmd = regularPolygonPath(\n projectPoint(geom.center.x, geom.center.y),\n geom.radius * radialScale,\n geom.sides,\n geom.rotation,\n );\n break;\n case 'star':\n pathCmd = starPath(\n projectPoint(geom.center.x, geom.center.y),\n geom.outerRadius * radialScale,\n geom.points,\n geom.innerRadius * radialScale,\n geom.rotation,\n );\n break;\n case 'pencil':\n // Genuinely open: `polygonFromPoints` closes the path, and the\n // closing edge from the last sample back to the first reads as\n // a marquee rather than as the stroke being drawn.\n pathCmd = polylineFromPoints(projectPoints(geom.samples));\n break;\n }\n\n if (!pathCmd) continue;\n const cmd: PathDrawCommand = {\n kind: 'path',\n path: pathCmd,\n fill: ov.shape === 'line' || ov.shape === 'pencil' || ov.shape === 'image'\n ? undefined\n : { paint: { color: cfg.fill } },\n stroke: { paint: { color: cfg.stroke }, width: cfg.lineWidth, dash: cfg.dash },\n };\n out.push(cmd);\n // Anchor dot at the drag's click point: for radial shapes no\n // vertex sits at the AABB corner, and in center mode the dot marks\n // the growth axis.\n if (ov.anchorPoint) {\n const anchorScreen = projectPoint(ov.anchorPoint.x, ov.anchorPoint.y);\n out.push({\n kind: 'path',\n path: ellipsePath({\n x: anchorScreen.x - 4,\n y: anchorScreen.y - 4,\n width: 8,\n height: 8,\n }),\n fill: { paint: { color: cfg.stroke } },\n });\n }\n continue;\n }\n\n if (ov.kind === 'lasso') {\n // `polygonFromPoints` closes the path, which draws the dashed\n // close-line back to the first vertex.\n const screenPts: { x: number; y: number }[] = [];\n for (const v of ov.vertices) {\n const [sx, sy] = worldToScreen(v.x, v.y, t);\n screenPts.push({ x: sx, y: sy });\n }\n const cmd: PathDrawCommand = {\n kind: 'path',\n path: polygonFromPoints(screenPts),\n fill: { paint: { color: cfg.fill } },\n stroke: { paint: { color: cfg.stroke }, width: cfg.lineWidth, dash: cfg.dash },\n };\n out.push(cmd);\n continue;\n }\n\n if (ov.kind === 'polyline') {\n const stroke =\n roles[ov.role] ??\n { paint: { color: cfg.stroke }, width: cfg.lineWidth, dash: cfg.dash };\n const screenPts: { x: number; y: number }[] = [];\n for (const pt of ov.points) {\n const [sx, sy] = worldToScreen(pt.x, pt.y, t);\n screenPts.push({ x: sx, y: sy });\n }\n out.push({\n kind: 'path',\n path: polylineFromPoints(screenPts),\n stroke,\n } satisfies PathDrawCommand);\n continue;\n }\n }\n\n if (out.length === 0) return [];\n return out;\n },\n }),\n [styleRef],\n );\n}\n"],"mappings":"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"}
@@ -0,0 +1,20 @@
1
+ import { useKeyState as e } from "../../input/useKeyState.js";
2
+ import { useMemo as t } from "react";
3
+ //#region src/canvas/SceneCanvas/useHeldModifiers.ts
4
+ function n() {
5
+ let n = e({ skipInEditable: !1 });
6
+ return t(() => ({
7
+ get: n.modifiers,
8
+ subscribe(e) {
9
+ let t = n.modifiers();
10
+ return n.subscribe(() => {
11
+ let r = n.modifiers();
12
+ r !== t && (t = r, e());
13
+ });
14
+ }
15
+ }), [n]);
16
+ }
17
+ //#endregion
18
+ export { n as useHeldModifiers };
19
+
20
+ //# sourceMappingURL=useHeldModifiers.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useHeldModifiers.js","names":["useHeldModifiers","keys","useKeyState","useMemo","held","now","listener"],"sources":["../../../src/canvas/SceneCanvas/useHeldModifiers.ts"],"sourcesContent":["/** The modifier keys held, for a surface's rule context. */\nimport { useMemo } from 'react';\nimport type { ModifierState } from '../../core/modifierState';\nimport type { RedrawSource } from '../../core/layers/render';\nimport { useKeyState } from '../../input/useKeyState';\n\nexport interface HeldModifiers extends RedrawSource {\n /** Read when a rule is evaluated. The same object until a modifier changes. */\n get(): ModifierState;\n}\n\n/** The modifiers held anywhere in the window, a text field included: a rule\n * is asked about the keyboard, not about where focus is. `subscribe` reports\n * a modifier going down or up and no other key. */\nexport function useHeldModifiers(): HeldModifiers {\n const keys = useKeyState({ skipInEditable: false });\n return useMemo(() => ({\n get: keys.modifiers,\n subscribe(listener) {\n let held = keys.modifiers();\n return keys.subscribe(() => {\n const now = keys.modifiers();\n if (now === held) return;\n held = now;\n listener();\n });\n },\n }), [keys]);\n}\n"],"mappings":";;;AAcA,SAAgBA,IAAkC;CAChD,IAAMC,IAAOC,EAAY,EAAE,gBAAgB,GAAM,CAAC;CAClD,OAAOC,SAAe;EACpB,KAAKF,EAAK;EACV,UAAU,GAAU;GAClB,IAAIG,IAAOH,EAAK,UAAU;GAC1B,OAAOA,EAAK,gBAAgB;IAC1B,IAAMI,IAAMJ,EAAK,UAAU;IAC3B,AAAII,MAAQD,MACZ,IAAOC,GACPC,EAAS;GACX,CAAC;EACH;CACF,IAAI,CAACL,CAAI,CAAC;AACZ"}
@@ -0,0 +1,26 @@
1
+ import { makeGetNodeAtPoint as e } from "../getNodeAtPoint.js";
2
+ import { useMemo as t } from "react";
3
+ //#region src/canvas/SceneCanvas/useNodeAtPoint.ts
4
+ function n(n) {
5
+ let { pickBest: r, nodes: i, kindOfData: a, isPointerInteractive: o } = n;
6
+ return t(() => {
7
+ if (!r) return;
8
+ let t = e(r, (e) => {
9
+ let t = i.getNode(e);
10
+ return t ? { kind: a ? a(t.data) : "unknown" } : null;
11
+ });
12
+ return o ? (e, n, r) => {
13
+ let i = t(e, n, r);
14
+ return i == null || o(i.id) === !1 ? null : i;
15
+ } : t;
16
+ }, [
17
+ i,
18
+ r,
19
+ o,
20
+ a
21
+ ]);
22
+ }
23
+ //#endregion
24
+ export { n as useNodeAtPoint };
25
+
26
+ //# sourceMappingURL=useNodeAtPoint.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useNodeAtPoint.js","names":["useNodeAtPoint","args","useMemo","pickBest","base","makeGetNodeAtPoint","node","nodes","id","kindOfData","isPointerInteractive","hit","wx","wy","view"],"sources":["../../../src/canvas/SceneCanvas/useNodeAtPoint.ts"],"sourcesContent":["import { useMemo } from 'react';\nimport { makeGetNodeAtPoint, type NodeAtPointHit } from '../getNodeAtPoint';\nimport type { PickView } from './useSceneSelectTool';\n\nexport type NodeAtPoint = (wx: number, wy: number, view?: PickView | null) => NodeAtPointHit | null;\n\n/**\n * The node under a world point with its routing kind, resolved through the\n * select tool's own single-hit picker, so `onClick`, `onDoubleClick`, hover,\n * and tool routing all name the node a click selects. A hit whose id\n * `isPointerInteractive` rejects comes back null.\n */\nexport function useNodeAtPoint<TData>(args: {\n pickBest: ((wx: number, wy: number, view?: PickView | null) => string | null) | undefined;\n /** A caller's `geometry.pickEvery` can answer an id the scene does not hold. */\n nodes: { getNode(id: string): { data: TData } | null | undefined };\n kindOfData: ((data: TData) => string) | undefined;\n isPointerInteractive: ((id: string) => boolean) | undefined;\n}): NodeAtPoint | undefined {\n const { pickBest, nodes, kindOfData, isPointerInteractive } = args;\n return useMemo(() => {\n if (!pickBest) return undefined;\n const base = makeGetNodeAtPoint(pickBest, (id) => {\n const node = nodes.getNode(id);\n if (!node) return null;\n return { kind: kindOfData ? kindOfData(node.data) : 'unknown' };\n });\n if (!isPointerInteractive) return base;\n return (wx, wy, view) => {\n const hit = base(wx, wy, view);\n if (hit == null) return null;\n if (isPointerInteractive(hit.id) === false) return null;\n return hit;\n };\n }, [nodes, pickBest, isPointerInteractive, kindOfData]);\n}\n"],"mappings":";;;AAYA,SAAgBA,EAAsB,GAMV;CAC1B,IAAM,EAAE,aAAU,UAAO,eAAY,4BAAyBC;CAC9D,OAAOC,QAAc;EACnB,IAAI,CAACC,GAAU;EACf,IAAMC,IAAOC,EAAmBF,IAAW,MAAO;GAChD,IAAMG,IAAOC,EAAM,QAAQC,CAAE;GAE7B,OADKF,IACE,EAAE,MAAMG,IAAaA,EAAWH,EAAK,IAAI,IAAI,UAAU,IAD5C;EAEpB,CAAC;EAED,OADKI,KACG,GAAI,GAAI,MAAS;GACvB,IAAMC,IAAMP,EAAKQ,GAAIC,GAAIC,CAAI;GAG7B,OAFIH,KAAO,QACPD,EAAqBC,EAAI,EAAE,MAAM,KAAc,OAC5CA;EACT,IANkCP;CAOpC,GAAG;EAACG;EAAOJ;EAAUO;EAAsBD;CAAU,CAAC;AACxD"}