@weasel-js/editing 1.19.1 → 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 (363) hide show
  1. package/README.md +23 -11
  2. package/dist/actionGroups.js +27 -0
  3. package/dist/actionGroups.js.map +1 -0
  4. package/dist/actions/align/action.js +12 -9
  5. package/dist/actions/align/action.js.map +1 -1
  6. package/dist/actions/align/align.js +5 -4
  7. package/dist/actions/align/align.js.map +1 -1
  8. package/dist/actions/clipboard/action.js +10 -7
  9. package/dist/actions/clipboard/action.js.map +1 -1
  10. package/dist/actions/clone/action.js +217 -0
  11. package/dist/actions/clone/action.js.map +1 -0
  12. package/dist/actions/clone/behaviors.js +65 -0
  13. package/dist/actions/clone/behaviors.js.map +1 -0
  14. package/dist/actions/delete/delete.js +123 -0
  15. package/dist/actions/delete/delete.js.map +1 -0
  16. package/dist/actions/derivedBox.js +16 -0
  17. package/dist/actions/derivedBox.js.map +1 -0
  18. package/dist/actions/distribute/action.js +6 -3
  19. package/dist/actions/distribute/action.js.map +1 -1
  20. package/dist/actions/distribute/distribute.js +3 -2
  21. package/dist/actions/distribute/distribute.js.map +1 -1
  22. package/dist/actions/distribute/plan.js.map +1 -1
  23. package/dist/actions/edit/createPaintAction.js +42 -13
  24. package/dist/actions/edit/createPaintAction.js.map +1 -1
  25. package/dist/actions/edit/{escape.js → deselect.js} +8 -8
  26. package/dist/actions/edit/deselect.js.map +1 -0
  27. package/dist/actions/edit/duplicate.js +9 -7
  28. package/dist/actions/edit/duplicate.js.map +1 -1
  29. package/dist/actions/edit/group.js +24 -20
  30. package/dist/actions/edit/group.js.map +1 -1
  31. package/dist/actions/edit/ingest.js +4 -2
  32. package/dist/actions/edit/ingest.js.map +1 -1
  33. package/dist/actions/edit/nudge.js +14 -10
  34. package/dist/actions/edit/nudge.js.map +1 -1
  35. package/dist/actions/edit/selectAll.js +1 -1
  36. package/dist/actions/edit/setFill.js +1 -1
  37. package/dist/actions/edit/setFill.js.map +1 -1
  38. package/dist/actions/edit/setFillOpacity.js +5 -5
  39. package/dist/actions/edit/setFillOpacity.js.map +1 -1
  40. package/dist/actions/edit/setStroke.js +1 -1
  41. package/dist/actions/edit/setStroke.js.map +1 -1
  42. package/dist/actions/edit/setStrokeOpacity.js +6 -6
  43. package/dist/actions/edit/setStrokeOpacity.js.map +1 -1
  44. package/dist/actions/edit/setStrokeWidth.js +13 -8
  45. package/dist/actions/edit/setStrokeWidth.js.map +1 -1
  46. package/dist/actions/edit/setVertexColor.js +13 -6
  47. package/dist/actions/edit/setVertexColor.js.map +1 -1
  48. package/dist/actions/flip/action.js +19 -14
  49. package/dist/actions/flip/action.js.map +1 -1
  50. package/dist/actions/flip/helpers.js.map +1 -1
  51. package/dist/actions/group/enterGroup.js +81 -0
  52. package/dist/actions/group/enterGroup.js.map +1 -0
  53. package/dist/actions/insert/action.js +152 -0
  54. package/dist/actions/insert/action.js.map +1 -0
  55. package/dist/actions/insert/commit.js +52 -0
  56. package/dist/actions/insert/commit.js.map +1 -0
  57. package/dist/actions/insert/extras.js +88 -0
  58. package/dist/actions/insert/extras.js.map +1 -0
  59. package/dist/actions/insert/frame.js +96 -0
  60. package/dist/actions/insert/frame.js.map +1 -0
  61. package/dist/actions/insert/geometry.js +35 -0
  62. package/dist/actions/insert/geometry.js.map +1 -0
  63. package/dist/actions/insert/lands.js +41 -0
  64. package/dist/actions/insert/lands.js.map +1 -0
  65. package/dist/actions/insert/params.js +42 -0
  66. package/dist/actions/insert/params.js.map +1 -0
  67. package/dist/actions/insert/placeAction.js +137 -0
  68. package/dist/actions/insert/placeAction.js.map +1 -0
  69. package/dist/actions/insert/repositionAction.js +47 -0
  70. package/dist/actions/insert/repositionAction.js.map +1 -0
  71. package/dist/actions/insert/rotateAction.js +34 -0
  72. package/dist/actions/insert/rotateAction.js.map +1 -0
  73. package/dist/actions/insert/session.js +99 -0
  74. package/dist/actions/insert/session.js.map +1 -0
  75. package/dist/actions/insert/shape.js +117 -0
  76. package/dist/actions/insert/shape.js.map +1 -0
  77. package/dist/actions/insert/style.js +23 -0
  78. package/dist/actions/insert/style.js.map +1 -0
  79. package/dist/actions/lassoSelect/action.js +201 -0
  80. package/dist/actions/lassoSelect/action.js.map +1 -0
  81. package/dist/actions/lassoSelect/behaviors/selectFromLasso.js +61 -0
  82. package/dist/actions/lassoSelect/behaviors/selectFromLasso.js.map +1 -0
  83. package/dist/actions/lockedWrites.js +20 -0
  84. package/dist/actions/lockedWrites.js.map +1 -0
  85. package/dist/actions/move/action.js +138 -0
  86. package/dist/actions/move/action.js.map +1 -0
  87. package/dist/actions/move/behaviors/clampMove.js +42 -0
  88. package/dist/actions/move/behaviors/clampMove.js.map +1 -0
  89. package/dist/actions/move/behaviors/layoutDrop.js +84 -0
  90. package/dist/actions/move/behaviors/layoutDrop.js.map +1 -0
  91. package/dist/actions/move/behaviors/pageDrop.js +30 -0
  92. package/dist/actions/move/behaviors/pageDrop.js.map +1 -0
  93. package/dist/actions/move/behaviors/reparentOnDrop.js +44 -0
  94. package/dist/actions/move/behaviors/reparentOnDrop.js.map +1 -0
  95. package/dist/actions/move/behaviors/snapBackOrDelete.js +52 -0
  96. package/dist/actions/move/behaviors/snapBackOrDelete.js.map +1 -0
  97. package/dist/actions/move/behaviors/snapToContainer.js +214 -0
  98. package/dist/actions/move/behaviors/snapToContainer.js.map +1 -0
  99. package/dist/actions/move/behaviors/swapOnDrop.js +180 -0
  100. package/dist/actions/move/behaviors/swapOnDrop.js.map +1 -0
  101. package/dist/actions/move/capture.js +116 -0
  102. package/dist/actions/move/capture.js.map +1 -0
  103. package/dist/actions/move/commit/index.js +47 -0
  104. package/dist/actions/move/commit/index.js.map +1 -0
  105. package/dist/actions/move/commit/layoutDrop.js +68 -0
  106. package/dist/actions/move/commit/layoutDrop.js.map +1 -0
  107. package/dist/actions/move/commit/layoutRelease.js +146 -0
  108. package/dist/actions/move/commit/layoutRelease.js.map +1 -0
  109. package/dist/actions/move/commit/pageDrop.js +162 -0
  110. package/dist/actions/move/commit/pageDrop.js.map +1 -0
  111. package/dist/actions/move/commit/rebase.js +24 -0
  112. package/dist/actions/move/commit/rebase.js.map +1 -0
  113. package/dist/actions/move/commit/reparent.js +157 -0
  114. package/dist/actions/move/commit/reparent.js.map +1 -0
  115. package/dist/actions/move/delta.js +127 -0
  116. package/dist/actions/move/delta.js.map +1 -0
  117. package/dist/actions/move/dragSnap.js +55 -0
  118. package/dist/actions/move/dragSnap.js.map +1 -0
  119. package/dist/actions/move/frame.js +67 -0
  120. package/dist/actions/move/frame.js.map +1 -0
  121. package/dist/actions/move/gestureAdapter.js +36 -0
  122. package/dist/actions/move/gestureAdapter.js.map +1 -0
  123. package/dist/actions/move/landedDescendants.js +50 -0
  124. package/dist/actions/move/landedDescendants.js.map +1 -0
  125. package/dist/actions/move/layout/container.js +119 -0
  126. package/dist/actions/move/layout/container.js.map +1 -0
  127. package/dist/actions/move/layout/dragged.js +75 -0
  128. package/dist/actions/move/layout/dragged.js.map +1 -0
  129. package/dist/actions/move/layout/dropPass.js +205 -0
  130. package/dist/actions/move/layout/dropPass.js.map +1 -0
  131. package/dist/actions/move/layout/exits.js +62 -0
  132. package/dist/actions/move/layout/exits.js.map +1 -0
  133. package/dist/actions/move/layout/glide.js +70 -0
  134. package/dist/actions/move/layout/glide.js.map +1 -0
  135. package/dist/actions/move/layout/view.js +60 -0
  136. package/dist/actions/move/layout/view.js.map +1 -0
  137. package/dist/actions/move/refusal.js +49 -0
  138. package/dist/actions/move/refusal.js.map +1 -0
  139. package/dist/actions/move/session.js +105 -0
  140. package/dist/actions/move/session.js.map +1 -0
  141. package/dist/actions/move/sessionOf.js +27 -0
  142. package/dist/actions/move/sessionOf.js.map +1 -0
  143. package/dist/actions/move/translate.js +49 -0
  144. package/dist/actions/move/translate.js.map +1 -0
  145. package/dist/actions/pathfinder/action.js +8 -6
  146. package/dist/actions/pathfinder/action.js.map +1 -1
  147. package/dist/actions/pathfinder/booleanGroupAction.js +16 -10
  148. package/dist/actions/pathfinder/booleanGroupAction.js.map +1 -1
  149. package/dist/actions/pathfinder/keymap.js +2 -2
  150. package/dist/actions/pathfinder/keymap.js.map +1 -1
  151. package/dist/actions/reorder/reorder.js +13 -11
  152. package/dist/actions/reorder/reorder.js.map +1 -1
  153. package/dist/actions/resize/action.js +105 -0
  154. package/dist/actions/resize/action.js.map +1 -0
  155. package/dist/actions/resize/aspect.js +42 -0
  156. package/dist/actions/resize/aspect.js.map +1 -0
  157. package/dist/actions/resize/behaviors/clampMinSize.js +100 -0
  158. package/dist/actions/resize/behaviors/clampMinSize.js.map +1 -0
  159. package/dist/actions/resize/boxFrame.js +19 -0
  160. package/dist/actions/resize/boxFrame.js.map +1 -0
  161. package/dist/actions/resize/capture.js +121 -0
  162. package/dist/actions/resize/capture.js.map +1 -0
  163. package/dist/actions/resize/commit.js +104 -0
  164. package/dist/actions/resize/commit.js.map +1 -0
  165. package/dist/actions/resize/frame.js +171 -0
  166. package/dist/actions/resize/frame.js.map +1 -0
  167. package/dist/actions/resize/held.js +44 -0
  168. package/dist/actions/resize/held.js.map +1 -0
  169. package/dist/actions/resize/minimum.js +34 -0
  170. package/dist/actions/resize/minimum.js.map +1 -0
  171. package/dist/actions/resize/replay.js +58 -0
  172. package/dist/actions/resize/replay.js.map +1 -0
  173. package/dist/actions/resize/ruleBounds.js +11 -0
  174. package/dist/actions/resize/ruleBounds.js.map +1 -0
  175. package/dist/actions/resize/session.js +118 -0
  176. package/dist/actions/resize/session.js.map +1 -0
  177. package/dist/actions/rotate/action.js +99 -0
  178. package/dist/actions/rotate/action.js.map +1 -0
  179. package/dist/actions/rotate/commit.js +48 -0
  180. package/dist/actions/rotate/commit.js.map +1 -0
  181. package/dist/actions/rotate/frame.js +96 -0
  182. package/dist/actions/rotate/frame.js.map +1 -0
  183. package/dist/actions/rotate/replay.js +25 -0
  184. package/dist/actions/rotate/replay.js.map +1 -0
  185. package/dist/actions/rotate/session.js +135 -0
  186. package/dist/actions/rotate/session.js.map +1 -0
  187. package/dist/actions/select/areaSelect.js +83 -0
  188. package/dist/actions/select/areaSelect.js.map +1 -0
  189. package/dist/actions/select/clearSelection.js +33 -0
  190. package/dist/actions/select/clearSelection.js.map +1 -0
  191. package/dist/actions/swap/action.js +63 -0
  192. package/dist/actions/swap/action.js.map +1 -0
  193. package/dist/actions/swap/swapOps.js +160 -0
  194. package/dist/actions/swap/swapOps.js.map +1 -0
  195. package/dist/actions/transformAgain/action.js +16 -14
  196. package/dist/actions/transformAgain/action.js.map +1 -1
  197. package/dist/actions/transformAgain/transformSelection.js +19 -5
  198. package/dist/actions/transformAgain/transformSelection.js.map +1 -1
  199. package/dist/booleans/booleans.js +130 -0
  200. package/dist/booleans/booleans.js.map +1 -0
  201. package/dist/booleans/commit.js +45 -0
  202. package/dist/booleans/commit.js.map +1 -0
  203. package/dist/booleans/custom.js +48 -0
  204. package/dist/booleans/custom.js.map +1 -0
  205. package/dist/booleans/operands.js +50 -0
  206. package/dist/booleans/operands.js.map +1 -0
  207. package/dist/booleans/pieces.js +43 -0
  208. package/dist/booleans/pieces.js.map +1 -0
  209. package/dist/booleans/placement.js +37 -0
  210. package/dist/booleans/placement.js.map +1 -0
  211. package/dist/booleans/useBooleans.js +34 -0
  212. package/dist/booleans/useBooleans.js.map +1 -0
  213. package/dist/booleans/useBooleansAdapter.js +11 -0
  214. package/dist/booleans/useBooleansAdapter.js.map +1 -0
  215. package/dist/chrome/affordances/cornerResize.js +123 -0
  216. package/dist/chrome/affordances/cornerResize.js.map +1 -0
  217. package/dist/chrome/affordances/rotateCursor.js +17 -0
  218. package/dist/chrome/affordances/rotateCursor.js.map +1 -0
  219. package/dist/chrome/affordances/rotationHandle.js +117 -0
  220. package/dist/chrome/affordances/rotationHandle.js.map +1 -0
  221. package/dist/chrome/handleCommands.js +110 -0
  222. package/dist/chrome/handleCommands.js.map +1 -0
  223. package/dist/chrome/overlay.js +271 -0
  224. package/dist/chrome/overlay.js.map +1 -0
  225. package/dist/chrome/rotationBadge.js +132 -0
  226. package/dist/chrome/rotationBadge.js.map +1 -0
  227. package/dist/chrome/rotationHandleGeometry.js +49 -0
  228. package/dist/chrome/rotationHandleGeometry.js.map +1 -0
  229. package/dist/chrome/selectionChrome.js +25 -0
  230. package/dist/chrome/selectionChrome.js.map +1 -0
  231. package/dist/chrome/selectionPose.js +112 -0
  232. package/dist/chrome/selectionPose.js.map +1 -0
  233. package/dist/chrome/shapeOutline.js +137 -0
  234. package/dist/chrome/shapeOutline.js.map +1 -0
  235. package/dist/clipboard/clipboardOps.js +48 -0
  236. package/dist/clipboard/clipboardOps.js.map +1 -0
  237. package/dist/clipboard/materializePaste.js +34 -0
  238. package/dist/clipboard/materializePaste.js.map +1 -0
  239. package/dist/clipboard/osClipboard.js +67 -0
  240. package/dist/clipboard/osClipboard.js.map +1 -0
  241. package/dist/clipboard/useClipboard.js +64 -0
  242. package/dist/clipboard/useClipboard.js.map +1 -0
  243. package/dist/clipboard/wireFormat.js +108 -0
  244. package/dist/clipboard/wireFormat.js.map +1 -0
  245. package/dist/deps/areaSelect.js +42 -0
  246. package/dist/deps/areaSelect.js.map +1 -0
  247. package/dist/deps/booleans.js +99 -0
  248. package/dist/deps/booleans.js.map +1 -0
  249. package/dist/deps/insert.js +260 -0
  250. package/dist/deps/insert.js.map +1 -0
  251. package/dist/deps/lassoSelect.js +37 -0
  252. package/dist/deps/lassoSelect.js.map +1 -0
  253. package/dist/deps/presetDeps.js +40 -0
  254. package/dist/deps/presetDeps.js.map +1 -0
  255. package/dist/deps/resizePolicy.js +41 -0
  256. package/dist/deps/resizePolicy.js.map +1 -0
  257. package/dist/engine-BV9RDHOL.d.ts +339 -0
  258. package/dist/engine.d.ts +6 -0
  259. package/dist/engine.js +10 -0
  260. package/dist/engineStandardActions.js +16 -7
  261. package/dist/engineStandardActions.js.map +1 -1
  262. package/dist/groups.d.ts +27 -0
  263. package/dist/groups.js +4 -0
  264. package/dist/icons.gen.js +8 -0
  265. package/dist/icons.gen.js.map +1 -0
  266. package/dist/icons.table.d.ts +6 -0
  267. package/dist/icons.table.js +8 -0
  268. package/dist/icons.table.js.map +1 -0
  269. package/dist/icons.table.json +156 -0
  270. package/dist/icons2.table.js +163 -0
  271. package/dist/icons2.table.js.map +1 -0
  272. package/dist/index.d.ts +1293 -105
  273. package/dist/index.js +61 -12
  274. package/dist/ingest/ghost.js +58 -0
  275. package/dist/ingest/ghost.js.map +1 -0
  276. package/dist/ingest/imageHandler.js +80 -0
  277. package/dist/ingest/imageHandler.js.map +1 -0
  278. package/dist/ingest/kitHandlers.js +15 -0
  279. package/dist/ingest/kitHandlers.js.map +1 -0
  280. package/dist/ingest/svgHandler.js +97 -0
  281. package/dist/ingest/svgHandler.js.map +1 -0
  282. package/dist/ingest/weaselJsonHandler.js +68 -0
  283. package/dist/ingest/weaselJsonHandler.js.map +1 -0
  284. package/dist/namedPresets.js +23 -11
  285. package/dist/namedPresets.js.map +1 -1
  286. package/dist/presets/arrange.js +21 -7
  287. package/dist/presets/arrange.js.map +1 -1
  288. package/dist/presets/booleans.js +13 -0
  289. package/dist/presets/booleans.js.map +1 -0
  290. package/dist/presets/composites.js +8 -5
  291. package/dist/presets/composites.js.map +1 -1
  292. package/dist/presets/edit.js +25 -13
  293. package/dist/presets/edit.js.map +1 -1
  294. package/dist/presets/ingest.js +7 -3
  295. package/dist/presets/ingest.js.map +1 -1
  296. package/dist/presets/insert.js +28 -0
  297. package/dist/presets/insert.js.map +1 -0
  298. package/dist/presets/pathfinder.js +5 -2
  299. package/dist/presets/pathfinder.js.map +1 -1
  300. package/dist/presets/select.js +16 -3
  301. package/dist/presets/select.js.map +1 -1
  302. package/dist/presets/selection.js +13 -0
  303. package/dist/presets/selection.js.map +1 -0
  304. package/dist/presets/selectionChrome.js +15 -0
  305. package/dist/presets/selectionChrome.js.map +1 -0
  306. package/dist/presets/tools.js +78 -9
  307. package/dist/presets/tools.js.map +1 -1
  308. package/dist/presets/transform.js +20 -7
  309. package/dist/presets/transform.js.map +1 -1
  310. package/dist/presets.d.ts +104 -0
  311. package/dist/presets.js +15 -0
  312. package/dist/selection/useSelection.js +127 -0
  313. package/dist/selection/useSelection.js.map +1 -0
  314. package/dist/test-seams.d.ts +50 -0
  315. package/dist/test-seams.js +4 -0
  316. package/dist/tools/ellipse/useEllipseTool.js +72 -0
  317. package/dist/tools/ellipse/useEllipseTool.js.map +1 -0
  318. package/dist/tools/eyedropper/useEyedropperTool.js +100 -0
  319. package/dist/tools/eyedropper/useEyedropperTool.js.map +1 -0
  320. package/dist/tools/image/useImageTool.js +57 -0
  321. package/dist/tools/image/useImageTool.js.map +1 -0
  322. package/dist/tools/lasso/useLassoTool.js +96 -0
  323. package/dist/tools/lasso/useLassoTool.js.map +1 -0
  324. package/dist/tools/line/useLineTool.js +67 -0
  325. package/dist/tools/line/useLineTool.js.map +1 -0
  326. package/dist/tools/polygon/usePolygonTool.js +149 -0
  327. package/dist/tools/polygon/usePolygonTool.js.map +1 -0
  328. package/dist/tools/rect/useRectTool.js +74 -0
  329. package/dist/tools/rect/useRectTool.js.map +1 -0
  330. package/dist/tools/select/adapterPointQuery.js +56 -0
  331. package/dist/tools/select/adapterPointQuery.js.map +1 -0
  332. package/dist/tools/select/collapseDeferred.js +35 -0
  333. package/dist/tools/select/collapseDeferred.js.map +1 -0
  334. package/dist/tools/select/extendPressLocked.js +17 -0
  335. package/dist/tools/select/extendPressLocked.js.map +1 -0
  336. package/dist/tools/select/groupEntry.js +73 -0
  337. package/dist/tools/select/groupEntry.js.map +1 -0
  338. package/dist/tools/select/pressDecision.js +39 -0
  339. package/dist/tools/select/pressDecision.js.map +1 -0
  340. package/dist/tools/select/selectDeep.js +39 -0
  341. package/dist/tools/select/selectDeep.js.map +1 -0
  342. package/dist/tools/select/selectPick.js +60 -0
  343. package/dist/tools/select/selectPick.js.map +1 -0
  344. package/dist/tools/select/selectionContributions.js +191 -0
  345. package/dist/tools/select/selectionContributions.js.map +1 -0
  346. package/dist/tools/select/usePickerSelectTool.js +145 -0
  347. package/dist/tools/select/usePickerSelectTool.js.map +1 -0
  348. package/dist/tools/select/useSelectTool.js +54 -0
  349. package/dist/tools/select/useSelectTool.js.map +1 -0
  350. package/dist/tools/shared/countOption.js +24 -0
  351. package/dist/tools/shared/countOption.js.map +1 -0
  352. package/dist/tools/shared/insertToolOptions.js +8 -0
  353. package/dist/tools/shared/insertToolOptions.js.map +1 -0
  354. package/dist/tools/shared/pointerFollower.js +23 -0
  355. package/dist/tools/shared/pointerFollower.js.map +1 -0
  356. package/dist/tools/shared/styleOptions.js +76 -0
  357. package/dist/tools/shared/styleOptions.js.map +1 -0
  358. package/dist/tools/star/useStarTool.js +149 -0
  359. package/dist/tools/star/useStarTool.js.map +1 -0
  360. package/dist/tools/toolSets.js +26 -0
  361. package/dist/tools/toolSets.js.map +1 -0
  362. package/package.json +39 -11
  363. package/dist/actions/edit/escape.js.map +0 -1
package/dist/index.d.ts CHANGED
@@ -1,10 +1,54 @@
1
1
  import * as _weasel_js_routing from '@weasel-js/routing';
2
- import { WorldPoint, Action, ActionDeps, Contribution } from '@weasel-js/routing';
3
- import { SpatialReference, NodeId, Op, PoseDescriptor, PoseComposition, DrawnBoundsScene, Bounds, SpatialReferenceSources, FeaturePreset, RepeatableTransform, BooleanStrokes } from '@weasel-js/core';
4
- import { Scale2 } from '@weasel-js/geom';
5
- import { StandardDeps, AnyScene, BooleanShapeOp } from '@weasel-js/core/engine';
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';
6
13
  import { KeySpec } from '@weasel-js/gestures';
7
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
+
8
52
  /** Edge or center the selection should align to within the reference's
9
53
  * bounds (rotated members contribute their ink extent). */
10
54
  type AlignEdge = 'left' | 'right' | 'top' | 'bottom' | 'center-x' | 'center-y';
@@ -130,7 +174,7 @@ type FlipAxis = 'x' | 'y';
130
174
  * - `'each'` — every pose mirrors about its own AABB; spatial layout of the
131
175
  * selection is unchanged, individual items are reflected in place.
132
176
  * - `'union'` — every pose mirrors about the selection's union AABB; items
133
- * swap sides as well as reflect, matching Illustrator/Figma defaults.
177
+ * swap sides as well as reflect.
134
178
  * - a {@link SpatialReference} — every pose mirrors about the center of the
135
179
  * bounds it names: the pointer, a world point or rect, or a key node. */
136
180
  type FlipPivot = 'each' | 'union' | SpatialReference;
@@ -180,79 +224,555 @@ declare module '@weasel-js/routing' {
180
224
  }
181
225
  }
182
226
 
183
- /** The select and lasso tools: click, marquee, lasso, and clearing on an empty click. */
184
- declare const selectPreset: FeaturePreset;
185
-
186
- /** The selection outline, drawn only while this is on. */
187
- declare const outlinePreset: FeaturePreset;
188
- /** Resize handles, drawn and bound. A handle sits over the selected body, so
189
- * it refines `move`, whose binding matches a handle drag too. */
190
- declare const resizePreset: FeaturePreset;
191
- /** The rotation handle, drawn and bound. It refines `move` as `resize` does. */
192
- declare const rotatePreset: FeaturePreset;
193
- /** Drag a body to move it, Alt-drag to clone it, under any tool that does not
194
- * claim the drag. */
195
- declare const movePreset: FeaturePreset;
196
-
197
- /** Escape, and canceling the gesture in flight. */
198
- declare const escapePreset: FeaturePreset;
199
- /** The context menu. */
200
- declare const contextMenuPreset: FeaturePreset;
201
- /** Cmd/Ctrl+A. */
202
- declare const selectAllPreset: FeaturePreset;
203
- /** Duplicate, and repeating the last transform. */
204
- declare const duplicatePreset: FeaturePreset;
205
- /** Deleting the selection. */
206
- declare const deletePreset: FeaturePreset;
207
- /** Group and ungroup. */
208
- declare const groupPreset: FeaturePreset;
209
- /** The arrow keys. */
210
- declare const nudgePreset: FeaturePreset;
211
- /** Fill and stroke, their opacities, the stroke's width, and a path's vertex colors. */
212
- declare const stylePreset: FeaturePreset;
213
- /**
214
- * Cut, copy, and paste.
215
- *
216
- * Cmd/Ctrl+V arrives as a DOM `paste` event, and two presets answer it. This
217
- * one brings `clipboard.pasteEvent`, which pastes nodes a kit canvas copied
218
- * and nothing else; `ingest` takes those plus images, SVG, files, and every
219
- * OS drop. With both on, `ingest` answers alone.
220
- */
221
- declare const clipboardPreset: FeaturePreset;
222
- /** Every edit preset above, and their keys. */
223
- declare const editPreset: FeaturePreset;
224
-
225
- /** Flipping the selection. */
226
- declare const flipPreset: FeaturePreset;
227
- /** Bringing forward and sending backward. */
228
- declare const reorderPreset: FeaturePreset;
229
- /** Aligning edges and centers. */
230
- declare const alignPreset: FeaturePreset;
231
- /** Distributing across or down. */
232
- declare const distributePreset: FeaturePreset;
233
- /** Align, distribute, reorder, and flip. */
234
- declare const arrangePreset: FeaturePreset;
235
-
236
- /** The pathfinder booleans, and the live boolean group. */
237
- declare const pathfinderPreset: FeaturePreset;
238
-
239
- /** The select tool and the lasso. */
240
- declare const selectToolsPreset: FeaturePreset;
241
- /** The tools that drag out a primitive: rect, ellipse, line, polygon, star. */
242
- declare const shapeToolsPreset: FeaturePreset;
243
-
244
- /** Select, and the selection's outline. */
245
- declare const pickPreset: FeaturePreset;
246
- /** Resize and rotate handles. */
247
- declare const transformPreset: FeaturePreset;
248
- /** Every kit behavior: view, pick, transform, move, edit, arrange, the pathfinder, and ingest. Tools that make
249
- * things are left to the canvas, through the `tools:` presets or `defaultTools`; path editing is
250
- * `@weasel-js/path-tools`'. */
251
- declare const drawPreset: FeaturePreset;
252
-
253
- /** Dropped and pasted content: images, SVG, files, and whatever
254
- * `ingestion.handlers` accept, on Cmd/Ctrl+V or an OS drop. */
255
- declare const ingestPreset: FeaturePreset;
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;
256
776
 
257
777
  /**
258
778
  * The kit's presets by name, core's view presets and editing's, for
@@ -263,6 +783,11 @@ declare const ingestPreset: FeaturePreset;
263
783
 
264
784
  /** Each kit preset by name, each after the presets it includes. */
265
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;
266
791
  readonly 'tools:select': FeaturePreset;
267
792
  readonly 'tools:view': FeaturePreset;
268
793
  readonly 'tools:shape': FeaturePreset;
@@ -288,7 +813,9 @@ declare const FEATURE_PRESETS: {
288
813
  readonly reorder: FeaturePreset;
289
814
  readonly align: FeaturePreset;
290
815
  readonly distribute: FeaturePreset;
816
+ readonly swap: FeaturePreset;
291
817
  readonly arrange: FeaturePreset;
818
+ readonly booleans: FeaturePreset;
292
819
  readonly pathfinder: FeaturePreset;
293
820
  readonly ingest: FeaturePreset;
294
821
  readonly draw: FeaturePreset;
@@ -299,7 +826,7 @@ type FeatureName = keyof typeof FEATURE_PRESETS;
299
826
  declare const FEATURE_NAMES: readonly FeatureName[];
300
827
  /**
301
828
  * The kit's presets for the given names, in order: `namedFeatures('pick', 'move')`
302
- * is `[pickPreset, movePreset]`, and means exactly what passing those objects
829
+ * is `[presets.pick, presets.move]`, and means exactly what passing those objects
303
830
  * means. It resolves names only; nothing else is implied, so a canvas that
304
831
  * pans and zooms names `'view'` (or `'draw'`, which includes it). Importing it
305
832
  * puts every kit preset in the bundle; import the objects to carry only those.
@@ -307,8 +834,8 @@ declare const FEATURE_NAMES: readonly FeatureName[];
307
834
  declare function namedFeatures(...names: readonly FeatureName[]): FeaturePreset[];
308
835
  /** The kit-standard action ids each preset registers itself, leaving out those of the presets it includes. */
309
836
  declare const FEATURE_ACTION_IDS: Readonly<Record<FeatureName, readonly string[]>>;
310
- /** Every kit-standard action: the baseline, each kit preset's in table order, then the
311
- * tool-driven ones. */
837
+ /** Every kit-standard action, each once: the baseline, then each kit preset's actions in table order, then its
838
+ * tool actions. */
312
839
  declare const KIT_STANDARD_ACTIONS: readonly Action[];
313
840
 
314
841
  /**
@@ -348,6 +875,290 @@ declare const KIT_STANDARD_ACTION_IDS: readonly string[];
348
875
  */
349
876
  declare function useStandardActions(opts: UseStandardActionsOptions): void;
350
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
+
351
1162
  /**
352
1163
  * Flips the selection. `params.axis` (`'x'` | `'y'`, default `'x'`) picks the
353
1164
  * direction, and the optional `params.pivot` (a `FlipPivot`, default `'each'`)
@@ -378,6 +1189,26 @@ declare const reorderBackwardAction: _weasel_js_routing.Action & {
378
1189
  id: "reorder.backward";
379
1190
  };
380
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
+
381
1212
  /** Static descriptor for align-left. */
382
1213
  declare const alignLeftAction: Action;
383
1214
  /** Static descriptor for align-right. */
@@ -397,18 +1228,9 @@ declare const distributeHorizontalAction: Action;
397
1228
  declare const distributeVerticalAction: Action;
398
1229
 
399
1230
  /**
400
- * The kit-standard actions a host of any dimension registers: history,
401
- * selection, move and clone, insert, nudge, duplicate, delete, group, and the
402
- * keys that leave a gesture. Pass it to `useActionSet`. None loads the 2D stack;
403
- * the 2D editing features (style, align, paths, clipboard, ingest) are
404
- * `useStandardActions`' alone.
1231
+ * Static descriptor for the `deselect` Action, bound to Escape. Clears the selection.
405
1232
  */
406
- declare const ENGINE_STANDARD_ACTIONS: readonly Action[];
407
-
408
- /**
409
- * Static descriptor for the `escape` Action. Clears selection.
410
- */
411
- declare const escapeAction: Action & {
1233
+ declare const deselectAction: Action & {
412
1234
  requires: string[];
413
1235
  };
414
1236
 
@@ -500,7 +1322,7 @@ declare const setFillAction: Action;
500
1322
  /**
501
1323
  * Static descriptor for the `setFillOpacity` Action.
502
1324
  *
503
- * `params.alpha01` (0..1) becomes each node's fill paint `opacity`, leaving
1325
+ * `params.alpha01` (0..1, ignored unless a finite number) becomes each node's fill paint `opacity`, leaving
504
1326
  * the rest of the paint — color, gradient stops, pattern — alone. That is the
505
1327
  * one alpha slot a gradient or a pattern has, so it is the slot all of them
506
1328
  * use. A node with no fill yet takes the kit's default one.
@@ -523,7 +1345,7 @@ declare const setStrokeAction: Action;
523
1345
  /**
524
1346
  * Static descriptor for the `setStrokeOpacity` Action.
525
1347
  *
526
- * `params.alpha01` (0..1) becomes each node's stroke paint `opacity`, leaving
1348
+ * `params.alpha01` (0..1, ignored unless a finite number) becomes each node's stroke paint `opacity`, leaving
527
1349
  * the rest of the stroke — color, width, cap, join, dash — alone. A node with
528
1350
  * no stroke yet gets a hairline one.
529
1351
  */
@@ -532,9 +1354,9 @@ declare const setStrokeOpacityAction: Action;
532
1354
  /**
533
1355
  * Static descriptor for the `setStrokeWidth` Action.
534
1356
  *
535
- * `params.width` becomes each node's stroke `width`, and `params.vertexWidths`
536
- * its per-anchor widths (`null` removes them), leaving the paint, cap, join and
537
- * dash alone. A node with no stroke yet gets a hairline one in the kit default
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
538
1360
  * color.
539
1361
  */
540
1362
  declare const setStrokeWidthAction: Action;
@@ -542,10 +1364,12 @@ declare const setStrokeWidthAction: Action;
542
1364
  /**
543
1365
  * Static descriptor for the `setVertexColor` Action.
544
1366
  *
545
- * `params.index` names an anchor and `params.rgba` its new color, written into
546
- * each selected node's `data.vertexColors` (one RGBA per anchor of its path),
547
- * leaving the other anchors alone. A node with no vertex colors, or fewer
548
- * anchors than `index` names, is left as it is.
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.
549
1373
  */
550
1374
  declare const setVertexColorAction: Action;
551
1375
 
@@ -569,11 +1393,14 @@ declare const transformAgainAction: Action & {
569
1393
  type SelectionTransform = Exclude<RepeatableTransform, {
570
1394
  kind: 'duplicate';
571
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;
572
1399
  /**
573
1400
  * Apply `t` to the selection as one undo entry labeled `label`, finished by
574
1401
  * the `transformFollowers` dep as a drag's transform is, and record it for
575
1402
  * Transform Again. An action calling it requires what Transform Again does
576
- * for that kind: `scene`, `selection`, `applyOps`, `poseDescriptor`,
1403
+ * for that kind: `scene`, `operands`, `applyOps`, `poseDescriptor`,
577
1404
  * `transformFollowers`, and `geometryProjection` for a move or `view`,
578
1405
  * `boundsIncludeStroke` and `drawnBoxes` for a rotate or a resize. Returns
579
1406
  * whether anything changed.
@@ -616,10 +1443,238 @@ declare const clipboardPasteAction: Action & {
616
1443
  * Bound to `text/plain` because that is the only flavor of a copy a paste
617
1444
  * event carries; a paste without text stays the page's.
618
1445
  */
619
- declare const clipboardPasteEventAction: Action & {
1446
+ declare const clipboardPasteCopiedAction: Action & {
620
1447
  id: "clipboard.pasteEvent";
621
1448
  };
622
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
+
623
1678
  /** What a stroked operand gives the built-in Pathfinder actions, and a tool
624
1679
  * that should count strokes as they do. */
625
1680
  declare const PATHFINDER_STROKES: BooleanStrokes;
@@ -675,5 +1730,138 @@ declare const PATHFINDER_LEADER: KeySpec;
675
1730
  */
676
1731
  declare const PATHFINDER_KEYMAP: readonly Contribution<never>[];
677
1732
 
678
- export { ENGINE_STANDARD_ACTIONS, FEATURE_ACTION_IDS, FEATURE_NAMES, FEATURE_PRESETS, KIT_STANDARD_ACTIONS, KIT_STANDARD_ACTION_IDS, PATHFINDER_KEYMAP, PATHFINDER_KEYMAP_ID, PATHFINDER_LEADER, PATHFINDER_STROKES, alignBottomAction, alignCenterXAction, alignCenterYAction, alignDeltaFor, alignLeftAction, alignPreset, alignRightAction, alignTargetBounds, alignTopAction, arrangePreset, booleanGroupOps, clipboardCopyAction, clipboardCutAction, clipboardPasteAction, clipboardPasteEventAction, clipboardPreset, contextMenuPreset, deletePreset, distributeHorizontalAction, distributePreset, distributeVerticalAction, drawPreset, duplicateAction, duplicatePreset, duplicateSelection, editPreset, escapeAction, escapePreset, flipAction, flipPreset, groupAction, groupPreset, ingestAction, ingestPreset, makeBooleanGroup, makeBooleanGroupAction, movePreset, namedFeatures, nudgeDownAction, nudgeLeftAction, nudgePreset, nudgeRightAction, nudgeUpAction, outlinePreset, pathfinderCropAction, pathfinderDivideAction, pathfinderExcludeAction, pathfinderIntersectAction, pathfinderMergeAction, pathfinderPreset, pathfinderSubtractAction, pathfinderTrimAction, pathfinderUnionAction, pickPreset, reorderBackwardAction, reorderForwardAction, reorderPreset, resizePreset, rotatePreset, selectAllAction, selectAllPreset, selectPreset, selectToolsPreset, setFillAction, setFillOpacityAction, setStrokeAction, setStrokeOpacityAction, setStrokeWidthAction, setVertexColorAction, shapeToolsPreset, stylePreset, transformAgainAction, transformPreset, transformSelection, ungroupAction, useAlign, useDistribute, useStandardActions };
679
- export type { AlignAdapter, AlignEdge, AlignParams, AlignReference, DistributeAdapter, DistributeAxis, DistributeMode, DistributeParams, FeatureName, FlipAxis, FlipParams, FlipPivot, ReorderParams, SelectionTransform, UseAlignOptions, UseAlignReturn, UseDistributeOptions, UseDistributeReturn, UseStandardActionsOptions };
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 };