@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
@@ -0,0 +1,40 @@
1
+ import { useAreaSelectDepSource } from "./areaSelect.js";
2
+ import { useBooleansAdapterDepSource } from "./booleans.js";
3
+ import { useInsertDepSource } from "./insert.js";
4
+ import { useLassoSelectDepSource } from "./lassoSelect.js";
5
+ import { resizePolicyOptions, useResizePolicyDepSource } from "./resizePolicy.js";
6
+ import { useLiveOperands } from "@weasel-js/core";
7
+ import { jsx } from "react/jsx-runtime";
8
+
9
+ // src/deps/presetDeps.tsx
10
+ /** Publishes the `areaSelect` and `lassoSelect` deps over the canvas's scene, selection and pickers. */
11
+ function RegionSelectDeps({ canvas }) {
12
+ const { pick } = canvas;
13
+ const alphaOf = pick.alphaOf();
14
+ useAreaSelectDepSource(canvas.scene(), canvas.selection(), canvas.poseDescriptor(), alphaOf, pick.reachable, pick.targetOf);
15
+ useLassoSelectDepSource(canvas.scene(), canvas.selection(), canvas.poseDescriptor(), alphaOf, pick.reachable, pick.targetOf);
16
+ return null;
17
+ }
18
+ /** Publishes the `insert` dep, minting into the canvas's scene with its insert factories. */
19
+ function InsertDeps({ canvas }) {
20
+ useInsertDepSource(canvas.scene(), canvas.adapter(), canvas.insertNodeFactories());
21
+ return null;
22
+ }
23
+ /** Publishes the `resizePolicy` dep from `<SceneCanvas selectTool.resize>`, when it is given. */
24
+ function ResizePolicyDeps({ canvas }) {
25
+ const resize = canvas.selectTool().resize;
26
+ return resize ? /* @__PURE__ */ jsx(ResizePolicy, { options: resize }) : null;
27
+ }
28
+ function ResizePolicy({ options }) {
29
+ useResizePolicyDepSource(resizePolicyOptions(options));
30
+ return null;
31
+ }
32
+ /** Publishes the `booleansAdapter` dep over the canvas's path leaves, acting on `operands`. */
33
+ function BooleansDeps({ canvas }) {
34
+ const operands = useLiveOperands();
35
+ useBooleansAdapterDepSource(canvas.scene(), operands, canvas.adapter(), canvas.poseDescriptor());
36
+ return null;
37
+ }
38
+
39
+ export { BooleansDeps, InsertDeps, RegionSelectDeps, ResizePolicyDeps };
40
+ //# sourceMappingURL=presetDeps.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"presetDeps.js","names":[],"sources":["../../src/deps/presetDeps.tsx"],"sourcesContent":["import type { PresetComponentProps, ResizeOptions } from '@weasel-js/core';\nimport { useLiveOperands } from '@weasel-js/core';\nimport { useAreaSelectDepSource } from './areaSelect';\nimport { useBooleansAdapterDepSource } from './booleans';\nimport { useInsertDepSource } from './insert';\nimport { useLassoSelectDepSource } from './lassoSelect';\nimport { resizePolicyOptions, useResizePolicyDepSource } from './resizePolicy';\n\n/** Publishes the `areaSelect` and `lassoSelect` deps over the canvas's scene, selection and pickers. */\nexport function RegionSelectDeps({ canvas }: PresetComponentProps) {\n const { pick } = canvas;\n const alphaOf = pick.alphaOf();\n useAreaSelectDepSource(canvas.scene(), canvas.selection(), canvas.poseDescriptor(), alphaOf, pick.reachable, pick.targetOf);\n useLassoSelectDepSource(canvas.scene(), canvas.selection(), canvas.poseDescriptor(), alphaOf, pick.reachable, pick.targetOf);\n return null;\n}\n\n/** Publishes the `insert` dep, minting into the canvas's scene with its insert factories. */\nexport function InsertDeps({ canvas }: PresetComponentProps) {\n useInsertDepSource(canvas.scene(), canvas.adapter(), canvas.insertNodeFactories());\n return null;\n}\n\n/** Publishes the `resizePolicy` dep from `<SceneCanvas selectTool.resize>`, when it is given. */\nexport function ResizePolicyDeps({ canvas }: PresetComponentProps) {\n const resize = canvas.selectTool().resize;\n return resize ? <ResizePolicy options={resize as ResizeOptions<unknown>} /> : null;\n}\n\nfunction ResizePolicy({ options }: { options: ResizeOptions<unknown> }) {\n useResizePolicyDepSource<unknown>(resizePolicyOptions(options));\n return null;\n}\n\n/** Publishes the `booleansAdapter` dep over the canvas's path leaves, acting on `operands`. */\nexport function BooleansDeps({ canvas }: PresetComponentProps) {\n const operands = useLiveOperands();\n useBooleansAdapterDepSource(canvas.scene(), operands, canvas.adapter(), canvas.poseDescriptor());\n return null;\n}\n"],"mappings":";;;;;;;;;;AASA,SAAgB,iBAAiB,EAAE,UAAgC;CACjE,MAAM,EAAE,SAAS;CACjB,MAAM,UAAU,KAAK,QAAQ;CAC7B,uBAAuB,OAAO,MAAM,GAAG,OAAO,UAAU,GAAG,OAAO,eAAe,GAAG,SAAS,KAAK,WAAW,KAAK,QAAQ;CAC1H,wBAAwB,OAAO,MAAM,GAAG,OAAO,UAAU,GAAG,OAAO,eAAe,GAAG,SAAS,KAAK,WAAW,KAAK,QAAQ;CAC3H,OAAO;AACT;;AAGA,SAAgB,WAAW,EAAE,UAAgC;CAC3D,mBAAmB,OAAO,MAAM,GAAG,OAAO,QAAQ,GAAG,OAAO,oBAAoB,CAAC;CACjF,OAAO;AACT;;AAGA,SAAgB,iBAAiB,EAAE,UAAgC;CACjE,MAAM,SAAS,OAAO,WAAW,CAAC,CAAC;CACnC,OAAO,SAAS,oBAAC,cAAD,EAAc,SAAS,OAAmC,CAAA,IAAI;AAChF;AAEA,SAAS,aAAa,EAAE,WAAgD;CACtE,yBAAkC,oBAAoB,OAAO,CAAC;CAC9D,OAAO;AACT;;AAGA,SAAgB,aAAa,EAAE,UAAgC;CAC7D,MAAM,WAAW,gBAAgB;CACjC,4BAA4B,OAAO,MAAM,GAAG,UAAU,OAAO,QAAQ,GAAG,OAAO,eAAe,CAAC;CAC/F,OAAO;AACT"}
@@ -0,0 +1,41 @@
1
+ import { useLatest } from "@weasel-js/react";
2
+ import { useDepSource } from "@weasel-js/routing/react";
3
+
4
+ // src/deps/resizePolicy.ts
5
+ /**
6
+ * Wires the `resizePolicy` dep consumed by `resizeAction`. Omitted
7
+ * `constraints` default to none; Shift's aspect lock is the snap session's.
8
+ */
9
+ var IDENTITY_EXPAND = (ids) => ids;
10
+ var EMPTY = Object.freeze([]);
11
+ /** Publish how resizing should behave — constraints and group expansion —
12
+ * for the resize action to consult. */
13
+ function useResizePolicyDepSource(options) {
14
+ const optsRef = useLatest(options);
15
+ useDepSource("resizePolicy", () => {
16
+ const o = optsRef.current;
17
+ return {
18
+ label: o.label,
19
+ transient: o.transient,
20
+ onRunStart: o.onRunStart,
21
+ onRunEnd: o.onRunEnd,
22
+ constraints: o.constraints ?? EMPTY,
23
+ expandIds: o.expandIds ?? IDENTITY_EXPAND
24
+ };
25
+ });
26
+ }
27
+ /** `<SceneCanvas selectTool.resize>` as {@link useResizePolicyDepSource} options.
28
+ * `resizable` is read by `<SceneCanvas>` itself. */
29
+ function resizePolicyOptions(o) {
30
+ return {
31
+ constraints: o.behaviors,
32
+ expandIds: o.expandIds,
33
+ label: o.resizeLabel,
34
+ transient: o.transient,
35
+ onRunStart: o.onRunStart,
36
+ onRunEnd: o.onRunEnd
37
+ };
38
+ }
39
+
40
+ export { resizePolicyOptions, useResizePolicyDepSource };
41
+ //# sourceMappingURL=resizePolicy.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resizePolicy.js","names":[],"sources":["../../src/deps/resizePolicy.ts"],"sourcesContent":["/**\n * Wires the `resizePolicy` dep consumed by `resizeAction`. Omitted\n * `constraints` default to none; Shift's aspect lock is the snap session's.\n */\nimport { useDepSource } from '@weasel-js/routing/react';\nimport { useLatest } from '@weasel-js/react';\nimport type { ResizePolicy, BoundsConstraint, RunLifecycleOptions } from '@weasel-js/core/engine';\nimport type { Bounds, ResizeOptions } from '@weasel-js/core';\n\n/** Options for `useResizePolicyDepSource`. Each omitted field falls back to the kit\n * default. */\nexport interface UseResizePolicyDepSourceOptions<TPose> extends RunLifecycleOptions {\n constraints?: TPose extends Bounds ? BoundsConstraint<TPose>[] : never[];\n expandIds?: (ids: string[]) => string[];\n}\n\nconst IDENTITY_EXPAND = (ids: string[]) => ids;\nconst EMPTY: readonly unknown[] = Object.freeze([]);\n\n/** Publish how resizing should behave — constraints and group expansion —\n * for the resize action to consult. */\nexport function useResizePolicyDepSource<TPose>(\n options: UseResizePolicyDepSourceOptions<TPose>,\n): void {\n const optsRef = useLatest(options);\n\n useDepSource('resizePolicy', (): ResizePolicy<unknown> => {\n const o = optsRef.current;\n return {\n label: o.label,\n transient: o.transient,\n onRunStart: o.onRunStart,\n onRunEnd: o.onRunEnd,\n constraints: (o.constraints ?? (EMPTY as unknown[])) as ResizePolicy<unknown>['constraints'],\n expandIds: o.expandIds ?? IDENTITY_EXPAND,\n };\n });\n}\n\n/** `<SceneCanvas selectTool.resize>` as {@link useResizePolicyDepSource} options.\n * `resizable` is read by `<SceneCanvas>` itself. */\nexport function resizePolicyOptions<TPose>(o: ResizeOptions<TPose>): UseResizePolicyDepSourceOptions<TPose> {\n return {\n constraints: o.behaviors as UseResizePolicyDepSourceOptions<TPose>['constraints'],\n expandIds: o.expandIds,\n label: o.resizeLabel,\n transient: o.transient,\n onRunStart: o.onRunStart,\n onRunEnd: o.onRunEnd,\n };\n}\n"],"mappings":";;;;;;;;AAgBA,IAAM,mBAAmB,QAAkB;AAC3C,IAAM,QAA4B,OAAO,OAAO,CAAC,CAAC;;;AAIlD,SAAgB,yBACd,SACM;CACN,MAAM,UAAU,UAAU,OAAO;CAEjC,aAAa,sBAA6C;EACxD,MAAM,IAAI,QAAQ;EAClB,OAAO;GACL,OAAO,EAAE;GACT,WAAW,EAAE;GACb,YAAY,EAAE;GACd,UAAU,EAAE;GACZ,aAAc,EAAE,eAAgB;GAChC,WAAW,EAAE,aAAa;EAC5B;CACF,CAAC;AACH;;;AAIA,SAAgB,oBAA2B,GAAiE;CAC1G,OAAO;EACL,aAAa,EAAE;EACf,WAAW,EAAE;EACb,OAAO,EAAE;EACT,WAAW,EAAE;EACb,YAAY,EAAE;EACd,UAAU,EAAE;CACd;AACF"}
@@ -0,0 +1,339 @@
1
+ import { Action, SelectionApi, WorldPoint, GestureBinding } from '@weasel-js/routing';
2
+ import * as _weasel_js_gestures from '@weasel-js/gestures';
3
+ import { ModSpec } from '@weasel-js/gestures';
4
+ import { SelectionOptions, SelectionStore, SelectionFactory, MoveAdapter, AreaSelectAdapter, LayerEnumerableAdapter, PoseDescriptor, PressTargetTree } from '@weasel-js/core/engine';
5
+ import { View, Tool, MoveOptions, Contribution, RotateOptions } from '@weasel-js/core';
6
+ import { Rect } from '@weasel-js/geom';
7
+
8
+ /**
9
+ * The kit-standard actions a host of any dimension registers: history,
10
+ * selection, move and clone, insert, nudge, duplicate, delete, group, and the
11
+ * keys that leave a gesture. Pass it to `useActionSet`. None loads the 2D stack;
12
+ * the 2D editing features (style, align, paths, clipboard, ingest) are
13
+ * `useStandardActions`' alone.
14
+ */
15
+ declare const ENGINE_STANDARD_ACTIONS: readonly Action[];
16
+
17
+ /**
18
+ * Drag-translates the selection.
19
+ *
20
+ * Each frame's poses go to the scene's ephemeral override table, not the
21
+ * document: `Scene.setPose` records an undo entry per call, and the overrides
22
+ * are what let a node deriving its geometry from a dragged one follow the
23
+ * drag. Release commits one batch — at most one undo entry, none when the
24
+ * binding's params make it transient — and cancel drops the overrides.
25
+ *
26
+ * Behaviors from the binding's `opts.behaviors` fold into each frame; on
27
+ * release the first non-`undefined` answer wins (`Op[]` commits, `null`
28
+ * aborts). `beginMove` appends the action's own: a layout drop, a page drop
29
+ * in a paged scene, and reparent-on-drop.
30
+ */
31
+ declare const moveAction: Action;
32
+
33
+ /** The modifiers an `insert` drag binding lets be held from the press: Alt, which draws from the
34
+ * center, and the snap roles' keys ({@link SNAP_ROLE_MODS}). */
35
+ declare const INSERT_DRAG_MODS: ModSpec;
36
+ /**
37
+ * Drag-to-insert. The node `kind` is read from `opts.params.kind`.
38
+ *
39
+ * The drag's start and current point snap through the `snap` dep's `point`
40
+ * sessions (never freehand pencil samples). While `snap.constrain` (Shift) is
41
+ * held, a line's end stays on the 15° line through the snapped start nearest
42
+ * the pointer, and lands where that line meets a target. Behaviors from the
43
+ * binding's `opts.behaviors` (`InsertBehavior[]`) run over the two points
44
+ * after that; on release the first answer wins (`null` aborts, `Op[]` commits
45
+ * in place of the insert).
46
+ *
47
+ * The new node has no scene id until commit, so the live preview is the
48
+ * `overlay()` surface with `kind: 'insertPreview'`. A consumer-defined kind
49
+ * previews as the outline of the box it will fill.
50
+ *
51
+ * A polygon's or a star's insert is the last operation once it commits, so a
52
+ * panel can change its sides, or its points and inner radius, by replaying the
53
+ * drag (`insertParams`); a drag that behaviors answered does not replay.
54
+ */
55
+ declare const insertAction: Action;
56
+
57
+ /**
58
+ * Marquee selection: replace, or extend with shift held. Hit-testing and
59
+ * selection writes are delegated to the `areaSelect` dep, each hit taken at
60
+ * the depth a click selects (`AreaSelectDep.targetOf`), and the selection
61
+ * write makes no undo entry.
62
+ */
63
+ declare const areaSelectAction: Action & {
64
+ requires: string[];
65
+ };
66
+
67
+ /** Options for {@link useSelection}: a {@link SelectionOptions}, and the store to keep it on. */
68
+ interface UseSelectionOptions extends SelectionOptions {
69
+ /** Keep the selection on this store rather than in the hook, so every
70
+ * consumer of the same scene shares one selection and undo / redo can
71
+ * restore it. `initial` then only seeds a store that has none yet.
72
+ * Omit it and the hook owns a selection nobody else sees. */
73
+ scene?: SelectionStore;
74
+ }
75
+ /**
76
+ * The kit's selection over `store`, with its click policy (single, or multi with an extend and a range key)
77
+ * read from `options()` at each write: the {@link SelectionFactory} editing's presets hand a canvas. Not a
78
+ * hook; the caller re-renders on the store's changes itself.
79
+ */
80
+ declare const createSelection: SelectionFactory;
81
+ /**
82
+ * Owns selection state, exposes a click-policy helper (single vs multi with
83
+ * an extend key), and pre-builds the `getSelection` / `setSelection` adapter
84
+ * methods:
85
+ *
86
+ * ```tsx
87
+ * const selection = useSelection({ mode: 'multiple' });
88
+ * const adapter = useSceneAdapter(scene, { selection: selection.adapterMethods });
89
+ * ```
90
+ *
91
+ * Returns the same object for as long as `scene` is the same store, so it is
92
+ * safe as a memo or effect dependency. The calling component re-renders when
93
+ * the selection changes; key anything derived from the ids on
94
+ * `selection.current`.
95
+ */
96
+ declare function useSelection(opts?: UseSelectionOptions): SelectionApi;
97
+
98
+ /** Options for `useSelectTool`: how a point resolves to nodes, how a click
99
+ * chooses among them, and the appearance of the marquee. */
100
+ interface UseSelectToolOptions<TPose> {
101
+ /** Return ids of all objects whose painted body covers `world`.
102
+ * Order doesn't matter — the tool collapses parent/child overlap via
103
+ * `topmostOf`. When omitted, defaults to an AABB-vs-point walk of
104
+ * the adapter's tree using the pose descriptor. Override for tighter
105
+ * shapes (path / polygon hit-tests). `viewId` is the view the press
106
+ * landed in, where the host routes views. */
107
+ pickEvery?: (world: WorldPoint, viewId?: string | null) => string[];
108
+ /** Optional alt-aware selection-update hit returning the single id the
109
+ * click should act on. */
110
+ pickBest?: (world: WorldPoint, alt: boolean, selection: readonly string[], viewId?: string | null) => string | null;
111
+ /** How to read poses for the default `pickEvery` and `between`. Default
112
+ * `AUTO_POSE_DESCRIPTOR`. */
113
+ poseDescriptor?: PoseDescriptor<TPose>;
114
+ /**
115
+ * How the default `pickEvery` decides a **leaf** node covers the pointer.
116
+ * Ignored when `pickEvery` is supplied.
117
+ *
118
+ * - `'aabb'` (default) — the pose rect: a click anywhere in the bounding
119
+ * box selects the node.
120
+ * - `'silhouette'` — the pose rect as a pre-test, then the ink the painter
121
+ * lays down: `findShapeSilhouette` filled or not per the painter's `ink`,
122
+ * plus its outline widened by the stroke half-width and `pickTolerance`.
123
+ * A click inside the bounding box but outside the drawn shape misses —
124
+ * the concave notch of a star, the corner outside an ellipse, the blank
125
+ * half of a text box — while a click on the thin outline of an unfilled
126
+ * shape hits.
127
+ *
128
+ * Container nodes already consult their silhouette unconditionally (it is
129
+ * how their clip is derived). A painter with no `silhouette` falls back to
130
+ * the AABB.
131
+ */
132
+ leafPicking?: 'aabb' | 'silhouette';
133
+ /**
134
+ * Grab slop around a shape's outline, in **world** units. Default 0.
135
+ *
136
+ * Consulted under `leafPicking: 'silhouette'`, and under `'aabb'` for a node
137
+ * that derives its path (a connector route), as slop around that path's
138
+ * box: a straight horizontal or vertical route has a box with no area, and
139
+ * is hit only within this distance of its line. World units because
140
+ * this hook has no view; `<SceneCanvas>` takes a screen-pixel figure
141
+ * (`geometry.pickTolerancePx`) and divides by scale on its own pick path.
142
+ * Without some slop a hairline outline is an unhittable target.
143
+ */
144
+ pickTolerance?: number;
145
+ /** Painted alpha per node in the view this tool picks for. A node painted
146
+ * at alpha 0 is not under the pointer, nor in a range. Read by the default
147
+ * `pickEvery` and `between`. */
148
+ alphaOf?: (id: string) => number;
149
+ /** Whether a node's `layer` reaches the screen in the view this tool picks
150
+ * for. Read by the default `pickEvery` and `between`. */
151
+ layerIsPainted?: (layer: string) => boolean;
152
+ /** The camera of the view this tool picks for. With it, a node on an
153
+ * adapter layer carrying `parallax` (`getLayers`) is picked where that
154
+ * camera's plane paints it; without it, every layer is taken to move with
155
+ * the camera. Ignored when `pickEvery` is supplied. */
156
+ getView?: () => View | null;
157
+ /**
158
+ * When this returns true, a toggle or range click must NOT change the
159
+ * node selection.
160
+ *
161
+ * `<SceneCanvas>` wires it to "a path is in anchor-edit mode", where
162
+ * Shift-click means "add this anchor to the anchor selection". Without
163
+ * the lock the same click also toggles the edited node out of the node
164
+ * selection, and the `editAnchors` dep treats that as the edit target
165
+ * disappearing.
166
+ *
167
+ * Only extend-clicks are locked. A plain click still re-selects, so
168
+ * clicking a different node exits edit mode as usual.
169
+ */
170
+ extendClickLocked?: () => boolean;
171
+ /**
172
+ * The nodes a range from `from` to `to` covers. The tool keeps those a press there could
173
+ * select itself, so a range takes a group whole, and inside an entered group stays in it.
174
+ * `useSelectTool` defaults it to every node whose center lies in the box the two span;
175
+ * without it a range walks the selection's own order.
176
+ */
177
+ between?: (from: string, to: string) => readonly string[];
178
+ }
179
+ /** Intersection of the move + area-select adapter interfaces.
180
+ * Resize and rotate run through `resizeAction` / `rotateAction`. */
181
+ type SelectAdapter<TNode extends {
182
+ id: string;
183
+ }, TPose> = MoveAdapter<TNode, TPose> & AreaSelectAdapter & LayerEnumerableAdapter;
184
+ /** The select tool over a picker the host supplies (`pickEvery`), with no
185
+ * 2D default: what a host that is not a 2D canvas builds on. `useSelectTool`
186
+ * is this with the kit's adapter walk as the default picker.
187
+ *
188
+ * Active-slot Tool:
189
+ * - `select.pick` classifies the press (pointerDown) — it runs the tool's own
190
+ * pickBest/pickEvery so click semantics (selection replace, extend,
191
+ * deferred collapse) live in one place.
192
+ * - an empty drag marquees (`areaSelect`) and a click on empty clears the
193
+ * selection (`clearSelection`); the marquee renders via the dispatcher
194
+ * overlay layer, driven by areaSelectAction's `overlay()`.
195
+ * - moving and transforming the selection are not the tool's: they are the
196
+ * ambient bindings in `selectionContributions.ts`.
197
+ */
198
+ declare function createPickerSelectTool<TNode extends {
199
+ id: string;
200
+ }, TPose>(adapter: () => SelectAdapter<TNode, TPose>, options: () => UseSelectToolOptions<TPose> & Required<Pick<UseSelectToolOptions<TPose>, 'pickEvery'>>): Tool;
201
+ /** {@link createPickerSelectTool} for the life of the calling component, reading `adapter` and `options` live. */
202
+ declare function usePickerSelectTool<TNode extends {
203
+ id: string;
204
+ }, TPose>(adapter: SelectAdapter<TNode, TPose>, options: UseSelectToolOptions<TPose> & Required<Pick<UseSelectToolOptions<TPose>, 'pickEvery'>>): Tool;
205
+
206
+ /** Options for {@link createSelectionMoveContribution}. */
207
+ interface SelectionMoveOptions<TPose = unknown> {
208
+ /** Move-action options: `behaviors` become the move bindings'
209
+ * `opts.behaviors`, everything else their `opts.params`. */
210
+ move?: MoveOptions<TPose>;
211
+ /** Reparent-on-drop behavior for drag-to-move. `'off'` (default) keeps
212
+ * translate-only commits. `'top'` lands the moved nodes at the top of the
213
+ * container under the drop point; `'above'` lands them immediately above the
214
+ * hit sibling. Requires the `nodeAtPoint` dep (`<SceneCanvas>` sources it). */
215
+ reparentOnDrop?: 'off' | 'top' | 'above';
216
+ }
217
+ /** Id of the entry {@link createSelectionMoveContribution} builds. */
218
+ declare const SELECTION_MOVE_ID = "selection.move";
219
+ /** Id of the entry {@link createSelectionTransformContribution} builds. */
220
+ declare const SELECTION_TRANSFORM_ID = "selection.transform";
221
+ /** Id of the entry {@link createSelectionResizeContribution} builds. */
222
+ declare const SELECTION_RESIZE_ID = "selection.resize";
223
+ /** Id of the entry {@link createSelectionRotateContribution} builds. */
224
+ declare const SELECTION_ROTATE_ID = "selection.rotate";
225
+ /** Drag a body to move the selection; Alt-drag to clone it. */
226
+ declare function selectionMoveBindings<TPose>(options?: SelectionMoveOptions<TPose>): GestureBinding[];
227
+ /** Options for {@link createSelectionRotateContribution}. */
228
+ interface SelectionRotateOptions<TPose = unknown> {
229
+ /** Rotate-action options: `behaviors` become the rotate binding's
230
+ * `opts.behaviors`, everything else its `opts.params`. */
231
+ rotate?: RotateOptions<TPose>;
232
+ }
233
+ /** Options for {@link createSelectionTransformContribution}. Resize takes its
234
+ * options through the `resizePolicy` dep (`useResizePolicyDepSource`), not here. */
235
+ type SelectionTransformOptions<TPose = unknown> = SelectionRotateOptions<TPose>;
236
+ /** Drag a resize handle to resize the selection. Options come through the
237
+ * `resizePolicy` dep (`useResizePolicyDepSource`). */
238
+ declare function selectionResizeBindings(): GestureBinding[];
239
+ /** Drag the rotation handle to rotate the selection. */
240
+ declare function selectionRotateBindings<TPose>(options?: SelectionRotateOptions<TPose>): GestureBinding[];
241
+ /** Drag a resize handle to resize the selection, the rotation handle to rotate it. */
242
+ declare function selectionTransformBindings<TPose>(options?: SelectionTransformOptions<TPose>): GestureBinding[];
243
+ /** An always-live entry carrying {@link selectionMoveBindings}. Add it to a
244
+ * canvas's ambient list; `<SceneCanvas features={[presets.move]}>` does. */
245
+ declare function createSelectionMoveContribution<TPose>(options?: SelectionMoveOptions<TPose>): Contribution;
246
+ /** An always-live entry carrying {@link selectionTransformBindings}: resize
247
+ * and rotate in one entry, what `<SceneCanvas features={[presets.transform]}>`
248
+ * turns on. */
249
+ declare function createSelectionTransformContribution<TPose>(options?: SelectionTransformOptions<TPose>): Contribution;
250
+ /** An always-live entry carrying {@link selectionResizeBindings}. Add it to a
251
+ * canvas's ambient list; `<SceneCanvas features={[presets.resize]}>` does. */
252
+ declare function createSelectionResizeContribution(): Contribution;
253
+ /** An always-live entry carrying {@link selectionRotateBindings}. Add it to a
254
+ * canvas's ambient list; `<SceneCanvas features={[presets.rotate]}>` does. */
255
+ declare function createSelectionRotateContribution<TPose>(options?: SelectionRotateOptions<TPose>): Contribution;
256
+ /** Id of the entry {@link createAreaSelectContribution} builds. */
257
+ declare const AREA_SELECT_ID = "selection.areaSelect";
258
+ /** A press on empty canvas: no hit, and not on chrome over it — the rotation
259
+ * handle and the outer half of a resize handle sit off the body. */
260
+ declare const isEmptyOffChrome: _weasel_js_gestures.TargetPredicate & {
261
+ readsAffordance: true;
262
+ };
263
+ /** A press on a node, off chrome. With no `classifyTarget` wired there is no
264
+ * body class to read, and every press off chrome passes. */
265
+ declare const isBodyOffChrome: _weasel_js_gestures.TargetPredicate & {
266
+ readsAffordance: true;
267
+ };
268
+ /** An always-live entry that marquee-selects on a drag across empty canvas,
269
+ * under any tool that does not claim the drag itself. No preset installs it:
270
+ * the select tool already marquees, and a canvas that wants it under every
271
+ * tool adds this to its ambient list. */
272
+ declare function createAreaSelectContribution(): Contribution;
273
+
274
+ /** What `group.enter` reads: the node under a point and the tree above it. */
275
+ interface EnterGroupOptions {
276
+ /** The node under the point, before any group above it is considered, as the
277
+ * view `viewId` names sees it: `null` or absent for the surface. */
278
+ pickHit: (world: WorldPoint, viewId?: string | null) => string | null;
279
+ tree: PressTargetTree;
280
+ }
281
+ /** What `group.leave` reads: where a group's box is. */
282
+ interface LeaveGroupOptions {
283
+ boxOf: (id: string) => Rect | null;
284
+ }
285
+ /**
286
+ * `group.enter` — enters the group a press at the point would select. Bound to a double-click
287
+ * on a body by `useSelectTool`. It declines where that is not a group, so the double-click
288
+ * falls through to text editing, path editing and the mode triggers.
289
+ */
290
+ declare function createEnterGroupAction(opts: EnterGroupOptions): Action;
291
+ /**
292
+ * `group.leave` — Escape leaves the entered group for the one above it; a press outside the
293
+ * entered group's box leaves every group that box does not hold. With nothing entered it
294
+ * declines, so Escape clears the selection as before, and it declines while path anchors are
295
+ * being edited, so that Escape exits the edit first.
296
+ */
297
+ declare function createLeaveGroupAction(opts: LeaveGroupOptions): Action;
298
+
299
+ /** Id of the entry {@link createGroupEntryContribution} builds. */
300
+ declare const GROUP_ENTRY_ID = "group.entry";
301
+ /**
302
+ * `group.enter` and `group.leave`, bound under any tool that leaves the gesture unclaimed. A
303
+ * double-click on a body enters the group a press there would select, and declines where that is
304
+ * no group, so text and path editing keep their double-click. Escape leaves one level, carrying
305
+ * the phase `escape` does and declining with nothing entered, which leaves Escape to `escape`.
306
+ * Leaving on a press is the select tool's ({@link GROUP_LEAVE_PRESS_BINDING}): under a drawing
307
+ * tool a press outside the group draws into it.
308
+ */
309
+ declare function createGroupEntryContribution(opts: EnterGroupOptions & LeaveGroupOptions): Contribution;
310
+ /** {@link createGroupEntryContribution} for the life of a canvas, reading its pickers live. */
311
+ declare function useGroupEntryContribution(opts: EnterGroupOptions & LeaveGroupOptions): Contribution;
312
+ /**
313
+ * A press outside the entered group's box leaves it, whatever modifiers are held. Nodes outside
314
+ * the group take no hits, so every such press lands on empty canvas.
315
+ */
316
+ declare const GROUP_LEAVE_PRESS_BINDING: {
317
+ spec: {
318
+ kind: "pointerDown";
319
+ target: {
320
+ kindOf: _weasel_js_gestures.TargetPredicate & {
321
+ readsAffordance: true;
322
+ };
323
+ };
324
+ mods: Readonly<Partial<{
325
+ alt: boolean | "optional";
326
+ ctrl: boolean | "optional";
327
+ meta: boolean | "optional";
328
+ mod: boolean | "optional";
329
+ shift: boolean | "optional";
330
+ }>>;
331
+ };
332
+ actionId: string;
333
+ opts: {
334
+ id: string;
335
+ };
336
+ };
337
+
338
+ export { AREA_SELECT_ID as A, selectionResizeBindings as B, selectionRotateBindings as C, selectionTransformBindings as D, ENGINE_STANDARD_ACTIONS as E, useGroupEntryContribution as F, GROUP_ENTRY_ID as G, usePickerSelectTool as H, INSERT_DRAG_MODS as I, useSelection as J, GROUP_LEAVE_PRESS_BINDING as b, SELECTION_MOVE_ID as c, SELECTION_RESIZE_ID as d, SELECTION_ROTATE_ID as e, SELECTION_TRANSFORM_ID as f, areaSelectAction as k, createAreaSelectContribution as l, createEnterGroupAction as m, createGroupEntryContribution as n, createLeaveGroupAction as o, createPickerSelectTool as p, createSelection as q, createSelectionMoveContribution as r, createSelectionResizeContribution as s, createSelectionRotateContribution as t, createSelectionTransformContribution as u, insertAction as v, isBodyOffChrome as w, isEmptyOffChrome as x, moveAction as y, selectionMoveBindings as z };
339
+ export type { LeaveGroupOptions as L, SelectAdapter as S, UseSelectToolOptions as U, EnterGroupOptions as a, SelectionMoveOptions as g, SelectionRotateOptions as h, SelectionTransformOptions as i, UseSelectionOptions as j };
@@ -0,0 +1,6 @@
1
+ export { E as ENGINE_STANDARD_ACTIONS, G as GROUP_ENTRY_ID, S as SelectAdapter, g as SelectionMoveOptions, U as UseSelectToolOptions, j as UseSelectionOptions, k as areaSelectAction, n as createGroupEntryContribution, p as createPickerSelectTool, q as createSelection, r as createSelectionMoveContribution, v as insertAction, y as moveAction, F as useGroupEntryContribution, H as usePickerSelectTool, J as useSelection } from './engine-BV9RDHOL.js';
2
+ import '@weasel-js/routing';
3
+ import '@weasel-js/gestures';
4
+ import '@weasel-js/core/engine';
5
+ import '@weasel-js/core';
6
+ import '@weasel-js/geom';
package/dist/engine.js ADDED
@@ -0,0 +1,10 @@
1
+ import { ENGINE_STANDARD_ACTIONS } from "./engineStandardActions.js";
2
+ import { moveAction } from "./actions/move/action.js";
3
+ import { insertAction } from "./actions/insert/action.js";
4
+ import { areaSelectAction } from "./actions/select/areaSelect.js";
5
+ import { createSelection, useSelection } from "./selection/useSelection.js";
6
+ import { createPickerSelectTool, usePickerSelectTool } from "./tools/select/usePickerSelectTool.js";
7
+ import { createSelectionMoveContribution } from "./tools/select/selectionContributions.js";
8
+ import { GROUP_ENTRY_ID, createGroupEntryContribution, useGroupEntryContribution } from "./tools/select/groupEntry.js";
9
+
10
+ export { ENGINE_STANDARD_ACTIONS, GROUP_ENTRY_ID, areaSelectAction, createGroupEntryContribution, createPickerSelectTool, createSelection, createSelectionMoveContribution, insertAction, moveAction, useGroupEntryContribution, usePickerSelectTool, useSelection };
@@ -1,11 +1,20 @@
1
1
  import { duplicateAction } from "./actions/edit/duplicate.js";
2
- import { escapeAction } from "./actions/edit/escape.js";
2
+ import { deselectAction } from "./actions/edit/deselect.js";
3
3
  import { groupAction, ungroupAction } from "./actions/edit/group.js";
4
4
  import { nudgeDownAction, nudgeLeftAction, nudgeRightAction, nudgeUpAction } from "./actions/edit/nudge.js";
5
5
  import { selectAllAction } from "./actions/edit/selectAll.js";
6
6
  import { transformAgainAction } from "./actions/transformAgain/action.js";
7
- import { cancelGestureAction, clearSelectionAction, cloneAction, deleteAction, insertRepositionAction, insertRotateAction, lassoSelectAction, placeAction, redoAction, undoAction } from "@weasel-js/core";
8
- import { areaSelectAction as areaSelectAction$1, insertAction, moveAction as moveAction$1 } from "@weasel-js/core/engine";
7
+ import { cloneAction } from "./actions/clone/action.js";
8
+ import { clearSelectionAction } from "./actions/select/clearSelection.js";
9
+ import { placeAction } from "./actions/insert/placeAction.js";
10
+ import { insertRepositionAction } from "./actions/insert/repositionAction.js";
11
+ import { insertRotateAction } from "./actions/insert/rotateAction.js";
12
+ import { lassoSelectAction } from "./actions/lassoSelect/action.js";
13
+ import { areaSelectAction } from "./actions/select/areaSelect.js";
14
+ import { insertAction } from "./actions/insert/action.js";
15
+ import { moveAction } from "./actions/move/action.js";
16
+ import { deleteAction } from "./actions/delete/delete.js";
17
+ import { cancelAllAction, redoAction, undoAction } from "@weasel-js/core";
9
18
 
10
19
  // src/engineStandardActions.ts
11
20
  /**
@@ -18,11 +27,11 @@ import { areaSelectAction as areaSelectAction$1, insertAction, moveAction as mov
18
27
  var ENGINE_STANDARD_ACTIONS = [
19
28
  undoAction,
20
29
  redoAction,
21
- areaSelectAction$1,
30
+ areaSelectAction,
22
31
  lassoSelectAction,
23
32
  clearSelectionAction,
24
33
  selectAllAction,
25
- moveAction$1,
34
+ moveAction,
26
35
  cloneAction,
27
36
  transformAgainAction,
28
37
  insertAction,
@@ -37,8 +46,8 @@ var ENGINE_STANDARD_ACTIONS = [
37
46
  deleteAction,
38
47
  groupAction,
39
48
  ungroupAction,
40
- escapeAction,
41
- cancelGestureAction
49
+ deselectAction,
50
+ cancelAllAction
42
51
  ];
43
52
 
44
53
  export { ENGINE_STANDARD_ACTIONS };
@@ -1 +1 @@
1
- {"version":3,"file":"engineStandardActions.js","names":["areaSelectAction","moveAction"],"sources":["../src/engineStandardActions.ts"],"sourcesContent":["import type { Action } from '@weasel-js/routing';\nimport { cloneAction, cancelGestureAction, clearSelectionAction, deleteAction, redoAction, undoAction, placeAction, insertRepositionAction, insertRotateAction, lassoSelectAction } from '@weasel-js/core';\nimport { areaSelectAction, insertAction, moveAction } from '@weasel-js/core/engine';\nimport { duplicateAction } from './actions/edit/duplicate';\nimport { escapeAction } from './actions/edit/escape';\nimport { groupAction, ungroupAction } from './actions/edit/group';\nimport { nudgeDownAction, nudgeLeftAction, nudgeRightAction, nudgeUpAction } from './actions/edit/nudge';\nimport { selectAllAction } from './actions/edit/selectAll';\nimport { transformAgainAction } from './actions/transformAgain/action';\n\n/**\n * The kit-standard actions a host of any dimension registers: history,\n * selection, move and clone, insert, nudge, duplicate, delete, group, and the\n * keys that leave a gesture. Pass it to `useActionSet`. None loads the 2D stack;\n * the 2D editing features (style, align, paths, clipboard, ingest) are\n * `useStandardActions`' alone.\n */\nexport const ENGINE_STANDARD_ACTIONS: readonly Action[] = [\n undoAction, redoAction,\n areaSelectAction, lassoSelectAction, clearSelectionAction, selectAllAction,\n moveAction, cloneAction, transformAgainAction,\n insertAction, placeAction, insertRotateAction, insertRepositionAction,\n nudgeUpAction, nudgeDownAction, nudgeLeftAction, nudgeRightAction,\n duplicateAction, deleteAction, groupAction, ungroupAction,\n escapeAction, cancelGestureAction,\n];\n"],"mappings":";;;;;;;;;;;;;;;;;AAiBA,IAAa,0BAA6C;CACxD;CAAY;CACZA;CAAkB;CAAmB;CAAsB;CAC3DC;CAAY;CAAa;CACzB;CAAc;CAAa;CAAoB;CAC/C;CAAe;CAAiB;CAAiB;CACjD;CAAiB;CAAc;CAAa;CAC5C;CAAc;AAChB"}
1
+ {"version":3,"file":"engineStandardActions.js","names":[],"sources":["../src/engineStandardActions.ts"],"sourcesContent":["import type { Action } from '@weasel-js/routing';\nimport { cancelAllAction, redoAction, undoAction } from '@weasel-js/core';\nimport { duplicateAction } from './actions/edit/duplicate';\nimport { deselectAction } from './actions/edit/deselect';\nimport { groupAction, ungroupAction } from './actions/edit/group';\nimport { nudgeDownAction, nudgeLeftAction, nudgeRightAction, nudgeUpAction } from './actions/edit/nudge';\nimport { selectAllAction } from './actions/edit/selectAll';\nimport { transformAgainAction } from './actions/transformAgain/action';\nimport { cloneAction } from './actions/clone/action';\nimport { clearSelectionAction } from './actions/select/clearSelection';\nimport { placeAction } from './actions/insert/placeAction';\nimport { insertRepositionAction } from './actions/insert/repositionAction';\nimport { insertRotateAction } from './actions/insert/rotateAction';\nimport { lassoSelectAction } from './actions/lassoSelect/action';\nimport { areaSelectAction } from './actions/select/areaSelect';\nimport { insertAction } from './actions/insert/action';\nimport { moveAction } from './actions/move/action';\nimport { deleteAction } from './actions/delete/delete';\n\n/**\n * The kit-standard actions a host of any dimension registers: history,\n * selection, move and clone, insert, nudge, duplicate, delete, group, and the\n * keys that leave a gesture. Pass it to `useActionSet`. None loads the 2D stack;\n * the 2D editing features (style, align, paths, clipboard, ingest) are\n * `useStandardActions`' alone.\n */\nexport const ENGINE_STANDARD_ACTIONS: readonly Action[] = [\n undoAction, redoAction,\n areaSelectAction, lassoSelectAction, clearSelectionAction, selectAllAction,\n moveAction, cloneAction, transformAgainAction,\n insertAction, placeAction, insertRotateAction, insertRepositionAction,\n nudgeUpAction, nudgeDownAction, nudgeLeftAction, nudgeRightAction,\n duplicateAction, deleteAction, groupAction, ungroupAction,\n deselectAction, cancelAllAction,\n];\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AA0BA,IAAa,0BAA6C;CACxD;CAAY;CACZ;CAAkB;CAAmB;CAAsB;CAC3D;CAAY;CAAa;CACzB;CAAc;CAAa;CAAoB;CAC/C;CAAe;CAAiB;CAAiB;CACjD;CAAiB;CAAc;CAAa;CAC5C;CAAgB;AAClB"}
@@ -0,0 +1,27 @@
1
+ export { anchors, history, path, presentation, tool, viewport } from '@weasel-js/core/groups';
2
+
3
+ /** The `group` each of editing's actions sits in, for an `<ActionBar group>`, a menu or a palette to gather them by. */
4
+ /** Cut, copy and paste. */
5
+ declare const CLIPBOARD_GROUP = "clipboard";
6
+ /** Delete, duplicate and transform again. */
7
+ declare const EDIT_GROUP = "edit";
8
+ /** Group and ungroup. */
9
+ declare const STRUCTURE_GROUP = "structure";
10
+ /** Moving the selection by a step. */
11
+ declare const NUDGE_GROUP = "nudge";
12
+ /** Inserting, placing, and positioning a new node. */
13
+ declare const INSERT_GROUP = "insert";
14
+ /** Aligning the selection's edges and centers. */
15
+ declare const ALIGN_GROUP = "align";
16
+ /** Spacing the selection evenly. */
17
+ declare const DISTRIBUTE_GROUP = "distribute";
18
+ /** Flipping the selection. */
19
+ declare const FLIP_GROUP = "flip";
20
+ /** Moving the selection forward or back in the stacking order. */
21
+ declare const REORDER_GROUP = "reorder";
22
+ /** The boolean operations on shapes. */
23
+ declare const PATHFINDER_GROUP = "pathfinder";
24
+ /** Trading two nodes' places. */
25
+ declare const SWAP_GROUP = "swap";
26
+
27
+ export { ALIGN_GROUP as align, CLIPBOARD_GROUP as clipboard, DISTRIBUTE_GROUP as distribute, EDIT_GROUP as edit, FLIP_GROUP as flip, INSERT_GROUP as insert, NUDGE_GROUP as nudge, PATHFINDER_GROUP as pathfinder, REORDER_GROUP as reorder, STRUCTURE_GROUP as structure, SWAP_GROUP as swap };
package/dist/groups.js ADDED
@@ -0,0 +1,4 @@
1
+ import { ALIGN_GROUP, CLIPBOARD_GROUP, DISTRIBUTE_GROUP, EDIT_GROUP, FLIP_GROUP, INSERT_GROUP, NUDGE_GROUP, PATHFINDER_GROUP, REORDER_GROUP, STRUCTURE_GROUP, SWAP_GROUP } from "./actionGroups.js";
2
+ import { anchors, history, path, presentation, tool, viewport } from "@weasel-js/core/groups";
3
+
4
+ export { ALIGN_GROUP as align, anchors, CLIPBOARD_GROUP as clipboard, DISTRIBUTE_GROUP as distribute, EDIT_GROUP as edit, FLIP_GROUP as flip, history, INSERT_GROUP as insert, NUDGE_GROUP as nudge, path, PATHFINDER_GROUP as pathfinder, presentation, REORDER_GROUP as reorder, STRUCTURE_GROUP as structure, SWAP_GROUP as swap, tool, viewport };
@@ -0,0 +1,8 @@
1
+ import { scopedIcon } from "@weasel-js/icons";
2
+
3
+ // src/icons.gen.ts
4
+ /** This package's `icon()`: a bare name means `editing:<name>`. */
5
+ var icon = scopedIcon("editing");
6
+
7
+ export { icon };
8
+ //# sourceMappingURL=icons.gen.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"icons.gen.js","names":[],"sources":["../src/icons.gen.ts"],"sourcesContent":["// GENERATED by packages/icons/scripts/gen-icons.mjs — do not edit by hand.\n\nimport { scopedIcon } from '@weasel-js/icons';\n\n/** A glyph this package draws, by its bare name. */\nexport type EditingIconName =\n | 'ellipse'\n | 'eyedropper'\n | 'lasso'\n | 'line'\n | 'polygon'\n | 'rect'\n | 'select'\n | 'star'\n | 'duplicate'\n | 'transformAgain'\n | 'group'\n | 'ungroup'\n | 'bringForward'\n | 'bringToFront'\n | 'sendBackward'\n | 'sendToBack'\n | 'flipX'\n | 'swap'\n | 'flipY'\n | 'alignLeft'\n | 'alignRight'\n | 'alignTop'\n | 'alignBottom'\n | 'alignCenterX'\n | 'alignCenterY'\n | 'divide'\n | 'crop'\n | 'trim'\n | 'booleanGroup'\n | 'merge';\n\n/** This package's `icon()`: a bare name means `editing:<name>`. */\nexport const icon = scopedIcon<EditingIconName>('editing');\n\n/** This package's glyphs, in the families they were drawn in. */\nexport const ICON_GROUPS: readonly { label: string; names: readonly EditingIconName[] }[] = [\n {\n \"label\": \"Tools\",\n \"names\": [\n \"ellipse\",\n \"eyedropper\",\n \"lasso\",\n \"line\",\n \"polygon\",\n \"rect\",\n \"select\",\n \"star\"\n ]\n },\n {\n \"label\": \"Edit\",\n \"names\": [\n \"duplicate\",\n \"transformAgain\",\n \"group\",\n \"ungroup\",\n \"bringForward\",\n \"bringToFront\",\n \"sendBackward\",\n \"sendToBack\",\n \"flipX\",\n \"swap\",\n \"flipY\"\n ]\n },\n {\n \"label\": \"Align\",\n \"names\": [\n \"alignLeft\",\n \"alignRight\",\n \"alignTop\",\n \"alignBottom\",\n \"alignCenterX\",\n \"alignCenterY\"\n ]\n },\n {\n \"label\": \"Booleans\",\n \"names\": [\n \"divide\",\n \"crop\",\n \"trim\",\n \"booleanGroup\",\n \"merge\"\n ]\n }\n];\n\ndeclare module '@weasel-js/icons' {\n interface IconName {\n 'editing:ellipse': true;\n 'editing:eyedropper': true;\n 'editing:lasso': true;\n 'editing:line': true;\n 'editing:polygon': true;\n 'editing:rect': true;\n 'editing:select': true;\n 'editing:star': true;\n 'editing:duplicate': true;\n 'editing:transformAgain': true;\n 'editing:group': true;\n 'editing:ungroup': true;\n 'editing:bringForward': true;\n 'editing:bringToFront': true;\n 'editing:sendBackward': true;\n 'editing:sendToBack': true;\n 'editing:flipX': true;\n 'editing:swap': true;\n 'editing:flipY': true;\n 'editing:alignLeft': true;\n 'editing:alignRight': true;\n 'editing:alignTop': true;\n 'editing:alignBottom': true;\n 'editing:alignCenterX': true;\n 'editing:alignCenterY': true;\n 'editing:divide': true;\n 'editing:crop': true;\n 'editing:trim': true;\n 'editing:booleanGroup': true;\n 'editing:merge': true;\n }\n}\n"],"mappings":";;;;AAsCA,IAAa,OAAO,WAA4B,SAAS"}
@@ -0,0 +1,6 @@
1
+ import { IconTable } from '@weasel-js/icons';
2
+
3
+ /** Every glyph this package ships, under the `editing` namespace. */
4
+ declare const icons: IconTable;
5
+
6
+ export { icons };
@@ -0,0 +1,8 @@
1
+ import icons_table_default from "./icons2.table.js";
2
+
3
+ // src/icons.table.ts
4
+ /** Every glyph this package ships, under the `editing` namespace. */
5
+ var icons = icons_table_default;
6
+
7
+ export { icons };
8
+ //# sourceMappingURL=icons.table.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"icons.table.js","names":["data"],"sources":["../src/icons.table.ts"],"sourcesContent":["// GENERATED by packages/icons/scripts/gen-icons.mjs — do not edit by hand.\n\nimport type { IconTable } from '@weasel-js/icons';\nimport data from './icons.table.json';\n\n/** Every glyph this package ships, under the `editing` namespace. */\nexport const icons: IconTable = data;\n"],"mappings":";;;;AAMA,IAAa,QAAmBA"}