motion-start 0.0.1 → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +42 -9
- package/{src → dist}/animation/UseAnimatedState.svelte +27 -25
- package/dist/animation/UseAnimatedState.svelte.d.ts +36 -0
- package/dist/animation/UseAnimatedState.svelte.d.ts.map +1 -0
- package/dist/animation/UseAnimation.svelte.d.ts +29 -0
- package/dist/animation/UseAnimation.svelte.d.ts.map +1 -0
- package/{src/animation/animate.ts → dist/animation/animate.d.ts} +59 -78
- package/dist/animation/animate.d.ts.map +1 -0
- package/dist/animation/animate.js +46 -0
- package/dist/animation/animation-controls.d.ts +12 -0
- package/dist/animation/animation-controls.d.ts.map +1 -0
- package/{src/animation/animation-controls.ts → dist/animation/animation-controls.js} +89 -101
- package/{src/animation/types.ts → dist/animation/types.d.ts} +84 -83
- package/dist/animation/types.d.ts.map +1 -0
- package/dist/animation/types.js +1 -0
- package/dist/animation/use-animated-state.d.ts +2 -0
- package/dist/animation/use-animated-state.d.ts.map +1 -0
- package/dist/animation/use-animated-state.js +1 -0
- package/dist/animation/use-animation.d.ts +62 -0
- package/dist/animation/use-animation.d.ts.map +1 -0
- package/{src/animation/use-animation.ts → dist/animation/use-animation.js} +66 -74
- package/dist/animation/utils/default-transitions.d.ts +27 -0
- package/dist/animation/utils/default-transitions.d.ts.map +1 -0
- package/{src/animation/utils/default-transitions.ts → dist/animation/utils/default-transitions.js} +57 -70
- package/dist/animation/utils/easing.d.ts +9 -0
- package/dist/animation/utils/easing.d.ts.map +1 -0
- package/{src/animation/utils/easing.ts → dist/animation/utils/easing.js} +42 -55
- package/dist/animation/utils/is-animatable.d.ts +17 -0
- package/dist/animation/utils/is-animatable.d.ts.map +1 -0
- package/{src/animation/utils/is-animatable.ts → dist/animation/utils/is-animatable.js} +33 -42
- package/{src/animation/utils/is-animation-controls.ts → dist/animation/utils/is-animation-controls.d.ts} +12 -17
- package/dist/animation/utils/is-animation-controls.d.ts.map +1 -0
- package/dist/animation/utils/is-animation-controls.js +8 -0
- package/{src/animation/utils/is-keyframes-target.ts → dist/animation/utils/is-keyframes-target.d.ts} +12 -17
- package/dist/animation/utils/is-keyframes-target.d.ts.map +1 -0
- package/dist/animation/utils/is-keyframes-target.js +8 -0
- package/dist/animation/utils/transitions.d.ts +35 -0
- package/dist/animation/utils/transitions.d.ts.map +1 -0
- package/{src/animation/utils/transitions.ts → dist/animation/utils/transitions.js} +211 -218
- package/{src/animation/utils/variant-resolvers.ts → dist/animation/utils/variant-resolvers.d.ts} +17 -15
- package/dist/animation/utils/variant-resolvers.d.ts.map +1 -0
- package/dist/animation/utils/variant-resolvers.js +1 -0
- package/{src → dist}/components/AnimatePresence/AnimatePresence.svelte +16 -8
- package/dist/components/AnimatePresence/AnimatePresence.svelte.d.ts +39 -0
- package/dist/components/AnimatePresence/AnimatePresence.svelte.d.ts.map +1 -0
- package/{src → dist}/components/AnimatePresence/PresenceChild/PresenceChild.svelte +14 -14
- package/dist/components/AnimatePresence/PresenceChild/PresenceChild.svelte.d.ts +29 -0
- package/dist/components/AnimatePresence/PresenceChild/PresenceChild.svelte.d.ts.map +1 -0
- package/{src/components/AnimatePresence/PresenceChild/index.ts → dist/components/AnimatePresence/PresenceChild/index.d.ts} +7 -7
- package/dist/components/AnimatePresence/PresenceChild/index.d.ts.map +1 -0
- package/dist/components/AnimatePresence/PresenceChild/index.js +5 -0
- package/{src/components/AnimatePresence/PresenceChild/types.ts → dist/components/AnimatePresence/PresenceChild/types.d.ts} +10 -10
- package/dist/components/AnimatePresence/PresenceChild/types.d.ts.map +1 -0
- package/dist/components/AnimatePresence/PresenceChild/types.js +1 -0
- package/{src/components/AnimatePresence/index.ts → dist/components/AnimatePresence/index.d.ts} +51 -46
- package/dist/components/AnimatePresence/index.d.ts.map +1 -0
- package/dist/components/AnimatePresence/index.js +2 -0
- package/dist/components/AnimatePresence/type.spec-d.d.ts +2 -0
- package/dist/components/AnimatePresence/type.spec-d.d.ts.map +1 -0
- package/dist/components/AnimatePresence/type.spec-d.js +6 -0
- package/{src/components/AnimatePresence/types.ts → dist/components/AnimatePresence/types.d.ts} +82 -79
- package/dist/components/AnimatePresence/types.d.ts.map +1 -0
- package/dist/components/AnimatePresence/types.js +1 -0
- package/dist/components/AnimatePresence/use-presence.d.ts +56 -0
- package/dist/components/AnimatePresence/use-presence.d.ts.map +1 -0
- package/{src/components/AnimatePresence/use-presence.ts → dist/components/AnimatePresence/use-presence.js} +69 -90
- package/{src → dist}/components/AnimateSharedLayout/AnimateSharedLayout.svelte +22 -15
- package/dist/components/AnimateSharedLayout/AnimateSharedLayout.svelte.d.ts +29 -0
- package/dist/components/AnimateSharedLayout/AnimateSharedLayout.svelte.d.ts.map +1 -0
- package/dist/components/AnimateSharedLayout/index.d.ts +11 -0
- package/dist/components/AnimateSharedLayout/index.d.ts.map +1 -0
- package/{src/components/AnimateSharedLayout/index.ts → dist/components/AnimateSharedLayout/index.js} +10 -11
- package/dist/components/AnimateSharedLayout/type.spec-d.d.ts +2 -0
- package/dist/components/AnimateSharedLayout/type.spec-d.d.ts.map +1 -0
- package/dist/components/AnimateSharedLayout/type.spec-d.js +6 -0
- package/{src/components/AnimateSharedLayout/types.ts → dist/components/AnimateSharedLayout/types.d.ts} +91 -111
- package/dist/components/AnimateSharedLayout/types.d.ts.map +1 -0
- package/dist/components/AnimateSharedLayout/types.js +39 -0
- package/dist/components/AnimateSharedLayout/utils/batcher.d.ts +11 -0
- package/dist/components/AnimateSharedLayout/utils/batcher.d.ts.map +1 -0
- package/{src/components/AnimateSharedLayout/utils/batcher.ts → dist/components/AnimateSharedLayout/utils/batcher.js} +86 -96
- package/dist/components/AnimateSharedLayout/utils/crossfader.d.ts +27 -0
- package/dist/components/AnimateSharedLayout/utils/crossfader.d.ts.map +1 -0
- package/{src/components/AnimateSharedLayout/utils/crossfader.ts → dist/components/AnimateSharedLayout/utils/crossfader.js} +228 -260
- package/dist/components/AnimateSharedLayout/utils/rotate.d.ts +8 -0
- package/dist/components/AnimateSharedLayout/utils/rotate.d.ts.map +1 -0
- package/{src/components/AnimateSharedLayout/utils/rotate.ts → dist/components/AnimateSharedLayout/utils/rotate.js} +39 -48
- package/dist/components/AnimateSharedLayout/utils/stack.d.ts +18 -0
- package/dist/components/AnimateSharedLayout/utils/stack.d.ts.map +1 -0
- package/{src/components/AnimateSharedLayout/utils/stack.ts → dist/components/AnimateSharedLayout/utils/stack.js} +138 -160
- package/{src → dist}/components/LazyMotion/LazyMotion.svelte +9 -3
- package/dist/components/LazyMotion/LazyMotion.svelte.d.ts +29 -0
- package/dist/components/LazyMotion/LazyMotion.svelte.d.ts.map +1 -0
- package/{src/components/LazyMotion/index.ts → dist/components/LazyMotion/index.d.ts} +42 -42
- package/dist/components/LazyMotion/index.d.ts.map +1 -0
- package/dist/components/LazyMotion/index.js +36 -0
- package/{src/components/LazyMotion/types.ts → dist/components/LazyMotion/types.d.ts} +57 -58
- package/dist/components/LazyMotion/types.d.ts.map +1 -0
- package/dist/components/LazyMotion/types.js +1 -0
- package/{src → dist}/components/MotionConfig/MotionConfig.svelte +4 -2
- package/dist/components/MotionConfig/MotionConfig.svelte.d.ts +29 -0
- package/dist/components/MotionConfig/MotionConfig.svelte.d.ts.map +1 -0
- package/dist/components/MotionConfig/MotionConfigScaleCorrection.d.ts +4 -0
- package/dist/components/MotionConfig/MotionConfigScaleCorrection.d.ts.map +1 -0
- package/dist/components/MotionConfig/MotionConfigScaleCorrection.js +32 -0
- package/{src/components/MotionConfig/index.ts → dist/components/MotionConfig/index.d.ts} +21 -20
- package/dist/components/MotionConfig/index.d.ts.map +1 -0
- package/dist/components/MotionConfig/index.js +14 -0
- package/dist/components/MotionConfig/type.spec-d.d.ts +2 -0
- package/dist/components/MotionConfig/type.spec-d.d.ts.map +1 -0
- package/dist/components/MotionConfig/type.spec-d.js +6 -0
- package/dist/components/MotionDiv.svelte.d.ts +31 -0
- package/dist/components/MotionDiv.svelte.d.ts.map +1 -0
- package/dist/context/DOMcontext.d.ts +6 -0
- package/dist/context/DOMcontext.d.ts.map +1 -0
- package/dist/context/DOMcontext.js +20 -0
- package/dist/context/LayoutGroupContext.d.ts +10 -0
- package/dist/context/LayoutGroupContext.d.ts.map +1 -0
- package/dist/context/LayoutGroupContext.js +7 -0
- package/dist/context/LazyContext.d.ts +13 -0
- package/dist/context/LazyContext.d.ts.map +1 -0
- package/dist/context/LazyContext.js +5 -0
- package/{src/context/MotionConfigContext.ts → dist/context/MotionConfigContext.d.ts} +35 -48
- package/dist/context/MotionConfigContext.d.ts.map +1 -0
- package/dist/context/MotionConfigContext.js +15 -0
- package/dist/context/MotionContext/MotionContext.svelte +13 -0
- package/dist/context/MotionContext/MotionContext.svelte.d.ts +5 -0
- package/dist/context/MotionContext/MotionContext.svelte.d.ts.map +1 -0
- package/dist/context/MotionContext/MotionContextProvider.svelte.d.ts +31 -0
- package/dist/context/MotionContext/MotionContextProvider.svelte.d.ts.map +1 -0
- package/dist/context/MotionContext/UseCreateMotionContext.svelte +39 -0
- package/dist/context/MotionContext/UseCreateMotionContext.svelte.d.ts +42 -0
- package/dist/context/MotionContext/UseCreateMotionContext.svelte.d.ts.map +1 -0
- package/dist/context/MotionContext/create.d.ts +2 -0
- package/dist/context/MotionContext/create.d.ts.map +1 -0
- package/{src/context/MotionContext/create.ts → dist/context/MotionContext/create.js} +1 -1
- package/dist/context/MotionContext/index.d.ts +15 -0
- package/dist/context/MotionContext/index.d.ts.map +1 -0
- package/dist/context/MotionContext/index.js +8 -0
- package/dist/context/MotionContext/utils.d.ts +9 -0
- package/dist/context/MotionContext/utils.d.ts.map +1 -0
- package/{src/context/MotionContext/utils.ts → dist/context/MotionContext/utils.js} +18 -29
- package/{src/context/PresenceContext.ts → dist/context/PresenceContext.d.ts} +22 -26
- package/dist/context/PresenceContext.d.ts.map +1 -0
- package/dist/context/PresenceContext.js +7 -0
- package/{src → dist}/context/ScaleCorrectionProvider.svelte +2 -3
- package/dist/context/ScaleCorrectionProvider.svelte.d.ts +33 -0
- package/dist/context/ScaleCorrectionProvider.svelte.d.ts.map +1 -0
- package/dist/context/SharedLayoutContext.d.ts +14 -0
- package/dist/context/SharedLayoutContext.d.ts.map +1 -0
- package/dist/context/SharedLayoutContext.js +18 -0
- package/dist/events/UseDomEvent-type.spec-d.d.ts +2 -0
- package/dist/events/UseDomEvent-type.spec-d.d.ts.map +1 -0
- package/dist/events/UseDomEvent-type.spec-d.js +6 -0
- package/{src → dist}/events/UseDomEvent.svelte +2 -17
- package/dist/events/UseDomEvent.svelte.d.ts +29 -0
- package/dist/events/UseDomEvent.svelte.d.ts.map +1 -0
- package/dist/events/UsePointerEvent.svelte +22 -0
- package/dist/events/UsePointerEvent.svelte.d.ts +29 -0
- package/dist/events/UsePointerEvent.svelte.d.ts.map +1 -0
- package/dist/events/event-info.d.ts +11 -0
- package/dist/events/event-info.d.ts.map +1 -0
- package/{src/events/event-info.ts → dist/events/event-info.js} +65 -69
- package/{src/events/types.ts → dist/events/types.d.ts} +16 -15
- package/dist/events/types.d.ts.map +1 -0
- package/dist/events/types.js +1 -0
- package/{src/events/use-dom-event.ts → dist/events/use-dom-event.d.ts} +51 -48
- package/dist/events/use-dom-event.d.ts.map +1 -0
- package/dist/events/use-dom-event.js +30 -0
- package/dist/events/use-pointer-event.d.ts +32 -0
- package/dist/events/use-pointer-event.d.ts.map +1 -0
- package/dist/events/use-pointer-event.js +35 -0
- package/dist/events/utils.d.ts +9 -0
- package/dist/events/utils.d.ts.map +1 -0
- package/{src/events/utils.ts → dist/events/utils.js} +20 -25
- package/dist/gestures/PanSession.d.ts +142 -0
- package/dist/gestures/PanSession.d.ts.map +1 -0
- package/dist/gestures/PanSession.js +232 -0
- package/dist/gestures/UseFocusGesture.svelte.d.ts +31 -0
- package/dist/gestures/UseFocusGesture.svelte.d.ts.map +1 -0
- package/dist/gestures/UseGestures.svelte.d.ts +31 -0
- package/dist/gestures/UseGestures.svelte.d.ts.map +1 -0
- package/{src → dist}/gestures/UseHoverGesture.svelte +6 -3
- package/dist/gestures/UseHoverGesture.svelte.d.ts +31 -0
- package/dist/gestures/UseHoverGesture.svelte.d.ts.map +1 -0
- package/{src → dist}/gestures/UsePanGesture.svelte +6 -5
- package/dist/gestures/UsePanGesture.svelte.d.ts +32 -0
- package/dist/gestures/UsePanGesture.svelte.d.ts.map +1 -0
- package/{src → dist}/gestures/UseTapGesture.svelte +6 -5
- package/dist/gestures/UseTapGesture.svelte.d.ts +31 -0
- package/dist/gestures/UseTapGesture.svelte.d.ts.map +1 -0
- package/{src → dist}/gestures/drag/UseDrag.svelte +5 -4
- package/dist/gestures/drag/UseDrag.svelte.d.ts +32 -0
- package/dist/gestures/drag/UseDrag.svelte.d.ts.map +1 -0
- package/dist/gestures/drag/UseDragControls.svelte +59 -0
- package/dist/gestures/drag/UseDragControls.svelte.d.ts +24 -0
- package/dist/gestures/drag/UseDragControls.svelte.d.ts.map +1 -0
- package/dist/gestures/drag/VisualElementDragControls.d.ts +116 -0
- package/dist/gestures/drag/VisualElementDragControls.d.ts.map +1 -0
- package/dist/gestures/drag/VisualElementDragControls.js +754 -0
- package/{src/gestures/drag/types.ts → dist/gestures/drag/types.d.ts} +309 -307
- package/dist/gestures/drag/types.d.ts.map +1 -0
- package/dist/gestures/drag/types.js +1 -0
- package/dist/gestures/drag/use-drag-controls.d.ts +130 -0
- package/dist/gestures/drag/use-drag-controls.d.ts.map +1 -0
- package/dist/gestures/drag/use-drag-controls.js +157 -0
- package/{src/gestures/drag/use-drag.ts → dist/gestures/drag/use-drag.d.ts} +13 -15
- package/dist/gestures/drag/use-drag.d.ts.map +1 -0
- package/dist/gestures/drag/use-drag.js +1 -0
- package/dist/gestures/drag/utils/constraints.d.ts +78 -0
- package/dist/gestures/drag/utils/constraints.d.ts.map +1 -0
- package/{src/gestures/drag/utils/constraints.ts → dist/gestures/drag/utils/constraints.js} +134 -157
- package/dist/gestures/drag/utils/lock.d.ts +14 -0
- package/dist/gestures/drag/utils/lock.d.ts.map +1 -0
- package/{src/gestures/drag/utils/lock.ts → dist/gestures/drag/utils/lock.js} +56 -69
- package/{src/gestures/types.ts → dist/gestures/types.d.ts} +258 -257
- package/dist/gestures/types.d.ts.map +1 -0
- package/dist/gestures/types.js +1 -0
- package/{src/gestures/use-focus-gesture.ts → dist/gestures/use-focus-gesture.d.ts} +14 -16
- package/dist/gestures/use-focus-gesture.d.ts.map +1 -0
- package/dist/gestures/use-focus-gesture.js +1 -0
- package/dist/gestures/use-gestures.d.ts +2 -0
- package/dist/gestures/use-gestures.d.ts.map +1 -0
- package/{src/gestures/use-gestures.ts → dist/gestures/use-gestures.js} +1 -2
- package/{src/gestures/use-hover-gesture.ts → dist/gestures/use-hover-gesture.d.ts} +8 -10
- package/dist/gestures/use-hover-gesture.d.ts.map +1 -0
- package/dist/gestures/use-hover-gesture.js +1 -0
- package/{src/gestures/use-pan-gesture.ts → dist/gestures/use-pan-gesture.d.ts} +20 -22
- package/dist/gestures/use-pan-gesture.d.ts.map +1 -0
- package/dist/gestures/use-pan-gesture.js +1 -0
- package/{src/gestures/use-tap-gesture.ts → dist/gestures/use-tap-gesture.d.ts} +12 -14
- package/dist/gestures/use-tap-gesture.d.ts.map +1 -0
- package/dist/gestures/use-tap-gesture.js +1 -0
- package/dist/gestures/utils/event-type.d.ts +12 -0
- package/dist/gestures/utils/event-type.d.ts.map +1 -0
- package/{src/gestures/utils/event-type.ts → dist/gestures/utils/event-type.js} +20 -24
- package/dist/gestures/utils/is-node-or-child.d.ts +18 -0
- package/dist/gestures/utils/is-node-or-child.d.ts.map +1 -0
- package/{src/gestures/utils/is-node-or-child.ts → dist/gestures/utils/is-node-or-child.js} +28 -31
- package/dist/index.d.ts +95 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +77 -0
- package/{src → dist}/motion/Motion.svelte +83 -74
- package/dist/motion/Motion.svelte.d.ts +41 -0
- package/dist/motion/Motion.svelte.d.ts.map +1 -0
- package/{src → dist}/motion/MotionSSR.svelte +77 -56
- package/dist/motion/MotionSSR.svelte.d.ts +41 -0
- package/dist/motion/MotionSSR.svelte.d.ts.map +1 -0
- package/dist/motion/features/AnimationState.svelte.d.ts +22 -0
- package/dist/motion/features/AnimationState.svelte.d.ts.map +1 -0
- package/{src → dist}/motion/features/Exit.svelte +15 -5
- package/dist/motion/features/Exit.svelte.d.ts +32 -0
- package/dist/motion/features/Exit.svelte.d.ts.map +1 -0
- package/{src → dist}/motion/features/UseFeatures.svelte +2 -2
- package/dist/motion/features/UseFeatures.svelte.d.ts +45 -0
- package/dist/motion/features/UseFeatures.svelte.d.ts.map +1 -0
- package/dist/motion/features/animations.d.ts +11 -0
- package/dist/motion/features/animations.d.ts.map +1 -0
- package/{src/motion/features/animations.ts → dist/motion/features/animations.js} +14 -22
- package/dist/motion/features/definitions.d.ts +37 -0
- package/dist/motion/features/definitions.d.ts.map +1 -0
- package/{src/motion/features/definitions.ts → dist/motion/features/definitions.js} +42 -49
- package/dist/motion/features/drag.d.ts +11 -0
- package/dist/motion/features/drag.d.ts.map +1 -0
- package/{src/motion/features/drag.ts → dist/motion/features/drag.js} +14 -24
- package/dist/motion/features/gestures.d.ts +11 -0
- package/dist/motion/features/gestures.d.ts.map +1 -0
- package/{src/motion/features/gestures.ts → dist/motion/features/gestures.js} +16 -24
- package/dist/motion/features/layout/Animate.d.ts +2 -0
- package/dist/motion/features/layout/Animate.d.ts.map +1 -0
- package/dist/motion/features/layout/Animate.js +2 -0
- package/{src → dist}/motion/features/layout/Animate.svelte +25 -24
- package/dist/motion/features/layout/Animate.svelte.d.ts +23 -0
- package/dist/motion/features/layout/Animate.svelte.d.ts.map +1 -0
- package/dist/motion/features/layout/AnimateLayoutContextProvider.svelte.d.ts +23 -0
- package/dist/motion/features/layout/AnimateLayoutContextProvider.svelte.d.ts.map +1 -0
- package/dist/motion/features/layout/Measure.d.ts +2 -0
- package/dist/motion/features/layout/Measure.d.ts.map +1 -0
- package/dist/motion/features/layout/Measure.js +2 -0
- package/{src → dist}/motion/features/layout/Measure.svelte +8 -6
- package/dist/motion/features/layout/Measure.svelte.d.ts +24 -0
- package/dist/motion/features/layout/Measure.svelte.d.ts.map +1 -0
- package/{src → dist}/motion/features/layout/MeasureContextProvider.svelte +7 -4
- package/dist/motion/features/layout/MeasureContextProvider.svelte.d.ts +23 -0
- package/dist/motion/features/layout/MeasureContextProvider.svelte.d.ts.map +1 -0
- package/dist/motion/features/layout/index.d.ts +8 -0
- package/dist/motion/features/layout/index.d.ts.map +1 -0
- package/{src/motion/features/layout/index.ts → dist/motion/features/layout/index.js} +11 -20
- package/{src/motion/features/layout/types.ts → dist/motion/features/layout/types.d.ts} +72 -71
- package/dist/motion/features/layout/types.d.ts.map +1 -0
- package/dist/motion/features/layout/types.js +1 -0
- package/dist/motion/features/layout/utils.d.ts +26 -0
- package/dist/motion/features/layout/utils.d.ts.map +1 -0
- package/{src/motion/features/layout/utils.ts → dist/motion/features/layout/utils.js} +28 -40
- package/{src/motion/features/types.ts → dist/motion/features/types.d.ts} +55 -53
- package/dist/motion/features/types.d.ts.map +1 -0
- package/dist/motion/features/types.js +1 -0
- package/{src/motion/features/use-features.ts → dist/motion/features/use-features.d.ts} +12 -16
- package/dist/motion/features/use-features.d.ts.map +1 -0
- package/dist/motion/features/use-features.js +5 -0
- package/dist/motion/index.d.ts +30 -0
- package/dist/motion/index.d.ts.map +1 -0
- package/dist/motion/index.js +35 -0
- package/{src/motion/types.ts → dist/motion/types.d.ts} +281 -278
- package/dist/motion/types.d.ts.map +1 -0
- package/dist/motion/types.js +1 -0
- package/{src → dist}/motion/utils/UseLayoutId.svelte +3 -2
- package/dist/motion/utils/UseLayoutId.svelte.d.ts +35 -0
- package/dist/motion/utils/UseLayoutId.svelte.d.ts.map +1 -0
- package/{src → dist}/motion/utils/UseVisualElement.svelte +22 -13
- package/dist/motion/utils/UseVisualElement.svelte.d.ts +40 -0
- package/dist/motion/utils/UseVisualElement.svelte.d.ts.map +1 -0
- package/{src → dist}/motion/utils/UseVisualState.svelte +27 -27
- package/dist/motion/utils/UseVisualState.svelte.d.ts +37 -0
- package/dist/motion/utils/UseVisualState.svelte.d.ts.map +1 -0
- package/dist/motion/utils/is-forced-motion-value.d.ts +11 -0
- package/dist/motion/utils/is-forced-motion-value.d.ts.map +1 -0
- package/{src/motion/utils/is-forced-motion-value.ts → dist/motion/utils/is-forced-motion-value.js} +13 -23
- package/{src/motion/utils/make-renderless-component.ts → dist/motion/utils/make-renderless-component.d.ts} +12 -17
- package/dist/motion/utils/make-renderless-component.d.ts.map +1 -0
- package/dist/motion/utils/make-renderless-component.js +11 -0
- package/{src/motion/utils/should-inhert-variant.ts → dist/motion/utils/should-inhert-variant.d.ts} +7 -6
- package/dist/motion/utils/should-inhert-variant.d.ts.map +1 -0
- package/dist/motion/utils/should-inhert-variant.js +1 -0
- package/dist/motion/utils/use-motion-ref.d.ts +14 -0
- package/dist/motion/utils/use-motion-ref.d.ts.map +1 -0
- package/dist/motion/utils/use-motion-ref.js +27 -0
- package/dist/motion/utils/use-visual-element.d.ts +11 -0
- package/dist/motion/utils/use-visual-element.d.ts.map +1 -0
- package/dist/motion/utils/use-visual-element.js +1 -0
- package/{src/motion/utils/use-visual-state.ts → dist/motion/utils/use-visual-state.d.ts} +21 -24
- package/dist/motion/utils/use-visual-state.d.ts.map +1 -0
- package/dist/motion/utils/use-visual-state.js +2 -0
- package/dist/motion/utils/valid-prop.d.ts +15 -0
- package/dist/motion/utils/valid-prop.d.ts.map +1 -0
- package/{src/motion/utils/valid-prop.ts → dist/motion/utils/valid-prop.js} +77 -80
- package/dist/render/dom/M-type.spec-d.d.ts +2 -0
- package/dist/render/dom/M-type.spec-d.d.ts.map +1 -0
- package/dist/render/dom/M-type.spec-d.js +6 -0
- package/{src/render/dom/M.svelte → dist/render/dom/Motion-Proxy.svelte} +8 -1
- package/dist/render/dom/Motion-Proxy.svelte.d.ts +33 -0
- package/dist/render/dom/Motion-Proxy.svelte.d.ts.map +1 -0
- package/dist/render/dom/Motion-type.spec-d.d.ts +2 -0
- package/dist/render/dom/Motion-type.spec-d.d.ts.map +1 -0
- package/dist/render/dom/Motion-type.spec-d.js +6 -0
- package/{src → dist}/render/dom/UseRender.svelte +2 -2
- package/dist/render/dom/UseRender.svelte.d.ts +42 -0
- package/dist/render/dom/UseRender.svelte.d.ts.map +1 -0
- package/dist/render/dom/create-visual-element.d.ts +8 -0
- package/dist/render/dom/create-visual-element.d.ts.map +1 -0
- package/{src/render/dom/create-visual-element.ts → dist/render/dom/create-visual-element.js} +12 -22
- package/dist/render/dom/featureBundle.d.ts +24 -0
- package/dist/render/dom/featureBundle.d.ts.map +1 -0
- package/{src/render/dom/featureBundle.ts → dist/render/dom/featureBundle.js} +20 -22
- package/dist/render/dom/motion-minimal.d.ts +942 -0
- package/dist/render/dom/motion-minimal.d.ts.map +1 -0
- package/dist/render/dom/motion-minimal.js +22 -0
- package/dist/render/dom/motion-proxy.d.ts +63 -0
- package/dist/render/dom/motion-proxy.d.ts.map +1 -0
- package/dist/render/dom/motion-proxy.js +57 -0
- package/dist/render/dom/motion.d.ts +966 -0
- package/dist/render/dom/motion.d.ts.map +1 -0
- package/{src/render/dom/motion.ts → dist/render/dom/motion.js} +46 -62
- package/dist/render/dom/projection/convert-to-relative.d.ts +12 -0
- package/dist/render/dom/projection/convert-to-relative.d.ts.map +1 -0
- package/{src/render/dom/projection/convert-to-relative.ts → dist/render/dom/projection/convert-to-relative.js} +32 -40
- package/dist/render/dom/projection/default-scale-correctors.d.ts +40 -0
- package/dist/render/dom/projection/default-scale-correctors.d.ts.map +1 -0
- package/{src/render/dom/projection/default-scale-correctors.ts → dist/render/dom/projection/default-scale-correctors.js} +108 -138
- package/dist/render/dom/projection/measure.d.ts +17 -0
- package/dist/render/dom/projection/measure.d.ts.map +1 -0
- package/{src/render/dom/projection/measure.ts → dist/render/dom/projection/measure.js} +19 -28
- package/dist/render/dom/projection/relative-set.d.ts +8 -0
- package/dist/render/dom/projection/relative-set.d.ts.map +1 -0
- package/{src/render/dom/projection/relative-set.ts → dist/render/dom/projection/relative-set.js} +18 -27
- package/dist/render/dom/projection/scale-correction.d.ts +16 -0
- package/dist/render/dom/projection/scale-correction.d.ts.map +1 -0
- package/dist/render/dom/projection/scale-correction.js +15 -0
- package/{src/render/dom/projection/types.ts → dist/render/dom/projection/types.d.ts} +14 -13
- package/dist/render/dom/projection/types.d.ts.map +1 -0
- package/dist/render/dom/projection/types.js +1 -0
- package/dist/render/dom/projection/utils.d.ts +18 -0
- package/dist/render/dom/projection/utils.d.ts.map +1 -0
- package/{src/render/dom/projection/utils.ts → dist/render/dom/projection/utils.js} +62 -69
- package/dist/render/dom/svg-visual-element.d.ts +3 -0
- package/dist/render/dom/svg-visual-element.d.ts.map +1 -0
- package/{src/render/dom/svg-visual-element.ts → dist/render/dom/svg-visual-element.js} +91 -114
- package/{src/render/dom/types.ts → dist/render/dom/types.d.ts} +33 -32
- package/dist/render/dom/types.d.ts.map +1 -0
- package/dist/render/dom/types.js +1 -0
- package/dist/render/dom/use-render.d.ts +6 -0
- package/dist/render/dom/use-render.d.ts.map +1 -0
- package/dist/render/dom/use-render.js +5 -0
- package/{src → dist}/render/dom/utils/UseInitialMotionProps.svelte +14 -3
- package/dist/render/dom/utils/UseInitialMotionProps.svelte.d.ts +36 -0
- package/dist/render/dom/utils/UseInitialMotionProps.svelte.d.ts.map +1 -0
- package/dist/render/dom/utils/batch-layout.d.ts +14 -0
- package/dist/render/dom/utils/batch-layout.d.ts.map +1 -0
- package/{src/render/dom/utils/batch-layout.ts → dist/render/dom/utils/batch-layout.js} +67 -77
- package/dist/render/dom/utils/camel-to-dash.d.ts +10 -0
- package/dist/render/dom/utils/camel-to-dash.d.ts.map +1 -0
- package/{src/render/dom/utils/camel-to-dash.ts → dist/render/dom/utils/camel-to-dash.js} +17 -20
- package/dist/render/dom/utils/create-config.d.ts +7 -0
- package/dist/render/dom/utils/create-config.d.ts.map +1 -0
- package/dist/render/dom/utils/create-config.js +18 -0
- package/dist/render/dom/utils/css-variables-conversion.d.ts +28 -0
- package/dist/render/dom/utils/css-variables-conversion.d.ts.map +1 -0
- package/{src/render/dom/utils/css-variables-conversion.ts → dist/render/dom/utils/css-variables-conversion.js} +111 -121
- package/dist/render/dom/utils/filter-props.d.ts +8 -0
- package/dist/render/dom/utils/filter-props.d.ts.map +1 -0
- package/{src/render/dom/utils/filter-props.ts → dist/render/dom/utils/filter-props.js} +47 -55
- package/dist/render/dom/utils/is-css-variable.d.ts +14 -0
- package/dist/render/dom/utils/is-css-variable.d.ts.map +1 -0
- package/{src/render/dom/utils/is-css-variable.ts → dist/render/dom/utils/is-css-variable.js} +15 -18
- package/dist/render/dom/utils/is-svg-component.d.ts +8 -0
- package/dist/render/dom/utils/is-svg-component.d.ts.map +1 -0
- package/{src/render/dom/utils/is-svg-component.ts → dist/render/dom/utils/is-svg-component.js} +36 -41
- package/dist/render/dom/utils/parse-dom-variant.d.ts +12 -0
- package/dist/render/dom/utils/parse-dom-variant.d.ts.map +1 -0
- package/{src/render/dom/utils/parse-dom-variant.ts → dist/render/dom/utils/parse-dom-variant.js} +17 -26
- package/dist/render/dom/utils/unit-conversion.d.ts +27 -0
- package/dist/render/dom/utils/unit-conversion.d.ts.map +1 -0
- package/{src/render/dom/utils/unit-conversion.ts → dist/render/dom/utils/unit-conversion.js} +236 -258
- package/dist/render/dom/utils/use-html-props.d.ts +2 -0
- package/dist/render/dom/utils/use-html-props.d.ts.map +1 -0
- package/{src/render/dom/utils/use-html-props.ts → dist/render/dom/utils/use-html-props.js} +2 -2
- package/dist/render/dom/utils/use-svg-props.d.ts +2 -0
- package/dist/render/dom/utils/use-svg-props.d.ts.map +1 -0
- package/dist/render/dom/utils/use-svg-props.js +1 -0
- package/dist/render/dom/value-types/animatable-none.d.ts +7 -0
- package/dist/render/dom/value-types/animatable-none.d.ts.map +1 -0
- package/{src/render/dom/value-types/animatable-none.ts → dist/render/dom/value-types/animatable-none.js} +20 -24
- package/dist/render/dom/value-types/defaults.d.ts +15 -0
- package/dist/render/dom/value-types/defaults.d.ts.map +1 -0
- package/dist/render/dom/value-types/defaults.js +31 -0
- package/dist/render/dom/value-types/dimensions.d.ts +15 -0
- package/dist/render/dom/value-types/dimensions.d.ts.map +1 -0
- package/{src/render/dom/value-types/dimensions.ts → dist/render/dom/value-types/dimensions.js} +23 -27
- package/dist/render/dom/value-types/find.d.ts +15 -0
- package/dist/render/dom/value-types/find.d.ts.map +1 -0
- package/dist/render/dom/value-types/find.js +21 -0
- package/{src/render/dom/value-types/get-as-type.ts → dist/render/dom/value-types/get-as-type.d.ts} +15 -21
- package/dist/render/dom/value-types/get-as-type.d.ts.map +1 -0
- package/dist/render/dom/value-types/get-as-type.js +13 -0
- package/dist/render/dom/value-types/number.d.ts +8 -0
- package/dist/render/dom/value-types/number.d.ts.map +1 -0
- package/{src/render/dom/value-types/number.ts → dist/render/dom/value-types/number.js} +74 -83
- package/{src/render/dom/value-types/test.ts → dist/render/dom/value-types/test.d.ts} +15 -17
- package/dist/render/dom/value-types/test.d.ts.map +1 -0
- package/dist/render/dom/value-types/test.js +9 -0
- package/{src/render/dom/value-types/type-auto.ts → dist/render/dom/value-types/type-auto.d.ts} +15 -21
- package/dist/render/dom/value-types/type-auto.d.ts.map +1 -0
- package/dist/render/dom/value-types/type-auto.js +12 -0
- package/{src/render/dom/value-types/type-int.ts → dist/render/dom/value-types/type-int.d.ts} +14 -23
- package/dist/render/dom/value-types/type-int.d.ts.map +1 -0
- package/dist/render/dom/value-types/type-int.js +12 -0
- package/{src/render/dom/value-types/types.ts → dist/render/dom/value-types/types.d.ts} +9 -8
- package/dist/render/dom/value-types/types.d.ts.map +1 -0
- package/dist/render/dom/value-types/types.js +1 -0
- package/{src → dist}/render/html/UseHTMLProps.svelte +19 -2
- package/{src → dist}/render/html/UseInitialMotionValues.svelte +1 -1
- package/dist/render/html/UseInitialMotionValues.svelte.d.ts +36 -0
- package/dist/render/html/UseInitialMotionValues.svelte.d.ts.map +1 -0
- package/dist/render/html/UseStyle.svelte +32 -0
- package/dist/render/html/UseStyle.svelte.d.ts +36 -0
- package/dist/render/html/UseStyle.svelte.d.ts.map +1 -0
- package/dist/render/html/config-motion.d.ts +13 -0
- package/dist/render/html/config-motion.d.ts.map +1 -0
- package/dist/render/html/config-motion.js +13 -0
- package/dist/render/html/supported-elements.d.ts +12 -0
- package/dist/render/html/supported-elements.d.ts.map +1 -0
- package/{src/render/html/supported-elements.ts → dist/render/html/supported-elements.js} +4 -10
- package/{src/render/html/types.ts → dist/render/html/types.d.ts} +54 -64
- package/dist/render/html/types.d.ts.map +1 -0
- package/dist/render/html/types.js +1 -0
- package/dist/render/html/use-props.d.ts +11 -0
- package/dist/render/html/use-props.d.ts.map +1 -0
- package/dist/render/html/use-props.js +15 -0
- package/dist/render/html/utils/build-projection-transform.d.ts +21 -0
- package/dist/render/html/utils/build-projection-transform.d.ts.map +1 -0
- package/{src/render/html/utils/build-projection-transform.ts → dist/render/html/utils/build-projection-transform.js} +39 -53
- package/dist/render/html/utils/build-styles.d.ts +13 -0
- package/dist/render/html/utils/build-styles.d.ts.map +1 -0
- package/{src/render/html/utils/build-styles.ts → dist/render/html/utils/build-styles.js} +108 -121
- package/dist/render/html/utils/build-transform.d.ts +21 -0
- package/dist/render/html/utils/build-transform.d.ts.map +1 -0
- package/{src/render/html/utils/build-transform.ts → dist/render/html/utils/build-transform.js} +70 -79
- package/dist/render/html/utils/create-render-state.d.ts +17 -0
- package/dist/render/html/utils/create-render-state.d.ts.map +1 -0
- package/dist/render/html/utils/create-render-state.js +18 -0
- package/dist/render/html/utils/render.d.ts +12 -0
- package/dist/render/html/utils/render.d.ts.map +1 -0
- package/{src/render/html/utils/render.ts → dist/render/html/utils/render.js} +15 -22
- package/dist/render/html/utils/scrape-motion-values.d.ts +8 -0
- package/dist/render/html/utils/scrape-motion-values.d.ts.map +1 -0
- package/{src/render/html/utils/scrape-motion-values.ts → dist/render/html/utils/scrape-motion-values.js} +19 -26
- package/dist/render/html/utils/transform.d.ts +25 -0
- package/dist/render/html/utils/transform.d.ts.map +1 -0
- package/{src/render/html/utils/transform.ts → dist/render/html/utils/transform.js} +48 -51
- package/dist/render/html/visual-element.d.ts +2312 -0
- package/dist/render/html/visual-element.d.ts.map +1 -0
- package/{src/render/html/visual-element.ts → dist/render/html/visual-element.js} +111 -129
- package/dist/render/index.d.ts +8 -0
- package/dist/render/index.d.ts.map +1 -0
- package/{src/render/index.ts → dist/render/index.js} +771 -703
- package/{src → dist}/render/svg/UseSVGProps.svelte +2 -2
- package/dist/render/svg/UseSVGProps.svelte.d.ts +39 -0
- package/dist/render/svg/UseSVGProps.svelte.d.ts.map +1 -0
- package/dist/render/svg/config-motion.d.ts +24 -0
- package/dist/render/svg/config-motion.d.ts.map +1 -0
- package/dist/render/svg/config-motion.js +44 -0
- package/dist/render/svg/lowercase-elements.d.ts +10 -0
- package/dist/render/svg/lowercase-elements.d.ts.map +1 -0
- package/{src/render/svg/lowercase-elements.ts → dist/render/svg/lowercase-elements.js} +35 -35
- package/dist/render/svg/supported-elements.d.ts +12 -0
- package/dist/render/svg/supported-elements.d.ts.map +1 -0
- package/{src/render/svg/supported-elements.ts → dist/render/svg/supported-elements.js} +4 -10
- package/dist/render/svg/types.d.ts +39 -0
- package/dist/render/svg/types.d.ts.map +1 -0
- package/dist/render/svg/types.js +1 -0
- package/{src/render/svg/use-props.ts → dist/render/svg/use-props.d.ts} +13 -14
- package/dist/render/svg/use-props.d.ts.map +1 -0
- package/dist/render/svg/use-props.js +1 -0
- package/dist/render/svg/utils/build-attrs.d.ts +16 -0
- package/dist/render/svg/utils/build-attrs.d.ts.map +1 -0
- package/dist/render/svg/utils/build-attrs.js +40 -0
- package/dist/render/svg/utils/camel-case-attrs.d.ts +9 -0
- package/dist/render/svg/utils/camel-case-attrs.d.ts.map +1 -0
- package/{src/render/svg/utils/camel-case-attrs.ts → dist/render/svg/utils/camel-case-attrs.js} +27 -27
- package/dist/render/svg/utils/create-render-state.d.ts +11 -0
- package/dist/render/svg/utils/create-render-state.d.ts.map +1 -0
- package/dist/render/svg/utils/create-render-state.js +7 -0
- package/dist/render/svg/utils/path.d.ts +15 -0
- package/dist/render/svg/utils/path.d.ts.map +1 -0
- package/{src/render/svg/utils/path.ts → dist/render/svg/utils/path.js} +46 -49
- package/dist/render/svg/utils/render.d.ts +8 -0
- package/dist/render/svg/utils/render.d.ts.map +1 -0
- package/{src/render/svg/utils/render.ts → dist/render/svg/utils/render.js} +14 -22
- package/dist/render/svg/utils/scrape-motion-values.d.ts +8 -0
- package/dist/render/svg/utils/scrape-motion-values.d.ts.map +1 -0
- package/{src/render/svg/utils/scrape-motion-values.ts → dist/render/svg/utils/scrape-motion-values.js} +19 -26
- package/dist/render/svg/utils/transform-origin.d.ts +12 -0
- package/dist/render/svg/utils/transform-origin.d.ts.map +1 -0
- package/{src/render/svg/utils/transform-origin.ts → dist/render/svg/utils/transform-origin.js} +21 -30
- package/dist/render/svg/visual-element.d.ts +7 -0
- package/dist/render/svg/visual-element.d.ts.map +1 -0
- package/{src/render/svg/visual-element.ts → dist/render/svg/visual-element.js} +38 -44
- package/{src/render/types.ts → dist/render/types.d.ts} +149 -148
- package/dist/render/types.d.ts.map +1 -0
- package/dist/render/types.js +1 -0
- package/dist/render/utils/animation-state.d.ts +43 -0
- package/dist/render/utils/animation-state.d.ts.map +1 -0
- package/{src/render/utils/animation-state.ts → dist/render/utils/animation-state.js} +338 -375
- package/dist/render/utils/animation.d.ts +27 -0
- package/dist/render/utils/animation.d.ts.map +1 -0
- package/{src/render/utils/animation.ts → dist/render/utils/animation.js} +145 -167
- package/{src/render/utils/compare-by-depth.ts → dist/render/utils/compare-by-depth.d.ts} +15 -18
- package/dist/render/utils/compare-by-depth.d.ts.map +1 -0
- package/dist/render/utils/compare-by-depth.js +8 -0
- package/dist/render/utils/flat-tree.d.ts +14 -0
- package/dist/render/utils/flat-tree.d.ts.map +1 -0
- package/dist/render/utils/flat-tree.js +53 -0
- package/{src/render/utils/is-draggable.ts → dist/render/utils/is-draggable.d.ts} +12 -17
- package/dist/render/utils/is-draggable.d.ts.map +1 -0
- package/dist/render/utils/is-draggable.js +9 -0
- package/{src/render/utils/lifecycles.ts → dist/render/utils/lifecycles.d.ts} +122 -172
- package/dist/render/utils/lifecycles.d.ts.map +1 -0
- package/dist/render/utils/lifecycles.js +44 -0
- package/dist/render/utils/motion-values.d.ts +9 -0
- package/dist/render/utils/motion-values.d.ts.map +1 -0
- package/{src/render/utils/motion-values.ts → dist/render/utils/motion-values.js} +50 -59
- package/dist/render/utils/projection.d.ts +9 -0
- package/dist/render/utils/projection.d.ts.map +1 -0
- package/{src/render/utils/projection.ts → dist/render/utils/projection.js} +29 -38
- package/dist/render/utils/setters.d.ts +794 -0
- package/dist/render/utils/setters.d.ts.map +1 -0
- package/dist/render/utils/setters.js +128 -0
- package/{src/render/utils/state.ts → dist/render/utils/state.d.ts} +90 -113
- package/dist/render/utils/state.d.ts.map +1 -0
- package/dist/render/utils/state.js +26 -0
- package/{src/render/utils/types.ts → dist/render/utils/types.d.ts} +13 -12
- package/dist/render/utils/types.d.ts.map +1 -0
- package/dist/render/utils/types.js +13 -0
- package/dist/render/utils/variants.d.ts +27 -0
- package/dist/render/utils/variants.d.ts.map +1 -0
- package/{src/render/utils/variants.ts → dist/render/utils/variants.js} +66 -76
- package/{src/types/geometry.ts → dist/types/geometry.d.ts} +93 -91
- package/dist/types/geometry.d.ts.map +1 -0
- package/dist/types/geometry.js +1 -0
- package/{src/types.ts → dist/types.d.ts} +1091 -1088
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +1 -0
- package/dist/utils/UseUnmountEffect.svelte.d.ts +30 -0
- package/dist/utils/UseUnmountEffect.svelte.d.ts.map +1 -0
- package/dist/utils/array.d.ts +12 -0
- package/dist/utils/array.d.ts.map +1 -0
- package/{src/utils/array.ts → dist/utils/array.js} +16 -18
- package/dist/utils/each-axis.d.ts +11 -0
- package/dist/utils/each-axis.d.ts.map +1 -0
- package/{src/utils/each-axis.ts → dist/utils/each-axis.js} +13 -15
- package/dist/utils/errors.d.ts +5 -0
- package/dist/utils/errors.d.ts.map +1 -0
- package/dist/utils/errors.js +16 -0
- package/dist/utils/fix-process-env.d.ts +2 -0
- package/dist/utils/fix-process-env.d.ts.map +1 -0
- package/dist/utils/fix-process-env.js +19 -0
- package/dist/utils/geometry/delta-apply.d.ts +71 -0
- package/dist/utils/geometry/delta-apply.d.ts.map +1 -0
- package/{src/utils/geometry/delta-apply.ts → dist/utils/geometry/delta-apply.js} +162 -162
- package/dist/utils/geometry/delta-calc.d.ts +34 -0
- package/dist/utils/geometry/delta-calc.d.ts.map +1 -0
- package/{src/utils/geometry/delta-calc.ts → dist/utils/geometry/delta-calc.js} +84 -89
- package/dist/utils/geometry/index.d.ts +30 -0
- package/dist/utils/geometry/index.d.ts.map +1 -0
- package/{src/utils/geometry/index.ts → dist/utils/geometry/index.js} +70 -83
- package/dist/utils/is-browser.d.ts +11 -0
- package/dist/utils/is-browser.d.ts.map +1 -0
- package/{src/utils/is-browser.ts → dist/utils/is-browser.js} +10 -12
- package/dist/utils/is-numerical-string.d.ts +14 -0
- package/dist/utils/is-numerical-string.d.ts.map +1 -0
- package/{src/utils/is-numerical-string.ts → dist/utils/is-numerical-string.js} +13 -15
- package/dist/utils/is-ref-object.d.ts +13 -0
- package/dist/utils/is-ref-object.d.ts.map +1 -0
- package/dist/utils/is-ref-object.js +12 -0
- package/dist/utils/noop.d.ts +11 -0
- package/dist/utils/noop.d.ts.map +1 -0
- package/{src/utils/noop.ts → dist/utils/noop.js} +13 -15
- package/dist/utils/resolve-value.d.ts +9 -0
- package/dist/utils/resolve-value.d.ts.map +1 -0
- package/{src/utils/resolve-value.ts → dist/utils/resolve-value.js} +15 -23
- package/dist/utils/shallow-compare.d.ts +11 -0
- package/dist/utils/shallow-compare.d.ts.map +1 -0
- package/{src/utils/shallow-compare.ts → dist/utils/shallow-compare.js} +21 -23
- package/dist/utils/subscription-manager.d.ts +14 -0
- package/dist/utils/subscription-manager.d.ts.map +1 -0
- package/dist/utils/subscription-manager.js +69 -0
- package/dist/utils/time-conversion.d.ts +17 -0
- package/dist/utils/time-conversion.d.ts.map +1 -0
- package/{src/utils/time-conversion.ts → dist/utils/time-conversion.js} +16 -18
- package/{src/utils/transform.ts → dist/utils/transform.d.ts} +93 -120
- package/dist/utils/transform.d.ts.map +1 -0
- package/dist/utils/transform.js +23 -0
- package/dist/utils/use-cycle.d.ts +2 -0
- package/dist/utils/use-cycle.d.ts.map +1 -0
- package/{src/utils/use-cycle.ts → dist/utils/use-cycle.js} +65 -78
- package/dist/utils/use-force-update.d.ts +6 -0
- package/dist/utils/use-force-update.d.ts.map +1 -0
- package/dist/utils/use-force-update.js +2 -0
- package/dist/utils/use-reduced-motion.d.ts +33 -0
- package/dist/utils/use-reduced-motion.d.ts.map +1 -0
- package/{src/utils/use-reduced-motion.ts → dist/utils/use-reduced-motion.js} +52 -70
- package/{src/utils/use-unmount-effect.ts → dist/utils/use-unmount-effect.d.ts} +7 -8
- package/dist/utils/use-unmount-effect.d.ts.map +1 -0
- package/dist/utils/use-unmount-effect.js +1 -0
- package/{src/value/index.ts → dist/value/index.d.ts} +273 -409
- package/dist/value/index.d.ts.map +1 -0
- package/dist/value/index.js +546 -0
- package/dist/value/scroll/use-element-scroll.d.ts +9 -0
- package/dist/value/scroll/use-element-scroll.d.ts.map +1 -0
- package/dist/value/scroll/use-element-scroll.js +39 -0
- package/dist/value/scroll/use-viewport-scroll.d.ts +29 -0
- package/dist/value/scroll/use-viewport-scroll.d.ts.map +1 -0
- package/{src/value/scroll/use-viewport-scroll.ts → dist/value/scroll/use-viewport-scroll.js} +59 -81
- package/dist/value/scroll/utils.d.ts +25 -0
- package/dist/value/scroll/utils.d.ts.map +1 -0
- package/dist/value/scroll/utils.js +48 -0
- package/dist/value/use-combine-values.d.ts +9 -0
- package/dist/value/use-combine-values.d.ts.map +1 -0
- package/dist/value/use-combine-values.js +41 -0
- package/dist/value/use-motion-template.d.ts +31 -0
- package/dist/value/use-motion-template.d.ts.map +1 -0
- package/{src/value/use-motion-template.ts → dist/value/use-motion-template.js} +51 -57
- package/dist/value/use-motion-value.d.ts +27 -0
- package/dist/value/use-motion-value.d.ts.map +1 -0
- package/{src/value/use-motion-value.ts → dist/value/use-motion-value.js} +27 -27
- package/dist/value/use-spring.d.ts +29 -0
- package/dist/value/use-spring.d.ts.map +1 -0
- package/{src/value/use-spring.ts → dist/value/use-spring.js} +64 -84
- package/dist/value/use-transform.d.ts +87 -0
- package/dist/value/use-transform.d.ts.map +1 -0
- package/dist/value/use-transform.js +78 -0
- package/dist/value/use-velocity.d.ts +20 -0
- package/dist/value/use-velocity.d.ts.map +1 -0
- package/{src/value/use-velocity.ts → dist/value/use-velocity.js} +34 -44
- package/dist/value/utils/is-motion-value.d.ts +12 -0
- package/dist/value/utils/is-motion-value.d.ts.map +1 -0
- package/dist/value/utils/is-motion-value.js +8 -0
- package/dist/value/utils/resolve-motion-value.d.ts +16 -0
- package/dist/value/utils/resolve-motion-value.d.ts.map +1 -0
- package/{src/value/utils/resolve-motion-value.ts → dist/value/utils/resolve-motion-value.js} +25 -29
- package/package.json +58 -27
- package/src/animation/use-animated-state.ts +0 -1
- package/src/components/MotionConfig/MotionConfigScaleCorrection.ts +0 -47
- package/src/context/DOMcontext.ts +0 -21
- package/src/context/LayoutGroupContext.ts +0 -13
- package/src/context/LazyContext.ts +0 -18
- package/src/context/MotionContext/MotionContext.svelte +0 -27
- package/src/context/MotionContext/UseCreateMotionContext.svelte +0 -34
- package/src/context/MotionContext/index.ts +0 -14
- package/src/context/SharedLayoutContext.ts +0 -29
- package/src/events/UsePointerEvent.svelte +0 -76
- package/src/events/use-pointer-event.ts +0 -29
- package/src/gestures/PanSession.ts +0 -298
- package/src/gestures/drag/UseDragControls.svelte +0 -145
- package/src/gestures/drag/VisualElementDragControls.ts +0 -632
- package/src/gestures/drag/use-drag-controls.ts +0 -148
- package/src/index.ts +0 -104
- package/src/motion/features/layout/Animate.ts +0 -9
- package/src/motion/features/layout/Measure.ts +0 -9
- package/src/motion/index.ts +0 -64
- package/src/motion/utils/use-motion-ref.ts +0 -41
- package/src/motion/utils/use-visual-element.ts +0 -13
- package/src/render/dom/create-motion-class.ts +0 -12
- package/src/render/dom/motion-minimal.ts +0 -22
- package/src/render/dom/motion-proxy.ts +0 -107
- package/src/render/dom/projection/scale-correction.ts +0 -22
- package/src/render/dom/use-render.ts +0 -11
- package/src/render/dom/utils/create-config.ts +0 -33
- package/src/render/dom/utils/use-svg-props.ts +0 -1
- package/src/render/dom/value-types/defaults.ts +0 -30
- package/src/render/dom/value-types/find.ts +0 -31
- package/src/render/html/UseStyle.svelte +0 -47
- package/src/render/html/config-motion.ts +0 -23
- package/src/render/html/use-props.ts +0 -14
- package/src/render/html/utils/create-render-state.ts +0 -18
- package/src/render/svg/config-motion.ts +0 -51
- package/src/render/svg/types.ts +0 -51
- package/src/render/svg/utils/build-attrs.ts +0 -58
- package/src/render/svg/utils/create-render-state.ts +0 -17
- package/src/render/utils/flat-tree.ts +0 -35
- package/src/render/utils/setters.ts +0 -910
- package/src/utils/errors.ts +0 -22
- package/src/utils/fix-process-env.ts +0 -22
- package/src/utils/is-ref-object.ts +0 -16
- package/src/utils/subscription-manager.ts +0 -49
- package/src/utils/use-constant.ts +0 -23
- package/src/utils/use-force-update.ts +0 -7
- package/src/utils/use-isomorphic-effect.ts +0 -8
- package/src/value/scroll/use-element-scroll.ts +0 -73
- package/src/value/scroll/utils.ts +0 -76
- package/src/value/use-combine-values.ts +0 -53
- package/src/value/use-transform.ts +0 -216
- package/src/value/utils/is-motion-value.ts +0 -15
- /package/{src → dist}/animation/UseAnimation.svelte +0 -0
- /package/{src → dist}/components/MotionDiv.svelte +0 -0
- /package/{src → dist}/context/MotionContext/MotionContextProvider.svelte +0 -0
- /package/{src → dist}/gestures/UseFocusGesture.svelte +0 -0
- /package/{src → dist}/gestures/UseGestures.svelte +0 -0
- /package/{src → dist}/motion/features/AnimationState.svelte +0 -0
- /package/{src → dist}/motion/features/layout/AnimateLayoutContextProvider.svelte +0 -0
- /package/{src → dist}/utils/UseUnmountEffect.svelte +0 -0
|
@@ -1,632 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
based on framer-motion@4.1.17,
|
|
3
|
-
Copyright (c) 2018 Framer B.V.
|
|
4
|
-
*/
|
|
5
|
-
import type { RefObject } from "react";
|
|
6
|
-
import type { PanInfo } from "../../gestures/PanSession";
|
|
7
|
-
import type { MotionProps } from "../../motion/types";
|
|
8
|
-
import type { VisualElement } from "../../render/types";
|
|
9
|
-
import type { AxisBox2D, Point2D, TransformPoint2D } from "../../types/geometry";
|
|
10
|
-
import type { DraggableProps, ResolvedConstraints } from "./types";
|
|
11
|
-
import type { Lock } from "./utils/lock.js";
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
interface DragControlConfig {
|
|
15
|
-
visualElement: VisualElement;
|
|
16
|
-
}
|
|
17
|
-
export interface DragControlOptions {
|
|
18
|
-
snapToCursor?: boolean;
|
|
19
|
-
cursorProgress?: Point2D;
|
|
20
|
-
}
|
|
21
|
-
interface DragControlsProps extends DraggableProps {
|
|
22
|
-
transformPagePoint?: TransformPoint2D;
|
|
23
|
-
}
|
|
24
|
-
type DragDirection = "x" | "y";
|
|
25
|
-
export type expectsResolvedDragConstraints = ({ dragConstraints, onMeasureDragConstraints, }: MotionProps) => boolean;
|
|
26
|
-
|
|
27
|
-
/**
|
|
28
|
-
based on framer-motion@4.1.15,
|
|
29
|
-
Copyright (c) 2018 Framer B.V.
|
|
30
|
-
*/
|
|
31
|
-
import { flushSync } from 'framesync';
|
|
32
|
-
import { progress } from 'popmotion';
|
|
33
|
-
import { __assign, __read, __spreadArray } from 'tslib';
|
|
34
|
-
import { startAnimation } from '../../animation/utils/transitions.js';
|
|
35
|
-
import { getViewportPointFromEvent } from '../../events/event-info.js';
|
|
36
|
-
import { addDomEvent } from '../../events/use-dom-event.js';
|
|
37
|
-
import { addPointerEvent } from '../../events/use-pointer-event.js';
|
|
38
|
-
import { calcRelativeOffset } from '../../motion/features/layout/utils.js';
|
|
39
|
-
import { convertToRelativeProjection } from '../../render/dom/projection/convert-to-relative.js';
|
|
40
|
-
import { getBoundingBox } from '../../render/dom/projection/measure.js';
|
|
41
|
-
import { collectProjectingAncestors, collectProjectingChildren, updateLayoutMeasurement } from '../../render/dom/projection/utils.js';
|
|
42
|
-
import { batchLayout, flushLayout } from '../../render/dom/utils/batch-layout.js';
|
|
43
|
-
import { AnimationType } from '../../render/utils/types.js';
|
|
44
|
-
import { eachAxis } from '../../utils/each-axis.js';
|
|
45
|
-
import { invariant } from '../../utils/errors.js';
|
|
46
|
-
import { calcOrigin } from '../../utils/geometry/delta-calc.js';
|
|
47
|
-
import { axisBox, convertAxisBoxToBoundingBox, convertBoundingBoxToAxisBox } from '../../utils/geometry/index.js';
|
|
48
|
-
import { isRefObject } from '../../utils/is-ref-object.js';
|
|
49
|
-
import { PanSession } from '../PanSession.js';
|
|
50
|
-
import { applyConstraints, calcConstrainedMinPoint, calcPositionFromProgress, calcRelativeConstraints, calcViewportConstraints, defaultElastic, rebaseAxisConstraints, resolveDragElastic } from './utils/constraints.js';
|
|
51
|
-
import { getGlobalLock } from './utils/lock.js';
|
|
52
|
-
|
|
53
|
-
var elementDragControls: WeakMap<VisualElement<any, any>, VisualElementDragControls> = new WeakMap();
|
|
54
|
-
/**
|
|
55
|
-
*
|
|
56
|
-
*/
|
|
57
|
-
var lastPointerEvent;
|
|
58
|
-
|
|
59
|
-
class VisualElementDragControls {
|
|
60
|
-
/**
|
|
61
|
-
* Track whether we're currently dragging.
|
|
62
|
-
*
|
|
63
|
-
* @internal
|
|
64
|
-
*/
|
|
65
|
-
isDragging = false;
|
|
66
|
-
/**
|
|
67
|
-
* The current direction of drag, or `null` if both.
|
|
68
|
-
*
|
|
69
|
-
* @internal
|
|
70
|
-
*/
|
|
71
|
-
private currentDirection: DragDirection | null = null;
|
|
72
|
-
/**
|
|
73
|
-
* The permitted boundaries of travel, in pixels.
|
|
74
|
-
*
|
|
75
|
-
* @internal
|
|
76
|
-
*/
|
|
77
|
-
private constraints: ResolvedConstraints | false = false;
|
|
78
|
-
/**
|
|
79
|
-
* The per-axis resolved elastic values.
|
|
80
|
-
*
|
|
81
|
-
* @internal
|
|
82
|
-
*/
|
|
83
|
-
private elastic = axisBox();
|
|
84
|
-
/**
|
|
85
|
-
* A reference to the host component's latest props.
|
|
86
|
-
*
|
|
87
|
-
* @internal
|
|
88
|
-
*/
|
|
89
|
-
private props: MotionProps & DragControlsProps = {};
|
|
90
|
-
/**
|
|
91
|
-
* @internal
|
|
92
|
-
*/
|
|
93
|
-
private visualElement: VisualElement<HTMLElement>;
|
|
94
|
-
/**
|
|
95
|
-
* @internal
|
|
96
|
-
*/
|
|
97
|
-
private hasMutatedConstraints = false;
|
|
98
|
-
/**
|
|
99
|
-
* @internal
|
|
100
|
-
*/
|
|
101
|
-
private cancelLayout?;
|
|
102
|
-
/**
|
|
103
|
-
* Track the initial position of the cursor relative to the dragging element
|
|
104
|
-
* when dragging starts as a value of 0-1 on each axis. We then use this to calculate
|
|
105
|
-
* an ideal bounding box for the VisualElement renderer to project into every frame.
|
|
106
|
-
*
|
|
107
|
-
* @internal
|
|
108
|
-
*/
|
|
109
|
-
private cursorProgress: Point2D = {
|
|
110
|
-
x: 0.5,
|
|
111
|
-
y: 0.5,
|
|
112
|
-
};
|
|
113
|
-
private originPoint: Point2D = { x: 0, y: 0 };
|
|
114
|
-
private openGlobalLock: Lock | null = null;
|
|
115
|
-
/**
|
|
116
|
-
* @internal
|
|
117
|
-
*/
|
|
118
|
-
private panSession?: PanSession;
|
|
119
|
-
/**
|
|
120
|
-
* A reference to the measured constraints bounding box
|
|
121
|
-
*/
|
|
122
|
-
private constraintsBox?;
|
|
123
|
-
|
|
124
|
-
constructor({ visualElement }: DragControlConfig) {
|
|
125
|
-
this.visualElement = visualElement;
|
|
126
|
-
this.visualElement.enableLayoutProjection();
|
|
127
|
-
elementDragControls.set(visualElement, this);
|
|
128
|
-
}
|
|
129
|
-
/**
|
|
130
|
-
* Instantiate a PanSession for the drag gesture
|
|
131
|
-
*
|
|
132
|
-
* @public
|
|
133
|
-
*/
|
|
134
|
-
start(originEvent: PointerEvent, { snapToCursor = false, cursorProgress = undefined }: DragControlOptions = {}) {
|
|
135
|
-
const onSessionStart = (event: PointerEvent | typeof this.cancelLayout) => {
|
|
136
|
-
// Stop any animations on both axis values immediately. This allows the user to throw and catch
|
|
137
|
-
// the component.
|
|
138
|
-
this.stopMotion();
|
|
139
|
-
/**
|
|
140
|
-
* Save the initial point. We'll use this to calculate the pointer's position rather
|
|
141
|
-
* than the one we receive when the gesture actually starts. By then, the pointer will
|
|
142
|
-
* have already moved, and the perception will be of the pointer "slipping" across the element
|
|
143
|
-
*/
|
|
144
|
-
var initialPoint = getViewportPointFromEvent(event).point;
|
|
145
|
-
(event = this.cancelLayout) === null || event === void 0 ? void 0 : event.call(this);
|
|
146
|
-
var _self = this;
|
|
147
|
-
this.cancelLayout = batchLayout(function (read, write) {
|
|
148
|
-
var ancestors = collectProjectingAncestors(_self.visualElement);
|
|
149
|
-
var children = collectProjectingChildren(_self.visualElement);
|
|
150
|
-
var tree = __spreadArray(__spreadArray([], __read(ancestors)), __read(children));
|
|
151
|
-
var hasManuallySetCursorOrigin = false;
|
|
152
|
-
/**
|
|
153
|
-
* Apply a simple lock to the projection target. This ensures no animations
|
|
154
|
-
* can run on the projection box while this lock is active.
|
|
155
|
-
*/
|
|
156
|
-
_self.isLayoutDrag() && _self.visualElement.lockProjectionTarget();
|
|
157
|
-
write(function () {
|
|
158
|
-
tree.forEach(function (element) { return element.resetTransform(); });
|
|
159
|
-
});
|
|
160
|
-
read(function () {
|
|
161
|
-
updateLayoutMeasurement(_self.visualElement);
|
|
162
|
-
children.forEach(updateLayoutMeasurement);
|
|
163
|
-
});
|
|
164
|
-
write(function () {
|
|
165
|
-
tree.forEach(function (element) { return element.restoreTransform(); });
|
|
166
|
-
if (snapToCursor) {
|
|
167
|
-
hasManuallySetCursorOrigin = _self.snapToCursor(initialPoint);
|
|
168
|
-
}
|
|
169
|
-
});
|
|
170
|
-
read(function () {
|
|
171
|
-
var isRelativeDrag = Boolean(_self.getAxisMotionValue("x") && !_self.isExternalDrag());
|
|
172
|
-
if (!isRelativeDrag) {
|
|
173
|
-
_self.visualElement.rebaseProjectionTarget(true, _self.visualElement.measureViewportBox(false));
|
|
174
|
-
}
|
|
175
|
-
_self.visualElement.scheduleUpdateLayoutProjection();
|
|
176
|
-
/**
|
|
177
|
-
* When dragging starts, we want to find where the cursor is relative to the bounding box
|
|
178
|
-
* of the element. Every frame, we calculate a new bounding box using this relative position
|
|
179
|
-
* and let the visualElement renderer figure out how to reproject the element into this bounding
|
|
180
|
-
* box.
|
|
181
|
-
*
|
|
182
|
-
* By doing it this way, rather than applying an x/y transform directly to the element,
|
|
183
|
-
* we can ensure the component always visually sticks to the cursor as we'd expect, even
|
|
184
|
-
* if the DOM element itself changes layout as a result of React updates the user might
|
|
185
|
-
* make based on the drag position.
|
|
186
|
-
*/
|
|
187
|
-
var projection = _self.visualElement.projection;
|
|
188
|
-
eachAxis(function (axis) {
|
|
189
|
-
if (!hasManuallySetCursorOrigin) {
|
|
190
|
-
var _a = projection.target[axis], min = _a.min, max = _a.max;
|
|
191
|
-
_self.cursorProgress[axis] = cursorProgress
|
|
192
|
-
? cursorProgress[axis]
|
|
193
|
-
: progress(min, max, initialPoint[axis]);
|
|
194
|
-
}
|
|
195
|
-
/**
|
|
196
|
-
* If we have external drag MotionValues, record their origin point. On pointermove
|
|
197
|
-
* we'll apply the pan gesture offset directly to this value.
|
|
198
|
-
*/
|
|
199
|
-
var axisValue = _self.getAxisMotionValue(axis);
|
|
200
|
-
if (axisValue) {
|
|
201
|
-
_self.originPoint[axis] = axisValue.get();
|
|
202
|
-
}
|
|
203
|
-
});
|
|
204
|
-
});
|
|
205
|
-
write(function () {
|
|
206
|
-
flushSync.update();
|
|
207
|
-
flushSync.preRender();
|
|
208
|
-
flushSync.render();
|
|
209
|
-
flushSync.postRender();
|
|
210
|
-
});
|
|
211
|
-
read(function () { return _self.resolveDragConstraints(); });
|
|
212
|
-
});
|
|
213
|
-
};
|
|
214
|
-
const onStart = (event: PointerEvent, info: PanInfo) => {
|
|
215
|
-
// Attempt to grab the global drag gesture lock - maybe make this part of PanSession
|
|
216
|
-
const { drag, dragPropagation, onDragStart } = this.props;
|
|
217
|
-
if (drag && !dragPropagation) {
|
|
218
|
-
if (this.openGlobalLock)
|
|
219
|
-
this.openGlobalLock();
|
|
220
|
-
this.openGlobalLock = getGlobalLock(drag);
|
|
221
|
-
// If we don 't have the lock, don't start dragging
|
|
222
|
-
if (!this.openGlobalLock)
|
|
223
|
-
return;
|
|
224
|
-
}
|
|
225
|
-
flushLayout();
|
|
226
|
-
// Set current drag status
|
|
227
|
-
this.isDragging = true;
|
|
228
|
-
this.currentDirection = null;
|
|
229
|
-
// Fire onDragStart event
|
|
230
|
-
if(onDragStart) onDragStart(event, info);
|
|
231
|
-
const { animationState } = this.visualElement;
|
|
232
|
-
animationState && animationState.setActive(AnimationType.Drag, true);
|
|
233
|
-
};
|
|
234
|
-
const onMove = (event: PointerEvent, info: PanInfo) => {
|
|
235
|
-
const {
|
|
236
|
-
dragPropagation,
|
|
237
|
-
dragDirectionLock,
|
|
238
|
-
onDirectionLock,
|
|
239
|
-
onDrag,
|
|
240
|
-
} = this.props;
|
|
241
|
-
// If we didn't successfully receive the gesture lock, early return.
|
|
242
|
-
if (!dragPropagation && !this.openGlobalLock)
|
|
243
|
-
return;
|
|
244
|
-
var offset = info.offset;
|
|
245
|
-
// Attempt to detect drag direction if directionLock is true
|
|
246
|
-
if (dragDirectionLock && this.currentDirection === null) {
|
|
247
|
-
this.currentDirection = getCurrentDirection(offset);
|
|
248
|
-
// If we've successfully set a direction, notify listener
|
|
249
|
-
if (this.currentDirection !== null) {
|
|
250
|
-
onDirectionLock && onDirectionLock(this.currentDirection);
|
|
251
|
-
}
|
|
252
|
-
return;
|
|
253
|
-
}
|
|
254
|
-
// Update each point with the latest position
|
|
255
|
-
this.updateAxis("x", info.point, offset);
|
|
256
|
-
this.updateAxis("y", info.point, offset);
|
|
257
|
-
// Fire onDrag event
|
|
258
|
-
onDrag && onDrag(event, info);
|
|
259
|
-
// Update the last pointer event
|
|
260
|
-
lastPointerEvent = event;
|
|
261
|
-
};
|
|
262
|
-
const onSessionEnd = (event: PointerEvent, info: PanInfo) => {
|
|
263
|
-
return this.stop(event, info);
|
|
264
|
-
};
|
|
265
|
-
const transformPagePoint = this.props.transformPagePoint;
|
|
266
|
-
this.panSession = new PanSession(originEvent, {
|
|
267
|
-
onSessionStart,
|
|
268
|
-
onStart,
|
|
269
|
-
onMove,
|
|
270
|
-
onSessionEnd,
|
|
271
|
-
}, { transformPagePoint: transformPagePoint });
|
|
272
|
-
}
|
|
273
|
-
resolveDragConstraints() {
|
|
274
|
-
const { dragConstraints, dragElastic } = this.props;
|
|
275
|
-
var layout = this.visualElement.getLayoutState().layoutCorrected;
|
|
276
|
-
if (dragConstraints) {
|
|
277
|
-
this.constraints = isRefObject(dragConstraints)
|
|
278
|
-
? this.resolveRefConstraints(layout, dragConstraints)
|
|
279
|
-
: calcRelativeConstraints(layout, dragConstraints);
|
|
280
|
-
}
|
|
281
|
-
else {
|
|
282
|
-
this.constraints = false;
|
|
283
|
-
}
|
|
284
|
-
this.elastic = resolveDragElastic(dragElastic);
|
|
285
|
-
/**
|
|
286
|
-
* If we're outputting to external MotionValues, we want to rebase the measured constraints
|
|
287
|
-
* from viewport-relative to component-relative.
|
|
288
|
-
*/
|
|
289
|
-
if (this.constraints && !this.hasMutatedConstraints) {
|
|
290
|
-
eachAxis((axis) => {
|
|
291
|
-
if (this.getAxisMotionValue(axis)) {
|
|
292
|
-
this.constraints[axis] = rebaseAxisConstraints(layout[axis], this.constraints[axis]);
|
|
293
|
-
}
|
|
294
|
-
});
|
|
295
|
-
}
|
|
296
|
-
}
|
|
297
|
-
private resolveRefConstraints(layoutBox: AxisBox2D, constraints: RefObject<Element>) {
|
|
298
|
-
const { transformPagePoint, onMeasureDragConstraints } = this.props;
|
|
299
|
-
const constraintsElement = constraints.current as HTMLElement;
|
|
300
|
-
invariant(constraintsElement !== null, "If `dragConstraints` is set as a React ref, that ref must be passed to another component's `ref` prop.");
|
|
301
|
-
this.constraintsBox = getBoundingBox(constraintsElement, transformPagePoint);
|
|
302
|
-
var measuredConstraints = calcViewportConstraints(layoutBox, this.constraintsBox);
|
|
303
|
-
/**
|
|
304
|
-
* If there's an onMeasureDragConstraints listener we call it and
|
|
305
|
-
* if different constraints are returned, set constraints to that
|
|
306
|
-
*/
|
|
307
|
-
if (onMeasureDragConstraints) {
|
|
308
|
-
var userConstraints = onMeasureDragConstraints(convertAxisBoxToBoundingBox(measuredConstraints));
|
|
309
|
-
this.hasMutatedConstraints = !!userConstraints;
|
|
310
|
-
if (userConstraints) {
|
|
311
|
-
measuredConstraints = convertBoundingBoxToAxisBox(userConstraints);
|
|
312
|
-
}
|
|
313
|
-
}
|
|
314
|
-
return measuredConstraints;
|
|
315
|
-
}
|
|
316
|
-
private cancelDrag() {
|
|
317
|
-
var _a, _b;
|
|
318
|
-
this.visualElement.unlockProjectionTarget();
|
|
319
|
-
(_a = this.cancelLayout) === null || _a === void 0 ? void 0 : _a.call(this);
|
|
320
|
-
this.isDragging = false;
|
|
321
|
-
const { projection, animationState } = this.visualElement
|
|
322
|
-
this.panSession && this.panSession.end();
|
|
323
|
-
this.panSession = undefined;
|
|
324
|
-
if (!this.props.dragPropagation && this.openGlobalLock) {
|
|
325
|
-
this.openGlobalLock();
|
|
326
|
-
this.openGlobalLock = null;
|
|
327
|
-
}
|
|
328
|
-
animationState && animationState.setActive(AnimationType.Drag, false)
|
|
329
|
-
}
|
|
330
|
-
private stop(event: PointerEvent, info: PanInfo) {
|
|
331
|
-
var _a, _b, _c;
|
|
332
|
-
(_a = this.panSession) === null || _a === void 0 ? void 0 : _a.end();
|
|
333
|
-
this.panSession = undefined;
|
|
334
|
-
var isDragging = this.isDragging;
|
|
335
|
-
this.cancelDrag();
|
|
336
|
-
if (!isDragging)
|
|
337
|
-
return;
|
|
338
|
-
var velocity = info.velocity;
|
|
339
|
-
this.animateDragEnd(velocity);
|
|
340
|
-
const { onDragEnd } = this.props;
|
|
341
|
-
if (onDragEnd) onDragEnd(event, info)
|
|
342
|
-
}
|
|
343
|
-
snapToCursor(point: Point2D) {
|
|
344
|
-
var _this = this;
|
|
345
|
-
return eachAxis(function (axis) {
|
|
346
|
-
var drag = _this.props.drag;
|
|
347
|
-
// If we're not dragging this axis, do an early return.
|
|
348
|
-
if (!shouldDrag(axis, drag, _this.currentDirection))
|
|
349
|
-
return;
|
|
350
|
-
var axisValue = _this.getAxisMotionValue(axis);
|
|
351
|
-
if (axisValue) {
|
|
352
|
-
var box = _this.visualElement.getLayoutState().layout;
|
|
353
|
-
var length_1 = box[axis].max - box[axis].min;
|
|
354
|
-
var center = box[axis].min + length_1 / 2;
|
|
355
|
-
var offset = point[axis] - center;
|
|
356
|
-
_this.originPoint[axis] = point[axis];
|
|
357
|
-
axisValue.set(offset);
|
|
358
|
-
}
|
|
359
|
-
else {
|
|
360
|
-
_this.cursorProgress[axis] = 0.5;
|
|
361
|
-
return true;
|
|
362
|
-
}
|
|
363
|
-
}).includes(true);
|
|
364
|
-
};
|
|
365
|
-
/**
|
|
366
|
-
* Update the specified axis with the latest pointer information.
|
|
367
|
-
*/
|
|
368
|
-
private updateAxis(axis: DragDirection, point: Point2D, offset?: Point2D) {
|
|
369
|
-
var drag = this.props.drag;
|
|
370
|
-
// If we're not dragging this axis, do an early return.
|
|
371
|
-
if (!shouldDrag(axis, drag, this.currentDirection))
|
|
372
|
-
return;
|
|
373
|
-
return this.getAxisMotionValue(axis)
|
|
374
|
-
? this.updateAxisMotionValue(axis, offset)
|
|
375
|
-
: this.updateVisualElementAxis(axis, point);
|
|
376
|
-
};
|
|
377
|
-
private updateAxisMotionValue(axis: DragDirection, offset?: Point2D) {
|
|
378
|
-
var axisValue = this.getAxisMotionValue(axis);
|
|
379
|
-
if (!offset || !axisValue)
|
|
380
|
-
return;
|
|
381
|
-
var nextValue = this.originPoint[axis] + offset[axis];
|
|
382
|
-
var update = this.constraints
|
|
383
|
-
? applyConstraints(nextValue, this.constraints[axis], this.elastic[axis])
|
|
384
|
-
: nextValue;
|
|
385
|
-
axisValue.set(update);
|
|
386
|
-
};
|
|
387
|
-
private updateVisualElementAxis(axis: DragDirection, point: Point2D) {
|
|
388
|
-
var _a;
|
|
389
|
-
// Get the actual layout bounding box of the element
|
|
390
|
-
var axisLayout = this.visualElement.getLayoutState().layout[axis];
|
|
391
|
-
// Calculate its current length. In the future we might want to lerp this to animate
|
|
392
|
-
// between lengths if the layout changes as we change the DOM
|
|
393
|
-
var axisLength = axisLayout.max - axisLayout.min;
|
|
394
|
-
// Get the initial progress that the pointer sat on this axis on gesture start.
|
|
395
|
-
var axisProgress = this.cursorProgress[axis];
|
|
396
|
-
// Calculate a new min point based on the latest pointer position, constraints and elastic
|
|
397
|
-
var min = calcConstrainedMinPoint(point[axis], axisLength, axisProgress, (_a = this.constraints) === null || _a === void 0 ? void 0 : _a[axis], this.elastic[axis]);
|
|
398
|
-
// Update the axis viewport target with this new min and the length
|
|
399
|
-
this.visualElement.setProjectionTargetAxis(axis, min, min + axisLength);
|
|
400
|
-
};
|
|
401
|
-
setProps({ drag = false, dragDirectionLock = false, dragPropagation = false, dragConstraints = false, dragElastic = defaultElastic, dragMomentum = true, ...remainingProps }: DragControlsProps & MotionProps) {
|
|
402
|
-
this.props = {
|
|
403
|
-
...remainingProps,
|
|
404
|
-
drag,
|
|
405
|
-
dragDirectionLock,
|
|
406
|
-
dragPropagation,
|
|
407
|
-
dragConstraints,
|
|
408
|
-
dragElastic,
|
|
409
|
-
dragMomentum,
|
|
410
|
-
};
|
|
411
|
-
};
|
|
412
|
-
/**
|
|
413
|
-
* Drag works differently depending on which props are provided.
|
|
414
|
-
*
|
|
415
|
-
* - If _dragX and _dragY are provided, we output the gesture delta directly to those motion values.
|
|
416
|
-
* - If the component will perform layout animations, we output the gesture to the component's
|
|
417
|
-
* visual bounding box
|
|
418
|
-
* - Otherwise, we apply the delta to the x/y motion values.
|
|
419
|
-
*/
|
|
420
|
-
private getAxisMotionValue(axis: string) {
|
|
421
|
-
var _a = this.props, layout = _a.layout, layoutId = _a.layoutId;
|
|
422
|
-
var dragKey = "_drag" + axis.toUpperCase();
|
|
423
|
-
if (this.props[dragKey]) {
|
|
424
|
-
return this.props[dragKey];
|
|
425
|
-
}
|
|
426
|
-
else if (!layout && layoutId === undefined) {
|
|
427
|
-
return this.visualElement.getValue(axis, 0);
|
|
428
|
-
}
|
|
429
|
-
}
|
|
430
|
-
private isLayoutDrag() {
|
|
431
|
-
return !this.getAxisMotionValue("x");
|
|
432
|
-
}
|
|
433
|
-
private isExternalDrag() {
|
|
434
|
-
var _a = this.props, _dragX = _a._dragX, _dragY = _a._dragY;
|
|
435
|
-
return _dragX || _dragY;
|
|
436
|
-
}
|
|
437
|
-
private animateDragEnd(velocity) {
|
|
438
|
-
var _this = this;
|
|
439
|
-
var _a = this.props, drag = _a.drag, dragMomentum = _a.dragMomentum, dragElastic = _a.dragElastic, dragTransition = _a.dragTransition;
|
|
440
|
-
/**
|
|
441
|
-
* Everything beyond the drag gesture should be performed with
|
|
442
|
-
* relative projection so children stay in sync with their parent element.
|
|
443
|
-
*/
|
|
444
|
-
var isRelative = convertToRelativeProjection(this.visualElement, this.isLayoutDrag() && !this.isExternalDrag());
|
|
445
|
-
/**
|
|
446
|
-
* If we had previously resolved constraints relative to the viewport,
|
|
447
|
-
* we need to also convert those to a relative coordinate space for the animation
|
|
448
|
-
*/
|
|
449
|
-
var constraints = this.constraints || {};
|
|
450
|
-
if (isRelative &&
|
|
451
|
-
Object.keys(constraints).length &&
|
|
452
|
-
this.isLayoutDrag()) {
|
|
453
|
-
var projectionParent = this.visualElement.getProjectionParent();
|
|
454
|
-
if (projectionParent) {
|
|
455
|
-
var relativeConstraints_1 = calcRelativeOffset(projectionParent.projection.targetFinal, constraints);
|
|
456
|
-
eachAxis(function (axis) {
|
|
457
|
-
var _a = relativeConstraints_1[axis], min = _a.min, max = _a.max;
|
|
458
|
-
constraints[axis] = {
|
|
459
|
-
min: isNaN(min) ? undefined : min,
|
|
460
|
-
max: isNaN(max) ? undefined : max,
|
|
461
|
-
};
|
|
462
|
-
});
|
|
463
|
-
}
|
|
464
|
-
}
|
|
465
|
-
var momentumAnimations = eachAxis(function (axis) {
|
|
466
|
-
var _a;
|
|
467
|
-
if (!shouldDrag(axis, drag, _this.currentDirection)) {
|
|
468
|
-
return;
|
|
469
|
-
}
|
|
470
|
-
var transition = (_a = constraints === null || constraints === void 0 ? void 0 : constraints[axis]) !== null && _a !== void 0 ? _a : {};
|
|
471
|
-
/**
|
|
472
|
-
* Overdamp the boundary spring if `dragElastic` is disabled. There's still a frame
|
|
473
|
-
* of spring animations so we should look into adding a disable spring option to `inertia`.
|
|
474
|
-
* We could do something here where we affect the `bounceStiffness` and `bounceDamping`
|
|
475
|
-
* using the value of `dragElastic`.
|
|
476
|
-
*/
|
|
477
|
-
var bounceStiffness = dragElastic ? 200 : 1000000;
|
|
478
|
-
var bounceDamping = dragElastic ? 40 : 10000000;
|
|
479
|
-
var inertia = __assign(__assign({ type: "inertia", velocity: dragMomentum ? velocity[axis] : 0, bounceStiffness: bounceStiffness,
|
|
480
|
-
bounceDamping: bounceDamping, timeConstant: 750, restDelta: 1, restSpeed: 10 }, dragTransition), transition);
|
|
481
|
-
// If we're not animating on an externally-provided `MotionValue` we can use the
|
|
482
|
-
// component's animation controls which will handle interactions with whileHover (etc),
|
|
483
|
-
// otherwise we just have to animate the `MotionValue` itself.
|
|
484
|
-
return _this.getAxisMotionValue(axis)
|
|
485
|
-
? _this.startAxisValueAnimation(axis, inertia)
|
|
486
|
-
: _this.visualElement.startLayoutAnimation(axis, inertia, isRelative);
|
|
487
|
-
});
|
|
488
|
-
// Run all animations and then resolve the new drag constraints.
|
|
489
|
-
return Promise.all(momentumAnimations).then(function () {
|
|
490
|
-
var _a, _b;
|
|
491
|
-
(_b = (_a = _this.props).onDragTransitionEnd) === null || _b === void 0 ? void 0 : _b.call(_a);
|
|
492
|
-
});
|
|
493
|
-
}
|
|
494
|
-
stopMotion() {
|
|
495
|
-
var _this = this;
|
|
496
|
-
eachAxis(function (axis) {
|
|
497
|
-
var axisValue = _this.getAxisMotionValue(axis);
|
|
498
|
-
axisValue
|
|
499
|
-
? axisValue.stop()
|
|
500
|
-
: _this.visualElement.stopLayoutAnimation();
|
|
501
|
-
});
|
|
502
|
-
}
|
|
503
|
-
private startAxisValueAnimation(axis, transition) {
|
|
504
|
-
var axisValue = this.getAxisMotionValue(axis);
|
|
505
|
-
if (!axisValue)
|
|
506
|
-
return;
|
|
507
|
-
var currentValue = axisValue.get();
|
|
508
|
-
axisValue.set(currentValue);
|
|
509
|
-
axisValue.set(currentValue); // Set twice to hard-reset velocity
|
|
510
|
-
return startAnimation(axis, axisValue, 0, transition);
|
|
511
|
-
}
|
|
512
|
-
scalePoint() {
|
|
513
|
-
var _this = this;
|
|
514
|
-
var _a = this.props, drag = _a.drag, dragConstraints = _a.dragConstraints;
|
|
515
|
-
if (!isRefObject(dragConstraints) || !this.constraintsBox)
|
|
516
|
-
return;
|
|
517
|
-
// Stop any current animations as there can be some visual glitching if we resize mid animation
|
|
518
|
-
this.stopMotion();
|
|
519
|
-
// Record the relative progress of the targetBox relative to the constraintsBox
|
|
520
|
-
var boxProgress = { x: 0, y: 0 };
|
|
521
|
-
eachAxis(function (axis) {
|
|
522
|
-
boxProgress[axis] = calcOrigin(_this.visualElement.projection.target[axis], _this.constraintsBox[axis]);
|
|
523
|
-
});
|
|
524
|
-
/**
|
|
525
|
-
* For each axis, calculate the current progress of the layout axis within the constraints.
|
|
526
|
-
* Then, using the latest layout and constraints measurements, reposition the new layout axis
|
|
527
|
-
* proportionally within the constraints.
|
|
528
|
-
*/
|
|
529
|
-
this.updateConstraints(function () {
|
|
530
|
-
eachAxis(function (axis) {
|
|
531
|
-
if (!shouldDrag(axis, drag, null))
|
|
532
|
-
return;
|
|
533
|
-
// Calculate the position of the targetBox relative to the constraintsBox using the
|
|
534
|
-
// previously calculated progress
|
|
535
|
-
var _a = calcPositionFromProgress(_this.visualElement.projection.target[axis], _this.constraintsBox[axis], boxProgress[axis]), min = _a.min, max = _a.max;
|
|
536
|
-
_this.visualElement.setProjectionTargetAxis(axis, min, max);
|
|
537
|
-
});
|
|
538
|
-
});
|
|
539
|
-
/**
|
|
540
|
-
* If any other draggable components are queuing the same tasks synchronously
|
|
541
|
-
* this will wait until they've all been scheduled before flushing.
|
|
542
|
-
*/
|
|
543
|
-
setTimeout(flushLayout, 1);
|
|
544
|
-
}
|
|
545
|
-
updateConstraints(onReady?: () => void) {
|
|
546
|
-
var _this = this;
|
|
547
|
-
this.cancelLayout = batchLayout(function (read, write) {
|
|
548
|
-
var ancestors = collectProjectingAncestors(_this.visualElement);
|
|
549
|
-
write(function () {
|
|
550
|
-
return ancestors.forEach(function (element) { return element.resetTransform(); });
|
|
551
|
-
});
|
|
552
|
-
read(function () { return updateLayoutMeasurement(_this.visualElement); });
|
|
553
|
-
write(function () {
|
|
554
|
-
return ancestors.forEach(function (element) { return element.restoreTransform(); });
|
|
555
|
-
});
|
|
556
|
-
read(function () {
|
|
557
|
-
_this.resolveDragConstraints();
|
|
558
|
-
});
|
|
559
|
-
if (onReady)
|
|
560
|
-
write(onReady);
|
|
561
|
-
});
|
|
562
|
-
};
|
|
563
|
-
mount(visualElement: VisualElement): () => void {
|
|
564
|
-
var _this = this;
|
|
565
|
-
var element = visualElement.getInstance();
|
|
566
|
-
/**
|
|
567
|
-
* Attach a pointerdown event listener on this DOM element to initiate drag tracking.
|
|
568
|
-
*/
|
|
569
|
-
var stopPointerListener = addPointerEvent(element, "pointerdown", function (event) {
|
|
570
|
-
var _a = _this.props, drag = _a.drag, _b = _a.dragListener, dragListener = _b === void 0 ? true : _b;
|
|
571
|
-
drag && dragListener && _this.start(event);
|
|
572
|
-
});
|
|
573
|
-
/**
|
|
574
|
-
* Attach a window resize listener to scale the draggable target within its defined
|
|
575
|
-
* constraints as the window resizes.
|
|
576
|
-
*/
|
|
577
|
-
var stopResizeListener = addDomEvent(window, "resize", function () {
|
|
578
|
-
_this.scalePoint();
|
|
579
|
-
});
|
|
580
|
-
/**
|
|
581
|
-
* Ensure drag constraints are resolved correctly relative to the dragging element
|
|
582
|
-
* whenever its layout changes.
|
|
583
|
-
*/
|
|
584
|
-
var stopLayoutUpdateListener = visualElement.onLayoutUpdate(function () {
|
|
585
|
-
if (_this.isDragging) {
|
|
586
|
-
_this.resolveDragConstraints();
|
|
587
|
-
}
|
|
588
|
-
});
|
|
589
|
-
/**
|
|
590
|
-
* If the previous component with this same layoutId was dragging at the time
|
|
591
|
-
* it was unmounted, we want to continue the same gesture on this component.
|
|
592
|
-
*/
|
|
593
|
-
var prevDragCursor = visualElement.prevDragCursor;
|
|
594
|
-
if (prevDragCursor) {
|
|
595
|
-
this.start(lastPointerEvent, { cursorProgress: prevDragCursor });
|
|
596
|
-
}
|
|
597
|
-
/**
|
|
598
|
-
* Return a function that will teardown the drag gesture
|
|
599
|
-
*/
|
|
600
|
-
return function () {
|
|
601
|
-
stopPointerListener === null || stopPointerListener === void 0 ? void 0 : stopPointerListener();
|
|
602
|
-
stopResizeListener === null || stopResizeListener === void 0 ? void 0 : stopResizeListener();
|
|
603
|
-
stopLayoutUpdateListener === null || stopLayoutUpdateListener === void 0 ? void 0 : stopLayoutUpdateListener();
|
|
604
|
-
_this.cancelDrag();
|
|
605
|
-
};
|
|
606
|
-
};
|
|
607
|
-
}
|
|
608
|
-
|
|
609
|
-
function shouldDrag(direction: DragDirection, drag: boolean | DragDirection | undefined, currentDirection: null | DragDirection) {
|
|
610
|
-
return ((drag === true || drag === direction) &&
|
|
611
|
-
(currentDirection === null || currentDirection === direction));
|
|
612
|
-
}
|
|
613
|
-
/**
|
|
614
|
-
* Based on an x/y offset determine the current drag direction. If both axis' offsets are lower
|
|
615
|
-
* than the provided threshold, return `null`.
|
|
616
|
-
*
|
|
617
|
-
* @param offset - The x/y offset from origin.
|
|
618
|
-
* @param lockThreshold - (Optional) - the minimum absolute offset before we can determine a drag direction.
|
|
619
|
-
*/
|
|
620
|
-
function getCurrentDirection(offset: Point2D, lockThreshold = 10) {
|
|
621
|
-
var direction: DragDirection | null = null;
|
|
622
|
-
if (Math.abs(offset.y) > lockThreshold) {
|
|
623
|
-
direction = "y";
|
|
624
|
-
}
|
|
625
|
-
else if (Math.abs(offset.x) > lockThreshold) {
|
|
626
|
-
direction = "x";
|
|
627
|
-
}
|
|
628
|
-
return direction;
|
|
629
|
-
}
|
|
630
|
-
|
|
631
|
-
export { VisualElementDragControls, elementDragControls };
|
|
632
|
-
|