@weasel-js/core 1.7.0 → 1.7.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +764 -0
- package/README.md +7 -8
- 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-DLn2lCr_.d.ts → builtins-BSUfH8nU.d.ts} +738 -513
- 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-Dp2IxLGb.d.ts → cornerHandles-CDcZOV8h.d.ts} +3 -13
- 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 -62
- package/dist/index.d.ts +1955 -1891
- 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 -49
- 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 +11 -21
- package/dist/renderer.js +18 -13
- package/dist/resize.d.ts +10 -46
- package/dist/resize.js +7 -5
- 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-D-9QWBy5.d.ts → types-CA54-mAZ.d.ts} +181 -13
- package/dist/{types-qYpyTAiZ.d.ts → types-DSjd6W3n.d.ts} +32 -6
- 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 +29 -19
- package/dist/chunk-3TY6FHAF.js +0 -170
- package/dist/chunk-3TY6FHAF.js.map +0 -1
- package/dist/chunk-DGWNNKGD.js +0 -248
- package/dist/chunk-DGWNNKGD.js.map +0 -1
- package/dist/chunk-G4ZGQMY7.js +0 -33372
- package/dist/chunk-G4ZGQMY7.js.map +0 -1
- package/dist/chunk-L5YNZYEG.js +0 -648
- package/dist/chunk-L5YNZYEG.js.map +0 -1
- package/dist/chunk-LU4IJ52W.js +0 -111
- package/dist/chunk-LU4IJ52W.js.map +0 -1
- package/dist/chunk-M24CLARN.js +0 -28
- package/dist/chunk-M24CLARN.js.map +0 -1
- package/dist/chunk-NE27EOLP.js +0 -146
- package/dist/chunk-NE27EOLP.js.map +0 -1
- package/dist/chunk-PNNZSYRD.js +0 -318
- package/dist/chunk-PNNZSYRD.js.map +0 -1
- package/dist/chunk-UPZY4ART.js +0 -29
- package/dist/chunk-UPZY4ART.js.map +0 -1
- package/dist/chunk-WPNA6L5O.js +0 -250
- package/dist/chunk-WPNA6L5O.js.map +0 -1
- package/dist/chunk-XMAWPGTK.js +0 -128
- package/dist/chunk-XMAWPGTK.js.map +0 -1
- package/dist/clipboard.js.map +0 -1
- package/dist/clone.js.map +0 -1
- package/dist/grid-CY5UKlZh.d.ts +0 -98
- package/dist/index.css.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/insert.d.ts +0 -36
- 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/path-JEV2c5If.d.ts +0 -48
- package/dist/patterns-builtin.js.map +0 -1
- package/dist/renderer.css +0 -62
- 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,27 @@
|
|
|
1
|
+
//#region src/interactions/actions/defaults/selectAll.ts
|
|
2
|
+
var e = {
|
|
3
|
+
id: "selectAll",
|
|
4
|
+
label: "Select All",
|
|
5
|
+
defaultBinding: {
|
|
6
|
+
kind: "key",
|
|
7
|
+
key: "a",
|
|
8
|
+
mods: { mod: !0 }
|
|
9
|
+
},
|
|
10
|
+
eligible: { capability: "creates-selection" },
|
|
11
|
+
requires: [
|
|
12
|
+
"scene",
|
|
13
|
+
"selection",
|
|
14
|
+
"view"
|
|
15
|
+
],
|
|
16
|
+
invoker: {
|
|
17
|
+
timing: "immediate",
|
|
18
|
+
run: (e) => {
|
|
19
|
+
let t = e.scene, n = e.view, r = new Set((t?.layers ?? []).filter((e) => !e.visible || e.locked === !0).map((e) => e.id)), i = !(r.size > 0 || n?.layerIsPainted !== void 0) || !t?.renderOrderNodes ? t?.renderOrder ? [...t.renderOrder()] : [] : t.renderOrderNodes().filter((e) => !r.has(e.layer) && n?.layerIsPainted?.(e.layer) !== !1 && t.isLocked?.(e.id) !== !0).map((e) => e.id);
|
|
20
|
+
i.length !== 0 && e.selection?.set(i);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
//#endregion
|
|
25
|
+
export { e as selectAllAction };
|
|
26
|
+
|
|
27
|
+
//# sourceMappingURL=selectAll.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"selectAll.js","names":["selectAllAction","scene","deps","view","skipped","l","all","n"],"sources":["../../../../src/interactions/actions/defaults/selectAll.ts"],"sourcesContent":["import type { NodeId } from 'core/scene/types';\nimport type { Action } from '@weasel-js/routing';\n\n/** The slice of a scene this action reads. Structural, so a consumer store\n * that answers these is a valid `scene` dep without being a `Scene`. */\ninterface SelectAllScene {\n renderOrder?: () => Iterable<NodeId>;\n renderOrderNodes?: () => readonly { id: NodeId; layer: string }[];\n layers?: readonly { id: string; visible: boolean; locked?: boolean }[];\n /** Consulted when present; a store without it is judged by layer alone. */\n isLocked?: (id: NodeId) => boolean;\n}\n\n/**\n * @experimental\n * Static descriptor for the `selectAll` Action. Selects every scene node the\n * user can see and reach — nodes on a hidden or locked layer, or on a layer\n * the asking view does not paint, are left out, so Cmd+A then Delete cannot\n * take content that is off screen or locked.\n */\nexport const selectAllAction: Action & { requires: string[] } = {\n id: 'selectAll',\n label: 'Select All',\n defaultBinding: { kind: 'key', key: 'a', mods: { mod: true } },\n eligible: { capability: 'creates-selection' },\n requires: ['scene', 'selection', 'view'],\n invoker: {\n timing: 'immediate',\n run: (deps) => {\n const scene = deps.scene as SelectAllScene | undefined;\n const view = deps.view as { layerIsPainted?(layerId: string): boolean } | undefined;\n const skipped = new Set(\n (scene?.layers ?? []).filter((l) => !l.visible || l.locked === true).map((l) => l.id),\n );\n // Scene exposes `renderOrder()` (bottom→top iterable of NodeIds), not\n // the never-implemented `listAll()`. The node walk is the same sequence\n // and carries the layer each id sits on, which the id walk cannot.\n const filtered = skipped.size > 0 || view?.layerIsPainted !== undefined;\n const all: NodeId[] = !filtered || !scene?.renderOrderNodes\n ? (scene?.renderOrder ? [...scene.renderOrder()] : [])\n : scene.renderOrderNodes()\n .filter((n) => !skipped.has(n.layer)\n && view?.layerIsPainted?.(n.layer) !== false\n && scene.isLocked?.(n.id) !== true)\n .map((n) => n.id);\n if (all.length === 0) return;\n (deps.selection as { set(ids: NodeId[]): void } | undefined)?.set(all);\n },\n },\n};\n"],"mappings":";AAoBA,IAAaA,IAAmD;CAC9D,IAAI;CACJ,OAAO;CACP,gBAAgB;EAAE,MAAM;EAAO,KAAK;EAAK,MAAM,EAAE,KAAK,GAAK;CAAE;CAC7D,UAAU,EAAE,YAAY,oBAAoB;CAC5C,UAAU;EAAC;EAAS;EAAa;CAAM;CACvC,SAAS;EACP,QAAQ;EACR,MAAM,MAAS;GACb,IAAMC,IAAQC,EAAK,OACbC,IAAOD,EAAK,MACZE,IAAU,IAAI,KACjBH,GAAO,UAAU,CAAC,EAAA,CAAG,QAAQ,MAAM,CAACI,EAAE,WAAWA,EAAE,WAAW,EAAI,CAAC,CAAC,KAAK,MAAMA,EAAE,EAAE,CACtF,GAKMC,IAAgB,EADLF,EAAQ,OAAO,KAAKD,GAAM,mBAAmB,KAAA,MAC3B,CAACF,GAAO,mBACtCA,GAAO,cAAc,CAAC,GAAGA,EAAM,YAAY,CAAC,IAAI,CAAC,IAClDA,EAAM,iBAAiB,CAAC,CACvB,QAAQ,MAAM,CAACG,EAAQ,IAAIG,EAAE,KAAK,KAC9BJ,GAAM,iBAAiBI,EAAE,KAAK,MAAM,MACpCN,EAAM,WAAWM,EAAE,EAAE,MAAM,EAAI,CAAC,CACpC,KAAK,MAAMA,EAAE,EAAE;GACpB,AAAID,EAAI,WAAW,KACnBJ,EAAM,WAAwD,IAAII,CAAG;EACvE;CACF;AACF"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { createPaintAction as e } from "./createPaintAction.js";
|
|
2
|
+
import { DEFAULT_FILL_COLOR as t, paintWithColor as n } from "../../../util/paint.js";
|
|
3
|
+
//#region src/interactions/actions/defaults/setFill.ts
|
|
4
|
+
var r = e({
|
|
5
|
+
id: "setFill",
|
|
6
|
+
label: "Set fill",
|
|
7
|
+
dataKey: "fill",
|
|
8
|
+
initialState: (e) => ({
|
|
9
|
+
color: e("color") ?? t,
|
|
10
|
+
paint: e("paint")
|
|
11
|
+
}),
|
|
12
|
+
readParams: (e, t) => {
|
|
13
|
+
let n = t?.color, r = t?.paint;
|
|
14
|
+
return n === void 0 && r === void 0 ? null : n === void 0 ? {
|
|
15
|
+
...e,
|
|
16
|
+
paint: r
|
|
17
|
+
} : {
|
|
18
|
+
color: n,
|
|
19
|
+
paint: r
|
|
20
|
+
};
|
|
21
|
+
},
|
|
22
|
+
merge: (e, t) => t.paint === void 0 ? n(e ?? void 0, t.color) : t.paint
|
|
23
|
+
});
|
|
24
|
+
//#endregion
|
|
25
|
+
export { r as setFillAction };
|
|
26
|
+
|
|
27
|
+
//# sourceMappingURL=setFill.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"setFill.js","names":["setFillAction","createPaintAction","pick","DEFAULT_FILL_COLOR","color","params","paint","prev","state","paintWithColor"],"sources":["../../../../src/interactions/actions/defaults/setFill.ts"],"sourcesContent":["import type { Action } from '@weasel-js/routing';\nimport type { FillStyle } from '@weasel-js/paint';\nimport { createPaintAction } from './createPaintAction';\nimport { paintWithColor, DEFAULT_FILL_COLOR } from '../../../util/paint';\n\n/** `setFill`'s gesture state. A `paint` shadows the color until a later color\n * supersedes it. */\ninterface SetFillState {\n /** May be 6- or 8-char hex. Ignored while `paint` is set. */\n color: string;\n /** `null` is an explicit no-fill, distinct from `undefined`, which means\n * this gesture carries no paint and the color applies. */\n paint?: FillStyle | null;\n}\n\n/**\n * Static descriptor for the `setFill` Action.\n *\n * Takes either `color` (a hex string) or `paint` (a whole `FillStyle`, for\n * gradients and patterns). `paint` wins when both are present.\n *\n * Alpha semantics: alpha lives on the paint's `opacity`. A 6-char (no-alpha)\n * color adopts the alpha of the node's existing paint; an 8-char color states\n * its own. A `paint` is written verbatim.\n */\nexport const setFillAction: Action & { requires: string[] } = createPaintAction<\n SetFillState,\n FillStyle,\n 'fill'\n>({\n id: 'setFill',\n label: 'Set fill',\n dataKey: 'fill',\n initialState: (pick) => ({\n color: pick<string>('color') ?? DEFAULT_FILL_COLOR,\n paint: pick<FillStyle | null>('paint'),\n }),\n readParams: (prev, params) => {\n const color = params?.color as string | undefined;\n const paint = params?.paint as FillStyle | null | undefined;\n if (color === undefined && paint === undefined) return null;\n if (color === undefined) return { ...prev, paint };\n // An explicit color supersedes a paint from an earlier tick; otherwise a\n // picker drag after a gradient would do nothing.\n return { color, paint };\n },\n // `??` would read an explicit no-fill as \"no paint given\" and repaint the\n // node with the state's color, so absence has to be tested for.\n merge: (prev, state) => (state.paint !== undefined\n ? state.paint\n : paintWithColor(prev ?? undefined, state.color)),\n});\n"],"mappings":";;;AAyBA,IAAaA,IAAiDC,EAI5D;CACA,IAAI;CACJ,OAAO;CACP,SAAS;CACT,eAAe,OAAU;EACvB,OAAOC,EAAa,OAAO,KAAKC;EAChC,OAAOD,EAAuB,OAAO;CACvC;CACA,aAAa,GAAM,MAAW;EAC5B,IAAME,IAAQC,GAAQ,OAChBC,IAAQD,GAAQ;EAKtB,OAJID,MAAU,KAAA,KAAaE,MAAU,KAAA,IAAkB,OACnDF,MAAU,KAAA,IAAkB;GAAE,GAAGG;GAAM;EAAM,IAG1C;GAAE;GAAO;EAAM;CACxB;CAGA,QAAQ,GAAM,MAAWC,EAAM,UAAU,KAAA,IAErCC,EAAeF,KAAQ,KAAA,GAAWC,EAAM,KAAK,IAD7CA,EAAM;AAEZ,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { createPaintAction as e } from "./createPaintAction.js";
|
|
2
|
+
import { DEFAULT_FILL_COLOR as t, paintWithAlpha as n, solid as r } from "../../../util/paint.js";
|
|
3
|
+
//#region src/interactions/actions/defaults/setFillOpacity.ts
|
|
4
|
+
var i = e({
|
|
5
|
+
id: "setFillOpacity",
|
|
6
|
+
label: "Set fill opacity",
|
|
7
|
+
dataKey: "fill",
|
|
8
|
+
initialState: (e) => e("alpha01") ?? 1,
|
|
9
|
+
readParams: (e, t) => t?.alpha01 ?? null,
|
|
10
|
+
merge: (e, i) => n(e ?? r(t), i)
|
|
11
|
+
});
|
|
12
|
+
//#endregion
|
|
13
|
+
export { i as setFillOpacityAction };
|
|
14
|
+
|
|
15
|
+
//# sourceMappingURL=setFillOpacity.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"setFillOpacity.js","names":["setFillOpacityAction","createPaintAction","pick","params","paintWithAlpha","prev","solid","DEFAULT_FILL_COLOR","alpha01"],"sources":["../../../../src/interactions/actions/defaults/setFillOpacity.ts"],"sourcesContent":["import type { Action } from '@weasel-js/routing';\nimport type { FillStyle } from '@weasel-js/paint';\nimport { createPaintAction } from './createPaintAction';\nimport { paintWithAlpha, solid, DEFAULT_FILL_COLOR } from '../../../util/paint';\n\n/**\n * Static descriptor for the `setFillOpacity` Action.\n *\n * `params.alpha01` (0..1) becomes each node's fill paint `opacity`, leaving\n * the rest of the paint — color, gradient stops, pattern — alone. That is the\n * one alpha slot a gradient or a pattern has, so it is the slot all of them\n * use. A node with no fill yet takes the kit's default one.\n */\nexport const setFillOpacityAction: Action & { requires: string[] } = createPaintAction<\n number,\n FillStyle,\n 'fill'\n>({\n id: 'setFillOpacity',\n label: 'Set fill opacity',\n dataKey: 'fill',\n initialState: (pick) => pick<number>('alpha01') ?? 1,\n readParams: (_prev, params) => (params?.alpha01 as number | undefined) ?? null,\n merge: (prev, alpha01) => paintWithAlpha(prev ?? solid(DEFAULT_FILL_COLOR), alpha01),\n});\n"],"mappings":";;;AAaA,IAAaA,IAAwDC,EAInE;CACA,IAAI;CACJ,OAAO;CACP,SAAS;CACT,eAAe,MAASC,EAAa,SAAS,KAAK;CACnD,aAAa,GAAO,MAAYC,GAAQ,WAAkC;CAC1E,QAAQ,GAAM,MAAYC,EAAeC,KAAQC,EAAMC,CAAkB,GAAGC,CAAO;AACrF,CAAC"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { createPaintAction as e } from "./createPaintAction.js";
|
|
2
|
+
import { DEFAULT_STROKE_COLOR as t, paintWithColor as n, strokeOf as r, strokeWith as i } from "../../../util/paint.js";
|
|
3
|
+
//#region src/interactions/actions/defaults/setStroke.ts
|
|
4
|
+
function a(e, t) {
|
|
5
|
+
return t.paint === null ? null : t.paint ? e ? {
|
|
6
|
+
...e,
|
|
7
|
+
paint: t.paint
|
|
8
|
+
} : i(t.paint) : e ? {
|
|
9
|
+
...e,
|
|
10
|
+
paint: n(e.paint, t.color)
|
|
11
|
+
} : r(t.color);
|
|
12
|
+
}
|
|
13
|
+
var o = e({
|
|
14
|
+
id: "setStroke",
|
|
15
|
+
label: "Set stroke",
|
|
16
|
+
dataKey: "stroke",
|
|
17
|
+
initialState: (e) => ({
|
|
18
|
+
color: e("color") ?? t,
|
|
19
|
+
paint: e("paint")
|
|
20
|
+
}),
|
|
21
|
+
readParams: (e, t) => {
|
|
22
|
+
let n = t?.color, r = t?.paint;
|
|
23
|
+
return n === void 0 && r === void 0 ? null : n === void 0 ? {
|
|
24
|
+
...e,
|
|
25
|
+
paint: r
|
|
26
|
+
} : {
|
|
27
|
+
color: n,
|
|
28
|
+
paint: r
|
|
29
|
+
};
|
|
30
|
+
},
|
|
31
|
+
merge: a
|
|
32
|
+
});
|
|
33
|
+
//#endregion
|
|
34
|
+
export { o as setStrokeAction };
|
|
35
|
+
|
|
36
|
+
//# sourceMappingURL=setStroke.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"setStroke.js","names":["repaint","state","prev","strokeWith","paintWithColor","strokeOf","setStrokeAction","createPaintAction","pick","DEFAULT_STROKE_COLOR","color","params","paint"],"sources":["../../../../src/interactions/actions/defaults/setStroke.ts"],"sourcesContent":["import type { Action } from '@weasel-js/routing';\nimport type { FillStyle, Stroke } from '@weasel-js/paint';\nimport { createPaintAction } from './createPaintAction';\nimport { paintWithColor, strokeOf, strokeWith, DEFAULT_STROKE_COLOR } from '../../../util/paint';\n\n/** `setStroke`'s gesture state — `setFill`'s, against a stroke. */\ninterface SetStrokeState {\n /** May be 6- or 8-char hex. Ignored while `paint` is set. */\n color: string;\n /** `null` is an explicit no-stroke, distinct from `undefined`, which means\n * this gesture carries no paint and the color applies. */\n paint?: FillStyle | null;\n}\n\n/** Repaint a node's stroke, keeping its width, cap, join, dash and align, so\n * picking a paint does not discard the rest of the stroke. A node with no\n * stroke yet gets a hairline one. */\nfunction repaint(prev: Stroke | null | undefined, state: SetStrokeState): Stroke | null {\n // A stroke whose paint is none paints nothing, so the whole stroke goes\n // rather than being kept as a widthful thing that draws no ink.\n if (state.paint === null) return null;\n if (state.paint) return prev ? { ...prev, paint: state.paint } : strokeWith(state.paint);\n if (!prev) return strokeOf(state.color);\n return { ...prev, paint: paintWithColor(prev.paint, state.color) };\n}\n\n/**\n * Static descriptor for the `setStroke` Action.\n *\n * Takes either `color` (a hex string) or `paint` (a whole `FillStyle`, for\n * gradients and patterns). `paint` wins when both are present. A stroke's\n * width, cap, join, dash and align survive either.\n *\n * Alpha semantics: alpha lives on the stroke paint's `opacity`. A 6-char\n * (no-alpha) color adopts the alpha of the node's existing stroke paint; an\n * 8-char color states its own. A `paint` is written verbatim.\n */\nexport const setStrokeAction: Action & { requires: string[] } = createPaintAction<\n SetStrokeState,\n Stroke,\n 'stroke'\n>({\n id: 'setStroke',\n label: 'Set stroke',\n dataKey: 'stroke',\n initialState: (pick) => ({\n color: pick<string>('color') ?? DEFAULT_STROKE_COLOR,\n paint: pick<FillStyle | null>('paint'),\n }),\n readParams: (prev, params) => {\n const color = params?.color as string | undefined;\n const paint = params?.paint as FillStyle | null | undefined;\n if (color === undefined && paint === undefined) return null;\n if (color === undefined) return { ...prev, paint };\n // An explicit color supersedes a paint from an earlier tick; otherwise a\n // picker drag after a gradient would do nothing.\n return { color, paint };\n },\n merge: repaint,\n});\n"],"mappings":";;;AAiBA,SAASA,EAAQ,GAAiC,GAAsC;CAMtF,OAHIC,EAAM,UAAU,OAAa,OAC7BA,EAAM,QAAcC,IAAO;EAAE,GAAGA;EAAM,OAAOD,EAAM;CAAM,IAAIE,EAAWF,EAAM,KAAK,IAClFC,IACE;EAAE,GAAGA;EAAM,OAAOE,EAAeF,EAAK,OAAOD,EAAM,KAAK;CAAE,IAD/CI,EAASJ,EAAM,KAAK;AAExC;AAaA,IAAaK,IAAmDC,EAI9D;CACA,IAAI;CACJ,OAAO;CACP,SAAS;CACT,eAAe,OAAU;EACvB,OAAOC,EAAa,OAAO,KAAKC;EAChC,OAAOD,EAAuB,OAAO;CACvC;CACA,aAAa,GAAM,MAAW;EAC5B,IAAME,IAAQC,GAAQ,OAChBC,IAAQD,GAAQ;EAKtB,OAJID,MAAU,KAAA,KAAaE,MAAU,KAAA,IAAkB,OACnDF,MAAU,KAAA,IAAkB;GAAE,GAAGR;GAAM;EAAM,IAG1C;GAAE;GAAO;EAAM;CACxB;CACA,OAAOF;AACT,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { createPaintAction as e } from "./createPaintAction.js";
|
|
2
|
+
import { DEFAULT_STROKE_COLOR as t, paintWithAlpha as n, solid as r, strokeOf as i } from "../../../util/paint.js";
|
|
3
|
+
//#region src/interactions/actions/defaults/setStrokeOpacity.ts
|
|
4
|
+
var a = e({
|
|
5
|
+
id: "setStrokeOpacity",
|
|
6
|
+
label: "Set stroke opacity",
|
|
7
|
+
dataKey: "stroke",
|
|
8
|
+
initialState: (e) => e("alpha01") ?? 1,
|
|
9
|
+
readParams: (e, t) => t?.alpha01 ?? null,
|
|
10
|
+
merge: (e, a) => {
|
|
11
|
+
let o = e ?? i(t);
|
|
12
|
+
return {
|
|
13
|
+
...o,
|
|
14
|
+
paint: n(o.paint ?? r(t), a)
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
//#endregion
|
|
19
|
+
export { a as setStrokeOpacityAction };
|
|
20
|
+
|
|
21
|
+
//# sourceMappingURL=setStrokeOpacity.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"setStrokeOpacity.js","names":["setStrokeOpacityAction","createPaintAction","pick","params","base","prev","strokeOf","DEFAULT_STROKE_COLOR","paintWithAlpha","solid","alpha01"],"sources":["../../../../src/interactions/actions/defaults/setStrokeOpacity.ts"],"sourcesContent":["import type { Action } from '@weasel-js/routing';\nimport type { Stroke } from '@weasel-js/paint';\nimport { createPaintAction } from './createPaintAction';\nimport { paintWithAlpha, solid, strokeOf, DEFAULT_STROKE_COLOR } from '../../../util/paint';\n\n/**\n * Static descriptor for the `setStrokeOpacity` Action.\n *\n * `params.alpha01` (0..1) becomes each node's stroke paint `opacity`, leaving\n * the rest of the stroke — color, width, cap, join, dash — alone. A node with\n * no stroke yet gets a hairline one.\n */\nexport const setStrokeOpacityAction: Action & { requires: string[] } = createPaintAction<\n number,\n Stroke,\n 'stroke'\n>({\n id: 'setStrokeOpacity',\n label: 'Set stroke opacity',\n dataKey: 'stroke',\n initialState: (pick) => pick<number>('alpha01') ?? 1,\n readParams: (_prev, params) => (params?.alpha01 as number | undefined) ?? null,\n merge: (prev, alpha01) => {\n const base = prev ?? strokeOf(DEFAULT_STROKE_COLOR);\n // A stroke with no paint has no opacity to set; seed the same default\n // colour a strokeless node gets, keeping the width and joins it has.\n return { ...base, paint: paintWithAlpha(base.paint ?? solid(DEFAULT_STROKE_COLOR), alpha01) };\n },\n});\n"],"mappings":";;;AAYA,IAAaA,IAA0DC,EAIrE;CACA,IAAI;CACJ,OAAO;CACP,SAAS;CACT,eAAe,MAASC,EAAa,SAAS,KAAK;CACnD,aAAa,GAAO,MAAYC,GAAQ,WAAkC;CAC1E,QAAQ,GAAM,MAAY;EACxB,IAAMC,IAAOC,KAAQC,EAASC,CAAoB;EAGlD,OAAO;GAAE,GAAGH;GAAM,OAAOI,EAAeJ,EAAK,SAASK,EAAMF,CAAoB,GAAGG,CAAO;EAAE;CAC9F;AACF,CAAC"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { ActionDisabledReason as e, resolveParams as t } from "@weasel-js/routing";
|
|
2
|
+
//#region src/interactions/actions/defaults/slice.ts
|
|
3
|
+
var n = {
|
|
4
|
+
id: "slice",
|
|
5
|
+
label: "Slice",
|
|
6
|
+
group: "edit",
|
|
7
|
+
eligible: { capability: "edits-page" },
|
|
8
|
+
requires: ["slice"],
|
|
9
|
+
invoker: {
|
|
10
|
+
timing: "ongoing",
|
|
11
|
+
start(e, n) {
|
|
12
|
+
let r = e.deps.slice, i = e.drag?.start ?? e.world, a = e.drag?.current ?? e.world, o, s = !0, c = () => t(n?.params)?.cut === "freehand", l = () => c() && o && o.length >= 2 ? o.map((e) => ({
|
|
13
|
+
x: e.x,
|
|
14
|
+
y: e.y
|
|
15
|
+
})) : [i, a];
|
|
16
|
+
return {
|
|
17
|
+
kind: "slice",
|
|
18
|
+
onMove(e) {
|
|
19
|
+
a = e.drag?.current ?? e.world, o = e.drag?.points;
|
|
20
|
+
},
|
|
21
|
+
overlay() {
|
|
22
|
+
return s ? {
|
|
23
|
+
kind: "polyline",
|
|
24
|
+
points: l(),
|
|
25
|
+
role: "cut"
|
|
26
|
+
} : null;
|
|
27
|
+
},
|
|
28
|
+
onEnd(e, t) {
|
|
29
|
+
s = !1, t !== "cancel" && r && (a = e.drag?.current ?? e.world, o = e.drag?.points ?? o, r.commit(l()));
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
enabled: (t) => t?.slice ? !0 : e.NotApplicable
|
|
35
|
+
};
|
|
36
|
+
//#endregion
|
|
37
|
+
export { n as sliceAction };
|
|
38
|
+
|
|
39
|
+
//# sourceMappingURL=slice.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"slice.js","names":["sliceAction","dep","ctx","\"slice\"","a","current","trail","open","freehand","resolveParams","opts","\"cut\"","cut","p","moveCtx","reason","endCtx","deps","ActionDisabledReason"],"sources":["../../../../src/interactions/actions/defaults/slice.ts"],"sourcesContent":["import type { Action } from '@weasel-js/routing';\nimport type { SliceDep } from '../depSchema';\nimport { ActionDisabledReason, resolveParams } from '@weasel-js/routing';\nimport type { BindingOpts, InvocationCtx, OngoingHandle, OngoingOverlay, Point2 } from '@weasel-js/routing';\n\n/**\n * @experimental\n * Static descriptor for the `slice` Action.\n *\n * Ongoing drag invoker: tracks the cut while the gesture is in flight,\n * publishes it as a `'cut'` overlay, and on commit hands it to\n * `SliceDep.commit(cut)`. No-ops gracefully when the `slice` dep is absent.\n *\n * The cut is a straight line from drag start to the pointer by default. With\n * the binding param `cut: 'freehand'` it is the whole drag trail instead.\n */\nexport const sliceAction: Action & { requires: string[] } = {\n id: 'slice',\n label: 'Slice',\n group: 'edit',\n eligible: { capability: 'edits-page' },\n requires: ['slice'],\n invoker: {\n timing: 'ongoing',\n start(ctx: InvocationCtx, opts?: BindingOpts): OngoingHandle {\n const dep = ctx.deps['slice'] as SliceDep | undefined;\n const a: Point2 = ctx.drag?.start ?? ctx.world;\n let current: Point2 = ctx.drag?.current ?? ctx.world;\n let trail: ReadonlyArray<Point2> | undefined;\n let open = true;\n\n const freehand = () => resolveParams(opts?.params)?.['cut'] === 'freehand';\n const cut = (): Point2[] =>\n freehand() && trail && trail.length >= 2\n ? trail.map((p) => ({ x: p.x, y: p.y }))\n : [a, current];\n\n return {\n kind: 'slice',\n onMove(moveCtx: InvocationCtx): void {\n current = moveCtx.drag?.current ?? moveCtx.world;\n trail = moveCtx.drag?.points;\n },\n overlay(): OngoingOverlay | null {\n if (!open) return null;\n return { kind: 'polyline', points: cut(), role: 'cut' };\n },\n onEnd(endCtx: InvocationCtx, reason: 'commit' | 'cancel'): void {\n open = false;\n if (reason === 'cancel' || !dep) return;\n current = endCtx.drag?.current ?? endCtx.world;\n trail = endCtx.drag?.points ?? trail;\n dep.commit(cut());\n },\n };\n },\n },\n // Slice can only act when a `slice` dep is wired (its `onEnd` no-ops\n // otherwise), so reflect dep presence for any UI reading action-enabled\n // state. The dispatcher still self-guards via the empty-handle path.\n enabled: (deps) => (deps?.['slice'] ? true : ActionDisabledReason.NotApplicable),\n};\n"],"mappings":";;AAgBA,IAAaA,IAA+C;CAC1D,IAAI;CACJ,OAAO;CACP,OAAO;CACP,UAAU,EAAE,YAAY,aAAa;CACrC,UAAU,CAAC,OAAO;CAClB,SAAS;EACP,QAAQ;EACR,MAAM,GAAoB,GAAmC;GAC3D,IAAMC,IAAMC,EAAI,KAAKC,OACfC,IAAYF,EAAI,MAAM,SAASA,EAAI,OACrCG,IAAkBH,EAAI,MAAM,WAAWA,EAAI,OAC3CI,GACAC,IAAO,IAELC,UAAiBC,EAAcC,GAAM,MAAM,CAAC,EAAGC,QAAW,YAC1DC,UACJJ,EAAS,KAAKF,KAASA,EAAM,UAAU,IACnCA,EAAM,KAAK,OAAO;IAAE,GAAGO,EAAE;IAAG,GAAGA,EAAE;GAAE,EAAE,IACrC,CAACT,GAAGC,CAAO;GAEjB,OAAO;IACL,MAAM;IACN,OAAO,GAA8B;KAEnC,AADA,IAAUS,EAAQ,MAAM,WAAWA,EAAQ,OAC3C,IAAQA,EAAQ,MAAM;IACxB;IACA,UAAiC;KAE/B,OADKP,IACE;MAAE,MAAM;MAAY,QAAQK,EAAI;MAAG,MAAM;KAAM,IADpC;IAEpB;IACA,MAAM,GAAuB,GAAmC;KAE9D,AADA,IAAO,IACHG,MAAW,YAAad,MAC5B,IAAUe,EAAO,MAAM,WAAWA,EAAO,OACzC,IAAQA,EAAO,MAAM,UAAUV,GAC/BL,EAAI,OAAOW,EAAI,CAAC;IAClB;GACF;EACF;CACF;CAIA,UAAU,MAAUK,GAAOd,QAAW,KAAOe,EAAqB;AACpE"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { createDeleteOp as e } from "../../../core/ops/delete.js";
|
|
2
|
+
import { createInsertOp as t } from "../../../core/ops/create.js";
|
|
3
|
+
import { pathToAnchors as n } from "../../../features/paths/anchors.js";
|
|
4
|
+
import { boundsOfPath as r } from "@weasel-js/geom";
|
|
5
|
+
import { snipPathByPolyline as i, splitPathByPolyline as a } from "@weasel-js/geom/booleans";
|
|
6
|
+
//#region src/interactions/actions/defaults/sliceOps.ts
|
|
7
|
+
function o(n) {
|
|
8
|
+
let { cut: o, nextId: l, selection: u } = n, d = n.placePiece ?? ((e, t) => ({
|
|
9
|
+
pose: s(e.node.pose, r(t)),
|
|
10
|
+
path: t
|
|
11
|
+
})), f = [], p = new Set(u ?? []), m = /* @__PURE__ */ new Set(), h = [], g = n.leaves.map((e, t) => ({
|
|
12
|
+
leaf: e,
|
|
13
|
+
i: t
|
|
14
|
+
})).sort((e, t) => t.leaf.index - e.leaf.index || e.i - t.i);
|
|
15
|
+
for (let { leaf: n } of g) {
|
|
16
|
+
let r = c(n.worldPath) ? i(n.worldPath, o) : a(n.worldPath, o);
|
|
17
|
+
if (!r) continue;
|
|
18
|
+
let s = n.node.id;
|
|
19
|
+
m.add(s), f.push(e({
|
|
20
|
+
node: n.node,
|
|
21
|
+
index: n.index,
|
|
22
|
+
label: "Slice"
|
|
23
|
+
}));
|
|
24
|
+
for (let e of r) {
|
|
25
|
+
let r = d(n, e), i = {
|
|
26
|
+
...n.node,
|
|
27
|
+
id: l(),
|
|
28
|
+
pose: r.pose,
|
|
29
|
+
data: {
|
|
30
|
+
...n.node.data,
|
|
31
|
+
path: r.path
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
f.push(t({
|
|
35
|
+
node: i,
|
|
36
|
+
index: n.index,
|
|
37
|
+
label: "Slice"
|
|
38
|
+
})), p.has(s) && h.push(i.id);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
return {
|
|
42
|
+
ops: f,
|
|
43
|
+
nextSelection: u && m.size > 0 ? [...u.filter((e) => !m.has(e)), ...h] : null
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
function s(e, t) {
|
|
47
|
+
let n = e && typeof e == "object" ? { ...e } : {};
|
|
48
|
+
return delete n.rotation, {
|
|
49
|
+
...n,
|
|
50
|
+
x: t.x,
|
|
51
|
+
y: t.y,
|
|
52
|
+
width: t.width,
|
|
53
|
+
height: t.height
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
var c = (e) => e.kind === "polygon" && n(e).closed.some((e) => !e);
|
|
57
|
+
//#endregion
|
|
58
|
+
export { o as computeSliceOps };
|
|
59
|
+
|
|
60
|
+
//# sourceMappingURL=sliceOps.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sliceOps.js","names":["computeSliceOps","args","placePiece","piecePose","leaf","boundsOfPath","piece","ops","selected","selection","cutIds","inherited","ordered","b","a","pieces","hasOpenSubpath","snipPathByPolyline","cut","splitPathByPolyline","sourceId","createDeleteOp","stored","node","nextId","createInsertOp","id","rest","source","\"rotation\"","path","pathToAnchors","closed"],"sources":["../../../../src/interactions/actions/defaults/sliceOps.ts"],"sourcesContent":["import { boundsOfPath, type Path } from '@weasel-js/geom';\nimport { splitPathByPolyline, snipPathByPolyline } from '@weasel-js/geom/booleans';\nimport { pathToAnchors } from 'features/paths/anchors';\nimport type { Op } from 'core/ops/types';\nimport { createDeleteOp } from 'core/ops/delete';\nimport { createInsertOp } from 'core/ops/create';\n\n/** The fields a slice reads from and writes to a node. */\nexport interface SliceableNode {\n id: string;\n pose: unknown;\n data: unknown;\n}\n\n/** One scene leaf a cut is tested against. */\nexport interface SliceLeaf<TNode extends SliceableNode = SliceableNode> {\n /** The whole node, which the delete op carries so undo restores it intact. */\n node: TNode;\n /** Its ordinal among its siblings: where the delete's undo puts it back,\n * and where its pieces go in. */\n index: number;\n /** Its path with every pose above it baked in: the space the cut is in. */\n worldPath: Path;\n}\n\ninterface SliceBounds {\n x: number;\n y: number;\n width: number;\n height: number;\n}\n\n/** Arguments to {@link computeSliceOps}. */\nexport interface ComputeSliceOpsArgs<TNode extends SliceableNode = SliceableNode> {\n leaves: readonly SliceLeaf<TNode>[];\n /** The cut, a polyline in world space. A last point equal to the first\n * closes it into a loop. */\n cut: ReadonlyArray<{ x: number; y: number }>;\n /** Mints the id of each piece. */\n nextId: () => string;\n /** The selection before the cut. Given, the result carries the selection\n * after it; omitted, `nextSelection` is `null`. */\n selection?: readonly string[];\n /** How a piece, cut in world space, is stored on its node. By default the\n * pose is the source's with the piece's bounds and no rotation, and the\n * path is the world piece itself, so any rotation is baked into it. A\n * scene with rotated poses or parent frames maps the piece back into the\n * node's own frame here. */\n placePiece?: (leaf: SliceLeaf<TNode>, piece: Path) => SlicePiece;\n}\n\n/** One piece as it is stored: the node's pose and its `data.path`. */\nexport interface SlicePiece {\n pose: unknown;\n path: Path;\n}\n\n/** Result of {@link computeSliceOps}. */\nexport interface ComputeSliceResult {\n /** A delete per cut leaf followed by an insert per piece, as one batch. */\n ops: Op[];\n /**\n * The selection after the cut: the cut sources dropped, the pieces of each\n * selected one added, everything else kept. `null` when no selection was\n * given or nothing was cut. It is not an op, so the caller sets it after\n * the batch commits; undo restores the one before either way.\n */\n nextSelection: string[] | null;\n}\n\n/**\n * Cut `leaves` along `cut` and return the ops that swap each crossed leaf for\n * its pieces.\n *\n * A path with an open subpath is snipped along its stroke\n * (`snipPathByPolyline`); a closed one is knifed into closed pieces\n * (`splitPathByPolyline`), which is also where a closed loop cuts out the\n * region it encloses. Each piece copies its source's node with the piece as\n * `data.path` and a fresh id. Leaves the cut misses produce nothing.\n */\nexport function computeSliceOps<TNode extends SliceableNode>(\n args: ComputeSliceOpsArgs<TNode>,\n): ComputeSliceResult {\n const { cut, nextId, selection } = args;\n const placePiece = args.placePiece\n ?? ((leaf: SliceLeaf<TNode>, piece: Path): SlicePiece => ({ pose: piecePose(leaf.node.pose, boundsOfPath(piece)), path: piece }));\n const ops: Op[] = [];\n const selected = new Set(selection ?? []);\n const cutIds = new Set<string>();\n const inherited: string[] = [];\n\n // Highest slot first: swapping a leaf changes how many siblings sit below\n // the next one only when the next one is above it.\n const ordered = args.leaves.map((leaf, i) => ({ leaf, i })).sort((a, b) => b.leaf.index - a.leaf.index || a.i - b.i);\n\n for (const { leaf } of ordered) {\n const pieces = hasOpenSubpath(leaf.worldPath)\n ? snipPathByPolyline(leaf.worldPath, cut)\n : splitPathByPolyline(leaf.worldPath, cut);\n if (!pieces) continue;\n\n const sourceId = leaf.node.id;\n cutIds.add(sourceId);\n ops.push(createDeleteOp({ node: leaf.node, index: leaf.index, label: 'Slice' }));\n for (const piece of pieces) {\n const stored = placePiece(leaf, piece);\n const node = {\n ...leaf.node,\n id: nextId(),\n pose: stored.pose,\n data: { ...(leaf.node.data as object), path: stored.path },\n };\n ops.push(createInsertOp({ node, index: leaf.index, label: 'Slice' }));\n if (selected.has(sourceId)) inherited.push(node.id);\n }\n }\n\n const nextSelection = selection && cutIds.size > 0\n ? [...selection.filter((id) => !cutIds.has(id)), ...inherited]\n : null;\n return { ops, nextSelection };\n}\n\nfunction piecePose(source: unknown, b: SliceBounds): SliceBounds {\n const rest = source && typeof source === 'object' ? { ...(source as Record<string, unknown>) } : {};\n delete rest['rotation'];\n return { ...rest, x: b.x, y: b.y, width: b.width, height: b.height };\n}\n\nconst hasOpenSubpath = (path: Path): boolean =>\n path.kind === 'polygon' && pathToAnchors(path).closed.some((closed) => !closed);\n"],"mappings":";;;;;;AAgFA,SAAgBA,EACd,GACoB;CACpB,IAAM,EAAE,QAAK,WAAQ,iBAAcC,GAC7BC,IAAaD,EAAK,gBACjB,GAAwB,OAA6B;EAAE,MAAME,EAAUC,EAAK,KAAK,MAAMC,EAAaC,CAAK,CAAC;EAAG,MAAMA;CAAM,KAC1HC,IAAY,CAAC,GACbC,IAAW,IAAI,IAAIC,KAAa,CAAC,CAAC,GAClCC,oBAAS,IAAI,IAAY,GACzBC,IAAsB,CAAC,GAIvBC,IAAUX,EAAK,OAAO,KAAK,GAAM,OAAO;EAAE;EAAM;CAAE,EAAE,CAAC,CAAC,MAAM,GAAG,MAAMY,EAAE,KAAK,QAAQC,EAAE,KAAK,SAASA,EAAE,IAAID,EAAE,CAAC;CAEnH,KAAK,IAAM,EAAE,aAAUD,GAAS;EAC9B,IAAMG,IAASC,EAAeZ,EAAK,SAAS,IACxCa,EAAmBb,EAAK,WAAWc,CAAG,IACtCC,EAAoBf,EAAK,WAAWc,CAAG;EAC3C,IAAI,CAACH,GAAQ;EAEb,IAAMK,IAAWhB,EAAK,KAAK;EAE3B,AADAM,EAAO,IAAIU,CAAQ,GACnBb,EAAI,KAAKc,EAAe;GAAE,MAAMjB,EAAK;GAAM,OAAOA,EAAK;GAAO,OAAO;EAAQ,CAAC,CAAC;EAC/E,KAAK,IAAME,KAASS,GAAQ;GAC1B,IAAMO,IAASpB,EAAWE,GAAME,CAAK,GAC/BiB,IAAO;IACX,GAAGnB,EAAK;IACR,IAAIoB,EAAO;IACX,MAAMF,EAAO;IACb,MAAM;KAAE,GAAIlB,EAAK,KAAK;KAAiB,MAAMkB,EAAO;IAAK;GAC3D;GAEA,AADAf,EAAI,KAAKkB,EAAe;IAAE;IAAM,OAAOrB,EAAK;IAAO,OAAO;GAAQ,CAAC,CAAC,GAChEI,EAAS,IAAIY,CAAQ,KAAGT,EAAU,KAAKY,EAAK,EAAE;EACpD;CACF;CAKA,OAAO;EAAE;EAAK,eAHQd,KAAaC,EAAO,OAAO,IAC7C,CAAC,GAAGD,EAAU,QAAQ,MAAO,CAACC,EAAO,IAAIgB,CAAE,CAAC,GAAG,GAAGf,CAAS,IAC3D;CACwB;AAC9B;AAEA,SAASR,EAAU,GAAiB,GAA6B;CAC/D,IAAMwB,IAAOC,KAAU,OAAOA,KAAW,WAAW,EAAE,GAAIA,EAAmC,IAAI,CAAC;CAElG,OADA,OAAOD,EAAKE,UACL;EAAE,GAAGF;EAAM,GAAGd,EAAE;EAAG,GAAGA,EAAE;EAAG,OAAOA,EAAE;EAAO,QAAQA,EAAE;CAAO;AACrE;AAEA,IAAMG,KAAkB,MACtBc,EAAK,SAAS,aAAaC,EAAcD,CAAI,CAAC,CAAC,OAAO,MAAM,MAAW,CAACE,CAAM"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
//#region src/interactions/actions/defaults/toolActivate.ts
|
|
2
|
+
var e = "tool.activate";
|
|
3
|
+
function t(e) {
|
|
4
|
+
return e.map(({ toolId: e, keyOpts: t }) => {
|
|
5
|
+
let n = {};
|
|
6
|
+
return t.mod !== void 0 && (n.mod = t.mod), t.alt !== void 0 && (n.alt = t.alt), t.shift !== void 0 && (n.shift = t.shift), {
|
|
7
|
+
spec: {
|
|
8
|
+
kind: "key",
|
|
9
|
+
key: t.key,
|
|
10
|
+
...Object.keys(n).length > 0 ? { mods: n } : {}
|
|
11
|
+
},
|
|
12
|
+
opts: { params: { toolId: e } }
|
|
13
|
+
};
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
function n(t, n) {
|
|
17
|
+
return {
|
|
18
|
+
id: e,
|
|
19
|
+
label: "Activate tool",
|
|
20
|
+
defaultBinding: t,
|
|
21
|
+
scope: "hotkey",
|
|
22
|
+
invoker: {
|
|
23
|
+
timing: "immediate",
|
|
24
|
+
run: (e, t) => {
|
|
25
|
+
let r = e.activeTool, i = t?.toolId;
|
|
26
|
+
r && i && (!n || n(i)) && r.setActive(i);
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
requires: ["activeTool"]
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
//#endregion
|
|
33
|
+
export { e as TOOL_ACTIVATE_ID, t as buildToolActivateBindings, n as makeToolActivateAction };
|
|
34
|
+
|
|
35
|
+
//# sourceMappingURL=toolActivate.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"toolActivate.js","names":["TOOL_ACTIVATE_ID","buildToolActivateBindings","specs","mods","keyOpts","makeToolActivateAction","bindings","activeTool","deps","toolId","params","isEligible"],"sources":["../../../../src/interactions/actions/defaults/toolActivate.ts"],"sourcesContent":["import type { Action } from '@weasel-js/routing';\nimport type { BoundGesture } from '@weasel-js/routing';\nimport type { ImmediateInvoker } from '@weasel-js/routing';\nimport type { ActiveToolContextValue } from '@weasel-js/routing/react';\n\n/** Canonical id of the consolidated tool-activation action. One descriptor\n * serves every tool; the matched binding (or imperative caller) supplies\n * `params.toolId` to select which tool to activate. */\nexport const TOOL_ACTIVATE_ID = 'tool.activate';\n\n/** Per-tool key spec consumed by `makeToolActivateAction`. `mod/alt/shift`\n * sit at the top level, mirroring the `KeyBinding` shape tools declare. */\nexport interface ToolActivateKeyOpts {\n key: string;\n mod?: boolean;\n alt?: boolean;\n shift?: boolean | 'optional';\n}\n\n/** Single entry pairing a tool id with the key spec that activates it. */\nexport interface ToolActivateBindingSpec {\n toolId: string;\n keyOpts: ToolActivateKeyOpts;\n}\n\n/** Build the per-tool `BoundGesture` list for the consolidated action's\n * `defaultBinding`. Each entry carries `opts.params.toolId` so the\n * invoker's `run` can pick out which tool to activate. */\nexport function buildToolActivateBindings(\n specs: readonly ToolActivateBindingSpec[],\n): BoundGesture[] {\n return specs.map(({ toolId, keyOpts }) => {\n // Modifiers belong under `mods` (a `ModSpec`), not at the top level of\n // the spec. They used to be spread flat and the mismatch was hidden by an\n // `as never` cast, so the matcher — which treats an absent modifier as\n // \"must NOT be held\" — could never match a modifier-qualified shortcut\n // like Cmd+D. Nobody noticed while `useKeybindings`'s own document\n // listener was doing the real matching.\n const mods: Record<string, boolean | 'optional'> = {};\n if (keyOpts.mod !== undefined) mods.mod = keyOpts.mod;\n if (keyOpts.alt !== undefined) mods.alt = keyOpts.alt;\n if (keyOpts.shift !== undefined) mods.shift = keyOpts.shift;\n return {\n spec: {\n kind: 'key',\n key: keyOpts.key,\n ...(Object.keys(mods).length > 0 ? { mods } : {}),\n },\n opts: { params: { toolId } },\n } as BoundGesture;\n });\n}\n\n/** Build the consolidated `tool.activate` action. `bindings` enumerates one\n * `{ spec, opts: { params: { toolId } } }` per tool; the invoker reads\n * `params.toolId` and calls `activeTool.setActive(toolId)`. Imperative\n * callers (palette, toolbar) reach the same effect via\n * `registry.trigger('tool.activate', { toolId })`.\n *\n * `isEligible` gates activation on the tool's `eligibility.capabilities` vs the active\n * mode — the same predicate `ToolPalette` uses to grey a button out. It has\n * to live in the invoker rather than in `Action.eligible` because eligibility\n * here is per-TOOL (read off `params.toolId`), while `Action.eligible` is a\n * static per-action descriptor. Omit it (or pass one that always returns\n * true) for consumers with no mode registry. */\nexport function makeToolActivateAction(\n bindings: BoundGesture[],\n isEligible?: (toolId: string) => boolean,\n): Action {\n const invoker: ImmediateInvoker = {\n timing: 'immediate',\n run: (deps, params) => {\n const activeTool = deps.activeTool as ActiveToolContextValue | undefined;\n const toolId = params?.toolId as string | undefined;\n if (!activeTool || !toolId) return;\n // Greyed out in the palette ⇒ not reachable by shortcut either. Before\n // this, `ToolDef.capabilities` described an intent the runtime never\n // enforced: in text-edit mode the palette greyed the pen button while\n // `P` still activated pen.\n if (isEligible && !isEligible(toolId)) return;\n activeTool.setActive(toolId);\n },\n };\n\n return {\n id: TOOL_ACTIVATE_ID,\n label: 'Activate tool',\n defaultBinding: bindings,\n scope: 'hotkey',\n invoker,\n requires: ['activeTool'],\n } as Action & { requires: string[] };\n}\n"],"mappings":";AAQA,IAAaA,IAAmB;AAoBhC,SAAgBC,EACd,GACgB;CAChB,OAAOC,EAAM,KAAK,EAAE,WAAQ,iBAAc;EAOxC,IAAMC,IAA6C,CAAC;EAIpD,OAHIC,EAAQ,QAAQ,KAAA,MAAW,EAAK,MAAMA,EAAQ,MAC9CA,EAAQ,QAAQ,KAAA,MAAW,EAAK,MAAMA,EAAQ,MAC9CA,EAAQ,UAAU,KAAA,MAAW,EAAK,QAAQA,EAAQ,QAC/C;GACL,MAAM;IACJ,MAAM;IACN,KAAKA,EAAQ;IACb,GAAI,OAAO,KAAKD,CAAI,CAAC,CAAC,SAAS,IAAI,EAAE,QAAK,IAAI,CAAC;GACjD;GACA,MAAM,EAAE,QAAQ,EAAE,UAAO,EAAE;EAC7B;CACF,CAAC;AACH;AAcA,SAAgBE,EACd,GACA,GACQ;CAgBR,OAAO;EACL,IAAIL;EACJ,OAAO;EACP,gBAAgBM;EAChB,OAAO;EACP,SAAA;GAnBA,QAAQ;GACR,MAAM,GAAM,MAAW;IACrB,IAAMC,IAAaC,EAAK,YAClBC,IAASC,GAAQ;IACvB,AAAKH,KAAeE,MAKhB,MAAeE,EAAWF,CAAM,MACpCF,EAAW,UAAUE,CAAM;GAC7B;EAQA;EACA,UAAU,CAAC,YAAY;CACzB;AACF"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { ActionDisabledReason as e } from "@weasel-js/routing";
|
|
2
|
+
//#region src/interactions/actions/defaults/toolResetToDefault.ts
|
|
3
|
+
var t = "tool.resetToDefault";
|
|
4
|
+
function n(n) {
|
|
5
|
+
return {
|
|
6
|
+
id: t,
|
|
7
|
+
label: "Return to default tool",
|
|
8
|
+
defaultBinding: {
|
|
9
|
+
kind: "key",
|
|
10
|
+
key: "Escape"
|
|
11
|
+
},
|
|
12
|
+
invoker: {
|
|
13
|
+
timing: "immediate",
|
|
14
|
+
run: (e) => {
|
|
15
|
+
let t = e.activeTool, r = n();
|
|
16
|
+
t && r && t.setActive(r);
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
requires: ["activeTool"],
|
|
20
|
+
enabled: () => n() ? !0 : e.NotApplicable
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
//#endregion
|
|
24
|
+
export { t as TOOL_RESET_TO_DEFAULT_ID, n as makeToolResetToDefaultAction };
|
|
25
|
+
|
|
26
|
+
//# sourceMappingURL=toolResetToDefault.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"toolResetToDefault.js","names":["TOOL_RESET_TO_DEFAULT_ID","makeToolResetToDefaultAction","activeTool","deps","target","getTarget","ActionDisabledReason"],"sources":["../../../../src/interactions/actions/defaults/toolResetToDefault.ts"],"sourcesContent":["import type { Action } from '@weasel-js/routing';\nimport { ActionDisabledReason } from '@weasel-js/routing';\nimport type { ImmediateInvoker } from '@weasel-js/routing';\nimport type { ActiveToolContextValue } from '@weasel-js/routing/react';\n\n/** Canonical id of the \"Escape returns to the default tool\" action. */\nexport const TOOL_RESET_TO_DEFAULT_ID = 'tool.resetToDefault';\n\n/**\n * Build the Escape-returns-to-default-tool action.\n *\n * This used to live in a raw document `keydown` listener inside\n * `useKeybindings`, running alongside — and unaware of — the dispatcher's own\n * Escape bindings (`cancelGesture`, `exitPathEdit`, `escape`). Both fired on\n * the same keypress because they were separate listeners.\n *\n * As an Action it joins the dispatcher's Escape order, which is\n * first-match-wins. It registers at ambient scope, the lowest priority, so\n * one Escape press does exactly one thing, in this order:\n *\n * 1. cancel an in-flight gesture\n * 2. exit path-anchor edit mode\n * 3. clear the selection\n * 4. return to the default tool ← this action\n *\n * That IS a behavior change from \"reset the tool *and* clear the selection on\n * the same press.\" That order is the coherent reading of Escape, and the old\n * pairing was an artifact of two uncoordinated listeners rather than a design.\n *\n * `getTarget` returns the tool id to return to, or `null` when the behavior\n * is disabled (consumer passed `defaultTool: null`) or already satisfied.\n */\nexport function makeToolResetToDefaultAction(\n getTarget: () => string | null,\n): Action {\n const invoker: ImmediateInvoker = {\n timing: 'immediate',\n run: (deps) => {\n const activeTool = deps.activeTool as ActiveToolContextValue | undefined;\n const target = getTarget();\n if (!activeTool || !target) return;\n activeTool.setActive(target);\n },\n };\n\n return {\n id: TOOL_RESET_TO_DEFAULT_ID,\n label: 'Return to default tool',\n defaultBinding: { kind: 'key', key: 'Escape' },\n invoker,\n requires: ['activeTool'],\n // Report disabled (rather than silently no-op'ing) when there's nothing\n // to return to, so the dispatcher falls through and the keypress isn't\n // swallowed.\n enabled: () => (getTarget() ? true : ActionDisabledReason.NotApplicable),\n } as Action & { requires: string[] };\n}\n"],"mappings":";;AAMA,IAAaA,IAA2B;AA0BxC,SAAgBC,EACd,GACQ;CAWR,OAAO;EACL,IAAID;EACJ,OAAO;EACP,gBAAgB;GAAE,MAAM;GAAO,KAAK;EAAS;EAC7C,SAAA;GAbA,QAAQ;GACR,MAAM,MAAS;IACb,IAAME,IAAaC,EAAK,YAClBC,IAASC,EAAU;IACzB,AAAKH,KAAeE,KACpBF,EAAW,UAAUE,CAAM;GAC7B;EAOA;EACA,UAAU,CAAC,YAAY;EAIvB,eAAgBC,EAAU,IAAI,KAAOC,EAAqB;CAC5D;AACF"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { RedoIcon as e, UndoIcon as t } from "./icons/actionGlyphIcons.js";
|
|
2
|
+
import { createElement as n } from "react";
|
|
3
|
+
import { ActionDisabledReason as r } from "@weasel-js/routing";
|
|
4
|
+
//#region src/interactions/actions/defaults/undoRedo.ts
|
|
5
|
+
function i(e, t) {
|
|
6
|
+
return (e?.history)?.[t]?.() ? !0 : r.NotApplicable;
|
|
7
|
+
}
|
|
8
|
+
var a = {
|
|
9
|
+
id: "undo",
|
|
10
|
+
label: "Undo",
|
|
11
|
+
icon: n(t),
|
|
12
|
+
group: "history",
|
|
13
|
+
defaultBinding: {
|
|
14
|
+
kind: "key",
|
|
15
|
+
key: "z",
|
|
16
|
+
mods: { mod: !0 }
|
|
17
|
+
},
|
|
18
|
+
requires: ["history"],
|
|
19
|
+
invoker: {
|
|
20
|
+
timing: "immediate",
|
|
21
|
+
run: (e) => {
|
|
22
|
+
e.history?.undo?.();
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
enabled: (e) => i(e, "canUndo")
|
|
26
|
+
}, o = {
|
|
27
|
+
id: "redo",
|
|
28
|
+
label: "Redo",
|
|
29
|
+
icon: n(e),
|
|
30
|
+
group: "history",
|
|
31
|
+
defaultBinding: {
|
|
32
|
+
kind: "key",
|
|
33
|
+
key: "z",
|
|
34
|
+
mods: {
|
|
35
|
+
mod: !0,
|
|
36
|
+
shift: !0
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
requires: ["history"],
|
|
40
|
+
invoker: {
|
|
41
|
+
timing: "immediate",
|
|
42
|
+
run: (e) => {
|
|
43
|
+
e.history?.redo?.();
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
enabled: (e) => i(e, "canRedo")
|
|
47
|
+
};
|
|
48
|
+
//#endregion
|
|
49
|
+
export { o as redoAction, a as undoAction };
|
|
50
|
+
|
|
51
|
+
//# sourceMappingURL=undoRedo.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"undoRedo.js","names":["historyCan","deps","which","ActionDisabledReason","undoAction","createElement","UndoIcon","redoAction","RedoIcon"],"sources":["../../../../src/interactions/actions/defaults/undoRedo.ts"],"sourcesContent":["import { createElement } from 'react';\nimport { RedoIcon, UndoIcon } from './icons/actionGlyphIcons';\nimport { ActionDisabledReason, type Action, type ActionDeps } from '@weasel-js/routing';\n\ntype HistoryReads = { canUndo?: () => boolean; canRedo?: () => boolean };\n\nfunction historyCan(deps: ActionDeps | undefined, which: 'canUndo' | 'canRedo'): true | ActionDisabledReason {\n const history = deps?.history as HistoryReads | undefined;\n return history?.[which]?.() ? true : ActionDisabledReason.NotApplicable;\n}\n\n/**\n * @experimental\n * Static descriptor for the `undo` Action.\n */\n// No `eligible` field → undo/redo are always eligible across all modes.\nexport const undoAction: Action & { requires: string[] } = {\n id: 'undo',\n label: 'Undo',\n icon: createElement(UndoIcon),\n group: 'history',\n defaultBinding: { kind: 'key', key: 'z', mods: { mod: true } },\n requires: ['history'],\n invoker: {\n timing: 'immediate',\n run: (deps) => {\n (deps.history as { undo?: () => boolean } | undefined)?.undo?.();\n },\n },\n enabled: (deps) => historyCan(deps, 'canUndo'),\n};\n\n/**\n * @experimental\n * Static descriptor for the `redo` Action.\n */\nexport const redoAction: Action & { requires: string[] } = {\n id: 'redo',\n label: 'Redo',\n icon: createElement(RedoIcon),\n group: 'history',\n defaultBinding: { kind: 'key', key: 'z', mods: { mod: true, shift: true } },\n requires: ['history'],\n invoker: {\n timing: 'immediate',\n run: (deps) => {\n (deps.history as { redo?: () => boolean } | undefined)?.redo?.();\n },\n },\n enabled: (deps) => historyCan(deps, 'canRedo'),\n};\n"],"mappings":";;;;AAMA,SAASA,EAAW,GAA8B,GAA2D;CAE3G,QADgBC,GAAM,QAAA,GACLC,EAAM,GAAG,IAAI,KAAOC,EAAqB;AAC5D;AAOA,IAAaC,IAA8C;CACzD,IAAI;CACJ,OAAO;CACP,MAAMC,EAAcC,CAAQ;CAC5B,OAAO;CACP,gBAAgB;EAAE,MAAM;EAAO,KAAK;EAAK,MAAM,EAAE,KAAK,GAAK;CAAE;CAC7D,UAAU,CAAC,SAAS;CACpB,SAAS;EACP,QAAQ;EACR,MAAM,MAAS;GACb,EAAM,SAAkD,OAAO;EACjE;CACF;CACA,UAAU,MAASN,EAAWC,GAAM,SAAS;AAC/C,GAMaM,IAA8C;CACzD,IAAI;CACJ,OAAO;CACP,MAAMF,EAAcG,CAAQ;CAC5B,OAAO;CACP,gBAAgB;EAAE,MAAM;EAAO,KAAK;EAAK,MAAM;GAAE,KAAK;GAAM,OAAO;EAAK;CAAE;CAC1E,UAAU,CAAC,SAAS;CACpB,SAAS;EACP,QAAQ;EACR,MAAM,MAAS;GACb,EAAM,SAAkD,OAAO;EACjE;CACF;CACA,UAAU,MAASR,EAAWC,GAAM,SAAS;AAC/C"}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { createVelocityTracker as e } from "../../../core/viewport/createVelocityTracker.js";
|
|
2
|
+
import { resolveParams as t } from "@weasel-js/routing";
|
|
3
|
+
//#region src/interactions/actions/defaults/viewportDragPan.ts
|
|
4
|
+
function n(e, t) {
|
|
5
|
+
let n = t.startView, r = t.view.get();
|
|
6
|
+
return {
|
|
7
|
+
x: (e.current.x - r.x - (e.start.x - n.x)) * n.scale.x,
|
|
8
|
+
y: (e.current.y - r.y - (e.start.y - n.y)) * n.scale.y
|
|
9
|
+
};
|
|
10
|
+
}
|
|
11
|
+
var r = {
|
|
12
|
+
id: "viewport.dragPan",
|
|
13
|
+
label: "Drag to pan viewport",
|
|
14
|
+
group: "viewport",
|
|
15
|
+
cursor: "grab",
|
|
16
|
+
activeCursor: "grabbing",
|
|
17
|
+
requires: ["view", "debug"],
|
|
18
|
+
invoker: {
|
|
19
|
+
timing: "ongoing",
|
|
20
|
+
start(r, i) {
|
|
21
|
+
let a = r.deps.view;
|
|
22
|
+
if (!a) return {};
|
|
23
|
+
let o = a.get(), s = t(i?.params) ?? {}, c = s.inertia === !1 ? void 0 : s.inertia, l = {
|
|
24
|
+
startView: o,
|
|
25
|
+
view: a,
|
|
26
|
+
axis: s.axis ?? "both",
|
|
27
|
+
inertia: c,
|
|
28
|
+
tracker: c && a.decay ? e() : void 0,
|
|
29
|
+
lastScreen: {
|
|
30
|
+
x: 0,
|
|
31
|
+
y: 0
|
|
32
|
+
}
|
|
33
|
+
}, u = r.deps.debug, d = r.drag?.start;
|
|
34
|
+
return {
|
|
35
|
+
kind: "pan",
|
|
36
|
+
onMove(e) {
|
|
37
|
+
if (!e.drag) return;
|
|
38
|
+
let t = e.drag.screenDelta ?? n(e.drag, l), r = l.axis === "y" ? 0 : t.x, i = l.axis === "x" ? 0 : t.y;
|
|
39
|
+
l.tracker && (l.tracker.record(r - l.lastScreen.x, i - l.lastScreen.y, performance.now()), l.lastScreen = {
|
|
40
|
+
x: r,
|
|
41
|
+
y: i
|
|
42
|
+
});
|
|
43
|
+
let a = l.startView, o = {
|
|
44
|
+
...a,
|
|
45
|
+
x: a.x - r / a.scale.x,
|
|
46
|
+
y: a.y - i / a.scale.y
|
|
47
|
+
};
|
|
48
|
+
l.view.set(o), u?.recordViewport("pan", a, o, d && {
|
|
49
|
+
x: d.x,
|
|
50
|
+
y: d.y
|
|
51
|
+
});
|
|
52
|
+
},
|
|
53
|
+
onEnd(e, t) {
|
|
54
|
+
let { tracker: n, inertia: r, view: i } = l;
|
|
55
|
+
if (t === "cancel" || !n || !r || !i.decay) return;
|
|
56
|
+
let { vx: a, vy: o } = n.getVelocity(), s = l.startView.scale;
|
|
57
|
+
i.decay({
|
|
58
|
+
velocity: {
|
|
59
|
+
vx: -a / s.x,
|
|
60
|
+
vy: -o / s.y
|
|
61
|
+
},
|
|
62
|
+
friction: r.friction,
|
|
63
|
+
minSpeed: r.minSpeed,
|
|
64
|
+
boundary: r.boundary,
|
|
65
|
+
viewBounds: r.bounds,
|
|
66
|
+
initialPosition: {
|
|
67
|
+
x: i.get().x,
|
|
68
|
+
y: i.get().y
|
|
69
|
+
},
|
|
70
|
+
onTick: (e, t) => {
|
|
71
|
+
let n = i.get();
|
|
72
|
+
i.set({
|
|
73
|
+
...n,
|
|
74
|
+
x: n.x + e,
|
|
75
|
+
y: n.y + t
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
},
|
|
83
|
+
enabled: () => !0
|
|
84
|
+
};
|
|
85
|
+
//#endregion
|
|
86
|
+
export { r as viewportDragPanAction };
|
|
87
|
+
|
|
88
|
+
//# sourceMappingURL=viewportDragPan.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"viewportDragPan.js","names":["screenDeltaFromWorld","v0","scratch","now","drag","viewportDragPanAction","view","ctx","startView","params","resolveParams","opts","inertia","createVelocityTracker","debug","grab","moveCtx","screen","screenDx","screenDy","sv","next","v","reason","tracker","scale","vx","vy","cur","dx","dy"],"sources":["../../../../src/interactions/actions/defaults/viewportDragPan.ts"],"sourcesContent":["/**\n * `viewportDragPanAction` — ongoing Action descriptor for drag-to-pan the viewport.\n *\n * ## Bindings\n * None of its own. The hand tool binds a drag to it, and a canvas that pans on\n * any unclaimed drag adds `dragPanContribution`.\n *\n * ## Design notes\n * The drag delta from the dispatcher is in screen space (pixels). The pan\n * formula converts screen pixels to world units by dividing by zoom:\n *\n * newView.x = startView.x - screenDx / startView.scale.x\n * newView.y = startView.y - screenDy / startView.scale.y\n *\n * where `screenDx` / `screenDy` are the screen-space pixel deltas from the\n * drag origin. This ensures that at any zoom level, the drag behavior is\n * consistent: 1 screen pixel always pans the same amount relative to the\n * viewport's zoom (e.g., at 1x zoom: 100px → 100 world units; at 2x zoom:\n * 100px → 50 world units). The camera moves opposite to the drag direction\n * so that the scene content appears to follow the pointer.\n *\n * The descriptor captures `startView` in its own scratch at `start` time,\n * parallel to `useHandTool`'s `startView` capture in its scratch object.\n *\n * ## Axis locking and inertia\n * Both are read from the binding's `params` at `start`, so any consumer\n * binding this action gets them — not just `useHandTool`. `axis` drops one\n * component of every pan delta. `inertia` coasts the view after release,\n * through the optional `view.decay` dep; with no such dep wired the pan\n * simply lands, which is what an unconfigured consumer already expects.\n *\n * @see useHandTool — the React hook this descriptor parallels.\n */\n\nimport type { Action, DebugSink } from '@weasel-js/routing';\nimport { resolveParams, type InvocationCtx, type OngoingHandle, type BindingOpts } from '@weasel-js/routing';\nimport type { View } from 'core/viewport/view';\nimport type { ViewApi } from '../depSchema';\nimport type { InertiaConfig } from 'core/viewport/useDecayLoop';\nimport { createVelocityTracker, type VelocityTracker } from 'core/viewport/createVelocityTracker';\n\n// ---------------------------------------------------------------------------\n// Internal scratch\n// ---------------------------------------------------------------------------\n\ninterface DragPanScratch {\n startView: View;\n view: ViewApi;\n axis: 'both' | 'x' | 'y';\n inertia: InertiaConfig | undefined;\n tracker: VelocityTracker | undefined;\n lastScreen: { x: number; y: number };\n}\n\n/**\n * Rebuild the client-pixel drag delta from the world one, for an event source\n * that supplied no `clientX`/`clientY`.\n *\n * A world delta is self-referential mid-pan — its two ends were measured under\n * different views — so it cannot simply be scaled. Undoing each end against the\n * view that produced it recovers the client delta exactly, since\n * `world = (client - origin) / scale + view` and neither the canvas origin nor\n * the scale moves during a pan.\n */\nfunction screenDeltaFromWorld(\n drag: NonNullable<InvocationCtx['drag']>,\n scratch: DragPanScratch,\n): { x: number; y: number } {\n const v0 = scratch.startView;\n const now = scratch.view.get();\n return {\n x: (drag.current.x - now.x - (drag.start.x - v0.x)) * v0.scale.x,\n y: (drag.current.y - now.y - (drag.start.y - v0.y)) * v0.scale.y,\n };\n}\n\n/** Binding params `viewport.dragPan` understands. `useHandTool` supplies both;\n * a bare binding supplies neither and pans both axes with no coasting. */\nexport interface DragPanParams {\n axis?: 'both' | 'x' | 'y';\n inertia?: false | InertiaConfig;\n}\n\n// ---------------------------------------------------------------------------\n// Descriptor\n// ---------------------------------------------------------------------------\n\n/**\n * @experimental\n * Static descriptor for the `viewport.dragPan` Action.\n *\n * Requires dep-schema entry: `view`.\n *\n * Translates the viewport by the screen-space drag delta so the canvas content\n * follows the pointer. Produces no scene ops — view changes are not undoable.\n */\n// No `eligible` field → viewport pan is always eligible across all modes.\nexport const viewportDragPanAction: Action & { requires: string[] } = {\n id: 'viewport.dragPan',\n label: 'Drag to pan viewport',\n group: 'viewport',\n // Hover hint: when this action would win the drag at the hovered point\n // (e.g. empty canvas with no marquee-capable tool ahead of it), the\n // hover-cursor pump shows the open hand.\n cursor: 'grab',\n // ...and the closed hand once the pan is actually running. This was\n // `useHandTool`'s `engaged: { cursor: 'grabbing' }` — a phase-table entry\n // on a tool, which meant a consumer who bound `viewport.dragPan` without\n // the hand tool got no state cursor at all.\n activeCursor: 'grabbing',\n requires: ['view', 'debug'],\n invoker: {\n timing: 'ongoing',\n start(ctx: InvocationCtx, opts?: BindingOpts): OngoingHandle {\n const view = ctx.deps.view as ViewApi | undefined;\n if (!view) return {};\n\n const startView = view.get();\n // Gesture-driven ongoing actions never see `ctx.params` — the dispatcher\n // hands the binding's unresolved `opts` here and nowhere else, and pumps\n // `onMove` / `onEnd` with an empty deps bag. Everything the gesture needs\n // has to be captured now.\n const params = (resolveParams(opts?.params) ?? {}) as DragPanParams;\n const inertia = params.inertia === false ? undefined : params.inertia;\n const scratch: DragPanScratch = {\n startView,\n view,\n axis: params.axis ?? 'both',\n inertia,\n // Only track when a coast could actually happen, so the common\n // no-inertia drag does no per-move work.\n tracker: inertia && view.decay ? createVelocityTracker() : undefined,\n lastScreen: { x: 0, y: 0 },\n };\n const debug = ctx.deps.debug as DebugSink | undefined;\n const grab = ctx.drag?.start;\n\n return {\n kind: 'pan',\n onMove(moveCtx: InvocationCtx): void {\n if (!moveCtx.drag) return;\n // Use `screenDelta` (client/CSS pixels), NOT `delta` (world). Pan\n // mutates the view itself, so world deltas are self-referential —\n // after the first commit, `toWorld(currentClient)` returns a\n // position offset by the just-applied pan, halving the apparent\n // movement on every subsequent pointermove. Screen coords come\n // straight from the DOM event and don't drift.\n const screen = moveCtx.drag.screenDelta ?? screenDeltaFromWorld(moveCtx.drag, scratch);\n // An axis lock drops the other component of the *cumulative* delta,\n // so the locked axis never moves however the pointer wanders.\n const screenDx = scratch.axis === 'y' ? 0 : screen.x;\n const screenDy = scratch.axis === 'x' ? 0 : screen.y;\n if (scratch.tracker) {\n scratch.tracker.record(\n screenDx - scratch.lastScreen.x,\n screenDy - scratch.lastScreen.y,\n performance.now(),\n );\n scratch.lastScreen = { x: screenDx, y: screenDy };\n }\n const sv = scratch.startView;\n // 1 screen px maps to 1/scale world units (at 2x zoom, 100 px →\n // 50 world units of pan).\n const next = {\n ...sv,\n x: sv.x - screenDx / sv.scale.x,\n y: sv.y - screenDy / sv.scale.y,\n };\n scratch.view.set(next);\n debug?.recordViewport('pan', sv, next, grab && { x: grab.x, y: grab.y });\n },\n onEnd(_endCtx: InvocationCtx, reason: 'commit' | 'cancel'): void {\n // No scene ops to commit; the pan itself is already live. What is\n // left is the coast, and only for a drag that actually ended.\n const { tracker, inertia, view: v } = scratch;\n if (reason === 'cancel' || !tracker || !inertia || !v.decay) return;\n const { vx, vy } = tracker.getVelocity();\n const scale = scratch.startView.scale;\n v.decay({\n // Screen px/ms → world units/ms, matching the onMove conversion.\n velocity: { vx: -vx / scale.x, vy: -vy / scale.y },\n friction: inertia.friction,\n minSpeed: inertia.minSpeed,\n boundary: inertia.boundary,\n viewBounds: inertia.bounds,\n initialPosition: { x: v.get().x, y: v.get().y },\n onTick: (dx, dy) => {\n const cur = v.get();\n v.set({ ...cur, x: cur.x + dx, y: cur.y + dy });\n },\n });\n },\n };\n },\n },\n enabled: () => true,\n};\n"],"mappings":";;;AAgEA,SAASA,EACP,GACA,GAC0B;CAC1B,IAAMC,IAAKC,EAAQ,WACbC,IAAMD,EAAQ,KAAK,IAAI;CAC7B,OAAO;EACL,IAAIE,EAAK,QAAQ,IAAID,EAAI,KAAKC,EAAK,MAAM,IAAIH,EAAG,MAAMA,EAAG,MAAM;EAC/D,IAAIG,EAAK,QAAQ,IAAID,EAAI,KAAKC,EAAK,MAAM,IAAIH,EAAG,MAAMA,EAAG,MAAM;CACjE;AACF;AAuBA,IAAaI,IAAyD;CACpE,IAAI;CACJ,OAAO;CACP,OAAO;CAIP,QAAQ;CAKR,cAAc;CACd,UAAU,CAAC,QAAQ,OAAO;CAC1B,SAAS;EACP,QAAQ;EACR,MAAM,GAAoB,GAAmC;GAC3D,IAAMC,IAAOC,EAAI,KAAK;GACtB,IAAI,CAACD,GAAM,OAAO,CAAC;GAEnB,IAAME,IAAYF,EAAK,IAAI,GAKrBG,IAAUC,EAAcC,GAAM,MAAM,KAAK,CAAC,GAC1CC,IAAUH,EAAO,YAAY,KAAQ,KAAA,IAAYA,EAAO,SACxDP,IAA0B;IAC9B;IACA;IACA,MAAMO,EAAO,QAAQ;IACrB;IAGA,SAASG,KAAWN,EAAK,QAAQO,EAAsB,IAAI,KAAA;IAC3D,YAAY;KAAE,GAAG;KAAG,GAAG;IAAE;GAC3B,GACMC,IAAQP,EAAI,KAAK,OACjBQ,IAAOR,EAAI,MAAM;GAEvB,OAAO;IACL,MAAM;IACN,OAAO,GAA8B;KACnC,IAAI,CAACS,EAAQ,MAAM;KAOnB,IAAMC,IAASD,EAAQ,KAAK,eAAehB,EAAqBgB,EAAQ,MAAMd,CAAO,GAG/EgB,IAAWhB,EAAQ,SAAS,MAAM,IAAIe,EAAO,GAC7CE,IAAWjB,EAAQ,SAAS,MAAM,IAAIe,EAAO;KACnD,AAAIf,EAAQ,YACVA,EAAQ,QAAQ,OACdgB,IAAWhB,EAAQ,WAAW,GAC9BiB,IAAWjB,EAAQ,WAAW,GAC9B,YAAY,IAAI,CAClB,GACA,EAAQ,aAAa;MAAE,GAAGgB;MAAU,GAAGC;KAAS;KAElD,IAAMC,IAAKlB,EAAQ,WAGbmB,IAAO;MACX,GAAGD;MACH,GAAGA,EAAG,IAAIF,IAAWE,EAAG,MAAM;MAC9B,GAAGA,EAAG,IAAID,IAAWC,EAAG,MAAM;KAChC;KAEA,AADAlB,EAAQ,KAAK,IAAImB,CAAI,GACrBP,GAAO,eAAe,OAAOM,GAAIC,GAAMN,KAAQ;MAAE,GAAGA,EAAK;MAAG,GAAGA,EAAK;KAAE,CAAC;IACzE;IACA,MAAM,GAAwB,GAAmC;KAG/D,IAAM,EAAE,YAAS,YAAS,MAAMO,MAAMpB;KACtC,IAAIqB,MAAW,YAAY,CAACC,KAAW,CAACZ,KAAW,CAACU,EAAE,OAAO;KAC7D,IAAM,EAAE,OAAI,UAAOE,EAAQ,YAAY,GACjCC,IAAQvB,EAAQ,UAAU;KAChC,EAAE,MAAM;MAEN,UAAU;OAAE,IAAI,CAACwB,IAAKD,EAAM;OAAG,IAAI,CAACE,IAAKF,EAAM;MAAE;MACjD,UAAUb,EAAQ;MAClB,UAAUA,EAAQ;MAClB,UAAUA,EAAQ;MAClB,YAAYA,EAAQ;MACpB,iBAAiB;OAAE,GAAGU,EAAE,IAAI,CAAC,CAAC;OAAG,GAAGA,EAAE,IAAI,CAAC,CAAC;MAAE;MAC9C,SAAS,GAAI,MAAO;OAClB,IAAMM,IAAMN,EAAE,IAAI;OAClB,EAAE,IAAI;QAAE,GAAGM;QAAK,GAAGA,EAAI,IAAIC;QAAI,GAAGD,EAAI,IAAIE;OAAG,CAAC;MAChD;KACF,CAAC;IACH;GACF;EACF;CACF;CACA,eAAe;AACjB"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { wheelPan as e } from "../../../core/viewport/wheelHandler.js";
|
|
2
|
+
//#region src/interactions/actions/defaults/viewportWheelPan.ts
|
|
3
|
+
var t = {
|
|
4
|
+
id: "viewport.wheelPan",
|
|
5
|
+
label: "Pan (wheel)",
|
|
6
|
+
group: "viewport",
|
|
7
|
+
defaultBinding: [{
|
|
8
|
+
spec: { kind: "wheel" },
|
|
9
|
+
opts: {}
|
|
10
|
+
}, {
|
|
11
|
+
spec: {
|
|
12
|
+
kind: "wheel",
|
|
13
|
+
mods: { shift: !0 }
|
|
14
|
+
},
|
|
15
|
+
opts: { params: { swapAxis: !0 } }
|
|
16
|
+
}],
|
|
17
|
+
requires: ["view", "debug"],
|
|
18
|
+
invoker: {
|
|
19
|
+
timing: "immediate",
|
|
20
|
+
run(t, n) {
|
|
21
|
+
let r = t.view;
|
|
22
|
+
if (!r) return;
|
|
23
|
+
let i = n?.axis ?? "both", a = n?.deltaX ?? 0, o = n?.deltaY ?? 0, s = r.get(), c = e(s, {
|
|
24
|
+
deltaX: a,
|
|
25
|
+
deltaY: o
|
|
26
|
+
}, {
|
|
27
|
+
axis: i,
|
|
28
|
+
swapAxis: n?.swapAxis === !0
|
|
29
|
+
});
|
|
30
|
+
r.set(c), t.debug?.recordViewport("pan", s, c);
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
enabled: () => !0
|
|
34
|
+
};
|
|
35
|
+
function n(e = {}) {
|
|
36
|
+
let n = e.axis ?? "both";
|
|
37
|
+
return {
|
|
38
|
+
...t,
|
|
39
|
+
defaultBinding: [{
|
|
40
|
+
spec: { kind: "wheel" },
|
|
41
|
+
opts: { params: { axis: n } }
|
|
42
|
+
}, {
|
|
43
|
+
spec: {
|
|
44
|
+
kind: "wheel",
|
|
45
|
+
mods: { shift: !0 }
|
|
46
|
+
},
|
|
47
|
+
opts: { params: {
|
|
48
|
+
swapAxis: !0,
|
|
49
|
+
axis: n
|
|
50
|
+
} }
|
|
51
|
+
}]
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
//#endregion
|
|
55
|
+
export { n as makeViewportWheelPanAction, t as viewportWheelPanAction };
|
|
56
|
+
|
|
57
|
+
//# sourceMappingURL=viewportWheelPan.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"viewportWheelPan.js","names":["viewportWheelPanAction","view","deps","axis","params","deltaX","deltaY","from","next","wheelPan","makeViewportWheelPanAction","opts"],"sources":["../../../../src/interactions/actions/defaults/viewportWheelPan.ts"],"sourcesContent":["/**\n * `viewportWheelPanAction` — immediate Action descriptor for wheel-based viewport pan.\n *\n * ## Bindings\n * - Plain wheel (no mod) → pan by deltaX/deltaY\n * - Shift+wheel → horizontal pan (mouse-wheel users get a horizontal axis\n * without a horizontal scroll device). Implemented by routing deltaY into\n * the x axis when the spec carries `params.swapAxis: true`.\n *\n * ## Design notes\n * The dispatcher merges wheel event data (deltaX, deltaY, clientX, clientY)\n * into params at dispatch time. The invoker reads them from the params bag\n * and defers to `wheelPan` (`core/viewport/wheelHandler`), the kit's one\n * statement of the wheel convention — which divides the delta by `view.scale`\n * so one screen-pixel scroll is one screen-pixel pan at any zoom.\n *\n * `axis` locks the pan to one axis, matching `viewport.dragPan`'s param of\n * the same name, so a consumer that wants a single-axis viewport can say so\n * once per action instead of clamping every committed view. An axis lock\n * outranks `swapAxis`: a shift-wheel routed into a barred axis moves nothing.\n */\n\nimport type { Action, DebugSink } from '@weasel-js/routing';\nimport type { ViewApi } from '../depSchema';\nimport { wheelPan } from 'core/viewport/wheelHandler';\n\n// ---------------------------------------------------------------------------\n// Descriptor\n// ---------------------------------------------------------------------------\n\n/**\n * @experimental\n * Static descriptor for the `viewport.wheelPan` Action.\n *\n * Companion to `viewport.dragPan` (drag-to-pan via the hand tool /\n * space-held). This one is the wheel/trackpad path; both share the\n * same `view` dep but fire on different gesture kinds, so they\n * coexist without competing.\n *\n * Requires dep-schema entry: `view`.\n */\nexport const viewportWheelPanAction: Action & { requires: string[] } = {\n id: 'viewport.wheelPan',\n label: 'Pan (wheel)',\n group: 'viewport',\n /**\n * Plain wheel → pan; Shift+wheel → horizontal pan (axis swap).\n * Cmd+wheel is claimed by `viewportZoomAction`. The matcher's strict\n * modifier check keeps the bindings exclusive: omitting `mods` forbids\n * any modifier, and `mods: { shift: true }` forbids the others.\n */\n defaultBinding: [\n { spec: { kind: 'wheel' }, opts: {} },\n { spec: { kind: 'wheel', mods: { shift: true } }, opts: { params: { swapAxis: true } } },\n ],\n requires: ['view', 'debug'],\n invoker: {\n timing: 'immediate',\n run(deps, params) {\n const view = deps.view as ViewApi | undefined;\n if (!view) return;\n const axis = (params?.axis as 'both' | 'x' | 'y' | undefined) ?? 'both';\n const deltaX = (params?.deltaX as number | undefined) ?? 0;\n const deltaY = (params?.deltaY as number | undefined) ?? 0;\n const from = view.get();\n const next = wheelPan(from, { deltaX, deltaY }, { axis, swapAxis: params?.swapAxis === true });\n view.set(next);\n (deps.debug as DebugSink | undefined)?.recordViewport('pan', from, next);\n },\n },\n enabled: () => true,\n};\n\n/** Tuning for {@link makeViewportWheelPanAction}. */\nexport interface WheelPanOptions {\n /** Lock the pan to one axis. Default `'both'`. Mirrors `viewport.dragPan`'s\n * `axis` param, so a single-axis viewport is declared once per action\n * rather than clamped on every committed view. */\n axis?: 'both' | 'x' | 'y';\n}\n\n/** Builds a `viewport.wheelPan` descriptor with `opts` baked into both of its\n * default bindings. `viewportWheelPanAction` is the unconfigured one. */\nexport function makeViewportWheelPanAction(\n opts: WheelPanOptions = {},\n): Action & { requires: string[] } {\n const axis = opts.axis ?? 'both';\n return {\n ...viewportWheelPanAction,\n defaultBinding: [\n { spec: { kind: 'wheel' }, opts: { params: { axis } } },\n { spec: { kind: 'wheel', mods: { shift: true } }, opts: { params: { swapAxis: true, axis } } },\n ],\n };\n}\n"],"mappings":";;AAyCA,IAAaA,IAA0D;CACrE,IAAI;CACJ,OAAO;CACP,OAAO;CAOP,gBAAgB,CACd;EAAE,MAAM,EAAE,MAAM,QAAQ;EAAG,MAAM,CAAC;CAAE,GACpC;EAAE,MAAM;GAAE,MAAM;GAAS,MAAM,EAAE,OAAO,GAAK;EAAE;EAAG,MAAM,EAAE,QAAQ,EAAE,UAAU,GAAK,EAAE;CAAE,CACzF;CACA,UAAU,CAAC,QAAQ,OAAO;CAC1B,SAAS;EACP,QAAQ;EACR,IAAI,GAAM,GAAQ;GAChB,IAAMC,IAAOC,EAAK;GAClB,IAAI,CAACD,GAAM;GACX,IAAME,IAAQC,GAAQ,QAA2C,QAC3DC,IAAUD,GAAQ,UAAiC,GACnDE,IAAUF,GAAQ,UAAiC,GACnDG,IAAON,EAAK,IAAI,GAChBO,IAAOC,EAASF,GAAM;IAAE;IAAQ;GAAO,GAAG;IAAE;IAAM,UAAUH,GAAQ,aAAa;GAAK,CAAC;GAE7F,AADAH,EAAK,IAAIO,CAAI,GACbN,EAAM,OAAiC,eAAe,OAAOK,GAAMC,CAAI;EACzE;CACF;CACA,eAAe;AACjB;AAYA,SAAgBE,EACd,IAAwB,CAAC,GACQ;CACjC,IAAMP,IAAOQ,EAAK,QAAQ;CAC1B,OAAO;EACL,GAAGX;EACH,gBAAgB,CACd;GAAE,MAAM,EAAE,MAAM,QAAQ;GAAG,MAAM,EAAE,QAAQ,EAAE,QAAK,EAAE;EAAE,GACtD;GAAE,MAAM;IAAE,MAAM;IAAS,MAAM,EAAE,OAAO,GAAK;GAAE;GAAG,MAAM,EAAE,QAAQ;IAAE,UAAU;IAAM;GAAK,EAAE;EAAE,CAC/F;CACF;AACF"}
|