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,45 +0,0 @@
|
|
|
1
|
-
import { HTMLVisualElement } from '../../render/html/HTMLVisualElement.mjs';
|
|
2
|
-
import { ObjectVisualElement } from '../../render/object/ObjectVisualElement.mjs';
|
|
3
|
-
import { visualElementStore } from '../../render/store.mjs';
|
|
4
|
-
import { SVGVisualElement } from '../../render/svg/SVGVisualElement.mjs';
|
|
5
|
-
import { isSVGElement } from '../../../../../motion-dom/dist/es/utils/is-svg-element.mjs';
|
|
6
|
-
import { isSVGSVGElement } from '../../../../../motion-dom/dist/es/utils/is-svg-svg-element.mjs';
|
|
7
|
-
|
|
8
|
-
function createDOMVisualElement(element) {
|
|
9
|
-
const options = {
|
|
10
|
-
presenceContext: null,
|
|
11
|
-
props: {},
|
|
12
|
-
visualState: {
|
|
13
|
-
renderState: {
|
|
14
|
-
transform: {},
|
|
15
|
-
transformOrigin: {},
|
|
16
|
-
style: {},
|
|
17
|
-
vars: {},
|
|
18
|
-
attrs: {},
|
|
19
|
-
},
|
|
20
|
-
latestValues: {},
|
|
21
|
-
},
|
|
22
|
-
};
|
|
23
|
-
const node = isSVGElement(element) && !isSVGSVGElement(element)
|
|
24
|
-
? new SVGVisualElement(options)
|
|
25
|
-
: new HTMLVisualElement(options);
|
|
26
|
-
node.mount(element);
|
|
27
|
-
visualElementStore.set(element, node);
|
|
28
|
-
}
|
|
29
|
-
function createObjectVisualElement(subject) {
|
|
30
|
-
const options = {
|
|
31
|
-
presenceContext: null,
|
|
32
|
-
props: {},
|
|
33
|
-
visualState: {
|
|
34
|
-
renderState: {
|
|
35
|
-
output: {},
|
|
36
|
-
},
|
|
37
|
-
latestValues: {},
|
|
38
|
-
},
|
|
39
|
-
};
|
|
40
|
-
const node = new ObjectVisualElement(options);
|
|
41
|
-
node.mount(subject);
|
|
42
|
-
visualElementStore.set(subject, node);
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
export { createDOMVisualElement, createObjectVisualElement };
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import { transformProps } from '../../../../../motion-dom/dist/es/render/utils/keys-transform.mjs';
|
|
2
|
-
|
|
3
|
-
const underDampedSpring = {
|
|
4
|
-
type: "spring",
|
|
5
|
-
stiffness: 500,
|
|
6
|
-
damping: 25,
|
|
7
|
-
restSpeed: 10,
|
|
8
|
-
};
|
|
9
|
-
const criticallyDampedSpring = (target) => ({
|
|
10
|
-
type: "spring",
|
|
11
|
-
stiffness: 550,
|
|
12
|
-
damping: target === 0 ? 2 * Math.sqrt(550) : 30,
|
|
13
|
-
restSpeed: 10,
|
|
14
|
-
});
|
|
15
|
-
const keyframesTransition = {
|
|
16
|
-
type: "keyframes",
|
|
17
|
-
duration: 0.8,
|
|
18
|
-
};
|
|
19
|
-
/**
|
|
20
|
-
* Default easing curve is a slightly shallower version of
|
|
21
|
-
* the default browser easing curve.
|
|
22
|
-
*/
|
|
23
|
-
const ease = {
|
|
24
|
-
type: "keyframes",
|
|
25
|
-
ease: [0.25, 0.1, 0.35, 1],
|
|
26
|
-
duration: 0.3,
|
|
27
|
-
};
|
|
28
|
-
const getDefaultTransition = (valueKey, { keyframes }) => {
|
|
29
|
-
if (keyframes.length > 2) {
|
|
30
|
-
return keyframesTransition;
|
|
31
|
-
}
|
|
32
|
-
else if (transformProps.has(valueKey)) {
|
|
33
|
-
return valueKey.startsWith("scale")
|
|
34
|
-
? criticallyDampedSpring(keyframes[1])
|
|
35
|
-
: underDampedSpring;
|
|
36
|
-
}
|
|
37
|
-
return ease;
|
|
38
|
-
};
|
|
39
|
-
|
|
40
|
-
export { getDefaultTransition };
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Decide whether a transition is defined on a given Transition.
|
|
3
|
-
* This filters out orchestration options and returns true
|
|
4
|
-
* if any options are left.
|
|
5
|
-
*/
|
|
6
|
-
function isTransitionDefined({ when, delay: _delay, delayChildren, staggerChildren, staggerDirection, repeat, repeatType, repeatDelay, from, elapsed, ...transition }) {
|
|
7
|
-
return !!Object.keys(transition).length;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
export { isTransitionDefined };
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { easingDefinitionToFunction } from '../../../../../motion-utils/dist/es/easing/utils/map.mjs';
|
|
2
|
-
|
|
3
|
-
function getOriginIndex(from, total) {
|
|
4
|
-
if (from === "first") {
|
|
5
|
-
return 0;
|
|
6
|
-
}
|
|
7
|
-
else {
|
|
8
|
-
const lastIndex = total - 1;
|
|
9
|
-
return from === "last" ? lastIndex : lastIndex / 2;
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
|
-
function stagger(duration = 0.1, { startDelay = 0, from = 0, ease } = {}) {
|
|
13
|
-
return (i, total) => {
|
|
14
|
-
const fromIndex = typeof from === "number" ? from : getOriginIndex(from, total);
|
|
15
|
-
const distance = Math.abs(fromIndex - i);
|
|
16
|
-
let delay = duration * distance;
|
|
17
|
-
if (ease) {
|
|
18
|
-
const maxDelay = total * duration;
|
|
19
|
-
const easingFunction = easingDefinitionToFunction(ease);
|
|
20
|
-
delay = easingFunction(delay / maxDelay) * maxDelay;
|
|
21
|
-
}
|
|
22
|
-
return startDelay + delay;
|
|
23
|
-
};
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
export { getOriginIndex, stagger };
|
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { jsx } from 'react/jsx-runtime';
|
|
3
|
-
import * as React from 'react';
|
|
4
|
-
import { useId, useRef, useContext, useInsertionEffect } from 'react';
|
|
5
|
-
import { MotionConfigContext } from '../../context/MotionConfigContext.mjs';
|
|
6
|
-
import { isHTMLElement } from '../../../../../motion-dom/dist/es/utils/is-html-element.mjs';
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* Measurement functionality has to be within a separate component
|
|
10
|
-
* to leverage snapshot lifecycle.
|
|
11
|
-
*/
|
|
12
|
-
class PopChildMeasure extends React.Component {
|
|
13
|
-
getSnapshotBeforeUpdate(prevProps) {
|
|
14
|
-
const element = this.props.childRef.current;
|
|
15
|
-
if (element && prevProps.isPresent && !this.props.isPresent) {
|
|
16
|
-
const parent = element.offsetParent;
|
|
17
|
-
const parentWidth = isHTMLElement(parent)
|
|
18
|
-
? parent.offsetWidth || 0
|
|
19
|
-
: 0;
|
|
20
|
-
const size = this.props.sizeRef.current;
|
|
21
|
-
size.height = element.offsetHeight || 0;
|
|
22
|
-
size.width = element.offsetWidth || 0;
|
|
23
|
-
size.top = element.offsetTop;
|
|
24
|
-
size.left = element.offsetLeft;
|
|
25
|
-
size.right = parentWidth - size.width - size.left;
|
|
26
|
-
}
|
|
27
|
-
return null;
|
|
28
|
-
}
|
|
29
|
-
/**
|
|
30
|
-
* Required with getSnapshotBeforeUpdate to stop React complaining.
|
|
31
|
-
*/
|
|
32
|
-
componentDidUpdate() { }
|
|
33
|
-
render() {
|
|
34
|
-
return this.props.children;
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
function PopChild({ children, isPresent, anchorX }) {
|
|
38
|
-
const id = useId();
|
|
39
|
-
const ref = useRef(null);
|
|
40
|
-
const size = useRef({
|
|
41
|
-
width: 0,
|
|
42
|
-
height: 0,
|
|
43
|
-
top: 0,
|
|
44
|
-
left: 0,
|
|
45
|
-
right: 0,
|
|
46
|
-
});
|
|
47
|
-
const { nonce } = useContext(MotionConfigContext);
|
|
48
|
-
/**
|
|
49
|
-
* We create and inject a style block so we can apply this explicit
|
|
50
|
-
* sizing in a non-destructive manner by just deleting the style block.
|
|
51
|
-
*
|
|
52
|
-
* We can't apply size via render as the measurement happens
|
|
53
|
-
* in getSnapshotBeforeUpdate (post-render), likewise if we apply the
|
|
54
|
-
* styles directly on the DOM node, we might be overwriting
|
|
55
|
-
* styles set via the style prop.
|
|
56
|
-
*/
|
|
57
|
-
useInsertionEffect(() => {
|
|
58
|
-
const { width, height, top, left, right } = size.current;
|
|
59
|
-
if (isPresent || !ref.current || !width || !height)
|
|
60
|
-
return;
|
|
61
|
-
const x = anchorX === "left" ? `left: ${left}` : `right: ${right}`;
|
|
62
|
-
ref.current.dataset.motionPopId = id;
|
|
63
|
-
const style = document.createElement("style");
|
|
64
|
-
if (nonce)
|
|
65
|
-
style.nonce = nonce;
|
|
66
|
-
document.head.appendChild(style);
|
|
67
|
-
if (style.sheet) {
|
|
68
|
-
style.sheet.insertRule(`
|
|
69
|
-
[data-motion-pop-id="${id}"] {
|
|
70
|
-
position: absolute !important;
|
|
71
|
-
width: ${width}px !important;
|
|
72
|
-
height: ${height}px !important;
|
|
73
|
-
${x}px !important;
|
|
74
|
-
top: ${top}px !important;
|
|
75
|
-
}
|
|
76
|
-
`);
|
|
77
|
-
}
|
|
78
|
-
return () => {
|
|
79
|
-
if (document.head.contains(style)) {
|
|
80
|
-
document.head.removeChild(style);
|
|
81
|
-
}
|
|
82
|
-
};
|
|
83
|
-
}, [isPresent]);
|
|
84
|
-
return (jsx(PopChildMeasure, { isPresent: isPresent, childRef: ref, sizeRef: size, children: React.cloneElement(children, { ref }) }));
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
export { PopChild };
|
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { jsx } from 'react/jsx-runtime';
|
|
3
|
-
import * as React from 'react';
|
|
4
|
-
import { useId, useMemo } from 'react';
|
|
5
|
-
import { PresenceContext } from '../../context/PresenceContext.mjs';
|
|
6
|
-
import { useConstant } from '../../utils/use-constant.mjs';
|
|
7
|
-
import { PopChild } from './PopChild.mjs';
|
|
8
|
-
|
|
9
|
-
const PresenceChild = ({ children, initial, isPresent, onExitComplete, custom, presenceAffectsLayout, mode, anchorX, }) => {
|
|
10
|
-
const presenceChildren = useConstant(newChildrenMap);
|
|
11
|
-
const id = useId();
|
|
12
|
-
let isReusedContext = true;
|
|
13
|
-
let context = useMemo(() => {
|
|
14
|
-
isReusedContext = false;
|
|
15
|
-
return {
|
|
16
|
-
id,
|
|
17
|
-
initial,
|
|
18
|
-
isPresent,
|
|
19
|
-
custom,
|
|
20
|
-
onExitComplete: (childId) => {
|
|
21
|
-
presenceChildren.set(childId, true);
|
|
22
|
-
for (const isComplete of presenceChildren.values()) {
|
|
23
|
-
if (!isComplete)
|
|
24
|
-
return; // can stop searching when any is incomplete
|
|
25
|
-
}
|
|
26
|
-
onExitComplete && onExitComplete();
|
|
27
|
-
},
|
|
28
|
-
register: (childId) => {
|
|
29
|
-
presenceChildren.set(childId, false);
|
|
30
|
-
return () => presenceChildren.delete(childId);
|
|
31
|
-
},
|
|
32
|
-
};
|
|
33
|
-
}, [isPresent, presenceChildren, onExitComplete]);
|
|
34
|
-
/**
|
|
35
|
-
* If the presence of a child affects the layout of the components around it,
|
|
36
|
-
* we want to make a new context value to ensure they get re-rendered
|
|
37
|
-
* so they can detect that layout change.
|
|
38
|
-
*/
|
|
39
|
-
if (presenceAffectsLayout && isReusedContext) {
|
|
40
|
-
context = { ...context };
|
|
41
|
-
}
|
|
42
|
-
useMemo(() => {
|
|
43
|
-
presenceChildren.forEach((_, key) => presenceChildren.set(key, false));
|
|
44
|
-
}, [isPresent]);
|
|
45
|
-
/**
|
|
46
|
-
* If there's no `motion` components to fire exit animations, we want to remove this
|
|
47
|
-
* component immediately.
|
|
48
|
-
*/
|
|
49
|
-
React.useEffect(() => {
|
|
50
|
-
!isPresent &&
|
|
51
|
-
!presenceChildren.size &&
|
|
52
|
-
onExitComplete &&
|
|
53
|
-
onExitComplete();
|
|
54
|
-
}, [isPresent]);
|
|
55
|
-
if (mode === "popLayout") {
|
|
56
|
-
children = (jsx(PopChild, { isPresent: isPresent, anchorX: anchorX, children: children }));
|
|
57
|
-
}
|
|
58
|
-
return (jsx(PresenceContext.Provider, { value: context, children: children }));
|
|
59
|
-
};
|
|
60
|
-
function newChildrenMap() {
|
|
61
|
-
return new Map();
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
export { PresenceChild };
|
|
@@ -1,166 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { jsx, Fragment } from 'react/jsx-runtime';
|
|
3
|
-
import { useMemo, useRef, useState, useContext } from 'react';
|
|
4
|
-
import { LayoutGroupContext } from '../../context/LayoutGroupContext.mjs';
|
|
5
|
-
import { useConstant } from '../../utils/use-constant.mjs';
|
|
6
|
-
import { useIsomorphicLayoutEffect } from '../../utils/use-isomorphic-effect.mjs';
|
|
7
|
-
import { PresenceChild } from './PresenceChild.mjs';
|
|
8
|
-
import { usePresence } from './use-presence.mjs';
|
|
9
|
-
import { onlyElements, getChildKey } from './utils.mjs';
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* `AnimatePresence` enables the animation of components that have been removed from the tree.
|
|
13
|
-
*
|
|
14
|
-
* When adding/removing more than a single child, every child **must** be given a unique `key` prop.
|
|
15
|
-
*
|
|
16
|
-
* Any `motion` components that have an `exit` property defined will animate out when removed from
|
|
17
|
-
* the tree.
|
|
18
|
-
*
|
|
19
|
-
* ```jsx
|
|
20
|
-
* import { motion, AnimatePresence } from 'framer-motion'
|
|
21
|
-
*
|
|
22
|
-
* export const Items = ({ items }) => (
|
|
23
|
-
* <AnimatePresence>
|
|
24
|
-
* {items.map(item => (
|
|
25
|
-
* <motion.div
|
|
26
|
-
* key={item.id}
|
|
27
|
-
* initial={{ opacity: 0 }}
|
|
28
|
-
* animate={{ opacity: 1 }}
|
|
29
|
-
* exit={{ opacity: 0 }}
|
|
30
|
-
* />
|
|
31
|
-
* ))}
|
|
32
|
-
* </AnimatePresence>
|
|
33
|
-
* )
|
|
34
|
-
* ```
|
|
35
|
-
*
|
|
36
|
-
* You can sequence exit animations throughout a tree using variants.
|
|
37
|
-
*
|
|
38
|
-
* If a child contains multiple `motion` components with `exit` props, it will only unmount the child
|
|
39
|
-
* once all `motion` components have finished animating out. Likewise, any components using
|
|
40
|
-
* `usePresence` all need to call `safeToRemove`.
|
|
41
|
-
*
|
|
42
|
-
* @public
|
|
43
|
-
*/
|
|
44
|
-
const AnimatePresence = ({ children, custom, initial = true, onExitComplete, presenceAffectsLayout = true, mode = "sync", propagate = false, anchorX = "left", }) => {
|
|
45
|
-
const [isParentPresent, safeToRemove] = usePresence(propagate);
|
|
46
|
-
/**
|
|
47
|
-
* Filter any children that aren't ReactElements. We can only track components
|
|
48
|
-
* between renders with a props.key.
|
|
49
|
-
*/
|
|
50
|
-
const presentChildren = useMemo(() => onlyElements(children), [children]);
|
|
51
|
-
/**
|
|
52
|
-
* Track the keys of the currently rendered children. This is used to
|
|
53
|
-
* determine which children are exiting.
|
|
54
|
-
*/
|
|
55
|
-
const presentKeys = propagate && !isParentPresent ? [] : presentChildren.map(getChildKey);
|
|
56
|
-
/**
|
|
57
|
-
* If `initial={false}` we only want to pass this to components in the first render.
|
|
58
|
-
*/
|
|
59
|
-
const isInitialRender = useRef(true);
|
|
60
|
-
/**
|
|
61
|
-
* A ref containing the currently present children. When all exit animations
|
|
62
|
-
* are complete, we use this to re-render the component with the latest children
|
|
63
|
-
* *committed* rather than the latest children *rendered*.
|
|
64
|
-
*/
|
|
65
|
-
const pendingPresentChildren = useRef(presentChildren);
|
|
66
|
-
/**
|
|
67
|
-
* Track which exiting children have finished animating out.
|
|
68
|
-
*/
|
|
69
|
-
const exitComplete = useConstant(() => new Map());
|
|
70
|
-
/**
|
|
71
|
-
* Save children to render as React state. To ensure this component is concurrent-safe,
|
|
72
|
-
* we check for exiting children via an effect.
|
|
73
|
-
*/
|
|
74
|
-
const [diffedChildren, setDiffedChildren] = useState(presentChildren);
|
|
75
|
-
const [renderedChildren, setRenderedChildren] = useState(presentChildren);
|
|
76
|
-
useIsomorphicLayoutEffect(() => {
|
|
77
|
-
isInitialRender.current = false;
|
|
78
|
-
pendingPresentChildren.current = presentChildren;
|
|
79
|
-
/**
|
|
80
|
-
* Update complete status of exiting children.
|
|
81
|
-
*/
|
|
82
|
-
for (let i = 0; i < renderedChildren.length; i++) {
|
|
83
|
-
const key = getChildKey(renderedChildren[i]);
|
|
84
|
-
if (!presentKeys.includes(key)) {
|
|
85
|
-
if (exitComplete.get(key) !== true) {
|
|
86
|
-
exitComplete.set(key, false);
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
else {
|
|
90
|
-
exitComplete.delete(key);
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
}, [renderedChildren, presentKeys.length, presentKeys.join("-")]);
|
|
94
|
-
const exitingChildren = [];
|
|
95
|
-
if (presentChildren !== diffedChildren) {
|
|
96
|
-
let nextChildren = [...presentChildren];
|
|
97
|
-
/**
|
|
98
|
-
* Loop through all the currently rendered components and decide which
|
|
99
|
-
* are exiting.
|
|
100
|
-
*/
|
|
101
|
-
for (let i = 0; i < renderedChildren.length; i++) {
|
|
102
|
-
const child = renderedChildren[i];
|
|
103
|
-
const key = getChildKey(child);
|
|
104
|
-
if (!presentKeys.includes(key)) {
|
|
105
|
-
nextChildren.splice(i, 0, child);
|
|
106
|
-
exitingChildren.push(child);
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
/**
|
|
110
|
-
* If we're in "wait" mode, and we have exiting children, we want to
|
|
111
|
-
* only render these until they've all exited.
|
|
112
|
-
*/
|
|
113
|
-
if (mode === "wait" && exitingChildren.length) {
|
|
114
|
-
nextChildren = exitingChildren;
|
|
115
|
-
}
|
|
116
|
-
setRenderedChildren(onlyElements(nextChildren));
|
|
117
|
-
setDiffedChildren(presentChildren);
|
|
118
|
-
/**
|
|
119
|
-
* Early return to ensure once we've set state with the latest diffed
|
|
120
|
-
* children, we can immediately re-render.
|
|
121
|
-
*/
|
|
122
|
-
return null;
|
|
123
|
-
}
|
|
124
|
-
if (process.env.NODE_ENV !== "production" &&
|
|
125
|
-
mode === "wait" &&
|
|
126
|
-
renderedChildren.length > 1) {
|
|
127
|
-
console.warn(`You're attempting to animate multiple children within AnimatePresence, but its mode is set to "wait". This will lead to odd visual behaviour.`);
|
|
128
|
-
}
|
|
129
|
-
/**
|
|
130
|
-
* If we've been provided a forceRender function by the LayoutGroupContext,
|
|
131
|
-
* we can use it to force a re-render amongst all surrounding components once
|
|
132
|
-
* all components have finished animating out.
|
|
133
|
-
*/
|
|
134
|
-
const { forceRender } = useContext(LayoutGroupContext);
|
|
135
|
-
return (jsx(Fragment, { children: renderedChildren.map((child) => {
|
|
136
|
-
const key = getChildKey(child);
|
|
137
|
-
const isPresent = propagate && !isParentPresent
|
|
138
|
-
? false
|
|
139
|
-
: presentChildren === renderedChildren ||
|
|
140
|
-
presentKeys.includes(key);
|
|
141
|
-
const onExit = () => {
|
|
142
|
-
if (exitComplete.has(key)) {
|
|
143
|
-
exitComplete.set(key, true);
|
|
144
|
-
}
|
|
145
|
-
else {
|
|
146
|
-
return;
|
|
147
|
-
}
|
|
148
|
-
let isEveryExitComplete = true;
|
|
149
|
-
exitComplete.forEach((isExitComplete) => {
|
|
150
|
-
if (!isExitComplete)
|
|
151
|
-
isEveryExitComplete = false;
|
|
152
|
-
});
|
|
153
|
-
if (isEveryExitComplete) {
|
|
154
|
-
forceRender?.();
|
|
155
|
-
setRenderedChildren(pendingPresentChildren.current);
|
|
156
|
-
propagate && safeToRemove?.();
|
|
157
|
-
onExitComplete && onExitComplete();
|
|
158
|
-
}
|
|
159
|
-
};
|
|
160
|
-
return (jsx(PresenceChild, { isPresent: isPresent, initial: !isInitialRender.current || initial
|
|
161
|
-
? undefined
|
|
162
|
-
: false, custom: custom, presenceAffectsLayout: presenceAffectsLayout, mode: mode, onExitComplete: isPresent ? undefined : onExit, anchorX: anchorX, children: child }, key));
|
|
163
|
-
}) }));
|
|
164
|
-
};
|
|
165
|
-
|
|
166
|
-
export { AnimatePresence };
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { useContext } from 'react';
|
|
2
|
-
import { PresenceContext } from '../../context/PresenceContext.mjs';
|
|
3
|
-
|
|
4
|
-
function usePresenceData() {
|
|
5
|
-
const context = useContext(PresenceContext);
|
|
6
|
-
return context ? context.custom : undefined;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
export { usePresenceData };
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
import { useContext, useId, useEffect, useCallback } from 'react';
|
|
2
|
-
import { PresenceContext } from '../../context/PresenceContext.mjs';
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* When a component is the child of `AnimatePresence`, it can use `usePresence`
|
|
6
|
-
* to access information about whether it's still present in the React tree.
|
|
7
|
-
*
|
|
8
|
-
* ```jsx
|
|
9
|
-
* import { usePresence } from "framer-motion"
|
|
10
|
-
*
|
|
11
|
-
* export const Component = () => {
|
|
12
|
-
* const [isPresent, safeToRemove] = usePresence()
|
|
13
|
-
*
|
|
14
|
-
* useEffect(() => {
|
|
15
|
-
* !isPresent && setTimeout(safeToRemove, 1000)
|
|
16
|
-
* }, [isPresent])
|
|
17
|
-
*
|
|
18
|
-
* return <div />
|
|
19
|
-
* }
|
|
20
|
-
* ```
|
|
21
|
-
*
|
|
22
|
-
* If `isPresent` is `false`, it means that a component has been removed the tree, but
|
|
23
|
-
* `AnimatePresence` won't really remove it until `safeToRemove` has been called.
|
|
24
|
-
*
|
|
25
|
-
* @public
|
|
26
|
-
*/
|
|
27
|
-
function usePresence(subscribe = true) {
|
|
28
|
-
const context = useContext(PresenceContext);
|
|
29
|
-
if (context === null)
|
|
30
|
-
return [true, null];
|
|
31
|
-
const { isPresent, onExitComplete, register } = context;
|
|
32
|
-
// It's safe to call the following hooks conditionally (after an early return) because the context will always
|
|
33
|
-
// either be null or non-null for the lifespan of the component.
|
|
34
|
-
const id = useId();
|
|
35
|
-
useEffect(() => {
|
|
36
|
-
if (subscribe) {
|
|
37
|
-
return register(id);
|
|
38
|
-
}
|
|
39
|
-
}, [subscribe]);
|
|
40
|
-
const safeToRemove = useCallback(() => subscribe && onExitComplete && onExitComplete(id), [id, onExitComplete, subscribe]);
|
|
41
|
-
return !isPresent && onExitComplete ? [false, safeToRemove] : [true];
|
|
42
|
-
}
|
|
43
|
-
/**
|
|
44
|
-
* Similar to `usePresence`, except `useIsPresent` simply returns whether or not the component is present.
|
|
45
|
-
* There is no `safeToRemove` function.
|
|
46
|
-
*
|
|
47
|
-
* ```jsx
|
|
48
|
-
* import { useIsPresent } from "framer-motion"
|
|
49
|
-
*
|
|
50
|
-
* export const Component = () => {
|
|
51
|
-
* const isPresent = useIsPresent()
|
|
52
|
-
*
|
|
53
|
-
* useEffect(() => {
|
|
54
|
-
* !isPresent && console.log("I've been removed!")
|
|
55
|
-
* }, [isPresent])
|
|
56
|
-
*
|
|
57
|
-
* return <div />
|
|
58
|
-
* }
|
|
59
|
-
* ```
|
|
60
|
-
*
|
|
61
|
-
* @public
|
|
62
|
-
*/
|
|
63
|
-
function useIsPresent() {
|
|
64
|
-
return isPresent(useContext(PresenceContext));
|
|
65
|
-
}
|
|
66
|
-
function isPresent(context) {
|
|
67
|
-
return context === null ? true : context.isPresent;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
export { isPresent, useIsPresent, usePresence };
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { Children, isValidElement } from 'react';
|
|
2
|
-
|
|
3
|
-
const getChildKey = (child) => child.key || "";
|
|
4
|
-
function onlyElements(children) {
|
|
5
|
-
const filtered = [];
|
|
6
|
-
// We use forEach here instead of map as map mutates the component key by preprending `.$`
|
|
7
|
-
Children.forEach(children, (child) => {
|
|
8
|
-
if (isValidElement(child))
|
|
9
|
-
filtered.push(child);
|
|
10
|
-
});
|
|
11
|
-
return filtered;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
export { getChildKey, onlyElements };
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { jsx } from 'react/jsx-runtime';
|
|
2
|
-
import * as React from 'react';
|
|
3
|
-
import { useConstant } from '../utils/use-constant.mjs';
|
|
4
|
-
import { LayoutGroup } from './LayoutGroup/index.mjs';
|
|
5
|
-
import { invariant } from '../../../../motion-utils/dist/es/errors.mjs';
|
|
6
|
-
|
|
7
|
-
let id = 0;
|
|
8
|
-
const AnimateSharedLayout = ({ children }) => {
|
|
9
|
-
React.useEffect(() => {
|
|
10
|
-
invariant(false, "AnimateSharedLayout is deprecated: https://www.framer.com/docs/guide-upgrade/##shared-layout-animations");
|
|
11
|
-
}, []);
|
|
12
|
-
return (jsx(LayoutGroup, { id: useConstant(() => `asl-${id++}`), children: children }));
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
export { AnimateSharedLayout };
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { jsx } from 'react/jsx-runtime';
|
|
3
|
-
import { useContext, useRef, useMemo } from 'react';
|
|
4
|
-
import { LayoutGroupContext } from '../../context/LayoutGroupContext.mjs';
|
|
5
|
-
import { DeprecatedLayoutGroupContext } from '../../context/DeprecatedLayoutGroupContext.mjs';
|
|
6
|
-
import { useForceUpdate } from '../../utils/use-force-update.mjs';
|
|
7
|
-
import { nodeGroup } from '../../projection/node/group.mjs';
|
|
8
|
-
|
|
9
|
-
const shouldInheritGroup = (inherit) => inherit === true;
|
|
10
|
-
const shouldInheritId = (inherit) => shouldInheritGroup(inherit === true) || inherit === "id";
|
|
11
|
-
const LayoutGroup = ({ children, id, inherit = true }) => {
|
|
12
|
-
const layoutGroupContext = useContext(LayoutGroupContext);
|
|
13
|
-
const deprecatedLayoutGroupContext = useContext(DeprecatedLayoutGroupContext);
|
|
14
|
-
const [forceRender, key] = useForceUpdate();
|
|
15
|
-
const context = useRef(null);
|
|
16
|
-
const upstreamId = layoutGroupContext.id || deprecatedLayoutGroupContext;
|
|
17
|
-
if (context.current === null) {
|
|
18
|
-
if (shouldInheritId(inherit) && upstreamId) {
|
|
19
|
-
id = id ? upstreamId + "-" + id : upstreamId;
|
|
20
|
-
}
|
|
21
|
-
context.current = {
|
|
22
|
-
id,
|
|
23
|
-
group: shouldInheritGroup(inherit)
|
|
24
|
-
? layoutGroupContext.group || nodeGroup()
|
|
25
|
-
: nodeGroup(),
|
|
26
|
-
};
|
|
27
|
-
}
|
|
28
|
-
const memoizedContext = useMemo(() => ({ ...context.current, forceRender }), [key]);
|
|
29
|
-
return (jsx(LayoutGroupContext.Provider, { value: memoizedContext, children: children }));
|
|
30
|
-
};
|
|
31
|
-
|
|
32
|
-
export { LayoutGroup };
|