@weasel-js/core 1.15.0 → 1.15.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (838) hide show
  1. package/CHANGELOG.md +199 -0
  2. package/dist/WeaselProvider.js +4 -5
  3. package/dist/affordances/composeAffordanceLayer.js +1 -2
  4. package/dist/affordances/cornerResize.js +4 -5
  5. package/dist/affordances/hitAffordanceRegions.js +1 -2
  6. package/dist/affordances/pathAnchors.js +1 -2
  7. package/dist/affordances/rotateCursor.js +1 -2
  8. package/dist/affordances/rotationHandle.js +2 -3
  9. package/dist/animation/behaviors/coast.js +1 -2
  10. package/dist/animation/behaviors/coastByWrite.js +2 -3
  11. package/dist/animation/behaviors/coastOnTargets.js +2 -3
  12. package/dist/animation/behaviors/momentum.js +1 -2
  13. package/dist/animation/clipTargets.js +1 -2
  14. package/dist/animation/departures.js +2 -3
  15. package/dist/animation/poseHelpers.js +2 -3
  16. package/dist/animation/poseTarget.js +5 -6
  17. package/dist/animation/poseTarget.js.map +1 -1
  18. package/dist/animation/poseTransition.js +1 -2
  19. package/dist/animation/reflow.js +9 -10
  20. package/dist/animation/reflow.js.map +1 -1
  21. package/dist/animation/rewind.js +1 -2
  22. package/dist/animation/rig/bindRig.js +2 -3
  23. package/dist/animation/rig/rigNode.js +3 -4
  24. package/dist/animation/rig/rigNode.js.map +1 -1
  25. package/dist/animation/rig/rigSeat.js +1 -2
  26. package/dist/animation/rig/skinBinding.js +1 -2
  27. package/dist/animation/rig/useRig.js +2 -3
  28. package/dist/animation/wrappers/animateLifecycle.js +1 -2
  29. package/dist/animation/wrappers/animateOnSetPose.js +1 -2
  30. package/dist/animation/wrappers/instantPose.js +1 -2
  31. package/dist/animation/writtenPoseTarget.js +1 -2
  32. package/dist/barrel/input.js +2 -1
  33. package/dist/barrel/interactions.js +2 -1
  34. package/dist/barrel/paint.js +2 -2
  35. package/dist/barrel/routing.js +2 -2
  36. package/dist/barrel/scene.js +2 -2
  37. package/dist/barrel/viewport.js +3 -3
  38. package/dist/canvas/Canvas.js +5 -6
  39. package/dist/canvas/CanvasView.js +6 -7
  40. package/dist/canvas/CursorCoordsHud.js +2 -3
  41. package/dist/canvas/DrawCanvas.js +3 -4
  42. package/dist/canvas/GestureReason.js +1 -2
  43. package/dist/canvas/GestureReason.module.js +1 -2
  44. package/dist/canvas/LeanSceneCanvas.js +2 -3
  45. package/dist/canvas/ModalityHud.js +2 -3
  46. package/dist/canvas/NodeShape.js +3 -4
  47. package/dist/canvas/PickHud.js +2 -3
  48. package/dist/canvas/SceneCanvas/ActionsProviderIfRoot.js +1 -2
  49. package/dist/canvas/SceneCanvas/CanvasKitProviders.js +3 -4
  50. package/dist/canvas/SceneCanvas/DepRegistryProviderIfRoot.js +1 -2
  51. package/dist/canvas/SceneCanvas/DevHuds.js +1 -2
  52. package/dist/canvas/SceneCanvas/PointerProviderIfRoot.js +18 -66
  53. package/dist/canvas/SceneCanvas/PointerProviderIfRoot.js.map +1 -1
  54. package/dist/canvas/SceneCanvas/SceneCanvasInput.js +4 -5
  55. package/dist/canvas/SceneCanvas/SurfaceDeclarations.js +1 -2
  56. package/dist/canvas/SceneCanvas/brushOverlay.js +1 -2
  57. package/dist/canvas/SceneCanvas/builtinToolSets.js +1 -2
  58. package/dist/canvas/SceneCanvas/canvasPassThrough.js +1 -2
  59. package/dist/canvas/SceneCanvas/contributionFrameHooks.js +1 -2
  60. package/dist/canvas/SceneCanvas/coordTrace.js +1 -2
  61. package/dist/canvas/SceneCanvas/defaultNodeProperties.js +3 -4
  62. package/dist/canvas/SceneCanvas/defaultNodeRouting.js +1 -2
  63. package/dist/canvas/SceneCanvas/defaultTextEditor.js +4 -5
  64. package/dist/canvas/SceneCanvas/describePresets.js +1 -2
  65. package/dist/canvas/SceneCanvas/dispatcherGestureBounds.js +1 -2
  66. package/dist/canvas/SceneCanvas/features.js +1 -2
  67. package/dist/canvas/SceneCanvas/insertPreviewCommands.js +1 -2
  68. package/dist/canvas/SceneCanvas/mergeLayers.js +1 -2
  69. package/dist/canvas/SceneCanvas/namedPresets.js +5 -6
  70. package/dist/canvas/SceneCanvas/poseGeometry.js +1 -2
  71. package/dist/canvas/SceneCanvas/poseRegistrars.js +1 -2
  72. package/dist/canvas/SceneCanvas/presets/arrange.js +2 -3
  73. package/dist/canvas/SceneCanvas/presets/baseline.js +1 -2
  74. package/dist/canvas/SceneCanvas/presets/chrome.js +1 -2
  75. package/dist/canvas/SceneCanvas/presets/composites.js +1 -2
  76. package/dist/canvas/SceneCanvas/presets/edit.js +4 -5
  77. package/dist/canvas/SceneCanvas/presets/ingest.js +1 -2
  78. package/dist/canvas/SceneCanvas/presets/paths.js +3 -4
  79. package/dist/canvas/SceneCanvas/presets/select.js +1 -2
  80. package/dist/canvas/SceneCanvas/presets/toolDriven.js +2 -3
  81. package/dist/canvas/SceneCanvas/presets/tools.js +1 -2
  82. package/dist/canvas/SceneCanvas/presets/transform.js +2 -3
  83. package/dist/canvas/SceneCanvas/presets/view.js +2 -3
  84. package/dist/canvas/SceneCanvas/props.js +1 -2
  85. package/dist/canvas/SceneCanvas/scenePointQuery.js +2 -3
  86. package/dist/canvas/SceneCanvas/shapeGeneratorProperties.js +1 -2
  87. package/dist/canvas/SceneCanvas/toolRegistry.js +2 -3
  88. package/dist/canvas/SceneCanvas/useActionTunings.js +1 -2
  89. package/dist/canvas/SceneCanvas/useActionsPropResolver.js +1 -2
  90. package/dist/canvas/SceneCanvas/useBakedScene.js +2 -3
  91. package/dist/canvas/SceneCanvas/useBuiltinShapeTools.js +7 -8
  92. package/dist/canvas/SceneCanvas/useBuiltinTools.js +2 -3
  93. package/dist/canvas/SceneCanvas/useCanvasCamera.js +2 -3
  94. package/dist/canvas/SceneCanvas/useCanvasDevtoolsRoot.js +1 -2
  95. package/dist/canvas/SceneCanvas/useCanvasDispatcher.js +1 -2
  96. package/dist/canvas/SceneCanvas/useCanvasSelection.js +8 -6
  97. package/dist/canvas/SceneCanvas/useCanvasSelection.js.map +1 -1
  98. package/dist/canvas/SceneCanvas/useCanvasTools.js +2 -3
  99. package/dist/canvas/SceneCanvas/useChromeAffordances.js +2 -3
  100. package/dist/canvas/SceneCanvas/useContributionRoles.js +1 -2
  101. package/dist/canvas/SceneCanvas/useDepartureGhostLayer.js +4 -5
  102. package/dist/canvas/SceneCanvas/useDispatcherOverlayLayer.js +2 -3
  103. package/dist/canvas/SceneCanvas/useHeldModifiers.js +1 -2
  104. package/dist/canvas/SceneCanvas/useMagnificationCheck.js +41 -0
  105. package/dist/canvas/SceneCanvas/useMagnificationCheck.js.map +1 -0
  106. package/dist/canvas/SceneCanvas/useNodeAtPoint.js +1 -2
  107. package/dist/canvas/SceneCanvas/useNodeKinds.js +2 -3
  108. package/dist/canvas/SceneCanvas/usePreviewGhostLayer.js +10 -11
  109. package/dist/canvas/SceneCanvas/useSceneCanvasHandle.js +1 -2
  110. package/dist/canvas/SceneCanvas/useSceneCanvasLayers.js +6 -7
  111. package/dist/canvas/SceneCanvas/useSceneCanvasPathEdit.js +1 -2
  112. package/dist/canvas/SceneCanvas/useSceneCanvasTools.js +1 -2
  113. package/dist/canvas/SceneCanvas/useSceneChrome.js +5 -6
  114. package/dist/canvas/SceneCanvas/useSceneGestureDispatcher.js +6 -7
  115. package/dist/canvas/SceneCanvas/useScenePicking.js +5 -6
  116. package/dist/canvas/SceneCanvas/useSceneRedrawSources.js +1 -2
  117. package/dist/canvas/SceneCanvas/useSceneSelectTool.js +7 -8
  118. package/dist/canvas/SceneCanvas/useSceneSlotLayers.js +2 -3
  119. package/dist/canvas/SceneCanvas/useSceneStandardActions.js +26 -18
  120. package/dist/canvas/SceneCanvas/useSceneStandardActions.js.map +1 -1
  121. package/dist/canvas/SceneCanvas/useSelectionOverlayLayer.js +2 -3
  122. package/dist/canvas/SceneCanvas/useSurfaceRouting.js +1 -2
  123. package/dist/canvas/SceneCanvas/useSurfaceViewInputs.js +1 -2
  124. package/dist/canvas/SceneCanvas/useToolKeybindings.js +1 -2
  125. package/dist/canvas/SceneCanvas/useViewportActions.js +3 -4
  126. package/dist/canvas/SceneCanvas/worldPointAt.js +1 -2
  127. package/dist/canvas/SceneCanvas.js +18 -17
  128. package/dist/canvas/SceneCanvas.js.map +1 -1
  129. package/dist/canvas/SceneViewCanvas.js +2 -3
  130. package/dist/canvas/SurfaceCanvas.js +1 -2
  131. package/dist/canvas/ViewMarker.js +1 -2
  132. package/dist/canvas/accentColor.js +4 -5
  133. package/dist/canvas/accentColor.js.map +1 -1
  134. package/dist/canvas/adapterDerivedPath.js +2 -3
  135. package/dist/canvas/adapterPickSource.js +1 -2
  136. package/dist/canvas/affordanceAt.js +2 -3
  137. package/dist/canvas/buildSceneLayer.js +4 -5
  138. package/dist/canvas/buildSceneTree.js +4 -5
  139. package/dist/canvas/canvasRenderer.js +1 -2
  140. package/dist/canvas/colorOverrides.js +1 -2
  141. package/dist/canvas/contextAttributes.js +1 -2
  142. package/dist/canvas/copiesAbove.js +1 -2
  143. package/dist/canvas/defaultDrawOne.js +1 -2
  144. package/dist/canvas/deps/areaSelect.js +5 -3
  145. package/dist/canvas/deps/areaSelect.js.map +1 -1
  146. package/dist/canvas/deps/booleans.js +5 -6
  147. package/dist/canvas/deps/changes.js +1 -2
  148. package/dist/canvas/deps/chromeRules.js +1 -2
  149. package/dist/canvas/deps/debug.js +1 -2
  150. package/dist/canvas/deps/dispatchSources.js +1 -2
  151. package/dist/canvas/deps/dispatcher.js +1 -2
  152. package/dist/canvas/deps/editAnchors.js +3 -4
  153. package/dist/canvas/deps/enteredGroup.js +6 -6
  154. package/dist/canvas/deps/enteredGroup.js.map +1 -1
  155. package/dist/canvas/deps/geometryProjection.js +1 -2
  156. package/dist/canvas/deps/hitTestArea.js +4 -5
  157. package/dist/canvas/deps/ingestion.js +1 -2
  158. package/dist/canvas/deps/insert.js +3 -4
  159. package/dist/canvas/deps/insertSite.js +3 -4
  160. package/dist/canvas/deps/kitSettings.js +1 -2
  161. package/dist/canvas/deps/lassoSelect.js +5 -3
  162. package/dist/canvas/deps/lassoSelect.js.map +1 -1
  163. package/dist/canvas/deps/layout.js +1 -2
  164. package/dist/canvas/deps/modeDefaultTool.js +1 -2
  165. package/dist/canvas/deps/nodeAtPoint.js +1 -2
  166. package/dist/canvas/deps/pathEditCommits.js +4 -5
  167. package/dist/canvas/deps/pathLeaf.js +1 -2
  168. package/dist/canvas/deps/pathLeafDeps.js +2 -3
  169. package/dist/canvas/deps/poseDescriptor.js +1 -2
  170. package/dist/canvas/deps/previewPaths.js +1 -2
  171. package/dist/canvas/deps/resizePolicy.js +1 -2
  172. package/dist/canvas/deps/selectionSnapshot.js +8 -4
  173. package/dist/canvas/deps/selectionSnapshot.js.map +1 -1
  174. package/dist/canvas/deps/slice.js +5 -6
  175. package/dist/canvas/deps/snap.js +3 -4
  176. package/dist/canvas/deps/surface.js +1 -2
  177. package/dist/canvas/deps/textEdit.js +1 -2
  178. package/dist/canvas/deps/transformFollowers.js +1 -2
  179. package/dist/canvas/deps/view.js +1 -2
  180. package/dist/canvas/derivedPath.js +6 -7
  181. package/dist/canvas/doubleClickTarget.js +1 -2
  182. package/dist/canvas/drawEnvelope.js +1 -2
  183. package/dist/canvas/drawnBounds.js +4 -5
  184. package/dist/canvas/getNodeAtPoint.js +1 -2
  185. package/dist/canvas/hostAnchor.js +1 -2
  186. package/dist/canvas/hud.module.js +1 -2
  187. package/dist/canvas/inheritedPaints.js +1 -2
  188. package/dist/canvas/insertPreviewExtent.js +1 -2
  189. package/dist/canvas/kitRequirements.js +1 -2
  190. package/dist/canvas/layerHover.js +1 -2
  191. package/dist/canvas/layerOrder.js +1 -2
  192. package/dist/canvas/layerSlots.js +1 -2
  193. package/dist/canvas/mountedCanvases.js +1 -2
  194. package/dist/canvas/nodeShapes/derivedPainter.js +2 -3
  195. package/dist/canvas/nodeShapes/imagePainter.js +1 -2
  196. package/dist/canvas/nodeShapes/measurePainter.js +2 -3
  197. package/dist/canvas/nodeShapes/memo.js +1 -2
  198. package/dist/canvas/nodeShapes/nodePaint.js +1 -2
  199. package/dist/canvas/nodeShapes/pathPainter.js +3 -4
  200. package/dist/canvas/nodeShapes/poseBox.js +1 -2
  201. package/dist/canvas/nodeShapes/rectFallbackPainter.js +1 -2
  202. package/dist/canvas/nodeShapes/shapePainter.js +2 -3
  203. package/dist/canvas/nodeShapes/strokedBounds.js +1 -2
  204. package/dist/canvas/nodeShapes/textPainter.js +1 -2
  205. package/dist/canvas/overChildren.js +1 -2
  206. package/dist/canvas/overlayRoleStrokes.js +1 -2
  207. package/dist/canvas/ownClip.js +1 -2
  208. package/dist/canvas/paintCull.js +1 -2
  209. package/dist/canvas/paintedCursorLayer.js +1 -2
  210. package/dist/canvas/pathOverlay.js +1 -2
  211. package/dist/canvas/pickIndex/nodeBroadBox.js +3 -4
  212. package/dist/canvas/pickIndex/scenePickIndex.js +3 -4
  213. package/dist/canvas/pickReach.js +1 -2
  214. package/dist/canvas/pickWalk.js +2 -3
  215. package/dist/canvas/planeClips.js +1 -2
  216. package/dist/canvas/poseRotation.js +1 -2
  217. package/dist/canvas/publishPreviews.js +1 -2
  218. package/dist/canvas/rasterReadback.js +1 -2
  219. package/dist/canvas/rasterToPng.js +1 -2
  220. package/dist/canvas/renderDebugSnapshot.js +1 -2
  221. package/dist/canvas/renderNeeds.js +1 -2
  222. package/dist/canvas/renderSceneToPixels.js +5 -6
  223. package/dist/canvas/sceneAdapter.js +37 -27
  224. package/dist/canvas/sceneAdapter.js.map +1 -1
  225. package/dist/canvas/sceneClipboard.js +19 -7
  226. package/dist/canvas/sceneClipboard.js.map +1 -1
  227. package/dist/canvas/sceneLayerPaint.js +1 -2
  228. package/dist/canvas/scenePickReads.js +1 -2
  229. package/dist/canvas/scenePickSource.js +5 -6
  230. package/dist/canvas/sceneSlotWiring.js +2 -3
  231. package/dist/canvas/sceneViewRender.js +5 -6
  232. package/dist/canvas/shownNodes.js +1 -2
  233. package/dist/canvas/slopsDebugLayer.js +9 -4
  234. package/dist/canvas/slopsDebugLayer.js.map +1 -1
  235. package/dist/canvas/surfaceContribution.js +1 -2
  236. package/dist/canvas/useCanvasElements.js +1 -2
  237. package/dist/canvas/useCanvasHandle.js +1 -2
  238. package/dist/canvas/useCanvasPaint.js +2 -3
  239. package/dist/canvas/useCanvasRenderer.js +1 -2
  240. package/dist/canvas/useCanvasSurface.js +1 -2
  241. package/dist/canvas/useCanvasView.js +2 -3
  242. package/dist/canvas/useClientToWorld.js +1 -2
  243. package/dist/canvas/useExtraLayers.js +1 -2
  244. package/dist/canvas/useFrameLoop.js +1 -2
  245. package/dist/canvas/useHitObserver.js +1 -2
  246. package/dist/canvas/useHostAnchor.js +1 -2
  247. package/dist/canvas/useInFlightBounds.js +6 -6
  248. package/dist/canvas/useInFlightBounds.js.map +1 -1
  249. package/dist/canvas/useLateContentRedraw.js +1 -2
  250. package/dist/canvas/useLayerStack.js +2 -3
  251. package/dist/canvas/usePaintedCursor.js +1 -2
  252. package/dist/canvas/useRedrawOn.js +1 -2
  253. package/dist/canvas/useSceneAdapter.js +1 -2
  254. package/dist/canvas/useSceneLayerList.js +1 -2
  255. package/dist/canvas/useSurfaceInput.js +1 -2
  256. package/dist/canvas/useSurfaceSize.js +1 -2
  257. package/dist/canvas/useToolCursor.js +1 -2
  258. package/dist/canvas/useViewAim.js +2 -3
  259. package/dist/canvas/useViewHelpers.js +5 -4
  260. package/dist/canvas/useViewHelpers.js.map +1 -1
  261. package/dist/canvas/useViewLayerGate.js +1 -2
  262. package/dist/canvas/useViewNesting.js +1 -2
  263. package/dist/canvas/useViewRegistrySurface.js +7 -5
  264. package/dist/canvas/useViewRegistrySurface.js.map +1 -1
  265. package/dist/canvas/viewInputs.js +1 -2
  266. package/dist/canvas/viewMarkers.js +1 -2
  267. package/dist/canvas/viewRegistry.js +6 -7
  268. package/dist/canvas/viewRegistry.js.map +1 -1
  269. package/dist/canvas/viewSnap.js +1 -2
  270. package/dist/canvas/watchElementMove.js +1 -2
  271. package/dist/canvas/wrapNodeOutput.js +1 -2
  272. package/dist/core/adapters/testing/rootsTree.js +1 -2
  273. package/dist/core/applyOps.js +1 -2
  274. package/dist/core/device/targets.js +1 -2
  275. package/dist/core/device/useDeviceProfile.js +1 -2
  276. package/dist/core/device/useTargetBasePx.js +1 -2
  277. package/dist/core/device/watchDevicePixelRatio.js +1 -2
  278. package/dist/core/geometry/autoPoseDescriptor.js +2 -3
  279. package/dist/core/geometry/booleanOfPaths.js +1 -2
  280. package/dist/core/geometry/inkExtents.js +1 -2
  281. package/dist/core/geometry/pathPoseDescriptor.js +1 -2
  282. package/dist/core/geometry/poseDescriptor.js +1 -2
  283. package/dist/core/geometry/regionHit.js +1 -2
  284. package/dist/core/geometry/targetFrame.js +1 -2
  285. package/dist/core/geometry/unionBounds.js +1 -2
  286. package/dist/core/layers/backgroundFill.js +1 -2
  287. package/dist/core/layers/children.js +1 -2
  288. package/dist/core/layers/gateLayer.js +1 -2
  289. package/dist/core/layers/layerGroup.js +1 -2
  290. package/dist/core/layers/redrawSource.js +1 -2
  291. package/dist/core/layers/render.js +1 -2
  292. package/dist/core/layers/retain.js +1 -2
  293. package/dist/core/ops/arrange.js +1 -2
  294. package/dist/core/ops/create.js +2 -3
  295. package/dist/core/ops/createHistory.js +2 -3
  296. package/dist/core/ops/delete.js +2 -3
  297. package/dist/core/ops/nodeFlags.js +1 -2
  298. package/dist/core/ops/registry.js +1 -2
  299. package/dist/core/ops/reorder/algorithms.js +1 -2
  300. package/dist/core/ops/reorder/index.js +3 -8
  301. package/dist/core/ops/reorder/index.js.map +1 -1
  302. package/dist/core/ops/reorder/setChildOrder.js +1 -2
  303. package/dist/core/ops/reparent.js +1 -2
  304. package/dist/core/ops/select.js +1 -2
  305. package/dist/core/ops/setData.js +1 -2
  306. package/dist/core/ops/setDependsOn.js +1 -2
  307. package/dist/core/ops/setLayer.js +1 -2
  308. package/dist/core/ops/setLayout.js +1 -2
  309. package/dist/core/ops/setPath.js +1 -2
  310. package/dist/core/ops/setText.js +1 -2
  311. package/dist/core/ops/slot.js +1 -2
  312. package/dist/core/ops/transform.js +1 -2
  313. package/dist/core/ops/writtenBy.js +1 -2
  314. package/dist/core/pages/fitViewToPage.js +3 -9
  315. package/dist/core/pages/fitViewToPage.js.map +1 -1
  316. package/dist/core/pages/pageEdits.js +3 -4
  317. package/dist/core/pages/pages.js +4 -11
  318. package/dist/core/pages/pages.js.map +1 -1
  319. package/dist/core/pages/pagesLayer.js +1 -2
  320. package/dist/core/paint/meshKind.js +1 -2
  321. package/dist/core/paint/meshKindLazy.js +18 -23
  322. package/dist/core/paint/meshKindLazy.js.map +1 -1
  323. package/dist/core/paint/paintKindEntry.js +1 -2
  324. package/dist/core/paint/paintKinds.js +1 -2
  325. package/dist/core/paint/registerMesh.js +1 -2
  326. package/dist/core/scene/NodeProperties.js +1 -2
  327. package/dist/core/scene/NodeRouting.js +1 -2
  328. package/dist/core/scene/annotation.js +1 -2
  329. package/dist/core/scene/appliedLog.js +1 -2
  330. package/dist/core/scene/arrivalWindow.js +2 -3
  331. package/dist/core/scene/arrivals.js +1 -2
  332. package/dist/core/scene/booleanGroup.js +1 -2
  333. package/dist/core/scene/booleanOfChildren.js +1 -2
  334. package/dist/core/scene/boundOps.js +1 -2
  335. package/dist/core/scene/carryDescendants.js +2 -3
  336. package/dist/core/scene/clipNothing.js +1 -2
  337. package/dist/core/scene/composeFrame.js +1 -2
  338. package/dist/core/scene/composePose.js +1 -2
  339. package/dist/core/scene/declaredFieldSetters.js +1 -2
  340. package/dist/core/scene/depFrame.js +1 -2
  341. package/dist/core/scene/depMemo.js +1 -2
  342. package/dist/core/scene/dependents.js +1 -2
  343. package/dist/core/scene/derivedParts.js +1 -2
  344. package/dist/core/scene/derivedPath.js +2 -3
  345. package/dist/core/scene/docValues.js +1 -2
  346. package/dist/core/scene/documentOf.js +1 -2
  347. package/dist/core/scene/editMode.js +1 -2
  348. package/dist/core/scene/editPass.js +1 -2
  349. package/dist/core/scene/effectivePose.js +3 -4
  350. package/dist/core/scene/fieldEdits.js +1 -2
  351. package/dist/core/scene/fontReads.js +1 -2
  352. package/dist/core/scene/historyFacade.js +1 -2
  353. package/dist/core/scene/historyForm.js +1 -2
  354. package/dist/core/scene/inheritedPaint.js +1 -2
  355. package/dist/core/scene/kitOps.js +16 -15
  356. package/dist/core/scene/kitOps.js.map +1 -1
  357. package/dist/core/scene/kitRegistry.js +2 -3
  358. package/dist/core/scene/layerOps.js +1 -2
  359. package/dist/core/scene/layerStack.js +1 -2
  360. package/dist/core/scene/layoutPass.js +4 -5
  361. package/dist/core/scene/lockGuard.js +1 -2
  362. package/dist/core/scene/minSize.js +1 -2
  363. package/dist/core/scene/nestedHit.js +1 -2
  364. package/dist/core/scene/nodeAsShown.js +1 -2
  365. package/dist/core/scene/nodeFlags.js +1 -2
  366. package/dist/core/scene/nodeFnFields.js +1 -2
  367. package/dist/core/scene/nodeGates.js +1 -2
  368. package/dist/core/scene/nodeMemo.js +1 -2
  369. package/dist/core/scene/nodeStore.js +2 -3
  370. package/dist/core/scene/notifier.js +1 -2
  371. package/dist/core/scene/opTable.js +1 -2
  372. package/dist/core/scene/outerOps.js +1 -2
  373. package/dist/core/scene/pathEffects/blend.js +3 -4
  374. package/dist/core/scene/pathEffects/blend.js.map +1 -1
  375. package/dist/core/scene/pathEffects/derive.js +2 -3
  376. package/dist/core/scene/pathEffects/effects.js +1 -2
  377. package/dist/core/scene/pathEffects/foundHidden.js +1 -2
  378. package/dist/core/scene/pathEffects/textAlong.js +6 -6
  379. package/dist/core/scene/pathEffects/textAlong.js.map +1 -1
  380. package/dist/core/scene/pathEffects/textAlongBands.js +1 -2
  381. package/dist/core/scene/plyStacks.js +1 -2
  382. package/dist/core/scene/poseFeed.js +1 -2
  383. package/dist/core/scene/poseHold.js +1 -2
  384. package/dist/core/scene/poseOverrides.js +1 -2
  385. package/dist/core/scene/posePlies.js +1 -2
  386. package/dist/core/scene/poseRemovals.js +1 -2
  387. package/dist/core/scene/poseSnapshot.js +1 -2
  388. package/dist/core/scene/poseWrites.js +1 -2
  389. package/dist/core/scene/reconcileSpecs.js +26 -3
  390. package/dist/core/scene/reconcileSpecs.js.map +1 -1
  391. package/dist/core/scene/recorder.js +1 -2
  392. package/dist/core/scene/renderOrder.js +1 -2
  393. package/dist/core/scene/sameValue.js +1 -2
  394. package/dist/core/scene/scene.js +23 -13
  395. package/dist/core/scene/scene.js.map +1 -1
  396. package/dist/core/scene/sceneChanges.js +1 -2
  397. package/dist/core/scene/sceneEdits.js +1 -2
  398. package/dist/core/scene/sceneJournals.js +1 -2
  399. package/dist/core/scene/sceneMutators.js +2 -3
  400. package/dist/core/scene/scenePoseAdapter.js +1 -2
  401. package/dist/core/scene/sceneRecording.js +1 -2
  402. package/dist/core/scene/sceneSelection.js +8 -5
  403. package/dist/core/scene/sceneSelection.js.map +1 -1
  404. package/dist/core/scene/sceneState.js +3 -4
  405. package/dist/core/scene/scrollOffsets.js +1 -2
  406. package/dist/core/scene/serialization.js +2 -3
  407. package/dist/core/scene/staleReplay.js +1 -2
  408. package/dist/core/scene/statedFields.js +1 -2
  409. package/dist/core/scene/strategyView.js +1 -2
  410. package/dist/core/scene/treeEdits.js +2 -3
  411. package/dist/core/scene/treeOrder.js +1 -2
  412. package/dist/core/scene/treeReads.js +1 -2
  413. package/dist/core/scene/treeShape.js +1 -2
  414. package/dist/core/scene/types.js +1 -2
  415. package/dist/core/scene/types.js.map +1 -1
  416. package/dist/core/scene/unionOfChildren.js +1 -2
  417. package/dist/core/scene/unitScopes.js +20 -4
  418. package/dist/core/scene/unitScopes.js.map +1 -1
  419. package/dist/core/scene/useScene.js +2 -3
  420. package/dist/core/scene/worldSave.js +2 -3
  421. package/dist/core/selection/chromeState.js +1 -2
  422. package/dist/core/selection/outermostSelection.js +56 -0
  423. package/dist/core/selection/outermostSelection.js.map +1 -0
  424. package/dist/core/selection/readOnlySelection.js +1 -2
  425. package/dist/core/selection/selectionTarget.js +1 -2
  426. package/dist/core/selection/usePublishSceneSelection.js +1 -2
  427. package/dist/core/selection/useSelection.js +1 -2
  428. package/dist/core/shapeKinds.js +1 -2
  429. package/dist/core/stableStringify.js +1 -2
  430. package/dist/core/stylus/stylus.js +1 -2
  431. package/dist/core/stylus/usePointerStylus.js +1 -2
  432. package/dist/core/usePaintKinds.js +1 -2
  433. package/dist/core/viewport/clampView.js +1 -2
  434. package/dist/core/viewport/clientToWorld.js +8 -3
  435. package/dist/core/viewport/clientToWorld.js.map +1 -1
  436. package/dist/core/viewport/createVelocityTracker.js +1 -2
  437. package/dist/core/viewport/fitToBounds.js +1 -2
  438. package/dist/core/viewport/fitViewToBounds.js +1 -2
  439. package/dist/core/viewport/interpolateView.js +1 -2
  440. package/dist/core/viewport/parallax.js +1 -2
  441. package/dist/core/viewport/sceneNodeClientRect.js +1 -2
  442. package/dist/core/viewport/screenSlop.js +1 -2
  443. package/dist/core/viewport/useAutoCenter.js +1 -2
  444. package/dist/core/viewport/useCanvasSize.js +1 -2
  445. package/dist/core/viewport/useDecayLoop.js +1 -2
  446. package/dist/core/viewport/useNodeOverlayFrame.js +1 -2
  447. package/dist/core/viewport/useVelocityTracker.js +1 -2
  448. package/dist/core/viewport/useViewAnimation.js +3 -4
  449. package/dist/core/viewport/view.js +1 -2
  450. package/dist/core/viewport/viewTransform.js +1 -2
  451. package/dist/core/viewport/viewportWorldRect.js +1 -2
  452. package/dist/core/viewport/wheelHandler.js +1 -2
  453. package/dist/core/viewport/zoomAt.js +7 -8
  454. package/dist/core/viewport/zoomAt.js.map +1 -1
  455. package/dist/core/viewport/zoomBounds.js +1 -2
  456. package/dist/debug/createDebugOverlayLayer.js +1 -2
  457. package/dist/debug/createDebugSink.js +1 -2
  458. package/dist/debug/defaultTheme.js +1 -2
  459. package/dist/debug/features.js +1 -2
  460. package/dist/debug/frameStats.js +1 -2
  461. package/dist/debug/overlayPanels.js +1 -2
  462. package/dist/debug/parseDebugFlags.js +1 -2
  463. package/dist/debug/useDebugSink.js +2 -3
  464. package/dist/{depSchema-ChQPzEkW.d.ts → depSchema-C7a_OMt-.d.ts} +61 -52
  465. package/dist/devtools/handlers.js +1 -2
  466. package/dist/devtools/history.js +1 -2
  467. package/dist/devtools/hook.js +1 -2
  468. package/dist/devtools/label.js +1 -2
  469. package/dist/devtools/notices.js +1 -2
  470. package/dist/devtools/protocol.js +1 -2
  471. package/dist/devtools/registry.js +1 -2
  472. package/dist/devtools/root.js +12 -6
  473. package/dist/devtools/root.js.map +1 -1
  474. package/dist/devtools/serialize.js +1 -2
  475. package/dist/devtools/session.js +2 -3
  476. package/dist/devtools/transport.js +13 -18
  477. package/dist/devtools/transport.js.map +1 -1
  478. package/dist/devtools/useDevtoolsRoot.js +1 -2
  479. package/dist/devtools-protocol.d.ts +1 -12
  480. package/dist/devtools-protocol.js +2 -2
  481. package/dist/devtools.d.ts +1 -1
  482. package/dist/devtools.js +1 -2
  483. package/dist/domains/chrome-caps/buildChromeCtx.js +1 -2
  484. package/dist/domains/chrome-caps/conditions.js +1 -2
  485. package/dist/domains/chrome-caps/defaults.js +1 -2
  486. package/dist/domains/chrome-caps/resolve.js +2 -3
  487. package/dist/domains/chrome-caps/useChromeCaps.js +1 -2
  488. package/dist/domains/chrome-caps/useHoverTracking.js +1 -2
  489. package/dist/domains/ingestion/contentHandlers.js +1 -2
  490. package/dist/domains/ingestion/ghost.js +2 -3
  491. package/dist/domains/ingestion/imageHandler.js +1 -2
  492. package/dist/domains/ingestion/kitHandlers.js +2 -3
  493. package/dist/domains/ingestion/openFilePicker.js +1 -2
  494. package/dist/domains/ingestion/placement.js +1 -2
  495. package/dist/domains/ingestion/svgHandler.js +1 -2
  496. package/dist/domains/ingestion/textHandler.js +1 -2
  497. package/dist/domains/ingestion/useCanvasIngestion.js +1 -2
  498. package/dist/domains/ingestion/weaselJsonHandler.js +2 -3
  499. package/dist/domains/longPress/longPressFeedback.js +1 -2
  500. package/dist/domains/measure/actionIds.js +1 -2
  501. package/dist/domains/measure/measureCommands.js +6 -7
  502. package/dist/domains/measure/measureContribution.js +3 -4
  503. package/dist/domains/measure/measureEdits.js +3 -4
  504. package/dist/domains/measure/measureGestures.js +2 -3
  505. package/dist/domains/measure/measureHit.js +5 -12
  506. package/dist/domains/measure/measureHit.js.map +1 -1
  507. package/dist/domains/measure/measureLayer.js +3 -4
  508. package/dist/domains/measure/measurement.js +1 -2
  509. package/dist/domains/measure/measurements.js +1 -2
  510. package/dist/domains/modes/modeLayers.js +1 -2
  511. package/dist/domains/modes/modeTriggers.js +1 -2
  512. package/dist/domains/pathEffects/effectSources.js +2 -3
  513. package/dist/domains/pathEffects/index.js +1 -2
  514. package/dist/domains/pathEffects/readSource.js +3 -4
  515. package/dist/domains/pathEffects/textItems.js +1 -2
  516. package/dist/domains/pathEffects/useEffectSourcesLayer.js +3 -4
  517. package/dist/domains/paths/anchorData.js +1 -2
  518. package/dist/domains/paths/anchorMarkers.js +6 -13
  519. package/dist/domains/paths/anchorMarkers.js.map +1 -1
  520. package/dist/domains/paths/editablePath.js +3 -4
  521. package/dist/domains/paths/originProjection.js +1 -2
  522. package/dist/domains/paths/pathEditExtension.js +1 -2
  523. package/dist/domains/paths/pathEditState.js +1 -2
  524. package/dist/domains/paths/pathEditingOverlayLayer.js +7 -12
  525. package/dist/domains/paths/pathEditingOverlayLayer.js.map +1 -1
  526. package/dist/domains/paths/pathLayer.js +1 -2
  527. package/dist/domains/paths/pathRepresentation.js +1 -2
  528. package/dist/domains/paths/pathSnap/glyphs.js +1 -2
  529. package/dist/domains/paths/pathSnap/pathSnapSource.js +1 -2
  530. package/dist/domains/paths/pathSnap/sceneIndex.js +1 -2
  531. package/dist/domains/paths/pathSnap/snapGeometry.js +2 -3
  532. package/dist/domains/paths/penPreviewLayer.js +10 -14
  533. package/dist/domains/paths/penPreviewLayer.js.map +1 -1
  534. package/dist/domains/paths/shapeGenerator.js +2 -4
  535. package/dist/domains/paths/shapeGenerator.js.map +1 -1
  536. package/dist/domains/paths/strokeOutline.js +2 -3
  537. package/dist/domains/paths/useAnchorFields.js +1 -2
  538. package/dist/domains/paths/usePathEdit.js +2 -3
  539. package/dist/domains/poseRun/usePoseRun.js +1 -2
  540. package/dist/domains/selection/enteredGroupFrame.js +1 -2
  541. package/dist/domains/selection/enteredGroupScope.js +1 -2
  542. package/dist/domains/selection/enteredOperands.js +1 -2
  543. package/dist/domains/selection/handleCommands.js +2 -3
  544. package/dist/domains/selection/overlay.js +6 -7
  545. package/dist/domains/selection/selectionPose.js +2 -3
  546. package/dist/domains/snap/angle2d.js +3 -3
  547. package/dist/domains/snap/angle2d.js.map +1 -1
  548. package/dist/domains/snap/debugCandidates.js +1 -2
  549. package/dist/domains/snap/gather.js +1 -2
  550. package/dist/domains/snap/inputSubspace.js +2 -3
  551. package/dist/domains/snap/lazySession.js +1 -2
  552. package/dist/domains/snap/marks.js +1 -2
  553. package/dist/domains/snap/outcomeStore.js +6 -10
  554. package/dist/domains/snap/outcomeStore.js.map +1 -1
  555. package/dist/domains/snap/pointSnap.js +1 -2
  556. package/dist/domains/snap/probes2d.js +1 -2
  557. package/dist/domains/snap/readoutDraw.js +1 -2
  558. package/dist/domains/snap/readoutLayer.js +1 -2
  559. package/dist/domains/snap/registry.js +1 -2
  560. package/dist/domains/snap/resizeBox.js +1 -2
  561. package/dist/domains/snap/roles.js +1 -2
  562. package/dist/domains/snap/rotationSource.js +1 -2
  563. package/dist/domains/snap/sceneReads.js +2 -3
  564. package/dist/domains/snap/sceneSession2d.js +2 -3
  565. package/dist/domains/snap/screen.js +2 -3
  566. package/dist/domains/snap/session2d.js +4 -5
  567. package/dist/domains/snap/spanSnap.js +1 -2
  568. package/dist/domains/snap/stepAngles.js +1 -2
  569. package/dist/domains/text/editingDrawOne.js +1 -2
  570. package/dist/domains/text/hostTextEditors.js +1 -2
  571. package/dist/domains/text/sceneTextDrafts.js +1 -2
  572. package/dist/domains/text/textHitAt.js +4 -5
  573. package/dist/domains/text/textLayer.js +12 -2
  574. package/dist/domains/text/textLayer.js.map +1 -1
  575. package/dist/domains/text/useSceneTextEdit.js +13 -9
  576. package/dist/domains/text/useSceneTextEdit.js.map +1 -1
  577. package/dist/domains/viewports/aim.js +6 -12
  578. package/dist/domains/viewports/aim.js.map +1 -1
  579. package/dist/domains/viewports/viewMarker.js +1 -2
  580. package/dist/domains/viewports/viewMarkerDrag.js +1 -2
  581. package/dist/domains/viewports/viewResolver.js +6 -5
  582. package/dist/domains/viewports/viewResolver.js.map +1 -1
  583. package/dist/domains/viewports/viewportLayer.js +1 -2
  584. package/dist/iconRegistry/IconRegistryProvider.js +1 -2
  585. package/dist/iconRegistry/useIconGlyph.js +1 -2
  586. package/dist/iconRegistry/useIconVariant.js +1 -2
  587. package/dist/icons.table.js +1 -2
  588. package/dist/icons2.table.js +1 -2
  589. package/dist/index.d.ts +70 -27
  590. package/dist/index.js +7 -5
  591. package/dist/input/keyState.js +1 -2
  592. package/dist/input/useKeyModifiers.js +1 -2
  593. package/dist/input/useKeyState.js +1 -2
  594. package/dist/input/usePublishPointer.js +59 -0
  595. package/dist/input/usePublishPointer.js.map +1 -0
  596. package/dist/interactions/actions/admitsChild.js +1 -2
  597. package/dist/interactions/actions/align/action.js +6 -7
  598. package/dist/interactions/actions/align/align.js +6 -7
  599. package/dist/interactions/actions/booleans/action.js +1 -2
  600. package/dist/interactions/actions/booleans/booleanGroupAction.js +2 -3
  601. package/dist/interactions/actions/booleans/booleans.js +1 -2
  602. package/dist/interactions/actions/booleans/commit.js +4 -5
  603. package/dist/interactions/actions/booleans/custom.js +2 -3
  604. package/dist/interactions/actions/booleans/keymap.js +1 -2
  605. package/dist/interactions/actions/booleans/operands.js +1 -2
  606. package/dist/interactions/actions/booleans/pieces.js +1 -2
  607. package/dist/interactions/actions/booleans/placement.js +1 -2
  608. package/dist/interactions/actions/booleans/useBooleans.js +1 -2
  609. package/dist/interactions/actions/booleans/useBooleansAdapter.js +1 -2
  610. package/dist/interactions/actions/clipboard/action.js +2 -3
  611. package/dist/interactions/actions/clipboard/clipboardOps.js +2 -3
  612. package/dist/interactions/actions/clipboard/materializePaste.js +1 -2
  613. package/dist/interactions/actions/clipboard/wireFormat.js +1 -2
  614. package/dist/interactions/actions/clone/action.js +7 -8
  615. package/dist/interactions/actions/clone/behaviors.js +4 -5
  616. package/dist/interactions/actions/defaultCommitAdapter.js +2 -3
  617. package/dist/interactions/actions/defaults/anchorEditing.js +3 -4
  618. package/dist/interactions/actions/defaults/anchorFields.js +1 -2
  619. package/dist/interactions/actions/defaults/anchorHandles.js +2 -3
  620. package/dist/interactions/actions/defaults/anchorJoin.js +2 -3
  621. package/dist/interactions/actions/defaults/areaSelect.js +6 -6
  622. package/dist/interactions/actions/defaults/areaSelect.js.map +1 -1
  623. package/dist/interactions/actions/defaults/bendSegment.js +3 -4
  624. package/dist/interactions/actions/defaults/cancelGesture.js +1 -2
  625. package/dist/interactions/actions/defaults/clearSelection.js +1 -2
  626. package/dist/interactions/actions/defaults/containerScroll.js +13 -8
  627. package/dist/interactions/actions/defaults/containerScroll.js.map +1 -1
  628. package/dist/interactions/actions/defaults/contextMenu.js +6 -7
  629. package/dist/interactions/actions/defaults/copySubtree.js +2 -3
  630. package/dist/interactions/actions/defaults/createPaintAction.js +3 -4
  631. package/dist/interactions/actions/defaults/delete.js +2 -3
  632. package/dist/interactions/actions/defaults/duplicate.js +5 -6
  633. package/dist/interactions/actions/defaults/enterGroup.js +5 -6
  634. package/dist/interactions/actions/defaults/enterGroup.js.map +1 -1
  635. package/dist/interactions/actions/defaults/enterPathEdit.js +1 -2
  636. package/dist/interactions/actions/defaults/enterTextEdit.js +1 -2
  637. package/dist/interactions/actions/defaults/escape.js +1 -2
  638. package/dist/interactions/actions/defaults/exitPathEdit.js +1 -2
  639. package/dist/interactions/actions/defaults/group.js +6 -7
  640. package/dist/interactions/actions/defaults/ingest.js +3 -4
  641. package/dist/interactions/actions/defaults/insertPathAnchor.js +2 -3
  642. package/dist/interactions/actions/defaults/nudge.js +3 -4
  643. package/dist/interactions/actions/defaults/nudgeSteps.js +2 -3
  644. package/dist/interactions/actions/defaults/nudgeSteps.js.map +1 -1
  645. package/dist/interactions/actions/defaults/pathEditMarks.js +3 -7
  646. package/dist/interactions/actions/defaults/pathEditMarks.js.map +1 -1
  647. package/dist/interactions/actions/defaults/pinchZoom.js +3 -4
  648. package/dist/interactions/actions/defaults/reorder.js +2 -3
  649. package/dist/interactions/actions/defaults/requiresSelection.js +1 -2
  650. package/dist/interactions/actions/defaults/segmentUnder.js +1 -2
  651. package/dist/interactions/actions/defaults/selectAll.js +1 -2
  652. package/dist/interactions/actions/defaults/selectDeep.js +1 -2
  653. package/dist/interactions/actions/defaults/setFill.js +1 -2
  654. package/dist/interactions/actions/defaults/setFillOpacity.js +1 -2
  655. package/dist/interactions/actions/defaults/setStroke.js +1 -2
  656. package/dist/interactions/actions/defaults/setStrokeOpacity.js +1 -2
  657. package/dist/interactions/actions/defaults/slice.js +1 -2
  658. package/dist/interactions/actions/defaults/sliceOps.js +1 -2
  659. package/dist/interactions/actions/defaults/toolActivate.js +1 -2
  660. package/dist/interactions/actions/defaults/toolResetToDefault.js +1 -2
  661. package/dist/interactions/actions/defaults/undoRedo.js +1 -2
  662. package/dist/interactions/actions/defaults/viewportDragPan.js +1 -2
  663. package/dist/interactions/actions/defaults/viewportWheelPan.js +1 -2
  664. package/dist/interactions/actions/defaults/viewportZoom.js +3 -4
  665. package/dist/interactions/actions/distribute/action.js +4 -5
  666. package/dist/interactions/actions/distribute/distribute.js +5 -6
  667. package/dist/interactions/actions/distribute/plan.js +1 -2
  668. package/dist/interactions/actions/drawnBoxes.js +4 -5
  669. package/dist/interactions/actions/dropVerdict.js +1 -2
  670. package/dist/interactions/actions/edit-anchors/action.js +4 -5
  671. package/dist/interactions/actions/edit-anchors/extensionDrags.js +1 -2
  672. package/dist/interactions/actions/edit-anchors/geometry.js +1 -2
  673. package/dist/interactions/actions/edit-anchors/handleDrag.js +5 -9
  674. package/dist/interactions/actions/edit-anchors/handleDrag.js.map +1 -1
  675. package/dist/interactions/actions/edit-anchors/handles.js +1 -2
  676. package/dist/interactions/actions/edit-anchors/params.js +1 -2
  677. package/dist/interactions/actions/edit-anchors/preview.js +1 -2
  678. package/dist/interactions/actions/edit-anchors/symmetry.js +1 -2
  679. package/dist/interactions/actions/flip/action.js +8 -9
  680. package/dist/interactions/actions/flip/helpers.js +1 -2
  681. package/dist/interactions/actions/geometryProjection.js +1 -2
  682. package/dist/interactions/actions/gestureFrames.js +3 -4
  683. package/dist/interactions/actions/gestureLifecycle.js +1 -2
  684. package/dist/interactions/actions/hitSelection.js +7 -3
  685. package/dist/interactions/actions/hitSelection.js.map +1 -1
  686. package/dist/interactions/actions/insert/action.js +6 -7
  687. package/dist/interactions/actions/insert/commit.js +2 -3
  688. package/dist/interactions/actions/insert/extras.js +1 -2
  689. package/dist/interactions/actions/insert/frame.js +1 -2
  690. package/dist/interactions/actions/insert/geometry.js +1 -2
  691. package/dist/interactions/actions/insert/params.js +2 -3
  692. package/dist/interactions/actions/insert/parent.js +1 -2
  693. package/dist/interactions/actions/insert/placeAction.js +5 -6
  694. package/dist/interactions/actions/insert/repositionAction.js +1 -2
  695. package/dist/interactions/actions/insert/rotateAction.js +1 -2
  696. package/dist/interactions/actions/insert/session.js +5 -6
  697. package/dist/interactions/actions/insert/shape.js +2 -3
  698. package/dist/interactions/actions/lasso-select/action.js +9 -9
  699. package/dist/interactions/actions/lasso-select/action.js.map +1 -1
  700. package/dist/interactions/actions/lasso-select/behaviors/selectFromLasso.js +2 -3
  701. package/dist/interactions/actions/magnification.js +37 -0
  702. package/dist/interactions/actions/magnification.js.map +1 -0
  703. package/dist/interactions/actions/move/action.js +2 -3
  704. package/dist/interactions/actions/move/behaviors/clampMove.js +42 -0
  705. package/dist/interactions/actions/move/behaviors/clampMove.js.map +1 -0
  706. package/dist/interactions/actions/move/behaviors/layoutDrop.js +2 -3
  707. package/dist/interactions/actions/move/behaviors/reparentOnDrop.js +2 -3
  708. package/dist/interactions/actions/move/behaviors/snapBackOrDelete.js +1 -2
  709. package/dist/interactions/actions/move/behaviors/snapToContainer.js +2 -3
  710. package/dist/interactions/actions/move/capture.js +6 -7
  711. package/dist/interactions/actions/move/commit/index.js +2 -3
  712. package/dist/interactions/actions/move/commit/layoutDrop.js +4 -5
  713. package/dist/interactions/actions/move/commit/layoutRelease.js +7 -8
  714. package/dist/interactions/actions/move/commit/rebase.js +2 -3
  715. package/dist/interactions/actions/move/commit/reparent.js +5 -6
  716. package/dist/interactions/actions/move/delta.js +2 -3
  717. package/dist/interactions/actions/move/frame.js +2 -3
  718. package/dist/interactions/actions/move/gestureAdapter.js +1 -2
  719. package/dist/interactions/actions/move/landedDescendants.js +2 -3
  720. package/dist/interactions/actions/move/layout/container.js +6 -10
  721. package/dist/interactions/actions/move/layout/container.js.map +1 -1
  722. package/dist/interactions/actions/move/layout/dragged.js +2 -3
  723. package/dist/interactions/actions/move/layout/dropPass.js +5 -6
  724. package/dist/interactions/actions/move/layout/exits.js +4 -5
  725. package/dist/interactions/actions/move/layout/exits.js.map +1 -1
  726. package/dist/interactions/actions/move/layout/glide.js +2 -3
  727. package/dist/interactions/actions/move/layout/view.js +1 -2
  728. package/dist/interactions/actions/move/refusal.js +2 -3
  729. package/dist/interactions/actions/move/session.js +4 -5
  730. package/dist/interactions/actions/move/translate.js +2 -3
  731. package/dist/interactions/actions/moveNodes.js +5 -6
  732. package/dist/interactions/actions/notices.js +1 -2
  733. package/dist/interactions/actions/outlines/createOutlines.js +1 -2
  734. package/dist/interactions/actions/outlines/createOutlinesAction.js +2 -3
  735. package/dist/interactions/actions/outlines/outlineStroke.js +2 -3
  736. package/dist/interactions/actions/outlines/outlineStrokeAction.js +2 -3
  737. package/dist/interactions/actions/outlines/replaceWithPaths.js +5 -6
  738. package/dist/interactions/actions/outlines/strokeRegion.js +1 -2
  739. package/dist/interactions/actions/outlines/useCreateOutlinesAdapter.js +1 -2
  740. package/dist/interactions/actions/pathCommands/cutJoin.js +3 -4
  741. package/dist/interactions/actions/pathCommands/livePathEdit.js +3 -4
  742. package/dist/interactions/actions/pathCommands/pathNodes.js +3 -4
  743. package/dist/interactions/actions/pathCommands/simplifyOffset.js +2 -3
  744. package/dist/interactions/actions/pathGestureTags.js +1 -2
  745. package/dist/interactions/actions/planeInput.js +2 -3
  746. package/dist/interactions/actions/pointerState.js +1 -2
  747. package/dist/interactions/actions/poseDescriptorDep.js +1 -2
  748. package/dist/interactions/actions/poseFrame.js +3 -4
  749. package/dist/interactions/actions/resize/action.js +3 -4
  750. package/dist/interactions/actions/resize/aspect.js +1 -2
  751. package/dist/interactions/actions/resize/behaviors/clampMinSize.js +1 -2
  752. package/dist/interactions/actions/resize/boxFrame.js +1 -2
  753. package/dist/interactions/actions/resize/capture.js +7 -8
  754. package/dist/interactions/actions/resize/commit.js +3 -4
  755. package/dist/interactions/actions/resize/cornerHandles.js +1 -2
  756. package/dist/interactions/actions/resize/frame.js +7 -8
  757. package/dist/interactions/actions/resize/held.js +2 -3
  758. package/dist/interactions/actions/resize/minimum.js +1 -2
  759. package/dist/interactions/actions/resize/replay.js +1 -2
  760. package/dist/interactions/actions/resize/ruleBounds.js +1 -2
  761. package/dist/interactions/actions/resize/session.js +9 -10
  762. package/dist/interactions/actions/resolveOverlays.js +1 -2
  763. package/dist/interactions/actions/resolvePreviews.js +3 -4
  764. package/dist/interactions/actions/rotate/action.js +5 -6
  765. package/dist/interactions/actions/rotate/commit.js +2 -3
  766. package/dist/interactions/actions/rotate/frame.js +3 -4
  767. package/dist/interactions/actions/rotate/geometry.js +1 -2
  768. package/dist/interactions/actions/rotate/handle.js +2 -3
  769. package/dist/interactions/actions/rotate/replay.js +2 -3
  770. package/dist/interactions/actions/rotate/session.js +10 -11
  771. package/dist/interactions/actions/selectionSubtree.js +7 -22
  772. package/dist/interactions/actions/selectionSubtree.js.map +1 -1
  773. package/dist/interactions/actions/spatialReference.js +1 -2
  774. package/dist/interactions/actions/testUtils.js +1 -2
  775. package/dist/interactions/actions/transform-again/action.js +5 -6
  776. package/dist/interactions/actions/transform-again/memory.js +3 -4
  777. package/dist/interactions/actions/transform-again/memory.js.map +1 -1
  778. package/dist/interactions/actions/transformFinish.js +1 -2
  779. package/dist/interactions/actions/useActionSet.js +1 -2
  780. package/dist/interactions/actions/useNotices.js +1 -2
  781. package/dist/interactions/actions/useStandardActions.js +1 -2
  782. package/dist/interactions/gestures/dragGesture/dragGesture.js +1 -2
  783. package/dist/interactions/gestures/dragGesture/dragPointOf.js +1 -2
  784. package/dist/interactions/gestures/dragRadial/dragRadial.js +2 -3
  785. package/dist/interactions/gestures/dragRect/dragRect.js +2 -3
  786. package/dist/interactions/gestures/handleDrag/handleDrag.js +1 -2
  787. package/dist/interactions/gestures/pointerDrag/pointerDrag.js +1 -2
  788. package/dist/interactions/gestures/shared/originProjection.js +1 -2
  789. package/dist/interactions/gestures/shared/screenTolerance.js +1 -2
  790. package/dist/interactions/gestures/thresholdDrag/thresholdDrag.js +1 -2
  791. package/dist/kitSettingsSchema.js +4 -5
  792. package/dist/move.d.ts +18 -3
  793. package/dist/move.js +2 -1
  794. package/dist/test-hook/createTestHook.js +1 -2
  795. package/dist/test-hook/install.js +1 -2
  796. package/dist/test-hook/useTestHook.js +1 -2
  797. package/dist/test-seams.d.ts +4 -4
  798. package/dist/test-seams.js +2 -2
  799. package/dist/tools/builtin/anchors/anchorsTool.js +1 -2
  800. package/dist/tools/builtin/ellipse/useEllipseTool.js +2 -3
  801. package/dist/tools/builtin/eyedropper/useEyedropperTool.js +1 -2
  802. package/dist/tools/builtin/hand/dragPanContribution.js +1 -2
  803. package/dist/tools/builtin/hand/useHandTool.js +1 -2
  804. package/dist/tools/builtin/image/useImageTool.js +1 -2
  805. package/dist/tools/builtin/lasso/useLassoTool.js +1 -2
  806. package/dist/tools/builtin/line/useLineTool.js +2 -3
  807. package/dist/tools/builtin/measure/useMeasureTool.js +2 -3
  808. package/dist/tools/builtin/pen/penHandle.js +1 -2
  809. package/dist/tools/builtin/pen/usePenTool.js +6 -7
  810. package/dist/tools/builtin/pencil/usePencilTool.js +1 -2
  811. package/dist/tools/builtin/pickTopMostHit.js +1 -2
  812. package/dist/tools/builtin/polygon/usePolygonTool.js +3 -4
  813. package/dist/tools/builtin/pressTarget.js +1 -2
  814. package/dist/tools/builtin/rect/useRectTool.js +2 -3
  815. package/dist/tools/builtin/select/adapterPointQuery.js +3 -4
  816. package/dist/tools/builtin/select/collapseDeferred.js +1 -2
  817. package/dist/tools/builtin/select/groupEntry.js +2 -3
  818. package/dist/tools/builtin/select/pressDecision.js +3 -4
  819. package/dist/tools/builtin/select/pressDecision.js.map +1 -1
  820. package/dist/tools/builtin/select/selectionContributions.js +1 -2
  821. package/dist/tools/builtin/select/useSelectTool.js +5 -6
  822. package/dist/tools/builtin/shared/insertToolOptions.js +1 -2
  823. package/dist/tools/builtin/shared/pointerFollower.js +1 -2
  824. package/dist/tools/builtin/slice/useSliceTool.js +5 -6
  825. package/dist/tools/builtin/star/useStarTool.js +3 -4
  826. package/dist/tools/builtin/sticky/stickyNode.js +1 -2
  827. package/dist/tools/builtin/sticky/useStickyTool.js +2 -3
  828. package/dist/tools/builtin/text/useTextTool.js +1 -2
  829. package/dist/tools/index.js +2 -2
  830. package/dist/tools/overlayBinding.js +1 -2
  831. package/dist/tools/toolOptions.js +17 -4
  832. package/dist/tools/toolOptions.js.map +1 -1
  833. package/dist/tools/useKeybindings.js +1 -2
  834. package/dist/{types-DW14eu9B.d.ts → types-BUvUXZe5.d.ts} +3 -3
  835. package/dist/util/color.js +1 -2
  836. package/dist/util/paint.js +1 -2
  837. package/dist/version.js +2 -3
  838. package/package.json +27 -27
@@ -1 +1 @@
1
- {"version":3,"file":"useViewHelpers.js","names":[],"sources":["../../src/canvas/useViewHelpers.ts"],"sourcesContent":["import { useCallback, useMemo } from 'react';\nimport { framedBounds } from 'core/geometry/poseDescriptor';\nimport { useLatest } from '@weasel-js/react';\nimport type { GestureSource, GesturePreviewSource } from './gestureBounds';\nimport { useInFlightBounds } from './useInFlightBounds';\nimport type { OngoingOverlay } from '@weasel-js/routing';\nimport { unionAABB } from 'core/geometry/unionBounds';\nimport { buildChromeState, type ChromeState } from 'core/selection/chromeState';\nimport type { PoseDescriptor } from 'interactions/actions/resize/geometry';\nimport type { NodeId } from 'core/scene/types';\nimport type { DebugSink } from '../debug/types';\nimport type { Bounds } from 'core/viewport/fitViewToBounds';\nimport type { Scale2 } from '@weasel-js/geom';\nimport { drawnBoundsOf, type DrawnBoundsScene } from './drawnBounds';\n\nconst noOpUnsubscribe = (): void => {};\n\nconst alwaysVisible = (): boolean => true;\n\n/**\n * The half of {@link CanvasHelpers} that belongs to one view — everything\n * answered by a camera's own tools, gestures and selection. A canvas hosting\n * several viewports needs one of these per view; the surface half is shared.\n */\nexport interface CanvasViewHelpers<TPose> {\n /** Pose currently displayed for `id` — drag/resize/rotate overlay if active,\n * otherwise the committed pose from the adapter. Returns `null` if the id\n * isn't known. */\n getEffectivePose(id: string): TPose | null;\n /** Overlay-aware bounds for `id`. */\n getEffectiveBounds(id: string): Bounds | null;\n /**\n * World-space AABB of everything the in-flight gesture proposes — the\n * displaced poses of nodes being moved / resized / rotated / cloned, plus\n * any nascent insert that has no scene node yet. `null` when no gesture is\n * in flight.\n *\n * This reports the *gesture*, not the document: committed content the\n * gesture isn't touching is excluded. Select-only gestures are excluded\n * too: a marquee or lasso has geometry but proposes no content.\n *\n * The result is a plain AABB — never rotated. Rotated parts are folded in\n * by their rotated extent.\n */\n getGestureBounds(): Bounds | null;\n /**\n * Subscribe to the gesture layer's change signal, for everything on this\n * object that moves during a drag (`getEffectivePose`, `getEffectiveBounds`,\n * `getGestureBounds`). Returns an unsubscribe.\n *\n * Fires once per dispatcher pump: gesture start, every pointermove that\n * reaches an in-flight handle, end, and cancel — plus UI-driven ongoing\n * actions. It fires on the pump, not on a diff: a pump that changed nothing\n * observable still notifies, so don't hang expensive work directly off the\n * callback.\n *\n * It does **not** cover committed scene edits (subscribe to the scene for\n * those) or previews a consumer's own tool publishes from React state.\n * Without a gesture source wired — a bare `<Canvas>` — it never fires.\n */\n subscribeGestures(fn: () => void): () => void;\n /**\n * Monotonic counter bumped on exactly the events `subscribeGestures` fires\n * on. Pair the two for `useSyncExternalStore`:\n *\n * ```ts\n * const gestureVersion = useSyncExternalStore(\n * useCallback((cb) => helpersRef.current?.subscribeGestures(cb) ?? (() => {}), []),\n * () => helpersRef.current?.getGestureVersion() ?? 0,\n * );\n * ```\n *\n * Starts at 0 and only increases. `0` is also what a bare `<Canvas>` with\n * no gesture source reports, forever.\n */\n getGestureVersion(): number;\n /** The live ChromeState built once per render: overlay-aware selection\n * state for affordances and custom layers. */\n getChromeState(): ChromeState;\n /**\n * Everything publishing an in-flight preview for this view: the handles in\n * flight on its dispatcher, in dispatch order. Readers take the first\n * non-null answer per id.\n *\n * A ghost layer must read this off its draw envelope rather than close over\n * a dispatcher: one layer array paints every view, so a closure ghosts view\n * zero's drag into every panel.\n */\n getPreviewSources(): readonly GesturePreviewSource[];\n /** Overlay shapes this view's in-flight handles publish — marquee, lasso,\n * insert preview, raw commands. Same envelope rule as\n * {@link CanvasViewHelpers.getPreviewSources}. */\n getGestureOverlays(): readonly OngoingOverlay[];\n /**\n * Chrome-caps visibility predicate, keyed by chrome id. Overlay layers and\n * affordances call it per element to decide whether to draw / hit-test.\n * Unwired, it is the universal `() => true`.\n */\n getIsVisible(): (id: string) => boolean;\n}\n\n/**\n * The half of {@link CanvasHelpers} that belongs to the surface — one GL\n * context, one debug sink, however many views are drawn on it.\n */\nexport interface CanvasSurfaceHelpers {\n /** Active debug sink, when `<Canvas debug=...>` is enabled, for layers to\n * call from their `draw` callback. `null` when debug is off. */\n getDebug(): DebugSink | null;\n}\n\n/** Live overlay-aware lookups exposed to custom layers via `helpersRef`, and\n * what a layer receives as its `data` argument. */\nexport interface CanvasHelpers<TPose> extends CanvasViewHelpers<TPose>, CanvasSurfaceHelpers {\n /**\n * The view this draw is for: a `<CanvasView>` id, or `null` for the\n * surface's own camera. One layer array paints every view, so a layer that\n * belongs in some views and not others — a minimap's indicator — declines\n * the rest by this id.\n */\n readonly viewId: string | null;\n}\n\n/** What a view's pose and bounds lookups read of an adapter. */\nexport interface ViewPoseAdapter<TPose> {\n getPose(id: string): TPose;\n /** Where the node is drawn, when the adapter composes poses. An adapter\n * without it stores absolute poses, where the two agree. */\n getWorldPose?(id: string): TPose;\n /** The node an id names, whose `layer` decides whether a view that hides\n * that layer shows its selection chrome. */\n getNode?(id: string): { layer?: string } | undefined;\n}\n\nexport interface UseViewHelpersOpts<TPose> {\n adapter: ViewPoseAdapter<TPose> | undefined;\n geometry: PoseDescriptor<TPose>;\n /** Consumer-supplied bounds resolver. Falls back to the adapter's pose. */\n boundsOf: ((id: string) => Bounds | null) | undefined;\n /** Bounds of `id` drawn at an in-flight `pose`. Falls back to the\n * geometry's box of that pose, which is wrong wherever the surface draws a\n * node somewhere its pose does not say — a parallax plane. */\n boundsOfPose?: ((id: string, pose: TPose) => Bounds | null) | undefined;\n /** The nodes the adapter's ids name: with them, the fallbacks box each as\n * drawn, stroke included, rather than by its pose. */\n nodes?: DrawnBoundsScene | undefined;\n /** The view's scale, which a screen-pixel stroke is resolved at. Default 1. */\n getScale?: (() => Scale2) | undefined;\n /** The ids selected, read whenever chrome asks: a view following another\n * reads that view's, which changes without this one rendering. */\n selection: () => readonly NodeId[];\n gestureSource: GestureSource | undefined;\n /** The dispatcher's preview pose for an id, read through a ref so a change\n * mid-gesture doesn't rebuild the memos that depend on it. */\n previewPoseExtra: ((id: string) => unknown) | undefined;\n /** Chrome-caps predicate for this view. Absent means everything is visible. */\n getIsVisible?: (() => (id: string) => boolean) | undefined;\n /** Whether a scene layer reaches the screen in this view. Absent means\n * every layer the scene shows does. */\n layerIsPainted?: ((layerId: string) => boolean) | undefined;\n}\n\nexport interface ViewHelpersBundle<TPose> {\n helpers: CanvasViewHelpers<TPose>;\n}\n\nfunction worldPoseOf<TPose>(adapter: ViewPoseAdapter<TPose>, id: string): TPose {\n return typeof adapter.getWorldPose === 'function' ? adapter.getWorldPose(id) : adapter.getPose(id);\n}\n\n/**\n * Build one view's overlay-aware state: its chrome and the lookups its layers\n * draw and hit-test against. A canvas with N views mounts N components each\n * calling this once.\n */\nexport function useViewHelpers<TPose>(\n opts: UseViewHelpersOpts<TPose>,\n): ViewHelpersBundle<TPose> {\n const {\n adapter, geometry, boundsOf, boundsOfPose, nodes, getScale, selection, gestureSource,\n previewPoseExtra, getIsVisible, layerIsPainted,\n } = opts;\n const getScaleRef = useLatest(getScale);\n const poseBoxOf = useCallback((id: string, pose: TPose): Bounds => {\n if (!nodes) return framedBounds(pose, geometry);\n const scale = getScaleRef.current?.();\n return drawnBoundsOf(nodes, id as NodeId, pose, {\n descriptor: geometry as PoseDescriptor<unknown>,\n ...(adapter ? { worldPoseOf: (m: NodeId) => worldPoseOf(adapter, m) } : {}),\n ...(scale ? { scale } : {}),\n });\n }, [nodes, geometry, adapter, getScaleRef]);\n const boxOf = useCallback(\n (id: string, pose: TPose): Bounds | null =>\n (boundsOfPose ? boundsOfPose(id, pose) : poseBoxOf(id, pose)),\n [boundsOfPose, poseBoxOf],\n );\n\n const baseBoundsOf = useMemo(() => {\n if (boundsOf) return boundsOf;\n if (!adapter) return undefined;\n return (id: string): Bounds | null => {\n try {\n // World: chrome is drawn over the picture, so it has to agree with\n // where the renderer put the node, not with where its pose is stored.\n return poseBoxOf(id, worldPoseOf(adapter, id));\n } catch {\n return null;\n }\n };\n }, [boundsOf, adapter, poseBoxOf]);\n\n const committedPoseOf = useCallback((id: string): TPose | null => {\n if (!adapter) return null;\n try {\n return worldPoseOf(adapter, id);\n } catch {\n return null;\n }\n }, [adapter]);\n\n const selectionRef = useLatest(selection);\n\n const effectiveBoundsOf = useMemo(() => boundsOf ?? baseBoundsOf, [boundsOf, baseBoundsOf]);\n const { previewPoseOf, previewBoundsOf } = useInFlightBounds({ gestureSource, previewPoseExtra, boxOf, committedPoseOf });\n\n /**\n * Bounds for `id` with any in-flight gesture folded in — what the user can\n * see, not what is committed. Both the chrome state and the layer helpers\n * answer bounds questions with this, so resize handles cannot end up a frame\n * away from the shape they belong to.\n */\n const boundsWithPreview = useCallback((id: string): Bounds | null => {\n const previewed = previewBoundsOf(id);\n if (previewed) return previewed;\n return effectiveBoundsOf ? effectiveBoundsOf(id) : null;\n }, [previewBoundsOf, effectiveBoundsOf]);\n\n const chromeState: ChromeState = useMemo(\n () => buildChromeState({\n get selection() { return selectionRef.current(); },\n get multiActive() { return selectionRef.current().length > 1; },\n effectiveBoundsOf: boundsWithPreview,\n modifiers: { alt: false, shift: false, meta: false, ctrl: false },\n // Absent adapter / unknown ids fall back to `true` so the affordance\n // stays visible for consumers that wire bounds without an adapter.\n canRotate: (id) => {\n if (!geometry.supportsRotation) return true;\n const pose = committedPoseOf(id);\n if (pose == null) return true;\n return geometry.supportsRotation(pose);\n },\n ...(layerIsPainted ? { layerIsPainted } : {}),\n ...(adapter?.getNode ? { layerOf: (id: string) => adapter.getNode?.(id)?.layer } : {}),\n }),\n [selectionRef, boundsWithPreview, geometry, committedPoseOf, layerIsPainted, adapter],\n );\n\n const helpers: CanvasViewHelpers<TPose> = {\n getEffectivePose: (id: string): TPose | null => {\n return previewPoseOf(id) ?? committedPoseOf(id);\n },\n getEffectiveBounds: boundsWithPreview,\n getGestureBounds: (): Bounds | null => {\n // The same id sets the ghost layer walks, so this cannot disagree with\n // what the user sees ghosted.\n const parts: (Bounds | null)[] = [];\n for (const id of new Set(gestureSource?.ids() ?? [])) parts.push(previewBoundsOf(id));\n const extraBounds = gestureSource?.bounds();\n if (extraBounds) for (const b of extraBounds) parts.push(b);\n return unionAABB(parts);\n },\n subscribeGestures: (fn: () => void): (() => void) =>\n gestureSource?.subscribe(fn) ?? noOpUnsubscribe,\n getGestureVersion: (): number => gestureSource?.getVersion() ?? 0,\n getChromeState: () => chromeState,\n getPreviewSources: (): readonly GesturePreviewSource[] => gestureSource?.previewSources() ?? [],\n getGestureOverlays: (): readonly OngoingOverlay[] => gestureSource?.overlays() ?? [],\n getIsVisible: (): ((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,CAAC;GACpF,MAAM,cAAc,eAAe,OAAO;GAC1C,IAAI,aAAa,KAAK,MAAM,KAAK,aAAa,MAAM,KAAK,CAAC;GAC1D,OAAO,UAAU,KAAK;EACxB;EACA,oBAAoB,OAClB,eAAe,UAAU,EAAE,KAAK;EAClC,yBAAiC,eAAe,WAAW,KAAK;EAChE,sBAAsB;EACtB,yBAA0D,eAAe,eAAe,KAAK,CAAC;EAC9F,0BAAqD,eAAe,SAAS,KAAK,CAAC;EACnF,oBAA+C,eAAe,KAAK;CAG5D,EAAQ;AACnB"}
1
+ {"version":3,"file":"useViewHelpers.js","names":[],"sources":["../../src/canvas/useViewHelpers.ts"],"sourcesContent":["import { useCallback, useMemo } from 'react';\nimport { framedBounds } from 'core/geometry/poseDescriptor';\nimport { useLatest } from '@weasel-js/react';\nimport type { GestureSource, GesturePreviewSource } from './gestureBounds';\nimport { useInFlightBounds } from './useInFlightBounds';\nimport type { OngoingOverlay } from '@weasel-js/routing';\nimport { unionAABB } from 'core/geometry/unionBounds';\nimport { buildChromeState, type ChromeState } from 'core/selection/chromeState';\nimport type { PoseDescriptor } from 'interactions/actions/resize/geometry';\nimport type { NodeId } from 'core/scene/types';\nimport type { DebugSink } from '../debug/types';\nimport type { Bounds } from 'core/viewport/fitViewToBounds';\nimport type { Scale2 } from '@weasel-js/geom';\nimport { drawnBoundsOf, type DrawnBoundsScene } from './drawnBounds';\n\nconst noOpUnsubscribe = (): void => {};\n\nconst alwaysVisible = (): boolean => true;\n\n/**\n * The half of {@link CanvasHelpers} that belongs to one view — everything\n * answered by a camera's own tools, gestures and selection. A canvas hosting\n * several viewports needs one of these per view; the surface half is shared.\n */\nexport interface CanvasViewHelpers<TPose> {\n /** Pose currently displayed for `id` — drag/resize/rotate overlay if active,\n * otherwise the committed pose from the adapter. Returns `null` if the id\n * isn't known. */\n getEffectivePose(id: string): TPose | null;\n /** Overlay-aware bounds for `id`. */\n getEffectiveBounds(id: string): Bounds | null;\n /**\n * World-space AABB of everything the in-flight gesture proposes — the\n * displaced poses of nodes being moved / resized / rotated / cloned, plus\n * any nascent insert that has no scene node yet. `null` when no gesture is\n * in flight.\n *\n * This reports the *gesture*, not the document: committed content the\n * gesture isn't touching is excluded. Select-only gestures are excluded\n * too: a marquee or lasso has geometry but proposes no content.\n *\n * The result is a plain AABB — never rotated. Rotated parts are folded in\n * by their rotated extent.\n */\n getGestureBounds(): Bounds | null;\n /**\n * Subscribe to the gesture layer's change signal, for everything on this\n * object that moves during a drag (`getEffectivePose`, `getEffectiveBounds`,\n * `getGestureBounds`). Returns an unsubscribe.\n *\n * Fires once per dispatcher pump: gesture start, every pointermove that\n * reaches an in-flight handle, end, and cancel — plus UI-driven ongoing\n * actions. It fires on the pump, not on a diff: a pump that changed nothing\n * observable still notifies, so don't hang expensive work directly off the\n * callback.\n *\n * It does **not** cover committed scene edits (subscribe to the scene for\n * those) or previews a consumer's own tool publishes from React state.\n * Without a gesture source wired — a bare `<Canvas>` — it never fires.\n */\n subscribeGestures(fn: () => void): () => void;\n /**\n * Monotonic counter bumped on exactly the events `subscribeGestures` fires\n * on. Pair the two for `useSyncExternalStore`:\n *\n * ```ts\n * const gestureVersion = useSyncExternalStore(\n * useCallback((cb) => helpersRef.current?.subscribeGestures(cb) ?? (() => {}), []),\n * () => helpersRef.current?.getGestureVersion() ?? 0,\n * );\n * ```\n *\n * Starts at 0 and only increases. `0` is also what a bare `<Canvas>` with\n * no gesture source reports, forever.\n */\n getGestureVersion(): number;\n /** The live ChromeState built once per render: overlay-aware selection\n * state for affordances and custom layers. */\n getChromeState(): ChromeState;\n /**\n * Everything publishing an in-flight preview for this view: the handles in\n * flight on its dispatcher, in dispatch order. Readers take the first\n * non-null answer per id.\n *\n * A ghost layer must read this off its draw envelope rather than close over\n * a dispatcher: one layer array paints every view, so a closure ghosts view\n * zero's drag into every panel.\n */\n getPreviewSources(): readonly GesturePreviewSource[];\n /** Overlay shapes this view's in-flight handles publish — marquee, lasso,\n * insert preview, raw commands. Same envelope rule as\n * {@link CanvasViewHelpers.getPreviewSources}. */\n getGestureOverlays(): readonly OngoingOverlay[];\n /**\n * Chrome-caps visibility predicate, keyed by chrome id. Overlay layers and\n * affordances call it per element to decide whether to draw / hit-test.\n * Unwired, it is the universal `() => true`.\n */\n getIsVisible(): (id: string) => boolean;\n}\n\n/**\n * The half of {@link CanvasHelpers} that belongs to the surface — one GL\n * context, one debug sink, however many views are drawn on it.\n */\nexport interface CanvasSurfaceHelpers {\n /** Active debug sink, when `<Canvas debug=...>` is enabled, for layers to\n * call from their `draw` callback. `null` when debug is off. */\n getDebug(): DebugSink | null;\n}\n\n/** Live overlay-aware lookups exposed to custom layers via `helpersRef`, and\n * what a layer receives as its `data` argument. */\nexport interface CanvasHelpers<TPose> extends CanvasViewHelpers<TPose>, CanvasSurfaceHelpers {\n /**\n * The view this draw is for: a `<CanvasView>` id, or `null` for the\n * surface's own camera. One layer array paints every view, so a layer that\n * belongs in some views and not others — a minimap's indicator — declines\n * the rest by this id.\n */\n readonly viewId: string | null;\n}\n\n/** What a view's pose and bounds lookups read of an adapter. */\nexport interface ViewPoseAdapter<TPose> {\n getPose(id: string): TPose;\n /** Where the node is drawn, when the adapter composes poses. An adapter\n * without it stores absolute poses, where the two agree. */\n getWorldPose?(id: string): TPose;\n /** Where `id` is drawn if it stores `stored`. An adapter without it stores\n * absolute poses. */\n worldOfStored?(id: string, stored: TPose): TPose;\n /** The node an id names, whose `layer` decides whether a view that hides\n * that layer shows its selection chrome. */\n getNode?(id: string): { layer?: string } | undefined;\n}\n\nexport interface UseViewHelpersOpts<TPose> {\n adapter: ViewPoseAdapter<TPose> | undefined;\n geometry: PoseDescriptor<TPose>;\n /** Consumer-supplied bounds resolver. Falls back to the adapter's pose. */\n boundsOf: ((id: string) => Bounds | null) | undefined;\n /** Bounds of `id` drawn at an in-flight `pose`. Falls back to the\n * geometry's box of that pose, which is wrong wherever the surface draws a\n * node somewhere its pose does not say — a parallax plane. */\n boundsOfPose?: ((id: string, pose: TPose) => Bounds | null) | undefined;\n /** The nodes the adapter's ids name: with them, the fallbacks box each as\n * drawn, stroke included, rather than by its pose. */\n nodes?: DrawnBoundsScene | undefined;\n /** The view's scale, which a screen-pixel stroke is resolved at. Default 1. */\n getScale?: (() => Scale2) | undefined;\n /** The ids selected, read whenever chrome asks: a view following another\n * reads that view's, which changes without this one rendering. */\n selection: () => readonly NodeId[];\n gestureSource: GestureSource | undefined;\n /** The dispatcher's preview pose for an id, read through a ref so a change\n * mid-gesture doesn't rebuild the memos that depend on it. */\n previewPoseExtra: ((id: string) => unknown) | undefined;\n /** Chrome-caps predicate for this view. Absent means everything is visible. */\n getIsVisible?: (() => (id: string) => boolean) | undefined;\n /** Whether a scene layer reaches the screen in this view. Absent means\n * every layer the scene shows does. */\n layerIsPainted?: ((layerId: string) => boolean) | undefined;\n}\n\nexport interface ViewHelpersBundle<TPose> {\n helpers: CanvasViewHelpers<TPose>;\n}\n\nfunction worldPoseOf<TPose>(adapter: ViewPoseAdapter<TPose>, id: string): TPose {\n return typeof adapter.getWorldPose === 'function' ? adapter.getWorldPose(id) : adapter.getPose(id);\n}\n\n/**\n * Build one view's overlay-aware state: its chrome and the lookups its layers\n * draw and hit-test against. A canvas with N views mounts N components each\n * calling this once.\n */\nexport function useViewHelpers<TPose>(\n opts: UseViewHelpersOpts<TPose>,\n): ViewHelpersBundle<TPose> {\n const {\n adapter, geometry, boundsOf, boundsOfPose, nodes, getScale, selection, gestureSource,\n previewPoseExtra, getIsVisible, layerIsPainted,\n } = opts;\n const getScaleRef = useLatest(getScale);\n const poseBoxOf = useCallback((id: string, pose: TPose): Bounds => {\n if (!nodes) return framedBounds(pose, geometry);\n const scale = getScaleRef.current?.();\n return drawnBoundsOf(nodes, id as NodeId, pose, {\n descriptor: geometry as PoseDescriptor<unknown>,\n ...(adapter ? { worldPoseOf: (m: NodeId) => worldPoseOf(adapter, m) } : {}),\n ...(scale ? { scale } : {}),\n });\n }, [nodes, geometry, adapter, getScaleRef]);\n const boxOf = useCallback(\n (id: string, pose: TPose): Bounds | null =>\n (boundsOfPose ? boundsOfPose(id, pose) : poseBoxOf(id, pose)),\n [boundsOfPose, poseBoxOf],\n );\n\n const baseBoundsOf = useMemo(() => {\n if (boundsOf) return boundsOf;\n if (!adapter) return undefined;\n return (id: string): Bounds | null => {\n try {\n // World: chrome is drawn over the picture, so it has to agree with\n // where the renderer put the node, not with where its pose is stored.\n return poseBoxOf(id, worldPoseOf(adapter, id));\n } catch {\n return null;\n }\n };\n }, [boundsOf, adapter, poseBoxOf]);\n\n const committedPoseOf = useCallback((id: string): TPose | null => {\n if (!adapter) return null;\n try {\n return worldPoseOf(adapter, id);\n } catch {\n return null;\n }\n }, [adapter]);\n\n const selectionRef = useLatest(selection);\n\n const effectiveBoundsOf = useMemo(() => boundsOf ?? baseBoundsOf, [boundsOf, baseBoundsOf]);\n const worldOfStored = useMemo(\n () => (adapter?.worldOfStored ? (id: string, stored: TPose) => adapter.worldOfStored!(id, stored) : undefined),\n [adapter],\n );\n const { previewPoseOf, previewBoundsOf } = useInFlightBounds({\n gestureSource, previewPoseExtra, boxOf, committedPoseOf, worldOfStored,\n });\n\n /**\n * Bounds for `id` with any in-flight gesture folded in — what the user can\n * see, not what is committed. Both the chrome state and the layer helpers\n * answer bounds questions with this, so resize handles cannot end up a frame\n * away from the shape they belong to.\n */\n const boundsWithPreview = useCallback((id: string): Bounds | null => {\n const previewed = previewBoundsOf(id);\n if (previewed) return previewed;\n return effectiveBoundsOf ? effectiveBoundsOf(id) : null;\n }, [previewBoundsOf, effectiveBoundsOf]);\n\n const chromeState: ChromeState = useMemo(\n () => buildChromeState({\n get selection() { return selectionRef.current(); },\n get multiActive() { return selectionRef.current().length > 1; },\n effectiveBoundsOf: boundsWithPreview,\n modifiers: { alt: false, shift: false, meta: false, ctrl: false },\n // Absent adapter / unknown ids fall back to `true` so the affordance\n // stays visible for consumers that wire bounds without an adapter.\n canRotate: (id) => {\n if (!geometry.supportsRotation) return true;\n const pose = committedPoseOf(id);\n if (pose == null) return true;\n return geometry.supportsRotation(pose);\n },\n ...(layerIsPainted ? { layerIsPainted } : {}),\n ...(adapter?.getNode ? { layerOf: (id: string) => adapter.getNode?.(id)?.layer } : {}),\n }),\n [selectionRef, boundsWithPreview, geometry, committedPoseOf, layerIsPainted, adapter],\n );\n\n const helpers: CanvasViewHelpers<TPose> = {\n getEffectivePose: (id: string): TPose | null => {\n return previewPoseOf(id) ?? committedPoseOf(id);\n },\n getEffectiveBounds: boundsWithPreview,\n getGestureBounds: (): Bounds | null => {\n // The same id sets the ghost layer walks, so this cannot disagree with\n // what the user sees ghosted.\n const parts: (Bounds | null)[] = [];\n for (const id of new Set(gestureSource?.ids() ?? [])) parts.push(previewBoundsOf(id));\n const extraBounds = gestureSource?.bounds();\n if (extraBounds) for (const b of extraBounds) parts.push(b);\n return unionAABB(parts);\n },\n subscribeGestures: (fn: () => void): (() => void) =>\n gestureSource?.subscribe(fn) ?? noOpUnsubscribe,\n getGestureVersion: (): number => gestureSource?.getVersion() ?? 0,\n getChromeState: () => chromeState,\n getPreviewSources: (): readonly GesturePreviewSource[] => gestureSource?.previewSources() ?? [],\n getGestureOverlays: (): readonly OngoingOverlay[] => gestureSource?.overlays() ?? [],\n getIsVisible: (): ((id: string) => boolean) => getIsVisible?.() ?? alwaysVisible,\n };\n\n return { helpers };\n}\n"],"mappings":";;;;;;;;;AAeA,IAAM,wBAA8B,CAAC;AAErC,IAAM,sBAA+B;AAwJrC,SAAS,YAAmB,SAAiC,IAAmB;CAC9E,OAAO,OAAO,QAAQ,iBAAiB,aAAa,QAAQ,aAAa,EAAE,IAAI,QAAQ,QAAQ,EAAE;AACnG;;;;;;AAOA,SAAgB,eACd,MAC0B;CAC1B,MAAM,EACJ,SAAS,UAAU,UAAU,cAAc,OAAO,UAAU,WAAW,eACvE,kBAAkB,cAAc,mBAC9B;CACJ,MAAM,cAAc,UAAU,QAAQ;CACtC,MAAM,YAAY,aAAa,IAAY,SAAwB;EACjE,IAA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AACnB"}
@@ -2,7 +2,7 @@ import { createSceneLayerGate } from "./sceneLayerPaint.js";
2
2
  import { useCallback, useState } from "react";
3
3
  import { useLatest } from "@weasel-js/react";
4
4
 
5
- //#region src/canvas/useViewLayerGate.ts
5
+ // src/canvas/useViewLayerGate.ts
6
6
  /**
7
7
  * Whether a surface's own view paints a scene layer, judged against the stack
8
8
  * `surfaceLayers` returns, read at ask time, so a consumer slot anchored
@@ -24,6 +24,5 @@ function useViewLayerGate(layerVisibility, layerOrder, surfaceLayers) {
24
24
  return layerVisibility !== void 0 || layerOrder !== void 0 ? layerIsPainted : void 0;
25
25
  }
26
26
 
27
- //#endregion
28
27
  export { useViewLayerGate };
29
28
  //# sourceMappingURL=useViewLayerGate.js.map
@@ -1,7 +1,7 @@
1
1
  import { createSceneLayerGate, viewPaintedLayers } from "./sceneLayerPaint.js";
2
2
  import { useCallback, useRef, useState } from "react";
3
3
 
4
- //#region src/canvas/useViewNesting.ts
4
+ // src/canvas/useViewNesting.ts
5
5
  /**
6
6
  * How a `<CanvasView>` sits in the view it is nested in: the frame its
7
7
  * `bounds` and derived camera are measured against, and the layers it may
@@ -127,6 +127,5 @@ function useViewNesting(registry, live) {
127
127
  };
128
128
  }
129
129
 
130
- //#endregion
131
130
  export { NO_RECT, sizeOf, useViewNesting };
132
131
  //# sourceMappingURL=useViewNesting.js.map
@@ -1,7 +1,8 @@
1
+ import { viewScreenToWorld } from "@weasel-js/geom";
1
2
  import { useEffect } from "react";
2
3
  import { useLatest } from "@weasel-js/react";
3
4
 
4
- //#region src/canvas/useViewRegistrySurface.ts
5
+ // src/canvas/useViewRegistrySurface.ts
5
6
  /**
6
7
  * Attach this canvas to the view registry as its surface. The stack a view paints through its
7
8
  * own camera is this canvas's `layers`, before the views themselves are folded in — otherwise
@@ -23,9 +24,11 @@ function useViewRegistrySurface(viewRegistry, layers, frame, services) {
23
24
  setView,
24
25
  claimsAbove: (x, y) => {
25
26
  const view = viewRef.current;
26
- const worldX = x / view.scale.x + view.x;
27
- const worldY = y / view.scale.y + view.y;
28
- return hitTestExtrasIn(worldX, worldY, view, dimsRef.current, helpersRef.current) !== null;
27
+ const world = viewScreenToWorld(view, {
28
+ x,
29
+ y
30
+ });
31
+ return hitTestExtrasIn(world.x, world.y, view, dimsRef.current, helpersRef.current) !== null;
29
32
  }
30
33
  });
31
34
  }, [
@@ -41,6 +44,5 @@ function useViewRegistrySurface(viewRegistry, layers, frame, services) {
41
44
  ]);
42
45
  }
43
46
 
44
- //#endregion
45
47
  export { useViewRegistrySurface };
46
48
  //# sourceMappingURL=useViewRegistrySurface.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"useViewRegistrySurface.js","names":[],"sources":["../../src/canvas/useViewRegistrySurface.ts"],"sourcesContent":["import { useEffect } from 'react';\nimport { useLatest } from '@weasel-js/react';\nimport type { View } from 'core/viewport/view';\nimport type { Dims, RenderLayer } from 'core/layers/render';\nimport type { CanvasHelpers } from './useViewHelpers';\nimport type { SurfaceHandle, ViewRegistry } from './viewRegistry';\n\n/** What the canvas reads at draw and hit time that changes outside a render. */\nexport interface SurfaceFrame {\n viewRef: { readonly current: View };\n dimsRef: { readonly current: Dims };\n helpersRef: { readonly current: Pick<CanvasHelpers<unknown>, 'getChromeState'> | null };\n}\n\n/** What the canvas does for a view that asks. */\nexport interface SurfaceServices {\n requestRedraw: () => void;\n hitTestExtrasIn: SurfaceHandle['hitTestExtras'];\n clientToWorld: SurfaceHandle['clientToWorld'];\n setView: NonNullable<SurfaceHandle['setView']>;\n}\n\n/**\n * Attach this canvas to the view registry as its surface. The stack a view paints through its\n * own camera is this canvas's `layers`, before the views themselves are folded in — otherwise\n * a view would contain itself. Published by reference and read at draw time.\n */\nexport function useViewRegistrySurface(\n viewRegistry: ViewRegistry | null,\n layers: readonly RenderLayer<unknown>[],\n frame: SurfaceFrame,\n services: SurfaceServices,\n): void {\n const surfaceLayersRef = useLatest<readonly RenderLayer<unknown>[]>(layers);\n const { viewRef, dimsRef, helpersRef } = frame;\n const { requestRedraw, hitTestExtrasIn, clientToWorld, setView } = services;\n useEffect(() => {\n return viewRegistry?.attachSurface({\n view: () => viewRef.current,\n dims: () => dimsRef.current,\n layers: () => surfaceLayersRef.current,\n requestRedraw,\n chromeState: () => helpersRef.current!.getChromeState(),\n hitTestExtras: hitTestExtrasIn,\n clientToWorld,\n setView,\n claimsAbove: (x, y) => {\n const view = viewRef.current;\n const worldX = x / view.scale.x + view.x;\n const worldY = y / view.scale.y + view.y;\n return hitTestExtrasIn(worldX, worldY, view, dimsRef.current, helpersRef.current) !== null;\n },\n });\n }, [viewRegistry, requestRedraw, hitTestExtrasIn, dimsRef, surfaceLayersRef, viewRef, helpersRef, clientToWorld, setView]);\n}\n"],"mappings":";;;;;;;;;AA2BA,SAAgB,uBACd,cACA,QACA,OACA,UACM;CACN,MAAM,mBAAmB,UAA2C,MAAM;CAC1E,MAAM,EAAE,SAAS,SAAS,eAAe;CACzC,MAAM,EAAE,eAAe,iBAAiB,eAAe,YAAY;CACnE,gBAAgB;EACd,OAAO,cAAc,cAAc;GACjC,YAAY,QAAQ;GACpB,YAAY,QAAQ;GACpB,cAAc,iBAAiB;GAC/B;GACA,mBAAmB,WAAW,QAAS,eAAe;GACtD,eAAe;GACf;GACA;GACA,cAAc,GAAG,MAAM;IACrB,MAAM,OAAO,QAAQ;IACrB,MAAM,SAAS,IAAI,KAAK,MAAM,IAAI,KAAK;IACvC,MAAM,SAAS,IAAI,KAAK,MAAM,IAAI,KAAK;IACvC,OAAO,gBAAgB,QAAQ,QAAQ,MAAM,QAAQ,SAAS,WAAW,OAAO,MAAM;GACxF;EACF,CAAC;CACH,GAAG;EAAC;EAAc;EAAe;EAAiB;EAAS;EAAkB;EAAS;EAAY;EAAe;CAAO,CAAC;AAC3H"}
1
+ {"version":3,"file":"useViewRegistrySurface.js","names":[],"sources":["../../src/canvas/useViewRegistrySurface.ts"],"sourcesContent":["import { useEffect } from 'react';\nimport { useLatest } from '@weasel-js/react';\nimport { viewScreenToWorld } from '@weasel-js/geom';\nimport type { View } from 'core/viewport/view';\nimport type { Dims, RenderLayer } from 'core/layers/render';\nimport type { CanvasHelpers } from './useViewHelpers';\nimport type { SurfaceHandle, ViewRegistry } from './viewRegistry';\n\n/** What the canvas reads at draw and hit time that changes outside a render. */\nexport interface SurfaceFrame {\n viewRef: { readonly current: View };\n dimsRef: { readonly current: Dims };\n helpersRef: { readonly current: Pick<CanvasHelpers<unknown>, 'getChromeState'> | null };\n}\n\n/** What the canvas does for a view that asks. */\nexport interface SurfaceServices {\n requestRedraw: () => void;\n hitTestExtrasIn: SurfaceHandle['hitTestExtras'];\n clientToWorld: SurfaceHandle['clientToWorld'];\n setView: NonNullable<SurfaceHandle['setView']>;\n}\n\n/**\n * Attach this canvas to the view registry as its surface. The stack a view paints through its\n * own camera is this canvas's `layers`, before the views themselves are folded in — otherwise\n * a view would contain itself. Published by reference and read at draw time.\n */\nexport function useViewRegistrySurface(\n viewRegistry: ViewRegistry | null,\n layers: readonly RenderLayer<unknown>[],\n frame: SurfaceFrame,\n services: SurfaceServices,\n): void {\n const surfaceLayersRef = useLatest<readonly RenderLayer<unknown>[]>(layers);\n const { viewRef, dimsRef, helpersRef } = frame;\n const { requestRedraw, hitTestExtrasIn, clientToWorld, setView } = services;\n useEffect(() => {\n return viewRegistry?.attachSurface({\n view: () => viewRef.current,\n dims: () => dimsRef.current,\n layers: () => surfaceLayersRef.current,\n requestRedraw,\n chromeState: () => helpersRef.current!.getChromeState(),\n hitTestExtras: hitTestExtrasIn,\n clientToWorld,\n setView,\n claimsAbove: (x, y) => {\n const view = viewRef.current;\n const world = viewScreenToWorld(view, { x, y });\n return hitTestExtrasIn(world.x, world.y, view, dimsRef.current, helpersRef.current) !== null;\n },\n });\n }, [viewRegistry, requestRedraw, hitTestExtrasIn, dimsRef, surfaceLayersRef, viewRef, helpersRef, clientToWorld, setView]);\n}\n"],"mappings":";;;;;;;;;;AA4BA,SAAgB,uBACd,cACA,QACA,OACA,UACM;CACN,MAAM,mBAAmB,UAA2C,MAAM;CAC1E,MAAM,EAAE,SAAS,SAAS,eAAe;CACzC,MAAM,EAAE,eAAe,iBAAiB,eAAe,YAAY;CACnE,gBAAgB;EACd,OAAO,cAAc,cAAc;GACjC,YAAY,QAAQ;GACpB,YAAY,QAAQ;GACpB,cAAc,iBAAiB;GAC/B;GACA,mBAAmB,WAAW,QAAS,eAAe;GACtD,eAAe;GACf;GACA;GACA,cAAc,GAAG,MAAM;IACrB,MAAM,OAAO,QAAQ;IACrB,MAAM,QAAQ,kBAAkB,MAAM;KAAE;KAAG;IAAE,CAAC;IAC9C,OAAO,gBAAgB,MAAM,GAAG,MAAM,GAAG,MAAM,QAAQ,SAAS,WAAW,OAAO,MAAM;GAC1F;EACF,CAAC;CACH,GAAG;EAAC;EAAc;EAAe;EAAiB;EAAS;EAAkB;EAAS;EAAY;EAAe;CAAO,CAAC;AAC3H"}
@@ -1,7 +1,7 @@
1
1
  import { createContext, useContext } from "react";
2
2
  import { jsx } from "react/jsx-runtime";
3
3
 
4
- //#region src/canvas/viewInputs.tsx
4
+ // src/canvas/viewInputs.tsx
5
5
  var ViewInputsContext = createContext(null);
6
6
  /** @internal */
7
7
  function ViewInputsProvider({ value, children }) {
@@ -15,6 +15,5 @@ function useOptionalViewInputs() {
15
15
  return useContext(ViewInputsContext);
16
16
  }
17
17
 
18
- //#endregion
19
18
  export { ViewInputsProvider, useOptionalViewInputs };
20
19
  //# sourceMappingURL=viewInputs.js.map
@@ -2,7 +2,7 @@ import { aimSpace2d } from "../domains/viewports/aim.js";
2
2
  import { createViewMarkerLayer, grabViewMarker } from "../domains/viewports/viewMarker.js";
3
3
  import { layerAffordance } from "./affordanceAt.js";
4
4
 
5
- //#region src/canvas/viewMarkers.ts
5
+ // src/canvas/viewMarkers.ts
6
6
  /** @internal */
7
7
  function createViewMarkerRegistry(markers, deps) {
8
8
  let gate = null;
@@ -58,6 +58,5 @@ function createViewMarkerRegistry(markers, deps) {
58
58
  };
59
59
  }
60
60
 
61
- //#endregion
62
61
  export { createViewMarkerRegistry };
63
62
  //# sourceMappingURL=viewMarkers.js.map
@@ -2,11 +2,12 @@ import { createViewResolver, viewContains } from "../domains/viewports/viewResol
2
2
  import { isRectAim, rectAim, viewForAim } from "../domains/viewports/aim.js";
3
3
  import { viewportWorldRect } from "../core/viewport/viewportWorldRect.js";
4
4
  import { createViewMarkerRegistry } from "./viewMarkers.js";
5
+ import { viewWorldToScreen } from "@weasel-js/geom";
5
6
  import { createEmitter } from "@weasel-js/registry";
6
7
  import { createContext, useContext, useMemo, useRef } from "react";
7
8
  import { jsx } from "react/jsx-runtime";
8
9
 
9
- //#region src/canvas/viewRegistry.tsx
10
+ // src/canvas/viewRegistry.tsx
10
11
  /**
11
12
  * The seam between a canvas surface and the views drawn on it.
12
13
  *
@@ -29,11 +30,10 @@ function surfaceLocal(surface, clientX, clientY) {
29
30
  y: clientY
30
31
  };
31
32
  const [worldX, worldY] = surface.clientToWorld(clientX, clientY);
32
- const view = surface.view();
33
- return {
34
- x: (worldX - view.x) * view.scale.x,
35
- y: (worldY - view.y) * view.scale.y
36
- };
33
+ return viewWorldToScreen(surface.view(), {
34
+ x: worldX,
35
+ y: worldY
36
+ });
37
37
  }
38
38
  var ViewRegistryContext = createContext(null);
39
39
  /** Mounts the registry for one surface. `<SceneCanvas>` mounts one; a view
@@ -186,6 +186,5 @@ var IDENTITY_VIEW = {
186
186
  }
187
187
  };
188
188
 
189
- //#endregion
190
189
  export { IDENTITY_VIEW, UNMEASURED_DIMS, ViewRegistryProvider, surfaceLocal, useOptionalViewRegistry };
191
190
  //# sourceMappingURL=viewRegistry.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"viewRegistry.js","names":[],"sources":["../../src/canvas/viewRegistry.tsx"],"sourcesContent":["/**\n * The seam between a canvas surface and the views drawn on it.\n *\n * Traffic runs both ways: the surface attaches a handle onto its frame and its\n * layer stack, and each view registers what it contributes back — the viewport\n * node it paints into and the record the gesture dispatcher routes its events\n * to. Both sides are thunks, read at draw and dispatch time, so neither can\n * serve the other a frame that has already moved.\n */\nimport { createContext, useContext, useMemo, useRef, type ReactNode } from 'react';\nimport type { Dims, RenderLayer } from 'core/layers/render';\nimport type { LayerHit } from 'affordances/types';\nimport type { ChromeState } from 'core/selection/chromeState';\nimport type { SelectionApi } from 'core/selection/useSelection';\nimport type { View } from 'core/viewport/view';\nimport type { ViewportLayer } from 'domains/viewports/viewportLayer';\nimport type { DispatcherViewTarget } from '@weasel-js/routing/internal';\nimport { createViewResolver, viewContains, type ViewResolver } from 'domains/viewports/viewResolver';\nimport { createEmitter } from '@weasel-js/registry';\nimport type { ViewAt } from './canvasExtension';\nimport { isRectAim, rectAim, viewForAim, type ViewAim } from 'domains/viewports/aim';\nimport { viewportWorldRect } from 'core/viewport/viewportWorldRect';\nimport type { ViewMarkerProps } from 'domains/viewports/viewMarker';\nimport { createViewMarkerRegistry, type ViewMarkerRegistry } from './viewMarkers';\n\n/**\n * What a view needs from the surface hosting it.\n *\n * @internal Attached by the surface, read by `<CanvasView>`.\n */\nexport interface SurfaceHandle {\n /** A client point in the surface's own world — the conversion the surface\n * itself makes, its `clientToWorld` override included. */\n clientToWorld(clientX: number, clientY: number): [number, number];\n /** The outer camera. */\n view(): View;\n /** The canvas's CSS-pixel size. */\n dims(): Dims;\n /** The stack a view paints through its own camera, unless it narrows it. */\n layers(): readonly RenderLayer<unknown>[];\n requestRedraw(): void;\n /** The canvas's own view chrome — its selection, its overlay-aware bounds.\n * What a `<CanvasView>` answers for itself, answered for view zero. */\n chromeState(): ChromeState;\n /** Hit-test the externally registered layers at a world point, against the\n * frame and draw envelope of whichever view is asking. The public\n * `hitTestExtras` is this with the canvas's own frame and envelope. */\n hitTestExtras(\n worldX: number,\n worldY: number,\n view: View,\n dims: Dims,\n data: unknown,\n /** Consider only these layers — the ones the asking view paints. A layer\n * asked on a frame it was not drawn in answers for the wrong pixels. */\n only?: readonly RenderLayer<unknown>[],\n ): { layerId: string; hit: LayerHit } | null;\n /** Whether a registered layer claims a canvas-local point on the surface's\n * own frame. Registered layers paint over every view, so such a point is\n * theirs even inside a view's rect. */\n claimsAbove(x: number, y: number): boolean;\n /** The root camera's input write: clamped, forwarded when controlled, and ending a glide. */\n setView?(next: View): void;\n}\n\n/**\n * A client point in the surface's CSS pixels, from its top-left: the surface's\n * own world point put back through its camera, so a `clientToWorld` override\n * reaches every view declared on it.\n *\n * @internal\n */\nexport function surfaceLocal(\n surface: Pick<SurfaceHandle, 'clientToWorld' | 'view'> | null,\n clientX: number,\n clientY: number,\n): { x: number; y: number } {\n if (!surface) return { x: clientX, y: clientY };\n const [worldX, worldY] = surface.clientToWorld(clientX, clientY);\n const view = surface.view();\n return { x: (worldX - view.x) * view.scale.x, y: (worldY - view.y) * view.scale.y };\n}\n\n/**\n * What one view contributes to the surface hosting it.\n *\n * @internal Written by `<CanvasView>`, read by the surface. Consumers declare\n * a view, not a registration.\n */\nexport interface ViewRegistration {\n id: string;\n /** The view this one is nested in: listed, painted and hit after it, and\n * its `layer` measures itself from that view's rect and camera. */\n parent?: string;\n /**\n * Paint and hit order, low to high. Views declared as props take their array\n * index; a view mounted as a child takes `Infinity`, so it lands after them\n * however React happens to order the mount effects.\n */\n order: number;\n /** The viewport node this view paints into. Its `resolvable` is what routes\n * input here. */\n layer: ViewportLayer<unknown>;\n /** `false` keeps input over the view on the canvas beneath it. */\n interactive: boolean;\n /** `false` leaves `layer` for a host to draw — a HUD window's interior — so\n * the surface does not paint it too. */\n paint: boolean;\n /** Everything about dispatching to this view except its id. */\n target: Omit<DispatcherViewTarget, 'id'>;\n /** Whether a scene layer reaches the screen in this view. For input that\n * reaches a view without a dispatch — hover — so it judges this view's\n * paint rather than the surface's. */\n layerIsPainted(layerId: string): boolean;\n /** The layers this view draws, in order — what a view nested in it paints\n * from. */\n drawnLayers(): readonly RenderLayer<unknown>[];\n /** The selection the view owns, or the one the view it follows owns;\n * `undefined` while it shares the surface's. */\n selection(): SelectionApi | undefined;\n /** Whether the view keeps its camera or its aim; the other is derived. */\n held: 'camera' | 'aim';\n /** What the view shows: the aim it holds, or its camera's. */\n aim(): ViewAim;\n /** `false` for an aim the view cannot read, or one with nowhere to go. */\n setAim(aim: ViewAim): boolean;\n}\n\n\n/** @internal */\nexport interface ViewRegistry extends ViewMarkerRegistry {\n /** Returns an unregister. */\n register(reg: ViewRegistration): () => void;\n /** Live registrations in paint order, each nested view after the view it\n * is nested in. */\n list(): readonly ViewRegistration[];\n /** The live registration with `id`, if any. */\n get(id: string): ViewRegistration | undefined;\n /** The innermost view painted under a canvas-local point, whether or not it\n * takes input, passing over `except` and the views nested in it. */\n viewAt(at: { x: number; y: number }, opts?: { except?: string }): ViewAt;\n /** What view `id` shows (`null`: the surface's root), or `null` while there is no such view. */\n aimOf(id: string | null): ViewAim | null;\n /** Point view `id` at `aim`; `false` when it cannot. */\n setAim(id: string | null, aim: ViewAim): boolean;\n /** Bumped whenever the list changes. Pair with {@link ViewRegistry.subscribe}\n * for `useSyncExternalStore`. */\n getVersion(): number;\n subscribe(fn: () => void): () => void;\n /** Which view a client point belongs to, sticky for a captured pointer.\n * One per surface: every caller that routes input — the dispatcher, pinch,\n * hover — must agree about where a point landed. */\n readonly resolver: ViewResolver;\n /** The hosting surface, or `null` before one attaches. */\n surface(): SurfaceHandle | null;\n /** Returns a detach, which leaves a handle attached since alone. */\n attachSurface(handle: SurfaceHandle): () => void;\n}\n\nconst ViewRegistryContext = createContext<ViewRegistry | null>(null);\n\n/** Mounts the registry for one surface. `<SceneCanvas>` mounts one; a view\n * declaring itself as a child must be inside it. */\nexport function ViewRegistryProvider({ children }: { children: ReactNode }) {\n const entriesRef = useRef(new Map<ViewRegistration, number>());\n const seqRef = useRef(0);\n const versionRef = useRef(0);\n const surfaceRef = useRef<SurfaceHandle | null>(null);\n const markersRef = useRef(new Map<() => ViewMarkerProps, RenderLayer<unknown>>());\n\n const registry = useMemo<ViewRegistry>(() => {\n const listeners = createEmitter();\n const changed = (): void => {\n versionRef.current++;\n listeners.emit();\n };\n const ordered = (): ViewRegistration[] => nestedOrder([...entriesRef.current.keys()].sort((a, b) => (\n a.order - b.order || entriesRef.current.get(a)! - entriesRef.current.get(b)!\n )));\n const get = (id: string): ViewRegistration | undefined => {\n for (const r of entriesRef.current.keys()) if (r.id === id) return r;\n return undefined;\n };\n /** Whether `r` is `id` or nested in it, however deep. */\n const within = (r: ViewRegistration, id: string): boolean => {\n const seen = new Set<ViewRegistration>();\n for (let at: ViewRegistration | undefined = r; at && !seen.has(at); at = at.parent === undefined ? undefined : get(at.parent)) {\n if (at.id === id) return true;\n seen.add(at);\n }\n return false;\n };\n const resolver = createViewResolver({\n views: () => {\n const surface = surfaceRef.current;\n const view = surface?.view() ?? IDENTITY_VIEW;\n const dims = surface?.dims() ?? UNMEASURED_DIMS;\n return ordered().filter((r) => r.interactive).map((r) => r.layer.resolvable(view, dims));\n },\n root: () => surfaceRef.current?.view() ?? IDENTITY_VIEW,\n toLocal: (clientX, clientY) => surfaceLocal(surfaceRef.current, clientX, clientY),\n occluded: (x, y) => surfaceRef.current?.claimsAbove(x, y) ?? false,\n });\n const registry: ViewRegistry = {\n resolver,\n register: (reg) => {\n entriesRef.current.set(reg, seqRef.current++);\n changed();\n return () => { entriesRef.current.delete(reg); changed(); };\n },\n list: ordered,\n get,\n viewAt: ({ x, y }, opts) => {\n const surface = surfaceRef.current;\n const view = surface?.view() ?? IDENTITY_VIEW;\n const dims = surface?.dims() ?? UNMEASURED_DIMS;\n const except = opts?.except;\n const list = ordered();\n for (let i = list.length - 1; i >= 0; i--) {\n const r = list[i]!;\n if (except !== undefined && within(r, except)) continue;\n const v = r.layer.resolvable(view, dims);\n if (viewContains(v, x, y)) return { id: v.id, view: v.view, rect: v.rect };\n }\n return { id: null, view, rect: { x: 0, y: 0, w: dims.width, h: dims.height } };\n },\n aimOf: (id) => {\n if (id !== null) return get(id)?.aim() ?? null;\n const surface = surfaceRef.current;\n return surface ? rectAim(null, viewportWorldRect(surface.view(), surface.dims())) : null;\n },\n setAim: (id, aim) => {\n if (id !== null) return get(id)?.setAim(aim) ?? false;\n const surface = surfaceRef.current;\n if (!isRectAim(aim) || !surface?.setView) return false;\n surface.setView(viewForAim(aim.extent, surface.dims(), 'exact'));\n return true;\n },\n ...createViewMarkerRegistry(markersRef.current, {\n host: { aimOf: (id) => registry.aimOf(id), setAim: (id, aim) => registry.setAim(id, aim) },\n surface: () => surfaceRef.current,\n resolve: (id, outer, dims) => get(id)?.layer.resolvable(outer, dims),\n changed,\n }),\n getVersion: () => versionRef.current,\n subscribe: listeners.subscribe,\n surface: () => surfaceRef.current,\n attachSurface: (handle) => {\n surfaceRef.current = handle;\n return () => { if (surfaceRef.current === handle) surfaceRef.current = null; };\n },\n };\n return registry;\n }, []);\n\n return <ViewRegistryContext.Provider value={registry}>{children}</ViewRegistryContext.Provider>;\n}\n\n/** The surface's view registry, or `null` outside one. */\nexport function useOptionalViewRegistry(): ViewRegistry | null {\n return useContext(ViewRegistryContext);\n}\n\n/** Each view followed by the views nested in it, in the order given. A view\n * whose parent is not registered keeps its place; one caught in a cycle\n * goes last. */\nfunction nestedOrder(sorted: readonly ViewRegistration[]): ViewRegistration[] {\n const ids = new Set(sorted.map((r) => r.id));\n const out: ViewRegistration[] = [];\n const placed = new Set<ViewRegistration>();\n const place = (r: ViewRegistration): void => {\n if (placed.has(r)) return;\n placed.add(r);\n out.push(r);\n for (const child of sorted) if (child.parent === r.id) place(child);\n };\n for (const r of sorted) if (r.parent === undefined || !ids.has(r.parent)) place(r);\n for (const r of sorted) place(r);\n return out;\n}\n\n/** The `Dims` a surface reports before it has measured itself. */\nexport const UNMEASURED_DIMS: Dims = { width: 0, height: 0 };\n\n/** The camera a view resolves against before its surface attaches. */\nexport const IDENTITY_VIEW: View = { x: 0, y: 0, scale: { x: 1, y: 1 } };\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAwEA,SAAgB,aACd,SACA,SACA,SAC0B;CAC1B,IAAI,CAAC,SA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ACV,KAAK,MAAM,SAAS,QAAQ,IAAI,MAAM,WAAW,EAAE,IAAI,MAAM,KAAK;CACpE;CACA,KAAK,MAAM,KAAK,QAAQ,IAAI,EAAE,WAAW,UAAa,CAAC,IAAI,IAAI,EAAE,MAAM,GAAG,MAAM,CAAC;CACjF,KAAK,MAAM,KAAK,QAAQ,MAAM,CAAC;CAC/B,OAAO;AACT;;AAGA,IAAa,kBAAwB;CAAE,OAAO;CAAG,QAAQ;AAAE;;AAG3D,IAAa,gBAAsB;CAAE,GAAG;CAAG,GAAG;CAAG,OAAO;EAAE,GAAG;EAAG,GAAG;CAAE;AAAE"}
1
+ {"version":3,"file":"viewRegistry.js","names":[],"sources":["../../src/canvas/viewRegistry.tsx"],"sourcesContent":["/**\n * The seam between a canvas surface and the views drawn on it.\n *\n * Traffic runs both ways: the surface attaches a handle onto its frame and its\n * layer stack, and each view registers what it contributes back — the viewport\n * node it paints into and the record the gesture dispatcher routes its events\n * to. Both sides are thunks, read at draw and dispatch time, so neither can\n * serve the other a frame that has already moved.\n */\nimport { createContext, useContext, useMemo, useRef, type ReactNode } from 'react';\nimport type { Dims, RenderLayer } from 'core/layers/render';\nimport type { LayerHit } from 'affordances/types';\nimport type { ChromeState } from 'core/selection/chromeState';\nimport type { SelectionApi } from 'core/selection/useSelection';\nimport type { View } from 'core/viewport/view';\nimport type { ViewportLayer } from 'domains/viewports/viewportLayer';\nimport type { DispatcherViewTarget } from '@weasel-js/routing/internal';\nimport { createViewResolver, viewContains, type ViewResolver } from 'domains/viewports/viewResolver';\nimport { createEmitter } from '@weasel-js/registry';\nimport { viewWorldToScreen } from '@weasel-js/geom';\nimport type { ViewAt } from './canvasExtension';\nimport { isRectAim, rectAim, viewForAim, type ViewAim } from 'domains/viewports/aim';\nimport { viewportWorldRect } from 'core/viewport/viewportWorldRect';\nimport type { ViewMarkerProps } from 'domains/viewports/viewMarker';\nimport { createViewMarkerRegistry, type ViewMarkerRegistry } from './viewMarkers';\n\n/**\n * What a view needs from the surface hosting it.\n *\n * @internal Attached by the surface, read by `<CanvasView>`.\n */\nexport interface SurfaceHandle {\n /** A client point in the surface's own world — the conversion the surface\n * itself makes, its `clientToWorld` override included. */\n clientToWorld(clientX: number, clientY: number): [number, number];\n /** The outer camera. */\n view(): View;\n /** The canvas's CSS-pixel size. */\n dims(): Dims;\n /** The stack a view paints through its own camera, unless it narrows it. */\n layers(): readonly RenderLayer<unknown>[];\n requestRedraw(): void;\n /** The canvas's own view chrome — its selection, its overlay-aware bounds.\n * What a `<CanvasView>` answers for itself, answered for view zero. */\n chromeState(): ChromeState;\n /** Hit-test the externally registered layers at a world point, against the\n * frame and draw envelope of whichever view is asking. The public\n * `hitTestExtras` is this with the canvas's own frame and envelope. */\n hitTestExtras(\n worldX: number,\n worldY: number,\n view: View,\n dims: Dims,\n data: unknown,\n /** Consider only these layers — the ones the asking view paints. A layer\n * asked on a frame it was not drawn in answers for the wrong pixels. */\n only?: readonly RenderLayer<unknown>[],\n ): { layerId: string; hit: LayerHit } | null;\n /** Whether a registered layer claims a canvas-local point on the surface's\n * own frame. Registered layers paint over every view, so such a point is\n * theirs even inside a view's rect. */\n claimsAbove(x: number, y: number): boolean;\n /** The root camera's input write: clamped, forwarded when controlled, and ending a glide. */\n setView?(next: View): void;\n}\n\n/**\n * A client point in the surface's CSS pixels, from its top-left: the surface's\n * own world point put back through its camera, so a `clientToWorld` override\n * reaches every view declared on it.\n *\n * @internal\n */\nexport function surfaceLocal(\n surface: Pick<SurfaceHandle, 'clientToWorld' | 'view'> | null,\n clientX: number,\n clientY: number,\n): { x: number; y: number } {\n if (!surface) return { x: clientX, y: clientY };\n const [worldX, worldY] = surface.clientToWorld(clientX, clientY);\n return viewWorldToScreen(surface.view(), { x: worldX, y: worldY });\n}\n\n/**\n * What one view contributes to the surface hosting it.\n *\n * @internal Written by `<CanvasView>`, read by the surface. Consumers declare\n * a view, not a registration.\n */\nexport interface ViewRegistration {\n id: string;\n /** The view this one is nested in: listed, painted and hit after it, and\n * its `layer` measures itself from that view's rect and camera. */\n parent?: string;\n /**\n * Paint and hit order, low to high. Views declared as props take their array\n * index; a view mounted as a child takes `Infinity`, so it lands after them\n * however React happens to order the mount effects.\n */\n order: number;\n /** The viewport node this view paints into. Its `resolvable` is what routes\n * input here. */\n layer: ViewportLayer<unknown>;\n /** `false` keeps input over the view on the canvas beneath it. */\n interactive: boolean;\n /** `false` leaves `layer` for a host to draw — a HUD window's interior — so\n * the surface does not paint it too. */\n paint: boolean;\n /** Everything about dispatching to this view except its id. */\n target: Omit<DispatcherViewTarget, 'id'>;\n /** Whether a scene layer reaches the screen in this view. For input that\n * reaches a view without a dispatch — hover — so it judges this view's\n * paint rather than the surface's. */\n layerIsPainted(layerId: string): boolean;\n /** The layers this view draws, in order — what a view nested in it paints\n * from. */\n drawnLayers(): readonly RenderLayer<unknown>[];\n /** The selection the view owns, or the one the view it follows owns;\n * `undefined` while it shares the surface's. */\n selection(): SelectionApi | undefined;\n /** Whether the view keeps its camera or its aim; the other is derived. */\n held: 'camera' | 'aim';\n /** What the view shows: the aim it holds, or its camera's. */\n aim(): ViewAim;\n /** `false` for an aim the view cannot read, or one with nowhere to go. */\n setAim(aim: ViewAim): boolean;\n}\n\n\n/** @internal */\nexport interface ViewRegistry extends ViewMarkerRegistry {\n /** Returns an unregister. */\n register(reg: ViewRegistration): () => void;\n /** Live registrations in paint order, each nested view after the view it\n * is nested in. */\n list(): readonly ViewRegistration[];\n /** The live registration with `id`, if any. */\n get(id: string): ViewRegistration | undefined;\n /** The innermost view painted under a canvas-local point, whether or not it\n * takes input, passing over `except` and the views nested in it. */\n viewAt(at: { x: number; y: number }, opts?: { except?: string }): ViewAt;\n /** What view `id` shows (`null`: the surface's root), or `null` while there is no such view. */\n aimOf(id: string | null): ViewAim | null;\n /** Point view `id` at `aim`; `false` when it cannot. */\n setAim(id: string | null, aim: ViewAim): boolean;\n /** Bumped whenever the list changes. Pair with {@link ViewRegistry.subscribe}\n * for `useSyncExternalStore`. */\n getVersion(): number;\n subscribe(fn: () => void): () => void;\n /** Which view a client point belongs to, sticky for a captured pointer.\n * One per surface: every caller that routes input — the dispatcher, pinch,\n * hover — must agree about where a point landed. */\n readonly resolver: ViewResolver;\n /** The hosting surface, or `null` before one attaches. */\n surface(): SurfaceHandle | null;\n /** Returns a detach, which leaves a handle attached since alone. */\n attachSurface(handle: SurfaceHandle): () => void;\n}\n\nconst ViewRegistryContext = createContext<ViewRegistry | null>(null);\n\n/** Mounts the registry for one surface. `<SceneCanvas>` mounts one; a view\n * declaring itself as a child must be inside it. */\nexport function ViewRegistryProvider({ children }: { children: ReactNode }) {\n const entriesRef = useRef(new Map<ViewRegistration, number>());\n const seqRef = useRef(0);\n const versionRef = useRef(0);\n const surfaceRef = useRef<SurfaceHandle | null>(null);\n const markersRef = useRef(new Map<() => ViewMarkerProps, RenderLayer<unknown>>());\n\n const registry = useMemo<ViewRegistry>(() => {\n const listeners = createEmitter();\n const changed = (): void => {\n versionRef.current++;\n listeners.emit();\n };\n const ordered = (): ViewRegistration[] => nestedOrder([...entriesRef.current.keys()].sort((a, b) => (\n a.order - b.order || entriesRef.current.get(a)! - entriesRef.current.get(b)!\n )));\n const get = (id: string): ViewRegistration | undefined => {\n for (const r of entriesRef.current.keys()) if (r.id === id) return r;\n return undefined;\n };\n /** Whether `r` is `id` or nested in it, however deep. */\n const within = (r: ViewRegistration, id: string): boolean => {\n const seen = new Set<ViewRegistration>();\n for (let at: ViewRegistration | undefined = r; at && !seen.has(at); at = at.parent === undefined ? undefined : get(at.parent)) {\n if (at.id === id) return true;\n seen.add(at);\n }\n return false;\n };\n const resolver = createViewResolver({\n views: () => {\n const surface = surfaceRef.current;\n const view = surface?.view() ?? IDENTITY_VIEW;\n const dims = surface?.dims() ?? UNMEASURED_DIMS;\n return ordered().filter((r) => r.interactive).map((r) => r.layer.resolvable(view, dims));\n },\n root: () => surfaceRef.current?.view() ?? IDENTITY_VIEW,\n toLocal: (clientX, clientY) => surfaceLocal(surfaceRef.current, clientX, clientY),\n occluded: (x, y) => surfaceRef.current?.claimsAbove(x, y) ?? false,\n });\n const registry: ViewRegistry = {\n resolver,\n register: (reg) => {\n entriesRef.current.set(reg, seqRef.current++);\n changed();\n return () => { entriesRef.current.delete(reg); changed(); };\n },\n list: ordered,\n get,\n viewAt: ({ x, y }, opts) => {\n const surface = surfaceRef.current;\n const view = surface?.view() ?? IDENTITY_VIEW;\n const dims = surface?.dims() ?? UNMEASURED_DIMS;\n const except = opts?.except;\n const list = ordered();\n for (let i = list.length - 1; i >= 0; i--) {\n const r = list[i]!;\n if (except !== undefined && within(r, except)) continue;\n const v = r.layer.resolvable(view, dims);\n if (viewContains(v, x, y)) return { id: v.id, view: v.view, rect: v.rect };\n }\n return { id: null, view, rect: { x: 0, y: 0, w: dims.width, h: dims.height } };\n },\n aimOf: (id) => {\n if (id !== null) return get(id)?.aim() ?? null;\n const surface = surfaceRef.current;\n return surface ? rectAim(null, viewportWorldRect(surface.view(), surface.dims())) : null;\n },\n setAim: (id, aim) => {\n if (id !== null) return get(id)?.setAim(aim) ?? false;\n const surface = surfaceRef.current;\n if (!isRectAim(aim) || !surface?.setView) return false;\n surface.setView(viewForAim(aim.extent, surface.dims(), 'exact'));\n return true;\n },\n ...createViewMarkerRegistry(markersRef.current, {\n host: { aimOf: (id) => registry.aimOf(id), setAim: (id, aim) => registry.setAim(id, aim) },\n surface: () => surfaceRef.current,\n resolve: (id, outer, dims) => get(id)?.layer.resolvable(outer, dims),\n changed,\n }),\n getVersion: () => versionRef.current,\n subscribe: listeners.subscribe,\n surface: () => surfaceRef.current,\n attachSurface: (handle) => {\n surfaceRef.current = handle;\n return () => { if (surfaceRef.current === handle) surfaceRef.current = null; };\n },\n };\n return registry;\n }, []);\n\n return <ViewRegistryContext.Provider value={registry}>{children}</ViewRegistryContext.Provider>;\n}\n\n/** The surface's view registry, or `null` outside one. */\nexport function useOptionalViewRegistry(): ViewRegistry | null {\n return useContext(ViewRegistryContext);\n}\n\n/** Each view followed by the views nested in it, in the order given. A view\n * whose parent is not registered keeps its place; one caught in a cycle\n * goes last. */\nfunction nestedOrder(sorted: readonly ViewRegistration[]): ViewRegistration[] {\n const ids = new Set(sorted.map((r) => r.id));\n const out: ViewRegistration[] = [];\n const placed = new Set<ViewRegistration>();\n const place = (r: ViewRegistration): void => {\n if (placed.has(r)) return;\n placed.add(r);\n out.push(r);\n for (const child of sorted) if (child.parent === r.id) place(child);\n };\n for (const r of sorted) if (r.parent === undefined || !ids.has(r.parent)) place(r);\n for (const r of sorted) place(r);\n return out;\n}\n\n/** The `Dims` a surface reports before it has measured itself. */\nexport const UNMEASURED_DIMS: Dims = { width: 0, height: 0 };\n\n/** The camera a view resolves against before its surface attaches. */\nexport const IDENTITY_VIEW: View = { x: 0, y: 0, scale: { x: 1, y: 1 } };\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAyEA,SAAgB,aACd,SACA,SACA,SAC0B;CAC1B,IAAI,CAAC,SAAS,OAAO;EAAE,GAAG;EAAS,GAAG;CAAQ;CAC9C,MAAM,CAAC,QAAQ,UAAU,QAAQ,cAAc,SAAS,OAAO;CAC/D,OAAO,kBAAkB,QAAQ,KAAK,GAAG;EAAE,GAAG;EAAQ,GAAG;CAAO,CAAC;AACnE;AA8EA,IAAM,sBAAsB,cAAmC,IAAI;;;AAInE,SAAgB,qBAAqB,EAAE,YAAqC;CAC1E,MAAM,aAAa,uBAAO,IAAI,IAA8B,CAAC;CAC7D,MAAM,SAAS,OAAO,CAAC;CACvB,MAAM,aAAa,OAAO,CAAC;CAC3B,MAAM,aAAa,OAA6B,IAAI;CACpD,MAAM,aAAa,uBAAO,IAAI,IAAiD,CAAC;CAEhF,MAAM,WAAW,cAA4B;EAC3C,MAAM,YAAY,cAAc;EAChC,MAAM,gBAAsB;GAC1B,WAAW;GACX,UAAU,KAAK;EACjB;EACA,MAAM,gBAAoC,YAAY,CAAC,GAAG,WAAW,QAAQ,KAAK,CAAC,CAAC,CAAC,MAAM,GA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;GAC1B,gBAAgB,WAAW;IACzB,WAAW,UAAU;IACrB,aAAa;KAAE,IAAI,WAAW,YAAY,QAAQ,WAAW,UAAU;IAAM;GAC/E;EACF;EACA,OAAO;CACT,GAAG,CAAC,CAAC;CAEL,OAAO,oBAAC,oBAAoB,UAArB;EAA8B,OAAO;EAAW;CAAuC,CAAA;AAChG;;AAGA,SAAgB,0BAA+C;CAC7D,OAAO,WAAW,mBAAmB;AACvC;;;;AAKA,SAAS,YAAY,QAAyD;CAC5E,MAAM,MAAM,IAAI,IAAI,OAAO,KAAK,MAAM,EAAE,EAAE,CAAC;CAC3C,MAAM,MAA0B,CAAC;CACjC,MAAM,yBAAS,IAAI,IAAsB;CACzC,MAAM,SAAS,MAA8B;EAC3C,IAAI,OAAO,IAAI,CAAC,GAAG;EACnB,OAAO,IAAI,CAAC;EACZ,IAAI,KAAK,CAAC;EACV,KAAK,MAAM,SAAS,QAAQ,IAAI,MAAM,WAAW,EAAE,IAAI,MAAM,KAAK;CACpE;CACA,KAAK,MAAM,KAAK,QAAQ,IAAI,EAAE,WAAW,UAAa,CAAC,IAAI,IAAI,EAAE,MAAM,GAAG,MAAM,CAAC;CACjF,KAAK,MAAM,KAAK,QAAQ,MAAM,CAAC;CAC/B,OAAO;AACT;;AAGA,IAAa,kBAAwB;CAAE,OAAO;CAAG,QAAQ;AAAE;;AAG3D,IAAa,gBAAsB;CAAE,GAAG;CAAG,GAAG;CAAG,OAAO;EAAE,GAAG;EAAG,GAAG;CAAE;AAAE"}
@@ -1,6 +1,6 @@
1
1
  import { sameView } from "../core/viewport/view.js";
2
2
 
3
- //#region src/canvas/viewSnap.ts
3
+ // src/canvas/viewSnap.ts
4
4
  /** A move within this of a whole device pixel is one: the renderer's own slack. */
5
5
  var SLACK = 1e-4;
6
6
  /**
@@ -62,6 +62,5 @@ function whole(n) {
62
62
  return Math.abs(n - Math.round(n)) <= SLACK;
63
63
  }
64
64
 
65
- //#endregion
66
65
  export { ViewSnap };
67
66
  //# sourceMappingURL=viewSnap.js.map
@@ -1,4 +1,4 @@
1
- //#region src/canvas/watchElementMove.ts
1
+ // src/canvas/watchElementMove.ts
2
2
  /**
3
3
  * Call `onMove` when `element`'s box moves in the viewport for a reason no
4
4
  * event reports: a sibling collapsing, content loading above it. A scroll or a
@@ -76,6 +76,5 @@ function watchElementMove(element, onMove) {
76
76
  return stop;
77
77
  }
78
78
 
79
- //#endregion
80
79
  export { watchElementMove };
81
80
  //# sourceMappingURL=watchElementMove.js.map
@@ -1,7 +1,7 @@
1
1
  import { wrapWithPoseRotation } from "./poseRotation.js";
2
2
  import { overChildren, splitOverChildren } from "./overChildren.js";
3
3
 
4
- //#region src/canvas/wrapNodeOutput.ts
4
+ // src/canvas/wrapNodeOutput.ts
5
5
  /** Rotate `cmds` about the pose's AABB center and multiply by `alpha`.
6
6
  * Both wraps are skipped when they would be no-ops (zero/absent rotation,
7
7
  * alpha exactly 1, empty command list), so an upright opaque node emits the
@@ -21,6 +21,5 @@ function wrapPart(cmds, pose, alpha) {
21
21
  return rotated;
22
22
  }
23
23
 
24
- //#endregion
25
24
  export { wrapNodeOutput };
26
25
  //# sourceMappingURL=wrapNodeOutput.js.map
@@ -1,4 +1,4 @@
1
- //#region src/core/adapters/testing/rootsTree.ts
1
+ // src/core/adapters/testing/rootsTree.ts
2
2
  /** The tree of a fake adapter whose nodes never nest: every id in `order` is a root, bottom
3
3
  * first. `setChildOrder` rewrites `order` in place. */
4
4
  function rootsTree(order = [], nodeOf = () => void 0) {
@@ -12,6 +12,5 @@ function rootsTree(order = [], nodeOf = () => void 0) {
12
12
  };
13
13
  }
14
14
 
15
- //#endregion
16
15
  export { rootsTree };
17
16
  //# sourceMappingURL=rootsTree.js.map
@@ -1,4 +1,4 @@
1
- //#region src/core/applyOps.ts
1
+ // src/core/applyOps.ts
2
2
  /**
3
3
  * Default `applyOps` implementation: apply each op in order against
4
4
  * `adapter`. Used by hooks when an adapter omits `applyOps`. Apps that
@@ -23,6 +23,5 @@ function dispatchApplyBatch(adapter, ops, label) {
23
23
  else applyOpsTo(adapter, ops, label);
24
24
  }
25
25
 
26
- //#endregion
27
26
  export { applyOpsTo, dispatchApplyBatch };
28
27
  //# sourceMappingURL=applyOps.js.map
@@ -1,4 +1,4 @@
1
- //#region src/core/device/targets.ts
1
+ // src/core/device/targets.ts
2
2
  /**
3
3
  * Base sizes for grabbable chrome, in CSS pixels at `targetScale = 1`, and the
4
4
  * one accessor that resolves them for a live pointer type.
@@ -33,6 +33,5 @@ function targetSizesPx(targetScale = 1, base = {}) {
33
33
  };
34
34
  }
35
35
 
36
- //#endregion
37
36
  export { ANCHOR_HIT_BASE_PX, HANDLE_BASE_PX, ROTATION_HANDLE_BASE_PX, targetSizesPx };
38
37
  //# sourceMappingURL=targets.js.map
@@ -2,7 +2,7 @@ import { watchDevicePixelRatio } from "./watchDevicePixelRatio.js";
2
2
  import { createContext, createElement, useContext, useEffect, useMemo, useState } from "react";
3
3
  import { DEFAULT_DEVICE_PROFILE, resolveDeviceProfile } from "@weasel-js/routing";
4
4
 
5
- //#region src/core/device/useDeviceProfile.ts
5
+ // src/core/device/useDeviceProfile.ts
6
6
  var COARSE_QUERY = "(pointer: coarse)";
7
7
  var HOVER_QUERY = "(hover: hover)";
8
8
  function hasMatchMedia() {
@@ -98,6 +98,5 @@ function DeviceProfileProvider({ value, children }) {
98
98
  return createElement(DeviceProfileContext.Provider, { value: profile }, children);
99
99
  }
100
100
 
101
- //#endregion
102
101
  export { DeviceProfileProvider, useDeviceProfile };
103
102
  //# sourceMappingURL=useDeviceProfile.js.map
@@ -1,7 +1,7 @@
1
1
  import { useMemo } from "react";
2
2
  import { useKitSetting } from "@weasel-js/react";
3
3
 
4
- //#region src/core/device/useTargetBasePx.ts
4
+ // src/core/device/useTargetBasePx.ts
5
5
  /** The unscaled chrome sizes the `targets` kit settings give, for `targetSizesPx`'s `base`. */
6
6
  function useTargetBasePx() {
7
7
  const handle = useKitSetting("targets.handlePx");
@@ -18,6 +18,5 @@ function useTargetBasePx() {
18
18
  ]);
19
19
  }
20
20
 
21
- //#endregion
22
21
  export { useTargetBasePx };
23
22
  //# sourceMappingURL=useTargetBasePx.js.map
@@ -1,4 +1,4 @@
1
- //#region src/core/device/watchDevicePixelRatio.ts
1
+ // src/core/device/watchDevicePixelRatio.ts
2
2
  /**
3
3
  * Call `onChange` each time `window.devicePixelRatio` changes: the window
4
4
  * moved to a display of another density, or the page zoomed. Returns the
@@ -29,6 +29,5 @@ function watchDevicePixelRatio(onChange) {
29
29
  };
30
30
  }
31
31
 
32
- //#endregion
33
32
  export { watchDevicePixelRatio };
34
33
  //# sourceMappingURL=watchDevicePixelRatio.js.map
@@ -1,7 +1,7 @@
1
- import { RECT_POSE_DESCRIPTOR } from "./poseDescriptor.js";
2
1
  import { pathPoseDescriptor } from "./pathPoseDescriptor.js";
2
+ import { RECT_POSE_DESCRIPTOR } from "./poseDescriptor.js";
3
3
 
4
- //#region src/core/geometry/autoPoseDescriptor.ts
4
+ // src/core/geometry/autoPoseDescriptor.ts
5
5
  /** True for Path-shaped poses (`{kind: 'polygon' | 'rect'}`). Useful for
6
6
  * callers that need to fork between `pathPoseDescriptor` and
7
7
  * `RECT_POSE_DESCRIPTOR` without forcing the consumer to wire
@@ -41,6 +41,5 @@ var AUTO_POSE_DESCRIPTOR = {
41
41
  }
42
42
  };
43
43
 
44
- //#endregion
45
44
  export { AUTO_POSE_DESCRIPTOR, isPathLike, isRectPose };
46
45
  //# sourceMappingURL=autoPoseDescriptor.js.map
@@ -1,6 +1,6 @@
1
1
  import { pathExclude, pathIntersect, pathSubtract, pathUnion } from "@weasel-js/geom/booleans";
2
2
 
3
- //#region src/core/geometry/booleanOfPaths.ts
3
+ // src/core/geometry/booleanOfPaths.ts
4
4
  /**
5
5
  * `op` over `paths`, given back to front, as one path. Subtract is
6
6
  * Illustrator's "Minus Front": the backmost less everything in front of it.
@@ -18,6 +18,5 @@ function booleanOfPaths(op, paths) {
18
18
  }
19
19
  }
20
20
 
21
- //#endregion
22
21
  export { booleanOfPaths };
23
22
  //# sourceMappingURL=booleanOfPaths.js.map
@@ -1,6 +1,6 @@
1
1
  import { localToWorld, targetTransformOf } from "./targetFrame.js";
2
2
 
3
- //#region src/core/geometry/inkExtents.ts
3
+ // src/core/geometry/inkExtents.ts
4
4
  var NO_INK_EXTENTS = Object.freeze({
5
5
  left: 0,
6
6
  top: 0,
@@ -55,6 +55,5 @@ function insetBox(box, e) {
55
55
  });
56
56
  }
57
57
 
58
- //#endregion
59
58
  export { NO_INK_EXTENTS, inkExtentsBetween, insetBox, isNoInkExtents, outsetBox };
60
59
  //# sourceMappingURL=inkExtents.js.map
@@ -1,6 +1,6 @@
1
1
  import { boundsOfPath, boxToBox, coordsFrom, lerpCorners, transformPath, translatePath, worldCoords } from "@weasel-js/geom";
2
2
 
3
- //#region src/core/geometry/pathPoseDescriptor.ts
3
+ // src/core/geometry/pathPoseDescriptor.ts
4
4
  /**
5
5
  * `PoseDescriptor` for `Path` poses — wires `useResize` to operate
6
6
  * on `Path` directly. `getBounds` defers to the same `boundsOfPath` kernel
@@ -111,6 +111,5 @@ var pathPoseDescriptor = {
111
111
  supportsRotation: () => false
112
112
  };
113
113
 
114
- //#endregion
115
114
  export { pathPoseDescriptor };
116
115
  //# sourceMappingURL=pathPoseDescriptor.js.map
@@ -1,7 +1,7 @@
1
1
  import { axisAlignedBounds } from "./unionBounds.js";
2
2
  import { multiply, poseLinearOf, rotate } from "@weasel-js/geom";
3
3
 
4
- //#region src/core/geometry/poseDescriptor.ts
4
+ // src/core/geometry/poseDescriptor.ts
5
5
  /** A world `lead` expressed in the frame whose world pose is `frameWorld`, for a
6
6
  * pose stored there; `null` is the root frame, where it is unchanged. */
7
7
  function leadUnder(pc, frameWorld, lead) {
@@ -235,6 +235,5 @@ function translatePoseViaDescriptor(pose, dx, dy, geometry, lead) {
235
235
  return geometry.remapBounds(pose, src, dst);
236
236
  }
237
237
 
238
- //#endregion
239
238
  export { RECT_POSE_DESCRIPTOR, ROTATED_POSE_DESCRIPTOR, framedBounds, leadUnder, poseDescriptorForNode, remapRotatedLeaf, translatePoseViaDescriptor, visualBoundsViaDescriptor };
240
239
  //# sourceMappingURL=poseDescriptor.js.map
@@ -2,7 +2,7 @@ import { nodeMemo } from "../scene/nodeMemo.js";
2
2
  import { visualBoundsViaDescriptor } from "./poseDescriptor.js";
3
3
  import { boxContainsBox, pathThroughPoseFrame, pointInPolygon, polygonContainsPath, polygonIntersectsPath, poseFrameOf } from "@weasel-js/geom";
4
4
 
5
- //#region src/core/geometry/regionHit.ts
5
+ // src/core/geometry/regionHit.ts
6
6
  /**
7
7
  * Whether a marquee or a lasso takes one node: the per-node decision the
8
8
  * scene's area walk (`canvas/deps/hitTestArea`) makes.
@@ -161,6 +161,5 @@ function regionTakes(region, mode, pose, b, outline, filled = () => true) {
161
161
  return polygonIntersectsPath(region.verts, drawn);
162
162
  }
163
163
 
164
- //#endregion
165
164
  export { isSilhouettePose, polygonRegion, poseOutline, rectRegion, regionBoundsOf, regionOf, regionTakes, regionTakesByBounds };
166
165
  //# sourceMappingURL=regionHit.js.map
@@ -1,6 +1,6 @@
1
1
  import { applyToPoint, invert, poseFrameOf, pxExtentInFrame } from "@weasel-js/geom";
2
2
 
3
- //#region src/core/geometry/targetFrame.ts
3
+ // src/core/geometry/targetFrame.ts
4
4
  /**
5
5
  * The frame selection chrome reads a target in: `poseFrameOf` over the
6
6
  * target's bounds, with the helpers the outline, the handles, their hit
@@ -102,6 +102,5 @@ function targetCorners(b, xf) {
102
102
  ];
103
103
  }
104
104
 
105
- //#endregion
106
105
  export { IDENTITY_TARGET, angleOf, isRigid, localToWorld, normalToWorld, pxExtentIn, targetCorners, targetTransformOf, worldDeltaToLocal, worldToLocal };
107
106
  //# sourceMappingURL=targetFrame.js.map
@@ -1,6 +1,6 @@
1
1
  import { applyToPoint, poseFrameOf } from "@weasel-js/geom";
2
2
 
3
- //#region src/core/geometry/unionBounds.ts
3
+ // src/core/geometry/unionBounds.ts
4
4
  /**
5
5
  * Union math over rect-shaped poses.
6
6
  *
@@ -111,6 +111,5 @@ function unionAABB(parts) {
111
111
  };
112
112
  }
113
113
 
114
- //#endregion
115
114
  export { axisAlignedBounds, unionAABB, unionBounds };
116
115
  //# sourceMappingURL=unionBounds.js.map
@@ -1,6 +1,6 @@
1
1
  import { commandPaint } from "@weasel-js/renderer";
2
2
 
3
- //#region src/core/layers/backgroundFill.ts
3
+ // src/core/layers/backgroundFill.ts
4
4
  /** The id of the layer {@link createBackgroundFillLayer} builds. */
5
5
  var BACKGROUND_FILL_LAYER_ID = "scene-background-fill";
6
6
  /**
@@ -34,6 +34,5 @@ function createBackgroundFillLayer(paint) {
34
34
  };
35
35
  }
36
36
 
37
- //#endregion
38
37
  export { BACKGROUND_FILL_LAYER_ID, backgroundFillCommands, createBackgroundFillLayer };
39
38
  //# sourceMappingURL=backgroundFill.js.map
@@ -1,4 +1,4 @@
1
- //#region src/core/layers/children.ts
1
+ // src/core/layers/children.ts
2
2
  /** Build a `RenderLayer` that draws an `OrderedAdapter`'s children in z-order. */
3
3
  function createChildrenLayer(opts) {
4
4
  return {
@@ -19,6 +19,5 @@ function createChildrenLayer(opts) {
19
19
  };
20
20
  }
21
21
 
22
- //#endregion
23
22
  export { createChildrenLayer };
24
23
  //# sourceMappingURL=children.js.map
@@ -1,6 +1,6 @@
1
1
  import { subscribeToSources } from "./redrawSource.js";
2
2
 
3
- //#region src/core/layers/gateLayer.ts
3
+ // src/core/layers/gateLayer.ts
4
4
  /**
5
5
  * `RenderLayer` wrapper that conditionally emits draw commands based on a
6
6
  * predicate.
@@ -23,6 +23,5 @@ function gateLayer(opts) {
23
23
  return wrapped;
24
24
  }
25
25
 
26
- //#endregion
27
26
  export { gateLayer };
28
27
  //# sourceMappingURL=gateLayer.js.map