motion 12.18.1 → 12.19.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/dist/cjs/mini.js +7 -1063
- package/dist/es/debug.mjs +1 -0
- package/dist/es/index.mjs +1 -0
- package/dist/es/mini.mjs +1 -0
- package/dist/es/react-client.mjs +2 -0
- package/dist/es/react-m.mjs +2 -0
- package/dist/es/react-mini.mjs +2 -0
- package/dist/es/react.mjs +2 -0
- package/dist/motion.dev.js +2 -2
- package/dist/motion.js +1 -1
- package/mini/package.json +1 -1
- package/package.json +11 -11
- package/react/package.json +1 -1
- package/react-client/package.json +1 -1
- package/react-m/package.json +1 -1
- package/dist/es/framer-motion/dist/es/animation/animate/index.mjs +0 -34
- package/dist/es/framer-motion/dist/es/animation/animate/resolve-subjects.mjs +0 -19
- package/dist/es/framer-motion/dist/es/animation/animate/sequence.mjs +0 -14
- package/dist/es/framer-motion/dist/es/animation/animate/single-value.mjs +0 -11
- package/dist/es/framer-motion/dist/es/animation/animate/subject.mjs +0 -52
- package/dist/es/framer-motion/dist/es/animation/animators/waapi/animate-elements.mjs +0 -112
- package/dist/es/framer-motion/dist/es/animation/animators/waapi/animate-sequence.mjs +0 -13
- package/dist/es/framer-motion/dist/es/animation/animators/waapi/animate-style.mjs +0 -12
- package/dist/es/framer-motion/dist/es/animation/animators/waapi/utils/get-final-keyframe.mjs +0 -12
- package/dist/es/framer-motion/dist/es/animation/hooks/animation-controls.mjs +0 -80
- package/dist/es/framer-motion/dist/es/animation/hooks/use-animate-style.mjs +0 -17
- package/dist/es/framer-motion/dist/es/animation/hooks/use-animate.mjs +0 -17
- package/dist/es/framer-motion/dist/es/animation/hooks/use-animated-state.mjs +0 -64
- package/dist/es/framer-motion/dist/es/animation/hooks/use-animation.mjs +0 -41
- package/dist/es/framer-motion/dist/es/animation/interfaces/motion-value.mjs +0 -102
- package/dist/es/framer-motion/dist/es/animation/interfaces/visual-element-target.mjs +0 -85
- package/dist/es/framer-motion/dist/es/animation/interfaces/visual-element-variant.mjs +0 -65
- package/dist/es/framer-motion/dist/es/animation/interfaces/visual-element.mjs +0 -26
- package/dist/es/framer-motion/dist/es/animation/optimized-appear/data-id.mjs +0 -6
- package/dist/es/framer-motion/dist/es/animation/optimized-appear/get-appear-id.mjs +0 -7
- package/dist/es/framer-motion/dist/es/animation/optimized-appear/handoff.mjs +0 -38
- package/dist/es/framer-motion/dist/es/animation/optimized-appear/start.mjs +0 -171
- package/dist/es/framer-motion/dist/es/animation/optimized-appear/store-id.mjs +0 -8
- package/dist/es/framer-motion/dist/es/animation/optimized-appear/store.mjs +0 -4
- package/dist/es/framer-motion/dist/es/animation/sequence/create.mjs +0 -256
- package/dist/es/framer-motion/dist/es/animation/sequence/utils/calc-repeat-duration.mjs +0 -5
- package/dist/es/framer-motion/dist/es/animation/sequence/utils/calc-time.mjs +0 -23
- package/dist/es/framer-motion/dist/es/animation/sequence/utils/edit.mjs +0 -31
- package/dist/es/framer-motion/dist/es/animation/sequence/utils/normalize-times.mjs +0 -13
- package/dist/es/framer-motion/dist/es/animation/sequence/utils/sort.mjs +0 -14
- package/dist/es/framer-motion/dist/es/animation/utils/create-visual-element.mjs +0 -45
- package/dist/es/framer-motion/dist/es/animation/utils/default-transitions.mjs +0 -40
- package/dist/es/framer-motion/dist/es/animation/utils/is-animation-controls.mjs +0 -7
- package/dist/es/framer-motion/dist/es/animation/utils/is-dom-keyframes.mjs +0 -5
- package/dist/es/framer-motion/dist/es/animation/utils/is-keyframes-target.mjs +0 -5
- package/dist/es/framer-motion/dist/es/animation/utils/is-transition-defined.mjs +0 -10
- package/dist/es/framer-motion/dist/es/animation/utils/stagger.mjs +0 -26
- package/dist/es/framer-motion/dist/es/components/AnimatePresence/PopChild.mjs +0 -87
- package/dist/es/framer-motion/dist/es/components/AnimatePresence/PresenceChild.mjs +0 -64
- package/dist/es/framer-motion/dist/es/components/AnimatePresence/index.mjs +0 -166
- package/dist/es/framer-motion/dist/es/components/AnimatePresence/use-presence-data.mjs +0 -9
- package/dist/es/framer-motion/dist/es/components/AnimatePresence/use-presence.mjs +0 -70
- package/dist/es/framer-motion/dist/es/components/AnimatePresence/utils.mjs +0 -14
- package/dist/es/framer-motion/dist/es/components/AnimateSharedLayout.mjs +0 -15
- package/dist/es/framer-motion/dist/es/components/LayoutGroup/index.mjs +0 -32
- package/dist/es/framer-motion/dist/es/components/LazyMotion/index.mjs +0 -68
- package/dist/es/framer-motion/dist/es/components/MotionConfig/index.mjs +0 -48
- package/dist/es/framer-motion/dist/es/components/Reorder/Group.mjs +0 -53
- package/dist/es/framer-motion/dist/es/components/Reorder/Item.mjs +0 -34
- package/dist/es/framer-motion/dist/es/components/Reorder/namespace.mjs +0 -2
- package/dist/es/framer-motion/dist/es/components/Reorder/utils/check-reorder.mjs +0 -24
- package/dist/es/framer-motion/dist/es/context/DeprecatedLayoutGroupContext.mjs +0 -10
- package/dist/es/framer-motion/dist/es/context/LayoutGroupContext.mjs +0 -6
- package/dist/es/framer-motion/dist/es/context/LazyContext.mjs +0 -6
- package/dist/es/framer-motion/dist/es/context/MotionConfigContext.mjs +0 -13
- package/dist/es/framer-motion/dist/es/context/MotionContext/create.mjs +0 -13
- package/dist/es/framer-motion/dist/es/context/MotionContext/index.mjs +0 -6
- package/dist/es/framer-motion/dist/es/context/MotionContext/utils.mjs +0 -17
- package/dist/es/framer-motion/dist/es/context/PresenceContext.mjs +0 -10
- package/dist/es/framer-motion/dist/es/context/ReorderContext.mjs +0 -6
- package/dist/es/framer-motion/dist/es/context/SwitchLayoutGroupContext.mjs +0 -9
- package/dist/es/framer-motion/dist/es/events/add-dom-event.mjs +0 -6
- package/dist/es/framer-motion/dist/es/events/add-pointer-event.mjs +0 -8
- package/dist/es/framer-motion/dist/es/events/event-info.mjs +0 -15
- package/dist/es/framer-motion/dist/es/events/use-dom-event.mjs +0 -34
- package/dist/es/framer-motion/dist/es/gestures/drag/VisualElementDragControls.mjs +0 -479
- package/dist/es/framer-motion/dist/es/gestures/drag/index.mjs +0 -27
- package/dist/es/framer-motion/dist/es/gestures/drag/use-drag-controls.mjs +0 -88
- package/dist/es/framer-motion/dist/es/gestures/drag/utils/constraints.mjs +0 -129
- package/dist/es/framer-motion/dist/es/gestures/focus.mjs +0 -41
- package/dist/es/framer-motion/dist/es/gestures/hover.mjs +0 -30
- package/dist/es/framer-motion/dist/es/gestures/pan/PanSession.mjs +0 -156
- package/dist/es/framer-motion/dist/es/gestures/pan/index.mjs +0 -50
- package/dist/es/framer-motion/dist/es/gestures/press.mjs +0 -33
- package/dist/es/framer-motion/dist/es/motion/features/Feature.mjs +0 -9
- package/dist/es/framer-motion/dist/es/motion/features/animation/exit.mjs +0 -36
- package/dist/es/framer-motion/dist/es/motion/features/animation/index.mjs +0 -40
- package/dist/es/framer-motion/dist/es/motion/features/animations.mjs +0 -13
- package/dist/es/framer-motion/dist/es/motion/features/definitions.mjs +0 -28
- package/dist/es/framer-motion/dist/es/motion/features/drag.mjs +0 -17
- package/dist/es/framer-motion/dist/es/motion/features/gestures.mjs +0 -21
- package/dist/es/framer-motion/dist/es/motion/features/layout/MeasureLayout.mjs +0 -135
- package/dist/es/framer-motion/dist/es/motion/features/layout.mjs +0 -11
- package/dist/es/framer-motion/dist/es/motion/features/load-features.mjs +0 -12
- package/dist/es/framer-motion/dist/es/motion/features/viewport/index.mjs +0 -72
- package/dist/es/framer-motion/dist/es/motion/features/viewport/observers.mjs +0 -49
- package/dist/es/framer-motion/dist/es/motion/index.mjs +0 -101
- package/dist/es/framer-motion/dist/es/motion/utils/is-forced-motion-value.mjs +0 -11
- package/dist/es/framer-motion/dist/es/motion/utils/is-motion-component.mjs +0 -12
- package/dist/es/framer-motion/dist/es/motion/utils/symbol.mjs +0 -3
- package/dist/es/framer-motion/dist/es/motion/utils/unwrap-motion-component.mjs +0 -17
- package/dist/es/framer-motion/dist/es/motion/utils/use-motion-ref.mjs +0 -38
- package/dist/es/framer-motion/dist/es/motion/utils/use-visual-element.mjs +0 -133
- package/dist/es/framer-motion/dist/es/motion/utils/use-visual-state.mjs +0 -79
- package/dist/es/framer-motion/dist/es/motion/utils/valid-prop.mjs +0 -57
- package/dist/es/framer-motion/dist/es/projection/animation/mix-values.mjs +0 -91
- package/dist/es/framer-motion/dist/es/projection/geometry/conversion.mjs +0 -33
- package/dist/es/framer-motion/dist/es/projection/geometry/copy.mjs +0 -31
- package/dist/es/framer-motion/dist/es/projection/geometry/delta-apply.mjs +0 -119
- package/dist/es/framer-motion/dist/es/projection/geometry/delta-calc.mjs +0 -52
- package/dist/es/framer-motion/dist/es/projection/geometry/delta-remove.mjs +0 -54
- package/dist/es/framer-motion/dist/es/projection/geometry/models.mjs +0 -17
- package/dist/es/framer-motion/dist/es/projection/geometry/utils.mjs +0 -31
- package/dist/es/framer-motion/dist/es/projection/node/DocumentProjectionNode.mjs +0 -13
- package/dist/es/framer-motion/dist/es/projection/node/HTMLProjectionNode.mjs +0 -27
- package/dist/es/framer-motion/dist/es/projection/node/create-projection-node.mjs +0 -1605
- package/dist/es/framer-motion/dist/es/projection/node/group.mjs +0 -24
- package/dist/es/framer-motion/dist/es/projection/node/state.mjs +0 -19
- package/dist/es/framer-motion/dist/es/projection/shared/stack.mjs +0 -112
- package/dist/es/framer-motion/dist/es/projection/styles/scale-border-radius.mjs +0 -41
- package/dist/es/framer-motion/dist/es/projection/styles/scale-box-shadow.mjs +0 -35
- package/dist/es/framer-motion/dist/es/projection/styles/scale-correction.mjs +0 -13
- package/dist/es/framer-motion/dist/es/projection/styles/transform.mjs +0 -49
- package/dist/es/framer-motion/dist/es/projection/use-instant-layout-transition.mjs +0 -14
- package/dist/es/framer-motion/dist/es/projection/use-reset-projection.mjs +0 -14
- package/dist/es/framer-motion/dist/es/projection/utils/each-axis.mjs +0 -5
- package/dist/es/framer-motion/dist/es/projection/utils/has-transform.mjs +0 -26
- package/dist/es/framer-motion/dist/es/projection/utils/measure.mjs +0 -17
- package/dist/es/framer-motion/dist/es/render/VisualElement.mjs +0 -478
- package/dist/es/framer-motion/dist/es/render/components/create-factory.mjs +0 -23
- package/dist/es/framer-motion/dist/es/render/components/create-proxy.mjs +0 -38
- package/dist/es/framer-motion/dist/es/render/components/m/create.mjs +0 -6
- package/dist/es/framer-motion/dist/es/render/components/m/elements.mjs +0 -227
- package/dist/es/framer-motion/dist/es/render/components/m/proxy.mjs +0 -6
- package/dist/es/framer-motion/dist/es/render/components/motion/create.mjs +0 -15
- package/dist/es/framer-motion/dist/es/render/components/motion/elements.mjs +0 -194
- package/dist/es/framer-motion/dist/es/render/components/motion/proxy.mjs +0 -6
- package/dist/es/framer-motion/dist/es/render/dom/DOMVisualElement.mjs +0 -43
- package/dist/es/framer-motion/dist/es/render/dom/create-visual-element.mjs +0 -14
- package/dist/es/framer-motion/dist/es/render/dom/features-animation.mjs +0 -14
- package/dist/es/framer-motion/dist/es/render/dom/features-max.mjs +0 -14
- package/dist/es/framer-motion/dist/es/render/dom/features-min.mjs +0 -12
- package/dist/es/framer-motion/dist/es/render/dom/scroll/attach-animation.mjs +0 -17
- package/dist/es/framer-motion/dist/es/render/dom/scroll/attach-function.mjs +0 -23
- package/dist/es/framer-motion/dist/es/render/dom/scroll/index.mjs +0 -14
- package/dist/es/framer-motion/dist/es/render/dom/scroll/info.mjs +0 -56
- package/dist/es/framer-motion/dist/es/render/dom/scroll/offsets/edge.mjs +0 -45
- package/dist/es/framer-motion/dist/es/render/dom/scroll/offsets/index.mjs +0 -60
- package/dist/es/framer-motion/dist/es/render/dom/scroll/offsets/inset.mjs +0 -47
- package/dist/es/framer-motion/dist/es/render/dom/scroll/offsets/offset.mjs +0 -35
- package/dist/es/framer-motion/dist/es/render/dom/scroll/offsets/presets.mjs +0 -20
- package/dist/es/framer-motion/dist/es/render/dom/scroll/on-scroll-handler.mjs +0 -48
- package/dist/es/framer-motion/dist/es/render/dom/scroll/track.mjs +0 -81
- package/dist/es/framer-motion/dist/es/render/dom/scroll/utils/get-timeline.mjs +0 -30
- package/dist/es/framer-motion/dist/es/render/dom/use-render.mjs +0 -33
- package/dist/es/framer-motion/dist/es/render/dom/utils/camel-to-dash.mjs +0 -6
- package/dist/es/framer-motion/dist/es/render/dom/utils/filter-props.mjs +0 -59
- package/dist/es/framer-motion/dist/es/render/dom/utils/is-svg-component.mjs +0 -30
- package/dist/es/framer-motion/dist/es/render/dom/viewport/index.mjs +0 -43
- package/dist/es/framer-motion/dist/es/render/html/HTMLVisualElement.mjs +0 -44
- package/dist/es/framer-motion/dist/es/render/html/config-motion.mjs +0 -12
- package/dist/es/framer-motion/dist/es/render/html/use-props.mjs +0 -57
- package/dist/es/framer-motion/dist/es/render/html/utils/build-styles.mjs +0 -65
- package/dist/es/framer-motion/dist/es/render/html/utils/build-transform.mjs +0 -62
- package/dist/es/framer-motion/dist/es/render/html/utils/create-render-state.mjs +0 -8
- package/dist/es/framer-motion/dist/es/render/html/utils/render.mjs +0 -9
- package/dist/es/framer-motion/dist/es/render/html/utils/scrape-motion-values.mjs +0 -19
- package/dist/es/framer-motion/dist/es/render/object/ObjectVisualElement.mjs +0 -41
- package/dist/es/framer-motion/dist/es/render/store.mjs +0 -3
- package/dist/es/framer-motion/dist/es/render/svg/SVGVisualElement.mjs +0 -45
- package/dist/es/framer-motion/dist/es/render/svg/config-motion.mjs +0 -12
- package/dist/es/framer-motion/dist/es/render/svg/lowercase-elements.mjs +0 -33
- package/dist/es/framer-motion/dist/es/render/svg/use-props.mjs +0 -24
- package/dist/es/framer-motion/dist/es/render/svg/utils/build-attrs.mjs +0 -57
- package/dist/es/framer-motion/dist/es/render/svg/utils/camel-case-attrs.mjs +0 -30
- package/dist/es/framer-motion/dist/es/render/svg/utils/create-render-state.mjs +0 -8
- package/dist/es/framer-motion/dist/es/render/svg/utils/is-svg-tag.mjs +0 -3
- package/dist/es/framer-motion/dist/es/render/svg/utils/path.mjs +0 -32
- package/dist/es/framer-motion/dist/es/render/svg/utils/render.mjs +0 -12
- package/dist/es/framer-motion/dist/es/render/svg/utils/scrape-motion-values.mjs +0 -19
- package/dist/es/framer-motion/dist/es/render/utils/animation-state.mjs +0 -342
- package/dist/es/framer-motion/dist/es/render/utils/compare-by-depth.mjs +0 -3
- package/dist/es/framer-motion/dist/es/render/utils/flat-tree.mjs +0 -24
- package/dist/es/framer-motion/dist/es/render/utils/get-variant-context.mjs +0 -28
- package/dist/es/framer-motion/dist/es/render/utils/is-controlling-variants.mjs +0 -13
- package/dist/es/framer-motion/dist/es/render/utils/is-variant-label.mjs +0 -8
- package/dist/es/framer-motion/dist/es/render/utils/motion-values.mjs +0 -51
- package/dist/es/framer-motion/dist/es/render/utils/resolve-dynamic-variants.mjs +0 -8
- package/dist/es/framer-motion/dist/es/render/utils/resolve-variants.mjs +0 -36
- package/dist/es/framer-motion/dist/es/render/utils/setters.mjs +0 -31
- package/dist/es/framer-motion/dist/es/render/utils/variant-props.mjs +0 -12
- package/dist/es/framer-motion/dist/es/utils/delay.mjs +0 -24
- package/dist/es/framer-motion/dist/es/utils/distance.mjs +0 -9
- package/dist/es/framer-motion/dist/es/utils/get-context-window.mjs +0 -6
- package/dist/es/framer-motion/dist/es/utils/is-browser.mjs +0 -3
- package/dist/es/framer-motion/dist/es/utils/is-ref-object.mjs +0 -7
- package/dist/es/framer-motion/dist/es/utils/reduced-motion/index.mjs +0 -19
- package/dist/es/framer-motion/dist/es/utils/reduced-motion/state.mjs +0 -5
- package/dist/es/framer-motion/dist/es/utils/reduced-motion/use-reduced-motion-config.mjs +0 -19
- package/dist/es/framer-motion/dist/es/utils/reduced-motion/use-reduced-motion.mjs +0 -47
- package/dist/es/framer-motion/dist/es/utils/shallow-compare.mjs +0 -14
- package/dist/es/framer-motion/dist/es/utils/use-animation-frame.mjs +0 -21
- package/dist/es/framer-motion/dist/es/utils/use-constant.mjs +0 -18
- package/dist/es/framer-motion/dist/es/utils/use-cycle.mjs +0 -47
- package/dist/es/framer-motion/dist/es/utils/use-force-update.mjs +0 -19
- package/dist/es/framer-motion/dist/es/utils/use-in-view.mjs +0 -23
- package/dist/es/framer-motion/dist/es/utils/use-instant-transition.mjs +0 -41
- package/dist/es/framer-motion/dist/es/utils/use-is-mounted.mjs +0 -15
- package/dist/es/framer-motion/dist/es/utils/use-isomorphic-effect.mjs +0 -6
- package/dist/es/framer-motion/dist/es/utils/use-motion-value-event.mjs +0 -13
- package/dist/es/framer-motion/dist/es/utils/use-unmount-effect.mjs +0 -7
- package/dist/es/framer-motion/dist/es/value/scroll/use-element-scroll.mjs +0 -14
- package/dist/es/framer-motion/dist/es/value/scroll/use-viewport-scroll.mjs +0 -14
- package/dist/es/framer-motion/dist/es/value/use-combine-values.mjs +0 -37
- package/dist/es/framer-motion/dist/es/value/use-computed.mjs +0 -19
- package/dist/es/framer-motion/dist/es/value/use-inverted-scale.mjs +0 -52
- package/dist/es/framer-motion/dist/es/value/use-motion-template.mjs +0 -45
- package/dist/es/framer-motion/dist/es/value/use-motion-value.mjs +0 -38
- package/dist/es/framer-motion/dist/es/value/use-scroll.mjs +0 -39
- package/dist/es/framer-motion/dist/es/value/use-spring.mjs +0 -22
- package/dist/es/framer-motion/dist/es/value/use-time.mjs +0 -10
- package/dist/es/framer-motion/dist/es/value/use-transform.mjs +0 -29
- package/dist/es/framer-motion/dist/es/value/use-velocity.mjs +0 -35
- package/dist/es/framer-motion/dist/es/value/use-will-change/WillChangeMotionValue.mjs +0 -21
- package/dist/es/framer-motion/dist/es/value/use-will-change/add-will-change.mjs +0 -20
- package/dist/es/framer-motion/dist/es/value/use-will-change/index.mjs +0 -8
- package/dist/es/framer-motion/dist/es/value/use-will-change/is.mjs +0 -7
- package/dist/es/framer-motion/dist/es/value/utils/resolve-motion-value.mjs +0 -12
- package/dist/es/motion/lib/debug.mjs +0 -1
- package/dist/es/motion/lib/index.mjs +0 -131
- package/dist/es/motion/lib/mini.mjs +0 -2
- package/dist/es/motion/lib/react-client.mjs +0 -3
- package/dist/es/motion/lib/react-m.mjs +0 -3
- package/dist/es/motion/lib/react-mini.mjs +0 -2
- package/dist/es/motion/lib/react.mjs +0 -204
- package/dist/es/motion-dom/dist/es/animation/AsyncMotionValueAnimation.mjs +0 -175
- package/dist/es/motion-dom/dist/es/animation/GroupAnimation.mjs +0 -72
- package/dist/es/motion-dom/dist/es/animation/GroupAnimationWithThen.mjs +0 -9
- package/dist/es/motion-dom/dist/es/animation/JSAnimation.mjs +0 -348
- package/dist/es/motion-dom/dist/es/animation/NativeAnimation.mjs +0 -158
- package/dist/es/motion-dom/dist/es/animation/NativeAnimationExtended.mjs +0 -65
- package/dist/es/motion-dom/dist/es/animation/NativeAnimationWrapper.mjs +0 -14
- package/dist/es/motion-dom/dist/es/animation/drivers/frame.mjs +0 -17
- package/dist/es/motion-dom/dist/es/animation/generators/inertia.mjs +0 -87
- package/dist/es/motion-dom/dist/es/animation/generators/keyframes.mjs +0 -51
- package/dist/es/motion-dom/dist/es/animation/generators/spring/defaults.mjs +0 -27
- package/dist/es/motion-dom/dist/es/animation/generators/spring/find.mjs +0 -86
- package/dist/es/motion-dom/dist/es/animation/generators/spring/index.mjs +0 -176
- package/dist/es/motion-dom/dist/es/animation/generators/utils/calc-duration.mjs +0 -17
- package/dist/es/motion-dom/dist/es/animation/generators/utils/create-generator-easing.mjs +0 -19
- package/dist/es/motion-dom/dist/es/animation/generators/utils/is-generator.mjs +0 -5
- package/dist/es/motion-dom/dist/es/animation/generators/utils/velocity.mjs +0 -9
- package/dist/es/motion-dom/dist/es/animation/keyframes/DOMKeyframesResolver.mjs +0 -131
- package/dist/es/motion-dom/dist/es/animation/keyframes/KeyframesResolver.mjs +0 -147
- package/dist/es/motion-dom/dist/es/animation/keyframes/get-final.mjs +0 -11
- package/dist/es/motion-dom/dist/es/animation/keyframes/offsets/default.mjs +0 -9
- package/dist/es/motion-dom/dist/es/animation/keyframes/offsets/fill.mjs +0 -12
- package/dist/es/motion-dom/dist/es/animation/keyframes/offsets/time.mjs +0 -5
- package/dist/es/motion-dom/dist/es/animation/keyframes/utils/apply-px-defaults.mjs +0 -11
- package/dist/es/motion-dom/dist/es/animation/keyframes/utils/fill-wildcards.mjs +0 -7
- package/dist/es/motion-dom/dist/es/animation/keyframes/utils/is-none.mjs +0 -15
- package/dist/es/motion-dom/dist/es/animation/keyframes/utils/make-none-animatable.mjs +0 -30
- package/dist/es/motion-dom/dist/es/animation/keyframes/utils/unit-conversion.mjs +0 -36
- package/dist/es/motion-dom/dist/es/animation/utils/WithPromise.mjs +0 -26
- package/dist/es/motion-dom/dist/es/animation/utils/active-animations.mjs +0 -9
- package/dist/es/motion-dom/dist/es/animation/utils/can-animate.mjs +0 -42
- package/dist/es/motion-dom/dist/es/animation/utils/css-variables-conversion.mjs +0 -42
- package/dist/es/motion-dom/dist/es/animation/utils/get-value-transition.mjs +0 -7
- package/dist/es/motion-dom/dist/es/animation/utils/is-animatable.mjs +0 -30
- package/dist/es/motion-dom/dist/es/animation/utils/is-css-variable.mjs +0 -15
- package/dist/es/motion-dom/dist/es/animation/utils/replace-transition-type.mjs +0 -18
- package/dist/es/motion-dom/dist/es/animation/waapi/easing/cubic-bezier.mjs +0 -3
- package/dist/es/motion-dom/dist/es/animation/waapi/easing/is-supported.mjs +0 -14
- package/dist/es/motion-dom/dist/es/animation/waapi/easing/map-easing.mjs +0 -28
- package/dist/es/motion-dom/dist/es/animation/waapi/easing/supported.mjs +0 -15
- package/dist/es/motion-dom/dist/es/animation/waapi/start-waapi-animation.mjs +0 -39
- package/dist/es/motion-dom/dist/es/animation/waapi/supports/partial-keyframes.mjs +0 -13
- package/dist/es/motion-dom/dist/es/animation/waapi/supports/waapi.mjs +0 -37
- package/dist/es/motion-dom/dist/es/animation/waapi/utils/accelerated-values.mjs +0 -14
- package/dist/es/motion-dom/dist/es/animation/waapi/utils/apply-generator.mjs +0 -15
- package/dist/es/motion-dom/dist/es/animation/waapi/utils/linear.mjs +0 -12
- package/dist/es/motion-dom/dist/es/animation/waapi/utils/px-values.mjs +0 -39
- package/dist/es/motion-dom/dist/es/animation/waapi/utils/unsupported-easing.mjs +0 -20
- package/dist/es/motion-dom/dist/es/effects/MotionValueState.mjs +0 -47
- package/dist/es/motion-dom/dist/es/effects/attr/index.mjs +0 -41
- package/dist/es/motion-dom/dist/es/effects/prop/index.mjs +0 -9
- package/dist/es/motion-dom/dist/es/effects/style/index.mjs +0 -52
- package/dist/es/motion-dom/dist/es/effects/style/transform.mjs +0 -38
- package/dist/es/motion-dom/dist/es/effects/svg/index.mjs +0 -41
- package/dist/es/motion-dom/dist/es/effects/utils/create-dom-effect.mjs +0 -18
- package/dist/es/motion-dom/dist/es/effects/utils/create-effect.mjs +0 -21
- package/dist/es/motion-dom/dist/es/frameloop/batcher.mjs +0 -71
- package/dist/es/motion-dom/dist/es/frameloop/frame.mjs +0 -6
- package/dist/es/motion-dom/dist/es/frameloop/index-legacy.mjs +0 -20
- package/dist/es/motion-dom/dist/es/frameloop/microtask.mjs +0 -6
- package/dist/es/motion-dom/dist/es/frameloop/order.mjs +0 -12
- package/dist/es/motion-dom/dist/es/frameloop/render-step.mjs +0 -92
- package/dist/es/motion-dom/dist/es/frameloop/sync-time.mjs +0 -31
- package/dist/es/motion-dom/dist/es/gestures/drag/state/is-active.mjs +0 -9
- package/dist/es/motion-dom/dist/es/gestures/drag/state/set-active.mjs +0 -28
- package/dist/es/motion-dom/dist/es/gestures/hover.mjs +0 -37
- package/dist/es/motion-dom/dist/es/gestures/press/index.mjs +0 -83
- package/dist/es/motion-dom/dist/es/gestures/press/utils/is-keyboard-accessible.mjs +0 -13
- package/dist/es/motion-dom/dist/es/gestures/press/utils/keyboard.mjs +0 -38
- package/dist/es/motion-dom/dist/es/gestures/press/utils/state.mjs +0 -3
- package/dist/es/motion-dom/dist/es/gestures/utils/is-node-or-child.mjs +0 -20
- package/dist/es/motion-dom/dist/es/gestures/utils/is-primary-pointer.mjs +0 -18
- package/dist/es/motion-dom/dist/es/gestures/utils/setup.mjs +0 -15
- package/dist/es/motion-dom/dist/es/render/dom/is-css-var.mjs +0 -3
- package/dist/es/motion-dom/dist/es/render/dom/parse-transform.mjs +0 -83
- package/dist/es/motion-dom/dist/es/render/dom/style-computed.mjs +0 -10
- package/dist/es/motion-dom/dist/es/render/dom/style-set.mjs +0 -9
- package/dist/es/motion-dom/dist/es/render/dom/utils/camel-to-dash.mjs +0 -5
- package/dist/es/motion-dom/dist/es/render/utils/keys-position.mjs +0 -13
- package/dist/es/motion-dom/dist/es/render/utils/keys-transform.mjs +0 -28
- package/dist/es/motion-dom/dist/es/resize/handle-element.mjs +0 -63
- package/dist/es/motion-dom/dist/es/resize/handle-window.mjs +0 -31
- package/dist/es/motion-dom/dist/es/resize/index.mjs +0 -8
- package/dist/es/motion-dom/dist/es/scroll/observe.mjs +0 -18
- package/dist/es/motion-dom/dist/es/stats/animation-count.mjs +0 -7
- package/dist/es/motion-dom/dist/es/stats/buffer.mjs +0 -6
- package/dist/es/motion-dom/dist/es/stats/index.mjs +0 -117
- package/dist/es/motion-dom/dist/es/utils/interpolate.mjs +0 -79
- package/dist/es/motion-dom/dist/es/utils/is-html-element.mjs +0 -11
- package/dist/es/motion-dom/dist/es/utils/is-svg-element.mjs +0 -11
- package/dist/es/motion-dom/dist/es/utils/is-svg-svg-element.mjs +0 -11
- package/dist/es/motion-dom/dist/es/utils/mix/color.mjs +0 -47
- package/dist/es/motion-dom/dist/es/utils/mix/complex.mjs +0 -93
- package/dist/es/motion-dom/dist/es/utils/mix/immediate.mjs +0 -5
- package/dist/es/motion-dom/dist/es/utils/mix/index.mjs +0 -14
- package/dist/es/motion-dom/dist/es/utils/mix/number.mjs +0 -26
- package/dist/es/motion-dom/dist/es/utils/mix/visibility.mjs +0 -16
- package/dist/es/motion-dom/dist/es/utils/resolve-elements.mjs +0 -17
- package/dist/es/motion-dom/dist/es/utils/supports/flags.mjs +0 -7
- package/dist/es/motion-dom/dist/es/utils/supports/linear-easing.mjs +0 -15
- package/dist/es/motion-dom/dist/es/utils/supports/memo.mjs +0 -9
- package/dist/es/motion-dom/dist/es/utils/supports/scroll-timeline.mjs +0 -5
- package/dist/es/motion-dom/dist/es/utils/transform.mjs +0 -14
- package/dist/es/motion-dom/dist/es/value/index.mjs +0 -329
- package/dist/es/motion-dom/dist/es/value/map-value.mjs +0 -46
- package/dist/es/motion-dom/dist/es/value/spring-value.mjs +0 -72
- package/dist/es/motion-dom/dist/es/value/subscribe-value.mjs +0 -13
- package/dist/es/motion-dom/dist/es/value/transform-value.mjs +0 -35
- package/dist/es/motion-dom/dist/es/value/types/auto.mjs +0 -9
- package/dist/es/motion-dom/dist/es/value/types/color/hex.mjs +0 -40
- package/dist/es/motion-dom/dist/es/value/types/color/hsla-to-rgba.mjs +0 -42
- package/dist/es/motion-dom/dist/es/value/types/color/hsla.mjs +0 -22
- package/dist/es/motion-dom/dist/es/value/types/color/index.mjs +0 -32
- package/dist/es/motion-dom/dist/es/value/types/color/rgba.mjs +0 -25
- package/dist/es/motion-dom/dist/es/value/types/color/utils.mjs +0 -29
- package/dist/es/motion-dom/dist/es/value/types/complex/filter.mjs +0 -30
- package/dist/es/motion-dom/dist/es/value/types/complex/index.mjs +0 -91
- package/dist/es/motion-dom/dist/es/value/types/dimensions.mjs +0 -15
- package/dist/es/motion-dom/dist/es/value/types/int.mjs +0 -8
- package/dist/es/motion-dom/dist/es/value/types/maps/defaults.mjs +0 -30
- package/dist/es/motion-dom/dist/es/value/types/maps/number.mjs +0 -50
- package/dist/es/motion-dom/dist/es/value/types/maps/transform.mjs +0 -31
- package/dist/es/motion-dom/dist/es/value/types/numbers/index.mjs +0 -17
- package/dist/es/motion-dom/dist/es/value/types/numbers/units.mjs +0 -18
- package/dist/es/motion-dom/dist/es/value/types/test.mjs +0 -6
- package/dist/es/motion-dom/dist/es/value/types/utils/animatable-none.mjs +0 -15
- package/dist/es/motion-dom/dist/es/value/types/utils/color-regex.mjs +0 -3
- package/dist/es/motion-dom/dist/es/value/types/utils/find.mjs +0 -15
- package/dist/es/motion-dom/dist/es/value/types/utils/float-regex.mjs +0 -3
- package/dist/es/motion-dom/dist/es/value/types/utils/get-as-type.mjs +0 -10
- package/dist/es/motion-dom/dist/es/value/types/utils/is-nullish.mjs +0 -5
- package/dist/es/motion-dom/dist/es/value/types/utils/sanitize.mjs +0 -5
- package/dist/es/motion-dom/dist/es/value/types/utils/single-color-regex.mjs +0 -3
- package/dist/es/motion-dom/dist/es/value/utils/is-motion-value.mjs +0 -3
- package/dist/es/motion-dom/dist/es/view/index.mjs +0 -64
- package/dist/es/motion-dom/dist/es/view/queue.mjs +0 -52
- package/dist/es/motion-dom/dist/es/view/start.mjs +0 -155
- package/dist/es/motion-dom/dist/es/view/utils/choose-layer-type.mjs +0 -11
- package/dist/es/motion-dom/dist/es/view/utils/css.mjs +0 -32
- package/dist/es/motion-dom/dist/es/view/utils/get-layer-name.mjs +0 -8
- package/dist/es/motion-dom/dist/es/view/utils/get-view-animations.mjs +0 -12
- package/dist/es/motion-dom/dist/es/view/utils/has-target.mjs +0 -5
- package/dist/es/motion-utils/dist/es/array.mjs +0 -21
- package/dist/es/motion-utils/dist/es/clamp.mjs +0 -9
- package/dist/es/motion-utils/dist/es/easing/anticipate.mjs +0 -5
- package/dist/es/motion-utils/dist/es/easing/back.mjs +0 -9
- package/dist/es/motion-utils/dist/es/easing/circ.mjs +0 -8
- package/dist/es/motion-utils/dist/es/easing/cubic-bezier.mjs +0 -51
- package/dist/es/motion-utils/dist/es/easing/ease.mjs +0 -7
- package/dist/es/motion-utils/dist/es/easing/modifiers/mirror.mjs +0 -5
- package/dist/es/motion-utils/dist/es/easing/modifiers/reverse.mjs +0 -5
- package/dist/es/motion-utils/dist/es/easing/steps.mjs +0 -15
- package/dist/es/motion-utils/dist/es/easing/utils/get-easing-for-segment.mjs +0 -8
- package/dist/es/motion-utils/dist/es/easing/utils/is-bezier-definition.mjs +0 -3
- package/dist/es/motion-utils/dist/es/easing/utils/is-easing-array.mjs +0 -5
- package/dist/es/motion-utils/dist/es/easing/utils/map.mjs +0 -41
- package/dist/es/motion-utils/dist/es/errors.mjs +0 -16
- package/dist/es/motion-utils/dist/es/global-config.mjs +0 -3
- package/dist/es/motion-utils/dist/es/is-numerical-string.mjs +0 -6
- package/dist/es/motion-utils/dist/es/is-object.mjs +0 -5
- package/dist/es/motion-utils/dist/es/is-zero-value-string.mjs +0 -6
- package/dist/es/motion-utils/dist/es/memo.mjs +0 -11
- package/dist/es/motion-utils/dist/es/noop.mjs +0 -4
- package/dist/es/motion-utils/dist/es/pipe.mjs +0 -11
- package/dist/es/motion-utils/dist/es/progress.mjs +0 -19
- package/dist/es/motion-utils/dist/es/subscription-manager.mjs +0 -40
- package/dist/es/motion-utils/dist/es/time-conversion.mjs +0 -12
- package/dist/es/motion-utils/dist/es/velocity-per-second.mjs +0 -11
- package/dist/es/motion-utils/dist/es/warn-once.mjs +0 -14
- package/dist/es/motion-utils/dist/es/wrap.mjs +0 -6
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import { useState } from 'react';
|
|
2
|
-
import { initPrefersReducedMotion } from './index.mjs';
|
|
3
|
-
import { hasReducedMotionListener, prefersReducedMotion } from './state.mjs';
|
|
4
|
-
import { warnOnce } from '../../../../../motion-utils/dist/es/warn-once.mjs';
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* A hook that returns `true` if we should be using reduced motion based on the current device's Reduced Motion setting.
|
|
8
|
-
*
|
|
9
|
-
* This can be used to implement changes to your UI based on Reduced Motion. For instance, replacing motion-sickness inducing
|
|
10
|
-
* `x`/`y` animations with `opacity`, disabling the autoplay of background videos, or turning off parallax motion.
|
|
11
|
-
*
|
|
12
|
-
* It will actively respond to changes and re-render your components with the latest setting.
|
|
13
|
-
*
|
|
14
|
-
* ```jsx
|
|
15
|
-
* export function Sidebar({ isOpen }) {
|
|
16
|
-
* const shouldReduceMotion = useReducedMotion()
|
|
17
|
-
* const closedX = shouldReduceMotion ? 0 : "-100%"
|
|
18
|
-
*
|
|
19
|
-
* return (
|
|
20
|
-
* <motion.div animate={{
|
|
21
|
-
* opacity: isOpen ? 1 : 0,
|
|
22
|
-
* x: isOpen ? 0 : closedX
|
|
23
|
-
* }} />
|
|
24
|
-
* )
|
|
25
|
-
* }
|
|
26
|
-
* ```
|
|
27
|
-
*
|
|
28
|
-
* @return boolean
|
|
29
|
-
*
|
|
30
|
-
* @public
|
|
31
|
-
*/
|
|
32
|
-
function useReducedMotion() {
|
|
33
|
-
/**
|
|
34
|
-
* Lazy initialisation of prefersReducedMotion
|
|
35
|
-
*/
|
|
36
|
-
!hasReducedMotionListener.current && initPrefersReducedMotion();
|
|
37
|
-
const [shouldReduceMotion] = useState(prefersReducedMotion.current);
|
|
38
|
-
if (process.env.NODE_ENV !== "production") {
|
|
39
|
-
warnOnce(shouldReduceMotion !== true, "You have Reduced Motion enabled on your device. Animations may not appear as expected.");
|
|
40
|
-
}
|
|
41
|
-
/**
|
|
42
|
-
* TODO See if people miss automatically updating shouldReduceMotion setting
|
|
43
|
-
*/
|
|
44
|
-
return shouldReduceMotion;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
export { useReducedMotion };
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
function shallowCompare(next, prev) {
|
|
2
|
-
if (!Array.isArray(prev))
|
|
3
|
-
return false;
|
|
4
|
-
const prevLength = prev.length;
|
|
5
|
-
if (prevLength !== next.length)
|
|
6
|
-
return false;
|
|
7
|
-
for (let i = 0; i < prevLength; i++) {
|
|
8
|
-
if (prev[i] !== next[i])
|
|
9
|
-
return false;
|
|
10
|
-
}
|
|
11
|
-
return true;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
export { shallowCompare };
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { useRef, useContext, useEffect } from 'react';
|
|
2
|
-
import { MotionConfigContext } from '../context/MotionConfigContext.mjs';
|
|
3
|
-
import { frame, cancelFrame } from '../../../../motion-dom/dist/es/frameloop/frame.mjs';
|
|
4
|
-
|
|
5
|
-
function useAnimationFrame(callback) {
|
|
6
|
-
const initialTimestamp = useRef(0);
|
|
7
|
-
const { isStatic } = useContext(MotionConfigContext);
|
|
8
|
-
useEffect(() => {
|
|
9
|
-
if (isStatic)
|
|
10
|
-
return;
|
|
11
|
-
const provideTimeSinceStart = ({ timestamp, delta }) => {
|
|
12
|
-
if (!initialTimestamp.current)
|
|
13
|
-
initialTimestamp.current = timestamp;
|
|
14
|
-
callback(timestamp - initialTimestamp.current, delta);
|
|
15
|
-
};
|
|
16
|
-
frame.update(provideTimeSinceStart, true);
|
|
17
|
-
return () => cancelFrame(provideTimeSinceStart);
|
|
18
|
-
}, [callback]);
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
export { useAnimationFrame };
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { useRef } from 'react';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Creates a constant value over the lifecycle of a component.
|
|
5
|
-
*
|
|
6
|
-
* Even if `useMemo` is provided an empty array as its final argument, it doesn't offer
|
|
7
|
-
* a guarantee that it won't re-run for performance reasons later on. By using `useConstant`
|
|
8
|
-
* you can ensure that initialisers don't execute twice or more.
|
|
9
|
-
*/
|
|
10
|
-
function useConstant(init) {
|
|
11
|
-
const ref = useRef(null);
|
|
12
|
-
if (ref.current === null) {
|
|
13
|
-
ref.current = init();
|
|
14
|
-
}
|
|
15
|
-
return ref.current;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
export { useConstant };
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import { useRef, useState, useCallback } from 'react';
|
|
2
|
-
import { wrap } from '../../../../motion-utils/dist/es/wrap.mjs';
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* Cycles through a series of visual properties. Can be used to toggle between or cycle through animations. It works similar to `useState` in React. It is provided an initial array of possible states, and returns an array of two arguments.
|
|
6
|
-
*
|
|
7
|
-
* An index value can be passed to the returned `cycle` function to cycle to a specific index.
|
|
8
|
-
*
|
|
9
|
-
* ```jsx
|
|
10
|
-
* import * as React from "react"
|
|
11
|
-
* import { motion, useCycle } from "framer-motion"
|
|
12
|
-
*
|
|
13
|
-
* export const MyComponent = () => {
|
|
14
|
-
* const [x, cycleX] = useCycle(0, 50, 100)
|
|
15
|
-
*
|
|
16
|
-
* return (
|
|
17
|
-
* <motion.div
|
|
18
|
-
* animate={{ x: x }}
|
|
19
|
-
* onTap={() => cycleX()}
|
|
20
|
-
* />
|
|
21
|
-
* )
|
|
22
|
-
* }
|
|
23
|
-
* ```
|
|
24
|
-
*
|
|
25
|
-
* @param items - items to cycle through
|
|
26
|
-
* @returns [currentState, cycleState]
|
|
27
|
-
*
|
|
28
|
-
* @public
|
|
29
|
-
*/
|
|
30
|
-
function useCycle(...items) {
|
|
31
|
-
const index = useRef(0);
|
|
32
|
-
const [item, setItem] = useState(items[index.current]);
|
|
33
|
-
const runCycle = useCallback((next) => {
|
|
34
|
-
index.current =
|
|
35
|
-
typeof next !== "number"
|
|
36
|
-
? wrap(0, items.length, index.current + 1)
|
|
37
|
-
: next;
|
|
38
|
-
setItem(items[index.current]);
|
|
39
|
-
},
|
|
40
|
-
// The array will change on each call, but by putting items.length at
|
|
41
|
-
// the front of this array, we guarantee the dependency comparison will match up
|
|
42
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
43
|
-
[items.length, ...items]);
|
|
44
|
-
return [item, runCycle];
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
export { useCycle };
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { useState, useCallback } from 'react';
|
|
2
|
-
import { useIsMounted } from './use-is-mounted.mjs';
|
|
3
|
-
import { frame } from '../../../../motion-dom/dist/es/frameloop/frame.mjs';
|
|
4
|
-
|
|
5
|
-
function useForceUpdate() {
|
|
6
|
-
const isMounted = useIsMounted();
|
|
7
|
-
const [forcedRenderCount, setForcedRenderCount] = useState(0);
|
|
8
|
-
const forceRender = useCallback(() => {
|
|
9
|
-
isMounted.current && setForcedRenderCount(forcedRenderCount + 1);
|
|
10
|
-
}, [forcedRenderCount]);
|
|
11
|
-
/**
|
|
12
|
-
* Defer this to the end of the next animation frame in case there are multiple
|
|
13
|
-
* synchronous calls.
|
|
14
|
-
*/
|
|
15
|
-
const deferredForceRender = useCallback(() => frame.postRender(forceRender), [forceRender]);
|
|
16
|
-
return [deferredForceRender, forcedRenderCount];
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
export { useForceUpdate };
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { useState, useEffect } from 'react';
|
|
2
|
-
import { inView } from '../render/dom/viewport/index.mjs';
|
|
3
|
-
|
|
4
|
-
function useInView(ref, { root, margin, amount, once = false, initial = false, } = {}) {
|
|
5
|
-
const [isInView, setInView] = useState(initial);
|
|
6
|
-
useEffect(() => {
|
|
7
|
-
if (!ref.current || (once && isInView))
|
|
8
|
-
return;
|
|
9
|
-
const onEnter = () => {
|
|
10
|
-
setInView(true);
|
|
11
|
-
return once ? undefined : () => setInView(false);
|
|
12
|
-
};
|
|
13
|
-
const options = {
|
|
14
|
-
root: (root && root.current) || undefined,
|
|
15
|
-
margin,
|
|
16
|
-
amount,
|
|
17
|
-
};
|
|
18
|
-
return inView(ref.current, onEnter, options);
|
|
19
|
-
}, [root, ref, margin, once, amount]);
|
|
20
|
-
return isInView;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
export { useInView };
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import { useRef, useEffect } from 'react';
|
|
2
|
-
import { useInstantLayoutTransition } from '../projection/use-instant-layout-transition.mjs';
|
|
3
|
-
import { useForceUpdate } from './use-force-update.mjs';
|
|
4
|
-
import { frame } from '../../../../motion-dom/dist/es/frameloop/frame.mjs';
|
|
5
|
-
import { MotionGlobalConfig } from '../../../../motion-utils/dist/es/global-config.mjs';
|
|
6
|
-
|
|
7
|
-
function useInstantTransition() {
|
|
8
|
-
const [forceUpdate, forcedRenderCount] = useForceUpdate();
|
|
9
|
-
const startInstantLayoutTransition = useInstantLayoutTransition();
|
|
10
|
-
const unlockOnFrameRef = useRef(-1);
|
|
11
|
-
useEffect(() => {
|
|
12
|
-
/**
|
|
13
|
-
* Unblock after two animation frames, otherwise this will unblock too soon.
|
|
14
|
-
*/
|
|
15
|
-
frame.postRender(() => frame.postRender(() => {
|
|
16
|
-
/**
|
|
17
|
-
* If the callback has been called again after the effect
|
|
18
|
-
* triggered this 2 frame delay, don't unblock animations. This
|
|
19
|
-
* prevents the previous effect from unblocking the current
|
|
20
|
-
* instant transition too soon. This becomes more likely when
|
|
21
|
-
* used in conjunction with React.startTransition().
|
|
22
|
-
*/
|
|
23
|
-
if (forcedRenderCount !== unlockOnFrameRef.current)
|
|
24
|
-
return;
|
|
25
|
-
MotionGlobalConfig.instantAnimations = false;
|
|
26
|
-
}));
|
|
27
|
-
}, [forcedRenderCount]);
|
|
28
|
-
return (callback) => {
|
|
29
|
-
startInstantLayoutTransition(() => {
|
|
30
|
-
MotionGlobalConfig.instantAnimations = true;
|
|
31
|
-
forceUpdate();
|
|
32
|
-
callback();
|
|
33
|
-
unlockOnFrameRef.current = forcedRenderCount + 1;
|
|
34
|
-
});
|
|
35
|
-
};
|
|
36
|
-
}
|
|
37
|
-
function disableInstantTransitions() {
|
|
38
|
-
MotionGlobalConfig.instantAnimations = false;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
export { disableInstantTransitions, useInstantTransition };
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { useRef } from 'react';
|
|
2
|
-
import { useIsomorphicLayoutEffect } from './use-isomorphic-effect.mjs';
|
|
3
|
-
|
|
4
|
-
function useIsMounted() {
|
|
5
|
-
const isMounted = useRef(false);
|
|
6
|
-
useIsomorphicLayoutEffect(() => {
|
|
7
|
-
isMounted.current = true;
|
|
8
|
-
return () => {
|
|
9
|
-
isMounted.current = false;
|
|
10
|
-
};
|
|
11
|
-
}, []);
|
|
12
|
-
return isMounted;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
export { useIsMounted };
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { useInsertionEffect } from 'react';
|
|
2
|
-
|
|
3
|
-
function useMotionValueEvent(value, event, callback) {
|
|
4
|
-
/**
|
|
5
|
-
* useInsertionEffect will create subscriptions before any other
|
|
6
|
-
* effects will run. Effects run upwards through the tree so it
|
|
7
|
-
* can be that binding a useLayoutEffect higher up the tree can
|
|
8
|
-
* miss changes from lower down the tree.
|
|
9
|
-
*/
|
|
10
|
-
useInsertionEffect(() => value.on(event, callback), [value, event, callback]);
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export { useMotionValueEvent };
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { useScroll } from '../use-scroll.mjs';
|
|
2
|
-
import { warnOnce } from '../../../../../motion-utils/dist/es/warn-once.mjs';
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* @deprecated useElementScroll is deprecated. Convert to useScroll({ container: ref })
|
|
6
|
-
*/
|
|
7
|
-
function useElementScroll(ref) {
|
|
8
|
-
if (process.env.NODE_ENV === "development") {
|
|
9
|
-
warnOnce(false, "useElementScroll is deprecated. Convert to useScroll({ container: ref }).");
|
|
10
|
-
}
|
|
11
|
-
return useScroll({ container: ref });
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
export { useElementScroll };
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { useScroll } from '../use-scroll.mjs';
|
|
2
|
-
import { warnOnce } from '../../../../../motion-utils/dist/es/warn-once.mjs';
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* @deprecated useViewportScroll is deprecated. Convert to useScroll()
|
|
6
|
-
*/
|
|
7
|
-
function useViewportScroll() {
|
|
8
|
-
if (process.env.NODE_ENV !== "production") {
|
|
9
|
-
warnOnce(false, "useViewportScroll is deprecated. Convert to useScroll().");
|
|
10
|
-
}
|
|
11
|
-
return useScroll();
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
export { useViewportScroll };
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import { useIsomorphicLayoutEffect } from '../utils/use-isomorphic-effect.mjs';
|
|
2
|
-
import { useMotionValue } from './use-motion-value.mjs';
|
|
3
|
-
import { cancelFrame, frame } from '../../../../motion-dom/dist/es/frameloop/frame.mjs';
|
|
4
|
-
|
|
5
|
-
function useCombineMotionValues(values, combineValues) {
|
|
6
|
-
/**
|
|
7
|
-
* Initialise the returned motion value. This remains the same between renders.
|
|
8
|
-
*/
|
|
9
|
-
const value = useMotionValue(combineValues());
|
|
10
|
-
/**
|
|
11
|
-
* Create a function that will update the template motion value with the latest values.
|
|
12
|
-
* This is pre-bound so whenever a motion value updates it can schedule its
|
|
13
|
-
* execution in Framesync. If it's already been scheduled it won't be fired twice
|
|
14
|
-
* in a single frame.
|
|
15
|
-
*/
|
|
16
|
-
const updateValue = () => value.set(combineValues());
|
|
17
|
-
/**
|
|
18
|
-
* Synchronously update the motion value with the latest values during the render.
|
|
19
|
-
* This ensures that within a React render, the styles applied to the DOM are up-to-date.
|
|
20
|
-
*/
|
|
21
|
-
updateValue();
|
|
22
|
-
/**
|
|
23
|
-
* Subscribe to all motion values found within the template. Whenever any of them change,
|
|
24
|
-
* schedule an update.
|
|
25
|
-
*/
|
|
26
|
-
useIsomorphicLayoutEffect(() => {
|
|
27
|
-
const scheduleUpdate = () => frame.preRender(updateValue, false, true);
|
|
28
|
-
const subscriptions = values.map((v) => v.on("change", scheduleUpdate));
|
|
29
|
-
return () => {
|
|
30
|
-
subscriptions.forEach((unsubscribe) => unsubscribe());
|
|
31
|
-
cancelFrame(updateValue);
|
|
32
|
-
};
|
|
33
|
-
});
|
|
34
|
-
return value;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
export { useCombineMotionValues };
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { useCombineMotionValues } from './use-combine-values.mjs';
|
|
2
|
-
import { collectMotionValues } from '../../../../motion-dom/dist/es/value/index.mjs';
|
|
3
|
-
|
|
4
|
-
function useComputed(compute) {
|
|
5
|
-
/**
|
|
6
|
-
* Open session of collectMotionValues. Any MotionValue that calls get()
|
|
7
|
-
* will be saved into this array.
|
|
8
|
-
*/
|
|
9
|
-
collectMotionValues.current = [];
|
|
10
|
-
compute();
|
|
11
|
-
const value = useCombineMotionValues(collectMotionValues.current, compute);
|
|
12
|
-
/**
|
|
13
|
-
* Synchronously close session of collectMotionValues.
|
|
14
|
-
*/
|
|
15
|
-
collectMotionValues.current = undefined;
|
|
16
|
-
return value;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
export { useComputed };
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import { useContext } from 'react';
|
|
2
|
-
import { MotionContext } from '../context/MotionContext/index.mjs';
|
|
3
|
-
import { useMotionValue } from './use-motion-value.mjs';
|
|
4
|
-
import { useTransform } from './use-transform.mjs';
|
|
5
|
-
import { invariant, warning } from '../../../../motion-utils/dist/es/errors.mjs';
|
|
6
|
-
|
|
7
|
-
// Keep things reasonable and avoid scale: Infinity. In practise we might need
|
|
8
|
-
// to add another value, opacity, that could interpolate scaleX/Y [0,0.01] => [0,1]
|
|
9
|
-
// to simply hide content at unreasonable scales.
|
|
10
|
-
const maxScale = 100000;
|
|
11
|
-
const invertScale = (scale) => scale > 0.001 ? 1 / scale : maxScale;
|
|
12
|
-
let hasWarned = false;
|
|
13
|
-
/**
|
|
14
|
-
* Returns a `MotionValue` each for `scaleX` and `scaleY` that update with the inverse
|
|
15
|
-
* of their respective parent scales.
|
|
16
|
-
*
|
|
17
|
-
* This is useful for undoing the distortion of content when scaling a parent component.
|
|
18
|
-
*
|
|
19
|
-
* By default, `useInvertedScale` will automatically fetch `scaleX` and `scaleY` from the nearest parent.
|
|
20
|
-
* By passing other `MotionValue`s in as `useInvertedScale({ scaleX, scaleY })`, it will invert the output
|
|
21
|
-
* of those instead.
|
|
22
|
-
*
|
|
23
|
-
* ```jsx
|
|
24
|
-
* const MyComponent = () => {
|
|
25
|
-
* const { scaleX, scaleY } = useInvertedScale()
|
|
26
|
-
* return <motion.div style={{ scaleX, scaleY }} />
|
|
27
|
-
* }
|
|
28
|
-
* ```
|
|
29
|
-
*
|
|
30
|
-
* @deprecated
|
|
31
|
-
*/
|
|
32
|
-
function useInvertedScale(scale) {
|
|
33
|
-
let parentScaleX = useMotionValue(1);
|
|
34
|
-
let parentScaleY = useMotionValue(1);
|
|
35
|
-
const { visualElement } = useContext(MotionContext);
|
|
36
|
-
invariant(!!(scale || visualElement), "If no scale values are provided, useInvertedScale must be used within a child of another motion component.");
|
|
37
|
-
warning(hasWarned, "useInvertedScale is deprecated and will be removed in 3.0. Use the layout prop instead.");
|
|
38
|
-
hasWarned = true;
|
|
39
|
-
if (scale) {
|
|
40
|
-
parentScaleX = scale.scaleX || parentScaleX;
|
|
41
|
-
parentScaleY = scale.scaleY || parentScaleY;
|
|
42
|
-
}
|
|
43
|
-
else if (visualElement) {
|
|
44
|
-
parentScaleX = visualElement.getValue("scaleX", 1);
|
|
45
|
-
parentScaleY = visualElement.getValue("scaleY", 1);
|
|
46
|
-
}
|
|
47
|
-
const scaleX = useTransform(parentScaleX, invertScale);
|
|
48
|
-
const scaleY = useTransform(parentScaleY, invertScale);
|
|
49
|
-
return { scaleX, scaleY };
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
export { invertScale, useInvertedScale };
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import { useCombineMotionValues } from './use-combine-values.mjs';
|
|
2
|
-
import { isMotionValue } from '../../../../motion-dom/dist/es/value/utils/is-motion-value.mjs';
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* Combine multiple motion values into a new one using a string template literal.
|
|
6
|
-
*
|
|
7
|
-
* ```jsx
|
|
8
|
-
* import {
|
|
9
|
-
* motion,
|
|
10
|
-
* useSpring,
|
|
11
|
-
* useMotionValue,
|
|
12
|
-
* useMotionTemplate
|
|
13
|
-
* } from "framer-motion"
|
|
14
|
-
*
|
|
15
|
-
* function Component() {
|
|
16
|
-
* const shadowX = useSpring(0)
|
|
17
|
-
* const shadowY = useMotionValue(0)
|
|
18
|
-
* const shadow = useMotionTemplate`drop-shadow(${shadowX}px ${shadowY}px 20px rgba(0,0,0,0.3))`
|
|
19
|
-
*
|
|
20
|
-
* return <motion.div style={{ filter: shadow }} />
|
|
21
|
-
* }
|
|
22
|
-
* ```
|
|
23
|
-
*
|
|
24
|
-
* @public
|
|
25
|
-
*/
|
|
26
|
-
function useMotionTemplate(fragments, ...values) {
|
|
27
|
-
/**
|
|
28
|
-
* Create a function that will build a string from the latest motion values.
|
|
29
|
-
*/
|
|
30
|
-
const numFragments = fragments.length;
|
|
31
|
-
function buildValue() {
|
|
32
|
-
let output = ``;
|
|
33
|
-
for (let i = 0; i < numFragments; i++) {
|
|
34
|
-
output += fragments[i];
|
|
35
|
-
const value = values[i];
|
|
36
|
-
if (value) {
|
|
37
|
-
output += isMotionValue(value) ? value.get() : value;
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
return output;
|
|
41
|
-
}
|
|
42
|
-
return useCombineMotionValues(values.filter(isMotionValue), buildValue);
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
export { useMotionTemplate };
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import { useContext, useState, useEffect } from 'react';
|
|
2
|
-
import { MotionConfigContext } from '../context/MotionConfigContext.mjs';
|
|
3
|
-
import { useConstant } from '../utils/use-constant.mjs';
|
|
4
|
-
import { motionValue } from '../../../../motion-dom/dist/es/value/index.mjs';
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* Creates a `MotionValue` to track the state and velocity of a value.
|
|
8
|
-
*
|
|
9
|
-
* Usually, these are created automatically. For advanced use-cases, like use with `useTransform`, you can create `MotionValue`s externally and pass them into the animated component via the `style` prop.
|
|
10
|
-
*
|
|
11
|
-
* ```jsx
|
|
12
|
-
* export const MyComponent = () => {
|
|
13
|
-
* const scale = useMotionValue(1)
|
|
14
|
-
*
|
|
15
|
-
* return <motion.div style={{ scale }} />
|
|
16
|
-
* }
|
|
17
|
-
* ```
|
|
18
|
-
*
|
|
19
|
-
* @param initial - The initial state.
|
|
20
|
-
*
|
|
21
|
-
* @public
|
|
22
|
-
*/
|
|
23
|
-
function useMotionValue(initial) {
|
|
24
|
-
const value = useConstant(() => motionValue(initial));
|
|
25
|
-
/**
|
|
26
|
-
* If this motion value is being used in static mode, like on
|
|
27
|
-
* the Framer canvas, force components to rerender when the motion
|
|
28
|
-
* value is updated.
|
|
29
|
-
*/
|
|
30
|
-
const { isStatic } = useContext(MotionConfigContext);
|
|
31
|
-
if (isStatic) {
|
|
32
|
-
const [, setLatest] = useState(initial);
|
|
33
|
-
useEffect(() => value.on("change", setLatest), []);
|
|
34
|
-
}
|
|
35
|
-
return value;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
export { useMotionValue };
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import { useEffect } from 'react';
|
|
2
|
-
import { scroll } from '../render/dom/scroll/index.mjs';
|
|
3
|
-
import { useConstant } from '../utils/use-constant.mjs';
|
|
4
|
-
import { useIsomorphicLayoutEffect } from '../utils/use-isomorphic-effect.mjs';
|
|
5
|
-
import { warning } from '../../../../motion-utils/dist/es/errors.mjs';
|
|
6
|
-
import { motionValue } from '../../../../motion-dom/dist/es/value/index.mjs';
|
|
7
|
-
|
|
8
|
-
function refWarning(name, ref) {
|
|
9
|
-
warning(Boolean(!ref || ref.current), `You have defined a ${name} options but the provided ref is not yet hydrated, probably because it's defined higher up the tree. Try calling useScroll() in the same component as the ref, or setting its \`layoutEffect: false\` option.`);
|
|
10
|
-
}
|
|
11
|
-
const createScrollMotionValues = () => ({
|
|
12
|
-
scrollX: motionValue(0),
|
|
13
|
-
scrollY: motionValue(0),
|
|
14
|
-
scrollXProgress: motionValue(0),
|
|
15
|
-
scrollYProgress: motionValue(0),
|
|
16
|
-
});
|
|
17
|
-
function useScroll({ container, target, layoutEffect = true, ...options } = {}) {
|
|
18
|
-
const values = useConstant(createScrollMotionValues);
|
|
19
|
-
const useLifecycleEffect = layoutEffect
|
|
20
|
-
? useIsomorphicLayoutEffect
|
|
21
|
-
: useEffect;
|
|
22
|
-
useLifecycleEffect(() => {
|
|
23
|
-
refWarning("target", target);
|
|
24
|
-
refWarning("container", container);
|
|
25
|
-
return scroll((_progress, { x, y, }) => {
|
|
26
|
-
values.scrollX.set(x.current);
|
|
27
|
-
values.scrollXProgress.set(x.progress);
|
|
28
|
-
values.scrollY.set(y.current);
|
|
29
|
-
values.scrollYProgress.set(y.progress);
|
|
30
|
-
}, {
|
|
31
|
-
...options,
|
|
32
|
-
container: container?.current || undefined,
|
|
33
|
-
target: target?.current || undefined,
|
|
34
|
-
});
|
|
35
|
-
}, [container, target, JSON.stringify(options.offset)]);
|
|
36
|
-
return values;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
export { useScroll };
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { useContext, useInsertionEffect } from 'react';
|
|
2
|
-
import { MotionConfigContext } from '../context/MotionConfigContext.mjs';
|
|
3
|
-
import { useMotionValue } from './use-motion-value.mjs';
|
|
4
|
-
import { useTransform } from './use-transform.mjs';
|
|
5
|
-
import { attachSpring } from '../../../../motion-dom/dist/es/value/spring-value.mjs';
|
|
6
|
-
import { isMotionValue } from '../../../../motion-dom/dist/es/value/utils/is-motion-value.mjs';
|
|
7
|
-
|
|
8
|
-
function useSpring(source, options = {}) {
|
|
9
|
-
const { isStatic } = useContext(MotionConfigContext);
|
|
10
|
-
const getFromSource = () => (isMotionValue(source) ? source.get() : source);
|
|
11
|
-
// isStatic will never change, allowing early hooks return
|
|
12
|
-
if (isStatic) {
|
|
13
|
-
return useTransform(getFromSource);
|
|
14
|
-
}
|
|
15
|
-
const value = useMotionValue(getFromSource());
|
|
16
|
-
useInsertionEffect(() => {
|
|
17
|
-
return attachSpring(value, source, options);
|
|
18
|
-
}, [value, JSON.stringify(options)]);
|
|
19
|
-
return value;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
export { useSpring };
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { useAnimationFrame } from '../utils/use-animation-frame.mjs';
|
|
2
|
-
import { useMotionValue } from './use-motion-value.mjs';
|
|
3
|
-
|
|
4
|
-
function useTime() {
|
|
5
|
-
const time = useMotionValue(0);
|
|
6
|
-
useAnimationFrame((t) => time.set(t));
|
|
7
|
-
return time;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
export { useTime };
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { useConstant } from '../utils/use-constant.mjs';
|
|
2
|
-
import { useCombineMotionValues } from './use-combine-values.mjs';
|
|
3
|
-
import { useComputed } from './use-computed.mjs';
|
|
4
|
-
import { transform } from '../../../../motion-dom/dist/es/utils/transform.mjs';
|
|
5
|
-
|
|
6
|
-
function useTransform(input, inputRangeOrTransformer, outputRange, options) {
|
|
7
|
-
if (typeof input === "function") {
|
|
8
|
-
return useComputed(input);
|
|
9
|
-
}
|
|
10
|
-
const transformer = typeof inputRangeOrTransformer === "function"
|
|
11
|
-
? inputRangeOrTransformer
|
|
12
|
-
: transform(inputRangeOrTransformer, outputRange, options);
|
|
13
|
-
return Array.isArray(input)
|
|
14
|
-
? useListTransform(input, transformer)
|
|
15
|
-
: useListTransform([input], ([latest]) => transformer(latest));
|
|
16
|
-
}
|
|
17
|
-
function useListTransform(values, transformer) {
|
|
18
|
-
const latest = useConstant(() => []);
|
|
19
|
-
return useCombineMotionValues(values, () => {
|
|
20
|
-
latest.length = 0;
|
|
21
|
-
const numValues = values.length;
|
|
22
|
-
for (let i = 0; i < numValues; i++) {
|
|
23
|
-
latest[i] = values[i].get();
|
|
24
|
-
}
|
|
25
|
-
return transformer(latest);
|
|
26
|
-
});
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
export { useTransform };
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { useMotionValueEvent } from '../utils/use-motion-value-event.mjs';
|
|
2
|
-
import { useMotionValue } from './use-motion-value.mjs';
|
|
3
|
-
import { frame } from '../../../../motion-dom/dist/es/frameloop/frame.mjs';
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Creates a `MotionValue` that updates when the velocity of the provided `MotionValue` changes.
|
|
7
|
-
*
|
|
8
|
-
* ```javascript
|
|
9
|
-
* const x = useMotionValue(0)
|
|
10
|
-
* const xVelocity = useVelocity(x)
|
|
11
|
-
* const xAcceleration = useVelocity(xVelocity)
|
|
12
|
-
* ```
|
|
13
|
-
*
|
|
14
|
-
* @public
|
|
15
|
-
*/
|
|
16
|
-
function useVelocity(value) {
|
|
17
|
-
const velocity = useMotionValue(value.getVelocity());
|
|
18
|
-
const updateVelocity = () => {
|
|
19
|
-
const latest = value.getVelocity();
|
|
20
|
-
velocity.set(latest);
|
|
21
|
-
/**
|
|
22
|
-
* If we still have velocity, schedule an update for the next frame
|
|
23
|
-
* to keep checking until it is zero.
|
|
24
|
-
*/
|
|
25
|
-
if (latest)
|
|
26
|
-
frame.update(updateVelocity);
|
|
27
|
-
};
|
|
28
|
-
useMotionValueEvent(value, "change", () => {
|
|
29
|
-
// Schedule an update to this value at the end of the current frame.
|
|
30
|
-
frame.update(updateVelocity, false, true);
|
|
31
|
-
});
|
|
32
|
-
return velocity;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
export { useVelocity };
|