@weasel-js/core 1.9.3 → 1.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (1139) hide show
  1. package/CHANGELOG.md +1106 -0
  2. package/README.md +7 -5
  3. package/dist/WeaselProvider.js +5 -7
  4. package/dist/WeaselProvider.js.map +1 -1
  5. package/dist/affordances/composeAffordanceLayer.js +91 -93
  6. package/dist/affordances/composeAffordanceLayer.js.map +1 -1
  7. package/dist/affordances/cornerResize.js +27 -18
  8. package/dist/affordances/cornerResize.js.map +1 -1
  9. package/dist/affordances/hitAffordanceRegions.js +65 -104
  10. package/dist/affordances/hitAffordanceRegions.js.map +1 -1
  11. package/dist/affordances/pathAnchors.js.map +1 -1
  12. package/dist/affordances/rotationHandle.js +22 -21
  13. package/dist/affordances/rotationHandle.js.map +1 -1
  14. package/dist/animation/behaviors/coast.js +21 -0
  15. package/dist/animation/behaviors/coast.js.map +1 -0
  16. package/dist/animation/behaviors/coastByWrite.js +107 -0
  17. package/dist/animation/behaviors/coastByWrite.js.map +1 -0
  18. package/dist/animation/behaviors/coastOnTargets.js +94 -0
  19. package/dist/animation/behaviors/coastOnTargets.js.map +1 -0
  20. package/dist/animation/behaviors/momentum.js +38 -88
  21. package/dist/animation/behaviors/momentum.js.map +1 -1
  22. package/dist/animation/clipTargets.js +12 -0
  23. package/dist/animation/clipTargets.js.map +1 -0
  24. package/dist/animation/index.js +15 -20
  25. package/dist/animation/poseHelpers.js +112 -33
  26. package/dist/animation/poseHelpers.js.map +1 -1
  27. package/dist/animation/poseTarget.js +115 -0
  28. package/dist/animation/poseTarget.js.map +1 -0
  29. package/dist/animation/reflow.js +113 -83
  30. package/dist/animation/reflow.js.map +1 -1
  31. package/dist/animation/rewind.js +66 -0
  32. package/dist/animation/rewind.js.map +1 -0
  33. package/dist/animation/rig/bindRig.js +85 -53
  34. package/dist/animation/rig/bindRig.js.map +1 -1
  35. package/dist/animation/rig/rigNode.js +93 -0
  36. package/dist/animation/rig/rigNode.js.map +1 -0
  37. package/dist/animation/rig/rigSeat.js +26 -0
  38. package/dist/animation/rig/rigSeat.js.map +1 -0
  39. package/dist/animation/rig/skinBinding.js +56 -0
  40. package/dist/animation/rig/skinBinding.js.map +1 -0
  41. package/dist/animation/rig/useRig.js +31 -16
  42. package/dist/animation/rig/useRig.js.map +1 -1
  43. package/dist/animation/wrappers/animateLifecycle.js +32 -24
  44. package/dist/animation/wrappers/animateLifecycle.js.map +1 -1
  45. package/dist/animation/wrappers/animateOnSetPose.js +31 -29
  46. package/dist/animation/wrappers/animateOnSetPose.js.map +1 -1
  47. package/dist/animation/wrappers/instantPose.js +13 -0
  48. package/dist/animation/wrappers/instantPose.js.map +1 -0
  49. package/dist/animation/writtenPoseTarget.js +33 -0
  50. package/dist/animation/writtenPoseTarget.js.map +1 -0
  51. package/dist/{autoPoseDescriptor-vCdt55xm.d.ts → autoPoseDescriptor-DHg5KqaJ.d.ts} +1 -1
  52. package/dist/barrel/canvas.js +31 -0
  53. package/dist/barrel/chrome.js +16 -0
  54. package/dist/barrel/input.js +18 -0
  55. package/dist/barrel/interactions.js +38 -0
  56. package/dist/barrel/paint.js +11 -0
  57. package/dist/barrel/paths.js +12 -0
  58. package/dist/barrel/renderer.js +14 -0
  59. package/dist/barrel/routing.js +57 -0
  60. package/dist/barrel/scene.js +37 -0
  61. package/dist/barrel/text.js +9 -0
  62. package/dist/barrel/viewport.js +42 -0
  63. package/dist/canvas/Canvas.js +280 -559
  64. package/dist/canvas/Canvas.js.map +1 -1
  65. package/dist/canvas/CanvasView.js +147 -167
  66. package/dist/canvas/CanvasView.js.map +1 -1
  67. package/dist/canvas/CursorCoordsHud.js +53 -49
  68. package/dist/canvas/CursorCoordsHud.js.map +1 -1
  69. package/dist/canvas/DrawCanvas.js +40 -51
  70. package/dist/canvas/DrawCanvas.js.map +1 -1
  71. package/dist/canvas/ModalityHud.js.map +1 -1
  72. package/dist/canvas/NodeShape.js +55 -374
  73. package/dist/canvas/NodeShape.js.map +1 -1
  74. package/dist/canvas/PickHud.js +50 -47
  75. package/dist/canvas/PickHud.js.map +1 -1
  76. package/dist/canvas/SceneCanvas/DevHuds.js +40 -0
  77. package/dist/canvas/SceneCanvas/DevHuds.js.map +1 -0
  78. package/dist/canvas/SceneCanvas/GestureDispatcherMounter.js +126 -0
  79. package/dist/canvas/SceneCanvas/GestureDispatcherMounter.js.map +1 -0
  80. package/dist/canvas/SceneCanvas/PointerProviderIfRoot.js +27 -31
  81. package/dist/canvas/SceneCanvas/PointerProviderIfRoot.js.map +1 -1
  82. package/dist/canvas/SceneCanvas/StandardActionsRegistrar.js +64 -0
  83. package/dist/canvas/SceneCanvas/StandardActionsRegistrar.js.map +1 -0
  84. package/dist/canvas/SceneCanvas/ToolKeybindingsMounter.js +16 -0
  85. package/dist/canvas/SceneCanvas/ToolKeybindingsMounter.js.map +1 -0
  86. package/dist/canvas/SceneCanvas/coordTrace.js +46 -0
  87. package/dist/canvas/SceneCanvas/coordTrace.js.map +1 -0
  88. package/dist/canvas/SceneCanvas/defaultNodeProperties.js +138 -85
  89. package/dist/canvas/SceneCanvas/defaultNodeProperties.js.map +1 -1
  90. package/dist/canvas/SceneCanvas/defaultNodeRouting.js +9 -8
  91. package/dist/canvas/SceneCanvas/defaultNodeRouting.js.map +1 -1
  92. package/dist/canvas/SceneCanvas/dispatcherGestureBounds.js.map +1 -1
  93. package/dist/canvas/SceneCanvas/features.js +74 -43
  94. package/dist/canvas/SceneCanvas/features.js.map +1 -1
  95. package/dist/canvas/SceneCanvas/isDev.js +12 -0
  96. package/dist/canvas/SceneCanvas/isDev.js.map +1 -0
  97. package/dist/canvas/SceneCanvas/poseGeometry.js +31 -34
  98. package/dist/canvas/SceneCanvas/poseGeometry.js.map +1 -1
  99. package/dist/canvas/SceneCanvas/poseRegistrars.js +13 -0
  100. package/dist/canvas/SceneCanvas/poseRegistrars.js.map +1 -0
  101. package/dist/canvas/SceneCanvas/props.js +39 -0
  102. package/dist/canvas/SceneCanvas/props.js.map +1 -0
  103. package/dist/canvas/SceneCanvas/toolRegistry.js +23 -0
  104. package/dist/canvas/SceneCanvas/toolRegistry.js.map +1 -0
  105. package/dist/canvas/SceneCanvas/useActionsPropResolver.js +6 -1
  106. package/dist/canvas/SceneCanvas/useActionsPropResolver.js.map +1 -1
  107. package/dist/canvas/SceneCanvas/useBuiltinShapeTools.js +21 -62
  108. package/dist/canvas/SceneCanvas/useBuiltinShapeTools.js.map +1 -1
  109. package/dist/canvas/SceneCanvas/useBuiltinTools.js +21 -0
  110. package/dist/canvas/SceneCanvas/useBuiltinTools.js.map +1 -0
  111. package/dist/canvas/SceneCanvas/useCanvasCamera.js +38 -0
  112. package/dist/canvas/SceneCanvas/useCanvasCamera.js.map +1 -0
  113. package/dist/canvas/SceneCanvas/useCanvasDispatcher.js +20 -0
  114. package/dist/canvas/SceneCanvas/useCanvasDispatcher.js.map +1 -0
  115. package/dist/canvas/SceneCanvas/useCanvasSelection.js +16 -0
  116. package/dist/canvas/SceneCanvas/useCanvasSelection.js.map +1 -0
  117. package/dist/canvas/SceneCanvas/useCanvasTools.js +67 -0
  118. package/dist/canvas/SceneCanvas/useCanvasTools.js.map +1 -0
  119. package/dist/canvas/SceneCanvas/useDispatcherOverlayLayer.js +29 -29
  120. package/dist/canvas/SceneCanvas/useDispatcherOverlayLayer.js.map +1 -1
  121. package/dist/canvas/SceneCanvas/useHeldModifiers.js +20 -0
  122. package/dist/canvas/SceneCanvas/useHeldModifiers.js.map +1 -0
  123. package/dist/canvas/SceneCanvas/useNodeAtPoint.js +26 -0
  124. package/dist/canvas/SceneCanvas/useNodeAtPoint.js.map +1 -0
  125. package/dist/canvas/SceneCanvas/useNodeKinds.js +26 -0
  126. package/dist/canvas/SceneCanvas/useNodeKinds.js.map +1 -0
  127. package/dist/canvas/SceneCanvas/usePreviewGhostLayer.js +48 -48
  128. package/dist/canvas/SceneCanvas/usePreviewGhostLayer.js.map +1 -1
  129. package/dist/canvas/SceneCanvas/useSceneCanvasHandle.js +47 -0
  130. package/dist/canvas/SceneCanvas/useSceneCanvasHandle.js.map +1 -0
  131. package/dist/canvas/SceneCanvas/useSceneCanvasLayers.js +66 -0
  132. package/dist/canvas/SceneCanvas/useSceneCanvasLayers.js.map +1 -0
  133. package/dist/canvas/SceneCanvas/useSceneChrome.js +59 -0
  134. package/dist/canvas/SceneCanvas/useSceneChrome.js.map +1 -0
  135. package/dist/canvas/SceneCanvas/useSceneRedrawSources.js +23 -0
  136. package/dist/canvas/SceneCanvas/useSceneRedrawSources.js.map +1 -0
  137. package/dist/canvas/SceneCanvas/useSceneSelectTool.js +74 -78
  138. package/dist/canvas/SceneCanvas/useSceneSelectTool.js.map +1 -1
  139. package/dist/canvas/SceneCanvas/useSceneSlotLayers.js +37 -0
  140. package/dist/canvas/SceneCanvas/useSceneSlotLayers.js.map +1 -0
  141. package/dist/canvas/SceneCanvas/useSelectionOverlayLayer.js +38 -0
  142. package/dist/canvas/SceneCanvas/useSelectionOverlayLayer.js.map +1 -0
  143. package/dist/canvas/SceneCanvas/useViewLayerGate.js +20 -0
  144. package/dist/canvas/SceneCanvas/useViewLayerGate.js.map +1 -0
  145. package/dist/canvas/SceneCanvas/useViewportActions.js +9 -1
  146. package/dist/canvas/SceneCanvas/useViewportActions.js.map +1 -1
  147. package/dist/canvas/SceneCanvas/worldPointAt.js +9 -0
  148. package/dist/canvas/SceneCanvas/worldPointAt.js.map +1 -0
  149. package/dist/canvas/SceneCanvas.js +311 -969
  150. package/dist/canvas/SceneCanvas.js.map +1 -1
  151. package/dist/canvas/SceneViewCanvas.js +42 -46
  152. package/dist/canvas/SceneViewCanvas.js.map +1 -1
  153. package/dist/canvas/adapterDerivedPath.js +26 -0
  154. package/dist/canvas/adapterDerivedPath.js.map +1 -0
  155. package/dist/canvas/affordanceAt.js +11 -1
  156. package/dist/canvas/affordanceAt.js.map +1 -1
  157. package/dist/canvas/buildSceneLayer.js +111 -0
  158. package/dist/canvas/buildSceneLayer.js.map +1 -0
  159. package/dist/canvas/buildSceneTree.js +16 -19
  160. package/dist/canvas/buildSceneTree.js.map +1 -1
  161. package/dist/canvas/canvasRenderer.js +67 -55
  162. package/dist/canvas/canvasRenderer.js.map +1 -1
  163. package/dist/canvas/colorOverrides.js.map +1 -1
  164. package/dist/canvas/defaultDrawOne.js +12 -12
  165. package/dist/canvas/defaultDrawOne.js.map +1 -1
  166. package/dist/canvas/deps/areaSelect.js +4 -4
  167. package/dist/canvas/deps/areaSelect.js.map +1 -1
  168. package/dist/canvas/deps/changes.js +13 -0
  169. package/dist/canvas/deps/changes.js.map +1 -0
  170. package/dist/canvas/deps/debug.js.map +1 -1
  171. package/dist/canvas/deps/editAnchors.js +38 -57
  172. package/dist/canvas/deps/editAnchors.js.map +1 -1
  173. package/dist/canvas/deps/geometryProjection.js.map +1 -1
  174. package/dist/canvas/deps/hitTestArea.js +31 -26
  175. package/dist/canvas/deps/hitTestArea.js.map +1 -1
  176. package/dist/canvas/deps/insert.js +130 -91
  177. package/dist/canvas/deps/insert.js.map +1 -1
  178. package/dist/canvas/deps/lassoSelect.js +5 -5
  179. package/dist/canvas/deps/lassoSelect.js.map +1 -1
  180. package/dist/canvas/deps/poseDescriptor.js +1 -1
  181. package/dist/canvas/deps/poseDescriptor.js.map +1 -1
  182. package/dist/canvas/deps/resizePolicy.js.map +1 -1
  183. package/dist/canvas/deps/slice.js +26 -26
  184. package/dist/canvas/deps/slice.js.map +1 -1
  185. package/dist/canvas/deps/textEdit.js +6 -5
  186. package/dist/canvas/deps/textEdit.js.map +1 -1
  187. package/dist/canvas/deps/view.js.map +1 -1
  188. package/dist/canvas/derivedPath.js +47 -22
  189. package/dist/canvas/derivedPath.js.map +1 -1
  190. package/dist/canvas/drawEnvelope.js +8 -4
  191. package/dist/canvas/drawEnvelope.js.map +1 -1
  192. package/dist/canvas/getNodeAtPoint.js +4 -8
  193. package/dist/canvas/getNodeAtPoint.js.map +1 -1
  194. package/dist/canvas/hud.module.js +1 -1
  195. package/dist/canvas/hud.module.js.map +1 -1
  196. package/dist/canvas/insertPreviewExtent.js.map +1 -1
  197. package/dist/canvas/kitRequirements.js +2 -2
  198. package/dist/canvas/kitRequirements.js.map +1 -1
  199. package/dist/canvas/layerOrder.js +13 -6
  200. package/dist/canvas/layerOrder.js.map +1 -1
  201. package/dist/canvas/layerSlots.js +6 -1
  202. package/dist/canvas/layerSlots.js.map +1 -1
  203. package/dist/canvas/nodeShapes/derivedPainter.js +34 -0
  204. package/dist/canvas/nodeShapes/derivedPainter.js.map +1 -0
  205. package/dist/canvas/nodeShapes/imagePainter.js +87 -0
  206. package/dist/canvas/nodeShapes/imagePainter.js.map +1 -0
  207. package/dist/canvas/nodeShapes/memo.js +9 -0
  208. package/dist/canvas/nodeShapes/memo.js.map +1 -0
  209. package/dist/canvas/nodeShapes/nodePaint.js +68 -0
  210. package/dist/canvas/nodeShapes/nodePaint.js.map +1 -0
  211. package/dist/canvas/nodeShapes/pathPainter.js +39 -0
  212. package/dist/canvas/nodeShapes/pathPainter.js.map +1 -0
  213. package/dist/canvas/nodeShapes/poseBox.js +20 -0
  214. package/dist/canvas/nodeShapes/poseBox.js.map +1 -0
  215. package/dist/canvas/nodeShapes/rectFallbackPainter.js +38 -0
  216. package/dist/canvas/nodeShapes/rectFallbackPainter.js.map +1 -0
  217. package/dist/canvas/nodeShapes/shapePainter.js +72 -0
  218. package/dist/canvas/nodeShapes/shapePainter.js.map +1 -0
  219. package/dist/canvas/nodeShapes/textPainter.js +55 -0
  220. package/dist/canvas/nodeShapes/textPainter.js.map +1 -0
  221. package/dist/canvas/overlayRoleStrokes.js.map +1 -1
  222. package/dist/canvas/paintCull.js +11 -14
  223. package/dist/canvas/paintCull.js.map +1 -1
  224. package/dist/{features/cursor → canvas}/paintedCursorLayer.js +2 -2
  225. package/dist/canvas/paintedCursorLayer.js.map +1 -0
  226. package/dist/canvas/pickWalk.js +59 -68
  227. package/dist/canvas/pickWalk.js.map +1 -1
  228. package/dist/canvas/planeClips.js +18 -19
  229. package/dist/canvas/planeClips.js.map +1 -1
  230. package/dist/canvas/poseCascade.js +41 -0
  231. package/dist/canvas/poseCascade.js.map +1 -0
  232. package/dist/canvas/poseRotation.js +9 -23
  233. package/dist/canvas/poseRotation.js.map +1 -1
  234. package/dist/canvas/rasterReadback.js +22 -0
  235. package/dist/canvas/rasterReadback.js.map +1 -0
  236. package/dist/canvas/renderDebugSnapshot.js +11 -11
  237. package/dist/canvas/renderDebugSnapshot.js.map +1 -1
  238. package/dist/canvas/renderNeeds.js +3 -3
  239. package/dist/canvas/renderNeeds.js.map +1 -1
  240. package/dist/canvas/renderSceneToPixels.js +64 -81
  241. package/dist/canvas/renderSceneToPixels.js.map +1 -1
  242. package/dist/canvas/sceneAdapter.js +68 -214
  243. package/dist/canvas/sceneAdapter.js.map +1 -1
  244. package/dist/canvas/sceneClipboard.js +112 -0
  245. package/dist/canvas/sceneClipboard.js.map +1 -0
  246. package/dist/canvas/sceneLayerPaint.js +4 -4
  247. package/dist/canvas/sceneLayerPaint.js.map +1 -1
  248. package/dist/canvas/sceneSlotWiring.js.map +1 -1
  249. package/dist/canvas/sceneViewRender.js +39 -39
  250. package/dist/canvas/sceneViewRender.js.map +1 -1
  251. package/dist/canvas/slopsDebugLayer.js +4 -4
  252. package/dist/canvas/slopsDebugLayer.js.map +1 -1
  253. package/dist/canvas/surface.module.js +6 -0
  254. package/dist/canvas/surface.module.js.map +1 -0
  255. package/dist/canvas/surfaceBox.js +16 -0
  256. package/dist/canvas/surfaceBox.js.map +1 -0
  257. package/dist/canvas/useCanvasRenderer.js +26 -6
  258. package/dist/canvas/useCanvasRenderer.js.map +1 -1
  259. package/dist/canvas/useCanvasSurface.js +31 -0
  260. package/dist/canvas/useCanvasSurface.js.map +1 -0
  261. package/dist/canvas/useCanvasView.js +67 -0
  262. package/dist/canvas/useCanvasView.js.map +1 -0
  263. package/dist/canvas/useFrameLoop.js +39 -31
  264. package/dist/canvas/useFrameLoop.js.map +1 -1
  265. package/dist/canvas/useHostAnchor.js +35 -33
  266. package/dist/canvas/useHostAnchor.js.map +1 -1
  267. package/dist/canvas/useLateContentRedraw.js +8 -8
  268. package/dist/canvas/useLateContentRedraw.js.map +1 -1
  269. package/dist/canvas/useSceneLayerList.js +11 -0
  270. package/dist/canvas/useSceneLayerList.js.map +1 -0
  271. package/dist/canvas/useSurfaceInput.js +42 -0
  272. package/dist/canvas/useSurfaceInput.js.map +1 -0
  273. package/dist/canvas/useToolCursor.js +29 -0
  274. package/dist/canvas/useToolCursor.js.map +1 -0
  275. package/dist/canvas/useViewHelpers.js +46 -85
  276. package/dist/canvas/useViewHelpers.js.map +1 -1
  277. package/dist/canvas/viewInputs.js.map +1 -1
  278. package/dist/canvas/viewRegistry.js +25 -27
  279. package/dist/canvas/viewRegistry.js.map +1 -1
  280. package/dist/canvas/watchElementMove.js +43 -0
  281. package/dist/canvas/watchElementMove.js.map +1 -0
  282. package/dist/canvas/wrapNodeOutput.js.map +1 -1
  283. package/dist/clipboard.d.ts +16 -19
  284. package/dist/{types-B_9g6hMM.d.ts → clone-2a5hVbBd.d.ts} +123 -74
  285. package/dist/clone.d.ts +4 -7
  286. package/dist/clone.js +0 -2
  287. package/dist/core/device/index.js +5 -4
  288. package/dist/core/device/targets.js.map +1 -1
  289. package/dist/core/device/useDeviceProfile.js +38 -44
  290. package/dist/core/device/useDeviceProfile.js.map +1 -1
  291. package/dist/core/device/watchDevicePixelRatio.js +17 -0
  292. package/dist/core/device/watchDevicePixelRatio.js.map +1 -0
  293. package/dist/{interactions/actions/resize → core/geometry}/autoPoseDescriptor.js +8 -7
  294. package/dist/core/geometry/autoPoseDescriptor.js.map +1 -0
  295. package/dist/core/geometry/pathPoseDescriptor.js +88 -0
  296. package/dist/core/geometry/pathPoseDescriptor.js.map +1 -0
  297. package/dist/core/geometry/poseDescriptor.js +68 -19
  298. package/dist/core/geometry/poseDescriptor.js.map +1 -1
  299. package/dist/core/geometry/regionHit.js +31 -34
  300. package/dist/core/geometry/regionHit.js.map +1 -1
  301. package/dist/core/geometry/targetFrame.js +94 -0
  302. package/dist/core/geometry/targetFrame.js.map +1 -0
  303. package/dist/core/geometry/unionBounds.js +30 -29
  304. package/dist/core/geometry/unionBounds.js.map +1 -1
  305. package/dist/core/isPlainObject.js +2 -11
  306. package/dist/core/layers/backgroundFill.js +31 -0
  307. package/dist/core/layers/backgroundFill.js.map +1 -0
  308. package/dist/{features/groups → core/layers}/children.js +1 -1
  309. package/dist/core/layers/children.js.map +1 -0
  310. package/dist/core/layers/gateLayer.js +13 -0
  311. package/dist/core/layers/gateLayer.js.map +1 -0
  312. package/dist/core/layers/layerGroup.js +40 -0
  313. package/dist/core/layers/layerGroup.js.map +1 -0
  314. package/dist/core/layers/render.js +50 -76
  315. package/dist/core/layers/render.js.map +1 -1
  316. package/dist/core/ops/arrange.js +1 -0
  317. package/dist/core/ops/arrange.js.map +1 -1
  318. package/dist/core/ops/create.js +10 -5
  319. package/dist/core/ops/create.js.map +1 -1
  320. package/dist/core/ops/createHistory.js +9 -9
  321. package/dist/core/ops/createHistory.js.map +1 -1
  322. package/dist/core/ops/delete.js +12 -24
  323. package/dist/core/ops/delete.js.map +1 -1
  324. package/dist/core/ops/reorder/index.js +43 -40
  325. package/dist/core/ops/reorder/index.js.map +1 -1
  326. package/dist/core/ops/reorder/setChildOrder.js +34 -0
  327. package/dist/core/ops/reorder/setChildOrder.js.map +1 -0
  328. package/dist/core/paint/meshKind.js +16 -0
  329. package/dist/core/paint/meshKind.js.map +1 -0
  330. package/dist/{features/meshPaint/lazyKind.js → core/paint/meshKindLazy.js} +282 -105
  331. package/dist/core/paint/meshKindLazy.js.map +1 -0
  332. package/dist/core/paint/paintKindEntry.js +8 -0
  333. package/dist/core/paint/paintKindEntry.js.map +1 -0
  334. package/dist/core/paint/paintKinds.js +144 -0
  335. package/dist/core/paint/paintKinds.js.map +1 -0
  336. package/dist/core/paint/registerMesh.js +7 -0
  337. package/dist/core/paint/registerMesh.js.map +1 -0
  338. package/dist/core/scene/NodeProperties.js.map +1 -1
  339. package/dist/core/scene/NodeRouting.js.map +1 -1
  340. package/dist/core/scene/appliedLog.js +37 -0
  341. package/dist/core/scene/appliedLog.js.map +1 -0
  342. package/dist/core/scene/arrivalWindow.js +102 -0
  343. package/dist/core/scene/arrivalWindow.js.map +1 -0
  344. package/dist/core/scene/boundOps.js +40 -0
  345. package/dist/core/scene/boundOps.js.map +1 -0
  346. package/dist/core/scene/composeFrame.js +9 -6
  347. package/dist/core/scene/composeFrame.js.map +1 -1
  348. package/dist/{features/groups → core/scene}/composePose.js +18 -18
  349. package/dist/core/scene/composePose.js.map +1 -0
  350. package/dist/core/scene/depMemo.js +31 -6
  351. package/dist/core/scene/depMemo.js.map +1 -1
  352. package/dist/core/scene/derivedPath.js +19 -20
  353. package/dist/core/scene/derivedPath.js.map +1 -1
  354. package/dist/core/scene/editMode.js +26 -0
  355. package/dist/core/scene/editMode.js.map +1 -0
  356. package/dist/core/scene/effectivePose.js +38 -39
  357. package/dist/core/scene/effectivePose.js.map +1 -1
  358. package/dist/core/scene/fieldEdits.js +98 -0
  359. package/dist/core/scene/fieldEdits.js.map +1 -0
  360. package/dist/core/scene/historyFacade.js +130 -0
  361. package/dist/core/scene/historyFacade.js.map +1 -0
  362. package/dist/core/scene/historyForm.js +6 -0
  363. package/dist/core/scene/historyForm.js.map +1 -0
  364. package/dist/core/scene/kitOps.js +185 -0
  365. package/dist/core/scene/kitOps.js.map +1 -0
  366. package/dist/core/scene/kitRegistry.js.map +1 -1
  367. package/dist/core/scene/layerStack.js +131 -0
  368. package/dist/core/scene/layerStack.js.map +1 -0
  369. package/dist/core/scene/layoutPass.js +58 -59
  370. package/dist/core/scene/layoutPass.js.map +1 -1
  371. package/dist/core/scene/lockGuard.js +37 -0
  372. package/dist/core/scene/lockGuard.js.map +1 -0
  373. package/dist/{features/groups → core/scene}/nestedHit.js +3 -3
  374. package/dist/core/scene/nestedHit.js.map +1 -0
  375. package/dist/core/scene/nodeFnFields.js +10 -11
  376. package/dist/core/scene/nodeFnFields.js.map +1 -1
  377. package/dist/core/scene/nodeMemo.js +45 -19
  378. package/dist/core/scene/nodeMemo.js.map +1 -1
  379. package/dist/core/scene/nodeStore.js +127 -0
  380. package/dist/core/scene/nodeStore.js.map +1 -0
  381. package/dist/core/scene/notifier.js +37 -0
  382. package/dist/core/scene/notifier.js.map +1 -0
  383. package/dist/core/scene/opTable.js +50 -0
  384. package/dist/core/scene/opTable.js.map +1 -0
  385. package/dist/core/scene/outerOps.js +66 -0
  386. package/dist/core/scene/outerOps.js.map +1 -0
  387. package/dist/core/scene/poseFeed.js +38 -38
  388. package/dist/core/scene/poseFeed.js.map +1 -1
  389. package/dist/core/scene/poseHold.js +39 -0
  390. package/dist/core/scene/poseHold.js.map +1 -0
  391. package/dist/core/scene/poseOverrides.js +44 -40
  392. package/dist/core/scene/poseOverrides.js.map +1 -1
  393. package/dist/core/scene/poseSnapshot.js.map +1 -1
  394. package/dist/core/scene/reconcileSpecs.js +3 -2
  395. package/dist/core/scene/reconcileSpecs.js.map +1 -1
  396. package/dist/core/scene/recorder.js +86 -0
  397. package/dist/core/scene/recorder.js.map +1 -0
  398. package/dist/core/scene/renderOrder.js +84 -0
  399. package/dist/core/scene/renderOrder.js.map +1 -0
  400. package/dist/core/scene/scene.js +80 -1266
  401. package/dist/core/scene/scene.js.map +1 -1
  402. package/dist/core/scene/sceneEdits.js +58 -0
  403. package/dist/core/scene/sceneEdits.js.map +1 -0
  404. package/dist/core/scene/sceneMutators.js +49 -0
  405. package/dist/core/scene/sceneMutators.js.map +1 -0
  406. package/dist/core/scene/scenePoseAdapter.js +16 -0
  407. package/dist/core/scene/scenePoseAdapter.js.map +1 -0
  408. package/dist/core/scene/sceneRecording.js +90 -0
  409. package/dist/core/scene/sceneRecording.js.map +1 -0
  410. package/dist/core/scene/sceneSelection.js +28 -0
  411. package/dist/core/scene/sceneSelection.js.map +1 -0
  412. package/dist/core/scene/sceneState.js +49 -0
  413. package/dist/core/scene/sceneState.js.map +1 -0
  414. package/dist/core/scene/serialization.js +71 -0
  415. package/dist/core/scene/serialization.js.map +1 -0
  416. package/dist/core/scene/staleReplay.js +51 -0
  417. package/dist/core/scene/staleReplay.js.map +1 -0
  418. package/dist/core/scene/statedFields.js +9 -0
  419. package/dist/core/scene/statedFields.js.map +1 -0
  420. package/dist/core/scene/treeEdits.js +127 -0
  421. package/dist/core/scene/treeEdits.js.map +1 -0
  422. package/dist/core/scene/treeOrder.js +13 -0
  423. package/dist/core/scene/treeOrder.js.map +1 -0
  424. package/dist/core/scene/treeReads.js +26 -0
  425. package/dist/core/scene/treeReads.js.map +1 -0
  426. package/dist/core/scene/types.js.map +1 -1
  427. package/dist/{features/groups → core/scene}/unionOfChildren.js +3 -3
  428. package/dist/core/scene/unionOfChildren.js.map +1 -0
  429. package/dist/core/scene/unitScopes.js +13 -0
  430. package/dist/core/scene/unitScopes.js.map +1 -0
  431. package/dist/core/scene/useScene.js.map +1 -1
  432. package/dist/core/selection/readOnlySelection.js +32 -0
  433. package/dist/core/selection/readOnlySelection.js.map +1 -0
  434. package/dist/core/selection/usePublishSceneSelection.js +26 -0
  435. package/dist/core/selection/usePublishSceneSelection.js.map +1 -0
  436. package/dist/core/selection/useSelection.js +34 -25
  437. package/dist/core/selection/useSelection.js.map +1 -1
  438. package/dist/core/shapeKinds.js.map +1 -1
  439. package/dist/core/stylus/stylus.js.map +1 -1
  440. package/dist/core/stylus/usePointerStylus.js.map +1 -1
  441. package/dist/core/usePaintKinds.js +1 -1
  442. package/dist/core/usePaintKinds.js.map +1 -1
  443. package/dist/core/viewport/clientToWorld.js.map +1 -1
  444. package/dist/core/viewport/fitViewToBounds.js.map +1 -1
  445. package/dist/core/viewport/parallax.js.map +1 -1
  446. package/dist/core/viewport/screenSlop.js +11 -11
  447. package/dist/core/viewport/screenSlop.js.map +1 -1
  448. package/dist/core/viewport/useCanvasSize.js.map +1 -1
  449. package/dist/core/viewport/useDecayLoop.js +8 -8
  450. package/dist/core/viewport/useDecayLoop.js.map +1 -1
  451. package/dist/core/viewport/useNodeOverlayFrame.js +84 -0
  452. package/dist/core/viewport/useNodeOverlayFrame.js.map +1 -0
  453. package/dist/core/viewport/useViewAnimation.js +102 -43
  454. package/dist/core/viewport/useViewAnimation.js.map +1 -1
  455. package/dist/core/viewport/view.js +9 -9
  456. package/dist/core/viewport/view.js.map +1 -1
  457. package/dist/core/viewport/wheelHandler.js.map +1 -1
  458. package/dist/core/viewport/zoomBounds.js +10 -8
  459. package/dist/core/viewport/zoomBounds.js.map +1 -1
  460. package/dist/{cornerHandles-BCrDp_mH.d.ts → cornerHandles-BEshc4z3.d.ts} +11 -24
  461. package/dist/debug/createDebugOverlayLayer.js +97 -97
  462. package/dist/debug/createDebugOverlayLayer.js.map +1 -1
  463. package/dist/debug/createDebugSink.js.map +1 -1
  464. package/dist/debug/flag.js +2 -41
  465. package/dist/debug/frameStats.js.map +1 -1
  466. package/dist/debug/useDebugSink.js +52 -0
  467. package/dist/debug/useDebugSink.js.map +1 -0
  468. package/dist/features/chrome-caps/buildChromeCtx.js.map +1 -1
  469. package/dist/features/chrome-caps/conditions.js.map +1 -1
  470. package/dist/features/chrome-caps/defaults.js.map +1 -1
  471. package/dist/features/chrome-caps/resolve.js.map +1 -1
  472. package/dist/features/chrome-caps/useChromeCaps.js +54 -0
  473. package/dist/features/chrome-caps/useChromeCaps.js.map +1 -0
  474. package/dist/features/chrome-caps/useHoverTracking.js +22 -17
  475. package/dist/features/chrome-caps/useHoverTracking.js.map +1 -1
  476. package/dist/features/ingestion/contentHandlers.js +28 -19
  477. package/dist/features/ingestion/contentHandlers.js.map +1 -1
  478. package/dist/features/ingestion/imageHandler.js +21 -24
  479. package/dist/features/ingestion/imageHandler.js.map +1 -1
  480. package/dist/features/ingestion/openFilePicker.js.map +1 -1
  481. package/dist/features/ingestion/placement.js +16 -0
  482. package/dist/features/ingestion/placement.js.map +1 -0
  483. package/dist/features/ingestion/registerKitHandlers.js +7 -7
  484. package/dist/features/ingestion/svgHandler.js +5 -0
  485. package/dist/features/ingestion/svgHandler.js.map +1 -1
  486. package/dist/features/ingestion/textHandler.js +28 -0
  487. package/dist/features/ingestion/textHandler.js.map +1 -0
  488. package/dist/features/ingestion/useCanvasIngestion.js +48 -0
  489. package/dist/features/ingestion/useCanvasIngestion.js.map +1 -0
  490. package/dist/features/ingestion/weaselJsonHandler.js +22 -14
  491. package/dist/features/ingestion/weaselJsonHandler.js.map +1 -1
  492. package/dist/features/longPress/longPressFeedback.js.map +1 -1
  493. package/dist/features/modes/modeLayers.js +7 -7
  494. package/dist/features/modes/modeLayers.js.map +1 -1
  495. package/dist/features/paths/editablePath.js +47 -0
  496. package/dist/features/paths/editablePath.js.map +1 -0
  497. package/dist/features/paths/index.js +9 -14
  498. package/dist/features/paths/pathEditState.js +41 -0
  499. package/dist/features/paths/pathEditState.js.map +1 -0
  500. package/dist/features/paths/pathEditingOverlayLayer.js +36 -38
  501. package/dist/features/paths/pathEditingOverlayLayer.js.map +1 -1
  502. package/dist/features/paths/pathLayer.js +3 -2
  503. package/dist/features/paths/pathLayer.js.map +1 -1
  504. package/dist/features/paths/penPreviewLayer.js +86 -88
  505. package/dist/features/paths/penPreviewLayer.js.map +1 -1
  506. package/dist/features/paths/usePathEdit.js +34 -0
  507. package/dist/features/paths/usePathEdit.js.map +1 -0
  508. package/dist/features/poseRun/usePoseRun.js +44 -52
  509. package/dist/features/poseRun/usePoseRun.js.map +1 -1
  510. package/dist/features/selection/overlay.js +171 -179
  511. package/dist/features/selection/overlay.js.map +1 -1
  512. package/dist/features/text/index.js +6 -0
  513. package/dist/features/text/textLayer.js +1 -1
  514. package/dist/features/text/textLayer.js.map +1 -1
  515. package/dist/features/text/useSceneTextEdit.js +100 -93
  516. package/dist/features/text/useSceneTextEdit.js.map +1 -1
  517. package/dist/features/viewports/viewportLayer.js +25 -36
  518. package/dist/features/viewports/viewportLayer.js.map +1 -1
  519. package/dist/index.d.ts +8473 -9141
  520. package/dist/index.js +269 -307
  521. package/dist/input/keyState.js +38 -39
  522. package/dist/input/keyState.js.map +1 -1
  523. package/dist/input/useKeyModifiers.js +11 -0
  524. package/dist/input/useKeyModifiers.js.map +1 -0
  525. package/dist/interactions/actions/actionShortcuts.js.map +1 -1
  526. package/dist/interactions/actions/{defaults/align.js → align/action.js} +18 -20
  527. package/dist/interactions/actions/align/action.js.map +1 -0
  528. package/dist/interactions/actions/align/align.js +20 -20
  529. package/dist/interactions/actions/align/align.js.map +1 -1
  530. package/dist/interactions/actions/booleans/action.js +65 -0
  531. package/dist/interactions/actions/booleans/action.js.map +1 -0
  532. package/dist/interactions/actions/booleans/booleans.js +69 -78
  533. package/dist/interactions/actions/booleans/booleans.js.map +1 -1
  534. package/dist/interactions/actions/booleans/operands.js +40 -0
  535. package/dist/interactions/actions/booleans/operands.js.map +1 -0
  536. package/dist/interactions/actions/booleans/pieces.js +45 -0
  537. package/dist/interactions/actions/booleans/pieces.js.map +1 -0
  538. package/dist/interactions/actions/booleans/placement.js +24 -0
  539. package/dist/interactions/actions/booleans/placement.js.map +1 -0
  540. package/dist/interactions/actions/booleans/useBooleans.js +11 -9
  541. package/dist/interactions/actions/booleans/useBooleans.js.map +1 -1
  542. package/dist/interactions/actions/booleans/useBooleansAdapter.js.map +1 -1
  543. package/dist/interactions/actions/{defaults/clipboard.js → clipboard/action.js} +31 -15
  544. package/dist/interactions/actions/clipboard/action.js.map +1 -0
  545. package/dist/interactions/actions/clipboard/clipboardOps.js +44 -42
  546. package/dist/interactions/actions/clipboard/clipboardOps.js.map +1 -1
  547. package/dist/interactions/actions/clipboard/materializePaste.js +10 -7
  548. package/dist/interactions/actions/clipboard/materializePaste.js.map +1 -1
  549. package/dist/interactions/actions/clipboard/wireFormat.js.map +1 -1
  550. package/dist/interactions/actions/clone/action.js +98 -0
  551. package/dist/interactions/actions/clone/action.js.map +1 -0
  552. package/dist/interactions/actions/clone/behaviors.js +52 -0
  553. package/dist/interactions/actions/clone/behaviors.js.map +1 -0
  554. package/dist/interactions/actions/defaultCommitAdapter.js +7 -32
  555. package/dist/interactions/actions/defaultCommitAdapter.js.map +1 -1
  556. package/dist/interactions/actions/defaults/anchorEditing.js +60 -84
  557. package/dist/interactions/actions/defaults/anchorEditing.js.map +1 -1
  558. package/dist/interactions/actions/defaults/areaSelect.js +35 -38
  559. package/dist/interactions/actions/defaults/areaSelect.js.map +1 -1
  560. package/dist/interactions/actions/defaults/cancelGesture.js.map +1 -1
  561. package/dist/interactions/actions/defaults/clearSelection.js.map +1 -1
  562. package/dist/interactions/actions/defaults/copySubtree.js +40 -0
  563. package/dist/interactions/actions/defaults/copySubtree.js.map +1 -0
  564. package/dist/interactions/actions/defaults/createPaintAction.js.map +1 -1
  565. package/dist/interactions/actions/defaults/delete.js.map +1 -1
  566. package/dist/interactions/actions/defaults/duplicate.js +13 -53
  567. package/dist/interactions/actions/defaults/duplicate.js.map +1 -1
  568. package/dist/interactions/actions/defaults/enterTextEdit.js.map +1 -1
  569. package/dist/interactions/actions/defaults/group.js +40 -50
  570. package/dist/interactions/actions/defaults/group.js.map +1 -1
  571. package/dist/interactions/actions/defaults/icons/booleanIcons.js +24 -1
  572. package/dist/interactions/actions/defaults/icons/booleanIcons.js.map +1 -1
  573. package/dist/interactions/actions/defaults/icons/outlineIcons.js +39 -1
  574. package/dist/interactions/actions/defaults/icons/outlineIcons.js.map +1 -1
  575. package/dist/interactions/actions/defaults/ingest.js +44 -38
  576. package/dist/interactions/actions/defaults/ingest.js.map +1 -1
  577. package/dist/interactions/actions/defaults/insertPathAnchor.js +11 -12
  578. package/dist/interactions/actions/defaults/insertPathAnchor.js.map +1 -1
  579. package/dist/interactions/actions/defaults/nudge.js +40 -69
  580. package/dist/interactions/actions/defaults/nudge.js.map +1 -1
  581. package/dist/interactions/actions/defaults/nudgeSteps.js +37 -0
  582. package/dist/interactions/actions/defaults/nudgeSteps.js.map +1 -0
  583. package/dist/interactions/actions/defaults/pinchZoom.js.map +1 -1
  584. package/dist/interactions/actions/defaults/reorder.js +2 -0
  585. package/dist/interactions/actions/defaults/reorder.js.map +1 -1
  586. package/dist/interactions/actions/defaults/requiresSelection.js.map +1 -1
  587. package/dist/interactions/actions/defaults/setFill.js +14 -8
  588. package/dist/interactions/actions/defaults/setFill.js.map +1 -1
  589. package/dist/interactions/actions/defaults/setFillOpacity.js +7 -4
  590. package/dist/interactions/actions/defaults/setFillOpacity.js.map +1 -1
  591. package/dist/interactions/actions/defaults/setStroke.js +12 -12
  592. package/dist/interactions/actions/defaults/setStroke.js.map +1 -1
  593. package/dist/interactions/actions/defaults/setStrokeOpacity.js +6 -6
  594. package/dist/interactions/actions/defaults/sliceOps.js +8 -10
  595. package/dist/interactions/actions/defaults/sliceOps.js.map +1 -1
  596. package/dist/interactions/actions/defaults/toolActivate.js.map +1 -1
  597. package/dist/interactions/actions/defaults/toolResetToDefault.js.map +1 -1
  598. package/dist/interactions/actions/defaults/viewportDragPan.js +37 -26
  599. package/dist/interactions/actions/defaults/viewportDragPan.js.map +1 -1
  600. package/dist/interactions/actions/defaults/viewportWheelPan.js.map +1 -1
  601. package/dist/interactions/actions/defaults/viewportZoom.js.map +1 -1
  602. package/dist/interactions/actions/distribute/action.js +66 -0
  603. package/dist/interactions/actions/distribute/action.js.map +1 -0
  604. package/dist/interactions/actions/distribute/distribute.js +11 -11
  605. package/dist/interactions/actions/distribute/distribute.js.map +1 -1
  606. package/dist/interactions/actions/{defaults/editAnchors.js → edit-anchors/action.js} +7 -9
  607. package/dist/interactions/actions/edit-anchors/action.js.map +1 -0
  608. package/dist/interactions/actions/edit-anchors/geometry.js +30 -27
  609. package/dist/interactions/actions/edit-anchors/geometry.js.map +1 -1
  610. package/dist/interactions/actions/flip/action.js +124 -0
  611. package/dist/interactions/actions/flip/action.js.map +1 -0
  612. package/dist/interactions/actions/flip/helpers.js +30 -17
  613. package/dist/interactions/actions/flip/helpers.js.map +1 -1
  614. package/dist/interactions/actions/gestureFrames.js +18 -0
  615. package/dist/interactions/actions/gestureFrames.js.map +1 -0
  616. package/dist/interactions/actions/gestureLifecycle.js +47 -20
  617. package/dist/interactions/actions/gestureLifecycle.js.map +1 -1
  618. package/dist/interactions/actions/hitSelection.js +8 -0
  619. package/dist/interactions/actions/hitSelection.js.map +1 -0
  620. package/dist/interactions/actions/insert/action.js +72 -0
  621. package/dist/interactions/actions/insert/action.js.map +1 -0
  622. package/dist/interactions/actions/insert/commit.js +28 -0
  623. package/dist/interactions/actions/insert/commit.js.map +1 -0
  624. package/dist/interactions/actions/insert/extras.js +65 -0
  625. package/dist/interactions/actions/insert/extras.js.map +1 -0
  626. package/dist/interactions/actions/insert/frame.js +48 -0
  627. package/dist/interactions/actions/insert/frame.js.map +1 -0
  628. package/dist/interactions/actions/insert/geometry.js +35 -0
  629. package/dist/interactions/actions/insert/geometry.js.map +1 -0
  630. package/dist/interactions/actions/insert/rotateAction.js +21 -0
  631. package/dist/interactions/actions/insert/rotateAction.js.map +1 -0
  632. package/dist/interactions/actions/insert/session.js +59 -0
  633. package/dist/interactions/actions/insert/session.js.map +1 -0
  634. package/dist/interactions/actions/insert/shape.js +34 -0
  635. package/dist/interactions/actions/insert/shape.js.map +1 -0
  636. package/dist/interactions/actions/lasso-select/action.js +143 -0
  637. package/dist/interactions/actions/lasso-select/action.js.map +1 -0
  638. package/dist/interactions/actions/lasso-select/behaviors/selectFromLasso.js +14 -18
  639. package/dist/interactions/actions/lasso-select/behaviors/selectFromLasso.js.map +1 -1
  640. package/dist/interactions/actions/move/action.js +87 -0
  641. package/dist/interactions/actions/move/action.js.map +1 -0
  642. package/dist/interactions/actions/move/behaviors/layoutDrop.js +51 -0
  643. package/dist/interactions/actions/move/behaviors/layoutDrop.js.map +1 -0
  644. package/dist/interactions/actions/move/behaviors/reparentOnDrop.js +15 -0
  645. package/dist/interactions/actions/move/behaviors/reparentOnDrop.js.map +1 -0
  646. package/dist/interactions/actions/move/behaviors/snapBackOrDelete.js +5 -5
  647. package/dist/interactions/actions/move/behaviors/snapBackOrDelete.js.map +1 -1
  648. package/dist/interactions/actions/move/behaviors/snapToContainer.js +39 -27
  649. package/dist/interactions/actions/move/behaviors/snapToContainer.js.map +1 -1
  650. package/dist/interactions/actions/move/capture.js +99 -0
  651. package/dist/interactions/actions/move/capture.js.map +1 -0
  652. package/dist/interactions/actions/move/commit/index.js +41 -0
  653. package/dist/interactions/actions/move/commit/index.js.map +1 -0
  654. package/dist/interactions/actions/move/commit/layoutDrop.js +44 -0
  655. package/dist/interactions/actions/move/commit/layoutDrop.js.map +1 -0
  656. package/dist/interactions/actions/move/commit/layoutRelease.js +100 -0
  657. package/dist/interactions/actions/move/commit/layoutRelease.js.map +1 -0
  658. package/dist/interactions/actions/move/commit/rebase.js +18 -0
  659. package/dist/interactions/actions/move/commit/rebase.js.map +1 -0
  660. package/dist/interactions/actions/move/commit/reparent.js +65 -0
  661. package/dist/interactions/actions/move/commit/reparent.js.map +1 -0
  662. package/dist/interactions/actions/move/delta.js +51 -0
  663. package/dist/interactions/actions/move/delta.js.map +1 -0
  664. package/dist/interactions/actions/move/frame.js +59 -0
  665. package/dist/interactions/actions/move/frame.js.map +1 -0
  666. package/dist/interactions/actions/move/gestureAdapter.js +22 -30
  667. package/dist/interactions/actions/move/gestureAdapter.js.map +1 -1
  668. package/dist/interactions/actions/move/landedDescendants.js +33 -0
  669. package/dist/interactions/actions/move/landedDescendants.js.map +1 -0
  670. package/dist/interactions/actions/move/layout/container.js +94 -0
  671. package/dist/interactions/actions/move/layout/container.js.map +1 -0
  672. package/dist/interactions/actions/move/layout/dragged.js +58 -0
  673. package/dist/interactions/actions/move/layout/dragged.js.map +1 -0
  674. package/dist/interactions/actions/move/layout/dropPass.js +122 -0
  675. package/dist/interactions/actions/move/layout/dropPass.js.map +1 -0
  676. package/dist/interactions/actions/move/layout/exits.js +38 -0
  677. package/dist/interactions/actions/move/layout/exits.js.map +1 -0
  678. package/dist/interactions/actions/move/layout/glide.js +48 -0
  679. package/dist/interactions/actions/move/layout/glide.js.map +1 -0
  680. package/dist/interactions/actions/move/session.js +63 -0
  681. package/dist/interactions/actions/move/session.js.map +1 -0
  682. package/dist/interactions/actions/move/translate.js +61 -0
  683. package/dist/interactions/actions/move/translate.js.map +1 -0
  684. package/dist/interactions/actions/outlines/createOutlines.js +16 -63
  685. package/dist/interactions/actions/outlines/createOutlines.js.map +1 -1
  686. package/dist/interactions/actions/outlines/createOutlinesAction.js +51 -0
  687. package/dist/interactions/actions/outlines/createOutlinesAction.js.map +1 -0
  688. package/dist/interactions/actions/outlines/outlineStroke.js +72 -0
  689. package/dist/interactions/actions/outlines/outlineStroke.js.map +1 -0
  690. package/dist/interactions/actions/outlines/outlineStrokeAction.js +37 -0
  691. package/dist/interactions/actions/outlines/outlineStrokeAction.js.map +1 -0
  692. package/dist/interactions/actions/outlines/replaceWithPaths.js +54 -0
  693. package/dist/interactions/actions/outlines/replaceWithPaths.js.map +1 -0
  694. package/dist/interactions/actions/outlines/strokeRegion.js +27 -0
  695. package/dist/interactions/actions/outlines/strokeRegion.js.map +1 -0
  696. package/dist/interactions/actions/planeInput.js.map +1 -1
  697. package/dist/interactions/actions/pointerState.js +12 -0
  698. package/dist/interactions/actions/pointerState.js.map +1 -0
  699. package/dist/interactions/actions/poseDescriptorDep.js +16 -4
  700. package/dist/interactions/actions/poseDescriptorDep.js.map +1 -1
  701. package/dist/interactions/actions/poseFrame.js +25 -20
  702. package/dist/interactions/actions/poseFrame.js.map +1 -1
  703. package/dist/interactions/actions/resize/action.js +55 -0
  704. package/dist/interactions/actions/resize/action.js.map +1 -0
  705. package/dist/interactions/actions/resize/behaviors/lockAspect.js.map +1 -1
  706. package/dist/interactions/actions/resize/boxFrame.js +16 -0
  707. package/dist/interactions/actions/resize/boxFrame.js.map +1 -0
  708. package/dist/interactions/actions/resize/capture.js +85 -0
  709. package/dist/interactions/actions/resize/capture.js.map +1 -0
  710. package/dist/interactions/actions/resize/commit.js +69 -0
  711. package/dist/interactions/actions/resize/commit.js.map +1 -0
  712. package/dist/interactions/actions/resize/frame.js +74 -0
  713. package/dist/interactions/actions/resize/frame.js.map +1 -0
  714. package/dist/interactions/actions/resize/pointSnap.js +111 -0
  715. package/dist/interactions/actions/resize/pointSnap.js.map +1 -0
  716. package/dist/interactions/actions/resize/ruleBounds.js +9 -0
  717. package/dist/interactions/actions/resize/ruleBounds.js.map +1 -0
  718. package/dist/interactions/actions/resize/session.js +49 -0
  719. package/dist/interactions/actions/resize/session.js.map +1 -0
  720. package/dist/interactions/actions/resolveOverlays.js.map +1 -1
  721. package/dist/interactions/actions/resolvePreviews.js.map +1 -1
  722. package/dist/interactions/actions/rotate/action.js +56 -0
  723. package/dist/interactions/actions/rotate/action.js.map +1 -0
  724. package/dist/interactions/actions/rotate/behaviors/index.js +7 -0
  725. package/dist/interactions/actions/rotate/behaviors/index.js.map +1 -0
  726. package/dist/interactions/actions/rotate/behaviors/snapRotation.js +12 -0
  727. package/dist/interactions/actions/rotate/behaviors/snapRotation.js.map +1 -0
  728. package/dist/interactions/actions/rotate/commit.js +40 -0
  729. package/dist/interactions/actions/rotate/commit.js.map +1 -0
  730. package/dist/interactions/actions/rotate/frame.js +65 -0
  731. package/dist/interactions/actions/rotate/frame.js.map +1 -0
  732. package/dist/interactions/actions/rotate/handle.js +12 -12
  733. package/dist/interactions/actions/rotate/handle.js.map +1 -1
  734. package/dist/interactions/actions/rotate/session.js +92 -0
  735. package/dist/interactions/actions/rotate/session.js.map +1 -0
  736. package/dist/interactions/actions/selectionSubtree.js +69 -0
  737. package/dist/interactions/actions/selectionSubtree.js.map +1 -0
  738. package/dist/interactions/actions/spatialReference.js.map +1 -1
  739. package/dist/interactions/actions/useStandardActions.js +87 -78
  740. package/dist/interactions/actions/useStandardActions.js.map +1 -1
  741. package/dist/interactions/gestures/dragGesture/dragGesture.js +4 -7
  742. package/dist/interactions/gestures/dragGesture/dragGesture.js.map +1 -1
  743. package/dist/interactions/gestures/dragGesture/dragPointOf.js +23 -0
  744. package/dist/interactions/gestures/dragGesture/dragPointOf.js.map +1 -0
  745. package/dist/interactions/gestures/handleDrag/handleDrag.js +21 -26
  746. package/dist/interactions/gestures/handleDrag/handleDrag.js.map +1 -1
  747. package/dist/interactions/gestures/pointerDrag/pointerDrag.js +62 -41
  748. package/dist/interactions/gestures/pointerDrag/pointerDrag.js.map +1 -1
  749. package/dist/interactions/gestures/shared/originProjection.js +1 -1
  750. package/dist/interactions/gestures/shared/originProjection.js.map +1 -1
  751. package/dist/interactions/gestures/shared/screenTolerance.js +8 -2
  752. package/dist/interactions/gestures/shared/screenTolerance.js.map +1 -1
  753. package/dist/interactions/gestures/shared/snap.js.map +1 -1
  754. package/dist/interactions/gestures/thresholdDrag/thresholdDrag.js +8 -4
  755. package/dist/interactions/gestures/thresholdDrag/thresholdDrag.js.map +1 -1
  756. package/dist/layout/arrivals.js +20 -23
  757. package/dist/layout/arrivals.js.map +1 -1
  758. package/dist/math-CYUjoyyU.d.ts +33 -0
  759. package/dist/math.d.ts +5 -3
  760. package/dist/math.js +6 -6
  761. package/dist/mesh.d.ts +4 -268
  762. package/dist/mesh.js +3 -7
  763. package/dist/move.d.ts +14 -11
  764. package/dist/{originProjection-DEklpDc_.d.ts → originProjection-PPT88jZv.d.ts} +1 -1
  765. package/dist/patterns-builtin.d.ts +1 -118
  766. package/dist/patterns-builtin.js +2 -3
  767. package/dist/{poseDescriptor-D-OH-tu5.d.ts → poseDescriptor-Bqk-11Rl.d.ts} +26 -36
  768. package/dist/renderer.d.ts +1 -91
  769. package/dist/renderer.js +2 -18
  770. package/dist/resize.d.ts +10 -22
  771. package/dist/resize.js +6 -6
  772. package/dist/style.css +1 -1
  773. package/dist/test-hook/install.js +12 -6
  774. package/dist/test-hook/install.js.map +1 -1
  775. package/dist/test-hook/useTestHook.js +22 -0
  776. package/dist/test-hook/useTestHook.js.map +1 -0
  777. package/dist/test-seams-D0pyV3pR.d.ts +149 -0
  778. package/dist/test-seams.d.ts +4 -4
  779. package/dist/test-seams.js +2 -2
  780. package/dist/tools/builtin/bone/boneActions.js +130 -0
  781. package/dist/tools/builtin/bone/boneActions.js.map +1 -0
  782. package/dist/tools/builtin/bone/boneOverlay.js +58 -0
  783. package/dist/tools/builtin/bone/boneOverlay.js.map +1 -0
  784. package/dist/tools/builtin/bone/placedRig.js +24 -0
  785. package/dist/tools/builtin/bone/placedRig.js.map +1 -0
  786. package/dist/tools/builtin/bone/rigEditState.js +21 -0
  787. package/dist/tools/builtin/bone/rigEditState.js.map +1 -0
  788. package/dist/tools/builtin/bone/useBoneTool.js +98 -0
  789. package/dist/tools/builtin/bone/useBoneTool.js.map +1 -0
  790. package/dist/tools/builtin/ellipse/useEllipseTool.js +1 -0
  791. package/dist/tools/builtin/ellipse/useEllipseTool.js.map +1 -1
  792. package/dist/tools/builtin/eyedropper/useEyedropperTool.js.map +1 -1
  793. package/dist/tools/builtin/hand/useHandTool.js +1 -0
  794. package/dist/tools/builtin/hand/useHandTool.js.map +1 -1
  795. package/dist/tools/builtin/image/useImageTool.js.map +1 -1
  796. package/dist/tools/builtin/lasso/useLassoTool.js +11 -11
  797. package/dist/tools/builtin/lasso/useLassoTool.js.map +1 -1
  798. package/dist/tools/builtin/line/useLineTool.js +1 -0
  799. package/dist/tools/builtin/line/useLineTool.js.map +1 -1
  800. package/dist/tools/builtin/pen/usePenTool.js +198 -150
  801. package/dist/tools/builtin/pen/usePenTool.js.map +1 -1
  802. package/dist/tools/builtin/pencil/usePencilTool.js +1 -0
  803. package/dist/tools/builtin/pencil/usePencilTool.js.map +1 -1
  804. package/dist/tools/builtin/pickTopMostHit.js.map +1 -1
  805. package/dist/tools/builtin/polygon/usePolygonTool.js +13 -8
  806. package/dist/tools/builtin/polygon/usePolygonTool.js.map +1 -1
  807. package/dist/tools/builtin/rect/useRectTool.js +1 -0
  808. package/dist/tools/builtin/rect/useRectTool.js.map +1 -1
  809. package/dist/tools/builtin/select/adapterPointQuery.js +36 -0
  810. package/dist/tools/builtin/select/adapterPointQuery.js.map +1 -0
  811. package/dist/tools/builtin/select/selectionContributions.js +25 -24
  812. package/dist/tools/builtin/select/selectionContributions.js.map +1 -1
  813. package/dist/tools/builtin/select/useSelectTool.js +42 -67
  814. package/dist/tools/builtin/select/useSelectTool.js.map +1 -1
  815. package/dist/tools/builtin/shared/pointerFollower.js +17 -0
  816. package/dist/tools/builtin/shared/pointerFollower.js.map +1 -0
  817. package/dist/tools/builtin/slice/useSliceTool.js +72 -82
  818. package/dist/tools/builtin/slice/useSliceTool.js.map +1 -1
  819. package/dist/tools/builtin/star/useStarTool.js +22 -16
  820. package/dist/tools/builtin/star/useStarTool.js.map +1 -1
  821. package/dist/tools/builtin/text/useTextTool.js +9 -0
  822. package/dist/tools/builtin/text/useTextTool.js.map +1 -1
  823. package/dist/tools/builtin/weight/useWeightTool.js +77 -0
  824. package/dist/tools/builtin/weight/useWeightTool.js.map +1 -0
  825. package/dist/tools/builtin/weight/weightActions.js +112 -0
  826. package/dist/tools/builtin/weight/weightActions.js.map +1 -0
  827. package/dist/tools/builtin/weight/weightOverlay.js +61 -0
  828. package/dist/tools/builtin/weight/weightOverlay.js.map +1 -0
  829. package/dist/tools/overlayBinding.js.map +1 -1
  830. package/dist/tools/useKeybindings.js +12 -22
  831. package/dist/tools/useKeybindings.js.map +1 -1
  832. package/dist/{types-A37hYkeR.d.ts → types-CIKDwlsP.d.ts} +113 -169
  833. package/dist/util/color.js +3 -3
  834. package/dist/util/color.js.map +1 -1
  835. package/dist/util/paint.js +1 -1
  836. package/dist/util/paint.js.map +1 -1
  837. package/dist/version.js +1 -1
  838. package/package.json +28 -21
  839. package/dist/animation/colorHelpers.js +0 -135
  840. package/dist/animation/colorHelpers.js.map +0 -1
  841. package/dist/animation/colorRegistry.js +0 -37
  842. package/dist/animation/colorRegistry.js.map +0 -1
  843. package/dist/animation/engine/axes.js +0 -36
  844. package/dist/animation/engine/axes.js.map +0 -1
  845. package/dist/animation/engine/codec.js +0 -170
  846. package/dist/animation/engine/codec.js.map +0 -1
  847. package/dist/animation/engine/integrator.js +0 -12
  848. package/dist/animation/engine/integrator.js.map +0 -1
  849. package/dist/animation/loop.js +0 -62
  850. package/dist/animation/loop.js.map +0 -1
  851. package/dist/animation/observe.js +0 -23
  852. package/dist/animation/observe.js.map +0 -1
  853. package/dist/animation/rig/blendPoses.js +0 -43
  854. package/dist/animation/rig/blendPoses.js.map +0 -1
  855. package/dist/animation/rig/mirrorPose.js +0 -19
  856. package/dist/animation/rig/mirrorPose.js.map +0 -1
  857. package/dist/animation/rig/resolveSkeleton.js +0 -33
  858. package/dist/animation/rig/resolveSkeleton.js.map +0 -1
  859. package/dist/animation/rig/solveIk.js +0 -103
  860. package/dist/animation/rig/solveIk.js.map +0 -1
  861. package/dist/animation/rig/types.js +0 -12
  862. package/dist/animation/rig/types.js.map +0 -1
  863. package/dist/animation/slew.js +0 -27
  864. package/dist/animation/slew.js.map +0 -1
  865. package/dist/animation/stagger.js +0 -138
  866. package/dist/animation/stagger.js.map +0 -1
  867. package/dist/animation/timeline/booking.js +0 -106
  868. package/dist/animation/timeline/booking.js.map +0 -1
  869. package/dist/animation/timeline/createTimeline.js +0 -116
  870. package/dist/animation/timeline/createTimeline.js.map +0 -1
  871. package/dist/animation/timeline/sampleTrack.js +0 -71
  872. package/dist/animation/timeline/sampleTrack.js.map +0 -1
  873. package/dist/animation/useAnimator.js +0 -378
  874. package/dist/animation/useAnimator.js.map +0 -1
  875. package/dist/builtins-C-VgUlWI.d.ts +0 -4514
  876. package/dist/canvas/MinimapCanvas.js +0 -139
  877. package/dist/canvas/MinimapCanvas.js.map +0 -1
  878. package/dist/canvas/deps/poseComposition.js +0 -11
  879. package/dist/canvas/deps/poseComposition.js.map +0 -1
  880. package/dist/canvas/minimapMath.js +0 -80
  881. package/dist/canvas/minimapMath.js.map +0 -1
  882. package/dist/canvas/toolPreview.js +0 -39
  883. package/dist/canvas/toolPreview.js.map +0 -1
  884. package/dist/core/adapters/arrayAdapter.js +0 -85
  885. package/dist/core/adapters/arrayAdapter.js.map +0 -1
  886. package/dist/core/adapters/useArrayAdapter.js +0 -13
  887. package/dist/core/adapters/useArrayAdapter.js.map +0 -1
  888. package/dist/core/fillInPoseFrame.js +0 -102
  889. package/dist/core/fillInPoseFrame.js.map +0 -1
  890. package/dist/core/geometry/poseRotation.js +0 -58
  891. package/dist/core/geometry/poseRotation.js.map +0 -1
  892. package/dist/core/gradient.js +0 -136
  893. package/dist/core/gradient.js.map +0 -1
  894. package/dist/core/isPlainObject.js.map +0 -1
  895. package/dist/core/markerInset.js +0 -24
  896. package/dist/core/markerInset.js.map +0 -1
  897. package/dist/core/mixed.js +0 -6
  898. package/dist/core/mixed.js.map +0 -1
  899. package/dist/core/paintKinds.js +0 -156
  900. package/dist/core/paintKinds.js.map +0 -1
  901. package/dist/core/strokeMarkerShapes.js +0 -139
  902. package/dist/core/strokeMarkerShapes.js.map +0 -1
  903. package/dist/core/strokeMarkers.js +0 -28
  904. package/dist/core/strokeMarkers.js.map +0 -1
  905. package/dist/core/viewport/meanScale.js +0 -8
  906. package/dist/core/viewport/meanScale.js.map +0 -1
  907. package/dist/core/viewport/pxExtent.js +0 -42
  908. package/dist/core/viewport/pxExtent.js.map +0 -1
  909. package/dist/debug/flag.js.map +0 -1
  910. package/dist/features/cursor/paintedCursorLayer.js.map +0 -1
  911. package/dist/features/focus/gateLayer.js +0 -14
  912. package/dist/features/focus/gateLayer.js.map +0 -1
  913. package/dist/features/focus/useCanvasFocus.js +0 -29
  914. package/dist/features/focus/useCanvasFocus.js.map +0 -1
  915. package/dist/features/groups/children.js.map +0 -1
  916. package/dist/features/groups/composePose.js.map +0 -1
  917. package/dist/features/groups/nestedHit.js.map +0 -1
  918. package/dist/features/groups/unionOfChildren.js.map +0 -1
  919. package/dist/features/images/imageCache.js +0 -94
  920. package/dist/features/images/imageCache.js.map +0 -1
  921. package/dist/features/ingestion/index.js +0 -8
  922. package/dist/features/meshPaint/bake.js +0 -79
  923. package/dist/features/meshPaint/bake.js.map +0 -1
  924. package/dist/features/meshPaint/bakeCache.js +0 -59
  925. package/dist/features/meshPaint/bakeCache.js.map +0 -1
  926. package/dist/features/meshPaint/handles.js +0 -86
  927. package/dist/features/meshPaint/handles.js.map +0 -1
  928. package/dist/features/meshPaint/lazyKind.js.map +0 -1
  929. package/dist/features/meshPaint/meshPaint.js +0 -236
  930. package/dist/features/meshPaint/meshPaint.js.map +0 -1
  931. package/dist/features/meshPaint/meshShader.js +0 -6
  932. package/dist/features/meshPaint/meshShader.js.map +0 -1
  933. package/dist/features/meshPaint/register.js +0 -7
  934. package/dist/features/meshPaint/register.js.map +0 -1
  935. package/dist/features/meshPaint/surface.js +0 -110
  936. package/dist/features/meshPaint/surface.js.map +0 -1
  937. package/dist/features/minimap/actions.js +0 -53
  938. package/dist/features/minimap/actions.js.map +0 -1
  939. package/dist/features/minimap/createMinimapContribution.js +0 -96
  940. package/dist/features/minimap/createMinimapContribution.js.map +0 -1
  941. package/dist/features/minimap/layers.js +0 -103
  942. package/dist/features/minimap/layers.js.map +0 -1
  943. package/dist/features/overlays/useNodeOverlayFrame.js +0 -103
  944. package/dist/features/overlays/useNodeOverlayFrame.js.map +0 -1
  945. package/dist/features/parallax/createParallaxLayer.js +0 -26
  946. package/dist/features/parallax/createParallaxLayer.js.map +0 -1
  947. package/dist/features/parallax/createParallaxPlane.js +0 -26
  948. package/dist/features/parallax/createParallaxPlane.js.map +0 -1
  949. package/dist/features/paths/anchorEdits.js +0 -156
  950. package/dist/features/paths/anchorEdits.js.map +0 -1
  951. package/dist/features/paths/anchors.js +0 -154
  952. package/dist/features/paths/anchors.js.map +0 -1
  953. package/dist/features/paths/booleans.js +0 -2
  954. package/dist/features/paths/markerCommands.js +0 -148
  955. package/dist/features/paths/markerCommands.js.map +0 -1
  956. package/dist/features/paths/markerSites.js +0 -59
  957. package/dist/features/paths/markerSites.js.map +0 -1
  958. package/dist/features/paths/markers.js +0 -95
  959. package/dist/features/paths/markers.js.map +0 -1
  960. package/dist/features/paths/nearestAnchor.js +0 -36
  961. package/dist/features/paths/nearestAnchor.js.map +0 -1
  962. package/dist/features/paths/pathInWorld.js +0 -41
  963. package/dist/features/paths/pathInWorld.js.map +0 -1
  964. package/dist/features/paths/poseDescriptor.js +0 -39
  965. package/dist/features/paths/poseDescriptor.js.map +0 -1
  966. package/dist/features/paths/tessellate/dash.js +0 -52
  967. package/dist/features/paths/tessellate/dash.js.map +0 -1
  968. package/dist/features/paths/tessellate/insets.js +0 -32
  969. package/dist/features/paths/tessellate/insets.js.map +0 -1
  970. package/dist/features/paths/tessellate/metric.js +0 -72
  971. package/dist/features/paths/tessellate/metric.js.map +0 -1
  972. package/dist/features/paths/tessellate/stroke.js +0 -170
  973. package/dist/features/paths/tessellate/stroke.js.map +0 -1
  974. package/dist/features/paths/tessellate/vertexWidths.js +0 -32
  975. package/dist/features/paths/tessellate/vertexWidths.js.map +0 -1
  976. package/dist/features/patterns/index.js +0 -23
  977. package/dist/features/patterns/index.js.map +0 -1
  978. package/dist/features/patterns/patterns-builtin.js +0 -38
  979. package/dist/features/patterns/patterns-builtin.js.map +0 -1
  980. package/dist/features/patterns/resolveSpec.js +0 -57
  981. package/dist/features/patterns/resolveSpec.js.map +0 -1
  982. package/dist/features/patterns/tileGeometry.js +0 -158
  983. package/dist/features/patterns/tileGeometry.js.map +0 -1
  984. package/dist/features/pointer/PointerContext.js +0 -45
  985. package/dist/features/pointer/PointerContext.js.map +0 -1
  986. package/dist/features/selection/SelectionContext.js +0 -46
  987. package/dist/features/selection/SelectionContext.js.map +0 -1
  988. package/dist/features/simulation/createSimulation.js +0 -61
  989. package/dist/features/simulation/createSimulation.js.map +0 -1
  990. package/dist/features/simulation/types.js +0 -6
  991. package/dist/features/simulation/types.js.map +0 -1
  992. package/dist/features/simulation/useSimulation.js +0 -74
  993. package/dist/features/simulation/useSimulation.js.map +0 -1
  994. package/dist/features/text/domRuns.js +0 -258
  995. package/dist/features/text/domRuns.js.map +0 -1
  996. package/dist/features/text/fitTextPose.js +0 -38
  997. package/dist/features/text/fitTextPose.js.map +0 -1
  998. package/dist/features/text/hitTest.js +0 -45
  999. package/dist/features/text/hitTest.js.map +0 -1
  1000. package/dist/features/text/renderLabel.js +0 -14
  1001. package/dist/features/text/renderLabel.js.map +0 -1
  1002. package/dist/features/text/runs/effectiveRangeStyle.js +0 -66
  1003. package/dist/features/text/runs/effectiveRangeStyle.js.map +0 -1
  1004. package/dist/features/text/runs/flagRange.js +0 -53
  1005. package/dist/features/text/runs/flagRange.js.map +0 -1
  1006. package/dist/features/text/runs/rangeStyle.js +0 -135
  1007. package/dist/features/text/runs/rangeStyle.js.map +0 -1
  1008. package/dist/features/text/textCommand.js +0 -59
  1009. package/dist/features/text/textCommand.js.map +0 -1
  1010. package/dist/features/text/textToPath.js +0 -181
  1011. package/dist/features/text/textToPath.js.map +0 -1
  1012. package/dist/features/text/useTextEdit.js +0 -467
  1013. package/dist/features/text/useTextEdit.js.map +0 -1
  1014. package/dist/features/tiling/createTiledLayer.js +0 -63
  1015. package/dist/features/tiling/createTiledLayer.js.map +0 -1
  1016. package/dist/features/tiling/tiledProject.js +0 -14
  1017. package/dist/features/tiling/tiledProject.js.map +0 -1
  1018. package/dist/interactions/actions/clone/behaviors/cloneByAltDrag.js +0 -26
  1019. package/dist/interactions/actions/clone/behaviors/cloneByAltDrag.js.map +0 -1
  1020. package/dist/interactions/actions/defaults/align.js.map +0 -1
  1021. package/dist/interactions/actions/defaults/booleans.js +0 -52
  1022. package/dist/interactions/actions/defaults/booleans.js.map +0 -1
  1023. package/dist/interactions/actions/defaults/clipboard.js.map +0 -1
  1024. package/dist/interactions/actions/defaults/clone.js +0 -107
  1025. package/dist/interactions/actions/defaults/clone.js.map +0 -1
  1026. package/dist/interactions/actions/defaults/createOutlines.js +0 -47
  1027. package/dist/interactions/actions/defaults/createOutlines.js.map +0 -1
  1028. package/dist/interactions/actions/defaults/distribute.js +0 -66
  1029. package/dist/interactions/actions/defaults/distribute.js.map +0 -1
  1030. package/dist/interactions/actions/defaults/editAnchors.js.map +0 -1
  1031. package/dist/interactions/actions/defaults/flip.js +0 -119
  1032. package/dist/interactions/actions/defaults/flip.js.map +0 -1
  1033. package/dist/interactions/actions/defaults/freshNodeId.js +0 -10
  1034. package/dist/interactions/actions/defaults/freshNodeId.js.map +0 -1
  1035. package/dist/interactions/actions/defaults/insert.js +0 -288
  1036. package/dist/interactions/actions/defaults/insert.js.map +0 -1
  1037. package/dist/interactions/actions/defaults/lassoSelect.js +0 -156
  1038. package/dist/interactions/actions/defaults/lassoSelect.js.map +0 -1
  1039. package/dist/interactions/actions/defaults/move.js +0 -760
  1040. package/dist/interactions/actions/defaults/move.js.map +0 -1
  1041. package/dist/interactions/actions/defaults/resize.js +0 -335
  1042. package/dist/interactions/actions/defaults/resize.js.map +0 -1
  1043. package/dist/interactions/actions/defaults/rotate.js +0 -184
  1044. package/dist/interactions/actions/defaults/rotate.js.map +0 -1
  1045. package/dist/interactions/actions/previewOverrides.js +0 -25
  1046. package/dist/interactions/actions/previewOverrides.js.map +0 -1
  1047. package/dist/interactions/actions/resize/autoPoseDescriptor.js.map +0 -1
  1048. package/dist/math-Drrw4ewZ.d.ts +0 -160
  1049. package/dist/registerProgram-BMZRDgrh.d.ts +0 -197
  1050. package/dist/renderer/DrawCommand.js +0 -6
  1051. package/dist/renderer/DrawCommand.js.map +0 -1
  1052. package/dist/renderer/WeaselRenderer.js +0 -331
  1053. package/dist/renderer/WeaselRenderer.js.map +0 -1
  1054. package/dist/renderer/batchClip.js +0 -46
  1055. package/dist/renderer/batchClip.js.map +0 -1
  1056. package/dist/renderer/cache/GLImageCache.js +0 -64
  1057. package/dist/renderer/cache/GLImageCache.js.map +0 -1
  1058. package/dist/renderer/cache/GLMeshCache.js +0 -102
  1059. package/dist/renderer/cache/GLMeshCache.js.map +0 -1
  1060. package/dist/renderer/cache/GLTextureCache.js +0 -51
  1061. package/dist/renderer/cache/GLTextureCache.js.map +0 -1
  1062. package/dist/renderer/cache/GradientRampAtlas.js +0 -82
  1063. package/dist/renderer/cache/GradientRampAtlas.js.map +0 -1
  1064. package/dist/renderer/cache/cache.js +0 -13
  1065. package/dist/renderer/cache/cache.js.map +0 -1
  1066. package/dist/renderer/cache/markerCommandCache.js +0 -63
  1067. package/dist/renderer/cache/markerCommandCache.js.map +0 -1
  1068. package/dist/renderer/cache/outlineMeshCache.js +0 -15
  1069. package/dist/renderer/cache/outlineMeshCache.js.map +0 -1
  1070. package/dist/renderer/cache/outlineStrokeMeshCache.js +0 -36
  1071. package/dist/renderer/cache/outlineStrokeMeshCache.js.map +0 -1
  1072. package/dist/renderer/cache/strokeMeshCache.js +0 -55
  1073. package/dist/renderer/cache/strokeMeshCache.js.map +0 -1
  1074. package/dist/renderer/cullDrawCommands.js +0 -90
  1075. package/dist/renderer/cullDrawCommands.js.map +0 -1
  1076. package/dist/renderer/draw.js +0 -1135
  1077. package/dist/renderer/draw.js.map +0 -1
  1078. package/dist/renderer/drawBatch.js +0 -198
  1079. package/dist/renderer/drawBatch.js.map +0 -1
  1080. package/dist/renderer/effects/EffectTargets.js +0 -45
  1081. package/dist/renderer/effects/EffectTargets.js.map +0 -1
  1082. package/dist/renderer/effects/builtins.js +0 -31
  1083. package/dist/renderer/effects/builtins.js.map +0 -1
  1084. package/dist/renderer/effects/composite.js +0 -9
  1085. package/dist/renderer/effects/composite.js.map +0 -1
  1086. package/dist/renderer/effects/effectPrelude.js +0 -10
  1087. package/dist/renderer/effects/effectPrelude.js.map +0 -1
  1088. package/dist/renderer/effects/types.js +0 -10
  1089. package/dist/renderer/effects/types.js.map +0 -1
  1090. package/dist/renderer/glyphOutlineMesh.js +0 -67
  1091. package/dist/renderer/glyphOutlineMesh.js.map +0 -1
  1092. package/dist/renderer/index.js +0 -19
  1093. package/dist/renderer/math/color.js +0 -341
  1094. package/dist/renderer/math/color.js.map +0 -1
  1095. package/dist/renderer/math/mat3.js +0 -76
  1096. package/dist/renderer/math/mat3.js.map +0 -1
  1097. package/dist/renderer/math/patternSpace.js +0 -22
  1098. package/dist/renderer/math/patternSpace.js.map +0 -1
  1099. package/dist/renderer/math/viewToMat3.js +0 -19
  1100. package/dist/renderer/math/viewToMat3.js.map +0 -1
  1101. package/dist/renderer/paintResources.js +0 -18
  1102. package/dist/renderer/paintResources.js.map +0 -1
  1103. package/dist/renderer/paintScratch.js +0 -37
  1104. package/dist/renderer/paintScratch.js.map +0 -1
  1105. package/dist/renderer/shaders/ShaderProgram.js +0 -74
  1106. package/dist/renderer/shaders/ShaderProgram.js.map +0 -1
  1107. package/dist/renderer/shaders/batchFill.js +0 -119
  1108. package/dist/renderer/shaders/batchFill.js.map +0 -1
  1109. package/dist/renderer/shaders/customPrelude.js +0 -34
  1110. package/dist/renderer/shaders/customPrelude.js.map +0 -1
  1111. package/dist/renderer/shaders/extractUniformNames.js +0 -184
  1112. package/dist/renderer/shaders/extractUniformNames.js.map +0 -1
  1113. package/dist/renderer/shaders/glyphPaint.js +0 -61
  1114. package/dist/renderer/shaders/glyphPaint.js.map +0 -1
  1115. package/dist/renderer/shaders/gradFill.js +0 -30
  1116. package/dist/renderer/shaders/gradFill.js.map +0 -1
  1117. package/dist/renderer/shaders/imageFill.js +0 -14
  1118. package/dist/renderer/shaders/imageFill.js.map +0 -1
  1119. package/dist/renderer/shaders/pathFill.js +0 -13
  1120. package/dist/renderer/shaders/pathFill.js.map +0 -1
  1121. package/dist/renderer/shaders/patternFill.js +0 -24
  1122. package/dist/renderer/shaders/patternFill.js.map +0 -1
  1123. package/dist/renderer/shaders/registerProgram.js +0 -18
  1124. package/dist/renderer/shaders/registerProgram.js.map +0 -1
  1125. package/dist/renderer/spriteSheet.js +0 -14
  1126. package/dist/renderer/spriteSheet.js.map +0 -1
  1127. package/dist/renderer/state/GroupState.js +0 -77
  1128. package/dist/renderer/state/GroupState.js.map +0 -1
  1129. package/dist/renderer/strokeLengths.js +0 -50
  1130. package/dist/renderer/strokeLengths.js.map +0 -1
  1131. package/dist/renderer/syntheticItalic.js +0 -6
  1132. package/dist/renderer/syntheticItalic.js.map +0 -1
  1133. package/dist/renderer/textures/registerTexture.js +0 -14
  1134. package/dist/renderer/textures/registerTexture.js.map +0 -1
  1135. package/dist/scheduling/useVisibleRaf.js +0 -69
  1136. package/dist/scheduling/useVisibleRaf.js.map +0 -1
  1137. package/dist/test-seams-CuIxe0xY.d.ts +0 -356
  1138. package/dist/tools/prefs.js +0 -62
  1139. package/dist/tools/prefs.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"targets.js","names":["BASE_PX","HANDLE_BASE_PX","ANCHOR_HIT_BASE_PX","ROTATION_HANDLE_BASE_PX","targetSizesPx","targetScale"],"sources":["../../../src/core/device/targets.ts"],"sourcesContent":["/**\n * Base sizes for grabbable chrome, in CSS pixels at `targetScale = 1`, and the\n * one accessor that resolves them for a live pointer type.\n *\n * Paint and hit-test MUST scale together: chrome you can see but cannot grab\n * is the exact failure `chrome-caps` exists to make impossible, and a literal\n * `8` copied into a fifth file is how that failure gets reintroduced. So every\n * kit-internal use site goes through {@link targetSizesPx} — the selection\n * overlay's handle size, `buildAffordanceAt`'s hit radii, and the slops debug\n * overlay all read the same object. The bare constants below stay exported for\n * consumers, who get the unscaled numbers they always got.\n */\n\nconst BASE_PX = {\n handle: 8,\n anchor: 8,\n rotationDistance: 24,\n} as const;\n\n/** Selection corner-handle visual size and hit radius. */\nexport const HANDLE_BASE_PX = BASE_PX.handle;\n\n/** Path anchor / control-point hit radius. */\nexport const ANCHOR_HIT_BASE_PX = BASE_PX.anchor;\n\n/** Distance from a selection's top edge to the rotation handle's center. */\nexport const ROTATION_HANDLE_BASE_PX = BASE_PX.rotationDistance;\n\n/** Grabbable-chrome sizes resolved for one pointer type, in CSS pixels. */\nexport interface TargetSizesPx {\n /** Corner-handle visual size and hit radius. */\n handle: number;\n /** Anchor / control-point hit radius. */\n anchor: number;\n /** Distance from a selection's top edge to the rotation handle's center,\n * which is also the rotate band's minimum thickness. */\n rotationDistance: number;\n}\n\n/**\n * How big is grabbable chrome, in CSS pixels, for this pointer type?\n *\n * `targetScale` comes from the live {@link DeviceProfile} — 1 for a mouse,\n * {@link COARSE_TARGET_SCALE} for touch.\n */\nexport function targetSizesPx(targetScale = 1): TargetSizesPx {\n return {\n handle: BASE_PX.handle * targetScale,\n anchor: BASE_PX.anchor * targetScale,\n rotationDistance: BASE_PX.rotationDistance * targetScale,\n };\n}\n"],"mappings":";AAaA,IAAMA,IAAU;CACd,QAAQ;CACR,QAAQ;CACR,kBAAkB;AACpB,GAGaC,IAAiBD,EAAQ,QAGzBE,IAAqBF,EAAQ,QAG7BG,IAA0BH,EAAQ;AAmB/C,SAAgBI,EAAc,IAAc,GAAkB;CAC5D,OAAO;EACL,QAAQJ,EAAQ,SAASK;EACzB,QAAQL,EAAQ,SAASK;EACzB,kBAAkBL,EAAQ,mBAAmBK;CAC/C;AACF"}
1
+ {"version":3,"file":"targets.js","names":["BASE_PX","HANDLE_BASE_PX","ANCHOR_HIT_BASE_PX","ROTATION_HANDLE_BASE_PX","targetSizesPx","targetScale"],"sources":["../../../src/core/device/targets.ts"],"sourcesContent":["/**\n * Base sizes for grabbable chrome, in CSS pixels at `targetScale = 1`, and the\n * one accessor that resolves them for a live pointer type.\n *\n * Paint and hit-test MUST scale together, or chrome can be seen and not\n * grabbed, so every kit-internal use site goes through {@link targetSizesPx}.\n * The bare constants below are the unscaled numbers, exported for consumers.\n */\n\nconst BASE_PX = {\n handle: 8,\n anchor: 8,\n rotationDistance: 24,\n} as const;\n\n/** Selection corner-handle visual size and hit radius. */\nexport const HANDLE_BASE_PX = BASE_PX.handle;\n\n/** Path anchor / control-point hit radius. */\nexport const ANCHOR_HIT_BASE_PX = BASE_PX.anchor;\n\n/** Distance from a selection's top edge to the rotation handle's center. */\nexport const ROTATION_HANDLE_BASE_PX = BASE_PX.rotationDistance;\n\n/** Grabbable-chrome sizes resolved for one pointer type, in CSS pixels. */\nexport interface TargetSizesPx {\n /** Corner-handle visual size and hit radius. */\n handle: number;\n /** Anchor / control-point hit radius. */\n anchor: number;\n /** Distance from a selection's top edge to the rotation handle's center,\n * which is also the rotate band's minimum thickness. */\n rotationDistance: number;\n}\n\n/**\n * How big is grabbable chrome, in CSS pixels, for this pointer type?\n *\n * `targetScale` comes from the live {@link DeviceProfile} — 1 for a mouse,\n * {@link COARSE_TARGET_SCALE} for touch.\n */\nexport function targetSizesPx(targetScale = 1): TargetSizesPx {\n return {\n handle: BASE_PX.handle * targetScale,\n anchor: BASE_PX.anchor * targetScale,\n rotationDistance: BASE_PX.rotationDistance * targetScale,\n };\n}\n"],"mappings":";AASA,IAAMA,IAAU;CACd,QAAQ;CACR,QAAQ;CACR,kBAAkB;AACpB,GAGaC,IAAiBD,EAAQ,QAGzBE,IAAqBF,EAAQ,QAG7BG,IAA0BH,EAAQ;AAmB/C,SAAgBI,EAAc,IAAc,GAAkB;CAC5D,OAAO;EACL,QAAQJ,EAAQ,SAASK;EACzB,QAAQL,EAAQ,SAASK;EACzB,kBAAkBL,EAAQ,mBAAmBK;CAC/C;AACF"}
@@ -1,75 +1,69 @@
1
- import { createContext as e, createElement as t, useContext as n, useEffect as r, useMemo as i, useState as a } from "react";
2
- import { DEFAULT_DEVICE_PROFILE as o, resolveDeviceProfile as s } from "@weasel-js/routing";
1
+ import { watchDevicePixelRatio as e } from "./watchDevicePixelRatio.js";
2
+ import { createContext as t, createElement as n, useContext as r, useEffect as i, useMemo as a, useState as o } from "react";
3
+ import { DEFAULT_DEVICE_PROFILE as s, resolveDeviceProfile as c } from "@weasel-js/routing";
3
4
  //#region src/core/device/useDeviceProfile.ts
4
- var c = "(pointer: coarse)", l = "(hover: hover)";
5
- function u() {
5
+ var l = "(pointer: coarse)", u = "(hover: hover)";
6
+ function d() {
6
7
  return typeof window < "u" && typeof window.matchMedia == "function";
7
8
  }
8
- function d() {
9
+ function f() {
9
10
  let e = typeof window < "u" && window.devicePixelRatio || 1;
10
- return u() ? {
11
- coarsePointer: window.matchMedia(c).matches,
12
- canHover: window.matchMedia(l).matches,
11
+ return d() ? {
12
+ coarsePointer: window.matchMedia(l).matches,
13
+ canHover: window.matchMedia(u).matches,
13
14
  dpr: e
14
15
  } : {
15
- coarsePointer: o.coarsePointer,
16
- canHover: o.canHover,
16
+ coarsePointer: s.coarsePointer,
17
+ canHover: s.canHover,
17
18
  dpr: e
18
19
  };
19
20
  }
20
- function f() {
21
- let [e, t] = a(d);
22
- return r(() => {
23
- if (!u()) return;
24
- let e = window.matchMedia(c), n = window.matchMedia(l), r = (e) => t((t) => ({
21
+ function p(t) {
22
+ let [n, r] = o(f);
23
+ return i(() => {
24
+ if (!t || !d()) return;
25
+ let n = window.matchMedia(l), i = window.matchMedia(u), a = (e) => r((t) => ({
25
26
  ...t,
26
27
  coarsePointer: e.matches
27
- })), i = (e) => t((t) => ({
28
+ })), o = (e) => r((t) => ({
28
29
  ...t,
29
30
  canHover: e.matches
30
31
  }));
31
- e.addEventListener("change", r), n.addEventListener("change", i);
32
- let a = !1, o = null, s = () => {
33
- if (a) return;
34
- let e = window.devicePixelRatio || 1;
35
- t((t) => t.dpr === e ? t : {
36
- ...t,
37
- dpr: e
38
- }), d();
39
- };
40
- function d() {
41
- a || (o?.removeEventListener("change", s), o = window.matchMedia(`(resolution: ${window.devicePixelRatio || 1}dppx)`), o.addEventListener("change", s));
42
- }
43
- return d(), t({
44
- coarsePointer: e.matches,
45
- canHover: n.matches,
32
+ n.addEventListener("change", a), i.addEventListener("change", o);
33
+ let s = e((e) => r((t) => t.dpr === e ? t : {
34
+ ...t,
35
+ dpr: e
36
+ }));
37
+ return r({
38
+ coarsePointer: n.matches,
39
+ canHover: i.matches,
46
40
  dpr: window.devicePixelRatio || 1
47
41
  }), () => {
48
- a = !0, e.removeEventListener("change", r), n.removeEventListener("change", i), o?.removeEventListener("change", s);
42
+ s(), n.removeEventListener("change", a), i.removeEventListener("change", o);
49
43
  };
50
- }, []), e;
44
+ }, [t]), n;
51
45
  }
52
- var p = e(null);
53
- function m(e) {
54
- let t = n(p), r = f(), a = t ?? r, { coarsePointer: o, canHover: c, dpr: l, targetScale: u } = e ?? {};
55
- return i(() => s(a, {
46
+ var m = t(null);
47
+ function h(e) {
48
+ let t = r(m), n = p(t === null), i = t ?? n, { coarsePointer: o, canHover: s, dpr: l, targetScale: u } = e ?? {};
49
+ return a(() => c(i, {
56
50
  ...o === void 0 ? {} : { coarsePointer: o },
57
- ...c === void 0 ? {} : { canHover: c },
51
+ ...s === void 0 ? {} : { canHover: s },
58
52
  ...l === void 0 ? {} : { dpr: l },
59
53
  ...u === void 0 ? {} : { targetScale: u }
60
54
  }), [
61
- a,
55
+ i,
62
56
  o,
63
- c,
57
+ s,
64
58
  l,
65
59
  u
66
60
  ]);
67
61
  }
68
- function h({ value: e, children: n }) {
69
- let r = m(e);
70
- return t(p.Provider, { value: r }, n);
62
+ function g({ value: e, children: t }) {
63
+ let r = h(e);
64
+ return n(m.Provider, { value: r }, t);
71
65
  }
72
66
  //#endregion
73
- export { h as DeviceProfileProvider, m as useDeviceProfile };
67
+ export { g as DeviceProfileProvider, h as useDeviceProfile };
74
68
 
75
69
  //# sourceMappingURL=useDeviceProfile.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"useDeviceProfile.js","names":["COARSE_QUERY","HOVER_QUERY","hasMatchMedia","detectOnce","dpr","DEFAULT_DEVICE_PROFILE","useDetectedFacts","facts","setFacts","useState","useEffect","coarseMq","hoverMq","onCoarse","f","onHover","disposed","densityMq","onDensity","next","arm","DeviceProfileContext","createContext","useDeviceProfile","provided","useContext","detected","base","overrides","useMemo","resolveDeviceProfile","coarsePointer","canHover","targetScale","DeviceProfileProvider","profile","value","createElement","children"],"sources":["../../../src/core/device/useDeviceProfile.ts"],"sourcesContent":["import {\n createContext,\n createElement,\n useContext,\n useEffect,\n useMemo,\n useState,\n type ReactNode,\n} from 'react';\nimport type { DetectedDeviceFacts, DeviceProfile } from './types';\nimport { DEFAULT_DEVICE_PROFILE, resolveDeviceProfile } from '@weasel-js/routing';\n\nconst COARSE_QUERY = '(pointer: coarse)';\nconst HOVER_QUERY = '(hover: hover)';\n\nfunction hasMatchMedia(): boolean {\n return typeof window !== 'undefined' && typeof window.matchMedia === 'function';\n}\n\nfunction detectOnce(): DetectedDeviceFacts {\n // Density is read unconditionally: `devicePixelRatio` does not depend on\n // `matchMedia` existing. Only *watching* density needs a media query.\n // Gating this read behind `hasMatchMedia()` would report density 1 under\n // any environment without matchMedia — including jsdom, which would\n // silently break `useCanvasSize`'s existing DPR assertions.\n const dpr = (typeof window !== 'undefined' && window.devicePixelRatio) || 1;\n if (!hasMatchMedia()) {\n return {\n coarsePointer: DEFAULT_DEVICE_PROFILE.coarsePointer,\n canHover: DEFAULT_DEVICE_PROFILE.canHover,\n dpr,\n };\n }\n return {\n coarsePointer: window.matchMedia(COARSE_QUERY).matches,\n canHover: window.matchMedia(HOVER_QUERY).matches,\n dpr,\n };\n}\n\n/**\n * Detect device facts and keep them live.\n *\n * Three subscriptions: pointer coarseness, hover capability, and pixel\n * density. The density one is special — `(resolution: Ndppx)` stops matching\n * as soon as density changes, so a single listener fires once and goes dead.\n * We re-arm a fresh query at the new density on every change.\n */\nfunction useDetectedFacts(): DetectedDeviceFacts {\n const [facts, setFacts] = useState<DetectedDeviceFacts>(detectOnce);\n\n useEffect(() => {\n if (!hasMatchMedia()) return;\n\n const coarseMq = window.matchMedia(COARSE_QUERY);\n const hoverMq = window.matchMedia(HOVER_QUERY);\n\n const onCoarse = (e: MediaQueryListEvent | { matches: boolean }) =>\n setFacts((f) => ({ ...f, coarsePointer: e.matches }));\n const onHover = (e: MediaQueryListEvent | { matches: boolean }) =>\n setFacts((f) => ({ ...f, canHover: e.matches }));\n\n coarseMq.addEventListener('change', onCoarse as EventListener);\n hoverMq.addEventListener('change', onHover as EventListener);\n\n // Re-arming density watcher.\n let disposed = false;\n let densityMq: MediaQueryList | null = null;\n const onDensity = () => {\n if (disposed) return;\n const next = window.devicePixelRatio || 1;\n setFacts((f) => (f.dpr === next ? f : { ...f, dpr: next }));\n arm();\n };\n function arm(): void {\n if (disposed) return;\n densityMq?.removeEventListener('change', onDensity as EventListener);\n densityMq = window.matchMedia(\n `(resolution: ${window.devicePixelRatio || 1}dppx)`,\n );\n densityMq.addEventListener('change', onDensity as EventListener);\n }\n arm();\n\n // Re-sync once on mount: a query could have changed between the\n // useState initializer and the effect running.\n // eslint-disable-next-line react-hooks/set-state-in-effect -- re-syncs media queries that may have changed before subscribing\n setFacts({\n coarsePointer: coarseMq.matches,\n canHover: hoverMq.matches,\n dpr: window.devicePixelRatio || 1,\n });\n\n return () => {\n disposed = true;\n coarseMq.removeEventListener('change', onCoarse as EventListener);\n hoverMq.removeEventListener('change', onHover as EventListener);\n densityMq?.removeEventListener('change', onDensity as EventListener);\n };\n }, []);\n\n return facts;\n}\n\nconst DeviceProfileContext = createContext<DeviceProfile | null>(null);\n\n/**\n * Read the ambient device profile.\n *\n * Uses the nearest {@link DeviceProfileProvider} when one exists, and\n * otherwise detects for itself — so a standalone overlay or a labkit panel\n * rendered outside a `<SceneCanvas>` still gets correct facts.\n *\n * `overrides` always wins over both, which is what makes tests and\n * force-touch-chrome demos possible without stubbing `matchMedia`.\n */\nexport function useDeviceProfile(overrides?: Partial<DeviceProfile>): DeviceProfile {\n const provided = useContext(DeviceProfileContext);\n const detected = useDetectedFacts();\n const base: DetectedDeviceFacts = provided ?? detected;\n const { coarsePointer, canHover, dpr, targetScale } = overrides ?? {};\n return useMemo(\n () =>\n resolveDeviceProfile(base, {\n ...(coarsePointer !== undefined ? { coarsePointer } : {}),\n ...(canHover !== undefined ? { canHover } : {}),\n ...(dpr !== undefined ? { dpr } : {}),\n ...(targetScale !== undefined ? { targetScale } : {}),\n }),\n [base, coarsePointer, canHover, dpr, targetScale],\n );\n}\n\n/** Props for `<DeviceProfileProvider>`. */\nexport interface DeviceProfileProviderProps {\n /** Partial override folded over detected facts. */\n value?: Partial<DeviceProfile>;\n children: ReactNode;\n}\n\n/**\n * Publish one resolved profile to a subtree. `<SceneCanvas>` renders this so\n * overlays, affordances, and consumer chrome all read the same object.\n */\nexport function DeviceProfileProvider({ value, children }: DeviceProfileProviderProps) {\n const profile = useDeviceProfile(value);\n return createElement(DeviceProfileContext.Provider, { value: profile }, children);\n}\n"],"mappings":";;;AAYA,IAAMA,IAAe,qBACfC,IAAc;AAEpB,SAASC,IAAyB;CAChC,OAAO,OAAO,SAAW,OAAe,OAAO,OAAO,cAAe;AACvE;AAEA,SAASC,IAAkC;CAMzC,IAAMC,IAAO,OAAO,SAAW,OAAe,OAAO,oBAAqB;CAQ1E,OAPKF,EAAc,IAOZ;EACL,eAAe,OAAO,WAAWF,CAAY,CAAC,CAAC;EAC/C,UAAU,OAAO,WAAWC,CAAW,CAAC,CAAC;EACzC;CACF,IAVS;EACL,eAAeI,EAAuB;EACtC,UAAUA,EAAuB;EACjC;CACF;AAOJ;AAUA,SAASC,IAAwC;CAC/C,IAAM,CAACC,GAAOC,KAAYC,EAA8BN,CAAU;CAoDlE,OAlDAO,QAAgB;EACd,IAAI,CAACR,EAAc,GAAG;EAEtB,IAAMS,IAAW,OAAO,WAAWX,CAAY,GACzCY,IAAU,OAAO,WAAWX,CAAW,GAEvCY,KAAY,MAChBL,GAAU,OAAO;GAAE,GAAGM;GAAG,eAAe,EAAE;EAAQ,EAAE,GAChDC,KAAW,MACfP,GAAU,OAAO;GAAE,GAAGM;GAAG,UAAU,EAAE;EAAQ,EAAE;EAGjD,AADAH,EAAS,iBAAiB,UAAUE,CAAyB,GAC7DD,EAAQ,iBAAiB,UAAUG,CAAwB;EAG3D,IAAIC,IAAW,IACXC,IAAmC,MACjCC,UAAkB;GACtB,IAAIF,GAAU;GACd,IAAMG,IAAO,OAAO,oBAAoB;GAExC,AADAX,GAAU,MAAOM,EAAE,QAAQK,IAAOL,IAAI;IAAE,GAAGA;IAAG,KAAKK;GAAK,CAAE,GAC1DC,EAAI;EACN;EACA,SAASA,IAAY;GACnB,AAAIJ,MACJC,GAAW,oBAAoB,UAAUC,CAA0B,GACnE,IAAY,OAAO,WACjB,gBAAgB,OAAO,oBAAoB,EAAE,MAC/C,GACAD,EAAU,iBAAiB,UAAUC,CAA0B;EACjE;EAYA,OAXAE,EAAI,GAKJZ,EAAS;GACP,eAAeG,EAAS;GACxB,UAAUC,EAAQ;GAClB,KAAK,OAAO,oBAAoB;EAClC,CAAC,SAEY;GAIX,AAHA,IAAW,IACXD,EAAS,oBAAoB,UAAUE,CAAyB,GAChED,EAAQ,oBAAoB,UAAUG,CAAwB,GAC9DE,GAAW,oBAAoB,UAAUC,CAA0B;EACrE;CACF,GAAG,CAAC,CAAC,GAEEX;AACT;AAEA,IAAMc,IAAuBC,EAAoC,IAAI;AAYrE,SAAgBC,EAAiB,GAAmD;CAClF,IAAMC,IAAWC,EAAWJ,CAAoB,GAC1CK,IAAWpB,EAAiB,GAC5BqB,IAA4BH,KAAYE,GACxC,EAAE,kBAAe,aAAU,QAAK,mBAAgBE,KAAa,CAAC;CACpE,OAAOC,QAEHC,EAAqBH,GAAM;EACzB,GAAII,MAAkB,KAAA,IAAgC,CAAC,IAArB,EAAE,iBAAc;EAClD,GAAIC,MAAa,KAAA,IAA2B,CAAC,IAAhB,EAAE,YAAS;EACxC,GAAI5B,MAAQ,KAAA,IAAsB,CAAC,IAAX,EAAE,OAAI;EAC9B,GAAI6B,MAAgB,KAAA,IAA8B,CAAC,IAAnB,EAAE,eAAY;CAChD,CAAC,GACH;EAACN;EAAMI;EAAeC;EAAU5B;EAAK6B;CAAW,CAClD;AACF;AAaA,SAAgBC,EAAsB,EAAE,UAAO,eAAwC;CACrF,IAAMC,IAAUZ,EAAiBa,CAAK;CACtC,OAAOC,EAAchB,EAAqB,UAAU,EAAE,OAAOc,EAAQ,GAAGG,CAAQ;AAClF"}
1
+ {"version":3,"file":"useDeviceProfile.js","names":["COARSE_QUERY","HOVER_QUERY","hasMatchMedia","detectOnce","dpr","DEFAULT_DEVICE_PROFILE","useDetectedFacts","facts","setFacts","useState","useEffect","watch","coarseMq","hoverMq","onCoarse","f","onHover","unwatchDensity","watchDevicePixelRatio","next","DeviceProfileContext","createContext","useDeviceProfile","provided","useContext","detected","base","overrides","useMemo","resolveDeviceProfile","coarsePointer","canHover","targetScale","DeviceProfileProvider","profile","value","createElement","children"],"sources":["../../../src/core/device/useDeviceProfile.ts"],"sourcesContent":["import {\n createContext,\n createElement,\n useContext,\n useEffect,\n useMemo,\n useState,\n type ReactNode,\n} from 'react';\nimport type { DetectedDeviceFacts, DeviceProfile } from './types';\nimport { DEFAULT_DEVICE_PROFILE, resolveDeviceProfile } from '@weasel-js/routing';\nimport { watchDevicePixelRatio } from './watchDevicePixelRatio';\n\nconst COARSE_QUERY = '(pointer: coarse)';\nconst HOVER_QUERY = '(hover: hover)';\n\nfunction hasMatchMedia(): boolean {\n return typeof window !== 'undefined' && typeof window.matchMedia === 'function';\n}\n\nfunction detectOnce(): DetectedDeviceFacts {\n // Density is read unconditionally: `devicePixelRatio` does not depend on\n // `matchMedia` existing. Only *watching* density needs a media query.\n // Gating this read behind `hasMatchMedia()` would report density 1 under\n // any environment without matchMedia — including jsdom, which would\n // silently break `useCanvasSize`'s existing DPR assertions.\n const dpr = (typeof window !== 'undefined' && window.devicePixelRatio) || 1;\n if (!hasMatchMedia()) {\n return {\n coarsePointer: DEFAULT_DEVICE_PROFILE.coarsePointer,\n canHover: DEFAULT_DEVICE_PROFILE.canHover,\n dpr,\n };\n }\n return {\n coarsePointer: window.matchMedia(COARSE_QUERY).matches,\n canHover: window.matchMedia(HOVER_QUERY).matches,\n dpr,\n };\n}\n\n/**\n * Detect device facts and keep them live.\n *\n * Three subscriptions: pointer coarseness, hover capability, and pixel\n * density. None while `watch` is false, and the facts then go stale.\n */\nfunction useDetectedFacts(watch: boolean): DetectedDeviceFacts {\n const [facts, setFacts] = useState<DetectedDeviceFacts>(detectOnce);\n\n useEffect(() => {\n if (!watch || !hasMatchMedia()) return;\n\n const coarseMq = window.matchMedia(COARSE_QUERY);\n const hoverMq = window.matchMedia(HOVER_QUERY);\n\n const onCoarse = (e: MediaQueryListEvent | { matches: boolean }) =>\n setFacts((f) => ({ ...f, coarsePointer: e.matches }));\n const onHover = (e: MediaQueryListEvent | { matches: boolean }) =>\n setFacts((f) => ({ ...f, canHover: e.matches }));\n\n coarseMq.addEventListener('change', onCoarse as EventListener);\n hoverMq.addEventListener('change', onHover as EventListener);\n\n const unwatchDensity = watchDevicePixelRatio((next) =>\n setFacts((f) => (f.dpr === next ? f : { ...f, dpr: next })));\n\n // Re-sync once on mount: a query could have changed between the\n // useState initializer and the effect running.\n // eslint-disable-next-line react-hooks/set-state-in-effect -- re-syncs media queries that may have changed before subscribing\n setFacts({\n coarsePointer: coarseMq.matches,\n canHover: hoverMq.matches,\n dpr: window.devicePixelRatio || 1,\n });\n\n return () => {\n unwatchDensity();\n coarseMq.removeEventListener('change', onCoarse as EventListener);\n hoverMq.removeEventListener('change', onHover as EventListener);\n };\n }, [watch]);\n\n return facts;\n}\n\nconst DeviceProfileContext = createContext<DeviceProfile | null>(null);\n\n/**\n * Read the ambient device profile.\n *\n * Uses the nearest {@link DeviceProfileProvider} when one exists, watching\n * nothing of its own, and otherwise detects for itself — so a standalone overlay or a labkit panel\n * rendered outside a `<SceneCanvas>` still gets correct facts.\n *\n * `overrides` always wins over both, which is what makes tests and\n * force-touch-chrome demos possible without stubbing `matchMedia`.\n */\nexport function useDeviceProfile(overrides?: Partial<DeviceProfile>): DeviceProfile {\n const provided = useContext(DeviceProfileContext);\n const detected = useDetectedFacts(provided === null);\n const base: DetectedDeviceFacts = provided ?? detected;\n const { coarsePointer, canHover, dpr, targetScale } = overrides ?? {};\n return useMemo(\n () =>\n resolveDeviceProfile(base, {\n ...(coarsePointer !== undefined ? { coarsePointer } : {}),\n ...(canHover !== undefined ? { canHover } : {}),\n ...(dpr !== undefined ? { dpr } : {}),\n ...(targetScale !== undefined ? { targetScale } : {}),\n }),\n [base, coarsePointer, canHover, dpr, targetScale],\n );\n}\n\n/** Props for `<DeviceProfileProvider>`. */\nexport interface DeviceProfileProviderProps {\n /** Partial override folded over detected facts. */\n value?: Partial<DeviceProfile>;\n children: ReactNode;\n}\n\n/**\n * Publish one resolved profile to a subtree. `<SceneCanvas>` renders this so\n * overlays, affordances, and consumer chrome all read the same object.\n */\nexport function DeviceProfileProvider({ value, children }: DeviceProfileProviderProps) {\n const profile = useDeviceProfile(value);\n return createElement(DeviceProfileContext.Provider, { value: profile }, children);\n}\n"],"mappings":";;;;AAaA,IAAMA,IAAe,qBACfC,IAAc;AAEpB,SAASC,IAAyB;CAChC,OAAO,OAAO,SAAW,OAAe,OAAO,OAAO,cAAe;AACvE;AAEA,SAASC,IAAkC;CAMzC,IAAMC,IAAO,OAAO,SAAW,OAAe,OAAO,oBAAqB;CAQ1E,OAPKF,EAAc,IAOZ;EACL,eAAe,OAAO,WAAWF,CAAY,CAAC,CAAC;EAC/C,UAAU,OAAO,WAAWC,CAAW,CAAC,CAAC;EACzC;CACF,IAVS;EACL,eAAeI,EAAuB;EACtC,UAAUA,EAAuB;EACjC;CACF;AAOJ;AAQA,SAASC,EAAiB,GAAqC;CAC7D,IAAM,CAACC,GAAOC,KAAYC,EAA8BN,CAAU;CAmClE,OAjCAO,QAAgB;EACd,IAAI,CAACC,KAAS,CAACT,EAAc,GAAG;EAEhC,IAAMU,IAAW,OAAO,WAAWZ,CAAY,GACzCa,IAAU,OAAO,WAAWZ,CAAW,GAEvCa,KAAY,MAChBN,GAAU,OAAO;GAAE,GAAGO;GAAG,eAAe,EAAE;EAAQ,EAAE,GAChDC,KAAW,MACfR,GAAU,OAAO;GAAE,GAAGO;GAAG,UAAU,EAAE;EAAQ,EAAE;EAGjD,AADAH,EAAS,iBAAiB,UAAUE,CAAyB,GAC7DD,EAAQ,iBAAiB,UAAUG,CAAwB;EAE3D,IAAMC,IAAiBC,GAAuB,MAC5CV,GAAU,MAAOO,EAAE,QAAQI,IAAOJ,IAAI;GAAE,GAAGA;GAAG,KAAKI;EAAK,CAAE,CAAC;EAW7D,OANAX,EAAS;GACP,eAAeI,EAAS;GACxB,UAAUC,EAAQ;GAClB,KAAK,OAAO,oBAAoB;EAClC,CAAC,SAEY;GAGX,AAFAI,EAAe,GACfL,EAAS,oBAAoB,UAAUE,CAAyB,GAChED,EAAQ,oBAAoB,UAAUG,CAAwB;EAChE;CACF,GAAG,CAACL,CAAK,CAAC,GAEHJ;AACT;AAEA,IAAMa,IAAuBC,EAAoC,IAAI;AAYrE,SAAgBC,EAAiB,GAAmD;CAClF,IAAMC,IAAWC,EAAWJ,CAAoB,GAC1CK,IAAWnB,EAAiBiB,MAAa,IAAI,GAC7CG,IAA4BH,KAAYE,GACxC,EAAE,kBAAe,aAAU,QAAK,mBAAgBE,KAAa,CAAC;CACpE,OAAOC,QAEHC,EAAqBH,GAAM;EACzB,GAAII,MAAkB,KAAA,IAAgC,CAAC,IAArB,EAAE,iBAAc;EAClD,GAAIC,MAAa,KAAA,IAA2B,CAAC,IAAhB,EAAE,YAAS;EACxC,GAAI3B,MAAQ,KAAA,IAAsB,CAAC,IAAX,EAAE,OAAI;EAC9B,GAAI4B,MAAgB,KAAA,IAA8B,CAAC,IAAnB,EAAE,eAAY;CAChD,CAAC,GACH;EAACN;EAAMI;EAAeC;EAAU3B;EAAK4B;CAAW,CAClD;AACF;AAaA,SAAgBC,EAAsB,EAAE,UAAO,eAAwC;CACrF,IAAMC,IAAUZ,EAAiBa,CAAK;CACtC,OAAOC,EAAchB,EAAqB,UAAU,EAAE,OAAOc,EAAQ,GAAGG,CAAQ;AAClF"}
@@ -0,0 +1,17 @@
1
+ //#region src/core/device/watchDevicePixelRatio.ts
2
+ function e(e) {
3
+ if (typeof window > "u" || typeof window.matchMedia != "function") return () => {};
4
+ let t = !1, n = null, r = () => {
5
+ t || (i(), e(window.devicePixelRatio || 1));
6
+ };
7
+ function i() {
8
+ n?.removeEventListener("change", r), n = window.matchMedia(`(resolution: ${window.devicePixelRatio || 1}dppx)`), n.addEventListener("change", r);
9
+ }
10
+ return i(), () => {
11
+ t = !0, n?.removeEventListener("change", r);
12
+ };
13
+ }
14
+ //#endregion
15
+ export { e as watchDevicePixelRatio };
16
+
17
+ //# sourceMappingURL=watchDevicePixelRatio.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"watchDevicePixelRatio.js","names":["watchDevicePixelRatio","disposed","query","onDensity","arm","onChange"],"sources":["../../../src/core/device/watchDevicePixelRatio.ts"],"sourcesContent":["/**\n * Call `onChange` each time `window.devicePixelRatio` changes: the window\n * moved to a display of another density, or the page zoomed. Returns the\n * unsubscribe. A no-op where `matchMedia` does not exist.\n *\n * `(resolution: Ndppx)` stops matching as soon as density changes, so one\n * listener fires once and goes dead; this arms a fresh query at the new\n * density on every change.\n */\nexport function watchDevicePixelRatio(onChange: (dpr: number) => void): () => void {\n if (typeof window === 'undefined' || typeof window.matchMedia !== 'function') return () => {};\n let disposed = false;\n let query: MediaQueryList | null = null;\n const onDensity = (): void => {\n if (disposed) return;\n arm();\n onChange(window.devicePixelRatio || 1);\n };\n function arm(): void {\n query?.removeEventListener('change', onDensity);\n query = window.matchMedia(`(resolution: ${window.devicePixelRatio || 1}dppx)`);\n query.addEventListener('change', onDensity);\n }\n arm();\n return () => {\n disposed = true;\n query?.removeEventListener('change', onDensity);\n };\n}\n"],"mappings":";AASA,SAAgBA,EAAsB,GAA6C;CACjF,IAAI,OAAO,SAAW,OAAe,OAAO,OAAO,cAAe,YAAY,aAAa,CAAC;CAC5F,IAAIC,IAAW,IACXC,IAA+B,MAC7BC,UAAwB;EAC5B,AAAIF,MACJG,EAAI,GACJC,EAAS,OAAO,oBAAoB,CAAC;CACvC;CACA,SAASD,IAAY;EAGnB,AAFAF,GAAO,oBAAoB,UAAUC,CAAS,GAC9C,IAAQ,OAAO,WAAW,gBAAgB,OAAO,oBAAoB,EAAE,MAAM,GAC7ED,EAAM,iBAAiB,UAAUC,CAAS;CAC5C;CAEA,OADAC,EAAI,SACS;EAEX,AADA,IAAW,IACXF,GAAO,oBAAoB,UAAUC,CAAS;CAChD;AACF"}
@@ -1,6 +1,6 @@
1
- import { RECT_POSE_DESCRIPTOR as e } from "../../../core/geometry/poseDescriptor.js";
2
- import { pathPoseDescriptor as t } from "../../../features/paths/poseDescriptor.js";
3
- //#region src/interactions/actions/resize/autoPoseDescriptor.ts
1
+ import { pathPoseDescriptor as e } from "./pathPoseDescriptor.js";
2
+ import { RECT_POSE_DESCRIPTOR as t } from "./poseDescriptor.js";
3
+ //#region src/core/geometry/autoPoseDescriptor.ts
4
4
  function n(e) {
5
5
  return !!e && typeof e == "object" && "kind" in e && (e.kind === "polygon" || e.kind === "rect");
6
6
  }
@@ -10,10 +10,11 @@ function r(e) {
10
10
  return typeof t.x == "number" && typeof t.y == "number" && typeof t.width == "number" && typeof t.height == "number";
11
11
  }
12
12
  var i = {
13
- getBounds: (r) => n(r) ? t.getBounds(r) : e.getBounds(r),
14
- remapBounds: (r, i, a) => n(r) ? t.remapBounds(r, i, a) : e.remapBounds(r, i, a),
15
- fromBounds: (r, i) => n(i) ? t.fromBounds(r, i) : e.fromBounds(r, i),
16
- translate: (r, i, a) => n(r) ? t.translate(r, i, a) : e.translate(r, i, a),
13
+ getBounds: (r) => n(r) ? e.getBounds(r) : t.getBounds(r),
14
+ remapBounds: (r, i, a) => n(r) ? e.remapBounds(r, i, a) : t.remapBounds(r, i, a),
15
+ fromBounds: (r, i) => n(i) ? e.fromBounds(r, i) : t.fromBounds(r, i),
16
+ translate: (r, i, a) => n(r) ? e.translate(r, i, a) : t.translate(r, i, a),
17
+ axes: (i) => r(i) ? t.axes(i) : n(i) ? e.axes(i) : null,
17
18
  getRotation: (e) => {
18
19
  if (n(e)) return 0;
19
20
  let t = e.rotation;
@@ -0,0 +1 @@
1
+ {"version":3,"file":"autoPoseDescriptor.js","names":["isPathLike","p","isRectPose","r","AUTO_POSE_DESCRIPTOR","pathPoseDescriptor","RECT_POSE_DESCRIPTOR","src","dst","template","b","dx","dy"],"sources":["../../../src/core/geometry/autoPoseDescriptor.ts"],"sourcesContent":["import type { Path } from '@weasel-js/geom';\nimport { pathPoseDescriptor } from './pathPoseDescriptor';\nimport { RECT_POSE_DESCRIPTOR, type PoseDescriptor } from './poseDescriptor';\nimport type { Bounds } from 'core/viewport/fitViewToBounds';\n\n/** True for Path-shaped poses (`{kind: 'polygon' | 'rect'}`). Useful for\n * callers that need to fork between `pathPoseDescriptor` and\n * `RECT_POSE_DESCRIPTOR` without forcing the consumer to wire\n * `poseDescriptor` explicitly. */\nexport function isPathLike(p: unknown): p is Path {\n return !!p && typeof p === 'object' && 'kind' in p\n && ((p as { kind: unknown }).kind === 'polygon' || (p as { kind: unknown }).kind === 'rect');\n}\n\n/** True for a pose with numeric top-level `x`/`y`/`width`/`height` — the only\n * shape the rect descriptor and the kit's built-in painters can read. */\nexport function isRectPose(p: unknown): p is { x: number; y: number; width: number; height: number; rotation?: number } {\n if (!p || typeof p !== 'object') return false;\n const r = p as Record<string, unknown>;\n return typeof r.x === 'number' && typeof r.y === 'number'\n && typeof r.width === 'number' && typeof r.height === 'number';\n}\n\n/** Per-call dispatch: if the pose looks like a Path, route to\n * `pathPoseDescriptor`; otherwise treat as a plain rect pose. Avoids forcing\n * demos with Path TPose to wire `poseDescriptor={pathPoseDescriptor}`\n * explicitly. `getRotation` surfaces a `pose.rotation` field on non-Path poses\n * so demos using rect-with-rotation shapes (e.g. `RotatedPose`) don't have to\n * wire `poseDescriptor={ROTATED_POSE_DESCRIPTOR}` just to get rotated\n * selection chrome and rotation-aware corner hit-tests. */\nexport const AUTO_POSE_DESCRIPTOR: PoseDescriptor<unknown> = {\n getBounds: (p) => isPathLike(p)\n ? pathPoseDescriptor.getBounds(p)\n : RECT_POSE_DESCRIPTOR.getBounds(p as { x: number; y: number; width: number; height: number }),\n remapBounds: (p, src, dst) => isPathLike(p)\n ? pathPoseDescriptor.remapBounds(p, src, dst)\n : RECT_POSE_DESCRIPTOR.remapBounds(p as { x: number; y: number; width: number; height: number }, src, dst),\n fromBounds: (b, template) => isPathLike(template)\n ? pathPoseDescriptor.fromBounds(b, template)\n : RECT_POSE_DESCRIPTOR.fromBounds(b, template as Bounds),\n translate: (p, dx, dy) => isPathLike(p)\n ? pathPoseDescriptor.translate!(p, dx, dy)\n : RECT_POSE_DESCRIPTOR.translate!(p as { x: number; y: number; width: number; height: number }, dx, dy),\n axes: (p) => (isRectPose(p)\n ? RECT_POSE_DESCRIPTOR.axes!(p) as never\n : isPathLike(p) ? pathPoseDescriptor.axes!(p) as never : null),\n getRotation: (p) => {\n if (isPathLike(p)) return 0;\n const r = (p as { rotation?: unknown }).rotation;\n return typeof r === 'number' ? r : 0;\n },\n // Path-shaped poses can't carry rotation (see `pathPoseDescriptor`).\n // Everything else flows through `wrapWithPoseRotation`'s x/y/w/h gate at\n // paint time, so report `true` and let the wrapper no-op for poses\n // missing AABB fields.\n supportsRotation: (p) => !isPathLike(p),\n withRotation: (p, rotation) => isPathLike(p) ? p : { ...(p as object), rotation },\n};\n"],"mappings":";;;AASA,SAAgBA,EAAW,GAAuB;CAChD,OAAO,CAAC,CAACC,KAAK,OAAOA,KAAM,YAAY,UAAUA,MAC1CA,EAAwB,SAAS,aAAcA,EAAwB,SAAS;AACzF;AAIA,SAAgBC,EAAW,GAA6F;CACtH,IAAI,CAACD,KAAK,OAAOA,KAAM,UAAU,OAAO;CACxC,IAAME,IAAIF;CACV,OAAO,OAAOE,EAAE,KAAM,YAAY,OAAOA,EAAE,KAAM,YAC5C,OAAOA,EAAE,SAAU,YAAY,OAAOA,EAAE,UAAW;AAC1D;AASA,IAAaC,IAAgD;CAC3D,YAAY,MAAMJ,EAAWC,CAAC,IAC1BI,EAAmB,UAAUJ,CAAC,IAC9BK,EAAqB,UAAUL,CAA4D;CAC/F,cAAc,GAAG,GAAK,MAAQD,EAAWC,CAAC,IACtCI,EAAmB,YAAYJ,GAAGM,GAAKC,CAAG,IAC1CF,EAAqB,YAAYL,GAA8DM,GAAKC,CAAG;CAC3G,aAAa,GAAG,MAAaR,EAAWS,CAAQ,IAC5CJ,EAAmB,WAAWK,GAAGD,CAAQ,IACzCH,EAAqB,WAAWI,GAAGD,CAAkB;CACzD,YAAY,GAAG,GAAI,MAAOT,EAAWC,CAAC,IAClCI,EAAmB,UAAWJ,GAAGU,GAAIC,CAAE,IACvCN,EAAqB,UAAWL,GAA8DU,GAAIC,CAAE;CACxG,OAAO,MAAOV,EAAWD,CAAC,IACtBK,EAAqB,KAAML,CAAC,IAC5BD,EAAWC,CAAC,IAAII,EAAmB,KAAMJ,CAAC,IAAa;CAC3D,cAAc,MAAM;EAClB,IAAID,EAAWC,CAAC,GAAG,OAAO;EAC1B,IAAME,IAAKF,EAA6B;EACxC,OAAO,OAAOE,KAAM,WAAWA,IAAI;CACrC;CAKA,mBAAmB,MAAM,CAACH,EAAWC,CAAC;CACtC,eAAe,GAAG,MAAaD,EAAWC,CAAC,IAAIA,IAAI;EAAE,GAAIA;EAAc;CAAS;AAClF"}
@@ -0,0 +1,88 @@
1
+ import { boundsOfPath as e, boxToBox as t, transformPath as n, translatePath as r } from "@weasel-js/geom";
2
+ //#region src/core/geometry/pathPoseDescriptor.ts
3
+ var i = {
4
+ getBounds: (t) => e(t),
5
+ remapBounds: (e, r, i) => n(e, t(r.x, r.y, r.width, r.height, i.x, i.y, i.width, i.height)),
6
+ fromBounds: (e) => ({
7
+ kind: "rect",
8
+ x: e.x,
9
+ y: e.y,
10
+ width: e.width,
11
+ height: e.height
12
+ }),
13
+ translate: (e, t, n) => r(e, t, n),
14
+ lerp: (e, t, n) => {
15
+ if (e.kind === "rect" && t.kind === "rect") return {
16
+ kind: "rect",
17
+ x: e.x + (t.x - e.x) * n,
18
+ y: e.y + (t.y - e.y) * n,
19
+ width: e.width + (t.width - e.width) * n,
20
+ height: e.height + (t.height - e.height) * n
21
+ };
22
+ if (e.kind === "polygon" && t.kind === "polygon" && e.coords.length === t.coords.length) {
23
+ let r = new Float32Array(e.coords.length);
24
+ for (let i = 0; i < e.coords.length; i++) r[i] = e.coords[i] + (t.coords[i] - e.coords[i]) * n;
25
+ return {
26
+ ...e,
27
+ coords: r
28
+ };
29
+ }
30
+ throw Error("pathPoseDescriptor.lerp: incompatible path shapes");
31
+ },
32
+ axes: (e) => e.kind === "rect" ? {
33
+ count: 4,
34
+ names: [
35
+ "x",
36
+ "y",
37
+ "width",
38
+ "height"
39
+ ],
40
+ to: (e) => e.kind === "rect" ? [
41
+ e.x,
42
+ e.y,
43
+ e.width,
44
+ e.height
45
+ ] : [],
46
+ from: (e) => ({
47
+ kind: "rect",
48
+ x: e[0],
49
+ y: e[1],
50
+ width: e[2],
51
+ height: e[3]
52
+ }),
53
+ add: (e, t) => e.kind === "rect" ? {
54
+ kind: "rect",
55
+ x: e.x + t[0],
56
+ y: e.y + t[1],
57
+ width: e.width + t[2],
58
+ height: e.height + t[3]
59
+ } : e,
60
+ write: (e, t, n) => {
61
+ e.kind === "rect" && (t[n] = e.x, t[n + 1] = e.y, t[n + 2] = e.width, t[n + 3] = e.height);
62
+ }
63
+ } : {
64
+ count: e.coords.length,
65
+ to: (e) => e.kind === "polygon" ? Array.from(e.coords) : [],
66
+ from: (t) => ({
67
+ ...e,
68
+ coords: Float32Array.from(t)
69
+ }),
70
+ add: (t, n) => {
71
+ if (t.kind !== "polygon") return t;
72
+ let r = new Float32Array(t.coords.length);
73
+ for (let e = 0; e < r.length; e++) r[e] = t.coords[e] + n[e];
74
+ return {
75
+ ...e,
76
+ coords: r
77
+ };
78
+ },
79
+ write: (e, t, n) => {
80
+ if (e.kind === "polygon") for (let r = 0; r < e.coords.length; r++) t[n + r] = e.coords[r];
81
+ }
82
+ },
83
+ supportsRotation: () => !1
84
+ };
85
+ //#endregion
86
+ export { i as pathPoseDescriptor };
87
+
88
+ //# sourceMappingURL=pathPoseDescriptor.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pathPoseDescriptor.js","names":["pathPoseDescriptor","boundsOfPath","path","transformPath","boxToBox","src","dst","b","translatePath","dx","dy","a","t","next","like","p","d","at","coords","i"],"sources":["../../../src/core/geometry/pathPoseDescriptor.ts"],"sourcesContent":["import {\n boxToBox,\n boundsOfPath,\n translatePath,\n transformPath,\n type Path,\n} from '@weasel-js/geom';\nimport type { PoseDescriptor } from 'core/geometry/poseDescriptor';\n\n/**\n * `PoseDescriptor` for `Path` poses — wires `useResize` to operate\n * on `Path` directly. `getBounds` defers to the same `boundsOfPath` kernel\n * the rest of the kit uses.\n *\n * `remapBounds` mirrors `scalePathToBounds` but takes `src` explicitly: the\n * resize hook knows the group's origin AABB and uses it for every leaf,\n * instead of each leaf scaling against its own AABB (which would ignore\n * group context).\n */\nexport const pathPoseDescriptor: PoseDescriptor<Path> = {\n getBounds: (path) => boundsOfPath(path),\n remapBounds: (path, src, dst) => transformPath(\n path,\n boxToBox(src.x, src.y, src.width, src.height, dst.x, dst.y, dst.width, dst.height),\n ),\n fromBounds: (b) => ({ kind: 'rect', x: b.x, y: b.y, width: b.width, height: b.height }),\n translate: (path, dx, dy) => translatePath(path, dx, dy),\n lerp: (a, b, t) => {\n if (a.kind === 'rect' && b.kind === 'rect') {\n return {\n kind: 'rect',\n x: a.x + (b.x - a.x) * t,\n y: a.y + (b.y - a.y) * t,\n width: a.width + (b.width - a.width) * t,\n height: a.height + (b.height - a.height) * t,\n };\n }\n if (a.kind === 'polygon' && b.kind === 'polygon' && a.coords.length === b.coords.length) {\n const next = new Float32Array(a.coords.length);\n for (let i = 0; i < a.coords.length; i++) {\n next[i] = a.coords[i] + (b.coords[i] - a.coords[i]) * t;\n }\n return { ...a, coords: next };\n }\n throw new Error('pathPoseDescriptor.lerp: incompatible path shapes');\n },\n // A polygon's axes are its coordinates, so a move needs both ends to have as many points.\n axes: (like) => {\n if (like.kind === 'rect') {\n return {\n count: 4,\n names: ['x', 'y', 'width', 'height'],\n to: (p) => (p.kind === 'rect' ? [p.x, p.y, p.width, p.height] : []),\n from: (a) => ({ kind: 'rect', x: a[0]!, y: a[1]!, width: a[2]!, height: a[3]! }),\n add: (p, d) => (p.kind !== 'rect' ? p : {\n kind: 'rect', x: p.x + d[0]!, y: p.y + d[1]!, width: p.width + d[2]!, height: p.height + d[3]!,\n }),\n write: (p, out, at) => {\n if (p.kind !== 'rect') return;\n out[at] = p.x;\n out[at + 1] = p.y;\n out[at + 2] = p.width;\n out[at + 3] = p.height;\n },\n };\n }\n return {\n count: like.coords.length,\n to: (p) => (p.kind === 'polygon' ? Array.from(p.coords) : []),\n from: (a) => ({ ...like, coords: Float32Array.from(a as ArrayLike<number>) }),\n add: (p, d) => {\n if (p.kind !== 'polygon') return p;\n const coords = new Float32Array(p.coords.length);\n for (let i = 0; i < coords.length; i++) coords[i] = p.coords[i]! + d[i]!;\n return { ...like, coords };\n },\n write: (p, out, at) => {\n if (p.kind !== 'polygon') return;\n for (let i = 0; i < p.coords.length; i++) out[at + i] = p.coords[i]!;\n },\n };\n },\n // Path poses carry no x/y/width/height/rotation fields — the kit's\n // `wrapWithPoseRotation` helper has nothing to bind a rotation to, and\n // `remapBounds` would drop a synthetic rotation field on every commit.\n // Returning false here hides the rotation affordance for Path consumers\n // so the rotate cursor doesn't appear without a working interaction.\n supportsRotation: () => false,\n};\n"],"mappings":";;AAmBA,IAAaA,IAA2C;CACtD,YAAY,MAASC,EAAaC,CAAI;CACtC,cAAc,GAAM,GAAK,MAAQC,EAC/BD,GACAE,EAASC,EAAI,GAAGA,EAAI,GAAGA,EAAI,OAAOA,EAAI,QAAQC,EAAI,GAAGA,EAAI,GAAGA,EAAI,OAAOA,EAAI,MAAM,CACnF;CACA,aAAa,OAAO;EAAE,MAAM;EAAQ,GAAGC,EAAE;EAAG,GAAGA,EAAE;EAAG,OAAOA,EAAE;EAAO,QAAQA,EAAE;CAAO;CACrF,YAAY,GAAM,GAAI,MAAOC,EAAcN,GAAMO,GAAIC,CAAE;CACvD,OAAO,GAAG,GAAG,MAAM;EACjB,IAAIC,EAAE,SAAS,UAAUJ,EAAE,SAAS,QAClC,OAAO;GACL,MAAM;GACN,GAAGI,EAAE,KAAKJ,EAAE,IAAII,EAAE,KAAKC;GACvB,GAAGD,EAAE,KAAKJ,EAAE,IAAII,EAAE,KAAKC;GACvB,OAAOD,EAAE,SAASJ,EAAE,QAAQI,EAAE,SAASC;GACvC,QAAQD,EAAE,UAAUJ,EAAE,SAASI,EAAE,UAAUC;EAC7C;EAEF,IAAID,EAAE,SAAS,aAAaJ,EAAE,SAAS,aAAaI,EAAE,OAAO,WAAWJ,EAAE,OAAO,QAAQ;GACvF,IAAMM,IAAO,IAAI,aAAaF,EAAE,OAAO,MAAM;GAC7C,KAAK,IAAI,IAAI,GAAG,IAAIA,EAAE,OAAO,QAAQ,KACnC,EAAK,KAAKA,EAAE,OAAO,MAAMJ,EAAE,OAAO,KAAKI,EAAE,OAAO,MAAMC;GAExD,OAAO;IAAE,GAAGD;IAAG,QAAQE;GAAK;EAC9B;EACA,MAAU,MAAM,mDAAmD;CACrE;CAEA,OAAO,MACDC,EAAK,SAAS,SACT;EACL,OAAO;EACP,OAAO;GAAC;GAAK;GAAK;GAAS;EAAQ;EACnC,KAAK,MAAOC,EAAE,SAAS,SAAS;GAACA,EAAE;GAAGA,EAAE;GAAGA,EAAE;GAAOA,EAAE;EAAM,IAAI,CAAC;EACjE,OAAO,OAAO;GAAE,MAAM;GAAQ,GAAGJ,EAAE;GAAK,GAAGA,EAAE;GAAK,OAAOA,EAAE;GAAK,QAAQA,EAAE;EAAI;EAC9E,MAAM,GAAG,MAAOI,EAAE,SAAS,SAAa;GACtC,MAAM;GAAQ,GAAGA,EAAE,IAAIC,EAAE;GAAK,GAAGD,EAAE,IAAIC,EAAE;GAAK,OAAOD,EAAE,QAAQC,EAAE;GAAK,QAAQD,EAAE,SAASC,EAAE;EAC7F,IAFoCD;EAGpC,QAAQ,GAAG,GAAK,MAAO;GACrB,AAAIA,EAAE,SAAS,WACf,EAAIE,KAAMF,EAAE,GACZ,EAAIE,IAAK,KAAKF,EAAE,GAChB,EAAIE,IAAK,KAAKF,EAAE,OAChB,EAAIE,IAAK,KAAKF,EAAE;EAClB;CACF,IAEK;EACL,OAAOD,EAAK,OAAO;EACnB,KAAK,MAAOC,EAAE,SAAS,YAAY,MAAM,KAAKA,EAAE,MAAM,IAAI,CAAC;EAC3D,OAAO,OAAO;GAAE,GAAGD;GAAM,QAAQ,aAAa,KAAKH,CAAsB;EAAE;EAC3E,MAAM,GAAG,MAAM;GACb,IAAII,EAAE,SAAS,WAAW,OAAOA;GACjC,IAAMG,IAAS,IAAI,aAAaH,EAAE,OAAO,MAAM;GAC/C,KAAK,IAAII,IAAI,GAAGA,IAAID,EAAO,QAAQ,KAAK,EAAOC,KAAKJ,EAAE,OAAOI,KAAMH,EAAEG;GACrE,OAAO;IAAE,GAAGL;IAAM;GAAO;EAC3B;EACA,QAAQ,GAAG,GAAK,MAAO;GACrB,IAAIC,EAAE,SAAS,WACf,KAAK,IAAII,IAAI,GAAGA,IAAIJ,EAAE,OAAO,QAAQ,KAAK,EAAIE,IAAKE,KAAKJ,EAAE,OAAOI;EACnE;CACF;CAOF,wBAAwB;AAC1B"}
@@ -1,9 +1,10 @@
1
1
  import { axisAlignedBounds as e } from "./unionBounds.js";
2
+ import { poseLinearOf as t } from "@weasel-js/geom";
2
3
  //#region src/core/geometry/poseDescriptor.ts
3
- function t(e, t) {
4
+ function n(e, t) {
4
5
  return e.forNode?.(t) ?? e;
5
6
  }
6
- var n = {
7
+ var r = {
7
8
  getBounds: (e) => e,
8
9
  remapBounds: (e, t, n) => {
9
10
  let r = t.width === 0 ? 1 : n.width / t.width, i = t.height === 0 ? 1 : n.height / t.height;
@@ -33,16 +34,63 @@ var n = {
33
34
  width: e.width + (t.width - e.width) * n,
34
35
  height: e.height + (t.height - e.height) * n
35
36
  }),
37
+ axes: (e) => [
38
+ e.x,
39
+ e.y,
40
+ e.width,
41
+ e.height
42
+ ].every((e) => typeof e == "number") ? {
43
+ count: 5,
44
+ names: [
45
+ "x",
46
+ "y",
47
+ "width",
48
+ "height",
49
+ "rotation"
50
+ ],
51
+ angles: [4],
52
+ to: (e) => [
53
+ e.x,
54
+ e.y,
55
+ e.width,
56
+ e.height,
57
+ e.rotation ?? 0
58
+ ],
59
+ from: (t) => {
60
+ let n = {
61
+ ...e,
62
+ x: t[0],
63
+ y: t[1],
64
+ width: t[2],
65
+ height: t[3]
66
+ };
67
+ return (e.rotation !== void 0 || t[4] !== 0) && (n.rotation = t[4]), n;
68
+ },
69
+ add: (e, t) => {
70
+ let n = {
71
+ ...e,
72
+ x: e.x + t[0],
73
+ y: e.y + t[1],
74
+ width: e.width + t[2],
75
+ height: e.height + t[3]
76
+ }, r = (e.rotation ?? 0) + t[4];
77
+ return (e.rotation !== void 0 || r !== 0) && (n.rotation = r), n;
78
+ },
79
+ write: (e, t, n) => {
80
+ t[n] = e.x, t[n + 1] = e.y, t[n + 2] = e.width, t[n + 3] = e.height, t[n + 4] = e.rotation ?? 0;
81
+ }
82
+ } : null,
36
83
  getRotation: (e) => e.rotation ?? 0,
37
84
  withRotation: (e, t) => ({
38
85
  ...e,
39
86
  rotation: t
40
87
  })
41
- }, r = {
42
- getBounds: n.getBounds,
43
- remapBounds: n.remapBounds,
44
- translate: n.translate,
45
- lerp: n.lerp,
88
+ }, i = {
89
+ getBounds: r.getBounds,
90
+ remapBounds: r.remapBounds,
91
+ translate: r.translate,
92
+ lerp: r.lerp,
93
+ axes: r.axes,
46
94
  fromBounds: (e) => ({
47
95
  x: e.x,
48
96
  y: e.y,
@@ -56,7 +104,7 @@ var n = {
56
104
  rotation: t
57
105
  })
58
106
  };
59
- function i(e, t, n) {
107
+ function a(e, t, n) {
60
108
  let r = t.width === 0 ? 1 : n.width / t.width, i = t.height === 0 ? 1 : n.height / t.height, a = e.rotation ?? 0, o = Math.cos(a), s = Math.sin(a), c = r * o, l = i * s, u = -r * s, d = i * o, f = e.width * Math.hypot(c, l), p = e.height * Math.hypot(u, d), m = Math.atan2(l, c), h = n.x + (e.x + e.width / 2 - t.x) * r, g = n.y + (e.y + e.height / 2 - t.y) * i;
61
109
  return {
62
110
  ...e,
@@ -67,17 +115,18 @@ function i(e, t, n) {
67
115
  rotation: m
68
116
  };
69
117
  }
70
- function a(t, n) {
71
- let r = n.getBounds(t), i = n.getRotation?.(t) ?? r.rotation ?? 0;
72
- return e({
73
- x: r.x,
74
- y: r.y,
75
- width: r.width,
76
- height: r.height,
77
- rotation: i
78
- });
118
+ function o(t, n) {
119
+ return e(s(t, n));
79
120
  }
80
- function o(e, t, n, r) {
121
+ function s(e, n) {
122
+ let r = n.getBounds(e), i = n.getRotation?.(e) ?? r.rotation ?? 0, a = t(e) ?? t(r);
123
+ return !i && !a ? r : {
124
+ ...r,
125
+ ...i ? { rotation: i } : {},
126
+ ...a ? { transform: a } : {}
127
+ };
128
+ }
129
+ function c(e, t, n, r) {
81
130
  if (r.translate) return r.translate(e, t, n);
82
131
  let i = r.getBounds(e), a = {
83
132
  x: i.x + t,
@@ -88,6 +137,6 @@ function o(e, t, n, r) {
88
137
  return r.remapBounds(e, i, a);
89
138
  }
90
139
  //#endregion
91
- export { n as RECT_POSE_DESCRIPTOR, r as ROTATED_POSE_DESCRIPTOR, t as poseDescriptorForNode, i as remapRotatedLeaf, o as translatePoseViaDescriptor, a as visualBoundsViaDescriptor };
140
+ export { r as RECT_POSE_DESCRIPTOR, i as ROTATED_POSE_DESCRIPTOR, s as framedBounds, n as poseDescriptorForNode, a as remapRotatedLeaf, c as translatePoseViaDescriptor, o as visualBoundsViaDescriptor };
92
141
 
93
142
  //# sourceMappingURL=poseDescriptor.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"poseDescriptor.js","names":["poseDescriptorForNode","descriptor","node","RECT_POSE_DESCRIPTOR","p","sx","src","dst","sy","b","dx","dy","a","t","ROTATED_POSE_DESCRIPTOR","remapRotatedLeaf","theta","pose","cos","sin","ux","uy","vx","vy","width","height","rotation","cxNew","cyNew","visualBoundsViaDescriptor","geometry","axisAlignedBounds","translatePoseViaDescriptor"],"sources":["../../../src/core/geometry/poseDescriptor.ts"],"sourcesContent":["import type { Bounds } from 'core/viewport/fitViewToBounds';\nimport { axisAlignedBounds } from 'core/geometry/unionBounds';\n\n/** `Bounds` with a required rotation angle (radians). Pivot is the AABB\n * center of the unrotated `{x, y, width, height}`. */\nexport interface RotatedPose extends Bounds {\n rotation: number;\n}\n\n/**\n * Bridges arbitrary `TPose` shapes into the resize hook's bounds-driven math.\n * The hook reads bounds via `getBounds`, runs anchor-relative math on those\n * bounds, then asks `remapBounds` to project the result back into TPose.\n *\n * `remapBounds(pose, src, dst)` is a single operation that subsumes both\n * \"set my own AABB to dst\" (single-leaf resize) and \"scale me as a leaf\n * inside parent's src→dst rect\" (group resize) — they're the same affine\n * map. For rect-shaped poses the default geometry interprets the pose as\n * its own bounds; for Path or polygon poses the consumer supplies a\n * projection that knows how to read and rewrite the underlying geometry.\n */\nexport interface PoseDescriptor<TPose, TNode = unknown> {\n getBounds(pose: TPose): Bounds;\n remapBounds(pose: TPose, src: Bounds, dst: Bounds): TPose;\n /** A pose occupying `bounds`, of the same kind as `template`. Unlike\n * `remapBounds`, the result carries none of the template's shape. */\n fromBounds(bounds: Bounds, template: TPose): TPose;\n /** Translate the pose by (dx, dy). Optional — when omitted, callers fall\n * back to a translation derived from `remapBounds` (origin shifted, no\n * scale). Path-shaped poses should provide this for performance. */\n translate?(pose: TPose, dx: number, dy: number): TPose;\n /** Interpolate between two poses. Optional — animation helpers fall back to\n * rect-shape lerp when omitted (which fails for non-rect poses). */\n lerp?(a: TPose, b: TPose, t: number): TPose;\n /** Read the pose's rotation in radians. Pivot is the AABB center\n * (`getBounds(pose)` center). Default 0 when omitted — descriptor\n * declares \"this pose has no rotation.\" When supplied and non-zero,\n * `useResize` projects the drag delta into the leaf's local frame,\n * runs anchor math there, and translates the resulting pose so the\n * diagonally opposite world-space corner is pinned. */\n getRotation?(pose: TPose): number;\n /** True iff this pose shape can carry a rotation. Consulted by the\n * rotation affordance to decide whether to render the rotate cursor /\n * drag-band over a selection. When omitted, the kit assumes `true` for\n * back-compat — descriptors whose poses lack `x/y/width/height/rotation`\n * fields (e.g. polygon Paths) should return `false` so the affordance\n * hides instead of exposing a non-functional rotate cursor. */\n supportsRotation?(pose: TPose): boolean;\n /** Write a rotation (radians) into the pose, bounds unchanged. Absent means\n * the pose cannot carry one, and the rotate action leaves it alone. */\n withRotation?(pose: TPose, rotation: number): TPose;\n /**\n * A descriptor specialized to one node. Every other method here sees only\n * the pose, so shapes sharing a pose type — a sphere and a box both posed by\n * position/rotation/scale — are indistinguishable to them. Implement this to\n * read `node.data` once and hand back a descriptor that knows which shape it\n * is describing.\n *\n * Callers reach it through {@link poseDescriptorForNode}, at whichever site\n * holds the node; the specialized descriptor then travels into the bounds and\n * hit-test helpers in place of this one. Sites with only an id keep using the\n * unspecialized descriptor, which is why this is optional on both ends.\n */\n forNode?(node: TNode): PoseDescriptor<TPose, TNode>;\n}\n\n/** The descriptor `node` should be read through: its own specialization when\n * it declares one, and otherwise the descriptor unchanged. */\nexport function poseDescriptorForNode<TPose, TNode>(\n descriptor: PoseDescriptor<TPose, TNode>,\n node: TNode,\n): PoseDescriptor<TPose, TNode> {\n return descriptor.forNode?.(node) ?? descriptor;\n}\n\n/** Identity geometry for `TPose extends Bounds`. Treats the pose as its\n * own bounds and remaps via affine scale against `src`/`dst`. */\nexport const RECT_POSE_DESCRIPTOR: PoseDescriptor<Bounds> = {\n getBounds: (p) => p,\n remapBounds: (p, src, dst) => {\n const sx = src.width === 0 ? 1 : dst.width / src.width;\n const sy = src.height === 0 ? 1 : dst.height / src.height;\n return {\n ...p,\n x: dst.x + (p.x - src.x) * sx,\n y: dst.y + (p.y - src.y) * sy,\n width: p.width * sx,\n height: p.height * sy,\n };\n },\n fromBounds: (b) => ({ x: b.x, y: b.y, width: b.width, height: b.height }),\n translate: (p, dx, dy) => ({ ...p, x: p.x + dx, y: p.y + dy }),\n lerp: (a, b, t) => ({\n ...a,\n x: a.x + (b.x - a.x) * t,\n y: a.y + (b.y - a.y) * t,\n width: a.width + (b.width - a.width) * t,\n height: a.height + (b.height - a.height) * t,\n }),\n // `Bounds` carries an optional `rotation`, and `withRotation` writes into\n // it — so reading it back has to be the same channel, or a pose reports\n // itself unrotated to `useResize` and to port placement while painting\n // rotated.\n getRotation: (p) => p.rotation ?? 0,\n withRotation: (p, rotation) => ({ ...p, rotation }),\n};\n\n/** Identity geometry for `RotatedPose`. Inherits rect-shape projection\n * from `RECT_POSE_DESCRIPTOR` (the `RotatedPose extends Bounds`\n * subtype lets the rect descriptor's methods apply directly; `remapBounds`\n * preserves the `rotation` field via `...p` spread). Adds `getRotation` so\n * `useResize` knows to take the rotation-aware math path. */\nexport const ROTATED_POSE_DESCRIPTOR: PoseDescriptor<RotatedPose> = {\n getBounds: RECT_POSE_DESCRIPTOR.getBounds as PoseDescriptor<RotatedPose>['getBounds'],\n remapBounds: RECT_POSE_DESCRIPTOR.remapBounds as PoseDescriptor<RotatedPose>['remapBounds'],\n translate: RECT_POSE_DESCRIPTOR.translate as PoseDescriptor<RotatedPose>['translate'],\n lerp: RECT_POSE_DESCRIPTOR.lerp as PoseDescriptor<RotatedPose>['lerp'],\n fromBounds: (b) => ({ x: b.x, y: b.y, width: b.width, height: b.height, rotation: 0 }),\n getRotation: (p) => p.rotation,\n withRotation: (p, rotation) => ({ ...p, rotation }),\n};\n\n/**\n * Remap a **rotated** leaf inside a group resize.\n *\n * The naive `remapBounds` scales a leaf's axis-aligned `width`/`height` by the\n * group's per-axis factors and carries `rotation` through untouched. That is\n * right when `src`/`dst` are already expressed in the leaf's own frame — the\n * single-leaf resize path, where the drag delta was projected into that frame\n * before the anchor math ran. In a group resize they are world-frame, so the\n * leaf's local axes do not line up with the axes being scaled: at 90° a\n * horizontal stretch should grow the leaf's `height`, and the naive map grows\n * its `width`.\n *\n * What this computes is the group affine applied to the leaf's local frame,\n * with the shear dropped — the pose model is `{x, y, width, height, rotation}`\n * and cannot represent the parallelogram a non-uniform scale of a rotated box\n * actually produces. The center moves exactly; each local axis takes the\n * length of its own image; the rotation follows the image of the local x-axis.\n *\n * Degenerates to the naive map at `rotation === 0`, and to a plain uniform\n * scale when `sx === sy`, both exactly.\n */\nexport function remapRotatedLeaf<TPose extends RotatedPose>(\n pose: TPose,\n src: Bounds,\n dst: Bounds,\n): TPose {\n const sx = src.width === 0 ? 1 : dst.width / src.width;\n const sy = src.height === 0 ? 1 : dst.height / src.height;\n const theta = pose.rotation ?? 0;\n const cos = Math.cos(theta);\n const sin = Math.sin(theta);\n\n // Images of the leaf's local unit axes under the group's diagonal scale.\n const ux = sx * cos, uy = sy * sin;\n const vx = -sx * sin, vy = sy * cos;\n\n const width = pose.width * Math.hypot(ux, uy);\n const height = pose.height * Math.hypot(vx, vy);\n const rotation = Math.atan2(uy, ux);\n\n // The center is a point, so it takes the group affine directly.\n const cxNew = dst.x + (pose.x + pose.width / 2 - src.x) * sx;\n const cyNew = dst.y + (pose.y + pose.height / 2 - src.y) * sy;\n\n return {\n ...pose,\n x: cxNew - width / 2,\n y: cyNew - height / 2,\n width,\n height,\n rotation,\n };\n}\n\n/** The pose's visual bounds: its frame expanded to cover the rotated\n * rectangle, so a turned shape reports the extent of its ink. */\nexport function visualBoundsViaDescriptor<TPose>(\n pose: TPose,\n geometry: PoseDescriptor<TPose>,\n): Bounds {\n const b = geometry.getBounds(pose);\n const rotation =\n geometry.getRotation?.(pose) ?? (b as { rotation?: number }).rotation ?? 0;\n return axisAlignedBounds({ x: b.x, y: b.y, width: b.width, height: b.height, rotation });\n}\n\n/** Translate through `geometry.translate`, or via `remapBounds` onto a shifted\n * copy of the pose's own bounds when the descriptor has none. */\nexport function translatePoseViaDescriptor<TPose>(\n pose: TPose,\n dx: number,\n dy: number,\n geometry: PoseDescriptor<TPose>,\n): TPose {\n if (geometry.translate) return geometry.translate(pose, dx, dy);\n const src = geometry.getBounds(pose);\n const dst = { x: src.x + dx, y: src.y + dy, width: src.width, height: src.height };\n return geometry.remapBounds(pose, src, dst);\n}\n"],"mappings":"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"}
1
+ {"version":3,"file":"poseDescriptor.js","names":["poseDescriptorForNode","descriptor","node","RECT_POSE_DESCRIPTOR","p","sx","src","dst","sy","b","dx","dy","a","t","like","n","pose","d","rotation","at","ROTATED_POSE_DESCRIPTOR","remapRotatedLeaf","theta","cos","sin","ux","uy","vx","vy","width","height","cxNew","cyNew","visualBoundsViaDescriptor","axisAlignedBounds","framedBounds","geometry","transform","poseLinearOf","translatePoseViaDescriptor"],"sources":["../../../src/core/geometry/poseDescriptor.ts"],"sourcesContent":["import type { Bounds } from 'core/viewport/fitViewToBounds';\nimport { axisAlignedBounds } from 'core/geometry/unionBounds';\nimport { poseLinearOf } from '@weasel-js/geom';\nimport type { TargetAxes } from '@weasel-js/animator';\n\n/** `Bounds` with a required rotation angle (radians). Pivot is the AABB\n * center of the unrotated `{x, y, width, height}`. */\nexport interface RotatedPose extends Bounds {\n rotation: number;\n}\n\n/**\n * Bridges arbitrary `TPose` shapes into the kit's bounds-driven math: bounds\n * are read via `getBounds`, and `remapBounds` projects a result back into\n * TPose.\n *\n * `remapBounds(pose, src, dst)` subsumes both \"set my own AABB to dst\"\n * (single-leaf resize) and \"scale me as a leaf inside parent's src→dst rect\"\n * (group resize) — they're the same affine map.\n */\nexport interface PoseDescriptor<TPose, TNode = unknown> {\n getBounds(pose: TPose): Bounds;\n remapBounds(pose: TPose, src: Bounds, dst: Bounds): TPose;\n /** A pose occupying `bounds`, of the same kind as `template`. Unlike\n * `remapBounds`, the result carries none of the template's shape. */\n fromBounds(bounds: Bounds, template: TPose): TPose;\n /** Translate the pose by (dx, dy). Optional — when omitted, callers fall\n * back to a translation derived from `remapBounds` (origin shifted, no\n * scale). Path-shaped poses should provide this for performance. */\n translate?(pose: TPose, dx: number, dy: number): TPose;\n /** Interpolate between two poses. Optional — animation helpers fall back to\n * rect-shape lerp when omitted (which fails for non-rect poses). */\n lerp?(a: TPose, b: TPose, t: number): TPose;\n /** How a pose of `like`'s kind maps to the flat numbers an animation moves, and which of them\n * are angles. `from` keeps the fields of `like` that are not axes. Null for a pose this\n * descriptor cannot map; absent, a pose animates by its flat numeric fields. */\n axes?(like: TPose): TargetAxes<TPose> | null;\n /** Read the pose's rotation in radians. Pivot is the AABB center\n * (`getBounds(pose)` center). Default 0 when omitted. */\n getRotation?(pose: TPose): number;\n /** True iff this pose shape can carry a rotation; the rotation affordance\n * hides when it is `false`. When omitted, the kit assumes `true`, so a\n * descriptor whose poses cannot rotate (e.g. polygon Paths) should\n * return `false`. */\n supportsRotation?(pose: TPose): boolean;\n /** Write a rotation (radians) into the pose, bounds unchanged. Absent means\n * the pose cannot carry one, and the rotate action leaves it alone. */\n withRotation?(pose: TPose, rotation: number): TPose;\n /**\n * A descriptor specialized to one node. Every other method here sees only\n * the pose, so shapes sharing a pose type are indistinguishable to them.\n * Implement this to read `node.data` once and hand back a descriptor that\n * knows which shape it is describing. Callers reach it through\n * {@link poseDescriptorForNode}; sites with only an id keep using the\n * unspecialized descriptor.\n */\n forNode?(node: TNode): PoseDescriptor<TPose, TNode>;\n}\n\n/** The descriptor `node` should be read through: its own specialization when\n * it declares one, and otherwise the descriptor unchanged. */\nexport function poseDescriptorForNode<TPose, TNode>(\n descriptor: PoseDescriptor<TPose, TNode>,\n node: TNode,\n): PoseDescriptor<TPose, TNode> {\n return descriptor.forNode?.(node) ?? descriptor;\n}\n\n/** Identity geometry for `TPose extends Bounds`. Treats the pose as its\n * own bounds and remaps via affine scale against `src`/`dst`. */\nexport const RECT_POSE_DESCRIPTOR: PoseDescriptor<Bounds> = {\n getBounds: (p) => p,\n remapBounds: (p, src, dst) => {\n const sx = src.width === 0 ? 1 : dst.width / src.width;\n const sy = src.height === 0 ? 1 : dst.height / src.height;\n return {\n ...p,\n x: dst.x + (p.x - src.x) * sx,\n y: dst.y + (p.y - src.y) * sy,\n width: p.width * sx,\n height: p.height * sy,\n };\n },\n fromBounds: (b) => ({ x: b.x, y: b.y, width: b.width, height: b.height }),\n translate: (p, dx, dy) => ({ ...p, x: p.x + dx, y: p.y + dy }),\n lerp: (a, b, t) => ({\n ...a,\n x: a.x + (b.x - a.x) * t,\n y: a.y + (b.y - a.y) * t,\n width: a.width + (b.width - a.width) * t,\n height: a.height + (b.height - a.height) * t,\n }),\n axes: (like) => {\n const flat = [like.x, like.y, like.width, like.height];\n if (!flat.every((n) => typeof n === 'number')) return null;\n return {\n count: 5,\n names: ['x', 'y', 'width', 'height', 'rotation'],\n angles: [4],\n to: (p) => [p.x, p.y, p.width, p.height, p.rotation ?? 0],\n from: (a) => {\n const pose = { ...like, x: a[0]!, y: a[1]!, width: a[2]!, height: a[3]! };\n if (like.rotation !== undefined || a[4] !== 0) pose.rotation = a[4]!;\n return pose;\n },\n add: (p, d) => {\n const pose = { ...p, x: p.x + d[0]!, y: p.y + d[1]!, width: p.width + d[2]!, height: p.height + d[3]! };\n const rotation = (p.rotation ?? 0) + d[4]!;\n if (p.rotation !== undefined || rotation !== 0) pose.rotation = rotation;\n return pose;\n },\n write: (p, out, at) => {\n out[at] = p.x;\n out[at + 1] = p.y;\n out[at + 2] = p.width;\n out[at + 3] = p.height;\n out[at + 4] = p.rotation ?? 0;\n },\n };\n },\n // `withRotation` writes into `Bounds`' optional `rotation`, so this reads\n // the same channel, or a pose reports itself unrotated while painting rotated.\n getRotation: (p) => p.rotation ?? 0,\n withRotation: (p, rotation) => ({ ...p, rotation }),\n};\n\n/** Identity geometry for `RotatedPose`: `RECT_POSE_DESCRIPTOR`'s projection,\n * with a required `rotation`. */\nexport const ROTATED_POSE_DESCRIPTOR: PoseDescriptor<RotatedPose> = {\n getBounds: RECT_POSE_DESCRIPTOR.getBounds as PoseDescriptor<RotatedPose>['getBounds'],\n remapBounds: RECT_POSE_DESCRIPTOR.remapBounds as PoseDescriptor<RotatedPose>['remapBounds'],\n translate: RECT_POSE_DESCRIPTOR.translate as PoseDescriptor<RotatedPose>['translate'],\n lerp: RECT_POSE_DESCRIPTOR.lerp as PoseDescriptor<RotatedPose>['lerp'],\n axes: RECT_POSE_DESCRIPTOR.axes as PoseDescriptor<RotatedPose>['axes'],\n fromBounds: (b) => ({ x: b.x, y: b.y, width: b.width, height: b.height, rotation: 0 }),\n getRotation: (p) => p.rotation,\n withRotation: (p, rotation) => ({ ...p, rotation }),\n};\n\n/**\n * Remap a **rotated** leaf inside a group resize.\n *\n * The naive `remapBounds` scales a leaf's axis-aligned `width`/`height` by the\n * group's per-axis factors and carries `rotation` through untouched. That is\n * right when `src`/`dst` are expressed in the leaf's own frame. In a group\n * resize they are world-frame: at 90° a horizontal stretch should grow the\n * leaf's `height`, and the naive map grows its `width`.\n *\n * What this computes is the group affine applied to the leaf's local frame,\n * with the shear dropped — the pose model cannot represent the parallelogram\n * a non-uniform scale of a rotated box produces. The center moves exactly;\n * each local axis takes the length of its own image; the rotation follows the\n * image of the local x-axis.\n */\nexport function remapRotatedLeaf<TPose extends RotatedPose>(\n pose: TPose,\n src: Bounds,\n dst: Bounds,\n): TPose {\n const sx = src.width === 0 ? 1 : dst.width / src.width;\n const sy = src.height === 0 ? 1 : dst.height / src.height;\n const theta = pose.rotation ?? 0;\n const cos = Math.cos(theta);\n const sin = Math.sin(theta);\n\n // Images of the leaf's local unit axes under the group's diagonal scale.\n const ux = sx * cos, uy = sy * sin;\n const vx = -sx * sin, vy = sy * cos;\n\n const width = pose.width * Math.hypot(ux, uy);\n const height = pose.height * Math.hypot(vx, vy);\n const rotation = Math.atan2(uy, ux);\n\n // The center is a point, so it takes the group affine directly.\n const cxNew = dst.x + (pose.x + pose.width / 2 - src.x) * sx;\n const cyNew = dst.y + (pose.y + pose.height / 2 - src.y) * sy;\n\n return {\n ...pose,\n x: cxNew - width / 2,\n y: cyNew - height / 2,\n width,\n height,\n rotation,\n };\n}\n\n/** The pose's visual bounds: its box expanded to cover the box as drawn\n * under its rotation and `transform`, so a turned or skewed shape reports\n * the extent of its ink. */\nexport function visualBoundsViaDescriptor<TPose>(\n pose: TPose,\n geometry: PoseDescriptor<TPose>,\n): Bounds {\n return axisAlignedBounds(framedBounds(pose, geometry));\n}\n\n/** The pose's box with the rotation and `transform` it is drawn in: what\n * `poseFrameOf` reads, for a pose only its descriptor can read. */\nexport function framedBounds<TPose>(pose: TPose, geometry: PoseDescriptor<TPose>): Bounds {\n const b = geometry.getBounds(pose);\n const rotation = geometry.getRotation?.(pose) ?? b.rotation ?? 0;\n const transform = poseLinearOf(pose) ?? poseLinearOf(b);\n if (!rotation && !transform) return b;\n return { ...b, ...(rotation ? { rotation } : {}), ...(transform ? { transform } : {}) };\n}\n\n/** Translate through `geometry.translate`, or via `remapBounds` onto a shifted\n * copy of the pose's own bounds when the descriptor has none. */\nexport function translatePoseViaDescriptor<TPose>(\n pose: TPose,\n dx: number,\n dy: number,\n geometry: PoseDescriptor<TPose>,\n): TPose {\n if (geometry.translate) return geometry.translate(pose, dx, dy);\n const src = geometry.getBounds(pose);\n const dst = { x: src.x + dx, y: src.y + dy, width: src.width, height: src.height };\n return geometry.remapBounds(pose, src, dst);\n}\n"],"mappings":"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"}
@@ -1,7 +1,6 @@
1
1
  import { nodeMemo as e } from "../scene/nodeMemo.js";
2
- import { poseRotationOf as t, rotatePathAround as n } from "./poseRotation.js";
3
- import { visualBoundsViaDescriptor as r } from "./poseDescriptor.js";
4
- import { boxContainsBox as i, pointInPolygon as a, polygonContainsPath as o, polygonIntersectsPath as s } from "@weasel-js/geom";
2
+ import { visualBoundsViaDescriptor as t } from "./poseDescriptor.js";
3
+ import { boxContainsBox as n, pathThroughPoseFrame as r, pointInPolygon as i, polygonContainsPath as a, polygonIntersectsPath as o, poseFrameOf as s } from "@weasel-js/geom";
5
4
  //#region src/core/geometry/regionHit.ts
6
5
  function c(e) {
7
6
  let { x: t, y: n, width: r, height: i } = e;
@@ -51,50 +50,48 @@ function u(e) {
51
50
  function d(e) {
52
51
  return typeof e == "object" && !!e && e.kind === "polygon";
53
52
  }
54
- function f(t, n, i) {
55
- return d(n) ? e(t, "aabb", n, () => i.getBounds(n)) : r(n, i);
53
+ function f(n, r, i) {
54
+ return d(r) ? e(n, "aabb", r, () => i.getBounds(r)) : t(r, i);
56
55
  }
57
- function p(e, r) {
58
- let i = t(e);
59
- if (i) {
56
+ function p(e, t) {
57
+ if (s(e)) {
60
58
  let t = e;
61
- return n({
59
+ return r({
62
60
  kind: "rect",
63
61
  x: t.x,
64
62
  y: t.y,
65
63
  width: t.width,
66
64
  height: t.height
67
- }, i.cx, i.cy, i.rotation);
65
+ }, e);
68
66
  }
69
67
  return {
70
68
  kind: "rect",
71
- x: r.x,
72
- y: r.y,
73
- width: r.width,
74
- height: r.height
69
+ x: t.x,
70
+ y: t.y,
71
+ width: t.width,
72
+ height: t.height
75
73
  };
76
74
  }
77
- function m(e, t, n, r, c) {
78
- if (!Number.isFinite(r.x) || !Number.isFinite(r.y) || !Number.isFinite(r.width) || !Number.isFinite(r.height)) return !1;
79
- let l = e.bounds;
80
- if (r.x >= l.x + l.width || r.x + r.width <= l.x || r.y >= l.y + l.height || r.y + r.height <= l.y) return !1;
81
- if (t === "centers") return a(e.coords, r.x + r.width / 2, r.y + r.height / 2);
82
- let u = i([
83
- l.x,
84
- l.y,
85
- l.x + l.width,
86
- l.y + l.height
75
+ function m(e, t, r, s, c, l = () => !0) {
76
+ if (!Number.isFinite(s.x) || !Number.isFinite(s.y) || !Number.isFinite(s.width) || !Number.isFinite(s.height)) return !1;
77
+ let u = e.bounds;
78
+ if (s.x >= u.x + u.width || s.x + s.width <= u.x || s.y >= u.y + u.height || s.y + s.height <= u.y) return !1;
79
+ if (t === "centers") return i(e.coords, s.x + s.width / 2, s.y + s.height / 2);
80
+ let f = n([
81
+ u.x,
82
+ u.y,
83
+ u.x + u.width,
84
+ u.y + u.height
87
85
  ], [
88
- r.x,
89
- r.y,
90
- r.x + r.width,
91
- r.y + r.height
92
- ]), f = d(n);
93
- if (t === "enclosed") return u ? o(e.verts, f ? n : c()) : !1;
94
- if (e.isRect && u) return !0;
95
- if (f) return s(e.verts, n);
96
- let p = c();
97
- return p.kind === "rect" && e.isRect ? !0 : s(e.verts, p);
86
+ s.x,
87
+ s.y,
88
+ s.x + s.width,
89
+ s.y + s.height
90
+ ]), p = d(r);
91
+ if (t === "enclosed") return f ? a(e.verts, p ? r : c()) : !1;
92
+ if (e.isRect && f) return !0;
93
+ let m = p ? r : c();
94
+ return l() ? m.kind === "rect" && e.isRect ? !0 : o(e.verts, m) : o(e.verts, m, { filled: !1 });
98
95
  }
99
96
  //#endregion
100
97
  export { d as isSilhouettePose, u as polygonRegion, p as poseOutline, c as rectRegion, f as regionBoundsOf, l as regionOf, m as regionTakes };