@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 @@
1
+ {"version":3,"file":"prefs.js","names":["prefUnit","self","unitScale","system","display","scale","opts","suffix","accepts","name","other","factor","offset","shown","stored","formatUnit","TOOL_PREF_KINDS","isBuiltinToolPref","leaf"],"sources":["../../src/tools/prefs.ts"],"sourcesContent":["// src/tools/prefs.ts\n//\n// Minimal pref descriptor for tools that want to expose user-facing\n// settings (commit-on-close, snap thresholds, etc.). Host apps compose\n// these into their own preferences registry; the kit ships no storage\n// or UI of its own. The shape is intentionally narrow — number,\n// boolean, string, enum, plus rendering hints — so it's a clean\n// structural subset of whatever a host app already has.\n\nimport { formatUnit, unitScale } from '@weasel-js/quantity';\nimport type { Display, Unit, UnitEntry, UnitScale, UnitSystem } from '@weasel-js/quantity';\n\n/** The value types a built-in pref leaf can hold. */\nexport type ToolPrefKind =\n | 'number' | 'boolean' | 'string' | 'enum' | 'color' | 'paint' | 'object';\n\n/** The fields every leaf pref shares, keyed by its `kind` and typed by its stored value. */\nexport interface ToolPrefBase<K extends string, Value> {\n kind: K;\n /** Human-readable label. */\n name: string;\n /** Longer help text — shown in tooltips / a settings pane. */\n description: string;\n /** Fallback when nothing is persisted. */\n default: Value;\n /** Hide from a host app's settings UI by default. */\n hidden?: boolean;\n /** Render full-width with no label row in schema-driven settings UIs\n * (weasel-ui `PrefsForm` honors this for leaves whose control brings\n * its own chrome). */\n block?: boolean;\n /** Glyph naming this leaf in a host UI's icon set (weasel-ui resolves it\n * against `ICON_PATHS`). A plain string because core ships no icon set and\n * cannot depend on one. Read where a leaf's `name` has nowhere to go — a\n * `pair`ed row is labeled by the pair, so its fields have only the glyph\n * to tell them apart. */\n icon?: string;\n /** Row-pairing hint for compact property UIs (weasel-ui\n * `SelectionPanel`): leaves sharing a `pair` id render side-by-side\n * on one row labeled with the `pair` string (e.g. `'Position'` for\n * `pose.x` / `pose.y`). Purely presentational. */\n pair?: string;\n /** The label a surface with no room for `name` shows instead — a strip of\n * controls on one line, or a segment in a `pair`ed row. `name` stays the\n * accessible name, so this abbreviates without costing anything. */\n short?: string;\n}\n\n/** How a schema-driven UI should present a number pref. */\nexport type ToolPrefNumberControl = 'input' | 'slider';\n/** How a schema-driven UI should present a boolean pref. */\nexport type ToolPrefBooleanControl = 'checkbox' | 'switch' | 'toggle';\n/** How a schema-driven UI should present a string pref. */\nexport type ToolPrefStringControl = 'input' | 'textarea';\n/** How a schema-driven UI should present an enum pref. */\nexport type ToolPrefEnumControl = 'select' | 'radio' | 'toggle';\n\n/** Display-unit conversion for number leaves whose stored value uses a\n * canonical unit the user shouldn't see (e.g. radians stored, degrees\n * shown). The stored value stays canonical; UIs convert at the edge. */\nexport interface ToolPrefNumberUnit {\n toDisplay: (stored: number) => number;\n fromDisplay: (display: number) => number;\n /** Shown after the input, e.g. `'°'`. */\n suffix?: string;\n /** Suffixes a person may type, each mapped to the scale that turns a\n * number in that unit into a display number: `{ mm: 0.1, cm: 1 }` for a\n * field showing centimeters. A unit that disagrees with the display unit\n * about zero carries an `offset` as well. */\n accepts?: Readonly<Record<string, UnitEntry>>;\n /** The stored value as display text, suffix included. */\n format?: (stored: number) => string;\n}\n\n/**\n * A display unit built from a {@link UnitSystem}: values are stored in the\n * system's base and shown in `display`, rounded to `precision` places when\n * given, and every unit in the system is accepted as typed text. `suffix`\n * defaults to the unit's name and is accepted too.\n */\nexport function prefUnit(\n system: UnitSystem,\n display: Unit,\n opts?: { precision?: number; suffix?: string },\n): ToolPrefNumberUnit {\n let self: Required<UnitScale>;\n try {\n self = unitScale(system, display);\n } catch (e) {\n throw new Error(`prefUnit: ${e instanceof Error ? e.message : String(e)}`);\n }\n const scale = opts?.precision === undefined ? undefined : 10 ** opts.precision;\n const suffix = opts?.suffix ?? display;\n const accepts: Record<string, UnitEntry> = { [suffix]: 1 };\n for (const name of Object.keys(system.units)) {\n const other = unitScale(system, name);\n // A number typed in `name` reaches display units through base:\n // `(n * factor + offset - self.offset) / self.factor`.\n const factor = other.factor / self.factor;\n const offset = (other.offset - self.offset) / self.factor;\n accepts[name] = offset === 0 ? factor : { factor, offset };\n }\n const toDisplay = (stored: number) => {\n const shown = (stored - self.offset) / self.factor;\n return scale === undefined ? shown : Math.round(shown * scale) / scale;\n };\n return {\n toDisplay,\n fromDisplay: (shown) => shown * self.factor + self.offset,\n suffix,\n accepts,\n format: (stored) =>\n `${formatUnit(stored, display, system, {\n precision: opts?.precision ?? 2,\n suffix: false,\n })}${suffix}`,\n };\n}\n\n/** A numeric pref, optionally bounded and stepped, and optionally stored in a\n * different unit from the one shown. */\nexport interface ToolPrefNumber extends ToolPrefBase<'number', number> {\n min?: number;\n max?: number;\n step?: number;\n control?: ToolPrefNumberControl;\n /** How the value shows, speaks and reads back when typed — `compact()`\n * reads `2.00M`. Presentation only: the stored value stays a number. */\n display?: Display;\n unit?: ToolPrefNumberUnit;\n}\n/**\n * Stored-value bridge for a boolean leaf whose field is not a boolean — the\n * flag counterpart of {@link ToolPrefEnumEncoding}. `TextStyle.fontStyle` is\n * the case: it stores `'italic'`, and the control is an Italic toggle.\n */\nexport interface ToolPrefBooleanEncoding {\n /** Whether `stored` reads as on. */\n read: (stored: unknown, siblings: Record<string, unknown> | undefined) => boolean;\n /** What to store for `on`. `undefined` removes the field. */\n write: (on: boolean, siblings: Record<string, unknown> | undefined) => unknown;\n}\n\n/** An on/off pref. */\nexport interface ToolPrefBoolean extends ToolPrefBase<'boolean', boolean> {\n control?: ToolPrefBooleanControl;\n encoding?: ToolPrefBooleanEncoding;\n}\n/** A free-text pref. */\nexport interface ToolPrefString extends ToolPrefBase<'string', string> {\n control?: ToolPrefStringControl;\n}\n/**\n * Stored-value bridge for an enum leaf whose value is not the option string —\n * the counterpart of {@link ToolPrefNumberUnit}, which does the same for a\n * number stored in a canonical unit.\n *\n * A dash array is the case that needs it: `Stroke.dash` stores lengths, and\n * the thing a person chooses is a style. The presets scale by the stroke's\n * width, so both directions are given the object's other fields — a style is\n * meaningless without the width it is a multiple of.\n */\nexport interface ToolPrefEnumEncoding<T extends string = string> {\n /**\n * The option `stored` reads as, or `undefined` for none — which a UI shows\n * the way it shows a mixed selection, by selecting nothing.\n *\n * `siblings` is the object the leaf is a field of, or `undefined` when the\n * node does not hold that object (and for a top-level leaf, which has none).\n */\n read: (stored: unknown, siblings: Record<string, unknown> | undefined) => T | undefined;\n /** What to store for `option`. `undefined` removes the field. */\n write: (option: T, siblings: Record<string, unknown> | undefined) => unknown;\n}\n\n/** A pref with a fixed set of labeled choices. `default` is `undefined` only\n * for a {@link ToolPrefEnum.clearable} leaf, whose absence is a value. */\nexport interface ToolPrefEnum<T extends string = string>\n extends ToolPrefBase<'enum', T | undefined> {\n /**\n * The field may hold none of the options, and that absence is a state of\n * its own rather than a missing value — a script that is neither super nor\n * sub. A toggle control then lets the chosen segment be clicked off, which\n * removes the field.\n */\n clearable?: boolean;\n /** `short` is the label a segmented control uses when a full one would not\n * fit — a capital or two. `icon` names a glyph in the host UI's set\n * (weasel-ui resolves it against `ICON_PATHS`) and outranks `short` where\n * it resolves. It is a plain string because core ships no icon set and\n * cannot depend on one. The full `label` stays the accessible name, so\n * neither the abbreviation nor the glyph becomes the only thing naming\n * the option.\n *\n * `disabled` marks an option a control reports but cannot author — the\n * value a stored form reads as when it matches nothing offered. Dropping it\n * from the list instead would leave the control selecting nothing and\n * claiming the field is unset. */\n options: readonly {\n value: T;\n label: string;\n short?: string;\n icon?: string;\n disabled?: boolean;\n }[];\n control?: ToolPrefEnumControl;\n encoding?: ToolPrefEnumEncoding<T>;\n}\n\n/** A single color, stored as a hex string. For a value that may also be a\n * gradient or a pattern, use {@link ToolPrefPaint} instead. */\nexport interface ToolPrefColor extends ToolPrefBase<'color', string> {\n /** Value is `#rrggbb`, or `#rrggbbaa` when `alpha` is set (UIs then\n * offer an opacity control). */\n alpha?: boolean;\n}\n\n/**\n * Open leaf: any node with a `kind` outside the built-ins. Schema-driven\n * UIs (weasel-ui `PrefsForm` / `SelectionPanel`) dispatch it to an\n * app-supplied renderer. Deliberately NOT index-signatured so concrete\n * app interfaces stay assignable. Mirrors weasel-ui's `PrefCustom`.\n */\nexport type ToolPrefCustom = ToolPrefBase<string, unknown>;\n\n/**\n * A whole `FillStyle`, not a color inside one. Use it wherever the value is\n * the tagged paint union — a solid color, a pattern, a gradient — rather\n * than a hex string.\n *\n * Addressing `…fill.color` instead reads `undefined` off a gradient (so the\n * control shows its default and claims the text is black) and writes a\n * hybrid `{ fill: 'gradient', stops, color }` that the renderer's structural\n * `'color' in paint` checks then paint flat solid. The union has to be\n * edited as a union.\n */\nexport interface ToolPrefPaint extends ToolPrefBase<'paint', unknown> {\n /** Offer an opacity control alongside the color. */\n alpha?: boolean;\n}\n\n/**\n * A leaf whose value is one object, with its own fields hanging off it.\n *\n * A compound value — a stroke, a shadow, a pattern spec — could be described\n * as several sibling leaves addressing into it (`data.stroke.width`,\n * `data.stroke.cap`). It shouldn't be: each control would then write one field\n * of a value it can only half see, and writing into something that is not an\n * object yet corrupts it. Here the fields are `children` of one leaf, and\n * every edit commits the parent object whole.\n *\n * `children` paths are relative to the object. They are ordinary leaves, so a\n * field that is itself a union (a stroke's `paint`) declares the kind that\n * edits that union. A child may also be a {@link ToolPrefGroup}, which\n * organises the fields under a heading without contributing to the path —\n * the same rule group keys follow at the top level. A `TextStyle` needs it:\n * its character and paragraph fields belong to one value but read as two\n * lists.\n */\nexport interface ToolPrefObject extends ToolPrefBase<'object', unknown> {\n children: Record<string, ToolPrefLeaf | ToolPrefGroup>;\n /**\n * Lift a non-object value into the object form, for a consumer field that\n * may also be held as a scalar. Called before a child edit is applied;\n * without it a scalar-valued leaf shows its children empty and refuses the\n * edit.\n */\n fromScalar?: (value: unknown) => Record<string, unknown>;\n}\n\n/** One built-in pref leaf. `ToolPrefLeaf` widens this to include\n * app-defined kinds. */\nexport type ToolPref =\n | ToolPrefNumber\n | ToolPrefBoolean\n | ToolPrefString\n | ToolPrefEnum\n | ToolPrefColor\n | ToolPrefPaint\n | ToolPrefObject;\n\n// Compile-time tie: every built-in leaf kind must appear in ToolPrefKind\n// and vice versa (ToolPrefBase's K is open for ToolPrefCustom's sake, so\n// the union no longer enforces it).\ntype _BuiltinKindsExact = [ToolPref['kind']] extends [ToolPrefKind]\n ? [ToolPrefKind] extends [ToolPref['kind']] ? true : never\n : never;\nconst _builtinKindsExact: _BuiltinKindsExact = true;\nvoid _builtinKindsExact;\n\n/**\n * The built-in kinds, as a table. A kind added to {@link ToolPrefKind} is a\n * compile error here, and from here it is one in every renderer's `never`\n * guard — the only thing standing between a new kind and rendering as\n * nothing in four places at once.\n */\nexport const TOOL_PREF_KINDS: Record<ToolPrefKind, true> = {\n number: true,\n boolean: true,\n string: true,\n enum: true,\n color: true,\n paint: true,\n object: true,\n};\n\n/**\n * Narrows a leaf to the built-in union, so a renderer's switch discriminates\n * on {@link ToolPrefKind} instead of the open `string` that\n * {@link ToolPrefCustom} widens `kind` to. An app-defined kind answers false\n * and belongs to the renderer's custom-renderer path.\n */\nexport function isBuiltinToolPref(leaf: ToolPrefLeaf): leaf is ToolPref {\n return Object.hasOwn(TOOL_PREF_KINDS, leaf.kind);\n}\n\n/** Built-in or app-defined leaf. */\nexport type ToolPrefLeaf = ToolPref | ToolPrefCustom;\n\n/** Nestable group: branch nodes a tool can use to organize its prefs. */\nexport interface ToolPrefGroup {\n /** Heading for the group's rows. **Empty means no heading** — for a group\n * that exists to organise, not to name: one whose children are themselves\n * groups carrying the labels a reader needs. Give it a name whenever the\n * name is the referent (a `Border` group over `Top` / `Right` / `Bottom`\n * reads as nothing without it). */\n name: string;\n description?: string;\n children: Record<string, ToolPrefLeaf | ToolPrefGroup>;\n}\n"],"mappings":";;AAgFA,SAAgBA,EACd,GACA,GACA,GACoB;CACpB,IAAIC;CACJ,IAAI;EACF,IAAOC,EAAUC,GAAQC,CAAO;CAClC,SAAS,GAAG;EACV,MAAU,MAAM,aAAa,aAAa,QAAQ,EAAE,UAAU,OAAO,CAAC,GAAG;CAC3E;CACA,IAAMC,IAAQC,GAAM,cAAc,KAAA,IAAY,KAAA,IAAY,MAAMA,EAAK,WAC/DC,IAASD,GAAM,UAAUF,GACzBI,IAAqC,GAAGD,IAAS,EAAE;CACzD,KAAK,IAAME,KAAQ,OAAO,KAAKN,EAAO,KAAK,GAAG;EAC5C,IAAMO,IAAQR,EAAUC,GAAQM,CAAI,GAG9BE,IAASD,EAAM,SAAST,EAAK,QAC7BW,KAAUF,EAAM,SAAST,EAAK,UAAUA,EAAK;EACnD,EAAQQ,KAAQG,MAAW,IAAID,IAAS;GAAE;GAAQ;EAAO;CAC3D;CAKA,OAAO;EACL,YALiB,MAAmB;GACpC,IAAME,KAASC,IAASb,EAAK,UAAUA,EAAK;GAC5C,OAAOI,MAAU,KAAA,IAAYQ,IAAQ,KAAK,MAAMA,IAAQR,CAAK,IAAIA;EACnE;EAGE,cAAc,MAAUQ,IAAQZ,EAAK,SAASA,EAAK;EACnD;EACA;EACA,SAAS,MACP,GAAGc,EAAWD,GAAQV,GAASD,GAAQ;GACrC,WAAWG,GAAM,aAAa;GAC9B,QAAQ;EACV,CAAC,IAAIC;CACT;AACF;AAmLA,IAAaS,IAA8C;CACzD,QAAQ;CACR,SAAS;CACT,QAAQ;CACR,MAAM;CACN,OAAO;CACP,OAAO;CACP,QAAQ;AACV;AAQA,SAAgBC,EAAkB,GAAsC;CACtE,OAAO,OAAO,OAAOD,GAAiBE,EAAK,IAAI;AACjD"}
@@ -0,0 +1,66 @@
1
+ import { buildToolActivateBindings as e, makeToolActivateAction as t } from "../interactions/actions/defaults/toolActivate.js";
2
+ import { makeToolResetToDefaultAction as n } from "../interactions/actions/defaults/toolResetToDefault.js";
3
+ import { useEffect as r, useRef as i } from "react";
4
+ import { useLatest as a } from "@weasel-js/react";
5
+ import { useActionsRegistry as o } from "@weasel-js/routing/react";
6
+ //#region src/tools/useKeybindings.ts
7
+ var s = {
8
+ select: { key: "V" },
9
+ rect: { key: "R" },
10
+ ellipse: { key: "E" },
11
+ line: { key: "\\" },
12
+ polygon: { key: "G" },
13
+ pencil: { key: "N" },
14
+ text: { key: "T" },
15
+ hand: { key: "H" },
16
+ pen: { key: "P" }
17
+ };
18
+ function c(c, l = {}) {
19
+ let u = a(c), d = a(l), f = i(c.active), p = o();
20
+ r(() => {
21
+ if (d.current.disable || !p || Object.keys(u.current.registry).length === 0) return;
22
+ let r = [];
23
+ for (let [e, t] of Object.entries(s)) u.current.has(e) && r.push({
24
+ toolId: e,
25
+ keyOpts: t
26
+ });
27
+ let i = u.current.registry;
28
+ for (let e in i) {
29
+ if (e in s) continue;
30
+ let t = i[e].keybinding;
31
+ if (!t) continue;
32
+ let n = typeof t.key == "string" ? [t.key] : t.key;
33
+ for (let i of n) i && r.push({
34
+ toolId: e,
35
+ keyOpts: {
36
+ ...t,
37
+ key: i
38
+ }
39
+ });
40
+ }
41
+ let a = [];
42
+ if (r.length > 0) {
43
+ let n = e(r);
44
+ a.push(p.register(t(n, (e) => d.current.isToolEligible?.(e) ?? !0)));
45
+ }
46
+ return a.push(p.register(n(() => {
47
+ let e = d.current.defaultTool;
48
+ if (e === null) return null;
49
+ let t = e ?? f.current;
50
+ if (!t) return null;
51
+ let n = u.current;
52
+ return !n.has(t) || n.active === t ? null : t;
53
+ }))), () => {
54
+ for (let e of a) e();
55
+ };
56
+ }, [
57
+ p,
58
+ c,
59
+ u,
60
+ d
61
+ ]);
62
+ }
63
+ //#endregion
64
+ export { c as useKeybindings };
65
+
66
+ //# sourceMappingURL=useKeybindings.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useKeybindings.js","names":["BUILTIN_SELECT_KEYS","useKeybindings","toolsRef","useLatest","tools","optionsRef","options","initialActiveRef","useRef","registry","useActionsRegistry","specs","toolId","keyOpts","allTools","binding","keys","key","unregisters","bindings","buildToolActivateBindings","makeToolActivateAction","makeToolResetToDefaultAction","opt","target","api","u"],"sources":["../../src/tools/useKeybindings.ts"],"sourcesContent":["// src/tools/useKeybindings.ts\nimport { useEffect, useRef } from 'react';\nimport { useActionsRegistry } from '@weasel-js/routing/react';\nimport { useLatest } from '@weasel-js/react';\nimport {\n makeToolActivateAction,\n buildToolActivateBindings,\n type ToolActivateBindingSpec,\n} from 'interactions/actions/defaults/toolActivate';\nimport { makeToolResetToDefaultAction } from 'interactions/actions/defaults/toolResetToDefault';\nimport type { ToolsApi } from './overlayBinding';\n\n/** Options for `useKeybindings`. */\nexport interface UseKeybindingsOptions {\n /** Skip all wiring. Useful for touch apps or test isolation. */\n disable?: boolean;\n /** Tool id Escape switches to. When omitted, defaults to whatever\n * `tools.active` was when the hook first ran (i.e. the initial active\n * tool). Pass `null` to disable Escape-returns-to-default behavior. */\n defaultTool?: string | null;\n /**\n * Gate for keyboard tool activation: return false to refuse a tool the\n * active mode doesn't allow. `<SceneCanvas>` wires this from\n * its `modes` registry + each tool's `eligibility.capabilities`, using the same predicate\n * `ToolPalette` uses to grey a button out — so the grey-out becomes a\n * guarantee rather than a hint.\n *\n * Omit for consumers with no mode registry: every tool stays activatable.\n */\n isToolEligible?: (toolId: string) => boolean;\n}\n\n/** Key opts for every built-in tool whose activation key lives here rather\n * than on the ToolDef. Consumed by the tool-select action-registration effect. */\nconst BUILTIN_SELECT_KEYS: Record<string, { key: string }> = {\n select: { key: 'V' },\n rect: { key: 'R' },\n ellipse: { key: 'E' },\n line: { key: '\\\\' },\n polygon: { key: 'G' },\n pencil: { key: 'N' },\n text: { key: 'T' },\n hand: { key: 'H' },\n pen: { key: 'P' },\n};\n\n/** Wire the single-key tool-activation shortcuts (V, P, T, …) and Escape to\n * return to the default tool. Activation is gated on what the active mode\n * allows, so a key cannot reach a tool the palette greys out. */\nexport function useKeybindings(\n tools: ToolsApi,\n options: UseKeybindingsOptions = {},\n): void {\n const toolsRef = useLatest(tools);\n const optionsRef = useLatest(options);\n // Snapshot the initial active tool — used as the Escape target when the\n // consumer doesn't pass an explicit `defaultTool`. Captured in a ref\n // (not state) so it survives re-renders without re-syncing.\n const initialActiveRef = useRef(tools.active);\n\n // Held-key engagement is not here: a tool declares `ToolDef.hotkey` and\n // assembly registers `tool.offhand` from the declaration.\n const registry = useActionsRegistry();\n\n // --- Tool-activate: register one parametric `tool.activate` action.\n // The single descriptor carries a `defaultBinding: BoundGesture[]` with one\n // entry per tool — each entry pairs a key spec with `opts.params.toolId`.\n // The invoker reads `params.toolId` and calls `setActive`. Imperative\n // callers (palette, toolbar) reach the same effect via\n // `registry.trigger('tool.activate', { toolId })`.\n //\n // Built-in tools with static keys come from BUILTIN_SELECT_KEYS; tools\n // whose activation key is configurable via their ToolDef (e.g. useLassoTool)\n // are picked up dynamically from the tools registry.\n useEffect(() => {\n if (optionsRef.current.disable) return;\n if (!registry) return;\n // No tools, no tool keys: nothing to activate and nothing to return to.\n if (Object.keys(toolsRef.current.registry).length === 0) return;\n\n const specs: ToolActivateBindingSpec[] = [];\n\n for (const [toolId, keyOpts] of Object.entries(BUILTIN_SELECT_KEYS)) {\n if (toolsRef.current.has(toolId)) {\n specs.push({ toolId, keyOpts });\n }\n }\n\n const allTools = toolsRef.current.registry;\n for (const toolId in allTools) {\n if (toolId in BUILTIN_SELECT_KEYS) continue;\n const binding = allTools[toolId].keybinding;\n if (!binding) continue;\n // KeyBinding.key may be an array; the consolidated action's per-entry\n // key spec expects a string. Take the first key in the array case —\n // multi-key aliases are rare in practice and the action system doesn't\n // support them yet.\n // `KeyBinding.key` may be an array of aliases. Emit one binding per\n // key: the old document listener matched every alias while this path\n // only took `key[0]`, so a multi-key tool activated on all its keys\n // through one route and only the first through the other.\n const keys = typeof binding.key === 'string' ? [binding.key] : binding.key;\n for (const key of keys) {\n if (!key) continue;\n specs.push({ toolId, keyOpts: { ...binding, key } });\n }\n }\n\n const unregisters: Array<() => void> = [];\n\n if (specs.length > 0) {\n const bindings = buildToolActivateBindings(specs);\n unregisters.push(registry.register(makeToolActivateAction(\n bindings,\n (toolId) => optionsRef.current.isToolEligible?.(toolId) ?? true,\n )));\n }\n\n // Escape-returns-to-default. Registered here rather than in the deleted\n // document listener so it competes in the dispatcher's Escape ladder\n // instead of firing in parallel with it — see\n // `makeToolResetToDefaultAction` for the ordering and the behavior\n // change that implies.\n unregisters.push(registry.register(makeToolResetToDefaultAction(() => {\n const opt = optionsRef.current.defaultTool;\n if (opt === null) return null;\n const target = opt ?? initialActiveRef.current;\n if (!target) return null;\n const api = toolsRef.current;\n if (!api.has(target) || api.active === target) return null;\n return target;\n })));\n\n return () => { for (const u of unregisters) u(); };\n }, [registry, tools, toolsRef, optionsRef]);\n}\n\n"],"mappings":";;;;;;AAkCA,IAAMA,IAAuD;CAC3D,QAAQ,EAAE,KAAK,IAAI;CACnB,MAAM,EAAE,KAAK,IAAI;CACjB,SAAS,EAAE,KAAK,IAAI;CACpB,MAAM,EAAE,KAAK,KAAK;CAClB,SAAS,EAAE,KAAK,IAAI;CACpB,QAAQ,EAAE,KAAK,IAAI;CACnB,MAAM,EAAE,KAAK,IAAI;CACjB,MAAM,EAAE,KAAK,IAAI;CACjB,KAAK,EAAE,KAAK,IAAI;AAClB;AAKA,SAAgBC,EACd,GACA,IAAiC,CAAC,GAC5B;CACN,IAAMC,IAAWC,EAAUC,CAAK,GAC1BC,IAAaF,EAAUG,CAAO,GAI9BC,IAAmBC,EAAOJ,EAAM,MAAM,GAItCK,IAAWC,EAAmB;CAYpC,QAAgB;EAId,IAHIL,EAAW,QAAQ,WACnB,CAACI,KAED,OAAO,KAAKP,EAAS,QAAQ,QAAQ,CAAC,CAAC,WAAW,GAAG;EAEzD,IAAMS,IAAmC,CAAC;EAE1C,KAAK,IAAM,CAACC,GAAQC,MAAY,OAAO,QAAQb,CAAmB,GAChE,AAAIE,EAAS,QAAQ,IAAIU,CAAM,KAC7BD,EAAM,KAAK;GAAE;GAAQ;EAAQ,CAAC;EAIlC,IAAMG,IAAWZ,EAAS,QAAQ;EAClC,KAAK,IAAMU,KAAUE,GAAU;GAC7B,IAAIF,KAAUZ,GAAqB;GACnC,IAAMe,IAAUD,EAASF,EAAO,CAAC;GACjC,IAAI,CAACG,GAAS;GASd,IAAMC,IAAO,OAAOD,EAAQ,OAAQ,WAAW,CAACA,EAAQ,GAAG,IAAIA,EAAQ;GACvE,KAAK,IAAME,KAAOD,GAChB,AAAKC,KACLN,EAAM,KAAK;IAAE;IAAQ,SAAS;KAAE,GAAGI;KAAS;IAAI;GAAE,CAAC;EAEvD;EAEA,IAAMG,IAAiC,CAAC;EAExC,IAAIP,EAAM,SAAS,GAAG;GACpB,IAAMQ,IAAWC,EAA0BT,CAAK;GAChD,EAAY,KAAKF,EAAS,SAASY,EACjCF,IACC,MAAWd,EAAW,QAAQ,iBAAiBO,CAAM,KAAK,EAC7D,CAAC,CAAC;EACJ;EAiBA,OAVAM,EAAY,KAAKT,EAAS,SAASa,QAAmC;GACpE,IAAMC,IAAMlB,EAAW,QAAQ;GAC/B,IAAIkB,MAAQ,MAAM,OAAO;GACzB,IAAMC,IAASD,KAAOhB,EAAiB;GACvC,IAAI,CAACiB,GAAQ,OAAO;GACpB,IAAMC,IAAMvB,EAAS;GAErB,OADI,CAACuB,EAAI,IAAID,CAAM,KAAKC,EAAI,WAAWD,IAAe,OAC/CA;EACT,CAAC,CAAC,CAAC,SAEU;GAAE,KAAK,IAAME,KAAKR,GAAa,EAAE;EAAG;CACnD,GAAG;EAACT;EAAUL;EAAOF;EAAUG;CAAU,CAAC;AAC5C"}
@@ -1,5 +1,89 @@
1
1
  import { Op } from '@weasel-js/history';
2
- import { P as Path } from './path-JEV2c5If.js';
2
+ import { Path } from '@weasel-js/geom';
3
+ import { View } from '@weasel-js/routing';
4
+
5
+ /** One value for both axes, or a separate value per axis. */
6
+ type ScalarOrXY = number | {
7
+ x: number;
8
+ y: number;
9
+ };
10
+ /** How a parallax plane tracks the camera: `pan` is the fraction of the
11
+ * camera's translation it follows (1 = locked to the scene, 0 = fixed to the
12
+ * screen), `zoom` the same for scale, and `anchor` the camera position
13
+ * (`view.x` / `view.y`) the translation is measured from — every plane lines
14
+ * up when the camera sits there. */
15
+ interface ParallaxOpts {
16
+ pan: ScalarOrXY;
17
+ zoom?: ScalarOrXY;
18
+ anchor?: {
19
+ x: number;
20
+ y: number;
21
+ };
22
+ }
23
+ /**
24
+ * Pure derivation of a parallax plane's inner `View` from the camera view
25
+ * plus per-plane factors.
26
+ *
27
+ * `pan` controls how much the plane translates with the camera (1 = normal,
28
+ * 0 = locked to `anchor`, >1 = leads). `zoom` controls how much it scales
29
+ * with camera zoom (1 = normal, 0 = fixed at identity scale). `anchor`
30
+ * (default origin) is the camera position at which all planes agree.
31
+ *
32
+ * Identity holds: `pan=1, zoom=1` returns a view equal to `outer`.
33
+ */
34
+ declare function deriveParallaxView(outer: View, opts: ParallaxOpts): View;
35
+ /** How a point of the camera's world lands in a plane's world, per axis:
36
+ * `plane = world * scale + offset`. A plane draws its content through its
37
+ * own view; this is what lets a pointer, a marquee or a selection box cross
38
+ * between that view and the camera's. */
39
+ interface PlaneMap {
40
+ scale: {
41
+ x: number;
42
+ y: number;
43
+ };
44
+ offset: {
45
+ x: number;
46
+ y: number;
47
+ };
48
+ }
49
+ /** The map from `outer`'s world into the world of a plane drawn through
50
+ * `deriveParallaxView(outer, opts)` — the one that puts both points under the
51
+ * same pixel. */
52
+ declare function planeMap(outer: View, opts: ParallaxOpts): PlaneMap;
53
+ /** Map a point from the outer view's world into the plane's world. */
54
+ declare function toPlane(m: PlaneMap, p: {
55
+ x: number;
56
+ y: number;
57
+ }): {
58
+ x: number;
59
+ y: number;
60
+ };
61
+ /** Map a point from the plane's world back into the outer view's world. */
62
+ declare function fromPlane(m: PlaneMap, p: {
63
+ x: number;
64
+ y: number;
65
+ }): {
66
+ x: number;
67
+ y: number;
68
+ };
69
+ interface Rect {
70
+ x: number;
71
+ y: number;
72
+ width: number;
73
+ height: number;
74
+ }
75
+ /** A camera-world rect in the plane's world. The map is axis-aligned, so a
76
+ * rect stays a rect; a flipped axis is normalized back to a positive size. */
77
+ declare function rectToPlane<R extends Rect>(m: PlaneMap, r: R): R;
78
+ /** A plane-world rect in the camera's world — see {@link rectToPlane}. */
79
+ declare function rectFromPlane<R extends Rect>(m: PlaneMap, r: R): R;
80
+ /** The map from one world into another, where `null` is the camera's own:
81
+ * `fromPlane(from)`, then `toPlane(to)`. Null when the two are the same
82
+ * world, so a caller can skip the work. */
83
+ declare function planeToPlane(from: PlaneMap | null, to: PlaneMap | null): PlaneMap | null;
84
+ /** The map as an affine matrix in `@weasel-js/geom`'s `[a, b, c, d, e, f]`
85
+ * order, for `transformPath` and friends. */
86
+ declare function planeMatrix(m: PlaneMap): [number, number, number, number, number, number];
3
87
 
4
88
  /** A layout container's extent in world units. */
5
89
  type ContainerBounds = {
@@ -67,11 +151,59 @@ type DropRegion = Path | ((point: {
67
151
  * only when the point is inside it; ties are broken as for `'innermost'`.
68
152
  */
69
153
  type LayoutDropTargetMode = 'innermost' | 'topmost' | 'region';
154
+ /**
155
+ * Carries a layout's sibling reflow to its targets over time rather than in
156
+ * one frame. `moveAction` hands every sibling a drag displaces to `glide`
157
+ * instead of snapping it, and `settle`s each one when it stops reflowing or
158
+ * the gesture ends; the dragged nodes themselves settle from where they were
159
+ * let go, and a node grabbed mid-glide is held where it is shown and dragged
160
+ * from there. What the node shows meanwhile is published through the
161
+ * scene's pose overrides; the document is never written.
162
+ *
163
+ * The scene's own reflows — the arrangement it re-applies after an insert,
164
+ * delete, reorder or resize inside a laid-out container — are `settle`d from
165
+ * the pose each child had before.
166
+ *
167
+ * `useAnimatedReflow` builds one over the animator. Supply it through
168
+ * `<SceneCanvas reflowTransition>` or `LayoutDep.reflow`.
169
+ */
170
+ interface ReflowTransition<TPose = unknown> {
171
+ /** Move what `id` shows toward `pose`, in the node's stored frame. A glide
172
+ * already running is retargeted from where it is now; naming the pose it
173
+ * is already heading for changes nothing. With `from`, the glide starts
174
+ * over from that pose instead. */
175
+ glide(id: string, pose: TPose, opts?: ReflowGlideOptions<TPose>): void;
176
+ /** Glide `id` onto its document pose, then stop overriding it. Without
177
+ * `from` this only touches a node it is already moving; with `from` it
178
+ * takes the node over from that pose, whatever is showing it. */
179
+ settle(id: string, opts?: ReflowGlideOptions<TPose>): void;
180
+ /** Stop overriding `id` now, wherever it is. */
181
+ stop(id: string): void;
182
+ /** What `id` is being shown at, or `undefined` when this is not moving it. */
183
+ poseOf(id: string): TPose | undefined;
184
+ }
185
+ /** Where a {@link ReflowTransition} glide starts. */
186
+ interface ReflowGlideOptions<TPose = unknown> {
187
+ /** The pose to start from, in the node's stored frame — where something
188
+ * else was last showing it, such as a drag at its release. Default:
189
+ * wherever the node is shown now. */
190
+ from?: TPose;
191
+ }
70
192
  /** The container a layout strategy is arranging children within. */
71
193
  interface LayoutContainer {
72
194
  id: string;
73
195
  bounds: ContainerBounds;
74
196
  }
197
+ /** What a container does about an edit to its children: see
198
+ * {@link LayoutStrategy.arrive} and {@link LayoutStrategy.depart}. */
199
+ interface LayoutArrival<TPose> {
200
+ /** World poses to write — the arrivals', and any sibling the strategy moves
201
+ * to make room. A child left out keeps its pose. */
202
+ poses: Map<string, TPose>;
203
+ /** The container's new world bounds, when the arrangement needs a
204
+ * different extent. Absent keeps the container as it is. */
205
+ bounds?: ContainerBounds;
206
+ }
75
207
  /** The child currently being dragged: where it started, where the pointer
76
208
  * currently proposes it goes, and which container it came from. */
77
209
  interface LayoutDragged<TPose> {
@@ -86,8 +218,10 @@ interface LayoutDragged<TPose> {
86
218
  * How a container arranges its children, and what happens when one is dragged
87
219
  * into or around it.
88
220
  *
89
- * The four required methods cover the whole cycle: `childPoses` is the resting
90
- * arrangement, `getDropTargets` enumerates where a drag could land,
221
+ * Declared on a container node (`ContainerNode.layout`). The four required
222
+ * methods cover the whole cycle: `childPoses` is the resting arrangement,
223
+ * which the scene re-applies whenever the container's children or size
224
+ * change, `getDropTargets` enumerates where a drag could land,
91
225
  * `reflowPoses` is the live preview once a target is picked, and `commitDrop`
92
226
  * turns the result into ops so the drop is undoable.
93
227
  */
@@ -118,14 +252,44 @@ interface LayoutStrategy<TPose> {
118
252
  * absent, every drag is considered — rejection is still possible later, by
119
253
  * `snap.pickTarget` returning null. */
120
254
  acceptsDrop?(container: LayoutContainer, dragged: LayoutDragged<TPose>): boolean;
255
+ /** Optional: place children that joined this container by an edit — an
256
+ * insert, a reparent, a duplicate or group landing inside it — rather than
257
+ * by a drag onto one of its targets. `children` is the container as the
258
+ * edit left it, `arrivals` included, all in world poses. Return `null` to
259
+ * refuse: the whole edit is reverted and nothing lands, as with a drop
260
+ * that finds no target. A drag onto the container arrives here too, after
261
+ * `commitDrop` has placed it, so a strategy leaves a child that already
262
+ * sits where it belongs alone. Absent, `childPoses` arranges them like
263
+ * any other change to the container's children. Applied by the scene's
264
+ * layout pass — for a layout the container declares, or one
265
+ * `<SceneCanvas layouts>` / `useLayoutArrivals` installs. */
266
+ arrive?(container: LayoutContainer, children: ReadonlyArray<LayoutChild<TPose>>, arrivals: ReadonlySet<string>): LayoutArrival<TPose> | null;
267
+ /** Optional: rearrange a container that children left by an edit — a
268
+ * delete, or a reparent or drag out of it. `children` is what stays, in
269
+ * world poses, still where they were; `departed` is who went, so
270
+ * `children.length + departed.size` is how many it held before. A
271
+ * container that sizes itself to its children shrinks here, from the pitch
272
+ * it had at that count. The edit's arrivals are placed afterward, by
273
+ * `arrive`, or with `childPoses` when there is none. Absent, `childPoses`
274
+ * arranges what stays like any other change. Applied by the scene's layout
275
+ * pass, in the same undo step as the departure. */
276
+ depart?(container: LayoutContainer, children: ReadonlyArray<LayoutChild<TPose>>, departed: ReadonlySet<string>): LayoutArrival<TPose>;
277
+ /** Optional: the world region the arrangement of `children` covers. Larger
278
+ * than `container.bounds` when children sit past it — a grid whose
279
+ * overflow runs on below its last visible row — and that difference is
280
+ * what a host scrolling the container's content scrolls over. Absent means
281
+ * the container's own bounds. */
282
+ contentExtent?(container: LayoutContainer, children: ReadonlyArray<LayoutChild<TPose>>): ContainerBounds;
121
283
  /** Optional: what this container does about a child of its own that was
122
284
  * released outside every layout container. Returning ops replaces the
123
285
  * free-space commit — put the child back in its slot, reflow the gap
124
286
  * closed — and an empty array leaves the container unchanged, which snaps
125
287
  * the child home because the drag only ever wrote previews. `null` lets
126
288
  * the drop stand where the pointer left it, which is also what a strategy
127
- * without this method gets. The drag preview follows the pointer either
128
- * way; this decides the release. */
289
+ * without this method gets; dropped outside the container's body, the
290
+ * child then leaves it for the plain container under the drop, or the top
291
+ * level. The drag preview follows the pointer either way; this decides the
292
+ * release. */
129
293
  releaseDrop?(container: LayoutContainer, children: ReadonlyArray<LayoutChild<TPose>>, dragged: LayoutDragged<TPose>): Op[] | null;
130
294
  }
131
295
 
@@ -260,10 +424,14 @@ interface RotateAdapter<TNode extends {
260
424
  /** Optional: see SceneAdapter.applyOps. */
261
425
  applyOps?(ops: Op[], label: string): void;
262
426
  }
263
- /**
264
- * Narrow adapter for `useAreaSelect`. Transient: no checkpoint, no
265
- * history. The hook calls `applyOps(ops)` instead of `applyOps(ops, label)`.
266
- */
427
+ /** The view a region pick answers for. */
428
+ interface RegionPickView {
429
+ /** The camera the region was drawn under. With it, a node on a parallax
430
+ * layer is tested where that camera's plane paints it. */
431
+ get?(): View;
432
+ /** Whether that view paints a layer at all. */
433
+ layerIsPainted?(layer: string): boolean;
434
+ }
267
435
  /**
268
436
  * Narrow adapter for `useAreaSelect`. Transient: no checkpoint, no
269
437
  * history. The hook calls `applyOps(ops)` instead of `applyOps(ops, label)`.
@@ -276,13 +444,14 @@ interface RotateAdapter<TNode extends {
276
444
  * Demos that don't need marquee selection can omit these methods entirely.
277
445
  */
278
446
  interface AreaSelectAdapter {
279
- /** Returns ids of nodes intersecting the world-space rect. */
447
+ /** Returns ids of nodes intersecting the world-space rect, as the view the
448
+ * rect was drawn in paints them. */
280
449
  hitTestArea?(rect: {
281
450
  x: number;
282
451
  y: number;
283
452
  width: number;
284
453
  height: number;
285
- }): string[];
454
+ }, view?: RegionPickView): string[];
286
455
  /** Current selection — read by behaviors to compute additive merges. */
287
456
  getSelection?(): string[];
288
457
  /** Mutator wired by `setSelection` op. */
@@ -298,8 +467,8 @@ interface AreaSelectAdapter {
298
467
  * - 'intersect' — the node's outline meets the polygon anywhere.
299
468
  * - 'enclosed' — the node's whole outline is inside the polygon.
300
469
  *
301
- * The outline is the drawn silhouette, rotation included. `arrayAdapter`,
302
- * which has no painters to ask, tests its descriptor's bounds instead.
470
+ * The outline is the drawn silhouette, rotation included. `arrayAdapter` asks
471
+ * its `silhouette` option for it, since the painters sit above `core/`.
303
472
  */
304
473
  type LassoHitMode = 'centers' | 'intersect' | 'enclosed';
305
474
  /**
@@ -314,7 +483,7 @@ interface LassoSelectAdapter extends AreaSelectAdapter {
314
483
  hitTestLasso?(polygon: ReadonlyArray<{
315
484
  x: number;
316
485
  y: number;
317
- }>, mode: LassoHitMode): string[];
486
+ }>, mode: LassoHitMode, view?: RegionPickView): string[];
318
487
  }
319
488
  /**
320
489
  * Narrow adapter for `useInsert` and `useClipboardOps`. The kit knows
@@ -384,6 +553,7 @@ interface LayerEnumerableAdapter<TLayer extends string = string> {
384
553
  getLayers?(): readonly {
385
554
  id: TLayer;
386
555
  visible: boolean;
556
+ parallax?: ParallaxOpts;
387
557
  }[];
388
558
  }
389
559
  /**
@@ -411,4 +581,4 @@ interface OrderedAdapter {
411
581
  setChildOrder?(parentId: string | null, ids: string[]): void;
412
582
  }
413
583
 
414
- export type { AreaSelectAdapter as A, ClipboardSnapshot as C, DropRegion as D, InsertAdapter as I, LayoutStrategy as L, MoveAdapter as M, OrderedAdapter as O, ResizeAdapter as R, SnapTarget as S, SceneAdapter as a, LayoutDropTargetMode as b, LassoHitMode as c, LassoSelectAdapter as d, RotateAdapter as e, LayerEnumerableAdapter as f, LayoutSnap as g, ContainerBounds as h, DropTarget as i, LayoutChild as j, LayoutContainer as k, LayoutDragged as l };
584
+ export { type AreaSelectAdapter as A, type ContainerBounds as C, type DropRegion as D, type InsertAdapter as I, type LayoutStrategy as L, type MoveAdapter as M, type OrderedAdapter as O, type PlaneMap as P, type RegionPickView as R, type SnapTarget as S, type ParallaxOpts as a, type SceneAdapter as b, type LayoutDropTargetMode as c, type ReflowTransition as d, type LayerEnumerableAdapter as e, type LassoHitMode as f, type LassoSelectAdapter as g, type ResizeAdapter as h, type RotateAdapter as i, type ClipboardSnapshot as j, type DropTarget as k, type LayoutArrival as l, type LayoutChild as m, type LayoutContainer as n, type LayoutDragged as o, type LayoutSnap as p, type ReflowGlideOptions as q, type ScalarOrXY as r, deriveParallaxView as s, fromPlane as t, planeMap as u, planeMatrix as v, planeToPlane as w, rectFromPlane as x, rectToPlane as y, toPlane as z };
@@ -1,6 +1,6 @@
1
+ import { S as SnapTarget, P as PlaneMap, M as MoveAdapter, I as InsertAdapter } from './types-A37hYkeR.js';
1
2
  import { Op } from '@weasel-js/history';
2
- import { S as SnapTarget, M as MoveAdapter, I as InsertAdapter } from './types-D-9QWBy5.js';
3
- import { Bounds, ModifierState, ResizeAnchor } from '@weasel-js/routing';
3
+ import { Bounds, ModifierState, View, ResizeAnchor } from '@weasel-js/routing';
4
4
 
5
5
  /** Pointer position in both world and client coords. */
6
6
  interface PointerState {
@@ -26,6 +26,19 @@ interface GestureContext<TPose, TNode extends {
26
26
  snap: SnapTarget<TPose> | null;
27
27
  modifiers: ModifierState;
28
28
  pointer: PointerState;
29
+ /**
30
+ * Camera of the view the input landed in (a `<CanvasView>`'s own, not the
31
+ * surface's), current as of this frame. `null` where no view answered; a
32
+ * screen-pixel length then reads as one world unit.
33
+ */
34
+ view: View | null;
35
+ /**
36
+ * How the camera's world maps into the world this gesture's poses are in,
37
+ * when that is a parallax plane; absent or null otherwise. The camera draws
38
+ * its guides and grid in its own world, so a snap strategy carries them
39
+ * through this before comparing them with a pose.
40
+ */
41
+ plane?: PlaneMap | null;
29
42
  adapter: MoveAdapter<TNode, TPose>;
30
43
  /**
31
44
  * Per-gesture mutable store. Keys should be namespaced by behavior name to avoid
@@ -43,8 +56,14 @@ interface SnapStrategy<TPose> {
43
56
  /**
44
57
  * Generalized base behavior. Each hook defines an alias that pins the
45
58
  * proposed-pose shape (TProposed) and the onMove return shape (TMoveResult).
46
- * onEnd is uniform: first non-undefined return wins (Op[] = commit those,
47
- * null = abort, undefined = defer).
59
+ * onEnd runs on commit for every behavior, in order, and the first
60
+ * non-undefined return wins (Op[] = commit those, null = abort, undefined =
61
+ * defer); later answers are ignored. So a behavior holding state outside the
62
+ * gesture (published guides, a timer) releases it in onEnd even when an
63
+ * earlier behavior decides. `end.answered` says one did: a behavior that acts
64
+ * on the scene itself from onEnd (starts an animation, applies ops) only
65
+ * cleans up then. A canceled gesture (Esc, pointercancel) runs every
66
+ * behavior's `onCancel` instead, which releases the same state.
48
67
  *
49
68
  * `defaultTransient`: when one behavior of a move, resize or rotate sets it
50
69
  * and the binding leaves `transient` unset, the gesture commits through
@@ -54,7 +73,14 @@ interface ActionBehavior<TPose, TProposed, TMoveResult> {
54
73
  defaultTransient?: boolean;
55
74
  onStart?(ctx: GestureContext<TPose>): void;
56
75
  onMove?(ctx: GestureContext<TPose>, proposed: TProposed): TMoveResult | void;
57
- onEnd?(ctx: GestureContext<TPose>): Op[] | null | void;
76
+ onEnd?(ctx: GestureContext<TPose>, end: BehaviorEnd): Op[] | null | void;
77
+ onCancel?(ctx: GestureContext<TPose>): void;
78
+ }
79
+ /** What a behavior's `onEnd` is told about the commit, beside the gesture. */
80
+ interface BehaviorEnd {
81
+ /** An earlier behavior's `onEnd` already decided the commit, so this one's
82
+ * answer is ignored. */
83
+ answered: boolean;
58
84
  }
59
85
  /**
60
86
  * Uniform group transform proposed by a gesture and shaped by behaviors.
@@ -304,4 +330,4 @@ interface CloneBehavior {
304
330
  }) => Op[];
305
331
  }
306
332
 
307
- export type { ActionBehavior as A, BoundsConstraint as B, CloneBehavior as C, GestureContext as G, InsertBehavior as I, LassoSelectBehavior as L, MoveBehavior as M, PointSnapBehavior as P, RotateBehavior as R, SnapStrategy as S, PointSnapFrame as a, AreaSelectOverlay as b, BehaviorMoveResult as c, BehaviorResult as d, CloneLayer as e, ClonePose as f, GroupTransform as g, InsertMoveResult as h, InsertOverlay as i, InsertPoint as j, InsertProposed as k, LassoSelectMoveResult as l, LassoSelectOverlay as m, LassoSelectPose as n, LassoSelectProposed as o, PointSnapContext as p, PointSnapResult as q, PointerState as r, ResizeMoveResult as s, ResizeOverlay as t, ResizeProposed as u, RotateMoveResult as v, RotateOverlay as w, RotateProposed as x };
333
+ export type { ActionBehavior as A, BoundsConstraint as B, CloneBehavior as C, GestureContext as G, InsertBehavior as I, LassoSelectBehavior as L, MoveBehavior as M, PointSnapBehavior as P, RotateBehavior as R, SnapStrategy as S, AreaSelectOverlay as a, BehaviorEnd as b, BehaviorMoveResult as c, BehaviorResult as d, CloneLayer as e, ClonePose as f, GroupTransform as g, InsertMoveResult as h, InsertOverlay as i, InsertPoint as j, InsertProposed as k, LassoSelectMoveResult as l, LassoSelectOverlay as m, LassoSelectPose as n, LassoSelectProposed as o, PointSnapContext as p, PointSnapFrame as q, PointSnapResult as r, PointerState as s, ResizeMoveResult as t, ResizeOverlay as u, ResizeProposed as v, RotateMoveResult as w, RotateOverlay as x, RotateProposed as y };
@@ -0,0 +1,26 @@
1
+ //#region src/util/color.ts
2
+ function e(e) {
3
+ if (!e.startsWith("#")) return e;
4
+ let t = e.slice(1);
5
+ if (t.length === 3) {
6
+ let e = t[0], n = t[1], r = t[2];
7
+ return `#${e}${e}${n}${n}${r}${r}ff`;
8
+ }
9
+ return t.length === 6 ? `#${t}ff` : t.length === 8 ? e.toLowerCase() : e;
10
+ }
11
+ function t(e) {
12
+ if (!e.startsWith("#") || e.length !== 9) return 1;
13
+ let t = parseInt(e.slice(7, 9), 16);
14
+ return Number.isFinite(t) ? t / 255 : 1;
15
+ }
16
+ function n(t, n) {
17
+ let r = Math.round(Math.max(0, Math.min(1, n)) * 255).toString(16).padStart(2, "0"), i = e(t);
18
+ return !i.startsWith("#") || i.length !== 9 ? t : `${i.slice(0, 7)}${r}`;
19
+ }
20
+ function r(e, r) {
21
+ return e.length === 9 && e.startsWith("#") ? e.toLowerCase() : n(e, t(r));
22
+ }
23
+ //#endregion
24
+ export { t as getAlpha01, r as mergeAlphaFromPrev, e as toHex8, n as withAlpha01 };
25
+
26
+ //# sourceMappingURL=color.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"color.js","names":["toHex8","color","hex","r","g","b","getAlpha01","a","withAlpha01","aa","alpha01","eight","mergeAlphaFromPrev","picked","prev"],"sources":["../../src/util/color.ts"],"sourcesContent":["/** Color hex8 helpers. All stored colors are `#rrggbbaa`. `<input type=\"color\">`\n * only round-trips the 6-char form, so call-sites pad the saved alpha back on\n * when the user picks via the native widget. */\n\n/** Expand `#rgb` / `#rrggbb` to `#rrggbbaa`. Pads `ff` when no alpha\n * channel is present. Non-hex inputs (named colors, `rgba(...)`) are\n * returned unchanged — the kit's renderer accepts arbitrary CSS, and\n * we only normalize the hex shapes we actually persist. */\nexport function toHex8(color: string): string {\n if (!color.startsWith('#')) return color;\n const hex = color.slice(1);\n if (hex.length === 3) {\n const r = hex[0], g = hex[1], b = hex[2];\n return `#${r}${r}${g}${g}${b}${b}ff`;\n }\n if (hex.length === 6) return `#${hex}ff`;\n if (hex.length === 8) return color.toLowerCase();\n return color;\n}\n\n/** Return the alpha channel of `color` as 0..1. Defaults to 1 when the\n * color is not in 8-char hex form. */\nexport function getAlpha01(color: string): number {\n if (!color.startsWith('#') || color.length !== 9) return 1;\n const a = parseInt(color.slice(7, 9), 16);\n return Number.isFinite(a) ? a / 255 : 1;\n}\n\n/** Replace the alpha channel of `color` with `alpha01` (clamped to 0..1).\n * Expands shorter hex forms first. Pass-through for non-hex inputs. */\nexport function withAlpha01(color: string, alpha01: number): string {\n const a = Math.max(0, Math.min(1, alpha01));\n const aa = Math.round(a * 255).toString(16).padStart(2, '0');\n const eight = toHex8(color);\n if (!eight.startsWith('#') || eight.length !== 9) return color;\n return `${eight.slice(0, 7)}${aa}`;\n}\n\n/** Merge a freshly-picked color with the previous color's alpha channel.\n * If `picked` is already in 8-char hex form (`#rrggbbaa`, length 9), it is\n * used as-is — its explicit alpha is preserved. Otherwise the alpha from\n * `prev` is adopted, which handles the common case where `<input type=\"color\">`\n * strips the alpha channel and returns a bare 6-char hex. */\nexport function mergeAlphaFromPrev(picked: string, prev: string): string {\n if (picked.length === 9 && picked.startsWith('#')) return picked.toLowerCase();\n return withAlpha01(picked, getAlpha01(prev));\n}\n"],"mappings":";AAQA,SAAgBA,EAAO,GAAuB;CAC5C,IAAI,CAACC,EAAM,WAAW,GAAG,GAAG,OAAOA;CACnC,IAAMC,IAAMD,EAAM,MAAM,CAAC;CACzB,IAAIC,EAAI,WAAW,GAAG;EACpB,IAAMC,IAAID,EAAI,IAAIE,IAAIF,EAAI,IAAIG,IAAIH,EAAI;EACtC,OAAO,IAAIC,IAAIA,IAAIC,IAAIA,IAAIC,IAAIA,EAAE;CACnC;CAGA,OAFIH,EAAI,WAAW,IAAU,IAAIA,EAAI,MACjCA,EAAI,WAAW,IAAUD,EAAM,YAAY,IACxCA;AACT;AAIA,SAAgBK,EAAW,GAAuB;CAChD,IAAI,CAACL,EAAM,WAAW,GAAG,KAAKA,EAAM,WAAW,GAAG,OAAO;CACzD,IAAMM,IAAI,SAASN,EAAM,MAAM,GAAG,CAAC,GAAG,EAAE;CACxC,OAAO,OAAO,SAASM,CAAC,IAAIA,IAAI,MAAM;AACxC;AAIA,SAAgBC,EAAY,GAAe,GAAyB;CAElE,IAAMC,IAAK,KAAK,MADN,KAAK,IAAI,GAAG,KAAK,IAAI,GAAGC,CAAO,CACnB,IAAI,GAAG,CAAC,CAAC,SAAS,EAAE,CAAC,CAAC,SAAS,GAAG,GAAG,GACrDC,IAAQX,EAAOC,CAAK;CAE1B,OADI,CAACU,EAAM,WAAW,GAAG,KAAKA,EAAM,WAAW,IAAUV,IAClD,GAAGU,EAAM,MAAM,GAAG,CAAC,IAAIF;AAChC;AAOA,SAAgBG,EAAmB,GAAgB,GAAsB;CAEvE,OADIC,EAAO,WAAW,KAAKA,EAAO,WAAW,GAAG,IAAUA,EAAO,YAAY,IACtEL,EAAYK,GAAQP,EAAWQ,CAAI,CAAC;AAC7C"}
@@ -0,0 +1,17 @@
1
+ //#region src/util/constrainTo45.ts
2
+ function e(e, t) {
3
+ let n = Math.hypot(e, t);
4
+ if (n === 0) return {
5
+ dx: 0,
6
+ dy: 0
7
+ };
8
+ let r = Math.atan2(t, e), i = Math.PI / 4, a = Math.round(r / i) * i;
9
+ return {
10
+ dx: Math.cos(a) * n,
11
+ dy: Math.sin(a) * n
12
+ };
13
+ }
14
+ //#endregion
15
+ export { e as constrainTo45 };
16
+
17
+ //# sourceMappingURL=constrainTo45.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constrainTo45.js","names":["constrainTo45","mag","dx","dy","angle","step","snapped"],"sources":["../../src/util/constrainTo45.ts"],"sourcesContent":["/**\n * Snap a (dx, dy) direction vector to the nearest 0/45/90/135° axis,\n * preserving the input magnitude. Used by the pen tool's Shift-constrain\n * affordance; reusable for any tool that wants axis/diagonal locking.\n *\n * Returns (0, 0) for a zero-length input (no direction to snap).\n */\nexport function constrainTo45(dx: number, dy: number): { dx: number; dy: number } {\n const mag = Math.hypot(dx, dy);\n if (mag === 0) return { dx: 0, dy: 0 };\n const angle = Math.atan2(dy, dx);\n // Snap to nearest multiple of π/4.\n const step = Math.PI / 4;\n const snapped = Math.round(angle / step) * step;\n return { dx: Math.cos(snapped) * mag, dy: Math.sin(snapped) * mag };\n}\n"],"mappings":";AAOA,SAAgBA,EAAc,GAAY,GAAwC;CAChF,IAAMC,IAAM,KAAK,MAAMC,GAAIC,CAAE;CAC7B,IAAIF,MAAQ,GAAG,OAAO;EAAE,IAAI;EAAG,IAAI;CAAE;CACrC,IAAMG,IAAQ,KAAK,MAAMD,GAAID,CAAE,GAEzBG,IAAO,KAAK,KAAK,GACjBC,IAAU,KAAK,MAAMF,IAAQC,CAAI,IAAIA;CAC3C,OAAO;EAAE,IAAI,KAAK,IAAIC,CAAO,IAAIL;EAAK,IAAI,KAAK,IAAIK,CAAO,IAAIL;CAAI;AACpE"}
@@ -0,0 +1,72 @@
1
+ import { getAlpha01 as e } from "./color.js";
2
+ import { colorLiteralToHex as t, hexToColorLiteral as n, resolvePaletteColor as r } from "@weasel-js/paint";
3
+ //#region src/util/paint.ts
4
+ var i = "#ffffffff", a = "#000000ff", o = (e) => n(e), s = { entries: [
5
+ {
6
+ name: "sage",
7
+ color: o("#7fb069")
8
+ },
9
+ {
10
+ name: "tan",
11
+ color: o("#d4a574")
12
+ },
13
+ {
14
+ name: "lavender",
15
+ color: o("#a48bd4")
16
+ },
17
+ {
18
+ name: "sky",
19
+ color: o("#7ab8d4")
20
+ },
21
+ {
22
+ name: "rose",
23
+ color: o("#d47a7a")
24
+ }
25
+ ] };
26
+ function c(e, n = s, a = i) {
27
+ let { entries: o } = n, c = o[(e % o.length + o.length) % o.length], l = c && r(n, { ref: c.name });
28
+ return (l && t(l)) ?? a;
29
+ }
30
+ var l = c(0);
31
+ function u(t) {
32
+ let n = e(t), r = t.length === 9 && t.startsWith("#") ? t.slice(0, 7) : t;
33
+ return n === 1 ? { color: r } : {
34
+ color: r,
35
+ opacity: n
36
+ };
37
+ }
38
+ function d(e, t = 1) {
39
+ return {
40
+ paint: u(e),
41
+ width: t
42
+ };
43
+ }
44
+ function f(e, t = 1) {
45
+ return {
46
+ paint: e,
47
+ width: t
48
+ };
49
+ }
50
+ var p = { color: "#888" };
51
+ function m(e) {
52
+ return e?.opacity ?? 1;
53
+ }
54
+ function h(e, t) {
55
+ return {
56
+ ...e,
57
+ opacity: Math.max(0, Math.min(1, t))
58
+ };
59
+ }
60
+ function g(e, t) {
61
+ let n = u(t);
62
+ if (t.length === 9 && t.startsWith("#") || e === void 0) return n;
63
+ let r = m(e);
64
+ return r === 1 ? n : {
65
+ ...n,
66
+ opacity: r
67
+ };
68
+ }
69
+ //#endregion
70
+ export { i as DEFAULT_FILL_COLOR, s as DEFAULT_PALETTE, p as DEFAULT_SHAPE_FILL, a as DEFAULT_STROKE_COLOR, l as GHOST_STROKE, c as cycleFill, m as paintAlpha, h as paintWithAlpha, g as paintWithColor, u as solid, d as strokeOf, f as strokeWith };
71
+
72
+ //# sourceMappingURL=paint.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"paint.js","names":["DEFAULT_FILL_COLOR","DEFAULT_STROKE_COLOR","srgb","hexToColorLiteral","hex","DEFAULT_PALETTE","cycleFill","palette","entry","entries","seq","color","resolvePaletteColor","colorLiteralToHex","fallback","GHOST_STROKE","solid","a","getAlpha01","rgb","strokeOf","strokeWith","DEFAULT_SHAPE_FILL","paintAlpha","paint","paintWithAlpha","alpha01","paintWithColor","next","alpha"],"sources":["../../src/util/paint.ts"],"sourcesContent":["/** Kit-shipped default paint constants.\n *\n * Single source of truth for the colors the built-in tools and the default\n * fill/stroke actions reach for. Consumers that want to match the kit's\n * out-of-the-box look (e.g. seed their own active-paint state) should import\n * these rather than re-declaring the literals.\n *\n * All values are `#rrggbbaa` so they round-trip through the kit's hex8 alpha\n * helpers (`util/color`) without ambiguity.\n */\nimport {\n colorLiteralToHex,\n hexToColorLiteral,\n resolvePaletteColor,\n type ColorLiteral,\n type FillStyle,\n type Palette,\n type Stroke,\n} from '@weasel-js/paint';\nimport { getAlpha01 } from './color';\n\n/** Default fill paint for shapes and the fill action — opaque white. */\nexport const DEFAULT_FILL_COLOR = '#ffffffff';\n\n/** Default stroke paint for shapes and the stroke action — opaque black. */\nexport const DEFAULT_STROKE_COLOR = '#000000ff';\n\nconst srgb = (hex: string): ColorLiteral => hexToColorLiteral(hex) as ColorLiteral;\n\n/** Default fill palette cycled through for auto-generated shape nodes\n * (the kit's built-in shape tools and the `insert` action). */\nexport const DEFAULT_PALETTE: Palette = {\n entries: [\n { name: 'sage', color: srgb('#7fb069') },\n { name: 'tan', color: srgb('#d4a574') },\n { name: 'lavender', color: srgb('#a48bd4') },\n { name: 'sky', color: srgb('#7ab8d4') },\n { name: 'rose', color: srgb('#d47a7a') },\n ],\n};\n\n/** The `seq`th color of `palette`'s entries as hex, wrapping past the end.\n * An entry that resolves to nothing, or to a space with no hex form, gives\n * `fallback`. */\nexport function cycleFill(seq: number, palette: Palette = DEFAULT_PALETTE, fallback = DEFAULT_FILL_COLOR): string {\n const { entries } = palette;\n const entry = entries[((seq % entries.length) + entries.length) % entries.length];\n const color = entry && resolvePaletteColor(palette, { ref: entry.name });\n return (color && colorLiteralToHex(color)) ?? fallback;\n}\n\n/** Preview / \"ghost\" stroke color used by drag-to-draw tool overlays and the\n * selected-anchor highlight. Derived from the first palette entry so the\n * preview chrome matches the default insert color. */\nexport const GHOST_STROKE: string = cycleFill(0);\n\n/**\n * A solid paint from a color string — the authoring shorthand for the one\n * shape a node's `data.fill` (and a `Stroke.paint`) may take.\n *\n * An alpha channel in `color` moves to `opacity`, because that is where every\n * paint kind carries its alpha; leaving it in the hex too would multiply the\n * two in the renderer.\n */\nexport function solid(color: string): FillStyle {\n const a = getAlpha01(color);\n const rgb = color.length === 9 && color.startsWith('#') ? color.slice(0, 7) : color;\n return a === 1 ? { color: rgb } : { color: rgb, opacity: a };\n}\n\n/** A solid stroke of `color` at `width` world units. Authoring shorthand for\n * `{ paint: solid(color), width }`. */\nexport function strokeOf(color: string, width = 1): Stroke {\n return { paint: solid(color), width };\n}\n\n/** A stroke painted with `paint` at `width` world units — `strokeOf`'s sibling\n * for a gradient or pattern, which has no color to pass. */\nexport function strokeWith(paint: FillStyle, width = 1): Stroke {\n return { paint, width };\n}\n\n/** The kit's default node paint — what a shape with no declared fill paints. */\nexport const DEFAULT_SHAPE_FILL: FillStyle = { color: '#888' };\n\n/**\n * The 0..1 alpha a paint paints at.\n *\n * Every paint kind carries its alpha in `opacity` — that is the one slot a\n * gradient or a pattern has, so it is the slot all of them use.\n */\nexport function paintAlpha(paint: FillStyle | undefined): number {\n return paint?.opacity ?? 1;\n}\n\n/** `paint` painting at `alpha01` (clamped to 0..1). */\nexport function paintWithAlpha(paint: FillStyle, alpha01: number): FillStyle {\n return { ...paint, opacity: Math.max(0, Math.min(1, alpha01)) };\n}\n\n/**\n * `paint` recolored to `color`, keeping everything else about it.\n *\n * A solid paint takes the new color; a gradient or a pattern has no single\n * color to replace, so it is superseded by a solid one — picking a color off\n * a swatch means \"paint this color\". An alpha channel in `color` wins;\n * without one, the paint's existing opacity carries over.\n */\nexport function paintWithColor(paint: FillStyle | undefined, color: string): FillStyle {\n const next = solid(color);\n const explicitAlpha = color.length === 9 && color.startsWith('#');\n if (explicitAlpha || paint === undefined) return next;\n const alpha = paintAlpha(paint);\n return alpha === 1 ? next : { ...next, opacity: alpha };\n}\n"],"mappings":";;;AAsBA,IAAaA,IAAqB,aAGrBC,IAAuB,aAE9BC,KAAQ,MAA8BC,EAAkBC,CAAG,GAIpDC,IAA2B,EACtC,SAAS;CACP;EAAE,MAAM;EAAQ,OAAOH,EAAK,SAAS;CAAE;CACvC;EAAE,MAAM;EAAO,OAAOA,EAAK,SAAS;CAAE;CACtC;EAAE,MAAM;EAAY,OAAOA,EAAK,SAAS;CAAE;CAC3C;EAAE,MAAM;EAAO,OAAOA,EAAK,SAAS;CAAE;CACtC;EAAE,MAAM;EAAQ,OAAOA,EAAK,SAAS;CAAE;AACzC,EACF;AAKA,SAAgBI,EAAU,GAAa,IAAmBD,GAAiB,IAAWL,GAA4B;CAChH,IAAM,EAAE,eAAYO,GACdC,IAAQC,GAAUC,IAAMD,EAAQ,SAAUA,EAAQ,UAAUA,EAAQ,SACpEE,IAAQH,KAASI,EAAoBL,GAAS,EAAE,KAAKC,EAAM,KAAK,CAAC;CACvE,QAAQG,KAASE,EAAkBF,CAAK,MAAMG;AAChD;AAKA,IAAaC,IAAuBT,EAAU,CAAC;AAU/C,SAAgBU,EAAM,GAA0B;CAC9C,IAAMC,IAAIC,EAAWP,CAAK,GACpBQ,IAAMR,EAAM,WAAW,KAAKA,EAAM,WAAW,GAAG,IAAIA,EAAM,MAAM,GAAG,CAAC,IAAIA;CAC9E,OAAOM,MAAM,IAAI,EAAE,OAAOE,EAAI,IAAI;EAAE,OAAOA;EAAK,SAASF;CAAE;AAC7D;AAIA,SAAgBG,EAAS,GAAe,IAAQ,GAAW;CACzD,OAAO;EAAE,OAAOJ,EAAML,CAAK;EAAG;CAAM;AACtC;AAIA,SAAgBU,EAAW,GAAkB,IAAQ,GAAW;CAC9D,OAAO;EAAE;EAAO;CAAM;AACxB;AAGA,IAAaC,IAAgC,EAAE,OAAO,OAAO;AAQ7D,SAAgBC,EAAW,GAAsC;CAC/D,OAAOC,GAAO,WAAW;AAC3B;AAGA,SAAgBC,EAAe,GAAkB,GAA4B;CAC3E,OAAO;EAAE,GAAGD;EAAO,SAAS,KAAK,IAAI,GAAG,KAAK,IAAI,GAAGE,CAAO,CAAC;CAAE;AAChE;AAUA,SAAgBC,EAAe,GAA8B,GAA0B;CACrF,IAAMC,IAAOZ,EAAML,CAAK;CAExB,IADsBA,EAAM,WAAW,KAAKA,EAAM,WAAW,GAAG,KAC3Ca,MAAU,KAAA,GAAW,OAAOI;CACjD,IAAMC,IAAQN,EAAWC,CAAK;CAC9B,OAAOK,MAAU,IAAID,IAAO;EAAE,GAAGA;EAAM,SAASC;CAAM;AACxD"}
@@ -0,0 +1,6 @@
1
+ //#region src/version.ts
2
+ var e = "1.7.2";
3
+ //#endregion
4
+ export { e as VERSION };
5
+
6
+ //# sourceMappingURL=version.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"version.js","names":["VERSION"],"sources":["../src/version.ts"],"sourcesContent":["/**\n * The kit version a build was compiled from, so an app can report what it is\n * running. Substituted at build time — by `vite.config.ts` for the published\n * package, and by `scripts/vite-build-info.ts` for anything in this repo that\n * bundles core's source through the workspace aliases.\n *\n * Apps pair this with their own compile timestamp; the kit deliberately does\n * not carry one, since a published package's build date says nothing about\n * when the app embedding it was built.\n */\n\ndeclare const __WEASEL_CORE_VERSION__: string | undefined;\n\n/**\n * Semver of `@weasel-js/core` as of the build.\n *\n * Falls back to `'0.0.0-unknown'` when core's source is imported by a bundler\n * that hasn't been given the define — honest about not knowing rather than\n * throwing, since nothing about version reporting should be able to break a\n * consumer's build.\n */\nexport const VERSION: string =\n typeof __WEASEL_CORE_VERSION__ === 'string' ? __WEASEL_CORE_VERSION__ : '0.0.0-unknown';\n"],"mappings":";AAqBA,IAAaA,IAAA"}