@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":"createDebugOverlayLayer.js","names":["rectPath","FPS_WINDOW","createDebugOverlayLayer","fpsHistory","config","buildDebugOverlayCommands","sink","view","dims","theme","DEFAULT_DEBUG_THEME","strokes","DEFAULT_DEBUG_STROKES","s","snapshot","t","viewToTransform","out","emitViewport","emitHitboxes","emitBounds","emitHandles","emitOrigins","emitSnap","emitIds","emitLayersPanel","emitFramePanel","frameTimes","approxCircleScreen","approxEllipseScreen","cx","cy","r","segments","cmds","coords","PATH_M","rx","i","PATH_L","theta","ry","PATH_Z","rotatedRectScreen","x","y","w","rotatePoint","sx","sy","worldToScreen","rectPath$1","h","strokeOf","fill","stroke","path","sw","sh","pts","p","commands","b","horiz","vert","o","color","c","cmd","textCommandFromRuns","lines","l","maxW","line","boxW","boxH","MONO","MONO_CHAR_W","LINE_H","emitTextPanel","maxLen","bg","fixed","v","decimals","width","span","history","interval","rows","frame","labelW","label","count","value","unit","rec","fx","fy","from","ax0","ay0","ax1","ay1","segment","signed","to","x0","y0","x1","y1"],"sources":["../../src/debug/createDebugOverlayLayer.ts"],"sourcesContent":["import type { DrawCommand, PathDrawCommand } from '../renderer';\nimport type { Dims, RenderLayer } from 'core/layers/render';\nimport type { View } from 'core/viewport/view';\nimport { viewToTransform } from 'core/viewport/view';\nimport { worldToScreen } from 'core/viewport/viewTransform';\nimport { rotatePoint } from 'interactions/actions/rotate/geometry';\nimport { PATH_L, PATH_M, PATH_Z, type PolygonPath } from '@weasel-js/geom';\nimport { textCommandFromRuns } from 'features/text/textCommand';\nimport type {\n DebugConfig,\n DebugSnapshot,\n DebugStroke,\n DebugStrokes,\n DebugTheme,\n FrameStats,\n RecordedViewport,\n} from './types';\nimport { DEFAULT_DEBUG_STROKES, DEFAULT_DEBUG_THEME } from './defaultTheme';\n\n/** @internal */\ninterface CreateDebugOverlayLayerOpts {\n sink: { snapshot(): DebugSnapshot };\n config: DebugConfig;\n}\n\nconst FPS_WINDOW = 60;\n\n/**\n * Screen-space `RenderLayer` that paints the sink's snapshot. Appended at\n * the top of the Canvas's layer stack when `debug` is enabled. World-space\n * coords in the snapshot are projected through `view` here, since the\n * layer itself runs at identity transform.\n */\nexport function createDebugOverlayLayer({\n sink,\n config,\n}: CreateDebugOverlayLayerOpts): RenderLayer<unknown> {\n // Timestamps of the last FPS_WINDOW draws; survives across draws within\n // one Canvas mount.\n const fpsHistory: number[] = [];\n return {\n id: 'debug-overlay',\n label: 'Debug overlay',\n space: 'screen',\n alwaysOn: true,\n draw: (_data, view, dims) => {\n if (config.fps) {\n fpsHistory.push(typeof performance !== 'undefined' ? performance.now() : Date.now());\n if (fpsHistory.length > FPS_WINDOW) fpsHistory.shift();\n } else if (fpsHistory.length > 0) {\n fpsHistory.length = 0;\n }\n return buildDebugOverlayCommands(sink.snapshot(), config, view, dims, fpsHistory);\n },\n };\n}\n\n/**\n * The debug overlay's draw commands for one snapshot, in screen space (CSS\n * pixels of a `dims`-sized canvas looking through `view`). What the overlay\n * layer paints each frame, and what `renderDebugSnapshot` rasterizes.\n *\n * `frameTimes` are `performance.now()` stamps of recent paints, oldest first;\n * the frame panel derives its rate from them and shows none without two.\n */\nexport function buildDebugOverlayCommands(\n snapshot: DebugSnapshot,\n config: DebugConfig,\n view: View,\n dims: Dims,\n frameTimes: readonly number[] = [],\n): DrawCommand[] {\n const theme: DebugTheme = { ...DEFAULT_DEBUG_THEME, ...(config.theme ?? {}) };\n const strokes: DebugStrokes = { ...DEFAULT_DEBUG_STROKES, ...(config.strokes ?? {}) };\n const s = snapshot;\n const t = viewToTransform(view);\n const out: DrawCommand[] = [];\n\n if (config.viewport && s.viewport) emitViewport(out, s.viewport, view, dims, theme, strokes);\n if (config.hitboxes) emitHitboxes(out, s, view, t, theme, strokes);\n if (config.bounds) emitBounds(out, s, view, t, theme, strokes);\n if (config.handles) emitHandles(out, s, t, theme, strokes);\n if (config.origins) emitOrigins(out, s, t, theme);\n if (config.snap) emitSnap(out, s, t, theme, strokes);\n if (config.ids) emitIds(out, s, t, theme);\n if (config.layers) emitLayersPanel(out, s, dims, theme);\n if (config.fps) emitFramePanel(out, frameTimes, s.frame, theme);\n return out;\n}\n\n// --- emitters (screen-space) ---\n\nfunction approxCircleScreen(cx: number, cy: number, r: number, segments = 24): PolygonPath {\n return approxEllipseScreen(cx, cy, r, r, segments);\n}\n\nfunction approxEllipseScreen(cx: number, cy: number, rx: number, ry: number, segments = 24): PolygonPath {\n // Commands: M + (segments-1) L + Z. Coords: (segments) × 2 — pairs for\n // the moveTo and the (segments-1) lineTos. PATH_Z consumes no coords.\n const cmds = new Uint8Array(segments + 1);\n const coords = new Float32Array(segments * 2);\n cmds[0] = PATH_M;\n coords[0] = cx + rx;\n coords[1] = cy;\n for (let i = 1; i < segments; i++) {\n cmds[i] = PATH_L;\n const theta = (i / segments) * Math.PI * 2;\n coords[i * 2] = cx + rx * Math.cos(theta);\n coords[i * 2 + 1] = cy + ry * Math.sin(theta);\n }\n cmds[segments] = PATH_Z;\n return { kind: 'polygon', commands: cmds, coords, fillRule: 'nonzero' };\n}\n\n/** A world rect turned `rotation` about its center, as the screen quad it\n * lands on. */\nfunction rotatedRectScreen(\n r: { x: number; y: number; width: number; height: number; rotation: number },\n t: ReturnType<typeof viewToTransform>,\n): PolygonPath {\n const cx = r.x + r.width / 2, cy = r.y + r.height / 2;\n const coords = new Float32Array(8);\n const corners = [[r.x, r.y], [r.x + r.width, r.y], [r.x + r.width, r.y + r.height], [r.x, r.y + r.height]];\n corners.forEach(([x, y], i) => {\n const w = rotatePoint(x, y, cx, cy, r.rotation);\n const [sx, sy] = worldToScreen(w.x, w.y, t);\n coords[i * 2] = sx;\n coords[i * 2 + 1] = sy;\n });\n return {\n kind: 'polygon',\n commands: new Uint8Array([PATH_M, PATH_L, PATH_L, PATH_L, PATH_Z]),\n coords,\n fillRule: 'nonzero',\n };\n}\n\nfunction rectPath(x: number, y: number, w: number, h: number): { kind: 'rect'; x: number; y: number; width: number; height: number } {\n return { kind: 'rect', x, y, width: w, height: h };\n}\n\n/** A `DebugStroke` + color as the renderer's stroke shape. `dash` is dropped\n * when empty rather than passed through, so a solid line stays solid. */\nfunction strokeOf(s: DebugStroke, color: string) {\n return {\n paint: { fill: 'solid' as const, color },\n width: s.width,\n ...(s.dash && s.dash.length > 0 ? { dash: [...s.dash] } : {}),\n };\n}\n\nfunction emitHitboxes(\n out: DrawCommand[],\n s: DebugSnapshot,\n view: View,\n t: ReturnType<typeof viewToTransform>,\n theme: DebugTheme,\n strokes: DebugStrokes,\n): void {\n const fill = { fill: 'solid' as const, color: theme.hitboxFill };\n const stroke = strokeOf(strokes.hitbox, theme.hitboxStroke);\n for (const h of s.hitboxes) {\n if (h.shape.kind === 'rect' && h.shape.rotation) {\n const path = rotatedRectScreen({ ...h.shape, rotation: h.shape.rotation }, t);\n out.push({ kind: 'path', path, fill, stroke });\n } else if (h.shape.kind === 'rect') {\n const [sx, sy] = worldToScreen(h.shape.x, h.shape.y, t);\n const sw = h.shape.width * view.scale.x;\n const sh = h.shape.height * view.scale.y;\n out.push({ kind: 'path', path: rectPath(sx, sy, sw, sh), fill, stroke });\n } else if (h.shape.kind === 'circle') {\n const [cx, cy] = worldToScreen(h.shape.cx, h.shape.cy, t);\n const rx = h.shape.r * Math.abs(view.scale.x);\n const ry = h.shape.r * Math.abs(view.scale.y);\n out.push({ kind: 'path', path: approxEllipseScreen(cx, cy, rx, ry), fill, stroke });\n } else if (h.shape.kind === 'polygon' && h.shape.points.length > 2) {\n const pts = h.shape.points;\n const coords = new Float32Array(pts.length * 2);\n pts.forEach((p, i) => {\n const [sx, sy] = worldToScreen(p.x, p.y, t);\n coords[i * 2] = sx;\n coords[i * 2 + 1] = sy;\n });\n const commands = new Uint8Array(pts.length + 1).fill(PATH_L);\n commands[0] = PATH_M;\n commands[pts.length] = PATH_Z;\n out.push({ kind: 'path', path: { kind: 'polygon', commands, coords, fillRule: 'nonzero' }, fill, stroke });\n }\n // 'path' kind: v1 punt — matches 2D behavior.\n }\n}\n\nfunction emitBounds(\n out: DrawCommand[],\n s: DebugSnapshot,\n view: View,\n t: ReturnType<typeof viewToTransform>,\n theme: DebugTheme,\n strokes: DebugStrokes,\n): void {\n const stroke = strokeOf(strokes.bounds, theme.bounds);\n for (const b of s.bounds) {\n const [sx, sy] = worldToScreen(b.bounds.x, b.bounds.y, t);\n const sw = b.bounds.width * view.scale.x;\n const sh = b.bounds.height * view.scale.y;\n out.push({ kind: 'path', path: rectPath(sx, sy, sw, sh), stroke });\n }\n}\n\nfunction emitHandles(\n out: DrawCommand[],\n s: DebugSnapshot,\n t: ReturnType<typeof viewToTransform>,\n theme: DebugTheme,\n strokes: DebugStrokes,\n): void {\n const stroke = strokeOf(strokes.handle, theme.handle);\n for (const h of s.handles) {\n const [cx, cy] = worldToScreen(h.position.x, h.position.y, t);\n const horiz: PolygonPath = {\n kind: 'polygon',\n commands: new Uint8Array([PATH_M, PATH_L]),\n coords: new Float32Array([cx - 4, cy, cx + 4, cy]),\n fillRule: 'nonzero',\n };\n const vert: PolygonPath = {\n kind: 'polygon',\n commands: new Uint8Array([PATH_M, PATH_L]),\n coords: new Float32Array([cx, cy - 4, cx, cy + 4]),\n fillRule: 'nonzero',\n };\n out.push({ kind: 'path', path: horiz, stroke });\n out.push({ kind: 'path', path: vert, stroke });\n }\n}\n\nfunction emitOrigins(\n out: DrawCommand[],\n s: DebugSnapshot,\n t: ReturnType<typeof viewToTransform>,\n theme: DebugTheme,\n): void {\n const fill = { fill: 'solid' as const, color: theme.origin };\n for (const o of s.origins) {\n const [cx, cy] = worldToScreen(o.point.x, o.point.y, t);\n out.push({ kind: 'path', path: approxCircleScreen(cx, cy, 3), fill });\n }\n}\n\nfunction emitSnap(\n out: DrawCommand[],\n s: DebugSnapshot,\n t: ReturnType<typeof viewToTransform>,\n theme: DebugTheme,\n strokes: DebugStrokes,\n): void {\n const color = theme.snap;\n for (const c of s.snap) {\n const [cx, cy] = worldToScreen(c.point.x, c.point.y, t);\n const cmd: PathDrawCommand = {\n kind: 'path',\n path: approxCircleScreen(cx, cy, 4),\n ...(c.accepted\n ? { fill: { fill: 'solid' as const, color } }\n : { stroke: strokeOf(strokes.snap, color) }),\n };\n out.push(cmd);\n }\n}\n\nfunction emitIds(\n out: DrawCommand[],\n s: DebugSnapshot,\n t: ReturnType<typeof viewToTransform>,\n theme: DebugTheme,\n): void {\n // Pulls from the bounds stream — every consumer that records bounds\n // (selection overlay's handle math, the kit's per-node debug shim) gets\n // an id label for free.\n for (const b of s.bounds) {\n const [sx, sy] = worldToScreen(b.bounds.x, b.bounds.y, t);\n out.push(textCommandFromRuns(\n sx + 2,\n sy + 11,\n [{ text: b.id, fill: { fill: 'solid', color: theme.idText } }],\n { fontFamily: 'ui-monospace, Menlo, monospace', fontSize: 10 },\n ));\n }\n}\n\nfunction emitLayersPanel(\n out: DrawCommand[],\n s: DebugSnapshot,\n dims: Dims,\n theme: DebugTheme,\n): void {\n if (s.layers.length === 0) return;\n const lineH = 14;\n const padX = 6;\n const padY = 4;\n const lines = s.layers.map((l) => `[${l.index}] ${l.id} (${l.space})`);\n // Approximate width: 11px font, monospaced — assume each glyph ≈6.6px.\n // 2D path uses ctx.measureText; we don't have a ctx here, so fall back\n // to a character-count estimate. Pixel-level accuracy is not load-bearing\n // for a debug panel; right-edge anchoring stays correct.\n const charW = 6.6;\n let maxW = 0;\n for (const line of lines) maxW = Math.max(maxW, line.length * charW);\n const boxW = maxW + padX * 2;\n const boxH = lines.length * lineH + padY * 2;\n const x = dims.width - boxW - 8;\n const y = 8;\n out.push({\n kind: 'path',\n path: rectPath(x, y, boxW, boxH),\n fill: { fill: 'solid', color: theme.layerTextBg },\n });\n for (let i = 0; i < lines.length; i++) {\n out.push(textCommandFromRuns(\n x + padX,\n y + padY + i * lineH,\n [{ text: lines[i], fill: { fill: 'solid', color: theme.layerText } }],\n { fontFamily: 'ui-monospace, Menlo, monospace', fontSize: 11 },\n ));\n }\n}\n\nconst MONO = { fontFamily: 'ui-monospace, Menlo, monospace', fontSize: 11 };\nconst MONO_CHAR_W = 6.6;\nconst LINE_H = 14;\n\n/** A dark box holding monospace lines, at `(x, y)`; `y < 0` anchors its bottom\n * that far above `bottom`. Width is estimated from the character count — there\n * is no text measurer here, and a debug panel does not need one. */\nfunction emitTextPanel(\n out: DrawCommand[],\n lines: readonly string[],\n x: number,\n y: number,\n color: string,\n bg: string,\n): void {\n const padX = 6;\n const padY = 4;\n let maxLen = 0;\n for (const l of lines) maxLen = Math.max(maxLen, l.length);\n out.push({\n kind: 'path',\n path: rectPath(x, y, maxLen * MONO_CHAR_W + padX * 2, lines.length * LINE_H + padY * 2),\n fill: { fill: 'solid', color: bg },\n });\n for (let i = 0; i < lines.length; i++) {\n out.push(textCommandFromRuns(\n x + padX,\n y + padY + i * LINE_H,\n [{ text: lines[i], fill: { fill: 'solid', color } }],\n MONO,\n ));\n }\n}\n\n/** Fixed-width number, right-aligned, `decimals` places: `%{width}.{decimals}f`. */\nfunction fixed(v: number, width: number, decimals: number): string {\n return v.toFixed(decimals).padStart(width);\n}\n\nfunction emitFramePanel(\n out: DrawCommand[],\n history: readonly number[],\n frame: FrameStats | null,\n theme: DebugTheme,\n): void {\n const span = history.length >= 2 ? history[history.length - 1] - history[0] : 0;\n const interval = span > 0 ? span / (history.length - 1) : null;\n // Columns: label, draw-call count, value, unit — every row the same width,\n // so decimals line up down the panel.\n const rows: [label: string, count: number | null, value: number | null, unit: string][] = [\n ['fps', null, interval ? 1000 / interval : null, ' '],\n ['frame', null, interval, 'ms'],\n ];\n if (frame) {\n rows.push(['paint', frame.drawCalls, frame.paintMs, 'ms']);\n for (const l of frame.layers) rows.push([l.id, l.drawCalls, l.ms, 'ms']);\n }\n let labelW = 0;\n for (const [label] of rows) labelW = Math.max(labelW, label.length);\n const line = (label: string, count: string, value: string, unit: string) =>\n `${label.padEnd(labelW)} ${count.padStart(5)} ${value.padStart(7)} ${unit}`;\n const lines = rows.map(([label, count, value, unit]) =>\n line(label, count === null ? '' : String(count), value === null ? '—' : fixed(value, 7, 2), unit));\n if (frame) lines.splice(2, 0, line('', 'draws', 'cpu', ' '));\n emitTextPanel(out, lines, 8, 8, theme.fpsText, theme.fpsTextBg);\n}\n\nfunction emitViewport(\n out: DrawCommand[],\n rec: RecordedViewport,\n view: View,\n dims: Dims,\n theme: DebugTheme,\n strokes: DebugStrokes,\n): void {\n const t = viewToTransform(view);\n const stroke = strokeOf(strokes.viewport, theme.viewport);\n // Where the viewport the gesture started from sits in the current camera.\n const { from, to } = rec;\n const [fx, fy] = worldToScreen(from.x, from.y, t);\n out.push({\n kind: 'path',\n path: rectPath(fx, fy, (dims.width / from.scale.x) * view.scale.x, (dims.height / from.scale.y) * view.scale.y),\n stroke,\n });\n if (rec.anchor) {\n const [ax0, ay0] = worldToScreen(rec.anchor.x, rec.anchor.y, viewToTransform(from));\n const [ax1, ay1] = worldToScreen(rec.anchor.x, rec.anchor.y, t);\n out.push({ kind: 'path', path: approxCircleScreen(ax0, ay0, 2.5), fill: { fill: 'solid', color: theme.viewport } });\n if (Math.hypot(ax1 - ax0, ay1 - ay0) > 0.5) {\n out.push({ kind: 'path', path: segment(ax0, ay0, ax1, ay1), stroke });\n }\n out.push({ kind: 'path', path: approxCircleScreen(ax1, ay1, 6), stroke: strokeOf({ width: strokes.viewport.width }, theme.viewport) });\n }\n const text = rec.kind === 'pan'\n ? `pan Δ ${signed((from.x - to.x) * to.scale.x)} ${signed((from.y - to.y) * to.scale.y)} px`\n : `zoom ×${(to.scale.x / from.scale.x).toFixed(3)} ${from.scale.x.toFixed(3)} → ${to.scale.x.toFixed(3)}`;\n emitTextPanel(out, [text], 8, dims.height - LINE_H - 16, theme.viewport, theme.layerTextBg);\n}\n\nfunction signed(v: number): string {\n const r = Math.abs(v) < 0.05 ? 0 : v;\n return `${r >= 0 ? '+' : '-'}${Math.abs(r).toFixed(1)}`.padStart(8);\n}\n\nfunction segment(x0: number, y0: number, x1: number, y1: number): PolygonPath {\n return {\n kind: 'polygon',\n commands: new Uint8Array([PATH_M, PATH_L]),\n coords: new Float32Array([x0, y0, x1, y1]),\n fillRule: 'nonzero',\n };\n}\n"],"mappings":";;;;;;;AAyBA,IAAMC,IAAa;AAQnB,SAAgBC,EAAwB,EACtC,SACA,aACoD;CAGpD,IAAMC,IAAuB,CAAC;CAC9B,OAAO;EACL,IAAI;EACJ,OAAO;EACP,OAAO;EACP,UAAU;EACV,OAAO,GAAO,GAAM,OACdC,EAAO,OACTD,EAAW,KAAK,OAAO,cAAgB,MAAc,YAAY,IAAI,IAAI,KAAK,IAAI,CAAC,GAC/EA,EAAW,SAASF,KAAYE,EAAW,MAAM,KAC5CA,EAAW,SAAS,MAC7B,EAAW,SAAS,IAEfE,EAA0BC,EAAK,SAAS,GAAGF,GAAQG,GAAMC,GAAML,CAAU;CAEpF;AACF;AAUA,SAAgBE,EACd,GACA,GACA,GACA,GACA,IAAgC,CAAC,GAClB;CACf,IAAMI,IAAoB;EAAE,GAAGC;EAAqB,GAAIN,EAAO,SAAS,CAAC;CAAG,GACtEO,IAAwB;EAAE,GAAGC;EAAuB,GAAIR,EAAO,WAAW,CAAC;CAAG,GAC9ES,IAAIC,GACJC,IAAIC,EAAgBT,CAAI,GACxBU,IAAqB,CAAC;CAW5B,OATIb,EAAO,YAAYS,EAAE,YAAUK,EAAaD,GAAKJ,EAAE,UAAUN,GAAMC,GAAMC,GAAOE,CAAO,GACvFP,EAAO,YAAUe,EAAaF,GAAKJ,GAAGN,GAAMQ,GAAGN,GAAOE,CAAO,GAC7DP,EAAO,UAAQgB,EAAWH,GAAKJ,GAAGN,G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AK,IAAIO,EAAG,KAAKA,EAAG,MAAM,CAAC,EAAE,GAAGD,GAAQN,EAAK,IAAIO,EAAG,KAAKA,EAAG,MAAM,CAAC,EAAE,OACxF,WAAWA,EAAG,MAAM,IAAIP,EAAK,MAAM,EAAA,CAAG,QAAQ,CAAC,EAAE,IAAIA,EAAK,MAAM,EAAE,QAAQ,CAAC,EAAE,KAAKO,EAAG,MAAM,EAAE,QAAQ,CAAC,GAClF,GAAG,GAAGlG,EAAK,SAASsE,IAAS,IAAIrE,EAAM,UAAUA,EAAM,WAAW;AAC5F;AAEA,SAASgG,EAAO,GAAmB;CACjC,IAAMzE,IAAI,KAAK,IAAImD,CAAC,IAAI,MAAO,IAAIA;CACnC,OAAO,GAAGnD,KAAK,IAAI,MAAM,MAAM,KAAK,IAAIA,CAAC,CAAC,CAAC,QAAQ,CAAC,IAAI,SAAS,CAAC;AACpE;AAEA,SAASwE,EAAQ,GAAY,GAAY,GAAY,GAAyB;CAC5E,OAAO;EACL,MAAM;EACN,UAAU,IAAI,WAAW,CAACpE,GAAQG,CAAM,CAAC;EACzC,QAAQ,IAAI,aAAa;GAACoE;GAAIC;GAAIC;GAAIC;EAAE,CAAC;EACzC,UAAU;CACZ;AACF"}
1
+ {"version":3,"file":"createDebugOverlayLayer.js","names":["rectPath","DEBUG_OVERLAY_ID","FPS_WINDOW","createDebugOverlayLayer","fpsHistory","config","buildDebugOverlayCommands","sink","view","dims","theme","DEFAULT_DEBUG_THEME","strokes","DEFAULT_DEBUG_STROKES","s","snapshot","t","viewToTransform","out","emitViewport","emitHitboxes","emitBounds","emitHandles","emitOrigins","emitSnap","emitIds","emitLayersPanel","emitFramePanel","frameTimes","approxCircleScreen","approxEllipseScreen","cx","cy","r","segments","cmds","coords","PATH_M","rx","i","PATH_L","theta","ry","PATH_Z","rotatedRectScreen","x","y","w","rotatePoint","sx","sy","worldToScreen","rectPath$1","h","strokeOf","fill","stroke","path","sw","sh","pts","p","commands","b","horiz","vert","o","color","c","cmd","textCommandFromRuns","lines","l","maxW","line","boxW","boxH","MONO","MONO_CHAR_W","LINE_H","emitTextPanel","maxLen","bg","fixed","v","decimals","width","span","history","interval","rows","frame","labelW","label","count","value","unit","rec","fx","fy","from","ax0","ay0","ax1","ay1","segment","signed","to","x0","y0","x1","y1"],"sources":["../../src/debug/createDebugOverlayLayer.ts"],"sourcesContent":["import type { DrawCommand, PathDrawCommand } from '@weasel-js/renderer';\nimport type { Dims, RenderLayer } from 'core/layers/render';\nimport type { View } from 'core/viewport/view';\nimport { viewToTransform } from 'core/viewport/view';\nimport { worldToScreen } from 'core/viewport/viewTransform';\nimport { rotatePoint } from 'interactions/actions/rotate/geometry';\nimport { PATH_L, PATH_M, PATH_Z, type PolygonPath } from '@weasel-js/geom';\nimport { textCommandFromRuns } from '@weasel-js/renderer';\nimport type {\n DebugConfig,\n DebugSnapshot,\n DebugStroke,\n DebugStrokes,\n DebugTheme,\n FrameStats,\n RecordedViewport,\n} from './types';\nimport { DEFAULT_DEBUG_STROKES, DEFAULT_DEBUG_THEME } from './defaultTheme';\n\n/** What `createDebugOverlayLayer` paints from: a sink to snapshot and the features to draw. */\nexport interface CreateDebugOverlayLayerOpts {\n sink: { snapshot(): DebugSnapshot };\n config: DebugConfig;\n}\n\nexport const DEBUG_OVERLAY_ID = 'debug-overlay';\nconst FPS_WINDOW = 60;\n\n/**\n * Screen-space `RenderLayer` that paints the sink's snapshot. Appended at\n * the top of the Canvas's layer stack when `debug` is enabled. World-space\n * coords in the snapshot are projected through `view` here, since the\n * layer itself runs at identity transform.\n */\nexport function createDebugOverlayLayer({\n sink,\n config,\n}: CreateDebugOverlayLayerOpts): RenderLayer<unknown> {\n // Timestamps of the last FPS_WINDOW draws, kept for the life of the layer.\n const fpsHistory: number[] = [];\n return {\n id: DEBUG_OVERLAY_ID,\n label: 'Debug overlay',\n space: 'screen',\n alwaysOn: true,\n draw: (_data, view, dims) => {\n if (config.fps) {\n fpsHistory.push(typeof performance !== 'undefined' ? performance.now() : Date.now());\n if (fpsHistory.length > FPS_WINDOW) fpsHistory.shift();\n } else if (fpsHistory.length > 0) {\n fpsHistory.length = 0;\n }\n return buildDebugOverlayCommands(sink.snapshot(), config, view, dims, fpsHistory);\n },\n };\n}\n\n/**\n * The debug overlay's draw commands for one snapshot, in screen space (CSS\n * pixels of a `dims`-sized canvas looking through `view`). What the overlay\n * layer paints each frame, and what `renderDebugSnapshot` rasterizes.\n *\n * `frameTimes` are `performance.now()` stamps of recent paints, oldest first;\n * the frame panel derives its rate from them and shows none without two.\n */\nexport function buildDebugOverlayCommands(\n snapshot: DebugSnapshot,\n config: DebugConfig,\n view: View,\n dims: Dims,\n frameTimes: readonly number[] = [],\n): DrawCommand[] {\n const theme: DebugTheme = { ...DEFAULT_DEBUG_THEME, ...(config.theme ?? {}) };\n const strokes: DebugStrokes = { ...DEFAULT_DEBUG_STROKES, ...(config.strokes ?? {}) };\n const s = snapshot;\n const t = viewToTransform(view);\n const out: DrawCommand[] = [];\n\n if (config.viewport && s.viewport) emitViewport(out, s.viewport, view, dims, theme, strokes);\n if (config.hitboxes) emitHitboxes(out, s, view, t, theme, strokes);\n if (config.bounds) emitBounds(out, s, view, t, theme, strokes);\n if (config.handles) emitHandles(out, s, t, theme, strokes);\n if (config.origins) emitOrigins(out, s, t, theme);\n if (config.snap) emitSnap(out, s, t, theme, strokes);\n if (config.ids) emitIds(out, s, t, theme);\n if (config.layers) emitLayersPanel(out, s, dims, theme);\n if (config.fps) emitFramePanel(out, frameTimes, s.frame, theme);\n return out;\n}\n\n// --- emitters (screen-space) ---\n\nfunction approxCircleScreen(cx: number, cy: number, r: number, segments = 24): PolygonPath {\n return approxEllipseScreen(cx, cy, r, r, segments);\n}\n\nfunction approxEllipseScreen(cx: number, cy: number, rx: number, ry: number, segments = 24): PolygonPath {\n // Commands: M + (segments-1) L + Z. Coords: (segments) × 2 — pairs for\n // the moveTo and the (segments-1) lineTos. PATH_Z consumes no coords.\n const cmds = new Uint8Array(segments + 1);\n const coords = new Float32Array(segments * 2);\n cmds[0] = PATH_M;\n coords[0] = cx + rx;\n coords[1] = cy;\n for (let i = 1; i < segments; i++) {\n cmds[i] = PATH_L;\n const theta = (i / segments) * Math.PI * 2;\n coords[i * 2] = cx + rx * Math.cos(theta);\n coords[i * 2 + 1] = cy + ry * Math.sin(theta);\n }\n cmds[segments] = PATH_Z;\n return { kind: 'polygon', commands: cmds, coords, fillRule: 'nonzero' };\n}\n\n/** A world rect turned `rotation` about its center, as the screen quad it\n * lands on. */\nfunction rotatedRectScreen(\n r: { x: number; y: number; width: number; height: number; rotation: number },\n t: ReturnType<typeof viewToTransform>,\n): PolygonPath {\n const cx = r.x + r.width / 2, cy = r.y + r.height / 2;\n const coords = new Float32Array(8);\n const corners = [[r.x, r.y], [r.x + r.width, r.y], [r.x + r.width, r.y + r.height], [r.x, r.y + r.height]];\n corners.forEach(([x, y], i) => {\n const w = rotatePoint(x, y, cx, cy, r.rotation);\n const [sx, sy] = worldToScreen(w.x, w.y, t);\n coords[i * 2] = sx;\n coords[i * 2 + 1] = sy;\n });\n return {\n kind: 'polygon',\n commands: new Uint8Array([PATH_M, PATH_L, PATH_L, PATH_L, PATH_Z]),\n coords,\n fillRule: 'nonzero',\n };\n}\n\nfunction rectPath(x: number, y: number, w: number, h: number): { kind: 'rect'; x: number; y: number; width: number; height: number } {\n return { kind: 'rect', x, y, width: w, height: h };\n}\n\n/** A `DebugStroke` + color as the renderer's stroke shape. `dash` is dropped\n * when empty rather than passed through, so a solid line stays solid. */\nfunction strokeOf(s: DebugStroke, color: string) {\n return {\n paint: { kind: 'solid' as const, color },\n width: s.width,\n ...(s.dash && s.dash.length > 0 ? { dash: [...s.dash] } : {}),\n };\n}\n\nfunction emitHitboxes(\n out: DrawCommand[],\n s: DebugSnapshot,\n view: View,\n t: ReturnType<typeof viewToTransform>,\n theme: DebugTheme,\n strokes: DebugStrokes,\n): void {\n const fill = { kind: 'solid' as const, color: theme.hitboxFill };\n const stroke = strokeOf(strokes.hitbox, theme.hitboxStroke);\n for (const h of s.hitboxes) {\n if (h.shape.kind === 'rect' && h.shape.rotation) {\n const path = rotatedRectScreen({ ...h.shape, rotation: h.shape.rotation }, t);\n out.push({ kind: 'path', path, fill: { paint: fill }, stroke });\n } else if (h.shape.kind === 'rect') {\n const [sx, sy] = worldToScreen(h.shape.x, h.shape.y, t);\n const sw = h.shape.width * view.scale.x;\n const sh = h.shape.height * view.scale.y;\n out.push({ kind: 'path', path: rectPath(sx, sy, sw, sh), fill: { paint: fill }, stroke });\n } else if (h.shape.kind === 'circle') {\n const [cx, cy] = worldToScreen(h.shape.cx, h.shape.cy, t);\n const rx = h.shape.r * Math.abs(view.scale.x);\n const ry = h.shape.r * Math.abs(view.scale.y);\n out.push({ kind: 'path', path: approxEllipseScreen(cx, cy, rx, ry), fill: { paint: fill }, stroke });\n } else if (h.shape.kind === 'polygon' && h.shape.points.length > 2) {\n const pts = h.shape.points;\n const coords = new Float32Array(pts.length * 2);\n pts.forEach((p, i) => {\n const [sx, sy] = worldToScreen(p.x, p.y, t);\n coords[i * 2] = sx;\n coords[i * 2 + 1] = sy;\n });\n const commands = new Uint8Array(pts.length + 1).fill(PATH_L);\n commands[0] = PATH_M;\n commands[pts.length] = PATH_Z;\n out.push({ kind: 'path', path: { kind: 'polygon', commands, coords, fillRule: 'nonzero' }, fill: { paint: fill }, stroke });\n }\n // 'path' kind: v1 punt — matches 2D behavior.\n }\n}\n\nfunction emitBounds(\n out: DrawCommand[],\n s: DebugSnapshot,\n view: View,\n t: ReturnType<typeof viewToTransform>,\n theme: DebugTheme,\n strokes: DebugStrokes,\n): void {\n const stroke = strokeOf(strokes.bounds, theme.bounds);\n for (const b of s.bounds) {\n const [sx, sy] = worldToScreen(b.bounds.x, b.bounds.y, t);\n const sw = b.bounds.width * view.scale.x;\n const sh = b.bounds.height * view.scale.y;\n out.push({ kind: 'path', path: rectPath(sx, sy, sw, sh), stroke });\n }\n}\n\nfunction emitHandles(\n out: DrawCommand[],\n s: DebugSnapshot,\n t: ReturnType<typeof viewToTransform>,\n theme: DebugTheme,\n strokes: DebugStrokes,\n): void {\n const stroke = strokeOf(strokes.handle, theme.handle);\n for (const h of s.handles) {\n const [cx, cy] = worldToScreen(h.position.x, h.position.y, t);\n const horiz: PolygonPath = {\n kind: 'polygon',\n commands: new Uint8Array([PATH_M, PATH_L]),\n coords: new Float32Array([cx - 4, cy, cx + 4, cy]),\n fillRule: 'nonzero',\n };\n const vert: PolygonPath = {\n kind: 'polygon',\n commands: new Uint8Array([PATH_M, PATH_L]),\n coords: new Float32Array([cx, cy - 4, cx, cy + 4]),\n fillRule: 'nonzero',\n };\n out.push({ kind: 'path', path: horiz, stroke });\n out.push({ kind: 'path', path: vert, stroke });\n }\n}\n\nfunction emitOrigins(\n out: DrawCommand[],\n s: DebugSnapshot,\n t: ReturnType<typeof viewToTransform>,\n theme: DebugTheme,\n): void {\n const fill = { kind: 'solid' as const, color: theme.origin };\n for (const o of s.origins) {\n const [cx, cy] = worldToScreen(o.point.x, o.point.y, t);\n out.push({ kind: 'path', path: approxCircleScreen(cx, cy, 3), fill: { paint: fill } });\n }\n}\n\nfunction emitSnap(\n out: DrawCommand[],\n s: DebugSnapshot,\n t: ReturnType<typeof viewToTransform>,\n theme: DebugTheme,\n strokes: DebugStrokes,\n): void {\n const color = theme.snap;\n for (const c of s.snap) {\n const [cx, cy] = worldToScreen(c.point.x, c.point.y, t);\n const cmd: PathDrawCommand = {\n kind: 'path',\n path: approxCircleScreen(cx, cy, 4),\n ...(c.accepted\n ? { fill: { paint: { kind: 'solid' as const, color } } }\n : { stroke: strokeOf(strokes.snap, color) }),\n };\n out.push(cmd);\n }\n}\n\nfunction emitIds(\n out: DrawCommand[],\n s: DebugSnapshot,\n t: ReturnType<typeof viewToTransform>,\n theme: DebugTheme,\n): void {\n // Pulls from the bounds stream — every consumer that records bounds\n // (selection overlay's handle math, the kit's per-node debug shim) gets\n // an id label for free.\n for (const b of s.bounds) {\n const [sx, sy] = worldToScreen(b.bounds.x, b.bounds.y, t);\n out.push(textCommandFromRuns(\n sx + 2,\n sy + 11,\n [{ text: b.id, fill: { paint: { kind: 'solid', color: theme.idText } } }],\n { fontFamily: 'ui-monospace, Menlo, monospace', fontSize: 10 },\n ));\n }\n}\n\nfunction emitLayersPanel(\n out: DrawCommand[],\n s: DebugSnapshot,\n dims: Dims,\n theme: DebugTheme,\n): void {\n if (s.layers.length === 0) return;\n const lineH = 14;\n const padX = 6;\n const padY = 4;\n const lines = s.layers.map((l) => `[${l.index}] ${l.id} (${l.space})`);\n // Approximate width: 11px font, monospaced — assume each glyph ≈6.6px.\n // 2D path uses ctx.measureText; we don't have a ctx here, so fall back\n // to a character-count estimate. Pixel-level accuracy is not load-bearing\n // for a debug panel; right-edge anchoring stays correct.\n const charW = 6.6;\n let maxW = 0;\n for (const line of lines) maxW = Math.max(maxW, line.length * charW);\n const boxW = maxW + padX * 2;\n const boxH = lines.length * lineH + padY * 2;\n const x = dims.width - boxW - 8;\n const y = 8;\n out.push({\n kind: 'path',\n path: rectPath(x, y, boxW, boxH),\n fill: { paint: { kind: 'solid', color: theme.layerTextBg } },\n });\n for (let i = 0; i < lines.length; i++) {\n out.push(textCommandFromRuns(\n x + padX,\n y + padY + i * lineH,\n [{ text: lines[i], fill: { paint: { kind: 'solid', color: theme.layerText } } }],\n { fontFamily: 'ui-monospace, Menlo, monospace', fontSize: 11 },\n ));\n }\n}\n\nconst MONO = { fontFamily: 'ui-monospace, Menlo, monospace', fontSize: 11 };\nconst MONO_CHAR_W = 6.6;\nconst LINE_H = 14;\n\n/** A dark box holding monospace lines, at `(x, y)`; `y < 0` anchors its bottom\n * that far above `bottom`. Width is estimated from the character count — there\n * is no text measurer here, and a debug panel does not need one. */\nfunction emitTextPanel(\n out: DrawCommand[],\n lines: readonly string[],\n x: number,\n y: number,\n color: string,\n bg: string,\n): void {\n const padX = 6;\n const padY = 4;\n let maxLen = 0;\n for (const l of lines) maxLen = Math.max(maxLen, l.length);\n out.push({\n kind: 'path',\n path: rectPath(x, y, maxLen * MONO_CHAR_W + padX * 2, lines.length * LINE_H + padY * 2),\n fill: { paint: { kind: 'solid', color: bg } },\n });\n for (let i = 0; i < lines.length; i++) {\n out.push(textCommandFromRuns(\n x + padX,\n y + padY + i * LINE_H,\n [{ text: lines[i], fill: { paint: { kind: 'solid', color } } }],\n MONO,\n ));\n }\n}\n\n/** Fixed-width number, right-aligned, `decimals` places: `%{width}.{decimals}f`. */\nfunction fixed(v: number, width: number, decimals: number): string {\n return v.toFixed(decimals).padStart(width);\n}\n\nfunction emitFramePanel(\n out: DrawCommand[],\n history: readonly number[],\n frame: FrameStats | null,\n theme: DebugTheme,\n): void {\n const span = history.length >= 2 ? history[history.length - 1] - history[0] : 0;\n const interval = span > 0 ? span / (history.length - 1) : null;\n // Columns: label, draw-call count, value, unit — every row the same width,\n // so decimals line up down the panel.\n const rows: [label: string, count: number | null, value: number | null, unit: string][] = [\n ['fps', null, interval ? 1000 / interval : null, ' '],\n ['frame', null, interval, 'ms'],\n ];\n if (frame) {\n rows.push(['paint', frame.drawCalls, frame.paintMs, 'ms']);\n for (const l of frame.layers) rows.push([l.id, l.drawCalls, l.ms, 'ms']);\n }\n let labelW = 0;\n for (const [label] of rows) labelW = Math.max(labelW, label.length);\n const line = (label: string, count: string, value: string, unit: string) =>\n `${label.padEnd(labelW)} ${count.padStart(5)} ${value.padStart(7)} ${unit}`;\n const lines = rows.map(([label, count, value, unit]) =>\n line(label, count === null ? '' : String(count), value === null ? '—' : fixed(value, 7, 2), unit));\n if (frame) lines.splice(2, 0, line('', 'draws', 'cpu', ' '));\n emitTextPanel(out, lines, 8, 8, theme.fpsText, theme.fpsTextBg);\n}\n\nfunction emitViewport(\n out: DrawCommand[],\n rec: RecordedViewport,\n view: View,\n dims: Dims,\n theme: DebugTheme,\n strokes: DebugStrokes,\n): void {\n const t = viewToTransform(view);\n const stroke = strokeOf(strokes.viewport, theme.viewport);\n // Where the viewport the gesture started from sits in the current camera.\n const { from, to } = rec;\n const [fx, fy] = worldToScreen(from.x, from.y, t);\n out.push({\n kind: 'path',\n path: rectPath(fx, fy, (dims.width / from.scale.x) * view.scale.x, (dims.height / from.scale.y) * view.scale.y),\n stroke,\n });\n if (rec.anchor) {\n const [ax0, ay0] = worldToScreen(rec.anchor.x, rec.anchor.y, viewToTransform(from));\n const [ax1, ay1] = worldToScreen(rec.anchor.x, rec.anchor.y, t);\n out.push({ kind: 'path', path: approxCircleScreen(ax0, ay0, 2.5), fill: { paint: { kind: 'solid', color: theme.viewport } } });\n if (Math.hypot(ax1 - ax0, ay1 - ay0) > 0.5) {\n out.push({ kind: 'path', path: segment(ax0, ay0, ax1, ay1), stroke });\n }\n out.push({ kind: 'path', path: approxCircleScreen(ax1, ay1, 6), stroke: strokeOf({ width: strokes.viewport.width }, theme.viewport) });\n }\n const text = rec.kind === 'pan'\n ? `pan Δ ${signed((from.x - to.x) * to.scale.x)} ${signed((from.y - to.y) * to.scale.y)} px`\n : `zoom ×${(to.scale.x / from.scale.x).toFixed(3)} ${from.scale.x.toFixed(3)} → ${to.scale.x.toFixed(3)}`;\n emitTextPanel(out, [text], 8, dims.height - LINE_H - 16, theme.viewport, theme.layerTextBg);\n}\n\nfunction signed(v: number): string {\n const r = Math.abs(v) < 0.05 ? 0 : v;\n return `${r >= 0 ? '+' : '-'}${Math.abs(r).toFixed(1)}`.padStart(8);\n}\n\nfunction segment(x0: number, y0: number, x1: number, y1: number): PolygonPath {\n return {\n kind: 'polygon',\n commands: new Uint8Array([PATH_M, PATH_L]),\n coords: new Float32Array([x0, y0, x1, y1]),\n fillRule: 'nonzero',\n };\n}\n"],"mappings":";;;;;;;AAyBA,IAAaC,IAAmB,iBAC1BC,IAAa;AAQnB,SAAgBC,EAAwB,EACtC,SACA,aACoD;CAEpD,IAAMC,IAAuB,CAAC;CAC9B,OAAO;EACL,IAAIH;EACJ,OAAO;EACP,OAAO;EACP,UAAU;EACV,OAAO,GAAO,GAAM,OACdI,EAAO,OACT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ClF,GAAG,GAAGlG,EAAK,SAASsE,IAAS,IAAIrE,EAAM,UAAUA,EAAM,WAAW;AAC5F;AAEA,SAASgG,EAAO,GAAmB;CACjC,IAAMzE,IAAI,KAAK,IAAImD,CAAC,IAAI,MAAO,IAAIA;CACnC,OAAO,GAAGnD,KAAK,IAAI,MAAM,MAAM,KAAK,IAAIA,CAAC,CAAC,CAAC,QAAQ,CAAC,IAAI,SAAS,CAAC;AACpE;AAEA,SAASwE,EAAQ,GAAY,GAAY,GAAY,GAAyB;CAC5E,OAAO;EACL,MAAM;EACN,UAAU,IAAI,WAAW,CAACpE,GAAQG,CAAM,CAAC;EACzC,QAAQ,IAAI,aAAa;GAACoE;GAAIC;GAAIC;GAAIC;EAAE,CAAC;EACzC,UAAU;CACZ;AACF"}
@@ -1 +1 @@
1
- {"version":3,"file":"createDebugSink.js","names":["createDebugSink","snap","config","anchor","stats"],"sources":["../../src/debug/createDebugSink.ts"],"sourcesContent":["import type {\n CanvasDebugSink,\n DebugConfig,\n DebugSnapshot,\n HandleKind,\n HitShape,\n} from './types';\n\n/**\n * Build a sink that stores recorded primitives in arrays keyed by feature.\n * Each `recordX` method checks the matching flag in `config` first — when\n * the feature is off, the call no-ops, so callers can record unconditionally\n * without an extra check.\n *\n * `beginFrame()` clears every per-frame array. `clearSnap()` clears the snap\n * array. Snap, the latest viewport record and the last frame's stats survive\n * across frames.\n *\n * `snapshot()` returns live references — no copy. The overlay layer reads\n * these in the same render frame.\n */\nexport function createDebugSink(config: DebugConfig): CanvasDebugSink {\n const snap: DebugSnapshot = {\n hitboxes: [],\n handles: [],\n bounds: [],\n origins: [],\n snap: [],\n layers: [],\n viewport: null,\n frame: null,\n };\n return {\n recordHitbox(id, kind, shape: HitShape) {\n if (!config.hitboxes) return;\n snap.hitboxes.push({ id, kind, shape });\n },\n recordHandle(id, position, kind: HandleKind) {\n if (!config.handles) return;\n snap.handles.push({ id, position, kind });\n },\n recordBounds(id, bounds) {\n if (!config.bounds) return;\n snap.bounds.push({ id, bounds });\n },\n recordOrigin(id, point) {\n if (!config.origins) return;\n snap.origins.push({ id, point });\n },\n recordSnapCandidate(point, accepted) {\n if (!config.snap) return;\n snap.snap.push({ point, accepted });\n },\n recordLayer(id, label, space, index) {\n if (!config.layers) return;\n snap.layers.push({ id, label, space, index });\n },\n recordViewport(kind, from, to, anchor) {\n if (!config.viewport) return;\n snap.viewport = anchor ? { kind, from, to, anchor } : { kind, from, to };\n },\n recordFrame(stats) {\n if (!config.fps) return;\n snap.frame = stats;\n },\n beginFrame() {\n snap.hitboxes.length = 0;\n snap.handles.length = 0;\n snap.bounds.length = 0;\n snap.origins.length = 0;\n snap.layers.length = 0;\n },\n clearSnap() {\n snap.snap.length = 0;\n },\n snapshot() {\n return snap;\n },\n };\n}\n"],"mappings":";AAqBA,SAAgBA,EAAgB,GAAsC;CACpE,IAAMC,IAAsB;EAC1B,UAAU,CAAC;EACX,SAAS,CAAC;EACV,QAAQ,CAAC;EACT,SAAS,CAAC;EACV,MAAM,CAAC;EACP,QAAQ,CAAC;EACT,UAAU;EACV,OAAO;CACT;CACA,OAAO;EACL,aAAa,GAAI,GAAM,GAAiB;GACtC,AAAKC,EAAO,YACZD,EAAK,SAAS,KAAK;IAAE;IAAI;IAAM;GAAM,CAAC;EACxC;EACA,aAAa,GAAI,GAAU,GAAkB;GAC3C,AAAKC,EAAO,WACZD,EAAK,QAAQ,KAAK;IAAE;IAAI;IAAU;GAAK,CAAC;EAC1C;EACA,aAAa,GAAI,GAAQ;GACvB,AAAKC,EAAO,UACZD,EAAK,OAAO,KAAK;IAAE;IAAI;GAAO,CAAC;EACjC;EACA,aAAa,GAAI,GAAO;GACtB,AAAKC,EAAO,WACZD,EAAK,QAAQ,KAAK;IAAE;IAAI;GAAM,CAAC;EACjC;EACA,oBAAoB,GAAO,GAAU;GACnC,AAAKC,EAAO,QACZD,EAAK,KAAK,KAAK;IAAE;IAAO;GAAS,CAAC;EACpC;EACA,YAAY,GAAI,GAAO,GAAO,GAAO;GACnC,AAAKC,EAAO,UACZD,EAAK,OAAO,KAAK;IAAE;IAAI;IAAO;IAAO;GAAM,CAAC;EAC9C;EACA,eAAe,GAAM,GAAM,GAAI,GAAQ;GACrC,AAAKC,EAAO,aACZ,EAAK,WAAWC,IAAS;IAAE;IAAM;IAAM;IAAI;GAAO,IAAI;IAAE;IAAM;IAAM;GAAG;EACzE;EACA,YAAY,GAAO;GACjB,AAAKD,EAAO,QACZ,EAAK,QAAQE;EACf;EACA,aAAa;GAKX,AAJA,EAAK,SAAS,SAAS,GACvB,EAAK,QAAQ,SAAS,GACtB,EAAK,OAAO,SAAS,GACrB,EAAK,QAAQ,SAAS,GACtB,EAAK,OAAO,SAAS;EACvB;EACA,YAAY;GACV,EAAK,KAAK,SAAS;EACrB;EACA,WAAW;GACT,OAAOH;EACT;CACF;AACF"}
1
+ {"version":3,"file":"createDebugSink.js","names":["createDebugSink","snap","config","anchor","stats"],"sources":["../../src/debug/createDebugSink.ts"],"sourcesContent":["import type {\n CanvasDebugSink,\n DebugConfig,\n DebugSnapshot,\n HandleKind,\n HitShape,\n} from './types';\n\n/**\n * Build a sink that stores recorded primitives in arrays keyed by feature.\n * A `recordX` call no-ops when its flag in `config` is off, so callers can\n * record unconditionally.\n *\n * `beginFrame()` clears every per-frame array. Snap, the latest viewport\n * record, and the last frame's stats survive across frames. `snapshot()`\n * returns live references — no copy.\n */\nexport function createDebugSink(config: DebugConfig): CanvasDebugSink {\n const snap: DebugSnapshot = {\n hitboxes: [],\n handles: [],\n bounds: [],\n origins: [],\n snap: [],\n layers: [],\n viewport: null,\n frame: null,\n };\n return {\n recordHitbox(id, kind, shape: HitShape) {\n if (!config.hitboxes) return;\n snap.hitboxes.push({ id, kind, shape });\n },\n recordHandle(id, position, kind: HandleKind) {\n if (!config.handles) return;\n snap.handles.push({ id, position, kind });\n },\n recordBounds(id, bounds) {\n if (!config.bounds) return;\n snap.bounds.push({ id, bounds });\n },\n recordOrigin(id, point) {\n if (!config.origins) return;\n snap.origins.push({ id, point });\n },\n recordSnapCandidate(point, accepted) {\n if (!config.snap) return;\n snap.snap.push({ point, accepted });\n },\n recordLayer(id, label, space, index) {\n if (!config.layers) return;\n snap.layers.push({ id, label, space, index });\n },\n recordViewport(kind, from, to, anchor) {\n if (!config.viewport) return;\n snap.viewport = anchor ? { kind, from, to, anchor } : { kind, from, to };\n },\n recordFrame(stats) {\n if (!config.fps) return;\n snap.frame = stats;\n },\n beginFrame() {\n snap.hitboxes.length = 0;\n snap.handles.length = 0;\n snap.bounds.length = 0;\n snap.origins.length = 0;\n snap.layers.length = 0;\n },\n clearSnap() {\n snap.snap.length = 0;\n },\n snapshot() {\n return snap;\n },\n };\n}\n"],"mappings":";AAiBA,SAAgBA,EAAgB,GAAsC;CACpE,IAAMC,IAAsB;EAC1B,UAAU,CAAC;EACX,SAAS,CAAC;EACV,QAAQ,CAAC;EACT,SAAS,CAAC;EACV,MAAM,CAAC;EACP,QAAQ,CAAC;EACT,UAAU;EACV,OAAO;CACT;CACA,OAAO;EACL,aAAa,GAAI,GAAM,GAAiB;GACtC,AAAKC,EAAO,YACZD,EAAK,SAAS,KAAK;IAAE;IAAI;IAAM;GAAM,CAAC;EACxC;EACA,aAAa,GAAI,GAAU,GAAkB;GAC3C,AAAKC,EAAO,WACZD,EAAK,QAAQ,KAAK;IAAE;IAAI;IAAU;GAAK,CAAC;EAC1C;EACA,aAAa,GAAI,GAAQ;GACvB,AAAKC,EAAO,UACZD,EAAK,OAAO,KAAK;IAAE;IAAI;GAAO,CAAC;EACjC;EACA,aAAa,GAAI,GAAO;GACtB,AAAKC,EAAO,WACZD,EAAK,QAAQ,KAAK;IAAE;IAAI;GAAM,CAAC;EACjC;EACA,oBAAoB,GAAO,GAAU;GACnC,AAAKC,EAAO,QACZD,EAAK,KAAK,KAAK;IAAE;IAAO;GAAS,CAAC;EACpC;EACA,YAAY,GAAI,GAAO,GAAO,GAAO;GACnC,AAAKC,EAAO,UACZD,EAAK,OAAO,KAAK;IAAE;IAAI;IAAO;IAAO;GAAM,CAAC;EAC9C;EACA,eAAe,GAAM,GAAM,GAAI,GAAQ;GACrC,AAAKC,EAAO,aACZ,EAAK,WAAWC,IAAS;IAAE;IAAM;IAAM;IAAI;GAAO,IAAI;IAAE;IAAM;IAAM;GAAG;EACzE;EACA,YAAY,GAAO;GACjB,AAAKD,EAAO,QACZ,EAAK,QAAQE;EACf;EACA,aAAa;GAKX,AAJA,EAAK,SAAS,SAAS,GACvB,EAAK,QAAQ,SAAS,GACtB,EAAK,OAAO,SAAS,GACrB,EAAK,QAAQ,SAAS,GACtB,EAAK,OAAO,SAAS;EACvB;EACA,YAAY;GACV,EAAK,KAAK,SAAS;EACrB;EACA,WAAW;GACT,OAAOH;EACT;CACF;AACF"}
@@ -1,41 +1,2 @@
1
- //#region src/debug/flag.ts
2
- var e = ["weasel.debug", "weaseldraw.debug"], t = null;
3
- function n() {
4
- let t = {
5
- all: !1,
6
- set: /* @__PURE__ */ new Set()
7
- };
8
- if (typeof localStorage > "u") return t;
9
- try {
10
- for (let t of e) {
11
- let e = localStorage.getItem(t);
12
- if (e != null && e !== "") return e === "1" || e === "true" || e === "*" ? {
13
- all: !0,
14
- set: /* @__PURE__ */ new Set()
15
- } : {
16
- all: !1,
17
- set: new Set(e.split(/[\s,]+/).filter(Boolean))
18
- };
19
- }
20
- return t;
21
- } catch {
22
- return t;
23
- }
24
- }
25
- function r() {
26
- return t === null && (t = n()), t;
27
- }
28
- function i(e) {
29
- let t = r();
30
- return t.all ? !0 : e === void 0 ? t.set.size > 0 : t.set.has(e);
31
- }
32
- function a(e, ...t) {
33
- i(e) && console.debug(`[${e}]`, ...t);
34
- }
35
- function o(e, ...t) {
36
- i(e) && console.warn(`[${e}]`, ...t);
37
- }
38
- //#endregion
39
- export { a as dlog, o as dwarn, i as isDebugEnabled };
40
-
41
- //# sourceMappingURL=flag.js.map
1
+ import { dlog as e, dwarn as t, isDebugEnabled as n } from "@weasel-js/routing";
2
+ export { e as dlog, t as dwarn, n as isDebugEnabled };
@@ -1 +1 @@
1
- {"version":3,"file":"frameStats.js","names":["frameStatsOf","render","layers","l","i"],"sources":["../../src/debug/frameStats.ts"],"sourcesContent":["import type { LayerDrawSpan } from 'core/layers/render';\nimport type { RenderStats } from '../renderer/WeaselRenderer';\nimport type { FrameStats } from './types';\n\n/** One paint's {@link FrameStats}: each layer's build time from `drawLayers`\n * joined with its dispatch cost from the renderer, span for span. */\nexport function frameStatsOf(layers: readonly LayerDrawSpan[], render: RenderStats, paintMs: number): FrameStats {\n return {\n paintMs,\n drawCalls: render.drawCalls,\n layers: layers.map((l, i) => ({\n id: l.id,\n drawCalls: render.spans[i]?.drawCalls ?? 0,\n ms: l.buildMs + (render.spans[i]?.ms ?? 0),\n })),\n };\n}\n"],"mappings":";AAMA,SAAgBA,EAAa,GAAkC,GAAqB,GAA6B;CAC/G,OAAO;EACL;EACA,WAAWC,EAAO;EAClB,QAAQC,EAAO,KAAK,GAAG,OAAO;GAC5B,IAAIC,EAAE;GACN,WAAWF,EAAO,MAAMG,EAAE,EAAE,aAAa;GACzC,IAAID,EAAE,WAAWF,EAAO,MAAMG,EAAE,EAAE,MAAM;EAC1C,EAAE;CACJ;AACF"}
1
+ {"version":3,"file":"frameStats.js","names":["frameStatsOf","render","layers","l","i"],"sources":["../../src/debug/frameStats.ts"],"sourcesContent":["import type { LayerDrawSpan } from 'core/layers/render';\nimport type { RenderStats } from '@weasel-js/renderer';\nimport type { FrameStats } from './types';\n\n/** One paint's {@link FrameStats}: each layer's build time from `drawLayers`\n * joined with its dispatch cost from the renderer, span for span. */\nexport function frameStatsOf(layers: readonly LayerDrawSpan[], render: RenderStats, paintMs: number): FrameStats {\n return {\n paintMs,\n drawCalls: render.drawCalls,\n layers: layers.map((l, i) => ({\n id: l.id,\n drawCalls: render.spans[i]?.drawCalls ?? 0,\n ms: l.buildMs + (render.spans[i]?.ms ?? 0),\n })),\n };\n}\n"],"mappings":";AAMA,SAAgBA,EAAa,GAAkC,GAAqB,GAA6B;CAC/G,OAAO;EACL;EACA,WAAWC,EAAO;EAClB,QAAQC,EAAO,KAAK,GAAG,OAAO;GAC5B,IAAIC,EAAE;GACN,WAAWF,EAAO,MAAMG,EAAE,EAAE,aAAa;GACzC,IAAID,EAAE,WAAWF,EAAO,MAAMG,EAAE,EAAE,MAAM;EAC1C,EAAE;CACJ;AACF"}
@@ -0,0 +1,52 @@
1
+ import { DEBUG_OVERLAY_ID as e, createDebugOverlayLayer as t } from "./createDebugOverlayLayer.js";
2
+ import { parseDebugFlags as n } from "./parseDebugFlags.js";
3
+ import { createDebugSink as r } from "./createDebugSink.js";
4
+ import { frameStatsOf as i } from "./frameStats.js";
5
+ import { useCallback as a, useMemo as o } from "react";
6
+ import { useLatest as s } from "@weasel-js/react";
7
+ //#region src/debug/useDebugSink.ts
8
+ var c = {
9
+ sink: null,
10
+ overlay: null,
11
+ frameStats: !1
12
+ };
13
+ function l(e) {
14
+ let i = e === void 0 ? void 0 : JSON.stringify(e), l = o(() => {
15
+ let e = i === void 0 ? typeof window > "u" ? null : n(window.location.search) : JSON.parse(i) || null;
16
+ if (!e) return c;
17
+ let a = r(e);
18
+ return {
19
+ sink: a,
20
+ overlay: t({
21
+ sink: a,
22
+ config: e
23
+ }),
24
+ frameStats: e.fps === !0
25
+ };
26
+ }, [i]), u = s(l.sink), d = a(() => u.current, [u]);
27
+ return {
28
+ ...l,
29
+ getDebug: d
30
+ };
31
+ }
32
+ function u(t, n, r) {
33
+ if (!t) return null;
34
+ t.beginFrame();
35
+ for (let n = 0; n < r.length; n++) {
36
+ let i = r[n];
37
+ i.id !== e && t.recordLayer(i.id, i.label, i.space ?? "world", n);
38
+ }
39
+ let a, o = 0;
40
+ return {
41
+ time: () => {
42
+ if (n) return a = [], o = performance.now(), a;
43
+ },
44
+ end: (e) => {
45
+ a && t.recordFrame(i(a, e, performance.now() - o));
46
+ }
47
+ };
48
+ }
49
+ //#endregion
50
+ export { u as beginDebugFrame, l as useDebugSink };
51
+
52
+ //# sourceMappingURL=useDebugSink.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useDebugSink.js","names":["OFF","useDebugSink","key","debug","state","useMemo","config","parseDebugFlags","sink","createDebugSink","createDebugOverlayLayer","committed","useLatest","getDebug","useCallback","beginDebugFrame","i","layers","layer","DEBUG_OVERLAY_ID","spans","startedAt","frameStats","frameStatsOf","render"],"sources":["../../src/debug/useDebugSink.ts"],"sourcesContent":["import { useCallback, useMemo } from 'react';\nimport { useLatest } from '@weasel-js/react';\nimport type { RenderStats } from '@weasel-js/renderer';\nimport type { LayerDrawSpan, RenderLayer } from 'core/layers/render';\nimport type { CanvasDebugSink, DebugConfig } from './types';\nimport { parseDebugFlags } from './parseDebugFlags';\nimport { createDebugSink } from './createDebugSink';\nimport { createDebugOverlayLayer, DEBUG_OVERLAY_ID } from './createDebugOverlayLayer';\nimport { frameStatsOf } from './frameStats';\n\n/** A surface's debug state for one resolved config. */\nexport interface SurfaceDebug {\n /** Null when debugging is off. */\n sink: CanvasDebugSink | null;\n /** The layer that paints the sink, for the top of the surface's stack. */\n overlay: RenderLayer<unknown> | null;\n /** Whether a paint should time itself for the frame panel. */\n frameStats: boolean;\n /** The sink of the last committed render. Stable. */\n getDebug: () => CanvasDebugSink | null;\n}\n\nconst OFF = { sink: null, overlay: null, frameStats: false };\n\n/**\n * Resolve a surface's `debug` prop and hold what it turns on. `undefined`\n * reads `?debug=…` from the URL, `false` forces it off, and a config forces it\n * on. Keyed on the config's content, so one written inline keeps its sink, and\n * what the sink and the overlay have accumulated, from render to render.\n */\nexport function useDebugSink(debug: DebugConfig | false | undefined): SurfaceDebug {\n const key = debug === undefined ? undefined : JSON.stringify(debug);\n const state = useMemo(() => {\n const config = key !== undefined\n ? (JSON.parse(key) as DebugConfig | false) || null\n : typeof window === 'undefined' ? null : parseDebugFlags(window.location.search);\n if (!config) return OFF;\n const sink = createDebugSink(config);\n return { sink, overlay: createDebugOverlayLayer({ sink, config }), frameStats: config.fps === true };\n }, [key]);\n const committed = useLatest(state.sink);\n const getDebug = useCallback(() => committed.current, [committed]);\n return { ...state, getDebug };\n}\n\n/** One paint's recording, from {@link beginDebugFrame}. */\nexport interface DebugFrame {\n /** Start the paint clock. Returns the list `drawLayers` fills, or\n * `undefined` when the frame panel is off and nothing is timed. */\n time(): LayerDrawSpan[] | undefined;\n /** Record what the timed paint cost. A no-op unless `time` was called. */\n end(render: RenderStats): void;\n}\n\n/**\n * Open a paint's recording: clear the sink's per-frame records and note the\n * stack about to be drawn, bottom first. Returns `null` with no sink.\n */\nexport function beginDebugFrame(\n sink: CanvasDebugSink | null,\n frameStats: boolean,\n layers: readonly RenderLayer<unknown>[],\n): DebugFrame | null {\n if (!sink) return null;\n sink.beginFrame();\n for (let i = 0; i < layers.length; i++) {\n const layer = layers[i]!;\n if (layer.id === DEBUG_OVERLAY_ID) continue;\n sink.recordLayer(layer.id, layer.label, layer.space ?? 'world', i);\n }\n let spans: LayerDrawSpan[] | undefined;\n let startedAt = 0;\n return {\n time: () => {\n if (!frameStats) return undefined;\n spans = [];\n startedAt = performance.now();\n return spans;\n },\n end: (render) => {\n if (spans) sink.recordFrame(frameStatsOf(spans, render, performance.now() - startedAt));\n },\n };\n}\n"],"mappings":";;;;;;;AAsBA,IAAMA,IAAM;CAAE,MAAM;CAAM,SAAS;CAAM,YAAY;AAAM;AAQ3D,SAAgBC,EAAa,GAAsD;CACjF,IAAMC,IAAMC,MAAU,KAAA,IAAY,KAAA,IAAY,KAAK,UAAUA,CAAK,GAC5DC,IAAQC,QAAc;EAC1B,IAAMC,IAASJ,MAAQ,KAAA,IAEnB,OAAO,SAAW,MAAc,OAAOK,EAAgB,OAAO,SAAS,MAAM,IAD5E,KAAK,MAAML,CAAG,KAA6B;EAEhD,IAAI,CAACI,GAAQ,OAAON;EACpB,IAAMQ,IAAOC,EAAgBH,CAAM;EACnC,OAAO;GAAE;GAAM,SAASI,EAAwB;IAAE;IAAM;GAAO,CAAC;GAAG,YAAYJ,EAAO,QAAQ;EAAK;CACrG,GAAG,CAACJ,CAAG,CAAC,GACFS,IAAYC,EAAUR,EAAM,IAAI,GAChCS,IAAWC,QAAkBH,EAAU,SAAS,CAACA,CAAS,CAAC;CACjE,OAAO;EAAE,GAAGP;EAAO;CAAS;AAC9B;AAeA,SAAgBW,EACd,GACA,GACA,GACmB;CACnB,IAAI,CAACP,GAAM,OAAO;CAClB,EAAK,WAAW;CAChB,KAAK,IAAIQ,IAAI,GAAGA,IAAIC,EAAO,QAAQ,KAAK;EACtC,IAAMC,IAAQD,EAAOD;EACrB,AAAIE,EAAM,OAAOC,KACjBX,EAAK,YAAYU,EAAM,IAAIA,EAAM,OAAOA,EAAM,SAAS,SAASF,CAAC;CACnE;CACA,IAAII,GACAC,IAAY;CAChB,OAAO;EACL,YAAY;GACV,IAAKC,GAGL,OAFA,IAAQ,CAAC,GACT,IAAY,YAAY,IAAI,GACrBF;EACT;EACA,MAAM,MAAW;GACf,AAAIA,KAAOZ,EAAK,YAAYe,EAAaH,GAAOI,GAAQ,YAAY,IAAI,IAAIH,CAAS,CAAC;EACxF;CACF;AACF"}
@@ -1 +1 @@
1
- {"version":3,"file":"buildChromeCtx.js","names":["buildChromeCtx","args"],"sources":["../../../src/features/chrome-caps/buildChromeCtx.ts"],"sourcesContent":["/**\n * Pure assembler for {@link ChromeCtx}.\n *\n * Called once per frame on the rendering side from whichever surface\n * needs to evaluate visibility rules — `composeAffordanceLayer`,\n * `createSelectionOverlayLayer`, the dispatcher overlay layer, etc.\n *\n * Sources are passed as plain getters / values rather than the live\n * objects they come from. This keeps `chrome-caps` from depending on\n * React, the dispatcher's concrete type, or `ChromeState`'s bounds\n * machinery — the same builder works from a test harness, a forge\n * story, or `<SceneCanvas>`.\n */\n\nimport type { NodeId } from '../../core/scene/types';\nimport type { ModifierState } from '../../interactions/gestures/types';\nimport type { View } from '../../core/viewport/view';\nimport type { ChromeCtx } from './types';\n\n/** The pieces of live canvas state a `ChromeCtx` is assembled from. */\nexport interface BuildChromeCtxArgs {\n focused: boolean;\n selection: readonly NodeId[];\n multiActive: boolean;\n modifiers: ModifierState;\n action: { kind: string | null; id: string | null };\n hover: NodeId | null;\n view: View;\n}\n\n/** Gather the current canvas state into the context that chrome-visibility\n * rules are evaluated against. Rebuilt per frame. */\nexport function buildChromeCtx(args: BuildChromeCtxArgs): ChromeCtx {\n return {\n focused: args.focused,\n selection: args.selection,\n multiActive: args.multiActive,\n modifiers: args.modifiers,\n action: args.action,\n hover: args.hover,\n view: args.view,\n };\n}\n"],"mappings":";AAgCA,SAAgBA,EAAe,GAAqC;CAClE,OAAO;EACL,SAASC,EAAK;EACd,WAAWA,EAAK;EAChB,aAAaA,EAAK;EAClB,WAAWA,EAAK;EAChB,QAAQA,EAAK;EACb,OAAOA,EAAK;EACZ,MAAMA,EAAK;CACb;AACF"}
1
+ {"version":3,"file":"buildChromeCtx.js","names":["buildChromeCtx","args"],"sources":["../../../src/features/chrome-caps/buildChromeCtx.ts"],"sourcesContent":["/**\n * Pure assembler for {@link ChromeCtx}. Sources are passed as plain values\n * rather than the live objects they come from, which keeps `chrome-caps`\n * from depending on React or the dispatcher's concrete type.\n */\n\nimport type { NodeId } from '../../core/scene/types';\nimport type { ModifierState } from '../../interactions/gestures/types';\nimport type { View } from '../../core/viewport/view';\nimport type { ChromeCtx } from './types';\n\n/** The pieces of live canvas state a `ChromeCtx` is assembled from. */\nexport interface BuildChromeCtxArgs {\n focused: boolean;\n selection: readonly NodeId[];\n multiActive: boolean;\n modifiers: ModifierState;\n action: { kind: string | null; id: string | null };\n hover: NodeId | null;\n view: View;\n}\n\n/** Gather the current canvas state into the context that chrome-visibility\n * rules are evaluated against. Rebuilt per frame. */\nexport function buildChromeCtx(args: BuildChromeCtxArgs): ChromeCtx {\n return {\n focused: args.focused,\n selection: args.selection,\n multiActive: args.multiActive,\n modifiers: args.modifiers,\n action: args.action,\n hover: args.hover,\n view: args.view,\n };\n}\n"],"mappings":";AAwBA,SAAgBA,EAAe,GAAqC;CAClE,OAAO;EACL,SAASC,EAAK;EACd,WAAWA,EAAK;EAChB,aAAaA,EAAK;EAClB,WAAWA,EAAK;EAChB,QAAQA,EAAK;EACb,OAAOA,EAAK;EACZ,MAAMA,EAAK;CACb;AACF"}
@@ -1 +1 @@
1
- {"version":3,"file":"conditions.js","names":["cond","condition","evaluate","rule","ctx","combineAll","asRule","other","combineAny","value","left","a","right","b","when","fn","and","cs","or","not","c","always","ALWAYS","never","NEVER","focused","gesturing","actionIs","kind","selectionEmpty","selectionIs","n","selectionAtLeast","multiActive","hovering","hoveringSelected","modifierHeld","m","zoomAtLeast","z","modeIs","modeIn","modes","modeNot","capabilityIs","cap","capabilityIn","caps","capabilityAll","capabilityNot","coarsePointer","canHover"],"sources":["../../../src/features/chrome-caps/conditions.ts"],"sourcesContent":["import type { Condition } from './types';\nimport type { Rule } from '@weasel-js/routing';\nimport type { RuleCtx } from '@weasel-js/routing';\nimport { evaluate, ALWAYS, NEVER } from '@weasel-js/routing';\nimport type { ModifierState } from '../../interactions/gestures/types';\n\n/**\n * Promote a Rule tree to a fluent Condition. The function form evaluates\n * the tree against a RuleCtx; combinator methods produce new Conditions\n * wrapping `all`/`any`/`not` nodes.\n *\n * **Chain semantics: strict left-to-right.** No boolean precedence.\n * `focused.or(hovering).and(selectionIs(1))` evaluates\n * `((focused || hovering) && selectionIs(1))` — NOT\n * `(focused || (hovering && selectionIs(1)))` as standard precedence\n * would give. For grouped disjunction, use the top-level `or` / `and` /\n * `not` helpers or name intermediates.\n *\n * Combinators flatten same-kind nesting on construction so `a.and(b).and(c)`\n * produces `{ all: [a, b, c] }` rather than `{ all: [{ all: [a, b] }, c] }`.\n * Canonical form simplifies downstream introspection.\n *\n * Use {@link when} for the inline-lambda escape hatch.\n */\nexport function cond(rule: Rule): Condition {\n const fn = (ctx: RuleCtx) => evaluate(rule, ctx);\n const condition = fn as Condition;\n (condition as { rule: Rule }).rule = rule;\n condition.and = (other) => cond(combineAll(rule, asRule(other)));\n condition.or = (other) => cond(combineAny(rule, asRule(other)));\n condition.andNot = (other) => cond(combineAll(rule, { not: asRule(other) }));\n condition.orNot = (other) => cond(combineAny(rule, { not: asRule(other) }));\n return condition;\n}\n\nfunction asRule(value: Condition | Rule): Rule {\n return typeof value === 'function' ? (value as Condition).rule : value;\n}\n\nfunction combineAll(a: Rule, b: Rule): Rule {\n const left = 'all' in a ? a.all : [a];\n const right = 'all' in b ? b.all : [b];\n return { all: [...left, ...right] };\n}\n\nfunction combineAny(a: Rule, b: Rule): Rule {\n const left = 'any' in a ? a.any : [a];\n const right = 'any' in b ? b.any : [b];\n return { any: [...left, ...right] };\n}\n\n/** Inline-lambda escape hatch. Wraps the closure as a `when` rule node. */\nexport function when(fn: (ctx: RuleCtx) => boolean): Condition {\n return cond({ when: fn });\n}\n\n// ─── Variadic helpers (for grouped expressions) ─────────────────────\n\n/** `(a && b && c && ...)` — useful when chain mixing makes left-to-right\n * semantics ambiguous. */\nexport function and(...cs: (Condition | Rule)[]): Condition {\n return cond({ all: cs.map(asRule) });\n}\n\n/** `(a || b || c || ...)` — preferred over `.or` chains when mixed with\n * `.and` to make grouping explicit. */\nexport function or(...cs: (Condition | Rule)[]): Condition {\n return cond({ any: cs.map(asRule) });\n}\n\n/** `!c` — top-level negation. Most rules use `.andNot()` / `.orNot()`\n * instead; this is for the lead-with-negation case. */\nexport function not(c: Condition | Rule): Condition {\n return cond({ not: asRule(c) });\n}\n\n// ─── Constant atoms ─────────────────────────────────────────────────\n\n/** Always true. The fallback for any chrome id without a registered rule. */\nexport const always: Condition = cond(ALWAYS);\n\n/** Always false. Useful for \"turn this chrome off entirely\":\n * `chromeVisibility={{ 'snap.guides': never }}`. */\nexport const never: Condition = cond(NEVER);\n\n// ─── Focus / action atoms ───────────────────────────────────────────\n\n/** Canvas surface currently focused. */\nexport const focused: Condition = cond({ focused: true });\n\n/** Any action currently in flight (read: user is gesturing). */\nexport const gesturing: Condition = cond({ gesturing: true });\n\n/** A path is currently in anchor-edit mode. */\nexport const editingAnchors: Condition = cond({ editingAnchors: true });\n\n/** Current selection is resizable (every selected node passes the consumer's\n * `selectTool.resize.resizable` predicate). Absent predicate → resizable. */\nexport const resizable: Condition = cond({ resizable: true });\n\n/** Active action's kind matches `kind` (e.g. `actionIs('move')`). */\nexport const actionIs = (kind: string): Condition => cond({ actionIs: kind });\n\n// ─── Selection atoms ────────────────────────────────────────────────\n\n/** Nothing selected. */\nexport const selectionEmpty: Condition = cond({ selection: { empty: true } });\n\n/** Exactly `n` items selected. */\nexport const selectionIs = (n: number): Condition => cond({ selection: { is: n } });\n\n/** At least `n` items selected. `selectionAtLeast(1)` is the common\n * \"something is selected\" check. */\nexport const selectionAtLeast = (n: number): Condition => cond({ selection: { atLeast: n } });\n\n/** Multi-mode handle behavior active (single shared union-bounds\n * handle vs per-item handles). Implemented as a `when` because\n * `multiActive` is a derived single-call read on RuleCtx, not a\n * selector-table key. Stable; safe to introspect. */\nexport const multiActive: Condition = cond({ when: (c) => c.multiActive });\n\n// ─── Hover atoms ────────────────────────────────────────────────────\n\n/** Pointer is hovering some node. */\nexport const hovering: Condition = cond({ hovering: true });\n\n/** Pointer is hovering a node that is currently selected. */\nexport const hoveringSelected: Condition = cond({ hoveringSelected: true });\n\n// ─── Modifier atoms ─────────────────────────────────────────────────\n\n/** Named modifier key currently held. */\nexport const modifierHeld = (m: keyof ModifierState): Condition => cond({ modifierHeld: m });\n\n// ─── View atoms ─────────────────────────────────────────────────────\n\n/** View scale (uniform or geometric mean for non-uniform) is at least\n * `z`. Useful for \"hide hairline chrome at low zoom\" rules. */\nexport const zoomAtLeast = (z: number): Condition => cond({ zoomAtLeast: z });\n\n// ─── Mode + capability atoms (new) ─────────────────────────────────\n\n/** Active mode equals `m`. */\nexport const modeIs = (m: string): Condition => cond({ mode: m });\n\n/** Active mode is one of `modes`. */\nexport const modeIn = (modes: readonly string[]): Condition => cond({ mode: { in: modes } });\n\n/** Active mode is NOT `m`. */\nexport const modeNot = (m: string): Condition => cond({ mode: { not: m } });\n\n/** Active mode's `allows` includes capability `cap`. */\nexport const capabilityIs = (cap: string): Condition => cond({ capability: cap });\n\n/** Active mode's `allows` includes ANY of `caps` (OR). */\nexport const capabilityIn = (caps: readonly string[]): Condition => cond({ capability: { in: caps } });\n\n/** Active mode's `allows` includes ALL of `caps` (AND). */\nexport const capabilityAll = (caps: readonly string[]): Condition => cond({ capability: [...caps] });\n\n/** Active mode's `allows` does NOT include capability `cap`. */\nexport const capabilityNot = (cap: string): Condition => cond({ capability: { not: cap } });\n\n// ─── Device atoms ───────────────────────────────────────────────────\n\n/** Primary pointer is imprecise (touch, most styluses). Absent device\n * profile → false, so a rule written with this atom is inert on the\n * mouse-shaped default rather than silently flipping. */\nexport const coarsePointer: Condition = cond({ coarsePointer: true });\n\n/** Primary pointer can hover. Absent device profile → true. Pair with\n * `not(...)` to gate chrome that only makes sense with a hovering\n * pointer: `not(canHover)` is \"this device cannot hover\". */\nexport const canHover: Condition = cond({ canHover: true });\n"],"mappings":";;AAwBA,SAAgBA,EAAK,GAAuB;CAE1C,IAAMC,KADM,MAAiBC,EAASC,GAAMC,CAAG;CAO/C,OALA,EAA8B,OAAOD,GACrC,EAAU,OAAU,MAAUH,EAAKK,EAAWF,GAAMG,EAAOC,CAAK,CAAC,CAAC,GAClE,EAAU,MAAU,MAAUP,EAAKQ,EAAWL,GAAMG,EAAOC,CAAK,CAAC,CAAC,GAClE,EAAU,UAAU,MAAUP,EAAKK,EAAWF,GAAM,EAAE,KAAKG,EAAOC,CAAK,EAAE,CAAC,CAAC,GAC3E,EAAU,SAAU,MAAUP,EAAKQ,EAAWL,GAAM,EAAE,KAAKG,EAAOC,CAAK,EAAE,CAAC,CAAC,GACpEN;AACT;AAEA,SAASK,EAAO,GAA+B;CAC7C,OAAO,OAAOG,KAAU,aAAcA,EAAoB,OAAOA;AACnE;AAEA,SAASJ,EAAW,GAAS,GAAe;CAC1C,IAAMK,IAAO,SAASC,IAAIA,EAAE,MAAM,CAAC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AS+B,EAAE,EAAE,CAAC,GAM/EE,IAAyBjC,EAAK,EAAE,OAAO,MAAMoB,EAAE,YAAY,CAAC,GAK5Dc,IAAsBlC,EAAK,EAAE,UAAU,GAAK,CAAC,GAG7CmC,IAA8BnC,EAAK,EAAE,kBAAkB,GAAK,CAAC,GAK7DoC,KAAgB,MAAsCpC,EAAK,EAAE,cAAcqC,EAAE,CAAC,GAM9EC,KAAe,MAAyBtC,EAAK,EAAE,aAAauC,EAAE,CAAC,GAK/DC,KAAU,MAAyBxC,EAAK,EAAE,MAAMqC,EAAE,CAAC,GAGnDI,KAAU,MAAwCzC,EAAK,EAAE,MAAM,EAAE,IAAI0C,EAAM,EAAE,CAAC,GAG9EC,KAAW,MAAyB3C,EAAK,EAAE,MAAM,EAAE,KAAKqC,EAAE,EAAE,CAAC,GAG7DO,KAAgB,MAA2B5C,EAAK,EAAE,YAAY6C,EAAI,CAAC,GAGnEC,KAAgB,MAAuC9C,EAAK,EAAE,YAAY,EAAE,IAAI+C,EAAK,EAAE,CAAC,GAGxFC,KAAiB,MAAuChD,EAAK,EAAE,YAAY,CAAC,GAAG+C,CAAI,EAAE,CAAC,GAGtFE,KAAiB,MAA2BjD,EAAK,EAAE,YAAY,EAAE,KAAK6C,EAAI,EAAE,CAAC,GAO7EK,IAA2BlD,EAAK,EAAE,eAAe,GAAK,CAAC,GAKvDmD,IAAsBnD,EAAK,EAAE,UAAU,GAAK,CAAC"}
1
+ {"version":3,"file":"conditions.js","names":["cond","condition","evaluate","rule","ctx","combineAll","asRule","other","combineAny","value","left","a","right","b","when","fn","and","cs","or","not","c","always","ALWAYS","never","NEVER","focused","gesturing","actionIs","kind","selectionEmpty","selectionIs","n","selectionAtLeast","multiActive","hovering","hoveringSelected","modifierHeld","m","zoomAtLeast","z","modeIs","modeIn","modes","modeNot","capabilityIs","cap","capabilityIn","caps","capabilityAll","capabilityNot","coarsePointer","canHover"],"sources":["../../../src/features/chrome-caps/conditions.ts"],"sourcesContent":["import type { Condition } from './types';\nimport type { Rule } from '@weasel-js/routing';\nimport type { RuleCtx } from '@weasel-js/routing';\nimport { evaluate, ALWAYS, NEVER } from '@weasel-js/routing';\nimport type { ModifierState } from '../../interactions/gestures/types';\n\n/**\n * Promote a Rule tree to a fluent Condition.\n *\n * **Chain semantics: strict left-to-right.** No boolean precedence.\n * `focused.or(hovering).and(selectionIs(1))` evaluates\n * `((focused || hovering) && selectionIs(1))`. For grouped disjunction, use\n * the top-level `or` / `and` / `not` helpers or name intermediates.\n *\n * Combinators flatten same-kind nesting on construction so `a.and(b).and(c)`\n * produces `{ all: [a, b, c] }`.\n */\nexport function cond(rule: Rule): Condition {\n const fn = (ctx: RuleCtx) => evaluate(rule, ctx);\n const condition = fn as Condition;\n (condition as { rule: Rule }).rule = rule;\n condition.and = (other) => cond(combineAll(rule, asRule(other)));\n condition.or = (other) => cond(combineAny(rule, asRule(other)));\n condition.andNot = (other) => cond(combineAll(rule, { not: asRule(other) }));\n condition.orNot = (other) => cond(combineAny(rule, { not: asRule(other) }));\n return condition;\n}\n\nfunction asRule(value: Condition | Rule): Rule {\n return typeof value === 'function' ? (value as Condition).rule : value;\n}\n\nfunction combineAll(a: Rule, b: Rule): Rule {\n const left = 'all' in a ? a.all : [a];\n const right = 'all' in b ? b.all : [b];\n return { all: [...left, ...right] };\n}\n\nfunction combineAny(a: Rule, b: Rule): Rule {\n const left = 'any' in a ? a.any : [a];\n const right = 'any' in b ? b.any : [b];\n return { any: [...left, ...right] };\n}\n\n/** Inline-lambda escape hatch. Wraps the closure as a `when` rule node. */\nexport function when(fn: (ctx: RuleCtx) => boolean): Condition {\n return cond({ when: fn });\n}\n\n// ─── Variadic helpers (for grouped expressions) ─────────────────────\n\n/** `(a && b && c && ...)` — useful when chain mixing makes left-to-right\n * semantics ambiguous. */\nexport function and(...cs: (Condition | Rule)[]): Condition {\n return cond({ all: cs.map(asRule) });\n}\n\n/** `(a || b || c || ...)` — preferred over `.or` chains when mixed with\n * `.and` to make grouping explicit. */\nexport function or(...cs: (Condition | Rule)[]): Condition {\n return cond({ any: cs.map(asRule) });\n}\n\n/** `!c` — top-level negation. Most rules use `.andNot()` / `.orNot()`\n * instead; this is for the lead-with-negation case. */\nexport function not(c: Condition | Rule): Condition {\n return cond({ not: asRule(c) });\n}\n\n// ─── Constant atoms ─────────────────────────────────────────────────\n\n/** Always true. The fallback for any chrome id without a registered rule. */\nexport const always: Condition = cond(ALWAYS);\n\n/** Always false. Useful for \"turn this chrome off entirely\":\n * `chromeVisibility={{ 'snap.guides': never }}`. */\nexport const never: Condition = cond(NEVER);\n\n// ─── Focus / action atoms ───────────────────────────────────────────\n\n/** Canvas surface currently focused. */\nexport const focused: Condition = cond({ focused: true });\n\n/** Any action currently in flight (read: user is gesturing). */\nexport const gesturing: Condition = cond({ gesturing: true });\n\n/** A path is currently in anchor-edit mode. */\nexport const editingAnchors: Condition = cond({ editingAnchors: true });\n\n/** Current selection is resizable (every selected node passes the consumer's\n * `selectTool.resize.resizable` predicate). Absent predicate → resizable. */\nexport const resizable: Condition = cond({ resizable: true });\n\n/** Active action's kind matches `kind` (e.g. `actionIs('move')`). */\nexport const actionIs = (kind: string): Condition => cond({ actionIs: kind });\n\n// ─── Selection atoms ────────────────────────────────────────────────\n\n/** Nothing selected. */\nexport const selectionEmpty: Condition = cond({ selection: { empty: true } });\n\n/** Exactly `n` items selected. */\nexport const selectionIs = (n: number): Condition => cond({ selection: { is: n } });\n\n/** At least `n` items selected. `selectionAtLeast(1)` is the common\n * \"something is selected\" check. */\nexport const selectionAtLeast = (n: number): Condition => cond({ selection: { atLeast: n } });\n\n/** Multi-mode handle behavior active (single shared union-bounds\n * handle vs per-item handles). */\nexport const multiActive: Condition = cond({ when: (c) => c.multiActive });\n\n// ─── Hover atoms ────────────────────────────────────────────────────\n\n/** Pointer is hovering some node. */\nexport const hovering: Condition = cond({ hovering: true });\n\n/** Pointer is hovering a node that is currently selected. */\nexport const hoveringSelected: Condition = cond({ hoveringSelected: true });\n\n// ─── Modifier atoms ─────────────────────────────────────────────────\n\n/** Named modifier key currently held. */\nexport const modifierHeld = (m: keyof ModifierState): Condition => cond({ modifierHeld: m });\n\n// ─── View atoms ─────────────────────────────────────────────────────\n\n/** View scale (uniform or geometric mean for non-uniform) is at least\n * `z`. Useful for \"hide hairline chrome at low zoom\" rules. */\nexport const zoomAtLeast = (z: number): Condition => cond({ zoomAtLeast: z });\n\n// ─── Mode + capability atoms ───────────────────────────────────────\n\n/** Active mode equals `m`. */\nexport const modeIs = (m: string): Condition => cond({ mode: m });\n\n/** Active mode is one of `modes`. */\nexport const modeIn = (modes: readonly string[]): Condition => cond({ mode: { in: modes } });\n\n/** Active mode is NOT `m`. */\nexport const modeNot = (m: string): Condition => cond({ mode: { not: m } });\n\n/** Active mode's `allows` includes capability `cap`. */\nexport const capabilityIs = (cap: string): Condition => cond({ capability: cap });\n\n/** Active mode's `allows` includes ANY of `caps` (OR). */\nexport const capabilityIn = (caps: readonly string[]): Condition => cond({ capability: { in: caps } });\n\n/** Active mode's `allows` includes ALL of `caps` (AND). */\nexport const capabilityAll = (caps: readonly string[]): Condition => cond({ capability: [...caps] });\n\n/** Active mode's `allows` does NOT include capability `cap`. */\nexport const capabilityNot = (cap: string): Condition => cond({ capability: { not: cap } });\n\n// ─── Device atoms ───────────────────────────────────────────────────\n\n/** Primary pointer is imprecise (touch, most styluses). Absent device\n * profile → false. */\nexport const coarsePointer: Condition = cond({ coarsePointer: true });\n\n/** Primary pointer can hover. Absent device profile → true. */\nexport const canHover: Condition = cond({ canHover: true });\n"],"mappings":";;AAiBA,SAAgBA,EAAK,GAAuB;CAE1C,IAAMC,KADM,MAAiBC,EAASC,GAAMC,CAAG;CAO/C,OALA,EAA8B,OAAOD,GACrC,EAAU,OAAU,MAAUH,EAAKK,EAAWF,GAAMG,EAAOC,CAAK,CAAC,CAAC,GAClE,EAAU,MAAU,MAAUP,EAAKQ,EAAWL,GAAMG,EAAOC,CAAK,CAAC,CAAC,GAClE,EAAU,UAA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@ -1 +1 @@
1
- {"version":3,"file":"defaults.js","names":["defaultVisibilityRules"],"sources":["../../../src/features/chrome-caps/defaults.ts"],"sourcesContent":["import type { VisibilityRules } from './types';\nimport type { Rule } from '@weasel-js/routing';\n\n/**\n * Kit-shipped defaults. Merged with the consumer's `chromeVisibility` map\n * at resolve time; consumer entries take precedence per id.\n *\n * Written as literal Rule trees rather than fluent chains so the inputs\n * each rule depends on are immediately visible. The fluent atoms compile\n * to the same trees; either form is valid in a VisibilityRules entry.\n *\n * Gating is written in terms of **capabilities, not mode ids**. A\n * capability rule keeps holding when a new mode is added that permits the\n * same thing; a mode rule has to be found and edited every time. There is\n * no `mode:` rule left in this table — the `path-edit.*` chrome used to be\n * the exception, on the theory that it's the visual signature of one mode;\n * see the comment on those rules below for why that was wrong in both\n * directions and what replaced it.\n *\n * Chrome that gates on the *absence* of a capability (the selection\n * outline, suppressed while an anchor-editing overlay owns the visuals)\n * uses `capability: { not: … }` for the same reason.\n */\nexport const defaultVisibilityRules: VisibilityRules = {\n // Static selection chrome — visible while a selection exists, but off\n // whenever an anchor-editing overlay has taken over the visuals (today:\n // path-edit mode; tomorrow: anything else that allows `edits-anchors`).\n 'selection.outline': {\n all: [\n { selection: { atLeast: 1 } },\n { capability: { not: 'edits-anchors' } },\n ],\n } as Rule,\n\n // Handles hide during an action so the moving / resizing object isn't\n // visually crowded; they reappear on commit. Gated on the mode actually\n // permitting transforms — grabbing a resize handle in a mode that\n // forbids `transforms-selection` could only ever be a no-op — and on the\n // selection being resizable (consumer `resizable` predicate).\n 'selection.resize-handles': {\n all: [\n { selection: { atLeast: 1 } },\n { not: { gesturing: true } },\n { capability: 'transforms-selection' },\n { resizable: true },\n ],\n } as Rule,\n\n // Rotation handle visible whenever any selection is focused — single\n // mode pivots around the selected node's center; multi mode pivots\n // around the union AABB center. Same transform gating as resize; also\n // off during an action.\n 'selection.rotation-handle': {\n all: [\n { selection: { atLeast: 1 } },\n { focused: true },\n { not: { gesturing: true } },\n { capability: 'transforms-selection' },\n ],\n } as Rule,\n\n // Transient action chrome — only shown during the matching action.\n 'action.marquee': { actionIs: 'marquee' } as Rule,\n 'action.lasso': { actionIs: 'lasso' } as Rule,\n 'action.move-ghosts': { actionIs: 'move' } as Rule,\n\n // Path-edit chrome — gated on there actually being an edited path.\n //\n // This used to read `{ mode: 'path-edit' }`, which was wrong in both\n // directions. Consumers with no mode registry report mode `'normal'`,\n // so the anchor hit-test (which asks `isVisible('path-edit.anchors')`)\n // refused every anchor while the overlay — which never consulted the\n // table at all — drew them anyway: visible but not grabbable, the exact\n // failure this table exists to make impossible. And a consumer defining\n // its own anchor-editing mode under a different id got neither.\n //\n // `editingAnchors` is the state both surfaces actually care about. It's\n // a state selector rather than a `capability:` one on purpose: the\n // capability says the user *may* edit anchors, which is not the same as\n // a path *being* edited, and drawing anchors for the former is wrong.\n 'path-edit.anchors': { editingAnchors: true } as Rule,\n 'path-edit.overlay': { editingAnchors: true } as Rule,\n\n // Snap system — guides during any action; targets consumer-driven for now.\n 'snap.guides': { gesturing: true } as Rule,\n // 'snap.targets' — no default; consumer-driven for now.\n\n // 'grid' / 'debug.*' — no default; visibility currently driven by\n // dedicated boolean props on <SceneCanvas>. They'll move into this\n // table as they migrate.\n};\n"],"mappings":";AAuBA,IAAaA,IAA0C;CAIrD,qBAAqB,EACnB,KAAK,CACH,EAAE,WAAW,EAAE,SAAS,EAAE,EAAE,GAC5B,EAAE,YAAY,EAAE,KAAK,gBAAgB,EAAE,CACzC,EACF;CAOA,4BAA4B,EAC1B,KAAK;EACH,EAAE,WAAW,EAAE,SAAS,EAAE,EAAE;EAC5B,EAAE,KAAK,EAAE,WAAW,GAAK,EAAE;EAC3B,EAAE,YAAY,uBAAuB;EACrC,EAAE,WAAW,GAAK;CACpB,EACF;CAMA,6BAA6B,EAC3B,KAAK;EACH,EAAE,WAAW,EAAE,SAAS,EAAE,EAAE;EAC5B,EAAE,SAAS,GAAK;EAChB,EAAE,KAAK,EAAE,WAAW,GAAK,EAAE;EAC3B,EAAE,YAAY,uBAAuB;CACvC,EACF;CAGA,kBAAsB,EAAE,UAAU,UAAU;CAC5C,gBAAsB,EAAE,UAAU,QAAQ;CAC1C,sBAAsB,EAAE,UAAU,OAAO;CAgBzC,qBAAqB,EAAE,gBAAgB,GAAK;CAC5C,qBAAqB,EAAE,gBAAgB,GAAK;CAG5C,eAAe,EAAE,WAAW,GAAK;AAMnC"}
1
+ {"version":3,"file":"defaults.js","names":["defaultVisibilityRules"],"sources":["../../../src/features/chrome-caps/defaults.ts"],"sourcesContent":["import type { VisibilityRules } from './types';\nimport type { Rule } from '@weasel-js/routing';\n\n/**\n * Kit-shipped defaults. Merged with the consumer's `chromeVisibility` map\n * at resolve time; consumer entries take precedence per id.\n *\n * Gating is written in terms of **capabilities, not mode ids**. A\n * capability rule keeps holding when a new mode is added that permits the\n * same thing; a mode rule has to be found and edited every time.\n */\nexport const defaultVisibilityRules: VisibilityRules = {\n // Off whenever an anchor-editing overlay has taken over the visuals.\n 'selection.outline': {\n all: [\n { selection: { atLeast: 1 } },\n { capability: { not: 'edits-anchors' } },\n ],\n } as Rule,\n\n // Handles hide during an action so the moving / resizing object isn't\n // visually crowded; they reappear on commit.\n 'selection.resize-handles': {\n all: [\n { selection: { atLeast: 1 } },\n { not: { gesturing: true } },\n { capability: 'transforms-selection' },\n { resizable: true },\n ],\n } as Rule,\n\n 'selection.rotation-handle': {\n all: [\n { selection: { atLeast: 1 } },\n { focused: true },\n { not: { gesturing: true } },\n { capability: 'transforms-selection' },\n ],\n } as Rule,\n\n // Transient action chrome — only shown during the matching action.\n 'action.marquee': { actionIs: 'marquee' } as Rule,\n 'action.lasso': { actionIs: 'lasso' } as Rule,\n 'action.move-ghosts': { actionIs: 'move' } as Rule,\n\n // Path-edit chrome — gated on there actually being an edited path, not on\n // `{ mode: 'path-edit' }`: consumers with no mode registry report mode\n // `'normal'`, and one defining its own anchor-editing mode uses another id.\n // A state selector rather than a `capability:` one on purpose: the\n // capability says the user *may* edit anchors, which is not the same as\n // a path *being* edited.\n 'path-edit.anchors': { editingAnchors: true } as Rule,\n 'path-edit.overlay': { editingAnchors: true } as Rule,\n\n // Snap system — guides during any action; targets consumer-driven for now.\n 'snap.guides': { gesturing: true } as Rule,\n // 'snap.targets' — no default; consumer-driven for now.\n\n // 'grid' / 'debug.*' — no default; visibility is driven by dedicated\n // boolean props on <SceneCanvas>.\n};\n"],"mappings":";AAWA,IAAaA,IAA0C;CAErD,qBAAqB,EACnB,KAAK,CACH,EAAE,WAAW,EAAE,SAAS,EAAE,EAAE,GAC5B,EAAE,YAAY,EAAE,KAAK,gBAAgB,EAAE,CACzC,EACF;CAIA,4BAA4B,EAC1B,KAAK;EACH,EAAE,WAAW,EAAE,SAAS,EAAE,EAAE;EAC5B,EAAE,KAAK,EAAE,WAAW,GAAK,EAAE;EAC3B,EAAE,YAAY,uBAAuB;EACrC,EAAE,WAAW,GAAK;CACpB,EACF;CAEA,6BAA6B,EAC3B,KAAK;EACH,EAAE,WAAW,EAAE,SAAS,EAAE,EAAE;EAC5B,EAAE,SAAS,GAAK;EAChB,EAAE,KAAK,EAAE,WAAW,GAAK,EAAE;EAC3B,EAAE,YAAY,uBAAuB;CACvC,EACF;CAGA,kBAAsB,EAAE,UAAU,UAAU;CAC5C,gBAAsB,EAAE,UAAU,QAAQ;CAC1C,sBAAsB,EAAE,UAAU,OAAO;CAQzC,qBAAqB,EAAE,gBAAgB,GAAK;CAC5C,qBAAqB,EAAE,gBAAgB,GAAK;CAG5C,eAAe,EAAE,WAAW,GAAK;AAKnC"}
@@ -1 +1 @@
1
- {"version":3,"file":"resolve.js","names":["resolveVisibility","merged","consumer","defaultVisibilityRules","ruleCtx","ctx","viewZoom","DEFAULT_ALLOWED_CAPABILITIES","entry","id","evaluate"],"sources":["../../../src/features/chrome-caps/resolve.ts"],"sourcesContent":["import type { ChromeCtx, ChromeId, VisibilityRules } from './types';\nimport type { RuleCtx } from '@weasel-js/routing';\nimport { DEFAULT_ALLOWED_CAPABILITIES } from '@weasel-js/routing';\nimport { evaluate } from '@weasel-js/routing';\nimport { defaultVisibilityRules } from './defaults';\nimport { viewZoom } from 'core/viewport/view';\n\n/**\n * Build the per-frame visibility check. Merges consumer rules on top\n * of the kit defaults, then closes over `ctx` so each chrome-id\n * lookup runs its rule against the current state.\n *\n * `VisibilityRules` entries may be either fluent `Condition` values\n * (callable) or raw `Rule` trees — we normalize at lookup time.\n *\n * Predicates are O(1) and run once per chrome id per frame; no\n * memoization in v1 — profile before adding any.\n *\n * `ChromeCtx` is the legacy shape; surfaces still on it get `mode='normal'`\n * and `DEFAULT_ALLOWED_CAPABILITIES` filled in here, so a caller that never\n * opted into modality behaves exactly like one sitting in normal mode.\n */\nexport function resolveVisibility(\n consumer: VisibilityRules | undefined,\n ctx: ChromeCtx | RuleCtx,\n): (id: ChromeId) => boolean {\n const merged: VisibilityRules = consumer\n ? { ...defaultVisibilityRules, ...consumer }\n : defaultVisibilityRules;\n const ruleCtx: RuleCtx = 'mode' in ctx\n ? ctx\n : {\n ...ctx,\n zoom: viewZoom(ctx.view),\n mode: 'normal',\n allowedCapabilities: DEFAULT_ALLOWED_CAPABILITIES,\n };\n return (id) => {\n const entry = merged[id];\n if (entry === undefined) return true;\n if (typeof entry === 'function') return entry(ruleCtx);\n return evaluate(entry, ruleCtx);\n };\n}\n"],"mappings":";;;;AAsBA,SAAgBA,EACd,GACA,GAC2B;CAC3B,IAAMC,IAA0BC,IAC5B;EAAE,GAAGC;EAAwB,GAAGD;CAAS,IACzCC,GACEC,IAAmB,UAAUC,IAC/BA,IACA;EACA,GAAGA;EACH,MAAMC,EAASD,EAAI,IAAI;EACvB,MAAM;EACN,qBAAqBE;CACvB;CACF,QAAQ,MAAO;EACb,IAAMC,IAAQP,EAAOQ;EAGrB,OAFID,MAAU,KAAA,IAAkB,KAC5B,OAAOA,KAAU,aAAmBA,EAAMJ,CAAO,IAC9CM,EAASF,GAAOJ,CAAO;CAChC;AACF"}
1
+ {"version":3,"file":"resolve.js","names":["resolveVisibility","merged","consumer","defaultVisibilityRules","ruleCtx","ctx","viewZoom","DEFAULT_ALLOWED_CAPABILITIES","entry","id","evaluate"],"sources":["../../../src/features/chrome-caps/resolve.ts"],"sourcesContent":["import type { ChromeCtx, ChromeId, VisibilityRules } from './types';\nimport type { RuleCtx } from '@weasel-js/routing';\nimport { DEFAULT_ALLOWED_CAPABILITIES } from '@weasel-js/routing';\nimport { evaluate } from '@weasel-js/routing';\nimport { defaultVisibilityRules } from './defaults';\nimport { viewZoom } from 'core/viewport/view';\n\n/**\n * Build the per-frame visibility check: consumer rules merged on top of\n * the kit defaults, evaluated against `ctx`.\n *\n * `ChromeCtx` is the legacy shape; surfaces still on it get `mode='normal'`\n * and `DEFAULT_ALLOWED_CAPABILITIES` filled in here, so a caller that never\n * opted into modality behaves exactly like one sitting in normal mode.\n */\nexport function resolveVisibility(\n consumer: VisibilityRules | undefined,\n ctx: ChromeCtx | RuleCtx,\n): (id: ChromeId) => boolean {\n const merged: VisibilityRules = consumer\n ? { ...defaultVisibilityRules, ...consumer }\n : defaultVisibilityRules;\n const ruleCtx: RuleCtx = 'mode' in ctx\n ? ctx\n : {\n ...ctx,\n zoom: viewZoom(ctx.view),\n mode: 'normal',\n allowedCapabilities: DEFAULT_ALLOWED_CAPABILITIES,\n };\n return (id) => {\n const entry = merged[id];\n if (entry === undefined) return true;\n if (typeof entry === 'function') return entry(ruleCtx);\n return evaluate(entry, ruleCtx);\n };\n}\n"],"mappings":";;;;AAeA,SAAgBA,EACd,GACA,GAC2B;CAC3B,IAAMC,IAA0BC,IAC5B;EAAE,GAAGC;EAAwB,GAAGD;CAAS,IACzCC,GACEC,IAAmB,UAAUC,IAC/BA,IACA;EACA,GAAGA;EACH,MAAMC,EAASD,EAAI,IAAI;EACvB,MAAM;EACN,qBAAqBE;CACvB;CACF,QAAQ,MAAO;EACb,IAAMC,IAAQP,EAAOQ;EAGrB,OAFID,MAAU,KAAA,IAAkB,KAC5B,OAAOA,KAAU,aAAmBA,EAAMJ,CAAO,IAC9CM,EAASF,GAAOJ,CAAO;CAChC;AACF"}
@@ -0,0 +1,54 @@
1
+ import { viewZoom as e } from "../../core/viewport/view.js";
2
+ import { resolveVisibility as t } from "./resolve.js";
3
+ import { useMemo as n } from "react";
4
+ import { useLatest as r } from "@weasel-js/react";
5
+ import { DEFAULT_ALLOWED_CAPABILITIES as i, buildRuleCtx as a } from "@weasel-js/routing";
6
+ //#region src/features/chrome-caps/useChromeCaps.ts
7
+ var o = {
8
+ alt: !1,
9
+ ctrl: !1,
10
+ meta: !1,
11
+ shift: !1
12
+ };
13
+ function s(t, n) {
14
+ let { resizable: r } = t;
15
+ return a({
16
+ focused: t.focused,
17
+ selection: n.selection,
18
+ multiActive: n.selection.length > 1,
19
+ modifiers: t.modifiers ?? o,
20
+ action: n.action,
21
+ hover: t.hover,
22
+ zoom: e(n.view),
23
+ mode: t.mode?.id ?? "normal",
24
+ allowedCapabilities: t.mode?.allowedCapabilities ?? i,
25
+ selectionResizable: r ? n.selection.every((e) => r(e)) : void 0,
26
+ editingAnchors: t.editingAnchors,
27
+ device: t.device
28
+ });
29
+ }
30
+ function c(e) {
31
+ let i = r(e);
32
+ return n(() => {
33
+ let e = (e) => {
34
+ let t = i.current;
35
+ return s({
36
+ focused: !t.getFocused || t.getFocused(),
37
+ modifiers: t.getModifiers?.(),
38
+ hover: t.getHover(),
39
+ mode: t.getMode?.(),
40
+ resizable: t.resizable,
41
+ editingAnchors: t.editingAnchors(),
42
+ device: t.device
43
+ }, e);
44
+ };
45
+ return {
46
+ ruleCtx: (t) => i.current.getMode ? e(t) : void 0,
47
+ isVisible: (n) => t(i.current.rules, e(n))
48
+ };
49
+ }, [i]);
50
+ }
51
+ //#endregion
52
+ export { s as surfaceRuleCtx, c as useChromeCaps };
53
+
54
+ //# sourceMappingURL=useChromeCaps.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useChromeCaps.js","names":["NO_MODIFIERS","surfaceRuleCtx","surface","buildRuleCtx","view","viewZoom","DEFAULT_ALLOWED_CAPABILITIES","resizable","id","useChromeCaps","live","useLatest","source","useMemo","build","now","inputs","resolveVisibility"],"sources":["../../../src/features/chrome-caps/useChromeCaps.ts"],"sourcesContent":["/**\n * The rule context a surface's chrome-visibility rules and action eligibility\n * are evaluated against, and the hook that keeps one for `<SceneCanvas>`.\n */\nimport { useMemo } from 'react';\nimport type { ActiveMode } from '@weasel-js/modes';\nimport { useLatest } from '@weasel-js/react';\nimport {\n buildRuleCtx,\n DEFAULT_ALLOWED_CAPABILITIES,\n type DeviceProfile,\n type ModifierState,\n type RuleCtx,\n} from '@weasel-js/routing';\nimport type { NodeId } from '../../core/scene/types';\nimport { viewZoom, type View } from '../../core/viewport/view';\nimport { resolveVisibility } from './resolve';\nimport type { VisibilityRules } from './types';\n\n/**\n * The part of a rule context that belongs to one view. Everything else a\n * `RuleCtx` carries — mode, capabilities, device, focus — is the surface's and\n * the same for every view drawn on it.\n */\nexport interface ViewRuleInputs {\n selection: readonly NodeId[];\n view: View;\n /** What that view's dispatcher currently has in flight. */\n action: { kind: string | null; id: string | null };\n}\n\n/** The part of a rule context that belongs to the surface. */\nexport interface SurfaceRuleInputs {\n focused: boolean;\n /** The modifier keys held. Absent means none, so `modifierHeld` never matches. */\n modifiers?: ModifierState | undefined;\n hover: NodeId | null;\n /** Absent on a surface with no mode registry, which behaves as normal mode. */\n mode: ActiveMode | undefined;\n /** Whether one node may be resized. Absent means every node may. */\n resizable: ((id: string) => boolean) | undefined;\n editingAnchors: boolean;\n device: DeviceProfile;\n}\n\nconst NO_MODIFIERS = { alt: false, ctrl: false, meta: false, shift: false };\n\n/** One view's rule context on a surface. */\nexport function surfaceRuleCtx(surface: SurfaceRuleInputs, view: ViewRuleInputs): RuleCtx {\n const { resizable } = surface;\n return buildRuleCtx({\n focused: surface.focused,\n selection: view.selection,\n multiActive: view.selection.length > 1,\n modifiers: surface.modifiers ?? NO_MODIFIERS,\n action: view.action,\n hover: surface.hover,\n zoom: viewZoom(view.view),\n mode: surface.mode?.id ?? 'normal',\n // An empty set would make every `capability:` rule false and hide the\n // chrome those rules gate.\n allowedCapabilities: surface.mode?.allowedCapabilities ?? DEFAULT_ALLOWED_CAPABILITIES,\n // Left undefined without a predicate, which `resizable:` reads as resizable.\n selectionResizable: resizable ? view.selection.every((id) => resizable(id)) : undefined,\n editingAnchors: surface.editingAnchors,\n device: surface.device,\n });\n}\n\n/** Where a surface's rule context comes from. Read at the moment a rule is\n * evaluated, never at render. */\nexport interface ChromeCapsSource {\n /** The surface's rule table, over the kit defaults. */\n rules: VisibilityRules | undefined;\n /** The active mode. Absent when no mode registry is wired. */\n getMode: (() => ActiveMode) | undefined;\n /** Absent means the surface always counts as focused. */\n getFocused: (() => boolean) | undefined;\n getHover: () => NodeId | null;\n /** Absent means no modifier key ever counts as held. */\n getModifiers?: (() => ModifierState) | undefined;\n resizable: ((id: string) => boolean) | undefined;\n editingAnchors: () => boolean;\n device: DeviceProfile;\n}\n\n/**\n * A surface's chrome-caps answers for one view. The rules are surface-wide on\n * purpose — one consumer table, one set of kit defaults — but a rule keyed on\n * selection, camera or the in-flight action answers differently per view, so\n * the caller supplies that part and both the paint gate and the dispatcher's\n * eligibility filter read the same context.\n */\nexport interface ChromeCaps {\n /** `undefined` when the surface gates nothing: no mode registry is wired. */\n ruleCtx(inputs: ViewRuleInputs): RuleCtx | undefined;\n isVisible(inputs: ViewRuleInputs): (id: string) => boolean;\n}\n\n/** The chrome-caps answers for a surface. The object keeps its identity for\n * the life of the component and reads `source` as of the last commit. */\nexport function useChromeCaps(source: ChromeCapsSource): ChromeCaps {\n const live = useLatest(source);\n return useMemo(() => {\n const build = (inputs: ViewRuleInputs): RuleCtx => {\n const now = live.current;\n return surfaceRuleCtx({\n focused: now.getFocused ? now.getFocused() : true,\n modifiers: now.getModifiers?.(),\n hover: now.getHover(),\n mode: now.getMode?.(),\n resizable: now.resizable,\n editingAnchors: now.editingAnchors(),\n device: now.device,\n }, inputs);\n };\n return {\n ruleCtx: (inputs) => (live.current.getMode ? build(inputs) : undefined),\n isVisible: (inputs) => resolveVisibility(live.current.rules, build(inputs)),\n };\n }, [live]);\n}\n"],"mappings":";;;;;;AA6CA,IAAMA,IAAe;CAAE,KAAK;CAAO,MAAM;CAAO,MAAM;CAAO,OAAO;AAAM;AAG1E,SAAgBC,EAAe,GAA4B,GAA+B;CACxF,IAAM,EAAE,iBAAcC;CACtB,OAAOC,EAAa;EAClB,SAASD,EAAQ;EACjB,WAAWE,EAAK;EAChB,aAAaA,EAAK,UAAU,SAAS;EACrC,WAAWF,EAAQ,aAAaF;EAChC,QAAQI,EAAK;EACb,OAAOF,EAAQ;EACf,MAAMG,EAASD,EAAK,IAAI;EACxB,MAAMF,EAAQ,MAAM,MAAM;EAG1B,qBAAqBA,EAAQ,MAAM,uBAAuBI;EAE1D,oBAAoBC,IAAYH,EAAK,UAAU,OAAO,MAAOG,EAAUC,CAAE,CAAC,IAAI,KAAA;EAC9E,gBAAgBN,EAAQ;EACxB,QAAQA,EAAQ;CAClB,CAAC;AACH;AAkCA,SAAgBO,EAAc,GAAsC;CAClE,IAAMC,IAAOC,EAAUC,CAAM;CAC7B,OAAOC,QAAc;EACnB,IAAMC,KAAS,MAAoC;GACjD,IAAMC,IAAML,EAAK;GACjB,OAAOT,EAAe;IACpB,SAAS,GAAI,cAAac,EAAI,WAAW;IACzC,WAAWA,EAAI,eAAe;IAC9B,OAAOA,EAAI,SAAS;IACpB,MAAMA,EAAI,UAAU;IACpB,WAAWA,EAAI;IACf,gBAAgBA,EAAI,eAAe;IACnC,QAAQA,EAAI;GACd,GAAGC,CAAM;EACX;EACA,OAAO;GACL,UAAU,MAAYN,EAAK,QAAQ,UAAUI,EAAME,CAAM,IAAI,KAAA;GAC7D,YAAY,MAAWC,EAAkBP,EAAK,QAAQ,OAAOI,EAAME,CAAM,CAAC;EAC5E;CACF,GAAG,CAACN,CAAI,CAAC;AACX"}
@@ -1,27 +1,32 @@
1
- import { useEffect as e, useRef as t } from "react";
2
- import { useLatest as n } from "@weasel-js/react";
1
+ import { useCallback as e, useEffect as t, useMemo as n, useRef as r } from "react";
2
+ import { useLatest as i } from "@weasel-js/react";
3
3
  //#region src/features/chrome-caps/useHoverTracking.ts
4
- function r(r) {
5
- let { canvasRef: i, nodeAtClientPoint: a, enabled: o = !0 } = r, s = t(null), c = n(a);
6
- return e(() => {
7
- if (!o) return;
8
- let e = i.current;
9
- if (!e) return;
4
+ function a(a) {
5
+ let { nodeAtClientPoint: o, enabled: s = !0 } = a, c = r(null), l = i(o), u = r(null), d = r(s), f = r(null), p = e(() => {
6
+ f.current?.(), f.current = null, c.current = null;
7
+ let e = u.current;
8
+ if (!e || !d.current) return;
10
9
  let t = (e) => {
11
- s.current = c.current(e.clientX, e.clientY)?.id ?? null;
10
+ c.current = l.current(e.clientX, e.clientY)?.id ?? null;
12
11
  }, n = () => {
13
- s.current = null;
12
+ c.current = null;
14
13
  };
15
- return e.addEventListener("pointermove", t), e.addEventListener("pointerleave", n), () => {
14
+ e.addEventListener("pointermove", t), e.addEventListener("pointerleave", n), f.current = () => {
16
15
  e.removeEventListener("pointermove", t), e.removeEventListener("pointerleave", n);
17
16
  };
18
- }, [
19
- i,
20
- o,
21
- c
22
- ]), () => s.current;
17
+ }, [l]);
18
+ t(() => (d.current = s, p(), () => {
19
+ f.current?.(), f.current = null, c.current = null;
20
+ }), [s, p]);
21
+ let m = e((e) => {
22
+ u.current !== e && (u.current = e, p());
23
+ }, [p]), h = e(() => c.current, []);
24
+ return n(() => ({
25
+ getHover: h,
26
+ canvasRef: m
27
+ }), [h, m]);
23
28
  }
24
29
  //#endregion
25
- export { r as useHoverTracking };
30
+ export { a as useHoverTracking };
26
31
 
27
32
  //# sourceMappingURL=useHoverTracking.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"useHoverTracking.js","names":["useHoverTracking","args","hoverRef","useRef","nodeAtRef","useLatest","nodeAtClientPoint","useEffect","enabled","c","canvasRef","onMove","onLeave"],"sources":["../../../src/features/chrome-caps/useHoverTracking.ts"],"sourcesContent":["/**\n * useHoverTracking — last-hovered NodeId for chrome-caps rules.\n *\n * Attaches a `pointermove` listener to the supplied canvas; on each move it\n * runs the supplied `nodeAtClientPoint` and caches the resulting id on a ref.\n * Cleared on `pointerleave` (pointer left the canvas → nothing is hovered).\n *\n * Returns a stable getter — call once per frame from `buildChromeCtx`.\n *\n * No re-render: the ref updates silently, and the next render that\n * reads it picks up the fresh value. Chrome-caps rules are evaluated\n * during paint, so the hover state is always read fresh.\n */\n\nimport { useEffect, useRef, type RefObject } from 'react';\nimport { useLatest } from '@weasel-js/react';\nimport type { NodeId } from '../../core/scene/types';\n\n/** Options for `useHoverTracking`. */\nexport interface UseHoverTrackingArgs {\n canvasRef: RefObject<HTMLElement | null>;\n /** Topmost id under a client point, or null. One lookup rather than a\n * client→world thunk beside a world-space picker: a screen-pixel pick\n * tolerance converts against the camera the point resolved to, and two\n * thunks are two chances to disagree about which view that is. */\n nodeAtClientPoint: (clientX: number, clientY: number) => { id: NodeId } | null;\n enabled?: boolean;\n}\n\n/** Track which node the pointer is over. Returns a getter rather than state,\n * so per-frame code can read the current value without the hover re-rendering\n * the component on every pointer move. */\nexport function useHoverTracking(args: UseHoverTrackingArgs): () => NodeId | null {\n const { canvasRef, nodeAtClientPoint, enabled = true } = args;\n const hoverRef = useRef<NodeId | null>(null);\n const nodeAtRef = useLatest(nodeAtClientPoint);\n\n useEffect(() => {\n if (!enabled) return;\n const c = canvasRef.current;\n if (!c) return;\n const onMove = (e: PointerEvent) => {\n hoverRef.current = nodeAtRef.current(e.clientX, e.clientY)?.id ?? null;\n };\n const onLeave = () => { hoverRef.current = null; };\n c.addEventListener('pointermove', onMove);\n c.addEventListener('pointerleave', onLeave);\n return () => {\n c.removeEventListener('pointermove', onMove);\n c.removeEventListener('pointerleave', onLeave);\n };\n }, [canvasRef, enabled, nodeAtRef]);\n\n return () => hoverRef.current;\n}\n"],"mappings":";;;AAgCA,SAAgBA,EAAiB,GAAiD;CAChF,IAAM,EAAE,cAAW,sBAAmB,aAAU,OAASC,GACnDC,IAAWC,EAAsB,IAAI,GACrCC,IAAYC,EAAUC,CAAiB;CAkB7C,OAhBAC,QAAgB;EACd,IAAI,CAACC,GAAS;EACd,IAAMC,IAAIC,EAAU;EACpB,IAAI,CAACD,GAAG;EACR,IAAME,KAAU,MAAoB;GAClC,EAAS,UAAUP,EAAU,QAAQ,EAAE,SAAS,EAAE,OAAO,CAAC,EAAE,MAAM;EACpE,GACMQ,UAAgB;GAAE,EAAS,UAAU;EAAM;EAGjD,OAFAH,EAAE,iBAAiB,eAAeE,CAAM,GACxCF,EAAE,iBAAiB,gBAAgBG,CAAO,SAC7B;GAEX,AADAH,EAAE,oBAAoB,eAAeE,CAAM,GAC3CF,EAAE,oBAAoB,gBAAgBG,CAAO;EAC/C;CACF,GAAG;EAACF;EAAWF;EAASJ;CAAS,CAAC,SAErBF,EAAS;AACxB"}
1
+ {"version":3,"file":"useHoverTracking.js","names":["useHoverTracking","args","hoverRef","useRef","nodeAtRef","useLatest","nodeAtClientPoint","elementRef","enabledRef","enabled","detachRef","sync","useCallback","el","onMove","onLeave","canvasRef","element","getHover","useMemo"],"sources":["../../../src/features/chrome-caps/useHoverTracking.ts"],"sourcesContent":["/** Last-hovered NodeId for chrome-caps rules. */\n\nimport { useCallback, useEffect, useMemo, useRef } from 'react';\nimport { useLatest } from '@weasel-js/react';\nimport type { NodeId } from '../../core/scene/types';\n\n/** Options for `useHoverTracking`. */\nexport interface UseHoverTrackingArgs {\n /** Topmost id under a client point, or null. */\n nodeAtClientPoint: (clientX: number, clientY: number) => { id: NodeId } | null;\n enabled?: boolean;\n}\n\n/** What `useHoverTracking` returns. Both members keep their identity. */\nexport interface HoverTracking {\n /** The node the pointer is over, or null. */\n getHover: () => NodeId | null;\n /** Hand it the element to track, or null to stop: a callback ref, so an\n * element that mounts after the hook is tracked from the moment it arrives. */\n canvasRef: (element: HTMLElement | null) => void;\n}\n\n/** Track which node the pointer is over. Returns a getter rather than state,\n * so a pointer move does not re-render the component. Cleared on\n * `pointerleave`. */\nexport function useHoverTracking(args: UseHoverTrackingArgs): HoverTracking {\n const { nodeAtClientPoint, enabled = true } = args;\n const hoverRef = useRef<NodeId | null>(null);\n const nodeAtRef = useLatest(nodeAtClientPoint);\n const elementRef = useRef<HTMLElement | null>(null);\n const enabledRef = useRef(enabled);\n const detachRef = useRef<(() => void) | null>(null);\n\n const sync = useCallback(() => {\n detachRef.current?.();\n detachRef.current = null;\n hoverRef.current = null;\n const el = elementRef.current;\n if (!el || !enabledRef.current) return;\n const onMove = (e: PointerEvent) => {\n hoverRef.current = nodeAtRef.current(e.clientX, e.clientY)?.id ?? null;\n };\n const onLeave = () => { hoverRef.current = null; };\n el.addEventListener('pointermove', onMove);\n el.addEventListener('pointerleave', onLeave);\n detachRef.current = () => {\n el.removeEventListener('pointermove', onMove);\n el.removeEventListener('pointerleave', onLeave);\n };\n }, [nodeAtRef]);\n\n useEffect(() => {\n enabledRef.current = enabled;\n sync();\n return () => {\n detachRef.current?.();\n detachRef.current = null;\n hoverRef.current = null;\n };\n }, [enabled, sync]);\n\n const canvasRef = useCallback((element: HTMLElement | null) => {\n if (elementRef.current === element) return;\n elementRef.current = element;\n sync();\n }, [sync]);\n const getHover = useCallback(() => hoverRef.current, []);\n\n return useMemo(() => ({ getHover, canvasRef }), [getHover, canvasRef]);\n}\n"],"mappings":";;;AAyBA,SAAgBA,EAAiB,GAA2C;CAC1E,IAAM,EAAE,sBAAmB,aAAU,OAASC,GACxCC,IAAWC,EAAsB,IAAI,GACrCC,IAAYC,EAAUC,CAAiB,GACvCC,IAAaJ,EAA2B,IAAI,GAC5CK,IAAaL,EAAOM,CAAO,GAC3BC,IAAYP,EAA4B,IAAI,GAE5CQ,IAAOC,QAAkB;EAG7B,AAFAF,EAAU,UAAU,GACpB,EAAU,UAAU,MACpB,EAAS,UAAU;EACnB,IAAMG,IAAKN,EAAW;EACtB,IAAI,CAACM,KAAM,CAACL,EAAW,SAAS;EAChC,IAAMM,KAAU,MAAoB;GAClC,EAAS,UAAUV,EAAU,QAAQ,EAAE,SAAS,EAAE,OAAO,CAAC,EAAE,MAAM;EACpE,GACMW,UAAgB;GAAE,EAAS,UAAU;EAAM;EAGjD,AAFAF,EAAG,iBAAiB,eAAeC,CAAM,GACzCD,EAAG,iBAAiB,gBAAgBE,CAAO,GAC3C,EAAU,gBAAgB;GAExB,AADAF,EAAG,oBAAoB,eAAeC,CAAM,GAC5CD,EAAG,oBAAoB,gBAAgBE,CAAO;EAChD;CACF,GAAG,CAACX,CAAS,CAAC;CAEd,SACE,EAAW,UAAUK,GACrBE,EAAK,SACQ;EAGX,AAFAD,EAAU,UAAU,GACpB,EAAU,UAAU,MACpB,EAAS,UAAU;CACrB,IACC,CAACD,GAASE,CAAI,CAAC;CAElB,IAAMK,IAAYJ,GAAa,MAAgC;EAC7D,AAAIL,EAAW,YAAYU,MAC3B,EAAW,UAAUA,GACrBN,EAAK;CACP,GAAG,CAACA,CAAI,CAAC,GACHO,IAAWN,QAAkBV,EAAS,SAAS,CAAC,CAAC;CAEvD,OAAOiB,SAAe;EAAE;EAAU;CAAU,IAAI,CAACD,GAAUF,CAAS,CAAC;AACvE"}
@@ -1,37 +1,46 @@
1
1
  import { dwarn as e } from "../../debug/flag.js";
2
- import { mimeMatchesGlob as t } from "@weasel-js/gestures";
2
+ import { UNKNOWN_MIME as t, mimeMatchesGlob as n } from "@weasel-js/gestures";
3
3
  //#region src/features/ingestion/contentHandlers.ts
4
- var n = [];
5
- function r(e) {
6
- return n.push(e), () => {
7
- let t = n.indexOf(e);
8
- t >= 0 && n.splice(t, 1);
4
+ var r = [];
5
+ function i(e) {
6
+ return r.push(e), () => {
7
+ let t = r.indexOf(e);
8
+ t >= 0 && r.splice(t, 1);
9
9
  };
10
10
  }
11
- function i() {
12
- return [...n].sort((e, t) => (t.priority ?? 0) - (e.priority ?? 0));
11
+ function a(e) {
12
+ return [...e].sort((e, t) => (t.priority ?? 0) - (e.priority ?? 0));
13
13
  }
14
- function a(e, n) {
14
+ function o() {
15
+ return a(r);
16
+ }
17
+ function s(e, t) {
15
18
  let { match: r } = e;
16
19
  if (typeof r == "function") try {
17
- return r(n);
20
+ return r(t);
18
21
  } catch (t) {
19
22
  return console.warn(`weasel ingest: handler "${e.id}" match predicate threw`, t), !1;
20
23
  }
21
- return (Array.isArray(r) ? r : [r]).some((e) => t(n.mime, e));
24
+ return (Array.isArray(r) ? r : [r]).some((e) => n(t.mime, e));
25
+ }
26
+ function c(e, i = r) {
27
+ return e.some((e) => e.kind === void 0 ? e.mime === t || i.some((t) => {
28
+ let r = typeof t.match == "function" ? t.types : [t.match].flat();
29
+ return r === void 0 || r.some((t) => n(e.mime, t));
30
+ }) : i.some((t) => s(t, e)));
22
31
  }
23
- async function o(t, n) {
24
- let r = t, o = [];
25
- for (let e of i()) {
26
- if (r.length === 0) break;
27
- let t = r.filter((t) => a(e, t));
28
- t.length !== 0 && (r = r.filter((e) => !t.includes(e)), o.push(Promise.resolve().then(() => e.handle(t, n)).catch((t) => {
32
+ async function l(t, n, r = {}) {
33
+ let i = t, c = [], l = r.handlers ? a(r.handlers) : o();
34
+ for (let e of l) {
35
+ if (i.length === 0) break;
36
+ let t = i.filter((t) => s(e, t));
37
+ t.length !== 0 && (i = i.filter((e) => !t.includes(e)), c.push(Promise.resolve().then(() => e.handle(t, n)).catch((t) => {
29
38
  console.warn(`weasel ingest: handler "${e.id}" threw`, t);
30
39
  })));
31
40
  }
32
- r.length > 0 && e("ingest", `no content handler matched ${r.length} item(s):`, r.map((e) => e.mime).join(", ")), await Promise.all(o);
41
+ i.length > 0 && e("ingest", `no content handler matched ${i.length} item(s):`, i.map((e) => e.mime).join(", ")), await Promise.all(c);
33
42
  }
34
43
  //#endregion
35
- export { i as getContentHandlers, r as registerContentHandler, o as runIngest };
44
+ export { c as couldClaim, o as getContentHandlers, i as registerContentHandler, l as runIngest };
36
45
 
37
46
  //# sourceMappingURL=contentHandlers.js.map