@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
@@ -6,106 +6,117 @@ import { useRef as f } from "react";
6
6
  import { useLatest as p } from "@weasel-js/react";
7
7
  import { useDepSource as m } from "@weasel-js/routing/react";
8
8
  //#region src/canvas/deps/insert.ts
9
- var h = (e, i) => {
9
+ function h({ fill: e, stroke: t }) {
10
+ return {
11
+ ...e === void 0 ? {} : { fill: e },
12
+ ...t === void 0 ? {} : { stroke: t }
13
+ };
14
+ }
15
+ function g(e, t) {
16
+ let n = e?.path;
17
+ return t === void 0 || n === void 0 || !("fillRule" in n) ? e : {
18
+ ...e,
19
+ path: {
20
+ ...n,
21
+ fillRule: t
22
+ }
23
+ };
24
+ }
25
+ var _ = (e, i) => {
10
26
  let a = t(i);
11
- return e === "pencil" ? { stroke: r(a, 2) } : e === "line" || e === "path" ? {
12
- fill: n(a),
27
+ return e === "line" || e === "pencil" ? { stroke: r(a, 2) } : e === "path" ? {
28
+ fill: { paint: n(a) },
13
29
  stroke: r(a, 2)
14
- } : { fill: n(a) };
30
+ } : { fill: { paint: n(a) } };
15
31
  };
16
- function g(t, n, r, g = h) {
17
- let _ = p(t), v = p(n), y = p(r), b = p(g), x = f(0), S = f({ gesture: null });
18
- m("insertLive", () => S.current), m("insert", () => {
19
- let t = _.current, n = v.current, r = t.layers[0]?.id ?? "default", f = (n, f) => {
20
- let p = f.kind, m = ++x.current, h = t.mintId(), g = (e = p) => {
21
- let { fill: t, stroke: n } = b.current(e, m);
22
- return {
23
- ...t === void 0 ? {} : { fill: t },
24
- ...n === void 0 ? {} : { stroke: n }
25
- };
26
- }, _ = e({
32
+ function v(t, n, r, v = _) {
33
+ let y = p(t), b = p(n), x = p(r), S = p(v), C = f(0), w = f({ gesture: null });
34
+ m("insertLive", () => w.current), m("insert", () => {
35
+ let t = y.current, n = b.current, r = t.layers[0]?.id ?? "default", f = (n, f) => {
36
+ let p = f.kind, m = ++C.current, _ = t.mintId(), v, y = (e = p) => h(v = S.current(e, m)), b = e({
27
37
  shape: p,
28
38
  bounds: n,
29
39
  extras: f
30
- }), v = _.bounds, S = y.current?.[p];
31
- if (S) {
32
- let e = S(n, f);
40
+ }), w = b.bounds, T = x.current?.[p];
41
+ if (T) {
42
+ let e = T(n, f);
33
43
  return e === null ? null : {
34
- id: h,
44
+ id: _,
35
45
  ops: [i({
36
46
  node: {
37
- id: h,
47
+ id: _,
38
48
  kind: "leaf",
39
49
  layer: r,
40
- pose: e.pose ?? v,
50
+ pose: e.pose ?? w,
41
51
  data: e.data
42
52
  },
43
53
  label: `Insert ${p}`
44
54
  })]
45
55
  };
46
56
  }
47
- let C = _.geometry, w;
48
- switch (C.kind) {
57
+ let E = b.geometry, D;
58
+ switch (E.kind) {
49
59
  case "line":
50
- w = {
51
- path: o(C.a, C.b),
52
- ...g()
60
+ D = {
61
+ path: o(E.a, E.b),
62
+ ...y(),
63
+ fill: null
53
64
  };
54
65
  break;
55
66
  case "polygon":
56
- w = {
57
- path: l(C.center, C.radius, C.sides, C.rotation),
58
- ...g()
67
+ D = {
68
+ path: l(E.center, E.radius, E.sides, E.rotation),
69
+ ...y()
59
70
  };
60
71
  break;
61
72
  case "star":
62
- w = {
63
- path: d(C.center, C.outerRadius, C.points, C.innerRadius, C.rotation),
64
- ...g()
73
+ D = {
74
+ path: d(E.center, E.outerRadius, E.points, E.innerRadius, E.rotation),
75
+ ...y()
65
76
  };
66
77
  break;
67
78
  case "pencil": {
68
- let e = C.samples;
69
- w = e.length >= 4 ? {
79
+ let e = E.samples;
80
+ D = e.length >= 4 ? {
70
81
  path: u(e, 2),
71
- ...g()
82
+ ...y()
72
83
  } : e.length >= 2 ? {
73
84
  path: s(e),
74
- ...g()
85
+ ...y()
75
86
  } : {
76
- path: c(0, 0, _.bounds.width, _.bounds.height),
77
- ...g("rect")
87
+ path: c(0, 0, b.bounds.width, b.bounds.height),
88
+ ...y("rect")
78
89
  };
79
90
  break;
80
91
  }
81
92
  case "box": switch (p) {
82
93
  case "rect":
83
- w = {
84
- path: c(0, 0, _.bounds.width, _.bounds.height),
85
- ...g()
94
+ D = {
95
+ path: c(0, 0, b.bounds.width, b.bounds.height),
96
+ ...y()
86
97
  };
87
98
  break;
88
99
  case "ellipse":
89
- w = {
90
- path: a(_.bounds),
91
- ...g()
100
+ D = {
101
+ path: a(b.bounds),
102
+ ...y()
92
103
  };
93
104
  break;
94
105
  case "path": {
95
106
  let e = f;
96
- w = {
107
+ D = {
97
108
  path: e.path,
98
- ...g(),
109
+ ...y(),
99
110
  ...e.closed ? {} : { fill: null }
100
111
  };
101
112
  break;
102
113
  }
103
114
  case "text":
104
- w = { text: f.text ?? "" };
115
+ D = { text: f.text ?? "" };
105
116
  break;
106
117
  case "image": {
107
118
  let e = f;
108
- w = { image: {
119
+ D = { image: {
109
120
  src: e.src ?? "",
110
121
  ...e.opacity === void 0 ? {} : { opacity: e.opacity }
111
122
  } };
@@ -114,15 +125,15 @@ function g(t, n, r, g = h) {
114
125
  default: return console.warn(`weasel insertDep: no factory for kind="${p}". Skipping insert.`), null;
115
126
  }
116
127
  }
117
- return {
118
- id: h,
128
+ return D = g(D, v?.fillRule), {
129
+ id: _,
119
130
  ops: [i({
120
131
  node: {
121
- id: h,
132
+ id: _,
122
133
  kind: "leaf",
123
134
  layer: r,
124
- pose: v,
125
- data: w
135
+ pose: w,
136
+ data: D
126
137
  },
127
138
  label: `Insert ${p}`
128
139
  })]
@@ -139,6 +150,6 @@ function g(t, n, r, g = h) {
139
150
  });
140
151
  }
141
152
  //#endregion
142
- export { h as paletteInsertPaint, g as useInsertDepSource };
153
+ export { _ as paletteInsertPaint, v as useInsertDepSource };
143
154
 
144
155
  //# sourceMappingURL=insert.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"insert.js","names":["e","paletteInsertPaint","color","cycleFill","seq","kind","strokeOf","solid","useInsertDepSource","sceneRef","useLatest","scene","adapterRef","adapter","factoriesRef","factories","paintRef","paint","insertSeqRef","useRef","liveRef","useDepSource","sc","ad","layer","build","extras","id","painted","as","fill","stroke","extent","insertPreviewExtent","pose","factory","built","bounds","createInsertOp","geom","data","linePath","regularPolygonPath","starPath","samples","schneiderFit","polygonFromPoints","rectPath","ellipsePath"],"sources":["../../../src/canvas/deps/insert.ts"],"sourcesContent":["/**\n * `useInsertDepSource` — wires the `insert` dep consumed by `insertAction`.\n *\n * Provides kit-side kind→data factories for the 6 builtin shape kinds\n * (`rect`, `ellipse`, `line`, `polygon`, `star`, `pencil`). Acceptable because\n * these kinds are kit-shipped tools; a future phase can expose a\n * `nodeFactories` prop for consumer-defined kinds.\n *\n * `line`, `polygon`, `star` and `pencil` receive the drag AABB from the\n * insertAction invoker, but `extras` may carry richer geometry (endpoints,\n * center+radius+rotation, point trail). `insertPreviewExtent` resolves the\n * two into the node's real extent — the same resolution the live preview\n * and the reported gesture bounds use.\n */\nimport { useRef } from 'react';\nimport { useDepSource } from '@weasel-js/routing/react';\nimport { useLatest } from '@weasel-js/react';\nimport type { InsertDep, InsertExtras, InsertLive } from 'interactions/actions/depSchema';\nimport type { Scene, NodeId } from 'core/scene/types';\nimport type { Op } from 'core/ops/types';\nimport { createInsertOp } from 'core/ops/create';\nimport {\n rectPath,\n ellipsePath,\n regularPolygonPath,\n starPath,\n linePath,\n polygonFromPoints,\n schneiderFit,\n type PolygonPath,\n} from '@weasel-js/geom';\nimport { insertPreviewExtent } from '../insertPreviewExtent';\nimport type { FillStyle, Stroke } from '@weasel-js/paint';\nimport { cycleFill, solid, strokeOf } from '../../util/paint';\n\ninterface OpsApplier {\n applyOps(ops: Op[], label?: string): void;\n}\n\n/**\n * Consumer-supplied node factory for one insert `kind`. Given the drag AABB\n * and the tool's `extras`, returns the node's `data` (in the consumer's own\n * data shape) plus an optional `pose` override — the dep supplies id, layer,\n * and the undoable insert op. Return `null` to reject the insert.\n *\n * A factory registered for a kit kind (`rect`, `line`, …) fully replaces the\n * kit's default `{ path, fill }` factory for that kind; a factory for a novel\n * kind adds support the kit doesn't ship (e.g. `text`). To change only the\n * paint of a kit shape, pass an {@link InsertPaint}. See\n * `SceneCanvas`'s `insertNodeFactories` prop.\n */\nexport type InsertNodeFactory = (\n bounds: { x: number; y: number; width: number; height: number },\n extras: InsertExtras,\n) => { data: unknown; pose?: unknown } | null;\n\n/**\n * The paint a kit-built shape is inserted with. `kind` is the shape being\n * built and `seq` counts this canvas's inserts from 1. A key left out stays\n * off the node, so its painter's default applies; `null` is \"none\". A pencil\n * trail too short to fit is built as a rect and asks as one.\n *\n * It paints only the shapes the kit builds: an `InsertNodeFactory` owns its\n * node's whole `data`. See `SceneCanvas`'s `insertPaint` prop.\n */\nexport type InsertPaint = (kind: string, seq: number) => { fill?: FillStyle | null; stroke?: Stroke | null };\n\n/** The default {@link InsertPaint}: the next color of the kit palette, as a\n * fill on a closed shape, a fill and a stroke on a line or a pen path, and a\n * stroke alone on a pencil trail. */\nexport const paletteInsertPaint: InsertPaint = (kind, seq) => {\n const color = cycleFill(seq);\n if (kind === 'pencil') return { stroke: strokeOf(color, 2) };\n if (kind === 'line' || kind === 'path') return { fill: solid(color), stroke: strokeOf(color, 2) };\n return { fill: solid(color) };\n};\n\nexport function useInsertDepSource(\n scene: Scene<unknown, string, unknown>,\n adapter: OpsApplier,\n factories?: Record<string, InsertNodeFactory>,\n paint: InsertPaint = paletteInsertPaint,\n): void {\n const sceneRef = useLatest(scene);\n const adapterRef = useLatest(adapter);\n const factoriesRef = useLatest(factories);\n const paintRef = useLatest(paint);\n const insertSeqRef = useRef(0);\n const liveRef = useRef<InsertLive>({ gesture: null });\n useDepSource('insertLive', () => liveRef.current);\n\n useDepSource('insert', (): InsertDep => {\n const sc = sceneRef.current;\n const ad = adapterRef.current;\n\n const layer = (sc.layers[0]?.id ?? 'default') as string;\n const build = (\n bounds: { x: number; y: number; width: number; height: number },\n extras: InsertExtras,\n ): { id: NodeId; ops: Op[] } | null => {\n const kind = extras.kind;\n const seq = ++insertSeqRef.current;\n const id = sc.mintId();\n const painted = (as: string = kind): { fill?: FillStyle | null; stroke?: Stroke | null } => {\n const { fill, stroke } = paintRef.current(as, seq);\n return { ...(fill !== undefined ? { fill } : {}), ...(stroke !== undefined ? { stroke } : {}) };\n };\n\n // The nascent node's extent — drag AABB reconciled with whatever\n // richer geometry `extras` carries.\n const extent = insertPreviewExtent({ shape: kind, bounds, extras });\n const pose: unknown = extent.bounds;\n\n // Consumer factory wins over the kit default for this kind (and is the\n // only way to insert consumer-defined kinds like `text`). It owns the\n // node's data + optional pose; the dep still supplies id/layer/op.\n const factory = factoriesRef.current?.[kind];\n if (factory) {\n const built = factory(bounds, extras);\n if (built === null) return null;\n return {\n id,\n ops: [createInsertOp({ node: { id, kind: 'leaf', layer, pose: built.pose ?? pose, data: built.data } as unknown as { id: string }, label: `Insert ${kind}` })],\n };\n }\n\n const geom = extent.geometry;\n let data: unknown;\n\n switch (geom.kind) {\n case 'line':\n data = { path: linePath(geom.a, geom.b), ...painted() };\n break;\n case 'polygon':\n data = {\n path: regularPolygonPath(geom.center, geom.radius, geom.sides, geom.rotation),\n ...painted(),\n };\n break;\n case 'star':\n data = {\n path: starPath(geom.center, geom.outerRadius, geom.points, geom.innerRadius, geom.rotation),\n ...painted(),\n };\n break;\n case 'pencil': {\n const samples = geom.samples as { x: number; y: number }[];\n if (samples.length >= 4) {\n data = { path: schneiderFit(samples, 2.0), ...painted() };\n } else if (samples.length >= 2) {\n data = { path: polygonFromPoints(samples), ...painted() };\n } else {\n data = { path: rectPath(0, 0, extent.bounds.width, extent.bounds.height), ...painted('rect') };\n }\n break;\n }\n case 'box':\n switch (kind) {\n case 'rect':\n // Geometry-in-local-frame: the rect path lives at the origin and\n // the pose carries position. `pathInPoseFrame` rebases a rect path\n // onto the pose box regardless of the stored coords, so origin vs.\n // duplicated-pose-coords render identically — don't double-count\n // the position. (#13)\n data = { path: rectPath(0, 0, extent.bounds.width, extent.bounds.height), ...painted() };\n break;\n case 'ellipse':\n data = { path: ellipsePath(extent.bounds), ...painted() };\n break;\n case 'path': {\n const e = extras as { path: PolygonPath; closed: boolean };\n data = { path: e.path, ...painted(), ...(e.closed ? {} : { fill: null }) };\n break;\n }\n case 'text': {\n // The built-in `useTextTool` drags an empty text box you then type\n // into (edit is entered via `enterTextEdit`), so `extras` carries\n // no content and `text` defaults to `''`. The kit:text painter\n // matches on `data.text != null` and applies style defaults at\n // render time, so a bare `{ text }` is a complete, editable node.\n const e = extras as Partial<{ text: string }>;\n data = { text: e.text ?? '' };\n break;\n }\n case 'image': {\n // The bitmap is loaded + cached by `imageCache` keyed on `src`;\n // only the (serializable) `src` lives on the node.\n const e = extras as Partial<{ src: string; opacity: number }>;\n data = {\n image: {\n src: e.src ?? '',\n ...(e.opacity !== undefined ? { opacity: e.opacity } : {}),\n },\n };\n break;\n }\n default:\n console.warn(`weasel insertDep: no factory for kind=\"${kind}\". Skipping insert.`);\n return null;\n }\n break;\n }\n\n return {\n id,\n ops: [createInsertOp({ node: { id, kind: 'leaf', layer, pose, data } as unknown as { id: string }, label: `Insert ${kind}` })],\n };\n };\n return {\n layer: () => layer,\n build,\n commit(bounds, extras): NodeId | null {\n const built = build(bounds, extras);\n if (built === null) return null;\n ad.applyOps(built.ops, `Insert ${extras.kind}`);\n return built.id;\n },\n };\n });\n}\n"],"mappings":"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"}
1
+ {"version":3,"file":"insert.js","names":["e","paintKeys","fill","stroke","withFillRule","path","data","rule","paletteInsertPaint","color","cycleFill","seq","kind","strokeOf","solid","useInsertDepSource","sceneRef","useLatest","scene","adapterRef","adapter","factoriesRef","factories","paintRef","paint","insertSeqRef","useRef","liveRef","useDepSource","sc","ad","layer","build","extras","id","asked","painted","as","extent","insertPreviewExtent","pose","factory","built","bounds","createInsertOp","geom","linePath","regularPolygonPath","starPath","samples","schneiderFit","polygonFromPoints","rectPath","ellipsePath"],"sources":["../../../src/canvas/deps/insert.ts"],"sourcesContent":["/**\n * `useInsertDepSource` — wires the `insert` dep consumed by `insertAction`.\n *\n * `line`, `polygon`, `star`, and `pencil` receive the drag AABB from the insertAction invoker,\n * but `extras` may carry richer geometry (endpoints, center+radius+rotation, point trail).\n * `insertPreviewExtent` resolves the two into the node's real extent — the same resolution the\n * live preview and the reported gesture bounds use.\n */\nimport { useRef } from 'react';\nimport { useDepSource } from '@weasel-js/routing/react';\nimport { useLatest } from '@weasel-js/react';\nimport type { InsertDep, InsertExtras, InsertLive } from 'interactions/actions/depSchema';\nimport type { Scene, NodeId } from 'core/scene/types';\nimport type { Op } from 'core/ops/types';\nimport { createInsertOp } from 'core/ops/create';\nimport {\n rectPath,\n ellipsePath,\n regularPolygonPath,\n starPath,\n linePath,\n polygonFromPoints,\n schneiderFit,\n type PathFillRule,\n type PolygonPath,\n} from '@weasel-js/geom';\nimport { insertPreviewExtent } from '../insertPreviewExtent';\nimport type { Stroke, Fill } from '@weasel-js/paint';\nimport { cycleFill, solid, strokeOf } from '../../util/paint';\n\ninterface OpsApplier {\n applyOps(ops: Op[], label?: string): void;\n}\n\n/**\n * Consumer-supplied node factory for one insert `kind`. Given the drag AABB\n * and the tool's `extras`, returns the node's `data` (in the consumer's own\n * data shape) plus an optional `pose` override — the dep supplies id, layer,\n * and the undoable insert op. Return `null` to reject the insert.\n *\n * A factory registered for a kit kind (`rect`, `line`, …) fully replaces the\n * kit's default `{ path, fill }` factory for that kind; a factory for a novel\n * kind adds support the kit doesn't ship (e.g. `text`). To change only the\n * paint of a kit shape, pass an {@link InsertPaint}. See\n * `SceneCanvas`'s `insertNodeFactories` prop.\n */\nexport type InsertNodeFactory = (\n bounds: { x: number; y: number; width: number; height: number },\n extras: InsertExtras,\n) => { data: unknown; pose?: unknown } | null;\n\n/**\n * The paint a kit-built shape is inserted with. `kind` is the shape being\n * built and `seq` counts this canvas's inserts from 1. A key left out stays\n * off the node, so its painter's default applies; `null` is \"none\". A pencil\n * trail too short to fit is built as a rect and asks as one. A line and an\n * open pen path are inserted unfilled: a fill given to either is dropped.\n * `fillRule` is the rule a path that carries one is built with, where the\n * kit's own is nonzero; a rect or an ellipse has none to set.\n *\n * It paints only the shapes the kit builds: an `InsertNodeFactory` owns its\n * node's whole `data`. See `SceneCanvas`'s `insertPaint` prop.\n */\nexport type InsertPaint = (kind: string, seq: number) => {\n fill?: Fill | null;\n stroke?: Stroke | null;\n fillRule?: PathFillRule;\n};\n\nfunction paintKeys({ fill, stroke }: ReturnType<InsertPaint>): { fill?: Fill | null; stroke?: Stroke | null } {\n return { ...(fill !== undefined ? { fill } : {}), ...(stroke !== undefined ? { stroke } : {}) };\n}\n\nfunction withFillRule(data: unknown, rule: PathFillRule | undefined): unknown {\n const path = (data as { path?: object } | undefined)?.path;\n if (rule === undefined || path === undefined || !('fillRule' in path)) return data;\n return { ...(data as object), path: { ...path, fillRule: rule } };\n}\n\n/** The default {@link InsertPaint}: the next color of the kit palette, as a\n * fill on a closed shape, a fill and a stroke on a pen path, and a stroke\n * alone on a line or a pencil trail. */\nexport const paletteInsertPaint: InsertPaint = (kind, seq) => {\n const color = cycleFill(seq);\n if (kind === 'line' || kind === 'pencil') return { stroke: strokeOf(color, 2) };\n if (kind === 'path') return { fill: { paint: solid(color) }, stroke: strokeOf(color, 2) };\n return { fill: { paint: solid(color) } };\n};\n\nexport function useInsertDepSource(\n scene: Scene<unknown, string, unknown>,\n adapter: OpsApplier,\n factories?: Record<string, InsertNodeFactory>,\n paint: InsertPaint = paletteInsertPaint,\n): void {\n const sceneRef = useLatest(scene);\n const adapterRef = useLatest(adapter);\n const factoriesRef = useLatest(factories);\n const paintRef = useLatest(paint);\n const insertSeqRef = useRef(0);\n const liveRef = useRef<InsertLive>({ gesture: null });\n useDepSource('insertLive', () => liveRef.current);\n\n useDepSource('insert', (): InsertDep => {\n const sc = sceneRef.current;\n const ad = adapterRef.current;\n\n const layer = (sc.layers[0]?.id ?? 'default') as string;\n const build = (\n bounds: { x: number; y: number; width: number; height: number },\n extras: InsertExtras,\n ): { id: NodeId; ops: Op[] } | null => {\n const kind = extras.kind;\n const seq = ++insertSeqRef.current;\n const id = sc.mintId();\n let asked: ReturnType<InsertPaint> | undefined;\n const painted = (as: string = kind) => paintKeys(asked = paintRef.current(as, seq));\n\n // The nascent node's extent — drag AABB reconciled with whatever\n // richer geometry `extras` carries.\n const extent = insertPreviewExtent({ shape: kind, bounds, extras });\n const pose: unknown = extent.bounds;\n\n // Consumer factory wins over the kit default for this kind. It owns the node's\n // data + optional pose; the dep still supplies id/layer/op.\n const factory = factoriesRef.current?.[kind];\n if (factory) {\n const built = factory(bounds, extras);\n if (built === null) return null;\n return {\n id,\n ops: [createInsertOp({ node: { id, kind: 'leaf', layer, pose: built.pose ?? pose, data: built.data } as unknown as { id: string }, label: `Insert ${kind}` })],\n };\n }\n\n const geom = extent.geometry;\n let data: unknown;\n\n switch (geom.kind) {\n case 'line':\n data = { path: linePath(geom.a, geom.b), ...painted(), fill: null };\n break;\n case 'polygon':\n data = {\n path: regularPolygonPath(geom.center, geom.radius, geom.sides, geom.rotation),\n ...painted(),\n };\n break;\n case 'star':\n data = {\n path: starPath(geom.center, geom.outerRadius, geom.points, geom.innerRadius, geom.rotation),\n ...painted(),\n };\n break;\n case 'pencil': {\n const samples = geom.samples as { x: number; y: number }[];\n if (samples.length >= 4) {\n data = { path: schneiderFit(samples, 2.0), ...painted() };\n } else if (samples.length >= 2) {\n data = { path: polygonFromPoints(samples), ...painted() };\n } else {\n data = { path: rectPath(0, 0, extent.bounds.width, extent.bounds.height), ...painted('rect') };\n }\n break;\n }\n case 'box':\n switch (kind) {\n case 'rect':\n // The rect path lives at the origin and the pose carries position:\n // `pathInPoseFrame` rebases a rect path onto the pose box, so don't\n // double-count the position.\n data = { path: rectPath(0, 0, extent.bounds.width, extent.bounds.height), ...painted() };\n break;\n case 'ellipse':\n data = { path: ellipsePath(extent.bounds), ...painted() };\n break;\n case 'path': {\n const e = extras as { path: PolygonPath; closed: boolean };\n data = { path: e.path, ...painted(), ...(e.closed ? {} : { fill: null }) };\n break;\n }\n case 'text': {\n // The built-in text tool drags an empty text box you then type into, so\n // `extras` carries no content. The kit:text painter matches on\n // `data.text != null` and applies style defaults at render time, so a bare\n // `{ text }` is a complete, editable node.\n const e = extras as Partial<{ text: string }>;\n data = { text: e.text ?? '' };\n break;\n }\n case 'image': {\n // The bitmap is loaded + cached by `imageCache` keyed on `src`;\n // only the (serializable) `src` lives on the node.\n const e = extras as Partial<{ src: string; opacity: number }>;\n data = {\n image: {\n src: e.src ?? '',\n ...(e.opacity !== undefined ? { opacity: e.opacity } : {}),\n },\n };\n break;\n }\n default:\n console.warn(`weasel insertDep: no factory for kind=\"${kind}\". Skipping insert.`);\n return null;\n }\n break;\n }\n\n data = withFillRule(data, asked?.fillRule);\n return {\n id,\n ops: [createInsertOp({ node: { id, kind: 'leaf', layer, pose, data } as unknown as { id: string }, label: `Insert ${kind}` })],\n };\n };\n return {\n layer: () => layer,\n build,\n commit(bounds, extras): NodeId | null {\n const built = build(bounds, extras);\n if (built === null) return null;\n ad.applyOps(built.ops, `Insert ${extras.kind}`);\n return built.id;\n },\n };\n });\n}\n"],"mappings":"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"}
@@ -2,13 +2,13 @@ import { hitTestArea as e, hitTestLassoPolygon as t, regionPickOptions as n } fr
2
2
  import { useLatest as r } from "@weasel-js/react";
3
3
  import { useDepSource as i } from "@weasel-js/routing/react";
4
4
  //#region src/canvas/deps/lassoSelect.ts
5
- function a(a, o, s, c, l) {
6
- let u = r(a), d = r(o), f = r(s), p = r(l);
5
+ function a(a, o, s, c) {
6
+ let l = r(a), u = r(o), d = r(s), f = r(c);
7
7
  i("lassoSelect", () => {
8
- let r = u.current, i = d.current, a = f.current, o = p.current;
8
+ let r = l.current, i = u.current, a = d.current, o = f.current;
9
9
  return {
10
- hitTestLasso: (e, i, s) => t(r, e, i, n(s, o, c), a),
11
- hitTestArea: (t, i) => e(r, t, n(i, o, c), a),
10
+ hitTestLasso: (e, i, s) => t(r, e, i, n(s, o), a),
11
+ hitTestArea: (t, i) => e(r, t, n(i, o), a),
12
12
  getSelection: () => i.current,
13
13
  setSelection: (e) => i.set(e)
14
14
  };
@@ -1 +1 @@
1
- {"version":3,"file":"lassoSelect.js","names":["hitTestAreaShared","useLassoSelectDepSource","sceneRef","useLatest","scene","selectionRef","selection","descriptorRef","descriptor","alphaOfRef","alphaOf","sc","s","d","a","hitTestLassoPolygon","polygon","mode","regionPickOptions","view","poseComposition","hitTestArea","bounds","ids"],"sources":["../../../src/canvas/deps/lassoSelect.ts"],"sourcesContent":["/**\n * `useLassoSelectDepSource` — wires the `lassoSelect` dep consumed by\n * `lassoSelectAction`: `hitTestLasso` tests the lasso polygon itself, and\n * `hitTestArea` is the same silhouette-aware rect test `areaSelect` uses.\n */\nimport { useDepSource } from '@weasel-js/routing/react';\nimport { useLatest } from '@weasel-js/react';\nimport type { LassoSelectDep } from 'interactions/actions/depSchema';\nimport type { Scene, NodeId } from 'core/scene/types';\nimport type { SelectionApi } from 'core/selection/useSelection';\nimport type { PoseDescriptor } from 'interactions/actions/resize/geometry';\nimport { hitTestArea as hitTestAreaShared, hitTestLassoPolygon, regionPickOptions } from './hitTestArea';\nimport type { PoseComposition } from 'features/groups/composePose';\n\nexport function useLassoSelectDepSource(\n scene: Scene<unknown, string, unknown>,\n selection: SelectionApi,\n descriptor?: PoseDescriptor<unknown>,\n poseComposition?: PoseComposition<unknown>,\n /** The painted alpha the surface's layers apply, which every view shares. */\n alphaOf?: (id: string) => number,\n): void {\n const sceneRef = useLatest(scene);\n const selectionRef = useLatest(selection);\n const descriptorRef = useLatest(descriptor);\n const alphaOfRef = useLatest(alphaOf);\n\n useDepSource('lassoSelect', (): LassoSelectDep => {\n const sc = sceneRef.current;\n const s = selectionRef.current;\n const d = descriptorRef.current;\n const a = alphaOfRef.current;\n return {\n hitTestLasso: (polygon, mode, view) =>\n hitTestLassoPolygon(sc, polygon, mode, regionPickOptions(view, a, poseComposition), d),\n hitTestArea: (bounds, view) =>\n hitTestAreaShared(sc, bounds, regionPickOptions(view, a, poseComposition), d),\n getSelection: () => s.current as NodeId[],\n setSelection: (ids) => s.set(ids as NodeId[]),\n };\n });\n}\n"],"mappings":";;;;AAcA,SAAgBC,EACd,GACA,GACA,GACA,GAEA,GACM;CACN,IAAMC,IAAWC,EAAUC,CAAK,GAC1BC,IAAeF,EAAUG,CAAS,GAClCC,IAAgBJ,EAAUK,CAAU,GACpCC,IAAaN,EAAUO,CAAO;CAEpC,EAAa,qBAAqC;EAChD,IAAMC,IAAKT,EAAS,SACdU,IAAIP,EAAa,SACjBQ,IAAIN,EAAc,SAClBO,IAAIL,EAAW;EACrB,OAAO;GACL,eAAe,GAAS,GAAM,MAC5BM,EAAoBJ,GAAIK,GAASC,GAAMC,EAAkBC,GAAML,GAAGM,CAAe,GAAGP,CAAC;GACvF,cAAc,GAAQ,MACpBb,EAAkBW,GAAIW,GAAQJ,EAAkBC,GAAML,GAAGM,CAAe,GAAGP,CAAC;GAC9E,oBAAoBD,EAAE;GACtB,eAAe,MAAQA,EAAE,IAAIW,CAAe;EAC9C;CACF,CAAC;AACH"}
1
+ {"version":3,"file":"lassoSelect.js","names":["hitTestAreaShared","useLassoSelectDepSource","sceneRef","useLatest","scene","selectionRef","selection","descriptorRef","descriptor","alphaOfRef","alphaOf","sc","s","d","a","hitTestLassoPolygon","polygon","mode","regionPickOptions","view","hitTestArea","bounds","ids"],"sources":["../../../src/canvas/deps/lassoSelect.ts"],"sourcesContent":["/**\n * `useLassoSelectDepSource` — wires the `lassoSelect` dep consumed by\n * `lassoSelectAction`: `hitTestLasso` tests the lasso polygon itself, and\n * `hitTestArea` is the same silhouette-aware rect test `areaSelect` uses.\n */\nimport { useDepSource } from '@weasel-js/routing/react';\nimport { useLatest } from '@weasel-js/react';\nimport type { LassoSelectDep } from 'interactions/actions/depSchema';\nimport type { Scene, NodeId } from 'core/scene/types';\nimport type { SelectionApi } from 'core/selection/useSelection';\nimport type { PoseDescriptor } from 'interactions/actions/resize/geometry';\nimport { hitTestArea as hitTestAreaShared, hitTestLassoPolygon, regionPickOptions } from './hitTestArea';\n\nexport function useLassoSelectDepSource(\n scene: Scene<unknown, string, unknown>,\n selection: SelectionApi,\n descriptor?: PoseDescriptor<unknown>,\n /** The painted alpha the surface's layers apply, which every view shares. */\n alphaOf?: (id: string) => number,\n): void {\n const sceneRef = useLatest(scene);\n const selectionRef = useLatest(selection);\n const descriptorRef = useLatest(descriptor);\n const alphaOfRef = useLatest(alphaOf);\n\n useDepSource('lassoSelect', (): LassoSelectDep => {\n const sc = sceneRef.current;\n const s = selectionRef.current;\n const d = descriptorRef.current;\n const a = alphaOfRef.current;\n return {\n hitTestLasso: (polygon, mode, view) =>\n hitTestLassoPolygon(sc, polygon, mode, regionPickOptions(view, a), d),\n hitTestArea: (bounds, view) =>\n hitTestAreaShared(sc, bounds, regionPickOptions(view, a), d),\n getSelection: () => s.current as NodeId[],\n setSelection: (ids) => s.set(ids as NodeId[]),\n };\n });\n}\n"],"mappings":";;;;AAaA,SAAgBC,EACd,GACA,GACA,GAEA,GACM;CACN,IAAMC,IAAWC,EAAUC,CAAK,GAC1BC,IAAeF,EAAUG,CAAS,GAClCC,IAAgBJ,EAAUK,CAAU,GACpCC,IAAaN,EAAUO,CAAO;CAEpC,EAAa,qBAAqC;EAChD,IAAMC,IAAKT,EAAS,SACdU,IAAIP,EAAa,SACjBQ,IAAIN,EAAc,SAClBO,IAAIL,EAAW;EACrB,OAAO;GACL,eAAe,GAAS,GAAM,MAC5BM,EAAoBJ,GAAIK,GAASC,GAAMC,EAAkBC,GAAML,CAAC,GAAGD,CAAC;GACtE,cAAc,GAAQ,MACpBb,EAAkBW,GAAIU,GAAQH,EAAkBC,GAAML,CAAC,GAAGD,CAAC;GAC7D,oBAAoBD,EAAE;GACtB,eAAe,MAAQA,EAAE,IAAIU,CAAe;EAC9C;CACF,CAAC;AACH"}
@@ -1,4 +1,4 @@
1
- import { AUTO_POSE_DESCRIPTOR as e } from "../../interactions/actions/resize/autoPoseDescriptor.js";
1
+ import { AUTO_POSE_DESCRIPTOR as e } from "../../core/geometry/autoPoseDescriptor.js";
2
2
  import { useLatest as t } from "@weasel-js/react";
3
3
  import { useDepSource as n } from "@weasel-js/routing/react";
4
4
  //#region src/canvas/deps/poseDescriptor.ts
@@ -1 +1 @@
1
- {"version":3,"file":"poseDescriptor.js","names":["usePoseDescriptorDepSource","ref","useLatest","descriptor","AUTO_POSE_DESCRIPTOR"],"sources":["../../../src/canvas/deps/poseDescriptor.ts"],"sourcesContent":["import { useDepSource } from '@weasel-js/routing/react';\nimport { useLatest } from '@weasel-js/react';\nimport type { PoseDescriptor } from 'interactions/actions/resize/geometry';\nimport { AUTO_POSE_DESCRIPTOR } from 'interactions/actions/resize/autoPoseDescriptor';\n\n/** Publish the pose descriptor every built-in action reads. */\nexport function usePoseDescriptorDepSource(\n descriptor: PoseDescriptor<unknown> | undefined,\n): void {\n const ref = useLatest(descriptor);\n useDepSource('poseDescriptor', () => ref.current ?? AUTO_POSE_DESCRIPTOR);\n}\n"],"mappings":";;;;AAMA,SAAgBA,EACd,GACM;CACN,IAAMC,IAAMC,EAAUC,CAAU;CAChC,EAAa,wBAAwBF,EAAI,WAAWG,CAAoB;AAC1E"}
1
+ {"version":3,"file":"poseDescriptor.js","names":["usePoseDescriptorDepSource","ref","useLatest","descriptor","AUTO_POSE_DESCRIPTOR"],"sources":["../../../src/canvas/deps/poseDescriptor.ts"],"sourcesContent":["import { useDepSource } from '@weasel-js/routing/react';\nimport { useLatest } from '@weasel-js/react';\nimport type { PoseDescriptor } from 'interactions/actions/resize/geometry';\nimport { AUTO_POSE_DESCRIPTOR } from 'core/geometry/autoPoseDescriptor';\n\n/** Publish the pose descriptor every built-in action reads. */\nexport function usePoseDescriptorDepSource(\n descriptor: PoseDescriptor<unknown> | undefined,\n): void {\n const ref = useLatest(descriptor);\n useDepSource('poseDescriptor', () => ref.current ?? AUTO_POSE_DESCRIPTOR);\n}\n"],"mappings":";;;;AAMA,SAAgBA,EACd,GACM;CACN,IAAMC,IAAMC,EAAUC,CAAU;CAChC,EAAa,wBAAwBF,EAAI,WAAWG,CAAoB;AAC1E"}
@@ -1 +1 @@
1
- {"version":3,"file":"resizePolicy.js","names":["IDENTITY_EXPAND","ids","EMPTY","useResizePolicy","optsRef","useLatest","options","o","DEFAULT_RESIZE_BEHAVIORS","resizePolicyOptions"],"sources":["../../../src/canvas/deps/resizePolicy.ts"],"sourcesContent":["/**\n * `useResizePolicy` — wires the `resizePolicy` dep consumed\n * by `resizeAction`.\n *\n * - `constraints` — bounds-frame constraints (e.g. `lockAspectWithModifier`).\n * - `pointSnap` — world-space anchor-point snap behaviors.\n * - `expandIds` — group-expansion at gesture start.\n * - `label`, `transient`, `onGestureStart`, `onGestureEnd` — the commit's\n * history label and recording, and the gesture's lifecycle callbacks.\n *\n * Every field is optional; omitted fields fall back to kit defaults\n * (`DEFAULT_RESIZE_BEHAVIORS` — shift = aspect lock; pass `[]` to disable —\n * then `[]`, `ids => ids`).\n *\n * Built once per render and stabilised by `useDepSource` (which reads via a\n * ref internally), so callers can pass fresh closures without triggering\n * re-registration.\n *\n * @see ResizePolicy — the dep schema entry.\n */\nimport { useDepSource } from '@weasel-js/routing/react';\nimport { useLatest } from '@weasel-js/react';\nimport type { ResizePolicy } from 'interactions/actions/depSchema';\nimport type {\n PointSnapBehavior,\n BoundsConstraint,\n} from 'interactions/gestures/types';\nimport type { Bounds } from 'core/viewport/fitViewToBounds';\nimport { DEFAULT_RESIZE_BEHAVIORS } from 'interactions/actions/resize/behaviors';\nimport type { GestureLifecycleOptions } from 'interactions/actions/gestureLifecycle';\nimport type { UseResizeOptions } from 'interactions/actions/resize/options';\n\n/** Options for `useResizePolicy`. Each omitted field falls back to the kit\n * default. */\nexport interface UseResizePolicyOptions<TPose> extends GestureLifecycleOptions {\n constraints?: TPose extends Bounds ? BoundsConstraint<TPose>[] : never[];\n pointSnap?: TPose extends Bounds ? PointSnapBehavior<TPose>[] : never[];\n expandIds?: (ids: string[]) => string[];\n}\n\nconst IDENTITY_EXPAND = (ids: string[]) => ids;\nconst EMPTY: readonly unknown[] = Object.freeze([]);\n\n/** Publish how resizing should behave — constraints, point snapping, group\n * expansion — for the resize action to consult. */\nexport function useResizePolicy<TPose>(\n options: UseResizePolicyOptions<TPose>,\n): void {\n const optsRef = useLatest(options);\n\n useDepSource('resizePolicy', (): ResizePolicy<unknown> => {\n const o = optsRef.current;\n return {\n label: o.label,\n transient: o.transient,\n onGestureStart: o.onGestureStart,\n onGestureEnd: o.onGestureEnd,\n constraints: (o.constraints ?? DEFAULT_RESIZE_BEHAVIORS) as ResizePolicy<unknown>['constraints'],\n pointSnap: (o.pointSnap ?? (EMPTY as unknown[])) as ResizePolicy<unknown>['pointSnap'],\n expandIds: o.expandIds ?? IDENTITY_EXPAND,\n };\n });\n}\n\n/** `<SceneCanvas selectTool.resize>` as {@link useResizePolicy} options.\n * `resizable` is read by `<SceneCanvas>` itself. */\nexport function resizePolicyOptions<TPose>(o: UseResizeOptions<TPose>): UseResizePolicyOptions<TPose> {\n return {\n constraints: o.behaviors as UseResizePolicyOptions<TPose>['constraints'],\n pointSnap: o.pointSnapBehaviors as UseResizePolicyOptions<TPose>['pointSnap'],\n expandIds: o.expandIds,\n label: o.resizeLabel,\n transient: o.transient,\n onGestureStart: o.onGestureStart,\n onGestureEnd: o.onGestureEnd,\n };\n}\n"],"mappings":";;;;AAwCA,IAAMA,KAAmB,MAAkBC,GACrCC,IAA4B,OAAO,OAAO,CAAC,CAAC;AAIlD,SAAgBC,EACd,GACM;CACN,IAAMC,IAAUC,EAAUC,CAAO;CAEjC,EAAa,sBAA6C;EACxD,IAAMC,IAAIH,EAAQ;EAClB,OAAO;GACL,OAAOG,EAAE;GACT,WAAWA,EAAE;GACb,gBAAgBA,EAAE;GAClB,cAAcA,EAAE;GAChB,aAAcA,EAAE,eAAeC;GAC/B,WAAYD,EAAE,aAAcL;GAC5B,WAAWK,EAAE,aAAaP;EAC5B;CACF,CAAC;AACH;AAIA,SAAgBS,EAA2B,GAA2D;CACpG,OAAO;EACL,aAAaF,EAAE;EACf,WAAWA,EAAE;EACb,WAAWA,EAAE;EACb,OAAOA,EAAE;EACT,WAAWA,EAAE;EACb,gBAAgBA,EAAE;EAClB,cAAcA,EAAE;CAClB;AACF"}
1
+ {"version":3,"file":"resizePolicy.js","names":["IDENTITY_EXPAND","ids","EMPTY","useResizePolicy","optsRef","useLatest","options","o","DEFAULT_RESIZE_BEHAVIORS","resizePolicyOptions"],"sources":["../../../src/canvas/deps/resizePolicy.ts"],"sourcesContent":["/**\n * Wires the `resizePolicy` dep consumed by `resizeAction`. Omitted\n * `constraints` default to `DEFAULT_RESIZE_BEHAVIORS` (shift = aspect lock);\n * pass `[]` to disable.\n */\nimport { useDepSource } from '@weasel-js/routing/react';\nimport { useLatest } from '@weasel-js/react';\nimport type { ResizePolicy } from 'interactions/actions/depSchema';\nimport type {\n PointSnapBehavior,\n BoundsConstraint,\n} from 'interactions/gestures/types';\nimport type { Bounds } from 'core/viewport/fitViewToBounds';\nimport { DEFAULT_RESIZE_BEHAVIORS } from 'interactions/actions/resize/behaviors';\nimport type { GestureLifecycleOptions } from 'interactions/actions/gestureLifecycle';\nimport type { UseResizeOptions } from 'interactions/actions/resize/options';\n\n/** Options for `useResizePolicy`. Each omitted field falls back to the kit\n * default. */\nexport interface UseResizePolicyOptions<TPose> extends GestureLifecycleOptions {\n constraints?: TPose extends Bounds ? BoundsConstraint<TPose>[] : never[];\n pointSnap?: TPose extends Bounds ? PointSnapBehavior<TPose>[] : never[];\n expandIds?: (ids: string[]) => string[];\n}\n\nconst IDENTITY_EXPAND = (ids: string[]) => ids;\nconst EMPTY: readonly unknown[] = Object.freeze([]);\n\n/** Publish how resizing should behave — constraints, point snapping, group\n * expansion — for the resize action to consult. */\nexport function useResizePolicy<TPose>(\n options: UseResizePolicyOptions<TPose>,\n): void {\n const optsRef = useLatest(options);\n\n useDepSource('resizePolicy', (): ResizePolicy<unknown> => {\n const o = optsRef.current;\n return {\n label: o.label,\n transient: o.transient,\n onGestureStart: o.onGestureStart,\n onGestureEnd: o.onGestureEnd,\n constraints: (o.constraints ?? DEFAULT_RESIZE_BEHAVIORS) as ResizePolicy<unknown>['constraints'],\n pointSnap: (o.pointSnap ?? (EMPTY as unknown[])) as ResizePolicy<unknown>['pointSnap'],\n expandIds: o.expandIds ?? IDENTITY_EXPAND,\n };\n });\n}\n\n/** `<SceneCanvas selectTool.resize>` as {@link useResizePolicy} options.\n * `resizable` is read by `<SceneCanvas>` itself. */\nexport function resizePolicyOptions<TPose>(o: UseResizeOptions<TPose>): UseResizePolicyOptions<TPose> {\n return {\n constraints: o.behaviors as UseResizePolicyOptions<TPose>['constraints'],\n pointSnap: o.pointSnapBehaviors as UseResizePolicyOptions<TPose>['pointSnap'],\n expandIds: o.expandIds,\n label: o.resizeLabel,\n transient: o.transient,\n onGestureStart: o.onGestureStart,\n onGestureEnd: o.onGestureEnd,\n };\n}\n"],"mappings":";;;;AAyBA,IAAMA,KAAmB,MAAkBC,GACrCC,IAA4B,OAAO,OAAO,CAAC,CAAC;AAIlD,SAAgBC,EACd,GACM;CACN,IAAMC,IAAUC,EAAUC,CAAO;CAEjC,EAAa,sBAA6C;EACxD,IAAMC,IAAIH,EAAQ;EAClB,OAAO;GACL,OAAOG,EAAE;GACT,WAAWA,EAAE;GACb,gBAAgBA,EAAE;GAClB,cAAcA,EAAE;GAChB,aAAcA,EAAE,eAAeC;GAC/B,WAAYD,EAAE,aAAcL;GAC5B,WAAWK,EAAE,aAAaP;EAC5B;CACF,CAAC;AACH;AAIA,SAAgBS,EAA2B,GAA2D;CACpG,OAAO;EACL,aAAaF,EAAE;EACf,WAAWA,EAAE;EACb,WAAWA,EAAE;EACb,OAAOA,EAAE;EACT,WAAWA,EAAE;EACb,gBAAgBA,EAAE;EAClB,cAAcA,EAAE;CAClB;AACF"}
@@ -1,9 +1,8 @@
1
- import { poseLinearOf as e } from "../../core/geometry/poseFrame.js";
2
- import { poseDescriptorForNode as t } from "../../core/geometry/poseDescriptor.js";
3
- import { AUTO_POSE_DESCRIPTOR as n } from "../../interactions/actions/resize/autoPoseDescriptor.js";
4
- import { pathInWorld as r, worldEditToStorage as i } from "../../features/paths/pathInWorld.js";
5
- import { scenePoseFrame as a } from "../../interactions/actions/poseFrame.js";
6
- import { computeSliceOps as o } from "../../interactions/actions/defaults/sliceOps.js";
1
+ import { poseDescriptorForNode as e } from "../../core/geometry/poseDescriptor.js";
2
+ import { AUTO_POSE_DESCRIPTOR as t } from "../../core/geometry/autoPoseDescriptor.js";
3
+ import { scenePoseFrame as n } from "../../interactions/actions/poseFrame.js";
4
+ import { computeSliceOps as r } from "../../interactions/actions/defaults/sliceOps.js";
5
+ import { pathInWorld as i, poseLinearOf as a, worldEditToStorage as o } from "@weasel-js/geom";
7
6
  import { useLatest as s } from "@weasel-js/react";
8
7
  import { useDepSource as c } from "@weasel-js/routing/react";
9
8
  //#region src/canvas/deps/slice.ts
@@ -11,25 +10,25 @@ function l(e) {
11
10
  let t = s(e);
12
11
  c("slice", () => t.current);
13
12
  }
14
- function u(e, i, l, u, h) {
15
- let g = s(e), _ = s(i), v = s(l), y = s(u), b = s(h);
16
- c("slice", () => ({ commit(e) {
17
- let i = g.current, s = a(i, y.current), c = b.current ?? n, l = [], u = /* @__PURE__ */ new Map();
18
- for (let e of i.renderOrderNodes()) {
19
- let n = p(i, e);
13
+ function u(a, o, l, u) {
14
+ let h = s(a), g = s(o), _ = s(l), v = s(u);
15
+ c("slice", () => ({ commit(a) {
16
+ let o = h.current, s = n(o), c = v.current ?? t, l = [], u = /* @__PURE__ */ new Map();
17
+ for (let t of o.renderOrderNodes()) {
18
+ let n = p(o, t);
20
19
  if (!n) continue;
21
- let a = d(t(c, e), s.world(e.id));
22
- a && (u.set(e.id, a), l.push({
23
- node: e,
24
- index: m(i, e),
25
- worldPath: r(n, a.box)
20
+ let r = d(e(c, t), s.world(t.id));
21
+ r && (u.set(t.id, r), l.push({
22
+ node: t,
23
+ index: m(o, t),
24
+ worldPath: i(n, r.box)
26
25
  }));
27
26
  }
28
- let h = _.current, { ops: x, nextSelection: S } = o({
27
+ let y = g.current, { ops: b, nextSelection: x } = r({
29
28
  leaves: l,
30
- cut: e,
31
- nextId: () => i.mintId(),
32
- selection: h.get(),
29
+ cut: a,
30
+ nextId: () => o.mintId(),
31
+ selection: y.get(),
33
32
  placePiece: (e, t) => {
34
33
  let n = f(u.get(e.node.id), t);
35
34
  return {
@@ -38,51 +37,51 @@ function u(e, i, l, u, h) {
38
37
  };
39
38
  }
40
39
  });
41
- x.length !== 0 && (v.current.applyOps(x, "Slice"), S && h.set(S));
40
+ b.length !== 0 && (_.current.applyOps(b, "Slice"), x && y.set(x));
42
41
  } }));
43
42
  }
44
- function d(t, n) {
45
- let r = t.getBounds(n);
46
- if (!r || ![
47
- r.x,
48
- r.y,
49
- r.width,
50
- r.height
43
+ function d(e, t) {
44
+ let n = e.getBounds(t);
45
+ if (!n || ![
46
+ n.x,
47
+ n.y,
48
+ n.width,
49
+ n.height
51
50
  ].every(Number.isFinite)) return null;
52
- let i = t.getRotation?.(n) ?? 0, a = e(n) ?? void 0;
51
+ let r = e.getRotation?.(t) ?? 0, i = a(t) ?? void 0;
53
52
  return {
54
- world: n,
55
- g: t,
53
+ world: t,
54
+ g: e,
56
55
  box: {
57
- x: r.x,
58
- y: r.y,
59
- width: r.width,
60
- height: r.height,
61
- rotation: i,
62
- transform: a
56
+ x: n.x,
57
+ y: n.y,
58
+ width: n.width,
59
+ height: n.height,
60
+ rotation: r,
61
+ transform: i
63
62
  }
64
63
  };
65
64
  }
66
65
  function f({ world: e, g: t, box: n }, r) {
67
- let a = !!t.withRotation && t.supportsRotation?.(e) !== !1, o = n.rotation ?? 0;
68
- if (o !== 0 && !a) {
69
- let a = i({
66
+ let i = !!t.withRotation && t.supportsRotation?.(e) !== !1, a = n.rotation ?? 0;
67
+ if (a !== 0 && !i) {
68
+ let i = o({
70
69
  ...n,
71
70
  rotation: 0
72
71
  }, r);
73
72
  return {
74
- pose: t.fromBounds(a.pose, e),
75
- path: a.path
73
+ pose: t.fromBounds(i.pose, e),
74
+ path: i.path
76
75
  };
77
76
  }
78
- let { pose: s, path: c } = i(n, r), l = {
77
+ let { pose: s, path: c } = o(n, r), l = {
79
78
  x: s.x,
80
79
  y: s.y,
81
80
  width: s.width,
82
81
  height: s.height
83
82
  }, u = t.remapBounds(e, t.getBounds(e), l);
84
83
  return {
85
- pose: o === 0 ? u : t.withRotation(u, o),
84
+ pose: a === 0 ? u : t.withRotation(u, a),
86
85
  path: c
87
86
  };
88
87
  }
@@ -1 +1 @@
1
- {"version":3,"file":"slice.js","names":["useSliceDep","depRef","useLatest","dep","useSliceDepSource","sceneRef","scene","selectionRef","selection","adapterRef","adapter","compositionRef","poseComposition","descriptorRef","poseDescriptor","sc","frame","scenePoseFrame","descriptor","AUTO_POSE_DESCRIPTOR","leaves","drawnAt","node","path","sliceablePath","drawn","drawnPose","poseDescriptorForNode","siblingIndex","pathInWorld","sel","computeSliceOps","stored","storePiece","leaf","piece","ops","nextSelection","b","g","world","rotation","transform","poseLinearOf","keepsRotation","box","baked","worldEditToStorage","dst","pose"],"sources":["../../../src/canvas/deps/slice.ts"],"sourcesContent":["/**\n * The `slice` dep `sliceAction` and `useSliceTool` commit their cuts through.\n *\n * `<SceneCanvas>` publishes `useSliceDepSource` over its own scene. A consumer\n * replaces it with `useSliceDep` (or `useDepSource('slice', …)`) from under\n * the canvas; the newest registration wins, and a canvas child registers\n * after the canvas's own.\n */\nimport { useDepSource } from '@weasel-js/routing/react';\nimport { useLatest } from '@weasel-js/react';\nimport type { SliceDep } from 'interactions/actions/depSchema';\nimport type { Scene, NodeId, Node } from 'core/scene/types';\nimport type { SelectionApi } from 'core/selection/useSelection';\nimport type { Op } from 'core/ops/types';\nimport type { Path } from '@weasel-js/geom';\nimport { AUTO_POSE_DESCRIPTOR } from 'interactions/actions/resize/autoPoseDescriptor';\nimport { poseDescriptorForNode, type PoseDescriptor } from 'core/geometry/poseDescriptor';\nimport { pathInWorld, worldEditToStorage, type PathInWorldPose } from 'features/paths/pathInWorld';\nimport { poseLinearOf } from 'core/geometry/poseFrame';\nimport { scenePoseFrame } from 'interactions/actions/poseFrame';\nimport { computeSliceOps, type SliceLeaf } from 'interactions/actions/defaults/sliceOps';\nimport type { PoseComposition } from 'features/groups/composePose';\n\n/** Publish how a slice (knife cut) is performed, so the `slice` action can\n * run against the consumer's geometry. */\nexport function useSliceDep(dep: SliceDep): void {\n const depRef = useLatest(dep);\n\n useDepSource('slice', (): SliceDep => depRef.current);\n}\n\ninterface OpsApplier {\n applyOps(ops: Op[], label?: string): void;\n}\n\n/**\n * The kit `slice` dep: cut every leaf the cut crosses and swap it for its\n * pieces in one undoable batch.\n *\n * A leaf is cut when its `data.path` is a `Path` and `poseDescriptor` can read\n * its world pose as a box and a rotation; a leaf on a locked layer, or one\n * whose geometry derives from other nodes, is passed over. Each path is drawn\n * into world space the way the renderer draws it, so a child is cut where it\n * appears, and each piece is mapped back into the source's frame: it keeps the\n * source's rotation in its pose when the descriptor can write one\n * (`withRotation`), and has the rotation baked into its path otherwise. The\n * piece's pose is then stored in its parent's frame through `poseComposition`.\n * The pieces of a selected leaf take its place in the selection.\n */\nexport function useSliceDepSource(\n scene: Scene<unknown, string, unknown>,\n selection: SelectionApi,\n adapter: OpsApplier,\n poseComposition?: PoseComposition<unknown>,\n poseDescriptor?: PoseDescriptor<unknown>,\n): void {\n const sceneRef = useLatest(scene);\n const selectionRef = useLatest(selection);\n const adapterRef = useLatest(adapter);\n const compositionRef = useLatest(poseComposition);\n const descriptorRef = useLatest(poseDescriptor);\n\n useDepSource('slice', (): SliceDep => ({\n commit(cut) {\n const sc = sceneRef.current;\n const frame = scenePoseFrame(sc, compositionRef.current);\n const descriptor = descriptorRef.current ?? AUTO_POSE_DESCRIPTOR;\n const leaves: SliceLeaf<Node<unknown, string, unknown>>[] = [];\n const drawnAt = new Map<string, DrawnPose>();\n for (const node of sc.renderOrderNodes()) {\n const path = sliceablePath(sc, node);\n if (!path) continue;\n const drawn = drawnPose(poseDescriptorForNode(descriptor, node), frame.world(node.id));\n if (!drawn) continue;\n drawnAt.set(node.id, drawn);\n leaves.push({ node, index: siblingIndex(sc, node), worldPath: pathInWorld(path, drawn.box) });\n }\n\n const sel = selectionRef.current;\n const { ops, nextSelection } = computeSliceOps({\n leaves,\n cut,\n nextId: () => sc.mintId(),\n selection: sel.get(),\n placePiece: (leaf, piece) => {\n const stored = storePiece(drawnAt.get(leaf.node.id)!, piece);\n return { pose: frame.local(leaf.node.id, stored.pose), path: stored.path };\n },\n });\n if (ops.length === 0) return;\n adapterRef.current.applyOps(ops, 'Slice');\n if (nextSelection) sel.set(nextSelection as NodeId[]);\n },\n }));\n}\n\n/** A leaf's world pose, and the box, rotation, and transform its path is drawn through. */\ninterface DrawnPose {\n world: unknown;\n g: PoseDescriptor<unknown>;\n box: PathInWorldPose;\n}\n\nfunction drawnPose(g: PoseDescriptor<unknown>, world: unknown): DrawnPose | null {\n const b = g.getBounds(world);\n if (!b || ![b.x, b.y, b.width, b.height].every(Number.isFinite)) return null;\n const rotation = g.getRotation?.(world) ?? 0;\n const transform = poseLinearOf(world) ?? undefined;\n return { world, g, box: { x: b.x, y: b.y, width: b.width, height: b.height, rotation, transform } };\n}\n\n/** A world-space piece as a world pose of the source's kind plus the path it draws. */\nfunction storePiece({ world, g, box }: DrawnPose, piece: Path): { pose: unknown; path: Path } {\n const keepsRotation = !!g.withRotation && g.supportsRotation?.(world) !== false;\n const rotation = box.rotation ?? 0;\n if (rotation !== 0 && !keepsRotation) {\n const baked = worldEditToStorage({ ...box, rotation: 0 }, piece);\n return { pose: g.fromBounds(baked.pose, world), path: baked.path };\n }\n const { pose: b, path } = worldEditToStorage(box, piece);\n const dst = { x: b.x, y: b.y, width: b.width, height: b.height };\n const pose = g.remapBounds(world, g.getBounds(world), dst);\n return { pose: rotation !== 0 ? g.withRotation!(pose, rotation) : pose, path };\n}\n\nfunction sliceablePath(scene: Scene<unknown, string, unknown>, node: Node<unknown, string, unknown>): Path | null {\n if (node.kind !== 'leaf' || node.derivePath || node.derivePose) return null;\n if (scene.isLocked(node.id)) return null;\n const path = (node.data as { path?: unknown } | null)?.path as Path | undefined;\n return path && (path.kind === 'rect' || path.kind === 'polygon') ? path : null;\n}\n\nfunction siblingIndex(scene: Scene<unknown, string, unknown>, node: Node<unknown, string, unknown>): number {\n const siblings = node.parent == null ? scene.roots : scene.childrenOf(node.parent);\n return siblings.indexOf(node.id);\n}\n"],"mappings":"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"}
1
+ {"version":3,"file":"slice.js","names":["useSliceDep","depRef","useLatest","dep","useSliceDepSource","sceneRef","scene","selectionRef","selection","adapterRef","adapter","descriptorRef","poseDescriptor","sc","frame","scenePoseFrame","descriptor","AUTO_POSE_DESCRIPTOR","leaves","drawnAt","node","path","sliceablePath","drawn","drawnPose","poseDescriptorForNode","siblingIndex","pathInWorld","sel","computeSliceOps","stored","storePiece","leaf","piece","ops","nextSelection","b","g","world","rotation","transform","poseLinearOf","keepsRotation","box","baked","worldEditToStorage","dst","pose"],"sources":["../../../src/canvas/deps/slice.ts"],"sourcesContent":["/**\n * The `slice` dep `sliceAction` and `useSliceTool` commit their cuts through.\n *\n * `<SceneCanvas>` publishes `useSliceDepSource` over its own scene. A consumer\n * replaces it with `useSliceDep` (or `useDepSource('slice', …)`) from under\n * the canvas; the newest registration wins, and a canvas child registers\n * after the canvas's own.\n */\nimport { useDepSource } from '@weasel-js/routing/react';\nimport { useLatest } from '@weasel-js/react';\nimport type { SliceDep } from 'interactions/actions/depSchema';\nimport type { Scene, NodeId, Node } from 'core/scene/types';\nimport type { SelectionApi } from 'core/selection/useSelection';\nimport type { Op } from 'core/ops/types';\nimport type { Path } from '@weasel-js/geom';\nimport { AUTO_POSE_DESCRIPTOR } from 'core/geometry/autoPoseDescriptor';\nimport { poseDescriptorForNode, type PoseDescriptor } from 'core/geometry/poseDescriptor';\nimport { pathInWorld, worldEditToStorage, type PathInWorldPose } from '@weasel-js/geom';\nimport { poseLinearOf } from '@weasel-js/geom';\nimport { scenePoseFrame } from 'interactions/actions/poseFrame';\nimport { computeSliceOps, type SliceLeaf } from 'interactions/actions/defaults/sliceOps';\n\n/** Publish how a slice (knife cut) is performed, so the `slice` action can\n * run against the consumer's geometry. */\nexport function useSliceDep(dep: SliceDep): void {\n const depRef = useLatest(dep);\n\n useDepSource('slice', (): SliceDep => depRef.current);\n}\n\n/** What the `slice` dep writes its batch through. An adapter satisfies it. */\nexport interface OpsApplier {\n applyOps(ops: Op[], label?: string): void;\n}\n\n/**\n * The kit `slice` dep: cut every leaf the cut crosses and swap it for its\n * pieces in one undoable batch.\n *\n * A leaf is cut when its `data.path` is a `Path` and `poseDescriptor` can read\n * its world pose as a box and a rotation; a leaf on a locked layer, or one\n * whose geometry derives from other nodes, is passed over. A piece keeps the\n * source's rotation in its pose when the descriptor can write one\n * (`withRotation`), and has the rotation baked into its path otherwise. The\n * pieces of a selected leaf take its place in the selection.\n */\nexport function useSliceDepSource(\n scene: Scene<unknown, string, unknown>,\n selection: SelectionApi,\n adapter: OpsApplier,\n poseDescriptor?: PoseDescriptor<unknown>,\n): void {\n const sceneRef = useLatest(scene);\n const selectionRef = useLatest(selection);\n const adapterRef = useLatest(adapter);\n const descriptorRef = useLatest(poseDescriptor);\n\n useDepSource('slice', (): SliceDep => ({\n commit(cut) {\n const sc = sceneRef.current;\n const frame = scenePoseFrame(sc);\n const descriptor = descriptorRef.current ?? AUTO_POSE_DESCRIPTOR;\n const leaves: SliceLeaf<Node<unknown, string, unknown>>[] = [];\n const drawnAt = new Map<string, DrawnPose>();\n for (const node of sc.renderOrderNodes()) {\n const path = sliceablePath(sc, node);\n if (!path) continue;\n const drawn = drawnPose(poseDescriptorForNode(descriptor, node), frame.world(node.id));\n if (!drawn) continue;\n drawnAt.set(node.id, drawn);\n leaves.push({ node, index: siblingIndex(sc, node), worldPath: pathInWorld(path, drawn.box) });\n }\n\n const sel = selectionRef.current;\n const { ops, nextSelection } = computeSliceOps({\n leaves,\n cut,\n nextId: () => sc.mintId(),\n selection: sel.get(),\n placePiece: (leaf, piece) => {\n const stored = storePiece(drawnAt.get(leaf.node.id)!, piece);\n return { pose: frame.local(leaf.node.id, stored.pose), path: stored.path };\n },\n });\n if (ops.length === 0) return;\n adapterRef.current.applyOps(ops, 'Slice');\n if (nextSelection) sel.set(nextSelection as NodeId[]);\n },\n }));\n}\n\n/** A leaf's world pose, and the box, rotation, and transform its path is drawn through. */\ninterface DrawnPose {\n world: unknown;\n g: PoseDescriptor<unknown>;\n box: PathInWorldPose;\n}\n\nfunction drawnPose(g: PoseDescriptor<unknown>, world: unknown): DrawnPose | null {\n const b = g.getBounds(world);\n if (!b || ![b.x, b.y, b.width, b.height].every(Number.isFinite)) return null;\n const rotation = g.getRotation?.(world) ?? 0;\n const transform = poseLinearOf(world) ?? undefined;\n return { world, g, box: { x: b.x, y: b.y, width: b.width, height: b.height, rotation, transform } };\n}\n\n/** A world-space piece as a world pose of the source's kind plus the path it draws. */\nfunction storePiece({ world, g, box }: DrawnPose, piece: Path): { pose: unknown; path: Path } {\n const keepsRotation = !!g.withRotation && g.supportsRotation?.(world) !== false;\n const rotation = box.rotation ?? 0;\n if (rotation !== 0 && !keepsRotation) {\n const baked = worldEditToStorage({ ...box, rotation: 0 }, piece);\n return { pose: g.fromBounds(baked.pose, world), path: baked.path };\n }\n const { pose: b, path } = worldEditToStorage(box, piece);\n const dst = { x: b.x, y: b.y, width: b.width, height: b.height };\n const pose = g.remapBounds(world, g.getBounds(world), dst);\n return { pose: rotation !== 0 ? g.withRotation!(pose, rotation) : pose, path };\n}\n\nfunction sliceablePath(scene: Scene<unknown, string, unknown>, node: Node<unknown, string, unknown>): Path | null {\n if (node.kind !== 'leaf' || node.derivePath || node.derivePose) return null;\n if (scene.isLocked(node.id)) return null;\n const path = (node.data as { path?: unknown } | null)?.path as Path | undefined;\n return path && (path.kind === 'rect' || path.kind === 'polygon') ? path : null;\n}\n\nfunction siblingIndex(scene: Scene<unknown, string, unknown>, node: Node<unknown, string, unknown>): number {\n const siblings = node.parent == null ? scene.roots : scene.childrenOf(node.parent);\n return siblings.indexOf(node.id);\n}\n"],"mappings":"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"}
@@ -1,17 +1,17 @@
1
- import { isTextData as e } from "../../features/text/isTextData.js";
2
- import { useLatest as t } from "@weasel-js/react";
3
- import { useDepSource as n } from "@weasel-js/routing/react";
1
+ import { useLatest as e } from "@weasel-js/react";
2
+ import { useDepSource as t } from "@weasel-js/routing/react";
3
+ import { isTextData as n } from "@weasel-js/text";
4
4
  //#region src/canvas/deps/textEdit.ts
5
5
  function r(r) {
6
- let i = t(r);
7
- n("textEdit", () => {
8
- let t = i.current;
6
+ let i = e(r);
7
+ t("textEdit", () => {
8
+ let e = i.current;
9
9
  return {
10
10
  startEdit(e, t) {
11
11
  process.env.NODE_ENV !== "production" && console.warn("weasel textEditDep: startEdit called but no useTextEdit hook is mounted in SceneCanvas. Override the \"textEdit\" dep via useDepSource(\"textEdit\", ...) to enable in-place text editing.");
12
12
  },
13
- isTextNode(n) {
14
- return e(t.get(n)?.data);
13
+ isTextNode(t) {
14
+ return n(e.get(t)?.data);
15
15
  }
16
16
  };
17
17
  });
@@ -1 +1 @@
1
- {"version":3,"file":"textEdit.js","names":["useTextEditDepSource","sceneRef","useLatest","scene","sc","isTextData","id"],"sources":["../../../src/canvas/deps/textEdit.ts"],"sourcesContent":["/**\n * `useTextEditDepSource` — wires the `textEdit` dep consumed by\n * `enterTextEditAction`. Kit-default implementation is a no-op stub for\n * `startEdit` plus an `isTextNode` that asks `isTextData`. Consumers wanting real text editing override the\n * dep via their own `useDepSource('textEdit', ...)` sourced from a\n * `useSceneTextEdit` instance.\n */\nimport { useDepSource } from '@weasel-js/routing/react';\nimport { useLatest } from '@weasel-js/react';\nimport type { TextEditDep } from 'interactions/actions/depSchema';\nimport type { Scene, NodeId } from 'core/scene/types';\nimport { isTextData } from 'features/text/isTextData';\n\nexport function useTextEditDepSource(\n scene: Scene<unknown, string, unknown>,\n): void {\n const sceneRef = useLatest(scene);\n\n useDepSource('textEdit', (): TextEditDep => {\n const sc = sceneRef.current;\n return {\n startEdit(_id: string, _opts?: { caret?: number | 'all' }) {\n if (process.env.NODE_ENV !== 'production') {\n console.warn(\n 'weasel textEditDep: startEdit called but no useTextEdit hook is mounted in SceneCanvas. ' +\n 'Override the \"textEdit\" dep via useDepSource(\"textEdit\", ...) to enable in-place text editing.',\n );\n }\n },\n isTextNode(id: string) {\n return isTextData(sc.get(id as NodeId)?.data);\n },\n };\n });\n}\n"],"mappings":";;;;AAaA,SAAgBA,EACd,GACM;CACN,IAAMC,IAAWC,EAAUC,CAAK;CAEhC,EAAa,kBAA+B;EAC1C,IAAMC,IAAKH,EAAS;EACpB,OAAO;GACL,UAAU,GAAa,GAAoC;IACzD,AAAA,QAAA,IAAA,aAA6B,gBAC3B,QAAQ,KACN,4LAEF;GAEJ;GACA,WAAW,GAAY;IACrB,OAAOI,EAAWD,EAAG,IAAIE,CAAY,CAAC,EAAE,IAAI;GAC9C;EACF;CACF,CAAC;AACH"}
1
+ {"version":3,"file":"textEdit.js","names":["useTextEditDepSource","sceneRef","useLatest","scene","sc","isTextData","id"],"sources":["../../../src/canvas/deps/textEdit.ts"],"sourcesContent":["/**\n * `useTextEditDepSource` — wires the `textEdit` dep consumed by\n * `enterTextEditAction`. Kit-default implementation is a no-op stub for\n * `startEdit` plus an `isTextNode` that asks `isTextData`. Consumers wanting real text editing override the\n * dep via their own `useDepSource('textEdit', ...)` sourced from a\n * `useSceneTextEdit` instance.\n */\nimport { useDepSource } from '@weasel-js/routing/react';\nimport { useLatest } from '@weasel-js/react';\nimport type { TextEditDep } from 'interactions/actions/depSchema';\nimport type { Scene, NodeId } from 'core/scene/types';\nimport { isTextData } from '@weasel-js/text';\n\nexport function useTextEditDepSource(\n scene: Scene<unknown, string, unknown>,\n): void {\n const sceneRef = useLatest(scene);\n\n useDepSource('textEdit', (): TextEditDep => {\n const sc = sceneRef.current;\n return {\n startEdit(_id: string, _opts?: { caret?: number | 'all' }) {\n if (process.env.NODE_ENV !== 'production') {\n console.warn(\n 'weasel textEditDep: startEdit called but no useTextEdit hook is mounted in SceneCanvas. ' +\n 'Override the \"textEdit\" dep via useDepSource(\"textEdit\", ...) to enable in-place text editing.',\n );\n }\n },\n isTextNode(id: string) {\n return isTextData(sc.get(id as NodeId)?.data);\n },\n };\n });\n}\n"],"mappings":";;;;AAaA,SAAgBA,EACd,GACM;CACN,IAAMC,IAAWC,EAAUC,CAAK;CAEhC,EAAa,kBAA+B;EAC1C,IAAMC,IAAKH,EAAS;EACpB,OAAO;GACL,UAAU,GAAa,GAAoC;IACzD,AAAA,QAAA,IAAA,aAA6B,gBAC3B,QAAQ,KACN,4LAEF;GAEJ;GACA,WAAW,GAAY;IACrB,OAAOI,EAAWD,EAAG,IAAIE,CAAY,CAAC,EAAE,IAAI;GAC9C;EACF;CACF,CAAC;AACH"}
@@ -1 +1 @@
1
- {"version":3,"file":"view.js","names":["useViewDepSource","wiring","useLatest","hasRecenter","recenter","hasHostSize","hostSize","hasAnimation","animation","hasDecay","decay","hasLayerIsPainted","layerIsPainted","useMemo","v","to","opts","config","layerId"],"sources":["../../../src/canvas/deps/view.ts"],"sourcesContent":["/**\n * `useViewDepSource` — builds a stable `ViewApi` that reads from\n * `currentViewRef`, writes via `onViewChange`, and (when a camera runner is\n * passed) exposes animation.\n *\n * NOTE: this hook does **not** itself call `useDepSource('view', ...)` because\n * `useStandardActions` already publishes the `view` dep when it is passed in\n * its options bag. Returning the `ViewApi` here lets the registrar hand the\n * same instance to `useStandardActions` (which then registers it) without\n * having to reconstruct it inline.\n *\n * Kept as a per-dep module so the construction logic (closure refresh, ref\n * stability, etc.) has a single home next to the other dep modules.\n */\nimport { useMemo } from 'react';\nimport { useLatest } from '@weasel-js/react';\nimport type React from 'react';\nimport type { ViewApi } from 'interactions/actions/depSchema';\nimport type { ViewAnimationApi } from 'core/viewport/useViewAnimation';\nimport type { DecayLoopConfig } from 'core/viewport/useDecayLoop';\nimport type { View } from 'core/viewport/view';\n\ninterface Wiring {\n currentViewRef: React.RefObject<View>;\n onViewChange: (v: View) => void;\n recenter?: () => View | void;\n hostSize?: () => { width: number; height: number } | null;\n animation?: ViewAnimationApi;\n decay?: DecayApi;\n layerIsPainted?: (layerId: string) => boolean;\n}\n\n/** The slice of `useDecayLoop` the view dep republishes. */\nexport interface DecayApi {\n start(config: DecayLoopConfig): void;\n cancel(): void;\n}\n\nexport function useViewDepSource(\n currentViewRef: React.RefObject<View>,\n onViewChange: (v: View) => void,\n recenter?: () => View | void,\n hostSize?: () => { width: number; height: number } | null,\n animation?: ViewAnimationApi,\n decay?: DecayApi,\n layerIsPainted?: (layerId: string) => boolean,\n): ViewApi {\n // Every method reads through this, so the latest onViewChange / recenter /\n // runner is captured without the API object itself changing identity.\n const wiring = useLatest<Wiring>({\n currentViewRef, onViewChange, recenter, hostSize, animation, decay, layerIsPainted,\n });\n\n // An unwired optional member must read falsy — `viewportZoomAction` branches\n // on `view.recenter`, and a forwarder is truthy — so the identity-stable API\n // is rebuilt whenever that presence set changes.\n const hasRecenter = !!recenter;\n const hasHostSize = !!hostSize;\n const hasAnimation = !!animation;\n const hasDecay = !!decay;\n const hasLayerIsPainted = !!layerIsPainted;\n return useMemo((): ViewApi => ({\n get: () => wiring.current.currentViewRef.current,\n // Not the canvas's only cancel feed (`onViewChange` is), but a `view` dep\n // wired to something other than a `<SceneCanvas>` has only this one.\n set: (v: View) => {\n wiring.current.animation?.stopIfExternal();\n wiring.current.onViewChange(v);\n },\n ...(hasRecenter ? { recenter: () => wiring.current.recenter!() } : {}),\n ...(hasHostSize ? { hostSize: () => wiring.current.hostSize!() } : {}),\n ...(hasAnimation\n ? {\n animate: (to: View, opts?: Parameters<ViewAnimationApi['animate']>[1]) =>\n wiring.current.animation!.animate(to, opts),\n stopAnimation: () => wiring.current.animation!.stop(),\n animationTarget: () => wiring.current.animation!.target(),\n }\n : {}),\n ...(hasDecay\n ? {\n decay: (config: DecayLoopConfig) => wiring.current.decay!.start(config),\n stopDecay: () => wiring.current.decay!.cancel(),\n }\n : {}),\n ...(hasLayerIsPainted\n ? { layerIsPainted: (layerId: string) => wiring.current.layerIsPainted!(layerId) }\n : {}),\n }), [wiring, hasRecenter, hasHostSize, hasAnimation, hasDecay, hasLayerIsPainted]);\n}\n"],"mappings":";;;AAsCA,SAAgBA,EACd,GACA,GACA,GACA,GACA,GACA,GACA,GACS;CAGT,IAAMC,IAASC,EAAkB;EAC/B;EAAgB;EAAc;EAAU;EAAU;EAAW;EAAO;CACtE,CAAC,GAKKC,IAAc,CAAC,CAACC,GAChBC,IAAc,CAAC,CAACC,GAChBC,IAAe,CAAC,CAACC,GACjBC,IAAW,CAAC,CAACC,GACbC,IAAoB,CAAC,CAACC;CAC5B,OAAOC,SAAwB;EAC7B,WAAWZ,EAAO,QAAQ,eAAe;EAGzC,MAAM,MAAY;GAEhB,AADAA,EAAO,QAAQ,WAAW,eAAe,GACzCA,EAAO,QAAQ,aAAaa,CAAC;EAC/B;EACA,GAAIX,IAAc,EAAE,gBAAgBF,EAAO,QAAQ,SAAU,EAAE,IAAI,CAAC;EACpE,GAAII,IAAc,EAAE,gBAAgBJ,EAAO,QAAQ,SAAU,EAAE,IAAI,CAAC;EACpE,GAAIM,IACA;GACE,UAAU,GAAU,MAClBN,EAAO,QAAQ,UAAW,QAAQc,GAAIC,CAAI;GAC5C,qBAAqBf,EAAO,QAAQ,UAAW,KAAK;GACpD,uBAAuBA,EAAO,QAAQ,UAAW,OAAO;EAC1D,IACA,CAAC;EACL,GAAIQ,IACA;GACE,QAAQ,MAA4BR,EAAO,QAAQ,MAAO,MAAMgB,CAAM;GACtE,iBAAiBhB,EAAO,QAAQ,MAAO,OAAO;EAChD,IACA,CAAC;EACL,GAAIU,IACA,EAAE,iBAAiB,MAAoBV,EAAO,QAAQ,eAAgBiB,CAAO,EAAE,IAC/E,CAAC;CACP,IAAI;EAACjB;EAAQE;EAAaE;EAAaE;EAAcE;EAAUE;CAAiB,CAAC;AACnF"}
1
+ {"version":3,"file":"view.js","names":["useViewDepSource","wiring","useLatest","hasRecenter","recenter","hasHostSize","hostSize","hasAnimation","animation","hasDecay","decay","hasLayerIsPainted","layerIsPainted","useMemo","v","to","opts","config","layerId"],"sources":["../../../src/canvas/deps/view.ts"],"sourcesContent":["/**\n * Builds a stable `ViewApi` that reads from `currentViewRef` and writes via\n * `onViewChange`. It does **not** call `useDepSource('view', ...)` itself:\n * `useStandardActions` publishes the `view` dep it is handed.\n */\nimport { useMemo } from 'react';\nimport { useLatest } from '@weasel-js/react';\nimport type React from 'react';\nimport type { ViewApi } from 'interactions/actions/depSchema';\nimport type { ViewAnimationApi } from 'core/viewport/useViewAnimation';\nimport type { DecayLoopConfig } from 'core/viewport/useDecayLoop';\nimport type { View } from 'core/viewport/view';\n\ninterface Wiring {\n currentViewRef: React.RefObject<View>;\n onViewChange: (v: View) => void;\n recenter?: () => View | void;\n hostSize?: () => { width: number; height: number } | null;\n animation?: ViewAnimationApi;\n decay?: DecayApi;\n layerIsPainted?: (layerId: string) => boolean;\n}\n\n/** The slice of `useDecayLoop` the view dep republishes. */\nexport interface DecayApi {\n start(config: DecayLoopConfig): void;\n cancel(): void;\n}\n\nexport function useViewDepSource(\n currentViewRef: React.RefObject<View>,\n onViewChange: (v: View) => void,\n recenter?: () => View | void,\n hostSize?: () => { width: number; height: number } | null,\n animation?: ViewAnimationApi,\n decay?: DecayApi,\n layerIsPainted?: (layerId: string) => boolean,\n): ViewApi {\n // Every method reads through this, so the latest onViewChange / recenter /\n // runner is captured without the API object itself changing identity.\n const wiring = useLatest<Wiring>({\n currentViewRef, onViewChange, recenter, hostSize, animation, decay, layerIsPainted,\n });\n\n // An unwired optional member must read falsy — `viewportZoomAction` branches\n // on `view.recenter`, and a forwarder is truthy — so the identity-stable API\n // is rebuilt whenever that presence set changes.\n const hasRecenter = !!recenter;\n const hasHostSize = !!hostSize;\n const hasAnimation = !!animation;\n const hasDecay = !!decay;\n const hasLayerIsPainted = !!layerIsPainted;\n return useMemo((): ViewApi => ({\n get: () => wiring.current.currentViewRef.current,\n // Not the canvas's only cancel feed (`onViewChange` is), but a `view` dep\n // wired to something other than a `<SceneCanvas>` has only this one.\n set: (v: View) => {\n wiring.current.animation?.stopIfExternal();\n wiring.current.onViewChange(v);\n },\n ...(hasRecenter ? { recenter: () => wiring.current.recenter!() } : {}),\n ...(hasHostSize ? { hostSize: () => wiring.current.hostSize!() } : {}),\n ...(hasAnimation\n ? {\n animate: (to: View, opts?: Parameters<ViewAnimationApi['animate']>[1]) =>\n wiring.current.animation!.animate(to, opts),\n stopAnimation: () => wiring.current.animation!.stop(),\n animationTarget: () => wiring.current.animation!.target(),\n }\n : {}),\n ...(hasDecay\n ? {\n decay: (config: DecayLoopConfig) => wiring.current.decay!.start(config),\n stopDecay: () => wiring.current.decay!.cancel(),\n }\n : {}),\n ...(hasLayerIsPainted\n ? { layerIsPainted: (layerId: string) => wiring.current.layerIsPainted!(layerId) }\n : {}),\n }), [wiring, hasRecenter, hasHostSize, hasAnimation, hasDecay, hasLayerIsPainted]);\n}\n"],"mappings":";;;AA6BA,SAAgBA,EACd,GACA,GACA,GACA,GACA,GACA,GACA,GACS;CAGT,IAAMC,IAASC,EAAkB;EAC/B;EAAgB;EAAc;EAAU;EAAU;EAAW;EAAO;CACtE,CAAC,GAKKC,IAAc,CAAC,CAACC,GAChBC,IAAc,CAAC,CAACC,GAChBC,IAAe,CAAC,CAACC,GACjBC,IAAW,CAAC,CAACC,GACbC,IAAoB,CAAC,CAACC;CAC5B,OAAOC,SAAwB;EAC7B,WAAWZ,EAAO,QAAQ,eAAe;EAGzC,MAAM,MAAY;GAEhB,AADAA,EAAO,QAAQ,WAAW,eAAe,GACzCA,EAAO,QAAQ,aAAaa,CAAC;EAC/B;EACA,GAAIX,IAAc,EAAE,gBAAgBF,EAAO,QAAQ,SAAU,EAAE,IAAI,CAAC;EACpE,GAAII,IAAc,EAAE,gBAAgBJ,EAAO,QAAQ,SAAU,EAAE,IAAI,CAAC;EACpE,GAAIM,IACA;GACE,UAAU,GAAU,MAClBN,EAAO,QAAQ,UAAW,QAAQc,GAAIC,CAAI;GAC5C,qBAAqBf,EAAO,QAAQ,UAAW,KAAK;GACpD,uBAAuBA,EAAO,QAAQ,UAAW,OAAO;EAC1D,IACA,CAAC;EACL,GAAIQ,IACA;GACE,QAAQ,MAA4BR,EAAO,QAAQ,MAAO,MAAMgB,CAAM;GACtE,iBAAiBhB,EAAO,QAAQ,MAAO,OAAO;EAChD,IACA,CAAC;EACL,GAAIU,IACA,EAAE,iBAAiB,MAAoBV,EAAO,QAAQ,eAAgBiB,CAAO,EAAE,IAC/E,CAAC;CACP,IAAI;EAACjB;EAAQE;EAAaE;EAAaE;EAAcE;EAAUE;CAAiB,CAAC;AACnF"}