@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":"slice.js","names":["useSliceDep","depRef","useLatest","dep","useSliceDepSource","sceneRef","scene","selectionRef","selection","adapterRef","adapter","compositionRef","poseComposition","descriptorRef","poseDescriptor","sc","frame","scenePoseFrame","descriptor","AUTO_POSE_DESCRIPTOR","leaves","drawnAt","node","path","sliceablePath","drawn","drawnPose","poseDescriptorForNode","siblingIndex","pathInWorld","sel","computeSliceOps","freshNodeId","stored","storePiece","leaf","piece","ops","nextSelection","b","g","world","rotation","keepsRotation","box","baked","worldEditToStorage","dst","pose"],"sources":["../../../src/canvas/deps/slice.ts"],"sourcesContent":["/**\n * The `slice` dep `sliceAction` and `useSliceTool` commit their cuts through.\n *\n * `<SceneCanvas>` publishes `useSliceDepSource` over its own scene. A consumer\n * replaces it with `useSliceDep` (or `useDepSource('slice', …)`) from under\n * the canvas; the newest registration wins, and a canvas child registers\n * after the canvas's own.\n */\nimport { useDepSource } from '@weasel-js/routing/react';\nimport { useLatest } from '@weasel-js/react';\nimport type { SliceDep } from 'interactions/actions/depSchema';\nimport type { Scene, NodeId, Node } from 'core/scene/types';\nimport type { SelectionApi } from 'core/selection/useSelection';\nimport type { Op } from 'core/ops/types';\nimport type { Path } from '@weasel-js/geom';\nimport { AUTO_POSE_DESCRIPTOR } from 'interactions/actions/resize/autoPoseDescriptor';\nimport { poseDescriptorForNode, type PoseDescriptor } from 'core/geometry/poseDescriptor';\nimport { pathInWorld, worldEditToStorage, type PathInWorldPose } from 'features/paths/pathInWorld';\nimport { scenePoseFrame } from 'interactions/actions/poseFrame';\nimport { freshNodeId } from 'interactions/actions/defaults/freshNodeId';\nimport { computeSliceOps, type SliceLeaf } from 'interactions/actions/defaults/sliceOps';\nimport type { PoseComposition } from 'features/groups/composePose';\n\n/** Publish how a slice (knife cut) is performed, so the `slice` action can\n * run against the consumer's geometry. */\nexport function useSliceDep(dep: SliceDep): void {\n const depRef = useLatest(dep);\n\n useDepSource('slice', (): SliceDep => depRef.current);\n}\n\ninterface OpsApplier {\n applyOps(ops: Op[], label?: string): void;\n}\n\n/**\n * The kit `slice` dep: cut every leaf the cut crosses and swap it for its\n * pieces in one undoable batch.\n *\n * A leaf is cut when its `data.path` is a `Path` and `poseDescriptor` can read\n * its world pose as a box and a rotation; a leaf on a locked layer, or one\n * whose geometry derives from other nodes, is passed over. Each path is drawn\n * into world space the way the renderer draws it, so a child is cut where it\n * appears, and each piece is mapped back into the source's frame: it keeps the\n * source's rotation in its pose when the descriptor can write one\n * (`withRotation`), and has the rotation baked into its path otherwise. The\n * piece's pose is then stored in its parent's frame through `poseComposition`.\n * The pieces of a selected leaf take its place in the selection.\n */\nexport function useSliceDepSource(\n scene: Scene<unknown, string, unknown>,\n selection: SelectionApi,\n adapter: OpsApplier,\n poseComposition?: PoseComposition<unknown>,\n poseDescriptor?: PoseDescriptor<unknown>,\n): void {\n const sceneRef = useLatest(scene);\n const selectionRef = useLatest(selection);\n const adapterRef = useLatest(adapter);\n const compositionRef = useLatest(poseComposition);\n const descriptorRef = useLatest(poseDescriptor);\n\n useDepSource('slice', (): SliceDep => ({\n commit(cut) {\n const sc = sceneRef.current;\n const frame = scenePoseFrame(sc, compositionRef.current);\n const descriptor = descriptorRef.current ?? AUTO_POSE_DESCRIPTOR;\n const leaves: SliceLeaf<Node<unknown, string, unknown>>[] = [];\n const drawnAt = new Map<string, DrawnPose>();\n for (const node of sc.renderOrderNodes()) {\n const path = sliceablePath(sc, node);\n if (!path) continue;\n const drawn = drawnPose(poseDescriptorForNode(descriptor, node), frame.world(node.id));\n if (!drawn) continue;\n drawnAt.set(node.id, drawn);\n leaves.push({ node, index: siblingIndex(sc, node), worldPath: pathInWorld(path, drawn.box) });\n }\n\n const sel = selectionRef.current;\n const { ops, nextSelection } = computeSliceOps({\n leaves,\n cut,\n nextId: freshNodeId,\n selection: sel.get(),\n placePiece: (leaf, piece) => {\n const stored = storePiece(drawnAt.get(leaf.node.id)!, piece);\n return { pose: frame.local(leaf.node.id, stored.pose), path: stored.path };\n },\n });\n if (ops.length === 0) return;\n adapterRef.current.applyOps(ops, 'Slice');\n if (nextSelection) sel.set(nextSelection as NodeId[]);\n },\n }));\n}\n\n/** A leaf's world pose, and the box and rotation its path is drawn through. */\ninterface DrawnPose {\n world: unknown;\n g: PoseDescriptor<unknown>;\n box: PathInWorldPose;\n}\n\nfunction drawnPose(g: PoseDescriptor<unknown>, world: unknown): DrawnPose | null {\n const b = g.getBounds(world);\n if (!b || ![b.x, b.y, b.width, b.height].every(Number.isFinite)) return null;\n const rotation = g.getRotation?.(world) ?? 0;\n return { world, g, box: { x: b.x, y: b.y, width: b.width, height: b.height, rotation } };\n}\n\n/** A world-space piece as a world pose of the source's kind plus the path it draws. */\nfunction storePiece({ world, g, box }: DrawnPose, piece: Path): { pose: unknown; path: Path } {\n const keepsRotation = !!g.withRotation && g.supportsRotation?.(world) !== false;\n const rotation = box.rotation ?? 0;\n if (rotation !== 0 && !keepsRotation) {\n const baked = worldEditToStorage({ ...box, rotation: 0 }, piece);\n return { pose: g.fromBounds(baked.pose, world), path: baked.path };\n }\n const { pose: b, path } = worldEditToStorage(box, piece);\n const dst = { x: b.x, y: b.y, width: b.width, height: b.height };\n const pose = g.remapBounds(world, g.getBounds(world), dst);\n return { pose: rotation !== 0 ? g.withRotation!(pose, rotation) : pose, path };\n}\n\nfunction sliceablePath(scene: Scene<unknown, string, unknown>, node: Node<unknown, string, unknown>): Path | null {\n if (node.kind !== 'leaf' || node.derivePath || node.derivePose) return null;\n if (scene.isLocked(node.id)) return null;\n const path = (node.data as { path?: unknown } | null)?.path as Path | undefined;\n return path && (path.kind === 'rect' || path.kind === 'polygon') ? path : null;\n}\n\nfunction siblingIndex(scene: Scene<unknown, string, unknown>, node: Node<unknown, string, unknown>): number {\n const siblings = node.parent == null ? scene.roots : scene.childrenOf(node.parent);\n return siblings.indexOf(node.id);\n}\n"],"mappings":";;;;;;;;;AAyBA,SAAgBA,EAAY,GAAqB;CAC/C,IAAMC,IAASC,EAAUC,CAAG;CAE5B,EAAa,eAAyBF,EAAO,OAAO;AACtD;AAoBA,SAAgBG,EACd,GACA,GACA,GACA,GACA,GACM;CACN,IAAMC,IAAWH,EAAUI,CAAK,GAC1BC,IAAeL,EAAUM,CAAS,GAClCC,IAAaP,EAAUQ,CAAO,GAC9BC,IAAiBT,EAAUU,CAAe,GAC1CC,IAAgBX,EAAUY,CAAc;CAE9C,EAAa,gBAA0B,EACrC,OAAO,GAAK;EACV,IAAMC,IAAKV,EAAS,SACdW,IAAQC,EAAeF,GAAIJ,EAAe,OAAO,GACjDO,IAAaL,EAAc,WAAWM,GACtCC,IAAsD,CAAC,GACvDC,oBAAU,IAAI,IAAuB;EAC3C,KAAK,IAAMC,KAAQP,EAAG,iBAAiB,GAAG;GACxC,IAAMQ,IAAOC,EAAcT,GAAIO,CAAI;GACnC,IAAI,CAACC,GAAM;GACX,IAAME,IAAQC,EAAUC,EAAsBT,GAAYI,CAAI,GAAGN,EAAM,MAAMM,EAAK,EAAE,CAAC;GACrF,AAAKG,MACLJ,EAAQ,IAAIC,EAAK,IAAIG,CAAK,GAC1BL,EAAO,KAAK;IAAE;IAAM,OAAOQ,EAAab,GAAIO,CAAI;IAAG,WAAWO,EAAYN,GAAME,EAAM,GAAG;GAAE,CAAC;EAC9F;EAEA,IAAMK,IAAMvB,EAAa,SACnB,EAAE,QAAK,qBAAkBwB,EAAgB;GAC7C;GACA;GACA,QAAQC;GACR,WAAWF,EAAI,IAAI;GACnB,aAAa,GAAM,MAAU;IAC3B,IAAMG,IAASC,EAAWb,EAAQ,IAAIc,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CAAG;CACzD,OAAO;EAAE,MAAML,MAAa,IAAsCM,IAAlCR,EAAE,aAAcQ,GAAMN,CAAQ;EAAU;CAAK;AAC/E;AAEA,SAASlB,EAAc,GAAwC,GAAmD;CAEhH,IADIF,EAAK,SAAS,UAAUA,EAAK,cAAcA,EAAK,cAChDhB,EAAM,SAASgB,EAAK,EAAE,GAAG,OAAO;CACpC,IAAMC,IAAQD,EAAK,MAAoC;CACvD,OAAOC,MAASA,EAAK,SAAS,UAAUA,EAAK,SAAS,aAAaA,IAAO;AAC5E;AAEA,SAASK,EAAa,GAAwC,GAA8C;CAE1G,QADiBN,EAAK,UAAU,OAAOhB,EAAM,QAAQA,EAAM,WAAWgB,EAAK,MAAM,EAAA,CACjE,QAAQA,EAAK,EAAE;AACjC"}
1
+ {"version":3,"file":"slice.js","names":["useSliceDep","depRef","useLatest","dep","useSliceDepSource","sceneRef","scene","selectionRef","selection","adapterRef","adapter","descriptorRef","poseDescriptor","sc","frame","scenePoseFrame","descriptor","AUTO_POSE_DESCRIPTOR","leaves","drawnAt","node","path","sliceablePath","drawn","drawnPose","poseDescriptorForNode","siblingIndex","pathInWorld","sel","computeSliceOps","stored","storePiece","leaf","piece","ops","nextSelection","b","g","world","rotation","transform","poseLinearOf","keepsRotation","box","baked","worldEditToStorage","dst","pose"],"sources":["../../../src/canvas/deps/slice.ts"],"sourcesContent":["/**\n * The `slice` dep `sliceAction` and `useSliceTool` commit their cuts through.\n *\n * `<SceneCanvas>` publishes `useSliceDepSource` over its own scene. A consumer\n * replaces it with `useSliceDep` (or `useDepSource('slice', …)`) from under\n * the canvas; the newest registration wins, and a canvas child registers\n * after the canvas's own.\n */\nimport { useDepSource } from '@weasel-js/routing/react';\nimport { useLatest } from '@weasel-js/react';\nimport type { SliceDep } from 'interactions/actions/depSchema';\nimport type { Scene, NodeId, Node } from 'core/scene/types';\nimport type { SelectionApi } from 'core/selection/useSelection';\nimport type { Op } from 'core/ops/types';\nimport type { Path } from '@weasel-js/geom';\nimport { AUTO_POSE_DESCRIPTOR } from 'core/geometry/autoPoseDescriptor';\nimport { poseDescriptorForNode, type PoseDescriptor } from 'core/geometry/poseDescriptor';\nimport { pathInWorld, worldEditToStorage, type PathInWorldPose } from '@weasel-js/geom';\nimport { poseLinearOf } from '@weasel-js/geom';\nimport { scenePoseFrame } from 'interactions/actions/poseFrame';\nimport { computeSliceOps, type SliceLeaf } from 'interactions/actions/defaults/sliceOps';\n\n/** Publish how a slice (knife cut) is performed, so the `slice` action can\n * run against the consumer's geometry. */\nexport function useSliceDep(dep: SliceDep): void {\n const depRef = useLatest(dep);\n\n useDepSource('slice', (): SliceDep => depRef.current);\n}\n\n/** What the `slice` dep writes its batch through. An adapter satisfies it. */\nexport interface OpsApplier {\n applyOps(ops: Op[], label?: string): void;\n}\n\n/**\n * The kit `slice` dep: cut every leaf the cut crosses and swap it for its\n * pieces in one undoable batch.\n *\n * A leaf is cut when its `data.path` is a `Path` and `poseDescriptor` can read\n * its world pose as a box and a rotation; a leaf on a locked layer, or one\n * whose geometry derives from other nodes, is passed over. A piece keeps the\n * source's rotation in its pose when the descriptor can write one\n * (`withRotation`), and has the rotation baked into its path otherwise. The\n * pieces of a selected leaf take its place in the selection.\n */\nexport function useSliceDepSource(\n scene: Scene<unknown, string, unknown>,\n selection: SelectionApi,\n adapter: OpsApplier,\n poseDescriptor?: PoseDescriptor<unknown>,\n): void {\n const sceneRef = useLatest(scene);\n const selectionRef = useLatest(selection);\n const adapterRef = useLatest(adapter);\n const descriptorRef = useLatest(poseDescriptor);\n\n useDepSource('slice', (): SliceDep => ({\n commit(cut) {\n const sc = sceneRef.current;\n const frame = scenePoseFrame(sc);\n const descriptor = descriptorRef.current ?? AUTO_POSE_DESCRIPTOR;\n const leaves: SliceLeaf<Node<unknown, string, unknown>>[] = [];\n const drawnAt = new Map<string, DrawnPose>();\n for (const node of sc.renderOrderNodes()) {\n const path = sliceablePath(sc, node);\n if (!path) continue;\n const drawn = drawnPose(poseDescriptorForNode(descriptor, node), frame.world(node.id));\n if (!drawn) continue;\n drawnAt.set(node.id, drawn);\n leaves.push({ node, index: siblingIndex(sc, node), worldPath: pathInWorld(path, drawn.box) });\n }\n\n const sel = selectionRef.current;\n const { ops, nextSelection } = computeSliceOps({\n leaves,\n cut,\n nextId: () => sc.mintId(),\n selection: sel.get(),\n placePiece: (leaf, piece) => {\n const stored = storePiece(drawnAt.get(leaf.node.id)!, piece);\n return { pose: frame.local(leaf.node.id, stored.pose), path: stored.path };\n },\n });\n if (ops.length === 0) return;\n adapterRef.current.applyOps(ops, 'Slice');\n if (nextSelection) sel.set(nextSelection as NodeId[]);\n },\n }));\n}\n\n/** A leaf's world pose, and the box, rotation, and transform its path is drawn through. */\ninterface DrawnPose {\n world: unknown;\n g: PoseDescriptor<unknown>;\n box: PathInWorldPose;\n}\n\nfunction drawnPose(g: PoseDescriptor<unknown>, world: unknown): DrawnPose | null {\n const b = g.getBounds(world);\n if (!b || ![b.x, b.y, b.width, b.height].every(Number.isFinite)) return null;\n const rotation = g.getRotation?.(world) ?? 0;\n const transform = poseLinearOf(world) ?? undefined;\n return { world, g, box: { x: b.x, y: b.y, width: b.width, height: b.height, rotation, transform } };\n}\n\n/** A world-space piece as a world pose of the source's kind plus the path it draws. */\nfunction storePiece({ world, g, box }: DrawnPose, piece: Path): { pose: unknown; path: Path } {\n const keepsRotation = !!g.withRotation && g.supportsRotation?.(world) !== false;\n const rotation = box.rotation ?? 0;\n if (rotation !== 0 && !keepsRotation) {\n const baked = worldEditToStorage({ ...box, rotation: 0 }, piece);\n return { pose: g.fromBounds(baked.pose, world), path: baked.path };\n }\n const { pose: b, path } = worldEditToStorage(box, piece);\n const dst = { x: b.x, y: b.y, width: b.width, height: b.height };\n const pose = g.remapBounds(world, g.getBounds(world), dst);\n return { pose: rotation !== 0 ? g.withRotation!(pose, rotation) : pose, path };\n}\n\nfunction sliceablePath(scene: Scene<unknown, string, unknown>, node: Node<unknown, string, unknown>): Path | null {\n if (node.kind !== 'leaf' || node.derivePath || node.derivePose) return null;\n if (scene.isLocked(node.id)) return null;\n const path = (node.data as { path?: unknown } | null)?.path as Path | undefined;\n return path && (path.kind === 'rect' || path.kind === 'polygon') ? path : null;\n}\n\nfunction siblingIndex(scene: Scene<unknown, string, unknown>, node: Node<unknown, string, unknown>): number {\n const siblings = node.parent == null ? scene.roots : scene.childrenOf(node.parent);\n return siblings.indexOf(node.id);\n}\n"],"mappings":";;;;;;;;AAwBA,SAAgBA,EAAY,GAAqB;CAC/C,IAAMC,IAASC,EAAUC,CAAG;CAE5B,EAAa,eAAyBF,EAAO,OAAO;AACtD;AAkBA,SAAgBG,EACd,GACA,GACA,GACA,GACM;CACN,IAAMC,IAAWH,EAAUI,CAAK,GAC1BC,IAAeL,EAAUM,CAAS,GAClCC,IAAaP,EAAUQ,CAAO,GAC9BC,IAAgBT,EAAUU,CAAc;CAE9C,EAAa,gBAA0B,EACrC,OAAO,GAAK;EACV,IAAMC,IAAKR,EAAS,SACdS,IAAQC,EAAeF,CAAE,GACzBG,IAAaL,EAAc,WAAWM,GACtCC,IAAsD,CAAC,GACvDC,oBAAU,IAAI,IAAuB;EAC3C,KAAK,IAAMC,KAAQP,EAAG,iBAAiB,GAAG;GACxC,IAAMQ,IAAOC,EAAcT,GAAIO,CAAI;GACnC,IAAI,CAACC,GAAM;GACX,IAAME,IAAQC,EAAUC,EAAsBT,GAAYI,CAAI,GAAGN,EAAM,MAAMM,EAAK,EAAE,CAAC;GACrF,AAAKG,MACLJ,EAAQ,IAAIC,EAAK,IAAIG,CAAK,GAC1BL,EAAO,KAAK;IAAE;IAAM,OAAOQ,EAAab,GAAIO,CAAI;IAAG,WAAWO,EAAYN,GAAME,EAAM,GAAG;GAAE,CAAC;EAC9F;EAEA,IAAMK,IAAMrB,EAAa,SACnB,EAAE,QAAK,qBAAkBsB,EAAgB;GAC7C;GACA;GACA,cAAchB,EAAG,OAAO;GACxB,WAAWe,EAAI,IAAI;GACnB,aAAa,GAAM,MAAU;IAC3B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QA,EAAE;CAAO,GACzDW,IAAOV,EAAE,YAAYC,GAAOD,EAAE,UAAUC,CAAK,GAAGQ,CAAG;CACzD,OAAO;EAAE,MAAMP,MAAa,IAAsCQ,IAAlCV,EAAE,aAAcU,GAAMR,CAAQ;EAAU;CAAK;AAC/E;AAEA,SAASjB,EAAc,GAAwC,GAAmD;CAEhH,IADIF,EAAK,SAAS,UAAUA,EAAK,cAAcA,EAAK,cAChDd,EAAM,SAASc,EAAK,EAAE,GAAG,OAAO;CACpC,IAAMC,IAAQD,EAAK,MAAoC;CACvD,OAAOC,MAASA,EAAK,SAAS,UAAUA,EAAK,SAAS,aAAaA,IAAO;AAC5E;AAEA,SAASK,EAAa,GAAwC,GAA8C;CAE1G,QADiBN,EAAK,UAAU,OAAOd,EAAM,QAAQA,EAAM,WAAWc,EAAK,MAAM,EAAA,CACjE,QAAQA,EAAK,EAAE;AACjC"}
@@ -1,21 +1,22 @@
1
1
  import { useLatest as e } from "@weasel-js/react";
2
2
  import { useDepSource as t } from "@weasel-js/routing/react";
3
+ import { isTextData as n } from "@weasel-js/text";
3
4
  //#region src/canvas/deps/textEdit.ts
4
- function n(n) {
5
- let r = e(n);
5
+ function r(r) {
6
+ let i = e(r);
6
7
  t("textEdit", () => {
7
- let e = r.current;
8
+ let e = i.current;
8
9
  return {
9
10
  startEdit(e, t) {
10
11
  process.env.NODE_ENV !== "production" && console.warn("weasel textEditDep: startEdit called but no useTextEdit hook is mounted in SceneCanvas. Override the \"textEdit\" dep via useDepSource(\"textEdit\", ...) to enable in-place text editing.");
11
12
  },
12
13
  isTextNode(t) {
13
- return e.get(t)?.data?.kind === "text";
14
+ return n(e.get(t)?.data);
14
15
  }
15
16
  };
16
17
  });
17
18
  }
18
19
  //#endregion
19
- export { n as useTextEditDepSource };
20
+ export { r as useTextEditDepSource };
20
21
 
21
22
  //# sourceMappingURL=textEdit.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"textEdit.js","names":["useTextEditDepSource","sceneRef","useLatest","scene","sc","id"],"sources":["../../../src/canvas/deps/textEdit.ts"],"sourcesContent":["/**\n * `useTextEditDepSource` — wires the `textEdit` dep consumed by\n * `enterTextEditAction`. Kit-default implementation is a no-op stub for\n * `startEdit` plus a convention-based `isTextNode` predicate\n * (`data.kind === 'text'`). Consumers wanting real text editing override the\n * dep via their own `useDepSource('textEdit', ...)` sourced from a\n * `useSceneTextEdit` instance.\n */\nimport { useDepSource } from '@weasel-js/routing/react';\nimport { useLatest } from '@weasel-js/react';\nimport type { TextEditDep } from 'interactions/actions/depSchema';\nimport type { Scene, NodeId } from 'core/scene/types';\n\nexport function useTextEditDepSource(\n scene: Scene<unknown, string, unknown>,\n): void {\n const sceneRef = useLatest(scene);\n\n useDepSource('textEdit', (): TextEditDep => {\n const sc = sceneRef.current;\n return {\n startEdit(_id: string, _opts?: { caret?: number | 'all' }) {\n if (process.env.NODE_ENV !== 'production') {\n console.warn(\n 'weasel textEditDep: startEdit called but no useTextEdit hook is mounted in SceneCanvas. ' +\n 'Override the \"textEdit\" dep via useDepSource(\"textEdit\", ...) to enable in-place text editing.',\n );\n }\n },\n isTextNode(id: string) {\n const node = sc.get(id as NodeId);\n return (node?.data as { kind?: string } | null | undefined)?.kind === 'text';\n },\n };\n });\n}\n"],"mappings":";;;AAaA,SAAgBA,EACd,GACM;CACN,IAAMC,IAAWC,EAAUC,CAAK;CAEhC,EAAa,kBAA+B;EAC1C,IAAMC,IAAKH,EAAS;EACpB,OAAO;GACL,UAAU,GAAa,GAAoC;IACzD,AAAA,QAAA,IAAA,aAA6B,gBAC3B,QAAQ,KACN,4LAEF;GAEJ;GACA,WAAW,GAAY;IAErB,OADaG,EAAG,IAAIC,CACZ,CAAA,EAAM,MAA+C,SAAS;GACxE;EACF;CACF,CAAC;AACH"}
1
+ {"version":3,"file":"textEdit.js","names":["useTextEditDepSource","sceneRef","useLatest","scene","sc","isTextData","id"],"sources":["../../../src/canvas/deps/textEdit.ts"],"sourcesContent":["/**\n * `useTextEditDepSource` — wires the `textEdit` dep consumed by\n * `enterTextEditAction`. Kit-default implementation is a no-op stub for\n * `startEdit` plus an `isTextNode` that asks `isTextData`. Consumers wanting real text editing override the\n * dep via their own `useDepSource('textEdit', ...)` sourced from a\n * `useSceneTextEdit` instance.\n */\nimport { useDepSource } from '@weasel-js/routing/react';\nimport { useLatest } from '@weasel-js/react';\nimport type { TextEditDep } from 'interactions/actions/depSchema';\nimport type { Scene, NodeId } from 'core/scene/types';\nimport { isTextData } from '@weasel-js/text';\n\nexport function useTextEditDepSource(\n scene: Scene<unknown, string, unknown>,\n): void {\n const sceneRef = useLatest(scene);\n\n useDepSource('textEdit', (): TextEditDep => {\n const sc = sceneRef.current;\n return {\n startEdit(_id: string, _opts?: { caret?: number | 'all' }) {\n if (process.env.NODE_ENV !== 'production') {\n console.warn(\n 'weasel textEditDep: startEdit called but no useTextEdit hook is mounted in SceneCanvas. ' +\n 'Override the \"textEdit\" dep via useDepSource(\"textEdit\", ...) to enable in-place text editing.',\n );\n }\n },\n isTextNode(id: string) {\n return isTextData(sc.get(id as NodeId)?.data);\n },\n };\n });\n}\n"],"mappings":";;;;AAaA,SAAgBA,EACd,GACM;CACN,IAAMC,IAAWC,EAAUC,CAAK;CAEhC,EAAa,kBAA+B;EAC1C,IAAMC,IAAKH,EAAS;EACpB,OAAO;GACL,UAAU,GAAa,GAAoC;IACzD,AAAA,QAAA,IAAA,aAA6B,gBAC3B,QAAQ,KACN,4LAEF;GAEJ;GACA,WAAW,GAAY;IACrB,OAAOI,EAAWD,EAAG,IAAIE,CAAY,CAAC,EAAE,IAAI;GAC9C;EACF;CACF,CAAC;AACH"}
@@ -1 +1 @@
1
- {"version":3,"file":"view.js","names":["useViewDepSource","wiring","useLatest","hasRecenter","recenter","hasHostSize","hostSize","hasAnimation","animation","hasDecay","decay","hasLayerIsPainted","layerIsPainted","useMemo","v","to","opts","config","layerId"],"sources":["../../../src/canvas/deps/view.ts"],"sourcesContent":["/**\n * `useViewDepSource` — builds a stable `ViewApi` that reads from\n * `currentViewRef`, writes via `onViewChange`, and (when a camera runner is\n * passed) exposes animation.\n *\n * NOTE: this hook does **not** itself call `useDepSource('view', ...)` because\n * `useStandardActions` already publishes the `view` dep when it is passed in\n * its options bag. Returning the `ViewApi` here lets the registrar hand the\n * same instance to `useStandardActions` (which then registers it) without\n * having to reconstruct it inline.\n *\n * Kept as a per-dep module so the construction logic (closure refresh, ref\n * stability, etc.) has a single home next to the other dep modules.\n */\nimport { useMemo } from 'react';\nimport { useLatest } from '@weasel-js/react';\nimport type React from 'react';\nimport type { ViewApi } from 'interactions/actions/depSchema';\nimport type { ViewAnimationApi } from 'core/viewport/useViewAnimation';\nimport type { DecayLoopConfig } from 'core/viewport/useDecayLoop';\nimport type { View } from 'core/viewport/view';\n\ninterface Wiring {\n currentViewRef: React.RefObject<View>;\n onViewChange: (v: View) => void;\n recenter?: () => View | void;\n hostSize?: () => { width: number; height: number } | null;\n animation?: ViewAnimationApi;\n decay?: DecayApi;\n layerIsPainted?: (layerId: string) => boolean;\n}\n\n/** The slice of `useDecayLoop` the view dep republishes. */\nexport interface DecayApi {\n start(config: DecayLoopConfig): void;\n cancel(): void;\n}\n\nexport function useViewDepSource(\n currentViewRef: React.RefObject<View>,\n onViewChange: (v: View) => void,\n recenter?: () => View | void,\n hostSize?: () => { width: number; height: number } | null,\n animation?: ViewAnimationApi,\n decay?: DecayApi,\n layerIsPainted?: (layerId: string) => boolean,\n): ViewApi {\n // Every method reads through this, so the latest onViewChange / recenter /\n // runner is captured without the API object itself changing identity.\n const wiring = useLatest<Wiring>({\n currentViewRef, onViewChange, recenter, hostSize, animation, decay, layerIsPainted,\n });\n\n // An unwired optional member must read falsy — `viewportZoomAction` branches\n // on `view.recenter`, and a forwarder is truthy — so the identity-stable API\n // is rebuilt whenever that presence set changes.\n const hasRecenter = !!recenter;\n const hasHostSize = !!hostSize;\n const hasAnimation = !!animation;\n const hasDecay = !!decay;\n const hasLayerIsPainted = !!layerIsPainted;\n return useMemo((): ViewApi => ({\n get: () => wiring.current.currentViewRef.current,\n // Not the canvas's only cancel feed (`onViewChange` is), but a `view` dep\n // wired to something other than a `<SceneCanvas>` has only this one.\n set: (v: View) => {\n wiring.current.animation?.stopIfExternal();\n wiring.current.onViewChange(v);\n },\n ...(hasRecenter ? { recenter: () => wiring.current.recenter!() } : {}),\n ...(hasHostSize ? { hostSize: () => wiring.current.hostSize!() } : {}),\n ...(hasAnimation\n ? {\n animate: (to: View, opts?: Parameters<ViewAnimationApi['animate']>[1]) =>\n wiring.current.animation!.animate(to, opts),\n stopAnimation: () => wiring.current.animation!.stop(),\n animationTarget: () => wiring.current.animation!.target(),\n }\n : {}),\n ...(hasDecay\n ? {\n decay: (config: DecayLoopConfig) => wiring.current.decay!.start(config),\n stopDecay: () => wiring.current.decay!.cancel(),\n }\n : {}),\n ...(hasLayerIsPainted\n ? { layerIsPainted: (layerId: string) => wiring.current.layerIsPainted!(layerId) }\n : {}),\n }), [wiring, hasRecenter, hasHostSize, hasAnimation, hasDecay, hasLayerIsPainted]);\n}\n"],"mappings":";;;AAsCA,SAAgBA,EACd,GACA,GACA,GACA,GACA,GACA,GACA,GACS;CAGT,IAAMC,IAASC,EAAkB;EAC/B;EAAgB;EAAc;EAAU;EAAU;EAAW;EAAO;CACtE,CAAC,GAKKC,IAAc,CAAC,CAACC,GAChBC,IAAc,CAAC,CAACC,GAChBC,IAAe,CAAC,CAACC,GACjBC,IAAW,CAAC,CAACC,GACbC,IAAoB,CAAC,CAACC;CAC5B,OAAOC,SAAwB;EAC7B,WAAWZ,EAAO,QAAQ,eAAe;EAGzC,MAAM,MAAY;GAEhB,AADAA,EAAO,QAAQ,WAAW,eAAe,GACzCA,EAAO,QAAQ,aAAaa,CAAC;EAC/B;EACA,GAAIX,IAAc,EAAE,gBAAgBF,EAAO,QAAQ,SAAU,EAAE,IAAI,CAAC;EACpE,GAAII,IAAc,EAAE,gBAAgBJ,EAAO,QAAQ,SAAU,EAAE,IAAI,CAAC;EACpE,GAAIM,IACA;GACE,UAAU,GAAU,MAClBN,EAAO,QAAQ,UAAW,QAAQc,GAAIC,CAAI;GAC5C,qBAAqBf,EAAO,QAAQ,UAAW,KAAK;GACpD,uBAAuBA,EAAO,QAAQ,UAAW,OAAO;EAC1D,IACA,CAAC;EACL,GAAIQ,IACA;GACE,QAAQ,MAA4BR,EAAO,QAAQ,MAAO,MAAMgB,CAAM;GACtE,iBAAiBhB,EAAO,QAAQ,MAAO,OAAO;EAChD,IACA,CAAC;EACL,GAAIU,IACA,EAAE,iBAAiB,MAAoBV,EAAO,QAAQ,eAAgBiB,CAAO,EAAE,IAC/E,CAAC;CACP,IAAI;EAACjB;EAAQE;EAAaE;EAAaE;EAAcE;EAAUE;CAAiB,CAAC;AACnF"}
1
+ {"version":3,"file":"view.js","names":["useViewDepSource","wiring","useLatest","hasRecenter","recenter","hasHostSize","hostSize","hasAnimation","animation","hasDecay","decay","hasLayerIsPainted","layerIsPainted","useMemo","v","to","opts","config","layerId"],"sources":["../../../src/canvas/deps/view.ts"],"sourcesContent":["/**\n * Builds a stable `ViewApi` that reads from `currentViewRef` and writes via\n * `onViewChange`. It does **not** call `useDepSource('view', ...)` itself:\n * `useStandardActions` publishes the `view` dep it is handed.\n */\nimport { useMemo } from 'react';\nimport { useLatest } from '@weasel-js/react';\nimport type React from 'react';\nimport type { ViewApi } from 'interactions/actions/depSchema';\nimport type { ViewAnimationApi } from 'core/viewport/useViewAnimation';\nimport type { DecayLoopConfig } from 'core/viewport/useDecayLoop';\nimport type { View } from 'core/viewport/view';\n\ninterface Wiring {\n currentViewRef: React.RefObject<View>;\n onViewChange: (v: View) => void;\n recenter?: () => View | void;\n hostSize?: () => { width: number; height: number } | null;\n animation?: ViewAnimationApi;\n decay?: DecayApi;\n layerIsPainted?: (layerId: string) => boolean;\n}\n\n/** The slice of `useDecayLoop` the view dep republishes. */\nexport interface DecayApi {\n start(config: DecayLoopConfig): void;\n cancel(): void;\n}\n\nexport function useViewDepSource(\n currentViewRef: React.RefObject<View>,\n onViewChange: (v: View) => void,\n recenter?: () => View | void,\n hostSize?: () => { width: number; height: number } | null,\n animation?: ViewAnimationApi,\n decay?: DecayApi,\n layerIsPainted?: (layerId: string) => boolean,\n): ViewApi {\n // Every method reads through this, so the latest onViewChange / recenter /\n // runner is captured without the API object itself changing identity.\n const wiring = useLatest<Wiring>({\n currentViewRef, onViewChange, recenter, hostSize, animation, decay, layerIsPainted,\n });\n\n // An unwired optional member must read falsy — `viewportZoomAction` branches\n // on `view.recenter`, and a forwarder is truthy — so the identity-stable API\n // is rebuilt whenever that presence set changes.\n const hasRecenter = !!recenter;\n const hasHostSize = !!hostSize;\n const hasAnimation = !!animation;\n const hasDecay = !!decay;\n const hasLayerIsPainted = !!layerIsPainted;\n return useMemo((): ViewApi => ({\n get: () => wiring.current.currentViewRef.current,\n // Not the canvas's only cancel feed (`onViewChange` is), but a `view` dep\n // wired to something other than a `<SceneCanvas>` has only this one.\n set: (v: View) => {\n wiring.current.animation?.stopIfExternal();\n wiring.current.onViewChange(v);\n },\n ...(hasRecenter ? { recenter: () => wiring.current.recenter!() } : {}),\n ...(hasHostSize ? { hostSize: () => wiring.current.hostSize!() } : {}),\n ...(hasAnimation\n ? {\n animate: (to: View, opts?: Parameters<ViewAnimationApi['animate']>[1]) =>\n wiring.current.animation!.animate(to, opts),\n stopAnimation: () => wiring.current.animation!.stop(),\n animationTarget: () => wiring.current.animation!.target(),\n }\n : {}),\n ...(hasDecay\n ? {\n decay: (config: DecayLoopConfig) => wiring.current.decay!.start(config),\n stopDecay: () => wiring.current.decay!.cancel(),\n }\n : {}),\n ...(hasLayerIsPainted\n ? { layerIsPainted: (layerId: string) => wiring.current.layerIsPainted!(layerId) }\n : {}),\n }), [wiring, hasRecenter, hasHostSize, hasAnimation, hasDecay, hasLayerIsPainted]);\n}\n"],"mappings":";;;AA6BA,SAAgBA,EACd,GACA,GACA,GACA,GACA,GACA,GACA,GACS;CAGT,IAAMC,IAASC,EAAkB;EAC/B;EAAgB;EAAc;EAAU;EAAU;EAAW;EAAO;CACtE,CAAC,GAKKC,IAAc,CAAC,CAACC,GAChBC,IAAc,CAAC,CAACC,GAChBC,IAAe,CAAC,CAACC,GACjBC,IAAW,CAAC,CAACC,GACbC,IAAoB,CAAC,CAACC;CAC5B,OAAOC,SAAwB;EAC7B,WAAWZ,EAAO,QAAQ,eAAe;EAGzC,MAAM,MAAY;GAEhB,AADAA,EAAO,QAAQ,WAAW,eAAe,GACzCA,EAAO,QAAQ,aAAaa,CAAC;EAC/B;EACA,GAAIX,IAAc,EAAE,gBAAgBF,EAAO,QAAQ,SAAU,EAAE,IAAI,CAAC;EACpE,GAAII,IAAc,EAAE,gBAAgBJ,EAAO,QAAQ,SAAU,EAAE,IAAI,CAAC;EACpE,GAAIM,IACA;GACE,UAAU,GAAU,MAClBN,EAAO,QAAQ,UAAW,QAAQc,GAAIC,CAAI;GAC5C,qBAAqBf,EAAO,QAAQ,UAAW,KAAK;GACpD,uBAAuBA,EAAO,QAAQ,UAAW,OAAO;EAC1D,IACA,CAAC;EACL,GAAIQ,IACA;GACE,QAAQ,MAA4BR,EAAO,QAAQ,MAAO,MAAMgB,CAAM;GACtE,iBAAiBhB,EAAO,QAAQ,MAAO,OAAO;EAChD,IACA,CAAC;EACL,GAAIU,IACA,EAAE,iBAAiB,MAAoBV,EAAO,QAAQ,eAAgBiB,CAAO,EAAE,IAC/E,CAAC;CACP,IAAI;EAACjB;EAAQE;EAAaE;EAAaE;EAAcE;EAAUE;CAAiB,CAAC;AACnF"}
@@ -1,20 +1,40 @@
1
- import { resolveDerivedPath as e } from "../core/scene/derivedPath.js";
2
- import { derivedDepOf as t } from "../core/scene/effectivePose.js";
1
+ import { composeWorldPose as e, composesFrames as t } from "../core/scene/composeFrame.js";
2
+ import { createNodeMemoScope as n } from "../core/scene/nodeMemo.js";
3
+ import { resolveDerivedPath as r } from "../core/scene/derivedPath.js";
4
+ import { definesFrame as i, derivedDepOf as a, effectivePose as o } from "../core/scene/effectivePose.js";
5
+ import { asNodeId as s } from "../core/scene/types.js";
3
6
  //#region src/canvas/derivedPath.ts
4
- function n(e, n) {
5
- if (n === void 0) return (n) => t(e, n);
7
+ function c(n, r) {
8
+ let a = r ?? ((e) => o(n, e));
9
+ if (!t(n.composition)) return a;
10
+ let c = {
11
+ getPose: (e) => {
12
+ let t = n.get(s(e));
13
+ return t ? a(t) : void 0;
14
+ },
15
+ getParent: (e) => n.get(s(e))?.parent ?? null,
16
+ definesFrame: (e) => {
17
+ let t = n.get(s(e));
18
+ return t === void 0 || i(t);
19
+ }
20
+ };
21
+ return (t) => e(c, t.id, n.composition.compose);
22
+ }
23
+ function l(e, n) {
24
+ let r = m(n, t(e.composition));
25
+ if (r === void 0) return (t) => a(e, t);
6
26
  let i = {
7
- at: n,
8
- slot: s(n),
27
+ at: c(e, n),
28
+ slot: r,
9
29
  childrenOf: (t) => e.childrenOf(t),
10
30
  lookup: (t) => {
11
31
  let n = e.get(t);
12
- return n === void 0 ? void 0 : new r(n, i);
32
+ return n === void 0 ? void 0 : new u(n, i);
13
33
  }
14
34
  };
15
35
  return i.lookup;
16
36
  }
17
- var r = class {
37
+ var u = class {
18
38
  ctx;
19
39
  node;
20
40
  pose;
@@ -22,26 +42,31 @@ var r = class {
22
42
  this.ctx = t, this.node = e, this.pose = t.at(e);
23
43
  }
24
44
  get path() {
25
- return e(this.node, this.ctx.lookup, this.ctx.childrenOf, this.ctx.slot);
45
+ return r(this.node, this.ctx.lookup, this.ctx.childrenOf, this.ctx.slot);
26
46
  }
27
47
  };
28
- function i(t, r) {
29
- let i = n(t, r), a = r === void 0 ? void 0 : s(r), o = (e) => t.childrenOf(e);
30
- return (t) => e(t, i, o, a);
48
+ function d(e, t) {
49
+ return t.dependsOn !== void 0 || e.overrides.read(t.id)?.path !== void 0;
50
+ }
51
+ function f(e, n) {
52
+ let i = l(e, n), a = m(n, t(e.composition)), o = (t) => e.childrenOf(t), s = (e) => r(e, i, o, a);
53
+ return n === void 0 ? (t) => e.overrides.read(t.id)?.path ?? s(t) : s;
31
54
  }
32
- var a = /* @__PURE__ */ new WeakMap(), o = 0;
33
- function s(e) {
34
- let t = a.get(e);
35
- return t === void 0 && (t = `kit:derivedPath:toPose:${o++}`, a.set(e, t)), t;
55
+ var p = /* @__PURE__ */ new WeakMap();
56
+ function m(e, t) {
57
+ let r = t ? "world" : "local";
58
+ if (e === void 0) return r === "world" ? "kit:derivedPath:world" : void 0;
59
+ let i = p.get(e);
60
+ return i === void 0 && (i = {}, p.set(e, i)), i[r] ??= n();
36
61
  }
37
- function c(e, t, n) {
38
- let r = i(e, n);
39
- return (e, n, i, a) => e.dependsOn === void 0 ? t(e, n, i, a) : t(e, n, i, {
40
- ...a,
41
- derivedPath: r(e)
62
+ function h(e, t, n) {
63
+ let r = f(e, n);
64
+ return (i, a, o, s) => (n === void 0 ? !d(e, i) : i.dependsOn === void 0) ? t(i, a, o, s) : t(i, a, o, {
65
+ ...s,
66
+ derivedPath: r(i)
42
67
  });
43
68
  }
44
69
  //#endregion
45
- export { e as resolveDerivedPath, n as sceneDepLookup, i as sceneDerivedPathOf, c as withDerivedPaths };
70
+ export { r as resolveDerivedPath, l as sceneDepLookup, f as sceneDerivedPathOf, c as scenePaintedPoseOf, d as showsComputedPath, h as withDerivedPaths };
46
71
 
47
72
  //# sourceMappingURL=derivedPath.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"derivedPath.js","names":["sceneDepLookup","toPose","derivedDepOf","scene","id","ctx","memoSlotFor","node","SlotDep","posed","resolveDerivedPath","sceneDerivedPathOf","depOf","slot","childrenOf","toPoseSlots","nextToPoseSlot","withDerivedPaths","derivedPathOf","drawOne","pose","view"],"sources":["../../src/canvas/derivedPath.ts"],"sourcesContent":["/**\n * The render walk's half of derived paths: resolving one against a scene, and\n * handing it to the painter.\n *\n * The resolver itself lives in `core/scene/derivedPath.ts`, beside\n * `derivedPose` — a *pose* can derive from a dependency's path, so\n * `effectivePose` has to be able to reach it.\n */\nimport type { DerivedDep, Node, NodeId, Scene } from 'core/scene/types';\nimport type { Path } from '@weasel-js/geom';\nimport { derivedDepOf } from 'core/scene/effectivePose';\nimport { resolveDerivedPath } from 'core/scene/derivedPath';\nimport type { SceneViewDrawOne } from './NodeShape';\n\nexport { resolveDerivedPath } from 'core/scene/derivedPath';\n\n/**\n * `(id) => that node, the pose it is painted at, and the path it derives` —\n * resolved against the scene, so a dependency that is itself derived resolves\n * before it is read.\n *\n * `Scene` stores absolute poses and the render walks hand `getPose` straight to\n * `drawOne`, composing nothing, so this has to read exactly what the render\n * adapters read: a derived edge is drawn from these coordinates and must meet\n * the nodes it connects. A slot's `toPose` replaces that read, so `toPose`\n * replaces it here too.\n */\nexport function sceneDepLookup<TData, TLayer extends string, TPose>(\n scene: Scene<TData, TLayer, TPose>,\n toPose?: (node: Node<TData, TLayer, TPose>) => TPose,\n): (id: NodeId) => DerivedDep<TPose> | undefined {\n if (toPose === undefined) return (id) => derivedDepOf(scene, id);\n const ctx: SlotLookup<TPose> = {\n at: toPose as (node: unknown) => TPose,\n slot: memoSlotFor(toPose),\n childrenOf: (id: NodeId) => scene.childrenOf(id),\n lookup: (id: NodeId) => {\n const node = scene.get(id);\n return node === undefined ? undefined : new SlotDep(node, ctx);\n },\n };\n return ctx.lookup;\n}\n\ninterface SlotLookup<TPose> {\n at: (node: unknown) => TPose;\n slot: string;\n childrenOf: (id: NodeId) => readonly NodeId[];\n lookup: (id: NodeId) => DerivedDep<TPose> | undefined;\n}\n\n/** A class, not an object literal with a `get path()` — see `SceneDep` in\n * `core/scene/effectivePose.ts` for why. */\nclass SlotDep<TPose> implements DerivedDep<TPose> {\n readonly node: Node<unknown, string, TPose>;\n readonly pose: TPose;\n\n constructor(posed: unknown, private readonly ctx: SlotLookup<TPose>) {\n this.node = posed as Node<unknown, string, TPose>;\n this.pose = ctx.at(posed);\n }\n\n get path(): Path | null {\n return resolveDerivedPath(\n this.node as never, this.ctx.lookup, this.ctx.childrenOf, this.ctx.slot,\n );\n }\n}\n\n/** `(node) => the path it derives`, read through {@link sceneDepLookup}. */\nexport function sceneDerivedPathOf<TData, TLayer extends string, TPose>(\n scene: Scene<TData, TLayer, TPose>,\n toPose?: (node: Node<TData, TLayer, TPose>) => TPose,\n): (node: Node<TData, TLayer, TPose>) => Path | null {\n const depOf = sceneDepLookup(scene, toPose);\n const slot = toPose === undefined ? undefined : memoSlotFor(toPose);\n const childrenOf = (id: NodeId): readonly NodeId[] => scene.childrenOf(id);\n return (node) => resolveDerivedPath(node, depOf, childrenOf, slot);\n}\n\nconst toPoseSlots = new WeakMap<object, string>();\nlet nextToPoseSlot = 0;\n\n/** One memo slot per `toPose`: two slots painting one scene at different\n * poses must not serve each other's paths. */\nfunction memoSlotFor(toPose: object): string {\n let slot = toPoseSlots.get(toPose);\n if (slot === undefined) {\n slot = `kit:derivedPath:toPose:${nextToPoseSlot++}`;\n toPoseSlots.set(toPose, slot);\n }\n return slot;\n}\n\n/**\n * Wrap a `drawOne` so a node that derives its geometry arrives at the painter\n * with the resolved path. The painter has no scene handle and so cannot read\n * the dependencies' poses itself; both scene walks wrap here instead.\n *\n * A node that derives nothing passes the caller's `ctx` through untouched —\n * this runs per node per frame, and an added `{ derivedPath: null }` would be\n * an allocation per node for a field no painter reads.\n */\nexport function withDerivedPaths<TData, TLayer extends string, TPose>(\n scene: Scene<TData, TLayer, TPose>,\n drawOne: SceneViewDrawOne<TData, TLayer, TPose>,\n toPose?: (node: Node<TData, TLayer, TPose>) => TPose,\n): SceneViewDrawOne<TData, TLayer, TPose> {\n const derivedPathOf = sceneDerivedPathOf(scene, toPose);\n return (node, pose, view, ctx) => {\n if (node.dependsOn === undefined) return drawOne(node, pose, view, ctx);\n return drawOne(node, pose, view, { ...ctx, derivedPath: derivedPathOf(node) });\n };\n}\n"],"mappings":";;;AA2BA,SAAgBA,EACd,GACA,GAC+C;CAC/C,IAAIC,MAAW,KAAA,GAAW,QAAQ,MAAOC,EAAaC,GAAOC,CAAE;CAC/D,IA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X,CAAI;CAAE,CAAC;AAEjF"}
1
+ {"version":3,"file":"derivedPath.js","names":["scenePaintedPoseOf","local","toPose","effectivePose","scene","node","composesFrames","chain","n","asNodeId","id","definesFrame","composeWorldPose","sceneDepLookup","slot","memoSlotFor","derivedDepOf","ctx","SlotDep","posed","resolveDerivedPath","showsComputedPath","sceneDerivedPathOf","depOf","childrenOf","derived","toPoseScopes","frame","composes","scopes","createNodeMemoScope","withDerivedPaths","derivedPathOf","drawOne","pose","view"],"sources":["../../src/canvas/derivedPath.ts"],"sourcesContent":["/**\n * The render walk's half of derived paths: resolving one against a scene, and\n * handing it to the painter.\n *\n * The resolver itself lives in `core/scene/derivedPath.ts`, beside\n * `derivedPose` — a *pose* can derive from a dependency's path, so\n * `effectivePose` has to be able to reach it.\n */\nimport type { DerivedDep, Node, NodeId, Scene } from 'core/scene/types';\nimport type { Path } from '@weasel-js/geom';\nimport { asNodeId } from 'core/scene/types';\nimport { definesFrame, derivedDepOf, effectivePose } from 'core/scene/effectivePose';\nimport { composesFrames, composeWorldPose, type PoseAdapter } from 'core/scene/composeFrame';\nimport { resolveDerivedPath } from 'core/scene/derivedPath';\nimport { createNodeMemoScope, type NodeMemoScope } from 'core/scene/nodeMemo';\nimport type { SceneViewDrawOne } from './NodeShape';\n\nexport { resolveDerivedPath } from 'core/scene/derivedPath';\n\n/**\n * `(node) => the pose it is painted at`: the slot's `toPose` if it has one,\n * else the scene's effective pose, folded through the parent chain when\n * the scene's composition makes a stored pose local to its container.\n */\nexport function scenePaintedPoseOf<TData, TLayer extends string, TPose>(\n scene: Scene<TData, TLayer, TPose>,\n toPose?: (node: Node<TData, TLayer, TPose>) => TPose,\n): (node: Node<TData, TLayer, TPose>) => TPose {\n const local = toPose ?? ((node: Node<TData, TLayer, TPose>) => effectivePose(scene, node));\n if (!composesFrames(scene.composition)) return local;\n const chain: PoseAdapter<TPose> = {\n getPose: (id) => {\n const n = scene.get(asNodeId(id));\n return n ? local(n) : (undefined as unknown as TPose);\n },\n getParent: (id) => scene.get(asNodeId(id))?.parent ?? null,\n definesFrame: (id) => {\n const n = scene.get(asNodeId(id));\n return n === undefined || definesFrame(n);\n },\n };\n return (node) => composeWorldPose(chain, node.id, scene.composition.compose);\n}\n\n/**\n * `(id) => that node, the pose it is painted at, and the path it derives` —\n * resolved against the scene, so a dependency that is itself derived resolves\n * before it is read.\n *\n * A derived edge is drawn from these coordinates and must meet the nodes it\n * connects, so this reads the pose each one is painted at: see\n * {@link scenePaintedPoseOf}.\n */\nexport function sceneDepLookup<TData, TLayer extends string, TPose>(\n scene: Scene<TData, TLayer, TPose>,\n toPose?: (node: Node<TData, TLayer, TPose>) => TPose,\n): (id: NodeId) => DerivedDep<TPose> | undefined {\n const slot = memoSlotFor(toPose, composesFrames(scene.composition));\n if (slot === undefined) return (id) => derivedDepOf(scene, id);\n const ctx: SlotLookup<TPose> = {\n at: scenePaintedPoseOf(scene, toPose) as (node: unknown) => TPose,\n slot,\n childrenOf: (id: NodeId) => scene.childrenOf(id),\n lookup: (id: NodeId) => {\n const node = scene.get(id);\n return node === undefined ? undefined : new SlotDep(node, ctx);\n },\n };\n return ctx.lookup;\n}\n\ninterface SlotLookup<TPose> {\n at: (node: unknown) => TPose;\n slot: string | NodeMemoScope;\n childrenOf: (id: NodeId) => readonly NodeId[];\n lookup: (id: NodeId) => DerivedDep<TPose> | undefined;\n}\n\n/** A class, not an object literal with a `get path()` — see `SceneDep` in\n * `core/scene/effectivePose.ts` for why. */\nclass SlotDep<TPose> implements DerivedDep<TPose> {\n readonly node: Node<unknown, string, TPose>;\n readonly pose: TPose;\n\n constructor(posed: unknown, private readonly ctx: SlotLookup<TPose>) {\n this.node = posed as Node<unknown, string, TPose>;\n this.pose = ctx.at(posed);\n }\n\n get path(): Path | null {\n return resolveDerivedPath(\n this.node as never, this.ctx.lookup, this.ctx.childrenOf, this.ctx.slot,\n );\n }\n}\n\n/** Whether something outside `node`'s data says what path it shows: it derives one, or a\n * pose override carries one. The gate both scene walks check before resolving a path. */\nexport function showsComputedPath<TData, TLayer extends string, TPose>(\n scene: Scene<TData, TLayer, TPose>,\n node: { id: NodeId; dependsOn?: readonly NodeId[] | 'children' },\n): boolean {\n return node.dependsOn !== undefined || scene.overrides.read(node.id)?.path !== undefined;\n}\n\n/**\n * `(node) => the path it shows in place of its data's`: a pose override's `path`, else the\n * one it derives, read through {@link sceneDepLookup}.\n *\n * An override path is in the scene's own frame, so a reader painting through a `toPose` is\n * answered the derived path alone.\n */\nexport function sceneDerivedPathOf<TData, TLayer extends string, TPose>(\n scene: Scene<TData, TLayer, TPose>,\n toPose?: (node: Node<TData, TLayer, TPose>) => TPose,\n): (node: Node<TData, TLayer, TPose>) => Path | null {\n const depOf = sceneDepLookup(scene, toPose);\n const slot = memoSlotFor(toPose, composesFrames(scene.composition));\n const childrenOf = (id: NodeId): readonly NodeId[] => scene.childrenOf(id);\n const derived = (node: Node<TData, TLayer, TPose>): Path | null =>\n resolveDerivedPath(node, depOf, childrenOf, slot);\n if (toPose !== undefined) return derived;\n return (node) => scene.overrides.read(node.id)?.path ?? derived(node);\n}\n\nconst toPoseScopes = new WeakMap<object, { local?: NodeMemoScope; world?: NodeMemoScope }>();\n\n/** Where one way of reading poses memoizes its paths, or `undefined` for the\n * scene's own slot: two readers painting one scene at different poses must\n * not serve each other's paths. Every reader composing stored poses shares a\n * slot; a `toPose` gets a scope that is collected with the function. */\nfunction memoSlotFor(\n toPose: object | undefined,\n composes: boolean,\n): string | NodeMemoScope | undefined {\n const frame = composes ? 'world' : 'local';\n if (toPose === undefined) return frame === 'world' ? 'kit:derivedPath:world' : undefined;\n let scopes = toPoseScopes.get(toPose);\n if (scopes === undefined) {\n scopes = {};\n toPoseScopes.set(toPose, scopes);\n }\n return (scopes[frame] ??= createNodeMemoScope());\n}\n\n/**\n * Wrap a `drawOne` so a node that derives its geometry, or whose pose override\n * carries a path, arrives at the painter with the resolved path. The painter has no scene handle and so cannot read\n * the dependencies' poses itself; both scene walks wrap here instead.\n *\n * A node that derives nothing passes the caller's `ctx` through untouched —\n * this runs per node per frame, and an added `{ derivedPath: null }` would be\n * an allocation per node for a field no painter reads.\n */\nexport function withDerivedPaths<TData, TLayer extends string, TPose>(\n scene: Scene<TData, TLayer, TPose>,\n drawOne: SceneViewDrawOne<TData, TLayer, TPose>,\n toPose?: (node: Node<TData, TLayer, TPose>) => TPose,\n): SceneViewDrawOne<TData, TLayer, TPose> {\n const derivedPathOf = sceneDerivedPathOf(scene, toPose);\n return (node, pose, view, ctx) => {\n if (toPose !== undefined ? node.dependsOn === undefined : !showsComputedPath(scene, node)) {\n return drawOne(node, pose, view, ctx);\n }\n return drawOne(node, pose, view, { ...ctx, derivedPath: derivedPathOf(node) });\n };\n}\n"],"mappings":";;;;;;AAwBA,SAAgBA,EACd,GACA,GAC6C;CAC7C,IAAMC,IAAQC,OAAY,MAAqCC,EAAcC,GAAOC,CAAI;CACxF,IAAI,CAACC,EAAeF,EAAM,WAAW,GAAG,OAAOH;CAC/C,IAAMM,IAA4B;EAChC,UAAU,MAAO;GACf,IAAMC,IAAIJ,EAAM,IAAIK,EAASC,CAAE,CAAC;GAChC,OAAOF,IAAIP,EAAMO,CAAC,IAAK,KAAA;EACzB;EACA,YAAY,MAAOJ,EAAM,IAAIK,EAASC,CAAE,CAAC,CAAC,EAAE,UAAU;EACtD,eAAe,MAAO;GACpB,IAAMF,IAAIJ,EAAM,IAAIK,EAASC,CAAE,CAAC;GAChC,OAAOF,MAAM,KAAA,KAAaG,EAAaH,CAAC;EAC1C;CACF;CACA,QAAQ,MAASI,EAAiBL,GAAOF,EAAK,IAAID,EAAM,YAAY,OAAO;AAC7E;AAWA,SAAgBS,EACd,GACA,GAC+C;CAC/C,IAAMC,IAAOC,EAAYb,GAAQI,EAAeF,EAAM,WAAW,CAAC;CAClE,IAAIU,MAAS,KAAA,GAAW,QAAQ,MAAOE,EAAaZ,GAAOM,CAAE;CAC7D,IAAMO,IAAyB;EAC7B,IAAIjB,EAAmBI,GAAOF,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,GAAQ2B,CAAM,IAEzB,EAAOF,OAAWG,EAAoB;AAChD;AAWA,SAAgBC,EACd,GACA,GACA,GACwC;CACxC,IAAMC,IAAgBV,EAAmBlB,GAAOF,CAAM;CACtD,QAAQ,GAAM,GAAM,GAAM,OACpBA,MAAW,KAAA,IAA2C,CAACmB,EAAkBjB,GAAOC,CAAI,IAA7DA,EAAK,cAAc,KAAA,KACrC4B,EAAQ5B,GAAM6B,GAAMC,GAAMlB,CAAG,IAE/BgB,EAAQ5B,GAAM6B,GAAMC,GAAM;EAAE,GAAGlB;EAAK,aAAae,EAAc3B,CAAI;CAAE,CAAC;AAEjF"}
@@ -10,13 +10,17 @@ function n(t) {
10
10
  return e(t, "getIsVisible")?.() ?? null;
11
11
  }
12
12
  function r(t) {
13
- return e(t, "getPreviewSources")?.() ?? a;
13
+ return e(t, "getPreviewSources")?.() ?? o;
14
14
  }
15
15
  function i(t) {
16
- return e(t, "getGestureOverlays")?.() ?? o;
16
+ return e(t, "getGestureOverlays")?.() ?? s;
17
17
  }
18
- var a = [], o = [];
18
+ function a(e) {
19
+ let t = e?.getDebug;
20
+ return typeof t == "function" ? t() : null;
21
+ }
22
+ var o = [], s = [];
19
23
  //#endregion
20
- export { t as chromeStateFrom, i as gestureOverlaysFrom, n as isVisibleFrom, r as previewSourcesFrom };
24
+ export { t as chromeStateFrom, a as debugSinkFrom, i as gestureOverlaysFrom, n as isVisibleFrom, r as previewSourcesFrom };
21
25
 
22
26
  //# sourceMappingURL=drawEnvelope.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"drawEnvelope.js","names":["thunk","maybe","data","key","chromeStateFrom","isVisibleFrom","previewSourcesFrom","EMPTY_SOURCES","gestureOverlaysFrom","EMPTY_OVERLAYS"],"sources":["../../src/canvas/drawEnvelope.ts"],"sourcesContent":["/**\n * Reading a layer's draw envelope.\n *\n * Every `RenderLayer.draw` receives the drawing view's {@link CanvasHelpers} as\n * its `data` argument, and `<CanvasView>` overlays its own half before handing\n * the stack to a second camera. A layer that answers from a construction\n * closure instead therefore answers for view zero in every view — so these\n * lookups exist to make the envelope the easy source.\n *\n * A layer drawn by a bare consumer may get plain data instead, which is why\n * each reader has an \"unwired\" answer rather than throwing.\n */\nimport type { ChromeState } from 'core/selection/chromeState';\nimport type { OngoingOverlay } from '@weasel-js/routing';\nimport type { GesturePreviewSource } from './gestureBounds';\nimport type { CanvasViewHelpers } from './useViewHelpers';\n\ntype PartialEnvelope = Partial<CanvasViewHelpers<unknown>>;\n\nfunction thunk<K extends keyof CanvasViewHelpers<unknown>>(\n data: unknown,\n key: K,\n): CanvasViewHelpers<unknown>[K] | undefined {\n const maybe = data as PartialEnvelope | null | undefined;\n return typeof maybe?.[key] === 'function' ? maybe[key] : undefined;\n}\n\n/** This view's chrome state, or `null` when the caller passed plain data. */\nexport function chromeStateFrom(data: unknown): ChromeState | null {\n return thunk(data, 'getChromeState')?.() ?? null;\n}\n\n/** This view's chrome-caps predicate, or `null` when the caller passed plain\n * data — the layer then paints unconditionally. */\nexport function isVisibleFrom(data: unknown): ((id: string) => boolean) | null {\n return thunk(data, 'getIsVisible')?.() ?? null;\n}\n\n/** This view's in-flight preview surfaces, in resolution order. Empty when\n * nothing is in flight and when the caller passed plain data. */\nexport function previewSourcesFrom(data: unknown): readonly GesturePreviewSource[] {\n return thunk(data, 'getPreviewSources')?.() ?? EMPTY_SOURCES;\n}\n\n/** The overlay shapes this view's in-flight handles publish. */\nexport function gestureOverlaysFrom(data: unknown): readonly OngoingOverlay[] {\n return thunk(data, 'getGestureOverlays')?.() ?? EMPTY_OVERLAYS;\n}\n\n/** First non-null `previewPose(id)` across `sources`, or `null`. */\nexport function previewPoseIn(\n sources: readonly GesturePreviewSource[],\n id: string,\n): unknown {\n for (const s of sources) {\n const p = s.previewPose?.(id);\n if (p != null) return p;\n }\n return null;\n}\n\n/** First non-null `previewData(id)` across `sources`, or `null`. */\nexport function previewDataIn(\n sources: readonly GesturePreviewSource[],\n id: string,\n): unknown {\n for (const s of sources) {\n const d = s.previewData?.(id);\n if (d != null) return d;\n }\n return null;\n}\n\nconst EMPTY_SOURCES: readonly GesturePreviewSource[] = [];\nconst EMPTY_OVERLAYS: readonly OngoingOverlay[] = [];\n"],"mappings":";AAmBA,SAASA,EACP,GACA,GAC2C;CAC3C,IAAMC,IAAQC;CACd,OAAO,OAAOD,IAAQE,MAAS,aAAaF,EAAME,KAAO,KAAA;AAC3D;AAGA,SAAgBC,EAAgB,GAAmC;CACjE,OAAOJ,EAAME,GAAM,gBAAgB,CAAC,GAAG,KAAK;AAC9C;AAIA,SAAgBG,EAAc,GAAiD;CAC7E,OAAOL,EAAME,GAAM,cAAc,CAAC,GAAG,KAAK;AAC5C;AAIA,SAAgBI,EAAmB,GAAgD;CACjF,OAAON,EAAME,GAAM,mBAAmB,CAAC,GAAG,KAAKK;AACjD;AAGA,SAAgBC,EAAoB,GAA0C;CAC5E,OAAOR,EAAME,GAAM,oBAAoB,CAAC,GAAG,KAAKO;AAClD;AA0BA,IAAMF,IAAiD,CAAC,GAClDE,IAA4C,CAAC"}
1
+ {"version":3,"file":"drawEnvelope.js","names":["thunk","maybe","data","key","chromeStateFrom","isVisibleFrom","previewSourcesFrom","EMPTY_SOURCES","gestureOverlaysFrom","EMPTY_OVERLAYS","debugSinkFrom","getDebug"],"sources":["../../src/canvas/drawEnvelope.ts"],"sourcesContent":["/**\n * Reading a layer's draw envelope.\n *\n * Every `RenderLayer.draw` receives the drawing view's `CanvasHelpers` as its\n * `data` argument. A layer that answers from a construction closure instead\n * answers for view zero in every view. A layer drawn by a bare consumer may\n * get plain data, so each reader has an \"unwired\" answer rather than throwing.\n */\nimport type { ChromeState } from 'core/selection/chromeState';\nimport type { OngoingOverlay } from '@weasel-js/routing';\nimport type { GesturePreviewSource } from './gestureBounds';\nimport type { DebugSink } from '../debug/types';\nimport type { CanvasSurfaceHelpers, CanvasViewHelpers } from './useViewHelpers';\n\ntype PartialEnvelope = Partial<CanvasViewHelpers<unknown>>;\n\nfunction thunk<K extends keyof CanvasViewHelpers<unknown>>(\n data: unknown,\n key: K,\n): CanvasViewHelpers<unknown>[K] | undefined {\n const maybe = data as PartialEnvelope | null | undefined;\n return typeof maybe?.[key] === 'function' ? maybe[key] : undefined;\n}\n\n/** This view's chrome state, or `null` when the caller passed plain data. */\nexport function chromeStateFrom(data: unknown): ChromeState | null {\n return thunk(data, 'getChromeState')?.() ?? null;\n}\n\n/** This view's chrome-caps predicate, or `null` when the caller passed plain\n * data — the layer then paints unconditionally. */\nexport function isVisibleFrom(data: unknown): ((id: string) => boolean) | null {\n return thunk(data, 'getIsVisible')?.() ?? null;\n}\n\n/** This view's in-flight preview surfaces, in resolution order. Empty when\n * nothing is in flight and when the caller passed plain data. */\nexport function previewSourcesFrom(data: unknown): readonly GesturePreviewSource[] {\n return thunk(data, 'getPreviewSources')?.() ?? EMPTY_SOURCES;\n}\n\n/** The overlay shapes this view's in-flight handles publish. */\nexport function gestureOverlaysFrom(data: unknown): readonly OngoingOverlay[] {\n return thunk(data, 'getGestureOverlays')?.() ?? EMPTY_OVERLAYS;\n}\n\n/** The surface's debug sink, or `null` when debugging is off and when the\n * caller passed plain data. */\nexport function debugSinkFrom(data: unknown): DebugSink | null {\n const getDebug = (data as Partial<CanvasSurfaceHelpers> | null | undefined)?.getDebug;\n return typeof getDebug === 'function' ? getDebug() : null;\n}\n\n/** First non-null `previewPose(id)` across `sources`, or `null`. */\nexport function previewPoseIn(\n sources: readonly GesturePreviewSource[],\n id: string,\n): unknown {\n for (const s of sources) {\n const p = s.previewPose?.(id);\n if (p != null) return p;\n }\n return null;\n}\n\n/** First non-null `previewData(id)` across `sources`, or `null`. */\nexport function previewDataIn(\n sources: readonly GesturePreviewSource[],\n id: string,\n): unknown {\n for (const s of sources) {\n const d = s.previewData?.(id);\n if (d != null) return d;\n }\n return null;\n}\n\nconst EMPTY_SOURCES: readonly GesturePreviewSource[] = [];\nconst EMPTY_OVERLAYS: readonly OngoingOverlay[] = [];\n"],"mappings":";AAgBA,SAASA,EACP,GACA,GAC2C;CAC3C,IAAMC,IAAQC;CACd,OAAO,OAAOD,IAAQE,MAAS,aAAaF,EAAME,KAAO,KAAA;AAC3D;AAGA,SAAgBC,EAAgB,GAAmC;CACjE,OAAOJ,EAAME,GAAM,gBAAgB,CAAC,GAAG,KAAK;AAC9C;AAIA,SAAgBG,EAAc,GAAiD;CAC7E,OAAOL,EAAME,GAAM,cAAc,CAAC,GAAG,KAAK;AAC5C;AAIA,SAAgBI,EAAmB,GAAgD;CACjF,OAAON,EAAME,GAAM,mBAAmB,CAAC,GAAG,KAAKK;AACjD;AAGA,SAAgBC,EAAoB,GAA0C;CAC5E,OAAOR,EAAME,GAAM,oBAAoB,CAAC,GAAG,KAAKO;AAClD;AAIA,SAAgBC,EAAc,GAAiC;CAC7D,IAAMC,IAAYT,GAA2D;CAC7E,OAAO,OAAOS,KAAa,aAAaA,EAAS,IAAI;AACvD;AA0BA,IAAMJ,IAAiD,CAAC,GAClDE,IAA4C,CAAC"}
@@ -1,14 +1,10 @@
1
1
  //#region src/canvas/getNodeAtPoint.ts
2
2
  function e(e, t) {
3
3
  return (n, r, i) => {
4
- let a = e(n, r, i), o = Array.isArray(a) ? a[0] ?? null : a;
5
- if (o == null) return null;
6
- let s = t?.(o) ?? null;
7
- return {
8
- id: o,
9
- kind: s?.kind ?? "unknown",
10
- pose: s?.pose,
11
- data: s?.data ?? { id: o }
4
+ let a = e(n, r, i);
5
+ return a == null ? null : {
6
+ id: a,
7
+ kind: t?.(a)?.kind ?? "unknown"
12
8
  };
13
9
  };
14
10
  }
@@ -1 +1 @@
1
- {"version":3,"file":"getNodeAtPoint.js","names":["makeGetNodeAtPoint","raw","pickEvery","wx","wy","view","id","resolved","nodeResolver"],"sources":["../../src/canvas/getNodeAtPoint.ts"],"sourcesContent":["/**\n * Stable helper for synthesizing the dispatcher's `getNodeAtPoint` callback\n * from a `pickEvery` function and an optional per-id node resolver.\n *\n * Extracted from `Canvas.tsx`'s inline `__setGetNodeAtPoint` synthesizer so\n * that `SceneCanvas` (and any other scene-aware wrapper) can build the\n * function externally and hand it to `<Canvas>` as a prop. The caller supplies\n * a `nodeResolver` that derives each hit's kind/pose/data (SceneCanvas\n * classifies the node's `data` via its routing registry).\n */\n\nimport type { PickView } from './SceneCanvas/useSceneSelectTool';\n\n/** The hit record returned by a `getNodeAtPoint` function. Matches the\n * shape expected by `ToolsDispatcher.__setGetNodeAtPoint`. */\nexport interface NodeAtPointHit {\n id: string;\n kind: string;\n pose: unknown;\n data: unknown;\n meta?: Record<string, unknown>;\n}\n\n/**\n * Resolves per-id metadata for a node (kind, pose, data). When absent,\n * kind falls back to `'unknown'` and pose/data fall back to trivial values.\n */\nexport type NodeResolver = (id: string) => { kind: string; pose: unknown; data: unknown } | null;\n\n/**\n * Build a stable `getNodeAtPoint(wx, wy)` function suitable for passing to\n * the tool dispatcher via `Canvas`'s `getNodeAtPoint` prop.\n *\n * Algorithm matches the inline synthesizer in Canvas.tsx exactly:\n * - `pickEvery` returns `string | string[] | null`\n * - When an array, the **first** element is the topmost id (front-to-back order)\n * - `nodeResolver` is called for the topmost id to get kind/pose/data\n * - When `nodeResolver` is absent or returns null, kind defaults to `'unknown'`,\n * pose to `undefined`, data to `{ id }`\n *\n * @param pickEvery Raw hit-test function. Same signature as the Canvas prop.\n * @param nodeResolver Optional per-id resolver. SceneCanvas builds this from its adapter.\n */\nexport function makeGetNodeAtPoint(\n pickEvery: (wx: number, wy: number, view?: PickView | null) => string | string[] | null,\n nodeResolver?: NodeResolver,\n): (wx: number, wy: number, view?: PickView | null) => NodeAtPointHit | null {\n return (wx: number, wy: number, view?: PickView | null): NodeAtPointHit | null => {\n const raw = pickEvery(wx, wy, view);\n // Normalize `string | string[] | null` to topmost id (first entry).\n const id = Array.isArray(raw) ? raw[0] ?? null : raw;\n if (id == null) return null;\n\n const resolved = nodeResolver?.(id) ?? null;\n const kind = resolved?.kind ?? 'unknown';\n const pose = resolved?.pose;\n const data = resolved?.data ?? { id };\n\n return { id, kind, pose, data };\n };\n}\n"],"mappings":";AA2CA,SAAgBA,EACd,GACA,GAC2E;CAC3E,QAAQ,GAAY,GAAY,MAAkD;EAChF,IAAMC,IAAMC,EAAUC,GAAIC,GAAIC,CAAI,GAE5BC,IAAK,MAAM,QAAQL,CAAG,IAAIA,EAAI,MAAM,OAAOA;EACjD,IAAIK,KAAM,MAAM,OAAO;EAEvB,IAAMC,IAAWC,IAAeF,CAAE,KAAK;EAKvC,OAAO;GAAE;GAAI,MAJAC,GAAU,QAAQ;GAIZ,MAHNA,GAAU;GAGE,MAFZA,GAAU,QAAQ,EAAE,MAAG;EAEN;CAChC;AACF"}
1
+ {"version":3,"file":"getNodeAtPoint.js","names":["makeGetNodeAtPoint","id","pickBest","wx","wy","view","nodeResolver"],"sources":["../../src/canvas/getNodeAtPoint.ts"],"sourcesContent":["import type { PickView } from './SceneCanvas/useSceneSelectTool';\n\n/** The hit record returned by a `getNodeAtPoint` function. */\nexport interface NodeAtPointHit {\n id: string;\n kind: string;\n}\n\n/** Resolves a node's routing kind. */\nexport type NodeResolver = (id: string) => { kind: string } | null;\n\n/** The node a single-hit picker names under a world point, with its kind:\n * `'unknown'` when `nodeResolver` is absent or returns null. */\nexport function makeGetNodeAtPoint(\n pickBest: (wx: number, wy: number, view?: PickView | null) => string | null,\n nodeResolver?: NodeResolver,\n): (wx: number, wy: number, view?: PickView | null) => NodeAtPointHit | null {\n return (wx: number, wy: number, view?: PickView | null): NodeAtPointHit | null => {\n const id = pickBest(wx, wy, view);\n if (id == null) return null;\n\n return { id, kind: nodeResolver?.(id)?.kind ?? 'unknown' };\n };\n}\n"],"mappings":";AAaA,SAAgBA,EACd,GACA,GAC2E;CAC3E,QAAQ,GAAY,GAAY,MAAkD;EAChF,IAAMC,IAAKC,EAASC,GAAIC,GAAIC,CAAI;EAGhC,OAFIJ,KAAM,OAAa,OAEhB;GAAE;GAAI,MAAMK,IAAeL,CAAE,CAAC,EAAE,QAAQ;EAAU;CAC3D;AACF"}
@@ -1,5 +1,5 @@
1
1
  //#region src/canvas/hud.module.css
2
- var e = "_hud_1hv8c_3", t = "_sized_1hv8c_17", n = "_readings_1hv8c_22 _numeric_zns9n_4", r = "_muted_1hv8c_39", i = "_absent_1hv8c_44", a = "_header_1hv8c_49", o = "_list_1hv8c_53", s = "_item_1hv8c_62", c = "_itemBest_1hv8c_68", l = "_row_1hv8c_72", u = "_stack_1hv8c_79", d = {
2
+ var e = "_hud_4467cb", t = "_sized_4467cb", n = "_readings_4467cb _numeric_25fd0b", r = "_muted_4467cb", i = "_absent_4467cb", a = "_header_4467cb", o = "_list_4467cb", s = "_item_4467cb", c = "_itemBest_4467cb", l = "_row_4467cb", u = "_stack_4467cb", d = {
3
3
  hud: e,
4
4
  sized: t,
5
5
  readings: n,
@@ -1 +1 @@
1
- {"version":3,"file":"hud.module.js","names":["hud","sized","readings","muted","absent","header","list","item","itemBest","row","stack","hud_module_default"],"sources":["../../src/canvas/hud.module.css"],"sourcesContent":["/* The debug HUDs <Canvas> can draw: CursorCoordsHud, PickHud, ModalityHud. The\n mono face is for the ids the pick and modality HUDs list; figures take the\n numeric face, on a child so `.hud`'s own font cannot override it. */\n.hud {\n position: fixed;\n z-index: 10000;\n background: rgba(0, 0, 0, 0.7);\n color: #e8e8e8;\n font: 11px ui-monospace, SFMono-Regular, Menlo, monospace;\n padding: 6px 8px;\n border-radius: 4px;\n pointer-events: none;\n line-height: 1.4;\n text-align: right;\n}\n\n.sized {\n min-width: 120px;\n max-width: 260px;\n}\n\n.readings {\n composes: numeric from '@weasel-js/theme/numeric.module.css';\n display: grid;\n grid-template-columns: auto auto;\n column-gap: 8px;\n margin: 0;\n}\n\n.readings dt {\n text-align: left;\n}\n\n.readings dd {\n margin: 0;\n white-space: nowrap;\n}\n\n.muted {\n color: #888;\n}\n\n/* A value that is not there: an em dash, \"off-canvas\". */\n.absent {\n color: #888;\n font-style: italic;\n}\n\n.header {\n margin-bottom: 2px;\n}\n\n.list {\n list-style: none;\n margin: 0;\n padding: 0;\n display: flex;\n flex-direction: column;\n gap: 1px;\n}\n\n.item {\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n}\n\n.itemBest {\n font-weight: 700;\n}\n\n.row {\n display: flex;\n gap: 8px;\n justify-content: flex-end;\n white-space: nowrap;\n}\n\n.stack {\n display: flex;\n flex-direction: column;\n align-items: flex-end;\n}\n"],"mappings":""}
1
+ {"version":3,"file":"hud.module.js","names":["hud","sized","readings","muted","absent","header","list","item","itemBest","row","stack","hud_module_default"],"sources":["../../src/canvas/hud.module.css"],"sourcesContent":["/* The debug HUDs <Canvas> can draw: CursorCoordsHud, PickHud, ModalityHud. The\n mono face is for the ids the pick and modality HUDs list; figures take the\n numeric face, on a child so `.hud`'s own font cannot override it. */\n.hud {\n position: fixed;\n z-index: var(--wzl-z-hud, 900);\n background: rgba(0, 0, 0, 0.7);\n color: #e8e8e8;\n font: 11px ui-monospace, SFMono-Regular, Menlo, monospace;\n padding: var(--wzl-space-3, 6px) var(--wzl-space-4, 8px);\n border-radius: 4px;\n pointer-events: none;\n line-height: 1.4;\n text-align: right;\n}\n\n.sized {\n min-width: 120px;\n max-width: 260px;\n}\n\n.readings {\n composes: numeric from '@weasel-js/theme/numeric.module.css';\n display: grid;\n grid-template-columns: auto auto;\n column-gap: var(--wzl-space-4, 8px);\n margin: 0;\n}\n\n.readings dt {\n text-align: left;\n}\n\n.readings dd {\n margin: 0;\n white-space: nowrap;\n}\n\n.muted {\n color: #888;\n}\n\n/* A value that is not there: an em dash, \"off-canvas\". */\n.absent {\n color: #888;\n font-style: italic;\n}\n\n.header {\n margin-bottom: var(--wzl-space-1, 2px);\n}\n\n.list {\n list-style: none;\n margin: 0;\n padding: 0;\n display: flex;\n flex-direction: column;\n gap: 1px;\n}\n\n.item {\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n}\n\n.itemBest {\n font-weight: 700;\n}\n\n.row {\n display: flex;\n gap: var(--wzl-space-4, 8px);\n justify-content: flex-end;\n white-space: nowrap;\n}\n\n.stack {\n display: flex;\n flex-direction: column;\n align-items: flex-end;\n}\n"],"mappings":""}
@@ -1 +1 @@
1
- {"version":3,"file":"insertPreviewExtent.js","names":["insertPreviewExtent","b","ov","box","e","b2","aabbOf","center","radius","radialBox","outerRadius","samples","pts","minX","minY","maxX","maxY","p"],"sources":["../../src/canvas/insertPreviewExtent.ts"],"sourcesContent":["/**\n * The one answer to \"how big is the thing this in-flight insert is making\".\n *\n * A drag-to-insert has no scene node until commit, so three surfaces have to\n * size the nascent shape themselves: `useDispatcherOverlayLayer` (paints the\n * preview), `canvas/deps/insert` (poses the committed node) and\n * `dispatcherGestureBounds` (reports the gesture's world AABB to `<Canvas>`).\n * They all resolve it here.\n *\n * The drag AABB alone is NOT the answer. `insertAction` hands over an\n * `extras` payload that can carry richer geometry than the drag rect —\n * a polygon's center+radius, a pencil's sample trail, a line's endpoints —\n * and where it does, that geometry is the shape. A centered Alt-drag\n * produces a `d`-wide drag rect around a `d√2` circumradius; a pencil that\n * loops back to its start produces a zero-area drag rect around a trail that\n * swept the page.\n */\nimport type { Bounds } from 'core/viewport/fitViewToBounds';\nimport type { OngoingOverlay } from '@weasel-js/routing';\n\ntype Point = { x: number; y: number };\n\n/** The fields of an `insertPreview` overlay this needs. `canvas/deps/insert`\n * passes the equivalent from its own `(bounds, extras)` commit arguments. */\nexport interface InsertPreviewLike {\n shape: string;\n bounds: { x: number; y: number; width: number; height: number };\n extras: unknown;\n}\n\n/** Resolved preview geometry, in the terms the path builders take. */\nexport type InsertPreviewGeometry =\n | { kind: 'box' }\n | { kind: 'line'; a: Point; b: Point }\n | { kind: 'polygon'; center: Point; radius: number; sides: number; rotation: number }\n | {\n kind: 'star';\n center: Point;\n outerRadius: number;\n innerRadius: number;\n points: number;\n rotation: number;\n }\n | { kind: 'pencil'; samples: ReadonlyArray<Point> };\n\n/** An in-flight insert's shape, resolved from its drag rect and `extras`. */\nexport interface InsertPreviewExtent {\n /** The insert kind, verbatim from the caller. */\n shape: string;\n /** World-space AABB of `geometry` — the extent. */\n bounds: Bounds;\n geometry: InsertPreviewGeometry;\n}\n\n/** The `insertPreview` member of `OngoingOverlay`, which `insertAction` publishes during a drag-to-insert. */\nexport type InsertPreviewOverlay = Extract<OngoingOverlay, { kind: 'insertPreview' }>;\n\n/** Resolve an in-flight insert's geometry and world AABB. Uses the geometry in\n * `extras` where the shape carries it; an unknown shape falls back to its drag rect. */\nexport function insertPreviewExtent(ov: InsertPreviewLike): InsertPreviewExtent {\n const b = ov.bounds;\n const box = { x: b.x, y: b.y, width: b.width, height: b.height };\n\n switch (ov.shape) {\n case 'line': {\n const e = ov.extras as Partial<{ a: Point; b: Point }>;\n const a = e.a ?? { x: b.x, y: b.y };\n const b2 = e.b ?? { x: b.x + b.width, y: b.y + b.height };\n return { shape: ov.shape, bounds: aabbOf([a, b2]) ?? box, geometry: { kind: 'line', a, b: b2 } };\n }\n case 'polygon': {\n const e = ov.extras as Partial<{\n sides: number; rotation: number; center: Point; radius: number;\n }>;\n const center = e.center ?? { x: b.x + b.width / 2, y: b.y + b.height / 2 };\n const radius = e.radius ?? Math.min(b.width, b.height) / 2;\n return {\n shape: ov.shape,\n bounds: radialBox(center, radius),\n geometry: {\n kind: 'polygon',\n center,\n radius,\n sides: Math.max(3, Math.floor(e.sides ?? 6)),\n rotation: e.rotation ?? 0,\n },\n };\n }\n case 'star': {\n const e = ov.extras as Partial<{\n points: number; innerRadiusRatio: number; rotation: number;\n center: Point; outerRadius: number;\n }>;\n const center = e.center ?? { x: b.x + b.width / 2, y: b.y + b.height / 2 };\n const outerRadius = e.outerRadius ?? Math.min(b.width, b.height) / 2;\n return {\n shape: ov.shape,\n bounds: radialBox(center, outerRadius),\n geometry: {\n kind: 'star',\n center,\n outerRadius,\n innerRadius: outerRadius * (e.innerRadiusRatio ?? 0.5),\n points: Math.max(3, Math.floor(e.points ?? 5)),\n rotation: e.rotation ?? 0,\n },\n };\n }\n case 'pencil': {\n const e = ov.extras as Partial<{ samples: ReadonlyArray<Point> }>;\n const samples = e.samples ?? [];\n return {\n shape: ov.shape,\n bounds: aabbOf(samples) ?? box,\n geometry: { kind: 'pencil', samples },\n };\n }\n default:\n return { shape: ov.shape, bounds: box, geometry: { kind: 'box' } };\n }\n}\n\n/** A radial shape's extent is its circumscribed square, not the drag rect. */\nfunction radialBox(center: Point, radius: number): Bounds {\n return { x: center.x - radius, y: center.y - radius, width: radius * 2, height: radius * 2 };\n}\n\nfunction aabbOf(pts: ReadonlyArray<Point>): Bounds | null {\n if (pts.length === 0) return null;\n let minX = Infinity, minY = Infinity, maxX = -Infinity, maxY = -Infinity;\n for (const p of pts) {\n if (p.x < minX) minX = p.x;\n if (p.y < minY) minY = p.y;\n if (p.x > maxX) maxX = p.x;\n if (p.y > maxY) maxY = p.y;\n }\n return { x: minX, y: minY, width: maxX - minX, height: maxY - minY };\n}\n"],"mappings":";AA2DA,SAAgBA,EAAoB,GAA4C;CAC9E,IAAMC,IAAIC,EAAG,QACPC,IAAM;EAAE,GAAGF,EAAE;EAAG,GAAGA,EAAE;EAAG,OAAOA,EAAE;EAAO,QAAQA,EAAE;CAAO;CAE/D,QAAQC,EAAG,OAAX;EACE,KAAK,QAAQ;GACX,IAAME,IAAIF,EAAG,QACP,IAAIE,EAAE,KAAK;IAAE,GAAGH,EAAE;IAAG,GAAGA,EAAE;GAAE,GAC5BI,IAAKD,EAAE,KAAK;IAAE,GAAGH,EAAE,IAAIA,EAAE;IAAO,GAAGA,EAAE,IAAIA,EAAE;GAAO;GACxD,OAAO;IAAE,OAAOC,EAAG;IAAO,QAAQI,EAAO,CAAC,GAAGD,CAAE,CAAC,KAAKF;IAAK,UAAU;KAAE,MAAM;KAAQ;KAAG,GAAGE;IAAG;GAAE;EACjG;EACA,KAAK,WAAW;GACd,IAAMD,IAAIF,EAAG,QAGPK,IAASH,EAAE,UAAU;IAAE,GAAGH,EAAE,IAAIA,EAAE,QAAQ;IAAG,GAAGA,EAAE,IAAI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G,OAAO;CAC7B,IAAIC,IAAO,UAAUC,IAAO,UAAUC,IAAO,WAAWC,IAAO;CAC/D,KAAK,IAAMC,KAAKL,GAId,AAHIK,EAAE,IAAIJ,MAAM,IAAOI,EAAE,IACrBA,EAAE,IAAIH,MAAM,IAAOG,EAAE,IACrBA,EAAE,IAAIF,MAAM,IAAOE,EAAE,IACrBA,EAAE,IAAID,MAAM,IAAOC,EAAE;CAE3B,OAAO;EAAE,GAAGJ;EAAM,GAAGC;EAAM,OAAOC,IAAOF;EAAM,QAAQG,IAAOF;CAAK;AACrE"}
1
+ {"version":3,"file":"insertPreviewExtent.js","names":["insertPreviewExtent","b","ov","box","e","b2","aabbOf","center","radius","radialBox","outerRadius","samples","pts","minX","minY","maxX","maxY","p"],"sources":["../../src/canvas/insertPreviewExtent.ts"],"sourcesContent":["/**\n * The one answer to \"how big is the thing this in-flight insert is making\",\n * shared by the preview paint, the commit, and the gesture's reported bounds.\n *\n * The drag AABB alone is NOT the answer. `insertAction` hands over an\n * `extras` payload that can carry richer geometry than the drag rect, and\n * where it does, that geometry is the shape: a pencil that loops back to its\n * start produces a zero-area drag rect around a trail that swept the page.\n */\nimport type { Bounds } from 'core/viewport/fitViewToBounds';\nimport type { OngoingOverlay } from '@weasel-js/routing';\n\ntype Point = { x: number; y: number };\n\n/** The fields of an `insertPreview` overlay this needs. `canvas/deps/insert`\n * passes the equivalent from its own `(bounds, extras)` commit arguments. */\nexport interface InsertPreviewLike {\n shape: string;\n bounds: { x: number; y: number; width: number; height: number };\n extras: unknown;\n}\n\n/** Resolved preview geometry, in the terms the path builders take. */\nexport type InsertPreviewGeometry =\n | { kind: 'box' }\n | { kind: 'line'; a: Point; b: Point }\n | { kind: 'polygon'; center: Point; radius: number; sides: number; rotation: number }\n | {\n kind: 'star';\n center: Point;\n outerRadius: number;\n innerRadius: number;\n points: number;\n rotation: number;\n }\n | { kind: 'pencil'; samples: ReadonlyArray<Point> };\n\n/** An in-flight insert's shape, resolved from its drag rect and `extras`. */\nexport interface InsertPreviewExtent {\n /** The insert kind, verbatim from the caller. */\n shape: string;\n /** World-space AABB of `geometry` — the extent. */\n bounds: Bounds;\n geometry: InsertPreviewGeometry;\n}\n\n/** The `insertPreview` member of `OngoingOverlay`, which `insertAction` publishes during a drag-to-insert. */\nexport type InsertPreviewOverlay = Extract<OngoingOverlay, { kind: 'insertPreview' }>;\n\n/** Resolve an in-flight insert's geometry and world AABB. Uses the geometry in\n * `extras` where the shape carries it; an unknown shape falls back to its drag rect. */\nexport function insertPreviewExtent(ov: InsertPreviewLike): InsertPreviewExtent {\n const b = ov.bounds;\n const box = { x: b.x, y: b.y, width: b.width, height: b.height };\n\n switch (ov.shape) {\n case 'line': {\n const e = ov.extras as Partial<{ a: Point; b: Point }>;\n const a = e.a ?? { x: b.x, y: b.y };\n const b2 = e.b ?? { x: b.x + b.width, y: b.y + b.height };\n return { shape: ov.shape, bounds: aabbOf([a, b2]) ?? box, geometry: { kind: 'line', a, b: b2 } };\n }\n case 'polygon': {\n const e = ov.extras as Partial<{\n sides: number; rotation: number; center: Point; radius: number;\n }>;\n const center = e.center ?? { x: b.x + b.width / 2, y: b.y + b.height / 2 };\n const radius = e.radius ?? Math.min(b.width, b.height) / 2;\n return {\n shape: ov.shape,\n bounds: radialBox(center, radius),\n geometry: {\n kind: 'polygon',\n center,\n radius,\n sides: Math.max(3, Math.floor(e.sides ?? 6)),\n rotation: e.rotation ?? 0,\n },\n };\n }\n case 'star': {\n const e = ov.extras as Partial<{\n points: number; innerRadiusRatio: number; rotation: number;\n center: Point; outerRadius: number;\n }>;\n const center = e.center ?? { x: b.x + b.width / 2, y: b.y + b.height / 2 };\n const outerRadius = e.outerRadius ?? Math.min(b.width, b.height) / 2;\n return {\n shape: ov.shape,\n bounds: radialBox(center, outerRadius),\n geometry: {\n kind: 'star',\n center,\n outerRadius,\n innerRadius: outerRadius * (e.innerRadiusRatio ?? 0.5),\n points: Math.max(3, Math.floor(e.points ?? 5)),\n rotation: e.rotation ?? 0,\n },\n };\n }\n case 'pencil': {\n const e = ov.extras as Partial<{ samples: ReadonlyArray<Point> }>;\n const samples = e.samples ?? [];\n return {\n shape: ov.shape,\n bounds: aabbOf(samples) ?? box,\n geometry: { kind: 'pencil', samples },\n };\n }\n default:\n return { shape: ov.shape, bounds: box, geometry: { kind: 'box' } };\n }\n}\n\n/** A radial shape's extent is its circumscribed square, not the drag rect. */\nfunction radialBox(center: Point, radius: number): Bounds {\n return { x: center.x - radius, y: center.y - radius, width: radius * 2, height: radius * 2 };\n}\n\nfunction aabbOf(pts: ReadonlyArray<Point>): Bounds | null {\n if (pts.length === 0) return null;\n let minX = Infinity, minY = Infinity, maxX = -Infinity, maxY = -Infinity;\n for (const p of pts) {\n if (p.x < minX) minX = p.x;\n if (p.y < minY) minY = p.y;\n if (p.x > maxX) maxX = p.x;\n if (p.y > maxY) maxY = p.y;\n }\n return { x: minX, y: minY, width: maxX - minX, height: maxY - minY };\n}\n"],"mappings":";AAmDA,SAAgBA,EAAoB,GAA4C;CAC9E,IAAMC,IAAIC,EAAG,QACPC,IAAM;EAAE,GAAGF,EAAE;EAAG,GAAGA,EAAE;EAAG,OAAOA,EAAE;EAAO,QAAQA,EAAE;CAAO;CAE/D,QAAQC,EAAG,OAAX;EACE,KAAK,QAAQ;GACX,IAAME,IAAIF,EAAG,QACP,IAAIE,EAAE,KAAK;IAAE,GAAGH,EAAE;IAAG,GAAGA,EAAE;GAAE,GAC5BI,IAAKD,EAAE,KAAK;IAAE,GAAGH,EAAE,IAAIA,EAAE;IAAO,GAAGA,EAAE,IAAIA,EAAE;GAAO;GACxD,OAAO;IAAE,OAAOC,EAAG;IAAO,QAAQI,EAAO,CAAC,GAAGD,CAAE,CAAC,KAAKF;IAAK,UAAU;KAAE,MAAM;KAAQ;KAAG,GAAGE;IAAG;GAAE;EACjG;EACA,KAAK,WAAW;GACd,IAAMD,IAAIF,EAAG,QAGPK,IAASH,EAAE,UAAU;IAAE,GAAGH,EAAE,IAAIA,EA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AA0C;CACxD,IAAIM,EAAI,WAAW,GAAG,OAAO;CAC7B,IAAIC,IAAO,UAAUC,IAAO,UAAUC,IAAO,WAAWC,IAAO;CAC/D,KAAK,IAAMC,KAAKL,GAId,AAHIK,EAAE,IAAIJ,MAAM,IAAOI,EAAE,IACrBA,EAAE,IAAIH,MAAM,IAAOG,EAAE,IACrBA,EAAE,IAAIF,MAAM,IAAOE,EAAE,IACrBA,EAAE,IAAID,MAAM,IAAOC,EAAE;CAE3B,OAAO;EAAE,GAAGJ;EAAM,GAAGC;EAAM,OAAOC,IAAOF;EAAM,QAAQG,IAAOF;CAAK;AACrE"}
@@ -122,7 +122,7 @@ function u(e, t) {
122
122
  case ">=": return n >= 0;
123
123
  case ">": return n > 0;
124
124
  case "<=": return n <= 0;
125
- case "<": return n < 0;
125
+ case "<": return t.v.pre.length > 0 ? n < 0 : s(c(...e.triple), t.v) < 0;
126
126
  }
127
127
  }
128
128
  function d(e, t) {
@@ -132,7 +132,7 @@ function d(e, t) {
132
132
  for (let e of r) {
133
133
  if (e === "") return null;
134
134
  let t = [];
135
- for (let n of e.split(/\s+/)) {
135
+ for (let n of e.replace(/(\^|~|>=|<=|>|<|=)\s+/g, "$1").split(/\s+/)) {
136
136
  let e = l(n);
137
137
  if (!e) return null;
138
138
  t.push(...e);
@@ -1 +1 @@
1
- {"version":3,"file":"kitRequirements.js","names":["KIT_VERSIONS","VERSION","UNKNOWN_SUFFIX","VERSION_RE","PARTIAL_RE","preOf","s","id","parseVersion","m","compare","i","d","a","b","x","y","v","c","parseComparator","token","op","p","nums","part","pre","M","mi","pa","lower","upper","top","holds","version","satisfiesRange","parsed","alternatives","range","alt","any","set","cs","checkRequirements","out","pkg","requires","have","running","ok"],"sources":["../../src/canvas/kitRequirements.ts"],"sourcesContent":["/**\n * Version negotiation for contributions: a `requires` map of semver ranges,\n * matched against the versions the running kit packages report.\n *\n * The range grammar is npm's everyday subset — `^`, `~`, `>=`, `>`, `<=`, `<`,\n * `=`, bare and partial versions (`1.7`, `1.x`, `*`), space for AND and `||`\n * for OR. Hyphen ranges are not read. A prerelease orders below its release,\n * without npm's rule that a range must opt into prereleases by naming one.\n */\nimport { VERSION } from '../version';\n\n/**\n * The versions a contribution can require, keyed by package without its\n * `@weasel-js/` scope. Only core reports its version today.\n */\nexport interface KitVersions {\n core: string;\n}\n\n/** A contribution's `requires`: a semver range per package it was written against. */\nexport type KitRequirements = { readonly [K in keyof KitVersions]?: string };\n\n/** The running kit's versions. */\nexport const KIT_VERSIONS: Readonly<KitVersions> = { core: VERSION };\n\n/** One requirement the running kit does not meet. */\nexport interface RequirementMismatch {\n package: string;\n range: string;\n /** The running version, or `undefined` when that package reports none. */\n running: string | undefined;\n reason: 'unsatisfied' | 'invalid-range' | 'unknown-package';\n}\n\ntype Triple = readonly [number, number, number];\ninterface Version { triple: Triple; pre: readonly (string | number)[] }\ninterface Comparator { op: '>=' | '<' | '>' | '<='; v: Version }\n\nconst UNKNOWN_SUFFIX = '-unknown';\nconst VERSION_RE = /^v?(\\d+)\\.(\\d+)\\.(\\d+)(?:-([0-9A-Za-z.-]+))?(?:\\+[0-9A-Za-z.-]+)?$/;\nconst PARTIAL_RE = /^v?(\\d+|[xX*])(?:\\.(\\d+|[xX*]))?(?:\\.(\\d+|[xX*]))?(?:-([0-9A-Za-z.-]+))?(?:\\+[0-9A-Za-z.-]+)?$/;\n\nfunction preOf(s: string | undefined): (string | number)[] {\n return s ? s.split('.').map((id) => (/^\\d+$/.test(id) ? Number(id) : id)) : [];\n}\n\nfunction parseVersion(s: string): Version | null {\n const m = VERSION_RE.exec(s.trim());\n return m ? { triple: [Number(m[1]), Number(m[2]), Number(m[3])], pre: preOf(m[4]) } : null;\n}\n\nfunction compare(a: Version, b: Version): number {\n for (let i = 0; i < 3; i++) {\n const d = a.triple[i]! - b.triple[i]!;\n if (d !== 0) return d;\n }\n if (a.pre.length === 0 || b.pre.length === 0) return b.pre.length - a.pre.length;\n for (let i = 0; i < Math.max(a.pre.length, b.pre.length); i++) {\n const x = a.pre[i];\n const y = b.pre[i];\n if (x === undefined) return -1;\n if (y === undefined) return 1;\n if (x === y) continue;\n if (typeof x === 'number' && typeof y === 'number') return x - y;\n if (typeof x === 'number') return -1;\n if (typeof y === 'number') return 1;\n return x < y ? -1 : 1;\n }\n return 0;\n}\n\nconst v = (a: number, b: number, c: number, pre: readonly (string | number)[] = []): Version =>\n ({ triple: [a, b, c], pre });\n\n/** One comparator token as the interval it names. `null` when unreadable. */\nfunction parseComparator(token: string): Comparator[] | null {\n const m = /^(\\^|~|>=|<=|>|<|=)?(.*)$/.exec(token)!;\n const op = m[1] ?? '';\n const p = PARTIAL_RE.exec(m[2]!);\n if (!p) return null;\n const nums: number[] = [];\n for (const part of [p[1], p[2], p[3]]) {\n if (part === undefined || /^[xX*]$/.test(part)) break;\n nums.push(Number(part));\n }\n const pre = preOf(p[4]);\n if (pre.length > 0 && nums.length < 3) return null;\n const [M = 0, mi = 0, pa = 0] = nums;\n const lower = v(M, mi, pa, pre);\n // The first version past everything the partial names: `1.7` → `1.8.0`.\n const upper = nums.length === 0 ? null\n : nums.length === 1 ? v(M + 1, 0, 0)\n : nums.length === 2 ? v(M, mi + 1, 0)\n : v(M, mi, pa + 1);\n\n switch (op) {\n case '>=': return [{ op: '>=', v: lower }];\n case '<': return nums.length === 0 ? [{ op: '<', v: v(0, 0, 0) }] : [{ op: '<', v: lower }];\n case '>': return nums.length === 3 ? [{ op: '>', v: lower }] : upper ? [{ op: '>=', v: upper }] : [{ op: '<', v: v(0, 0, 0) }];\n case '<=': return nums.length === 3 ? [{ op: '<=', v: lower }] : upper ? [{ op: '<', v: upper }] : [];\n case '~': {\n const top = nums.length <= 1 ? v(M + 1, 0, 0) : v(M, mi + 1, 0);\n return [{ op: '>=', v: lower }, { op: '<', v: top }];\n }\n case '^': {\n const top = M > 0 || nums.length === 1 ? v(M + 1, 0, 0)\n : mi > 0 || nums.length === 2 ? v(0, mi + 1, 0)\n : v(0, 0, pa + 1);\n return nums.length === 0 ? [] : [{ op: '>=', v: lower }, { op: '<', v: top }];\n }\n default:\n if (nums.length === 3) return [{ op: '>=', v: lower }, { op: '<=', v: lower }];\n return upper ? [{ op: '>=', v: lower }, { op: '<', v: upper }] : [];\n }\n}\n\nfunction holds(version: Version, c: Comparator): boolean {\n const d = compare(version, c.v);\n switch (c.op) {\n case '>=': return d >= 0;\n case '>': return d > 0;\n case '<=': return d <= 0;\n case '<': return d < 0;\n }\n}\n\n/**\n * Whether `version` falls in `range`. `null` when either cannot be read, so a\n * caller can tell a mismatch from a requirement it could not check.\n */\nexport function satisfiesRange(version: string, range: string): boolean | null {\n const parsed = parseVersion(version);\n if (!parsed) return null;\n const alternatives = range.split('||').map((alt) => alt.trim());\n let any = false;\n for (const alt of alternatives) {\n if (alt === '') return null;\n const set: Comparator[] = [];\n for (const token of alt.split(/\\s+/)) {\n const cs = parseComparator(token);\n if (!cs) return null;\n set.push(...cs);\n }\n if (set.every((c) => holds(parsed, c))) any = true;\n }\n return any;\n}\n\n/**\n * Every requirement in `requires` the running kit does not meet. A package\n * whose build does not know its own version (`0.0.0-unknown`, core's source\n * bundled without its define) is skipped: nothing can be said about it.\n */\nexport function checkRequirements(\n requires: KitRequirements,\n running: Readonly<Partial<Record<string, string>>> = KIT_VERSIONS,\n): RequirementMismatch[] {\n const out: RequirementMismatch[] = [];\n for (const [pkg, range] of Object.entries(requires)) {\n if (range === undefined) continue;\n const have = running[pkg];\n if (have === undefined) {\n out.push({ package: pkg, range, running: undefined, reason: 'unknown-package' });\n continue;\n }\n if (have.endsWith(UNKNOWN_SUFFIX)) continue;\n const ok = satisfiesRange(have, range);\n if (ok === null) out.push({ package: pkg, range, running: have, reason: 'invalid-range' });\n else if (!ok) out.push({ package: pkg, range, running: have, reason: 'unsatisfied' });\n }\n return out;\n}\n"],"mappings":";;AAuBA,IAAaA,IAAsC,EAAE,MAAMC,EAAQ,GAe7DC,IAAiB,YACjBC,IAAa,sEACbC,IAAa;AAEnB,SAAS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ayB,CAAO;CACnC,IAAI,CAACE,GAAQ,OAAO;CACpB,IAAMC,IAAeC,EAAM,MAAM,IAAI,CAAC,CAAC,KAAK,MAAQC,EAAI,KAAK,CAAC,GAC1DC,IAAM;CACV,KAAK,IAAMD,KAAOF,GAAc;EAC9B,IAAIE,MAAQ,IAAI,OAAO;EACvB,IAAME,IAAoB,CAAC;EAC3B,KAAK,IAAMpB,KAASkB,EAAI,MAAM,KAAK,GAAG;GACpC,IAAMG,IAAKtB,EAAgBC,CAAK;GAChC,IAAI,CAACqB,GAAI,OAAO;GAChB,EAAI,KAAK,GAAGA,CAAE;EAChB;EACA,AAAID,EAAI,OAAO,MAAMR,EAAMG,GAAQjB,CAAC,CAAC,MAAG,IAAM;CAChD;CACA,OAAOqB;AACT;AAOA,SAAgBG,EACd,GACA,IAAqD1C,GAC9B;CACvB,IAAM2C,IAA6B,CAAC;CACpC,KAAK,IAAM,CAACC,GAAKP,MAAU,OAAO,QAAQQ,CAAQ,GAAG;EACnD,IAAIR,MAAU,KAAA,GAAW;EACzB,IAAMS,IAAOC,EAAQH;EACrB,IAAIE,MAAS,KAAA,GAAW;GACtB,EAAI,KAAK;IAAE,SAASF;IAAK;IAAO,SAAS,KAAA;IAAW,QAAQ;GAAkB,CAAC;GAC/E;EACF;EACA,IAAIE,EAAK,SAAS5C,CAAc,GAAG;EACnC,IAAM8C,IAAKd,EAAeY,GAAMT,CAAK;EACrC,AAAIW,MAAO,OAAML,EAAI,KAAK;GAAE,SAASC;GAAK;GAAO,SAASE;GAAM,QAAQ;EAAgB,CAAC,IAC/EE,KAAIL,EAAI,KAAK;GAAE,SAASC;GAAK;GAAO,SAASE;GAAM,QAAQ;EAAc,CAAC;CACtF;CACA,OAAOH;AACT"}
1
+ {"version":3,"file":"kitRequirements.js","names":["KIT_VERSIONS","VERSION","UNKNOWN_SUFFIX","VERSION_RE","PARTIAL_RE","preOf","s","id","parseVersion","m","compare","i","d","a","b","x","y","v","c","parseComparator","token","op","p","nums","part","pre","M","mi","pa","lower","upper","top","holds","version","satisfiesRange","parsed","alternatives","range","alt","any","set","cs","checkRequirements","out","pkg","requires","have","running","ok"],"sources":["../../src/canvas/kitRequirements.ts"],"sourcesContent":["/**\n * Version negotiation for contributions: a `requires` map of semver ranges,\n * matched against the versions the running kit packages report.\n *\n * The range grammar is npm's everyday subset — `^`, `~`, `>=`, `>`, `<=`, `<`,\n * `=`, bare and partial versions (`1.7`, `1.x`, `*`), space for AND and `||`\n * for OR. Hyphen ranges are not read. A prerelease orders below its release,\n * without npm's rule that a range must opt into prereleases by naming one —\n * except at an exclusive upper bound, which also excludes that version's own\n * prereleases, so `^1.4` does not admit `2.0.0-rc.1`.\n */\nimport { VERSION } from '../version';\n\n/**\n * The versions a contribution can require, keyed by package without its\n * `@weasel-js/` scope. Only core reports its version today.\n */\nexport interface KitVersions {\n core: string;\n}\n\n/** A contribution's `requires`: a semver range per package it was written against. */\nexport type KitRequirements = { readonly [K in keyof KitVersions]?: string };\n\n/** The running kit's versions. */\nexport const KIT_VERSIONS: Readonly<KitVersions> = { core: VERSION };\n\n/** One requirement the running kit does not meet. */\nexport interface RequirementMismatch {\n package: string;\n range: string;\n /** The running version, or `undefined` when that package reports none. */\n running: string | undefined;\n reason: 'unsatisfied' | 'invalid-range' | 'unknown-package';\n}\n\ntype Triple = readonly [number, number, number];\ninterface Version { triple: Triple; pre: readonly (string | number)[] }\ninterface Comparator { op: '>=' | '<' | '>' | '<='; v: Version }\n\nconst UNKNOWN_SUFFIX = '-unknown';\nconst VERSION_RE = /^v?(\\d+)\\.(\\d+)\\.(\\d+)(?:-([0-9A-Za-z.-]+))?(?:\\+[0-9A-Za-z.-]+)?$/;\nconst PARTIAL_RE = /^v?(\\d+|[xX*])(?:\\.(\\d+|[xX*]))?(?:\\.(\\d+|[xX*]))?(?:-([0-9A-Za-z.-]+))?(?:\\+[0-9A-Za-z.-]+)?$/;\n\nfunction preOf(s: string | undefined): (string | number)[] {\n return s ? s.split('.').map((id) => (/^\\d+$/.test(id) ? Number(id) : id)) : [];\n}\n\nfunction parseVersion(s: string): Version | null {\n const m = VERSION_RE.exec(s.trim());\n return m ? { triple: [Number(m[1]), Number(m[2]), Number(m[3])], pre: preOf(m[4]) } : null;\n}\n\nfunction compare(a: Version, b: Version): number {\n for (let i = 0; i < 3; i++) {\n const d = a.triple[i]! - b.triple[i]!;\n if (d !== 0) return d;\n }\n if (a.pre.length === 0 || b.pre.length === 0) return b.pre.length - a.pre.length;\n for (let i = 0; i < Math.max(a.pre.length, b.pre.length); i++) {\n const x = a.pre[i];\n const y = b.pre[i];\n if (x === undefined) return -1;\n if (y === undefined) return 1;\n if (x === y) continue;\n if (typeof x === 'number' && typeof y === 'number') return x - y;\n if (typeof x === 'number') return -1;\n if (typeof y === 'number') return 1;\n return x < y ? -1 : 1;\n }\n return 0;\n}\n\nconst v = (a: number, b: number, c: number, pre: readonly (string | number)[] = []): Version =>\n ({ triple: [a, b, c], pre });\n\n/** One comparator token as the interval it names. `null` when unreadable. */\nfunction parseComparator(token: string): Comparator[] | null {\n const m = /^(\\^|~|>=|<=|>|<|=)?(.*)$/.exec(token)!;\n const op = m[1] ?? '';\n const p = PARTIAL_RE.exec(m[2]!);\n if (!p) return null;\n const nums: number[] = [];\n for (const part of [p[1], p[2], p[3]]) {\n if (part === undefined || /^[xX*]$/.test(part)) break;\n nums.push(Number(part));\n }\n const pre = preOf(p[4]);\n if (pre.length > 0 && nums.length < 3) return null;\n const [M = 0, mi = 0, pa = 0] = nums;\n const lower = v(M, mi, pa, pre);\n // The first version past everything the partial names: `1.7` → `1.8.0`.\n const upper = nums.length === 0 ? null\n : nums.length === 1 ? v(M + 1, 0, 0)\n : nums.length === 2 ? v(M, mi + 1, 0)\n : v(M, mi, pa + 1);\n\n switch (op) {\n case '>=': return [{ op: '>=', v: lower }];\n case '<': return nums.length === 0 ? [{ op: '<', v: v(0, 0, 0) }] : [{ op: '<', v: lower }];\n case '>': return nums.length === 3 ? [{ op: '>', v: lower }] : upper ? [{ op: '>=', v: upper }] : [{ op: '<', v: v(0, 0, 0) }];\n case '<=': return nums.length === 3 ? [{ op: '<=', v: lower }] : upper ? [{ op: '<', v: upper }] : [];\n case '~': {\n const top = nums.length <= 1 ? v(M + 1, 0, 0) : v(M, mi + 1, 0);\n return [{ op: '>=', v: lower }, { op: '<', v: top }];\n }\n case '^': {\n const top = M > 0 || nums.length === 1 ? v(M + 1, 0, 0)\n : mi > 0 || nums.length === 2 ? v(0, mi + 1, 0)\n : v(0, 0, pa + 1);\n return nums.length === 0 ? [] : [{ op: '>=', v: lower }, { op: '<', v: top }];\n }\n default:\n if (nums.length === 3) return [{ op: '>=', v: lower }, { op: '<=', v: lower }];\n return upper ? [{ op: '>=', v: lower }, { op: '<', v: upper }] : [];\n }\n}\n\nfunction holds(version: Version, c: Comparator): boolean {\n const d = compare(version, c.v);\n switch (c.op) {\n case '>=': return d >= 0;\n case '>': return d > 0;\n case '<=': return d <= 0;\n case '<': return c.v.pre.length > 0 ? d < 0 : compare(v(...version.triple), c.v) < 0;\n }\n}\n\n/**\n * Whether `version` falls in `range`. `null` when either cannot be read, so a\n * caller can tell a mismatch from a requirement it could not check.\n */\nexport function satisfiesRange(version: string, range: string): boolean | null {\n const parsed = parseVersion(version);\n if (!parsed) return null;\n const alternatives = range.split('||').map((alt) => alt.trim());\n let any = false;\n for (const alt of alternatives) {\n if (alt === '') return null;\n const set: Comparator[] = [];\n for (const token of alt.replace(/(\\^|~|>=|<=|>|<|=)\\s+/g, '$1').split(/\\s+/)) {\n const cs = parseComparator(token);\n if (!cs) return null;\n set.push(...cs);\n }\n if (set.every((c) => holds(parsed, c))) any = true;\n }\n return any;\n}\n\n/**\n * Every requirement in `requires` the running kit does not meet. A package\n * whose build does not know its own version (`0.0.0-unknown`, core's source\n * bundled without its define) is skipped: nothing can be said about it.\n */\nexport function checkRequirements(\n requires: KitRequirements,\n running: Readonly<Partial<Record<string, string>>> = KIT_VERSIONS,\n): RequirementMismatch[] {\n const out: RequirementMismatch[] = [];\n for (const [pkg, range] of Object.entries(requires)) {\n if (range === undefined) continue;\n const have = running[pkg];\n if (have === undefined) {\n out.push({ package: pkg, range, running: undefined, reason: 'unknown-package' });\n continue;\n }\n if (have.endsWith(UNKNOWN_SUFFIX)) continue;\n const ok = satisfiesRange(have, range);\n if (ok === null) out.push({ package: pkg, range, running: have, reason: 'invalid-range' });\n else if (!ok) out.push({ package: pkg, range, running: have, reason: 'unsatisfied' });\n }\n return out;\n}\n"],"mappings":";;AAyBA,IAAaA,IAAsC,EAAE,MAAMC,EAAQ,GAe7DC,IAAiB,YACjBC,IAAa,sEACbC,IAAa;AAEnB,SAASC,EAAM,GAA4C;CACzD,OAAOC,IAAIA,EAAE,MAAM,GAAG,CAAC,CAAC,KAAK,MAAQ,QAAQ,KAAKC,CAAE,IAAI,OAAOA,CAAE,IAAIA,CAAG,IAAI,CAAC;AAC/E;AAEA,SAASC,EAAa,GAA2B;CAC/C,IAAMC,IAAIN,EAAW,KAAKG,EAAE,KAAK,CAAC;CAClC,OAAOG,IAAI;EAAE,QAAQ;GAAC,OAAOA,EAAE,EAAE;GAAG,OAAOA,EAAE,EAAE;GAAG,OAAOA,EAAE,EAAE;EAAC;EAAG,KAAKJ,EAAMI,EAAE,EAAE;CAAE,IAAI;AACxF;AAEA,SAASC,EAAQ,GAAY,GAAoB;CAC/C,KAAK,IAAIC,IAAI,GAAGA,IAAI,GAAG,KAAK;EAC1B,IAAMC,IAAIC,EAAE,OAAOF,KAAMG,EAAE,OAAOH;EAClC,IAAIC,MAAM,GAAG,OAAOA;CACtB;CACA,IAAIC,EAAE,IAAI,WAAW,KAAKC,EAAE,IAAI,WAAW,GAAG,OAAOA,EAAE,IAAI,SAASD,EAAE,IAAI;CAC1E,KAAK,IAAIF,IAAI,GAAGA,IAAI,KAAK,IAAIE,EAAE,IAAI,QAAQC,EAAE,IAAI,MAAM,GAAG,KAAK;EAC7D,IAAMC,IAAIF,EAAE,IAAIF,IACVK,IAAIF,EAA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AA,GAAW;GACtB,EAAI,KAAK;IAAE,SAASF;IAAK;IAAO,SAAS,KAAA;IAAW,QAAQ;GAAkB,CAAC;GAC/E;EACF;EACA,IAAIE,EAAK,SAAS5C,CAAc,GAAG;EACnC,IAAM8C,IAAKd,EAAeY,GAAMT,CAAK;EACrC,AAAIW,MAAO,OAAML,EAAI,KAAK;GAAE,SAASC;GAAK;GAAO,SAASE;GAAM,QAAQ;EAAgB,CAAC,IAC/EE,KAAIL,EAAI,KAAK;GAAE,SAASC;GAAK;GAAO,SAASE;GAAM,QAAQ;EAAc,CAAC;CACtF;CACA,OAAOH;AACT"}
@@ -23,11 +23,7 @@ function r(r, i, a, o) {
23
23
  }
24
24
  let d = /* @__PURE__ */ new Set(), f = o ? [o] : [];
25
25
  function p(e) {
26
- if (d.has(e.key)) {
27
- console.warn(`composeOrderedLayers: cycle detected involving custom layer "${e.key}"`);
28
- return;
29
- }
30
- d.add(e.key), h(e.key), f.push(e.layer), m(e.key);
26
+ d.has(e.key) || (d.add(e.key), h(e.key), f.push(e.layer), m(e.key));
31
27
  }
32
28
  function m(e) {
33
29
  for (let t of s.get(e) ?? []) p(t);
@@ -47,12 +43,23 @@ function r(r, i, a, o) {
47
43
  e && f.push(e), m(t);
48
44
  }
49
45
  for (let e of l) d.has(e.key) || (d.add(e.key), f.push(e.layer));
46
+ let g = (e) => {
47
+ let n = r[e];
48
+ return t(n) ? n.after ?? n.before : void 0;
49
+ }, _ = (e) => {
50
+ let t = g(e);
51
+ for (let n = 0; t !== void 0 && n < u.size; n++) {
52
+ if (t === e) return !0;
53
+ t = g(t);
54
+ }
55
+ return !1;
56
+ };
50
57
  for (let e of u) {
51
58
  if (d.has(e)) continue;
52
59
  let n = r[e];
53
60
  if (!t(n)) continue;
54
61
  let i = n.after ?? n.before;
55
- console.warn(`composeOrderedLayers: dangling reference "${i}" from custom layer "${e}" — falling back to tail`), d.add(e), f.push(n.layer);
62
+ console.warn(_(e) ? `composeOrderedLayers: cycle detected involving custom layer "${e}" — falling back to tail` : `composeOrderedLayers: dangling reference "${i}" from custom layer "${e}" — falling back to tail`), d.add(e), f.push(n.layer);
56
63
  }
57
64
  return f;
58
65
  }
@@ -1 +1 @@
1
- {"version":3,"file":"layerOrder.js","names":["STANDARD_SLOT_SET","STANDARD_SLOTS","composeOrderedLayers","afterByParent","beforeByParent","tail","allCustomKeys","key","value","layersMap","isCustomEntry","arr","emitted","out","background","emitChild","child","emitBefore","emitAfter","parentKey","slot","sceneLayers","sl","layer","standardLayers","t","ref","placeToolOverlays","before","overlays","after","at","selectionOverlay","ordered"],"sources":["../../src/canvas/layerOrder.ts"],"sourcesContent":["import type { RenderLayer } from '../core/layers/render';\nimport type { LayerSlotValue } from './Canvas';\nimport { STANDARD_SLOTS, isCustomEntry } from './layerSlots';\nimport type { OverlayPosition } from '@weasel-js/routing';\n\nconst STANDARD_SLOT_SET = new Set<string>(STANDARD_SLOTS);\n\n/**\n * Compose the final ordered layer list from a layersMap and the resolved\n * standard-slot layers.\n *\n * Semantics:\n * - Standard slots are emitted in `STANDARD_SLOTS` order.\n * - Each standard-slot layer is preceded by its `before` chain (deepest first)\n * and followed by its `after` chain (ancestors first).\n * - `after: 'X'` / `before: 'X'` accept standard slot names OR other\n * custom-layer keys, and chains may mix the two — a custom anchored\n * `before` a slot can itself carry an `after` chain, and vice versa.\n * - Customs with neither `after` nor `before` go to a tail bucket emitted\n * after all standard slots.\n * - Dangling references (target unresolvable) go to the tail with a\n * `console.warn`. Cycles are detected and broken with a warning.\n *\n * Pure function — no side effects beyond `console.warn` on malformed input.\n */\nexport function composeOrderedLayers<TNode extends { id: string }, TPose>(\n layersMap: Record<string, LayerSlotValue<TNode, TPose> | null | undefined>,\n standardLayers: Partial<Record<(typeof STANDARD_SLOTS)[number], RenderLayer<unknown>>>,\n /** When the `scene` slot is split into per-scene-layer canvas layers (keyed\n * `scene:<layerId>`), pass them here in render order. Each key becomes an\n * anchor point, so customs can target `before/after: 'scene:<layerId>'`.\n * `before/after: 'scene'` still works (before the first / after the last).\n * When omitted, the `scene` slot uses `standardLayers.scene` as before. */\n sceneLayers?: ReadonlyArray<{ key: string; layer: RenderLayer<unknown> }>,\n /** Drawn beneath everything else, grid and customs anchored before the\n * scene included — a fill that must never cover what is laid over it. */\n background?: RenderLayer<unknown>,\n): RenderLayer<unknown>[] {\n // Map<parent key, [{ key, layer }, ...]> — children grouped by their declared anchor.\n const afterByParent = new Map<string, Array<{ key: string; layer: RenderLayer<unknown> }>>();\n const beforeByParent = new Map<string, Array<{ key: string; layer: RenderLayer<unknown> }>>();\n const tail: Array<{ key: string; layer: RenderLayer<unknown> }> = [];\n const allCustomKeys = new Set<string>();\n\n for (const [key, value] of Object.entries(layersMap)) {\n if (STANDARD_SLOT_SET.has(key)) continue;\n if (!isCustomEntry(value)) continue;\n allCustomKeys.add(key);\n if (value.after) {\n const arr = afterByParent.get(value.after) ?? [];\n arr.push({ key, layer: value.layer });\n afterByParent.set(value.after, arr);\n } else if (value.before) {\n const arr = beforeByParent.get(value.before) ?? [];\n arr.push({ key, layer: value.layer });\n beforeByParent.set(value.before, arr);\n } else {\n tail.push({ key, layer: value.layer });\n }\n }\n\n const emitted = new Set<string>();\n const out: RenderLayer<unknown>[] = background ? [background] : [];\n\n function emitChild(child: { key: string; layer: RenderLayer<unknown> }) {\n if (emitted.has(child.key)) {\n // Cycle — already emitted via another path. Warn once.\n console.warn(`composeOrderedLayers: cycle detected involving custom layer \"${child.key}\"`);\n return;\n }\n emitted.add(child.key);\n emitBefore(child.key);\n out.push(child.layer);\n emitAfter(child.key);\n }\n\n function emitAfter(parentKey: string) {\n for (const child of afterByParent.get(parentKey) ?? []) emitChild(child);\n }\n\n function emitBefore(parentKey: string) {\n for (const child of beforeByParent.get(parentKey) ?? []) emitChild(child);\n }\n\n for (const slot of STANDARD_SLOTS) {\n if (slot === 'scene' && sceneLayers) {\n // Split scene slot: emit each per-scene-layer canvas layer in order, with\n // its own anchor point. `before/after: 'scene'` brackets the whole group.\n emitBefore('scene');\n for (const sl of sceneLayers) {\n emitBefore(sl.key);\n out.push(sl.layer);\n emitAfter(sl.key);\n }\n emitAfter('scene');\n continue;\n }\n emitBefore(slot);\n const layer = standardLayers[slot];\n if (layer) out.push(layer);\n emitAfter(slot);\n }\n\n // Tail customs (neither after nor before).\n for (const t of tail) {\n if (emitted.has(t.key)) continue;\n emitted.add(t.key);\n out.push(t.layer);\n }\n\n // Orphans: customs that declared an `after`/`before` but never got emitted\n // (target didn't resolve through any chain to a known standard slot or custom).\n for (const key of allCustomKeys) {\n if (emitted.has(key)) continue;\n const value = layersMap[key];\n if (!isCustomEntry(value)) continue;\n const ref = value.after ?? value.before;\n console.warn(`composeOrderedLayers: dangling reference \"${ref}\" from custom layer \"${key}\" — falling back to tail`);\n emitted.add(key);\n out.push(value.layer);\n }\n\n return out;\n}\n\n/**\n * Splice a tool's positioned overlays into an already-composed layer list.\n *\n * `'top'` appends; the other two anchor on the selection-chrome layer's index\n * in `ordered`. With no selection chrome present the anchored overlays fall\n * back to the tail, keeping their relative order. Mutates and returns\n * `ordered`.\n */\nexport function placeToolOverlays(\n ordered: RenderLayer<unknown>[],\n selectionOverlay: RenderLayer<unknown> | undefined,\n overlays: (position: OverlayPosition) => RenderLayer<unknown>[],\n): RenderLayer<unknown>[] {\n const before = overlays('before-selection');\n const after = overlays('after-selection');\n const at = selectionOverlay ? ordered.indexOf(selectionOverlay) : -1;\n if (at >= 0) {\n ordered.splice(at + 1, 0, ...after);\n ordered.splice(at, 0, ...before);\n } else {\n ordered.push(...before, ...after);\n }\n ordered.push(...overlays('top'));\n return ordered;\n}\n"],"mappings":";;AAKA,IAAMA,IAAoB,IAAI,IAAYC,CAAc;AAoBxD,SAAgBC,EACd,GACA,GAMA,GAGA,GACwB;CAExB,IAAMC,oBAAgB,IAAI,IAAiE,GACrFC,oBAAiB,IAAI,IAAiE,GACtFC,IAA4D,CAAC,GAC7DC,oBAAgB,IAAI,IAAY;CAEtC,KAAK,IAAM,CAACC,G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FAJ,EAAWK,EAAG,GAAG,GACjBT,EAAI,KAAKS,EAAG,KAAK,GACjBJ,EAAUI,EAAG,GAAG;GAElB,EAAU,OAAO;GACjB;EACF;EACA,EAAWF,CAAI;EACf,IAAMG,IAAQC,EAAeJ;EAE7B,AADIG,KAAOV,EAAI,KAAKU,CAAK,GACzBL,EAAUE,CAAI;CAChB;CAGA,KAAK,IAAMK,KAAKpB,GACd,AAAIO,EAAQ,IAAIa,EAAE,GAAG,MACrBb,EAAQ,IAAIa,EAAE,GAAG,GACjBZ,EAAI,KAAKY,EAAE,KAAK;CAKlB,KAAK,IAAMlB,KAAOD,GAAe;EAC/B,IAAIM,EAAQ,IAAIL,CAAG,GAAG;EACtB,IAAMC,IAAQC,EAAUF;EACxB,IAAI,CAACG,EAAcF,CAAK,GAAG;EAC3B,IAAMkB,IAAMlB,EAAM,SAASA,EAAM;EAGjC,AAFA,QAAQ,KAAK,6CAA6CkB,EAAI,uBAAuBnB,EAAI,yBAAyB,GAClHK,EAAQ,IAAIL,CAAG,GACfM,EAAI,KAAKL,EAAM,KAAK;CACtB;CAEA,OAAOK;AACT;AAUA,SAAgBc,EACd,GACA,GACA,GACwB;CACxB,IAAMC,IAASC,EAAS,kBAAkB,GACpCC,IAAQD,EAAS,iBAAiB,GAClCE,IAAKC,IAAmBC,EAAQ,QAAQD,CAAgB,IAAI;CAQlE,OAPID,KAAM,KACRE,EAAQ,OAAOF,IAAK,GAAG,GAAG,GAAGD,CAAK,GAClCG,EAAQ,OAAOF,GAAI,GAAG,GAAGH,CAAM,KAE/BK,EAAQ,KAAK,GAAGL,GAAQ,GAAGE,CAAK,GAElCG,EAAQ,KAAK,GAAGJ,EAAS,KAAK,CAAC,GACxBI;AACT"}
1
+ {"version":3,"file":"layerOrder.js","names":["STANDARD_SLOT_SET","STANDARD_SLOTS","composeOrderedLayers","afterByParent","beforeByParent","tail","allCustomKeys","key","value","layersMap","isCustomEntry","arr","emitted","out","background","emitChild","child","emitBefore","emitAfter","parentKey","slot","sceneLayers","sl","layer","standardLayers","t","anchorOf","inCycle","at","hops","ref","placeToolOverlays","before","overlays","after","selectionOverlay","ordered"],"sources":["../../src/canvas/layerOrder.ts"],"sourcesContent":["import type { RenderLayer } from '../core/layers/render';\nimport { STANDARD_SLOTS, isCustomEntry } from './layerSlots';\nimport type { OverlayPosition } from '@weasel-js/routing';\n\nconst STANDARD_SLOT_SET = new Set<string>(STANDARD_SLOTS);\n\n/**\n * Compose the final ordered layer list from a layersMap and the resolved\n * standard-slot layers.\n *\n * - Standard slots are emitted in `STANDARD_SLOTS` order.\n * - `after: 'X'` / `before: 'X'` accept standard slot names OR other\n * custom-layer keys, and chains may mix the two.\n * - Customs with neither `after` nor `before` are emitted after all standard\n * slots.\n * - Dangling references and cycles go to the tail with a `console.warn`.\n * - An entry with both `after` and `before` is placed by `after`.\n */\nexport function composeOrderedLayers(\n layersMap: Record<string, unknown>,\n standardLayers: Partial<Record<(typeof STANDARD_SLOTS)[number], RenderLayer<unknown>>>,\n /** The `scene` slot split into per-scene-layer canvas layers (keyed\n * `scene:<layerId>`), in render order. Each key becomes an anchor point;\n * `before/after: 'scene'` brackets the whole group. When omitted, the\n * `scene` slot uses `standardLayers.scene`. */\n sceneLayers?: ReadonlyArray<{ key: string; layer: RenderLayer<unknown> }>,\n /** Drawn beneath everything else, grid and customs anchored before the\n * scene included — a fill that must never cover what is laid over it. */\n background?: RenderLayer<unknown>,\n): RenderLayer<unknown>[] {\n // Map<parent key, [{ key, layer }, ...]> — children grouped by their declared anchor.\n const afterByParent = new Map<string, Array<{ key: string; layer: RenderLayer<unknown> }>>();\n const beforeByParent = new Map<string, Array<{ key: string; layer: RenderLayer<unknown> }>>();\n const tail: Array<{ key: string; layer: RenderLayer<unknown> }> = [];\n const allCustomKeys = new Set<string>();\n\n for (const [key, value] of Object.entries(layersMap)) {\n if (STANDARD_SLOT_SET.has(key)) continue;\n if (!isCustomEntry(value)) continue;\n allCustomKeys.add(key);\n if (value.after) {\n const arr = afterByParent.get(value.after) ?? [];\n arr.push({ key, layer: value.layer });\n afterByParent.set(value.after, arr);\n } else if (value.before) {\n const arr = beforeByParent.get(value.before) ?? [];\n arr.push({ key, layer: value.layer });\n beforeByParent.set(value.before, arr);\n } else {\n tail.push({ key, layer: value.layer });\n }\n }\n\n const emitted = new Set<string>();\n const out: RenderLayer<unknown>[] = background ? [background] : [];\n\n function emitChild(child: { key: string; layer: RenderLayer<unknown> }) {\n // A custom has one anchor, so it is reached twice only when `sceneLayers`\n // repeats a key.\n if (emitted.has(child.key)) return;\n emitted.add(child.key);\n emitBefore(child.key);\n out.push(child.layer);\n emitAfter(child.key);\n }\n\n function emitAfter(parentKey: string) {\n for (const child of afterByParent.get(parentKey) ?? []) emitChild(child);\n }\n\n function emitBefore(parentKey: string) {\n for (const child of beforeByParent.get(parentKey) ?? []) emitChild(child);\n }\n\n for (const slot of STANDARD_SLOTS) {\n if (slot === 'scene' && sceneLayers) {\n emitBefore('scene');\n for (const sl of sceneLayers) {\n emitBefore(sl.key);\n out.push(sl.layer);\n emitAfter(sl.key);\n }\n emitAfter('scene');\n continue;\n }\n emitBefore(slot);\n const layer = standardLayers[slot];\n if (layer) out.push(layer);\n emitAfter(slot);\n }\n\n for (const t of tail) {\n if (emitted.has(t.key)) continue;\n emitted.add(t.key);\n out.push(t.layer);\n }\n\n const anchorOf = (key: string): string | undefined => {\n const value = layersMap[key];\n return isCustomEntry(value) ? value.after ?? value.before : undefined;\n };\n const inCycle = (key: string): boolean => {\n let at = anchorOf(key);\n for (let hops = 0; at !== undefined && hops < allCustomKeys.size; hops++) {\n if (at === key) return true;\n at = anchorOf(at);\n }\n return false;\n };\n\n // Orphans: customs that declared an `after`/`before` but never got emitted,\n // because the chain of anchors loops or ends on a key nothing defines.\n for (const key of allCustomKeys) {\n if (emitted.has(key)) continue;\n const value = layersMap[key];\n if (!isCustomEntry(value)) continue;\n const ref = value.after ?? value.before;\n console.warn(inCycle(key)\n ? `composeOrderedLayers: cycle detected involving custom layer \"${key}\" — falling back to tail`\n : `composeOrderedLayers: dangling reference \"${ref}\" from custom layer \"${key}\" — falling back to tail`);\n emitted.add(key);\n out.push(value.layer);\n }\n\n return out;\n}\n\n/**\n * Splice a tool's positioned overlays into an already-composed layer list.\n * With no selection chrome present the anchored overlays fall back to the\n * tail, keeping their relative order. Mutates and returns `ordered`.\n */\nexport function placeToolOverlays(\n ordered: RenderLayer<unknown>[],\n selectionOverlay: RenderLayer<unknown> | undefined,\n overlays: (position: OverlayPosition) => RenderLayer<unknown>[],\n): RenderLayer<unknown>[] {\n const before = overlays('before-selection');\n const after = overlays('after-selection');\n const at = selectionOverlay ? ordered.indexOf(selectionOverlay) : -1;\n if (at >= 0) {\n ordered.splice(at + 1, 0, ...after);\n ordered.splice(at, 0, ...before);\n } else {\n ordered.push(...before, ...after);\n }\n ordered.push(...overlays('top'));\n return ordered;\n}\n"],"mappings":";;AAIA,IAAMA,IAAoB,IAAI,IAAYC,CAAc;AAcxD,SAAgBC,EACd,GACA,GAKA,GAGA,GACwB;CAExB,IAAMC,oBAAgB,IAAI,IAAiE,GACrFC,oBAAiB,IAAI,IAAiE,GACtFC,IAA4D,CAAC,GAC7DC,oBAAgB,IAAI,IAAY;CAEtC,KAAK,IAAM,CAACC,GAAKC,MAAU,OAAO,QAAQC,CAAS,GACjD,IAAI,GAAkB,IAAIF,CAAG,KACxBG,EAAcF,CAAK,GAExB;MADAF,EAAc,IAAIC,CAAG,GACjBC,EAAM,OAAO;GACf,IAAMG,IAAMR,EAAc,IAAIK,EAAM,KAAK,KAAK,CAAC;GAE/C,AADAG,EAAI,KAAK;IAAE;IAAK,OAAOH,EAAM;GAAM,CAAC,GACpCL,EAAc,IAAIK,EAAM,OAAOG,CAAG;EACpC,OAAO,IAAIH,EAAM,QAAQ;GACvB,IAAMG,IAAMP,EAAe,IAAII,EAAM,MAAM,KAAK,CAAC;GAEjD,AADAG,EAAI,KAAK;IAAE;IAAK,OAAOH,EAAM;GAAM,CAAC,GACp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