@weasel-js/core 1.7.0 → 1.7.2

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 (1004) hide show
  1. package/CHANGELOG.md +794 -0
  2. package/README.md +14 -8
  3. package/dist/WeaselProvider.js +15 -0
  4. package/dist/WeaselProvider.js.map +1 -0
  5. package/dist/affordances/composeAffordanceLayer.js +224 -0
  6. package/dist/affordances/composeAffordanceLayer.js.map +1 -0
  7. package/dist/affordances/cornerResize.js +69 -0
  8. package/dist/affordances/cornerResize.js.map +1 -0
  9. package/dist/affordances/hitAffordanceRegions.js +138 -0
  10. package/dist/affordances/hitAffordanceRegions.js.map +1 -0
  11. package/dist/affordances/pathAnchors.js +66 -0
  12. package/dist/affordances/pathAnchors.js.map +1 -0
  13. package/dist/affordances/rotationHandle.js +103 -0
  14. package/dist/affordances/rotationHandle.js.map +1 -0
  15. package/dist/animation/behaviors/momentum.js +118 -0
  16. package/dist/animation/behaviors/momentum.js.map +1 -0
  17. package/dist/animation/colorHelpers.js +135 -0
  18. package/dist/animation/colorHelpers.js.map +1 -0
  19. package/dist/animation/colorRegistry.js +37 -0
  20. package/dist/animation/colorRegistry.js.map +1 -0
  21. package/dist/animation/index.js +20 -0
  22. package/dist/animation/loop.js +62 -0
  23. package/dist/animation/loop.js.map +1 -0
  24. package/dist/animation/observe.js +23 -0
  25. package/dist/animation/observe.js.map +1 -0
  26. package/dist/animation/poseHelpers.js +50 -0
  27. package/dist/animation/poseHelpers.js.map +1 -0
  28. package/dist/animation/reflow.js +121 -0
  29. package/dist/animation/reflow.js.map +1 -0
  30. package/dist/animation/rig/bindRig.js +74 -0
  31. package/dist/animation/rig/bindRig.js.map +1 -0
  32. package/dist/animation/rig/blendPoses.js +43 -0
  33. package/dist/animation/rig/blendPoses.js.map +1 -0
  34. package/dist/animation/rig/mirrorPose.js +19 -0
  35. package/dist/animation/rig/mirrorPose.js.map +1 -0
  36. package/dist/animation/rig/resolveSkeleton.js +33 -0
  37. package/dist/animation/rig/resolveSkeleton.js.map +1 -0
  38. package/dist/animation/rig/solveIk.js +103 -0
  39. package/dist/animation/rig/solveIk.js.map +1 -0
  40. package/dist/animation/rig/types.js +12 -0
  41. package/dist/animation/rig/types.js.map +1 -0
  42. package/dist/animation/rig/useRig.js +23 -0
  43. package/dist/animation/rig/useRig.js.map +1 -0
  44. package/dist/animation/slew.js +27 -0
  45. package/dist/animation/slew.js.map +1 -0
  46. package/dist/animation/stagger.js +138 -0
  47. package/dist/animation/stagger.js.map +1 -0
  48. package/dist/animation/timeline/booking.js +106 -0
  49. package/dist/animation/timeline/booking.js.map +1 -0
  50. package/dist/animation/timeline/createTimeline.js +116 -0
  51. package/dist/animation/timeline/createTimeline.js.map +1 -0
  52. package/dist/animation/timeline/sampleTrack.js +29 -0
  53. package/dist/animation/timeline/sampleTrack.js.map +1 -0
  54. package/dist/animation/useAnimator.js +329 -0
  55. package/dist/animation/useAnimator.js.map +1 -0
  56. package/dist/animation/wrappers/animateLifecycle.js +40 -0
  57. package/dist/animation/wrappers/animateLifecycle.js.map +1 -0
  58. package/dist/animation/wrappers/animateOnSetPose.js +44 -0
  59. package/dist/animation/wrappers/animateOnSetPose.js.map +1 -0
  60. package/dist/{autoPoseDescriptor-_XOyF7t4.d.ts → autoPoseDescriptor-vCdt55xm.d.ts} +2 -2
  61. package/dist/{builtins-DLn2lCr_.d.ts → builtins-C-gRyVRx.d.ts} +742 -513
  62. package/dist/canvas/Canvas.js +608 -0
  63. package/dist/canvas/Canvas.js.map +1 -0
  64. package/dist/canvas/CanvasView.js +255 -0
  65. package/dist/canvas/CanvasView.js.map +1 -0
  66. package/dist/canvas/CursorCoordsHud.js +102 -0
  67. package/dist/canvas/CursorCoordsHud.js.map +1 -0
  68. package/dist/canvas/DrawCanvas.js +67 -0
  69. package/dist/canvas/DrawCanvas.js.map +1 -0
  70. package/dist/canvas/MinimapCanvas.js +139 -0
  71. package/dist/canvas/MinimapCanvas.js.map +1 -0
  72. package/dist/canvas/ModalityHud.js +66 -0
  73. package/dist/canvas/ModalityHud.js.map +1 -0
  74. package/dist/canvas/NodeShape.js +391 -0
  75. package/dist/canvas/NodeShape.js.map +1 -0
  76. package/dist/canvas/PickHud.js +93 -0
  77. package/dist/canvas/PickHud.js.map +1 -0
  78. package/dist/canvas/SceneCanvas/ActionsProviderIfRoot.js +10 -0
  79. package/dist/canvas/SceneCanvas/ActionsProviderIfRoot.js.map +1 -0
  80. package/dist/canvas/SceneCanvas/DepRegistryProviderIfRoot.js +10 -0
  81. package/dist/canvas/SceneCanvas/DepRegistryProviderIfRoot.js.map +1 -0
  82. package/dist/canvas/SceneCanvas/PointerProviderIfRoot.js +51 -0
  83. package/dist/canvas/SceneCanvas/PointerProviderIfRoot.js.map +1 -0
  84. package/dist/canvas/SceneCanvas/contributionFrameHooks.js +42 -0
  85. package/dist/canvas/SceneCanvas/contributionFrameHooks.js.map +1 -0
  86. package/dist/canvas/SceneCanvas/defaultNodeProperties.js +549 -0
  87. package/dist/canvas/SceneCanvas/defaultNodeProperties.js.map +1 -0
  88. package/dist/canvas/SceneCanvas/defaultNodeRouting.js +26 -0
  89. package/dist/canvas/SceneCanvas/defaultNodeRouting.js.map +1 -0
  90. package/dist/canvas/SceneCanvas/dispatcherGestureBounds.js +69 -0
  91. package/dist/canvas/SceneCanvas/dispatcherGestureBounds.js.map +1 -0
  92. package/dist/canvas/SceneCanvas/features.js +97 -0
  93. package/dist/canvas/SceneCanvas/features.js.map +1 -0
  94. package/dist/canvas/SceneCanvas/poseGeometry.js +46 -0
  95. package/dist/canvas/SceneCanvas/poseGeometry.js.map +1 -0
  96. package/dist/canvas/SceneCanvas/useActionsPropResolver.js +48 -0
  97. package/dist/canvas/SceneCanvas/useActionsPropResolver.js.map +1 -0
  98. package/dist/canvas/SceneCanvas/useBuiltinShapeTools.js +70 -0
  99. package/dist/canvas/SceneCanvas/useBuiltinShapeTools.js.map +1 -0
  100. package/dist/canvas/SceneCanvas/useContributionRoles.js +75 -0
  101. package/dist/canvas/SceneCanvas/useContributionRoles.js.map +1 -0
  102. package/dist/canvas/SceneCanvas/useDispatcherOverlayLayer.js +172 -0
  103. package/dist/canvas/SceneCanvas/useDispatcherOverlayLayer.js.map +1 -0
  104. package/dist/canvas/SceneCanvas/usePreviewGhostLayer.js +69 -0
  105. package/dist/canvas/SceneCanvas/usePreviewGhostLayer.js.map +1 -0
  106. package/dist/canvas/SceneCanvas/useSceneSelectTool.js +127 -0
  107. package/dist/canvas/SceneCanvas/useSceneSelectTool.js.map +1 -0
  108. package/dist/canvas/SceneCanvas/useViewportActions.js +30 -0
  109. package/dist/canvas/SceneCanvas/useViewportActions.js.map +1 -0
  110. package/dist/canvas/SceneCanvas.js +992 -0
  111. package/dist/canvas/SceneCanvas.js.map +1 -0
  112. package/dist/canvas/SceneViewCanvas.js +54 -0
  113. package/dist/canvas/SceneViewCanvas.js.map +1 -0
  114. package/dist/canvas/accentColor.js +9 -0
  115. package/dist/canvas/accentColor.js.map +1 -0
  116. package/dist/canvas/affordanceAt.js +63 -0
  117. package/dist/canvas/affordanceAt.js.map +1 -0
  118. package/dist/canvas/buildSceneTree.js +65 -0
  119. package/dist/canvas/buildSceneTree.js.map +1 -0
  120. package/dist/canvas/canvasRenderer.js +89 -0
  121. package/dist/canvas/canvasRenderer.js.map +1 -0
  122. package/dist/canvas/colorOverrides.js +16 -0
  123. package/dist/canvas/colorOverrides.js.map +1 -0
  124. package/dist/canvas/defaultDrawOne.js +43 -0
  125. package/dist/canvas/defaultDrawOne.js.map +1 -0
  126. package/dist/canvas/deps/areaSelect.js +19 -0
  127. package/dist/canvas/deps/areaSelect.js.map +1 -0
  128. package/dist/canvas/deps/debug.js +9 -0
  129. package/dist/canvas/deps/debug.js.map +1 -0
  130. package/dist/canvas/deps/dispatcher.js +11 -0
  131. package/dist/canvas/deps/dispatcher.js.map +1 -0
  132. package/dist/canvas/deps/editAnchors.js +101 -0
  133. package/dist/canvas/deps/editAnchors.js.map +1 -0
  134. package/dist/canvas/deps/geometryProjection.js +11 -0
  135. package/dist/canvas/deps/geometryProjection.js.map +1 -0
  136. package/dist/canvas/deps/hitTestArea.js +51 -0
  137. package/dist/canvas/deps/hitTestArea.js.map +1 -0
  138. package/dist/canvas/deps/ingestion.js +31 -0
  139. package/dist/canvas/deps/ingestion.js.map +1 -0
  140. package/dist/canvas/deps/insert.js +116 -0
  141. package/dist/canvas/deps/insert.js.map +1 -0
  142. package/dist/canvas/deps/lassoSelect.js +20 -0
  143. package/dist/canvas/deps/lassoSelect.js.map +1 -0
  144. package/dist/canvas/deps/layout.js +34 -0
  145. package/dist/canvas/deps/layout.js.map +1 -0
  146. package/dist/canvas/deps/nodeAtPoint.js +19 -0
  147. package/dist/canvas/deps/nodeAtPoint.js.map +1 -0
  148. package/dist/canvas/deps/poseComposition.js +11 -0
  149. package/dist/canvas/deps/poseComposition.js.map +1 -0
  150. package/dist/canvas/deps/poseDescriptor.js +12 -0
  151. package/dist/canvas/deps/poseDescriptor.js.map +1 -0
  152. package/dist/canvas/deps/resizePolicy.js +35 -0
  153. package/dist/canvas/deps/resizePolicy.js.map +1 -0
  154. package/dist/canvas/deps/slice.js +99 -0
  155. package/dist/canvas/deps/slice.js.map +1 -0
  156. package/dist/canvas/deps/snap.js +11 -0
  157. package/dist/canvas/deps/snap.js.map +1 -0
  158. package/dist/canvas/deps/textEdit.js +21 -0
  159. package/dist/canvas/deps/textEdit.js.map +1 -0
  160. package/dist/canvas/deps/view.js +43 -0
  161. package/dist/canvas/deps/view.js.map +1 -0
  162. package/dist/canvas/derivedPath.js +47 -0
  163. package/dist/canvas/derivedPath.js.map +1 -0
  164. package/dist/canvas/drawEnvelope.js +22 -0
  165. package/dist/canvas/drawEnvelope.js.map +1 -0
  166. package/dist/canvas/getNodeAtPoint.js +18 -0
  167. package/dist/canvas/getNodeAtPoint.js.map +1 -0
  168. package/dist/canvas/hostAnchor.js +29 -0
  169. package/dist/canvas/hostAnchor.js.map +1 -0
  170. package/dist/canvas/hud.module.js +18 -0
  171. package/dist/canvas/hud.module.js.map +1 -0
  172. package/dist/canvas/insertPreviewExtent.js +103 -0
  173. package/dist/canvas/insertPreviewExtent.js.map +1 -0
  174. package/dist/canvas/kitRequirements.js +177 -0
  175. package/dist/canvas/kitRequirements.js.map +1 -0
  176. package/dist/canvas/layerOrder.js +66 -0
  177. package/dist/canvas/layerOrder.js.map +1 -0
  178. package/dist/canvas/layerSlots.js +14 -0
  179. package/dist/canvas/layerSlots.js.map +1 -0
  180. package/dist/canvas/minimapMath.js +80 -0
  181. package/dist/canvas/minimapMath.js.map +1 -0
  182. package/dist/canvas/mountedCanvases.js +20 -0
  183. package/dist/canvas/mountedCanvases.js.map +1 -0
  184. package/dist/canvas/overlayRoleStrokes.js +17 -0
  185. package/dist/canvas/overlayRoleStrokes.js.map +1 -0
  186. package/dist/canvas/paintCull.js +20 -0
  187. package/dist/canvas/paintCull.js.map +1 -0
  188. package/dist/canvas/pickWalk.js +158 -0
  189. package/dist/canvas/pickWalk.js.map +1 -0
  190. package/dist/canvas/planeClips.js +30 -0
  191. package/dist/canvas/planeClips.js.map +1 -0
  192. package/dist/canvas/poseRotation.js +35 -0
  193. package/dist/canvas/poseRotation.js.map +1 -0
  194. package/dist/canvas/rasterToPng.js +21 -0
  195. package/dist/canvas/rasterToPng.js.map +1 -0
  196. package/dist/canvas/renderDebugSnapshot.js +32 -0
  197. package/dist/canvas/renderDebugSnapshot.js.map +1 -0
  198. package/dist/canvas/renderNeeds.js +25 -0
  199. package/dist/canvas/renderNeeds.js.map +1 -0
  200. package/dist/canvas/renderSceneToPixels.js +143 -0
  201. package/dist/canvas/renderSceneToPixels.js.map +1 -0
  202. package/dist/canvas/sceneAdapter.js +270 -0
  203. package/dist/canvas/sceneAdapter.js.map +1 -0
  204. package/dist/canvas/sceneLayerPaint.js +37 -0
  205. package/dist/canvas/sceneLayerPaint.js.map +1 -0
  206. package/dist/canvas/sceneSlotWiring.js +20 -0
  207. package/dist/canvas/sceneSlotWiring.js.map +1 -0
  208. package/dist/canvas/sceneViewRender.js +72 -0
  209. package/dist/canvas/sceneViewRender.js.map +1 -0
  210. package/dist/canvas/slopsDebugLayer.js +61 -0
  211. package/dist/canvas/slopsDebugLayer.js.map +1 -0
  212. package/dist/canvas/surfaceContribution.js +15 -0
  213. package/dist/canvas/surfaceContribution.js.map +1 -0
  214. package/dist/canvas/toolPreview.js +39 -0
  215. package/dist/canvas/toolPreview.js.map +1 -0
  216. package/dist/canvas/useCanvasRenderer.js +11 -0
  217. package/dist/canvas/useCanvasRenderer.js.map +1 -0
  218. package/dist/canvas/useFrameLoop.js +60 -0
  219. package/dist/canvas/useFrameLoop.js.map +1 -0
  220. package/dist/canvas/useHostAnchor.js +71 -0
  221. package/dist/canvas/useHostAnchor.js.map +1 -0
  222. package/dist/canvas/useLateContentRedraw.js +21 -0
  223. package/dist/canvas/useLateContentRedraw.js.map +1 -0
  224. package/dist/canvas/useRedrawOn.js +21 -0
  225. package/dist/canvas/useRedrawOn.js.map +1 -0
  226. package/dist/canvas/useViewHelpers.js +120 -0
  227. package/dist/canvas/useViewHelpers.js.map +1 -0
  228. package/dist/canvas/viewInputs.js +17 -0
  229. package/dist/canvas/viewInputs.js.map +1 -0
  230. package/dist/canvas/viewRegistry.js +61 -0
  231. package/dist/canvas/viewRegistry.js.map +1 -0
  232. package/dist/canvas/wrapNodeOutput.js +14 -0
  233. package/dist/canvas/wrapNodeOutput.js.map +1 -0
  234. package/dist/clipboard.d.ts +10 -5
  235. package/dist/clipboard.js +3 -5
  236. package/dist/clone.d.ts +3 -3
  237. package/dist/clone.js +2 -5
  238. package/dist/core/adapters/arrayAdapter.js +85 -0
  239. package/dist/core/adapters/arrayAdapter.js.map +1 -0
  240. package/dist/core/adapters/useArrayAdapter.js +13 -0
  241. package/dist/core/adapters/useArrayAdapter.js.map +1 -0
  242. package/dist/core/applyOps.js +12 -0
  243. package/dist/core/applyOps.js.map +1 -0
  244. package/dist/core/device/index.js +4 -0
  245. package/dist/core/device/targets.js +17 -0
  246. package/dist/core/device/targets.js.map +1 -0
  247. package/dist/core/device/useDeviceProfile.js +75 -0
  248. package/dist/core/device/useDeviceProfile.js.map +1 -0
  249. package/dist/core/fillInPoseFrame.js +102 -0
  250. package/dist/core/fillInPoseFrame.js.map +1 -0
  251. package/dist/core/geometry/poseDescriptor.js +93 -0
  252. package/dist/core/geometry/poseDescriptor.js.map +1 -0
  253. package/dist/core/geometry/poseRotation.js +58 -0
  254. package/dist/core/geometry/poseRotation.js.map +1 -0
  255. package/dist/core/geometry/regionHit.js +102 -0
  256. package/dist/core/geometry/regionHit.js.map +1 -0
  257. package/dist/core/geometry/unionBounds.js +60 -0
  258. package/dist/core/geometry/unionBounds.js.map +1 -0
  259. package/dist/core/gradient.js +136 -0
  260. package/dist/core/gradient.js.map +1 -0
  261. package/dist/core/isPlainObject.js +11 -0
  262. package/dist/core/isPlainObject.js.map +1 -0
  263. package/dist/core/layers/render.js +150 -0
  264. package/dist/core/layers/render.js.map +1 -0
  265. package/dist/core/markerInset.js +24 -0
  266. package/dist/core/markerInset.js.map +1 -0
  267. package/dist/core/mixed.js +6 -0
  268. package/dist/core/mixed.js.map +1 -0
  269. package/dist/core/ops/arrange.js +31 -0
  270. package/dist/core/ops/arrange.js.map +1 -0
  271. package/dist/core/ops/create.js +32 -0
  272. package/dist/core/ops/create.js.map +1 -0
  273. package/dist/core/ops/createHistory.js +20 -0
  274. package/dist/core/ops/createHistory.js.map +1 -0
  275. package/dist/core/ops/delete.js +89 -0
  276. package/dist/core/ops/delete.js.map +1 -0
  277. package/dist/core/ops/registry.js +17 -0
  278. package/dist/core/ops/registry.js.map +1 -0
  279. package/dist/core/ops/reorder/algorithms.js +55 -0
  280. package/dist/core/ops/reorder/algorithms.js.map +1 -0
  281. package/dist/core/ops/reorder/index.js +140 -0
  282. package/dist/core/ops/reorder/index.js.map +1 -0
  283. package/dist/core/ops/reparent.js +52 -0
  284. package/dist/core/ops/reparent.js.map +1 -0
  285. package/dist/core/ops/select.js +34 -0
  286. package/dist/core/ops/select.js.map +1 -0
  287. package/dist/core/ops/setData.js +34 -0
  288. package/dist/core/ops/setData.js.map +1 -0
  289. package/dist/core/ops/setLayer.js +34 -0
  290. package/dist/core/ops/setLayer.js.map +1 -0
  291. package/dist/core/ops/setLayout.js +31 -0
  292. package/dist/core/ops/setLayout.js.map +1 -0
  293. package/dist/core/ops/setPath.js +57 -0
  294. package/dist/core/ops/setPath.js.map +1 -0
  295. package/dist/core/ops/setText.js +34 -0
  296. package/dist/core/ops/setText.js.map +1 -0
  297. package/dist/core/ops/slot.js +37 -0
  298. package/dist/core/ops/slot.js.map +1 -0
  299. package/dist/core/ops/transform.js +42 -0
  300. package/dist/core/ops/transform.js.map +1 -0
  301. package/dist/core/paintKinds.js +156 -0
  302. package/dist/core/paintKinds.js.map +1 -0
  303. package/dist/core/scene/NodeProperties.js +20 -0
  304. package/dist/core/scene/NodeProperties.js.map +1 -0
  305. package/dist/core/scene/NodeRouting.js +24 -0
  306. package/dist/core/scene/NodeRouting.js.map +1 -0
  307. package/dist/core/scene/arrivals.js +12 -0
  308. package/dist/core/scene/arrivals.js.map +1 -0
  309. package/dist/core/scene/composeFrame.js +29 -0
  310. package/dist/core/scene/composeFrame.js.map +1 -0
  311. package/dist/core/scene/depMemo.js +18 -0
  312. package/dist/core/scene/depMemo.js.map +1 -0
  313. package/dist/core/scene/dependents.js +66 -0
  314. package/dist/core/scene/dependents.js.map +1 -0
  315. package/dist/core/scene/derivedPath.js +31 -0
  316. package/dist/core/scene/derivedPath.js.map +1 -0
  317. package/dist/core/scene/effectivePose.js +78 -0
  318. package/dist/core/scene/effectivePose.js.map +1 -0
  319. package/dist/core/scene/kitRegistry.js +33 -0
  320. package/dist/core/scene/kitRegistry.js.map +1 -0
  321. package/dist/core/scene/layoutPass.js +96 -0
  322. package/dist/core/scene/layoutPass.js.map +1 -0
  323. package/dist/core/scene/nodeFnFields.js +83 -0
  324. package/dist/core/scene/nodeFnFields.js.map +1 -0
  325. package/dist/core/scene/nodeMemo.js +28 -0
  326. package/dist/core/scene/nodeMemo.js.map +1 -0
  327. package/dist/core/scene/poseFeed.js +87 -0
  328. package/dist/core/scene/poseFeed.js.map +1 -0
  329. package/dist/core/scene/poseOverrides.js +52 -0
  330. package/dist/core/scene/poseOverrides.js.map +1 -0
  331. package/dist/core/scene/poseSnapshot.js +54 -0
  332. package/dist/core/scene/poseSnapshot.js.map +1 -0
  333. package/dist/core/scene/scene.js +1271 -0
  334. package/dist/core/scene/scene.js.map +1 -0
  335. package/dist/core/scene/types.js +6 -0
  336. package/dist/core/scene/types.js.map +1 -0
  337. package/dist/core/scene/useScene.js +32 -0
  338. package/dist/core/scene/useScene.js.map +1 -0
  339. package/dist/core/selection/chromeState.js +31 -0
  340. package/dist/core/selection/chromeState.js.map +1 -0
  341. package/dist/core/selection/selectionTarget.js +6 -0
  342. package/dist/core/selection/selectionTarget.js.map +1 -0
  343. package/dist/core/selection/useSelection.js +71 -0
  344. package/dist/core/selection/useSelection.js.map +1 -0
  345. package/dist/core/shapeKinds.js +54 -0
  346. package/dist/core/shapeKinds.js.map +1 -0
  347. package/dist/core/strokeMarkerShapes.js +139 -0
  348. package/dist/core/strokeMarkerShapes.js.map +1 -0
  349. package/dist/core/strokeMarkers.js +28 -0
  350. package/dist/core/strokeMarkers.js.map +1 -0
  351. package/dist/core/stylus/stylus.js +39 -0
  352. package/dist/core/stylus/stylus.js.map +1 -0
  353. package/dist/core/stylus/usePointerStylus.js +51 -0
  354. package/dist/core/stylus/usePointerStylus.js.map +1 -0
  355. package/dist/core/usePaintKinds.js +17 -0
  356. package/dist/core/usePaintKinds.js.map +1 -0
  357. package/dist/core/viewport/clampView.js +24 -0
  358. package/dist/core/viewport/clampView.js.map +1 -0
  359. package/dist/core/viewport/clientToWorld.js +8 -0
  360. package/dist/core/viewport/clientToWorld.js.map +1 -0
  361. package/dist/core/viewport/createVelocityTracker.js +39 -0
  362. package/dist/core/viewport/createVelocityTracker.js.map +1 -0
  363. package/dist/core/viewport/fitToBounds.js +18 -0
  364. package/dist/core/viewport/fitToBounds.js.map +1 -0
  365. package/dist/core/viewport/fitViewToBounds.js +36 -0
  366. package/dist/core/viewport/fitViewToBounds.js.map +1 -0
  367. package/dist/core/viewport/interpolateView.js +34 -0
  368. package/dist/core/viewport/interpolateView.js.map +1 -0
  369. package/dist/core/viewport/meanScale.js +8 -0
  370. package/dist/core/viewport/meanScale.js.map +1 -0
  371. package/dist/core/viewport/parallax.js +111 -0
  372. package/dist/core/viewport/parallax.js.map +1 -0
  373. package/dist/core/viewport/pxExtent.js +42 -0
  374. package/dist/core/viewport/pxExtent.js.map +1 -0
  375. package/dist/core/viewport/sceneNodeClientRect.js +18 -0
  376. package/dist/core/viewport/sceneNodeClientRect.js.map +1 -0
  377. package/dist/core/viewport/screenSlop.js +27 -0
  378. package/dist/core/viewport/screenSlop.js.map +1 -0
  379. package/dist/core/viewport/useAutoCenter.js +32 -0
  380. package/dist/core/viewport/useAutoCenter.js.map +1 -0
  381. package/dist/core/viewport/useCanvasSize.js +29 -0
  382. package/dist/core/viewport/useCanvasSize.js.map +1 -0
  383. package/dist/core/viewport/useDecayLoop.js +63 -0
  384. package/dist/core/viewport/useDecayLoop.js.map +1 -0
  385. package/dist/core/viewport/useVelocityTracker.js +10 -0
  386. package/dist/core/viewport/useVelocityTracker.js.map +1 -0
  387. package/dist/core/viewport/useViewAnimation.js +63 -0
  388. package/dist/core/viewport/useViewAnimation.js.map +1 -0
  389. package/dist/core/viewport/view.js +37 -0
  390. package/dist/core/viewport/view.js.map +1 -0
  391. package/dist/core/viewport/viewTransform.js +11 -0
  392. package/dist/core/viewport/viewTransform.js.map +1 -0
  393. package/dist/core/viewport/viewportWorldRect.js +13 -0
  394. package/dist/core/viewport/viewportWorldRect.js.map +1 -0
  395. package/dist/core/viewport/wheelHandler.js +30 -0
  396. package/dist/core/viewport/wheelHandler.js.map +1 -0
  397. package/dist/core/viewport/zoomAt.js +22 -0
  398. package/dist/core/viewport/zoomAt.js.map +1 -0
  399. package/dist/core/viewport/zoomBounds.js +20 -0
  400. package/dist/core/viewport/zoomBounds.js.map +1 -0
  401. package/dist/{pointSnapToGrid-Dp2IxLGb.d.ts → cornerHandles-BCrDp_mH.d.ts} +3 -13
  402. package/dist/debug/createDebugOverlayLayer.js +358 -0
  403. package/dist/debug/createDebugOverlayLayer.js.map +1 -0
  404. package/dist/debug/createDebugSink.js +83 -0
  405. package/dist/debug/createDebugSink.js.map +1 -0
  406. package/dist/debug/defaultTheme.js +31 -0
  407. package/dist/debug/defaultTheme.js.map +1 -0
  408. package/dist/debug/flag.js +41 -0
  409. package/dist/debug/flag.js.map +1 -0
  410. package/dist/debug/frameStats.js +16 -0
  411. package/dist/debug/frameStats.js.map +1 -0
  412. package/dist/debug/parseDebugFlags.js +32 -0
  413. package/dist/debug/parseDebugFlags.js.map +1 -0
  414. package/dist/features/chrome-caps/buildChromeCtx.js +16 -0
  415. package/dist/features/chrome-caps/buildChromeCtx.js.map +1 -0
  416. package/dist/features/chrome-caps/conditions.js +36 -0
  417. package/dist/features/chrome-caps/conditions.js.map +1 -0
  418. package/dist/features/chrome-caps/defaults.js +26 -0
  419. package/dist/features/chrome-caps/defaults.js.map +1 -0
  420. package/dist/features/chrome-caps/index.js +7 -0
  421. package/dist/features/chrome-caps/resolve.js +23 -0
  422. package/dist/features/chrome-caps/resolve.js.map +1 -0
  423. package/dist/features/chrome-caps/useHoverTracking.js +27 -0
  424. package/dist/features/chrome-caps/useHoverTracking.js.map +1 -0
  425. package/dist/features/cursor/paintedCursorLayer.js +60 -0
  426. package/dist/features/cursor/paintedCursorLayer.js.map +1 -0
  427. package/dist/features/focus/gateLayer.js +14 -0
  428. package/dist/features/focus/gateLayer.js.map +1 -0
  429. package/dist/features/focus/useCanvasFocus.js +29 -0
  430. package/dist/features/focus/useCanvasFocus.js.map +1 -0
  431. package/dist/features/groups/children.js +23 -0
  432. package/dist/features/groups/children.js.map +1 -0
  433. package/dist/features/groups/composePose.js +67 -0
  434. package/dist/features/groups/composePose.js.map +1 -0
  435. package/dist/features/groups/nestedHit.js +40 -0
  436. package/dist/features/groups/nestedHit.js.map +1 -0
  437. package/dist/features/groups/unionOfChildren.js +15 -0
  438. package/dist/features/groups/unionOfChildren.js.map +1 -0
  439. package/dist/features/images/imageCache.js +94 -0
  440. package/dist/features/images/imageCache.js.map +1 -0
  441. package/dist/features/ingestion/contentHandlers.js +37 -0
  442. package/dist/features/ingestion/contentHandlers.js.map +1 -0
  443. package/dist/features/ingestion/imageHandler.js +45 -0
  444. package/dist/features/ingestion/imageHandler.js.map +1 -0
  445. package/dist/features/ingestion/index.js +8 -0
  446. package/dist/features/ingestion/openFilePicker.js +15 -0
  447. package/dist/features/ingestion/openFilePicker.js.map +1 -0
  448. package/dist/features/ingestion/registerKitHandlers.js +26 -0
  449. package/dist/features/ingestion/registerKitHandlers.js.map +1 -0
  450. package/dist/features/ingestion/svgHandler.js +58 -0
  451. package/dist/features/ingestion/svgHandler.js.map +1 -0
  452. package/dist/features/ingestion/weaselJsonHandler.js +39 -0
  453. package/dist/features/ingestion/weaselJsonHandler.js.map +1 -0
  454. package/dist/features/longPress/longPressFeedback.js +96 -0
  455. package/dist/features/longPress/longPressFeedback.js.map +1 -0
  456. package/dist/features/meshPaint/bake.js +79 -0
  457. package/dist/features/meshPaint/bake.js.map +1 -0
  458. package/dist/features/meshPaint/bakeCache.js +59 -0
  459. package/dist/features/meshPaint/bakeCache.js.map +1 -0
  460. package/dist/features/meshPaint/handles.js +86 -0
  461. package/dist/features/meshPaint/handles.js.map +1 -0
  462. package/dist/features/meshPaint/lazyKind.js +1298 -0
  463. package/dist/features/meshPaint/lazyKind.js.map +1 -0
  464. package/dist/features/meshPaint/meshPaint.js +236 -0
  465. package/dist/features/meshPaint/meshPaint.js.map +1 -0
  466. package/dist/features/meshPaint/meshShader.js +6 -0
  467. package/dist/features/meshPaint/meshShader.js.map +1 -0
  468. package/dist/features/meshPaint/register.js +7 -0
  469. package/dist/features/meshPaint/register.js.map +1 -0
  470. package/dist/features/meshPaint/surface.js +110 -0
  471. package/dist/features/meshPaint/surface.js.map +1 -0
  472. package/dist/features/minimap/actions.js +53 -0
  473. package/dist/features/minimap/actions.js.map +1 -0
  474. package/dist/features/minimap/createMinimapContribution.js +96 -0
  475. package/dist/features/minimap/createMinimapContribution.js.map +1 -0
  476. package/dist/features/minimap/layers.js +103 -0
  477. package/dist/features/minimap/layers.js.map +1 -0
  478. package/dist/features/modes/modeLayers.js +113 -0
  479. package/dist/features/modes/modeLayers.js.map +1 -0
  480. package/dist/features/overlays/useNodeOverlayFrame.js +103 -0
  481. package/dist/features/overlays/useNodeOverlayFrame.js.map +1 -0
  482. package/dist/features/parallax/createParallaxLayer.js +26 -0
  483. package/dist/features/parallax/createParallaxLayer.js.map +1 -0
  484. package/dist/features/parallax/createParallaxPlane.js +26 -0
  485. package/dist/features/parallax/createParallaxPlane.js.map +1 -0
  486. package/dist/features/paths/anchorEdits.js +156 -0
  487. package/dist/features/paths/anchorEdits.js.map +1 -0
  488. package/dist/features/paths/anchors.js +154 -0
  489. package/dist/features/paths/anchors.js.map +1 -0
  490. package/dist/features/paths/booleans.js +2 -0
  491. package/dist/features/paths/index.js +15 -0
  492. package/dist/features/paths/markerCommands.js +116 -0
  493. package/dist/features/paths/markerCommands.js.map +1 -0
  494. package/dist/features/paths/markerSites.js +59 -0
  495. package/dist/features/paths/markerSites.js.map +1 -0
  496. package/dist/features/paths/markers.js +95 -0
  497. package/dist/features/paths/markers.js.map +1 -0
  498. package/dist/features/paths/nearestAnchor.js +36 -0
  499. package/dist/features/paths/nearestAnchor.js.map +1 -0
  500. package/dist/features/paths/originProjection.js +16 -0
  501. package/dist/features/paths/originProjection.js.map +1 -0
  502. package/dist/features/paths/pathEditingOverlayLayer.js +137 -0
  503. package/dist/features/paths/pathEditingOverlayLayer.js.map +1 -0
  504. package/dist/features/paths/pathInWorld.js +41 -0
  505. package/dist/features/paths/pathInWorld.js.map +1 -0
  506. package/dist/features/paths/pathLayer.js +44 -0
  507. package/dist/features/paths/pathLayer.js.map +1 -0
  508. package/dist/features/paths/penPreviewLayer.js +220 -0
  509. package/dist/features/paths/penPreviewLayer.js.map +1 -0
  510. package/dist/features/paths/poseDescriptor.js +39 -0
  511. package/dist/features/paths/poseDescriptor.js.map +1 -0
  512. package/dist/features/paths/tessellate/stroke.js +230 -0
  513. package/dist/features/paths/tessellate/stroke.js.map +1 -0
  514. package/dist/features/patterns/index.js +23 -0
  515. package/dist/features/patterns/index.js.map +1 -0
  516. package/dist/features/patterns/patterns-builtin.js +38 -0
  517. package/dist/features/patterns/patterns-builtin.js.map +1 -0
  518. package/dist/features/patterns/resolveSpec.js +57 -0
  519. package/dist/features/patterns/resolveSpec.js.map +1 -0
  520. package/dist/features/patterns/tileGeometry.js +158 -0
  521. package/dist/features/patterns/tileGeometry.js.map +1 -0
  522. package/dist/features/pointer/PointerContext.js +45 -0
  523. package/dist/features/pointer/PointerContext.js.map +1 -0
  524. package/dist/features/poseRun/usePoseRun.js +70 -0
  525. package/dist/features/poseRun/usePoseRun.js.map +1 -0
  526. package/dist/features/selection/SelectionContext.js +46 -0
  527. package/dist/features/selection/SelectionContext.js.map +1 -0
  528. package/dist/features/selection/overlay.js +442 -0
  529. package/dist/features/selection/overlay.js.map +1 -0
  530. package/dist/features/simulation/createSimulation.js +61 -0
  531. package/dist/features/simulation/createSimulation.js.map +1 -0
  532. package/dist/features/simulation/types.js +6 -0
  533. package/dist/features/simulation/types.js.map +1 -0
  534. package/dist/features/simulation/useSimulation.js +74 -0
  535. package/dist/features/simulation/useSimulation.js.map +1 -0
  536. package/dist/features/text/domRuns.js +258 -0
  537. package/dist/features/text/domRuns.js.map +1 -0
  538. package/dist/features/text/fitTextPose.js +38 -0
  539. package/dist/features/text/fitTextPose.js.map +1 -0
  540. package/dist/features/text/hitTest.js +45 -0
  541. package/dist/features/text/hitTest.js.map +1 -0
  542. package/dist/features/text/renderLabel.js +14 -0
  543. package/dist/features/text/renderLabel.js.map +1 -0
  544. package/dist/features/text/runs/effectiveRangeStyle.js +66 -0
  545. package/dist/features/text/runs/effectiveRangeStyle.js.map +1 -0
  546. package/dist/features/text/runs/flagRange.js +53 -0
  547. package/dist/features/text/runs/flagRange.js.map +1 -0
  548. package/dist/features/text/runs/rangeStyle.js +135 -0
  549. package/dist/features/text/runs/rangeStyle.js.map +1 -0
  550. package/dist/features/text/textCommand.js +59 -0
  551. package/dist/features/text/textCommand.js.map +1 -0
  552. package/dist/features/text/textLayer.js +35 -0
  553. package/dist/features/text/textLayer.js.map +1 -0
  554. package/dist/features/text/textToPath.js +181 -0
  555. package/dist/features/text/textToPath.js.map +1 -0
  556. package/dist/features/text/useSceneTextEdit.js +138 -0
  557. package/dist/features/text/useSceneTextEdit.js.map +1 -0
  558. package/dist/features/text/useTextEdit.js +465 -0
  559. package/dist/features/text/useTextEdit.js.map +1 -0
  560. package/dist/features/tiling/createTiledLayer.js +63 -0
  561. package/dist/features/tiling/createTiledLayer.js.map +1 -0
  562. package/dist/features/tiling/tiledProject.js +14 -0
  563. package/dist/features/tiling/tiledProject.js.map +1 -0
  564. package/dist/features/viewports/viewResolver.js +59 -0
  565. package/dist/features/viewports/viewResolver.js.map +1 -0
  566. package/dist/features/viewports/viewportLayer.js +58 -0
  567. package/dist/features/viewports/viewportLayer.js.map +1 -0
  568. package/dist/icons/ArrowIcon.js +23 -0
  569. package/dist/icons/ArrowIcon.js.map +1 -0
  570. package/dist/icons/EllipseIcon.js +21 -0
  571. package/dist/icons/EllipseIcon.js.map +1 -0
  572. package/dist/icons/EyedropperIcon.js +49 -0
  573. package/dist/icons/EyedropperIcon.js.map +1 -0
  574. package/dist/icons/HandIcon.js +59 -0
  575. package/dist/icons/HandIcon.js.map +1 -0
  576. package/dist/icons/ImageIcon.js +34 -0
  577. package/dist/icons/ImageIcon.js.map +1 -0
  578. package/dist/icons/LassoIcon.js +22 -0
  579. package/dist/icons/LassoIcon.js.map +1 -0
  580. package/dist/icons/LineIcon.js +22 -0
  581. package/dist/icons/LineIcon.js.map +1 -0
  582. package/dist/icons/PenIcon.js +36 -0
  583. package/dist/icons/PenIcon.js.map +1 -0
  584. package/dist/icons/PencilIcon.js +25 -0
  585. package/dist/icons/PencilIcon.js.map +1 -0
  586. package/dist/icons/PolygonIcon.js +19 -0
  587. package/dist/icons/PolygonIcon.js.map +1 -0
  588. package/dist/icons/RectIcon.js +37 -0
  589. package/dist/icons/RectIcon.js.map +1 -0
  590. package/dist/icons/SelectIcon.js +20 -0
  591. package/dist/icons/SelectIcon.js.map +1 -0
  592. package/dist/icons/StarIcon.js +19 -0
  593. package/dist/icons/StarIcon.js.map +1 -0
  594. package/dist/icons/TextIcon.js +19 -0
  595. package/dist/icons/TextIcon.js.map +1 -0
  596. package/dist/icons/UnknownIcon.js +33 -0
  597. package/dist/icons/UnknownIcon.js.map +1 -0
  598. package/dist/icons/_base.js +12 -0
  599. package/dist/icons/_base.js.map +1 -0
  600. package/dist/index.d.ts +1960 -1891
  601. package/dist/index.js +312 -13
  602. package/dist/input/keyState.js +76 -0
  603. package/dist/input/keyState.js.map +1 -0
  604. package/dist/input/useKeyState.js +22 -0
  605. package/dist/input/useKeyState.js.map +1 -0
  606. package/dist/interactions/actions/actionShortcuts.js +32 -0
  607. package/dist/interactions/actions/actionShortcuts.js.map +1 -0
  608. package/dist/interactions/actions/align/align.js +81 -0
  609. package/dist/interactions/actions/align/align.js.map +1 -0
  610. package/dist/interactions/actions/booleans/booleans.js +120 -0
  611. package/dist/interactions/actions/booleans/booleans.js.map +1 -0
  612. package/dist/interactions/actions/booleans/useBooleans.js +20 -0
  613. package/dist/interactions/actions/booleans/useBooleans.js.map +1 -0
  614. package/dist/interactions/actions/booleans/useBooleansAdapter.js +9 -0
  615. package/dist/interactions/actions/booleans/useBooleansAdapter.js.map +1 -0
  616. package/dist/interactions/actions/clipboard/clipboardOps.js +94 -0
  617. package/dist/interactions/actions/clipboard/clipboardOps.js.map +1 -0
  618. package/dist/interactions/actions/clipboard/materializePaste.js +25 -0
  619. package/dist/interactions/actions/clipboard/materializePaste.js.map +1 -0
  620. package/dist/interactions/actions/clipboard/wireFormat.js +43 -0
  621. package/dist/interactions/actions/clipboard/wireFormat.js.map +1 -0
  622. package/dist/interactions/actions/clone/behaviors/cloneByAltDrag.js +26 -0
  623. package/dist/interactions/actions/clone/behaviors/cloneByAltDrag.js.map +1 -0
  624. package/dist/interactions/actions/defaultCommitAdapter.js +42 -0
  625. package/dist/interactions/actions/defaultCommitAdapter.js.map +1 -0
  626. package/dist/interactions/actions/defaults/align.js +71 -0
  627. package/dist/interactions/actions/defaults/align.js.map +1 -0
  628. package/dist/interactions/actions/defaults/anchorEditing.js +235 -0
  629. package/dist/interactions/actions/defaults/anchorEditing.js.map +1 -0
  630. package/dist/interactions/actions/defaults/areaSelect.js +75 -0
  631. package/dist/interactions/actions/defaults/areaSelect.js.map +1 -0
  632. package/dist/interactions/actions/defaults/booleans.js +52 -0
  633. package/dist/interactions/actions/defaults/booleans.js.map +1 -0
  634. package/dist/interactions/actions/defaults/cancelGesture.js +24 -0
  635. package/dist/interactions/actions/defaults/cancelGesture.js.map +1 -0
  636. package/dist/interactions/actions/defaults/clearSelection.js +19 -0
  637. package/dist/interactions/actions/defaults/clearSelection.js.map +1 -0
  638. package/dist/interactions/actions/defaults/clipboard.js +78 -0
  639. package/dist/interactions/actions/defaults/clipboard.js.map +1 -0
  640. package/dist/interactions/actions/defaults/clone.js +107 -0
  641. package/dist/interactions/actions/defaults/clone.js.map +1 -0
  642. package/dist/interactions/actions/defaults/createOutlines.js +47 -0
  643. package/dist/interactions/actions/defaults/createOutlines.js.map +1 -0
  644. package/dist/interactions/actions/defaults/createPaintAction.js +85 -0
  645. package/dist/interactions/actions/defaults/createPaintAction.js.map +1 -0
  646. package/dist/interactions/actions/defaults/delete.js +61 -0
  647. package/dist/interactions/actions/defaults/delete.js.map +1 -0
  648. package/dist/interactions/actions/defaults/distribute.js +66 -0
  649. package/dist/interactions/actions/defaults/distribute.js.map +1 -0
  650. package/dist/interactions/actions/defaults/duplicate.js +83 -0
  651. package/dist/interactions/actions/defaults/duplicate.js.map +1 -0
  652. package/dist/interactions/actions/defaults/editAnchors.js +100 -0
  653. package/dist/interactions/actions/defaults/editAnchors.js.map +1 -0
  654. package/dist/interactions/actions/defaults/enterPathEdit.js +29 -0
  655. package/dist/interactions/actions/defaults/enterPathEdit.js.map +1 -0
  656. package/dist/interactions/actions/defaults/enterTextEdit.js +20 -0
  657. package/dist/interactions/actions/defaults/enterTextEdit.js.map +1 -0
  658. package/dist/interactions/actions/defaults/escape.js +26 -0
  659. package/dist/interactions/actions/defaults/escape.js.map +1 -0
  660. package/dist/interactions/actions/defaults/exitPathEdit.js +22 -0
  661. package/dist/interactions/actions/defaults/exitPathEdit.js.map +1 -0
  662. package/dist/interactions/actions/defaults/flip.js +119 -0
  663. package/dist/interactions/actions/defaults/flip.js.map +1 -0
  664. package/dist/interactions/actions/defaults/freshNodeId.js +10 -0
  665. package/dist/interactions/actions/defaults/freshNodeId.js.map +1 -0
  666. package/dist/interactions/actions/defaults/group.js +131 -0
  667. package/dist/interactions/actions/defaults/group.js.map +1 -0
  668. package/dist/interactions/actions/defaults/icons/actionGlyphIcons.js +40 -0
  669. package/dist/interactions/actions/defaults/icons/actionGlyphIcons.js.map +1 -0
  670. package/dist/interactions/actions/defaults/icons/actionGlyphs.js +10 -0
  671. package/dist/interactions/actions/defaults/icons/actionGlyphs.js.map +1 -0
  672. package/dist/interactions/actions/defaults/icons/alignIcons.js +173 -0
  673. package/dist/interactions/actions/defaults/icons/alignIcons.js.map +1 -0
  674. package/dist/interactions/actions/defaults/icons/booleanIcons.js +171 -0
  675. package/dist/interactions/actions/defaults/icons/booleanIcons.js.map +1 -0
  676. package/dist/interactions/actions/defaults/icons/distributeIcons.js +63 -0
  677. package/dist/interactions/actions/defaults/icons/distributeIcons.js.map +1 -0
  678. package/dist/interactions/actions/defaults/icons/editIcons.js +280 -0
  679. package/dist/interactions/actions/defaults/icons/editIcons.js.map +1 -0
  680. package/dist/interactions/actions/defaults/icons/outlineIcons.js +53 -0
  681. package/dist/interactions/actions/defaults/icons/outlineIcons.js.map +1 -0
  682. package/dist/interactions/actions/defaults/ingest.js +58 -0
  683. package/dist/interactions/actions/defaults/ingest.js.map +1 -0
  684. package/dist/interactions/actions/defaults/insert.js +288 -0
  685. package/dist/interactions/actions/defaults/insert.js.map +1 -0
  686. package/dist/interactions/actions/defaults/insertPathAnchor.js +50 -0
  687. package/dist/interactions/actions/defaults/insertPathAnchor.js.map +1 -0
  688. package/dist/interactions/actions/defaults/lassoSelect.js +156 -0
  689. package/dist/interactions/actions/defaults/lassoSelect.js.map +1 -0
  690. package/dist/interactions/actions/defaults/move.js +760 -0
  691. package/dist/interactions/actions/defaults/move.js.map +1 -0
  692. package/dist/interactions/actions/defaults/nudge.js +110 -0
  693. package/dist/interactions/actions/defaults/nudge.js.map +1 -0
  694. package/dist/interactions/actions/defaults/pinchZoom.js +63 -0
  695. package/dist/interactions/actions/defaults/pinchZoom.js.map +1 -0
  696. package/dist/interactions/actions/defaults/reorder.js +143 -0
  697. package/dist/interactions/actions/defaults/reorder.js.map +1 -0
  698. package/dist/interactions/actions/defaults/requiresSelection.js +10 -0
  699. package/dist/interactions/actions/defaults/requiresSelection.js.map +1 -0
  700. package/dist/interactions/actions/defaults/resize.js +335 -0
  701. package/dist/interactions/actions/defaults/resize.js.map +1 -0
  702. package/dist/interactions/actions/defaults/rotate.js +184 -0
  703. package/dist/interactions/actions/defaults/rotate.js.map +1 -0
  704. package/dist/interactions/actions/defaults/selectAll.js +27 -0
  705. package/dist/interactions/actions/defaults/selectAll.js.map +1 -0
  706. package/dist/interactions/actions/defaults/setFill.js +27 -0
  707. package/dist/interactions/actions/defaults/setFill.js.map +1 -0
  708. package/dist/interactions/actions/defaults/setFillOpacity.js +15 -0
  709. package/dist/interactions/actions/defaults/setFillOpacity.js.map +1 -0
  710. package/dist/interactions/actions/defaults/setStroke.js +36 -0
  711. package/dist/interactions/actions/defaults/setStroke.js.map +1 -0
  712. package/dist/interactions/actions/defaults/setStrokeOpacity.js +21 -0
  713. package/dist/interactions/actions/defaults/setStrokeOpacity.js.map +1 -0
  714. package/dist/interactions/actions/defaults/slice.js +39 -0
  715. package/dist/interactions/actions/defaults/slice.js.map +1 -0
  716. package/dist/interactions/actions/defaults/sliceOps.js +60 -0
  717. package/dist/interactions/actions/defaults/sliceOps.js.map +1 -0
  718. package/dist/interactions/actions/defaults/toolActivate.js +35 -0
  719. package/dist/interactions/actions/defaults/toolActivate.js.map +1 -0
  720. package/dist/interactions/actions/defaults/toolResetToDefault.js +26 -0
  721. package/dist/interactions/actions/defaults/toolResetToDefault.js.map +1 -0
  722. package/dist/interactions/actions/defaults/undoRedo.js +51 -0
  723. package/dist/interactions/actions/defaults/undoRedo.js.map +1 -0
  724. package/dist/interactions/actions/defaults/viewportDragPan.js +88 -0
  725. package/dist/interactions/actions/defaults/viewportDragPan.js.map +1 -0
  726. package/dist/interactions/actions/defaults/viewportWheelPan.js +57 -0
  727. package/dist/interactions/actions/defaults/viewportWheelPan.js.map +1 -0
  728. package/dist/interactions/actions/defaults/viewportZoom.js +143 -0
  729. package/dist/interactions/actions/defaults/viewportZoom.js.map +1 -0
  730. package/dist/interactions/actions/distribute/distribute.js +42 -0
  731. package/dist/interactions/actions/distribute/distribute.js.map +1 -0
  732. package/dist/interactions/actions/distribute/plan.js +29 -0
  733. package/dist/interactions/actions/distribute/plan.js.map +1 -0
  734. package/dist/interactions/actions/edit-anchors/geometry.js +61 -0
  735. package/dist/interactions/actions/edit-anchors/geometry.js.map +1 -0
  736. package/dist/interactions/actions/edit-anchors/handles.js +43 -0
  737. package/dist/interactions/actions/edit-anchors/handles.js.map +1 -0
  738. package/dist/interactions/actions/flip/helpers.js +35 -0
  739. package/dist/interactions/actions/flip/helpers.js.map +1 -0
  740. package/dist/interactions/actions/geometryProjection.js +18 -0
  741. package/dist/interactions/actions/geometryProjection.js.map +1 -0
  742. package/dist/interactions/actions/gestureLifecycle.js +44 -0
  743. package/dist/interactions/actions/gestureLifecycle.js.map +1 -0
  744. package/dist/interactions/actions/lasso-select/behaviors/selectFromLasso.js +39 -0
  745. package/dist/interactions/actions/lasso-select/behaviors/selectFromLasso.js.map +1 -0
  746. package/dist/interactions/actions/move/behaviors/snapBackOrDelete.js +36 -0
  747. package/dist/interactions/actions/move/behaviors/snapBackOrDelete.js.map +1 -0
  748. package/dist/interactions/actions/move/behaviors/snapToContainer.js +67 -0
  749. package/dist/interactions/actions/move/behaviors/snapToContainer.js.map +1 -0
  750. package/dist/interactions/actions/move/gestureAdapter.js +37 -0
  751. package/dist/interactions/actions/move/gestureAdapter.js.map +1 -0
  752. package/dist/interactions/actions/outlines/createOutlines.js +84 -0
  753. package/dist/interactions/actions/outlines/createOutlines.js.map +1 -0
  754. package/dist/interactions/actions/outlines/useCreateOutlinesAdapter.js +9 -0
  755. package/dist/interactions/actions/outlines/useCreateOutlinesAdapter.js.map +1 -0
  756. package/dist/interactions/actions/planeInput.js +181 -0
  757. package/dist/interactions/actions/planeInput.js.map +1 -0
  758. package/dist/interactions/actions/poseDescriptorDep.js +9 -0
  759. package/dist/interactions/actions/poseDescriptorDep.js.map +1 -0
  760. package/dist/interactions/actions/poseFrame.js +38 -0
  761. package/dist/interactions/actions/poseFrame.js.map +1 -0
  762. package/dist/interactions/actions/previewOverrides.js +25 -0
  763. package/dist/interactions/actions/previewOverrides.js.map +1 -0
  764. package/dist/interactions/actions/resize/autoPoseDescriptor.js +31 -0
  765. package/dist/interactions/actions/resize/autoPoseDescriptor.js.map +1 -0
  766. package/dist/interactions/actions/resize/behaviors/clampMinSize.js +18 -0
  767. package/dist/interactions/actions/resize/behaviors/clampMinSize.js.map +1 -0
  768. package/dist/interactions/actions/resize/behaviors/index.js +8 -0
  769. package/dist/interactions/actions/resize/behaviors/index.js.map +1 -0
  770. package/dist/interactions/actions/resize/behaviors/lockAspect.js +24 -0
  771. package/dist/interactions/actions/resize/behaviors/lockAspect.js.map +1 -0
  772. package/dist/interactions/actions/resize/cornerHandles.js +72 -0
  773. package/dist/interactions/actions/resize/cornerHandles.js.map +1 -0
  774. package/dist/interactions/actions/resolveOverlays.js +60 -0
  775. package/dist/interactions/actions/resolveOverlays.js.map +1 -0
  776. package/dist/interactions/actions/resolvePreviews.js +61 -0
  777. package/dist/interactions/actions/resolvePreviews.js.map +1 -0
  778. package/dist/interactions/actions/rotate/geometry.js +46 -0
  779. package/dist/interactions/actions/rotate/geometry.js.map +1 -0
  780. package/dist/interactions/actions/rotate/handle.js +27 -0
  781. package/dist/interactions/actions/rotate/handle.js.map +1 -0
  782. package/dist/interactions/actions/spatialReference.js +42 -0
  783. package/dist/interactions/actions/spatialReference.js.map +1 -0
  784. package/dist/interactions/actions/useStandardActions.js +142 -0
  785. package/dist/interactions/actions/useStandardActions.js.map +1 -0
  786. package/dist/interactions/gestures/dragGesture/dragGesture.js +111 -0
  787. package/dist/interactions/gestures/dragGesture/dragGesture.js.map +1 -0
  788. package/dist/interactions/gestures/dragRadial/dragRadial.js +117 -0
  789. package/dist/interactions/gestures/dragRadial/dragRadial.js.map +1 -0
  790. package/dist/interactions/gestures/dragRect/dragRect.js +164 -0
  791. package/dist/interactions/gestures/dragRect/dragRect.js.map +1 -0
  792. package/dist/interactions/gestures/handleDrag/handleDrag.js +46 -0
  793. package/dist/interactions/gestures/handleDrag/handleDrag.js.map +1 -0
  794. package/dist/interactions/gestures/pointerDrag/pointerDrag.js +118 -0
  795. package/dist/interactions/gestures/pointerDrag/pointerDrag.js.map +1 -0
  796. package/dist/interactions/gestures/shared/originProjection.js +42 -0
  797. package/dist/interactions/gestures/shared/originProjection.js.map +1 -0
  798. package/dist/interactions/gestures/shared/screenTolerance.js +21 -0
  799. package/dist/interactions/gestures/shared/screenTolerance.js.map +1 -0
  800. package/dist/interactions/gestures/shared/snap.js +24 -0
  801. package/dist/interactions/gestures/shared/snap.js.map +1 -0
  802. package/dist/interactions/gestures/thresholdDrag/thresholdDrag.js +30 -0
  803. package/dist/interactions/gestures/thresholdDrag/thresholdDrag.js.map +1 -0
  804. package/dist/layout/arrivals.js +36 -0
  805. package/dist/layout/arrivals.js.map +1 -0
  806. package/dist/{math-MCQcf_gc.d.ts → math-Drrw4ewZ.d.ts} +8 -116
  807. package/dist/math.d.ts +4 -5
  808. package/dist/math.js +6 -4
  809. package/dist/mesh.d.ts +268 -0
  810. package/dist/mesh.js +7 -0
  811. package/dist/move.d.ts +7 -49
  812. package/dist/move.js +3 -142
  813. package/dist/originProjection-DEklpDc_.d.ts +57 -0
  814. package/dist/patterns-builtin.js +3 -3
  815. package/dist/{poseDescriptor-rZa9W5hJ.d.ts → poseDescriptor-D-OH-tu5.d.ts} +0 -4
  816. package/dist/registerProgram-ateHDGjw.d.ts +193 -0
  817. package/dist/renderer/DrawCommand.js +6 -0
  818. package/dist/renderer/DrawCommand.js.map +1 -0
  819. package/dist/renderer/WeaselRenderer.js +328 -0
  820. package/dist/renderer/WeaselRenderer.js.map +1 -0
  821. package/dist/renderer/cache/GLImageCache.js +64 -0
  822. package/dist/renderer/cache/GLImageCache.js.map +1 -0
  823. package/dist/renderer/cache/GLMeshCache.js +102 -0
  824. package/dist/renderer/cache/GLMeshCache.js.map +1 -0
  825. package/dist/renderer/cache/GLTextureCache.js +51 -0
  826. package/dist/renderer/cache/GLTextureCache.js.map +1 -0
  827. package/dist/renderer/cache/GradientRampAtlas.js +82 -0
  828. package/dist/renderer/cache/GradientRampAtlas.js.map +1 -0
  829. package/dist/renderer/cache/cache.js +13 -0
  830. package/dist/renderer/cache/cache.js.map +1 -0
  831. package/dist/renderer/cache/markerCommandCache.js +59 -0
  832. package/dist/renderer/cache/markerCommandCache.js.map +1 -0
  833. package/dist/renderer/cache/outlineMeshCache.js +15 -0
  834. package/dist/renderer/cache/outlineMeshCache.js.map +1 -0
  835. package/dist/renderer/cache/outlineStrokeMeshCache.js +31 -0
  836. package/dist/renderer/cache/outlineStrokeMeshCache.js.map +1 -0
  837. package/dist/renderer/cache/strokeMeshCache.js +44 -0
  838. package/dist/renderer/cache/strokeMeshCache.js.map +1 -0
  839. package/dist/renderer/cullDrawCommands.js +89 -0
  840. package/dist/renderer/cullDrawCommands.js.map +1 -0
  841. package/dist/renderer/draw.js +1109 -0
  842. package/dist/renderer/draw.js.map +1 -0
  843. package/dist/renderer/drawBatch.js +168 -0
  844. package/dist/renderer/drawBatch.js.map +1 -0
  845. package/dist/renderer/effects/EffectTargets.js +45 -0
  846. package/dist/renderer/effects/EffectTargets.js.map +1 -0
  847. package/dist/renderer/effects/builtins.js +31 -0
  848. package/dist/renderer/effects/builtins.js.map +1 -0
  849. package/dist/renderer/effects/composite.js +9 -0
  850. package/dist/renderer/effects/composite.js.map +1 -0
  851. package/dist/renderer/effects/effectPrelude.js +10 -0
  852. package/dist/renderer/effects/effectPrelude.js.map +1 -0
  853. package/dist/renderer/effects/types.js +10 -0
  854. package/dist/renderer/effects/types.js.map +1 -0
  855. package/dist/renderer/index.js +19 -0
  856. package/dist/renderer/math/color.js +341 -0
  857. package/dist/renderer/math/color.js.map +1 -0
  858. package/dist/renderer/math/mat3.js +71 -0
  859. package/dist/renderer/math/mat3.js.map +1 -0
  860. package/dist/renderer/math/patternSpace.js +22 -0
  861. package/dist/renderer/math/patternSpace.js.map +1 -0
  862. package/dist/renderer/math/viewToMat3.js +19 -0
  863. package/dist/renderer/math/viewToMat3.js.map +1 -0
  864. package/dist/renderer/paintResources.js +18 -0
  865. package/dist/renderer/paintResources.js.map +1 -0
  866. package/dist/renderer/paintScratch.js +37 -0
  867. package/dist/renderer/paintScratch.js.map +1 -0
  868. package/dist/renderer/shaders/ShaderProgram.js +74 -0
  869. package/dist/renderer/shaders/ShaderProgram.js.map +1 -0
  870. package/dist/renderer/shaders/batchFill.js +118 -0
  871. package/dist/renderer/shaders/batchFill.js.map +1 -0
  872. package/dist/renderer/shaders/customPrelude.js +34 -0
  873. package/dist/renderer/shaders/customPrelude.js.map +1 -0
  874. package/dist/renderer/shaders/extractUniformNames.js +184 -0
  875. package/dist/renderer/shaders/extractUniformNames.js.map +1 -0
  876. package/dist/renderer/shaders/glyphPaint.js +61 -0
  877. package/dist/renderer/shaders/glyphPaint.js.map +1 -0
  878. package/dist/renderer/shaders/gradFill.js +30 -0
  879. package/dist/renderer/shaders/gradFill.js.map +1 -0
  880. package/dist/renderer/shaders/imageFill.js +14 -0
  881. package/dist/renderer/shaders/imageFill.js.map +1 -0
  882. package/dist/renderer/shaders/pathFill.js +13 -0
  883. package/dist/renderer/shaders/pathFill.js.map +1 -0
  884. package/dist/renderer/shaders/patternFill.js +24 -0
  885. package/dist/renderer/shaders/patternFill.js.map +1 -0
  886. package/dist/renderer/shaders/registerProgram.js +18 -0
  887. package/dist/renderer/shaders/registerProgram.js.map +1 -0
  888. package/dist/renderer/spriteSheet.js +14 -0
  889. package/dist/renderer/spriteSheet.js.map +1 -0
  890. package/dist/renderer/state/GroupState.js +77 -0
  891. package/dist/renderer/state/GroupState.js.map +1 -0
  892. package/dist/renderer/syntheticItalic.js +6 -0
  893. package/dist/renderer/syntheticItalic.js.map +1 -0
  894. package/dist/renderer/textures/registerTexture.js +14 -0
  895. package/dist/renderer/textures/registerTexture.js.map +1 -0
  896. package/dist/renderer.d.ts +11 -21
  897. package/dist/renderer.js +18 -13
  898. package/dist/resize.d.ts +10 -46
  899. package/dist/resize.js +7 -5
  900. package/dist/routing.js +2 -3
  901. package/dist/scheduling/useVisibleRaf.js +69 -0
  902. package/dist/scheduling/useVisibleRaf.js.map +1 -0
  903. package/dist/style.css +2 -0
  904. package/dist/test-hook/createTestHook.js +39 -0
  905. package/dist/test-hook/createTestHook.js.map +1 -0
  906. package/dist/test-hook/install.js +12 -0
  907. package/dist/test-hook/install.js.map +1 -0
  908. package/dist/test-seams-fYf6m5pu.d.ts +356 -0
  909. package/dist/test-seams.d.ts +6 -0
  910. package/dist/test-seams.js +3 -0
  911. package/dist/tools/builtin/ellipse/useEllipseTool.js +33 -0
  912. package/dist/tools/builtin/ellipse/useEllipseTool.js.map +1 -0
  913. package/dist/tools/builtin/eyedropper/useEyedropperTool.js +55 -0
  914. package/dist/tools/builtin/eyedropper/useEyedropperTool.js.map +1 -0
  915. package/dist/tools/builtin/hand/dragPanContribution.js +17 -0
  916. package/dist/tools/builtin/hand/dragPanContribution.js.map +1 -0
  917. package/dist/tools/builtin/hand/useHandTool.js +31 -0
  918. package/dist/tools/builtin/hand/useHandTool.js.map +1 -0
  919. package/dist/tools/builtin/image/useImageTool.js +41 -0
  920. package/dist/tools/builtin/image/useImageTool.js.map +1 -0
  921. package/dist/tools/builtin/lasso/useLassoTool.js +42 -0
  922. package/dist/tools/builtin/lasso/useLassoTool.js.map +1 -0
  923. package/dist/tools/builtin/line/useLineTool.js +33 -0
  924. package/dist/tools/builtin/line/useLineTool.js.map +1 -0
  925. package/dist/tools/builtin/pen/usePenTool.js +414 -0
  926. package/dist/tools/builtin/pen/usePenTool.js.map +1 -0
  927. package/dist/tools/builtin/pencil/usePencilTool.js +36 -0
  928. package/dist/tools/builtin/pencil/usePencilTool.js.map +1 -0
  929. package/dist/tools/builtin/pickTopMostHit.js +45 -0
  930. package/dist/tools/builtin/pickTopMostHit.js.map +1 -0
  931. package/dist/tools/builtin/polygon/usePolygonTool.js +81 -0
  932. package/dist/tools/builtin/polygon/usePolygonTool.js.map +1 -0
  933. package/dist/tools/builtin/rect/useRectTool.js +32 -0
  934. package/dist/tools/builtin/rect/useRectTool.js.map +1 -0
  935. package/dist/tools/builtin/select/selectionContributions.js +109 -0
  936. package/dist/tools/builtin/select/selectionContributions.js.map +1 -0
  937. package/dist/tools/builtin/select/useSelectTool.js +162 -0
  938. package/dist/tools/builtin/select/useSelectTool.js.map +1 -0
  939. package/dist/tools/builtin/shared/insertToolOptions.js +8 -0
  940. package/dist/tools/builtin/shared/insertToolOptions.js.map +1 -0
  941. package/dist/tools/builtin/slice/useSliceTool.js +263 -0
  942. package/dist/tools/builtin/slice/useSliceTool.js.map +1 -0
  943. package/dist/tools/builtin/star/useStarTool.js +82 -0
  944. package/dist/tools/builtin/star/useStarTool.js.map +1 -0
  945. package/dist/tools/builtin/text/useTextTool.js +177 -0
  946. package/dist/tools/builtin/text/useTextTool.js.map +1 -0
  947. package/dist/tools/overlayBinding.js +8 -0
  948. package/dist/tools/overlayBinding.js.map +1 -0
  949. package/dist/tools/prefs.js +47 -0
  950. package/dist/tools/prefs.js.map +1 -0
  951. package/dist/tools/useKeybindings.js +66 -0
  952. package/dist/tools/useKeybindings.js.map +1 -0
  953. package/dist/{types-D-9QWBy5.d.ts → types-A37hYkeR.d.ts} +185 -15
  954. package/dist/{types-qYpyTAiZ.d.ts → types-B_9g6hMM.d.ts} +32 -6
  955. package/dist/util/color.js +26 -0
  956. package/dist/util/color.js.map +1 -0
  957. package/dist/util/constrainTo45.js +17 -0
  958. package/dist/util/constrainTo45.js.map +1 -0
  959. package/dist/util/paint.js +72 -0
  960. package/dist/util/paint.js.map +1 -0
  961. package/dist/version.js +6 -0
  962. package/dist/version.js.map +1 -0
  963. package/package.json +31 -19
  964. package/dist/chunk-3TY6FHAF.js +0 -170
  965. package/dist/chunk-3TY6FHAF.js.map +0 -1
  966. package/dist/chunk-DGWNNKGD.js +0 -248
  967. package/dist/chunk-DGWNNKGD.js.map +0 -1
  968. package/dist/chunk-G4ZGQMY7.js +0 -33372
  969. package/dist/chunk-G4ZGQMY7.js.map +0 -1
  970. package/dist/chunk-L5YNZYEG.js +0 -648
  971. package/dist/chunk-L5YNZYEG.js.map +0 -1
  972. package/dist/chunk-LU4IJ52W.js +0 -111
  973. package/dist/chunk-LU4IJ52W.js.map +0 -1
  974. package/dist/chunk-M24CLARN.js +0 -28
  975. package/dist/chunk-M24CLARN.js.map +0 -1
  976. package/dist/chunk-NE27EOLP.js +0 -146
  977. package/dist/chunk-NE27EOLP.js.map +0 -1
  978. package/dist/chunk-PNNZSYRD.js +0 -318
  979. package/dist/chunk-PNNZSYRD.js.map +0 -1
  980. package/dist/chunk-UPZY4ART.js +0 -29
  981. package/dist/chunk-UPZY4ART.js.map +0 -1
  982. package/dist/chunk-WPNA6L5O.js +0 -250
  983. package/dist/chunk-WPNA6L5O.js.map +0 -1
  984. package/dist/chunk-XMAWPGTK.js +0 -128
  985. package/dist/chunk-XMAWPGTK.js.map +0 -1
  986. package/dist/clipboard.js.map +0 -1
  987. package/dist/clone.js.map +0 -1
  988. package/dist/grid-CY5UKlZh.d.ts +0 -98
  989. package/dist/index.css +0 -62
  990. package/dist/index.css.map +0 -1
  991. package/dist/index.js.map +0 -1
  992. package/dist/insert.d.ts +0 -36
  993. package/dist/insert.js +0 -81
  994. package/dist/insert.js.map +0 -1
  995. package/dist/math.js.map +0 -1
  996. package/dist/move.js.map +0 -1
  997. package/dist/path-JEV2c5If.d.ts +0 -48
  998. package/dist/patterns-builtin.js.map +0 -1
  999. package/dist/renderer.css +0 -62
  1000. package/dist/renderer.css.map +0 -1
  1001. package/dist/renderer.js.map +0 -1
  1002. package/dist/resize.js.map +0 -1
  1003. package/dist/routing.js.map +0 -1
  1004. package/dist/types-D2tTKEU0.d.ts +0 -18
@@ -0,0 +1,120 @@
1
+ import { unionAABB as e } from "../core/geometry/unionBounds.js";
2
+ import { aggregatePreviewIds as t, firstPreviewBounds as n, firstPreviewPose as r, toolPreviewSources as i } from "./toolPreview.js";
3
+ import { buildChromeState as a } from "../core/selection/chromeState.js";
4
+ import { useCallback as o, useMemo as s } from "react";
5
+ import { useLatest as c } from "@weasel-js/react";
6
+ //#region src/canvas/useViewHelpers.ts
7
+ var l = () => {}, u = () => !0;
8
+ function d(e, t) {
9
+ return typeof e.getWorldPose == "function" ? e.getWorldPose(t) : e.getPose(t);
10
+ }
11
+ function f(f) {
12
+ let { adapter: p, geometry: m, boundsOf: h, boundsOfPose: g, selection: _, tools: v, gestureSource: y, previewPoseExtra: b, previewIdsExtra: x, getIsVisible: S } = f, C = o((e, t) => g ? g(e, t) : m.getBounds(t), [g, m]), w = s(() => {
13
+ if (h) return h;
14
+ if (p) return (e) => {
15
+ try {
16
+ let t = d(p, e), n = m.getBounds(t), r = m.getRotation?.(t);
17
+ return r ? {
18
+ ...n,
19
+ rotation: r
20
+ } : n;
21
+ } catch {
22
+ return null;
23
+ }
24
+ };
25
+ }, [
26
+ h,
27
+ p,
28
+ m
29
+ ]), T = o((e) => {
30
+ if (!p) return null;
31
+ try {
32
+ return d(p, e);
33
+ } catch {
34
+ return null;
35
+ }
36
+ }, [p]), E = _.length > 1, D = c({
37
+ previewPoseExtra: b,
38
+ previewIdsExtra: x
39
+ }), O = s(() => h ?? w, [h, w]), k = o((e) => {
40
+ if (v) {
41
+ let t = r(v, e);
42
+ if (t != null) return t;
43
+ }
44
+ let t = D.current.previewPoseExtra;
45
+ if (t) {
46
+ let n = t(e);
47
+ if (n != null) return n;
48
+ }
49
+ return null;
50
+ }, [v, D]), A = o((e) => {
51
+ if (v) {
52
+ let t = n(v, e);
53
+ if (t) return t;
54
+ let i = r(v, e);
55
+ if (i != null) return C(e, i);
56
+ }
57
+ let t = D.current.previewPoseExtra;
58
+ if (t) {
59
+ let n = t(e);
60
+ if (n != null) return C(e, n);
61
+ }
62
+ return null;
63
+ }, [
64
+ v,
65
+ C,
66
+ D
67
+ ]), j = o((e) => A(e) || (O ? O(e) : null), [A, O]), M = s(() => a({
68
+ selection: _,
69
+ multiActive: E,
70
+ effectiveBoundsOf: j,
71
+ modifiers: {
72
+ alt: !1,
73
+ shift: !1,
74
+ meta: !1,
75
+ ctrl: !1
76
+ },
77
+ canRotate: (e) => {
78
+ if (!m.supportsRotation) return !0;
79
+ let t = T(e);
80
+ return t == null || m.supportsRotation(t);
81
+ }
82
+ }), [
83
+ _,
84
+ E,
85
+ j,
86
+ m,
87
+ T
88
+ ]);
89
+ return {
90
+ helpers: {
91
+ getEffectivePose: (e) => k(e) ?? T(e),
92
+ getEffectiveBounds: j,
93
+ getGestureBounds: () => {
94
+ let n = t(v), r = y?.ids();
95
+ if (r) for (let e of r) n.add(e);
96
+ let i = [];
97
+ for (let e of n) i.push(A(e));
98
+ let a = y?.bounds();
99
+ if (a) for (let e of a) i.push(e);
100
+ return e(i);
101
+ },
102
+ subscribeGestures: (e) => y?.subscribe(e) ?? l,
103
+ getGestureVersion: () => y?.getVersion() ?? 0,
104
+ getChromeState: () => M,
105
+ getPreviewSources: () => [...i(v), ...y?.previewSources() ?? []],
106
+ getGestureOverlays: () => y?.overlays() ?? [],
107
+ getIsVisible: () => S?.() ?? u
108
+ },
109
+ chromeState: M,
110
+ committedPoseOf: T,
111
+ effectiveBoundsOf: O,
112
+ previewToolPose: k,
113
+ previewToolBounds: A,
114
+ previewExtraRef: D
115
+ };
116
+ }
117
+ //#endregion
118
+ export { f as useViewHelpers };
119
+
120
+ //# sourceMappingURL=useViewHelpers.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useViewHelpers.js","names":["noOpUnsubscribe","alwaysVisible","worldPoseOf","adapter","id","useViewHelpers","opts","boxOf","useCallback","boundsOfPose","pose","geometry","baseBoundsOf","useMemo","boundsOf","b","rot","committedPoseOf","multiActive","selection","previewExtraRef","useLatest","effectiveBoundsOf","previewToolPose","tools","p","firstPreviewPose","extra","previewToolBounds","firstPreviewBounds","boundsWithPreview","chromeState","buildChromeState","ids","aggregatePreviewIds","extraIds","gestureSource","parts","extraBounds","unionAABB","fn","toolPreviewSources","getIsVisible"],"sources":["../../src/canvas/useViewHelpers.ts"],"sourcesContent":["import { useCallback, useMemo } from 'react';\nimport { useLatest } from '@weasel-js/react';\nimport { firstPreviewPose, firstPreviewBounds, aggregatePreviewIds, toolPreviewSources } from './toolPreview';\nimport type { GestureSource, GesturePreviewSource } from './gestureBounds';\nimport type { OngoingOverlay } from '@weasel-js/routing';\nimport { unionAABB } from 'core/geometry/unionBounds';\nimport { buildChromeState, type ChromeState } from 'core/selection/chromeState';\nimport type { PoseDescriptor } from 'interactions/actions/resize/geometry';\nimport type { NodeId } from 'core/scene/types';\nimport type { ToolsApi } from '../tools/overlayBinding';\nimport type { DebugSink } from '../debug/types';\nimport type { Bounds } from 'core/viewport/fitViewToBounds';\n\nconst noOpUnsubscribe = (): void => {};\n\nconst alwaysVisible = (): boolean => true;\n\n/**\n * The half of {@link CanvasHelpers} that belongs to one view — everything\n * answered by a camera's own tools, gestures and selection. A canvas hosting\n * several viewports needs one of these per view; the surface half is shared.\n */\nexport interface CanvasViewHelpers<TPose> {\n /** Pose currently displayed for `id` — drag/resize/rotate overlay if active,\n * otherwise the committed pose from the adapter. Returns `null` if the id\n * isn't known. */\n getEffectivePose(id: string): TPose | null;\n /** Overlay-aware bounds for `id`. */\n getEffectiveBounds(id: string): Bounds | null;\n /**\n * World-space AABB of everything the in-flight gesture proposes — the\n * displaced poses of nodes being moved / resized / rotated / cloned, plus\n * any nascent insert that has no scene node yet. `null` when no gesture is\n * in flight.\n *\n * This reports the *gesture*, not the document: committed content the\n * gesture isn't touching is excluded, so a consumer that wants the union\n * with the rest of the scene still walks its own ids through\n * `getEffectiveBounds`. It exists because every other lookup here is keyed\n * by node id, which can't answer \"where is the shape the user is drawing\n * right now\" — a drag-to-insert has no id until pointer-up.\n *\n * Select-only gestures are deliberately excluded: a marquee or lasso has\n * geometry but proposes no content, and a consumer sizing itself to the\n * gesture must not grow because the user swept a selection rectangle.\n *\n * The result is a plain AABB — never rotated. Rotated parts are folded in\n * by their rotated extent (a union of several oriented boxes has no single\n * orientation to report).\n */\n getGestureBounds(): Bounds | null;\n /**\n * Subscribe to the gesture layer's change signal — the other half of the\n * `useSyncExternalStore` contract for everything on this object that moves\n * during a drag (`getEffectivePose`, `getEffectiveBounds`,\n * `getGestureBounds`). Returns an unsubscribe.\n *\n * Fires once per dispatcher pump: gesture start, every pointermove that\n * reaches an in-flight handle, end, and cancel — plus UI-driven ongoing\n * actions (a slider bound to an ongoing action pumps the same way). It\n * fires on the pump, not on a diff: a pump that changed nothing observable\n * still notifies, so don't hang expensive work directly off the callback.\n *\n * It does **not** cover committed scene edits (subscribe to the scene for\n * those) or previews a consumer's own tool publishes from React state\n * (that tool re-renders on its own).\n *\n * Without a gesture source wired — a bare `<Canvas>` — this is a no-op\n * subscription that never fires.\n */\n subscribeGestures(fn: () => void): () => void;\n /**\n * Monotonic counter bumped on exactly the events `subscribeGestures` fires\n * on. Pair the two for `useSyncExternalStore`:\n *\n * ```ts\n * const gestureVersion = useSyncExternalStore(\n * useCallback((cb) => helpersRef.current?.subscribeGestures(cb) ?? (() => {}), []),\n * () => helpersRef.current?.getGestureVersion() ?? 0,\n * );\n * ```\n *\n * Starts at 0 and only increases. `0` is also what a bare `<Canvas>` with\n * no gesture source reports, forever.\n */\n getGestureVersion(): number;\n /** Returns the live ChromeState built once per render. Affordances and\n * custom layers that need overlay-aware selection state (selection ids,\n * bounds, multi-union AABB, modifier flags) read from this. */\n getChromeState(): ChromeState;\n /**\n * Everything publishing an in-flight preview for this view, in resolution\n * order: tool-side first (hotkey → active → registry → ambient), then the\n * handles in flight on this view's dispatcher. Readers take the first\n * non-null answer per id.\n *\n * A ghost layer must read this off its draw envelope rather than close over\n * a dispatcher: one layer array paints every view, so a closure ghosts view\n * zero's drag into every panel.\n */\n getPreviewSources(): readonly GesturePreviewSource[];\n /** Overlay shapes this view's in-flight handles publish — marquee, lasso,\n * insert preview, raw commands. Same envelope rule as\n * {@link CanvasViewHelpers.getPreviewSources}. */\n getGestureOverlays(): readonly OngoingOverlay[];\n /**\n * Chrome-caps visibility predicate, keyed by chrome id. Overlay layers and\n * affordances call it per element to decide whether to draw / hit-test.\n *\n * The rule table is the surface's; the context it resolves against is this\n * view's selection, camera and in-flight action — so the predicate belongs\n * here rather than on {@link CanvasSurfaceHelpers}. Unwired, it is the\n * universal `() => true`.\n */\n getIsVisible(): (id: string) => boolean;\n}\n\n/**\n * The half of {@link CanvasHelpers} that belongs to the surface — one GL\n * context, one debug sink, however many views are drawn on it.\n */\nexport interface CanvasSurfaceHelpers {\n /** Active debug sink, when `<Canvas debug=...>` is enabled. Layers that\n * want to participate in `hitboxes`/`bounds`/etc. visualization can\n * call into this from their `draw` callback. Returns `null` when\n * debug is off — no-op for production renders. */\n getDebug(): DebugSink | null;\n}\n\n/** Live overlay-aware lookups exposed to custom layers via `helpersRef`.\n * What a layer receives as its `data` argument, unchanged: the two halves\n * are split so a per-view set can be built independently of the surface's,\n * not to make layers ask for one. */\nexport interface CanvasHelpers<TPose> extends CanvasViewHelpers<TPose>, CanvasSurfaceHelpers {\n /**\n * The view this draw is for: a `<CanvasView>` id, or `null` for the\n * surface's own camera. One layer array paints every view, so a layer that\n * belongs in some views and not others — a minimap's indicator — declines\n * the rest by this id.\n */\n readonly viewId: string | null;\n}\n\nexport interface UseViewHelpersOpts<TPose> {\n /** Only `getPose` is read here — the narrow slice keeps this hook off the\n * full adapter contract. */\n adapter: { getPose(id: string): TPose } | undefined;\n geometry: PoseDescriptor<TPose>;\n /** Consumer-supplied bounds resolver. Falls back to the adapter's pose. */\n boundsOf: ((id: string) => Bounds | null) | undefined;\n /** Bounds of `id` drawn at an in-flight `pose`. Falls back to the\n * geometry's box of that pose, which is wrong wherever the surface draws a\n * node somewhere its pose does not say — a parallax plane. */\n boundsOfPose?: ((id: string, pose: TPose) => Bounds | null) | undefined;\n selection: readonly NodeId[];\n tools: ToolsApi | undefined;\n gestureSource: GestureSource | undefined;\n /** Dispatcher-published preview overlays, read through a ref so a change\n * mid-gesture doesn't rebuild the memos that depend on them. */\n previewPoseExtra: ((id: string) => unknown) | undefined;\n previewIdsExtra: (() => Iterable<string> | null) | undefined;\n /** Chrome-caps predicate for this view. Absent means everything is visible. */\n getIsVisible?: (() => (id: string) => boolean) | undefined;\n}\n\nexport interface ViewHelpersBundle<TPose> {\n helpers: CanvasViewHelpers<TPose>;\n chromeState: ChromeState;\n /** Committed pose straight from the adapter, no overlay applied. */\n committedPoseOf(id: string): TPose | null;\n /** Bounds resolver after the `boundsOf` / adapter fallback, before previews. */\n effectiveBoundsOf: ((id: string) => Bounds | null) | undefined;\n previewToolPose(id: string): TPose | null;\n previewToolBounds(id: string): Bounds | null;\n /** Live dispatcher preview extras, for callers outside this bundle. */\n previewExtraRef: React.MutableRefObject<{\n previewPoseExtra: ((id: string) => unknown) | undefined;\n previewIdsExtra: (() => Iterable<string> | null) | undefined;\n }>;\n}\n\n/**\n * Build one view's overlay-aware state: its chrome and the lookups its layers\n * draw and hit-test against.\n *\n * This is a hook, so it runs once per component. That is the point — N views\n * cannot be a loop inside one component, but they can be N components each\n * calling this once.\n */\n/** The composed pose when the adapter resolves one, its stored pose otherwise.\n * Adapters predating `getWorldPose` are absolute-pose, where the two agree. */\nfunction worldPoseOf<TPose>(\n adapter: { getPose(id: string): TPose; getWorldPose?(id: string): TPose },\n id: string,\n): TPose {\n return typeof adapter.getWorldPose === 'function' ? adapter.getWorldPose(id) : adapter.getPose(id);\n}\n\nexport function useViewHelpers<TPose>(\n opts: UseViewHelpersOpts<TPose>,\n): ViewHelpersBundle<TPose> {\n const {\n adapter, geometry, boundsOf, boundsOfPose, selection, tools, gestureSource,\n previewPoseExtra, previewIdsExtra, getIsVisible,\n } = opts;\n const boxOf = useCallback(\n (id: string, pose: TPose): Bounds | null =>\n (boundsOfPose ? boundsOfPose(id, pose) : geometry.getBounds(pose)),\n [boundsOfPose, geometry],\n );\n\n const baseBoundsOf = useMemo(() => {\n if (boundsOf) return boundsOf;\n if (!adapter) return undefined;\n return (id: string): Bounds | null => {\n try {\n // World: chrome is drawn over the picture, so it has to agree with\n // where the renderer put the node, not with where its pose is stored.\n const pose = worldPoseOf(adapter, id);\n const b = geometry.getBounds(pose);\n const rot = geometry.getRotation?.(pose);\n return rot ? { ...b, rotation: rot } : b;\n } catch {\n return null;\n }\n };\n }, [boundsOf, adapter, geometry]);\n\n const committedPoseOf = useCallback((id: string): TPose | null => {\n if (!adapter) return null;\n try {\n return worldPoseOf(adapter, id);\n } catch {\n return null;\n }\n }, [adapter]);\n\n const multiActive = selection.length > 1;\n\n const previewExtraRef = useLatest({ previewPoseExtra, previewIdsExtra });\n\n const effectiveBoundsOf = useMemo(() => boundsOf ?? baseBoundsOf, [boundsOf, baseBoundsOf]);\n\n // The live overlay a gesture proposes for `id`: the active tool's published\n // preview first, then the dispatcher's preview extras. `null` when nothing\n // is mid-gesture — callers fall through to committed state.\n const previewToolPose = useCallback((id: string): TPose | null => {\n if (tools) {\n const p = firstPreviewPose(tools, id);\n if (p != null) return p as TPose;\n }\n const extra = previewExtraRef.current.previewPoseExtra;\n if (extra) {\n const p = extra(id);\n if (p != null) return p as TPose;\n }\n return null;\n }, [tools, previewExtraRef]);\n const previewToolBounds = useCallback((id: string): Bounds | null => {\n if (tools) {\n const b = firstPreviewBounds(tools, id);\n if (b) return b;\n const p = firstPreviewPose(tools, id);\n if (p != null) return boxOf(id, p as TPose);\n }\n const extra = previewExtraRef.current.previewPoseExtra;\n if (extra) {\n const p = extra(id);\n if (p != null) return boxOf(id, p as TPose);\n }\n return null;\n }, [tools, boxOf, previewExtraRef]);\n\n /**\n * Bounds for `id` with any in-flight gesture folded in — what the user can\n * see, not what is committed. Both the chrome state and the layer helpers\n * answer bounds questions with this, so resize handles cannot end up a frame\n * away from the shape they belong to.\n */\n const boundsWithPreview = useCallback((id: string): Bounds | null => {\n const previewed = previewToolBounds(id);\n if (previewed) return previewed;\n return effectiveBoundsOf ? effectiveBoundsOf(id) : null;\n }, [previewToolBounds, effectiveBoundsOf]);\n\n const chromeState: ChromeState = useMemo(\n () => buildChromeState({\n selection,\n multiActive,\n effectiveBoundsOf: boundsWithPreview,\n modifiers: { alt: false, shift: false, meta: false, ctrl: false },\n // Rotation-capability predicate. Reads the committed pose (gestures\n // don't change descriptor capability) and asks the geometry. Absent\n // adapter / unknown ids fall back to `true` so the affordance stays\n // visible — preserves pre-existing behavior for consumers that wire\n // bounds without an adapter.\n canRotate: (id) => {\n if (!geometry.supportsRotation) return true;\n const pose = committedPoseOf(id);\n if (pose == null) return true;\n return geometry.supportsRotation(pose);\n },\n }),\n [selection, multiActive, boundsWithPreview, geometry, committedPoseOf],\n );\n\n const helpers: CanvasViewHelpers<TPose> = {\n getEffectivePose: (id: string): TPose | null => {\n const tp = previewToolPose(id);\n if (tp != null) return tp;\n return committedPoseOf(id);\n },\n getEffectiveBounds: boundsWithPreview,\n getGestureBounds: (): Bounds | null => {\n // In-flight ids come from both preview sources the ghost layer walks:\n // tool-published `previewIds()` and the dispatcher's in-flight handles\n // (via `gestureSource.ids()`). Using the same sets keeps this from\n // disagreeing with what the user sees ghosted.\n const ids = aggregatePreviewIds(tools);\n const extraIds = gestureSource?.ids();\n if (extraIds) for (const id of extraIds) ids.add(id);\n\n const parts: (Bounds | null)[] = [];\n for (const id of ids) parts.push(previewToolBounds(id));\n // Nascent inserts have no id to look up — they arrive as ready-made\n // world AABBs.\n const extraBounds = gestureSource?.bounds();\n if (extraBounds) for (const b of extraBounds) parts.push(b);\n return unionAABB(parts);\n },\n subscribeGestures: (fn: () => void): (() => void) =>\n gestureSource?.subscribe(fn) ?? noOpUnsubscribe,\n getGestureVersion: (): number => gestureSource?.getVersion() ?? 0,\n getChromeState: () => chromeState,\n getPreviewSources: (): readonly GesturePreviewSource[] => [\n ...toolPreviewSources(tools),\n ...(gestureSource?.previewSources() ?? []),\n ],\n getGestureOverlays: (): readonly OngoingOverlay[] => gestureSource?.overlays() ?? [],\n getIsVisible: (): ((id: string) => boolean) => getIsVisible?.() ?? alwaysVisible,\n };\n\n return {\n helpers,\n chromeState,\n committedPoseOf,\n effectiveBoundsOf,\n previewToolPose,\n previewToolBounds,\n previewExtraRef,\n };\n}\n"],"mappings":"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"}
@@ -0,0 +1,17 @@
1
+ import { createContext as e, useContext as t } from "react";
2
+ import { jsx as n } from "react/jsx-runtime";
3
+ //#region src/canvas/viewInputs.tsx
4
+ var r = e(null);
5
+ function i({ value: e, children: t }) {
6
+ return /* @__PURE__ */ n(r.Provider, {
7
+ value: e,
8
+ children: t
9
+ });
10
+ }
11
+ function a() {
12
+ return t(r);
13
+ }
14
+ //#endregion
15
+ export { i as ViewInputsProvider, a as useOptionalViewInputs };
16
+
17
+ //# sourceMappingURL=viewInputs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"viewInputs.js","names":["ViewInputsContext","createContext","ViewInputsProvider","useOptionalViewInputs","useContext"],"sources":["../../src/canvas/viewInputs.tsx"],"sourcesContent":["/**\n * What {@link useViewHelpers} needs that belongs to the surface rather than to\n * one view: the adapter, the geometry, the bounds resolver and the tools.\n *\n * These are read during a view's render, so they travel as context rather than\n * on the `SurfaceHandle`, which is not attached until an effect runs.\n */\nimport { createContext, useContext, type ReactNode } from 'react';\nimport type { UseViewHelpersOpts } from './useViewHelpers';\nimport type { SelectionApi } from 'core/selection/useSelection';\nimport type { NodeId } from 'core/scene/types';\nimport type { View } from 'core/viewport/view';\nimport type { Bounds } from 'core/viewport/fitViewToBounds';\nimport type { PlaneMap } from 'core/viewport/parallax';\nimport type { RuleCtx } from 'features/chrome-caps';\nimport type { PickView } from './SceneCanvas/useSceneSelectTool';\n\n/**\n * The part of a chrome-caps rule context that belongs to one view. Everything\n * else a `RuleCtx` carries — mode, capabilities, device, focus — is the\n * surface's and the same for every view drawn on it.\n */\nexport interface ViewRuleInputs {\n selection: readonly NodeId[];\n view: View;\n /** What that view's dispatcher currently has in flight. */\n action: { kind: string | null; id: string | null };\n}\n\n/**\n * @internal Provided by the surface, consumed by `<CanvasView>`.\n *\n * The scene-shaped half only. What a gesture is doing right now is read from\n * the asking view's own dispatcher, not from here.\n */\nexport interface SurfaceViewInputs\n extends Pick<UseViewHelpersOpts<unknown>, 'adapter' | 'geometry' | 'tools'> {\n /** A node's box for chrome, drawn under `view` — the camera of the view\n * asking, since a node on a parallax plane lands somewhere else in each. */\n boundsOf: ((id: string, view?: View | null) => Bounds | null) | undefined;\n /** How `view`'s world maps into the parallax plane `id` is drawn through,\n * or null when its layer moves with the camera. */\n planeOfNode?: ((id: string, view?: View | null) => PlaneMap | null) | undefined;\n /** `boundsOf` for `id` drawn at an in-flight `pose`, under `view`. */\n boundsOfPose?: ((id: string, pose: unknown, view?: View | null) => Bounds | null) | undefined;\n /** Every id under a world point, bottom-first. `view` is the view the\n * point was produced under — a screen-pixel tolerance cannot be converted\n * without its scale, nor a layer judged without its paint, and the world\n * point carries neither. */\n pickEvery?: (worldX: number, worldY: number, view?: PickView | null) => string[];\n /** The one id a click resolves to, collapsing parent/child the way the\n * select tool does. Falls back to `pickEvery`'s last when absent. */\n pickBest?: (worldX: number, worldY: number, view?: PickView | null) => string | null;\n /** A hit node's routing-trait kind, so `target: 'kind:text'` bindings match. */\n kindOfNode?: (id: string) => string | undefined;\n /**\n * The surface's chrome-caps rule table, evaluated against a view's own\n * context. The rules are surface-wide on purpose — one consumer table, one\n * set of kit defaults — but a rule keyed on selection, camera or the\n * in-flight action answers differently per view, so the caller supplies the\n * context and both the paint gate and the dispatcher's eligibility filter\n * read the same one.\n */\n chromeCaps?: {\n /** `undefined` when the surface gates nothing — no mode registry wired,\n * which is what `<SceneCanvas>` reports for its own view too. */\n ruleCtx(inputs: ViewRuleInputs): RuleCtx | undefined;\n isVisible(inputs: ViewRuleInputs): (id: string) => boolean;\n };\n /** The surface's selection, which a view shares unless it was given one of\n * its own. */\n selectionApi: SelectionApi;\n /** The rotate badge the surface's selection overlay paints, which every\n * view drawing that overlay has to make grabbable where it is drawn. */\n rotationBadge?: { distancePx: number; sizePx: number } | null;\n}\n\nconst ViewInputsContext = createContext<SurfaceViewInputs | null>(null);\n\n/** @internal */\nexport function ViewInputsProvider(\n { value, children }: { value: SurfaceViewInputs; children: ReactNode },\n) {\n return <ViewInputsContext.Provider value={value}>{children}</ViewInputsContext.Provider>;\n}\n\n/** The hosting surface's view-helper inputs, or `null` outside one. */\nexport function useOptionalViewInputs(): SurfaceViewInputs | null {\n return useContext(ViewInputsContext);\n}\n"],"mappings":";;;AA6EA,IAAMA,IAAoBC,EAAwC,IAAI;AAGtE,SAAgBC,EACd,EAAE,UAAO,eACT;CACA,OAAO,kBAACF,EAAkB,UAAnB;EAAmC;EAAQ;CAAqC,CAAA;AACzF;AAGA,SAAgBG,IAAkD;CAChE,OAAOC,EAAWJ,CAAiB;AACrC"}
@@ -0,0 +1,61 @@
1
+ import { createViewResolver as e } from "../features/viewports/viewResolver.js";
2
+ import { createContext as t, useContext as n, useMemo as r, useRef as i } from "react";
3
+ import { jsx as a } from "react/jsx-runtime";
4
+ //#region src/canvas/viewRegistry.tsx
5
+ var o = t(null);
6
+ function s({ children: t }) {
7
+ let n = i(/* @__PURE__ */ new Map()), s = i(0), c = i(0), d = i(/* @__PURE__ */ new Set()), f = i(null), p = r(() => {
8
+ let t = () => {
9
+ c.current++;
10
+ for (let e of d.current) e();
11
+ }, r = () => [...n.current.keys()].sort((e, t) => e.order - t.order || n.current.get(e) - n.current.get(t));
12
+ return {
13
+ resolver: e({
14
+ views: () => {
15
+ let e = f.current, t = e?.view() ?? u, n = e?.dims() ?? l;
16
+ return r().filter((e) => e.interactive).map((e) => e.layer.resolvable(t, n));
17
+ },
18
+ root: () => f.current?.view() ?? u,
19
+ canvasOrigin: () => f.current?.origin() ?? {
20
+ left: 0,
21
+ top: 0
22
+ },
23
+ occluded: (e, t) => f.current?.claimsAbove(e, t) ?? !1
24
+ }),
25
+ register: (e) => (n.current.set(e, s.current++), t(), () => {
26
+ n.current.delete(e), t();
27
+ }),
28
+ list: r,
29
+ getVersion: () => c.current,
30
+ subscribe: (e) => (d.current.add(e), () => {
31
+ d.current.delete(e);
32
+ }),
33
+ surface: () => f.current,
34
+ attachSurface: (e) => {
35
+ f.current = e;
36
+ }
37
+ };
38
+ }, []);
39
+ return /* @__PURE__ */ a(o.Provider, {
40
+ value: p,
41
+ children: t
42
+ });
43
+ }
44
+ function c() {
45
+ return n(o);
46
+ }
47
+ var l = {
48
+ width: 0,
49
+ height: 0
50
+ }, u = {
51
+ x: 0,
52
+ y: 0,
53
+ scale: {
54
+ x: 1,
55
+ y: 1
56
+ }
57
+ };
58
+ //#endregion
59
+ export { u as IDENTITY_VIEW, l as UNMEASURED_DIMS, s as ViewRegistryProvider, c as useOptionalViewRegistry };
60
+
61
+ //# sourceMappingURL=viewRegistry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"viewRegistry.js","names":["ViewRegistryContext","createContext","ViewRegistryProvider","entriesRef","useRef","seqRef","versionRef","listenersRef","surfaceRef","registry","useMemo","changed","fn","ordered","a","b","createViewResolver","surface","view","IDENTITY_VIEW","dims","UNMEASURED_DIMS","r","x","y","reg","handle","useOptionalViewRegistry","useContext"],"sources":["../../src/canvas/viewRegistry.tsx"],"sourcesContent":["/**\n * The seam between a canvas surface and the views drawn on it.\n *\n * Traffic runs both ways: the surface attaches a handle onto its frame and its\n * layer stack, and each view registers what it contributes back — the viewport\n * node it paints into and the record the gesture dispatcher routes its events\n * to. Both sides are thunks, read at draw and dispatch time, so neither can\n * serve the other a frame that has already moved.\n */\nimport { createContext, useContext, useMemo, useRef, type ReactNode } from 'react';\nimport type { Dims, RenderLayer } from 'core/layers/render';\nimport type { LayerHit } from 'affordances/types';\nimport type { ChromeState } from 'core/selection/chromeState';\nimport type { View } from 'core/viewport/view';\nimport type { ViewportLayer } from 'features/viewports/viewportLayer';\nimport type { DispatcherViewTarget } from '@weasel-js/routing/internal';\nimport { createViewResolver, type ViewResolver } from 'features/viewports/viewResolver';\n\n/**\n * What a view needs from the surface hosting it.\n *\n * @internal Attached by the surface, read by `<CanvasView>`.\n */\nexport interface SurfaceHandle {\n /** Client-space origin of the canvas element. */\n origin(): { left: number; top: number };\n /** The outer camera. */\n view(): View;\n /** The canvas's CSS-pixel size. */\n dims(): Dims;\n /** The stack a view paints through its own camera, unless it narrows it. */\n layers(): readonly RenderLayer<unknown>[];\n requestRedraw(): void;\n /** The canvas's own view chrome — its selection, its overlay-aware bounds.\n * What a `<CanvasView>` answers for itself, answered for view zero. */\n chromeState(): ChromeState;\n /** Hit-test the externally registered layers at a world point, against the\n * frame and draw envelope of whichever view is asking. The public\n * `hitTestExtras` is this with the canvas's own frame and envelope. */\n hitTestExtras(\n worldX: number,\n worldY: number,\n view: View,\n dims: Dims,\n data: unknown,\n /** Consider only these layers — the ones the asking view paints. A layer\n * asked on a frame it was not drawn in answers for the wrong pixels. */\n only?: readonly RenderLayer<unknown>[],\n ): { layerId: string; hit: LayerHit } | null;\n /** Whether a registered layer claims a canvas-local point on the surface's\n * own frame. Registered layers paint over every view, so such a point is\n * theirs even inside a view's rect. */\n claimsAbove(x: number, y: number): boolean;\n}\n\n/**\n * What one view contributes to the surface hosting it.\n *\n * @internal Written by `<CanvasView>`, read by the surface. Consumers declare\n * a view, not a registration.\n */\nexport interface ViewRegistration {\n id: string;\n /**\n * Paint and hit order, low to high. Views declared as props take their array\n * index; a view mounted as a child takes `Infinity`, so it lands after them\n * however React happens to order the mount effects.\n */\n order: number;\n /** The viewport node this view paints into. Its `resolvable` is what routes\n * input here. */\n layer: ViewportLayer<unknown>;\n /** `false` keeps input over the view on the canvas beneath it. */\n interactive: boolean;\n /** `false` leaves `layer` for a host to draw — a HUD window's interior — so\n * the surface does not paint it too. */\n paint: boolean;\n /** Everything about dispatching to this view except its id. */\n target: Omit<DispatcherViewTarget, 'id'>;\n /** Whether a scene layer reaches the screen in this view. For input that\n * reaches a view without a dispatch — hover — so it judges this view's\n * paint rather than the surface's. */\n layerIsPainted(layerId: string): boolean;\n}\n\n/** @internal */\nexport interface ViewRegistry {\n /** Returns an unregister. */\n register(reg: ViewRegistration): () => void;\n /** Live registrations in paint order. */\n list(): readonly ViewRegistration[];\n /** Bumped whenever the list changes. Pair with {@link ViewRegistry.subscribe}\n * for `useSyncExternalStore`. */\n getVersion(): number;\n subscribe(fn: () => void): () => void;\n /** Which view a client point belongs to, sticky for a captured pointer.\n * One per surface: every caller that routes input — the dispatcher, pinch,\n * hover — must agree about where a point landed. */\n readonly resolver: ViewResolver;\n /** The hosting surface, or `null` before one attaches. */\n surface(): SurfaceHandle | null;\n attachSurface(handle: SurfaceHandle): void;\n}\n\nconst ViewRegistryContext = createContext<ViewRegistry | null>(null);\n\n/** Mounts the registry for one surface. `<SceneCanvas>` mounts one; a view\n * declaring itself as a child must be inside it. */\nexport function ViewRegistryProvider({ children }: { children: ReactNode }) {\n const entriesRef = useRef(new Map<ViewRegistration, number>());\n const seqRef = useRef(0);\n const versionRef = useRef(0);\n const listenersRef = useRef(new Set<() => void>());\n const surfaceRef = useRef<SurfaceHandle | null>(null);\n\n const registry = useMemo<ViewRegistry>(() => {\n const changed = (): void => {\n versionRef.current++;\n for (const fn of listenersRef.current) fn();\n };\n const ordered = (): ViewRegistration[] => [...entriesRef.current.keys()].sort((a, b) => (\n a.order - b.order || entriesRef.current.get(a)! - entriesRef.current.get(b)!\n ));\n const resolver = createViewResolver({\n views: () => {\n const surface = surfaceRef.current;\n const view = surface?.view() ?? IDENTITY_VIEW;\n const dims = surface?.dims() ?? UNMEASURED_DIMS;\n return ordered().filter((r) => r.interactive).map((r) => r.layer.resolvable(view, dims));\n },\n root: () => surfaceRef.current?.view() ?? IDENTITY_VIEW,\n canvasOrigin: () => surfaceRef.current?.origin() ?? { left: 0, top: 0 },\n occluded: (x, y) => surfaceRef.current?.claimsAbove(x, y) ?? false,\n });\n return {\n resolver,\n register: (reg) => {\n entriesRef.current.set(reg, seqRef.current++);\n changed();\n return () => { entriesRef.current.delete(reg); changed(); };\n },\n list: ordered,\n getVersion: () => versionRef.current,\n subscribe: (fn) => {\n listenersRef.current.add(fn);\n return () => { listenersRef.current.delete(fn); };\n },\n surface: () => surfaceRef.current,\n attachSurface: (handle) => { surfaceRef.current = handle; },\n };\n }, []);\n\n return <ViewRegistryContext.Provider value={registry}>{children}</ViewRegistryContext.Provider>;\n}\n\n/** The surface's view registry, or `null` outside one. */\nexport function useOptionalViewRegistry(): ViewRegistry | null {\n return useContext(ViewRegistryContext);\n}\n\n/** The `Dims` a surface reports before it has measured itself. */\nexport const UNMEASURED_DIMS: Dims = { width: 0, height: 0 };\n\n/** The camera a view resolves against before its surface attaches. */\nexport const IDENTITY_VIEW: View = { x: 0, y: 0, scale: { x: 1, y: 1 } };\n"],"mappings":";;;;AAwGA,IAAMA,IAAsBC,EAAmC,IAAI;AAInE,SAAgBC,EAAqB,EAAE,eAAqC;CAC1E,IAAMC,IAAaC,kBAAO,IAAI,IAA8B,CAAC,GACvDC,IAASD,EAAO,CAAC,GACjBE,IAAaF,EAAO,CAAC,GACrBG,IAAeH,kBAAO,IAAI,IAAgB,CAAC,GAC3CI,IAAaJ,EAA6B,IAAI,GAE9CK,IAAWC,QAA4B;EAC3C,IAAMC,UAAsB;GAC1B,EAAW;GACX,KAAK,IAAMC,KAAML,EAAa,SAAS,EAAG;EAC5C,GACMM,UAAoC,CAAC,GAAGV,EAAW,QAAQ,KAAK,CAAC,CAAC,CAAC,MAAM,GAAG,MAChFW,EAAE,QAAQC,EAAE,SAASZ,EAAW,QAAQ,IAAIW,CAAC,IAAKX,EAAW,QAAQ,IAAIY,CAAC,CAC3E;EAYD,OAAO;GACL,UAZeC,EAAmB;IAClC,aAAa;KACX,IAAMC,IAAUT,EAAW,SACrBU,IAAOD,GAAS,KAAK,KAAKE,GAC1BC,IAAOH,GAAS,KAAK,KAAKI;KAChC,OAAOR,EAAQ,CAAC,CAAC,QAAQ,MAAMS,EAAE,WAAW,CAAC,CAAC,KAAK,MAAMA,EAAE,MAAM,WAAWJ,GAAME,CAAI,CAAC;IACzF;IACA,YAAYZ,EAAW,SAAS,KAAK,KAAKW;IAC1C,oBAAoBX,EAAW,SAAS,OAAO,KAAK;KAAE,MAAM;KAAG,KAAK;IAAE;IACtE,WAAW,GAAG,MAAMA,EAAW,SAAS,YAAYe,GAAGC,CAAC,KAAK;GAC/D,CAEE;GACA,WAAW,OACTrB,EAAW,QAAQ,IAAIsB,GAAK,EAAO,SAAS,GAC5Cd,EAAQ,SACK;IAAkC,AAAhCR,EAAW,QAAQ,OAAOsB,CAAG,GAAGd,EAAQ;GAAG;GAE5D,MAAME;GACN,kBAAkBP,EAAW;GAC7B,YAAY,OACVC,EAAa,QAAQ,IAAIK,CAAE,SACd;IAAE,EAAa,QAAQ,OAAOA,CAAE;GAAG;GAElD,eAAeJ,EAAW;GAC1B,gBAAgB,MAAW;IAAE,EAAW,UAAUkB;GAAQ;EAC5D;CACF,GAAG,CAAC,CAAC;CAEL,OAAO,kBAAC1B,EAAoB,UAArB;EAA8B,OAAOS;EAAW;CAAuC,CAAA;AAChG;AAGA,SAAgBkB,IAA+C;CAC7D,OAAOC,EAAW5B,CAAmB;AACvC;AAGA,IAAaqB,IAAwB;CAAE,OAAO;CAAG,QAAQ;AAAE,GAG9CF,IAAsB;CAAE,GAAG;CAAG,GAAG;CAAG,OAAO;EAAE,GAAG;EAAG,GAAG;CAAE;AAAE"}
@@ -0,0 +1,14 @@
1
+ import { wrapWithPoseRotation as e } from "./poseRotation.js";
2
+ //#region src/canvas/wrapNodeOutput.ts
3
+ function t(t, n, r) {
4
+ let i = e(t, n);
5
+ return r !== 1 && i.length > 0 ? [{
6
+ kind: "group",
7
+ alpha: r,
8
+ children: i
9
+ }] : i;
10
+ }
11
+ //#endregion
12
+ export { t as wrapNodeOutput };
13
+
14
+ //# sourceMappingURL=wrapNodeOutput.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"wrapNodeOutput.js","names":["wrapNodeOutput","rotated","wrapWithPoseRotation","cmds","pose","alpha"],"sources":["../../src/canvas/wrapNodeOutput.ts"],"sourcesContent":["/**\n * The per-node wraps a scene render applies on top of whatever `drawOne`\n * returned — pose rotation, then a per-id alpha multiplier. They sit outside\n * `drawOne` on purpose: consumer-supplied painters get rotation and dimming\n * without having to reimplement either.\n *\n * Shared by the main canvas (`buildSceneLayer`) and the detached renders\n * (`buildSceneViewCommands`) so a scene painted off-screen matches the same\n * scene painted on it.\n */\nimport type { DrawCommand } from '../renderer';\nimport { wrapWithPoseRotation } from './poseRotation';\n\n/** Rotate `cmds` about the pose's AABB center and multiply by `alpha`.\n * Both wraps are skipped when they would be no-ops (zero/absent rotation,\n * alpha exactly 1, empty command list), so an upright opaque node emits the\n * painter's commands untouched. Alpha nests OUTSIDE rotation. */\nexport function wrapNodeOutput(\n cmds: DrawCommand[],\n pose: unknown,\n alpha: number,\n): DrawCommand[] {\n const rotated = wrapWithPoseRotation(cmds, pose);\n if (alpha !== 1 && rotated.length > 0) {\n return [{ kind: 'group', alpha, children: rotated }];\n }\n return rotated;\n}\n"],"mappings":";;AAiBA,SAAgBA,EACd,GACA,GACA,GACe;CACf,IAAMC,IAAUC,EAAqBC,GAAMC,CAAI;CAI/C,OAHIC,MAAU,KAAKJ,EAAQ,SAAS,IAC3B,CAAC;EAAE,MAAM;EAAS;EAAO,UAAUA;CAAQ,CAAC,IAE9CA;AACT"}
@@ -1,7 +1,7 @@
1
1
  import { NodeId } from '@weasel-js/routing';
2
- import { C as ClipboardSnapshot, I as InsertAdapter } from './types-D-9QWBy5.js';
2
+ import { j as ClipboardSnapshot, I as InsertAdapter } from './types-A37hYkeR.js';
3
3
  import '@weasel-js/history';
4
- import './path-JEV2c5If.js';
4
+ import '@weasel-js/geom';
5
5
 
6
6
  type Replacer$1 = (key: string, value: unknown) => unknown;
7
7
  /** Options for `useClipboardOps`. */
@@ -26,12 +26,17 @@ interface UseClipboardOpsOptions {
26
26
  * `application/x-weasel-clipboard+json` plus `text/plain` carrying the
27
27
  * same JSON. Apps override to add richer flavors (e.g. real SVG) or to
28
28
  * replace the text flavor. Return an empty object to skip the OS write
29
- * entirely. */
30
- produceFlavors?: (snapshot: ClipboardSnapshot) => Record<string, string>;
29
+ * entirely. A value may be a promise — an SVG flavor waiting on
30
+ * `warmSvg`, say: the write is still issued inside the copy gesture and
31
+ * the clipboard takes the text when it resolves. The producer itself runs
32
+ * synchronously, so it reads the selection as it stood at the copy. */
33
+ produceFlavors?: (snapshot: ClipboardSnapshot) => ClipboardFlavors;
31
34
  /** Replacer for the kit-default JSON flavor (typed arrays etc.). Ignored
32
35
  * when `produceFlavors` is supplied. */
33
36
  jsonReplacer?: Replacer$1;
34
37
  }
38
+ /** MIME type to payload, as `produceFlavors` returns it. */
39
+ type ClipboardFlavors = Record<string, string | Promise<string>>;
35
40
  /** Return shape of `useClipboardOps`: imperative `copy`, `paste`, and `isEmpty` functions. */
36
41
  interface UseClipboardOpsReturn {
37
42
  copy(): void;
@@ -91,4 +96,4 @@ declare function extractWeaselClipboardFromSvg(svgText: string): string | null;
91
96
  * (callers decline to the next content handler). */
92
97
  declare function parseWeaselClipboardText(text: string, reviver?: Reviver): unknown[] | null;
93
98
 
94
- export { type UseClipboardOpsOptions, type UseClipboardOpsReturn, WEASEL_CLIPBOARD_MIME, WEASEL_CLIPBOARD_MIME_WEB, buildWeaselClipboardText, embedWeaselMetadataInSvg, extractWeaselClipboardFromSvg, parseWeaselClipboardText, sniffWeaselClipboardText, useClipboardOps };
99
+ export { type ClipboardFlavors, type UseClipboardOpsOptions, type UseClipboardOpsReturn, WEASEL_CLIPBOARD_MIME, WEASEL_CLIPBOARD_MIME_WEB, buildWeaselClipboardText, embedWeaselMetadataInSvg, extractWeaselClipboardFromSvg, parseWeaselClipboardText, sniffWeaselClipboardText, useClipboardOps };
package/dist/clipboard.js CHANGED
@@ -1,5 +1,3 @@
1
- export { WEASEL_CLIPBOARD_MIME, WEASEL_CLIPBOARD_MIME_WEB, buildWeaselClipboardText, embedWeaselMetadataInSvg, extractWeaselClipboardFromSvg, parseWeaselClipboardText, sniffWeaselClipboardText, useClipboardOps } from './chunk-WPNA6L5O.js';
2
- import './chunk-UPZY4ART.js';
3
- import './chunk-NE27EOLP.js';
4
- //# sourceMappingURL=clipboard.js.map
5
- //# sourceMappingURL=clipboard.js.map
1
+ import { WEASEL_CLIPBOARD_MIME as e, WEASEL_CLIPBOARD_MIME_WEB as t, buildWeaselClipboardText as n, embedWeaselMetadataInSvg as r, extractWeaselClipboardFromSvg as i, parseWeaselClipboardText as a, sniffWeaselClipboardText as o } from "./interactions/actions/clipboard/wireFormat.js";
2
+ import { useClipboardOps as s } from "./interactions/actions/clipboard/clipboardOps.js";
3
+ export { e as WEASEL_CLIPBOARD_MIME, t as WEASEL_CLIPBOARD_MIME_WEB, n as buildWeaselClipboardText, r as embedWeaselMetadataInSvg, i as extractWeaselClipboardFromSvg, a as parseWeaselClipboardText, o as sniffWeaselClipboardText, s as useClipboardOps };
package/dist/clone.d.ts CHANGED
@@ -1,7 +1,7 @@
1
- import { C as CloneBehavior } from './types-qYpyTAiZ.js';
1
+ import { C as CloneBehavior } from './types-B_9g6hMM.js';
2
+ import './types-A37hYkeR.js';
2
3
  import '@weasel-js/history';
3
- import './types-D-9QWBy5.js';
4
- import './path-JEV2c5If.js';
4
+ import '@weasel-js/geom';
5
5
  import '@weasel-js/routing';
6
6
 
7
7
  /** Clone-on-alt-drag behavior for `useClone`; activates when Alt/Option is held at drag start. */
package/dist/clone.js CHANGED
@@ -1,5 +1,2 @@
1
- export { cloneByAltDrag } from './chunk-M24CLARN.js';
2
- import './chunk-UPZY4ART.js';
3
- import './chunk-NE27EOLP.js';
4
- //# sourceMappingURL=clone.js.map
5
- //# sourceMappingURL=clone.js.map
1
+ import { cloneByAltDrag as e } from "./interactions/actions/clone/behaviors/cloneByAltDrag.js";
2
+ export { e as cloneByAltDrag };
@@ -0,0 +1,85 @@
1
+ import { RECT_POSE_DESCRIPTOR as e, poseDescriptorForNode as t, translatePoseViaDescriptor as n } from "../geometry/poseDescriptor.js";
2
+ import { applyOpsTo as r } from "../applyOps.js";
3
+ import { polygonRegion as i, poseOutline as a, rectRegion as o, regionBoundsOf as s, regionTakes as c } from "../geometry/regionHit.js";
4
+ //#region src/core/adapters/arrayAdapter.ts
5
+ function l(e, t) {
6
+ return {
7
+ ...e,
8
+ ...t
9
+ };
10
+ }
11
+ var u = 0;
12
+ function d() {
13
+ let e = globalThis.crypto;
14
+ return e && typeof e.randomUUID == "function" ? e.randomUUID() : `paste-${u++}`;
15
+ }
16
+ function f(u) {
17
+ let { ref: f, setItems: p, toPose: m, fromPose: h = l, getParent: g = () => null, setParent: _ = () => {}, getChildren: v, selectionRef: y, setSelection: b = () => {}, createDefault: x, nextId: S = d, silhouette: C } = u, w = u.poseDescriptor ?? e, T = y ? () => y.current : () => [], E = (e, n) => {
18
+ let r = [];
19
+ for (let i of f.current) {
20
+ let o = m(i), l = s(i, o, t(w, i));
21
+ c(e, n, o, l, () => C?.(i, o) ?? a(o, l)) && r.push(i.id);
22
+ }
23
+ return r;
24
+ }, D = {
25
+ getNode: (e) => f.current.find((t) => t.id === e),
26
+ getNodes: () => f.current,
27
+ getPose: (e) => {
28
+ let t = f.current.find((t) => t.id === e);
29
+ if (!t) throw Error(`arrayAdapter.getPose: id "${e}" not found`);
30
+ return m(t);
31
+ },
32
+ setPose: (e, t) => {
33
+ p((n) => n.map((n) => n.id === e ? h(n, t) : n));
34
+ },
35
+ getParent: g,
36
+ setParent: _,
37
+ insertNode: (e, t) => p((n) => t === void 0 || t < 0 || t >= n.length ? [...n, e] : [
38
+ ...n.slice(0, t),
39
+ e,
40
+ ...n.slice(t)
41
+ ]),
42
+ removeNode: (e) => p((t) => t.filter((t) => t.id !== e)),
43
+ getSelection: T,
44
+ setSelection: b,
45
+ hitTestArea: (e) => E(o(e), "intersect"),
46
+ hitTestLasso: (e, t) => {
47
+ let n = i(e);
48
+ return n ? E(n, t) : [];
49
+ },
50
+ applyOps(e) {
51
+ r(this, e);
52
+ },
53
+ commitInsert: x ? (e) => x(e) : () => null,
54
+ commitPaste: (e, r, i) => {
55
+ let a = e.items;
56
+ if (a.length === 0) return [];
57
+ let o = r.dx, s = r.dy;
58
+ if (i?.dropPoint) {
59
+ let e = Infinity, n = Infinity, r = -Infinity, c = -Infinity;
60
+ for (let i of a) {
61
+ let a = t(w, i).getBounds(m(i));
62
+ a.x < e && (e = a.x), a.y < n && (n = a.y), a.x + a.width > r && (r = a.x + a.width), a.y + a.height > c && (c = a.y + a.height);
63
+ }
64
+ if (Number.isFinite(e) && Number.isFinite(n)) {
65
+ let t = (e + r) / 2, a = (n + c) / 2;
66
+ o = i.dropPoint.worldX - t, s = i.dropPoint.worldY - a;
67
+ }
68
+ }
69
+ let c = [];
70
+ for (let e of a) {
71
+ let r = JSON.parse(JSON.stringify(e));
72
+ r.id = S();
73
+ let i = n(m(r), o, s, t(w, r));
74
+ c.push(h(r, i));
75
+ }
76
+ return c;
77
+ },
78
+ snapshotSelection: (e) => ({ items: e.map((e) => f.current.find((t) => t.id === e)).filter((e) => !!e) })
79
+ };
80
+ return v && (D.getChildren = (e) => e === null ? f.current.filter((e) => g(e.id) === null).map((e) => e.id) : v(e) ?? []), D;
81
+ }
82
+ //#endregion
83
+ export { f as arrayAdapter };
84
+
85
+ //# sourceMappingURL=arrayAdapter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"arrayAdapter.js","names":["defaultFromPose","obj","pose","monotonicPasteCounter","defaultNextId","c","arrayAdapter","config","d","RECT_POSE_DESCRIPTOR","getSelection","selectionRef","takenBy","out","o","ref","toPose","b","regionBoundsOf","poseDescriptorForNode","regionTakes","region","mode","silhouette","poseOutline","adapter","id","items","fromPose","setItems","index","rectRegion","rect","polygonRegion","polygon","ops","createDefault","src","clip","dx","offset","dy","ctx","minX","minY","maxX","maxY","n","cx","cy","cloned","nextId","translated","translatePoseViaDescriptor","ids","getChildren","parentId","getParent"],"sources":["../../../src/core/adapters/arrayAdapter.ts"],"sourcesContent":["import type { MutableRefObject } from 'react';\nimport type {\n AreaSelectAdapter,\n InsertAdapter,\n LassoHitMode,\n LassoSelectAdapter,\n MoveAdapter,\n ResizeAdapter,\n} from './types';\nimport type { Op } from '../ops/types';\nimport { applyOpsTo } from '../applyOps';\nimport type { Bounds } from '../viewport/fitViewToBounds';\nimport type { ClipboardSnapshot } from './types';\nimport {\n poseDescriptorForNode,\n translatePoseViaDescriptor,\n RECT_POSE_DESCRIPTOR,\n type PoseDescriptor,\n} from 'core/geometry/poseDescriptor';\nimport type { Path } from '@weasel-js/geom';\nimport {\n polygonRegion,\n poseOutline,\n rectRegion,\n regionBoundsOf,\n regionTakes,\n type SelectRegion,\n} from 'core/geometry/regionHit';\n\n/** Configuration for `arrayAdapter`. */\nexport interface ArrayAdapterConfig<TNode extends { id: string }, TPose> {\n /** Live ref to the current array. */\n ref: MutableRefObject<TNode[]>;\n /** Functional setter (typically the second value from `useState`). */\n setItems: (updater: (items: TNode[]) => TNode[]) => void;\n /** Project an object to its pose. Required. */\n toPose: (obj: TNode) => TPose;\n /** Merge a new pose back into an object. Default: shallow spread. */\n fromPose?: (obj: TNode, pose: TPose) => TNode;\n /** Optional parent lookup. Default returns `null`. */\n getParent?: (id: string) => string | null;\n /** Optional reparent mutator. Default is a noop. */\n setParent?: (id: string, parentId: string | null) => void;\n /** Optional children lookup for a node id. The adapter answers the root\n * itself, from `ref` and `getParent` in array order, so this is never\n * called with `null`. Default omits the method entirely. */\n getChildren?: (id: string) => string[] | undefined;\n\n /** Live ref to the current selection. Default: empty array. */\n selectionRef?: MutableRefObject<string[]>;\n /** Selection setter. Default: noop. */\n setSelection?: (ids: string[]) => void;\n\n /** Factory for `commitInsert` — invoked at the end of an insert drag.\n * Consumers own id generation and any palette/payload fields. Returning\n * `null` aborts the insert. When omitted, `commitInsert` returns `null`. */\n createDefault?: (bounds: Bounds) => TNode | null;\n\n /** How to read and rewrite item poses. Default `RECT_POSE_DESCRIPTOR`,\n * which reads the pose as its own AABB — the canonical axis-aligned rect\n * pose. `AUTO_POSE_DESCRIPTOR` lives above `core/` and so cannot be the\n * default here; pass it for a scene whose poses may be Paths. */\n poseDescriptor?: PoseDescriptor<TPose>;\n\n /** The outline a node draws, for marquee and lasso, in world coordinates.\n * Return `null` where the pose says it all. Default: none — a polygon pose\n * is its own outline, and anything else is its pose rect, rotated by\n * `rotation`. The kit's painters live above `core/`, so a scene whose\n * nodes they draw passes `findShapeSilhouette` to be tested as drawn. */\n silhouette?: (node: TNode, pose: TPose) => Path | null;\n\n /** Factory for fresh node ids in `commitPaste`. Default: `crypto.randomUUID()`\n * when available, otherwise a monotonic `paste-<n>` counter. Override\n * when consumers want stable id schemes (e.g. `clip-${n++}`). */\n nextId?: () => string;\n}\n\n/**\n * Combined adapter satisfying every narrow adapter the kit ships. Methods\n * with no default implementation (e.g. `commitInsert` without\n * `createDefault`) return null/[]/noop — sufficient to typecheck against\n * `InsertAdapter`/`AreaSelectAdapter`, and the corresponding gesture hook\n * simply produces no commit.\n */\nexport interface ArrayAdapter<TNode extends { id: string }, TPose>\n extends MoveAdapter<TNode, TPose>,\n ResizeAdapter<TNode, TPose>,\n InsertAdapter<TNode>,\n AreaSelectAdapter,\n LassoSelectAdapter {\n getNodes(): TNode[];\n removeNode(id: string): void;\n // ArrayAdapter satisfies the union of all narrow adapters; redeclare the\n // methods that are optional on AreaSelectAdapter (post-relaxation) but\n // required on InsertAdapter so TS sees a single non-conflicting signature.\n getSelection(): string[];\n setSelection(ids: string[]): void;\n // Redeclare applyOps with an optional label so it's compatible with both\n // MoveAdapter (label required) and AreaSelectAdapter (label absent = transient).\n applyOps?(ops: Op[], label?: string): void;\n}\n\nfunction defaultFromPose<TNode extends { id: string }, TPose>(\n obj: TNode,\n pose: TPose,\n): TNode {\n return { ...obj, ...(pose as object) } as TNode;\n}\n\nlet monotonicPasteCounter = 0;\nfunction defaultNextId(): string {\n const c = (globalThis as { crypto?: { randomUUID?: () => string } }).crypto;\n if (c && typeof c.randomUUID === 'function') return c.randomUUID();\n return `paste-${monotonicPasteCounter++}`;\n}\n\n/**\n * Synthesize a many-faceted adapter from a `useState`-array scene. Always\n * satisfies `MoveAdapter`, `ResizeAdapter`, `InsertAdapter`, and\n * `AreaSelectAdapter` via structural typing. Override individual methods by\n * spreading the result.\n *\n * `applyOps` is intentionally omitted — hooks fall back to the built-in\n * dispatcher (see `dispatchApplyBatch`). Apps with custom history\n * integration supply their own via spread.\n */\nexport function arrayAdapter<TNode extends { id: string }, TPose>(\n config: ArrayAdapterConfig<TNode, TPose>,\n): ArrayAdapter<TNode, TPose> {\n const {\n ref,\n setItems,\n toPose,\n fromPose = defaultFromPose,\n getParent = () => null,\n setParent = () => {},\n getChildren,\n selectionRef,\n setSelection = () => {},\n createDefault,\n nextId = defaultNextId,\n silhouette,\n } = config;\n\n const d = (config.poseDescriptor ?? RECT_POSE_DESCRIPTOR) as PoseDescriptor<TPose>;\n\n const getSelection = selectionRef ? () => selectionRef.current : () => [];\n\n const takenBy = (region: SelectRegion, mode: LassoHitMode): string[] => {\n const out: string[] = [];\n for (const o of ref.current) {\n const pose = toPose(o);\n const b = regionBoundsOf(o, pose, poseDescriptorForNode(d, o) as PoseDescriptor<unknown>);\n const outline = (): Path => silhouette?.(o, pose) ?? poseOutline(pose, b);\n if (regionTakes(region, mode, pose, b, outline)) out.push(o.id);\n }\n return out;\n };\n\n const adapter: ArrayAdapter<TNode, TPose> = {\n getNode: (id) => ref.current.find((o) => o.id === id),\n getNodes: () => ref.current,\n getPose: (id) => {\n const obj = ref.current.find((o) => o.id === id);\n if (!obj) throw new Error(`arrayAdapter.getPose: id \"${id}\" not found`);\n return toPose(obj);\n },\n setPose: (id, pose) => {\n setItems((items) => items.map((o) => (o.id === id ? fromPose(o, pose) : o)));\n },\n getParent,\n setParent,\n\n insertNode: (obj, index) => setItems((items) => {\n if (index === undefined || index < 0 || index >= items.length) return [...items, obj];\n return [...items.slice(0, index), obj, ...items.slice(index)];\n }),\n removeNode: (id) => setItems((items) => items.filter((o) => o.id !== id)),\n\n getSelection,\n setSelection,\n\n hitTestArea: (rect) => takenBy(rectRegion(rect), 'intersect'),\n\n hitTestLasso: (polygon, mode: LassoHitMode) => {\n const region = polygonRegion(polygon);\n return region ? takenBy(region, mode) : [];\n },\n\n // Use a method shorthand so `this` is the call-site receiver, not the\n // adapter we're building here. That way consumers can spread additional\n // methods on top (e.g. `{ ...arrayAdapter(...), ...selection.adapterMethods }`)\n // and `applyOps` will dispatch ops against the merged object.\n applyOps(ops: Op[]) {\n applyOpsTo(this, ops);\n },\n\n commitInsert: createDefault ? (b) => createDefault(b) : () => null,\n commitPaste: (\n clip: ClipboardSnapshot,\n offset: { dx: number; dy: number },\n ctx?: { dropPoint?: { worldX: number; worldY: number } },\n ): TNode[] => {\n const src = clip.items as TNode[];\n if (src.length === 0) return [];\n\n // Default translation = `offset`. When `dropPoint` is supplied, center\n // the cluster's union AABB at the drop point — matches the\n // `ClipboardDemo` reference wiring.\n let dx = offset.dx;\n let dy = offset.dy;\n if (ctx?.dropPoint) {\n let minX = Infinity, minY = Infinity, maxX = -Infinity, maxY = -Infinity;\n for (const n of src) {\n const b = poseDescriptorForNode(d, n).getBounds(toPose(n));\n if (b.x < minX) minX = b.x;\n if (b.y < minY) minY = b.y;\n if (b.x + b.width > maxX) maxX = b.x + b.width;\n if (b.y + b.height > maxY) maxY = b.y + b.height;\n }\n // Defensive: if the descriptor returned nothing usable, fall back to offset.\n if (Number.isFinite(minX) && Number.isFinite(minY)) {\n const cx = (minX + maxX) / 2;\n const cy = (minY + maxY) / 2;\n dx = ctx.dropPoint.worldX - cx;\n dy = ctx.dropPoint.worldY - cy;\n }\n }\n\n // Deep-clone via JSON round-trip so the snapshot isn't mutated by\n // downstream pose edits.\n const out: TNode[] = [];\n for (const n of src) {\n const cloned = JSON.parse(JSON.stringify(n)) as TNode;\n (cloned as { id: string }).id = nextId();\n const translated = translatePoseViaDescriptor(\n toPose(cloned), dx, dy, poseDescriptorForNode(d, cloned),\n );\n out.push(fromPose(cloned, translated));\n }\n return out;\n },\n snapshotSelection: (ids) => ({\n items: ids\n .map((id) => ref.current.find((o) => o.id === id))\n .filter((o): o is TNode => !!o),\n }),\n };\n\n if (getChildren) {\n (adapter as ArrayAdapter<TNode, TPose> & {\n getChildren: (parentId: string | null) => string[];\n }).getChildren = (parentId) => {\n // Root order is the item array's order, which this adapter owns — asking\n // the consumer would get a callback written for node ids, and its `[]`\n // is indistinguishable from \"the root has no children\".\n if (parentId === null) {\n return ref.current.filter((o) => getParent(o.id) === null).map((o) => o.id);\n }\n return getChildren(parentId) ?? [];\n };\n }\n\n return adapter;\n}\n"],"mappings":"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"}
@@ -0,0 +1,13 @@
1
+ import { arrayAdapter as e } from "./arrayAdapter.js";
2
+ //#region src/core/adapters/useArrayAdapter.ts
3
+ function t(t) {
4
+ let { items: n, ...r } = t;
5
+ return e({
6
+ ref: { current: n },
7
+ ...r
8
+ });
9
+ }
10
+ //#endregion
11
+ export { t as useArrayAdapter };
12
+
13
+ //# sourceMappingURL=useArrayAdapter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useArrayAdapter.js","names":["useArrayAdapter","rest","options","arrayAdapter","items"],"sources":["../../../src/core/adapters/useArrayAdapter.ts"],"sourcesContent":["import { arrayAdapter, type ArrayAdapter, type ArrayAdapterConfig } from './arrayAdapter';\n\n/** Options for `useArrayAdapter` — same shape as `ArrayAdapterConfig` minus the\n * `ref` field, which the hook manages internally from `items`. */\nexport type UseArrayAdapterOptions<TNode extends { id: string }, TPose> =\n Omit<ArrayAdapterConfig<TNode, TPose>, 'ref' | 'setItems'> & {\n items: TNode[];\n setItems: ArrayAdapterConfig<TNode, TPose>['setItems'];\n };\n\n/** Hook wrapper around `arrayAdapter` over this render's `items`. Eliminates\n * the `useRef + ref.current = items` boilerplate every flat-list scene needs.\n * Returns a fresh adapter each render, reading that render's items — so an\n * adapter a render reads from sees its own items, and the gesture hooks, which\n * hold the latest committed adapter, see the committed ones. */\nexport function useArrayAdapter<TNode extends { id: string }, TPose>(\n options: UseArrayAdapterOptions<TNode, TPose>,\n): ArrayAdapter<TNode, TPose> {\n const { items, ...rest } = options;\n return arrayAdapter<TNode, TPose>({ ref: { current: items }, ...rest });\n}\n"],"mappings":";;AAeA,SAAgBA,EACd,GAC4B;CAC5B,IAAM,EAAE,UAAO,GAAGC,MAASC;CAC3B,OAAOC,EAA2B;EAAE,KAAK,EAAE,SAASC,EAAM;EAAG,GAAGH;CAAK,CAAC;AACxE"}
@@ -0,0 +1,12 @@
1
+ //#region src/core/applyOps.ts
2
+ function e(e, t, n) {
3
+ for (let n of t) n.apply(e);
4
+ }
5
+ function t(t, n, r) {
6
+ let i = t;
7
+ i.applyOps ? i.applyOps(n, r) : e(t, n, r);
8
+ }
9
+ //#endregion
10
+ export { e as applyOpsTo, t as dispatchApplyBatch };
11
+
12
+ //# sourceMappingURL=applyOps.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"applyOps.js","names":["applyOpsTo","op","ops","adapter","dispatchApplyBatch","a","label"],"sources":["../../src/core/applyOps.ts"],"sourcesContent":["import type { Op } from './ops/types';\n\n/**\n * Default `applyOps` implementation: apply each op in order against\n * `adapter`. Used by hooks when an adapter omits `applyOps`. Apps that\n * need history integration (checkpoint + push entry) supply their own\n * `applyOps` instead.\n *\n * The `_label` parameter mirrors the `applyOps(ops, label)` signature so\n * call-sites can dispatch through `(adapter.applyOps ?? applyOpsTo)` with\n * matching arguments. The default ignores it.\n */\nexport function applyOpsTo<A>(adapter: A, ops: Op[], _label?: string): void {\n for (const op of ops) op.apply(adapter);\n}\n\n/**\n * Dispatcher: invokes `adapter.applyOps` if present, otherwise falls back\n * to `applyOpsTo`. Convenience for hooks so they don't repeat the\n * `?? applyOpsTo` pattern at every call site.\n */\nexport function dispatchApplyBatch<A>(\n adapter: A,\n ops: Op[],\n label?: string,\n): void {\n const a = adapter as { applyOps?: (ops: Op[], label?: string) => void };\n if (a.applyOps) a.applyOps(ops, label);\n else applyOpsTo(adapter, ops, label);\n}\n"],"mappings":";AAYA,SAAgBA,EAAc,GAAY,GAAW,GAAuB;CAC1E,KAAK,IAAMC,KAAMC,GAAK,EAAG,MAAMC,CAAO;AACxC;AAOA,SAAgBC,EACd,GACA,GACA,GACM;CACN,IAAMC,IAAIF;CACV,AAAIE,EAAE,WAAUA,EAAE,SAASH,GAAKI,CAAK,IAChCN,EAAWG,GAASD,GAAKI,CAAK;AACrC"}
@@ -0,0 +1,4 @@
1
+ import { DeviceProfileProvider as e, useDeviceProfile as t } from "./useDeviceProfile.js";
2
+ import { ANCHOR_HIT_BASE_PX as n, HANDLE_BASE_PX as r, ROTATION_HANDLE_BASE_PX as i } from "./targets.js";
3
+ import { COARSE_TARGET_SCALE as a, DEFAULT_DEVICE_PROFILE as o, resolveDeviceProfile as s } from "@weasel-js/routing";
4
+ export { n as ANCHOR_HIT_BASE_PX, a as COARSE_TARGET_SCALE, o as DEFAULT_DEVICE_PROFILE, e as DeviceProfileProvider, r as HANDLE_BASE_PX, i as ROTATION_HANDLE_BASE_PX, s as resolveDeviceProfile, t as useDeviceProfile };
@@ -0,0 +1,17 @@
1
+ //#region src/core/device/targets.ts
2
+ var e = {
3
+ handle: 8,
4
+ anchor: 8,
5
+ rotationDistance: 24
6
+ }, t = e.handle, n = e.anchor, r = e.rotationDistance;
7
+ function i(t = 1) {
8
+ return {
9
+ handle: e.handle * t,
10
+ anchor: e.anchor * t,
11
+ rotationDistance: e.rotationDistance * t
12
+ };
13
+ }
14
+ //#endregion
15
+ export { n as ANCHOR_HIT_BASE_PX, t as HANDLE_BASE_PX, r as ROTATION_HANDLE_BASE_PX, i as targetSizesPx };
16
+
17
+ //# sourceMappingURL=targets.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"targets.js","names":["BASE_PX","HANDLE_BASE_PX","ANCHOR_HIT_BASE_PX","ROTATION_HANDLE_BASE_PX","targetSizesPx","targetScale"],"sources":["../../../src/core/device/targets.ts"],"sourcesContent":["/**\n * Base sizes for grabbable chrome, in CSS pixels at `targetScale = 1`, and the\n * one accessor that resolves them for a live pointer type.\n *\n * Paint and hit-test MUST scale together: chrome you can see but cannot grab\n * is the exact failure `chrome-caps` exists to make impossible, and a literal\n * `8` copied into a fifth file is how that failure gets reintroduced. So every\n * kit-internal use site goes through {@link targetSizesPx} — the selection\n * overlay's handle size, `buildAffordanceAt`'s hit radii, and the slops debug\n * overlay all read the same object. The bare constants below stay exported for\n * consumers, who get the unscaled numbers they always got.\n */\n\nconst BASE_PX = {\n handle: 8,\n anchor: 8,\n rotationDistance: 24,\n} as const;\n\n/** Selection corner-handle visual size and hit radius. */\nexport const HANDLE_BASE_PX = BASE_PX.handle;\n\n/** Path anchor / control-point hit radius. */\nexport const ANCHOR_HIT_BASE_PX = BASE_PX.anchor;\n\n/** Distance from a selection's top edge to the rotation handle's center. */\nexport const ROTATION_HANDLE_BASE_PX = BASE_PX.rotationDistance;\n\n/** Grabbable-chrome sizes resolved for one pointer type, in CSS pixels. */\nexport interface TargetSizesPx {\n /** Corner-handle visual size and hit radius. */\n handle: number;\n /** Anchor / control-point hit radius. */\n anchor: number;\n /** Distance from a selection's top edge to the rotation handle's center,\n * which is also the rotate band's minimum thickness. */\n rotationDistance: number;\n}\n\n/**\n * How big is grabbable chrome, in CSS pixels, for this pointer type?\n *\n * `targetScale` comes from the live {@link DeviceProfile} — 1 for a mouse,\n * {@link COARSE_TARGET_SCALE} for touch.\n */\nexport function targetSizesPx(targetScale = 1): TargetSizesPx {\n return {\n handle: BASE_PX.handle * targetScale,\n anchor: BASE_PX.anchor * targetScale,\n rotationDistance: BASE_PX.rotationDistance * targetScale,\n };\n}\n"],"mappings":";AAaA,IAAMA,IAAU;CACd,QAAQ;CACR,QAAQ;CACR,kBAAkB;AACpB,GAGaC,IAAiBD,EAAQ,QAGzBE,IAAqBF,EAAQ,QAG7BG,IAA0BH,EAAQ;AAmB/C,SAAgBI,EAAc,IAAc,GAAkB;CAC5D,OAAO;EACL,QAAQJ,EAAQ,SAASK;EACzB,QAAQL,EAAQ,SAASK;EACzB,kBAAkBL,EAAQ,mBAAmBK;CAC/C;AACF"}