@weasel-js/core 1.11.0 → 1.11.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (365) hide show
  1. package/CHANGELOG.md +427 -0
  2. package/README.md +1 -1
  3. package/dist/animation/index.js +3 -3
  4. package/dist/animation/rig/bindRig.js +1 -1
  5. package/dist/animation/rig/rigNode.js.map +1 -1
  6. package/dist/barrel/canvas.js +7 -3
  7. package/dist/barrel/interactions.js +5 -4
  8. package/dist/barrel/paths.js +3 -3
  9. package/dist/barrel/renderer.js +3 -2
  10. package/dist/barrel/routing.js +6 -11
  11. package/dist/barrel/scene.js +8 -5
  12. package/dist/barrel/viewport.js +4 -3
  13. package/dist/canvas/Canvas.js +3 -1
  14. package/dist/canvas/Canvas.js.map +1 -1
  15. package/dist/canvas/SceneCanvas/SceneCanvasInput.js +17 -3
  16. package/dist/canvas/SceneCanvas/SceneCanvasInput.js.map +1 -1
  17. package/dist/canvas/SceneCanvas/builtinToolSets.js +30 -0
  18. package/dist/canvas/SceneCanvas/builtinToolSets.js.map +1 -0
  19. package/dist/canvas/SceneCanvas/canvasPassThrough.js +1 -0
  20. package/dist/canvas/SceneCanvas/canvasPassThrough.js.map +1 -1
  21. package/dist/canvas/SceneCanvas/coordTrace.js +5 -16
  22. package/dist/canvas/SceneCanvas/coordTrace.js.map +1 -1
  23. package/dist/canvas/SceneCanvas/defaultNodeProperties.js +5 -0
  24. package/dist/canvas/SceneCanvas/defaultNodeProperties.js.map +1 -1
  25. package/dist/canvas/SceneCanvas/features.js +45 -5
  26. package/dist/canvas/SceneCanvas/features.js.map +1 -1
  27. package/dist/canvas/SceneCanvas/props.js +1 -11
  28. package/dist/canvas/SceneCanvas/props.js.map +1 -1
  29. package/dist/canvas/SceneCanvas/toolRegistry.js +8 -4
  30. package/dist/canvas/SceneCanvas/toolRegistry.js.map +1 -1
  31. package/dist/canvas/SceneCanvas/useActionsPropResolver.js +1 -11
  32. package/dist/canvas/SceneCanvas/useActionsPropResolver.js.map +1 -1
  33. package/dist/canvas/SceneCanvas/useBuiltinShapeTools.js.map +1 -1
  34. package/dist/canvas/SceneCanvas/useBuiltinTools.js +2 -9
  35. package/dist/canvas/SceneCanvas/useBuiltinTools.js.map +1 -1
  36. package/dist/canvas/SceneCanvas/useCanvasDevtoolsRoot.js +93 -0
  37. package/dist/canvas/SceneCanvas/useCanvasDevtoolsRoot.js.map +1 -0
  38. package/dist/canvas/SceneCanvas/useCanvasSelection.js +7 -2
  39. package/dist/canvas/SceneCanvas/useCanvasSelection.js.map +1 -1
  40. package/dist/canvas/SceneCanvas/useCanvasTools.js +8 -8
  41. package/dist/canvas/SceneCanvas/useCanvasTools.js.map +1 -1
  42. package/dist/canvas/SceneCanvas/useNodeKinds.js +1 -1
  43. package/dist/canvas/SceneCanvas/useNodeKinds.js.map +1 -1
  44. package/dist/canvas/SceneCanvas/useSceneCanvasLayers.js +13 -2
  45. package/dist/canvas/SceneCanvas/useSceneCanvasLayers.js.map +1 -1
  46. package/dist/canvas/SceneCanvas/useSceneCanvasTools.js +1 -3
  47. package/dist/canvas/SceneCanvas/useSceneCanvasTools.js.map +1 -1
  48. package/dist/canvas/SceneCanvas/useSceneChrome.js +6 -7
  49. package/dist/canvas/SceneCanvas/useSceneChrome.js.map +1 -1
  50. package/dist/canvas/SceneCanvas/useSceneGestureDispatcher.js +5 -3
  51. package/dist/canvas/SceneCanvas/useSceneGestureDispatcher.js.map +1 -1
  52. package/dist/canvas/SceneCanvas/useScenePicking.js +2 -3
  53. package/dist/canvas/SceneCanvas/useScenePicking.js.map +1 -1
  54. package/dist/canvas/SceneCanvas/useSceneSelectTool.js +2 -1
  55. package/dist/canvas/SceneCanvas/useSceneSelectTool.js.map +1 -1
  56. package/dist/canvas/SceneCanvas/useSceneStandardActions.js +3 -4
  57. package/dist/canvas/SceneCanvas/useSceneStandardActions.js.map +1 -1
  58. package/dist/canvas/SceneCanvas.js +16 -14
  59. package/dist/canvas/SceneCanvas.js.map +1 -1
  60. package/dist/canvas/SurfaceCanvas.js +5 -22
  61. package/dist/canvas/SurfaceCanvas.js.map +1 -1
  62. package/dist/canvas/canvasRenderer.js +9 -5
  63. package/dist/canvas/canvasRenderer.js.map +1 -1
  64. package/dist/canvas/contextAttributes.js +14 -0
  65. package/dist/canvas/contextAttributes.js.map +1 -0
  66. package/dist/canvas/deps/editAnchors.js +9 -113
  67. package/dist/canvas/deps/editAnchors.js.map +1 -1
  68. package/dist/canvas/deps/insert.js +4 -2
  69. package/dist/canvas/deps/insert.js.map +1 -1
  70. package/dist/canvas/deps/pathEditCommits.js +193 -0
  71. package/dist/canvas/deps/pathEditCommits.js.map +1 -0
  72. package/dist/canvas/deps/snap.js +12 -9
  73. package/dist/canvas/deps/snap.js.map +1 -1
  74. package/dist/canvas/deps/transformFollowers.js +20 -0
  75. package/dist/canvas/deps/transformFollowers.js.map +1 -0
  76. package/dist/canvas/derivedPath.js +20 -1
  77. package/dist/canvas/derivedPath.js.map +1 -1
  78. package/dist/canvas/drawnBounds.js +29 -3
  79. package/dist/canvas/drawnBounds.js.map +1 -1
  80. package/dist/canvas/nodeShapes/derivedPainter.js +9 -1
  81. package/dist/canvas/nodeShapes/derivedPainter.js.map +1 -1
  82. package/dist/canvas/nodeShapes/pathPainter.js +3 -2
  83. package/dist/canvas/nodeShapes/pathPainter.js.map +1 -1
  84. package/dist/canvas/nodeShapes/shapePainter.js +1 -1
  85. package/dist/canvas/overlayRoleStrokes.js +12 -0
  86. package/dist/canvas/overlayRoleStrokes.js.map +1 -1
  87. package/dist/canvas/pathOverlay.js +27 -7
  88. package/dist/canvas/pathOverlay.js.map +1 -1
  89. package/dist/canvas/renderDebugSnapshot.js +1 -0
  90. package/dist/canvas/renderDebugSnapshot.js.map +1 -1
  91. package/dist/canvas/renderSceneToPixels.js +6 -5
  92. package/dist/canvas/renderSceneToPixels.js.map +1 -1
  93. package/dist/canvas/sceneAdapter.js.map +1 -1
  94. package/dist/canvas/useCanvasPaint.js +2 -1
  95. package/dist/canvas/useCanvasPaint.js.map +1 -1
  96. package/dist/canvas/useInFlightBounds.js +52 -0
  97. package/dist/canvas/useInFlightBounds.js.map +1 -0
  98. package/dist/canvas/useViewHelpers.js +7 -9
  99. package/dist/canvas/useViewHelpers.js.map +1 -1
  100. package/dist/clipboard.d.ts +3 -2
  101. package/dist/{clone-DZDrfIlU.d.ts → clone-C3e0OTuF.d.ts} +8 -21
  102. package/dist/clone.d.ts +4 -3
  103. package/dist/core/geometry/autoPoseDescriptor.js +1 -1
  104. package/dist/core/ops/setDependsOn.js +37 -0
  105. package/dist/core/ops/setDependsOn.js.map +1 -0
  106. package/dist/core/ops/writtenBy.js +53 -0
  107. package/dist/core/ops/writtenBy.js.map +1 -0
  108. package/dist/core/pages/fitViewToPage.js +12 -1
  109. package/dist/core/pages/fitViewToPage.js.map +1 -1
  110. package/dist/core/pages/pageEdits.js +164 -0
  111. package/dist/core/pages/pageEdits.js.map +1 -0
  112. package/dist/core/pages/pages.js +30 -1
  113. package/dist/core/pages/pages.js.map +1 -1
  114. package/dist/core/scene/NodeRouting.js +8 -3
  115. package/dist/core/scene/NodeRouting.js.map +1 -1
  116. package/dist/core/scene/arrivalWindow.js.map +1 -1
  117. package/dist/core/scene/carryDescendants.js +51 -0
  118. package/dist/core/scene/carryDescendants.js.map +1 -0
  119. package/dist/core/scene/docValues.js +57 -0
  120. package/dist/core/scene/docValues.js.map +1 -0
  121. package/dist/core/scene/editPass.js +111 -0
  122. package/dist/core/scene/editPass.js.map +1 -0
  123. package/dist/core/scene/effectivePose.js +7 -1
  124. package/dist/core/scene/effectivePose.js.map +1 -1
  125. package/dist/core/scene/fieldEdits.js +4 -1
  126. package/dist/core/scene/fieldEdits.js.map +1 -1
  127. package/dist/core/scene/historyFacade.js +1 -0
  128. package/dist/core/scene/historyFacade.js.map +1 -1
  129. package/dist/core/scene/layoutPass.js +28 -3
  130. package/dist/core/scene/layoutPass.js.map +1 -1
  131. package/dist/core/scene/recorder.js +28 -19
  132. package/dist/core/scene/recorder.js.map +1 -1
  133. package/dist/core/scene/scene.js +15 -9
  134. package/dist/core/scene/scene.js.map +1 -1
  135. package/dist/core/scene/sceneChanges.js +13 -0
  136. package/dist/core/scene/sceneChanges.js.map +1 -0
  137. package/dist/core/scene/sceneEdits.js +8 -1
  138. package/dist/core/scene/sceneEdits.js.map +1 -1
  139. package/dist/core/scene/sceneMutators.js +1 -0
  140. package/dist/core/scene/sceneMutators.js.map +1 -1
  141. package/dist/core/scene/sceneRecording.js +20 -3
  142. package/dist/core/scene/sceneRecording.js.map +1 -1
  143. package/dist/core/scene/sceneSelection.js +4 -1
  144. package/dist/core/scene/sceneSelection.js.map +1 -1
  145. package/dist/core/scene/sceneState.js +11 -5
  146. package/dist/core/scene/sceneState.js.map +1 -1
  147. package/dist/core/scene/serialization.js +5 -3
  148. package/dist/core/scene/serialization.js.map +1 -1
  149. package/dist/core/scene/types.js.map +1 -1
  150. package/dist/core/scene/unitScopes.js +19 -1
  151. package/dist/core/scene/unitScopes.js.map +1 -1
  152. package/dist/core/selection/usePublishSceneSelection.js +6 -12
  153. package/dist/core/selection/usePublishSceneSelection.js.map +1 -1
  154. package/dist/core/shapeKinds.js +25 -11
  155. package/dist/core/shapeKinds.js.map +1 -1
  156. package/dist/{cornerHandles-Camw_yeu.d.ts → cornerHandles-BHuoMs1o.d.ts} +1 -1
  157. package/dist/debug/createDebugOverlayLayer.js +16 -111
  158. package/dist/debug/createDebugOverlayLayer.js.map +1 -1
  159. package/dist/debug/createDebugSink.js +2 -1
  160. package/dist/debug/createDebugSink.js.map +1 -1
  161. package/dist/debug/defaultTheme.js +4 -2
  162. package/dist/debug/defaultTheme.js.map +1 -1
  163. package/dist/debug/features.js +17 -0
  164. package/dist/debug/features.js.map +1 -0
  165. package/dist/debug/overlayPanels.js +117 -0
  166. package/dist/debug/overlayPanels.js.map +1 -0
  167. package/dist/debug/parseDebugFlags.js +4 -13
  168. package/dist/debug/parseDebugFlags.js.map +1 -1
  169. package/dist/{depSchema-Cgfu_G9s.d.ts → depSchema-BpZNOv7q.d.ts} +114 -892
  170. package/dist/devtools/handlers.js +112 -0
  171. package/dist/devtools/handlers.js.map +1 -0
  172. package/dist/devtools/history.js +71 -0
  173. package/dist/devtools/history.js.map +1 -0
  174. package/dist/devtools/hook.js +74 -0
  175. package/dist/devtools/hook.js.map +1 -0
  176. package/dist/devtools/label.js +25 -0
  177. package/dist/devtools/label.js.map +1 -0
  178. package/dist/devtools/notices.js +58 -0
  179. package/dist/devtools/notices.js.map +1 -0
  180. package/dist/devtools/protocol.js +7 -0
  181. package/dist/devtools/protocol.js.map +1 -0
  182. package/dist/devtools/registry.js +90 -0
  183. package/dist/devtools/registry.js.map +1 -0
  184. package/dist/devtools/root.js +80 -0
  185. package/dist/devtools/root.js.map +1 -0
  186. package/dist/devtools/serialize.js +86 -0
  187. package/dist/devtools/serialize.js.map +1 -0
  188. package/dist/devtools/session.js +111 -0
  189. package/dist/devtools/session.js.map +1 -0
  190. package/dist/devtools/transport.js +67 -0
  191. package/dist/devtools/transport.js.map +1 -0
  192. package/dist/devtools/useDevtoolsRoot.js +81 -0
  193. package/dist/devtools/useDevtoolsRoot.js.map +1 -0
  194. package/dist/devtools-protocol.d.ts +435 -0
  195. package/dist/devtools-protocol.js +7 -0
  196. package/dist/devtools.d.ts +8 -0
  197. package/dist/devtools.js +12 -0
  198. package/dist/devtools.js.map +1 -0
  199. package/dist/features/chrome-caps/useHoverTracking.js +16 -10
  200. package/dist/features/chrome-caps/useHoverTracking.js.map +1 -1
  201. package/dist/features/ingestion/contentHandlers.js +25 -2
  202. package/dist/features/ingestion/contentHandlers.js.map +1 -1
  203. package/dist/features/measure/measureCommands.js +7 -5
  204. package/dist/features/measure/measureCommands.js.map +1 -1
  205. package/dist/features/paths/index.js +2 -2
  206. package/dist/features/paths/pathEditExtension.js.map +1 -1
  207. package/dist/features/paths/pathSnap/pathSnapSource.js +5 -5
  208. package/dist/features/paths/pathSnap/pathSnapSource.js.map +1 -1
  209. package/dist/features/paths/pathSnap/sceneIndex.js +10 -3
  210. package/dist/features/paths/pathSnap/sceneIndex.js.map +1 -1
  211. package/dist/features/selection/selectionPose.js +4 -1
  212. package/dist/features/selection/selectionPose.js.map +1 -1
  213. package/dist/features/snap/gather.js +9 -1
  214. package/dist/features/snap/gather.js.map +1 -1
  215. package/dist/features/snap/lazySession.js +17 -0
  216. package/dist/features/snap/lazySession.js.map +1 -0
  217. package/dist/features/snap/marks.js.map +1 -1
  218. package/dist/features/snap/probes2d.js +27 -19
  219. package/dist/features/snap/probes2d.js.map +1 -1
  220. package/dist/features/snap/readoutLayer.js.map +1 -1
  221. package/dist/features/snap/roles.js +2 -1
  222. package/dist/features/snap/roles.js.map +1 -1
  223. package/dist/features/snap/rotationSource.js +25 -8
  224. package/dist/features/snap/rotationSource.js.map +1 -1
  225. package/dist/features/snap/sceneSession2d.js +6 -4
  226. package/dist/features/snap/sceneSession2d.js.map +1 -1
  227. package/dist/features/snap/session2d.js +37 -23
  228. package/dist/features/snap/session2d.js.map +1 -1
  229. package/dist/features/snap/spanSnap.js +5 -2
  230. package/dist/features/snap/spanSnap.js.map +1 -1
  231. package/dist/icons.table.js +1 -1
  232. package/dist/icons.table.js.map +1 -1
  233. package/dist/icons.table.json +0 -10
  234. package/dist/index.d.ts +701 -696
  235. package/dist/index.js +35 -29
  236. package/dist/interactions/actions/align/action.js +6 -4
  237. package/dist/interactions/actions/align/action.js.map +1 -1
  238. package/dist/interactions/actions/align/align.js.map +1 -1
  239. package/dist/interactions/actions/booleans/action.js +7 -1
  240. package/dist/interactions/actions/booleans/action.js.map +1 -1
  241. package/dist/interactions/actions/clone/action.js +1 -1
  242. package/dist/interactions/actions/clone/behaviors.js +4 -4
  243. package/dist/interactions/actions/clone/behaviors.js.map +1 -1
  244. package/dist/interactions/actions/defaults/bendSegment.js +1 -1
  245. package/dist/interactions/actions/defaults/bendSegment.js.map +1 -1
  246. package/dist/interactions/actions/defaults/createPaintAction.js +1 -1
  247. package/dist/interactions/actions/defaults/delete.js +48 -39
  248. package/dist/interactions/actions/defaults/delete.js.map +1 -1
  249. package/dist/interactions/actions/defaults/duplicate.js +1 -1
  250. package/dist/interactions/actions/defaults/group.js +2 -2
  251. package/dist/interactions/actions/defaults/ingest.js +7 -5
  252. package/dist/interactions/actions/defaults/ingest.js.map +1 -1
  253. package/dist/interactions/actions/defaults/nudge.js +13 -38
  254. package/dist/interactions/actions/defaults/nudge.js.map +1 -1
  255. package/dist/interactions/actions/distribute/action.js +6 -4
  256. package/dist/interactions/actions/distribute/action.js.map +1 -1
  257. package/dist/interactions/actions/drawnBoxes.js +2 -1
  258. package/dist/interactions/actions/drawnBoxes.js.map +1 -1
  259. package/dist/interactions/actions/edit-anchors/action.js +3 -6
  260. package/dist/interactions/actions/edit-anchors/action.js.map +1 -1
  261. package/dist/interactions/actions/edit-anchors/preview.js +41 -8
  262. package/dist/interactions/actions/edit-anchors/preview.js.map +1 -1
  263. package/dist/interactions/actions/flip/action.js +6 -4
  264. package/dist/interactions/actions/flip/action.js.map +1 -1
  265. package/dist/interactions/actions/gestureLifecycle.js +5 -2
  266. package/dist/interactions/actions/gestureLifecycle.js.map +1 -1
  267. package/dist/interactions/actions/insert/action.js +1 -2
  268. package/dist/interactions/actions/insert/action.js.map +1 -1
  269. package/dist/interactions/actions/insert/commit.js +1 -1
  270. package/dist/interactions/actions/insert/parent.js +11 -0
  271. package/dist/interactions/actions/insert/parent.js.map +1 -0
  272. package/dist/interactions/actions/insert/placeAction.js +7 -2
  273. package/dist/interactions/actions/insert/placeAction.js.map +1 -1
  274. package/dist/interactions/actions/insert/session.js +5 -1
  275. package/dist/interactions/actions/insert/session.js.map +1 -1
  276. package/dist/interactions/actions/move/action.js +8 -4
  277. package/dist/interactions/actions/move/action.js.map +1 -1
  278. package/dist/interactions/actions/move/behaviors/layoutDrop.js +0 -1
  279. package/dist/interactions/actions/move/behaviors/layoutDrop.js.map +1 -1
  280. package/dist/interactions/actions/move/behaviors/snapToContainer.js +1 -1
  281. package/dist/interactions/actions/move/capture.js +1 -1
  282. package/dist/interactions/actions/move/commit/index.js +0 -2
  283. package/dist/interactions/actions/move/commit/index.js.map +1 -1
  284. package/dist/interactions/actions/move/commit/layoutDrop.js +2 -2
  285. package/dist/interactions/actions/move/commit/layoutRelease.js +2 -2
  286. package/dist/interactions/actions/move/commit/reparent.js +11 -5
  287. package/dist/interactions/actions/move/commit/reparent.js.map +1 -1
  288. package/dist/interactions/actions/move/frame.js +4 -10
  289. package/dist/interactions/actions/move/frame.js.map +1 -1
  290. package/dist/interactions/actions/move/landedDescendants.js +20 -17
  291. package/dist/interactions/actions/move/landedDescendants.js.map +1 -1
  292. package/dist/interactions/actions/move/layout/container.js +2 -1
  293. package/dist/interactions/actions/move/layout/container.js.map +1 -1
  294. package/dist/interactions/actions/move/layout/dragged.js +1 -1
  295. package/dist/interactions/actions/move/layout/dropPass.js +18 -1
  296. package/dist/interactions/actions/move/layout/dropPass.js.map +1 -1
  297. package/dist/interactions/actions/move/layout/exits.js +5 -5
  298. package/dist/interactions/actions/move/layout/exits.js.map +1 -1
  299. package/dist/interactions/actions/move/session.js +14 -3
  300. package/dist/interactions/actions/move/session.js.map +1 -1
  301. package/dist/interactions/actions/move/translate.js +8 -37
  302. package/dist/interactions/actions/move/translate.js.map +1 -1
  303. package/dist/interactions/actions/moveNodes.js +87 -0
  304. package/dist/interactions/actions/moveNodes.js.map +1 -0
  305. package/dist/interactions/actions/planeInput.js.map +1 -1
  306. package/dist/interactions/actions/resize/action.js +83 -72
  307. package/dist/interactions/actions/resize/action.js.map +1 -1
  308. package/dist/interactions/actions/resize/commit.js +2 -1
  309. package/dist/interactions/actions/resize/commit.js.map +1 -1
  310. package/dist/interactions/actions/resize/session.js +2 -0
  311. package/dist/interactions/actions/resize/session.js.map +1 -1
  312. package/dist/interactions/actions/resolvePreviews.js +3 -3
  313. package/dist/interactions/actions/resolvePreviews.js.map +1 -1
  314. package/dist/interactions/actions/rotate/action.js +7 -4
  315. package/dist/interactions/actions/rotate/action.js.map +1 -1
  316. package/dist/interactions/actions/rotate/commit.js +2 -1
  317. package/dist/interactions/actions/rotate/commit.js.map +1 -1
  318. package/dist/interactions/actions/rotate/session.js +2 -0
  319. package/dist/interactions/actions/rotate/session.js.map +1 -1
  320. package/dist/interactions/actions/selectionSubtree.js +13 -2
  321. package/dist/interactions/actions/selectionSubtree.js.map +1 -1
  322. package/dist/interactions/actions/testUtils.js.map +1 -1
  323. package/dist/interactions/actions/transform-again/action.js +5 -6
  324. package/dist/interactions/actions/transform-again/action.js.map +1 -1
  325. package/dist/interactions/actions/transformFinish.js +106 -0
  326. package/dist/interactions/actions/transformFinish.js.map +1 -0
  327. package/dist/kitSettingsSchema.js +0 -4
  328. package/dist/kitSettingsSchema.js.map +1 -1
  329. package/dist/move.d.ts +5 -4
  330. package/dist/{options-p9GZMXbY.d.ts → options-DBxEryYq.d.ts} +1 -1
  331. package/dist/resize.d.ts +4 -3
  332. package/dist/routing.d.ts +1 -1
  333. package/dist/routing.js +2 -2
  334. package/dist/test-hook/createTestHook.js +1 -1
  335. package/dist/test-hook/createTestHook.js.map +1 -1
  336. package/dist/test-hook/useTestHook.js +2 -1
  337. package/dist/test-hook/useTestHook.js.map +1 -1
  338. package/dist/test-seams.d.ts +9 -5
  339. package/dist/tools/builtin/pen/penHandle.js +3 -5
  340. package/dist/tools/builtin/pen/penHandle.js.map +1 -1
  341. package/dist/tools/index.js +26 -0
  342. package/dist/{types-CHVXGfYm.d.ts → types-7puAuVD2.d.ts} +3 -262
  343. package/dist/types-BN9hbdMI.d.ts +184 -0
  344. package/dist/types-CniVctmk.d.ts +949 -0
  345. package/dist/types-oFeQ5VjV.d.ts +264 -0
  346. package/dist/version.js +1 -1
  347. package/package.json +35 -25
  348. package/dist/canvas/SceneCanvas/useBuiltinRigTools.js +0 -65
  349. package/dist/canvas/SceneCanvas/useBuiltinRigTools.js.map +0 -1
  350. package/dist/tools/builtin/bone/boneActions.js +0 -156
  351. package/dist/tools/builtin/bone/boneActions.js.map +0 -1
  352. package/dist/tools/builtin/bone/boneOverlay.js +0 -71
  353. package/dist/tools/builtin/bone/boneOverlay.js.map +0 -1
  354. package/dist/tools/builtin/bone/placedRig.js +0 -28
  355. package/dist/tools/builtin/bone/placedRig.js.map +0 -1
  356. package/dist/tools/builtin/bone/rigEditState.js +0 -30
  357. package/dist/tools/builtin/bone/rigEditState.js.map +0 -1
  358. package/dist/tools/builtin/bone/useBoneTool.js +0 -125
  359. package/dist/tools/builtin/bone/useBoneTool.js.map +0 -1
  360. package/dist/tools/builtin/weight/useWeightTool.js +0 -101
  361. package/dist/tools/builtin/weight/useWeightTool.js.map +0 -1
  362. package/dist/tools/builtin/weight/weightActions.js +0 -140
  363. package/dist/tools/builtin/weight/weightActions.js.map +0 -1
  364. package/dist/tools/builtin/weight/weightOverlay.js +0 -78
  365. package/dist/tools/builtin/weight/weightOverlay.js.map +0 -1
@@ -0,0 +1,264 @@
1
+ import { L as LayoutStrategy, P as ParallaxOpts } from './types-7puAuVD2.js';
2
+ import { Op } from '@weasel-js/history';
3
+ import { View } from '@weasel-js/geom';
4
+ import { P as PoseDescriptor } from './poseDescriptor-DN2yfnq_.js';
5
+ import { Target } from '@weasel-js/animator';
6
+
7
+ /**
8
+ * Opaque clipboard payload: the kit never inspects entries. The adapter both
9
+ * produces snapshots (`snapshotSelection`) and consumes them (`commitPaste`).
10
+ */
11
+ interface ClipboardSnapshot {
12
+ items: unknown[];
13
+ }
14
+ /**
15
+ * A copied node a paste did not make, and why:
16
+ *
17
+ * - `dependency-not-copied` — it derives from the nodes in `missing`, which
18
+ * were not copied with it.
19
+ * - `derivation-not-registered` — it derives from other nodes through a
20
+ * function that did not survive the clipboard and is not in the scene's
21
+ * registry.
22
+ * - `container-not-pasted` — its container was left out.
23
+ */
24
+ interface PasteOmission {
25
+ /** The id the node had when it was copied. */
26
+ id: string;
27
+ reason: 'dependency-not-copied' | 'derivation-not-registered' | 'container-not-pasted';
28
+ missing?: string[];
29
+ }
30
+ /** What `commitPaste` is told beyond the snapshot and the offset. */
31
+ interface PasteCtx {
32
+ dropPoint?: {
33
+ worldX: number;
34
+ worldY: number;
35
+ };
36
+ /** Called once per copied node the paste leaves out. */
37
+ onOmit?: (omission: PasteOmission) => void;
38
+ }
39
+ /**
40
+ * Where a dragged node would re-parent to if released. `slotPose` is the pose
41
+ * (in world coordinates) the node should snap to within the target;
42
+ * `metadata` is an opaque pass-through for app-specific snap details.
43
+ */
44
+ interface SnapTarget<TPose = unknown> {
45
+ parentId: string;
46
+ slotPose: TPose;
47
+ metadata?: unknown;
48
+ }
49
+ /**
50
+ * The contracts below are slices: each names what one reader asks of an
51
+ * adapter. The whole of it, as the kit builds it over a `Scene`, is
52
+ * `SceneCanvasAdapter` (`sceneToAdapter`).
53
+ *
54
+ * **Pose semantics:** `getPose` / `setPose` work in **local** coordinates —
55
+ * relative to the node's direct parent (or world, for root-parented nodes).
56
+ * `getWorldPose`, where an adapter has it, is the composed reading.
57
+ *
58
+ * **Every adapter carries the tree:** `getNode`, `getParent`, and
59
+ * `getChildren`. A list with no nesting is a tree whose nodes are all roots:
60
+ * `getParent` answers `null` and `getChildren(null)` answers every id,
61
+ * bottom first.
62
+ */
63
+ /** Narrow adapter for move. Apps without container-snapping leave out `findSnapTarget`. */
64
+ interface MoveAdapter<TNode extends {
65
+ id: string;
66
+ }, TPose> {
67
+ getNode(id: string): TNode | undefined;
68
+ getNodes(): TNode[];
69
+ getPose(id: string): TPose;
70
+ /** The node's container, `null` for a root. */
71
+ getParent(id: string): string | null;
72
+ /** Optional paint depth, read by `pickTopMostHit` to resolve two *siblings*
73
+ * whose bodies both cover the pointer. Without it the hit list's own order
74
+ * decides, which is right for a back-to-front walk and wrong for anything
75
+ * else. See `PickTopMostHitAdapter` for the `compareZ` alternative. */
76
+ getZIndex?(id: string): number | null | undefined;
77
+ compareZ?(a: string, b: string): number;
78
+ setPose(id: string, pose: TPose): void;
79
+ /** Optional. Used only by reparent ops; an adapter that never reparents may omit. */
80
+ setParent?(id: string, parentId: string | null): void;
81
+ /** Optional. The commit point of a gesture. When omitted, ops are applied
82
+ * against the adapter one by one; an adapter with a history of its own
83
+ * takes them here as one entry. */
84
+ applyOps?(ops: Op[], label: string): void;
85
+ /** Optional. Show each node at its pose without writing the document, so
86
+ * nothing is recorded; `null` withdraws a node's preview. What a behavior
87
+ * that keeps moving nodes after the gesture ends writes each frame. */
88
+ previewPoses?(poses: ReadonlyMap<string, TPose | null>): void;
89
+ /** Optional. The animation target of node `id`'s pose, the same one on
90
+ * every call, so everything animating the node adds; `descriptor` supplies
91
+ * its axes the first time. `tweenPose`, `springPose`, and `momentum` move
92
+ * it where it is there, and write `setPose` each frame where it is not or
93
+ * it answers `undefined`. */
94
+ poseTarget?(id: string, descriptor?: PoseDescriptor<TPose>): Target<TPose> | undefined;
95
+ findSnapTarget?(draggedId: string, worldX: number, worldY: number): SnapTarget<TPose> | null;
96
+ /** Ordered children of `parentId`, `null` for the root siblings, in
97
+ * z-order: index 0 is the bottom. One contract with
98
+ * {@link OrderedAdapter.getChildren} — the two land on the same adapter
99
+ * object. Picking walks it, and the ops read a node's sibling slot from it.
100
+ * A node with no children answers `[]`. */
101
+ getChildren(parentId: string | null): string[];
102
+ /** Optional: layout strategy attached to a container, or null if the
103
+ * container uses absolute positioning. When present, a move uses it to
104
+ * compute drop targets, sibling reflow, and the commit op batch. */
105
+ getLayout?(containerId: string): LayoutStrategy<TPose> | null;
106
+ }
107
+ /** Narrow adapter for resize. */
108
+ interface ResizeAdapter<TNode extends {
109
+ id: string;
110
+ }, TPose> {
111
+ getNode(id: string): TNode | undefined;
112
+ getPose(id: string): TPose;
113
+ setPose(id: string, pose: TPose): void;
114
+ /** Optional: see MoveAdapter.applyOps. */
115
+ applyOps?(ops: Op[], label: string): void;
116
+ }
117
+ /** Narrow adapter for rotate, which mutates pose only and never reparents. */
118
+ interface RotateAdapter<TNode extends {
119
+ id: string;
120
+ }, TPose> {
121
+ getNode(id: string): TNode | undefined;
122
+ getPose(id: string): TPose;
123
+ setPose(id: string, pose: TPose): void;
124
+ /** Optional: see MoveAdapter.applyOps. */
125
+ applyOps?(ops: Op[], label: string): void;
126
+ }
127
+ /** The view a region pick answers for. */
128
+ interface RegionPickView {
129
+ /** The camera the region was drawn under. With it, a node on a parallax
130
+ * layer is tested where that camera's plane paints it. */
131
+ get?(): View;
132
+ /** Whether that view paints a layer at all. */
133
+ layerIsPainted?(layer: string): boolean;
134
+ }
135
+ /**
136
+ * Narrow adapter for marquee selection. Transient: no checkpoint, no
137
+ * history — `applyOps(ops)` is called with no label.
138
+ *
139
+ * All fields are **optional**. `useSelectTool` only wires the default marquee
140
+ * behavior when `hitTestArea`, `getSelection`, `setSelection`, and `applyOps`
141
+ * are all present on the adapter; otherwise empty-space drags do nothing.
142
+ */
143
+ interface AreaSelectAdapter {
144
+ /** Returns ids of nodes intersecting the world-space rect, as the view the
145
+ * rect was drawn in paints them. */
146
+ hitTestArea?(rect: {
147
+ x: number;
148
+ y: number;
149
+ width: number;
150
+ height: number;
151
+ }, view?: RegionPickView): string[];
152
+ /** Current selection — read by behaviors to compute additive merges. */
153
+ getSelection?(): string[];
154
+ /** Mutator wired by `setSelection` op. */
155
+ setSelection?(ids: string[]): void;
156
+ /** Apply ops without checkpointing or pushing a history entry. The optional
157
+ * `label` parameter is accepted (and ignored by transient implementations)
158
+ * so that this signature is compatible with `MoveAdapter.applyOps`. */
159
+ applyOps?(ops: Op[], label?: string): void;
160
+ }
161
+ /**
162
+ * Hit mode for `LassoSelectAdapter.hitTestLasso`:
163
+ * - 'centers' — the center of the node's visual bounds is inside the polygon.
164
+ * - 'intersect' — the node's outline meets the polygon anywhere.
165
+ * - 'enclosed' — the node's whole outline is inside the polygon.
166
+ *
167
+ * The outline is the drawn silhouette, rotation included.
168
+ */
169
+ type LassoHitMode = 'centers' | 'intersect' | 'enclosed';
170
+ /**
171
+ * Narrow adapter for lasso selection: `AreaSelectAdapter` plus a polygon
172
+ * hit-test. `selectFromLasso` does nothing without `hitTestLasso`.
173
+ */
174
+ interface LassoSelectAdapter extends AreaSelectAdapter {
175
+ /** Hit-test against a closed polygon. Vertex order may be CW or CCW; the
176
+ * closing edge from last → first is implicit. */
177
+ hitTestLasso?(polygon: ReadonlyArray<{
178
+ x: number;
179
+ y: number;
180
+ }>, mode: LassoHitMode, view?: RegionPickView): string[];
181
+ }
182
+ /**
183
+ * Narrow adapter for insert and `useClipboardOps`. The kit knows nothing
184
+ * about what shape to construct; it asks the adapter to produce node(s) given
185
+ * gesture or paste inputs, and wraps each in an `InsertOp`.
186
+ */
187
+ interface InsertAdapter<TNode extends {
188
+ id: string;
189
+ }> {
190
+ getNode(id: string): TNode | undefined;
191
+ getParent(id: string): string | null;
192
+ /** Ordered children of `parentId`, `null` for the root siblings. An insert
193
+ * resolves its sibling slot against it. */
194
+ getChildren(parentId: string | null): string[];
195
+ /** Materialize a new node from drag-rect bounds (drag-to-insert tools).
196
+ * Optional: `sceneToAdapter` only fills it in when `options.commitInsert`
197
+ * is supplied. */
198
+ commitInsert?(bounds: {
199
+ x: number;
200
+ y: number;
201
+ width: number;
202
+ height: number;
203
+ }): TNode | null;
204
+ /** Materialize the new nodes from a clipboard snapshot, in order.
205
+ * Optional — required only for paste. */
206
+ commitPaste?(clipboard: ClipboardSnapshot, offset: {
207
+ dx: number;
208
+ dy: number;
209
+ }, ctx?: PasteCtx): TNode[];
210
+ /** Snapshot the current selection into the clipboard payload shape.
211
+ * Optional — required only for copy, cut, and clone's ghost capture. */
212
+ snapshotSelection?(ids: string[]): ClipboardSnapshot;
213
+ getPasteOffset?(clipboard: ClipboardSnapshot): {
214
+ dx: number;
215
+ dy: number;
216
+ };
217
+ /** Mutator wired by `insertNode`-using ops (kit-side InsertOp). `index` is
218
+ * the node's z-position among its siblings. `createDeleteOp` captures it
219
+ * and `invert()` forwards it, so an implementation that drops it makes
220
+ * undo of a delete restore the node at the top instead of where it was.
221
+ * Omit only for an unordered store. */
222
+ insertNode(node: TNode, index?: number): void;
223
+ /** Mutator wired by `setSelection` ops batched alongside paste. */
224
+ setSelection(ids: string[]): void;
225
+ /** Optional: see MoveAdapter.applyOps. */
226
+ applyOps?(ops: Op[], label: string): void;
227
+ /** Returns the current selection. Used by clone behaviors. */
228
+ getSelection(): string[];
229
+ }
230
+ /**
231
+ * The layer list of an adapter whose nodes sit on layers. The scene slot
232
+ * paints one canvas layer per entry; a pick over a bare adapter reads it for
233
+ * parallax planes where it is there.
234
+ */
235
+ interface LayerEnumerableAdapter<TLayer extends string = string> {
236
+ getLayers?(): readonly {
237
+ id: TLayer;
238
+ visible: boolean;
239
+ parallax?: ParallaxOpts;
240
+ }[];
241
+ /** Call `listener` whenever the list `getLayers` answers may have changed.
242
+ * A canvas reads the list at mount and again on each call, so an adapter
243
+ * whose list never changes leaves this out. */
244
+ subscribeLayers?(listener: () => void): () => void;
245
+ }
246
+ /**
247
+ * Sibling z-order: what the reorder ops read and write.
248
+ *
249
+ * **Convention:** array order IS z-order. Index 0 is the bottom of the
250
+ * stack, the last index is the top. Hit-testing should iterate the returned
251
+ * list in REVERSE (top to bottom). Render layers iterate FORWARD (bottom to
252
+ * top).
253
+ */
254
+ interface OrderedAdapter {
255
+ /** Ordered children of `parentId` (or root siblings if null), in z-order:
256
+ * index 0 is bottom, last index is top. The same contract
257
+ * {@link MoveAdapter.getChildren} declares — one method, two readers. */
258
+ getChildren(parentId: string | null): string[];
259
+ /** Rewrite the order of `parentId`'s children. Length and contents must
260
+ * match the existing children — reorder only, no add/remove. */
261
+ setChildOrder(parentId: string | null, ids: string[]): void;
262
+ }
263
+
264
+ export type { AreaSelectAdapter as A, ClipboardSnapshot as C, InsertAdapter as I, LayerEnumerableAdapter as L, MoveAdapter as M, OrderedAdapter as O, PasteOmission as P, RegionPickView as R, SnapTarget as S, LassoHitMode as a, ResizeAdapter as b, RotateAdapter as c, LassoSelectAdapter as d, PasteCtx as e };
package/dist/version.js CHANGED
@@ -7,7 +7,7 @@
7
7
  * throwing, since nothing about version reporting should be able to break a
8
8
  * consumer's build.
9
9
  */
10
- var VERSION = "1.11.0";
10
+ var VERSION = "1.11.1";
11
11
 
12
12
  //#endregion
13
13
  export { VERSION };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@weasel-js/core",
3
- "version": "1.11.0",
3
+ "version": "1.11.1",
4
4
  "description": "A 2D scene-graph engine for React, rendered on WebGL2: the scene tree, viewport math, pointer and keyboard input, layered rendering, and op-based undo.",
5
5
  "weasel": {
6
6
  "needs": ["webgl2"]
@@ -20,6 +20,8 @@
20
20
  "sideEffects": [
21
21
  "*.css",
22
22
  "./src/import-shims/mesh.ts",
23
+ "./src/import-shims/devtools.ts",
24
+ "./dist/devtools.js",
23
25
  "./src/core/paint/registerMesh.ts",
24
26
  "./dist/mesh.js",
25
27
  "./dist/core/paint/registerMesh.js"
@@ -73,6 +75,14 @@
73
75
  "import": "./dist/clone.js",
74
76
  "types": "./dist/clone.d.ts"
75
77
  },
78
+ "./devtools": {
79
+ "import": "./dist/devtools.js",
80
+ "types": "./dist/devtools.d.ts"
81
+ },
82
+ "./devtools-protocol": {
83
+ "import": "./dist/devtools-protocol.js",
84
+ "types": "./dist/devtools-protocol.d.ts"
85
+ },
76
86
  "./patterns-builtin": {
77
87
  "import": "./dist/patterns-builtin.js",
78
88
  "types": "./dist/patterns-builtin.d.ts"
@@ -96,30 +106,30 @@
96
106
  "typecheck": "tsc --noEmit -p tsconfig.json"
97
107
  },
98
108
  "peerDependencies": {
99
- "@weasel-js/font": "1.11.0",
109
+ "@weasel-js/font": "1.11.1",
100
110
  "react": ">=18"
101
111
  },
102
112
  "dependencies": {
103
- "@msb235/blits": "0.10.0",
104
- "@weasel-js/animator": "1.11.0",
105
- "@weasel-js/cursor": "1.11.0",
106
- "@weasel-js/geom": "1.11.0",
107
- "@weasel-js/gestures": "1.11.0",
108
- "@weasel-js/history": "1.11.0",
109
- "@weasel-js/icons": "1.11.0",
110
- "@weasel-js/modes": "1.11.0",
111
- "@weasel-js/paint": "1.11.0",
112
- "@weasel-js/prefs": "1.11.0",
113
- "@weasel-js/quantity": "1.11.0",
114
- "@weasel-js/react": "1.11.0",
115
- "@weasel-js/registry": "1.11.0",
116
- "@weasel-js/renderer": "1.11.0",
117
- "@weasel-js/routing": "1.11.0",
118
- "@weasel-js/select": "1.11.0",
119
- "@weasel-js/simulation": "1.11.0",
120
- "@weasel-js/stroke": "1.11.0",
121
- "@weasel-js/text": "1.11.0",
122
- "@weasel-js/text-dom": "1.11.0",
113
+ "@msb235/blits": "0.11.0",
114
+ "@weasel-js/animator": "1.11.1",
115
+ "@weasel-js/cursor": "1.11.1",
116
+ "@weasel-js/geom": "1.11.1",
117
+ "@weasel-js/gestures": "1.11.1",
118
+ "@weasel-js/history": "1.11.1",
119
+ "@weasel-js/icons": "1.11.1",
120
+ "@weasel-js/modes": "1.11.1",
121
+ "@weasel-js/paint": "1.11.1",
122
+ "@weasel-js/prefs": "1.11.1",
123
+ "@weasel-js/quantity": "1.11.1",
124
+ "@weasel-js/react": "1.11.1",
125
+ "@weasel-js/registry": "1.11.1",
126
+ "@weasel-js/renderer": "1.11.1",
127
+ "@weasel-js/routing": "1.11.1",
128
+ "@weasel-js/select": "1.11.1",
129
+ "@weasel-js/simulation": "1.11.1",
130
+ "@weasel-js/stroke": "1.11.1",
131
+ "@weasel-js/text": "1.11.1",
132
+ "@weasel-js/text-dom": "1.11.1",
123
133
  "earcut": "3.2.3",
124
134
  "polygon-clipping": "^0.15.7"
125
135
  },
@@ -137,8 +147,8 @@
137
147
  "2d"
138
148
  ],
139
149
  "devDependencies": {
140
- "@weasel-js/icons-plugin": "1.11.0",
141
- "@weasel-js/modes": "1.11.0",
142
- "@weasel-js/theme": "1.11.0"
150
+ "@weasel-js/icons-plugin": "1.11.1",
151
+ "@weasel-js/modes": "1.11.1",
152
+ "@weasel-js/theme": "1.11.1"
143
153
  }
144
154
  }
@@ -1,65 +0,0 @@
1
- import { createRigEditState } from "../../tools/builtin/bone/rigEditState.js";
2
- import { useBoneTool } from "../../tools/builtin/bone/useBoneTool.js";
3
- import { useWeightTool } from "../../tools/builtin/weight/useWeightTool.js";
4
- import { useMemo } from "react";
5
- import { useLatest } from "@weasel-js/react";
6
-
7
- //#region src/canvas/SceneCanvas/useBuiltinRigTools.ts
8
- /**
9
- * The bone and weight tools as `<SceneCanvas>` mounts them: on the canvas's
10
- * own scene, sharing one `RigEditState`, and acting on the rig the selection
11
- * names unless `toolOptions.rig` fixes one.
12
- *
13
- * Both hooks always run (React rules of hooks); `resolveToolRegistry` decides
14
- * which the canvas registers.
15
- */
16
- /**
17
- * The rig a selection names: with one node selected, the nearest of it and its
18
- * ancestors whose `data.skeleton` exists, else that node itself, so a first
19
- * bone can be drawn onto it. With none or several selected, `null`.
20
- */
21
- function rigOfSelection(scene, ids) {
22
- if (ids.length !== 1) return null;
23
- const own = ids[0];
24
- for (let id = own; id !== null;) {
25
- const node = scene.get(id);
26
- if (!node) break;
27
- if (node.data?.skeleton) return id;
28
- id = node.parent;
29
- }
30
- return scene.get(own) ? own : null;
31
- }
32
- function useBuiltinRigTools(args) {
33
- const { scene, options } = args;
34
- const latest = useLatest({
35
- scene,
36
- selection: args.selection,
37
- rig: options?.rig?.rig
38
- });
39
- const rig = useMemo(() => () => {
40
- const { scene: s, selection, rig: fixed } = latest.current;
41
- return fixed ? fixed() : rigOfSelection(s, selection());
42
- }, [latest]);
43
- const ownState = useMemo(() => createRigEditState(), []);
44
- const state = options?.rig?.state ?? ownState;
45
- const reach = options?.rig?.reach;
46
- return {
47
- bone: useBoneTool({
48
- scene,
49
- rig,
50
- state,
51
- reach
52
- }),
53
- weight: useWeightTool({
54
- scene,
55
- rig,
56
- state,
57
- reach,
58
- radius: options?.weight?.radius
59
- })
60
- };
61
- }
62
-
63
- //#endregion
64
- export { rigOfSelection, useBuiltinRigTools };
65
- //# sourceMappingURL=useBuiltinRigTools.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useBuiltinRigTools.js","names":[],"sources":["../../../src/canvas/SceneCanvas/useBuiltinRigTools.ts"],"sourcesContent":["/**\n * The bone and weight tools as `<SceneCanvas>` mounts them: on the canvas's\n * own scene, sharing one `RigEditState`, and acting on the rig the selection\n * names unless `toolOptions.rig` fixes one.\n *\n * Both hooks always run (React rules of hooks); `resolveToolRegistry` decides\n * which the canvas registers.\n */\nimport { useMemo } from 'react';\nimport { useLatest } from '@weasel-js/react';\nimport type { NodeId, Scene } from 'core/scene/types';\nimport type { RigNodeData } from '../../animation/rig/rigNode';\nimport { useBoneTool } from 'tools/builtin/bone/useBoneTool';\nimport { createRigEditState } from 'tools/builtin/bone/rigEditState';\nimport { useWeightTool } from 'tools/builtin/weight/useWeightTool';\nimport type { Tool } from 'tools/overlayBinding';\nimport type { BuiltinToolOptions } from './useBuiltinShapeTools';\n\n/**\n * The rig a selection names: with one node selected, the nearest of it and its\n * ancestors whose `data.skeleton` exists, else that node itself, so a first\n * bone can be drawn onto it. With none or several selected, `null`.\n */\nexport function rigOfSelection(\n scene: { get(id: NodeId): { parent: NodeId | null; data?: unknown } | undefined },\n ids: readonly NodeId[],\n): NodeId | null {\n if (ids.length !== 1) return null;\n const own = ids[0];\n for (let id: NodeId | null = own; id !== null;) {\n const node = scene.get(id);\n if (!node) break;\n if ((node.data as RigNodeData | null | undefined)?.skeleton) return id;\n id = node.parent;\n }\n return scene.get(own) ? own : null;\n}\n\nexport interface UseBuiltinRigToolsArgs {\n scene: Scene<unknown, string, unknown>;\n /** The canvas's selection, read when a tool acts. */\n selection: () => readonly NodeId[];\n options?: BuiltinToolOptions;\n}\n\nexport function useBuiltinRigTools(args: UseBuiltinRigToolsArgs): { bone: Tool; weight: Tool } {\n const { scene, options } = args;\n const latest = useLatest({ scene, selection: args.selection, rig: options?.rig?.rig });\n const rig = useMemo(() => (): NodeId | null => {\n const { scene: s, selection, rig: fixed } = latest.current;\n return fixed ? fixed() : rigOfSelection(s, selection());\n }, [latest]);\n const ownState = useMemo(() => createRigEditState(), []);\n const state = options?.rig?.state ?? ownState;\n const reach = options?.rig?.reach;\n const bone = useBoneTool({ scene, rig, state, reach });\n const weight = useWeightTool({ scene, rig, state, reach, radius: options?.weight?.radius });\n return { bone, weight };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAuBA,SAAgB,eACd,OACA,KACe;CACf,IAAI,IAAI,WAAW,GAAG,OAAO;CAC7B,MAAM,MAAM,IAAI;CAChB,KAAK,IAAI,KAAoB,KAAK,OAAO,OAAO;EAC9C,MAAM,OAAO,MAAM,IAAI,EAAE;EACzB,IAAI,CAAC,MAAM;EACX,IAAK,KAAK,MAAyC,UAAU,OAAO;EACpE,KAAK,KAAK;CACZ;CACA,OAAO,MAAM,IAAI,GAAG,IAAI,MAAM;AAChC;AASA,SAAgB,mBAAmB,MAA4D;CAC7F,MAAM,EAAE,OAAO,YAAY;CAC3B,MAAM,SAAS,UAAU;EAAE;EAAO,WAAW,KAAK;EAAW,KAAK,SAAS,KAAK;CAAI,CAAC;CACrF,MAAM,MAAM,oBAAmC;EAC7C,MAAM,EAAE,OAAO,GAAG,WAAW,KAAK,UAAU,OAAO;EACnD,OAAO,QAAQ,MAAM,IAAI,eAAe,GAAG,UAAU,CAAC;CACxD,GAAG,CAAC,MAAM,CAAC;CACX,MAAM,WAAW,cAAc,mBAAmB,GAAG,CAAC,CAAC;CACvD,MAAM,QAAQ,SAAS,KAAK,SAAS;CACrC,MAAM,QAAQ,SAAS,KAAK;CAG5B,OAAO;EAAE,MAFI,YAAY;GAAE;GAAO;GAAK;GAAO;EAAM,CAE3C;EAAM,QADA,cAAc;GAAE;GAAO;GAAK;GAAO;GAAO,QAAQ,SAAS,QAAQ;EAAO,CAC1E;CAAO;AACxB"}
@@ -1,156 +0,0 @@
1
- import { createSetDataOp } from "../../../core/ops/setData.js";
2
- import { defaultCommitAdapter } from "../../../interactions/actions/defaultCommitAdapter.js";
3
- import { unplaceSkeleton } from "../../../animation/rig/rigNode.js";
4
- import { sceneReach } from "./placedRig.js";
5
- import { ActionDisabledReason } from "@weasel-js/routing";
6
- import { addJoint, dropSkinJoints, jointAt, jointPositions, moveJoint, removeJoint } from "@weasel-js/animator";
7
-
8
- //#region src/tools/builtin/bone/boneActions.ts
9
- var eligible = { capability: "edits-page" };
10
- var reachOf = (env, deps) => sceneReach(deps, env.reachPx());
11
- var activeIn = (env, skeleton) => {
12
- const name = env.state.active();
13
- return name !== null && skeleton.joints.some((j) => j.name === name) ? name : null;
14
- };
15
- /** Write `next`, a skeleton in the scene's space, into the rig node, and take `removed`
16
- * joints out of the skins under it, as one undo entry. */
17
- function commitSkeleton(scene, deps, id, next, label, removed = []) {
18
- const node = scene.get(id);
19
- if (!node) return;
20
- const ops = [createSetDataOp({
21
- id,
22
- from: node.data,
23
- to: {
24
- ...node.data,
25
- skeleton: unplaceSkeleton(next, node.pose)
26
- },
27
- label
28
- })];
29
- const strip = (parent) => {
30
- for (const child of scene.childrenOf(parent)) {
31
- const data = scene.get(child)?.data;
32
- const kept = data?.skin && dropSkinJoints(data.skin, removed);
33
- if (kept && kept !== data.skin) ops.push(createSetDataOp({
34
- id: child,
35
- from: data,
36
- to: {
37
- ...data,
38
- skin: kept
39
- },
40
- label
41
- }));
42
- strip(child);
43
- }
44
- };
45
- if (removed.length > 0) strip(id);
46
- if (deps.applyOps) deps.applyOps(ops, label);
47
- else scene.applyBatch(ops, label, defaultCommitAdapter(scene, deps.selection?.adapterMethods));
48
- }
49
- function dragAction(env, editing) {
50
- return {
51
- id: "bone.drag",
52
- label: "Bone — move a joint or draw a bone",
53
- eligible,
54
- requires: [
55
- "view",
56
- "selection",
57
- "applyOps"
58
- ],
59
- enabled: editing,
60
- invoker: {
61
- timing: "ongoing",
62
- start: ({ deps, drag, world }) => {
63
- const at = env.placed();
64
- if (!at) return {};
65
- const press = drag?.start ?? world;
66
- const before = env.state.active();
67
- const hit = jointAt(at.skeleton, press.x, press.y, reachOf(env, deps));
68
- let origin = at.skeleton;
69
- let name = hit;
70
- if (name === null) {
71
- let parent = activeIn(env, origin);
72
- if (parent === null) ({skeleton: origin, name: parent} = addJoint(origin, null, press.x, press.y));
73
- ({skeleton: origin, name} = addJoint(origin, parent, press.x, press.y));
74
- }
75
- const joint = name;
76
- const from = jointPositions(origin).get(joint);
77
- env.state.setActive(joint);
78
- env.show(origin);
79
- return {
80
- onMove: (move) => {
81
- env.show(moveJoint(origin, joint, from.x + move.world.x - press.x, from.y + move.world.y - press.y));
82
- },
83
- onEnd: (_end, reason) => {
84
- const next = env.shown();
85
- env.show(null);
86
- if (reason === "cancel" || !next) {
87
- env.state.setActive(before);
88
- return;
89
- }
90
- commitSkeleton(env.scene(), deps, at.id, next, hit === null ? "Add bone" : "Move joint");
91
- }
92
- };
93
- }
94
- }
95
- };
96
- }
97
- /** The bone tool's actions: `bone.drag`, `bone.pick`, `bone.remove`, and `bone.clear`. */
98
- function createBoneActions(env) {
99
- const editing = () => env.placed() ? true : ActionDisabledReason.NotApplicable;
100
- const hasActive = () => {
101
- const at = env.placed();
102
- return at && activeIn(env, at.skeleton) !== null ? true : ActionDisabledReason.NotApplicable;
103
- };
104
- return [
105
- dragAction(env, editing),
106
- {
107
- id: "bone.pick",
108
- label: "Bone — pick the active joint",
109
- eligible,
110
- requires: ["view"],
111
- enabled: editing,
112
- invoker: {
113
- timing: "immediate",
114
- run: (deps, params) => {
115
- const p = params;
116
- const at = env.placed();
117
- if (!at || p?.pressX === void 0 || p.pressY === void 0) return;
118
- env.state.setActive(jointAt(at.skeleton, p.pressX, p.pressY, reachOf(env, deps)));
119
- }
120
- }
121
- },
122
- {
123
- id: "bone.remove",
124
- label: "Bone — remove the active joint",
125
- eligible,
126
- requires: ["selection", "applyOps"],
127
- enabled: hasActive,
128
- invoker: {
129
- timing: "immediate",
130
- run: (deps) => {
131
- const at = env.placed();
132
- const name = at && activeIn(env, at.skeleton);
133
- if (!at || name == null) return;
134
- const parent = at.skeleton.joints.find((j) => j.name === name).parent;
135
- const { skeleton, removed } = removeJoint(at.skeleton, name);
136
- commitSkeleton(env.scene(), deps, at.id, skeleton, "Remove joint", removed);
137
- env.state.setActive(parent);
138
- }
139
- }
140
- },
141
- {
142
- id: "bone.clear",
143
- label: "Bone — clear the active joint",
144
- eligible,
145
- enabled: hasActive,
146
- invoker: {
147
- timing: "immediate",
148
- run: () => env.state.setActive(null)
149
- }
150
- }
151
- ];
152
- }
153
-
154
- //#endregion
155
- export { createBoneActions };
156
- //# sourceMappingURL=boneActions.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"boneActions.js","names":[],"sources":["../../../../src/tools/builtin/bone/boneActions.ts"],"sourcesContent":["import type { Action, ActionDeps, InvocationCtx } from '@weasel-js/routing';\nimport { ActionDisabledReason } from '@weasel-js/routing';\nimport type { Op } from '@weasel-js/history';\nimport { createSetDataOp } from 'core/ops/setData';\nimport type { NodeId, Scene } from 'core/scene/types';\nimport { defaultCommitAdapter } from 'interactions/actions/defaultCommitAdapter';\nimport { unplaceSkeleton, type RigNodeData } from '../../../animation/rig/rigNode';\nimport { addJoint, dropSkinJoints, jointAt, jointPositions, moveJoint, removeJoint } from '@weasel-js/animator';\nimport type { Skeleton } from '@weasel-js/animator';\nimport { sceneReach, type PlacedRig } from './placedRig';\nimport type { RigEditState } from './rigEditState';\n\n/** What the bone tool's actions read and write, all of it the tool's own. */\nexport interface BoneEnv {\n scene(): Scene<unknown, string, unknown>;\n /** The rig node and its skeleton in the scene's space, or `null` with nothing to edit. */\n placed(): PlacedRig | null;\n state: RigEditState;\n /** Screen px around a joint within which a press takes it. */\n reachPx(): number;\n /** Show `skeleton` in place of the document's while a drag shapes it; `null` ends that. */\n show(skeleton: Skeleton | null): void;\n shown(): Skeleton | null;\n}\n\nconst eligible = { capability: 'edits-page' } as const;\n\nconst reachOf = (env: BoneEnv, deps: ActionDeps): number => sceneReach(deps, env.reachPx());\n\nconst activeIn = (env: BoneEnv, skeleton: Skeleton): string | null => {\n const name = env.state.active();\n return name !== null && skeleton.joints.some((j) => j.name === name) ? name : null;\n};\n\n/** Write `next`, a skeleton in the scene's space, into the rig node, and take `removed`\n * joints out of the skins under it, as one undo entry. */\nfunction commitSkeleton(\n scene: Scene<unknown, string, unknown>,\n deps: ActionDeps,\n id: NodeId,\n next: Skeleton,\n label: string,\n removed: readonly string[] = [],\n): void {\n const node = scene.get(id);\n if (!node) return;\n const ops: Op[] = [createSetDataOp({\n id, from: node.data, to: { ...(node.data as object), skeleton: unplaceSkeleton(next, node.pose) }, label,\n })];\n const strip = (parent: NodeId): void => {\n for (const child of scene.childrenOf(parent)) {\n const data = scene.get(child)?.data as RigNodeData | null | undefined;\n const kept = data?.skin && dropSkinJoints(data.skin, removed);\n if (kept && kept !== data.skin) ops.push(createSetDataOp({ id: child, from: data, to: { ...data, skin: kept }, label }));\n strip(child);\n }\n };\n if (removed.length > 0) strip(id);\n if (deps.applyOps) deps.applyOps(ops, label);\n else scene.applyBatch(ops, label, defaultCommitAdapter(scene, deps.selection?.adapterMethods));\n}\n\nfunction dragAction(env: BoneEnv, editing: () => true | ActionDisabledReason): Action {\n return {\n id: 'bone.drag',\n label: 'Bone — move a joint or draw a bone',\n eligible,\n requires: ['view', 'selection', 'applyOps'],\n enabled: editing,\n invoker: {\n timing: 'ongoing',\n start: ({ deps, drag, world }: InvocationCtx) => {\n const at = env.placed();\n if (!at) return {};\n const press = drag?.start ?? world;\n const before = env.state.active();\n const hit = jointAt(at.skeleton, press.x, press.y, reachOf(env, deps));\n let origin = at.skeleton;\n let name = hit;\n if (name === null) {\n let parent = activeIn(env, origin);\n if (parent === null) ({ skeleton: origin, name: parent } = addJoint(origin, null, press.x, press.y));\n ({ skeleton: origin, name } = addJoint(origin, parent, press.x, press.y));\n }\n const joint = name;\n const from = jointPositions(origin).get(joint)!;\n env.state.setActive(joint);\n env.show(origin);\n return {\n onMove: (move: InvocationCtx) => {\n env.show(moveJoint(origin, joint, from.x + move.world.x - press.x, from.y + move.world.y - press.y));\n },\n // The dispatcher hands `onEnd` a context with empty deps.\n onEnd: (_end: InvocationCtx, reason: 'commit' | 'cancel') => {\n const next = env.shown();\n env.show(null);\n if (reason === 'cancel' || !next) {\n env.state.setActive(before);\n return;\n }\n commitSkeleton(env.scene(), deps, at.id, next, hit === null ? 'Add bone' : 'Move joint');\n },\n };\n },\n },\n };\n}\n\n/** The bone tool's actions: `bone.drag`, `bone.pick`, `bone.remove`, and `bone.clear`. */\nexport function createBoneActions(env: BoneEnv): Action[] {\n const editing = () => (env.placed() ? true : ActionDisabledReason.NotApplicable);\n const hasActive = () => {\n const at = env.placed();\n return at && activeIn(env, at.skeleton) !== null ? true : ActionDisabledReason.NotApplicable;\n };\n return [\n dragAction(env, editing),\n {\n id: 'bone.pick',\n label: 'Bone — pick the active joint',\n eligible,\n requires: ['view'],\n enabled: editing,\n invoker: {\n timing: 'immediate',\n run: (deps, params) => {\n const p = params as { pressX?: number; pressY?: number } | undefined;\n const at = env.placed();\n if (!at || p?.pressX === undefined || p.pressY === undefined) return;\n env.state.setActive(jointAt(at.skeleton, p.pressX, p.pressY, reachOf(env, deps)));\n },\n },\n },\n {\n id: 'bone.remove',\n label: 'Bone — remove the active joint',\n eligible,\n requires: ['selection', 'applyOps'],\n // Declining with no joint active leaves Delete to the ambient `delete`.\n enabled: hasActive,\n invoker: {\n timing: 'immediate',\n run: (deps) => {\n const at = env.placed();\n const name = at && activeIn(env, at.skeleton);\n if (!at || name == null) return;\n const parent = at.skeleton.joints.find((j) => j.name === name)!.parent;\n const { skeleton, removed } = removeJoint(at.skeleton, name);\n commitSkeleton(env.scene(), deps, at.id, skeleton, 'Remove joint', removed);\n env.state.setActive(parent);\n },\n },\n },\n {\n id: 'bone.clear',\n label: 'Bone — clear the active joint',\n eligible,\n enabled: hasActive,\n invoker: { timing: 'immediate', run: () => env.state.setActive(null) },\n },\n ];\n}\n"],"mappings":"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"}