motion 12.18.0 → 12.18.2
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.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,342 +0,0 @@
|
|
|
1
|
-
import { animateVisualElement } from '../../animation/interfaces/visual-element.mjs';
|
|
2
|
-
import { isAnimationControls } from '../../animation/utils/is-animation-controls.mjs';
|
|
3
|
-
import { isKeyframesTarget } from '../../animation/utils/is-keyframes-target.mjs';
|
|
4
|
-
import { shallowCompare } from '../../utils/shallow-compare.mjs';
|
|
5
|
-
import { getVariantContext } from './get-variant-context.mjs';
|
|
6
|
-
import { isVariantLabel } from './is-variant-label.mjs';
|
|
7
|
-
import { resolveVariant } from './resolve-dynamic-variants.mjs';
|
|
8
|
-
import { variantPriorityOrder } from './variant-props.mjs';
|
|
9
|
-
|
|
10
|
-
const reversePriorityOrder = [...variantPriorityOrder].reverse();
|
|
11
|
-
const numAnimationTypes = variantPriorityOrder.length;
|
|
12
|
-
function animateList(visualElement) {
|
|
13
|
-
return (animations) => Promise.all(animations.map(({ animation, options }) => animateVisualElement(visualElement, animation, options)));
|
|
14
|
-
}
|
|
15
|
-
function createAnimationState(visualElement) {
|
|
16
|
-
let animate = animateList(visualElement);
|
|
17
|
-
let state = createState();
|
|
18
|
-
let isInitialRender = true;
|
|
19
|
-
/**
|
|
20
|
-
* This function will be used to reduce the animation definitions for
|
|
21
|
-
* each active animation type into an object of resolved values for it.
|
|
22
|
-
*/
|
|
23
|
-
const buildResolvedTypeValues = (type) => (acc, definition) => {
|
|
24
|
-
const resolved = resolveVariant(visualElement, definition, type === "exit"
|
|
25
|
-
? visualElement.presenceContext?.custom
|
|
26
|
-
: undefined);
|
|
27
|
-
if (resolved) {
|
|
28
|
-
const { transition, transitionEnd, ...target } = resolved;
|
|
29
|
-
acc = { ...acc, ...target, ...transitionEnd };
|
|
30
|
-
}
|
|
31
|
-
return acc;
|
|
32
|
-
};
|
|
33
|
-
/**
|
|
34
|
-
* This just allows us to inject mocked animation functions
|
|
35
|
-
* @internal
|
|
36
|
-
*/
|
|
37
|
-
function setAnimateFunction(makeAnimator) {
|
|
38
|
-
animate = makeAnimator(visualElement);
|
|
39
|
-
}
|
|
40
|
-
/**
|
|
41
|
-
* When we receive new props, we need to:
|
|
42
|
-
* 1. Create a list of protected keys for each type. This is a directory of
|
|
43
|
-
* value keys that are currently being "handled" by types of a higher priority
|
|
44
|
-
* so that whenever an animation is played of a given type, these values are
|
|
45
|
-
* protected from being animated.
|
|
46
|
-
* 2. Determine if an animation type needs animating.
|
|
47
|
-
* 3. Determine if any values have been removed from a type and figure out
|
|
48
|
-
* what to animate those to.
|
|
49
|
-
*/
|
|
50
|
-
function animateChanges(changedActiveType) {
|
|
51
|
-
const { props } = visualElement;
|
|
52
|
-
const context = getVariantContext(visualElement.parent) || {};
|
|
53
|
-
/**
|
|
54
|
-
* A list of animations that we'll build into as we iterate through the animation
|
|
55
|
-
* types. This will get executed at the end of the function.
|
|
56
|
-
*/
|
|
57
|
-
const animations = [];
|
|
58
|
-
/**
|
|
59
|
-
* Keep track of which values have been removed. Then, as we hit lower priority
|
|
60
|
-
* animation types, we can check if they contain removed values and animate to that.
|
|
61
|
-
*/
|
|
62
|
-
const removedKeys = new Set();
|
|
63
|
-
/**
|
|
64
|
-
* A dictionary of all encountered keys. This is an object to let us build into and
|
|
65
|
-
* copy it without iteration. Each time we hit an animation type we set its protected
|
|
66
|
-
* keys - the keys its not allowed to animate - to the latest version of this object.
|
|
67
|
-
*/
|
|
68
|
-
let encounteredKeys = {};
|
|
69
|
-
/**
|
|
70
|
-
* If a variant has been removed at a given index, and this component is controlling
|
|
71
|
-
* variant animations, we want to ensure lower-priority variants are forced to animate.
|
|
72
|
-
*/
|
|
73
|
-
let removedVariantIndex = Infinity;
|
|
74
|
-
/**
|
|
75
|
-
* Iterate through all animation types in reverse priority order. For each, we want to
|
|
76
|
-
* detect which values it's handling and whether or not they've changed (and therefore
|
|
77
|
-
* need to be animated). If any values have been removed, we want to detect those in
|
|
78
|
-
* lower priority props and flag for animation.
|
|
79
|
-
*/
|
|
80
|
-
for (let i = 0; i < numAnimationTypes; i++) {
|
|
81
|
-
const type = reversePriorityOrder[i];
|
|
82
|
-
const typeState = state[type];
|
|
83
|
-
const prop = props[type] !== undefined
|
|
84
|
-
? props[type]
|
|
85
|
-
: context[type];
|
|
86
|
-
const propIsVariant = isVariantLabel(prop);
|
|
87
|
-
/**
|
|
88
|
-
* If this type has *just* changed isActive status, set activeDelta
|
|
89
|
-
* to that status. Otherwise set to null.
|
|
90
|
-
*/
|
|
91
|
-
const activeDelta = type === changedActiveType ? typeState.isActive : null;
|
|
92
|
-
if (activeDelta === false)
|
|
93
|
-
removedVariantIndex = i;
|
|
94
|
-
/**
|
|
95
|
-
* If this prop is an inherited variant, rather than been set directly on the
|
|
96
|
-
* component itself, we want to make sure we allow the parent to trigger animations.
|
|
97
|
-
*
|
|
98
|
-
* TODO: Can probably change this to a !isControllingVariants check
|
|
99
|
-
*/
|
|
100
|
-
let isInherited = prop === context[type] &&
|
|
101
|
-
prop !== props[type] &&
|
|
102
|
-
propIsVariant;
|
|
103
|
-
/**
|
|
104
|
-
*
|
|
105
|
-
*/
|
|
106
|
-
if (isInherited &&
|
|
107
|
-
isInitialRender &&
|
|
108
|
-
visualElement.manuallyAnimateOnMount) {
|
|
109
|
-
isInherited = false;
|
|
110
|
-
}
|
|
111
|
-
/**
|
|
112
|
-
* Set all encountered keys so far as the protected keys for this type. This will
|
|
113
|
-
* be any key that has been animated or otherwise handled by active, higher-priortiy types.
|
|
114
|
-
*/
|
|
115
|
-
typeState.protectedKeys = { ...encounteredKeys };
|
|
116
|
-
// Check if we can skip analysing this prop early
|
|
117
|
-
if (
|
|
118
|
-
// If it isn't active and hasn't *just* been set as inactive
|
|
119
|
-
(!typeState.isActive && activeDelta === null) ||
|
|
120
|
-
// If we didn't and don't have any defined prop for this animation type
|
|
121
|
-
(!prop && !typeState.prevProp) ||
|
|
122
|
-
// Or if the prop doesn't define an animation
|
|
123
|
-
isAnimationControls(prop) ||
|
|
124
|
-
typeof prop === "boolean") {
|
|
125
|
-
continue;
|
|
126
|
-
}
|
|
127
|
-
/**
|
|
128
|
-
* As we go look through the values defined on this type, if we detect
|
|
129
|
-
* a changed value or a value that was removed in a higher priority, we set
|
|
130
|
-
* this to true and add this prop to the animation list.
|
|
131
|
-
*/
|
|
132
|
-
const variantDidChange = checkVariantsDidChange(typeState.prevProp, prop);
|
|
133
|
-
let shouldAnimateType = variantDidChange ||
|
|
134
|
-
// If we're making this variant active, we want to always make it active
|
|
135
|
-
(type === changedActiveType &&
|
|
136
|
-
typeState.isActive &&
|
|
137
|
-
!isInherited &&
|
|
138
|
-
propIsVariant) ||
|
|
139
|
-
// If we removed a higher-priority variant (i is in reverse order)
|
|
140
|
-
(i > removedVariantIndex && propIsVariant);
|
|
141
|
-
let handledRemovedValues = false;
|
|
142
|
-
/**
|
|
143
|
-
* As animations can be set as variant lists, variants or target objects, we
|
|
144
|
-
* coerce everything to an array if it isn't one already
|
|
145
|
-
*/
|
|
146
|
-
const definitionList = Array.isArray(prop) ? prop : [prop];
|
|
147
|
-
/**
|
|
148
|
-
* Build an object of all the resolved values. We'll use this in the subsequent
|
|
149
|
-
* animateChanges calls to determine whether a value has changed.
|
|
150
|
-
*/
|
|
151
|
-
let resolvedValues = definitionList.reduce(buildResolvedTypeValues(type), {});
|
|
152
|
-
if (activeDelta === false)
|
|
153
|
-
resolvedValues = {};
|
|
154
|
-
/**
|
|
155
|
-
* Now we need to loop through all the keys in the prev prop and this prop,
|
|
156
|
-
* and decide:
|
|
157
|
-
* 1. If the value has changed, and needs animating
|
|
158
|
-
* 2. If it has been removed, and needs adding to the removedKeys set
|
|
159
|
-
* 3. If it has been removed in a higher priority type and needs animating
|
|
160
|
-
* 4. If it hasn't been removed in a higher priority but hasn't changed, and
|
|
161
|
-
* needs adding to the type's protectedKeys list.
|
|
162
|
-
*/
|
|
163
|
-
const { prevResolvedValues = {} } = typeState;
|
|
164
|
-
const allKeys = {
|
|
165
|
-
...prevResolvedValues,
|
|
166
|
-
...resolvedValues,
|
|
167
|
-
};
|
|
168
|
-
const markToAnimate = (key) => {
|
|
169
|
-
shouldAnimateType = true;
|
|
170
|
-
if (removedKeys.has(key)) {
|
|
171
|
-
handledRemovedValues = true;
|
|
172
|
-
removedKeys.delete(key);
|
|
173
|
-
}
|
|
174
|
-
typeState.needsAnimating[key] = true;
|
|
175
|
-
const motionValue = visualElement.getValue(key);
|
|
176
|
-
if (motionValue)
|
|
177
|
-
motionValue.liveStyle = false;
|
|
178
|
-
};
|
|
179
|
-
for (const key in allKeys) {
|
|
180
|
-
const next = resolvedValues[key];
|
|
181
|
-
const prev = prevResolvedValues[key];
|
|
182
|
-
// If we've already handled this we can just skip ahead
|
|
183
|
-
if (encounteredKeys.hasOwnProperty(key))
|
|
184
|
-
continue;
|
|
185
|
-
/**
|
|
186
|
-
* If the value has changed, we probably want to animate it.
|
|
187
|
-
*/
|
|
188
|
-
let valueHasChanged = false;
|
|
189
|
-
if (isKeyframesTarget(next) && isKeyframesTarget(prev)) {
|
|
190
|
-
valueHasChanged = !shallowCompare(next, prev);
|
|
191
|
-
}
|
|
192
|
-
else {
|
|
193
|
-
valueHasChanged = next !== prev;
|
|
194
|
-
}
|
|
195
|
-
if (valueHasChanged) {
|
|
196
|
-
if (next !== undefined && next !== null) {
|
|
197
|
-
// If next is defined and doesn't equal prev, it needs animating
|
|
198
|
-
markToAnimate(key);
|
|
199
|
-
}
|
|
200
|
-
else {
|
|
201
|
-
// If it's undefined, it's been removed.
|
|
202
|
-
removedKeys.add(key);
|
|
203
|
-
}
|
|
204
|
-
}
|
|
205
|
-
else if (next !== undefined && removedKeys.has(key)) {
|
|
206
|
-
/**
|
|
207
|
-
* If next hasn't changed and it isn't undefined, we want to check if it's
|
|
208
|
-
* been removed by a higher priority
|
|
209
|
-
*/
|
|
210
|
-
markToAnimate(key);
|
|
211
|
-
}
|
|
212
|
-
else {
|
|
213
|
-
/**
|
|
214
|
-
* If it hasn't changed, we add it to the list of protected values
|
|
215
|
-
* to ensure it doesn't get animated.
|
|
216
|
-
*/
|
|
217
|
-
typeState.protectedKeys[key] = true;
|
|
218
|
-
}
|
|
219
|
-
}
|
|
220
|
-
/**
|
|
221
|
-
* Update the typeState so next time animateChanges is called we can compare the
|
|
222
|
-
* latest prop and resolvedValues to these.
|
|
223
|
-
*/
|
|
224
|
-
typeState.prevProp = prop;
|
|
225
|
-
typeState.prevResolvedValues = resolvedValues;
|
|
226
|
-
/**
|
|
227
|
-
*
|
|
228
|
-
*/
|
|
229
|
-
if (typeState.isActive) {
|
|
230
|
-
encounteredKeys = { ...encounteredKeys, ...resolvedValues };
|
|
231
|
-
}
|
|
232
|
-
if (isInitialRender && visualElement.blockInitialAnimation) {
|
|
233
|
-
shouldAnimateType = false;
|
|
234
|
-
}
|
|
235
|
-
/**
|
|
236
|
-
* If this is an inherited prop we want to skip this animation
|
|
237
|
-
* unless the inherited variants haven't changed on this render.
|
|
238
|
-
*/
|
|
239
|
-
const willAnimateViaParent = isInherited && variantDidChange;
|
|
240
|
-
const needsAnimating = !willAnimateViaParent || handledRemovedValues;
|
|
241
|
-
if (shouldAnimateType && needsAnimating) {
|
|
242
|
-
animations.push(...definitionList.map((animation) => ({
|
|
243
|
-
animation: animation,
|
|
244
|
-
options: { type },
|
|
245
|
-
})));
|
|
246
|
-
}
|
|
247
|
-
}
|
|
248
|
-
/**
|
|
249
|
-
* If there are some removed value that haven't been dealt with,
|
|
250
|
-
* we need to create a new animation that falls back either to the value
|
|
251
|
-
* defined in the style prop, or the last read value.
|
|
252
|
-
*/
|
|
253
|
-
if (removedKeys.size) {
|
|
254
|
-
const fallbackAnimation = {};
|
|
255
|
-
/**
|
|
256
|
-
* If the initial prop contains a transition we can use that, otherwise
|
|
257
|
-
* allow the animation function to use the visual element's default.
|
|
258
|
-
*/
|
|
259
|
-
if (typeof props.initial !== "boolean") {
|
|
260
|
-
const initialTransition = resolveVariant(visualElement, Array.isArray(props.initial)
|
|
261
|
-
? props.initial[0]
|
|
262
|
-
: props.initial);
|
|
263
|
-
if (initialTransition && initialTransition.transition) {
|
|
264
|
-
fallbackAnimation.transition = initialTransition.transition;
|
|
265
|
-
}
|
|
266
|
-
}
|
|
267
|
-
removedKeys.forEach((key) => {
|
|
268
|
-
const fallbackTarget = visualElement.getBaseTarget(key);
|
|
269
|
-
const motionValue = visualElement.getValue(key);
|
|
270
|
-
if (motionValue)
|
|
271
|
-
motionValue.liveStyle = true;
|
|
272
|
-
// @ts-expect-error - @mattgperry to figure if we should do something here
|
|
273
|
-
fallbackAnimation[key] = fallbackTarget ?? null;
|
|
274
|
-
});
|
|
275
|
-
animations.push({ animation: fallbackAnimation });
|
|
276
|
-
}
|
|
277
|
-
let shouldAnimate = Boolean(animations.length);
|
|
278
|
-
if (isInitialRender &&
|
|
279
|
-
(props.initial === false || props.initial === props.animate) &&
|
|
280
|
-
!visualElement.manuallyAnimateOnMount) {
|
|
281
|
-
shouldAnimate = false;
|
|
282
|
-
}
|
|
283
|
-
isInitialRender = false;
|
|
284
|
-
return shouldAnimate ? animate(animations) : Promise.resolve();
|
|
285
|
-
}
|
|
286
|
-
/**
|
|
287
|
-
* Change whether a certain animation type is active.
|
|
288
|
-
*/
|
|
289
|
-
function setActive(type, isActive) {
|
|
290
|
-
// If the active state hasn't changed, we can safely do nothing here
|
|
291
|
-
if (state[type].isActive === isActive)
|
|
292
|
-
return Promise.resolve();
|
|
293
|
-
// Propagate active change to children
|
|
294
|
-
visualElement.variantChildren?.forEach((child) => child.animationState?.setActive(type, isActive));
|
|
295
|
-
state[type].isActive = isActive;
|
|
296
|
-
const animations = animateChanges(type);
|
|
297
|
-
for (const key in state) {
|
|
298
|
-
state[key].protectedKeys = {};
|
|
299
|
-
}
|
|
300
|
-
return animations;
|
|
301
|
-
}
|
|
302
|
-
return {
|
|
303
|
-
animateChanges,
|
|
304
|
-
setActive,
|
|
305
|
-
setAnimateFunction,
|
|
306
|
-
getState: () => state,
|
|
307
|
-
reset: () => {
|
|
308
|
-
state = createState();
|
|
309
|
-
isInitialRender = true;
|
|
310
|
-
},
|
|
311
|
-
};
|
|
312
|
-
}
|
|
313
|
-
function checkVariantsDidChange(prev, next) {
|
|
314
|
-
if (typeof next === "string") {
|
|
315
|
-
return next !== prev;
|
|
316
|
-
}
|
|
317
|
-
else if (Array.isArray(next)) {
|
|
318
|
-
return !shallowCompare(next, prev);
|
|
319
|
-
}
|
|
320
|
-
return false;
|
|
321
|
-
}
|
|
322
|
-
function createTypeState(isActive = false) {
|
|
323
|
-
return {
|
|
324
|
-
isActive,
|
|
325
|
-
protectedKeys: {},
|
|
326
|
-
needsAnimating: {},
|
|
327
|
-
prevResolvedValues: {},
|
|
328
|
-
};
|
|
329
|
-
}
|
|
330
|
-
function createState() {
|
|
331
|
-
return {
|
|
332
|
-
animate: createTypeState(true),
|
|
333
|
-
whileInView: createTypeState(),
|
|
334
|
-
whileHover: createTypeState(),
|
|
335
|
-
whileTap: createTypeState(),
|
|
336
|
-
whileDrag: createTypeState(),
|
|
337
|
-
whileFocus: createTypeState(),
|
|
338
|
-
exit: createTypeState(),
|
|
339
|
-
};
|
|
340
|
-
}
|
|
341
|
-
|
|
342
|
-
export { checkVariantsDidChange, createAnimationState };
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { compareByDepth } from './compare-by-depth.mjs';
|
|
2
|
-
import { addUniqueItem, removeItem } from '../../../../../motion-utils/dist/es/array.mjs';
|
|
3
|
-
|
|
4
|
-
class FlatTree {
|
|
5
|
-
constructor() {
|
|
6
|
-
this.children = [];
|
|
7
|
-
this.isDirty = false;
|
|
8
|
-
}
|
|
9
|
-
add(child) {
|
|
10
|
-
addUniqueItem(this.children, child);
|
|
11
|
-
this.isDirty = true;
|
|
12
|
-
}
|
|
13
|
-
remove(child) {
|
|
14
|
-
removeItem(this.children, child);
|
|
15
|
-
this.isDirty = true;
|
|
16
|
-
}
|
|
17
|
-
forEach(callback) {
|
|
18
|
-
this.isDirty && this.children.sort(compareByDepth);
|
|
19
|
-
this.isDirty = false;
|
|
20
|
-
this.children.forEach(callback);
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
export { FlatTree };
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { isVariantLabel } from './is-variant-label.mjs';
|
|
2
|
-
import { variantProps } from './variant-props.mjs';
|
|
3
|
-
|
|
4
|
-
const numVariantProps = variantProps.length;
|
|
5
|
-
function getVariantContext(visualElement) {
|
|
6
|
-
if (!visualElement)
|
|
7
|
-
return undefined;
|
|
8
|
-
if (!visualElement.isControllingVariants) {
|
|
9
|
-
const context = visualElement.parent
|
|
10
|
-
? getVariantContext(visualElement.parent) || {}
|
|
11
|
-
: {};
|
|
12
|
-
if (visualElement.props.initial !== undefined) {
|
|
13
|
-
context.initial = visualElement.props.initial;
|
|
14
|
-
}
|
|
15
|
-
return context;
|
|
16
|
-
}
|
|
17
|
-
const context = {};
|
|
18
|
-
for (let i = 0; i < numVariantProps; i++) {
|
|
19
|
-
const name = variantProps[i];
|
|
20
|
-
const prop = visualElement.props[name];
|
|
21
|
-
if (isVariantLabel(prop) || prop === false) {
|
|
22
|
-
context[name] = prop;
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
return context;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
export { getVariantContext };
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { isAnimationControls } from '../../animation/utils/is-animation-controls.mjs';
|
|
2
|
-
import { isVariantLabel } from './is-variant-label.mjs';
|
|
3
|
-
import { variantProps } from './variant-props.mjs';
|
|
4
|
-
|
|
5
|
-
function isControllingVariants(props) {
|
|
6
|
-
return (isAnimationControls(props.animate) ||
|
|
7
|
-
variantProps.some((name) => isVariantLabel(props[name])));
|
|
8
|
-
}
|
|
9
|
-
function isVariantNode(props) {
|
|
10
|
-
return Boolean(isControllingVariants(props) || props.variants);
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export { isControllingVariants, isVariantNode };
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
import { isMotionValue } from '../../../../../motion-dom/dist/es/value/utils/is-motion-value.mjs';
|
|
2
|
-
import { motionValue } from '../../../../../motion-dom/dist/es/value/index.mjs';
|
|
3
|
-
|
|
4
|
-
function updateMotionValuesFromProps(element, next, prev) {
|
|
5
|
-
for (const key in next) {
|
|
6
|
-
const nextValue = next[key];
|
|
7
|
-
const prevValue = prev[key];
|
|
8
|
-
if (isMotionValue(nextValue)) {
|
|
9
|
-
/**
|
|
10
|
-
* If this is a motion value found in props or style, we want to add it
|
|
11
|
-
* to our visual element's motion value map.
|
|
12
|
-
*/
|
|
13
|
-
element.addValue(key, nextValue);
|
|
14
|
-
}
|
|
15
|
-
else if (isMotionValue(prevValue)) {
|
|
16
|
-
/**
|
|
17
|
-
* If we're swapping from a motion value to a static value,
|
|
18
|
-
* create a new motion value from that
|
|
19
|
-
*/
|
|
20
|
-
element.addValue(key, motionValue(nextValue, { owner: element }));
|
|
21
|
-
}
|
|
22
|
-
else if (prevValue !== nextValue) {
|
|
23
|
-
/**
|
|
24
|
-
* If this is a flat value that has changed, update the motion value
|
|
25
|
-
* or create one if it doesn't exist. We only want to do this if we're
|
|
26
|
-
* not handling the value with our animation state.
|
|
27
|
-
*/
|
|
28
|
-
if (element.hasValue(key)) {
|
|
29
|
-
const existingValue = element.getValue(key);
|
|
30
|
-
if (existingValue.liveStyle === true) {
|
|
31
|
-
existingValue.jump(nextValue);
|
|
32
|
-
}
|
|
33
|
-
else if (!existingValue.hasAnimated) {
|
|
34
|
-
existingValue.set(nextValue);
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
else {
|
|
38
|
-
const latestValue = element.getStaticValue(key);
|
|
39
|
-
element.addValue(key, motionValue(latestValue !== undefined ? latestValue : nextValue, { owner: element }));
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
// Handle removed values
|
|
44
|
-
for (const key in prev) {
|
|
45
|
-
if (next[key] === undefined)
|
|
46
|
-
element.removeValue(key);
|
|
47
|
-
}
|
|
48
|
-
return next;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
export { updateMotionValuesFromProps };
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { resolveVariantFromProps } from './resolve-variants.mjs';
|
|
2
|
-
|
|
3
|
-
function resolveVariant(visualElement, definition, custom) {
|
|
4
|
-
const props = visualElement.getProps();
|
|
5
|
-
return resolveVariantFromProps(props, definition, custom !== undefined ? custom : props.custom, visualElement);
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
export { resolveVariant };
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
function getValueState(visualElement) {
|
|
2
|
-
const state = [{}, {}];
|
|
3
|
-
visualElement?.values.forEach((value, key) => {
|
|
4
|
-
state[0][key] = value.get();
|
|
5
|
-
state[1][key] = value.getVelocity();
|
|
6
|
-
});
|
|
7
|
-
return state;
|
|
8
|
-
}
|
|
9
|
-
function resolveVariantFromProps(props, definition, custom, visualElement) {
|
|
10
|
-
/**
|
|
11
|
-
* If the variant definition is a function, resolve.
|
|
12
|
-
*/
|
|
13
|
-
if (typeof definition === "function") {
|
|
14
|
-
const [current, velocity] = getValueState(visualElement);
|
|
15
|
-
definition = definition(custom !== undefined ? custom : props.custom, current, velocity);
|
|
16
|
-
}
|
|
17
|
-
/**
|
|
18
|
-
* If the variant definition is a variant label, or
|
|
19
|
-
* the function returned a variant label, resolve.
|
|
20
|
-
*/
|
|
21
|
-
if (typeof definition === "string") {
|
|
22
|
-
definition = props.variants && props.variants[definition];
|
|
23
|
-
}
|
|
24
|
-
/**
|
|
25
|
-
* At this point we've resolved both functions and variant labels,
|
|
26
|
-
* but the resolved variant label might itself have been a function.
|
|
27
|
-
* If so, resolve. This can only have returned a valid target object.
|
|
28
|
-
*/
|
|
29
|
-
if (typeof definition === "function") {
|
|
30
|
-
const [current, velocity] = getValueState(visualElement);
|
|
31
|
-
definition = definition(custom !== undefined ? custom : props.custom, current, velocity);
|
|
32
|
-
}
|
|
33
|
-
return definition;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
export { resolveVariantFromProps };
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { isKeyframesTarget } from '../../animation/utils/is-keyframes-target.mjs';
|
|
2
|
-
import { resolveVariant } from './resolve-dynamic-variants.mjs';
|
|
3
|
-
import { motionValue } from '../../../../../motion-dom/dist/es/value/index.mjs';
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Set VisualElement's MotionValue, creating a new MotionValue for it if
|
|
7
|
-
* it doesn't exist.
|
|
8
|
-
*/
|
|
9
|
-
function setMotionValue(visualElement, key, value) {
|
|
10
|
-
if (visualElement.hasValue(key)) {
|
|
11
|
-
visualElement.getValue(key).set(value);
|
|
12
|
-
}
|
|
13
|
-
else {
|
|
14
|
-
visualElement.addValue(key, motionValue(value));
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
function resolveFinalValueInKeyframes(v) {
|
|
18
|
-
// TODO maybe throw if v.length - 1 is placeholder token?
|
|
19
|
-
return isKeyframesTarget(v) ? v[v.length - 1] || 0 : v;
|
|
20
|
-
}
|
|
21
|
-
function setTarget(visualElement, definition) {
|
|
22
|
-
const resolved = resolveVariant(visualElement, definition);
|
|
23
|
-
let { transitionEnd = {}, transition = {}, ...target } = resolved || {};
|
|
24
|
-
target = { ...target, ...transitionEnd };
|
|
25
|
-
for (const key in target) {
|
|
26
|
-
const value = resolveFinalValueInKeyframes(target[key]);
|
|
27
|
-
setMotionValue(visualElement, key, value);
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
export { setTarget };
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { time } from '../../../../motion-dom/dist/es/frameloop/sync-time.mjs';
|
|
2
|
-
import { frame, cancelFrame } from '../../../../motion-dom/dist/es/frameloop/frame.mjs';
|
|
3
|
-
import { secondsToMilliseconds } from '../../../../motion-utils/dist/es/time-conversion.mjs';
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Timeout defined in ms
|
|
7
|
-
*/
|
|
8
|
-
function delay(callback, timeout) {
|
|
9
|
-
const start = time.now();
|
|
10
|
-
const checkElapsed = ({ timestamp }) => {
|
|
11
|
-
const elapsed = timestamp - start;
|
|
12
|
-
if (elapsed >= timeout) {
|
|
13
|
-
cancelFrame(checkElapsed);
|
|
14
|
-
callback(elapsed - timeout);
|
|
15
|
-
}
|
|
16
|
-
};
|
|
17
|
-
frame.setup(checkElapsed, true);
|
|
18
|
-
return () => cancelFrame(checkElapsed);
|
|
19
|
-
}
|
|
20
|
-
function delayInSeconds(callback, timeout) {
|
|
21
|
-
return delay(callback, secondsToMilliseconds(timeout));
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
export { delay, delayInSeconds };
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { isBrowser } from '../is-browser.mjs';
|
|
2
|
-
import { hasReducedMotionListener, prefersReducedMotion } from './state.mjs';
|
|
3
|
-
|
|
4
|
-
function initPrefersReducedMotion() {
|
|
5
|
-
hasReducedMotionListener.current = true;
|
|
6
|
-
if (!isBrowser)
|
|
7
|
-
return;
|
|
8
|
-
if (window.matchMedia) {
|
|
9
|
-
const motionMediaQuery = window.matchMedia("(prefers-reduced-motion)");
|
|
10
|
-
const setReducedMotionPreferences = () => (prefersReducedMotion.current = motionMediaQuery.matches);
|
|
11
|
-
motionMediaQuery.addListener(setReducedMotionPreferences);
|
|
12
|
-
setReducedMotionPreferences();
|
|
13
|
-
}
|
|
14
|
-
else {
|
|
15
|
-
prefersReducedMotion.current = false;
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
export { initPrefersReducedMotion };
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { useContext } from 'react';
|
|
2
|
-
import { MotionConfigContext } from '../../context/MotionConfigContext.mjs';
|
|
3
|
-
import { useReducedMotion } from './use-reduced-motion.mjs';
|
|
4
|
-
|
|
5
|
-
function useReducedMotionConfig() {
|
|
6
|
-
const reducedMotionPreference = useReducedMotion();
|
|
7
|
-
const { reducedMotion } = useContext(MotionConfigContext);
|
|
8
|
-
if (reducedMotion === "never") {
|
|
9
|
-
return false;
|
|
10
|
-
}
|
|
11
|
-
else if (reducedMotion === "always") {
|
|
12
|
-
return true;
|
|
13
|
-
}
|
|
14
|
-
else {
|
|
15
|
-
return reducedMotionPreference;
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
export { useReducedMotionConfig };
|