@weasel-js/core 1.6.1 → 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.
- package/CHANGELOG.md +1006 -0
- package/README.md +28 -9
- package/dist/WeaselProvider.js +15 -0
- package/dist/WeaselProvider.js.map +1 -0
- package/dist/affordances/composeAffordanceLayer.js +224 -0
- package/dist/affordances/composeAffordanceLayer.js.map +1 -0
- package/dist/affordances/cornerResize.js +69 -0
- package/dist/affordances/cornerResize.js.map +1 -0
- package/dist/affordances/hitAffordanceRegions.js +138 -0
- package/dist/affordances/hitAffordanceRegions.js.map +1 -0
- package/dist/affordances/pathAnchors.js +66 -0
- package/dist/affordances/pathAnchors.js.map +1 -0
- package/dist/affordances/rotationHandle.js +103 -0
- package/dist/affordances/rotationHandle.js.map +1 -0
- package/dist/animation/behaviors/momentum.js +118 -0
- package/dist/animation/behaviors/momentum.js.map +1 -0
- package/dist/animation/colorHelpers.js +135 -0
- package/dist/animation/colorHelpers.js.map +1 -0
- package/dist/animation/colorRegistry.js +37 -0
- package/dist/animation/colorRegistry.js.map +1 -0
- package/dist/animation/index.js +20 -0
- package/dist/animation/loop.js +62 -0
- package/dist/animation/loop.js.map +1 -0
- package/dist/animation/observe.js +23 -0
- package/dist/animation/observe.js.map +1 -0
- package/dist/animation/poseHelpers.js +50 -0
- package/dist/animation/poseHelpers.js.map +1 -0
- package/dist/animation/reflow.js +121 -0
- package/dist/animation/reflow.js.map +1 -0
- package/dist/animation/rig/bindRig.js +74 -0
- package/dist/animation/rig/bindRig.js.map +1 -0
- package/dist/animation/rig/blendPoses.js +43 -0
- package/dist/animation/rig/blendPoses.js.map +1 -0
- package/dist/animation/rig/mirrorPose.js +19 -0
- package/dist/animation/rig/mirrorPose.js.map +1 -0
- package/dist/animation/rig/resolveSkeleton.js +33 -0
- package/dist/animation/rig/resolveSkeleton.js.map +1 -0
- package/dist/animation/rig/solveIk.js +103 -0
- package/dist/animation/rig/solveIk.js.map +1 -0
- package/dist/animation/rig/types.js +12 -0
- package/dist/animation/rig/types.js.map +1 -0
- package/dist/animation/rig/useRig.js +23 -0
- package/dist/animation/rig/useRig.js.map +1 -0
- package/dist/animation/slew.js +27 -0
- package/dist/animation/slew.js.map +1 -0
- package/dist/animation/stagger.js +138 -0
- package/dist/animation/stagger.js.map +1 -0
- package/dist/animation/timeline/booking.js +106 -0
- package/dist/animation/timeline/booking.js.map +1 -0
- package/dist/animation/timeline/createTimeline.js +116 -0
- package/dist/animation/timeline/createTimeline.js.map +1 -0
- package/dist/animation/timeline/sampleTrack.js +29 -0
- package/dist/animation/timeline/sampleTrack.js.map +1 -0
- package/dist/animation/useAnimator.js +329 -0
- package/dist/animation/useAnimator.js.map +1 -0
- package/dist/animation/wrappers/animateLifecycle.js +40 -0
- package/dist/animation/wrappers/animateLifecycle.js.map +1 -0
- package/dist/animation/wrappers/animateOnSetPose.js +44 -0
- package/dist/animation/wrappers/animateOnSetPose.js.map +1 -0
- package/dist/{autoPoseDescriptor-_XOyF7t4.d.ts → autoPoseDescriptor-BT_vp9FO.d.ts} +2 -2
- package/dist/{builtins-HWyuLzE-.d.ts → builtins-BSUfH8nU.d.ts} +1301 -508
- package/dist/canvas/Canvas.js +608 -0
- package/dist/canvas/Canvas.js.map +1 -0
- package/dist/canvas/CanvasView.js +255 -0
- package/dist/canvas/CanvasView.js.map +1 -0
- package/dist/canvas/CursorCoordsHud.js +75 -0
- package/dist/canvas/CursorCoordsHud.js.map +1 -0
- package/dist/canvas/DrawCanvas.js +67 -0
- package/dist/canvas/DrawCanvas.js.map +1 -0
- package/dist/canvas/MinimapCanvas.js +139 -0
- package/dist/canvas/MinimapCanvas.js.map +1 -0
- package/dist/canvas/ModalityHud.js +66 -0
- package/dist/canvas/ModalityHud.js.map +1 -0
- package/dist/canvas/NodeShape.js +391 -0
- package/dist/canvas/NodeShape.js.map +1 -0
- package/dist/canvas/PickHud.js +93 -0
- package/dist/canvas/PickHud.js.map +1 -0
- package/dist/canvas/SceneCanvas/ActionsProviderIfRoot.js +10 -0
- package/dist/canvas/SceneCanvas/ActionsProviderIfRoot.js.map +1 -0
- package/dist/canvas/SceneCanvas/DepRegistryProviderIfRoot.js +10 -0
- package/dist/canvas/SceneCanvas/DepRegistryProviderIfRoot.js.map +1 -0
- package/dist/canvas/SceneCanvas/PointerProviderIfRoot.js +51 -0
- package/dist/canvas/SceneCanvas/PointerProviderIfRoot.js.map +1 -0
- package/dist/canvas/SceneCanvas/contributionFrameHooks.js +42 -0
- package/dist/canvas/SceneCanvas/contributionFrameHooks.js.map +1 -0
- package/dist/canvas/SceneCanvas/defaultNodeProperties.js +549 -0
- package/dist/canvas/SceneCanvas/defaultNodeProperties.js.map +1 -0
- package/dist/canvas/SceneCanvas/defaultNodeRouting.js +26 -0
- package/dist/canvas/SceneCanvas/defaultNodeRouting.js.map +1 -0
- package/dist/canvas/SceneCanvas/dispatcherGestureBounds.js +69 -0
- package/dist/canvas/SceneCanvas/dispatcherGestureBounds.js.map +1 -0
- package/dist/canvas/SceneCanvas/features.js +97 -0
- package/dist/canvas/SceneCanvas/features.js.map +1 -0
- package/dist/canvas/SceneCanvas/poseGeometry.js +46 -0
- package/dist/canvas/SceneCanvas/poseGeometry.js.map +1 -0
- package/dist/canvas/SceneCanvas/useActionsPropResolver.js +48 -0
- package/dist/canvas/SceneCanvas/useActionsPropResolver.js.map +1 -0
- package/dist/canvas/SceneCanvas/useBuiltinShapeTools.js +70 -0
- package/dist/canvas/SceneCanvas/useBuiltinShapeTools.js.map +1 -0
- package/dist/canvas/SceneCanvas/useContributionRoles.js +75 -0
- package/dist/canvas/SceneCanvas/useContributionRoles.js.map +1 -0
- package/dist/canvas/SceneCanvas/useDispatcherOverlayLayer.js +172 -0
- package/dist/canvas/SceneCanvas/useDispatcherOverlayLayer.js.map +1 -0
- package/dist/canvas/SceneCanvas/usePreviewGhostLayer.js +69 -0
- package/dist/canvas/SceneCanvas/usePreviewGhostLayer.js.map +1 -0
- package/dist/canvas/SceneCanvas/useSceneSelectTool.js +127 -0
- package/dist/canvas/SceneCanvas/useSceneSelectTool.js.map +1 -0
- package/dist/canvas/SceneCanvas/useViewportActions.js +30 -0
- package/dist/canvas/SceneCanvas/useViewportActions.js.map +1 -0
- package/dist/canvas/SceneCanvas.js +992 -0
- package/dist/canvas/SceneCanvas.js.map +1 -0
- package/dist/canvas/SceneViewCanvas.js +54 -0
- package/dist/canvas/SceneViewCanvas.js.map +1 -0
- package/dist/canvas/accentColor.js +9 -0
- package/dist/canvas/accentColor.js.map +1 -0
- package/dist/canvas/affordanceAt.js +63 -0
- package/dist/canvas/affordanceAt.js.map +1 -0
- package/dist/canvas/buildSceneTree.js +65 -0
- package/dist/canvas/buildSceneTree.js.map +1 -0
- package/dist/canvas/canvasRenderer.js +89 -0
- package/dist/canvas/canvasRenderer.js.map +1 -0
- package/dist/canvas/colorOverrides.js +16 -0
- package/dist/canvas/colorOverrides.js.map +1 -0
- package/dist/canvas/defaultDrawOne.js +43 -0
- package/dist/canvas/defaultDrawOne.js.map +1 -0
- package/dist/canvas/deps/areaSelect.js +19 -0
- package/dist/canvas/deps/areaSelect.js.map +1 -0
- package/dist/canvas/deps/debug.js +9 -0
- package/dist/canvas/deps/debug.js.map +1 -0
- package/dist/canvas/deps/dispatcher.js +11 -0
- package/dist/canvas/deps/dispatcher.js.map +1 -0
- package/dist/canvas/deps/editAnchors.js +101 -0
- package/dist/canvas/deps/editAnchors.js.map +1 -0
- package/dist/canvas/deps/geometryProjection.js +11 -0
- package/dist/canvas/deps/geometryProjection.js.map +1 -0
- package/dist/canvas/deps/hitTestArea.js +51 -0
- package/dist/canvas/deps/hitTestArea.js.map +1 -0
- package/dist/canvas/deps/ingestion.js +31 -0
- package/dist/canvas/deps/ingestion.js.map +1 -0
- package/dist/canvas/deps/insert.js +116 -0
- package/dist/canvas/deps/insert.js.map +1 -0
- package/dist/canvas/deps/lassoSelect.js +20 -0
- package/dist/canvas/deps/lassoSelect.js.map +1 -0
- package/dist/canvas/deps/layout.js +34 -0
- package/dist/canvas/deps/layout.js.map +1 -0
- package/dist/canvas/deps/nodeAtPoint.js +19 -0
- package/dist/canvas/deps/nodeAtPoint.js.map +1 -0
- package/dist/canvas/deps/poseComposition.js +11 -0
- package/dist/canvas/deps/poseComposition.js.map +1 -0
- package/dist/canvas/deps/poseDescriptor.js +12 -0
- package/dist/canvas/deps/poseDescriptor.js.map +1 -0
- package/dist/canvas/deps/resizePolicy.js +35 -0
- package/dist/canvas/deps/resizePolicy.js.map +1 -0
- package/dist/canvas/deps/slice.js +99 -0
- package/dist/canvas/deps/slice.js.map +1 -0
- package/dist/canvas/deps/snap.js +11 -0
- package/dist/canvas/deps/snap.js.map +1 -0
- package/dist/canvas/deps/textEdit.js +21 -0
- package/dist/canvas/deps/textEdit.js.map +1 -0
- package/dist/canvas/deps/view.js +43 -0
- package/dist/canvas/deps/view.js.map +1 -0
- package/dist/canvas/derivedPath.js +47 -0
- package/dist/canvas/derivedPath.js.map +1 -0
- package/dist/canvas/drawEnvelope.js +22 -0
- package/dist/canvas/drawEnvelope.js.map +1 -0
- package/dist/canvas/getNodeAtPoint.js +18 -0
- package/dist/canvas/getNodeAtPoint.js.map +1 -0
- package/dist/canvas/hostAnchor.js +29 -0
- package/dist/canvas/hostAnchor.js.map +1 -0
- package/dist/canvas/hud.module.js +18 -0
- package/dist/canvas/hud.module.js.map +1 -0
- package/dist/canvas/insertPreviewExtent.js +103 -0
- package/dist/canvas/insertPreviewExtent.js.map +1 -0
- package/dist/canvas/kitRequirements.js +177 -0
- package/dist/canvas/kitRequirements.js.map +1 -0
- package/dist/canvas/layerOrder.js +66 -0
- package/dist/canvas/layerOrder.js.map +1 -0
- package/dist/canvas/layerSlots.js +14 -0
- package/dist/canvas/layerSlots.js.map +1 -0
- package/dist/canvas/minimapMath.js +80 -0
- package/dist/canvas/minimapMath.js.map +1 -0
- package/dist/canvas/mountedCanvases.js +20 -0
- package/dist/canvas/mountedCanvases.js.map +1 -0
- package/dist/canvas/overlayRoleStrokes.js +17 -0
- package/dist/canvas/overlayRoleStrokes.js.map +1 -0
- package/dist/canvas/paintCull.js +20 -0
- package/dist/canvas/paintCull.js.map +1 -0
- package/dist/canvas/pickWalk.js +158 -0
- package/dist/canvas/pickWalk.js.map +1 -0
- package/dist/canvas/planeClips.js +30 -0
- package/dist/canvas/planeClips.js.map +1 -0
- package/dist/canvas/poseRotation.js +35 -0
- package/dist/canvas/poseRotation.js.map +1 -0
- package/dist/canvas/rasterToPng.js +21 -0
- package/dist/canvas/rasterToPng.js.map +1 -0
- package/dist/canvas/renderDebugSnapshot.js +32 -0
- package/dist/canvas/renderDebugSnapshot.js.map +1 -0
- package/dist/canvas/renderNeeds.js +25 -0
- package/dist/canvas/renderNeeds.js.map +1 -0
- package/dist/canvas/renderSceneToPixels.js +143 -0
- package/dist/canvas/renderSceneToPixels.js.map +1 -0
- package/dist/canvas/sceneAdapter.js +270 -0
- package/dist/canvas/sceneAdapter.js.map +1 -0
- package/dist/canvas/sceneLayerPaint.js +37 -0
- package/dist/canvas/sceneLayerPaint.js.map +1 -0
- package/dist/canvas/sceneSlotWiring.js +20 -0
- package/dist/canvas/sceneSlotWiring.js.map +1 -0
- package/dist/canvas/sceneViewRender.js +72 -0
- package/dist/canvas/sceneViewRender.js.map +1 -0
- package/dist/canvas/slopsDebugLayer.js +61 -0
- package/dist/canvas/slopsDebugLayer.js.map +1 -0
- package/dist/canvas/surfaceContribution.js +15 -0
- package/dist/canvas/surfaceContribution.js.map +1 -0
- package/dist/canvas/toolPreview.js +39 -0
- package/dist/canvas/toolPreview.js.map +1 -0
- package/dist/canvas/useCanvasRenderer.js +11 -0
- package/dist/canvas/useCanvasRenderer.js.map +1 -0
- package/dist/canvas/useFrameLoop.js +60 -0
- package/dist/canvas/useFrameLoop.js.map +1 -0
- package/dist/canvas/useHostAnchor.js +71 -0
- package/dist/canvas/useHostAnchor.js.map +1 -0
- package/dist/canvas/useLateContentRedraw.js +21 -0
- package/dist/canvas/useLateContentRedraw.js.map +1 -0
- package/dist/canvas/useRedrawOn.js +21 -0
- package/dist/canvas/useRedrawOn.js.map +1 -0
- package/dist/canvas/useViewHelpers.js +120 -0
- package/dist/canvas/useViewHelpers.js.map +1 -0
- package/dist/canvas/viewInputs.js +17 -0
- package/dist/canvas/viewInputs.js.map +1 -0
- package/dist/canvas/viewRegistry.js +61 -0
- package/dist/canvas/viewRegistry.js.map +1 -0
- package/dist/canvas/wrapNodeOutput.js +14 -0
- package/dist/canvas/wrapNodeOutput.js.map +1 -0
- package/dist/clipboard.d.ts +10 -5
- package/dist/clipboard.js +3 -5
- package/dist/clone.d.ts +3 -3
- package/dist/clone.js +2 -5
- package/dist/core/adapters/arrayAdapter.js +85 -0
- package/dist/core/adapters/arrayAdapter.js.map +1 -0
- package/dist/core/adapters/useArrayAdapter.js +13 -0
- package/dist/core/adapters/useArrayAdapter.js.map +1 -0
- package/dist/core/applyOps.js +12 -0
- package/dist/core/applyOps.js.map +1 -0
- package/dist/core/device/index.js +4 -0
- package/dist/core/device/targets.js +17 -0
- package/dist/core/device/targets.js.map +1 -0
- package/dist/core/device/useDeviceProfile.js +75 -0
- package/dist/core/device/useDeviceProfile.js.map +1 -0
- package/dist/core/fillInPoseFrame.js +102 -0
- package/dist/core/fillInPoseFrame.js.map +1 -0
- package/dist/core/geometry/poseDescriptor.js +98 -0
- package/dist/core/geometry/poseDescriptor.js.map +1 -0
- package/dist/core/geometry/poseRotation.js +58 -0
- package/dist/core/geometry/poseRotation.js.map +1 -0
- package/dist/core/geometry/regionHit.js +102 -0
- package/dist/core/geometry/regionHit.js.map +1 -0
- package/dist/core/geometry/unionBounds.js +60 -0
- package/dist/core/geometry/unionBounds.js.map +1 -0
- package/dist/core/gradient.js +136 -0
- package/dist/core/gradient.js.map +1 -0
- package/dist/core/isPlainObject.js +11 -0
- package/dist/core/isPlainObject.js.map +1 -0
- package/dist/core/layers/render.js +150 -0
- package/dist/core/layers/render.js.map +1 -0
- package/dist/core/markerInset.js +24 -0
- package/dist/core/markerInset.js.map +1 -0
- package/dist/core/mixed.js +6 -0
- package/dist/core/mixed.js.map +1 -0
- package/dist/core/ops/arrange.js +31 -0
- package/dist/core/ops/arrange.js.map +1 -0
- package/dist/core/ops/create.js +32 -0
- package/dist/core/ops/create.js.map +1 -0
- package/dist/core/ops/createHistory.js +20 -0
- package/dist/core/ops/createHistory.js.map +1 -0
- package/dist/core/ops/delete.js +89 -0
- package/dist/core/ops/delete.js.map +1 -0
- package/dist/core/ops/registry.js +17 -0
- package/dist/core/ops/registry.js.map +1 -0
- package/dist/core/ops/reorder/algorithms.js +55 -0
- package/dist/core/ops/reorder/algorithms.js.map +1 -0
- package/dist/core/ops/reorder/index.js +140 -0
- package/dist/core/ops/reorder/index.js.map +1 -0
- package/dist/core/ops/reparent.js +52 -0
- package/dist/core/ops/reparent.js.map +1 -0
- package/dist/core/ops/select.js +34 -0
- package/dist/core/ops/select.js.map +1 -0
- package/dist/core/ops/setData.js +34 -0
- package/dist/core/ops/setData.js.map +1 -0
- package/dist/core/ops/setLayer.js +34 -0
- package/dist/core/ops/setLayer.js.map +1 -0
- package/dist/core/ops/setLayout.js +31 -0
- package/dist/core/ops/setLayout.js.map +1 -0
- package/dist/core/ops/setPath.js +57 -0
- package/dist/core/ops/setPath.js.map +1 -0
- package/dist/core/ops/setText.js +34 -0
- package/dist/core/ops/setText.js.map +1 -0
- package/dist/core/ops/slot.js +37 -0
- package/dist/core/ops/slot.js.map +1 -0
- package/dist/core/ops/transform.js +42 -0
- package/dist/core/ops/transform.js.map +1 -0
- package/dist/core/paintKinds.js +156 -0
- package/dist/core/paintKinds.js.map +1 -0
- package/dist/core/scene/NodeProperties.js +20 -0
- package/dist/core/scene/NodeProperties.js.map +1 -0
- package/dist/core/scene/NodeRouting.js +24 -0
- package/dist/core/scene/NodeRouting.js.map +1 -0
- package/dist/core/scene/arrivals.js +12 -0
- package/dist/core/scene/arrivals.js.map +1 -0
- package/dist/core/scene/composeFrame.js +29 -0
- package/dist/core/scene/composeFrame.js.map +1 -0
- package/dist/core/scene/depMemo.js +18 -0
- package/dist/core/scene/depMemo.js.map +1 -0
- package/dist/core/scene/dependents.js +66 -0
- package/dist/core/scene/dependents.js.map +1 -0
- package/dist/core/scene/derivedPath.js +31 -0
- package/dist/core/scene/derivedPath.js.map +1 -0
- package/dist/core/scene/effectivePose.js +78 -0
- package/dist/core/scene/effectivePose.js.map +1 -0
- package/dist/core/scene/kitRegistry.js +33 -0
- package/dist/core/scene/kitRegistry.js.map +1 -0
- package/dist/core/scene/layoutPass.js +96 -0
- package/dist/core/scene/layoutPass.js.map +1 -0
- package/dist/core/scene/nodeFnFields.js +83 -0
- package/dist/core/scene/nodeFnFields.js.map +1 -0
- package/dist/core/scene/nodeMemo.js +28 -0
- package/dist/core/scene/nodeMemo.js.map +1 -0
- package/dist/core/scene/poseFeed.js +87 -0
- package/dist/core/scene/poseFeed.js.map +1 -0
- package/dist/core/scene/poseOverrides.js +52 -0
- package/dist/core/scene/poseOverrides.js.map +1 -0
- package/dist/core/scene/poseSnapshot.js +54 -0
- package/dist/core/scene/poseSnapshot.js.map +1 -0
- package/dist/core/scene/scene.js +1271 -0
- package/dist/core/scene/scene.js.map +1 -0
- package/dist/core/scene/types.js +6 -0
- package/dist/core/scene/types.js.map +1 -0
- package/dist/core/scene/useScene.js +32 -0
- package/dist/core/scene/useScene.js.map +1 -0
- package/dist/core/selection/chromeState.js +31 -0
- package/dist/core/selection/chromeState.js.map +1 -0
- package/dist/core/selection/selectionTarget.js +6 -0
- package/dist/core/selection/selectionTarget.js.map +1 -0
- package/dist/core/selection/useSelection.js +71 -0
- package/dist/core/selection/useSelection.js.map +1 -0
- package/dist/core/shapeKinds.js +54 -0
- package/dist/core/shapeKinds.js.map +1 -0
- package/dist/core/strokeMarkerShapes.js +139 -0
- package/dist/core/strokeMarkerShapes.js.map +1 -0
- package/dist/core/strokeMarkers.js +28 -0
- package/dist/core/strokeMarkers.js.map +1 -0
- package/dist/core/stylus/stylus.js +39 -0
- package/dist/core/stylus/stylus.js.map +1 -0
- package/dist/core/stylus/usePointerStylus.js +51 -0
- package/dist/core/stylus/usePointerStylus.js.map +1 -0
- package/dist/core/usePaintKinds.js +17 -0
- package/dist/core/usePaintKinds.js.map +1 -0
- package/dist/core/viewport/clampView.js +24 -0
- package/dist/core/viewport/clampView.js.map +1 -0
- package/dist/core/viewport/clientToWorld.js +8 -0
- package/dist/core/viewport/clientToWorld.js.map +1 -0
- package/dist/core/viewport/createVelocityTracker.js +39 -0
- package/dist/core/viewport/createVelocityTracker.js.map +1 -0
- package/dist/core/viewport/fitToBounds.js +18 -0
- package/dist/core/viewport/fitToBounds.js.map +1 -0
- package/dist/core/viewport/fitViewToBounds.js +36 -0
- package/dist/core/viewport/fitViewToBounds.js.map +1 -0
- package/dist/core/viewport/interpolateView.js +34 -0
- package/dist/core/viewport/interpolateView.js.map +1 -0
- package/dist/core/viewport/meanScale.js +8 -0
- package/dist/core/viewport/meanScale.js.map +1 -0
- package/dist/core/viewport/parallax.js +111 -0
- package/dist/core/viewport/parallax.js.map +1 -0
- package/dist/core/viewport/pxExtent.js +42 -0
- package/dist/core/viewport/pxExtent.js.map +1 -0
- package/dist/core/viewport/sceneNodeClientRect.js +18 -0
- package/dist/core/viewport/sceneNodeClientRect.js.map +1 -0
- package/dist/core/viewport/screenSlop.js +27 -0
- package/dist/core/viewport/screenSlop.js.map +1 -0
- package/dist/core/viewport/useAutoCenter.js +32 -0
- package/dist/core/viewport/useAutoCenter.js.map +1 -0
- package/dist/core/viewport/useCanvasSize.js +29 -0
- package/dist/core/viewport/useCanvasSize.js.map +1 -0
- package/dist/core/viewport/useDecayLoop.js +63 -0
- package/dist/core/viewport/useDecayLoop.js.map +1 -0
- package/dist/core/viewport/useVelocityTracker.js +10 -0
- package/dist/core/viewport/useVelocityTracker.js.map +1 -0
- package/dist/core/viewport/useViewAnimation.js +63 -0
- package/dist/core/viewport/useViewAnimation.js.map +1 -0
- package/dist/core/viewport/view.js +37 -0
- package/dist/core/viewport/view.js.map +1 -0
- package/dist/core/viewport/viewTransform.js +11 -0
- package/dist/core/viewport/viewTransform.js.map +1 -0
- package/dist/core/viewport/viewportWorldRect.js +13 -0
- package/dist/core/viewport/viewportWorldRect.js.map +1 -0
- package/dist/core/viewport/wheelHandler.js +30 -0
- package/dist/core/viewport/wheelHandler.js.map +1 -0
- package/dist/core/viewport/zoomAt.js +22 -0
- package/dist/core/viewport/zoomAt.js.map +1 -0
- package/dist/core/viewport/zoomBounds.js +20 -0
- package/dist/core/viewport/zoomBounds.js.map +1 -0
- package/dist/{pointSnapToGrid-7mCcm6qG.d.ts → cornerHandles-CDcZOV8h.d.ts} +54 -71
- package/dist/debug/createDebugOverlayLayer.js +358 -0
- package/dist/debug/createDebugOverlayLayer.js.map +1 -0
- package/dist/debug/createDebugSink.js +83 -0
- package/dist/debug/createDebugSink.js.map +1 -0
- package/dist/debug/defaultTheme.js +31 -0
- package/dist/debug/defaultTheme.js.map +1 -0
- package/dist/debug/flag.js +41 -0
- package/dist/debug/flag.js.map +1 -0
- package/dist/debug/frameStats.js +16 -0
- package/dist/debug/frameStats.js.map +1 -0
- package/dist/debug/parseDebugFlags.js +32 -0
- package/dist/debug/parseDebugFlags.js.map +1 -0
- package/dist/features/chrome-caps/buildChromeCtx.js +16 -0
- package/dist/features/chrome-caps/buildChromeCtx.js.map +1 -0
- package/dist/features/chrome-caps/conditions.js +36 -0
- package/dist/features/chrome-caps/conditions.js.map +1 -0
- package/dist/features/chrome-caps/defaults.js +26 -0
- package/dist/features/chrome-caps/defaults.js.map +1 -0
- package/dist/features/chrome-caps/index.js +7 -0
- package/dist/features/chrome-caps/resolve.js +23 -0
- package/dist/features/chrome-caps/resolve.js.map +1 -0
- package/dist/features/chrome-caps/useHoverTracking.js +27 -0
- package/dist/features/chrome-caps/useHoverTracking.js.map +1 -0
- package/dist/features/cursor/paintedCursorLayer.js +60 -0
- package/dist/features/cursor/paintedCursorLayer.js.map +1 -0
- package/dist/features/focus/gateLayer.js +14 -0
- package/dist/features/focus/gateLayer.js.map +1 -0
- package/dist/features/focus/useCanvasFocus.js +29 -0
- package/dist/features/focus/useCanvasFocus.js.map +1 -0
- package/dist/features/groups/children.js +23 -0
- package/dist/features/groups/children.js.map +1 -0
- package/dist/features/groups/composePose.js +67 -0
- package/dist/features/groups/composePose.js.map +1 -0
- package/dist/features/groups/nestedHit.js +40 -0
- package/dist/features/groups/nestedHit.js.map +1 -0
- package/dist/features/groups/unionOfChildren.js +15 -0
- package/dist/features/groups/unionOfChildren.js.map +1 -0
- package/dist/features/images/imageCache.js +94 -0
- package/dist/features/images/imageCache.js.map +1 -0
- package/dist/features/ingestion/contentHandlers.js +37 -0
- package/dist/features/ingestion/contentHandlers.js.map +1 -0
- package/dist/features/ingestion/imageHandler.js +45 -0
- package/dist/features/ingestion/imageHandler.js.map +1 -0
- package/dist/features/ingestion/index.js +8 -0
- package/dist/features/ingestion/openFilePicker.js +15 -0
- package/dist/features/ingestion/openFilePicker.js.map +1 -0
- package/dist/features/ingestion/registerKitHandlers.js +26 -0
- package/dist/features/ingestion/registerKitHandlers.js.map +1 -0
- package/dist/features/ingestion/svgHandler.js +58 -0
- package/dist/features/ingestion/svgHandler.js.map +1 -0
- package/dist/features/ingestion/weaselJsonHandler.js +39 -0
- package/dist/features/ingestion/weaselJsonHandler.js.map +1 -0
- package/dist/features/longPress/longPressFeedback.js +96 -0
- package/dist/features/longPress/longPressFeedback.js.map +1 -0
- package/dist/features/meshPaint/bake.js +79 -0
- package/dist/features/meshPaint/bake.js.map +1 -0
- package/dist/features/meshPaint/bakeCache.js +59 -0
- package/dist/features/meshPaint/bakeCache.js.map +1 -0
- package/dist/features/meshPaint/handles.js +86 -0
- package/dist/features/meshPaint/handles.js.map +1 -0
- package/dist/features/meshPaint/lazyKind.js +1298 -0
- package/dist/features/meshPaint/lazyKind.js.map +1 -0
- package/dist/features/meshPaint/meshPaint.js +236 -0
- package/dist/features/meshPaint/meshPaint.js.map +1 -0
- package/dist/features/meshPaint/meshShader.js +6 -0
- package/dist/features/meshPaint/meshShader.js.map +1 -0
- package/dist/features/meshPaint/register.js +7 -0
- package/dist/features/meshPaint/register.js.map +1 -0
- package/dist/features/meshPaint/surface.js +110 -0
- package/dist/features/meshPaint/surface.js.map +1 -0
- package/dist/features/minimap/actions.js +53 -0
- package/dist/features/minimap/actions.js.map +1 -0
- package/dist/features/minimap/createMinimapContribution.js +96 -0
- package/dist/features/minimap/createMinimapContribution.js.map +1 -0
- package/dist/features/minimap/layers.js +103 -0
- package/dist/features/minimap/layers.js.map +1 -0
- package/dist/features/modes/modeLayers.js +113 -0
- package/dist/features/modes/modeLayers.js.map +1 -0
- package/dist/features/overlays/useNodeOverlayFrame.js +103 -0
- package/dist/features/overlays/useNodeOverlayFrame.js.map +1 -0
- package/dist/features/parallax/createParallaxLayer.js +26 -0
- package/dist/features/parallax/createParallaxLayer.js.map +1 -0
- package/dist/features/parallax/createParallaxPlane.js +26 -0
- package/dist/features/parallax/createParallaxPlane.js.map +1 -0
- package/dist/features/paths/anchorEdits.js +156 -0
- package/dist/features/paths/anchorEdits.js.map +1 -0
- package/dist/features/paths/anchors.js +154 -0
- package/dist/features/paths/anchors.js.map +1 -0
- package/dist/features/paths/booleans.js +2 -0
- package/dist/features/paths/index.js +15 -0
- package/dist/features/paths/markerCommands.js +116 -0
- package/dist/features/paths/markerCommands.js.map +1 -0
- package/dist/features/paths/markerSites.js +59 -0
- package/dist/features/paths/markerSites.js.map +1 -0
- package/dist/features/paths/markers.js +95 -0
- package/dist/features/paths/markers.js.map +1 -0
- package/dist/features/paths/nearestAnchor.js +36 -0
- package/dist/features/paths/nearestAnchor.js.map +1 -0
- package/dist/features/paths/originProjection.js +16 -0
- package/dist/features/paths/originProjection.js.map +1 -0
- package/dist/features/paths/pathEditingOverlayLayer.js +137 -0
- package/dist/features/paths/pathEditingOverlayLayer.js.map +1 -0
- package/dist/features/paths/pathInWorld.js +41 -0
- package/dist/features/paths/pathInWorld.js.map +1 -0
- package/dist/features/paths/pathLayer.js +44 -0
- package/dist/features/paths/pathLayer.js.map +1 -0
- package/dist/features/paths/penPreviewLayer.js +220 -0
- package/dist/features/paths/penPreviewLayer.js.map +1 -0
- package/dist/features/paths/poseDescriptor.js +44 -0
- package/dist/features/paths/poseDescriptor.js.map +1 -0
- package/dist/features/paths/tessellate/stroke.js +230 -0
- package/dist/features/paths/tessellate/stroke.js.map +1 -0
- package/dist/features/patterns/index.js +23 -0
- package/dist/features/patterns/index.js.map +1 -0
- package/dist/features/patterns/patterns-builtin.js +38 -0
- package/dist/features/patterns/patterns-builtin.js.map +1 -0
- package/dist/features/patterns/resolveSpec.js +57 -0
- package/dist/features/patterns/resolveSpec.js.map +1 -0
- package/dist/features/patterns/tileGeometry.js +158 -0
- package/dist/features/patterns/tileGeometry.js.map +1 -0
- package/dist/features/pointer/PointerContext.js +45 -0
- package/dist/features/pointer/PointerContext.js.map +1 -0
- package/dist/features/poseRun/usePoseRun.js +70 -0
- package/dist/features/poseRun/usePoseRun.js.map +1 -0
- package/dist/features/selection/SelectionContext.js +46 -0
- package/dist/features/selection/SelectionContext.js.map +1 -0
- package/dist/features/selection/overlay.js +442 -0
- package/dist/features/selection/overlay.js.map +1 -0
- package/dist/features/simulation/createSimulation.js +61 -0
- package/dist/features/simulation/createSimulation.js.map +1 -0
- package/dist/features/simulation/types.js +6 -0
- package/dist/features/simulation/types.js.map +1 -0
- package/dist/features/simulation/useSimulation.js +74 -0
- package/dist/features/simulation/useSimulation.js.map +1 -0
- package/dist/features/text/domRuns.js +258 -0
- package/dist/features/text/domRuns.js.map +1 -0
- package/dist/features/text/fitTextPose.js +38 -0
- package/dist/features/text/fitTextPose.js.map +1 -0
- package/dist/features/text/hitTest.js +45 -0
- package/dist/features/text/hitTest.js.map +1 -0
- package/dist/features/text/renderLabel.js +14 -0
- package/dist/features/text/renderLabel.js.map +1 -0
- package/dist/features/text/runs/effectiveRangeStyle.js +66 -0
- package/dist/features/text/runs/effectiveRangeStyle.js.map +1 -0
- package/dist/features/text/runs/flagRange.js +53 -0
- package/dist/features/text/runs/flagRange.js.map +1 -0
- package/dist/features/text/runs/rangeStyle.js +135 -0
- package/dist/features/text/runs/rangeStyle.js.map +1 -0
- package/dist/features/text/textCommand.js +59 -0
- package/dist/features/text/textCommand.js.map +1 -0
- package/dist/features/text/textLayer.js +35 -0
- package/dist/features/text/textLayer.js.map +1 -0
- package/dist/features/text/textToPath.js +181 -0
- package/dist/features/text/textToPath.js.map +1 -0
- package/dist/features/text/useSceneTextEdit.js +138 -0
- package/dist/features/text/useSceneTextEdit.js.map +1 -0
- package/dist/features/text/useTextEdit.js +465 -0
- package/dist/features/text/useTextEdit.js.map +1 -0
- package/dist/features/tiling/createTiledLayer.js +63 -0
- package/dist/features/tiling/createTiledLayer.js.map +1 -0
- package/dist/features/tiling/tiledProject.js +14 -0
- package/dist/features/tiling/tiledProject.js.map +1 -0
- package/dist/features/viewports/viewResolver.js +59 -0
- package/dist/features/viewports/viewResolver.js.map +1 -0
- package/dist/features/viewports/viewportLayer.js +58 -0
- package/dist/features/viewports/viewportLayer.js.map +1 -0
- package/dist/icons/ArrowIcon.js +23 -0
- package/dist/icons/ArrowIcon.js.map +1 -0
- package/dist/icons/EllipseIcon.js +21 -0
- package/dist/icons/EllipseIcon.js.map +1 -0
- package/dist/icons/EyedropperIcon.js +49 -0
- package/dist/icons/EyedropperIcon.js.map +1 -0
- package/dist/icons/HandIcon.js +59 -0
- package/dist/icons/HandIcon.js.map +1 -0
- package/dist/icons/ImageIcon.js +34 -0
- package/dist/icons/ImageIcon.js.map +1 -0
- package/dist/icons/LassoIcon.js +22 -0
- package/dist/icons/LassoIcon.js.map +1 -0
- package/dist/icons/LineIcon.js +22 -0
- package/dist/icons/LineIcon.js.map +1 -0
- package/dist/icons/PenIcon.js +36 -0
- package/dist/icons/PenIcon.js.map +1 -0
- package/dist/icons/PencilIcon.js +25 -0
- package/dist/icons/PencilIcon.js.map +1 -0
- package/dist/icons/PolygonIcon.js +19 -0
- package/dist/icons/PolygonIcon.js.map +1 -0
- package/dist/icons/RectIcon.js +37 -0
- package/dist/icons/RectIcon.js.map +1 -0
- package/dist/icons/SelectIcon.js +20 -0
- package/dist/icons/SelectIcon.js.map +1 -0
- package/dist/icons/StarIcon.js +19 -0
- package/dist/icons/StarIcon.js.map +1 -0
- package/dist/icons/TextIcon.js +19 -0
- package/dist/icons/TextIcon.js.map +1 -0
- package/dist/icons/UnknownIcon.js +33 -0
- package/dist/icons/UnknownIcon.js.map +1 -0
- package/dist/icons/_base.js +12 -0
- package/dist/icons/_base.js.map +1 -0
- package/dist/index.css +2 -86
- package/dist/index.d.ts +2349 -2609
- package/dist/index.js +312 -13
- package/dist/input/keyState.js +76 -0
- package/dist/input/keyState.js.map +1 -0
- package/dist/input/useKeyState.js +22 -0
- package/dist/input/useKeyState.js.map +1 -0
- package/dist/interactions/actions/actionShortcuts.js +32 -0
- package/dist/interactions/actions/actionShortcuts.js.map +1 -0
- package/dist/interactions/actions/align/align.js +81 -0
- package/dist/interactions/actions/align/align.js.map +1 -0
- package/dist/interactions/actions/booleans/booleans.js +120 -0
- package/dist/interactions/actions/booleans/booleans.js.map +1 -0
- package/dist/interactions/actions/booleans/useBooleans.js +20 -0
- package/dist/interactions/actions/booleans/useBooleans.js.map +1 -0
- package/dist/interactions/actions/booleans/useBooleansAdapter.js +9 -0
- package/dist/interactions/actions/booleans/useBooleansAdapter.js.map +1 -0
- package/dist/interactions/actions/clipboard/clipboardOps.js +94 -0
- package/dist/interactions/actions/clipboard/clipboardOps.js.map +1 -0
- package/dist/interactions/actions/clipboard/materializePaste.js +25 -0
- package/dist/interactions/actions/clipboard/materializePaste.js.map +1 -0
- package/dist/interactions/actions/clipboard/wireFormat.js +43 -0
- package/dist/interactions/actions/clipboard/wireFormat.js.map +1 -0
- package/dist/interactions/actions/clone/behaviors/cloneByAltDrag.js +26 -0
- package/dist/interactions/actions/clone/behaviors/cloneByAltDrag.js.map +1 -0
- package/dist/interactions/actions/defaultCommitAdapter.js +42 -0
- package/dist/interactions/actions/defaultCommitAdapter.js.map +1 -0
- package/dist/interactions/actions/defaults/align.js +71 -0
- package/dist/interactions/actions/defaults/align.js.map +1 -0
- package/dist/interactions/actions/defaults/anchorEditing.js +235 -0
- package/dist/interactions/actions/defaults/anchorEditing.js.map +1 -0
- package/dist/interactions/actions/defaults/areaSelect.js +75 -0
- package/dist/interactions/actions/defaults/areaSelect.js.map +1 -0
- package/dist/interactions/actions/defaults/booleans.js +52 -0
- package/dist/interactions/actions/defaults/booleans.js.map +1 -0
- package/dist/interactions/actions/defaults/cancelGesture.js +24 -0
- package/dist/interactions/actions/defaults/cancelGesture.js.map +1 -0
- package/dist/interactions/actions/defaults/clearSelection.js +19 -0
- package/dist/interactions/actions/defaults/clearSelection.js.map +1 -0
- package/dist/interactions/actions/defaults/clipboard.js +78 -0
- package/dist/interactions/actions/defaults/clipboard.js.map +1 -0
- package/dist/interactions/actions/defaults/clone.js +96 -0
- package/dist/interactions/actions/defaults/clone.js.map +1 -0
- package/dist/interactions/actions/defaults/createOutlines.js +47 -0
- package/dist/interactions/actions/defaults/createOutlines.js.map +1 -0
- package/dist/interactions/actions/defaults/createPaintAction.js +85 -0
- package/dist/interactions/actions/defaults/createPaintAction.js.map +1 -0
- package/dist/interactions/actions/defaults/delete.js +61 -0
- package/dist/interactions/actions/defaults/delete.js.map +1 -0
- package/dist/interactions/actions/defaults/distribute.js +66 -0
- package/dist/interactions/actions/defaults/distribute.js.map +1 -0
- package/dist/interactions/actions/defaults/duplicate.js +83 -0
- package/dist/interactions/actions/defaults/duplicate.js.map +1 -0
- package/dist/interactions/actions/defaults/editAnchors.js +100 -0
- package/dist/interactions/actions/defaults/editAnchors.js.map +1 -0
- package/dist/interactions/actions/defaults/enterPathEdit.js +29 -0
- package/dist/interactions/actions/defaults/enterPathEdit.js.map +1 -0
- package/dist/interactions/actions/defaults/enterTextEdit.js +20 -0
- package/dist/interactions/actions/defaults/enterTextEdit.js.map +1 -0
- package/dist/interactions/actions/defaults/escape.js +26 -0
- package/dist/interactions/actions/defaults/escape.js.map +1 -0
- package/dist/interactions/actions/defaults/exitPathEdit.js +22 -0
- package/dist/interactions/actions/defaults/exitPathEdit.js.map +1 -0
- package/dist/interactions/actions/defaults/flip.js +119 -0
- package/dist/interactions/actions/defaults/flip.js.map +1 -0
- package/dist/interactions/actions/defaults/freshNodeId.js +10 -0
- package/dist/interactions/actions/defaults/freshNodeId.js.map +1 -0
- package/dist/interactions/actions/defaults/group.js +131 -0
- package/dist/interactions/actions/defaults/group.js.map +1 -0
- package/dist/interactions/actions/defaults/icons/actionGlyphIcons.js +40 -0
- package/dist/interactions/actions/defaults/icons/actionGlyphIcons.js.map +1 -0
- package/dist/interactions/actions/defaults/icons/actionGlyphs.js +10 -0
- package/dist/interactions/actions/defaults/icons/actionGlyphs.js.map +1 -0
- package/dist/interactions/actions/defaults/icons/alignIcons.js +173 -0
- package/dist/interactions/actions/defaults/icons/alignIcons.js.map +1 -0
- package/dist/interactions/actions/defaults/icons/booleanIcons.js +171 -0
- package/dist/interactions/actions/defaults/icons/booleanIcons.js.map +1 -0
- package/dist/interactions/actions/defaults/icons/distributeIcons.js +63 -0
- package/dist/interactions/actions/defaults/icons/distributeIcons.js.map +1 -0
- package/dist/interactions/actions/defaults/icons/editIcons.js +280 -0
- package/dist/interactions/actions/defaults/icons/editIcons.js.map +1 -0
- package/dist/interactions/actions/defaults/icons/outlineIcons.js +53 -0
- package/dist/interactions/actions/defaults/icons/outlineIcons.js.map +1 -0
- package/dist/interactions/actions/defaults/ingest.js +58 -0
- package/dist/interactions/actions/defaults/ingest.js.map +1 -0
- package/dist/interactions/actions/defaults/insert.js +288 -0
- package/dist/interactions/actions/defaults/insert.js.map +1 -0
- package/dist/interactions/actions/defaults/insertPathAnchor.js +50 -0
- package/dist/interactions/actions/defaults/insertPathAnchor.js.map +1 -0
- package/dist/interactions/actions/defaults/lassoSelect.js +156 -0
- package/dist/interactions/actions/defaults/lassoSelect.js.map +1 -0
- package/dist/interactions/actions/defaults/move.js +656 -0
- package/dist/interactions/actions/defaults/move.js.map +1 -0
- package/dist/interactions/actions/defaults/nudge.js +110 -0
- package/dist/interactions/actions/defaults/nudge.js.map +1 -0
- package/dist/interactions/actions/defaults/pinchZoom.js +63 -0
- package/dist/interactions/actions/defaults/pinchZoom.js.map +1 -0
- package/dist/interactions/actions/defaults/reorder.js +143 -0
- package/dist/interactions/actions/defaults/reorder.js.map +1 -0
- package/dist/interactions/actions/defaults/requiresSelection.js +10 -0
- package/dist/interactions/actions/defaults/requiresSelection.js.map +1 -0
- package/dist/interactions/actions/defaults/resize.js +332 -0
- package/dist/interactions/actions/defaults/resize.js.map +1 -0
- package/dist/interactions/actions/defaults/rotate.js +181 -0
- package/dist/interactions/actions/defaults/rotate.js.map +1 -0
- package/dist/interactions/actions/defaults/selectAll.js +27 -0
- package/dist/interactions/actions/defaults/selectAll.js.map +1 -0
- package/dist/interactions/actions/defaults/setFill.js +27 -0
- package/dist/interactions/actions/defaults/setFill.js.map +1 -0
- package/dist/interactions/actions/defaults/setFillOpacity.js +15 -0
- package/dist/interactions/actions/defaults/setFillOpacity.js.map +1 -0
- package/dist/interactions/actions/defaults/setStroke.js +36 -0
- package/dist/interactions/actions/defaults/setStroke.js.map +1 -0
- package/dist/interactions/actions/defaults/setStrokeOpacity.js +21 -0
- package/dist/interactions/actions/defaults/setStrokeOpacity.js.map +1 -0
- package/dist/interactions/actions/defaults/slice.js +39 -0
- package/dist/interactions/actions/defaults/slice.js.map +1 -0
- package/dist/interactions/actions/defaults/sliceOps.js +60 -0
- package/dist/interactions/actions/defaults/sliceOps.js.map +1 -0
- package/dist/interactions/actions/defaults/toolActivate.js +35 -0
- package/dist/interactions/actions/defaults/toolActivate.js.map +1 -0
- package/dist/interactions/actions/defaults/toolResetToDefault.js +26 -0
- package/dist/interactions/actions/defaults/toolResetToDefault.js.map +1 -0
- package/dist/interactions/actions/defaults/undoRedo.js +51 -0
- package/dist/interactions/actions/defaults/undoRedo.js.map +1 -0
- package/dist/interactions/actions/defaults/viewportDragPan.js +88 -0
- package/dist/interactions/actions/defaults/viewportDragPan.js.map +1 -0
- package/dist/interactions/actions/defaults/viewportWheelPan.js +57 -0
- package/dist/interactions/actions/defaults/viewportWheelPan.js.map +1 -0
- package/dist/interactions/actions/defaults/viewportZoom.js +143 -0
- package/dist/interactions/actions/defaults/viewportZoom.js.map +1 -0
- package/dist/interactions/actions/distribute/distribute.js +42 -0
- package/dist/interactions/actions/distribute/distribute.js.map +1 -0
- package/dist/interactions/actions/distribute/plan.js +29 -0
- package/dist/interactions/actions/distribute/plan.js.map +1 -0
- package/dist/interactions/actions/edit-anchors/geometry.js +61 -0
- package/dist/interactions/actions/edit-anchors/geometry.js.map +1 -0
- package/dist/interactions/actions/edit-anchors/handles.js +43 -0
- package/dist/interactions/actions/edit-anchors/handles.js.map +1 -0
- package/dist/interactions/actions/flip/helpers.js +35 -0
- package/dist/interactions/actions/flip/helpers.js.map +1 -0
- package/dist/interactions/actions/geometryProjection.js +18 -0
- package/dist/interactions/actions/geometryProjection.js.map +1 -0
- package/dist/interactions/actions/gestureLifecycle.js +44 -0
- package/dist/interactions/actions/gestureLifecycle.js.map +1 -0
- package/dist/interactions/actions/lasso-select/behaviors/selectFromLasso.js +39 -0
- package/dist/interactions/actions/lasso-select/behaviors/selectFromLasso.js.map +1 -0
- package/dist/interactions/actions/move/behaviors/snapBackOrDelete.js +36 -0
- package/dist/interactions/actions/move/behaviors/snapBackOrDelete.js.map +1 -0
- package/dist/interactions/actions/move/behaviors/snapToContainer.js +67 -0
- package/dist/interactions/actions/move/behaviors/snapToContainer.js.map +1 -0
- package/dist/interactions/actions/move/gestureAdapter.js +37 -0
- package/dist/interactions/actions/move/gestureAdapter.js.map +1 -0
- package/dist/interactions/actions/outlines/createOutlines.js +84 -0
- package/dist/interactions/actions/outlines/createOutlines.js.map +1 -0
- package/dist/interactions/actions/outlines/useCreateOutlinesAdapter.js +9 -0
- package/dist/interactions/actions/outlines/useCreateOutlinesAdapter.js.map +1 -0
- package/dist/interactions/actions/planeInput.js +168 -0
- package/dist/interactions/actions/planeInput.js.map +1 -0
- package/dist/interactions/actions/poseDescriptorDep.js +9 -0
- package/dist/interactions/actions/poseDescriptorDep.js.map +1 -0
- package/dist/interactions/actions/poseFrame.js +38 -0
- package/dist/interactions/actions/poseFrame.js.map +1 -0
- package/dist/interactions/actions/previewOverrides.js +25 -0
- package/dist/interactions/actions/previewOverrides.js.map +1 -0
- package/dist/interactions/actions/resize/autoPoseDescriptor.js +32 -0
- package/dist/interactions/actions/resize/autoPoseDescriptor.js.map +1 -0
- package/dist/interactions/actions/resize/behaviors/clampMinSize.js +18 -0
- package/dist/interactions/actions/resize/behaviors/clampMinSize.js.map +1 -0
- package/dist/interactions/actions/resize/behaviors/index.js +8 -0
- package/dist/interactions/actions/resize/behaviors/index.js.map +1 -0
- package/dist/interactions/actions/resize/behaviors/lockAspect.js +24 -0
- package/dist/interactions/actions/resize/behaviors/lockAspect.js.map +1 -0
- package/dist/interactions/actions/resize/cornerHandles.js +72 -0
- package/dist/interactions/actions/resize/cornerHandles.js.map +1 -0
- package/dist/interactions/actions/resolveOverlays.js +60 -0
- package/dist/interactions/actions/resolveOverlays.js.map +1 -0
- package/dist/interactions/actions/resolvePreviews.js +61 -0
- package/dist/interactions/actions/resolvePreviews.js.map +1 -0
- package/dist/interactions/actions/rotate/geometry.js +46 -0
- package/dist/interactions/actions/rotate/geometry.js.map +1 -0
- package/dist/interactions/actions/rotate/handle.js +27 -0
- package/dist/interactions/actions/rotate/handle.js.map +1 -0
- package/dist/interactions/actions/spatialReference.js +42 -0
- package/dist/interactions/actions/spatialReference.js.map +1 -0
- package/dist/interactions/actions/useStandardActions.js +142 -0
- package/dist/interactions/actions/useStandardActions.js.map +1 -0
- package/dist/interactions/gestures/dragGesture/dragGesture.js +111 -0
- package/dist/interactions/gestures/dragGesture/dragGesture.js.map +1 -0
- package/dist/interactions/gestures/dragRadial/dragRadial.js +117 -0
- package/dist/interactions/gestures/dragRadial/dragRadial.js.map +1 -0
- package/dist/interactions/gestures/dragRect/dragRect.js +164 -0
- package/dist/interactions/gestures/dragRect/dragRect.js.map +1 -0
- package/dist/interactions/gestures/handleDrag/handleDrag.js +46 -0
- package/dist/interactions/gestures/handleDrag/handleDrag.js.map +1 -0
- package/dist/interactions/gestures/pointerDrag/pointerDrag.js +118 -0
- package/dist/interactions/gestures/pointerDrag/pointerDrag.js.map +1 -0
- package/dist/interactions/gestures/shared/originProjection.js +42 -0
- package/dist/interactions/gestures/shared/originProjection.js.map +1 -0
- package/dist/interactions/gestures/shared/screenTolerance.js +21 -0
- package/dist/interactions/gestures/shared/screenTolerance.js.map +1 -0
- package/dist/interactions/gestures/shared/snap.js +24 -0
- package/dist/interactions/gestures/shared/snap.js.map +1 -0
- package/dist/interactions/gestures/thresholdDrag/thresholdDrag.js +30 -0
- package/dist/interactions/gestures/thresholdDrag/thresholdDrag.js.map +1 -0
- package/dist/layout/arrivals.js +36 -0
- package/dist/layout/arrivals.js.map +1 -0
- package/dist/{math-MCQcf_gc.d.ts → math-CUMxmZzn.d.ts} +8 -116
- package/dist/math.d.ts +4 -5
- package/dist/math.js +6 -4
- package/dist/mesh.d.ts +268 -0
- package/dist/mesh.js +7 -0
- package/dist/move.d.ts +7 -48
- package/dist/move.js +3 -142
- package/dist/originProjection-BSn4xiEy.d.ts +57 -0
- package/dist/patterns-builtin.js +3 -3
- package/dist/{poseDescriptor-rZa9W5hJ.d.ts → poseDescriptor-CjSXMf8X.d.ts} +3 -3
- package/dist/registerProgram-ateHDGjw.d.ts +193 -0
- package/dist/renderer/DrawCommand.js +6 -0
- package/dist/renderer/DrawCommand.js.map +1 -0
- package/dist/renderer/WeaselRenderer.js +328 -0
- package/dist/renderer/WeaselRenderer.js.map +1 -0
- package/dist/renderer/cache/GLImageCache.js +64 -0
- package/dist/renderer/cache/GLImageCache.js.map +1 -0
- package/dist/renderer/cache/GLMeshCache.js +102 -0
- package/dist/renderer/cache/GLMeshCache.js.map +1 -0
- package/dist/renderer/cache/GLTextureCache.js +51 -0
- package/dist/renderer/cache/GLTextureCache.js.map +1 -0
- package/dist/renderer/cache/GradientRampAtlas.js +82 -0
- package/dist/renderer/cache/GradientRampAtlas.js.map +1 -0
- package/dist/renderer/cache/cache.js +13 -0
- package/dist/renderer/cache/cache.js.map +1 -0
- package/dist/renderer/cache/markerCommandCache.js +59 -0
- package/dist/renderer/cache/markerCommandCache.js.map +1 -0
- package/dist/renderer/cache/outlineMeshCache.js +15 -0
- package/dist/renderer/cache/outlineMeshCache.js.map +1 -0
- package/dist/renderer/cache/outlineStrokeMeshCache.js +31 -0
- package/dist/renderer/cache/outlineStrokeMeshCache.js.map +1 -0
- package/dist/renderer/cache/strokeMeshCache.js +44 -0
- package/dist/renderer/cache/strokeMeshCache.js.map +1 -0
- package/dist/renderer/cullDrawCommands.js +89 -0
- package/dist/renderer/cullDrawCommands.js.map +1 -0
- package/dist/renderer/draw.js +1109 -0
- package/dist/renderer/draw.js.map +1 -0
- package/dist/renderer/drawBatch.js +168 -0
- package/dist/renderer/drawBatch.js.map +1 -0
- package/dist/renderer/effects/EffectTargets.js +45 -0
- package/dist/renderer/effects/EffectTargets.js.map +1 -0
- package/dist/renderer/effects/builtins.js +31 -0
- package/dist/renderer/effects/builtins.js.map +1 -0
- package/dist/renderer/effects/composite.js +9 -0
- package/dist/renderer/effects/composite.js.map +1 -0
- package/dist/renderer/effects/effectPrelude.js +10 -0
- package/dist/renderer/effects/effectPrelude.js.map +1 -0
- package/dist/renderer/effects/types.js +10 -0
- package/dist/renderer/effects/types.js.map +1 -0
- package/dist/renderer/index.js +19 -0
- package/dist/renderer/math/color.js +341 -0
- package/dist/renderer/math/color.js.map +1 -0
- package/dist/renderer/math/mat3.js +71 -0
- package/dist/renderer/math/mat3.js.map +1 -0
- package/dist/renderer/math/patternSpace.js +22 -0
- package/dist/renderer/math/patternSpace.js.map +1 -0
- package/dist/renderer/math/viewToMat3.js +19 -0
- package/dist/renderer/math/viewToMat3.js.map +1 -0
- package/dist/renderer/paintResources.js +18 -0
- package/dist/renderer/paintResources.js.map +1 -0
- package/dist/renderer/paintScratch.js +37 -0
- package/dist/renderer/paintScratch.js.map +1 -0
- package/dist/renderer/shaders/ShaderProgram.js +74 -0
- package/dist/renderer/shaders/ShaderProgram.js.map +1 -0
- package/dist/renderer/shaders/batchFill.js +118 -0
- package/dist/renderer/shaders/batchFill.js.map +1 -0
- package/dist/renderer/shaders/customPrelude.js +34 -0
- package/dist/renderer/shaders/customPrelude.js.map +1 -0
- package/dist/renderer/shaders/extractUniformNames.js +184 -0
- package/dist/renderer/shaders/extractUniformNames.js.map +1 -0
- package/dist/renderer/shaders/glyphPaint.js +61 -0
- package/dist/renderer/shaders/glyphPaint.js.map +1 -0
- package/dist/renderer/shaders/gradFill.js +30 -0
- package/dist/renderer/shaders/gradFill.js.map +1 -0
- package/dist/renderer/shaders/imageFill.js +14 -0
- package/dist/renderer/shaders/imageFill.js.map +1 -0
- package/dist/renderer/shaders/pathFill.js +13 -0
- package/dist/renderer/shaders/pathFill.js.map +1 -0
- package/dist/renderer/shaders/patternFill.js +24 -0
- package/dist/renderer/shaders/patternFill.js.map +1 -0
- package/dist/renderer/shaders/registerProgram.js +18 -0
- package/dist/renderer/shaders/registerProgram.js.map +1 -0
- package/dist/renderer/spriteSheet.js +14 -0
- package/dist/renderer/spriteSheet.js.map +1 -0
- package/dist/renderer/state/GroupState.js +77 -0
- package/dist/renderer/state/GroupState.js.map +1 -0
- package/dist/renderer/syntheticItalic.js +6 -0
- package/dist/renderer/syntheticItalic.js.map +1 -0
- package/dist/renderer/textures/registerTexture.js +14 -0
- package/dist/renderer/textures/registerTexture.js.map +1 -0
- package/dist/renderer.d.ts +18 -20
- package/dist/renderer.js +18 -13
- package/dist/resize.d.ts +10 -46
- package/dist/resize.js +7 -5
- package/dist/routing.d.ts +1 -1
- package/dist/routing.js +2 -3
- package/dist/scheduling/useVisibleRaf.js +69 -0
- package/dist/scheduling/useVisibleRaf.js.map +1 -0
- package/dist/test-hook/createTestHook.js +39 -0
- package/dist/test-hook/createTestHook.js.map +1 -0
- package/dist/test-hook/install.js +12 -0
- package/dist/test-hook/install.js.map +1 -0
- package/dist/test-seams-fYf6m5pu.d.ts +356 -0
- package/dist/test-seams.d.ts +6 -0
- package/dist/test-seams.js +3 -0
- package/dist/tools/builtin/ellipse/useEllipseTool.js +33 -0
- package/dist/tools/builtin/ellipse/useEllipseTool.js.map +1 -0
- package/dist/tools/builtin/eyedropper/useEyedropperTool.js +55 -0
- package/dist/tools/builtin/eyedropper/useEyedropperTool.js.map +1 -0
- package/dist/tools/builtin/hand/dragPanContribution.js +17 -0
- package/dist/tools/builtin/hand/dragPanContribution.js.map +1 -0
- package/dist/tools/builtin/hand/useHandTool.js +31 -0
- package/dist/tools/builtin/hand/useHandTool.js.map +1 -0
- package/dist/tools/builtin/image/useImageTool.js +41 -0
- package/dist/tools/builtin/image/useImageTool.js.map +1 -0
- package/dist/tools/builtin/lasso/useLassoTool.js +42 -0
- package/dist/tools/builtin/lasso/useLassoTool.js.map +1 -0
- package/dist/tools/builtin/line/useLineTool.js +33 -0
- package/dist/tools/builtin/line/useLineTool.js.map +1 -0
- package/dist/tools/builtin/pen/usePenTool.js +414 -0
- package/dist/tools/builtin/pen/usePenTool.js.map +1 -0
- package/dist/tools/builtin/pencil/usePencilTool.js +36 -0
- package/dist/tools/builtin/pencil/usePencilTool.js.map +1 -0
- package/dist/tools/builtin/pickTopMostHit.js +45 -0
- package/dist/tools/builtin/pickTopMostHit.js.map +1 -0
- package/dist/tools/builtin/polygon/usePolygonTool.js +81 -0
- package/dist/tools/builtin/polygon/usePolygonTool.js.map +1 -0
- package/dist/tools/builtin/rect/useRectTool.js +32 -0
- package/dist/tools/builtin/rect/useRectTool.js.map +1 -0
- package/dist/tools/builtin/select/selectionContributions.js +109 -0
- package/dist/tools/builtin/select/selectionContributions.js.map +1 -0
- package/dist/tools/builtin/select/useSelectTool.js +162 -0
- package/dist/tools/builtin/select/useSelectTool.js.map +1 -0
- package/dist/tools/builtin/shared/insertToolOptions.js +8 -0
- package/dist/tools/builtin/shared/insertToolOptions.js.map +1 -0
- package/dist/tools/builtin/slice/useSliceTool.js +263 -0
- package/dist/tools/builtin/slice/useSliceTool.js.map +1 -0
- package/dist/tools/builtin/star/useStarTool.js +82 -0
- package/dist/tools/builtin/star/useStarTool.js.map +1 -0
- package/dist/tools/builtin/text/useTextTool.js +177 -0
- package/dist/tools/builtin/text/useTextTool.js.map +1 -0
- package/dist/tools/overlayBinding.js +8 -0
- package/dist/tools/overlayBinding.js.map +1 -0
- package/dist/tools/prefs.js +47 -0
- package/dist/tools/prefs.js.map +1 -0
- package/dist/tools/useKeybindings.js +66 -0
- package/dist/tools/useKeybindings.js.map +1 -0
- package/dist/{types-CxC8P6W0.d.ts → types-CA54-mAZ.d.ts} +188 -17
- package/dist/{types-D_74YlWs.d.ts → types-DSjd6W3n.d.ts} +35 -12
- package/dist/util/color.js +26 -0
- package/dist/util/color.js.map +1 -0
- package/dist/util/constrainTo45.js +17 -0
- package/dist/util/constrainTo45.js.map +1 -0
- package/dist/util/paint.js +72 -0
- package/dist/util/paint.js.map +1 -0
- package/dist/version.js +6 -0
- package/dist/version.js.map +1 -0
- package/package.json +31 -18
- package/dist/chunk-44EWMJV2.js +0 -128
- package/dist/chunk-44EWMJV2.js.map +0 -1
- package/dist/chunk-4RJP2N2L.js +0 -143
- package/dist/chunk-4RJP2N2L.js.map +0 -1
- package/dist/chunk-BJN5ZRIJ.js +0 -167
- package/dist/chunk-BJN5ZRIJ.js.map +0 -1
- package/dist/chunk-D4AAWR64.js +0 -28
- package/dist/chunk-D4AAWR64.js.map +0 -1
- package/dist/chunk-DOBSZOPR.js +0 -29
- package/dist/chunk-DOBSZOPR.js.map +0 -1
- package/dist/chunk-H6N2JSZ3.js +0 -248
- package/dist/chunk-H6N2JSZ3.js.map +0 -1
- package/dist/chunk-HPFJUUTF.js +0 -167
- package/dist/chunk-HPFJUUTF.js.map +0 -1
- package/dist/chunk-L5YNZYEG.js +0 -648
- package/dist/chunk-L5YNZYEG.js.map +0 -1
- package/dist/chunk-MZAIDI6D.js +0 -32492
- package/dist/chunk-MZAIDI6D.js.map +0 -1
- package/dist/chunk-PNNZSYRD.js +0 -318
- package/dist/chunk-PNNZSYRD.js.map +0 -1
- package/dist/chunk-RMR4QMM6.js +0 -250
- package/dist/chunk-RMR4QMM6.js.map +0 -1
- package/dist/clipboard.js.map +0 -1
- package/dist/clone.js.map +0 -1
- package/dist/grid-BXdz8GF2.d.ts +0 -158
- package/dist/index.css.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/insert.d.ts +0 -37
- package/dist/insert.js +0 -81
- package/dist/insert.js.map +0 -1
- package/dist/math.js.map +0 -1
- package/dist/move.js.map +0 -1
- package/dist/options-CzjxFoYZ.d.ts +0 -67
- package/dist/path-JEV2c5If.d.ts +0 -48
- package/dist/patterns-builtin.js.map +0 -1
- package/dist/renderer.css +0 -86
- package/dist/renderer.css.map +0 -1
- package/dist/renderer.js.map +0 -1
- package/dist/resize.js.map +0 -1
- package/dist/routing.js.map +0 -1
- package/dist/types-D2tTKEU0.d.ts +0 -18
|
@@ -0,0 +1,356 @@
|
|
|
1
|
+
import { FillStyle, GradientUnits, GradStop, ColorSpace, MarkerKey, Stroke } from '@weasel-js/paint';
|
|
2
|
+
import { ComponentType } from 'react';
|
|
3
|
+
import { Reflection } from '@weasel-js/registry';
|
|
4
|
+
import { c as ShaderProgram, G as GlMat3, P as ProgramSource } from './registerProgram-ateHDGjw.js';
|
|
5
|
+
import { Path } from '@weasel-js/geom';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Resolve a `units: 'bounds'` gradient into the frame its node is painted in.
|
|
9
|
+
*
|
|
10
|
+
* Node painters bake the pose into their geometry (`pathInPoseFrame`) rather
|
|
11
|
+
* than emitting a per-node transform, so by the time the renderer sees a
|
|
12
|
+
* scene node there is no node-local space left for a gradient to refer to.
|
|
13
|
+
* This is the paint-side counterpart: it maps box-relative gradient geometry
|
|
14
|
+
* onto the same box the path was just projected into, so the two arrive in
|
|
15
|
+
* the renderer in one frame.
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
/** The box a `'bounds'` gradient's normalized geometry is mapped onto —
|
|
19
|
+
* usually a node's bounds. */
|
|
20
|
+
interface FillPoseBox {
|
|
21
|
+
x: number;
|
|
22
|
+
y: number;
|
|
23
|
+
width: number;
|
|
24
|
+
height: number;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Map a `'bounds'` gradient's `0..1` geometry onto `box`, returning it in the
|
|
28
|
+
* box's own frame (`units: 'local'`). Any other fill — solid, pattern, or a
|
|
29
|
+
* gradient in another space — is returned untouched.
|
|
30
|
+
*
|
|
31
|
+
* Radii scale by the box's normalized diagonal, SVG's rule for a percentage
|
|
32
|
+
* radius against `objectBoundingBox`: `sqrt(w² + h²) / sqrt(2)`, which is
|
|
33
|
+
* exactly `w` for a square box. The renderer's radial gradient is circular,
|
|
34
|
+
* so a non-square box cannot make it the ellipse SVG would — this keeps the
|
|
35
|
+
* radius proportionate instead.
|
|
36
|
+
*/
|
|
37
|
+
declare function fillInPoseFrame(fill: FillStyle, box: FillPoseBox): FillStyle;
|
|
38
|
+
/**
|
|
39
|
+
* Inverse of {@link fillInPoseFrame}: express a gradient already positioned
|
|
40
|
+
* in `box`'s frame as `0..1` fractions of that box (`units: 'bounds'`), so
|
|
41
|
+
* it follows the node when moved or resized.
|
|
42
|
+
*
|
|
43
|
+
* The importer's counterpart — SVG `userSpaceOnUse` coordinates arrive in
|
|
44
|
+
* page space, and normalizing them here makes an imported gradient behave
|
|
45
|
+
* exactly like one drawn in the app.
|
|
46
|
+
*
|
|
47
|
+
* A zero-width or zero-height box has no frame to normalize against; the
|
|
48
|
+
* fill is returned untouched rather than divided by zero.
|
|
49
|
+
*/
|
|
50
|
+
declare function fillToBoundsFrame(fill: FillStyle, box: FillPoseBox): FillStyle;
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* The paint-kind registry — what makes `FillStyle` open.
|
|
54
|
+
*
|
|
55
|
+
* A consumer registers a sixth kind and it renders, converts between the
|
|
56
|
+
* bounds and pose frames, and serializes, with no kit edits. The five built-in
|
|
57
|
+
* kinds are registered here at module load so an editor's kind bar can
|
|
58
|
+
* enumerate every kind through one list.
|
|
59
|
+
*
|
|
60
|
+
* Each kit layer consults this registry for a kind it does not recognize and
|
|
61
|
+
* otherwise runs its own built-in branch. That split is not laziness: a built-in
|
|
62
|
+
* kind's render slot lives in the GL renderer, its serialize slot lives in
|
|
63
|
+
* `@weasel-js/svg`, and neither can be imported from here without inverting a
|
|
64
|
+
* package dependency.
|
|
65
|
+
*/
|
|
66
|
+
|
|
67
|
+
/** A compiled GL program. A paint kind gets one from
|
|
68
|
+
* {@link PaintBindContext.program} and hands it back from `bind`. */
|
|
69
|
+
type PaintProgram = ShaderProgram;
|
|
70
|
+
/**
|
|
71
|
+
* `FillStyle`'s discriminant, open on the string the way `ChromeId` is: the
|
|
72
|
+
* five kinds the kit ships, plus whatever a consumer registers.
|
|
73
|
+
*/
|
|
74
|
+
type PaintKind = 'solid' | 'linear-gradient' | 'radial-gradient' | 'conic-gradient' | 'pattern' | (string & {});
|
|
75
|
+
/** What a registered kind's editor renders. `PaintInput` in `@weasel-js/ui`
|
|
76
|
+
* is the control that mounts it. */
|
|
77
|
+
interface PaintKindEditorProps {
|
|
78
|
+
value: FillStyle;
|
|
79
|
+
onInput?(next: FillStyle): void;
|
|
80
|
+
onChange(next: FillStyle): void;
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* The lifetime a paint kind's GPU state belongs to: one renderer on one live
|
|
84
|
+
* context. The object itself is the key — a kind caches textures in a
|
|
85
|
+
* `WeakMap` on it, so two renderers sharing a context never trade them — and
|
|
86
|
+
* `onRelease` is where it frees them.
|
|
87
|
+
*/
|
|
88
|
+
interface PaintResources {
|
|
89
|
+
/** Run `release` once, when this lifetime ends: the renderer is disposed, or
|
|
90
|
+
* its context was lost and restored. Free every GL object made under it
|
|
91
|
+
* there. */
|
|
92
|
+
onRelease(release: () => void): void;
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* The renderer surface a paint kind binds against, narrowed to what a paint
|
|
96
|
+
* needs. The full `DrawContext` is not consumer surface.
|
|
97
|
+
*/
|
|
98
|
+
interface PaintBindContext {
|
|
99
|
+
readonly gl: WebGL2RenderingContext;
|
|
100
|
+
/** The group alpha this draw inherits — multiply it into the paint's own. */
|
|
101
|
+
readonly alpha: number;
|
|
102
|
+
/**
|
|
103
|
+
* The compiled program for a `registerProgram` id, compiled against this
|
|
104
|
+
* renderer on first use. `null` when no source is registered under `id` or
|
|
105
|
+
* compilation failed.
|
|
106
|
+
*/
|
|
107
|
+
program(id: string): PaintProgram | null;
|
|
108
|
+
/** Send `u_proj` and `u_model`, which every kit vertex shader takes. */
|
|
109
|
+
setProjAndModel(program: PaintProgram): void;
|
|
110
|
+
/**
|
|
111
|
+
* `u_worldInv` for a paint declaring `units` — the inverse of the transform
|
|
112
|
+
* from the paint's space to the frame the geometry arrives in. Paired with
|
|
113
|
+
* the vertex shader's `v_world` varying this is *the* paint-space
|
|
114
|
+
* convention; it is not gradient-specific.
|
|
115
|
+
*
|
|
116
|
+
* `null` when that space has no inverse — a transform or view that flattens
|
|
117
|
+
* an axis. Nothing the paint draws there means anything, so `bind` should
|
|
118
|
+
* return `null` and draw nothing.
|
|
119
|
+
*/
|
|
120
|
+
spaceInverse(units: GradientUnits | undefined): GlMat3 | null;
|
|
121
|
+
/**
|
|
122
|
+
* The transform from the space `units` names to device pixels of the target
|
|
123
|
+
* this draw lands in — screen pixels times the pixel ratio on screen, output
|
|
124
|
+
* pixels in a headless render. It is what a paint baking a texture measures
|
|
125
|
+
* its resolution against. `null` where `spaceInverse` is.
|
|
126
|
+
*/
|
|
127
|
+
spaceToDevice(units: GradientUnits | undefined): GlMat3 | null;
|
|
128
|
+
/** The largest texture side this context accepts, `MAX_TEXTURE_SIZE`. */
|
|
129
|
+
readonly maxTextureSize: number;
|
|
130
|
+
/** The lifetime GPU state made for this draw belongs to. Stable across the
|
|
131
|
+
* frames of one renderer, so it is the key for a kind's texture cache. */
|
|
132
|
+
readonly resources: PaintResources;
|
|
133
|
+
/**
|
|
134
|
+
* Bake a stop ramp into the frame's ramp atlas, bind that atlas to a texture
|
|
135
|
+
* unit, and return the `v` the ramp's own row sits at — every ramp in a
|
|
136
|
+
* frame shares one texture, so a paint must sample at the returned `v` and
|
|
137
|
+
* not at a constant.
|
|
138
|
+
*
|
|
139
|
+
* `space` is the blend the stops are baked through, defaulting to `'rgb'`.
|
|
140
|
+
* It is part of the atlas key, so the same stops under two spaces take two
|
|
141
|
+
* rows rather than colliding.
|
|
142
|
+
*/
|
|
143
|
+
bindRamp(stops: GradStop[], unit: number, space?: ColorSpace): number;
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* One paint kind.
|
|
147
|
+
*
|
|
148
|
+
* `seed`, `label` and `colorOf` are the editor's slots and every kind has
|
|
149
|
+
* them. The rest are optional because a kind may not need them — but
|
|
150
|
+
* `inPoseFrame` and `toBoundsFrame` come as a pair or not at all: a kind that
|
|
151
|
+
* converts one direction and not the other paints correctly once and then
|
|
152
|
+
* drifts on the next resize.
|
|
153
|
+
*/
|
|
154
|
+
interface PaintKindEntry {
|
|
155
|
+
id: string;
|
|
156
|
+
label: string;
|
|
157
|
+
/** Glyph naming this kind in an editor's kind bar, as an icon name the UI
|
|
158
|
+
* layer resolves — the same indirection `ToolPrefBase.icon` uses. A kind
|
|
159
|
+
* without one is named by its `label`. */
|
|
160
|
+
icon?: string;
|
|
161
|
+
/** A paint of this kind seeded from a color — what an editor writes when a
|
|
162
|
+
* consumer switches a solid to this kind. */
|
|
163
|
+
seed(fromColor: string): FillStyle;
|
|
164
|
+
/** The single color this paint shows, or `undefined` when it has none. */
|
|
165
|
+
colorOf(paint: FillStyle): string | undefined;
|
|
166
|
+
/** Editor slot. */
|
|
167
|
+
Editor?: ComponentType<PaintKindEditorProps>;
|
|
168
|
+
/**
|
|
169
|
+
* The stop list this paint reads as. With `fromStops`, it is what makes a
|
|
170
|
+
* kind a gradient: `listGradientKinds` returns the kinds carrying both, and
|
|
171
|
+
* `switchGradientKind` converts between any two of them through the list.
|
|
172
|
+
*/
|
|
173
|
+
stopsOf?(paint: FillStyle): GradStop[];
|
|
174
|
+
/** A paint of this kind built from a stop list, in `bounds` units. The
|
|
175
|
+
* converse of `stopsOf`; supply both or neither. */
|
|
176
|
+
fromStops?(stops: GradStop[]): FillStyle;
|
|
177
|
+
/**
|
|
178
|
+
* Render slot: bind program, uniforms and textures for `fill` and return the
|
|
179
|
+
* bound program; `null` declines the paint.
|
|
180
|
+
*
|
|
181
|
+
* Binding is split from drawing on purpose — a caller owning its own stencil
|
|
182
|
+
* state (an inner/outer-aligned stroke, an even-odd fill) must issue its own
|
|
183
|
+
* draw call, and the kit's draw wrapper would clobber that state. Shader
|
|
184
|
+
* output must be premultiplied: `outColor = vec4(rgb * a, a)`.
|
|
185
|
+
*
|
|
186
|
+
* The geometry is not always the node's own. Text below the outline tier
|
|
187
|
+
* paints by drawing a quad over its glyphs' screen box into an offscreen
|
|
188
|
+
* buffer and masking that with glyph coverage, so a paint must come from
|
|
189
|
+
* `v_world` through `spaceInverse`, not from where `a_position` happens to
|
|
190
|
+
* lie.
|
|
191
|
+
*/
|
|
192
|
+
bind?(ctx: PaintBindContext, fill: FillStyle): PaintProgram | null;
|
|
193
|
+
/** Bounds frame → the frame the node is painted in. */
|
|
194
|
+
inPoseFrame?(fill: FillStyle, box: FillPoseBox): FillStyle;
|
|
195
|
+
/** The inverse. Required whenever `inPoseFrame` is supplied. */
|
|
196
|
+
toBoundsFrame?(fill: FillStyle, box: FillPoseBox): FillStyle;
|
|
197
|
+
/**
|
|
198
|
+
* The `<defs>` entry backing a `url(#id)` reference.
|
|
199
|
+
*
|
|
200
|
+
* SVG has paint servers for two gradients and a pattern and nothing else, so
|
|
201
|
+
* a kind beyond those has no element to target: write a foreign-namespaced
|
|
202
|
+
* one under the `wzl:` prefix `@weasel-js/svg` declares on the root whenever
|
|
203
|
+
* a document holds such a paint. That package emits the fallback color
|
|
204
|
+
* beside the reference on its own, from `colorOf`.
|
|
205
|
+
*/
|
|
206
|
+
toSvg?(id: string, fill: FillStyle): string;
|
|
207
|
+
/**
|
|
208
|
+
* Shader programs `bind` looks up through `ctx.program`, keyed by program
|
|
209
|
+
* id; registering the kind registers them. Declaring them here rather than
|
|
210
|
+
* calling `registerProgram` at import keeps a kind loaded by
|
|
211
|
+
* {@link registerPaintKindLoader} free of core's registries.
|
|
212
|
+
*/
|
|
213
|
+
programs?: Readonly<Record<string, ProgramSource>>;
|
|
214
|
+
}
|
|
215
|
+
/** Every registered paint kind, with the overrides each displaced. */
|
|
216
|
+
declare const paintKindRegistry: Reflection<PaintKindEntry>;
|
|
217
|
+
/**
|
|
218
|
+
* A consumer's own paint, typed as a `FillStyle`.
|
|
219
|
+
*
|
|
220
|
+
* `FillStyle` stays a closed union: opening its discriminant would widen every
|
|
221
|
+
* built-in member and break the narrowing the kit's own branches depend on.
|
|
222
|
+
* A registered kind declares its own interface instead and passes it through
|
|
223
|
+
* here — the kit reads only `fill` and hands the whole object back to that
|
|
224
|
+
* kind's slots.
|
|
225
|
+
*/
|
|
226
|
+
declare function asPaint<T extends {
|
|
227
|
+
fill: string;
|
|
228
|
+
}>(paint: T): FillStyle;
|
|
229
|
+
/** Register a paint kind. Returns a disposer that removes it. Re-registering an
|
|
230
|
+
* existing id is an override; disposing it uncovers whatever it displaced. */
|
|
231
|
+
declare function registerPaintKind(entry: PaintKindEntry): () => void;
|
|
232
|
+
/** The entry for `kind`, or `undefined`. A lookup that misses on a kind with
|
|
233
|
+
* a loader starts that load; see {@link registerPaintKindLoader}. */
|
|
234
|
+
declare function getPaintKind(kind: string | undefined): PaintKindEntry | undefined;
|
|
235
|
+
/** Resolves with the entry for a kind that is loaded on first use. */
|
|
236
|
+
type PaintKindLoader = () => Promise<PaintKindEntry>;
|
|
237
|
+
/**
|
|
238
|
+
* Declare a paint kind that is loaded the first time something looks it up,
|
|
239
|
+
* so its code stays out of the bundle until a paint of it appears — typically
|
|
240
|
+
* `() => import('./myKind').then((m) => m.myKindEntry)`.
|
|
241
|
+
*
|
|
242
|
+
* Until it lands the kind is unregistered: the renderer draws nothing for its
|
|
243
|
+
* paints, and every other reader treats it as unknown. Registering it fires
|
|
244
|
+
* `paintKindRegistry`'s subscribers, which is what `<SceneCanvas>` repaints
|
|
245
|
+
* on. Call {@link warmPaintKinds} to load ahead of the first frame instead.
|
|
246
|
+
*
|
|
247
|
+
* A kind that is already registered never calls its loader. Returns a
|
|
248
|
+
* disposer that removes the loader.
|
|
249
|
+
*/
|
|
250
|
+
declare function registerPaintKindLoader(id: string, load: PaintKindLoader): () => void;
|
|
251
|
+
/** Is `id` registered, or declared with a loader? */
|
|
252
|
+
declare function isPaintKindKnown(id: string): boolean;
|
|
253
|
+
/**
|
|
254
|
+
* Load paint kinds ahead of their first use, so the first frame that meets
|
|
255
|
+
* one draws it rather than a blank. With no list, loads every kind that has a
|
|
256
|
+
* loader — the kit's lazily loaded built-ins (`mesh-gradient`) plus any a
|
|
257
|
+
* consumer declared with {@link registerPaintKindLoader}.
|
|
258
|
+
*
|
|
259
|
+
* Resolves once every kind is registered; a kind already registered counts
|
|
260
|
+
* as loaded. Rejects when a load fails, or for a kind that is neither
|
|
261
|
+
* registered nor loadable.
|
|
262
|
+
*/
|
|
263
|
+
declare function warmPaintKinds(kinds?: readonly string[]): Promise<void>;
|
|
264
|
+
/** Every registered kind, built-ins first, in registration order. The same
|
|
265
|
+
* array until the registry changes. */
|
|
266
|
+
declare function listPaintKinds(): readonly PaintKindEntry[];
|
|
267
|
+
/** Every registered gradient kind — the ones that read as and build from a
|
|
268
|
+
* stop list — in registration order. The same array until the registry
|
|
269
|
+
* changes. */
|
|
270
|
+
declare function listGradientKinds(): readonly PaintKindEntry[];
|
|
271
|
+
/**
|
|
272
|
+
* `paint` retargeted to gradient kind `kind`, or `undefined` when either side
|
|
273
|
+
* is not a gradient kind.
|
|
274
|
+
*
|
|
275
|
+
* Between two of the stop gradients this is `withGradientKind`, which carries
|
|
276
|
+
* the geometry. Any other pair goes through the stop list — `stopsOf` on the
|
|
277
|
+
* way out, `fromStops` on the way in — keeping `interpolate` and `opacity`.
|
|
278
|
+
* Lossy wherever the kinds hold different information; an editor that wants a
|
|
279
|
+
* switch to be undoable should keep the original paint.
|
|
280
|
+
*/
|
|
281
|
+
declare function switchGradientKind(paint: FillStyle, kind: PaintKind): FillStyle | undefined;
|
|
282
|
+
/** The registry entry for a paint, or `undefined` when its kind is unknown. */
|
|
283
|
+
declare function paintKindOf(fill: FillStyle): PaintKindEntry | undefined;
|
|
284
|
+
/** @internal Test helper — do not call from product code. */
|
|
285
|
+
declare function _resetPaintKindsForTests(): void;
|
|
286
|
+
|
|
287
|
+
/**
|
|
288
|
+
* The stroke-marker registry — arrowheads and other line terminators.
|
|
289
|
+
*
|
|
290
|
+
* Keyed by string, because a key is what sits in `stroke.markerEnd`. That is
|
|
291
|
+
* the difference from `registerNodeShape`, which resolves by first-matching
|
|
292
|
+
* predicate and whose `id` is only a label.
|
|
293
|
+
*
|
|
294
|
+
* A built-in's SVG slot lives in `@weasel-js/svg` and cannot be imported here
|
|
295
|
+
* without inverting a package dependency, so an entry carries `toSvg` for that
|
|
296
|
+
* package to consume — the same split `PaintKindEntry` uses.
|
|
297
|
+
*/
|
|
298
|
+
|
|
299
|
+
/** What an entry's `path` is given. Entries that ignore it may return a
|
|
300
|
+
* constant path. */
|
|
301
|
+
interface MarkerCtx {
|
|
302
|
+
/** One geometry unit, in the same world units the ribbon is tessellated in.
|
|
303
|
+
* Defaults to the resolved stroke width. */
|
|
304
|
+
readonly size: number;
|
|
305
|
+
/** The stroke this marker belongs to, already width-resolved. */
|
|
306
|
+
readonly stroke: Stroke;
|
|
307
|
+
}
|
|
308
|
+
/** `'line'` means the stroke's own paint — SVG 2's `context-stroke`, as the
|
|
309
|
+
* default rather than an opt-in. */
|
|
310
|
+
type MarkerPaint = FillStyle | 'line' | 'none';
|
|
311
|
+
/** A stroke-marker registry entry: a terminator's geometry, paint and inset. */
|
|
312
|
+
interface MarkerEntry {
|
|
313
|
+
/** `'kit:'`-free for built-ins so the key matches the SVG attribute value;
|
|
314
|
+
* consumers should prefix (`'app-my-head'`). A key becomes the `id` of the
|
|
315
|
+
* emitted `<marker>` def, so it must be a valid XML name — no colons. */
|
|
316
|
+
id: MarkerKey;
|
|
317
|
+
/** Geometry with its anchor at the origin, pointing +X, in units of
|
|
318
|
+
* `ctx.size`. An arbitrary anchor is expressed by where the geometry is
|
|
319
|
+
* drawn, which is why there is no `refX`/`refY`. */
|
|
320
|
+
path(ctx: MarkerCtx): Path;
|
|
321
|
+
/** Default `'line'`. */
|
|
322
|
+
fill?: MarkerPaint;
|
|
323
|
+
/** Outline width is in the same units as `path`. `false` (the default)
|
|
324
|
+
* means no outline. */
|
|
325
|
+
outline?: {
|
|
326
|
+
width: number;
|
|
327
|
+
paint?: MarkerPaint;
|
|
328
|
+
} | false;
|
|
329
|
+
/** How far back along the line the stroke stops, in units of `ctx.size`.
|
|
330
|
+
* Default 0. A property of the shape, not a setting on the stroke: an open
|
|
331
|
+
* V needs 0 or its arms stop meeting the line. */
|
|
332
|
+
inset?: number;
|
|
333
|
+
/** `'auto'` (default) follows the line; a number is a fixed angle in
|
|
334
|
+
* radians, ignoring the line — SVG's `orient="<angle>"`. */
|
|
335
|
+
orient?: 'auto' | number;
|
|
336
|
+
/** The stroke fields `path` reads besides `ctx.size` — `[]` for a shape
|
|
337
|
+
* drawn from size alone. Declared, a head is reused across stroke objects
|
|
338
|
+
* whose listed fields are equal; omitted, only across frames that pass the
|
|
339
|
+
* same stroke object, since `path` might read any of it. */
|
|
340
|
+
reads?: readonly (keyof Stroke)[];
|
|
341
|
+
/** Emits the `<marker>` def. Consumed by `@weasel-js/svg`. */
|
|
342
|
+
toSvg?(id: string, entry: MarkerEntry): string;
|
|
343
|
+
}
|
|
344
|
+
/** Every registered marker, with the overrides each displaced. */
|
|
345
|
+
declare const markerRegistry: Reflection<MarkerEntry>;
|
|
346
|
+
/** Register a marker. Returns a disposer. Re-registering an existing id is an
|
|
347
|
+
* override; disposing it uncovers whatever it displaced rather than deleting the key. */
|
|
348
|
+
declare function registerMarker(entry: MarkerEntry): () => void;
|
|
349
|
+
/** The entry for `key`, or `undefined`. */
|
|
350
|
+
declare function getMarker(key: string | undefined): MarkerEntry | undefined;
|
|
351
|
+
/** Every registered marker, built-ins first, in registration order. */
|
|
352
|
+
declare function listMarkers(): readonly MarkerEntry[];
|
|
353
|
+
/** Test helper. Do not call from product code. */
|
|
354
|
+
declare function _resetMarkersForTests(): void;
|
|
355
|
+
|
|
356
|
+
export { type FillPoseBox as F, type MarkerEntry as M, type PaintKindEntry as P, _resetMarkersForTests as _, type MarkerCtx as a, type MarkerPaint as b, type PaintBindContext as c, type PaintKind as d, type PaintKindEditorProps as e, type PaintKindLoader as f, type PaintProgram as g, type PaintResources as h, asPaint as i, fillInPoseFrame as j, fillToBoundsFrame as k, getMarker as l, getPaintKind as m, isPaintKindKnown as n, listGradientKinds as o, listMarkers as p, listPaintKinds as q, markerRegistry as r, paintKindOf as s, paintKindRegistry as t, registerMarker as u, registerPaintKind as v, registerPaintKindLoader as w, switchGradientKind as x, warmPaintKinds as y, _resetPaintKindsForTests as z };
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { defineTool as e } from "../../overlayBinding.js";
|
|
2
|
+
import t from "../../../icons/EllipseIcon.js";
|
|
3
|
+
import { insertBindingBehaviors as n } from "../shared/insertToolOptions.js";
|
|
4
|
+
import { useMemo as r } from "react";
|
|
5
|
+
import { jsx as i } from "react/jsx-runtime";
|
|
6
|
+
import { cursorFor as a } from "@weasel-js/cursor";
|
|
7
|
+
//#region src/tools/builtin/ellipse/useEllipseTool.tsx
|
|
8
|
+
function o(o = {}) {
|
|
9
|
+
let { behaviors: s } = o;
|
|
10
|
+
return r(() => e({
|
|
11
|
+
id: "ellipse",
|
|
12
|
+
capabilities: ["creates-shapes"],
|
|
13
|
+
hookName: "useEllipseTool",
|
|
14
|
+
cursor: a("crosshairEllipse", { fallback: "crosshair" }),
|
|
15
|
+
presentation: {
|
|
16
|
+
label: "Ellipse",
|
|
17
|
+
group: "shape",
|
|
18
|
+
icon: /* @__PURE__ */ i(t, {})
|
|
19
|
+
},
|
|
20
|
+
bindings: [{
|
|
21
|
+
spec: { kind: "drag" },
|
|
22
|
+
actionId: "insert",
|
|
23
|
+
opts: {
|
|
24
|
+
params: { kind: "ellipse" },
|
|
25
|
+
...n(s)
|
|
26
|
+
}
|
|
27
|
+
}]
|
|
28
|
+
}), [s]);
|
|
29
|
+
}
|
|
30
|
+
//#endregion
|
|
31
|
+
export { o as useEllipseTool };
|
|
32
|
+
|
|
33
|
+
//# sourceMappingURL=useEllipseTool.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useEllipseTool.js","names":["EllipseIcon","useEllipseTool","options","useMemo","defineTool","cursorFor","insertBindingBehaviors","behaviors"],"sources":["../../../../src/tools/builtin/ellipse/useEllipseTool.tsx"],"sourcesContent":["import { useMemo } from 'react';\nimport { defineTool } from '../../overlayBinding';\nimport { EllipseIcon } from '../../../icons';\nimport type { Tool } from '../../overlayBinding';\nimport { insertBindingBehaviors, type InsertToolOptions } from '../shared/insertToolOptions';\nimport { cursorFor } from '@weasel-js/cursor';\n\n/**\n * Drag-to-draw ellipse tool. Mirrors `useRectTool`: the `drag` binding\n * routes to `insertAction`, which owns the live preview and commits\n * through the `insert` dep. Alt toggles from-corner ⇄ from-center\n * mid-drag via the action's live modifier read.\n */\nexport function useEllipseTool(options: InsertToolOptions = {}): Tool<null> {\n const { behaviors } = options;\n return useMemo(\n () =>\n defineTool<null>({\n id: 'ellipse',\n capabilities: ['creates-shapes'],\n hookName: 'useEllipseTool',\n cursor: cursorFor('crosshairEllipse', { fallback: 'crosshair' }),\n presentation: {\n label: 'Ellipse',\n group: 'shape',\n icon: <EllipseIcon />,\n },\n bindings: [\n {\n spec: { kind: 'drag' },\n actionId: 'insert',\n opts: { params: { kind: 'ellipse' } , ...insertBindingBehaviors(behaviors) },\n },\n ],\n }),\n [behaviors],\n );\n}\n"],"mappings":";;;;;;;AAaA,SAAgBC,EAAe,IAA6B,CAAC,GAAe;CAC1E,IAAM,EAAE,iBAAcC;CACtB,OAAOC,QAEHC,EAAiB;EACf,IAAI;EACJ,cAAc,CAAC,gBAAgB;EAC/B,UAAU;EACV,QAAQC,EAAU,oBAAoB,EAAE,UAAU,YAAY,CAAC;EAC/D,cAAc;GACZ,OAAO;GACP,OAAO;GACP,MAAM,kBAACL,GAAD,CAAc,CAAA;EACtB;EACA,UAAU,CACR;GACE,MAAM,EAAE,MAAM,OAAO;GACrB,UAAU;GACV,MAAM;IAAE,QAAQ,EAAE,MAAM,UAAU;IAAI,GAAGM,EAAuBC,CAAS;GAAE;EAC7E,CACF;CACF,CAAC,GACH,CAACA,CAAS,CACZ;AACF"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { defineTool as e } from "../../overlayBinding.js";
|
|
2
|
+
import t from "../../../icons/EyedropperIcon.js";
|
|
3
|
+
import { createElement as n, useMemo as r } from "react";
|
|
4
|
+
import { useLatest as i } from "@weasel-js/react";
|
|
5
|
+
import { cursorFor as a } from "@weasel-js/cursor";
|
|
6
|
+
//#region src/tools/builtin/eyedropper/useEyedropperTool.ts
|
|
7
|
+
function o(o) {
|
|
8
|
+
let s = i(o.onPick), c = i(o.colorOf), l = r(() => ({
|
|
9
|
+
id: "eyedropper.pick",
|
|
10
|
+
label: "Eyedropper — sample color",
|
|
11
|
+
eligible: { capability: "samples-color" },
|
|
12
|
+
requires: ["nodeAtPoint"],
|
|
13
|
+
invoker: {
|
|
14
|
+
timing: "immediate",
|
|
15
|
+
run: (e, t) => {
|
|
16
|
+
let n = t;
|
|
17
|
+
if (n?.pressX === void 0 || n.pressY === void 0) return;
|
|
18
|
+
let r = e.nodeAtPoint, i = r?.({
|
|
19
|
+
x: n.pressX,
|
|
20
|
+
y: n.pressY
|
|
21
|
+
}) ?? null;
|
|
22
|
+
i !== null && s.current(c.current(i));
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}), [s, c]);
|
|
26
|
+
return r(() => {
|
|
27
|
+
let r = o.keybinding === null ? void 0 : o.keybinding ?? { key: "I" }, i = o.hotkey === null ? void 0 : o.hotkey ?? "alt";
|
|
28
|
+
return e({
|
|
29
|
+
id: "eyedropper",
|
|
30
|
+
capabilities: ["samples-color"],
|
|
31
|
+
hookName: "useEyedropperTool",
|
|
32
|
+
keybinding: r,
|
|
33
|
+
hotkey: i,
|
|
34
|
+
cursor: a("eyedropper", { fallback: "crosshair" }),
|
|
35
|
+
presentation: {
|
|
36
|
+
label: "Eyedropper",
|
|
37
|
+
icon: n(t),
|
|
38
|
+
group: "view"
|
|
39
|
+
},
|
|
40
|
+
actions: [l],
|
|
41
|
+
bindings: [{
|
|
42
|
+
spec: { kind: "click" },
|
|
43
|
+
actionId: "eyedropper.pick"
|
|
44
|
+
}]
|
|
45
|
+
});
|
|
46
|
+
}, [
|
|
47
|
+
o.keybinding,
|
|
48
|
+
o.hotkey,
|
|
49
|
+
l
|
|
50
|
+
]);
|
|
51
|
+
}
|
|
52
|
+
//#endregion
|
|
53
|
+
export { o as useEyedropperTool };
|
|
54
|
+
|
|
55
|
+
//# sourceMappingURL=useEyedropperTool.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useEyedropperTool.js","names":["EyedropperIcon","useEyedropperTool","onPickRef","useLatest","opts","colorOfRef","pickAction","useMemo","p","params","nodeAtPoint","deps","id","keybinding","hotkey","defineTool","cursorFor","createElement"],"sources":["../../../../src/tools/builtin/eyedropper/useEyedropperTool.ts"],"sourcesContent":["import { useMemo, createElement } from 'react';\nimport { useLatest } from '@weasel-js/react';\nimport { defineTool } from '../../overlayBinding';\nimport type { Tool } from '../../overlayBinding';\nimport type { HotkeyTrigger } from '@weasel-js/routing';\nimport type { ToolKeybinding } from '@weasel-js/routing';\nimport type { Action } from '@weasel-js/routing';\nimport type { NodeAtPointDep } from 'interactions/actions/depSchema';\nimport { EyedropperIcon } from '../../../icons';\nimport { cursorFor } from '@weasel-js/cursor';\n\n/** Options for `useEyedropperTool`. */\nexport interface UseEyedropperToolOptions {\n /** Called when the user picks a color. `null` means \"no node was hit\n * with a color\" — currently only reachable when `colorOf` returns null\n * on a real hit; empty-click is a no-op in v1. */\n onPick: (color: string | null) => void;\n\n /** Map a node id to a color string, or `null` if the node has no color\n * to sample. Called on click with the id of the topmost node under the\n * click point. */\n colorOf: (id: string) => string | null;\n\n /** Override the default `{ key: 'I' }` keybinding. Pass `null` to omit\n * the keybinding entirely (palette-only or hotkey-only wiring). */\n keybinding?: ToolKeybinding | null;\n\n /** Override the default `'alt'` hotkey trigger. Pass `null` to omit. */\n hotkey?: HotkeyTrigger | null;\n}\n\n/**\n * Eyedropper. Click a node to sample its color; the consumer's `onPick`\n * callback decides where the color goes. Engages as a sticky active-slot\n * tool (`I` keybinding) and as a momentary hotkey-slot tool while Alt\n * is held — consumers can override either trigger to `null`.\n *\n * Pure-read tool — does NOT mutate the scene. v1 is click-only; drag is\n * unbound (a future drag-to-sample option is additive).\n *\n * The node under the click comes from the `nodeAtPoint` dep, so an\n * eyedropper in a consumer that never registered that dep samples nothing.\n * `<SceneCanvas>` sources it from the same picker the rest of the kit hits.\n */\nexport function useEyedropperTool(opts: UseEyedropperToolOptions): Tool<null> {\n const onPickRef = useLatest(opts.onPick);\n const colorOfRef = useLatest(opts.colorOf);\n\n // Registered by `useToolActions` from inside the ActionsProvider — see\n // `ToolDef.actions`. Closing over the option refs here is what lets the\n // consumer's `onPick` stay a plain callback instead of a dep.\n const pickAction = useMemo<Action>(\n () => ({\n id: 'eyedropper.pick',\n label: 'Eyedropper — sample color',\n // Same tag the tool declares, so a mode that disallows color sampling\n // can't be reached through the gesture either. The tool's own\n // eligibility already gates activation; this closes the gesture side.\n eligible: { capability: 'samples-color' },\n requires: ['nodeAtPoint'],\n invoker: {\n timing: 'immediate' as const,\n run: (deps, params) => {\n const p = params as { pressX?: number; pressY?: number } | undefined;\n if (p?.pressX === undefined || p.pressY === undefined) return;\n const nodeAtPoint = deps.nodeAtPoint as NodeAtPointDep | undefined;\n const id = nodeAtPoint?.({ x: p.pressX, y: p.pressY }) ?? null;\n // Empty click is a no-op in v1 — `onPick(null)` is reserved for\n // \"hit a node that has no color to sample.\"\n if (id === null) return;\n onPickRef.current(colorOfRef.current(id));\n },\n },\n }),\n [onPickRef, colorOfRef],\n );\n\n return useMemo(() => {\n // Resolve overrides. The spec says `null` => omit; defineTool reads\n // these directly into the returned Tool, and the registry treats\n // `undefined` as \"no trigger.\" Convert null → undefined here.\n const keybinding =\n opts.keybinding === null ? undefined : (opts.keybinding ?? { key: 'I' });\n const hotkey =\n opts.hotkey === null ? undefined : (opts.hotkey ?? 'alt');\n\n return defineTool<null>({\n id: 'eyedropper',\n capabilities: ['samples-color'],\n hookName: 'useEyedropperTool',\n keybinding,\n hotkey,\n cursor: cursorFor('eyedropper', { fallback: 'crosshair' }),\n presentation: {\n label: 'Eyedropper',\n icon: createElement(EyedropperIcon),\n group: 'view',\n },\n actions: [pickAction],\n // One binding, no target filter: the action resolves the node itself\n // and no-ops on empty. Sampling deliberately reads the PRESS point\n // rather than the release — a 4px drift between the two can land on a\n // different node, and the color you meant is the one you pressed.\n //\n // The eyedropper used to carry a `pointerDown` route that existed only\n // to claim the press before `useSelectTool`'s own always-claiming\n // pointerdown route could. That was an artifact of two dispatchers\n // racing; hotkey scope now outranks active scope in the one dispatcher\n // that remains, so holding Alt wins without a gate.\n bindings: [{ spec: { kind: 'click' as const }, actionId: 'eyedropper.pick' }],\n });\n }, [opts.keybinding, opts.hotkey, pickAction]);\n}\n"],"mappings":";;;;;;AA4CA,SAAgBC,EAAkB,GAA4C;CAC5E,IAAMC,IAAYC,EAAUC,EAAK,MAAM,GACjCC,IAAaF,EAAUC,EAAK,OAAO,GAKnCE,IAAaC,SACV;EACL,IAAI;EACJ,OAAO;EAIP,UAAU,EAAE,YAAY,gBAAgB;EACxC,UAAU,CAAC,aAAa;EACxB,SAAS;GACP,QAAQ;GACR,MAAM,GAAM,MAAW;IACrB,IAAMC,IAAIC;IACV,IAAID,GAAG,WAAW,KAAA,KAAaA,EAAE,WAAW,KAAA,GAAW;IACvD,IAAME,IAAcC,EAAK,aACnBC,IAAKF,IAAc;KAAE,GAAGF,EAAE;KAAQ,GAAGA,EAAE;IAAO,CAAC,KAAK;IAG1D,AAAII,MAAO,QACXV,EAAU,QAAQG,EAAW,QAAQO,CAAE,CAAC;GAC1C;EACF;CACF,IACA,CAACV,GAAWG,CAAU,CACxB;CAEA,OAAOE,QAAc;EAInB,IAAMM,IACJT,EAAK,eAAe,OAAO,KAAA,IAAaA,EAAK,cAAc,EAAE,KAAK,IAAI,GAClEU,IACJV,EAAK,WAAW,OAAO,KAAA,IAAaA,EAAK,UAAU;EAErD,OAAOW,EAAiB;GACtB,IAAI;GACJ,cAAc,CAAC,eAAe;GAC9B,UAAU;GACV;GACA;GACA,QAAQC,EAAU,cAAc,EAAE,UAAU,YAAY,CAAC;GACzD,cAAc;IACZ,OAAO;IACP,MAAMC,EAAcjB,CAAc;IAClC,OAAO;GACT;GACA,SAAS,CAACM,CAAU;GAWpB,UAAU,CAAC;IAAE,MAAM,EAAE,MAAM,QAAiB;IAAG,UAAU;GAAkB,CAAC;EAC9E,CAAC;CACH,GAAG;EAACF,EAAK;EAAYA,EAAK;EAAQE;CAAU,CAAC;AAC/C"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
//#region src/tools/builtin/hand/dragPanContribution.ts
|
|
2
|
+
var e = "viewport.dragPanBinding";
|
|
3
|
+
function t(t = {}) {
|
|
4
|
+
return {
|
|
5
|
+
id: e,
|
|
6
|
+
eligibility: { always: !0 },
|
|
7
|
+
bindings: [{
|
|
8
|
+
spec: { kind: "drag" },
|
|
9
|
+
actionId: "viewport.dragPan",
|
|
10
|
+
...Object.keys(t).length > 0 ? { opts: { params: { ...t } } } : {}
|
|
11
|
+
}]
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
//#endregion
|
|
15
|
+
export { e as DRAG_PAN_ID, t as dragPanContribution };
|
|
16
|
+
|
|
17
|
+
//# sourceMappingURL=dragPanContribution.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dragPanContribution.js","names":["DRAG_PAN_ID","dragPanContribution","params"],"sources":["../../../../src/tools/builtin/hand/dragPanContribution.ts"],"sourcesContent":["import type { Contribution } from '../../overlayBinding';\nimport type { DragPanParams } from '../../../interactions/actions/defaults/viewportDragPan';\n\n/** Id of the entry {@link dragPanContribution} builds. */\nexport const DRAG_PAN_ID = 'viewport.dragPanBinding';\n\n/** An always-live entry that pans the view on a drag no tool claims. No preset\n * installs it: the hand tool pans, space-held or chosen, and a canvas that\n * should pan on a plain drag — a viewer, a map — adds this to its ambient\n * list. `params` are `viewport.dragPan`'s, as the hand tool passes them. */\nexport function dragPanContribution(params: DragPanParams = {}): Contribution {\n return {\n id: DRAG_PAN_ID,\n eligibility: { always: true },\n bindings: [{\n spec: { kind: 'drag' },\n actionId: 'viewport.dragPan',\n ...(Object.keys(params).length > 0 ? { opts: { params: { ...params } } } : {}),\n }],\n };\n}\n"],"mappings":";AAIA,IAAaA,IAAc;AAM3B,SAAgBC,EAAoB,IAAwB,CAAC,GAAiB;CAC5E,OAAO;EACL,IAAID;EACJ,aAAa,EAAE,QAAQ,GAAK;EAC5B,UAAU,CAAC;GACT,MAAM,EAAE,MAAM,OAAO;GACrB,UAAU;GACV,GAAI,OAAO,KAAKE,CAAM,CAAC,CAAC,SAAS,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,GAAGA,EAAO,EAAE,EAAE,IAAI,CAAC;EAC9E,CAAC;CACH;AACF"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { defineTool as e } from "../../overlayBinding.js";
|
|
2
|
+
import t from "../../../icons/HandIcon.js";
|
|
3
|
+
import { createElement as n, useMemo as r } from "react";
|
|
4
|
+
import { useLatest as i } from "@weasel-js/react";
|
|
5
|
+
//#region src/tools/builtin/hand/useHandTool.ts
|
|
6
|
+
function a(a = {}) {
|
|
7
|
+
let o = i(a);
|
|
8
|
+
return r(() => Object.assign(e({
|
|
9
|
+
id: "hand",
|
|
10
|
+
capabilities: ["navigation"],
|
|
11
|
+
hotkey: "space",
|
|
12
|
+
hookName: "useHandTool",
|
|
13
|
+
presentation: {
|
|
14
|
+
label: "Hand",
|
|
15
|
+
icon: n(t),
|
|
16
|
+
group: "view"
|
|
17
|
+
},
|
|
18
|
+
cursor: "grab"
|
|
19
|
+
}), { bindings: [{
|
|
20
|
+
spec: { kind: "drag" },
|
|
21
|
+
actionId: "viewport.dragPan",
|
|
22
|
+
opts: { params: () => ({
|
|
23
|
+
axis: o.current.axis ?? "both",
|
|
24
|
+
inertia: o.current.inertia
|
|
25
|
+
}) }
|
|
26
|
+
}] }), [o]);
|
|
27
|
+
}
|
|
28
|
+
//#endregion
|
|
29
|
+
export { a as useHandTool };
|
|
30
|
+
|
|
31
|
+
//# sourceMappingURL=useHandTool.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useHandTool.js","names":["HandIcon","useHandTool","optsRef","useLatest","opts","useMemo","defineTool","createElement"],"sources":["../../../../src/tools/builtin/hand/useHandTool.ts"],"sourcesContent":["import { useMemo, createElement } from 'react';\nimport { useLatest } from '@weasel-js/react';\nimport { defineTool } from '../../overlayBinding';\nimport type { Tool } from '../../overlayBinding';\nimport { HandIcon } from '../../../icons';\nimport type { View } from 'core/viewport/view';\nimport type { InertiaConfig } from 'core/viewport/useDecayLoop';\n\nexport type { InertiaConfig };\n\n/** Options for `useHandTool`. Both are forwarded to `viewport.dragPan` as\n * binding params; momentum additionally needs a `view` dep publishing\n * `decay`, which `<SceneCanvas>` wires. */\nexport interface UseHandToolOptions {\n /** Momentum after release. Omit or pass `false` for none. */\n inertia?: false | InertiaConfig;\n /**\n * Which axes the drag responds to. Default `'both'`.\n *\n * - `'both'` — pan both axes (default).\n * - `'x'` — drag only changes `view.x`. Inertia (if enabled) also stays on x.\n * - `'y'` — drag only changes `view.y`. Inertia stays on y.\n *\n * Locks drag panning to a single axis. The former `useWheelPanTool` /\n * `useWheelZoomTool` / `useKeyboardZoomTool` axis option is dissolved.\n */\n axis?: 'both' | 'x' | 'y';\n}\n\n/** @internal */\ninterface HandScratch {\n startView: View;\n startScreenPoint: { x: number; y: number };\n}\n\n/**\n * Pan-on-drag tool. Registered in both the active slot (sticky, `H` key)\n * and the hotkey slot (momentary, hold `space`).\n *\n * Drag handlers compute pan deltas inline. View is read from ctx.view at\n * gesture start and written via ctx.setView on every move — so the tool\n * works with both controlled and uncontrolled Canvas viewport modes\n * without any extra wiring.\n *\n * Sign convention: dragging the mouse right moves the canvas content right\n * relative to the viewport — i.e. the camera moves *left*. So the new view\n * is `{ x: startView.x - dx, y: startView.y - dy }`.\n */\nexport function useHandTool(opts: UseHandToolOptions = {}): Tool<HandScratch | null> {\n // Read through a ref from a params thunk rather than closing over the\n // values: a consumer passing `inertia={{ friction: 0.9 }}` inline would\n // otherwise mint a new tool identity on every render.\n const optsRef = useLatest(opts);\n return useMemo(\n () =>\n Object.assign(defineTool<HandScratch>({\n id: 'hand',\n capabilities: ['navigation'],\n hotkey: 'space',\n hookName: 'useHandTool',\n presentation: {\n label: 'Hand',\n icon: createElement(HandIcon),\n group: 'view',\n },\n cursor: 'grab',\n }), {\n // Declarative binding routes drag through the dispatcher +\n // viewportDragPanAction, which also owns the grabbing cursor\n // (`Action.activeCursor`) the tool used to declare as an `engaged`\n // phase entry.\n bindings: [{\n spec: { kind: 'drag' as const },\n actionId: 'viewport.dragPan',\n opts: {\n params: () => ({\n axis: optsRef.current.axis ?? 'both',\n inertia: optsRef.current.inertia,\n }),\n },\n }],\n }) as Tool<HandScratch | null>,\n [optsRef],\n );\n}\n"],"mappings":";;;;;AAgDA,SAAgBC,EAAY,IAA2B,CAAC,GAA6B;CAInF,IAAMC,IAAUC,EAAUC,CAAI;CAC9B,OAAOC,QAEH,OAAO,OAAOC,EAAwB;EACpC,IAAI;EACJ,cAAc,CAAC,YAAY;EAC3B,QAAQ;EACR,UAAU;EACV,cAAc;GACZ,OAAO;GACP,MAAMC,EAAcP,CAAQ;GAC5B,OAAO;EACT;EACA,QAAQ;CACV,CAAC,GAAG,EAKF,UAAU,CAAC;EACT,MAAM,EAAE,MAAM,OAAgB;EAC9B,UAAU;EACV,MAAM,EACJ,eAAe;GACb,MAAME,EAAQ,QAAQ,QAAQ;GAC9B,SAASA,EAAQ,QAAQ;EAC3B,GACF;CACF,CAAC,EACH,CAAC,GACH,CAACA,CAAO,CACV;AACF"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { defineTool as e } from "../../overlayBinding.js";
|
|
2
|
+
import t from "../../../icons/ImageIcon.js";
|
|
3
|
+
import { insertBindingBehaviors as n } from "../shared/insertToolOptions.js";
|
|
4
|
+
import { useMemo as r } from "react";
|
|
5
|
+
import { jsx as i } from "react/jsx-runtime";
|
|
6
|
+
//#region src/tools/builtin/image/useImageTool.tsx
|
|
7
|
+
function a(a) {
|
|
8
|
+
let { src: o, label: s = "Image", preview: c = "bitmap", behaviors: l } = a;
|
|
9
|
+
return r(() => e({
|
|
10
|
+
id: "image",
|
|
11
|
+
capabilities: ["creates-shapes"],
|
|
12
|
+
hookName: "useImageTool",
|
|
13
|
+
cursor: "crosshair",
|
|
14
|
+
presentation: {
|
|
15
|
+
label: s,
|
|
16
|
+
group: "shape",
|
|
17
|
+
icon: /* @__PURE__ */ i(t, {})
|
|
18
|
+
},
|
|
19
|
+
bindings: [{
|
|
20
|
+
spec: { kind: "drag" },
|
|
21
|
+
actionId: "insert",
|
|
22
|
+
opts: {
|
|
23
|
+
params: {
|
|
24
|
+
kind: "image",
|
|
25
|
+
src: o,
|
|
26
|
+
preview: c
|
|
27
|
+
},
|
|
28
|
+
...n(l)
|
|
29
|
+
}
|
|
30
|
+
}]
|
|
31
|
+
}), [
|
|
32
|
+
o,
|
|
33
|
+
s,
|
|
34
|
+
c,
|
|
35
|
+
l
|
|
36
|
+
]);
|
|
37
|
+
}
|
|
38
|
+
//#endregion
|
|
39
|
+
export { a as useImageTool };
|
|
40
|
+
|
|
41
|
+
//# sourceMappingURL=useImageTool.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useImageTool.js","names":["ImageIcon","useImageTool","options","useMemo","defineTool","insertBindingBehaviors","behaviors","src","label","preview"],"sources":["../../../../src/tools/builtin/image/useImageTool.tsx"],"sourcesContent":["import { useMemo } from 'react';\nimport { defineTool } from '../../overlayBinding';\nimport { ImageIcon } from '../../../icons';\nimport type { Tool } from '../../overlayBinding';\nimport { insertBindingBehaviors, type InsertToolOptions } from '../shared/insertToolOptions';\n\n/** Options for `useImageTool`. */\nexport interface UseImageToolOptions extends InsertToolOptions {\n /** Image source for inserted nodes — a URL, a `blob:` URL, or a\n * `data:image/…;base64,…` URI. Stored verbatim on each new node's\n * `data.image.src`. */\n src: string;\n label?: string;\n /** What the live drag paints. `'bitmap'` (default) previews the decoded\n * image inside the drag bounds, falling back to the outline until it\n * decodes; `'outline'` never draws the image. */\n preview?: 'bitmap' | 'outline';\n}\n\n/**\n * Drag-to-insert image tool. A drag-rect commits a leaf node with\n * `data: { image: { src } }` through the dispatcher's `insertAction` + the\n * kit's `insert` dep (the same path the shape tools use); the `kit:image`\n * painter renders it once the bitmap decodes.\n *\n * Thin declarative veneer — the node is minted by `useInsertDepSource`'s\n * `'image'` case, not the tool. `src` is baked into the binding's `params`\n * so the insert dep can stamp it onto the new node.\n */\nexport function useImageTool(options: UseImageToolOptions): Tool<null> {\n const { src, label = 'Image', preview = 'bitmap', behaviors } = options;\n return useMemo(\n () =>\n defineTool<null>({\n id: 'image',\n capabilities: ['creates-shapes'],\n hookName: 'useImageTool',\n cursor: 'crosshair',\n presentation: {\n label,\n group: 'shape',\n icon: <ImageIcon />,\n },\n // Declarative binding routes empty-space drags through the\n // dispatcher + insertAction; `kind: 'image'` selects the insert\n // dep's image factory and `src` rides along on the new node.\n bindings: [\n {\n spec: { kind: 'drag' },\n actionId: 'insert',\n opts: { params: { kind: 'image', src, preview }, ...insertBindingBehaviors(behaviors) },\n },\n ],\n }),\n [src, label, preview, behaviors],\n );\n}\n"],"mappings":";;;;;;AA6BA,SAAgBC,EAAa,GAA0C;CACrE,IAAM,EAAE,QAAK,WAAQ,SAAS,aAAU,UAAU,iBAAcC;CAChE,OAAOC,QAEHC,EAAiB;EACf,IAAI;EACJ,cAAc,CAAC,gBAAgB;EAC/B,UAAU;EACV,QAAQ;EACR,cAAc;GACZ;GACA,OAAO;GACP,MAAM,kBAACJ,GAAD,CAAY,CAAA;EACpB;EAIA,UAAU,CACR;GACE,MAAM,EAAE,MAAM,OAAO;GACrB,UAAU;GACV,MAAM;IAAE,QAAQ;KAAE,MAAM;KAAS;KAAK;IAAQ;IAAG,GAAGK,EAAuBC,CAAS;GAAE;EACxF,CACF;CACF,CAAC,GACH;EAACC;EAAKC;EAAOC;EAASH;CAAS,CACjC;AACF"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { defineTool as e } from "../../overlayBinding.js";
|
|
2
|
+
import t from "../../../icons/LassoIcon.js";
|
|
3
|
+
import { createElement as n, useMemo as r } from "react";
|
|
4
|
+
import { useLatest as i } from "@weasel-js/react";
|
|
5
|
+
//#region src/tools/builtin/lasso/useLassoTool.ts
|
|
6
|
+
function a(a, o = {}) {
|
|
7
|
+
let s = i({
|
|
8
|
+
mode: o.mode ?? "intersect",
|
|
9
|
+
...o.minVertexSpacing === void 0 ? {} : { minVertexSpacing: o.minVertexSpacing }
|
|
10
|
+
}), { behaviors: c } = o;
|
|
11
|
+
return r(() => e({
|
|
12
|
+
id: "lasso",
|
|
13
|
+
capabilities: ["creates-selection"],
|
|
14
|
+
hookName: "useLassoTool",
|
|
15
|
+
...o.keybinding === null ? {} : { keybinding: o.keybinding ?? { key: "L" } },
|
|
16
|
+
cursor: "crosshair",
|
|
17
|
+
presentation: {
|
|
18
|
+
label: "Lasso",
|
|
19
|
+
icon: n(t),
|
|
20
|
+
group: "select"
|
|
21
|
+
},
|
|
22
|
+
bindings: [{
|
|
23
|
+
spec: {
|
|
24
|
+
kind: "drag",
|
|
25
|
+
mods: { shift: "optional" }
|
|
26
|
+
},
|
|
27
|
+
actionId: "lassoSelect",
|
|
28
|
+
opts: {
|
|
29
|
+
params: () => s.current,
|
|
30
|
+
...c ? { behaviors: c } : {}
|
|
31
|
+
}
|
|
32
|
+
}]
|
|
33
|
+
}), [
|
|
34
|
+
o.keybinding,
|
|
35
|
+
c,
|
|
36
|
+
s
|
|
37
|
+
]);
|
|
38
|
+
}
|
|
39
|
+
//#endregion
|
|
40
|
+
export { a as useLassoTool };
|
|
41
|
+
|
|
42
|
+
//# sourceMappingURL=useLassoTool.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useLassoTool.js","names":["LassoIcon","useLassoTool","paramsRef","useLatest","options","useMemo","defineTool","createElement","behaviors"],"sources":["../../../../src/tools/builtin/lasso/useLassoTool.ts"],"sourcesContent":["import { useMemo, createElement } from 'react';\nimport { useLatest } from '@weasel-js/react';\nimport { defineTool } from '../../overlayBinding';\nimport { LassoIcon } from '../../../icons';\nimport type { Tool } from '../../overlayBinding';\nimport type { UseLassoSelectOptions } from 'interactions/actions/lasso-select/options';\nimport type { LassoHitMode, LassoSelectAdapter } from 'core/adapters/types';\nimport type { ToolKeybinding } from '@weasel-js/routing';\n\n/** Options for `useLassoTool` — the lasso-select action's options plus the\n * tool's own hit mode and activation key. */\nexport interface UseLassoToolOptions extends UseLassoSelectOptions {\n /** Hit mode for the action's own selection commit, which runs when no\n * behavior claims the gesture. A behavior carries its own, as\n * `selectFromLasso({ mode })` does. Default 'intersect'. */\n mode?: LassoHitMode;\n /** Override the default keybinding (`{ key: 'L' }`). Pass `null` to omit. */\n keybinding?: ToolKeybinding | null;\n}\n\n/** Free-form polygon select Tool. Drag is handled entirely by the gesture\n * dispatcher via the `lassoSelect` action binding below; the dispatcher\n * overlay layer (`useDispatcherOverlayLayer`) paints the live polyline +\n * dashed close-line while the gesture is in flight. Esc cancels through\n * the dispatcher's standard cancel pipeline.\n *\n * The legacy `useLassoSelect` hook is removed — all gesture\n * state, overlay rendering, and selection commit live in\n * `lassoSelectAction` (see `src/interactions/actions/defaults/lassoSelect.ts`). */\nexport function useLassoTool(\n _adapter: LassoSelectAdapter,\n options: UseLassoToolOptions = {},\n): Tool<undefined> {\n const paramsRef = useLatest<{ mode: LassoHitMode; minVertexSpacing?: number }>({\n mode: options.mode ?? 'intersect',\n ...(options.minVertexSpacing !== undefined ? { minVertexSpacing: options.minVertexSpacing } : {}),\n });\n const { behaviors } = options;\n\n return useMemo(() => {\n return defineTool<undefined>({\n id: 'lasso',\n capabilities: ['creates-selection'],\n hookName: 'useLassoTool',\n ...(options.keybinding === null ? {} : { keybinding: options.keybinding ?? { key: 'L' } }),\n cursor: 'crosshair',\n presentation: {\n label: 'Lasso',\n icon: createElement(LassoIcon),\n group: 'select',\n },\n // Declarative drag binding for the new gesture dispatcher. The\n // dispatcher invokes `lassoSelectAction`, which owns vertex buffering,\n // overlay state, and the commit-on-end selection write.\n bindings: [\n {\n spec: { kind: 'drag', mods: { shift: 'optional' } },\n actionId: 'lassoSelect',\n // Thunked so a mode or spacing change reaches the next gesture\n // without rebuilding the tool.\n opts: {\n params: () => paramsRef.current,\n ...(behaviors ? { behaviors } : {}),\n },\n },\n ],\n });\n }, [options.keybinding, behaviors, paramsRef]);\n}\n"],"mappings":";;;;;AA6BA,SAAgBC,EACd,GACA,IAA+B,CAAC,GACf;CACjB,IAAMC,IAAYC,EAA6D;EAC7E,MAAMC,EAAQ,QAAQ;EACtB,GAAIA,EAAQ,qBAAqB,KAAA,IAA6D,CAAC,IAAlD,EAAE,kBAAkBA,EAAQ,iBAAiB;CAC5F,CAAC,GACK,EAAE,iBAAcA;CAEtB,OAAOC,QACEC,EAAsB;EAC3B,IAAI;EACJ,cAAc,CAAC,mBAAmB;EAClC,UAAU;EACV,GAAIF,EAAQ,eAAe,OAAO,CAAC,IAAI,EAAE,YAAYA,EAAQ,cAAc,EAAE,KAAK,IAAI,EAAE;EACxF,QAAQ;EACR,cAAc;GACZ,OAAO;GACP,MAAMG,EAAcP,CAAS;GAC7B,OAAO;EACT;EAIA,UAAU,CACR;GACE,MAAM;IAAE,MAAM;IAAQ,MAAM,EAAE,OAAO,WAAW;GAAE;GAClD,UAAU;GAGV,MAAM;IACJ,cAAcE,EAAU;IACxB,GAAIM,IAAY,EAAE,aAAU,IAAI,CAAC;GACnC;EACF,CACF;CACF,CAAC,GACA;EAACJ,EAAQ;EAAYI;EAAWN;CAAS,CAAC;AAC/C"}
|