@weasel-js/editing 0.0.0-stage → 2.0.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 (368) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +60 -2
  3. package/dist/actionGroups.js +27 -0
  4. package/dist/actionGroups.js.map +1 -0
  5. package/dist/actions/align/action.js +105 -0
  6. package/dist/actions/align/action.js.map +1 -0
  7. package/dist/actions/align/align.js +115 -0
  8. package/dist/actions/align/align.js.map +1 -0
  9. package/dist/actions/clipboard/action.js +133 -0
  10. package/dist/actions/clipboard/action.js.map +1 -0
  11. package/dist/actions/clone/action.js +217 -0
  12. package/dist/actions/clone/action.js.map +1 -0
  13. package/dist/actions/clone/behaviors.js +65 -0
  14. package/dist/actions/clone/behaviors.js.map +1 -0
  15. package/dist/actions/delete/delete.js +123 -0
  16. package/dist/actions/delete/delete.js.map +1 -0
  17. package/dist/actions/derivedBox.js +16 -0
  18. package/dist/actions/derivedBox.js.map +1 -0
  19. package/dist/actions/distribute/action.js +96 -0
  20. package/dist/actions/distribute/action.js.map +1 -0
  21. package/dist/actions/distribute/distribute.js +61 -0
  22. package/dist/actions/distribute/distribute.js.map +1 -0
  23. package/dist/actions/distribute/plan.js +55 -0
  24. package/dist/actions/distribute/plan.js.map +1 -0
  25. package/dist/actions/edit/createPaintAction.js +138 -0
  26. package/dist/actions/edit/createPaintAction.js.map +1 -0
  27. package/dist/actions/edit/deselect.js +34 -0
  28. package/dist/actions/edit/deselect.js.map +1 -0
  29. package/dist/actions/edit/duplicate.js +93 -0
  30. package/dist/actions/edit/duplicate.js.map +1 -0
  31. package/dist/actions/edit/group.js +281 -0
  32. package/dist/actions/edit/group.js.map +1 -0
  33. package/dist/actions/edit/ingest.js +114 -0
  34. package/dist/actions/edit/ingest.js.map +1 -0
  35. package/dist/actions/edit/nudge.js +97 -0
  36. package/dist/actions/edit/nudge.js.map +1 -0
  37. package/dist/actions/edit/selectAll.js +48 -0
  38. package/dist/actions/edit/selectAll.js.map +1 -0
  39. package/dist/actions/edit/setFill.js +52 -0
  40. package/dist/actions/edit/setFill.js.map +1 -0
  41. package/dist/actions/edit/setFillOpacity.js +26 -0
  42. package/dist/actions/edit/setFillOpacity.js.map +1 -0
  43. package/dist/actions/edit/setStroke.js +57 -0
  44. package/dist/actions/edit/setStroke.js.map +1 -0
  45. package/dist/actions/edit/setStrokeOpacity.js +28 -0
  46. package/dist/actions/edit/setStrokeOpacity.js.map +1 -0
  47. package/dist/actions/edit/setStrokeWidth.js +53 -0
  48. package/dist/actions/edit/setStrokeWidth.js.map +1 -0
  49. package/dist/actions/edit/setVertexColor.js +45 -0
  50. package/dist/actions/edit/setVertexColor.js.map +1 -0
  51. package/dist/actions/flip/action.js +209 -0
  52. package/dist/actions/flip/action.js.map +1 -0
  53. package/dist/actions/flip/helpers.js +80 -0
  54. package/dist/actions/flip/helpers.js.map +1 -0
  55. package/dist/actions/group/enterGroup.js +81 -0
  56. package/dist/actions/group/enterGroup.js.map +1 -0
  57. package/dist/actions/insert/action.js +152 -0
  58. package/dist/actions/insert/action.js.map +1 -0
  59. package/dist/actions/insert/commit.js +52 -0
  60. package/dist/actions/insert/commit.js.map +1 -0
  61. package/dist/actions/insert/extras.js +88 -0
  62. package/dist/actions/insert/extras.js.map +1 -0
  63. package/dist/actions/insert/frame.js +96 -0
  64. package/dist/actions/insert/frame.js.map +1 -0
  65. package/dist/actions/insert/geometry.js +35 -0
  66. package/dist/actions/insert/geometry.js.map +1 -0
  67. package/dist/actions/insert/lands.js +41 -0
  68. package/dist/actions/insert/lands.js.map +1 -0
  69. package/dist/actions/insert/params.js +42 -0
  70. package/dist/actions/insert/params.js.map +1 -0
  71. package/dist/actions/insert/placeAction.js +137 -0
  72. package/dist/actions/insert/placeAction.js.map +1 -0
  73. package/dist/actions/insert/repositionAction.js +47 -0
  74. package/dist/actions/insert/repositionAction.js.map +1 -0
  75. package/dist/actions/insert/rotateAction.js +34 -0
  76. package/dist/actions/insert/rotateAction.js.map +1 -0
  77. package/dist/actions/insert/session.js +99 -0
  78. package/dist/actions/insert/session.js.map +1 -0
  79. package/dist/actions/insert/shape.js +117 -0
  80. package/dist/actions/insert/shape.js.map +1 -0
  81. package/dist/actions/insert/style.js +23 -0
  82. package/dist/actions/insert/style.js.map +1 -0
  83. package/dist/actions/lassoSelect/action.js +201 -0
  84. package/dist/actions/lassoSelect/action.js.map +1 -0
  85. package/dist/actions/lassoSelect/behaviors/selectFromLasso.js +61 -0
  86. package/dist/actions/lassoSelect/behaviors/selectFromLasso.js.map +1 -0
  87. package/dist/actions/lockedWrites.js +20 -0
  88. package/dist/actions/lockedWrites.js.map +1 -0
  89. package/dist/actions/move/action.js +138 -0
  90. package/dist/actions/move/action.js.map +1 -0
  91. package/dist/actions/move/behaviors/clampMove.js +42 -0
  92. package/dist/actions/move/behaviors/clampMove.js.map +1 -0
  93. package/dist/actions/move/behaviors/layoutDrop.js +84 -0
  94. package/dist/actions/move/behaviors/layoutDrop.js.map +1 -0
  95. package/dist/actions/move/behaviors/pageDrop.js +30 -0
  96. package/dist/actions/move/behaviors/pageDrop.js.map +1 -0
  97. package/dist/actions/move/behaviors/reparentOnDrop.js +44 -0
  98. package/dist/actions/move/behaviors/reparentOnDrop.js.map +1 -0
  99. package/dist/actions/move/behaviors/snapBackOrDelete.js +52 -0
  100. package/dist/actions/move/behaviors/snapBackOrDelete.js.map +1 -0
  101. package/dist/actions/move/behaviors/snapToContainer.js +214 -0
  102. package/dist/actions/move/behaviors/snapToContainer.js.map +1 -0
  103. package/dist/actions/move/behaviors/swapOnDrop.js +180 -0
  104. package/dist/actions/move/behaviors/swapOnDrop.js.map +1 -0
  105. package/dist/actions/move/capture.js +116 -0
  106. package/dist/actions/move/capture.js.map +1 -0
  107. package/dist/actions/move/commit/index.js +47 -0
  108. package/dist/actions/move/commit/index.js.map +1 -0
  109. package/dist/actions/move/commit/layoutDrop.js +68 -0
  110. package/dist/actions/move/commit/layoutDrop.js.map +1 -0
  111. package/dist/actions/move/commit/layoutRelease.js +146 -0
  112. package/dist/actions/move/commit/layoutRelease.js.map +1 -0
  113. package/dist/actions/move/commit/pageDrop.js +162 -0
  114. package/dist/actions/move/commit/pageDrop.js.map +1 -0
  115. package/dist/actions/move/commit/rebase.js +24 -0
  116. package/dist/actions/move/commit/rebase.js.map +1 -0
  117. package/dist/actions/move/commit/reparent.js +157 -0
  118. package/dist/actions/move/commit/reparent.js.map +1 -0
  119. package/dist/actions/move/delta.js +127 -0
  120. package/dist/actions/move/delta.js.map +1 -0
  121. package/dist/actions/move/dragSnap.js +55 -0
  122. package/dist/actions/move/dragSnap.js.map +1 -0
  123. package/dist/actions/move/frame.js +67 -0
  124. package/dist/actions/move/frame.js.map +1 -0
  125. package/dist/actions/move/gestureAdapter.js +36 -0
  126. package/dist/actions/move/gestureAdapter.js.map +1 -0
  127. package/dist/actions/move/landedDescendants.js +50 -0
  128. package/dist/actions/move/landedDescendants.js.map +1 -0
  129. package/dist/actions/move/layout/container.js +119 -0
  130. package/dist/actions/move/layout/container.js.map +1 -0
  131. package/dist/actions/move/layout/dragged.js +75 -0
  132. package/dist/actions/move/layout/dragged.js.map +1 -0
  133. package/dist/actions/move/layout/dropPass.js +205 -0
  134. package/dist/actions/move/layout/dropPass.js.map +1 -0
  135. package/dist/actions/move/layout/exits.js +62 -0
  136. package/dist/actions/move/layout/exits.js.map +1 -0
  137. package/dist/actions/move/layout/glide.js +70 -0
  138. package/dist/actions/move/layout/glide.js.map +1 -0
  139. package/dist/actions/move/layout/view.js +60 -0
  140. package/dist/actions/move/layout/view.js.map +1 -0
  141. package/dist/actions/move/refusal.js +49 -0
  142. package/dist/actions/move/refusal.js.map +1 -0
  143. package/dist/actions/move/session.js +105 -0
  144. package/dist/actions/move/session.js.map +1 -0
  145. package/dist/actions/move/sessionOf.js +27 -0
  146. package/dist/actions/move/sessionOf.js.map +1 -0
  147. package/dist/actions/move/translate.js +49 -0
  148. package/dist/actions/move/translate.js.map +1 -0
  149. package/dist/actions/pathfinder/action.js +109 -0
  150. package/dist/actions/pathfinder/action.js.map +1 -0
  151. package/dist/actions/pathfinder/booleanGroupAction.js +117 -0
  152. package/dist/actions/pathfinder/booleanGroupAction.js.map +1 -0
  153. package/dist/actions/pathfinder/keymap.js +51 -0
  154. package/dist/actions/pathfinder/keymap.js.map +1 -0
  155. package/dist/actions/reorder/reorder.js +245 -0
  156. package/dist/actions/reorder/reorder.js.map +1 -0
  157. package/dist/actions/resize/action.js +105 -0
  158. package/dist/actions/resize/action.js.map +1 -0
  159. package/dist/actions/resize/aspect.js +42 -0
  160. package/dist/actions/resize/aspect.js.map +1 -0
  161. package/dist/actions/resize/behaviors/clampMinSize.js +100 -0
  162. package/dist/actions/resize/behaviors/clampMinSize.js.map +1 -0
  163. package/dist/actions/resize/boxFrame.js +19 -0
  164. package/dist/actions/resize/boxFrame.js.map +1 -0
  165. package/dist/actions/resize/capture.js +121 -0
  166. package/dist/actions/resize/capture.js.map +1 -0
  167. package/dist/actions/resize/commit.js +104 -0
  168. package/dist/actions/resize/commit.js.map +1 -0
  169. package/dist/actions/resize/frame.js +171 -0
  170. package/dist/actions/resize/frame.js.map +1 -0
  171. package/dist/actions/resize/held.js +44 -0
  172. package/dist/actions/resize/held.js.map +1 -0
  173. package/dist/actions/resize/minimum.js +34 -0
  174. package/dist/actions/resize/minimum.js.map +1 -0
  175. package/dist/actions/resize/replay.js +58 -0
  176. package/dist/actions/resize/replay.js.map +1 -0
  177. package/dist/actions/resize/ruleBounds.js +11 -0
  178. package/dist/actions/resize/ruleBounds.js.map +1 -0
  179. package/dist/actions/resize/session.js +118 -0
  180. package/dist/actions/resize/session.js.map +1 -0
  181. package/dist/actions/rotate/action.js +99 -0
  182. package/dist/actions/rotate/action.js.map +1 -0
  183. package/dist/actions/rotate/commit.js +48 -0
  184. package/dist/actions/rotate/commit.js.map +1 -0
  185. package/dist/actions/rotate/frame.js +96 -0
  186. package/dist/actions/rotate/frame.js.map +1 -0
  187. package/dist/actions/rotate/replay.js +25 -0
  188. package/dist/actions/rotate/replay.js.map +1 -0
  189. package/dist/actions/rotate/session.js +135 -0
  190. package/dist/actions/rotate/session.js.map +1 -0
  191. package/dist/actions/select/areaSelect.js +83 -0
  192. package/dist/actions/select/areaSelect.js.map +1 -0
  193. package/dist/actions/select/clearSelection.js +33 -0
  194. package/dist/actions/select/clearSelection.js.map +1 -0
  195. package/dist/actions/swap/action.js +63 -0
  196. package/dist/actions/swap/action.js.map +1 -0
  197. package/dist/actions/swap/swapOps.js +160 -0
  198. package/dist/actions/swap/swapOps.js.map +1 -0
  199. package/dist/actions/transformAgain/action.js +90 -0
  200. package/dist/actions/transformAgain/action.js.map +1 -0
  201. package/dist/actions/transformAgain/transformSelection.js +49 -0
  202. package/dist/actions/transformAgain/transformSelection.js.map +1 -0
  203. package/dist/booleans/booleans.js +130 -0
  204. package/dist/booleans/booleans.js.map +1 -0
  205. package/dist/booleans/commit.js +45 -0
  206. package/dist/booleans/commit.js.map +1 -0
  207. package/dist/booleans/custom.js +48 -0
  208. package/dist/booleans/custom.js.map +1 -0
  209. package/dist/booleans/operands.js +50 -0
  210. package/dist/booleans/operands.js.map +1 -0
  211. package/dist/booleans/pieces.js +43 -0
  212. package/dist/booleans/pieces.js.map +1 -0
  213. package/dist/booleans/placement.js +37 -0
  214. package/dist/booleans/placement.js.map +1 -0
  215. package/dist/booleans/useBooleans.js +34 -0
  216. package/dist/booleans/useBooleans.js.map +1 -0
  217. package/dist/booleans/useBooleansAdapter.js +11 -0
  218. package/dist/booleans/useBooleansAdapter.js.map +1 -0
  219. package/dist/chrome/affordances/cornerResize.js +123 -0
  220. package/dist/chrome/affordances/cornerResize.js.map +1 -0
  221. package/dist/chrome/affordances/rotateCursor.js +17 -0
  222. package/dist/chrome/affordances/rotateCursor.js.map +1 -0
  223. package/dist/chrome/affordances/rotationHandle.js +117 -0
  224. package/dist/chrome/affordances/rotationHandle.js.map +1 -0
  225. package/dist/chrome/handleCommands.js +110 -0
  226. package/dist/chrome/handleCommands.js.map +1 -0
  227. package/dist/chrome/overlay.js +271 -0
  228. package/dist/chrome/overlay.js.map +1 -0
  229. package/dist/chrome/rotationBadge.js +132 -0
  230. package/dist/chrome/rotationBadge.js.map +1 -0
  231. package/dist/chrome/rotationHandleGeometry.js +49 -0
  232. package/dist/chrome/rotationHandleGeometry.js.map +1 -0
  233. package/dist/chrome/selectionChrome.js +25 -0
  234. package/dist/chrome/selectionChrome.js.map +1 -0
  235. package/dist/chrome/selectionPose.js +112 -0
  236. package/dist/chrome/selectionPose.js.map +1 -0
  237. package/dist/chrome/shapeOutline.js +137 -0
  238. package/dist/chrome/shapeOutline.js.map +1 -0
  239. package/dist/clipboard/clipboardOps.js +48 -0
  240. package/dist/clipboard/clipboardOps.js.map +1 -0
  241. package/dist/clipboard/materializePaste.js +34 -0
  242. package/dist/clipboard/materializePaste.js.map +1 -0
  243. package/dist/clipboard/osClipboard.js +67 -0
  244. package/dist/clipboard/osClipboard.js.map +1 -0
  245. package/dist/clipboard/useClipboard.js +64 -0
  246. package/dist/clipboard/useClipboard.js.map +1 -0
  247. package/dist/clipboard/wireFormat.js +108 -0
  248. package/dist/clipboard/wireFormat.js.map +1 -0
  249. package/dist/deps/areaSelect.js +42 -0
  250. package/dist/deps/areaSelect.js.map +1 -0
  251. package/dist/deps/booleans.js +99 -0
  252. package/dist/deps/booleans.js.map +1 -0
  253. package/dist/deps/insert.js +260 -0
  254. package/dist/deps/insert.js.map +1 -0
  255. package/dist/deps/lassoSelect.js +37 -0
  256. package/dist/deps/lassoSelect.js.map +1 -0
  257. package/dist/deps/presetDeps.js +40 -0
  258. package/dist/deps/presetDeps.js.map +1 -0
  259. package/dist/deps/resizePolicy.js +41 -0
  260. package/dist/deps/resizePolicy.js.map +1 -0
  261. package/dist/engine-BV9RDHOL.d.ts +339 -0
  262. package/dist/engine.d.ts +6 -0
  263. package/dist/engine.js +10 -0
  264. package/dist/engineStandardActions.js +54 -0
  265. package/dist/engineStandardActions.js.map +1 -0
  266. package/dist/groups.d.ts +27 -0
  267. package/dist/groups.js +4 -0
  268. package/dist/icons.gen.js +8 -0
  269. package/dist/icons.gen.js.map +1 -0
  270. package/dist/icons.table.d.ts +6 -0
  271. package/dist/icons.table.js +8 -0
  272. package/dist/icons.table.js.map +1 -0
  273. package/dist/icons.table.json +156 -0
  274. package/dist/icons2.table.js +163 -0
  275. package/dist/icons2.table.js.map +1 -0
  276. package/dist/index.d.ts +1867 -0
  277. package/dist/index.js +86 -0
  278. package/dist/ingest/ghost.js +58 -0
  279. package/dist/ingest/ghost.js.map +1 -0
  280. package/dist/ingest/imageHandler.js +80 -0
  281. package/dist/ingest/imageHandler.js.map +1 -0
  282. package/dist/ingest/kitHandlers.js +15 -0
  283. package/dist/ingest/kitHandlers.js.map +1 -0
  284. package/dist/ingest/svgHandler.js +97 -0
  285. package/dist/ingest/svgHandler.js.map +1 -0
  286. package/dist/ingest/weaselJsonHandler.js +68 -0
  287. package/dist/ingest/weaselJsonHandler.js.map +1 -0
  288. package/dist/namedPresets.js +83 -0
  289. package/dist/namedPresets.js.map +1 -0
  290. package/dist/presets/arrange.js +65 -0
  291. package/dist/presets/arrange.js.map +1 -0
  292. package/dist/presets/booleans.js +13 -0
  293. package/dist/presets/booleans.js.map +1 -0
  294. package/dist/presets/composites.js +46 -0
  295. package/dist/presets/composites.js.map +1 -0
  296. package/dist/presets/edit.js +125 -0
  297. package/dist/presets/edit.js.map +1 -0
  298. package/dist/presets/ingest.js +17 -0
  299. package/dist/presets/ingest.js.map +1 -0
  300. package/dist/presets/insert.js +28 -0
  301. package/dist/presets/insert.js.map +1 -0
  302. package/dist/presets/pathfinder.js +26 -0
  303. package/dist/presets/pathfinder.js.map +1 -0
  304. package/dist/presets/select.js +31 -0
  305. package/dist/presets/select.js.map +1 -0
  306. package/dist/presets/selection.js +13 -0
  307. package/dist/presets/selection.js.map +1 -0
  308. package/dist/presets/selectionChrome.js +15 -0
  309. package/dist/presets/selectionChrome.js.map +1 -0
  310. package/dist/presets/tools.js +84 -0
  311. package/dist/presets/tools.js.map +1 -0
  312. package/dist/presets/transform.js +52 -0
  313. package/dist/presets/transform.js.map +1 -0
  314. package/dist/presets.d.ts +104 -0
  315. package/dist/presets.js +15 -0
  316. package/dist/selection/useSelection.js +127 -0
  317. package/dist/selection/useSelection.js.map +1 -0
  318. package/dist/test-seams.d.ts +50 -0
  319. package/dist/test-seams.js +4 -0
  320. package/dist/tools/ellipse/useEllipseTool.js +72 -0
  321. package/dist/tools/ellipse/useEllipseTool.js.map +1 -0
  322. package/dist/tools/eyedropper/useEyedropperTool.js +100 -0
  323. package/dist/tools/eyedropper/useEyedropperTool.js.map +1 -0
  324. package/dist/tools/image/useImageTool.js +57 -0
  325. package/dist/tools/image/useImageTool.js.map +1 -0
  326. package/dist/tools/lasso/useLassoTool.js +96 -0
  327. package/dist/tools/lasso/useLassoTool.js.map +1 -0
  328. package/dist/tools/line/useLineTool.js +67 -0
  329. package/dist/tools/line/useLineTool.js.map +1 -0
  330. package/dist/tools/polygon/usePolygonTool.js +149 -0
  331. package/dist/tools/polygon/usePolygonTool.js.map +1 -0
  332. package/dist/tools/rect/useRectTool.js +74 -0
  333. package/dist/tools/rect/useRectTool.js.map +1 -0
  334. package/dist/tools/select/adapterPointQuery.js +56 -0
  335. package/dist/tools/select/adapterPointQuery.js.map +1 -0
  336. package/dist/tools/select/collapseDeferred.js +35 -0
  337. package/dist/tools/select/collapseDeferred.js.map +1 -0
  338. package/dist/tools/select/extendPressLocked.js +17 -0
  339. package/dist/tools/select/extendPressLocked.js.map +1 -0
  340. package/dist/tools/select/groupEntry.js +73 -0
  341. package/dist/tools/select/groupEntry.js.map +1 -0
  342. package/dist/tools/select/pressDecision.js +39 -0
  343. package/dist/tools/select/pressDecision.js.map +1 -0
  344. package/dist/tools/select/selectDeep.js +39 -0
  345. package/dist/tools/select/selectDeep.js.map +1 -0
  346. package/dist/tools/select/selectPick.js +60 -0
  347. package/dist/tools/select/selectPick.js.map +1 -0
  348. package/dist/tools/select/selectionContributions.js +191 -0
  349. package/dist/tools/select/selectionContributions.js.map +1 -0
  350. package/dist/tools/select/usePickerSelectTool.js +145 -0
  351. package/dist/tools/select/usePickerSelectTool.js.map +1 -0
  352. package/dist/tools/select/useSelectTool.js +54 -0
  353. package/dist/tools/select/useSelectTool.js.map +1 -0
  354. package/dist/tools/shared/countOption.js +24 -0
  355. package/dist/tools/shared/countOption.js.map +1 -0
  356. package/dist/tools/shared/insertToolOptions.js +8 -0
  357. package/dist/tools/shared/insertToolOptions.js.map +1 -0
  358. package/dist/tools/shared/pointerFollower.js +23 -0
  359. package/dist/tools/shared/pointerFollower.js.map +1 -0
  360. package/dist/tools/shared/styleOptions.js +76 -0
  361. package/dist/tools/shared/styleOptions.js.map +1 -0
  362. package/dist/tools/star/useStarTool.js +149 -0
  363. package/dist/tools/star/useStarTool.js.map +1 -0
  364. package/dist/tools/toolSets.js +26 -0
  365. package/dist/tools/toolSets.js.map +1 -0
  366. package/dist/useStandardActions.js +26 -0
  367. package/dist/useStandardActions.js.map +1 -0
  368. package/package.json +87 -4
@@ -0,0 +1,1867 @@
1
+ import * as _weasel_js_routing from '@weasel-js/routing';
2
+ import { WorldPoint, ToolSet, ToolOptionsSpec, ToolOptionShare, BindingOptions, ToolKeybinding, HotkeyTrigger, ActionDeps, Action, GestureBinding, ActionUnavailable, Contribution } from '@weasel-js/routing';
3
+ import { SpatialReference, NodeId, Op, PoseDescriptor, PoseComposition, DrawnBoundsScene, Bounds, SpatialReferenceSources, BuiltinToolId, BuiltinShapeToolId, Tool, Scene, ContentHandlerEntry, SelectionChrome, SelectionHandlesLayerOptions, RenderLayer, SelectionOutlineLayerOptions, SelectionOverlayLayerOptions, CommonAffordanceScratch, ResizeAnchor, Affordance, FeaturePreset, BoundsConstraint, ResizeOptions, OpsApplier, InsertNodeFactories, RepeatableTransform, NodeOutline, PathPaint, NodeOutlineError } from '@weasel-js/core';
4
+ import { Scale2, PathFillRule, PoseLinear, FramedRect, Path, Affine } from '@weasel-js/geom';
5
+ import * as _weasel_js_prefs_schema from '@weasel-js/prefs-schema';
6
+ import { PrefGroup, PrefLeaf } from '@weasel-js/prefs-schema';
7
+ import { Paint, CommandStroke, CommandFill } from '@weasel-js/paint';
8
+ import { InsertBehavior, LassoSelectBehavior, LassoHitMode, StandardDeps, SnapTarget, MoveBehavior, OriginProjection, PoseDescriptor as PoseDescriptor$1, RunLifecycleOptions, BoundsConstraint as BoundsConstraint$1, AnyScene, BooleanShapeOp, Scene as Scene$1, OperandsDep, PasteOmission, ClipboardSnapshot, InsertAdapter, ClipboardDep } from '@weasel-js/core/engine';
9
+ import { PointerContextValue } from '@weasel-js/routing/react';
10
+ import { S as SelectAdapter, U as UseSelectToolOptions } from './engine-BV9RDHOL.js';
11
+ export { A as AREA_SELECT_ID, E as ENGINE_STANDARD_ACTIONS, a as EnterGroupOptions, G as GROUP_ENTRY_ID, b as GROUP_LEAVE_PRESS_BINDING, I as INSERT_DRAG_MODS, L as LeaveGroupOptions, c as SELECTION_MOVE_ID, d as SELECTION_RESIZE_ID, e as SELECTION_ROTATE_ID, f as SELECTION_TRANSFORM_ID, g as SelectionMoveOptions, h as SelectionRotateOptions, i as SelectionTransformOptions, j as UseSelectionOptions, k as areaSelectAction, l as createAreaSelectContribution, m as createEnterGroupAction, n as createGroupEntryContribution, o as createLeaveGroupAction, p as createPickerSelectTool, q as createSelection, r as createSelectionMoveContribution, s as createSelectionResizeContribution, t as createSelectionRotateContribution, u as createSelectionTransformContribution, v as insertAction, w as isBodyOffChrome, x as isEmptyOffChrome, y as moveAction, z as selectionMoveBindings, B as selectionResizeBindings, C as selectionRotateBindings, D as selectionTransformBindings, F as useGroupEntryContribution, H as usePickerSelectTool, J as useSelection } from './engine-BV9RDHOL.js';
12
+ import { CursorSpec } from '@weasel-js/cursor';
13
+ import { KeySpec } from '@weasel-js/gestures';
14
+
15
+ /** A glyph this package draws, by its bare name. */
16
+ type EditingIconName = 'ellipse' | 'eyedropper' | 'lasso' | 'line' | 'polygon' | 'rect' | 'select' | 'star' | 'duplicate' | 'transformAgain' | 'group' | 'ungroup' | 'bringForward' | 'bringToFront' | 'sendBackward' | 'sendToBack' | 'flipX' | 'swap' | 'flipY' | 'alignLeft' | 'alignRight' | 'alignTop' | 'alignBottom' | 'alignCenterX' | 'alignCenterY' | 'divide' | 'crop' | 'trim' | 'booleanGroup' | 'merge';
17
+ declare module '@weasel-js/icons' {
18
+ interface IconName {
19
+ 'editing:ellipse': true;
20
+ 'editing:eyedropper': true;
21
+ 'editing:lasso': true;
22
+ 'editing:line': true;
23
+ 'editing:polygon': true;
24
+ 'editing:rect': true;
25
+ 'editing:select': true;
26
+ 'editing:star': true;
27
+ 'editing:duplicate': true;
28
+ 'editing:transformAgain': true;
29
+ 'editing:group': true;
30
+ 'editing:ungroup': true;
31
+ 'editing:bringForward': true;
32
+ 'editing:bringToFront': true;
33
+ 'editing:sendBackward': true;
34
+ 'editing:sendToBack': true;
35
+ 'editing:flipX': true;
36
+ 'editing:swap': true;
37
+ 'editing:flipY': true;
38
+ 'editing:alignLeft': true;
39
+ 'editing:alignRight': true;
40
+ 'editing:alignTop': true;
41
+ 'editing:alignBottom': true;
42
+ 'editing:alignCenterX': true;
43
+ 'editing:alignCenterY': true;
44
+ 'editing:divide': true;
45
+ 'editing:crop': true;
46
+ 'editing:trim': true;
47
+ 'editing:booleanGroup': true;
48
+ 'editing:merge': true;
49
+ }
50
+ }
51
+
52
+ /** Edge or center the selection should align to within the reference's
53
+ * bounds (rotated members contribute their ink extent). */
54
+ type AlignEdge = 'left' | 'right' | 'top' | 'bottom' | 'center-x' | 'center-y';
55
+ /** What the selection aligns to: `'union'` — the selection's
56
+ * own visual union AABB, the default — or a {@link SpatialReference}. */
57
+ type AlignReference = 'union' | SpatialReference;
58
+ /** The bounds each member of `bounds` aligns to under `to`, or
59
+ * `null` when there is nothing to align: a union of fewer than two members,
60
+ * an empty selection, or a reference that names nothing right now. */
61
+ declare function alignTargetBounds(bounds: readonly Bounds[], to: AlignReference | undefined, src: SpatialReferenceSources): Bounds | null;
62
+ /** Adapter for `useAlign`. */
63
+ interface AlignAdapter<TPose> {
64
+ getSelection(): NodeId[];
65
+ /** The pose as stored — local to the node's parent. */
66
+ getPose(id: NodeId): TPose;
67
+ /** The node's container, `null` for a root: the chain a pose is composed
68
+ * through when container poses define a frame. */
69
+ getParent(id: NodeId): NodeId | null;
70
+ applyOps?(ops: Op[], label?: string): void;
71
+ }
72
+ /** Options for `useAlign`. */
73
+ interface UseAlignOptions<TPose> {
74
+ /** Projection between `TPose` and bounds. Defaults to `RECT_POSE_DESCRIPTOR`
75
+ * for `{x,y,width,height}` poses. Pass `pathPoseDescriptor` for `Path`
76
+ * poses so polygon coords translate correctly. */
77
+ geometry?: PoseDescriptor<TPose>;
78
+ /** Label passed to applyOps. Default 'Align'. */
79
+ label?: string;
80
+ /** How local poses fold up to world. Default IDENTITY, which takes every
81
+ * pose the adapter answers as world; over a scene's adapter, pass
82
+ * `scene.composition`. */
83
+ composition?: PoseComposition<TPose>;
84
+ /** The nodes behind the adapter's ids. With it, a stroked node aligns by
85
+ * the box it is drawn with (`drawnBoundsOf`); without, by its pose box.
86
+ * Pass a `Scene` through `drawnBoundsScene` so a path-derived node is
87
+ * boxed by its path. */
88
+ scene?: DrawnBoundsScene;
89
+ /** View scale a screen-pixel stroke is resolved at. Default 1. */
90
+ viewScale?: () => number | Scale2;
91
+ }
92
+ /** Return shape of `useAlign`. */
93
+ interface UseAlignReturn {
94
+ /** Imperative trigger. `to` defaults to `'union'`, which needs two items;
95
+ * any other reference aligns a single item too. `'pointer'` reads the
96
+ * surrounding `<PointerContextProvider>`. */
97
+ align(edge: AlignEdge, to?: AlignReference): void;
98
+ }
99
+ /** Compute the (dx, dy) translation that moves AABB `b` so that the requested
100
+ * `edge`/center matches the corresponding feature of the union AABB `u`. */
101
+ declare function alignDeltaFor(b: Bounds, u: Bounds, edge: AlignEdge): {
102
+ dx: number;
103
+ dy: number;
104
+ };
105
+ /** Align the current selection to a shared edge or center of the selection's
106
+ * union AABB, or of another reference. Single batch — one undo step.
107
+ *
108
+ * The edge is a world edge: bounds are measured and translated in world, and
109
+ * each result is stored back in its own parent's frame. A node in a singular
110
+ * frame, where no stored pose reaches the edge, stays where it is. */
111
+ declare function useAlign<TPose>(adapter: AlignAdapter<TPose>, options?: UseAlignOptions<TPose>): UseAlignReturn;
112
+
113
+ /** Axis along which selection is distributed. `'x'` spreads horizontally. */
114
+ type DistributeAxis = 'x' | 'y';
115
+ /** `'centers'` spaces centers equally; `'gaps'` makes the gap between
116
+ * consecutive items equal. Both measure a rotated item by its ink extent.
117
+ * Endpoints stay put in both modes. */
118
+ type DistributeMode = 'centers' | 'gaps';
119
+ /** Adapter for `useDistribute`. */
120
+ interface DistributeAdapter<TPose> {
121
+ getSelection(): NodeId[];
122
+ /** The pose as stored — local to the node's parent. */
123
+ getPose(id: NodeId): TPose;
124
+ /** The node's container, `null` for a root: the chain a pose is composed
125
+ * through when container poses define a frame. */
126
+ getParent(id: NodeId): NodeId | null;
127
+ applyOps?(ops: Op[], label?: string): void;
128
+ }
129
+ /** Options for `useDistribute`. */
130
+ interface UseDistributeOptions<TPose> {
131
+ /** Projection between `TPose` and bounds. Defaults to `RECT_POSE_DESCRIPTOR`
132
+ * for `{x,y,width,height}` poses. */
133
+ geometry?: PoseDescriptor<TPose>;
134
+ /** Default mode when `distribute(axis)` is called without one. Default 'centers'. */
135
+ defaultMode?: DistributeMode;
136
+ /** Label passed to applyOps. Default 'Distribute'. */
137
+ label?: string;
138
+ /** How local poses fold up to world. Default IDENTITY, which takes every
139
+ * pose the adapter answers as world; over a scene's adapter, pass
140
+ * `scene.composition`. */
141
+ composition?: PoseComposition<TPose>;
142
+ /** The nodes behind the adapter's ids, as `useAlign` takes them: with it, a
143
+ * stroked node is spaced by the box it is drawn with. */
144
+ scene?: UseAlignOptions<TPose>['scene'];
145
+ /** View scale a screen-pixel stroke is resolved at. Default 1. */
146
+ viewScale?: UseAlignOptions<TPose>['viewScale'];
147
+ }
148
+ /** Return shape of `useDistribute`. */
149
+ interface UseDistributeReturn {
150
+ /** Imperative trigger. No-op when fewer than 3 items selected. */
151
+ distribute(axis: DistributeAxis, mode?: DistributeMode): void;
152
+ }
153
+ /** Distribute the current multi-selection along `axis`. Requires ≥3 items;
154
+ * no-op otherwise. Endpoints (min and max along the axis) stay put; the
155
+ * remaining items are repositioned. Single batch — one undo step.
156
+ *
157
+ * The span being divided is a world span: bounds are measured and translated
158
+ * in world, and each result is stored back in its own parent's frame. A node
159
+ * in a singular frame stays where it is. */
160
+ declare function useDistribute<TPose>(adapter: DistributeAdapter<TPose>, options?: UseDistributeOptions<TPose>): UseDistributeReturn;
161
+
162
+ /**
163
+ * Pose-flip helpers used by `flipAction` (via `defaults/flip.ts`).
164
+ *
165
+ * These were extracted from the legacy `useFlip` hook when it was removed —
166
+ * they remain because the descriptor-style `flipAction` still needs to reflect
167
+ * arbitrary `TPose` values through a `PoseDescriptor`.
168
+ */
169
+
170
+ /** Axis for flip. `'x'` mirrors horizontally (left↔right); `'y'` mirrors vertically (top↔bottom). */
171
+ type FlipAxis = 'x' | 'y';
172
+ /** How a multi-selection flip chooses its pivot.
173
+ *
174
+ * - `'each'` — every pose mirrors about its own AABB; spatial layout of the
175
+ * selection is unchanged, individual items are reflected in place.
176
+ * - `'union'` — every pose mirrors about the selection's union AABB; items
177
+ * swap sides as well as reflect.
178
+ * - a {@link SpatialReference} — every pose mirrors about the center of the
179
+ * bounds it names: the pointer, a world point or rect, or a key node. */
180
+ type FlipPivot = 'each' | 'union' | SpatialReference;
181
+
182
+ /**
183
+ * The params editing's own actions read, merged into routing's
184
+ * `ActionParamSchema` so `<SceneCanvas tune>` types them.
185
+ */
186
+
187
+ /** `align.*`'s params. */
188
+ type AlignParams = {
189
+ /** The point a reference of `'pointer'` resolves to in place of the pointer dep. */
190
+ world?: WorldPoint;
191
+ /** Default the selection. */
192
+ to?: AlignReference;
193
+ };
194
+ /** `flip`'s params. */
195
+ type FlipParams = {
196
+ /** The point a pivot of `'pointer'` resolves to in place of the pointer dep. */
197
+ world?: WorldPoint;
198
+ /** Default `'x'`. */
199
+ axis?: FlipAxis;
200
+ /** Default `'each'`. */
201
+ pivot?: FlipPivot;
202
+ };
203
+ /** A `distribute.*` action's params: what it spaces evenly. */
204
+ type DistributeParams = {
205
+ mode?: DistributeMode;
206
+ };
207
+ /** A reorder action's params: one step, or all the way to the front or back. */
208
+ type ReorderParams = {
209
+ distance?: 'adjacent' | 'extreme';
210
+ };
211
+ declare module '@weasel-js/routing' {
212
+ interface ActionParamSchema {
213
+ 'align.left': AlignParams;
214
+ 'align.centerX': AlignParams;
215
+ 'align.right': AlignParams;
216
+ 'align.top': AlignParams;
217
+ 'align.centerY': AlignParams;
218
+ 'align.bottom': AlignParams;
219
+ flip: FlipParams;
220
+ 'distribute.horizontal': DistributeParams;
221
+ 'distribute.vertical': DistributeParams;
222
+ 'reorder.forward': ReorderParams;
223
+ 'reorder.backward': ReorderParams;
224
+ }
225
+ }
226
+
227
+ /** Every tool id the kit ships: core's own (the hand) and the ones editing's presets offer. */
228
+ type KitToolId = BuiltinToolId | 'select' | BuiltinShapeToolId;
229
+ /** The selection tools: click and marquee, and the lasso. */
230
+ declare const SELECT_TOOLS: ToolSet<KitToolId>;
231
+ /** The tools that drag out a closed or open primitive. */
232
+ declare const SHAPE_TOOLS: ToolSet<KitToolId>;
233
+ /** The kit's tool sets in palette order: selection, then navigation, then the tools that make things. Each set is
234
+ * named for the presentation group its tools sit in. */
235
+ declare const KIT_TOOL_GROUPS: readonly ToolSet<KitToolId>[];
236
+ /** The natural order of palette groups, as `ToolPalette`'s `groupOrder`. */
237
+ declare const TOOL_GROUP_ORDER: readonly string[];
238
+ /** Every kit tool, in palette order: {@link KIT_TOOL_GROUPS} one after another, then any shape kind in no
239
+ * family. */
240
+ declare const KIT_TOOLS: ToolSet<KitToolId>;
241
+ /** Every kit tool id, in palette order: {@link KIT_TOOLS} opened. A palette orders the tools within each group
242
+ * by it. */
243
+ declare const KIT_TOOL_IDS: readonly KitToolId[];
244
+
245
+ /** The style params an insert reads, each a shape tool's option of the same name. */
246
+ declare const STYLE_OPTION_KEYS: readonly ["fill", "stroke", "strokeWidth", "fillRule"];
247
+ /** One of {@link STYLE_OPTION_KEYS}. */
248
+ type StyleOptionKey = (typeof STYLE_OPTION_KEYS)[number];
249
+ /** The stroke width a new shape is drawn with, in world units, when nothing names one. */
250
+ declare const DEFAULT_STROKE_WIDTH = 2;
251
+ /** The style an insert is drawn with, as `extras.style` hands it to the `insert` dep. A key left out is the dep's
252
+ * own choice; `null` paints none of it. */
253
+ interface InsertStyle {
254
+ fill?: Paint | null;
255
+ stroke?: Paint | null;
256
+ strokeWidth?: number;
257
+ fillRule?: PathFillRule;
258
+ }
259
+ /** The style `params` carry, or `undefined` when they carry none. */
260
+ declare function insertStyleOf(params: Readonly<Record<string, unknown>> | undefined): InsertStyle | undefined;
261
+
262
+ /**
263
+ * The style a shape tool draws with, declared as its tool options: fill,
264
+ * stroke, stroke width, and a path's fill rule. Each is shared under its own
265
+ * name, so every shape tool reads one fill until a tool or its user keeps one
266
+ * of its own (`share: { fill: null }`).
267
+ */
268
+
269
+ /** The kit's color for a new shape: the first of its palette. */
270
+ declare const DEFAULT_SHAPE_PAINT: Paint;
271
+ /** `paint` in the one spelling every tool option's color default takes: `solid`'s, six hex digits with any alpha
272
+ * as `opacity`, so `#000` and `#000000ff` read as one value. Any other paint comes back as it is. */
273
+ declare function toolOptionPaint(paint: Paint | null): Paint | null;
274
+ /** Each style option's leaf, defaulting to `defaults`. */
275
+ declare function styleOptionLeaves(defaults: InsertStyle, keys: readonly StyleOptionKey[]): Record<string, PrefLeaf>;
276
+ /** What a shape tool declares about its options. */
277
+ interface ShapeToolOptionsSpec {
278
+ /** The action, or actions, the options are params of. */
279
+ actionId: ToolOptionsSpec['actionId'];
280
+ /** The options group's name: the tool's. */
281
+ name: string;
282
+ /** Which style options it takes, and their defaults. */
283
+ style: InsertStyle;
284
+ keys: readonly StyleOptionKey[];
285
+ /** Its options besides the style ones, kept per tool. */
286
+ own?: PrefGroup['children'];
287
+ }
288
+ /** A shape tool's options: its style options, each shared under its own name, and its own beside them. */
289
+ declare function shapeToolOptions(spec: ShapeToolOptionsSpec): ToolOptionsSpec;
290
+
291
+ /** Options every drag-to-insert tool takes. */
292
+ interface InsertToolOptions {
293
+ /** Behaviors `insertAction` runs over the drag's start and current point
294
+ * after the snap session, in order. Keep the array stable across renders:
295
+ * a new one rebuilds the tool. */
296
+ behaviors?: readonly InsertBehavior<unknown>[];
297
+ /** Laid over the tool's own option shares: `{ fill: null }` keeps this
298
+ * tool's fill its own rather than the one every shape tool shares. Keep it
299
+ * stable across renders: a new one rebuilds the tool. */
300
+ share?: ToolOptionShare;
301
+ }
302
+ /** The insert binding's `opts.behaviors` entry, left out when there are none. */
303
+ declare function insertBindingBehaviors(behaviors: InsertToolOptions['behaviors']): Pick<BindingOptions, 'behaviors'>;
304
+
305
+ /** A tool's subscription to the `pointer` dep, held only while it has
306
+ * something trailing to the pointer. */
307
+ interface PointerFollower {
308
+ /** The store being followed, or `null`. */
309
+ pointer(): PointerContextValue | null;
310
+ /** Start following `next`; a no-op for the store already followed. */
311
+ follow(next: PointerContextValue | undefined): void;
312
+ unfollow(): void;
313
+ }
314
+ /** `onMove` runs after every change of the followed pointer. */
315
+ declare function createPointerFollower(onMove: () => void): PointerFollower;
316
+
317
+ /** The rectangle tool's options: the style it draws with, shared with every shape tool. */
318
+ declare const RECT_TOOL_OPTIONS: _weasel_js_routing.ToolOptionsSpec;
319
+ /**
320
+ * Drag-to-draw rectangle tool.
321
+ *
322
+ * The `drag` binding routes to `insertAction`, which owns the live preview
323
+ * and commits via the `insert` dep on release. Consumers wanting a custom
324
+ * node give the dep a factory (`<SceneCanvas insertNodeFactories={{ rect }}>`)
325
+ * rather than changing the tool. Grid snapping comes from the `snap` dep.
326
+ */
327
+ declare function createRectTool(options?: InsertToolOptions): Tool;
328
+ /** {@link createRectTool}, kept while its options are. */
329
+ declare function useRectTool(options?: InsertToolOptions): Tool;
330
+
331
+ /** The ellipse tool's options: the style it draws with, shared with every shape tool. */
332
+ declare const ELLIPSE_TOOL_OPTIONS: _weasel_js_routing.ToolOptionsSpec;
333
+ /**
334
+ * Drag-to-draw ellipse tool. Mirrors `useRectTool`: the `drag` binding
335
+ * routes to `insertAction`, which owns the live preview and commits
336
+ * through the `insert` dep. Alt toggles from-corner ⇄ from-center
337
+ * mid-drag via the action's live modifier read.
338
+ */
339
+ declare function createEllipseTool(options?: InsertToolOptions): Tool;
340
+ /** {@link createEllipseTool}, kept while its options are. */
341
+ declare function useEllipseTool(options?: InsertToolOptions): Tool;
342
+
343
+ /** An endpoint of a line, in world coordinates. */
344
+ type LinePoint = WorldPoint;
345
+ /** The line tool's options: the style it draws with, shared with every shape tool. */
346
+ declare const LINE_TOOL_OPTIONS: _weasel_js_routing.ToolOptionsSpec;
347
+ /**
348
+ * Drag-to-draw line tool. The `drag` binding routes to `insertAction`, which
349
+ * commits through the `insert` dep with `{ kind: 'line', a, b }` endpoints
350
+ * (not the AABB diagonal), so the drag direction is preserved.
351
+ *
352
+ * Shift constrains to 15° increments; alt mirrors the end around the start
353
+ * (the drag is treated as a half-line).
354
+ */
355
+ declare function createLineTool(options?: InsertToolOptions): Tool;
356
+ /** {@link createLineTool}, kept while its options are. */
357
+ declare function useLineTool(options?: InsertToolOptions): Tool;
358
+
359
+ /** A point in world coordinates. */
360
+ type PolygonPoint = WorldPoint;
361
+ /** Options for `usePolygonTool`. */
362
+ interface UsePolygonToolOptions extends InsertToolOptions {
363
+ label?: string;
364
+ /** The side count before its user changes it, the `sides` option's
365
+ * default. It persists across gestures and is
366
+ * adjustable mid-drag via ArrowUp/Down or wheel (range 3–32). */
367
+ sides?: number;
368
+ }
369
+ /** The polygon tool's options: the style it draws with, shared with every shape tool, and its side count. */
370
+ declare const POLYGON_TOOL_OPTIONS: _weasel_js_routing.ToolOptionsSpec;
371
+ /** {@link usePolygonTool}'s options, and what to call when a gesture changes the side count, so the live preview
372
+ * repaints. */
373
+ interface CreatePolygonToolOptions extends UsePolygonToolOptions {
374
+ onCountChange?: () => void;
375
+ }
376
+ /**
377
+ * Drag-from-center polygon tool. Pointerdown sets center; drag
378
+ * determines radius + rotation; release commits via `insertAction` (the
379
+ * kit's standard insert dep, sourced by `<SceneCanvas>`). Side count
380
+ * defaults to 6, adjustable mid-gesture via ArrowUp/Down or wheel.
381
+ *
382
+ * The live preview is painted by the dispatcher overlay layer reading
383
+ * `insertAction.overlay()` — the action returns `{ kind:'insertPreview',
384
+ * shape:'polygon', bounds, extras: { sides, ... } }`. Consumers wanting
385
+ * a custom polygon node shape override the `insert` dep.
386
+ *
387
+ * A side change mid-drag calls `onCountChange`.
388
+ */
389
+ declare function createPolygonTool(options?: CreatePolygonToolOptions): Tool;
390
+ /** {@link createPolygonTool}, kept while its options are, re-rendering its caller when the side count changes. */
391
+ declare function usePolygonTool(options?: UsePolygonToolOptions): Tool;
392
+
393
+ /** A point in world coordinates. */
394
+ type StarPoint = WorldPoint;
395
+ /** Options for `useStarTool`. */
396
+ interface UseStarToolOptions extends InsertToolOptions {
397
+ label?: string;
398
+ /** The point count before its user changes it, the `points` option's
399
+ * default. Persists across gestures, adjustable
400
+ * mid-drag via ArrowUp/Down or wheel (range 3–32). */
401
+ points?: number;
402
+ /** The inner-radius / outer-radius ratio before its user changes it, the
403
+ * `innerRadiusRatio` option's default. Default 0.5. */
404
+ innerRatio?: number;
405
+ }
406
+ /** The star tool's options: the style it draws with, shared with every shape tool, and its points and inner radius. */
407
+ declare const STAR_TOOL_OPTIONS: _weasel_js_routing.ToolOptionsSpec;
408
+ /** {@link useStarTool}'s options, and what to call when a gesture changes the point count, so the live preview
409
+ * repaints. */
410
+ interface CreateStarToolOptions extends UseStarToolOptions {
411
+ onCountChange?: () => void;
412
+ }
413
+ /**
414
+ * Drag-from-center star tool. Pointerdown sets center; drag determines
415
+ * outer radius + rotation; release commits via `insertAction`. Inner
416
+ * radius = outer × `innerRatio` (default 0.5). Point count defaults to
417
+ * 5, adjustable mid-gesture via ArrowUp/Down or wheel.
418
+ *
419
+ * Live preview painted by the dispatcher overlay layer reading
420
+ * `insertAction.overlay()`. Consumers wanting custom star geometry
421
+ * override the `insert` dep.
422
+ *
423
+ * A point change mid-drag calls `onCountChange`.
424
+ */
425
+ declare function createStarTool(options?: CreateStarToolOptions): Tool;
426
+ /** {@link createStarTool}, kept while its options are, re-rendering its caller when the point count changes. */
427
+ declare function useStarTool(options?: UseStarToolOptions): Tool;
428
+
429
+ /** Option surface for the `lasso-select` action. */
430
+
431
+ /** Options for the `lasso-select` action. */
432
+ interface UseLassoSelectOptions {
433
+ behaviors?: LassoSelectBehavior[];
434
+ /** Skip vertices closer than this many world-px to the previous one.
435
+ * Default 2. Set 0 to record every move sample. */
436
+ minVertexSpacing?: number;
437
+ }
438
+
439
+ /** The lasso's options: which shapes its loop selects, its own rather than shared. */
440
+ declare const LASSO_TOOL_OPTIONS: ToolOptionsSpec;
441
+ /** Options for `useLassoTool` — the lasso-select action's options plus the
442
+ * tool's own hit mode and activation key. */
443
+ interface UseLassoToolOptions extends UseLassoSelectOptions {
444
+ /** Hit mode for the action's own selection commit, which runs when no
445
+ * behavior claims the gesture: the `mode` option's default. A behavior
446
+ * carries its own, as `selectFromLasso({ mode })` does. Default 'intersect'. */
447
+ mode?: LassoHitMode;
448
+ /** Override the default keybinding (`{ key: 'L' }`). Pass `null` to omit. */
449
+ keybinding?: ToolKeybinding | null;
450
+ }
451
+ /** Free-form polygon select Tool. Drag is handled entirely by the gesture
452
+ * dispatcher via the `lassoSelect` action binding below; the dispatcher
453
+ * overlay layer (`useDispatcherOverlayLayer`) paints the live polyline +
454
+ * dashed close-line while the gesture is in flight. Esc cancels through
455
+ * the dispatcher's standard cancel pipeline.
456
+ *
457
+ * The legacy `useLassoSelect` hook is removed — all gesture
458
+ * state, overlay rendering, and selection commit live in
459
+ * `lassoSelectAction` (see `src/interactions/actions/defaults/lassoSelect.ts`). */
460
+ declare function createLassoTool(options?: UseLassoToolOptions,
461
+ /** Read for the vertex spacing at each gesture instead of `options.minVertexSpacing`. */
462
+ spacing?: () => number | undefined): Tool;
463
+ /** {@link createLassoTool}, kept while its options are, reading the committed render's spacing. */
464
+ declare function useLassoTool(options?: UseLassoToolOptions): Tool;
465
+
466
+ /** Options for `useImageTool`. It takes an insert tool's `behaviors` but not
467
+ * its `share`: the image tool has no options for a share to lay over. */
468
+ interface UseImageToolOptions extends Pick<InsertToolOptions, 'behaviors'> {
469
+ /** Image source for inserted nodes — a URL, a `blob:` URL, or a
470
+ * `data:image/…;base64,…` URI. Stored verbatim on each new node's
471
+ * `data.image.src`. */
472
+ src: string;
473
+ label?: string;
474
+ /** What the live drag paints. `'bitmap'` (default) previews the decoded
475
+ * image inside the drag bounds, falling back to the outline until it
476
+ * decodes; `'outline'` never draws the image. */
477
+ preview?: 'bitmap' | 'outline';
478
+ }
479
+ /**
480
+ * Drag-to-insert image tool. A drag-rect commits a leaf node with
481
+ * `data: { image: { src } }` through the dispatcher's `insertAction` + the
482
+ * kit's `insert` dep (the same path the shape tools use); the `kit:image`
483
+ * painter renders it once the bitmap decodes.
484
+ *
485
+ * Thin declarative veneer — the node is minted by `useInsertDepSource`'s
486
+ * `'image'` case, not the tool. `src` is baked into the binding's `params`
487
+ * so the insert dep can stamp it onto the new node.
488
+ */
489
+ declare function useImageTool(options: UseImageToolOptions): Tool;
490
+
491
+ /** Options for `useEyedropperTool`. */
492
+ interface UseEyedropperToolOptions {
493
+ /** Called when the user picks a color. `null` means `colorOf` returned
494
+ * null on a real hit; an empty click is a no-op. */
495
+ onPick: (color: string | null) => void;
496
+ /**
497
+ * Sample a node's declared color instead of pixels: map the id of the
498
+ * topmost node under the press to its color, or `null` if it has none.
499
+ * Omitted, the tool samples the pixel under the press through the
500
+ * `colorAt` dep — on `<SceneCanvas>`, its document layers drawn again at
501
+ * that point, with no chrome in them.
502
+ */
503
+ colorOf?: (id: string) => string | null;
504
+ /** Override the default `{ key: 'I' }` keybinding. Pass `null` to omit
505
+ * the keybinding entirely (palette-only or hotkey-only wiring). */
506
+ keybinding?: ToolKeybinding | null;
507
+ /** A modifier that engages the tool while held (`'alt'`). Default none: a held
508
+ * Alt would shadow every other tool's Alt-click. `null` also means none. */
509
+ hotkey?: HotkeyTrigger | null;
510
+ }
511
+ /**
512
+ * Eyedropper. Click to sample a color; the consumer's `onPick` callback
513
+ * decides where it goes. Engages as a sticky active-slot tool (`I`
514
+ * keybinding, or `null` for none), and as a momentary hotkey-slot tool only
515
+ * while a `hotkey` its caller names is held.
516
+ *
517
+ * Does not mutate the scene. Click-only; drag is unbound.
518
+ *
519
+ * By default it samples the pixel under the press, through the `colorAt` dep
520
+ * at the press's screen point (the `view` dep maps it there), and a click on
521
+ * nothing drawn picks nothing. Given `colorOf`, it samples the node under the
522
+ * press instead, which comes from the `nodeAtPoint` dep. Either way, a
523
+ * consumer that never registered the dep samples nothing.
524
+ */
525
+ declare function useEyedropperTool(opts: UseEyedropperToolOptions): Tool;
526
+
527
+ /** The select tool: {@link createPickerSelectTool} with `options().pickEvery` and `options().between`, or the kit's
528
+ * adapter walks where they are omitted, read live. */
529
+ declare function createSelectTool<TNode extends {
530
+ id: string;
531
+ }, TPose>(adapter: () => SelectAdapter<TNode, TPose>, options: () => UseSelectToolOptions<TPose>): Tool;
532
+ /** {@link createSelectTool} for the life of the calling component, reading `adapter` and `options` live. */
533
+ declare function useSelectTool<TNode extends {
534
+ id: string;
535
+ }, TPose>(adapter: SelectAdapter<TNode, TPose>, options: UseSelectToolOptions<TPose>): Tool;
536
+
537
+ /**
538
+ * Delete ops for the sources a removal of `ids` takes with it (see
539
+ * `hiddenSourcesTakenWith`), for an action whose own ops remove `ids` some
540
+ * other way. Append them after those ops: a delete finds its slot as it runs.
541
+ * Sources in `keep` stay.
542
+ */
543
+ declare function hiddenSourceDeleteOps(scene: Scene<unknown, string, unknown>, ids: readonly NodeId[], label: string, keep?: ReadonlySet<NodeId>): Op[];
544
+ /** Options for {@link createDeleteAction}. */
545
+ interface DeleteActionOptions {
546
+ /** Runs in place of the default, {@link commitDeleteToScene}. */
547
+ commit?: (ids: readonly NodeId[], deps: ActionDeps) => void;
548
+ }
549
+ /** The default commit: removes `ids`, their dependents, and the sources a
550
+ * path effect among them hid, as one undo entry, then empties the operands. */
551
+ declare function commitDeleteToScene(ids: readonly NodeId[], deps: ActionDeps, label?: string): void;
552
+ /** Delete on Delete and Backspace: hands the operands to `commit`. */
553
+ declare function createDeleteAction(opts?: DeleteActionOptions): Action & {
554
+ requires: string[];
555
+ };
556
+ /**
557
+ * Removes every selected node from the scene as one undo entry. Undo restores
558
+ * everything the removal cascaded — a container's children and a deleted
559
+ * node's dependents come back with it, at their own slots.
560
+ */
561
+ declare const deleteAction: Action & {
562
+ requires: string[];
563
+ };
564
+
565
+ /**
566
+ * The kit's content handlers: images, SVG, and nodes a kit canvas copied. `presets.ingest` brings them to the
567
+ * canvas, not to the page-wide registry, so one canvas turning one off leaves the others alone.
568
+ */
569
+
570
+ /** The kit's content handlers, by the order `presets.ingest` brings them in; `<SceneCanvas ingestion.kitHandlers>`
571
+ * turns any of them off. */
572
+ declare const KIT_CONTENT_HANDLERS: readonly ContentHandlerEntry[];
573
+
574
+ /** The kit's selection chrome: the outline, resize handles and rotate badge it paints, and the rotate ring and
575
+ * handles a press grabs, beneath the canvas's anchors. */
576
+ declare const SELECTION_CHROME: SelectionChrome;
577
+
578
+ /**
579
+ * The pose and box a selection's chrome is drawn around: precedence between
580
+ * the in-flight overlays and the stored pose, a container's union over its
581
+ * leaves, and the drawn box a scene supplies.
582
+ */
583
+
584
+ /** Options for `composeSelectionPose`. */
585
+ interface ComposeSelectionPoseOptions<TPose> {
586
+ /** Move overlay; when present its `poses` map wins over everything else. */
587
+ moveOverlay?: {
588
+ poses: Map<string, TPose>;
589
+ } | null;
590
+ /**
591
+ * Resize overlay; consulted only when move overlay does not own the id.
592
+ * For container resize, `leafPoses` (when present) maps each leaf id under
593
+ * the container to its overlay pose. If absent the container falls back to
594
+ * stored leaf poses.
595
+ */
596
+ resizeOverlay?: {
597
+ id: string;
598
+ currentPose: TPose;
599
+ leafPoses?: Map<string, TPose>;
600
+ } | null;
601
+ /** Fallback pose lookup (typically the stored/committed pose). */
602
+ getStoredPose: (id: string) => TPose;
603
+ /** How to read poses. Default `AUTO_POSE_DESCRIPTOR`. */
604
+ poseDescriptor?: PoseDescriptor<TPose>;
605
+ /** Walk a container's direct children (e.g. `scene.childrenOf`). With
606
+ * `isContainer`, a selected container resolves to the union AABB of its
607
+ * transitive leaf poses instead of its own stored pose. */
608
+ getChildren?: (id: string) => readonly string[];
609
+ /** True when `id` is a structural container. */
610
+ isContainer?: (id: string) => boolean;
611
+ /** The nodes behind the ids. With it, a container's union takes each leaf
612
+ * as drawn, stroke included (`drawnBoundsOf`); without, its pose box. */
613
+ scene?: DrawnBoundsScene;
614
+ /** View scale a screen-pixel stroke is resolved at. Default 1. */
615
+ viewScale?: () => number | Scale2;
616
+ }
617
+ /**
618
+ * Build a pose resolver for a selection. Precedence per id:
619
+ * move overlay > resize overlay > stored. When `getChildren`/`isContainer`
620
+ * are supplied and the id resolves to a container, the resolver returns the
621
+ * union AABB of all transitive leaf poses (each leaf still subject to the
622
+ * precedence rules). Containers with no leaves resolve to `null`.
623
+ */
624
+ declare function composeSelectionPose<TPose>(opts: ComposeSelectionPoseOptions<TPose>): (id: string) => TPose | null;
625
+
626
+ /**
627
+ * Selection overlay primitives — render layers for drawing selection
628
+ * outlines and resize handles.
629
+ *
630
+ * **Pose shape:** TPose is generic; callers pass `poseDescriptor` for poses
631
+ * `AUTO_POSE_DESCRIPTOR` can't read. Container ids reduce via `unionAabb`
632
+ * over the projected AABBs.
633
+ */
634
+
635
+ /**
636
+ * `RenderLayer` that draws selection outlines only. Stack alongside
637
+ * `createSelectionHandlesLayer` (or use `createSelectionOverlayLayer`, which
638
+ * runs both passes in one layer) when both are wanted.
639
+ */
640
+ declare function createSelectionOutlineLayer<TPose>(opts: SelectionOutlineLayerOptions<TPose>): RenderLayer<unknown>;
641
+ /**
642
+ * `RenderLayer` that draws selection handles only. Stack on top of
643
+ * `createSelectionOutlineLayer` (handles render on top of the outline).
644
+ */
645
+ declare function createSelectionHandlesLayer<TPose>(opts: SelectionHandlesLayerOptions<TPose>): RenderLayer<unknown>;
646
+ /**
647
+ * Draws outlines then handles in a single layer. Exactly equivalent to
648
+ * stacking `createSelectionOutlineLayer` and `createSelectionHandlesLayer` —
649
+ * all three run the same body. Pass `handles: false` to render outlines only.
650
+ */
651
+ declare function createSelectionOverlayLayer<TPose>(opts: SelectionOverlayLayerOptions<TPose>): RenderLayer<unknown>;
652
+
653
+ /** Options for `createCornerResizeAffordance` — the size and appearance of
654
+ * the resize handles, and whether the edge midpoints get one. */
655
+ interface CornerResizeAffordanceOptions {
656
+ /** Hit radius (screen-px) for the handles. Default 8. */
657
+ handleHitRadius?: number;
658
+ /** Visual handle size (screen-px). Default 8. */
659
+ handleSize?: number;
660
+ fill?: string;
661
+ stroke?: string;
662
+ /** Add a handle at the middle of each edge, resizing along one axis with
663
+ * the opposite edge pinned. A side under `EDGE_HANDLE_MIN_RADII` hit radii
664
+ * on screen takes none. Default true. */
665
+ edges?: boolean;
666
+ }
667
+ /** What a corner-resize hit hands to the resize action: which corner stays
668
+ * put, what is being resized, and the world-space pivot to scale from. */
669
+ interface CornerResizeScratch extends CommonAffordanceScratch {
670
+ /** Resize anchor identifying the OPPOSITE corner or edge (the one that
671
+ * stays fixed). Matches the kit's existing ResizeAnchor convention. */
672
+ anchor: ResizeAnchor;
673
+ /** Id of the resize target. In multi-mode this is `MULTI_RESIZE_TARGET_ID`. */
674
+ targetId: string;
675
+ /** The fixed corner (an edge handle's: the opposite edge's midpoint) in
676
+ * **world** coords, with the target's rotation already applied. `resizeAction` scales from this point, and it has no access to
677
+ * the target transform, so the affordance resolves it here. */
678
+ fixedPoint: {
679
+ x: number;
680
+ y: number;
681
+ };
682
+ }
683
+ /**
684
+ * Resize-handle affordance for the active selection (single member in
685
+ * single-mode; the union AABB in multi-mode): a handle at each corner and,
686
+ * unless `edges` is false, at each edge midpoint.
687
+ *
688
+ * Declares point regions in the target's local frame; the framework
689
+ * applies the target's bounds rotation for both paint and hit-test. A
690
+ * region's `bind()` carries only the scratch a hit hands to the resize
691
+ * action: the anchor, the target, and the world-space fixed point.
692
+ */
693
+ declare function createCornerResizeAffordance(opts?: CornerResizeAffordanceOptions): Affordance;
694
+
695
+ /** Options for `createRotationAffordance` — how thick the rotate band is
696
+ * outside the selection, and how (or whether) it is painted. */
697
+ interface RotationAffordanceOptions {
698
+ /** Minimum screen-space thickness of the rotate-zone band outside the selection AABB, so
699
+ * the zone stays hoverable at any zoom and any selection size. Default 24. */
700
+ bandPx?: number;
701
+ /** Paint for the ring. `null` / `false` = invisible. Default is a semi-transparent fill of
702
+ * the band, contracted by `insetPx` screen pixels on the outer edge. Pass a `Stroke` (or
703
+ * `{ fill, stroke, insetPx }`) to override. */
704
+ paint?: CommandStroke | {
705
+ fill?: CommandFill;
706
+ stroke?: CommandStroke;
707
+ insetPx?: number;
708
+ } | null | false;
709
+ /** Cursor while hovering the ring. Defaults to the `rotate` glyph turned
710
+ * square to the line from the pivot to the pointer, falling back to
711
+ * `'grab'` if the browser rejects the image. */
712
+ cursor?: CursorSpec;
713
+ /** A grab region for a rotate badge painted off the top edge — the one
714
+ * the selection overlay's `rotationHandle` draws. `distancePx` is how far
715
+ * off the edge it sits and `hitRadiusPx` the half-extent of its square,
716
+ * both in screen pixels. Placed by the same `standoff` the painted badge
717
+ * is, so the two cannot drift apart. Omitted, only the ring rotates. */
718
+ handle?: {
719
+ distancePx: number;
720
+ hitRadiusPx: number;
721
+ };
722
+ }
723
+ /** What a rotation-handle hit hands to the rotate action: what is being
724
+ * rotated, and the world-space pivot it turns around. */
725
+ interface RotationScratch extends CommonAffordanceScratch {
726
+ /** Id of the rotation target — single selection id, or
727
+ * `MULTI_RESIZE_TARGET_ID` for multi-selection. */
728
+ targetId: string;
729
+ /** Rotation pivot in world coords — the AABB (or union AABB) center. */
730
+ fixedPoint: {
731
+ x: number;
732
+ y: number;
733
+ };
734
+ }
735
+ /**
736
+ * Rotation affordance for the active selection: an elliptical ring that wraps the selection —
737
+ * the smallest ellipse containing the AABB, minus the AABB itself. Hovering the ring sets the
738
+ * cursor (default the `rotate` glyph) and a drag from it triggers `rotateAction`.
739
+ *
740
+ * The ring is target-local — under target rotation the ellipse rotates with the AABB.
741
+ * Visibility is gated by chrome-caps' `'selection.rotation-handle'` rule. `paint: null` leaves
742
+ * the cursor change as the only cue.
743
+ */
744
+ declare function createRotationAffordance(opts?: RotationAffordanceOptions): Affordance;
745
+
746
+ /** Default world-space distance from the rect's top edge to the rotation
747
+ * handle's center. Matches the demo's visual default; consumers can
748
+ * override per-call. Unscaled — kit-internal use sites multiply by
749
+ * `DeviceProfile.targetScale`. */
750
+ declare const DEFAULT_ROTATION_HANDLE_DISTANCE: 24;
751
+ /** Rotation handle position in world coords. */
752
+ interface RotationHandle {
753
+ /** Handle center in world coords. */
754
+ cx: number;
755
+ cy: number;
756
+ /** How far the handle is turned on screen, radians: the angle from screen
757
+ * up to the top edge's outward normal as it lands there. Equals the pose
758
+ * rotation under uniform zoom. */
759
+ angle: number;
760
+ }
761
+ /** Rotation handle for a box as its frame draws it: `distance` pixels off the
762
+ * top edge's midpoint, along that edge's outward normal as it lands on a
763
+ * screen whose per-axis zoom is `scale`. With no `scale`, a pixel is a world
764
+ * unit. */
765
+ declare function rotationHandle(pose: {
766
+ x: number;
767
+ y: number;
768
+ width: number;
769
+ height: number;
770
+ rotation?: number;
771
+ transform?: PoseLinear;
772
+ }, distance?: number, scale?: Scale2): RotationHandle;
773
+ /** Square hit-test: returns true if `(px, py)` is within `radius` of the
774
+ * handle's center on both axes. Mirrors `hitCornerHandle`. */
775
+ declare function hitRotationHandle(handle: Pick<RotationHandle, 'cx' | 'cy'>, px: number, py: number, radius: number): boolean;
776
+
777
+ /**
778
+ * The kit's presets by name, core's view presets and editing's, for
779
+ * `namedFeatures('draw')` and for listings that key presets by name. Importing
780
+ * this module loads every preset's actions; a canvas handed preset objects
781
+ * carries only those.
782
+ */
783
+
784
+ /** Each kit preset by name, each after the presets it includes. */
785
+ declare const FEATURE_PRESETS: {
786
+ readonly selection: FeaturePreset;
787
+ readonly insert: FeaturePreset;
788
+ readonly selectionChrome: FeaturePreset;
789
+ readonly 'toolkit:select': FeaturePreset;
790
+ readonly 'toolkit:shape': FeaturePreset;
791
+ readonly 'tools:select': FeaturePreset;
792
+ readonly 'tools:view': FeaturePreset;
793
+ readonly 'tools:shape': FeaturePreset;
794
+ readonly view: FeaturePreset;
795
+ readonly select: FeaturePreset;
796
+ readonly outline: FeaturePreset;
797
+ readonly pick: FeaturePreset;
798
+ readonly move: FeaturePreset;
799
+ readonly resize: FeaturePreset;
800
+ readonly rotate: FeaturePreset;
801
+ readonly transform: FeaturePreset;
802
+ readonly escape: FeaturePreset;
803
+ readonly contextMenu: FeaturePreset;
804
+ readonly selectAll: FeaturePreset;
805
+ readonly duplicate: FeaturePreset;
806
+ readonly delete: FeaturePreset;
807
+ readonly group: FeaturePreset;
808
+ readonly nudge: FeaturePreset;
809
+ readonly style: FeaturePreset;
810
+ readonly clipboard: FeaturePreset;
811
+ readonly edit: FeaturePreset;
812
+ readonly flip: FeaturePreset;
813
+ readonly reorder: FeaturePreset;
814
+ readonly align: FeaturePreset;
815
+ readonly distribute: FeaturePreset;
816
+ readonly swap: FeaturePreset;
817
+ readonly arrange: FeaturePreset;
818
+ readonly booleans: FeaturePreset;
819
+ readonly pathfinder: FeaturePreset;
820
+ readonly ingest: FeaturePreset;
821
+ readonly draw: FeaturePreset;
822
+ };
823
+ /** A kit preset's name, as `namedFeatures` takes it. */
824
+ type FeatureName = keyof typeof FEATURE_PRESETS;
825
+ /** Every kit preset's name, each after the presets it includes. */
826
+ declare const FEATURE_NAMES: readonly FeatureName[];
827
+ /**
828
+ * The kit's presets for the given names, in order: `namedFeatures('pick', 'move')`
829
+ * is `[presets.pick, presets.move]`, and means exactly what passing those objects
830
+ * means. It resolves names only; nothing else is implied, so a canvas that
831
+ * pans and zooms names `'view'` (or `'draw'`, which includes it). Importing it
832
+ * puts every kit preset in the bundle; import the objects to carry only those.
833
+ */
834
+ declare function namedFeatures(...names: readonly FeatureName[]): FeaturePreset[];
835
+ /** The kit-standard action ids each preset registers itself, leaving out those of the presets it includes. */
836
+ declare const FEATURE_ACTION_IDS: Readonly<Record<FeatureName, readonly string[]>>;
837
+ /** Every kit-standard action, each once: the baseline, then each kit preset's actions in table order, then its
838
+ * tool actions. */
839
+ declare const KIT_STANDARD_ACTIONS: readonly Action[];
840
+
841
+ /**
842
+ * `useStandardActions` — register the kit-standard action descriptors into the
843
+ * nearest `<ActionsProvider>` and publish dep sources into the nearest
844
+ * `<DepRegistryProvider>`. Falls back silently to a no-op when either is
845
+ * not in scope.
846
+ */
847
+
848
+ /** Options for `useStandardActions`: which actions to register, and the deps they read. */
849
+ interface UseStandardActionsOptions extends StandardDeps {
850
+ /**
851
+ * The actions to register, in order. Default: every kit-standard action
852
+ * (`KIT_STANDARD_ACTION_IDS`). A preset's `actions` is a set in this form.
853
+ */
854
+ actions?: readonly Action[];
855
+ /**
856
+ * Ids of kit-standard actions to leave unregistered, so a consumer can bind
857
+ * its own. Ids that name no kit action are ignored;
858
+ * `KIT_STANDARD_ACTION_IDS` is the full list.
859
+ */
860
+ exclude?: Iterable<string>;
861
+ }
862
+ /** Every id `useStandardActions` can register, each kit preset's in turn and
863
+ * then the tool-driven ones. It holds `clipboard.pasteEvent` back while
864
+ * `ingest` is registered. */
865
+ declare const KIT_STANDARD_ACTION_IDS: readonly string[];
866
+ /**
867
+ * Register each kit-standard dep source and action descriptor into the
868
+ * surrounding `<ActionsProvider>` and `<DepRegistryProvider>` (typically
869
+ * provided by `<SceneCanvas>`); a silent no-op when either is absent.
870
+ *
871
+ * Each dep option is published as a live source in the dep registry under its
872
+ * canonical name (`selection`, `scene`, …). The source reads the latest
873
+ * option value at invocation time, so consumers don't have to memoize their
874
+ * dep objects.
875
+ */
876
+ declare function useStandardActions(opts: UseStandardActionsOptions): void;
877
+
878
+ /**
879
+ * Move behavior that drops the dragged nodes into a container the pointer
880
+ * hovers over for `dwellMs`, reparenting each and giving it the slot
881
+ * `findTarget` answers for its id. A node `findTarget` has no slot for in
882
+ * that container rides along with the first, at its offset from it.
883
+ *
884
+ * The dwell is what keeps a drag that merely passes over a container from
885
+ * being captured by it. On an Alt-drag clone the copies drop in the same way
886
+ * and the originals stay put.
887
+ */
888
+ declare function snapToContainer<TPose>(args: {
889
+ dwellMs: number;
890
+ findTarget: (draggedId: string, worldX: number, worldY: number) => SnapTarget<TPose> | null;
891
+ isInstant?: (target: SnapTarget<TPose>) => boolean;
892
+ moveLabel?: string;
893
+ reparentLabel?: string;
894
+ }): MoveBehavior<TPose>;
895
+
896
+ /**
897
+ * Move behavior for a drag that is only meaningful near where it started:
898
+ * release inside `radius` and every dragged node returns to its original
899
+ * pose; release outside it and they all either spring back anyway or are
900
+ * deleted, per `onFreeRelease`. The distance is the first dragged node's. A
901
+ * deletion is recorded as undoable ops with paint order preserved. An Alt-drag
902
+ * clone released anywhere but a snap target makes no copy.
903
+ */
904
+ declare function snapBackOrDelete<TPose extends {
905
+ x: number;
906
+ y: number;
907
+ }>(args: {
908
+ radius: number;
909
+ onFreeRelease: 'snap-back' | 'delete';
910
+ deleteLabel?: string;
911
+ }): MoveBehavior<TPose>;
912
+ /** As above, for a `TPose` that is not a rect: `origin` tells the behavior how
913
+ * to read and write the pose's origin. */
914
+ declare function snapBackOrDelete<TPose>(args: {
915
+ radius: number;
916
+ onFreeRelease: 'snap-back' | 'delete';
917
+ deleteLabel?: string;
918
+ origin: OriginProjection<TPose>;
919
+ }): MoveBehavior<TPose>;
920
+
921
+ /** What {@link clampMove} takes. */
922
+ interface ClampMoveOptions<TPose> {
923
+ /** The world rect the dragged nodes stay inside, or a function read each frame for one that changes. */
924
+ bounds: FramedRect | (() => FramedRect);
925
+ /** Reads each pose's box. Default `AUTO_POSE_DESCRIPTOR`. */
926
+ poseDescriptor?: PoseDescriptor$1<TPose>;
927
+ }
928
+ /**
929
+ * Move behavior that keeps the dragged nodes inside `bounds`: the drag's translation is
930
+ * clamped so the box around every dragged node's start pose in world, moved by it, stays in the rect.
931
+ * The clamp applies to the preview and the commit alike, so a node let go past an edge lands
932
+ * on it. Put it after behaviors that reshape the translation, so it has the last word.
933
+ */
934
+ declare function clampMove<TPose>(opts: ClampMoveOptions<TPose>): MoveBehavior<TPose>;
935
+
936
+ /** Options for {@link swapOnDrop}. */
937
+ interface SwapOnDropOptions {
938
+ /** How long the pointer rests over a node before a release there swaps. Default 1000. */
939
+ dwellMs?: number;
940
+ /**
941
+ * The node the dragged node `draggedId` would trade places with, for the pointer at `point` in world, or
942
+ * `null`. Default: the node the `nodeAtPoint` dep hits, outside the dragged node, or the first of its
943
+ * ancestors `swappable` lets trade places with it.
944
+ */
945
+ targetAt?(point: {
946
+ x: number;
947
+ y: number;
948
+ }, draggedId: string): string | null;
949
+ }
950
+ /**
951
+ * Move behavior that swaps the one dragged node with the node it is held over: resting there for `dwellMs`
952
+ * arms the swap, which slides that node into the dragged one's start place, outlines it, and shows the swap
953
+ * cursor, and a release while armed trades the two (`swapOps`), as one undo step. Moving off disarms it, and
954
+ * coming back starts the wait again. A drag of several nodes never swaps, nor does an Alt-drag clone.
955
+ *
956
+ * The move action's `swapOnDrop: 'dwell'` param runs this with the defaults; a binding that needs another
957
+ * `targetAt` or wait passes its own in `behaviors`.
958
+ */
959
+ declare function swapOnDrop(options?: SwapOnDropOptions): MoveBehavior<unknown>;
960
+
961
+ /**
962
+ * `cloneAction` — ongoing Action descriptor for alt-drag clone. Nothing is
963
+ * written before the commit, so a cancel only clears the preview.
964
+ *
965
+ * The action does not gate on a modifier: it runs whenever the dispatcher
966
+ * routes to it, and the binding that names it carries the `alt` requirement.
967
+ */
968
+
969
+ /**
970
+ * Static descriptor for the `clone` Action. Copies each selected node, with
971
+ * its subtree, to where the drag left it. One undo entry.
972
+ */
973
+ declare const cloneAction: Action & {
974
+ requires: string[];
975
+ };
976
+
977
+ /** Options for {@link createResizeAction}. */
978
+ interface ResizeActionOptions {
979
+ /** Runs in place of the scene commit, handed each resized node's pose at
980
+ * release, so a host keeping the geometry as data can store it. The scene
981
+ * is left as it was, and no undo entry is made; the constraints' `onEnd`
982
+ * answers are not asked for. */
983
+ commit?: (poses: ReadonlyMap<NodeId, unknown>, deps: ActionDeps) => void;
984
+ }
985
+ /**
986
+ * Anchor-relative drag resize, committed as one batch on release. It needs
987
+ * `InvocationCtx.drag.affordance` with a `handle:*` kind.
988
+ *
989
+ * The dragged corner or edge snaps through the `snap` dep's session before
990
+ * the box is resized, held to the handle's axis, and to the box's diagonal
991
+ * while `snap.constrain` (Shift) is held. The optional `resizePolicy` dep
992
+ * carries the constraints, point snaps, and `expandIds`; absent, the invoker
993
+ * runs no constraints and `ids => ids` expansion.
994
+ */
995
+ declare function createResizeAction(opts?: ResizeActionOptions): Action & {
996
+ requires: string[];
997
+ };
998
+ /** The resize that commits to the scene. */
999
+ declare const resizeAction: Action & {
1000
+ requires: string[];
1001
+ };
1002
+
1003
+ /** Resize constraint that stops a node shrinking past a minimum. The anchored
1004
+ * edge stays put, so clamping pushes the dragged edge back rather than moving
1005
+ * the node. */
1006
+ declare function clampMinSize<TPose extends Bounds>(args: {
1007
+ minWidth: number;
1008
+ minHeight: number;
1009
+ }): BoundsConstraint<TPose>;
1010
+
1011
+ /** Options for `useResizePolicyDepSource`. Each omitted field falls back to the kit
1012
+ * default. */
1013
+ interface UseResizePolicyDepSourceOptions<TPose> extends RunLifecycleOptions {
1014
+ constraints?: TPose extends Bounds ? BoundsConstraint$1<TPose>[] : never[];
1015
+ expandIds?: (ids: string[]) => string[];
1016
+ }
1017
+ /** Publish how resizing should behave — constraints and group expansion —
1018
+ * for the resize action to consult. */
1019
+ declare function useResizePolicyDepSource<TPose>(options: UseResizePolicyDepSourceOptions<TPose>): void;
1020
+ /** `<SceneCanvas selectTool.resize>` as {@link useResizePolicyDepSource} options.
1021
+ * `resizable` is read by `<SceneCanvas>` itself. */
1022
+ declare function resizePolicyOptions<TPose>(o: ResizeOptions<TPose>): UseResizePolicyDepSourceOptions<TPose>;
1023
+
1024
+ /**
1025
+ * Pointer-driven rotation of the selection, committed as one undo entry.
1026
+ *
1027
+ * A pose whose descriptor has no `withRotation`, or reports
1028
+ * `supportsRotation` false, is left alone. The first rotated node's angle
1029
+ * snaps through the `snap` dep's session — quarter turns and other nodes'
1030
+ * angles, 15 degree steps while `snap.constrain` (Shift) is held — and the
1031
+ * rest of the selection turns by the same amount. Behaviors
1032
+ * (`opts.behaviors`) then see that node's turned pose; a pose one returns
1033
+ * from `onMove` sets the rotation for the whole selection.
1034
+ */
1035
+ declare const rotateAction: Action;
1036
+
1037
+ /**
1038
+ * Clears the selection on a click on empty canvas. It has no ambient
1039
+ * `defaultBinding`: it fires only through `useSelectTool`'s bindings.
1040
+ *
1041
+ * `enabled` declines while a path is in anchor-edit mode, so the dispatcher
1042
+ * falls through to `selectAnchorAction`. `useSelectTool` binds this action at
1043
+ * **active** scope while `selectAnchor` is **ambient**, so without the gate an
1044
+ * anchor that sits over empty canvas clears the node selection instead of
1045
+ * selecting the anchor. Capability eligibility covers only consumers that
1046
+ * wired a mode registry.
1047
+ */
1048
+ declare const clearSelectionAction: Action & {
1049
+ requires: string[];
1050
+ };
1051
+
1052
+ /**
1053
+ * `lassoSelectAction` — ongoing Action descriptor for polygon lasso selection.
1054
+ *
1055
+ * A move adds a vertex unless it is closer than the binding's
1056
+ * `params.minVertexSpacing` (default 2 world-px) to the last one. The commit
1057
+ * hit-tests the polygon with `dep.hitTestLasso(polygon, mode)` — `mode` from
1058
+ * the binding's `params.mode`, default `'intersect'` — falling back to the
1059
+ * polygon's AABB via `dep.hitTestArea(bounds)`. Shift extends the selection.
1060
+ * Always transient: no undo entry.
1061
+ *
1062
+ * `opts.behaviors` (`LassoSelectBehavior[]`) run over a `GestureContext`
1063
+ * whose `origin.get('gesture')` is the start pose, whose scratch holds the
1064
+ * vertices under `LASSO_VERTICES`, and whose adapter answers selection and
1065
+ * hit-testing from the `lassoSelect` dep. `onEnd` is first-non-undefined-wins:
1066
+ * `Op[]` is applied in place of the default selection, `null` aborts, and
1067
+ * all-`undefined` falls through to it. A behavior's ops are applied
1068
+ * transiently too.
1069
+ */
1070
+ /**
1071
+ * Static descriptor for the `lassoSelect` Action.
1072
+ */
1073
+ declare const lassoSelectAction: _weasel_js_routing.Action & {
1074
+ id: "lassoSelect";
1075
+ };
1076
+
1077
+ /** Options for `selectFromLasso`. */
1078
+ interface SelectFromLassoOptions {
1079
+ /** Hit mode for `hitTestLasso`. Default 'intersect'. */
1080
+ mode?: LassoHitMode;
1081
+ }
1082
+ /** A lasso behavior (`useLassoTool({ behaviors })`): replace selection with
1083
+ * polygon hits in its own `mode`, or extend the existing selection when shift
1084
+ * is held at gesture start. Tiny / degenerate lassos behave like a click —
1085
+ * clear (or preserve, with shift). Hits come from the gesture adapter's
1086
+ * `hitTestLasso`, which under `lassoSelectAction` is the `lassoSelect` dep. */
1087
+ declare function selectFromLasso(opts?: SelectFromLassoOptions): LassoSelectBehavior;
1088
+
1089
+ /** A polygon insert's params as a form, for the last-operation panel. */
1090
+ declare const POLYGON_INSERT_PARAMS: Omit<PrefGroup, "children"> & {
1091
+ children: {
1092
+ readonly sides: _weasel_js_prefs_schema.PrefNumberBase & {
1093
+ default: number;
1094
+ clearable?: false;
1095
+ };
1096
+ };
1097
+ };
1098
+ /** A star insert's params as a form, for the last-operation panel. */
1099
+ declare const STAR_INSERT_PARAMS: Omit<PrefGroup, "children"> & {
1100
+ children: {
1101
+ readonly points: _weasel_js_prefs_schema.PrefNumberBase & {
1102
+ default: number;
1103
+ clearable?: false;
1104
+ };
1105
+ readonly innerRadiusRatio: _weasel_js_prefs_schema.PrefNumberBase & {
1106
+ default: number;
1107
+ clearable?: false;
1108
+ };
1109
+ };
1110
+ };
1111
+ /** The form an insert of the kind `params` names shows: a polygon's sides, a star's points and inner radius, and
1112
+ * none for any other kind. */
1113
+ declare function insertParams(params: Readonly<Record<string, unknown>>): PrefGroup | null;
1114
+
1115
+ /**
1116
+ * Click-to-insert: the companion to `insertAction` for a click, which draws
1117
+ * no box. It commits a node of `params.kind` at `params.size`, centered on the
1118
+ * click, snapped through a `point` session of the `snap` dep unless the
1119
+ * click held `snap.suspend` (Ctrl), and commits
1120
+ * through the same `insert` dep a drag commits through. Its extras are the
1121
+ * ones a drag out from the click's center to the size's corner makes
1122
+ * (`insertShape`), built from the rest of the binding's params.
1123
+ *
1124
+ * A `minSize` in the params floors the size, and goes on to the node. Style
1125
+ * params (a shape tool's fill, stroke, …) reach the dep as `extras.style`.
1126
+ *
1127
+ * A binding with no `size` places nothing: the kind's extent is the tool's to
1128
+ * name, and a click has none of its own.
1129
+ */
1130
+ declare const placeAction: Action;
1131
+
1132
+ /**
1133
+ * Companion to `insertAction`: while its key is held, dragging moves the
1134
+ * shape being drawn instead of resizing it; letting go resumes resizing from
1135
+ * where the shape now sits. No-op when no insert is in flight.
1136
+ */
1137
+ declare const insertRepositionAction: Action;
1138
+ /**
1139
+ * The binding a shape-drawing tool adds so holding Space mid-draw repositions
1140
+ * the shape. Gated to the tool's own engaged phase, so Space between drags is
1141
+ * left to the offhand hand tool. Shift and Alt may be down with it, so a
1142
+ * constrained or from-center draw can be moved without letting go of them.
1143
+ */
1144
+ declare const INSERT_REPOSITION_BINDING: GestureBinding;
1145
+
1146
+ /**
1147
+ * Companion to `insertAction` — adjusts the live insert gesture's
1148
+ * `userRotation` based on wheel deltaY. Intended to be bound to
1149
+ * Shift+wheel during the insert tool's engaged phase. No-op when no
1150
+ * insert is in flight.
1151
+ */
1152
+ declare const insertRotateAction: _weasel_js_routing.Action & {
1153
+ id: "insert.rotate";
1154
+ };
1155
+
1156
+ /** The kinds {@link kitData} builds a node for with no factory. */
1157
+ declare const KIT_INSERT_KINDS: readonly string[];
1158
+ /** Provides the `insert` dep, and the `insertLive` gesture state beside it, minting nodes into `scene` through
1159
+ * `adapter` with `factories` in place of the kit's own. */
1160
+ declare function useInsertDepSource(scene: Scene<unknown, string, unknown>, adapter: OpsApplier, factories?: InsertNodeFactories): void;
1161
+
1162
+ /**
1163
+ * Flips the selection. `params.axis` (`'x'` | `'y'`, default `'x'`) picks the
1164
+ * direction, and the optional `params.pivot` (a `FlipPivot`, default `'each'`)
1165
+ * picks what it mirrors about.
1166
+ */
1167
+ declare const flipAction: _weasel_js_routing.Action & {
1168
+ id: "flip";
1169
+ };
1170
+
1171
+ /**
1172
+ * Parametric descriptor for forward reorder (`reorder.forward`).
1173
+ *
1174
+ * Collapses the old `reorder.forward` (adjacent) and `reorder.front`
1175
+ * (extreme) actions into one descriptor with two keybindings. The distance
1176
+ * param (`'adjacent'` | `'extreme'`) is carried in `opts.params.distance`
1177
+ * and forwarded to `invoker.run` by the dispatcher.
1178
+ */
1179
+ declare const reorderForwardAction: _weasel_js_routing.Action & {
1180
+ id: "reorder.forward";
1181
+ };
1182
+ /**
1183
+ * Parametric descriptor for backward reorder (`reorder.backward`).
1184
+ *
1185
+ * Collapses the old `reorder.backward` (adjacent) and `reorder.back`
1186
+ * (extreme) actions into one descriptor with two keybindings.
1187
+ */
1188
+ declare const reorderBackwardAction: _weasel_js_routing.Action & {
1189
+ id: "reorder.backward";
1190
+ };
1191
+
1192
+ /**
1193
+ * Trades the places of the two selected nodes, as one undo step labeled "Swap": each moves onto the other's
1194
+ * bounds and takes its parent and place in the stacking order (`swapOps`). Enabled only for exactly two nodes
1195
+ * `swappable` lets trade places, which the `canSwap` dep decides.
1196
+ */
1197
+ declare const swapAction: _weasel_js_routing.Action & {
1198
+ id: "swap";
1199
+ };
1200
+
1201
+ /**
1202
+ * The ops that make `a` and `b` trade places, for one undo step: each moves onto the other's bounds, carrying
1203
+ * what is inside it, and takes the other's parent, layer and place among its siblings. Poses are read from the
1204
+ * document, so a drag in flight over either one does not count as where it is. `null` when either would land
1205
+ * in a singular frame, or past the double range.
1206
+ *
1207
+ * This is the commit for the `swap` command and for a swap drop; whether the two may trade places is
1208
+ * `swappable`'s to say.
1209
+ */
1210
+ declare function swapOps(scene: Scene<unknown, string, unknown>, a: string, b: string, deps?: Pick<ActionDeps, 'poseDescriptor' | 'geometryProjection'>, label?: string): Op[] | null;
1211
+
1212
+ /** Static descriptor for align-left. */
1213
+ declare const alignLeftAction: Action;
1214
+ /** Static descriptor for align-right. */
1215
+ declare const alignRightAction: Action;
1216
+ /** Static descriptor for align-top. */
1217
+ declare const alignTopAction: Action;
1218
+ /** Static descriptor for align-bottom. */
1219
+ declare const alignBottomAction: Action;
1220
+ /** Static descriptor for align-center-x. */
1221
+ declare const alignCenterXAction: Action;
1222
+ /** Static descriptor for align-center-y. */
1223
+ declare const alignCenterYAction: Action;
1224
+
1225
+ /** Static descriptor for distribute-horizontal. */
1226
+ declare const distributeHorizontalAction: Action;
1227
+ /** Static descriptor for distribute-vertical. */
1228
+ declare const distributeVerticalAction: Action;
1229
+
1230
+ /**
1231
+ * Static descriptor for the `deselect` Action, bound to Escape. Clears the selection.
1232
+ */
1233
+ declare const deselectAction: Action & {
1234
+ requires: string[];
1235
+ };
1236
+
1237
+ /**
1238
+ * Static descriptor for the `selectAll` Action. Selects every scene node the
1239
+ * user can see and reach — hidden and locked nodes, pages and the page run
1240
+ * (`nodeGates`), and nodes on a layer the asking view does not paint, are left
1241
+ * out, so Cmd+A then Delete cannot take content that is off screen or locked.
1242
+ * Inside an entered group it selects only what the group holds.
1243
+ */
1244
+ declare const selectAllAction: Action & {
1245
+ requires: string[];
1246
+ };
1247
+
1248
+ /**
1249
+ * Copy each selected node, with its subtree, offset by `(dx, dy)` in world
1250
+ * space whatever frame it is stored in, as one
1251
+ * undoable batch labeled `label`, and select the copies. Returns the copies'
1252
+ * ids, or null when nothing was copied or the scene refused the copies.
1253
+ */
1254
+ declare function duplicateSelection(deps: ActionDeps, dx: number, dy: number, label?: string): string[] | null;
1255
+ /**
1256
+ * Static descriptor for the `duplicate` Action. Copies each selected node —
1257
+ * with its subtree, so duplicating a group produces a populated group — offset
1258
+ * by a small nudge, as one undoable batch, then selects the copies.
1259
+ */
1260
+ declare const duplicateAction: Action & {
1261
+ requires: string[];
1262
+ };
1263
+
1264
+ /**
1265
+ * Creates a structural `GroupNode` and reparents the current selection
1266
+ * under it as a single undoable batch, in the container `groupingSite` names,
1267
+ * in the frontmost member's place, the members keeping their stacking.
1268
+ *
1269
+ * Grouping never moves a member on screen, unless with the pasteboard off
1270
+ * the members lie wholly off every page and move onto one. The container takes the world
1271
+ * envelope of its members' ink, and each member is re-expressed in that
1272
+ * container's frame. The container is a frame, so its pose is authored rather
1273
+ * than derived from its members, whose poses are expressed in it. A node
1274
+ * following a member that changes page goes where `followerMoves` says.
1275
+ */
1276
+ declare const groupAction: Action & {
1277
+ requires: string[];
1278
+ };
1279
+ /**
1280
+ * Dissolves each selected group, or boolean group, by reparenting its children up to the
1281
+ * container's own parent (preserving z-order) and removing the now-empty
1282
+ * container, as a single undoable batch. Selected marks, children or not, are
1283
+ * ignored. The freed children become the new selection, and nothing moves on
1284
+ * screen. Every node deriving from a dissolved container, a freed child or not, drops that container from its
1285
+ * `dependsOn`, so the batch removes the containers and nothing else. Disabled while any node it would move,
1286
+ * rewrite, or remove is locked, and while a child would land in a singular frame, where it could not stay
1287
+ * where it is shown. A child of a singular container keeps the flat place it is shown at.
1288
+ */
1289
+ declare const ungroupAction: Action & {
1290
+ requires: string[];
1291
+ };
1292
+
1293
+ /** Nudge up: the Up arrow, a big step with Shift. */
1294
+ declare const nudgeUpAction: Action & {
1295
+ requires: string[];
1296
+ };
1297
+ /** Nudge down: the Down arrow, a big step with Shift. */
1298
+ declare const nudgeDownAction: Action & {
1299
+ requires: string[];
1300
+ };
1301
+ /** Nudge left: the Left arrow, a big step with Shift. */
1302
+ declare const nudgeLeftAction: Action & {
1303
+ requires: string[];
1304
+ };
1305
+ /** Nudge right: the Right arrow, a big step with Shift. */
1306
+ declare const nudgeRightAction: Action & {
1307
+ requires: string[];
1308
+ };
1309
+
1310
+ /**
1311
+ * Static descriptor for the `setFill` Action.
1312
+ *
1313
+ * Takes either `color` (a hex string) or `paint` (a whole `Paint`, for
1314
+ * gradients and patterns). `paint` wins when both are present.
1315
+ *
1316
+ * Alpha semantics: alpha lives on the paint's `opacity`. A 6-char (no-alpha)
1317
+ * color adopts the alpha of the node's existing paint; an 8-char color states
1318
+ * its own. A `paint` is written verbatim.
1319
+ */
1320
+ declare const setFillAction: Action;
1321
+
1322
+ /**
1323
+ * Static descriptor for the `setFillOpacity` Action.
1324
+ *
1325
+ * `params.alpha01` (0..1, ignored unless a finite number) becomes each node's fill paint `opacity`, leaving
1326
+ * the rest of the paint — color, gradient stops, pattern — alone. That is the
1327
+ * one alpha slot a gradient or a pattern has, so it is the slot all of them
1328
+ * use. A node with no fill yet takes the kit's default one.
1329
+ */
1330
+ declare const setFillOpacityAction: Action;
1331
+
1332
+ /**
1333
+ * Static descriptor for the `setStroke` Action.
1334
+ *
1335
+ * Takes either `color` (a hex string) or `paint` (a whole `Paint`, for
1336
+ * gradients and patterns). `paint` wins when both are present. A stroke's
1337
+ * width, cap, join, dash and align survive either.
1338
+ *
1339
+ * Alpha semantics: alpha lives on the stroke paint's `opacity`. A 6-char
1340
+ * (no-alpha) color adopts the alpha of the node's existing stroke paint; an
1341
+ * 8-char color states its own. A `paint` is written verbatim.
1342
+ */
1343
+ declare const setStrokeAction: Action;
1344
+
1345
+ /**
1346
+ * Static descriptor for the `setStrokeOpacity` Action.
1347
+ *
1348
+ * `params.alpha01` (0..1, ignored unless a finite number) becomes each node's stroke paint `opacity`, leaving
1349
+ * the rest of the stroke — color, width, cap, join, dash — alone. A node with
1350
+ * no stroke yet gets a hairline one.
1351
+ */
1352
+ declare const setStrokeOpacityAction: Action;
1353
+
1354
+ /**
1355
+ * Static descriptor for the `setStrokeWidth` Action.
1356
+ *
1357
+ * `params.width` (ignored unless a finite number, zero or more) becomes each
1358
+ * node's stroke `width`, and `params.vertexWidths` its per-anchor widths
1359
+ * (`null` removes them), leaving the paint, cap, join and dash alone. A node with no stroke yet gets a hairline one in the kit default
1360
+ * color.
1361
+ */
1362
+ declare const setStrokeWidthAction: Action;
1363
+
1364
+ /**
1365
+ * Static descriptor for the `setVertexColor` Action.
1366
+ *
1367
+ * `params.index` names an anchor and `params.rgba` its new color (ignored
1368
+ * unless four finite numbers), written into each selected node's
1369
+ * `data.vertexColors` (one RGBA per anchor of its path), leaving the other
1370
+ * anchors alone. A node with no vertex colors, or fewer anchors than `index`
1371
+ * names, is left as it is; the action is `NotApplicable` while no selected
1372
+ * node has any.
1373
+ */
1374
+ declare const setVertexColorAction: Action;
1375
+
1376
+ /** Ingest: places what a drop or a paste brings, through the canvas's content handlers. */
1377
+ declare const ingestAction: _weasel_js_routing.Action & {
1378
+ id: "ingest";
1379
+ };
1380
+
1381
+ /**
1382
+ * Repeat the last move, rotate, resize, nudge, duplicate, or Alt-drag clone on
1383
+ * the current selection, as one undo entry. A repeated duplicate copies the
1384
+ * selection — the last copies — again by the same offset, so pressing it over
1385
+ * and over makes a step-and-repeat; moving the copies between a duplicate and
1386
+ * its repeat changes that offset. With nothing to repeat it duplicates.
1387
+ */
1388
+ declare const transformAgainAction: Action & {
1389
+ requires: string[];
1390
+ };
1391
+
1392
+ /** A move, rotate or resize the selection can be given: a {@link RepeatableTransform} other than a duplicate. */
1393
+ type SelectionTransform = Exclude<RepeatableTransform, {
1394
+ kind: 'duplicate';
1395
+ }>;
1396
+ /** `enabled`'s answer for applying `t` to the selection (ruled 2026-11-09 and 2026-11-10): not applicable when the
1397
+ * batch the followers finish changes nothing, locked when it would rewrite a locked node. */
1398
+ declare function selectionTransformAnswer(deps: ActionDeps, t: SelectionTransform, label: string): true | ActionUnavailable;
1399
+ /**
1400
+ * Apply `t` to the selection as one undo entry labeled `label`, finished by
1401
+ * the `transformFollowers` dep as a drag's transform is, and record it for
1402
+ * Transform Again. An action calling it requires what Transform Again does
1403
+ * for that kind: `scene`, `operands`, `applyOps`, `poseDescriptor`,
1404
+ * `transformFollowers`, and `geometryProjection` for a move or `view`,
1405
+ * `boundsIncludeStroke` and `drawnBoxes` for a rotate or a resize. Returns
1406
+ * whether anything changed.
1407
+ */
1408
+ declare function transformSelection(deps: ActionDeps, t: SelectionTransform, label: string): boolean;
1409
+
1410
+ /**
1411
+ * Static descriptor for the `clipboard.copy` Action (Cmd/Ctrl+C).
1412
+ */
1413
+ declare const clipboardCopyAction: Action & {
1414
+ requires: string[];
1415
+ };
1416
+ /**
1417
+ * Static descriptor for the `clipboard.cut` Action (Cmd/Ctrl+X) — copy, then
1418
+ * the same batched delete `deleteAction` performs, as one undo entry: the
1419
+ * sources a path effect hid go too.
1420
+ */
1421
+ declare const clipboardCutAction: Action & {
1422
+ requires: string[];
1423
+ };
1424
+ /**
1425
+ * Static descriptor for the `clipboard.paste` Action — what a Paste button or
1426
+ * menu item triggers, pasting the last copy this canvas made. It has no key
1427
+ * binding: Cmd/Ctrl+V already arrives as a DOM `paste` event, which the
1428
+ * dispatcher routes to `clipboard.pasteEvent` or `ingest`, and a binding here
1429
+ * would fire alongside it and paste twice.
1430
+ */
1431
+ declare const clipboardPasteAction: Action & {
1432
+ id: "clipboard.paste";
1433
+ };
1434
+ /**
1435
+ * Static descriptor for the `clipboard.pasteEvent` Action — Cmd/Ctrl+V on a
1436
+ * canvas that edits and does not ingest. It answers the DOM `paste` event by
1437
+ * pasting nodes a kit canvas copied to the OS clipboard, in this tab or
1438
+ * another, and nothing else: an image, SVG, or file on the clipboard, and
1439
+ * every consumer content handler, need `ingest`. `ingest` binds the same
1440
+ * event and takes this payload among the rest, so `useStandardActions`
1441
+ * leaves this one unregistered wherever `ingest` is registered.
1442
+ *
1443
+ * Bound to `text/plain` because that is the only flavor of a copy a paste
1444
+ * event carries; a paste without text stays the page's.
1445
+ */
1446
+ declare const clipboardPasteCopiedAction: Action & {
1447
+ id: "clipboard.pasteEvent";
1448
+ };
1449
+
1450
+ /**
1451
+ * What each selected node gives a Boolean operation: its path, its outline
1452
+ * (a text node's glyphs), or the region its ink covers once a stroke is counted.
1453
+ */
1454
+
1455
+ /**
1456
+ * What a stroked operand gives a Boolean operation.
1457
+ *
1458
+ * - `'ignore'`: its path, as though it had no stroke.
1459
+ * - `'unfilled'`: the region its stroke covers when it has no fill, as a line
1460
+ * or an open pencil stroke has none; its path when it is filled.
1461
+ * - `'include'`: what it paints — its fill and its stroke together, or the
1462
+ * stroke alone when it has no fill.
1463
+ *
1464
+ * Any mode but `'ignore'` needs {@link BooleansAdapter.getPaint}.
1465
+ */
1466
+ type BooleanStrokes = 'ignore' | 'unfilled' | 'include';
1467
+ /** Options for `applyBooleanOp`. */
1468
+ interface BooleanOpOptions {
1469
+ /** Default `'ignore'`. */
1470
+ strokes?: BooleanStrokes;
1471
+ /** The view scale a `{ px }` stroke width resolves against: one number, or
1472
+ * the view's own scale per axis. Default 1. */
1473
+ scale?: number | Scale2;
1474
+ }
1475
+
1476
+ /**
1477
+ * Pure action core for path boolean operations. Resolves the current
1478
+ * selection into z-ordered paths, runs the chosen op, and dispatches a
1479
+ * single batch of `Op`s (delete sources + insert results + set selection).
1480
+ */
1481
+
1482
+ declare module '@weasel-js/routing' {
1483
+ interface DepSchema {
1484
+ /** What the Pathfinder actions and the shape builder read and mint paths through. `presets.booleans` publishes
1485
+ * one over the canvas's path leaves; a consumer replaces it with `useBooleansAdapter`. */
1486
+ booleansAdapter?: BooleansAdapter;
1487
+ }
1488
+ }
1489
+ /** Boolean op identifiers: the five Pathfinder primaries, and Crop, Trim, and Merge. */
1490
+ type BooleanOp = 'union' | 'intersect' | 'subtract' | 'exclude' | 'divide' | 'crop' | 'trim' | 'merge';
1491
+ /** Adapter the hook and the pure core both consume. */
1492
+ interface BooleansAdapter {
1493
+ getSelection(): readonly NodeId[] | readonly string[];
1494
+ getWorldPath(id: NodeId): Path | undefined;
1495
+ /**
1496
+ * Optional: the outline of the node behind `id`, for an id `getWorldPath`
1497
+ * has no path for — `sceneNodeOutline`, which asks the node's painter. It
1498
+ * becomes the operand, so text, whose outline is its glyphs, can be cut,
1499
+ * united or intersected like any shape.
1500
+ */
1501
+ getOutline?(id: NodeId): NodeOutline | undefined;
1502
+ /**
1503
+ * Optional: the paint the path node behind `id` wears. An operation told to
1504
+ * count strokes (`BooleanOpOptions.strokes`) reads it to learn whether the
1505
+ * node is stroked and whether it is filled; without it every operand is its
1506
+ * path alone.
1507
+ */
1508
+ getPaint?(id: NodeId): PathPaint | undefined;
1509
+ /**
1510
+ * Optional: the frame the node behind `id` draws its stroke in, as the
1511
+ * matrix taking that frame to world (`poseFrameOf`); null or absent for a
1512
+ * node drawn straight. A counted world-width stroke is skewed and stretched
1513
+ * with it. Without it every stroke is outlined in world.
1514
+ */
1515
+ getStrokeFrame?(id: NodeId): Affine | null | undefined;
1516
+ compareZ(a: NodeId, b: NodeId): number;
1517
+ /**
1518
+ * Mint a new node from a boolean-op result `Path`. `producedBy` names the
1519
+ * op that synthesized it — adapters that store provenance (e.g. for a
1520
+ * layer-panel icon) record it; others ignore the arg. `sourceId` is the
1521
+ * source the result stands in for: the topmost, except that each piece of
1522
+ * a Divide, Crop, Trim, or Merge names the topmost source it was cut from. Give the
1523
+ * node that source's parent, or the kit's reorder cannot find it there.
1524
+ * `paint` is passed when that source's stroke went into the geometry, and
1525
+ * the node must wear it as given: wearing the source's stroke again would
1526
+ * draw it twice. Without `paint`, give it that source's paint. The kit never
1527
+ * reads a node's `data`: anything else the result should keep of its source,
1528
+ * a name say, is the adapter's to copy from `sourceId`.
1529
+ */
1530
+ createPathNode(path: Path, producedBy: BooleanOp, sourceId: NodeId, paint?: PathPaint): {
1531
+ id: string;
1532
+ };
1533
+ /**
1534
+ * The full object for an id. The delete ops capture it, so their `invert`
1535
+ * (an insert) restores the complete object on undo.
1536
+ */
1537
+ getNode(id: NodeId): {
1538
+ id: string;
1539
+ } | undefined | null;
1540
+ /**
1541
+ * The tree. The kit reads each source's slot among its siblings through
1542
+ * `getParent` and `getChildren`, and moves each result into the slot of
1543
+ * the topmost source in its own source's parent through `setChildOrder`.
1544
+ * `defaultCommitAdapter` supplies all three, and `getNode`.
1545
+ */
1546
+ getParent(id: string): string | null;
1547
+ getChildren(parentId: string | null): string[];
1548
+ setChildOrder(parentId: string | null, ids: string[]): void;
1549
+ applyOps?(ops: Op[], label?: string): void;
1550
+ setSelection?(ids: NodeId[]): void;
1551
+ insertNode?(node: {
1552
+ id: string;
1553
+ }): void;
1554
+ removeNode?(id: string): void;
1555
+ }
1556
+ /** Outcome reported back to callers (lets the hook surface no-op signals). */
1557
+ type BooleanOpResult = {
1558
+ kind: 'applied';
1559
+ resultIds: string[];
1560
+ } | {
1561
+ kind: 'noop';
1562
+ reason: 'no-paths' | 'too-few-for-subtract' | 'empty-result';
1563
+ }
1564
+ /** An operand's outline could not be built. Nothing was changed: an op that
1565
+ * quietly dropped the operand would commit a different shape than asked. */
1566
+ | {
1567
+ kind: 'failed';
1568
+ reason: 'outlines';
1569
+ error: NodeOutlineError;
1570
+ };
1571
+ /** One path a Boolean operation would make. */
1572
+ interface BooleanPreviewPiece {
1573
+ path: Path;
1574
+ /** The source the piece stands in for; see `BooleansAdapter.createPathNode`. */
1575
+ sourceId: NodeId;
1576
+ /** Set when that source's stroke went into `path`: the paint the piece wears. */
1577
+ paint?: PathPaint;
1578
+ }
1579
+ /** What {@link previewBooleanOp} answers: the pieces, or why there are none. */
1580
+ type BooleanOpPreview = {
1581
+ kind: 'pieces';
1582
+ pieces: BooleanPreviewPiece[];
1583
+ } | Exclude<BooleanOpResult, {
1584
+ kind: 'applied';
1585
+ }>;
1586
+ /**
1587
+ * What {@link applyBooleanOp} would make of the selection, without minting a
1588
+ * node or committing anything: for drawing an operation before it is applied.
1589
+ */
1590
+ declare function previewBooleanOp(adapter: BooleansAdapter, op: BooleanOp, opts?: BooleanOpOptions): BooleanOpPreview;
1591
+ /**
1592
+ * Run one Boolean operation over the selected paths and commit the result as a
1593
+ * single undoable batch.
1594
+ *
1595
+ * Operands are ordered back-to-front, which is what makes `subtract` mean
1596
+ * "everything in front removed from the backmost shape". Returns without
1597
+ * mutating anything when the selection holds no paths, or too few for the
1598
+ * requested operation. `opts.strokes` says what a stroked operand gives.
1599
+ */
1600
+ declare function applyBooleanOp(adapter: BooleansAdapter, op: BooleanOp, opts?: BooleanOpOptions): BooleanOpResult;
1601
+
1602
+ /** The Boolean path operations, each acting on the current selection and
1603
+ * committing as one undo step. */
1604
+ interface UseBooleansReturn {
1605
+ union(): void;
1606
+ intersect(): void;
1607
+ subtract(): void;
1608
+ exclude(): void;
1609
+ divide(): void;
1610
+ crop(): void;
1611
+ trim(): void;
1612
+ merge(): void;
1613
+ }
1614
+ /** Options for `useBooleans`. */
1615
+ interface UseBooleansOptions extends BooleanOpOptions {
1616
+ /** No-op. Retained for source-compatibility; `useStandardActions`
1617
+ * registers the actions. */
1618
+ enableActions?: boolean;
1619
+ }
1620
+ /** Bind the Boolean path operations to an adapter that knows how to read the
1621
+ * selection, fetch world-space paths and mint result nodes. */
1622
+ declare function useBooleans(adapter: BooleansAdapter, options?: UseBooleansOptions): UseBooleansReturn;
1623
+
1624
+ /** Publish a Boolean-ops adapter so the built-in Pathfinder actions can run.
1625
+ * Silently does nothing outside a `<DepRegistryProvider>`. */
1626
+ declare function useBooleansAdapter(adapter: BooleansAdapter): void;
1627
+
1628
+ /** One path to mint: the index of the source it stands in for, and the op it
1629
+ * is recorded as made by. */
1630
+ interface BooleanCommitPiece {
1631
+ path: Path;
1632
+ source: number;
1633
+ producedBy: BooleanOp;
1634
+ }
1635
+
1636
+ /**
1637
+ * A Boolean operation of the caller's own over the selection: the operands the
1638
+ * kit resolves from it, and the commit that replaces them with the pieces the
1639
+ * caller cut from those operands, as one undo step.
1640
+ */
1641
+
1642
+ /** One selected node's operand. */
1643
+ interface BooleanSource {
1644
+ id: NodeId;
1645
+ /** In world: its path, its glyph outlines, or the region its ink covers
1646
+ * once a stroke is counted. */
1647
+ path: Path;
1648
+ /** Set when a stroke went into `path`: what a piece standing in for this
1649
+ * source wears. */
1650
+ paint?: PathPaint;
1651
+ }
1652
+ /** What {@link resolveBooleanOperands} answers. */
1653
+ interface BooleanOperands {
1654
+ /** The selection the operands were read from. */
1655
+ selection: readonly NodeId[];
1656
+ /** Back to front. */
1657
+ sources: readonly BooleanSource[];
1658
+ }
1659
+ /**
1660
+ * The operands the nodes among `ids` (the selection, when not given) give a
1661
+ * Boolean operation, back to front, as the built-in operations resolve them;
1662
+ * or why there are fewer than two.
1663
+ * Reads the adapter and changes nothing.
1664
+ */
1665
+ declare function resolveBooleanOperands(adapter: BooleansAdapter, opts?: BooleanOpOptions, ids?: readonly NodeId[]): BooleanOperands | Exclude<BooleanOpResult, {
1666
+ kind: 'applied';
1667
+ }>;
1668
+ /**
1669
+ * Replace `operands`' sources with `pieces` as one undo step named `label`,
1670
+ * and select what was made. Each piece is minted from the source it names, as
1671
+ * `BooleansAdapter.createPathNode` says, and stacks in that source's slot. An
1672
+ * empty `pieces` deletes every source.
1673
+ */
1674
+ declare function commitBooleanPieces(adapter: BooleansAdapter, operands: BooleanOperands, pieces: readonly BooleanCommitPiece[], label: string): Extract<BooleanOpResult, {
1675
+ kind: 'applied';
1676
+ }>;
1677
+
1678
+ /** What a stroked operand gives the built-in Pathfinder actions, and a tool
1679
+ * that should count strokes as they do. */
1680
+ declare const PATHFINDER_STROKES: BooleanStrokes;
1681
+ /** Static descriptor for pathfinder-union. */
1682
+ declare const pathfinderUnionAction: Action;
1683
+ /** Static descriptor for pathfinder-subtract. */
1684
+ declare const pathfinderSubtractAction: Action;
1685
+ /** Static descriptor for pathfinder-intersect. */
1686
+ declare const pathfinderIntersectAction: Action;
1687
+ /** Static descriptor for pathfinder-exclude. */
1688
+ declare const pathfinderExcludeAction: Action;
1689
+ /** Static descriptor for pathfinder-divide. */
1690
+ declare const pathfinderDivideAction: Action;
1691
+ /** Static descriptor for pathfinder-crop. */
1692
+ declare const pathfinderCropAction: Action;
1693
+ /** Static descriptor for pathfinder-trim. */
1694
+ declare const pathfinderTrimAction: Action;
1695
+ /** Static descriptor for pathfinder-merge. */
1696
+ declare const pathfinderMergeAction: Action;
1697
+
1698
+ /**
1699
+ * The ops that put `ids` under a new boolean group of `op`, in the frontmost one's place
1700
+ * in the container `groupingSite` names, labeled `label`; nothing moves on
1701
+ * screen, unless the operands lie wholly off every page with the pasteboard
1702
+ * off and move onto one, and a node following one that changes page goes
1703
+ * where `followerMoves` says. The group wears the frontmost
1704
+ * operand's `fill` and `stroke`. The operands are the outermost of `ids`, so a selected node's selected
1705
+ * descendant stays where it is. Null when fewer than two operands are nodes on one layer, or when one would land in
1706
+ * a singular frame.
1707
+ */
1708
+ declare function booleanGroupOps(scene: AnyScene, ids: readonly string[], op?: BooleanShapeOp, label?: string): {
1709
+ ops: Op[];
1710
+ group: NodeId;
1711
+ } | null;
1712
+ /** {@link booleanGroupOps} committed straight to `scene` as one undo entry. Returns the group's id, or null. */
1713
+ declare function makeBooleanGroup(scene: AnyScene, ids: readonly string[], op?: BooleanShapeOp): NodeId | null;
1714
+ /** Put the selection under a new boolean group, a union until its operation is changed. */
1715
+ declare const makeBooleanGroupAction: Action & {
1716
+ requires: string[];
1717
+ };
1718
+
1719
+ /** The Pathfinder keymap's id; its leader action is `keymap.pathfinder`. */
1720
+ declare const PATHFINDER_KEYMAP_ID = "pathfinder";
1721
+ /** Alt+P, by the physical key too, since with Alt held on a Mac it types `π`. */
1722
+ declare const PATHFINDER_LEADER: KeySpec;
1723
+ /**
1724
+ * The Pathfinder operations on held keys, behind the leader Alt+P: holding
1725
+ * an operation's key previews it on the selection, releasing runs it, and
1726
+ * Escape while it is held cancels it. Each binding's id is its hold's action
1727
+ * id (`pathfinder.union.hold`), which is what a host rebinds it by. The
1728
+ * operations themselves come from the `paths` preset; this carries only their
1729
+ * holds. Install it with `<SceneCanvas ambient>`.
1730
+ */
1731
+ declare const PATHFINDER_KEYMAP: readonly Contribution<never>[];
1732
+
1733
+ /**
1734
+ * Publish a `booleansAdapter` over `scene`'s path leaves (`data.path` drawn
1735
+ * through the pose's box), acting on `operands`. A result is minted from the source it stands in
1736
+ * for: its layer, parent, frame, and data, with the result's path, and the
1737
+ * result's paint in place of the source's when the operation gives one.
1738
+ */
1739
+ declare function useBooleansAdapterDepSource(scene: Scene$1<unknown, string, unknown>, operands: OperandsDep, adapter: OpsApplier, poseDescriptor?: PoseDescriptor$1<unknown>): void;
1740
+
1741
+ /** MIME type to payload, as `produceFlavors` returns it. */
1742
+ type ClipboardFlavors = Record<string, string | Promise<string>>;
1743
+
1744
+ /** Options for `useClipboardOps`. */
1745
+ interface UseClipboardOpsOptions {
1746
+ /** How the hook reads "current selection" for copy. The kit doesn't assume
1747
+ * a global selection store; each consumer wires this. */
1748
+ getSelection: () => NodeId[];
1749
+ /** Called after a successful paste with the ids of the newly inserted objects. */
1750
+ onPaste?: (newIds: NodeId[]) => void;
1751
+ /** Called when a paste left copied nodes out, with each one and the reason
1752
+ * — an edge whose endpoints were not copied with it, say. Also called for
1753
+ * a paste that made nothing. */
1754
+ onPasteOmitted?: (omitted: PasteOmission[]) => void;
1755
+ /** Label for the history entry produced by paste. Default 'Paste'. */
1756
+ pasteLabel?: string;
1757
+ /** Pulled once per paste() call. When non-null, threaded to commitPaste
1758
+ * as `ctx.dropPoint`; adapters typically use it as the cluster origin
1759
+ * (ignoring `offset`). When null/undefined, the hook falls back to the
1760
+ * existing cascade-offset behavior. */
1761
+ getDropPoint?: () => WorldPoint | null;
1762
+ /** Produce the OS-clipboard flavor map for a copied snapshot. Keys are MIME
1763
+ * types, values the serialized payload. The kit default emits
1764
+ * `application/x-weasel-clipboard+json` plus `text/plain` carrying the
1765
+ * same JSON. Apps override to add richer flavors (e.g. real SVG) or to
1766
+ * replace the text flavor. Return an empty object to skip the OS write
1767
+ * entirely. A value may be a promise — an SVG flavor waiting on
1768
+ * `warmSvg`, say: the write is still issued inside the copy gesture and
1769
+ * the clipboard takes the text when it resolves. The producer itself runs
1770
+ * synchronously, so it reads the selection as it stood at the copy. */
1771
+ produceFlavors?: (snapshot: ClipboardSnapshot) => ClipboardFlavors;
1772
+ /** Replacer for the kit-default JSON flavor (typed arrays etc.). Ignored
1773
+ * when `produceFlavors` is supplied. */
1774
+ jsonReplacer?: (key: string, value: unknown) => unknown;
1775
+ }
1776
+ /** Return shape of `useClipboardOps`: imperative `copy`, `paste`, and `isEmpty` functions. */
1777
+ interface UseClipboardOpsReturn {
1778
+ copy(): void;
1779
+ /** Paste at `at` when given; otherwise at the drop point, else the cascade offset. */
1780
+ paste(at?: WorldPoint): void;
1781
+ isEmpty(): boolean;
1782
+ }
1783
+ /** `useClipboard` over `InsertAdapter.snapshotSelection` / `commitPaste`, each paste one undoable op batch. */
1784
+ declare function useClipboardOps<TNode extends {
1785
+ id: string;
1786
+ }>(adapter: InsertAdapter<TNode>, options: UseClipboardOpsOptions): UseClipboardOpsReturn;
1787
+
1788
+ /** What a paste wrote: the new nodes' ids, and the copies the next paste of this clipboard starts from. */
1789
+ interface PastedItems<TItem> {
1790
+ ids: string[];
1791
+ /** Shaped like what `copy` returns. Pasting again pastes these, so a run of pastes steps on from the last one
1792
+ * instead of stacking on the first. */
1793
+ items: readonly TItem[];
1794
+ }
1795
+ /** Options for `useClipboard`. */
1796
+ interface UseClipboardOptions<TItem> {
1797
+ /** The ids Copy takes. */
1798
+ getSelection: () => readonly string[];
1799
+ /** The copyable form of `ids`, or `null` when they cannot be copied. */
1800
+ copy: (ids: readonly string[]) => readonly TItem[] | null;
1801
+ /** Write copies of `items` into the document, and say what was written, or `null` when nothing was.
1802
+ * `at.dropPoint` is where the paste was asked to land, when it was. */
1803
+ paste: (items: readonly TItem[], at: {
1804
+ dropPoint?: WorldPoint;
1805
+ }) => PastedItems<TItem> | null;
1806
+ /** Called after a paste with the new ids. */
1807
+ onPaste?: (ids: string[]) => void;
1808
+ /** Where a paste with no point of its own lands. Defaults to the pointer, as `<SceneCanvas>` publishes it. */
1809
+ getDropPoint?: () => WorldPoint | null;
1810
+ /** The OS-clipboard flavors for a copy, by MIME type. Defaults to the kit's JSON flavor and `text/plain`
1811
+ * carrying the same JSON; `{}` writes nothing to the OS clipboard. A value may be a promise. Runs inside
1812
+ * `copy()`, so it reads the document as it stood at the copy. */
1813
+ produceFlavors?: (copied: {
1814
+ items: readonly TItem[];
1815
+ }) => ClipboardFlavors;
1816
+ /** Replacer for the default JSON flavor. Ignored when `produceFlavors` is given. */
1817
+ jsonReplacer?: (key: string, value: unknown) => unknown;
1818
+ }
1819
+ /**
1820
+ * Copy and paste over any document: an in-memory clipboard of what `copy` returns, written to the OS clipboard as
1821
+ * well, and pasted through `paste`. The returned object is the `clipboard` dep's shape. `useClipboardOps` is this
1822
+ * over an `InsertAdapter` and the scene's op history; an app whose own document owns its nodes passes its own
1823
+ * functions, or uses `@weasel-js/editor`'s `useDocClipboard`, which adds the commands.
1824
+ */
1825
+ declare function useClipboard<TItem>(options: UseClipboardOptions<TItem>): ClipboardDep;
1826
+
1827
+ /** MIME type the kit writes its full-fidelity clipboard payload under, so a
1828
+ * copy/paste between two weasel canvases round-trips scene nodes rather than
1829
+ * the SVG or text flavors other apps read. */
1830
+ declare const WEASEL_CLIPBOARD_MIME = "application/x-weasel-clipboard+json";
1831
+ /** Chromium's async-clipboard spelling for custom formats. */
1832
+ declare const WEASEL_CLIPBOARD_MIME_WEB = "web application/x-weasel-clipboard+json";
1833
+ /** Serialize snapshot items into the versioned wire text.
1834
+ *
1835
+ * JSON drops a function-valued field (a container's `clipFromPose`, a
1836
+ * node's `derivePath`). A scene adapter's snapshot also carries each one's
1837
+ * `SceneRegistry` key (`clipFromPoseKey`, `derivePathKey`, …), which does
1838
+ * cross, and its paste restores the function from the pasting scene's
1839
+ * registry. A function that is not registered does not survive. Written with the snapshot codec unless
1840
+ * `replacer` says otherwise, so typed arrays and non-finite numbers cross. */
1841
+ declare function buildWeaselClipboardText(items: unknown[], replacer?: (key: string, value: unknown) => unknown): string;
1842
+ /** Cheap check: is this text a payload {@link parseWeaselClipboardText}
1843
+ * accepts? Substring pre-check, then a guarded parse. */
1844
+ declare function sniffWeaselClipboardText(text: string): boolean;
1845
+ /**
1846
+ * Embed a weasel clipboard payload in an SVG document as a `<metadata>`
1847
+ * child of the root — legal SVG 1.1, ignored by external tools — so one
1848
+ * `text/plain` flavor serves both audiences.
1849
+ *
1850
+ * Intended for OUR serializer's output only (`serializeSvg` — single
1851
+ * `<svg ...>` open tag, XML-escaped attributes). When no open tag is found
1852
+ * the input is returned unchanged with a debug warning.
1853
+ */
1854
+ declare function embedWeaselMetadataInSvg(svgText: string, payloadText: string): string;
1855
+ /**
1856
+ * The weasel clipboard payload embedded in SVG text by
1857
+ * {@link embedWeaselMetadataInSvg}, or null when the first `<metadata>` block
1858
+ * is absent or not the weasel wire format. A text scan, not an XML parse.
1859
+ */
1860
+ declare function extractWeaselClipboardFromSvg(svgText: string): string | null;
1861
+ /** Parse wire text to snapshot items, or null when malformed/mismatched
1862
+ * (callers decline to the next content handler). Decoded with the snapshot codec unless `reviver` says otherwise;
1863
+ * a `reviver` that throws declines too, logged with `console.error`. */
1864
+ declare function parseWeaselClipboardText(text: string, reviver?: (key: string, value: unknown) => unknown): unknown[] | null;
1865
+
1866
+ export { DEFAULT_ROTATION_HANDLE_DISTANCE, DEFAULT_SHAPE_PAINT, DEFAULT_STROKE_WIDTH, ELLIPSE_TOOL_OPTIONS, FEATURE_ACTION_IDS, FEATURE_NAMES, FEATURE_PRESETS, INSERT_REPOSITION_BINDING, KIT_CONTENT_HANDLERS, KIT_INSERT_KINDS, KIT_STANDARD_ACTIONS, KIT_STANDARD_ACTION_IDS, KIT_TOOLS, KIT_TOOL_GROUPS, KIT_TOOL_IDS, LASSO_TOOL_OPTIONS, LINE_TOOL_OPTIONS, PATHFINDER_KEYMAP, PATHFINDER_KEYMAP_ID, PATHFINDER_LEADER, PATHFINDER_STROKES, POLYGON_INSERT_PARAMS, POLYGON_TOOL_OPTIONS, RECT_TOOL_OPTIONS, SELECTION_CHROME, SELECT_TOOLS, SHAPE_TOOLS, STAR_INSERT_PARAMS, STAR_TOOL_OPTIONS, STYLE_OPTION_KEYS, SelectAdapter, TOOL_GROUP_ORDER, UseSelectToolOptions, WEASEL_CLIPBOARD_MIME, WEASEL_CLIPBOARD_MIME_WEB, alignBottomAction, alignCenterXAction, alignCenterYAction, alignDeltaFor, alignLeftAction, alignRightAction, alignTargetBounds, alignTopAction, applyBooleanOp, booleanGroupOps, buildWeaselClipboardText, clampMinSize, clampMove, clearSelectionAction, clipboardCopyAction, clipboardCutAction, clipboardPasteAction, clipboardPasteCopiedAction, cloneAction, commitBooleanPieces, commitDeleteToScene, composeSelectionPose, createCornerResizeAffordance, createDeleteAction, createEllipseTool, createLassoTool, createLineTool, createPointerFollower, createPolygonTool, createRectTool, createResizeAction, createRotationAffordance, createSelectTool, createSelectionHandlesLayer, createSelectionOutlineLayer, createSelectionOverlayLayer, createStarTool, deleteAction, deselectAction, distributeHorizontalAction, distributeVerticalAction, duplicateAction, duplicateSelection, embedWeaselMetadataInSvg, extractWeaselClipboardFromSvg, flipAction, groupAction, hiddenSourceDeleteOps, hitRotationHandle, ingestAction, insertBindingBehaviors, insertParams, insertRepositionAction, insertRotateAction, insertStyleOf, lassoSelectAction, makeBooleanGroup, makeBooleanGroupAction, namedFeatures, nudgeDownAction, nudgeLeftAction, nudgeRightAction, nudgeUpAction, parseWeaselClipboardText, pathfinderCropAction, pathfinderDivideAction, pathfinderExcludeAction, pathfinderIntersectAction, pathfinderMergeAction, pathfinderSubtractAction, pathfinderTrimAction, pathfinderUnionAction, placeAction, previewBooleanOp, reorderBackwardAction, reorderForwardAction, resizeAction, resizePolicyOptions, resolveBooleanOperands, rotateAction, rotationHandle, selectAllAction, selectFromLasso, selectionTransformAnswer, setFillAction, setFillOpacityAction, setStrokeAction, setStrokeOpacityAction, setStrokeWidthAction, setVertexColorAction, shapeToolOptions, snapBackOrDelete, snapToContainer, sniffWeaselClipboardText, styleOptionLeaves, swapAction, swapOnDrop, swapOps, toolOptionPaint, transformAgainAction, transformSelection, ungroupAction, useAlign, useBooleans, useBooleansAdapter, useBooleansAdapterDepSource, useClipboard, useClipboardOps, useDistribute, useEllipseTool, useEyedropperTool, useImageTool, useInsertDepSource, useLassoTool, useLineTool, usePolygonTool, useRectTool, useResizePolicyDepSource, useSelectTool, useStandardActions, useStarTool };
1867
+ export type { AlignAdapter, AlignEdge, AlignParams, AlignReference, BooleanCommitPiece, BooleanOp, BooleanOpOptions, BooleanOpPreview, BooleanOpResult, BooleanOperands, BooleanPreviewPiece, BooleanSource, BooleanStrokes, BooleansAdapter, ClampMoveOptions, ClipboardFlavors, ComposeSelectionPoseOptions, CornerResizeAffordanceOptions, CornerResizeScratch, CreatePolygonToolOptions, CreateStarToolOptions, DeleteActionOptions, DistributeAdapter, DistributeAxis, DistributeMode, DistributeParams, EditingIconName, FeatureName, FlipAxis, FlipParams, FlipPivot, InsertStyle, InsertToolOptions, KitToolId, LinePoint, PastedItems, PointerFollower, PolygonPoint, ReorderParams, ResizeActionOptions, RotationAffordanceOptions, RotationHandle, RotationScratch, SelectFromLassoOptions, SelectionTransform, ShapeToolOptionsSpec, StarPoint, StyleOptionKey, SwapOnDropOptions, UseAlignOptions, UseAlignReturn, UseBooleansOptions, UseBooleansReturn, UseClipboardOpsOptions, UseClipboardOpsReturn, UseClipboardOptions, UseDistributeOptions, UseDistributeReturn, UseEyedropperToolOptions, UseImageToolOptions, UseLassoSelectOptions, UseLassoToolOptions, UsePolygonToolOptions, UseResizePolicyDepSourceOptions, UseStandardActionsOptions, UseStarToolOptions };