@weasel-js/core 1.7.0 → 1.7.1

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 (1003) hide show
  1. package/CHANGELOG.md +764 -0
  2. package/README.md +7 -8
  3. package/dist/WeaselProvider.js +15 -0
  4. package/dist/WeaselProvider.js.map +1 -0
  5. package/dist/affordances/composeAffordanceLayer.js +224 -0
  6. package/dist/affordances/composeAffordanceLayer.js.map +1 -0
  7. package/dist/affordances/cornerResize.js +69 -0
  8. package/dist/affordances/cornerResize.js.map +1 -0
  9. package/dist/affordances/hitAffordanceRegions.js +138 -0
  10. package/dist/affordances/hitAffordanceRegions.js.map +1 -0
  11. package/dist/affordances/pathAnchors.js +66 -0
  12. package/dist/affordances/pathAnchors.js.map +1 -0
  13. package/dist/affordances/rotationHandle.js +103 -0
  14. package/dist/affordances/rotationHandle.js.map +1 -0
  15. package/dist/animation/behaviors/momentum.js +118 -0
  16. package/dist/animation/behaviors/momentum.js.map +1 -0
  17. package/dist/animation/colorHelpers.js +135 -0
  18. package/dist/animation/colorHelpers.js.map +1 -0
  19. package/dist/animation/colorRegistry.js +37 -0
  20. package/dist/animation/colorRegistry.js.map +1 -0
  21. package/dist/animation/index.js +20 -0
  22. package/dist/animation/loop.js +62 -0
  23. package/dist/animation/loop.js.map +1 -0
  24. package/dist/animation/observe.js +23 -0
  25. package/dist/animation/observe.js.map +1 -0
  26. package/dist/animation/poseHelpers.js +50 -0
  27. package/dist/animation/poseHelpers.js.map +1 -0
  28. package/dist/animation/reflow.js +121 -0
  29. package/dist/animation/reflow.js.map +1 -0
  30. package/dist/animation/rig/bindRig.js +74 -0
  31. package/dist/animation/rig/bindRig.js.map +1 -0
  32. package/dist/animation/rig/blendPoses.js +43 -0
  33. package/dist/animation/rig/blendPoses.js.map +1 -0
  34. package/dist/animation/rig/mirrorPose.js +19 -0
  35. package/dist/animation/rig/mirrorPose.js.map +1 -0
  36. package/dist/animation/rig/resolveSkeleton.js +33 -0
  37. package/dist/animation/rig/resolveSkeleton.js.map +1 -0
  38. package/dist/animation/rig/solveIk.js +103 -0
  39. package/dist/animation/rig/solveIk.js.map +1 -0
  40. package/dist/animation/rig/types.js +12 -0
  41. package/dist/animation/rig/types.js.map +1 -0
  42. package/dist/animation/rig/useRig.js +23 -0
  43. package/dist/animation/rig/useRig.js.map +1 -0
  44. package/dist/animation/slew.js +27 -0
  45. package/dist/animation/slew.js.map +1 -0
  46. package/dist/animation/stagger.js +138 -0
  47. package/dist/animation/stagger.js.map +1 -0
  48. package/dist/animation/timeline/booking.js +106 -0
  49. package/dist/animation/timeline/booking.js.map +1 -0
  50. package/dist/animation/timeline/createTimeline.js +116 -0
  51. package/dist/animation/timeline/createTimeline.js.map +1 -0
  52. package/dist/animation/timeline/sampleTrack.js +29 -0
  53. package/dist/animation/timeline/sampleTrack.js.map +1 -0
  54. package/dist/animation/useAnimator.js +329 -0
  55. package/dist/animation/useAnimator.js.map +1 -0
  56. package/dist/animation/wrappers/animateLifecycle.js +40 -0
  57. package/dist/animation/wrappers/animateLifecycle.js.map +1 -0
  58. package/dist/animation/wrappers/animateOnSetPose.js +44 -0
  59. package/dist/animation/wrappers/animateOnSetPose.js.map +1 -0
  60. package/dist/{autoPoseDescriptor-_XOyF7t4.d.ts → autoPoseDescriptor-BT_vp9FO.d.ts} +2 -2
  61. package/dist/{builtins-DLn2lCr_.d.ts → builtins-BSUfH8nU.d.ts} +738 -513
  62. package/dist/canvas/Canvas.js +608 -0
  63. package/dist/canvas/Canvas.js.map +1 -0
  64. package/dist/canvas/CanvasView.js +255 -0
  65. package/dist/canvas/CanvasView.js.map +1 -0
  66. package/dist/canvas/CursorCoordsHud.js +75 -0
  67. package/dist/canvas/CursorCoordsHud.js.map +1 -0
  68. package/dist/canvas/DrawCanvas.js +67 -0
  69. package/dist/canvas/DrawCanvas.js.map +1 -0
  70. package/dist/canvas/MinimapCanvas.js +139 -0
  71. package/dist/canvas/MinimapCanvas.js.map +1 -0
  72. package/dist/canvas/ModalityHud.js +66 -0
  73. package/dist/canvas/ModalityHud.js.map +1 -0
  74. package/dist/canvas/NodeShape.js +391 -0
  75. package/dist/canvas/NodeShape.js.map +1 -0
  76. package/dist/canvas/PickHud.js +93 -0
  77. package/dist/canvas/PickHud.js.map +1 -0
  78. package/dist/canvas/SceneCanvas/ActionsProviderIfRoot.js +10 -0
  79. package/dist/canvas/SceneCanvas/ActionsProviderIfRoot.js.map +1 -0
  80. package/dist/canvas/SceneCanvas/DepRegistryProviderIfRoot.js +10 -0
  81. package/dist/canvas/SceneCanvas/DepRegistryProviderIfRoot.js.map +1 -0
  82. package/dist/canvas/SceneCanvas/PointerProviderIfRoot.js +51 -0
  83. package/dist/canvas/SceneCanvas/PointerProviderIfRoot.js.map +1 -0
  84. package/dist/canvas/SceneCanvas/contributionFrameHooks.js +42 -0
  85. package/dist/canvas/SceneCanvas/contributionFrameHooks.js.map +1 -0
  86. package/dist/canvas/SceneCanvas/defaultNodeProperties.js +549 -0
  87. package/dist/canvas/SceneCanvas/defaultNodeProperties.js.map +1 -0
  88. package/dist/canvas/SceneCanvas/defaultNodeRouting.js +26 -0
  89. package/dist/canvas/SceneCanvas/defaultNodeRouting.js.map +1 -0
  90. package/dist/canvas/SceneCanvas/dispatcherGestureBounds.js +69 -0
  91. package/dist/canvas/SceneCanvas/dispatcherGestureBounds.js.map +1 -0
  92. package/dist/canvas/SceneCanvas/features.js +97 -0
  93. package/dist/canvas/SceneCanvas/features.js.map +1 -0
  94. package/dist/canvas/SceneCanvas/poseGeometry.js +46 -0
  95. package/dist/canvas/SceneCanvas/poseGeometry.js.map +1 -0
  96. package/dist/canvas/SceneCanvas/useActionsPropResolver.js +48 -0
  97. package/dist/canvas/SceneCanvas/useActionsPropResolver.js.map +1 -0
  98. package/dist/canvas/SceneCanvas/useBuiltinShapeTools.js +70 -0
  99. package/dist/canvas/SceneCanvas/useBuiltinShapeTools.js.map +1 -0
  100. package/dist/canvas/SceneCanvas/useContributionRoles.js +75 -0
  101. package/dist/canvas/SceneCanvas/useContributionRoles.js.map +1 -0
  102. package/dist/canvas/SceneCanvas/useDispatcherOverlayLayer.js +172 -0
  103. package/dist/canvas/SceneCanvas/useDispatcherOverlayLayer.js.map +1 -0
  104. package/dist/canvas/SceneCanvas/usePreviewGhostLayer.js +69 -0
  105. package/dist/canvas/SceneCanvas/usePreviewGhostLayer.js.map +1 -0
  106. package/dist/canvas/SceneCanvas/useSceneSelectTool.js +127 -0
  107. package/dist/canvas/SceneCanvas/useSceneSelectTool.js.map +1 -0
  108. package/dist/canvas/SceneCanvas/useViewportActions.js +30 -0
  109. package/dist/canvas/SceneCanvas/useViewportActions.js.map +1 -0
  110. package/dist/canvas/SceneCanvas.js +992 -0
  111. package/dist/canvas/SceneCanvas.js.map +1 -0
  112. package/dist/canvas/SceneViewCanvas.js +54 -0
  113. package/dist/canvas/SceneViewCanvas.js.map +1 -0
  114. package/dist/canvas/accentColor.js +9 -0
  115. package/dist/canvas/accentColor.js.map +1 -0
  116. package/dist/canvas/affordanceAt.js +63 -0
  117. package/dist/canvas/affordanceAt.js.map +1 -0
  118. package/dist/canvas/buildSceneTree.js +65 -0
  119. package/dist/canvas/buildSceneTree.js.map +1 -0
  120. package/dist/canvas/canvasRenderer.js +89 -0
  121. package/dist/canvas/canvasRenderer.js.map +1 -0
  122. package/dist/canvas/colorOverrides.js +16 -0
  123. package/dist/canvas/colorOverrides.js.map +1 -0
  124. package/dist/canvas/defaultDrawOne.js +43 -0
  125. package/dist/canvas/defaultDrawOne.js.map +1 -0
  126. package/dist/canvas/deps/areaSelect.js +19 -0
  127. package/dist/canvas/deps/areaSelect.js.map +1 -0
  128. package/dist/canvas/deps/debug.js +9 -0
  129. package/dist/canvas/deps/debug.js.map +1 -0
  130. package/dist/canvas/deps/dispatcher.js +11 -0
  131. package/dist/canvas/deps/dispatcher.js.map +1 -0
  132. package/dist/canvas/deps/editAnchors.js +101 -0
  133. package/dist/canvas/deps/editAnchors.js.map +1 -0
  134. package/dist/canvas/deps/geometryProjection.js +11 -0
  135. package/dist/canvas/deps/geometryProjection.js.map +1 -0
  136. package/dist/canvas/deps/hitTestArea.js +51 -0
  137. package/dist/canvas/deps/hitTestArea.js.map +1 -0
  138. package/dist/canvas/deps/ingestion.js +31 -0
  139. package/dist/canvas/deps/ingestion.js.map +1 -0
  140. package/dist/canvas/deps/insert.js +116 -0
  141. package/dist/canvas/deps/insert.js.map +1 -0
  142. package/dist/canvas/deps/lassoSelect.js +20 -0
  143. package/dist/canvas/deps/lassoSelect.js.map +1 -0
  144. package/dist/canvas/deps/layout.js +34 -0
  145. package/dist/canvas/deps/layout.js.map +1 -0
  146. package/dist/canvas/deps/nodeAtPoint.js +19 -0
  147. package/dist/canvas/deps/nodeAtPoint.js.map +1 -0
  148. package/dist/canvas/deps/poseComposition.js +11 -0
  149. package/dist/canvas/deps/poseComposition.js.map +1 -0
  150. package/dist/canvas/deps/poseDescriptor.js +12 -0
  151. package/dist/canvas/deps/poseDescriptor.js.map +1 -0
  152. package/dist/canvas/deps/resizePolicy.js +35 -0
  153. package/dist/canvas/deps/resizePolicy.js.map +1 -0
  154. package/dist/canvas/deps/slice.js +99 -0
  155. package/dist/canvas/deps/slice.js.map +1 -0
  156. package/dist/canvas/deps/snap.js +11 -0
  157. package/dist/canvas/deps/snap.js.map +1 -0
  158. package/dist/canvas/deps/textEdit.js +21 -0
  159. package/dist/canvas/deps/textEdit.js.map +1 -0
  160. package/dist/canvas/deps/view.js +43 -0
  161. package/dist/canvas/deps/view.js.map +1 -0
  162. package/dist/canvas/derivedPath.js +47 -0
  163. package/dist/canvas/derivedPath.js.map +1 -0
  164. package/dist/canvas/drawEnvelope.js +22 -0
  165. package/dist/canvas/drawEnvelope.js.map +1 -0
  166. package/dist/canvas/getNodeAtPoint.js +18 -0
  167. package/dist/canvas/getNodeAtPoint.js.map +1 -0
  168. package/dist/canvas/hostAnchor.js +29 -0
  169. package/dist/canvas/hostAnchor.js.map +1 -0
  170. package/dist/canvas/hud.module.js +18 -0
  171. package/dist/canvas/hud.module.js.map +1 -0
  172. package/dist/canvas/insertPreviewExtent.js +103 -0
  173. package/dist/canvas/insertPreviewExtent.js.map +1 -0
  174. package/dist/canvas/kitRequirements.js +177 -0
  175. package/dist/canvas/kitRequirements.js.map +1 -0
  176. package/dist/canvas/layerOrder.js +66 -0
  177. package/dist/canvas/layerOrder.js.map +1 -0
  178. package/dist/canvas/layerSlots.js +14 -0
  179. package/dist/canvas/layerSlots.js.map +1 -0
  180. package/dist/canvas/minimapMath.js +80 -0
  181. package/dist/canvas/minimapMath.js.map +1 -0
  182. package/dist/canvas/mountedCanvases.js +20 -0
  183. package/dist/canvas/mountedCanvases.js.map +1 -0
  184. package/dist/canvas/overlayRoleStrokes.js +17 -0
  185. package/dist/canvas/overlayRoleStrokes.js.map +1 -0
  186. package/dist/canvas/paintCull.js +20 -0
  187. package/dist/canvas/paintCull.js.map +1 -0
  188. package/dist/canvas/pickWalk.js +158 -0
  189. package/dist/canvas/pickWalk.js.map +1 -0
  190. package/dist/canvas/planeClips.js +30 -0
  191. package/dist/canvas/planeClips.js.map +1 -0
  192. package/dist/canvas/poseRotation.js +35 -0
  193. package/dist/canvas/poseRotation.js.map +1 -0
  194. package/dist/canvas/rasterToPng.js +21 -0
  195. package/dist/canvas/rasterToPng.js.map +1 -0
  196. package/dist/canvas/renderDebugSnapshot.js +32 -0
  197. package/dist/canvas/renderDebugSnapshot.js.map +1 -0
  198. package/dist/canvas/renderNeeds.js +25 -0
  199. package/dist/canvas/renderNeeds.js.map +1 -0
  200. package/dist/canvas/renderSceneToPixels.js +143 -0
  201. package/dist/canvas/renderSceneToPixels.js.map +1 -0
  202. package/dist/canvas/sceneAdapter.js +270 -0
  203. package/dist/canvas/sceneAdapter.js.map +1 -0
  204. package/dist/canvas/sceneLayerPaint.js +37 -0
  205. package/dist/canvas/sceneLayerPaint.js.map +1 -0
  206. package/dist/canvas/sceneSlotWiring.js +20 -0
  207. package/dist/canvas/sceneSlotWiring.js.map +1 -0
  208. package/dist/canvas/sceneViewRender.js +72 -0
  209. package/dist/canvas/sceneViewRender.js.map +1 -0
  210. package/dist/canvas/slopsDebugLayer.js +61 -0
  211. package/dist/canvas/slopsDebugLayer.js.map +1 -0
  212. package/dist/canvas/surfaceContribution.js +15 -0
  213. package/dist/canvas/surfaceContribution.js.map +1 -0
  214. package/dist/canvas/toolPreview.js +39 -0
  215. package/dist/canvas/toolPreview.js.map +1 -0
  216. package/dist/canvas/useCanvasRenderer.js +11 -0
  217. package/dist/canvas/useCanvasRenderer.js.map +1 -0
  218. package/dist/canvas/useFrameLoop.js +60 -0
  219. package/dist/canvas/useFrameLoop.js.map +1 -0
  220. package/dist/canvas/useHostAnchor.js +71 -0
  221. package/dist/canvas/useHostAnchor.js.map +1 -0
  222. package/dist/canvas/useLateContentRedraw.js +21 -0
  223. package/dist/canvas/useLateContentRedraw.js.map +1 -0
  224. package/dist/canvas/useRedrawOn.js +21 -0
  225. package/dist/canvas/useRedrawOn.js.map +1 -0
  226. package/dist/canvas/useViewHelpers.js +120 -0
  227. package/dist/canvas/useViewHelpers.js.map +1 -0
  228. package/dist/canvas/viewInputs.js +17 -0
  229. package/dist/canvas/viewInputs.js.map +1 -0
  230. package/dist/canvas/viewRegistry.js +61 -0
  231. package/dist/canvas/viewRegistry.js.map +1 -0
  232. package/dist/canvas/wrapNodeOutput.js +14 -0
  233. package/dist/canvas/wrapNodeOutput.js.map +1 -0
  234. package/dist/clipboard.d.ts +10 -5
  235. package/dist/clipboard.js +3 -5
  236. package/dist/clone.d.ts +3 -3
  237. package/dist/clone.js +2 -5
  238. package/dist/core/adapters/arrayAdapter.js +85 -0
  239. package/dist/core/adapters/arrayAdapter.js.map +1 -0
  240. package/dist/core/adapters/useArrayAdapter.js +13 -0
  241. package/dist/core/adapters/useArrayAdapter.js.map +1 -0
  242. package/dist/core/applyOps.js +12 -0
  243. package/dist/core/applyOps.js.map +1 -0
  244. package/dist/core/device/index.js +4 -0
  245. package/dist/core/device/targets.js +17 -0
  246. package/dist/core/device/targets.js.map +1 -0
  247. package/dist/core/device/useDeviceProfile.js +75 -0
  248. package/dist/core/device/useDeviceProfile.js.map +1 -0
  249. package/dist/core/fillInPoseFrame.js +102 -0
  250. package/dist/core/fillInPoseFrame.js.map +1 -0
  251. package/dist/core/geometry/poseDescriptor.js +98 -0
  252. package/dist/core/geometry/poseDescriptor.js.map +1 -0
  253. package/dist/core/geometry/poseRotation.js +58 -0
  254. package/dist/core/geometry/poseRotation.js.map +1 -0
  255. package/dist/core/geometry/regionHit.js +102 -0
  256. package/dist/core/geometry/regionHit.js.map +1 -0
  257. package/dist/core/geometry/unionBounds.js +60 -0
  258. package/dist/core/geometry/unionBounds.js.map +1 -0
  259. package/dist/core/gradient.js +136 -0
  260. package/dist/core/gradient.js.map +1 -0
  261. package/dist/core/isPlainObject.js +11 -0
  262. package/dist/core/isPlainObject.js.map +1 -0
  263. package/dist/core/layers/render.js +150 -0
  264. package/dist/core/layers/render.js.map +1 -0
  265. package/dist/core/markerInset.js +24 -0
  266. package/dist/core/markerInset.js.map +1 -0
  267. package/dist/core/mixed.js +6 -0
  268. package/dist/core/mixed.js.map +1 -0
  269. package/dist/core/ops/arrange.js +31 -0
  270. package/dist/core/ops/arrange.js.map +1 -0
  271. package/dist/core/ops/create.js +32 -0
  272. package/dist/core/ops/create.js.map +1 -0
  273. package/dist/core/ops/createHistory.js +20 -0
  274. package/dist/core/ops/createHistory.js.map +1 -0
  275. package/dist/core/ops/delete.js +89 -0
  276. package/dist/core/ops/delete.js.map +1 -0
  277. package/dist/core/ops/registry.js +17 -0
  278. package/dist/core/ops/registry.js.map +1 -0
  279. package/dist/core/ops/reorder/algorithms.js +55 -0
  280. package/dist/core/ops/reorder/algorithms.js.map +1 -0
  281. package/dist/core/ops/reorder/index.js +140 -0
  282. package/dist/core/ops/reorder/index.js.map +1 -0
  283. package/dist/core/ops/reparent.js +52 -0
  284. package/dist/core/ops/reparent.js.map +1 -0
  285. package/dist/core/ops/select.js +34 -0
  286. package/dist/core/ops/select.js.map +1 -0
  287. package/dist/core/ops/setData.js +34 -0
  288. package/dist/core/ops/setData.js.map +1 -0
  289. package/dist/core/ops/setLayer.js +34 -0
  290. package/dist/core/ops/setLayer.js.map +1 -0
  291. package/dist/core/ops/setLayout.js +31 -0
  292. package/dist/core/ops/setLayout.js.map +1 -0
  293. package/dist/core/ops/setPath.js +57 -0
  294. package/dist/core/ops/setPath.js.map +1 -0
  295. package/dist/core/ops/setText.js +34 -0
  296. package/dist/core/ops/setText.js.map +1 -0
  297. package/dist/core/ops/slot.js +37 -0
  298. package/dist/core/ops/slot.js.map +1 -0
  299. package/dist/core/ops/transform.js +42 -0
  300. package/dist/core/ops/transform.js.map +1 -0
  301. package/dist/core/paintKinds.js +156 -0
  302. package/dist/core/paintKinds.js.map +1 -0
  303. package/dist/core/scene/NodeProperties.js +20 -0
  304. package/dist/core/scene/NodeProperties.js.map +1 -0
  305. package/dist/core/scene/NodeRouting.js +24 -0
  306. package/dist/core/scene/NodeRouting.js.map +1 -0
  307. package/dist/core/scene/arrivals.js +12 -0
  308. package/dist/core/scene/arrivals.js.map +1 -0
  309. package/dist/core/scene/composeFrame.js +29 -0
  310. package/dist/core/scene/composeFrame.js.map +1 -0
  311. package/dist/core/scene/depMemo.js +18 -0
  312. package/dist/core/scene/depMemo.js.map +1 -0
  313. package/dist/core/scene/dependents.js +66 -0
  314. package/dist/core/scene/dependents.js.map +1 -0
  315. package/dist/core/scene/derivedPath.js +31 -0
  316. package/dist/core/scene/derivedPath.js.map +1 -0
  317. package/dist/core/scene/effectivePose.js +78 -0
  318. package/dist/core/scene/effectivePose.js.map +1 -0
  319. package/dist/core/scene/kitRegistry.js +33 -0
  320. package/dist/core/scene/kitRegistry.js.map +1 -0
  321. package/dist/core/scene/layoutPass.js +96 -0
  322. package/dist/core/scene/layoutPass.js.map +1 -0
  323. package/dist/core/scene/nodeFnFields.js +83 -0
  324. package/dist/core/scene/nodeFnFields.js.map +1 -0
  325. package/dist/core/scene/nodeMemo.js +28 -0
  326. package/dist/core/scene/nodeMemo.js.map +1 -0
  327. package/dist/core/scene/poseFeed.js +87 -0
  328. package/dist/core/scene/poseFeed.js.map +1 -0
  329. package/dist/core/scene/poseOverrides.js +52 -0
  330. package/dist/core/scene/poseOverrides.js.map +1 -0
  331. package/dist/core/scene/poseSnapshot.js +54 -0
  332. package/dist/core/scene/poseSnapshot.js.map +1 -0
  333. package/dist/core/scene/scene.js +1271 -0
  334. package/dist/core/scene/scene.js.map +1 -0
  335. package/dist/core/scene/types.js +6 -0
  336. package/dist/core/scene/types.js.map +1 -0
  337. package/dist/core/scene/useScene.js +32 -0
  338. package/dist/core/scene/useScene.js.map +1 -0
  339. package/dist/core/selection/chromeState.js +31 -0
  340. package/dist/core/selection/chromeState.js.map +1 -0
  341. package/dist/core/selection/selectionTarget.js +6 -0
  342. package/dist/core/selection/selectionTarget.js.map +1 -0
  343. package/dist/core/selection/useSelection.js +71 -0
  344. package/dist/core/selection/useSelection.js.map +1 -0
  345. package/dist/core/shapeKinds.js +54 -0
  346. package/dist/core/shapeKinds.js.map +1 -0
  347. package/dist/core/strokeMarkerShapes.js +139 -0
  348. package/dist/core/strokeMarkerShapes.js.map +1 -0
  349. package/dist/core/strokeMarkers.js +28 -0
  350. package/dist/core/strokeMarkers.js.map +1 -0
  351. package/dist/core/stylus/stylus.js +39 -0
  352. package/dist/core/stylus/stylus.js.map +1 -0
  353. package/dist/core/stylus/usePointerStylus.js +51 -0
  354. package/dist/core/stylus/usePointerStylus.js.map +1 -0
  355. package/dist/core/usePaintKinds.js +17 -0
  356. package/dist/core/usePaintKinds.js.map +1 -0
  357. package/dist/core/viewport/clampView.js +24 -0
  358. package/dist/core/viewport/clampView.js.map +1 -0
  359. package/dist/core/viewport/clientToWorld.js +8 -0
  360. package/dist/core/viewport/clientToWorld.js.map +1 -0
  361. package/dist/core/viewport/createVelocityTracker.js +39 -0
  362. package/dist/core/viewport/createVelocityTracker.js.map +1 -0
  363. package/dist/core/viewport/fitToBounds.js +18 -0
  364. package/dist/core/viewport/fitToBounds.js.map +1 -0
  365. package/dist/core/viewport/fitViewToBounds.js +36 -0
  366. package/dist/core/viewport/fitViewToBounds.js.map +1 -0
  367. package/dist/core/viewport/interpolateView.js +34 -0
  368. package/dist/core/viewport/interpolateView.js.map +1 -0
  369. package/dist/core/viewport/meanScale.js +8 -0
  370. package/dist/core/viewport/meanScale.js.map +1 -0
  371. package/dist/core/viewport/parallax.js +111 -0
  372. package/dist/core/viewport/parallax.js.map +1 -0
  373. package/dist/core/viewport/pxExtent.js +42 -0
  374. package/dist/core/viewport/pxExtent.js.map +1 -0
  375. package/dist/core/viewport/sceneNodeClientRect.js +18 -0
  376. package/dist/core/viewport/sceneNodeClientRect.js.map +1 -0
  377. package/dist/core/viewport/screenSlop.js +27 -0
  378. package/dist/core/viewport/screenSlop.js.map +1 -0
  379. package/dist/core/viewport/useAutoCenter.js +32 -0
  380. package/dist/core/viewport/useAutoCenter.js.map +1 -0
  381. package/dist/core/viewport/useCanvasSize.js +29 -0
  382. package/dist/core/viewport/useCanvasSize.js.map +1 -0
  383. package/dist/core/viewport/useDecayLoop.js +63 -0
  384. package/dist/core/viewport/useDecayLoop.js.map +1 -0
  385. package/dist/core/viewport/useVelocityTracker.js +10 -0
  386. package/dist/core/viewport/useVelocityTracker.js.map +1 -0
  387. package/dist/core/viewport/useViewAnimation.js +63 -0
  388. package/dist/core/viewport/useViewAnimation.js.map +1 -0
  389. package/dist/core/viewport/view.js +37 -0
  390. package/dist/core/viewport/view.js.map +1 -0
  391. package/dist/core/viewport/viewTransform.js +11 -0
  392. package/dist/core/viewport/viewTransform.js.map +1 -0
  393. package/dist/core/viewport/viewportWorldRect.js +13 -0
  394. package/dist/core/viewport/viewportWorldRect.js.map +1 -0
  395. package/dist/core/viewport/wheelHandler.js +30 -0
  396. package/dist/core/viewport/wheelHandler.js.map +1 -0
  397. package/dist/core/viewport/zoomAt.js +22 -0
  398. package/dist/core/viewport/zoomAt.js.map +1 -0
  399. package/dist/core/viewport/zoomBounds.js +20 -0
  400. package/dist/core/viewport/zoomBounds.js.map +1 -0
  401. package/dist/{pointSnapToGrid-Dp2IxLGb.d.ts → cornerHandles-CDcZOV8h.d.ts} +3 -13
  402. package/dist/debug/createDebugOverlayLayer.js +358 -0
  403. package/dist/debug/createDebugOverlayLayer.js.map +1 -0
  404. package/dist/debug/createDebugSink.js +83 -0
  405. package/dist/debug/createDebugSink.js.map +1 -0
  406. package/dist/debug/defaultTheme.js +31 -0
  407. package/dist/debug/defaultTheme.js.map +1 -0
  408. package/dist/debug/flag.js +41 -0
  409. package/dist/debug/flag.js.map +1 -0
  410. package/dist/debug/frameStats.js +16 -0
  411. package/dist/debug/frameStats.js.map +1 -0
  412. package/dist/debug/parseDebugFlags.js +32 -0
  413. package/dist/debug/parseDebugFlags.js.map +1 -0
  414. package/dist/features/chrome-caps/buildChromeCtx.js +16 -0
  415. package/dist/features/chrome-caps/buildChromeCtx.js.map +1 -0
  416. package/dist/features/chrome-caps/conditions.js +36 -0
  417. package/dist/features/chrome-caps/conditions.js.map +1 -0
  418. package/dist/features/chrome-caps/defaults.js +26 -0
  419. package/dist/features/chrome-caps/defaults.js.map +1 -0
  420. package/dist/features/chrome-caps/index.js +7 -0
  421. package/dist/features/chrome-caps/resolve.js +23 -0
  422. package/dist/features/chrome-caps/resolve.js.map +1 -0
  423. package/dist/features/chrome-caps/useHoverTracking.js +27 -0
  424. package/dist/features/chrome-caps/useHoverTracking.js.map +1 -0
  425. package/dist/features/cursor/paintedCursorLayer.js +60 -0
  426. package/dist/features/cursor/paintedCursorLayer.js.map +1 -0
  427. package/dist/features/focus/gateLayer.js +14 -0
  428. package/dist/features/focus/gateLayer.js.map +1 -0
  429. package/dist/features/focus/useCanvasFocus.js +29 -0
  430. package/dist/features/focus/useCanvasFocus.js.map +1 -0
  431. package/dist/features/groups/children.js +23 -0
  432. package/dist/features/groups/children.js.map +1 -0
  433. package/dist/features/groups/composePose.js +67 -0
  434. package/dist/features/groups/composePose.js.map +1 -0
  435. package/dist/features/groups/nestedHit.js +40 -0
  436. package/dist/features/groups/nestedHit.js.map +1 -0
  437. package/dist/features/groups/unionOfChildren.js +15 -0
  438. package/dist/features/groups/unionOfChildren.js.map +1 -0
  439. package/dist/features/images/imageCache.js +94 -0
  440. package/dist/features/images/imageCache.js.map +1 -0
  441. package/dist/features/ingestion/contentHandlers.js +37 -0
  442. package/dist/features/ingestion/contentHandlers.js.map +1 -0
  443. package/dist/features/ingestion/imageHandler.js +45 -0
  444. package/dist/features/ingestion/imageHandler.js.map +1 -0
  445. package/dist/features/ingestion/index.js +8 -0
  446. package/dist/features/ingestion/openFilePicker.js +15 -0
  447. package/dist/features/ingestion/openFilePicker.js.map +1 -0
  448. package/dist/features/ingestion/registerKitHandlers.js +26 -0
  449. package/dist/features/ingestion/registerKitHandlers.js.map +1 -0
  450. package/dist/features/ingestion/svgHandler.js +58 -0
  451. package/dist/features/ingestion/svgHandler.js.map +1 -0
  452. package/dist/features/ingestion/weaselJsonHandler.js +39 -0
  453. package/dist/features/ingestion/weaselJsonHandler.js.map +1 -0
  454. package/dist/features/longPress/longPressFeedback.js +96 -0
  455. package/dist/features/longPress/longPressFeedback.js.map +1 -0
  456. package/dist/features/meshPaint/bake.js +79 -0
  457. package/dist/features/meshPaint/bake.js.map +1 -0
  458. package/dist/features/meshPaint/bakeCache.js +59 -0
  459. package/dist/features/meshPaint/bakeCache.js.map +1 -0
  460. package/dist/features/meshPaint/handles.js +86 -0
  461. package/dist/features/meshPaint/handles.js.map +1 -0
  462. package/dist/features/meshPaint/lazyKind.js +1298 -0
  463. package/dist/features/meshPaint/lazyKind.js.map +1 -0
  464. package/dist/features/meshPaint/meshPaint.js +236 -0
  465. package/dist/features/meshPaint/meshPaint.js.map +1 -0
  466. package/dist/features/meshPaint/meshShader.js +6 -0
  467. package/dist/features/meshPaint/meshShader.js.map +1 -0
  468. package/dist/features/meshPaint/register.js +7 -0
  469. package/dist/features/meshPaint/register.js.map +1 -0
  470. package/dist/features/meshPaint/surface.js +110 -0
  471. package/dist/features/meshPaint/surface.js.map +1 -0
  472. package/dist/features/minimap/actions.js +53 -0
  473. package/dist/features/minimap/actions.js.map +1 -0
  474. package/dist/features/minimap/createMinimapContribution.js +96 -0
  475. package/dist/features/minimap/createMinimapContribution.js.map +1 -0
  476. package/dist/features/minimap/layers.js +103 -0
  477. package/dist/features/minimap/layers.js.map +1 -0
  478. package/dist/features/modes/modeLayers.js +113 -0
  479. package/dist/features/modes/modeLayers.js.map +1 -0
  480. package/dist/features/overlays/useNodeOverlayFrame.js +103 -0
  481. package/dist/features/overlays/useNodeOverlayFrame.js.map +1 -0
  482. package/dist/features/parallax/createParallaxLayer.js +26 -0
  483. package/dist/features/parallax/createParallaxLayer.js.map +1 -0
  484. package/dist/features/parallax/createParallaxPlane.js +26 -0
  485. package/dist/features/parallax/createParallaxPlane.js.map +1 -0
  486. package/dist/features/paths/anchorEdits.js +156 -0
  487. package/dist/features/paths/anchorEdits.js.map +1 -0
  488. package/dist/features/paths/anchors.js +154 -0
  489. package/dist/features/paths/anchors.js.map +1 -0
  490. package/dist/features/paths/booleans.js +2 -0
  491. package/dist/features/paths/index.js +15 -0
  492. package/dist/features/paths/markerCommands.js +116 -0
  493. package/dist/features/paths/markerCommands.js.map +1 -0
  494. package/dist/features/paths/markerSites.js +59 -0
  495. package/dist/features/paths/markerSites.js.map +1 -0
  496. package/dist/features/paths/markers.js +95 -0
  497. package/dist/features/paths/markers.js.map +1 -0
  498. package/dist/features/paths/nearestAnchor.js +36 -0
  499. package/dist/features/paths/nearestAnchor.js.map +1 -0
  500. package/dist/features/paths/originProjection.js +16 -0
  501. package/dist/features/paths/originProjection.js.map +1 -0
  502. package/dist/features/paths/pathEditingOverlayLayer.js +137 -0
  503. package/dist/features/paths/pathEditingOverlayLayer.js.map +1 -0
  504. package/dist/features/paths/pathInWorld.js +41 -0
  505. package/dist/features/paths/pathInWorld.js.map +1 -0
  506. package/dist/features/paths/pathLayer.js +44 -0
  507. package/dist/features/paths/pathLayer.js.map +1 -0
  508. package/dist/features/paths/penPreviewLayer.js +220 -0
  509. package/dist/features/paths/penPreviewLayer.js.map +1 -0
  510. package/dist/features/paths/poseDescriptor.js +44 -0
  511. package/dist/features/paths/poseDescriptor.js.map +1 -0
  512. package/dist/features/paths/tessellate/stroke.js +230 -0
  513. package/dist/features/paths/tessellate/stroke.js.map +1 -0
  514. package/dist/features/patterns/index.js +23 -0
  515. package/dist/features/patterns/index.js.map +1 -0
  516. package/dist/features/patterns/patterns-builtin.js +38 -0
  517. package/dist/features/patterns/patterns-builtin.js.map +1 -0
  518. package/dist/features/patterns/resolveSpec.js +57 -0
  519. package/dist/features/patterns/resolveSpec.js.map +1 -0
  520. package/dist/features/patterns/tileGeometry.js +158 -0
  521. package/dist/features/patterns/tileGeometry.js.map +1 -0
  522. package/dist/features/pointer/PointerContext.js +45 -0
  523. package/dist/features/pointer/PointerContext.js.map +1 -0
  524. package/dist/features/poseRun/usePoseRun.js +70 -0
  525. package/dist/features/poseRun/usePoseRun.js.map +1 -0
  526. package/dist/features/selection/SelectionContext.js +46 -0
  527. package/dist/features/selection/SelectionContext.js.map +1 -0
  528. package/dist/features/selection/overlay.js +442 -0
  529. package/dist/features/selection/overlay.js.map +1 -0
  530. package/dist/features/simulation/createSimulation.js +61 -0
  531. package/dist/features/simulation/createSimulation.js.map +1 -0
  532. package/dist/features/simulation/types.js +6 -0
  533. package/dist/features/simulation/types.js.map +1 -0
  534. package/dist/features/simulation/useSimulation.js +74 -0
  535. package/dist/features/simulation/useSimulation.js.map +1 -0
  536. package/dist/features/text/domRuns.js +258 -0
  537. package/dist/features/text/domRuns.js.map +1 -0
  538. package/dist/features/text/fitTextPose.js +38 -0
  539. package/dist/features/text/fitTextPose.js.map +1 -0
  540. package/dist/features/text/hitTest.js +45 -0
  541. package/dist/features/text/hitTest.js.map +1 -0
  542. package/dist/features/text/renderLabel.js +14 -0
  543. package/dist/features/text/renderLabel.js.map +1 -0
  544. package/dist/features/text/runs/effectiveRangeStyle.js +66 -0
  545. package/dist/features/text/runs/effectiveRangeStyle.js.map +1 -0
  546. package/dist/features/text/runs/flagRange.js +53 -0
  547. package/dist/features/text/runs/flagRange.js.map +1 -0
  548. package/dist/features/text/runs/rangeStyle.js +135 -0
  549. package/dist/features/text/runs/rangeStyle.js.map +1 -0
  550. package/dist/features/text/textCommand.js +59 -0
  551. package/dist/features/text/textCommand.js.map +1 -0
  552. package/dist/features/text/textLayer.js +35 -0
  553. package/dist/features/text/textLayer.js.map +1 -0
  554. package/dist/features/text/textToPath.js +181 -0
  555. package/dist/features/text/textToPath.js.map +1 -0
  556. package/dist/features/text/useSceneTextEdit.js +138 -0
  557. package/dist/features/text/useSceneTextEdit.js.map +1 -0
  558. package/dist/features/text/useTextEdit.js +465 -0
  559. package/dist/features/text/useTextEdit.js.map +1 -0
  560. package/dist/features/tiling/createTiledLayer.js +63 -0
  561. package/dist/features/tiling/createTiledLayer.js.map +1 -0
  562. package/dist/features/tiling/tiledProject.js +14 -0
  563. package/dist/features/tiling/tiledProject.js.map +1 -0
  564. package/dist/features/viewports/viewResolver.js +59 -0
  565. package/dist/features/viewports/viewResolver.js.map +1 -0
  566. package/dist/features/viewports/viewportLayer.js +58 -0
  567. package/dist/features/viewports/viewportLayer.js.map +1 -0
  568. package/dist/icons/ArrowIcon.js +23 -0
  569. package/dist/icons/ArrowIcon.js.map +1 -0
  570. package/dist/icons/EllipseIcon.js +21 -0
  571. package/dist/icons/EllipseIcon.js.map +1 -0
  572. package/dist/icons/EyedropperIcon.js +49 -0
  573. package/dist/icons/EyedropperIcon.js.map +1 -0
  574. package/dist/icons/HandIcon.js +59 -0
  575. package/dist/icons/HandIcon.js.map +1 -0
  576. package/dist/icons/ImageIcon.js +34 -0
  577. package/dist/icons/ImageIcon.js.map +1 -0
  578. package/dist/icons/LassoIcon.js +22 -0
  579. package/dist/icons/LassoIcon.js.map +1 -0
  580. package/dist/icons/LineIcon.js +22 -0
  581. package/dist/icons/LineIcon.js.map +1 -0
  582. package/dist/icons/PenIcon.js +36 -0
  583. package/dist/icons/PenIcon.js.map +1 -0
  584. package/dist/icons/PencilIcon.js +25 -0
  585. package/dist/icons/PencilIcon.js.map +1 -0
  586. package/dist/icons/PolygonIcon.js +19 -0
  587. package/dist/icons/PolygonIcon.js.map +1 -0
  588. package/dist/icons/RectIcon.js +37 -0
  589. package/dist/icons/RectIcon.js.map +1 -0
  590. package/dist/icons/SelectIcon.js +20 -0
  591. package/dist/icons/SelectIcon.js.map +1 -0
  592. package/dist/icons/StarIcon.js +19 -0
  593. package/dist/icons/StarIcon.js.map +1 -0
  594. package/dist/icons/TextIcon.js +19 -0
  595. package/dist/icons/TextIcon.js.map +1 -0
  596. package/dist/icons/UnknownIcon.js +33 -0
  597. package/dist/icons/UnknownIcon.js.map +1 -0
  598. package/dist/icons/_base.js +12 -0
  599. package/dist/icons/_base.js.map +1 -0
  600. package/dist/index.css +2 -62
  601. package/dist/index.d.ts +1955 -1891
  602. package/dist/index.js +312 -13
  603. package/dist/input/keyState.js +76 -0
  604. package/dist/input/keyState.js.map +1 -0
  605. package/dist/input/useKeyState.js +22 -0
  606. package/dist/input/useKeyState.js.map +1 -0
  607. package/dist/interactions/actions/actionShortcuts.js +32 -0
  608. package/dist/interactions/actions/actionShortcuts.js.map +1 -0
  609. package/dist/interactions/actions/align/align.js +81 -0
  610. package/dist/interactions/actions/align/align.js.map +1 -0
  611. package/dist/interactions/actions/booleans/booleans.js +120 -0
  612. package/dist/interactions/actions/booleans/booleans.js.map +1 -0
  613. package/dist/interactions/actions/booleans/useBooleans.js +20 -0
  614. package/dist/interactions/actions/booleans/useBooleans.js.map +1 -0
  615. package/dist/interactions/actions/booleans/useBooleansAdapter.js +9 -0
  616. package/dist/interactions/actions/booleans/useBooleansAdapter.js.map +1 -0
  617. package/dist/interactions/actions/clipboard/clipboardOps.js +94 -0
  618. package/dist/interactions/actions/clipboard/clipboardOps.js.map +1 -0
  619. package/dist/interactions/actions/clipboard/materializePaste.js +25 -0
  620. package/dist/interactions/actions/clipboard/materializePaste.js.map +1 -0
  621. package/dist/interactions/actions/clipboard/wireFormat.js +43 -0
  622. package/dist/interactions/actions/clipboard/wireFormat.js.map +1 -0
  623. package/dist/interactions/actions/clone/behaviors/cloneByAltDrag.js +26 -0
  624. package/dist/interactions/actions/clone/behaviors/cloneByAltDrag.js.map +1 -0
  625. package/dist/interactions/actions/defaultCommitAdapter.js +42 -0
  626. package/dist/interactions/actions/defaultCommitAdapter.js.map +1 -0
  627. package/dist/interactions/actions/defaults/align.js +71 -0
  628. package/dist/interactions/actions/defaults/align.js.map +1 -0
  629. package/dist/interactions/actions/defaults/anchorEditing.js +235 -0
  630. package/dist/interactions/actions/defaults/anchorEditing.js.map +1 -0
  631. package/dist/interactions/actions/defaults/areaSelect.js +75 -0
  632. package/dist/interactions/actions/defaults/areaSelect.js.map +1 -0
  633. package/dist/interactions/actions/defaults/booleans.js +52 -0
  634. package/dist/interactions/actions/defaults/booleans.js.map +1 -0
  635. package/dist/interactions/actions/defaults/cancelGesture.js +24 -0
  636. package/dist/interactions/actions/defaults/cancelGesture.js.map +1 -0
  637. package/dist/interactions/actions/defaults/clearSelection.js +19 -0
  638. package/dist/interactions/actions/defaults/clearSelection.js.map +1 -0
  639. package/dist/interactions/actions/defaults/clipboard.js +78 -0
  640. package/dist/interactions/actions/defaults/clipboard.js.map +1 -0
  641. package/dist/interactions/actions/defaults/clone.js +96 -0
  642. package/dist/interactions/actions/defaults/clone.js.map +1 -0
  643. package/dist/interactions/actions/defaults/createOutlines.js +47 -0
  644. package/dist/interactions/actions/defaults/createOutlines.js.map +1 -0
  645. package/dist/interactions/actions/defaults/createPaintAction.js +85 -0
  646. package/dist/interactions/actions/defaults/createPaintAction.js.map +1 -0
  647. package/dist/interactions/actions/defaults/delete.js +61 -0
  648. package/dist/interactions/actions/defaults/delete.js.map +1 -0
  649. package/dist/interactions/actions/defaults/distribute.js +66 -0
  650. package/dist/interactions/actions/defaults/distribute.js.map +1 -0
  651. package/dist/interactions/actions/defaults/duplicate.js +83 -0
  652. package/dist/interactions/actions/defaults/duplicate.js.map +1 -0
  653. package/dist/interactions/actions/defaults/editAnchors.js +100 -0
  654. package/dist/interactions/actions/defaults/editAnchors.js.map +1 -0
  655. package/dist/interactions/actions/defaults/enterPathEdit.js +29 -0
  656. package/dist/interactions/actions/defaults/enterPathEdit.js.map +1 -0
  657. package/dist/interactions/actions/defaults/enterTextEdit.js +20 -0
  658. package/dist/interactions/actions/defaults/enterTextEdit.js.map +1 -0
  659. package/dist/interactions/actions/defaults/escape.js +26 -0
  660. package/dist/interactions/actions/defaults/escape.js.map +1 -0
  661. package/dist/interactions/actions/defaults/exitPathEdit.js +22 -0
  662. package/dist/interactions/actions/defaults/exitPathEdit.js.map +1 -0
  663. package/dist/interactions/actions/defaults/flip.js +119 -0
  664. package/dist/interactions/actions/defaults/flip.js.map +1 -0
  665. package/dist/interactions/actions/defaults/freshNodeId.js +10 -0
  666. package/dist/interactions/actions/defaults/freshNodeId.js.map +1 -0
  667. package/dist/interactions/actions/defaults/group.js +131 -0
  668. package/dist/interactions/actions/defaults/group.js.map +1 -0
  669. package/dist/interactions/actions/defaults/icons/actionGlyphIcons.js +40 -0
  670. package/dist/interactions/actions/defaults/icons/actionGlyphIcons.js.map +1 -0
  671. package/dist/interactions/actions/defaults/icons/actionGlyphs.js +10 -0
  672. package/dist/interactions/actions/defaults/icons/actionGlyphs.js.map +1 -0
  673. package/dist/interactions/actions/defaults/icons/alignIcons.js +173 -0
  674. package/dist/interactions/actions/defaults/icons/alignIcons.js.map +1 -0
  675. package/dist/interactions/actions/defaults/icons/booleanIcons.js +171 -0
  676. package/dist/interactions/actions/defaults/icons/booleanIcons.js.map +1 -0
  677. package/dist/interactions/actions/defaults/icons/distributeIcons.js +63 -0
  678. package/dist/interactions/actions/defaults/icons/distributeIcons.js.map +1 -0
  679. package/dist/interactions/actions/defaults/icons/editIcons.js +280 -0
  680. package/dist/interactions/actions/defaults/icons/editIcons.js.map +1 -0
  681. package/dist/interactions/actions/defaults/icons/outlineIcons.js +53 -0
  682. package/dist/interactions/actions/defaults/icons/outlineIcons.js.map +1 -0
  683. package/dist/interactions/actions/defaults/ingest.js +58 -0
  684. package/dist/interactions/actions/defaults/ingest.js.map +1 -0
  685. package/dist/interactions/actions/defaults/insert.js +288 -0
  686. package/dist/interactions/actions/defaults/insert.js.map +1 -0
  687. package/dist/interactions/actions/defaults/insertPathAnchor.js +50 -0
  688. package/dist/interactions/actions/defaults/insertPathAnchor.js.map +1 -0
  689. package/dist/interactions/actions/defaults/lassoSelect.js +156 -0
  690. package/dist/interactions/actions/defaults/lassoSelect.js.map +1 -0
  691. package/dist/interactions/actions/defaults/move.js +656 -0
  692. package/dist/interactions/actions/defaults/move.js.map +1 -0
  693. package/dist/interactions/actions/defaults/nudge.js +110 -0
  694. package/dist/interactions/actions/defaults/nudge.js.map +1 -0
  695. package/dist/interactions/actions/defaults/pinchZoom.js +63 -0
  696. package/dist/interactions/actions/defaults/pinchZoom.js.map +1 -0
  697. package/dist/interactions/actions/defaults/reorder.js +143 -0
  698. package/dist/interactions/actions/defaults/reorder.js.map +1 -0
  699. package/dist/interactions/actions/defaults/requiresSelection.js +10 -0
  700. package/dist/interactions/actions/defaults/requiresSelection.js.map +1 -0
  701. package/dist/interactions/actions/defaults/resize.js +332 -0
  702. package/dist/interactions/actions/defaults/resize.js.map +1 -0
  703. package/dist/interactions/actions/defaults/rotate.js +181 -0
  704. package/dist/interactions/actions/defaults/rotate.js.map +1 -0
  705. package/dist/interactions/actions/defaults/selectAll.js +27 -0
  706. package/dist/interactions/actions/defaults/selectAll.js.map +1 -0
  707. package/dist/interactions/actions/defaults/setFill.js +27 -0
  708. package/dist/interactions/actions/defaults/setFill.js.map +1 -0
  709. package/dist/interactions/actions/defaults/setFillOpacity.js +15 -0
  710. package/dist/interactions/actions/defaults/setFillOpacity.js.map +1 -0
  711. package/dist/interactions/actions/defaults/setStroke.js +36 -0
  712. package/dist/interactions/actions/defaults/setStroke.js.map +1 -0
  713. package/dist/interactions/actions/defaults/setStrokeOpacity.js +21 -0
  714. package/dist/interactions/actions/defaults/setStrokeOpacity.js.map +1 -0
  715. package/dist/interactions/actions/defaults/slice.js +39 -0
  716. package/dist/interactions/actions/defaults/slice.js.map +1 -0
  717. package/dist/interactions/actions/defaults/sliceOps.js +60 -0
  718. package/dist/interactions/actions/defaults/sliceOps.js.map +1 -0
  719. package/dist/interactions/actions/defaults/toolActivate.js +35 -0
  720. package/dist/interactions/actions/defaults/toolActivate.js.map +1 -0
  721. package/dist/interactions/actions/defaults/toolResetToDefault.js +26 -0
  722. package/dist/interactions/actions/defaults/toolResetToDefault.js.map +1 -0
  723. package/dist/interactions/actions/defaults/undoRedo.js +51 -0
  724. package/dist/interactions/actions/defaults/undoRedo.js.map +1 -0
  725. package/dist/interactions/actions/defaults/viewportDragPan.js +88 -0
  726. package/dist/interactions/actions/defaults/viewportDragPan.js.map +1 -0
  727. package/dist/interactions/actions/defaults/viewportWheelPan.js +57 -0
  728. package/dist/interactions/actions/defaults/viewportWheelPan.js.map +1 -0
  729. package/dist/interactions/actions/defaults/viewportZoom.js +143 -0
  730. package/dist/interactions/actions/defaults/viewportZoom.js.map +1 -0
  731. package/dist/interactions/actions/distribute/distribute.js +42 -0
  732. package/dist/interactions/actions/distribute/distribute.js.map +1 -0
  733. package/dist/interactions/actions/distribute/plan.js +29 -0
  734. package/dist/interactions/actions/distribute/plan.js.map +1 -0
  735. package/dist/interactions/actions/edit-anchors/geometry.js +61 -0
  736. package/dist/interactions/actions/edit-anchors/geometry.js.map +1 -0
  737. package/dist/interactions/actions/edit-anchors/handles.js +43 -0
  738. package/dist/interactions/actions/edit-anchors/handles.js.map +1 -0
  739. package/dist/interactions/actions/flip/helpers.js +35 -0
  740. package/dist/interactions/actions/flip/helpers.js.map +1 -0
  741. package/dist/interactions/actions/geometryProjection.js +18 -0
  742. package/dist/interactions/actions/geometryProjection.js.map +1 -0
  743. package/dist/interactions/actions/gestureLifecycle.js +44 -0
  744. package/dist/interactions/actions/gestureLifecycle.js.map +1 -0
  745. package/dist/interactions/actions/lasso-select/behaviors/selectFromLasso.js +39 -0
  746. package/dist/interactions/actions/lasso-select/behaviors/selectFromLasso.js.map +1 -0
  747. package/dist/interactions/actions/move/behaviors/snapBackOrDelete.js +36 -0
  748. package/dist/interactions/actions/move/behaviors/snapBackOrDelete.js.map +1 -0
  749. package/dist/interactions/actions/move/behaviors/snapToContainer.js +67 -0
  750. package/dist/interactions/actions/move/behaviors/snapToContainer.js.map +1 -0
  751. package/dist/interactions/actions/move/gestureAdapter.js +37 -0
  752. package/dist/interactions/actions/move/gestureAdapter.js.map +1 -0
  753. package/dist/interactions/actions/outlines/createOutlines.js +84 -0
  754. package/dist/interactions/actions/outlines/createOutlines.js.map +1 -0
  755. package/dist/interactions/actions/outlines/useCreateOutlinesAdapter.js +9 -0
  756. package/dist/interactions/actions/outlines/useCreateOutlinesAdapter.js.map +1 -0
  757. package/dist/interactions/actions/planeInput.js +168 -0
  758. package/dist/interactions/actions/planeInput.js.map +1 -0
  759. package/dist/interactions/actions/poseDescriptorDep.js +9 -0
  760. package/dist/interactions/actions/poseDescriptorDep.js.map +1 -0
  761. package/dist/interactions/actions/poseFrame.js +38 -0
  762. package/dist/interactions/actions/poseFrame.js.map +1 -0
  763. package/dist/interactions/actions/previewOverrides.js +25 -0
  764. package/dist/interactions/actions/previewOverrides.js.map +1 -0
  765. package/dist/interactions/actions/resize/autoPoseDescriptor.js +32 -0
  766. package/dist/interactions/actions/resize/autoPoseDescriptor.js.map +1 -0
  767. package/dist/interactions/actions/resize/behaviors/clampMinSize.js +18 -0
  768. package/dist/interactions/actions/resize/behaviors/clampMinSize.js.map +1 -0
  769. package/dist/interactions/actions/resize/behaviors/index.js +8 -0
  770. package/dist/interactions/actions/resize/behaviors/index.js.map +1 -0
  771. package/dist/interactions/actions/resize/behaviors/lockAspect.js +24 -0
  772. package/dist/interactions/actions/resize/behaviors/lockAspect.js.map +1 -0
  773. package/dist/interactions/actions/resize/cornerHandles.js +72 -0
  774. package/dist/interactions/actions/resize/cornerHandles.js.map +1 -0
  775. package/dist/interactions/actions/resolveOverlays.js +60 -0
  776. package/dist/interactions/actions/resolveOverlays.js.map +1 -0
  777. package/dist/interactions/actions/resolvePreviews.js +61 -0
  778. package/dist/interactions/actions/resolvePreviews.js.map +1 -0
  779. package/dist/interactions/actions/rotate/geometry.js +46 -0
  780. package/dist/interactions/actions/rotate/geometry.js.map +1 -0
  781. package/dist/interactions/actions/rotate/handle.js +27 -0
  782. package/dist/interactions/actions/rotate/handle.js.map +1 -0
  783. package/dist/interactions/actions/spatialReference.js +42 -0
  784. package/dist/interactions/actions/spatialReference.js.map +1 -0
  785. package/dist/interactions/actions/useStandardActions.js +142 -0
  786. package/dist/interactions/actions/useStandardActions.js.map +1 -0
  787. package/dist/interactions/gestures/dragGesture/dragGesture.js +111 -0
  788. package/dist/interactions/gestures/dragGesture/dragGesture.js.map +1 -0
  789. package/dist/interactions/gestures/dragRadial/dragRadial.js +117 -0
  790. package/dist/interactions/gestures/dragRadial/dragRadial.js.map +1 -0
  791. package/dist/interactions/gestures/dragRect/dragRect.js +164 -0
  792. package/dist/interactions/gestures/dragRect/dragRect.js.map +1 -0
  793. package/dist/interactions/gestures/handleDrag/handleDrag.js +46 -0
  794. package/dist/interactions/gestures/handleDrag/handleDrag.js.map +1 -0
  795. package/dist/interactions/gestures/pointerDrag/pointerDrag.js +118 -0
  796. package/dist/interactions/gestures/pointerDrag/pointerDrag.js.map +1 -0
  797. package/dist/interactions/gestures/shared/originProjection.js +42 -0
  798. package/dist/interactions/gestures/shared/originProjection.js.map +1 -0
  799. package/dist/interactions/gestures/shared/screenTolerance.js +21 -0
  800. package/dist/interactions/gestures/shared/screenTolerance.js.map +1 -0
  801. package/dist/interactions/gestures/shared/snap.js +24 -0
  802. package/dist/interactions/gestures/shared/snap.js.map +1 -0
  803. package/dist/interactions/gestures/thresholdDrag/thresholdDrag.js +30 -0
  804. package/dist/interactions/gestures/thresholdDrag/thresholdDrag.js.map +1 -0
  805. package/dist/layout/arrivals.js +36 -0
  806. package/dist/layout/arrivals.js.map +1 -0
  807. package/dist/{math-MCQcf_gc.d.ts → math-CUMxmZzn.d.ts} +8 -116
  808. package/dist/math.d.ts +4 -5
  809. package/dist/math.js +6 -4
  810. package/dist/mesh.d.ts +268 -0
  811. package/dist/mesh.js +7 -0
  812. package/dist/move.d.ts +7 -49
  813. package/dist/move.js +3 -142
  814. package/dist/originProjection-BSn4xiEy.d.ts +57 -0
  815. package/dist/patterns-builtin.js +3 -3
  816. package/dist/{poseDescriptor-rZa9W5hJ.d.ts → poseDescriptor-CjSXMf8X.d.ts} +3 -3
  817. package/dist/registerProgram-ateHDGjw.d.ts +193 -0
  818. package/dist/renderer/DrawCommand.js +6 -0
  819. package/dist/renderer/DrawCommand.js.map +1 -0
  820. package/dist/renderer/WeaselRenderer.js +328 -0
  821. package/dist/renderer/WeaselRenderer.js.map +1 -0
  822. package/dist/renderer/cache/GLImageCache.js +64 -0
  823. package/dist/renderer/cache/GLImageCache.js.map +1 -0
  824. package/dist/renderer/cache/GLMeshCache.js +102 -0
  825. package/dist/renderer/cache/GLMeshCache.js.map +1 -0
  826. package/dist/renderer/cache/GLTextureCache.js +51 -0
  827. package/dist/renderer/cache/GLTextureCache.js.map +1 -0
  828. package/dist/renderer/cache/GradientRampAtlas.js +82 -0
  829. package/dist/renderer/cache/GradientRampAtlas.js.map +1 -0
  830. package/dist/renderer/cache/cache.js +13 -0
  831. package/dist/renderer/cache/cache.js.map +1 -0
  832. package/dist/renderer/cache/markerCommandCache.js +59 -0
  833. package/dist/renderer/cache/markerCommandCache.js.map +1 -0
  834. package/dist/renderer/cache/outlineMeshCache.js +15 -0
  835. package/dist/renderer/cache/outlineMeshCache.js.map +1 -0
  836. package/dist/renderer/cache/outlineStrokeMeshCache.js +31 -0
  837. package/dist/renderer/cache/outlineStrokeMeshCache.js.map +1 -0
  838. package/dist/renderer/cache/strokeMeshCache.js +44 -0
  839. package/dist/renderer/cache/strokeMeshCache.js.map +1 -0
  840. package/dist/renderer/cullDrawCommands.js +89 -0
  841. package/dist/renderer/cullDrawCommands.js.map +1 -0
  842. package/dist/renderer/draw.js +1109 -0
  843. package/dist/renderer/draw.js.map +1 -0
  844. package/dist/renderer/drawBatch.js +168 -0
  845. package/dist/renderer/drawBatch.js.map +1 -0
  846. package/dist/renderer/effects/EffectTargets.js +45 -0
  847. package/dist/renderer/effects/EffectTargets.js.map +1 -0
  848. package/dist/renderer/effects/builtins.js +31 -0
  849. package/dist/renderer/effects/builtins.js.map +1 -0
  850. package/dist/renderer/effects/composite.js +9 -0
  851. package/dist/renderer/effects/composite.js.map +1 -0
  852. package/dist/renderer/effects/effectPrelude.js +10 -0
  853. package/dist/renderer/effects/effectPrelude.js.map +1 -0
  854. package/dist/renderer/effects/types.js +10 -0
  855. package/dist/renderer/effects/types.js.map +1 -0
  856. package/dist/renderer/index.js +19 -0
  857. package/dist/renderer/math/color.js +341 -0
  858. package/dist/renderer/math/color.js.map +1 -0
  859. package/dist/renderer/math/mat3.js +71 -0
  860. package/dist/renderer/math/mat3.js.map +1 -0
  861. package/dist/renderer/math/patternSpace.js +22 -0
  862. package/dist/renderer/math/patternSpace.js.map +1 -0
  863. package/dist/renderer/math/viewToMat3.js +19 -0
  864. package/dist/renderer/math/viewToMat3.js.map +1 -0
  865. package/dist/renderer/paintResources.js +18 -0
  866. package/dist/renderer/paintResources.js.map +1 -0
  867. package/dist/renderer/paintScratch.js +37 -0
  868. package/dist/renderer/paintScratch.js.map +1 -0
  869. package/dist/renderer/shaders/ShaderProgram.js +74 -0
  870. package/dist/renderer/shaders/ShaderProgram.js.map +1 -0
  871. package/dist/renderer/shaders/batchFill.js +118 -0
  872. package/dist/renderer/shaders/batchFill.js.map +1 -0
  873. package/dist/renderer/shaders/customPrelude.js +34 -0
  874. package/dist/renderer/shaders/customPrelude.js.map +1 -0
  875. package/dist/renderer/shaders/extractUniformNames.js +184 -0
  876. package/dist/renderer/shaders/extractUniformNames.js.map +1 -0
  877. package/dist/renderer/shaders/glyphPaint.js +61 -0
  878. package/dist/renderer/shaders/glyphPaint.js.map +1 -0
  879. package/dist/renderer/shaders/gradFill.js +30 -0
  880. package/dist/renderer/shaders/gradFill.js.map +1 -0
  881. package/dist/renderer/shaders/imageFill.js +14 -0
  882. package/dist/renderer/shaders/imageFill.js.map +1 -0
  883. package/dist/renderer/shaders/pathFill.js +13 -0
  884. package/dist/renderer/shaders/pathFill.js.map +1 -0
  885. package/dist/renderer/shaders/patternFill.js +24 -0
  886. package/dist/renderer/shaders/patternFill.js.map +1 -0
  887. package/dist/renderer/shaders/registerProgram.js +18 -0
  888. package/dist/renderer/shaders/registerProgram.js.map +1 -0
  889. package/dist/renderer/spriteSheet.js +14 -0
  890. package/dist/renderer/spriteSheet.js.map +1 -0
  891. package/dist/renderer/state/GroupState.js +77 -0
  892. package/dist/renderer/state/GroupState.js.map +1 -0
  893. package/dist/renderer/syntheticItalic.js +6 -0
  894. package/dist/renderer/syntheticItalic.js.map +1 -0
  895. package/dist/renderer/textures/registerTexture.js +14 -0
  896. package/dist/renderer/textures/registerTexture.js.map +1 -0
  897. package/dist/renderer.d.ts +11 -21
  898. package/dist/renderer.js +18 -13
  899. package/dist/resize.d.ts +10 -46
  900. package/dist/resize.js +7 -5
  901. package/dist/routing.js +2 -3
  902. package/dist/scheduling/useVisibleRaf.js +69 -0
  903. package/dist/scheduling/useVisibleRaf.js.map +1 -0
  904. package/dist/test-hook/createTestHook.js +39 -0
  905. package/dist/test-hook/createTestHook.js.map +1 -0
  906. package/dist/test-hook/install.js +12 -0
  907. package/dist/test-hook/install.js.map +1 -0
  908. package/dist/test-seams-fYf6m5pu.d.ts +356 -0
  909. package/dist/test-seams.d.ts +6 -0
  910. package/dist/test-seams.js +3 -0
  911. package/dist/tools/builtin/ellipse/useEllipseTool.js +33 -0
  912. package/dist/tools/builtin/ellipse/useEllipseTool.js.map +1 -0
  913. package/dist/tools/builtin/eyedropper/useEyedropperTool.js +55 -0
  914. package/dist/tools/builtin/eyedropper/useEyedropperTool.js.map +1 -0
  915. package/dist/tools/builtin/hand/dragPanContribution.js +17 -0
  916. package/dist/tools/builtin/hand/dragPanContribution.js.map +1 -0
  917. package/dist/tools/builtin/hand/useHandTool.js +31 -0
  918. package/dist/tools/builtin/hand/useHandTool.js.map +1 -0
  919. package/dist/tools/builtin/image/useImageTool.js +41 -0
  920. package/dist/tools/builtin/image/useImageTool.js.map +1 -0
  921. package/dist/tools/builtin/lasso/useLassoTool.js +42 -0
  922. package/dist/tools/builtin/lasso/useLassoTool.js.map +1 -0
  923. package/dist/tools/builtin/line/useLineTool.js +33 -0
  924. package/dist/tools/builtin/line/useLineTool.js.map +1 -0
  925. package/dist/tools/builtin/pen/usePenTool.js +414 -0
  926. package/dist/tools/builtin/pen/usePenTool.js.map +1 -0
  927. package/dist/tools/builtin/pencil/usePencilTool.js +36 -0
  928. package/dist/tools/builtin/pencil/usePencilTool.js.map +1 -0
  929. package/dist/tools/builtin/pickTopMostHit.js +45 -0
  930. package/dist/tools/builtin/pickTopMostHit.js.map +1 -0
  931. package/dist/tools/builtin/polygon/usePolygonTool.js +81 -0
  932. package/dist/tools/builtin/polygon/usePolygonTool.js.map +1 -0
  933. package/dist/tools/builtin/rect/useRectTool.js +32 -0
  934. package/dist/tools/builtin/rect/useRectTool.js.map +1 -0
  935. package/dist/tools/builtin/select/selectionContributions.js +109 -0
  936. package/dist/tools/builtin/select/selectionContributions.js.map +1 -0
  937. package/dist/tools/builtin/select/useSelectTool.js +162 -0
  938. package/dist/tools/builtin/select/useSelectTool.js.map +1 -0
  939. package/dist/tools/builtin/shared/insertToolOptions.js +8 -0
  940. package/dist/tools/builtin/shared/insertToolOptions.js.map +1 -0
  941. package/dist/tools/builtin/slice/useSliceTool.js +263 -0
  942. package/dist/tools/builtin/slice/useSliceTool.js.map +1 -0
  943. package/dist/tools/builtin/star/useStarTool.js +82 -0
  944. package/dist/tools/builtin/star/useStarTool.js.map +1 -0
  945. package/dist/tools/builtin/text/useTextTool.js +177 -0
  946. package/dist/tools/builtin/text/useTextTool.js.map +1 -0
  947. package/dist/tools/overlayBinding.js +8 -0
  948. package/dist/tools/overlayBinding.js.map +1 -0
  949. package/dist/tools/prefs.js +47 -0
  950. package/dist/tools/prefs.js.map +1 -0
  951. package/dist/tools/useKeybindings.js +66 -0
  952. package/dist/tools/useKeybindings.js.map +1 -0
  953. package/dist/{types-D-9QWBy5.d.ts → types-CA54-mAZ.d.ts} +181 -13
  954. package/dist/{types-qYpyTAiZ.d.ts → types-DSjd6W3n.d.ts} +32 -6
  955. package/dist/util/color.js +26 -0
  956. package/dist/util/color.js.map +1 -0
  957. package/dist/util/constrainTo45.js +17 -0
  958. package/dist/util/constrainTo45.js.map +1 -0
  959. package/dist/util/paint.js +72 -0
  960. package/dist/util/paint.js.map +1 -0
  961. package/dist/version.js +6 -0
  962. package/dist/version.js.map +1 -0
  963. package/package.json +29 -19
  964. package/dist/chunk-3TY6FHAF.js +0 -170
  965. package/dist/chunk-3TY6FHAF.js.map +0 -1
  966. package/dist/chunk-DGWNNKGD.js +0 -248
  967. package/dist/chunk-DGWNNKGD.js.map +0 -1
  968. package/dist/chunk-G4ZGQMY7.js +0 -33372
  969. package/dist/chunk-G4ZGQMY7.js.map +0 -1
  970. package/dist/chunk-L5YNZYEG.js +0 -648
  971. package/dist/chunk-L5YNZYEG.js.map +0 -1
  972. package/dist/chunk-LU4IJ52W.js +0 -111
  973. package/dist/chunk-LU4IJ52W.js.map +0 -1
  974. package/dist/chunk-M24CLARN.js +0 -28
  975. package/dist/chunk-M24CLARN.js.map +0 -1
  976. package/dist/chunk-NE27EOLP.js +0 -146
  977. package/dist/chunk-NE27EOLP.js.map +0 -1
  978. package/dist/chunk-PNNZSYRD.js +0 -318
  979. package/dist/chunk-PNNZSYRD.js.map +0 -1
  980. package/dist/chunk-UPZY4ART.js +0 -29
  981. package/dist/chunk-UPZY4ART.js.map +0 -1
  982. package/dist/chunk-WPNA6L5O.js +0 -250
  983. package/dist/chunk-WPNA6L5O.js.map +0 -1
  984. package/dist/chunk-XMAWPGTK.js +0 -128
  985. package/dist/chunk-XMAWPGTK.js.map +0 -1
  986. package/dist/clipboard.js.map +0 -1
  987. package/dist/clone.js.map +0 -1
  988. package/dist/grid-CY5UKlZh.d.ts +0 -98
  989. package/dist/index.css.map +0 -1
  990. package/dist/index.js.map +0 -1
  991. package/dist/insert.d.ts +0 -36
  992. package/dist/insert.js +0 -81
  993. package/dist/insert.js.map +0 -1
  994. package/dist/math.js.map +0 -1
  995. package/dist/move.js.map +0 -1
  996. package/dist/path-JEV2c5If.d.ts +0 -48
  997. package/dist/patterns-builtin.js.map +0 -1
  998. package/dist/renderer.css +0 -62
  999. package/dist/renderer.css.map +0 -1
  1000. package/dist/renderer.js.map +0 -1
  1001. package/dist/resize.js.map +0 -1
  1002. package/dist/routing.js.map +0 -1
  1003. package/dist/types-D2tTKEU0.d.ts +0 -18
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useNodeOverlayFrame.js","names":["useNodeOverlayFrame","useCanvasSize","containerRef","options","project","useCallback","box","worldBoxOf","scene","nodeId","compose","multiply","viewMatrix","resolveView","view","rotationMatrix","toScreen","m","p","x","y","applyToPoint","lastInverse","useRef","toLocal","inverse","invert","width","height","useInsertionEffect","nodes","composeWorldPose","effectivePose","id","composeRectPose","sx","sy","r","poseRotationOf","pose","c","s"],"sources":["../../../src/features/overlays/useNodeOverlayFrame.ts"],"sourcesContent":["/**\n * `useNodeOverlayFrame` — the coordinate frame a DOM overlay pinned to one\n * scene node needs: the node's world box, the projection from that box's\n * frame into overlay pixels, and the overlay's measured size.\n *\n * This is the frame half of `subscribeView`'s \"DOM pinned to world\n * coordinates\" case. Consumers positioning chrome over a node — gradient\n * handles, a badge, a caret — otherwise re-derive it, and the\n * translate-and-scale inverse that derivation usually reaches for drops\n * `pose.rotation`, so the chrome sits where the node would be unrotated.\n *\n * `toScreen` maps the node's **unrotated world box** frame, which is the\n * frame `fillInPoseFrame` resolves a `units: 'bounds'` paint into and the\n * one `pathInPoseFrame` projects geometry into. Rotation lives in this hook,\n * not in those: a node's stored geometry is pre-rotation by definition.\n */\nimport { useCallback, useInsertionEffect, useRef, type RefObject } from 'react';\nimport { applyToPoint, invert, multiply, type Mat3 } from '@weasel-js/geom';\nimport type { Node, RectPose, Scene } from '../../core/scene/types';\nimport { useCanvasSize } from '../../core/viewport/useCanvasSize';\nimport type { View } from '../../core/viewport/view';\nimport { composeRectPose, composeWorldPose } from '../groups/composePose';\nimport { effectivePose } from 'core/scene/effectivePose';\nimport { poseRotationOf } from 'core/geometry/poseRotation';\n\n/** Structural point, matching every other `{ x, y }` the kit passes across a\n * boundary. */\nexport interface OverlayPoint {\n x: number;\n y: number;\n}\n\n/** The overlay frame for one node. `null` from the hook means there is no\n * frame yet — no node, or nothing measured to draw it on. */\nexport interface NodeOverlayFrame {\n /** The node's composed world box, **unrotated**: the frame `toScreen` maps\n * from, and the box to hand `fillInPoseFrame` / `fillToBoundsFrame`. */\n box: { x: number; y: number; width: number; height: number };\n /** Node box frame → overlay pixels, rotation and view included. */\n toScreen: (p: OverlayPoint) => OverlayPoint;\n /** Overlay pixels → node box frame. Inverts `toScreen`; while a live view\n * flattens an axis, it keeps the last mapping that had an inverse. */\n toLocal: (p: OverlayPoint) => OverlayPoint;\n /** The container's size in CSS pixels — the overlay's own box. */\n width: number;\n height: number;\n}\n\n/** Options for `useNodeOverlayFrame`. */\nexport interface UseNodeOverlayFrameOptions<TPose> {\n /**\n * Current viewport. A thunk is re-read on every projection, which is what\n * an uncontrolled `SceneCanvas` needs — its camera lives in a ref and moves\n * without a render, so pass the handle's `getView`. A plain `View` is the\n * value from the render that supplied it, correct for a controlled\n * consumer. Omit it and world units are handed through as screen pixels.\n */\n view?: View | (() => View);\n /** Fold a child pose into its parent's frame. Default `composeRectPose`. */\n compose?: (parent: TPose, child: TPose) => TPose;\n}\n\n/**\n * Resolve the overlay frame for `nodeId` against `containerRef` — the element\n * the overlay is positioned in, which must be the canvas's own box for the\n * projection to land.\n *\n * Returns `null` when there is no node under `nodeId`, when the container has\n * not been measured, or when the view collapses an axis to zero — the three\n * states in which an overlay has nothing to draw.\n */\nexport function useNodeOverlayFrame<TData, TLayer extends string, TPose extends RectPose>(\n scene: Scene<TData, TLayer, TPose>,\n containerRef: RefObject<HTMLElement | null>,\n nodeId: string | null | undefined,\n options: UseNodeOverlayFrameOptions<TPose> = {},\n): NodeOverlayFrame | null {\n const { width, height } = useCanvasSize(containerRef);\n const { view, compose } = options;\n\n const project = useCallback((): Mat3 | null => {\n const box = worldBoxOf(scene, nodeId, compose);\n if (!box) return null;\n return multiply(viewMatrix(resolveView(view)), rotationMatrix(box));\n }, [scene, nodeId, compose, view]);\n\n const toScreen = useCallback((p: OverlayPoint): OverlayPoint => {\n const m = project();\n if (!m) return p;\n const [x, y] = applyToPoint(m, p.x, p.y);\n return { x, y };\n }, [project]);\n\n const lastInverse = useRef<Mat3 | null>(null);\n\n const toLocal = useCallback((p: OverlayPoint): OverlayPoint => {\n const m = project();\n const inverse = m && invert(m);\n if (inverse) lastInverse.current = inverse;\n // Published by the commit that handed this toLocal out, so there is one.\n const [x, y] = applyToPoint(inverse ?? lastInverse.current!, p.x, p.y);\n return { x, y };\n }, [project]);\n\n const box = worldBoxOf(scene, nodeId, compose);\n const m = box && width !== 0 && height !== 0 ? project() : null;\n const inverse = m && invert(m);\n useInsertionEffect(() => {\n if (inverse) lastInverse.current = inverse;\n });\n\n if (!box || !inverse) return null;\n return { box: { x: box.x, y: box.y, width: box.width, height: box.height }, toScreen, toLocal, width, height };\n}\n\nfunction resolveView(view: View | (() => View) | undefined): View | undefined {\n return typeof view === 'function' ? view() : view;\n}\n\nfunction worldBoxOf<TData, TLayer extends string, TPose extends RectPose>(\n scene: Scene<TData, TLayer, TPose>,\n nodeId: string | null | undefined,\n compose: ((parent: TPose, child: TPose) => TPose) | undefined,\n): TPose | null {\n if (nodeId == null) return null;\n const nodes = scene.nodes as ReadonlyMap<string, Node<TData, TLayer, TPose>>;\n if (!nodes.has(nodeId)) return null;\n // `effectivePose`, not `node.pose`: an overlay tracks what the renderer\n // draws, and a gesture override or a derived pose is exactly the difference.\n const adapter = {\n getPose: (id: string) => effectivePose(scene, nodes.get(id)!),\n getParent: (id: string) => nodes.get(id)?.parent ?? null,\n };\n return composeWorldPose(adapter, nodeId, compose ?? composeRectPose);\n}\n\n/** World → overlay pixels: `screen = (world − view) × view.scale`. */\nfunction viewMatrix(view: View | undefined): Mat3 {\n if (!view) return [1, 0, 0, 1, 0, 0];\n const { x: sx, y: sy } = view.scale;\n return [sx, 0, 0, sy, -view.x * sx, -view.y * sy];\n}\n\n/** The pose→world leg the box frame omits, per `poseRotationOf`'s convention. */\nfunction rotationMatrix(pose: RectPose): Mat3 {\n const r = poseRotationOf(pose);\n if (!r) return [1, 0, 0, 1, 0, 0];\n const c = Math.cos(r.rotation);\n const s = Math.sin(r.rotation);\n return [c, s, -s, c, r.cx - r.cx * c + r.cy * s, r.cy - r.cx * s - r.cy * c];\n}\n"],"mappings":";;;;;;;;AAuEA,SAAgBA,EACd,GACA,GACA,GACA,IAA6C,CAAC,GACrB;CACzB,IAAM,EAAE,UAAO,cAAWC,EAAcC,CAAY,GAC9C,EAAE,SAAM,eAAYC,GAEpBC,IAAUC,QAA+B;EAC7C,IAAMC,IAAMC,EAAWC,GAAOC,GAAQC,CAAO;EAE7C,OADKJ,IACEK,EAASC,EAAWC,EAAYC,CAAI,CAAC,GAAGC,EAAeT,CAAG,CAAC,IADjD;CAEnB,GAAG;EAACE;EAAOC;EAAQC;EAASI;CAAI,CAAC,GAE3BE,IAAWX,GAAa,MAAkC;EAC9D,IAAMY,IAAIb,EAAQ;EAClB,IAAI,CAACa,GAAG,OAAOC;EACf,IAAM,CAACC,GAAGC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GAAM,OAAO;EAAC;EAAG;EAAG;EAAG;EAAG;EAAG;CAAC;CACnC,IAAM,EAAE,GAAGqB,GAAI,GAAGC,MAAOtB,EAAK;CAC9B,OAAO;EAACqB;EAAI;EAAG;EAAGC;EAAI,CAACtB,EAAK,IAAIqB;EAAI,CAACrB,EAAK,IAAIsB;CAAE;AAClD;AAGA,SAASrB,EAAe,GAAsB;CAC5C,IAAMsB,IAAIC,EAAeC,CAAI;CAC7B,IAAI,CAACF,GAAG,OAAO;EAAC;EAAG;EAAG;EAAG;EAAG;EAAG;CAAC;CAChC,IAAMG,IAAI,KAAK,IAAIH,EAAE,QAAQ,GACvBI,IAAI,KAAK,IAAIJ,EAAE,QAAQ;CAC7B,OAAO;EAACG;EAAGC;EAAG,CAACA;EAAGD;EAAGH,EAAE,KAAKA,EAAE,KAAKG,IAAIH,EAAE,KAAKI;EAAGJ,EAAE,KAAKA,EAAE,KAAKI,IAAIJ,EAAE,KAAKG;CAAC;AAC7E"}
@@ -0,0 +1,26 @@
1
+ import { drawOneLayer as e, subscribeToSources as t } from "../../core/layers/render.js";
2
+ import { deriveParallaxView as n } from "../../core/viewport/parallax.js";
3
+ import { isParallaxSource as r } from "./createParallaxPlane.js";
4
+ //#region src/features/parallax/createParallaxLayer.ts
5
+ function i(i) {
6
+ let { id: a, label: o, source: s, parallax: c, getOuterView: l } = i, u = r(c) ? () => c.get() : () => c, d = t(s);
7
+ return {
8
+ id: a,
9
+ label: o,
10
+ space: "screen",
11
+ subscribe: r(c) ? (e) => {
12
+ let t = d(e), n = c.subscribe(e);
13
+ return () => {
14
+ t(), n();
15
+ };
16
+ } : d,
17
+ draw: (t, r, i) => {
18
+ let a = n(l?.() ?? r, u());
19
+ return s.flatMap((n) => e(n, t, a, i));
20
+ }
21
+ };
22
+ }
23
+ //#endregion
24
+ export { i as createParallaxLayer };
25
+
26
+ //# sourceMappingURL=createParallaxLayer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createParallaxLayer.js","names":["createParallaxLayer","opts","read","isParallaxSource","parallax","fromSources","subscribeToSources","source","offSources","listener","offPlane","inner","deriveParallaxView","getOuterView","outer","drawOneLayer","layer","data","dims"],"sources":["../../../src/features/parallax/createParallaxLayer.ts"],"sourcesContent":["import { drawOneLayer, subscribeToSources, type RenderLayer } from '../../core/layers/render';\nimport type { View } from '../../core/viewport/view';\nimport { deriveParallaxView, type ParallaxOpts } from '../../core/viewport/parallax';\nimport { isParallaxSource, type ParallaxSource } from './createParallaxPlane';\n\n/** Options for `createParallaxLayer`. */\nexport interface CreateParallaxLayerOpts<TData> {\n id: string;\n label: string;\n /** Layers re-rendered through the derived inner view. */\n source: RenderLayer<TData>[];\n /** How the plane tracks the camera. Pass a `ParallaxSource` (such as\n * `createParallaxPlane`) to change it after the layer is built — an\n * animator tweening `pan` or `zoom` writes the plane, not the layer. */\n parallax: ParallaxOpts | ParallaxSource;\n /** Where the camera view comes from. Defaults to the view the Canvas hands\n * the layer — the `view` prop. A consumer running a 60 Hz camera through\n * refs pins that prop to identity, and would otherwise get identity back\n * for every `pan` value and a backdrop that never moves. */\n getOuterView?: () => View;\n}\n\n/**\n * Wrap source RenderLayers in a parallax plane. The plane's inner view is\n * derived from the camera view per {@link deriveParallaxView}; each source\n * layer is drawn through it by `drawOneLayer`, so a `space: 'world'` source\n * gets the inner view's transform and a `space: 'screen'` one does not. The\n * plane itself is emitted as `space: 'screen'` — its children already carry\n * whatever transform they need, and the outer Canvas must add none.\n *\n * What this draws is paint: pointer events target the camera's view. Content\n * that should be clickable belongs on a scene layer carrying `parallax`\n * instead, which `<SceneCanvas>` renders and picks through the same view.\n *\n * **Screen-space source layers don't compose meaningfully** — they ignore\n * the derived view by definition. Same constraint as `createViewportLayer`.\n */\nexport function createParallaxLayer<TData>(\n opts: CreateParallaxLayerOpts<TData>,\n): RenderLayer<TData> {\n const { id, label, source, parallax, getOuterView } = opts;\n const read = isParallaxSource(parallax) ? () => parallax.get() : () => parallax;\n const fromSources = subscribeToSources(source);\n return {\n id,\n label,\n space: 'screen',\n subscribe: isParallaxSource(parallax)\n ? (listener) => {\n const offSources = fromSources(listener);\n const offPlane = parallax.subscribe(listener);\n return () => { offSources(); offPlane(); };\n }\n : fromSources,\n draw: (data, outer, dims) => {\n const inner = deriveParallaxView(getOuterView?.() ?? outer, read());\n return source.flatMap((layer) => drawOneLayer(layer, data, inner, dims));\n },\n };\n}\n"],"mappings":";;;;AAqCA,SAAgBA,EACd,GACoB;CACpB,IAAM,EAAE,OAAI,UAAO,WAAQ,aAAU,oBAAiBC,GAChDC,IAAOC,EAAiBC,CAAQ,UAAUA,EAAS,IAAI,UAAUA,GACjEC,IAAcC,EAAmBC,CAAM;CAC7C,OAAO;EACL;EACA;EACA,OAAO;EACP,WAAWJ,EAAiBC,CAAQ,KAC/B,MAAa;GACd,IAAMI,IAAaH,EAAYI,CAAQ,GACjCC,IAAWN,EAAS,UAAUK,CAAQ;GAC5C,aAAa;IAAgB,AAAdD,EAAW,GAAGE,EAAS;GAAG;EAC3C,IACEL;EACJ,OAAO,GAAM,GAAO,MAAS;GAC3B,IAAMM,IAAQC,EAAmBC,IAAe,KAAKC,GAAOZ,EAAK,CAAC;GAClE,OAAOK,EAAO,SAAS,MAAUQ,EAAaC,GAAOC,GAAMN,GAAOO,CAAI,CAAC;EACzE;CACF;AACF"}
@@ -0,0 +1,26 @@
1
+ //#region src/features/parallax/createParallaxPlane.ts
2
+ function e(e) {
3
+ let t = { ...e }, n = /* @__PURE__ */ new Set();
4
+ return {
5
+ get: () => t,
6
+ set(e) {
7
+ t = {
8
+ ...t,
9
+ ...e
10
+ };
11
+ for (let e of [...n]) e();
12
+ },
13
+ subscribe(e) {
14
+ return n.add(e), () => {
15
+ n.delete(e);
16
+ };
17
+ }
18
+ };
19
+ }
20
+ function t(e) {
21
+ return typeof e.get == "function";
22
+ }
23
+ //#endregion
24
+ export { e as createParallaxPlane, t as isParallaxSource };
25
+
26
+ //# sourceMappingURL=createParallaxPlane.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createParallaxPlane.js","names":["createParallaxPlane","current","initial","listeners","patch","fn","isParallaxSource","p"],"sources":["../../../src/features/parallax/createParallaxPlane.ts"],"sourcesContent":["import type { RedrawSource } from '../../core/layers/render';\nimport type { ParallaxOpts } from '../../core/viewport/parallax';\n\n/** Parallax opts that can change after a layer is built. `get` is read on\n * every draw, and a notification repaints whatever draws through it. */\nexport interface ParallaxSource extends RedrawSource {\n get(): ParallaxOpts;\n}\n\n/** A {@link ParallaxSource} you write to — what an animator's `onTick` drives\n * to tween a plane's `pan`, `zoom` or `anchor`. */\nexport interface ParallaxPlane extends ParallaxSource {\n /** Merge `patch` over the current opts and notify. */\n set(patch: Partial<ParallaxOpts>): void;\n}\n\n/** A {@link ParallaxPlane} starting at `initial`. Pass it as a parallax\n * layer's `parallax` and write to it to move the plane. */\nexport function createParallaxPlane(initial: ParallaxOpts): ParallaxPlane {\n let current: ParallaxOpts = { ...initial };\n const listeners = new Set<() => void>();\n return {\n get: () => current,\n set(patch) {\n current = { ...current, ...patch };\n for (const fn of [...listeners]) fn();\n },\n subscribe(fn) {\n listeners.add(fn);\n return () => { listeners.delete(fn); };\n },\n };\n}\n\n/** Whether `p` is a live source rather than a fixed set of opts. */\nexport function isParallaxSource(p: ParallaxOpts | ParallaxSource): p is ParallaxSource {\n return typeof (p as ParallaxSource).get === 'function';\n}\n"],"mappings":";AAkBA,SAAgBA,EAAoB,GAAsC;CACxE,IAAIC,IAAwB,EAAE,GAAGC,EAAQ,GACnCC,oBAAY,IAAI,IAAgB;CACtC,OAAO;EACL,WAAWF;EACX,IAAI,GAAO;GACT,IAAU;IAAE,GAAGA;IAAS,GAAGG;GAAM;GACjC,KAAK,IAAMC,KAAM,CAAC,GAAGF,CAAS,GAAG,EAAG;EACtC;EACA,UAAU,GAAI;GAEZ,OADAA,EAAU,IAAIE,CAAE,SACH;IAAE,EAAU,OAAOA,CAAE;GAAG;EACvC;CACF;AACF;AAGA,SAAgBC,EAAiB,GAAuD;CACtF,OAAO,OAAQC,EAAqB,OAAQ;AAC9C"}
@@ -0,0 +1,156 @@
1
+ import { withinPxRadius as e } from "../../core/viewport/pxExtent.js";
2
+ import { anchorsToPath as t, isAnchorSmooth as n, isStraightSegment as r, nearestSegmentT as i, pathToAnchors as a, segmentEnds as o } from "./anchors.js";
3
+ import { cubicPointAt as s, fitCubicThroughDeletion as c, splitCubicAtT as l } from "@weasel-js/geom";
4
+ //#region src/features/paths/anchorEdits.ts
5
+ function u(e, t) {
6
+ if (t < 0) return null;
7
+ let n = t;
8
+ for (let t = 0; t < e.anchors.length; t++) {
9
+ let r = e.anchors[t].length;
10
+ if (n < r) return {
11
+ sub: t,
12
+ idx: n
13
+ };
14
+ n -= r;
15
+ }
16
+ return null;
17
+ }
18
+ function d(e, t, n) {
19
+ if (t < 0 || t >= e.anchors.length || n < 0 || n >= e.anchors[t].length) return -1;
20
+ let r = 0;
21
+ for (let n = 0; n < t; n++) r += e.anchors[n].length;
22
+ return r + n;
23
+ }
24
+ function f(e, t) {
25
+ let n = u(e, t);
26
+ return n ? e.anchors[n.sub][n.idx] ?? null : null;
27
+ }
28
+ function p(e, n) {
29
+ let r = a(e);
30
+ return n(r) === !1 ? null : t(r.anchors, r.closed);
31
+ }
32
+ function m(e, t, n, r) {
33
+ let i = f(e, t);
34
+ return i ? (i.x += n, i.y += r, i.inHandle && (i.inHandle.x += n, i.inHandle.y += r), i.outHandle && (i.outHandle.x += n, i.outHandle.y += r), !0) : !1;
35
+ }
36
+ function h(e, t, r, i, a, o) {
37
+ let s = f(e, t);
38
+ if (!s) return !1;
39
+ let c = n(s), l = {
40
+ x: i,
41
+ y: a
42
+ };
43
+ r === "out" ? s.outHandle = l : s.inHandle = l;
44
+ let u = r === "out" ? "in" : "out", d = u === "in" ? s.inHandle : s.outHandle;
45
+ if (!o && c && d) {
46
+ let e = {
47
+ x: 2 * s.x - l.x,
48
+ y: 2 * s.y - l.y
49
+ };
50
+ u === "in" ? s.inHandle = e : s.outHandle = e;
51
+ }
52
+ return !0;
53
+ }
54
+ function g(e, t) {
55
+ let n = o(e.anchors, e.closed, t.sub, t.segIdx);
56
+ if (!n) return -1;
57
+ let { a: i, b: a } = n, s = t.segIdx + 1;
58
+ if (r(i, a)) return e.anchors[t.sub].splice(s, 0, {
59
+ x: i.x + (a.x - i.x) * t.t,
60
+ y: i.y + (a.y - i.y) * t.t
61
+ }), d(e, t.sub, s);
62
+ let c = i, u = i.outHandle ?? i, f = a.inHandle ?? a, { left: p, right: m } = l(c, u, f, a, t.t);
63
+ return i.outHandle = {
64
+ x: p[1].x,
65
+ y: p[1].y
66
+ }, a.inHandle = {
67
+ x: m[2].x,
68
+ y: m[2].y
69
+ }, e.anchors[t.sub].splice(s, 0, {
70
+ x: p[3].x,
71
+ y: p[3].y,
72
+ inHandle: {
73
+ x: p[2].x,
74
+ y: p[2].y
75
+ },
76
+ outHandle: {
77
+ x: m[1].x,
78
+ y: m[1].y
79
+ }
80
+ }), d(e, t.sub, s);
81
+ }
82
+ function _(t, n, r, a) {
83
+ let s = a.scale ?? {
84
+ x: 1,
85
+ y: 1
86
+ }, c = (e) => ({
87
+ x: e.x * s.x,
88
+ y: e.y * s.y
89
+ }), l = t.anchors.map((e) => e.map((e) => ({
90
+ ...c(e),
91
+ ...e.inHandle ? { inHandle: c(e.inHandle) } : {},
92
+ ...e.outHandle ? { outHandle: c(e.outHandle) } : {}
93
+ }))), u = i(l, n * s.x, r * s.y, t.closed);
94
+ if (!u) return null;
95
+ let d = o(t.anchors, t.closed, u.sub, u.segIdx), f = v(d.a, d.b, u.t), p = a.tolerancePx;
96
+ return !e(f.x - n, f.y - r, p, s) || e(f.x - d.a.x, f.y - d.a.y, p, s) || e(f.x - d.b.x, f.y - d.b.y, p, s) ? null : {
97
+ sub: u.sub,
98
+ segIdx: u.segIdx,
99
+ t: u.t,
100
+ x: f.x,
101
+ y: f.y
102
+ };
103
+ }
104
+ function v(e, t, n) {
105
+ return r(e, t) ? {
106
+ x: e.x + (t.x - e.x) * n,
107
+ y: e.y + (t.y - e.y) * n
108
+ } : s(e, e.outHandle ?? e, t.inHandle ?? t, t, n);
109
+ }
110
+ function y(e, t) {
111
+ let n = /* @__PURE__ */ new Map();
112
+ for (let r of t) {
113
+ let t = u(e, r);
114
+ if (!t) continue;
115
+ let i = n.get(t.sub);
116
+ i ? i.push(t.idx) : n.set(t.sub, [t.idx]);
117
+ }
118
+ if (n.size === 0) return !1;
119
+ let r = 0;
120
+ for (let t = 0; t < e.anchors.length; t++) {
121
+ let i = n.get(t)?.length ?? 0;
122
+ e.anchors[t].length - i >= 2 && r++;
123
+ }
124
+ if (r === 0) return !1;
125
+ for (let [t, r] of n) {
126
+ let n = e.anchors[t];
127
+ if (n) {
128
+ r.sort((e, t) => t - e);
129
+ for (let e of r) {
130
+ let t = n[e - 1], r = n[e + 1];
131
+ if (t && r) {
132
+ let { c1: e, c2: n } = c(t, r);
133
+ t.outHandle = e, r.inHandle = n;
134
+ }
135
+ n.splice(e, 1);
136
+ }
137
+ }
138
+ }
139
+ for (let t = e.anchors.length - 1; t >= 0; t--) e.anchors[t].length < 2 && (e.anchors.splice(t, 1), e.closed.splice(t, 1));
140
+ return !0;
141
+ }
142
+ function b(e, t) {
143
+ let n = u(e, t);
144
+ if (!n || !e.closed[n.sub]) return !1;
145
+ let r = e.anchors[n.sub];
146
+ return r ? (e.anchors[n.sub] = [...r.slice(n.idx), ...r.slice(0, n.idx)], e.closed[n.sub] = !1, !0) : !1;
147
+ }
148
+ function x(e, t) {
149
+ let n = t.x + t.width, r = t.y + t.height, i = [], a = 0;
150
+ for (let o of e.anchors) for (let e of o) e.x >= t.x && e.x <= n && e.y >= t.y && e.y <= r && i.push(a), a++;
151
+ return i;
152
+ }
153
+ //#endregion
154
+ export { f as anchorAt, x as anchorsInRect, y as deleteAnchorsAt, p as editAnchorSet, d as flatAnchorIndex, g as insertAnchorOnSegment, u as locateAnchor, h as moveHandleTo, b as openSubpathAt, _ as segmentAt, m as translateAnchorBy };
155
+
156
+ //# sourceMappingURL=anchorEdits.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"anchorEdits.js","names":["p3","locateAnchor","flatIndex","remaining","sub","set","len","flatAnchorIndex","idx","base","s","anchorAt","loc","editAnchorSet","pathToAnchors","path","edit","anchorsToPath","translateAnchorBy","a","dx","dy","moveHandleTo","wasSmooth","isAnchorSmooth","target","toX","toY","side","oppositeSide","opposite","breakSmoothness","mirrored","insertAnchorOnSegment","ends","segmentEnds","args","at","isStraightSegment","b","p0","p1","p2","splitCubicAtT","left","right","segmentAt","scale","opts","onScreen","p","screenAnchors","hit","nearestSegmentT","x","y","point","pointOnSegment","tol","withinPxRadius","t","cubicPointAt","deleteAnchorsAt","bySub","flat","flatIndexes","list","survivors","doomed","indices","i","prev","next","fitCubicThroughDeletion","c1","c2","openSubpathAt","anchorsInRect","x2","rect","y2","hits"],"sources":["../../../src/features/paths/anchorEdits.ts"],"sourcesContent":["/**\n * Pure anchor-set edits — the geometry half of path editing, with no\n * dependency on any tool's scratch or on the action layer.\n *\n * The model is the one `pathToAnchors` produces: subpath-major\n * `PenAnchor[][]` plus a parallel `closed: boolean[]`. Every function here\n * mutates that structure in place; callers decode with `pathToAnchors`,\n * apply, and re-encode with `anchorsToPath` (see {@link editAnchorSet}).\n *\n * ## Two ways to name an anchor\n *\n * Callers address anchors by **flat index** — the sequential position in\n * walk order across all subpaths, which is exactly what\n * `enumerateAnchors` reports and therefore what the dispatcher's\n * `anchor:N` / `controlIn:N` / `controlOut:N` affordance kinds carry.\n * Internally, operations that have to reason about subpath structure\n * (deletion, scissors) need the `(sub, idx)` pair instead.\n * {@link locateAnchor} and {@link flatAnchorIndex} convert.\n *\n * The two orders agree because `pathToAnchors` and `enumerateAnchors`\n * walk the same command stream and emit one anchor per M/L/C/Q — see the\n * invariant test in `anchorEdits.test.ts`. If you change either walker,\n * that test is the tripwire.\n */\n\nimport { cubicPointAt, fitCubicThroughDeletion, splitCubicAtT, type PolygonPath } from '@weasel-js/geom';\nimport {\n pathToAnchors,\n anchorsToPath,\n isAnchorSmooth,\n isStraightSegment,\n nearestSegmentT,\n segmentEnds,\n type PenAnchor,\n} from './anchors';\nimport { withinPxRadius, type Scale2 } from 'core/viewport/pxExtent';\n\n/** Subpath-major anchor model — the decoded form of a `PolygonPath`. */\nexport interface AnchorSet {\n anchors: PenAnchor[][];\n closed: boolean[];\n}\n\n/** A world-space rectangle, as produced by a drag-rect gesture. */\nexport interface AnchorRect {\n x: number;\n y: number;\n width: number;\n height: number;\n}\n\n// ---------------------------------------------------------------------------\n// Addressing\n// ---------------------------------------------------------------------------\n\n/** Total anchors across every subpath. */\nexport function anchorCount(set: AnchorSet): number {\n let n = 0;\n for (const sub of set.anchors) n += sub.length;\n return n;\n}\n\n/** Flat index → `(sub, idx)`. Returns null when out of range. */\nexport function locateAnchor(\n set: AnchorSet,\n flatIndex: number,\n): { sub: number; idx: number } | null {\n if (flatIndex < 0) return null;\n let remaining = flatIndex;\n for (let sub = 0; sub < set.anchors.length; sub++) {\n const len = set.anchors[sub].length;\n if (remaining < len) return { sub, idx: remaining };\n remaining -= len;\n }\n return null;\n}\n\n/** `(sub, idx)` → flat index. Returns -1 when out of range. */\nexport function flatAnchorIndex(set: AnchorSet, sub: number, idx: number): number {\n if (sub < 0 || sub >= set.anchors.length) return -1;\n if (idx < 0 || idx >= set.anchors[sub].length) return -1;\n let base = 0;\n for (let s = 0; s < sub; s++) base += set.anchors[s].length;\n return base + idx;\n}\n\n/** Resolve a flat index to the anchor itself. Null when out of range. */\nexport function anchorAt(set: AnchorSet, flatIndex: number): PenAnchor | null {\n const loc = locateAnchor(set, flatIndex);\n if (!loc) return null;\n return set.anchors[loc.sub][loc.idx] ?? null;\n}\n\n// ---------------------------------------------------------------------------\n// Decode / apply / encode\n// ---------------------------------------------------------------------------\n\n/**\n * Decode `path`, hand the mutable anchor set to `edit`, and re-encode.\n * Returns the new path, or null when `edit` reports that it changed\n * nothing (returning `false`) — callers use that to skip a no-op commit\n * and avoid pushing an empty history entry.\n */\nexport function editAnchorSet(\n path: PolygonPath,\n edit: (set: AnchorSet) => boolean | void,\n): PolygonPath | null {\n const set = pathToAnchors(path) as AnchorSet;\n const changed = edit(set);\n if (changed === false) return null;\n return anchorsToPath(set.anchors, set.closed);\n}\n\n// ---------------------------------------------------------------------------\n// Edits\n// ---------------------------------------------------------------------------\n\n/** Translate an anchor and both of its handles by `(dx, dy)`. */\nexport function translateAnchorBy(\n set: AnchorSet,\n flatIndex: number,\n dx: number,\n dy: number,\n): boolean {\n const a = anchorAt(set, flatIndex);\n if (!a) return false;\n a.x += dx;\n a.y += dy;\n if (a.inHandle) {\n a.inHandle.x += dx;\n a.inHandle.y += dy;\n }\n if (a.outHandle) {\n a.outHandle.x += dx;\n a.outHandle.y += dy;\n }\n return true;\n}\n\n/**\n * Move one control handle to an absolute world position.\n *\n * When the anchor was smooth (handles collinear through the anchor) and\n * `breakSmoothness` is false, the opposite handle is mirrored so the curve\n * stays smooth — Illustrator's default. Alt-drag sets `breakSmoothness`\n * and the two handles become independent.\n */\nexport function moveHandleTo(\n set: AnchorSet,\n flatIndex: number,\n side: 'in' | 'out',\n toX: number,\n toY: number,\n breakSmoothness: boolean,\n): boolean {\n const a = anchorAt(set, flatIndex);\n if (!a) return false;\n const wasSmooth = isAnchorSmooth(a);\n const target = { x: toX, y: toY };\n if (side === 'out') a.outHandle = target;\n else a.inHandle = target;\n const oppositeSide = side === 'out' ? 'in' : 'out';\n const opposite = oppositeSide === 'in' ? a.inHandle : a.outHandle;\n if (!breakSmoothness && wasSmooth && opposite) {\n const mirrored = { x: 2 * a.x - target.x, y: 2 * a.y - target.y };\n if (oppositeSide === 'in') a.inHandle = mirrored;\n else a.outHandle = mirrored;\n }\n return true;\n}\n\n/**\n * Split the segment `(sub, segIdx) → (sub, segIdx + 1)` at parameter `t`,\n * inserting a new anchor there. On a closed subpath `segIdx` may also name\n * the closing segment (`sub.length - 1`); its new anchor is appended.\n *\n * A straight segment splits linearly and stays straight — the new anchor\n * has no handles. A curved one splits by de Casteljau, which preserves the\n * curve exactly: the two halves trace the original path.\n *\n * Returns the new anchor's flat index, or -1 when the segment doesn't\n * exist.\n */\nexport function insertAnchorOnSegment(\n set: AnchorSet,\n args: { sub: number; segIdx: number; t: number },\n): number {\n const ends = segmentEnds(set.anchors, set.closed, args.sub, args.segIdx);\n if (!ends) return -1;\n const { a, b } = ends;\n const at = args.segIdx + 1;\n if (isStraightSegment(a, b)) {\n set.anchors[args.sub].splice(at, 0, {\n x: a.x + (b.x - a.x) * args.t,\n y: a.y + (b.y - a.y) * args.t,\n });\n return flatAnchorIndex(set, args.sub, at);\n }\n const p0 = a, p1 = a.outHandle ?? a, p2 = b.inHandle ?? b, p3 = b;\n const { left, right } = splitCubicAtT(p0, p1, p2, p3, args.t);\n a.outHandle = { x: left[1].x, y: left[1].y };\n b.inHandle = { x: right[2].x, y: right[2].y };\n set.anchors[args.sub].splice(at, 0, {\n x: left[3].x,\n y: left[3].y,\n inHandle: { x: left[2].x, y: left[2].y },\n outHandle: { x: right[1].x, y: right[1].y },\n });\n return flatAnchorIndex(set, args.sub, at);\n}\n\n/** A point on a segment, as {@link segmentAt} reports it. */\nexport interface SegmentHit {\n sub: number;\n segIdx: number;\n /** Parameter on the segment — what {@link insertAnchorOnSegment} takes. */\n t: number;\n /** The point on the path at `t`, in the set's own space. */\n x: number;\n y: number;\n}\n\n/**\n * The segment point under `(x, y)`, when it lies within `tolerancePx` of\n * the path on screen and no nearer than that to either of the segment's\n * own anchors — a press on an anchor is about the anchor, not the segment\n * beside it.\n *\n * `scale` is the view's, so the tolerance holds per axis under\n * non-uniform zoom. The search runs in screen-scaled space: scaling is\n * affine, so the curve's parameterization, and therefore `t`, carries\n * straight back to world space.\n */\nexport function segmentAt(\n set: AnchorSet,\n x: number,\n y: number,\n opts: { tolerancePx: number; scale?: Scale2 },\n): SegmentHit | null {\n const scale = opts.scale ?? { x: 1, y: 1 };\n const onScreen = (p: { x: number; y: number }) => ({ x: p.x * scale.x, y: p.y * scale.y });\n const screenAnchors = set.anchors.map((sub) => sub.map((a) => ({\n ...onScreen(a),\n ...(a.inHandle ? { inHandle: onScreen(a.inHandle) } : {}),\n ...(a.outHandle ? { outHandle: onScreen(a.outHandle) } : {}),\n })));\n const hit = nearestSegmentT(screenAnchors, x * scale.x, y * scale.y, set.closed);\n if (!hit) return null;\n const ends = segmentEnds(set.anchors, set.closed, hit.sub, hit.segIdx)!;\n const point = pointOnSegment(ends.a, ends.b, hit.t);\n const tol = opts.tolerancePx;\n if (!withinPxRadius(point.x - x, point.y - y, tol, scale)) return null;\n if (withinPxRadius(point.x - ends.a.x, point.y - ends.a.y, tol, scale)) return null;\n if (withinPxRadius(point.x - ends.b.x, point.y - ends.b.y, tol, scale)) return null;\n return { sub: hit.sub, segIdx: hit.segIdx, t: hit.t, x: point.x, y: point.y };\n}\n\nfunction pointOnSegment(a: PenAnchor, b: PenAnchor, t: number): { x: number; y: number } {\n if (isStraightSegment(a, b)) return { x: a.x + (b.x - a.x) * t, y: a.y + (b.y - a.y) * t };\n return cubicPointAt(a, a.outHandle ?? a, b.inHandle ?? b, b, t);\n}\n\n/**\n * Delete the anchors at `flatIndexes`. Where a deleted anchor had\n * neighbors on both sides, the surviving segment is refitted through the\n * gap (`fitCubicThroughDeletion`) so the path keeps its shape instead of\n * snapping to a straight line.\n *\n * Subpaths left with fewer than two anchors are dropped entirely — a\n * one-anchor subpath has no segments and would serialize to a stray `M`.\n *\n * If that would leave the path with **no** subpaths at all, the whole\n * deletion is refused (returns false, `set` untouched). Committing an\n * empty path turns the node into an invisible zombie: still selected,\n * still in the scene, nothing on screen and no anchors left to grab it\n * by. Deleting the object is the node-level Delete action's job, and the\n * user asked to delete anchors.\n */\nexport function deleteAnchorsAt(set: AnchorSet, flatIndexes: Iterable<number>): boolean {\n const bySub = new Map<number, number[]>();\n for (const flat of flatIndexes) {\n const loc = locateAnchor(set, flat);\n if (!loc) continue;\n const list = bySub.get(loc.sub);\n if (list) list.push(loc.idx);\n else bySub.set(loc.sub, [loc.idx]);\n }\n if (bySub.size === 0) return false;\n\n // Refuse up front if this would wipe the path out — cheaper and safer\n // than mutating and rolling back.\n let survivors = 0;\n for (let s = 0; s < set.anchors.length; s++) {\n const doomed = bySub.get(s)?.length ?? 0;\n if (set.anchors[s].length - doomed >= 2) survivors++;\n }\n if (survivors === 0) return false;\n\n for (const [s, indices] of bySub) {\n const sub = set.anchors[s];\n if (!sub) continue;\n // Descending so each splice leaves the not-yet-processed indices valid.\n indices.sort((a, b) => b - a);\n for (const i of indices) {\n const prev = sub[i - 1];\n const next = sub[i + 1];\n if (prev && next) {\n const { c1, c2 } = fitCubicThroughDeletion(prev, next);\n prev.outHandle = c1;\n next.inHandle = c2;\n }\n sub.splice(i, 1);\n }\n }\n\n // Drop degenerate subpaths, back to front so indices stay valid.\n for (let s = set.anchors.length - 1; s >= 0; s--) {\n if (set.anchors[s].length < 2) {\n set.anchors.splice(s, 1);\n set.closed.splice(s, 1);\n }\n }\n return true;\n}\n\n/**\n * Scissors: open a closed subpath at the given anchor, rotating the\n * anchor list so the cut point becomes the new start/end. No-ops on an\n * already-open subpath — there's nothing to cut.\n */\nexport function openSubpathAt(set: AnchorSet, flatIndex: number): boolean {\n const loc = locateAnchor(set, flatIndex);\n if (!loc) return false;\n if (!set.closed[loc.sub]) return false;\n const sub = set.anchors[loc.sub];\n if (!sub) return false;\n set.anchors[loc.sub] = [...sub.slice(loc.idx), ...sub.slice(0, loc.idx)];\n set.closed[loc.sub] = false;\n return true;\n}\n\n/** Flat indices of every anchor whose on-curve point falls inside `rect`. */\nexport function anchorsInRect(set: AnchorSet, rect: AnchorRect): number[] {\n const x2 = rect.x + rect.width;\n const y2 = rect.y + rect.height;\n const hits: number[] = [];\n let flat = 0;\n for (const sub of set.anchors) {\n for (const a of sub) {\n if (a.x >= rect.x && a.x <= x2 && a.y >= rect.y && a.y <= y2) hits.push(flat);\n flat++;\n }\n }\n return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d,AADIe,EAAE,KAAK4D,EAAK,KAAK5D,EAAE,KAAK2D,KAAM3D,EAAE,KAAK4D,EAAK,KAAK5D,EAAE,KAAK6D,KAAIC,EAAK,KAAKjB,CAAI,GAC5E;CAGJ,OAAOiB;AACT"}
@@ -0,0 +1,154 @@
1
+ import { PATH_C as e, PATH_L as t, PATH_M as n, PATH_Q as r, PATH_Z as i, PathBuilder as a, forEachSegment as o, nearestOnCubic as s, nearestOnLine as c } from "@weasel-js/geom";
2
+ //#region src/features/paths/anchors.ts
3
+ function l(a) {
4
+ let { commands: s, coords: c } = a, l = [], u = [], d = null;
5
+ return o(s, c, (a, o) => {
6
+ switch (a) {
7
+ case n:
8
+ d && (l.push(d), u.push(!1)), d = [{
9
+ x: c[o],
10
+ y: c[o + 1]
11
+ }];
12
+ break;
13
+ case t:
14
+ if (!d) throw Error("pathToAnchors: L without prior M");
15
+ d.push({
16
+ x: c[o],
17
+ y: c[o + 1]
18
+ });
19
+ break;
20
+ case e: {
21
+ if (!d) throw Error("pathToAnchors: C without prior M");
22
+ let e = d[d.length - 1];
23
+ e.outHandle = {
24
+ x: c[o],
25
+ y: c[o + 1]
26
+ }, d.push({
27
+ x: c[o + 4],
28
+ y: c[o + 5],
29
+ inHandle: {
30
+ x: c[o + 2],
31
+ y: c[o + 3]
32
+ }
33
+ });
34
+ break;
35
+ }
36
+ case r: {
37
+ if (!d) throw Error("pathToAnchors: Q without prior M");
38
+ let e = {
39
+ x: c[o],
40
+ y: c[o + 1]
41
+ }, t = d[d.length - 1];
42
+ t.outHandle = e, d.push({
43
+ x: c[o + 2],
44
+ y: c[o + 3],
45
+ inHandle: { ...e }
46
+ });
47
+ break;
48
+ }
49
+ case i:
50
+ d &&= (l.push(d), u.push(!0), null);
51
+ break;
52
+ default: throw Error(`pathToAnchors: unknown command ${a}`);
53
+ }
54
+ }), d && (l.push(d), u.push(!1)), {
55
+ anchors: l,
56
+ closed: u
57
+ };
58
+ }
59
+ function u(e, t) {
60
+ let n = new a();
61
+ for (let r = 0; r < e.length; r++) {
62
+ let i = e[r];
63
+ if (i.length !== 0) {
64
+ n.moveTo(i[0].x, i[0].y);
65
+ for (let e = 1; e < i.length; e++) {
66
+ let t = i[e - 1], r = i[e];
67
+ if (t.outHandle == null && r.inHandle == null) n.lineTo(r.x, r.y);
68
+ else {
69
+ let e = t.outHandle ?? {
70
+ x: t.x,
71
+ y: t.y
72
+ }, i = r.inHandle ?? {
73
+ x: r.x,
74
+ y: r.y
75
+ };
76
+ n.curveTo(e.x, e.y, i.x, i.y, r.x, r.y);
77
+ }
78
+ }
79
+ if (t[r]) {
80
+ let e = i[i.length - 1], t = i[0];
81
+ if (e.outHandle != null || t.inHandle != null) {
82
+ let r = e.outHandle ?? {
83
+ x: e.x,
84
+ y: e.y
85
+ }, i = t.inHandle ?? {
86
+ x: t.x,
87
+ y: t.y
88
+ };
89
+ n.curveTo(r.x, r.y, i.x, i.y, t.x, t.y);
90
+ }
91
+ n.close();
92
+ }
93
+ }
94
+ }
95
+ return n.build();
96
+ }
97
+ var d = .001;
98
+ function f(e) {
99
+ if (!e.inHandle || !e.outHandle) return !1;
100
+ let t = e.inHandle.x - e.x, n = e.inHandle.y - e.y, r = e.outHandle.x - e.x, i = e.outHandle.y - e.y, a = Math.hypot(t, n), o = Math.hypot(r, i);
101
+ if (a === 0 || o === 0) return !1;
102
+ let s = (t * i - n * r) / (a * o);
103
+ return Math.abs(s) < d;
104
+ }
105
+ function p(i) {
106
+ if (i.kind === "rect") return 4;
107
+ let a = i.commands, o = 0;
108
+ for (let i = 0; i < a.length; i++) {
109
+ let s = a[i];
110
+ (s === n || s === t || s === e || s === r) && o++;
111
+ }
112
+ return o;
113
+ }
114
+ function m(e, t, n, r) {
115
+ let i = e[n];
116
+ return !i || r < 0 ? null : r + 1 < i.length ? {
117
+ a: i[r],
118
+ b: i[r + 1]
119
+ } : t?.[n] && i.length > 1 && r === i.length - 1 ? {
120
+ a: i[r],
121
+ b: i[0]
122
+ } : null;
123
+ }
124
+ function h(e, t) {
125
+ return e.outHandle == null && t.inHandle == null;
126
+ }
127
+ function g(e, t, n, r) {
128
+ let i = e.outHandle ?? e, a = t.inHandle ?? t, o = h(e, t) ? c(n, r, e.x, e.y, t.x, t.y) : s(n, r, e.x, e.y, i.x, i.y, a.x, a.y, t.x, t.y);
129
+ return {
130
+ t: o.t,
131
+ d2: o.dist * o.dist
132
+ };
133
+ }
134
+ function _(e, t, n, r) {
135
+ let i = Infinity, a = null;
136
+ for (let o = 0; o < e.length; o++) {
137
+ let s = e[o].length - +!r?.[o];
138
+ for (let c = 0; c < s; c++) {
139
+ let s = m(e, r, o, c);
140
+ if (!s) continue;
141
+ let l = g(s.a, s.b, t, n);
142
+ l.d2 < i && (i = l.d2, a = {
143
+ sub: o,
144
+ segIdx: c,
145
+ t: l.t
146
+ });
147
+ }
148
+ }
149
+ return a;
150
+ }
151
+ //#endregion
152
+ export { u as anchorsToPath, p as countPathAnchors, f as isAnchorSmooth, h as isStraightSegment, _ as nearestSegmentT, l as pathToAnchors, m as segmentEnds };
153
+
154
+ //# sourceMappingURL=anchors.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"anchors.js","names":["pathToAnchors","path","anchors","closed","current","forEachSegment","commands","coords","cmd","PATH_M","ci","PATH_L","PATH_C","prev","PATH_Q","handle","PATH_Z","anchorsToPath","b","PathBuilder","s","sub","i","cur","c1","c2","last","first","SMOOTH_THRESHOLD","isAnchorSmooth","a","inDX","inDY","outDX","outDY","inLen","outLen","cross","countPathAnchors","cmds","n","c","segmentEnds","segIdx","isStraightSegment","nearestOnSegment","p1","p2","hit","nearestOnLine","x","y","nearestOnCubic","nearestSegmentT","bestD2","best","segCount","ends","wx","wy"],"sources":["../../../src/features/paths/anchors.ts"],"sourcesContent":["/**\n * Counts the path anchors used by the per-anchor coloring surface. An\n * \"anchor\" is the destination point of a path command: M, L, C, Q each\n * contribute one (the (x, y) where the pen ends up); Z contributes none\n * (it closes back to the subpath's first M). RectPath has four implicit\n * anchors — the corners — matching its M/L/L/L/Z stroke tessellation.\n *\n * Consumers use this to size their per-anchor color array; the renderer\n * uses it to validate the array length in dev builds.\n */\n\nimport {\n PATH_C,\n PATH_L,\n PATH_M,\n PATH_Q,\n PATH_Z,\n type Path,\n type PolygonPath,\n forEachSegment,\n nearestOnCubic,\n nearestOnLine,\n PathBuilder,\n} from '@weasel-js/geom';\n\n/** One anchor of an editable path: its on-curve point plus the two control\n * handles that shape the segments either side of it. Handles are in the same\n * space as the point, and absent when the adjoining segment is straight. */\nexport interface PenAnchor {\n x: number;\n y: number;\n inHandle?: { x: number; y: number };\n outHandle?: { x: number; y: number };\n}\n\n/**\n * Derive a per-subpath anchor model from a PolygonPath. Subpaths split on\n * every `M` command; a subpath is closed iff it ends with `Z`.\n *\n * Cubic-segment control points become the outHandle of the previous anchor\n * and the inHandle of the next anchor. Quadratic segments are upgraded to\n * cubics (each control reused for both adjacent handles) — this loses no\n * geometry. Linear segments produce anchors with no handles.\n */\nexport function pathToAnchors(\n path: PolygonPath,\n): { anchors: PenAnchor[][]; closed: boolean[] } {\n const { commands, coords } = path;\n const anchors: PenAnchor[][] = [];\n const closed: boolean[] = [];\n let current: PenAnchor[] | null = null;\n\n forEachSegment(commands, coords, (cmd, ci) => {\n switch (cmd) {\n case PATH_M: {\n if (current) { anchors.push(current); closed.push(false); }\n current = [{ x: coords[ci], y: coords[ci + 1] }];\n break;\n }\n case PATH_L: {\n if (!current) throw new Error('pathToAnchors: L without prior M');\n current.push({ x: coords[ci], y: coords[ci + 1] });\n break;\n }\n case PATH_C: {\n if (!current) throw new Error('pathToAnchors: C without prior M');\n const prev = current[current.length - 1];\n prev.outHandle = { x: coords[ci], y: coords[ci + 1] };\n current.push({\n x: coords[ci + 4], y: coords[ci + 5],\n inHandle: { x: coords[ci + 2], y: coords[ci + 3] },\n });\n break;\n }\n case PATH_Q: {\n if (!current) throw new Error('pathToAnchors: Q without prior M');\n // Quadratic → cubic: handle is the same control point on both sides.\n const handle = { x: coords[ci], y: coords[ci + 1] };\n const prev = current[current.length - 1];\n prev.outHandle = handle;\n current.push({ x: coords[ci + 2], y: coords[ci + 3], inHandle: { ...handle } });\n break;\n }\n case PATH_Z: {\n if (current) { anchors.push(current); closed.push(true); current = null; }\n break;\n }\n default:\n throw new Error(`pathToAnchors: unknown command ${cmd}`);\n }\n });\n if (current) { anchors.push(current); closed.push(false); }\n return { anchors, closed };\n}\n\n/**\n * Serialize the per-subpath anchor model back to a PolygonPath. Inverse of\n * `pathToAnchors`. Curve-vs-line decision per segment:\n * - Both adjacent handles absent → straight L segment.\n * - Either handle present → C segment, with missing handles defaulting to\n * the anchor point itself (degenerate but valid; renders as a near-line).\n */\nexport function anchorsToPath(\n anchors: PenAnchor[][],\n closed: boolean[],\n): PolygonPath {\n const b = new PathBuilder();\n for (let s = 0; s < anchors.length; s++) {\n const sub = anchors[s];\n if (sub.length === 0) continue;\n b.moveTo(sub[0].x, sub[0].y);\n for (let i = 1; i < sub.length; i++) {\n const prev = sub[i - 1];\n const cur = sub[i];\n const hasHandle = prev.outHandle != null || cur.inHandle != null;\n if (!hasHandle) {\n b.lineTo(cur.x, cur.y);\n } else {\n const c1 = prev.outHandle ?? { x: prev.x, y: prev.y };\n const c2 = cur.inHandle ?? { x: cur.x, y: cur.y };\n b.curveTo(c1.x, c1.y, c2.x, c2.y, cur.x, cur.y);\n }\n }\n if (closed[s]) {\n // Bridge last → first if they have curve handles; either way emit Z.\n const last = sub[sub.length - 1];\n const first = sub[0];\n const hasHandle = last.outHandle != null || first.inHandle != null;\n if (hasHandle) {\n const c1 = last.outHandle ?? { x: last.x, y: last.y };\n const c2 = first.inHandle ?? { x: first.x, y: first.y };\n b.curveTo(c1.x, c1.y, c2.x, c2.y, first.x, first.y);\n }\n b.close();\n }\n }\n return b.build();\n}\n\nconst SMOOTH_THRESHOLD = 0.001;\n\n/**\n * Returns true if the anchor's in-handle and out-handle are collinear with\n * the anchor point, indicating \"smooth\" (mirror-drag) behavior. Detected via\n * the magnitude of the normalized cross product of the two handle vectors.\n *\n * Edge cases:\n * - Missing in or out handle → false (corner by definition).\n * - Either handle at zero distance from anchor → false.\n */\nexport function isAnchorSmooth(a: PenAnchor): boolean {\n if (!a.inHandle || !a.outHandle) return false;\n const inDX = a.inHandle.x - a.x;\n const inDY = a.inHandle.y - a.y;\n const outDX = a.outHandle.x - a.x;\n const outDY = a.outHandle.y - a.y;\n const inLen = Math.hypot(inDX, inDY);\n const outLen = Math.hypot(outDX, outDY);\n if (inLen === 0 || outLen === 0) return false;\n // For collinear handles on opposite sides of the anchor, the cross product\n // of the two handle vectors should be zero. Normalize by both magnitudes.\n const cross = (inDX * outDY - inDY * outDX) / (inLen * outLen);\n return Math.abs(cross) < SMOOTH_THRESHOLD;\n}\n\n/** How many anchors a path has. Matches the per-anchor arrays the renderer\n * expects for `vertexColors`. */\nexport function countPathAnchors(path: Path): number {\n if (path.kind === 'rect') return 4;\n const cmds = path.commands;\n let n = 0;\n for (let i = 0; i < cmds.length; i++) {\n const c = cmds[i];\n if (c === PATH_M || c === PATH_L || c === PATH_C || c === PATH_Q) n++;\n }\n return n;\n}\n\n/** The segment `(sub, segIdx)` as its two end anchors, or null when it\n * doesn't exist. `segIdx === sub.length - 1` names a closed subpath's\n * closing segment, which runs from the last anchor back to the first. */\nexport function segmentEnds(\n anchors: readonly PenAnchor[][],\n closed: readonly boolean[] | undefined,\n sub: number,\n segIdx: number,\n): { a: PenAnchor; b: PenAnchor } | null {\n const s = anchors[sub];\n if (!s || segIdx < 0) return null;\n if (segIdx + 1 < s.length) return { a: s[segIdx], b: s[segIdx + 1] };\n if (closed?.[sub] && s.length > 1 && segIdx === s.length - 1) return { a: s[segIdx], b: s[0] };\n return null;\n}\n\n/** Whether the segment from `a` to `b` is a straight line (no handles). */\nexport function isStraightSegment(a: PenAnchor, b: PenAnchor): boolean {\n return a.outHandle == null && b.inHandle == null;\n}\n\n/** Nearest parameter on one segment to `(x, y)`, with its squared distance.\n * A straight segment is parameterized by arc length (`t` is the fraction of\n * the way from `a` to `b`), matching how {@link insertAnchorOnSegment}\n * splits one. */\nfunction nearestOnSegment(a: PenAnchor, b: PenAnchor, x: number, y: number): { t: number; d2: number } {\n const p1 = a.outHandle ?? a;\n const p2 = b.inHandle ?? b;\n const hit = isStraightSegment(a, b)\n ? nearestOnLine(x, y, a.x, a.y, b.x, b.y)\n : nearestOnCubic(x, y, a.x, a.y, p1.x, p1.y, p2.x, p2.y, b.x, b.y);\n return { t: hit.t, d2: hit.dist * hit.dist };\n}\n\n/** The segment of a decoded path nearest `(wx, wy)`, and the parameter `t`\n * on it closest to that point. Pass `closed` (from `pathToAnchors`) to\n * include each closed subpath's closing segment, reported as\n * `segIdx === sub.length - 1`. `t` spans `[0, 1]`, endpoints included.\n * Returns `null` only when there are no segments. */\nexport function nearestSegmentT(\n anchors: PenAnchor[][],\n wx: number,\n wy: number,\n closed?: readonly boolean[],\n): { sub: number; segIdx: number; t: number } | null {\n let bestD2 = Infinity;\n let best: { sub: number; segIdx: number; t: number } | null = null;\n for (let s = 0; s < anchors.length; s++) {\n const segCount = anchors[s].length - (closed?.[s] ? 0 : 1);\n for (let i = 0; i < segCount; i++) {\n const ends = segmentEnds(anchors, closed, s, i);\n if (!ends) continue;\n const hit = nearestOnSegment(ends.a, ends.b, wx, wy);\n if (hit.d2 < bestD2) {\n bestD2 = hit.d2;\n best = { sub: s, segIdx: i, t: hit.t };\n }\n }\n }\n return best;\n}\n"],"mappings":";;AA4CA,SAAgBA,EACd,GAC+C;CAC/C,IAAM,EAAE,aAAU,cAAWC,GACvBC,IAAyB,CAAC,GAC1BC,IAAoB,CAAC,GACvBC,IAA8B;CA0ClC,OAxCAC,EAAeC,GAAUC,IAAS,GAAK,MAAO;EAC5C,QAAQC,GAAR;GACE,KAAKC;IAEH,AADIL,MAAWF,EAAQ,KAAKE,CAAO,GAAGD,EAAO,KAAK,EAAK,IACvD,IAAU,CAAC;KAAE,GAAGI,EAAOG;KAAK,GAAGH,EAA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AAE,CAAC,IACtCkC,EAAeF,GAAGC,GAAGrB,EAAE,GAAGA,EAAE,GAAGgB,EAAG,GAAGA,EAAG,GAAGC,EAAG,GAAGA,EAAG,GAAG7B,EAAE,GAAGA,EAAE,CAAC;CACnE,OAAO;EAAE,GAAG8B,EAAI;EAAG,IAAIA,EAAI,OAAOA,EAAI;CAAK;AAC7C;AAOA,SAAgBK,EACd,GACA,GACA,GACA,GACmD;CACnD,IAAIC,IAAS,UACTC,IAA0D;CAC9D,KAAK,IAAInC,IAAI,GAAGA,IAAIlB,EAAQ,QAAQ,KAAK;EACvC,IAAMsD,IAAWtD,EAAQkB,EAAE,CAAC,SAAU,MAASA;EAC/C,KAAK,IAAIE,IAAI,GAAGA,IAAIkC,GAAU,KAAK;GACjC,IAAMC,IAAOf,EAAYxC,GAASC,GAAQiB,GAAGE,CAAC;GAC9C,IAAI,CAACmC,GAAM;GACX,IAAMT,IAAMH,EAAiBY,EAAK,GAAGA,EAAK,GAAGC,GAAIC,CAAE;GACnD,AAAIX,EAAI,KAAKM,MACX,IAASN,EAAI,IACb,IAAO;IAAE,KAAK5B;IAAG,QAAQE;IAAG,GAAG0B,EAAI;GAAE;EAEzC;CACF;CACA,OAAOO;AACT"}
@@ -0,0 +1,2 @@
1
+ import { pathCrop as e, pathDivide as t, pathExclude as n, pathIntersect as r, pathSubtract as i, pathUnion as a } from "@weasel-js/geom/booleans";
2
+ export { e as pathCrop, t as pathDivide, n as pathExclude, r as pathIntersect, i as pathSubtract, a as pathUnion };
@@ -0,0 +1,15 @@
1
+ import { poseRotationOf as e, rotatePathAround as t } from "../../core/geometry/poseRotation.js";
2
+ import { pathPoseDescriptor as n } from "./poseDescriptor.js";
3
+ import { countPathAnchors as r, pathToAnchors as i } from "./anchors.js";
4
+ import "./anchorEdits.js";
5
+ import { pathInPoseFrame as a, pathInWorld as o, worldEditToStorage as s } from "./pathInWorld.js";
6
+ import "./booleans.js";
7
+ import { circlePath as c, rectMarkerPath as l, roundRectPath as u, squarePath as d } from "./markers.js";
8
+ import { createPenPreviewLayer as f } from "./penPreviewLayer.js";
9
+ import { createPathEditingOverlayLayer as p } from "./pathEditingOverlayLayer.js";
10
+ import { createPathLayer as m } from "./pathLayer.js";
11
+ import { pathOriginProjection as h } from "./originProjection.js";
12
+ import { DEFAULT_FLATTEN_TOLERANCE as g, PATH_C as _, PATH_CMD_LENGTHS as v, PATH_L as y, PATH_M as b, PATH_Q as x, PATH_Z as S, PathBuilder as C, boundsOfPath as w, composePath as T, decomposePath as E, ellipsePath as D, flattenCubic as O, flattenCubicWithArcLen as k, flattenQuadratic as A, flattenQuadraticWithArcLen as j, linePath as M, pathCommandCoordCount as N, pathContainsPoint as P, pathContainsPolygon as F, pathContainsRect as I, pathDistanceToPoint as L, pathFromD as R, pathIntersectsPolygon as z, pathIntersectsRect as B, pathSignedArea as V, pointAlongPath as H, pointInPath as U, polygonFromPoints as W, polylineFromPoints as G, rectPath as K, regularPolygonPath as q, reversePath as J, scalePathToBounds as Y, splitSubpaths as X, starPath as Z, transformPath as Q, translatePath as $, unionBoundsPath as ee } from "@weasel-js/geom";
13
+ import { snipPathByPolyline as te, splitPathByPolyline as ne, splitPathBySegment as re } from "@weasel-js/geom/booleans";
14
+ import "@weasel-js/geom/curves";
15
+ export { g as DEFAULT_FLATTEN_TOLERANCE, _ as PATH_C, v as PATH_CMD_LENGTHS, y as PATH_L, b as PATH_M, x as PATH_Q, S as PATH_Z, C as PathBuilder, w as boundsOfPath, c as circlePath, T as composePath, r as countPathAnchors, p as createPathEditingOverlayLayer, m as createPathLayer, f as createPenPreviewLayer, E as decomposePath, D as ellipsePath, O as flattenCubic, k as flattenCubicWithArcLen, A as flattenQuadratic, j as flattenQuadraticWithArcLen, M as linePath, N as pathCommandCoordCount, P as pathContainsPoint, F as pathContainsPolygon, I as pathContainsRect, L as pathDistanceToPoint, R as pathFromD, a as pathInPoseFrame, o as pathInWorld, z as pathIntersectsPolygon, B as pathIntersectsRect, h as pathOriginProjection, n as pathPoseDescriptor, V as pathSignedArea, i as pathToAnchors, H as pointAlongPath, U as pointInPath, W as polygonFromPoints, G as polylineFromPoints, e as poseRotationOf, l as rectMarkerPath, K as rectPath, q as regularPolygonPath, J as reversePath, t as rotatePathAround, u as roundRectPath, Y as scalePathToBounds, te as snipPathByPolyline, ne as splitPathByPolyline, re as splitPathBySegment, X as splitSubpaths, d as squarePath, Z as starPath, Q as transformPath, $ as translatePath, ee as unionBoundsPath, s as worldEditToStorage };
@@ -0,0 +1,116 @@
1
+ import { getMarker as e } from "../../core/strokeMarkers.js";
2
+ import { markerKeyOf as t, resolveMarkerSize as n } from "../../core/markerInset.js";
3
+ import { markerSites as r } from "./markerSites.js";
4
+ import { boundsOfPath as i } from "@weasel-js/geom";
5
+ import { extractPolylines as a } from "@weasel-js/geom/tessellate";
6
+ //#region src/features/paths/markerCommands.ts
7
+ function o(e, t) {
8
+ let n = e, r = Math.cos(t.angle), i = Math.sin(t.angle), a = new Float32Array(n.coords.length);
9
+ for (let e = 0; e < n.coords.length; e += 2) {
10
+ let o = n.coords[e], s = n.coords[e + 1];
11
+ a[e] = t.x + o * r - s * i, a[e + 1] = t.y + o * i + s * r;
12
+ }
13
+ return {
14
+ kind: "polygon",
15
+ commands: n.commands,
16
+ coords: a,
17
+ fillRule: n.fillRule
18
+ };
19
+ }
20
+ function s(e, t, n) {
21
+ let r = e ?? n;
22
+ if (r !== "none") return r === "line" ? t.paint : r;
23
+ }
24
+ function c(i, s, c, l) {
25
+ let u = {
26
+ start: s.markerStart !== void 0,
27
+ mid: s.markerMid !== void 0,
28
+ end: s.markerEnd !== void 0
29
+ };
30
+ if (!u.start && !u.mid && !u.end) return [];
31
+ let d = (e) => e === "start" ? s.markerStart : e === "mid" ? s.markerMid : s.markerEnd, f = [];
32
+ for (let p of a(i, { flattenTolerance: l })) for (let i of r(p, u)) {
33
+ let r = d(i.role);
34
+ if (r === void 0) continue;
35
+ let a = e(t(r));
36
+ if (a === void 0) continue;
37
+ let l = n(r, c), u = a.orient === void 0 || a.orient === "auto" ? i.angle : a.orient;
38
+ f.push({
39
+ entry: a,
40
+ size: l,
41
+ path: o(a.path({
42
+ size: l,
43
+ stroke: s
44
+ }), {
45
+ ...i,
46
+ angle: u
47
+ })
48
+ });
49
+ }
50
+ return f;
51
+ }
52
+ function l(e, t) {
53
+ let n = [];
54
+ for (let { entry: r, path: i, size: a } of e) {
55
+ let e = s(r.fill, t, "line"), o = r.outline ? {
56
+ paint: s(r.outline.paint, t, "line"),
57
+ width: r.outline.width * a
58
+ } : null;
59
+ (e !== void 0 || o !== null && o.paint !== void 0) && n.push({
60
+ kind: "path",
61
+ path: i,
62
+ ...e ? { fill: e } : {},
63
+ ...o && o.paint ? { stroke: {
64
+ paint: o.paint,
65
+ width: o.width,
66
+ cap: "round",
67
+ join: "round"
68
+ } } : {}
69
+ });
70
+ }
71
+ return n;
72
+ }
73
+ function u(e, t) {
74
+ if (e.reads === void 0) return null;
75
+ let n = "";
76
+ for (let r of e.reads) n += `${JSON.stringify(t[r]) ?? ""}|`;
77
+ return n;
78
+ }
79
+ var d = 64, f = /* @__PURE__ */ new WeakMap(), p = /* @__PURE__ */ new WeakMap();
80
+ function m(e, t) {
81
+ let n = i(e.path({
82
+ size: 1,
83
+ stroke: t
84
+ }));
85
+ return Math.max(Math.abs(n.x), Math.abs(n.x + n.width), Math.abs(n.y), Math.abs(n.y + n.height)) + (e.outline ? e.outline.width / 2 : 0);
86
+ }
87
+ function h(e, t) {
88
+ let n = u(e, t);
89
+ if (n === null) {
90
+ let n = p.get(e);
91
+ n === void 0 && p.set(e, n = /* @__PURE__ */ new WeakMap());
92
+ let r = n.get(t);
93
+ return r === void 0 && n.set(t, r = m(e, t)), r;
94
+ }
95
+ let r = f.get(e);
96
+ r === void 0 && f.set(e, r = /* @__PURE__ */ new Map());
97
+ let i = r.get(n);
98
+ return i === void 0 && (r.size >= d && r.clear(), r.set(n, i = m(e, t))), i;
99
+ }
100
+ function g(r, i, a = 1) {
101
+ let o = 0;
102
+ for (let s of [
103
+ r.markerStart,
104
+ r.markerMid,
105
+ r.markerEnd
106
+ ]) {
107
+ if (s === void 0) continue;
108
+ let c = e(t(s));
109
+ c !== void 0 && (o = Math.max(o, h(c, r) * n(s, i, a)));
110
+ }
111
+ return o;
112
+ }
113
+ //#endregion
114
+ export { l as headCommands, c as markerHeads, g as markerReach, u as markerReadsKey };
115
+
116
+ //# sourceMappingURL=markerCommands.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"markerCommands.js","names":["placed","src","path","cos","site","sin","coords","i","x","y","resolvePaint","v","p","fallback","stroke","markerHeads","want","refFor","role","out","pl","extractPolylines","markerSites","ref","entry","getMarker","markerKeyOf","size","resolveMarkerSize","strokeWidth","angle","headCommands","heads","fill","outline","markerReadsKey","key","field","READINGS_PER_ENTRY","REACH_BY_READING","REACH_BY_STROKE","measureUnitReach","b","boundsOfPath","unitReach","byStroke","reach","byReading","markerReach","scale"],"sources":["../../../src/features/paths/markerCommands.ts"],"sourcesContent":["/**\n * Turning a stroke's markers into draw commands.\n *\n * Separate `PathDrawCommand`s rather than triangles appended to the stroke\n * ribbon: an entry may carry a fill and an outline at once, or a paint that\n * differs from the line's, neither of which one mesh can express — and folding\n * them in would drag the whole marker vocabulary into the ribbon cache key.\n */\n\nimport type { MarkerRef, Stroke } from '@weasel-js/paint';\nimport { type Path, type PolygonPath, boundsOfPath } from '@weasel-js/geom';\nimport type { PathDrawCommand } from '../../renderer/DrawCommand';\nimport { getMarker, type MarkerEntry, type MarkerPaint } from '../../core/strokeMarkers';\nimport { markerKeyOf, resolveMarkerSize } from '../../core/markerInset';\nimport { extractPolylines } from '@weasel-js/geom/tessellate';\nimport { markerSites, type MarkerSite } from './markerSites';\n\n/** Rotate + translate a marker's geometry onto its site. */\nfunction placed(path: Path, site: MarkerSite): PolygonPath {\n const src = path as PolygonPath;\n const cos = Math.cos(site.angle);\n const sin = Math.sin(site.angle);\n const coords = new Float32Array(src.coords.length);\n for (let i = 0; i < src.coords.length; i += 2) {\n const x = src.coords[i], y = src.coords[i + 1];\n coords[i] = site.x + x * cos - y * sin;\n coords[i + 1] = site.y + x * sin + y * cos;\n }\n return { kind: 'polygon', commands: src.commands, coords, fillRule: src.fillRule };\n}\n\nfunction resolvePaint(p: MarkerPaint | undefined, stroke: Stroke, fallback: MarkerPaint) {\n const v = p ?? fallback;\n if (v === 'none') return undefined;\n return v === 'line' ? stroke.paint : v;\n}\n\n/** One head's placed geometry, before any paint is applied. */\nexport interface MarkerHead {\n readonly entry: MarkerEntry;\n readonly path: PolygonPath;\n readonly size: number;\n}\n\n/**\n * Every marker head for `path` under `stroke`, placed but unpainted.\n * `strokeWidth` is the already width-resolved stroke width; `flattenTolerance`\n * matches what the ribbon used, so heads land on the same flattened vertices\n * the stroke did.\n */\nexport function markerHeads(\n path: Path,\n stroke: Stroke,\n strokeWidth: number,\n flattenTolerance: number | undefined,\n): MarkerHead[] {\n const want = {\n start: stroke.markerStart !== undefined,\n mid: stroke.markerMid !== undefined,\n end: stroke.markerEnd !== undefined,\n };\n if (!want.start && !want.mid && !want.end) return [];\n\n const refFor = (role: MarkerSite['role']): MarkerRef | undefined =>\n role === 'start' ? stroke.markerStart : role === 'mid' ? stroke.markerMid : stroke.markerEnd;\n\n const out: MarkerHead[] = [];\n for (const pl of extractPolylines(path, { flattenTolerance })) {\n for (const site of markerSites(pl, want)) {\n const ref = refFor(site.role);\n if (ref === undefined) continue;\n const entry = getMarker(markerKeyOf(ref));\n if (entry === undefined) continue;\n const size = resolveMarkerSize(ref, strokeWidth);\n const angle = entry.orient === undefined || entry.orient === 'auto' ? site.angle : entry.orient;\n out.push({ entry, size, path: placed(entry.path({ size, stroke }), { ...site, angle }) });\n }\n }\n return out;\n}\n\n/** `heads` as draw commands in `stroke`'s paint. A head whose fill and outline\n * both resolve to no paint is dropped. */\nexport function headCommands(heads: readonly MarkerHead[], stroke: Stroke): PathDrawCommand[] {\n const out: PathDrawCommand[] = [];\n for (const { entry, path, size } of heads) {\n const fill = resolvePaint(entry.fill, stroke, 'line');\n const outline = entry.outline\n ? { paint: resolvePaint(entry.outline.paint, stroke, 'line'), width: entry.outline.width * size }\n : null;\n if (fill === undefined && (outline === null || outline.paint === undefined)) continue;\n out.push({\n kind: 'path',\n path,\n ...(fill ? { fill } : {}),\n ...(outline && outline.paint\n ? { stroke: { paint: outline.paint, width: outline.width, cap: 'round', join: 'round' } }\n : {}),\n });\n }\n return out;\n}\n\n/** Every marker command for `path` under `stroke`; see {@link markerHeads}. */\nexport function markerDrawCommands(\n path: Path,\n stroke: Stroke,\n strokeWidth: number,\n flattenTolerance: number | undefined,\n): PathDrawCommand[] {\n return headCommands(markerHeads(path, stroke, strokeWidth, flattenTolerance), stroke);\n}\n\n/**\n * A key for the stroke fields `entry`'s geometry reads, or `null` when the\n * entry does not say which it reads and only the stroke's identity can stand\n * in for them.\n */\nexport function markerReadsKey(entry: MarkerEntry, stroke: Stroke): string | null {\n if (entry.reads === undefined) return null;\n let key = '';\n for (const field of entry.reads) key += `${JSON.stringify(stroke[field]) ?? ''}|`;\n return key;\n}\n\n/** Distinct stroke readings kept per entry before its map is dropped. */\nconst READINGS_PER_ENTRY = 64;\n\n/** Each entry's farthest reach from its anchor at `size` 1, outline included,\n * per value of the fields it reads — or per stroke object, when it does not\n * say which. */\nconst REACH_BY_READING = new WeakMap<MarkerEntry, Map<string, number>>();\nconst REACH_BY_STROKE = new WeakMap<MarkerEntry, WeakMap<Stroke, number>>();\n\nfunction measureUnitReach(entry: MarkerEntry, stroke: Stroke): number {\n const b = boundsOfPath(entry.path({ size: 1, stroke }));\n return Math.max(Math.abs(b.x), Math.abs(b.x + b.width), Math.abs(b.y), Math.abs(b.y + b.height))\n + (entry.outline ? entry.outline.width / 2 : 0);\n}\n\nfunction unitReach(entry: MarkerEntry, stroke: Stroke): number {\n const key = markerReadsKey(entry, stroke);\n if (key === null) {\n let byStroke = REACH_BY_STROKE.get(entry);\n if (byStroke === undefined) REACH_BY_STROKE.set(entry, (byStroke = new WeakMap()));\n let reach = byStroke.get(stroke);\n if (reach === undefined) byStroke.set(stroke, (reach = measureUnitReach(entry, stroke)));\n return reach;\n }\n let byReading = REACH_BY_READING.get(entry);\n if (byReading === undefined) REACH_BY_READING.set(entry, (byReading = new Map()));\n let reach = byReading.get(key);\n if (reach === undefined) {\n if (byReading.size >= READINGS_PER_ENTRY) byReading.clear();\n byReading.set(key, (reach = measureUnitReach(entry, stroke)));\n }\n return reach;\n}\n\n/**\n * How far any of `stroke`'s markers can paint from the vertex it sits on, in\n * world units. `strokeWidth` is the resolved width and `scale` the view scale\n * a `{ px }` size resolves against. Culling and a path node's grab reach both\n * measure through here.\n */\nexport function markerReach(stroke: Stroke, strokeWidth: number, scale = 1): number {\n let reach = 0;\n for (const ref of [stroke.markerStart, stroke.markerMid, stroke.markerEnd]) {\n if (ref === undefined) continue;\n const entry = getMarker(markerKeyOf(ref));\n if (entry === undefined) continue;\n reach = Math.max(reach, unitReach(entry, stroke) * resolveMarkerSize(ref, strokeWidth, scale));\n }\n return reach;\n}\n"],"mappings":";;;;;;AAkBA,SAASA,EAAO,GAAY,GAA+B;CACzD,IAAMC,IAAMC,GACNC,IAAM,KAAK,IAAIC,EAAK,KAAK,GACzBC,IAAM,KAAK,IAAID,EAAK,KAAK,GACzBE,IAAS,IAAI,aAAaL,EAAI,OAAO,MAAM;CACjD,KAAK,IAAIM,IAAI,GAAGA,IAAIN,EAAI,OAAO,QAAQ,KAAK,GAAG;EAC7C,IAAMO,IAAIP,EAAI,OAAOM,IAAIE,IAAIR,EAAI,OAAOM,IAAI;EAE5C,AADA,EAAOA,KAAKH,EAAK,IAAII,IAAIL,IAAMM,IAAIJ,GACnC,EAAOE,IAAI,KAAKH,EAAK,IAAII,IAAIH,IAAMI,IAAIN;CACzC;CACA,OAAO;EAAE,MAAM;EAAW,UAAUF,EAAI;EAAU;EAAQ,UAAUA,EAAI;CAAS;AACnF;AAEA,SAASS,EAAa,GAA4B,GAAgB,GAAu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