motion 10.18.0 → 11.11.13
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/.turbo/turbo-build.log +32 -0
- package/{LICENSE → LICENSE.md} +2 -2
- package/README.md +99 -7
- package/dist/cjs/index.js +6117 -0
- package/dist/cjs/react-client.js +10003 -0
- package/dist/cjs/react-m.js +1852 -0
- package/dist/es/framer-motion/dist/es/animation/GroupPlaybackControls.mjs +78 -0
- package/dist/es/framer-motion/dist/es/animation/animate/index.mjs +34 -0
- package/dist/es/framer-motion/dist/es/animation/animate/resolve-subjects.mjs +19 -0
- package/dist/es/framer-motion/dist/es/animation/animate/sequence.mjs +14 -0
- package/dist/es/framer-motion/dist/es/animation/animate/single-value.mjs +11 -0
- package/dist/es/framer-motion/dist/es/animation/animate/subject.mjs +52 -0
- package/dist/es/framer-motion/dist/es/animation/animators/AcceleratedAnimation.mjs +318 -0
- package/dist/es/framer-motion/dist/es/animation/animators/BaseAnimation.mjs +113 -0
- package/dist/es/framer-motion/dist/es/animation/animators/MainThreadAnimation.mjs +384 -0
- package/dist/es/framer-motion/dist/es/animation/animators/drivers/driver-frameloop.mjs +17 -0
- package/dist/es/framer-motion/dist/es/animation/animators/utils/accelerated-values.mjs +14 -0
- package/dist/es/framer-motion/dist/es/animation/animators/utils/can-animate.mjs +42 -0
- package/dist/es/framer-motion/dist/es/animation/animators/waapi/NativeAnimation.mjs +169 -0
- package/dist/es/framer-motion/dist/es/animation/animators/waapi/animate-elements.mjs +36 -0
- package/dist/es/framer-motion/dist/es/animation/animators/waapi/animate-style.mjs +12 -0
- package/dist/es/framer-motion/dist/es/animation/animators/waapi/easing.mjs +44 -0
- package/dist/es/framer-motion/dist/es/animation/animators/waapi/index.mjs +23 -0
- package/dist/es/framer-motion/dist/es/animation/animators/waapi/utils/attach-timeline.mjs +6 -0
- package/dist/es/framer-motion/dist/es/animation/animators/waapi/utils/get-final-keyframe.mjs +12 -0
- package/dist/es/framer-motion/dist/es/animation/animators/waapi/utils/linear.mjs +15 -0
- package/dist/es/framer-motion/dist/es/animation/animators/waapi/utils/memo-supports.mjs +9 -0
- package/dist/es/framer-motion/dist/es/animation/animators/waapi/utils/style.mjs +8 -0
- package/dist/es/framer-motion/dist/es/animation/animators/waapi/utils/supports-flags.mjs +9 -0
- package/dist/es/framer-motion/dist/es/animation/animators/waapi/utils/supports-linear-easing.mjs +15 -0
- package/dist/es/framer-motion/dist/es/animation/animators/waapi/utils/supports-partial-keyframes.mjs +13 -0
- package/dist/es/framer-motion/dist/es/animation/animators/waapi/utils/supports-waapi.mjs +5 -0
- package/dist/es/framer-motion/dist/es/animation/generators/inertia.mjs +87 -0
- package/dist/es/framer-motion/dist/es/animation/generators/keyframes.mjs +51 -0
- package/dist/es/framer-motion/dist/es/animation/generators/spring/find.mjs +89 -0
- package/dist/es/framer-motion/dist/es/animation/generators/spring/index.mjs +129 -0
- package/dist/es/framer-motion/dist/es/animation/generators/utils/calc-duration.mjs +17 -0
- package/dist/es/framer-motion/dist/es/animation/generators/utils/is-generator.mjs +5 -0
- package/dist/es/framer-motion/dist/es/animation/generators/utils/velocity.mjs +9 -0
- package/dist/es/framer-motion/dist/es/animation/hooks/animation-controls.mjs +80 -0
- package/dist/es/framer-motion/dist/es/animation/hooks/use-animate-style.mjs +17 -0
- package/dist/es/framer-motion/dist/es/animation/hooks/use-animate.mjs +17 -0
- package/dist/es/framer-motion/dist/es/animation/hooks/use-animated-state.mjs +64 -0
- package/dist/es/framer-motion/dist/es/animation/hooks/use-animation.mjs +41 -0
- package/dist/es/framer-motion/dist/es/animation/interfaces/motion-value.mjs +113 -0
- package/dist/es/framer-motion/dist/es/animation/interfaces/visual-element-target.mjs +75 -0
- package/dist/es/framer-motion/dist/es/animation/interfaces/visual-element-variant.mjs +66 -0
- package/dist/es/framer-motion/dist/es/animation/interfaces/visual-element.mjs +26 -0
- package/dist/es/framer-motion/dist/es/animation/optimized-appear/data-id.mjs +6 -0
- package/dist/es/framer-motion/dist/es/animation/optimized-appear/get-appear-id.mjs +7 -0
- package/dist/es/framer-motion/dist/es/animation/optimized-appear/handoff.mjs +40 -0
- package/dist/es/framer-motion/dist/es/animation/optimized-appear/start.mjs +173 -0
- package/dist/es/framer-motion/dist/es/animation/optimized-appear/store-id.mjs +8 -0
- package/dist/es/framer-motion/dist/es/animation/optimized-appear/store.mjs +4 -0
- package/dist/es/framer-motion/dist/es/animation/sequence/create.mjs +230 -0
- package/dist/es/framer-motion/dist/es/animation/sequence/utils/calc-time.mjs +21 -0
- package/dist/es/framer-motion/dist/es/animation/sequence/utils/edit.mjs +31 -0
- package/dist/es/framer-motion/dist/es/animation/sequence/utils/sort.mjs +14 -0
- package/dist/es/framer-motion/dist/es/animation/utils/create-visual-element.mjs +44 -0
- package/dist/es/framer-motion/dist/es/animation/utils/default-transitions.mjs +40 -0
- package/dist/es/framer-motion/dist/es/animation/utils/get-value-transition.mjs +9 -0
- package/dist/es/framer-motion/dist/es/animation/utils/is-animatable.mjs +30 -0
- package/dist/es/framer-motion/dist/es/animation/utils/is-animation-controls.mjs +7 -0
- package/dist/es/framer-motion/dist/es/animation/utils/is-dom-keyframes.mjs +5 -0
- package/dist/es/framer-motion/dist/es/animation/utils/is-keyframes-target.mjs +5 -0
- package/dist/es/framer-motion/dist/es/animation/utils/is-none.mjs +15 -0
- package/dist/es/framer-motion/dist/es/animation/utils/is-transition-defined.mjs +10 -0
- package/dist/es/framer-motion/dist/es/animation/utils/stagger.mjs +26 -0
- package/dist/es/framer-motion/dist/es/components/AnimatePresence/PopChild.mjs +77 -0
- package/dist/es/framer-motion/dist/es/components/AnimatePresence/PresenceChild.mjs +61 -0
- package/dist/es/framer-motion/dist/es/components/AnimatePresence/index.mjs +163 -0
- package/dist/es/framer-motion/dist/es/components/AnimatePresence/use-presence.mjs +66 -0
- package/dist/es/framer-motion/dist/es/components/AnimatePresence/utils.mjs +14 -0
- package/dist/es/framer-motion/dist/es/components/AnimateSharedLayout.mjs +15 -0
- package/dist/es/framer-motion/dist/es/components/LayoutGroup/index.mjs +32 -0
- package/dist/es/framer-motion/dist/es/components/LazyMotion/index.mjs +68 -0
- package/dist/es/framer-motion/dist/es/components/MotionConfig/index.mjs +48 -0
- package/dist/es/framer-motion/dist/es/components/Reorder/Group.mjs +53 -0
- package/dist/es/framer-motion/dist/es/components/Reorder/Item.mjs +34 -0
- package/dist/es/framer-motion/dist/es/components/Reorder/namespace.mjs +2 -0
- package/dist/es/framer-motion/dist/es/components/Reorder/utils/check-reorder.mjs +24 -0
- package/dist/es/framer-motion/dist/es/context/DeprecatedLayoutGroupContext.mjs +10 -0
- package/dist/es/framer-motion/dist/es/context/LayoutGroupContext.mjs +6 -0
- package/dist/es/framer-motion/dist/es/context/LazyContext.mjs +6 -0
- package/dist/es/framer-motion/dist/es/context/MotionConfigContext.mjs +13 -0
- package/dist/es/framer-motion/dist/es/context/MotionContext/create.mjs +13 -0
- package/dist/es/framer-motion/dist/es/context/MotionContext/index.mjs +6 -0
- package/dist/es/framer-motion/dist/es/context/MotionContext/utils.mjs +17 -0
- package/dist/es/framer-motion/dist/es/context/PresenceContext.mjs +9 -0
- package/dist/es/framer-motion/dist/es/context/ReorderContext.mjs +6 -0
- package/dist/es/framer-motion/dist/es/context/SwitchLayoutGroupContext.mjs +9 -0
- package/dist/es/framer-motion/dist/es/easing/anticipate.mjs +5 -0
- package/dist/es/framer-motion/dist/es/easing/back.mjs +9 -0
- package/dist/es/framer-motion/dist/es/easing/circ.mjs +8 -0
- package/dist/es/framer-motion/dist/es/easing/cubic-bezier.mjs +51 -0
- package/dist/es/framer-motion/dist/es/easing/ease.mjs +7 -0
- package/dist/es/framer-motion/dist/es/easing/modifiers/mirror.mjs +5 -0
- package/dist/es/framer-motion/dist/es/easing/modifiers/reverse.mjs +5 -0
- package/dist/es/framer-motion/dist/es/easing/steps.mjs +15 -0
- package/dist/es/framer-motion/dist/es/easing/utils/create-generator-easing.mjs +17 -0
- package/dist/es/framer-motion/dist/es/easing/utils/get-easing-for-segment.mjs +8 -0
- package/dist/es/framer-motion/dist/es/easing/utils/is-bezier-definition.mjs +3 -0
- package/dist/es/framer-motion/dist/es/easing/utils/is-easing-array.mjs +5 -0
- package/dist/es/framer-motion/dist/es/easing/utils/map.mjs +38 -0
- package/dist/es/framer-motion/dist/es/events/add-dom-event.mjs +6 -0
- package/dist/es/framer-motion/dist/es/events/add-pointer-event.mjs +8 -0
- package/dist/es/framer-motion/dist/es/events/event-info.mjs +15 -0
- package/dist/es/framer-motion/dist/es/events/use-dom-event.mjs +34 -0
- package/dist/es/framer-motion/dist/es/events/utils/is-primary-pointer.mjs +18 -0
- package/dist/es/framer-motion/dist/es/frameloop/batcher.mjs +74 -0
- package/dist/es/framer-motion/dist/es/frameloop/frame.mjs +6 -0
- package/dist/es/framer-motion/dist/es/frameloop/index-legacy.mjs +20 -0
- package/dist/es/framer-motion/dist/es/frameloop/microtask.mjs +5 -0
- package/dist/es/framer-motion/dist/es/frameloop/render-step.mjs +80 -0
- package/dist/es/framer-motion/dist/es/frameloop/sync-time.mjs +31 -0
- package/dist/es/framer-motion/dist/es/gestures/drag/VisualElementDragControls.mjs +487 -0
- package/dist/es/framer-motion/dist/es/gestures/drag/index.mjs +27 -0
- package/dist/es/framer-motion/dist/es/gestures/drag/use-drag-controls.mjs +88 -0
- package/dist/es/framer-motion/dist/es/gestures/drag/utils/constraints.mjs +129 -0
- package/dist/es/framer-motion/dist/es/gestures/drag/utils/lock.mjs +53 -0
- package/dist/es/framer-motion/dist/es/gestures/focus.mjs +41 -0
- package/dist/es/framer-motion/dist/es/gestures/hover.mjs +33 -0
- package/dist/es/framer-motion/dist/es/gestures/pan/PanSession.mjs +156 -0
- package/dist/es/framer-motion/dist/es/gestures/pan/index.mjs +50 -0
- package/dist/es/framer-motion/dist/es/gestures/press.mjs +130 -0
- package/dist/es/framer-motion/dist/es/gestures/utils/is-node-or-child.mjs +20 -0
- package/dist/es/framer-motion/dist/es/motion/features/Feature.mjs +9 -0
- package/dist/es/framer-motion/dist/es/motion/features/animation/exit.mjs +31 -0
- package/dist/es/framer-motion/dist/es/motion/features/animation/index.mjs +41 -0
- package/dist/es/framer-motion/dist/es/motion/features/animations.mjs +13 -0
- package/dist/es/framer-motion/dist/es/motion/features/definitions.mjs +28 -0
- package/dist/es/framer-motion/dist/es/motion/features/drag.mjs +17 -0
- package/dist/es/framer-motion/dist/es/motion/features/gestures.mjs +21 -0
- package/dist/es/framer-motion/dist/es/motion/features/layout/MeasureLayout.mjs +134 -0
- package/dist/es/framer-motion/dist/es/motion/features/layout.mjs +11 -0
- package/dist/es/framer-motion/dist/es/motion/features/load-features.mjs +12 -0
- package/dist/es/framer-motion/dist/es/motion/features/viewport/index.mjs +72 -0
- package/dist/es/framer-motion/dist/es/motion/features/viewport/observers.mjs +49 -0
- package/dist/es/framer-motion/dist/es/motion/index.mjs +98 -0
- package/dist/es/framer-motion/dist/es/motion/utils/is-forced-motion-value.mjs +11 -0
- package/dist/es/framer-motion/dist/es/motion/utils/is-motion-component.mjs +12 -0
- package/dist/es/framer-motion/dist/es/motion/utils/symbol.mjs +3 -0
- package/dist/es/framer-motion/dist/es/motion/utils/unwrap-motion-component.mjs +17 -0
- package/dist/es/framer-motion/dist/es/motion/utils/use-motion-ref.mjs +36 -0
- package/dist/es/framer-motion/dist/es/motion/utils/use-visual-element.mjs +134 -0
- package/dist/es/framer-motion/dist/es/motion/utils/use-visual-state.mjs +82 -0
- package/dist/es/framer-motion/dist/es/motion/utils/valid-prop.mjs +57 -0
- package/dist/es/framer-motion/dist/es/projection/animation/mix-values.mjs +93 -0
- package/dist/es/framer-motion/dist/es/projection/geometry/conversion.mjs +33 -0
- package/dist/es/framer-motion/dist/es/projection/geometry/copy.mjs +31 -0
- package/dist/es/framer-motion/dist/es/projection/geometry/delta-apply.mjs +119 -0
- package/dist/es/framer-motion/dist/es/projection/geometry/delta-calc.mjs +52 -0
- package/dist/es/framer-motion/dist/es/projection/geometry/delta-remove.mjs +54 -0
- package/dist/es/framer-motion/dist/es/projection/geometry/models.mjs +17 -0
- package/dist/es/framer-motion/dist/es/projection/geometry/utils.mjs +31 -0
- package/dist/es/framer-motion/dist/es/projection/node/DocumentProjectionNode.mjs +13 -0
- package/dist/es/framer-motion/dist/es/projection/node/HTMLProjectionNode.mjs +27 -0
- package/dist/es/framer-motion/dist/es/projection/node/create-projection-node.mjs +1583 -0
- package/dist/es/framer-motion/dist/es/projection/node/group.mjs +24 -0
- package/dist/es/framer-motion/dist/es/projection/node/state.mjs +19 -0
- package/dist/es/framer-motion/dist/es/projection/shared/stack.mjs +112 -0
- package/dist/es/framer-motion/dist/es/projection/styles/scale-border-radius.mjs +41 -0
- package/dist/es/framer-motion/dist/es/projection/styles/scale-box-shadow.mjs +35 -0
- package/dist/es/framer-motion/dist/es/projection/styles/scale-correction.mjs +6 -0
- package/dist/es/framer-motion/dist/es/projection/styles/transform.mjs +49 -0
- package/dist/es/framer-motion/dist/es/projection/use-instant-layout-transition.mjs +14 -0
- package/dist/es/framer-motion/dist/es/projection/use-reset-projection.mjs +14 -0
- package/dist/es/framer-motion/dist/es/projection/utils/each-axis.mjs +5 -0
- package/dist/es/framer-motion/dist/es/projection/utils/has-transform.mjs +26 -0
- package/dist/es/framer-motion/dist/es/projection/utils/measure.mjs +17 -0
- package/dist/es/framer-motion/dist/es/render/VisualElement.mjs +477 -0
- package/dist/es/framer-motion/dist/es/render/components/create-factory.mjs +23 -0
- package/dist/es/framer-motion/dist/es/render/components/create-proxy.mjs +38 -0
- package/dist/es/framer-motion/dist/es/render/components/m/create.mjs +6 -0
- package/dist/es/framer-motion/dist/es/render/components/m/elements.mjs +227 -0
- package/dist/es/framer-motion/dist/es/render/components/m/proxy.mjs +6 -0
- package/dist/es/framer-motion/dist/es/render/components/motion/create.mjs +15 -0
- package/dist/es/framer-motion/dist/es/render/components/motion/elements.mjs +194 -0
- package/dist/es/framer-motion/dist/es/render/components/motion/proxy.mjs +6 -0
- package/dist/es/framer-motion/dist/es/render/dom/DOMKeyframesResolver.mjs +130 -0
- package/dist/es/framer-motion/dist/es/render/dom/DOMVisualElement.mjs +28 -0
- package/dist/es/framer-motion/dist/es/render/dom/create-visual-element.mjs +14 -0
- package/dist/es/framer-motion/dist/es/render/dom/features-animation.mjs +14 -0
- package/dist/es/framer-motion/dist/es/render/dom/features-max.mjs +14 -0
- package/dist/es/framer-motion/dist/es/render/dom/features-min.mjs +12 -0
- package/dist/es/framer-motion/dist/es/render/dom/resize/handle-element.mjs +64 -0
- package/dist/es/framer-motion/dist/es/render/dom/resize/handle-window.mjs +30 -0
- package/dist/es/framer-motion/dist/es/render/dom/resize/index.mjs +8 -0
- package/dist/es/framer-motion/dist/es/render/dom/scroll/index.mjs +80 -0
- package/dist/es/framer-motion/dist/es/render/dom/scroll/info.mjs +56 -0
- package/dist/es/framer-motion/dist/es/render/dom/scroll/observe.mjs +18 -0
- package/dist/es/framer-motion/dist/es/render/dom/scroll/offsets/edge.mjs +45 -0
- package/dist/es/framer-motion/dist/es/render/dom/scroll/offsets/index.mjs +59 -0
- package/dist/es/framer-motion/dist/es/render/dom/scroll/offsets/inset.mjs +45 -0
- package/dist/es/framer-motion/dist/es/render/dom/scroll/offsets/offset.mjs +35 -0
- package/dist/es/framer-motion/dist/es/render/dom/scroll/offsets/presets.mjs +20 -0
- package/dist/es/framer-motion/dist/es/render/dom/scroll/on-scroll-handler.mjs +48 -0
- package/dist/es/framer-motion/dist/es/render/dom/scroll/supports.mjs +5 -0
- package/dist/es/framer-motion/dist/es/render/dom/scroll/track.mjs +84 -0
- package/dist/es/framer-motion/dist/es/render/dom/use-render.mjs +33 -0
- package/dist/es/framer-motion/dist/es/render/dom/utils/camel-to-dash.mjs +6 -0
- package/dist/es/framer-motion/dist/es/render/dom/utils/css-variables-conversion.mjs +42 -0
- package/dist/es/framer-motion/dist/es/render/dom/utils/filter-props.mjs +59 -0
- package/dist/es/framer-motion/dist/es/render/dom/utils/is-css-variable.mjs +15 -0
- package/dist/es/framer-motion/dist/es/render/dom/utils/is-svg-component.mjs +30 -0
- package/dist/es/framer-motion/dist/es/render/dom/utils/is-svg-element.mjs +5 -0
- package/dist/es/framer-motion/dist/es/render/dom/utils/resolve-element.mjs +28 -0
- package/dist/es/framer-motion/dist/es/render/dom/utils/unit-conversion.mjs +65 -0
- package/dist/es/framer-motion/dist/es/render/dom/value-types/animatable-none.mjs +15 -0
- package/dist/es/framer-motion/dist/es/render/dom/value-types/defaults.mjs +30 -0
- package/dist/es/framer-motion/dist/es/render/dom/value-types/dimensions.mjs +15 -0
- package/dist/es/framer-motion/dist/es/render/dom/value-types/find.mjs +15 -0
- package/dist/es/framer-motion/dist/es/render/dom/value-types/get-as-type.mjs +10 -0
- package/dist/es/framer-motion/dist/es/render/dom/value-types/number-browser.mjs +41 -0
- package/dist/es/framer-motion/dist/es/render/dom/value-types/number.mjs +18 -0
- package/dist/es/framer-motion/dist/es/render/dom/value-types/test.mjs +6 -0
- package/dist/es/framer-motion/dist/es/render/dom/value-types/transform.mjs +31 -0
- package/dist/es/framer-motion/dist/es/render/dom/value-types/type-auto.mjs +9 -0
- package/dist/es/framer-motion/dist/es/render/dom/value-types/type-int.mjs +8 -0
- package/dist/es/framer-motion/dist/es/render/dom/viewport/index.mjs +43 -0
- package/dist/es/framer-motion/dist/es/render/html/HTMLVisualElement.mjs +57 -0
- package/dist/es/framer-motion/dist/es/render/html/config-motion.mjs +12 -0
- package/dist/es/framer-motion/dist/es/render/html/use-props.mjs +57 -0
- package/dist/es/framer-motion/dist/es/render/html/utils/build-styles.mjs +65 -0
- package/dist/es/framer-motion/dist/es/render/html/utils/build-transform.mjs +62 -0
- package/dist/es/framer-motion/dist/es/render/html/utils/create-render-state.mjs +8 -0
- package/dist/es/framer-motion/dist/es/render/html/utils/make-none-animatable.mjs +30 -0
- package/dist/es/framer-motion/dist/es/render/html/utils/render.mjs +9 -0
- package/dist/es/framer-motion/dist/es/render/html/utils/scrape-motion-values.mjs +20 -0
- package/dist/es/framer-motion/dist/es/render/html/utils/transform.mjs +28 -0
- package/dist/es/framer-motion/dist/es/render/object/ObjectVisualElement.mjs +41 -0
- package/dist/es/framer-motion/dist/es/render/store.mjs +3 -0
- package/dist/es/framer-motion/dist/es/render/svg/SVGVisualElement.mjs +45 -0
- package/dist/es/framer-motion/dist/es/render/svg/config-motion.mjs +40 -0
- package/dist/es/framer-motion/dist/es/render/svg/lowercase-elements.mjs +33 -0
- package/dist/es/framer-motion/dist/es/render/svg/use-props.mjs +24 -0
- package/dist/es/framer-motion/dist/es/render/svg/utils/build-attrs.mjs +52 -0
- package/dist/es/framer-motion/dist/es/render/svg/utils/camel-case-attrs.mjs +30 -0
- package/dist/es/framer-motion/dist/es/render/svg/utils/create-render-state.mjs +8 -0
- package/dist/es/framer-motion/dist/es/render/svg/utils/is-svg-tag.mjs +3 -0
- package/dist/es/framer-motion/dist/es/render/svg/utils/path.mjs +32 -0
- package/dist/es/framer-motion/dist/es/render/svg/utils/render.mjs +12 -0
- package/dist/es/framer-motion/dist/es/render/svg/utils/scrape-motion-values.mjs +19 -0
- package/dist/es/framer-motion/dist/es/render/svg/utils/transform-origin.mjs +18 -0
- package/dist/es/framer-motion/dist/es/render/utils/KeyframesResolver.mjs +164 -0
- package/dist/es/framer-motion/dist/es/render/utils/animation-state.mjs +332 -0
- package/dist/es/framer-motion/dist/es/render/utils/compare-by-depth.mjs +3 -0
- package/dist/es/framer-motion/dist/es/render/utils/flat-tree.mjs +24 -0
- package/dist/es/framer-motion/dist/es/render/utils/get-variant-context.mjs +28 -0
- package/dist/es/framer-motion/dist/es/render/utils/is-controlling-variants.mjs +13 -0
- package/dist/es/framer-motion/dist/es/render/utils/is-variant-label.mjs +8 -0
- package/dist/es/framer-motion/dist/es/render/utils/motion-values.mjs +59 -0
- package/dist/es/framer-motion/dist/es/render/utils/resolve-dynamic-variants.mjs +8 -0
- package/dist/es/framer-motion/dist/es/render/utils/resolve-variants.mjs +36 -0
- package/dist/es/framer-motion/dist/es/render/utils/setters.mjs +27 -0
- package/dist/es/framer-motion/dist/es/render/utils/variant-props.mjs +12 -0
- package/dist/es/framer-motion/dist/es/utils/GlobalConfig.mjs +6 -0
- package/dist/es/framer-motion/dist/es/utils/array.mjs +21 -0
- package/dist/es/framer-motion/dist/es/utils/clamp.mjs +9 -0
- package/dist/es/framer-motion/dist/es/utils/delay.mjs +24 -0
- package/dist/es/framer-motion/dist/es/utils/distance.mjs +9 -0
- package/dist/es/framer-motion/dist/es/utils/errors.mjs +18 -0
- package/dist/es/framer-motion/dist/es/utils/get-context-window.mjs +6 -0
- package/dist/es/framer-motion/dist/es/utils/hsla-to-rgba.mjs +42 -0
- package/dist/es/framer-motion/dist/es/utils/interpolate.mjs +75 -0
- package/dist/es/framer-motion/dist/es/utils/is-browser.mjs +3 -0
- package/dist/es/framer-motion/dist/es/utils/is-numerical-string.mjs +6 -0
- package/dist/es/framer-motion/dist/es/utils/is-ref-object.mjs +7 -0
- package/dist/es/framer-motion/dist/es/utils/is-zero-value-string.mjs +6 -0
- package/dist/es/framer-motion/dist/es/utils/memo.mjs +10 -0
- package/dist/es/framer-motion/dist/es/utils/mix/color.mjs +47 -0
- package/dist/es/framer-motion/dist/es/utils/mix/complex.mjs +94 -0
- package/dist/es/framer-motion/dist/es/utils/mix/immediate.mjs +5 -0
- package/dist/es/framer-motion/dist/es/utils/mix/index.mjs +14 -0
- package/dist/es/framer-motion/dist/es/utils/mix/number.mjs +26 -0
- package/dist/es/framer-motion/dist/es/utils/mix/visibility.mjs +16 -0
- package/dist/es/framer-motion/dist/es/utils/noop.mjs +3 -0
- package/dist/es/framer-motion/dist/es/utils/offsets/default.mjs +9 -0
- package/dist/es/framer-motion/dist/es/utils/offsets/fill.mjs +12 -0
- package/dist/es/framer-motion/dist/es/utils/offsets/time.mjs +5 -0
- package/dist/es/framer-motion/dist/es/utils/pipe.mjs +11 -0
- package/dist/es/framer-motion/dist/es/utils/progress.mjs +18 -0
- package/dist/es/framer-motion/dist/es/utils/reduced-motion/index.mjs +19 -0
- package/dist/es/framer-motion/dist/es/utils/reduced-motion/state.mjs +5 -0
- package/dist/es/framer-motion/dist/es/utils/reduced-motion/use-reduced-motion-config.mjs +19 -0
- package/dist/es/framer-motion/dist/es/utils/reduced-motion/use-reduced-motion.mjs +47 -0
- package/dist/es/framer-motion/dist/es/utils/resolve-value.mjs +11 -0
- package/dist/es/framer-motion/dist/es/utils/shallow-compare.mjs +14 -0
- package/dist/es/framer-motion/dist/es/utils/subscription-manager.mjs +40 -0
- package/dist/es/framer-motion/dist/es/utils/time-conversion.mjs +10 -0
- package/dist/es/framer-motion/dist/es/utils/transform.mjs +21 -0
- package/dist/es/framer-motion/dist/es/utils/use-animation-frame.mjs +21 -0
- package/dist/es/framer-motion/dist/es/utils/use-constant.mjs +18 -0
- package/dist/es/framer-motion/dist/es/utils/use-cycle.mjs +47 -0
- package/dist/es/framer-motion/dist/es/utils/use-force-update.mjs +19 -0
- package/dist/es/framer-motion/dist/es/utils/use-in-view.mjs +23 -0
- package/dist/es/framer-motion/dist/es/utils/use-instant-transition-state.mjs +5 -0
- package/dist/es/framer-motion/dist/es/utils/use-instant-transition.mjs +41 -0
- package/dist/es/framer-motion/dist/es/utils/use-is-mounted.mjs +15 -0
- package/dist/es/framer-motion/dist/es/utils/use-isomorphic-effect.mjs +6 -0
- package/dist/es/framer-motion/dist/es/utils/use-motion-value-event.mjs +13 -0
- package/dist/es/framer-motion/dist/es/utils/use-unmount-effect.mjs +7 -0
- package/dist/es/framer-motion/dist/es/utils/velocity-per-second.mjs +11 -0
- package/dist/es/framer-motion/dist/es/utils/warn-once.mjs +11 -0
- package/dist/es/framer-motion/dist/es/utils/wrap.mjs +6 -0
- package/dist/es/framer-motion/dist/es/value/index.mjs +319 -0
- package/dist/es/framer-motion/dist/es/value/scroll/use-element-scroll.mjs +14 -0
- package/dist/es/framer-motion/dist/es/value/scroll/use-viewport-scroll.mjs +14 -0
- package/dist/es/framer-motion/dist/es/value/types/color/hex.mjs +40 -0
- package/dist/es/framer-motion/dist/es/value/types/color/hsla.mjs +22 -0
- package/dist/es/framer-motion/dist/es/value/types/color/index.mjs +27 -0
- package/dist/es/framer-motion/dist/es/value/types/color/rgba.mjs +25 -0
- package/dist/es/framer-motion/dist/es/value/types/color/utils.mjs +29 -0
- package/dist/es/framer-motion/dist/es/value/types/complex/filter.mjs +30 -0
- package/dist/es/framer-motion/dist/es/value/types/complex/index.mjs +92 -0
- package/dist/es/framer-motion/dist/es/value/types/numbers/index.mjs +17 -0
- package/dist/es/framer-motion/dist/es/value/types/numbers/units.mjs +17 -0
- package/dist/es/framer-motion/dist/es/value/types/utils/color-regex.mjs +3 -0
- package/dist/es/framer-motion/dist/es/value/types/utils/float-regex.mjs +3 -0
- package/dist/es/framer-motion/dist/es/value/types/utils/is-nullish.mjs +5 -0
- package/dist/es/framer-motion/dist/es/value/types/utils/sanitize.mjs +5 -0
- package/dist/es/framer-motion/dist/es/value/types/utils/single-color-regex.mjs +3 -0
- package/dist/es/framer-motion/dist/es/value/use-combine-values.mjs +37 -0
- package/dist/es/framer-motion/dist/es/value/use-computed.mjs +19 -0
- package/dist/es/framer-motion/dist/es/value/use-inverted-scale.mjs +52 -0
- package/dist/es/framer-motion/dist/es/value/use-motion-template.mjs +45 -0
- package/dist/es/framer-motion/dist/es/value/use-motion-value.mjs +38 -0
- package/dist/es/framer-motion/dist/es/value/use-scroll.mjs +39 -0
- package/dist/es/framer-motion/dist/es/value/use-spring.mjs +85 -0
- package/dist/es/framer-motion/dist/es/value/use-time.mjs +10 -0
- package/dist/es/framer-motion/dist/es/value/use-transform.mjs +29 -0
- package/dist/es/framer-motion/dist/es/value/use-velocity.mjs +35 -0
- package/dist/es/framer-motion/dist/es/value/use-will-change/WillChangeMotionValue.mjs +22 -0
- package/dist/es/framer-motion/dist/es/value/use-will-change/add-will-change.mjs +14 -0
- package/dist/es/framer-motion/dist/es/value/use-will-change/get-will-change-name.mjs +14 -0
- package/dist/es/framer-motion/dist/es/value/use-will-change/index.mjs +8 -0
- package/dist/es/framer-motion/dist/es/value/use-will-change/is.mjs +7 -0
- package/dist/es/framer-motion/dist/es/value/utils/is-motion-value.mjs +3 -0
- package/dist/es/framer-motion/dist/es/value/utils/resolve-motion-value.mjs +16 -0
- package/dist/es/motion/lib/index.mjs +30 -0
- package/dist/es/motion/lib/react-client.mjs +3 -0
- package/dist/es/motion/lib/react-m.mjs +3 -0
- package/dist/es/motion/lib/react.mjs +110 -0
- package/dist/index.d.ts +1 -0
- package/dist/motion.dev.js +6121 -0
- package/dist/motion.js +1 -0
- package/dist/react-client.d.ts +1 -0
- package/dist/react-m.d.ts +1 -0
- package/dist/react.d.ts +1 -0
- package/lib/index.js +1 -3
- package/lib/index.js.map +1 -1
- package/lib/react-client.js +3 -0
- package/lib/react-client.js.map +1 -0
- package/lib/react-m.js +3 -0
- package/lib/react-m.js.map +1 -0
- package/lib/react.js +3 -0
- package/lib/react.js.map +1 -0
- package/package.json +79 -29
- package/react/package.json +6 -0
- package/react-client/package.json +6 -0
- package/react-m/package.json +6 -0
- package/rollup.config.mjs +184 -0
- package/src/index.ts +1 -0
- package/src/react-client.ts +3 -0
- package/src/react-m.ts +3 -0
- package/src/react.ts +3 -0
- package/tsconfig.json +25 -0
- package/types/index.d.ts +1 -4
- package/types/react-client.d.ts +1 -0
- package/types/react-m.d.ts +1 -0
- package/types/react.d.ts +1 -0
- package/CHANGELOG.md +0 -378
- package/dist/animate.cjs.js +0 -22
- package/dist/animate.es.js +0 -19
- package/dist/main.cjs.js +0 -21
- package/dist/main.es.js +0 -3
- package/dist/motion.min.js +0 -1
- package/dist/motion.umd.js +0 -2364
- package/dist/size-index.js +0 -1
- package/lib/animate.js +0 -17
- package/lib/animate.js.map +0 -1
- package/types/animate.d.ts +0 -6
- package/types/animate.d.ts.map +0 -1
- package/types/index.d.ts.map +0 -1
|
@@ -0,0 +1,1852 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
6
|
+
var react = require('react');
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* @public
|
|
10
|
+
*/
|
|
11
|
+
const MotionConfigContext = react.createContext({
|
|
12
|
+
transformPagePoint: (p) => p,
|
|
13
|
+
isStatic: false,
|
|
14
|
+
reducedMotion: "never",
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
const MotionContext = react.createContext({});
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* @public
|
|
21
|
+
*/
|
|
22
|
+
const PresenceContext = react.createContext(null);
|
|
23
|
+
|
|
24
|
+
const isBrowser = typeof window !== "undefined";
|
|
25
|
+
|
|
26
|
+
const useIsomorphicLayoutEffect = isBrowser ? react.useLayoutEffect : react.useEffect;
|
|
27
|
+
|
|
28
|
+
const LazyContext = react.createContext({ strict: false });
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Convert camelCase to dash-case properties.
|
|
32
|
+
*/
|
|
33
|
+
const camelToDash = (str) => str.replace(/([a-z])([A-Z])/gu, "$1-$2").toLowerCase();
|
|
34
|
+
|
|
35
|
+
const optimizedAppearDataId = "framerAppearId";
|
|
36
|
+
const optimizedAppearDataAttribute = "data-" + camelToDash(optimizedAppearDataId);
|
|
37
|
+
|
|
38
|
+
function createRenderStep(runNextFrame) {
|
|
39
|
+
/**
|
|
40
|
+
* We create and reuse two queues, one to queue jobs for the current frame
|
|
41
|
+
* and one for the next. We reuse to avoid triggering GC after x frames.
|
|
42
|
+
*/
|
|
43
|
+
let thisFrame = new Set();
|
|
44
|
+
let nextFrame = new Set();
|
|
45
|
+
/**
|
|
46
|
+
* Track whether we're currently processing jobs in this step. This way
|
|
47
|
+
* we can decide whether to schedule new jobs for this frame or next.
|
|
48
|
+
*/
|
|
49
|
+
let isProcessing = false;
|
|
50
|
+
let flushNextFrame = false;
|
|
51
|
+
/**
|
|
52
|
+
* A set of processes which were marked keepAlive when scheduled.
|
|
53
|
+
*/
|
|
54
|
+
const toKeepAlive = new WeakSet();
|
|
55
|
+
let latestFrameData = {
|
|
56
|
+
delta: 0.0,
|
|
57
|
+
timestamp: 0.0,
|
|
58
|
+
isProcessing: false,
|
|
59
|
+
};
|
|
60
|
+
function triggerCallback(callback) {
|
|
61
|
+
if (toKeepAlive.has(callback)) {
|
|
62
|
+
step.schedule(callback);
|
|
63
|
+
runNextFrame();
|
|
64
|
+
}
|
|
65
|
+
callback(latestFrameData);
|
|
66
|
+
}
|
|
67
|
+
const step = {
|
|
68
|
+
/**
|
|
69
|
+
* Schedule a process to run on the next frame.
|
|
70
|
+
*/
|
|
71
|
+
schedule: (callback, keepAlive = false, immediate = false) => {
|
|
72
|
+
const addToCurrentFrame = immediate && isProcessing;
|
|
73
|
+
const queue = addToCurrentFrame ? thisFrame : nextFrame;
|
|
74
|
+
if (keepAlive)
|
|
75
|
+
toKeepAlive.add(callback);
|
|
76
|
+
if (!queue.has(callback))
|
|
77
|
+
queue.add(callback);
|
|
78
|
+
return callback;
|
|
79
|
+
},
|
|
80
|
+
/**
|
|
81
|
+
* Cancel the provided callback from running on the next frame.
|
|
82
|
+
*/
|
|
83
|
+
cancel: (callback) => {
|
|
84
|
+
nextFrame.delete(callback);
|
|
85
|
+
toKeepAlive.delete(callback);
|
|
86
|
+
},
|
|
87
|
+
/**
|
|
88
|
+
* Execute all schedule callbacks.
|
|
89
|
+
*/
|
|
90
|
+
process: (frameData) => {
|
|
91
|
+
latestFrameData = frameData;
|
|
92
|
+
/**
|
|
93
|
+
* If we're already processing we've probably been triggered by a flushSync
|
|
94
|
+
* inside an existing process. Instead of executing, mark flushNextFrame
|
|
95
|
+
* as true and ensure we flush the following frame at the end of this one.
|
|
96
|
+
*/
|
|
97
|
+
if (isProcessing) {
|
|
98
|
+
flushNextFrame = true;
|
|
99
|
+
return;
|
|
100
|
+
}
|
|
101
|
+
isProcessing = true;
|
|
102
|
+
[thisFrame, nextFrame] = [nextFrame, thisFrame];
|
|
103
|
+
// Clear the next frame queue
|
|
104
|
+
nextFrame.clear();
|
|
105
|
+
// Execute this frame
|
|
106
|
+
thisFrame.forEach(triggerCallback);
|
|
107
|
+
isProcessing = false;
|
|
108
|
+
if (flushNextFrame) {
|
|
109
|
+
flushNextFrame = false;
|
|
110
|
+
step.process(frameData);
|
|
111
|
+
}
|
|
112
|
+
},
|
|
113
|
+
};
|
|
114
|
+
return step;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
const stepsOrder = [
|
|
118
|
+
"read", // Read
|
|
119
|
+
"resolveKeyframes", // Write/Read/Write/Read
|
|
120
|
+
"update", // Compute
|
|
121
|
+
"preRender", // Compute
|
|
122
|
+
"render", // Write
|
|
123
|
+
"postRender", // Compute
|
|
124
|
+
];
|
|
125
|
+
const maxElapsed = 40;
|
|
126
|
+
function createRenderBatcher(scheduleNextBatch, allowKeepAlive) {
|
|
127
|
+
let runNextFrame = false;
|
|
128
|
+
let useDefaultElapsed = true;
|
|
129
|
+
const state = {
|
|
130
|
+
delta: 0.0,
|
|
131
|
+
timestamp: 0.0,
|
|
132
|
+
isProcessing: false,
|
|
133
|
+
};
|
|
134
|
+
const flagRunNextFrame = () => (runNextFrame = true);
|
|
135
|
+
const steps = stepsOrder.reduce((acc, key) => {
|
|
136
|
+
acc[key] = createRenderStep(flagRunNextFrame);
|
|
137
|
+
return acc;
|
|
138
|
+
}, {});
|
|
139
|
+
const { read, resolveKeyframes, update, preRender, render, postRender } = steps;
|
|
140
|
+
const processBatch = () => {
|
|
141
|
+
const timestamp = performance.now();
|
|
142
|
+
runNextFrame = false;
|
|
143
|
+
state.delta = useDefaultElapsed
|
|
144
|
+
? 1000 / 60
|
|
145
|
+
: Math.max(Math.min(timestamp - state.timestamp, maxElapsed), 1);
|
|
146
|
+
state.timestamp = timestamp;
|
|
147
|
+
state.isProcessing = true;
|
|
148
|
+
// Unrolled render loop for better per-frame performance
|
|
149
|
+
read.process(state);
|
|
150
|
+
resolveKeyframes.process(state);
|
|
151
|
+
update.process(state);
|
|
152
|
+
preRender.process(state);
|
|
153
|
+
render.process(state);
|
|
154
|
+
postRender.process(state);
|
|
155
|
+
state.isProcessing = false;
|
|
156
|
+
if (runNextFrame && allowKeepAlive) {
|
|
157
|
+
useDefaultElapsed = false;
|
|
158
|
+
scheduleNextBatch(processBatch);
|
|
159
|
+
}
|
|
160
|
+
};
|
|
161
|
+
const wake = () => {
|
|
162
|
+
runNextFrame = true;
|
|
163
|
+
useDefaultElapsed = true;
|
|
164
|
+
if (!state.isProcessing) {
|
|
165
|
+
scheduleNextBatch(processBatch);
|
|
166
|
+
}
|
|
167
|
+
};
|
|
168
|
+
const schedule = stepsOrder.reduce((acc, key) => {
|
|
169
|
+
const step = steps[key];
|
|
170
|
+
acc[key] = (process, keepAlive = false, immediate = false) => {
|
|
171
|
+
if (!runNextFrame)
|
|
172
|
+
wake();
|
|
173
|
+
return step.schedule(process, keepAlive, immediate);
|
|
174
|
+
};
|
|
175
|
+
return acc;
|
|
176
|
+
}, {});
|
|
177
|
+
const cancel = (process) => {
|
|
178
|
+
for (let i = 0; i < stepsOrder.length; i++) {
|
|
179
|
+
steps[stepsOrder[i]].cancel(process);
|
|
180
|
+
}
|
|
181
|
+
};
|
|
182
|
+
return { schedule, cancel, state, steps };
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
const { schedule: microtask, cancel: cancelMicrotask } = createRenderBatcher(queueMicrotask, false);
|
|
186
|
+
|
|
187
|
+
function isRefObject(ref) {
|
|
188
|
+
return (ref &&
|
|
189
|
+
typeof ref === "object" &&
|
|
190
|
+
Object.prototype.hasOwnProperty.call(ref, "current"));
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
/**
|
|
194
|
+
* Internal, exported only for usage in Framer
|
|
195
|
+
*/
|
|
196
|
+
const SwitchLayoutGroupContext = react.createContext({});
|
|
197
|
+
|
|
198
|
+
function useVisualElement(Component, visualState, props, createVisualElement, ProjectionNodeConstructor) {
|
|
199
|
+
var _a, _b;
|
|
200
|
+
const { visualElement: parent } = react.useContext(MotionContext);
|
|
201
|
+
const lazyContext = react.useContext(LazyContext);
|
|
202
|
+
const presenceContext = react.useContext(PresenceContext);
|
|
203
|
+
const reducedMotionConfig = react.useContext(MotionConfigContext).reducedMotion;
|
|
204
|
+
const visualElementRef = react.useRef();
|
|
205
|
+
/**
|
|
206
|
+
* If we haven't preloaded a renderer, check to see if we have one lazy-loaded
|
|
207
|
+
*/
|
|
208
|
+
createVisualElement = createVisualElement || lazyContext.renderer;
|
|
209
|
+
if (!visualElementRef.current && createVisualElement) {
|
|
210
|
+
visualElementRef.current = createVisualElement(Component, {
|
|
211
|
+
visualState,
|
|
212
|
+
parent,
|
|
213
|
+
props,
|
|
214
|
+
presenceContext,
|
|
215
|
+
blockInitialAnimation: presenceContext
|
|
216
|
+
? presenceContext.initial === false
|
|
217
|
+
: false,
|
|
218
|
+
reducedMotionConfig,
|
|
219
|
+
});
|
|
220
|
+
}
|
|
221
|
+
const visualElement = visualElementRef.current;
|
|
222
|
+
/**
|
|
223
|
+
* Load Motion gesture and animation features. These are rendered as renderless
|
|
224
|
+
* components so each feature can optionally make use of React lifecycle methods.
|
|
225
|
+
*/
|
|
226
|
+
const initialLayoutGroupConfig = react.useContext(SwitchLayoutGroupContext);
|
|
227
|
+
if (visualElement &&
|
|
228
|
+
!visualElement.projection &&
|
|
229
|
+
ProjectionNodeConstructor &&
|
|
230
|
+
(visualElement.type === "html" || visualElement.type === "svg")) {
|
|
231
|
+
createProjectionNode(visualElementRef.current, props, ProjectionNodeConstructor, initialLayoutGroupConfig);
|
|
232
|
+
}
|
|
233
|
+
const isMounted = react.useRef(false);
|
|
234
|
+
react.useInsertionEffect(() => {
|
|
235
|
+
/**
|
|
236
|
+
* Check the component has already mounted before calling
|
|
237
|
+
* `update` unnecessarily. This ensures we skip the initial update.
|
|
238
|
+
*/
|
|
239
|
+
if (visualElement && isMounted.current) {
|
|
240
|
+
visualElement.update(props, presenceContext);
|
|
241
|
+
}
|
|
242
|
+
});
|
|
243
|
+
/**
|
|
244
|
+
* Cache this value as we want to know whether HandoffAppearAnimations
|
|
245
|
+
* was present on initial render - it will be deleted after this.
|
|
246
|
+
*/
|
|
247
|
+
const optimisedAppearId = props[optimizedAppearDataAttribute];
|
|
248
|
+
const wantsHandoff = react.useRef(Boolean(optimisedAppearId) &&
|
|
249
|
+
!((_a = window.MotionHandoffIsComplete) === null || _a === void 0 ? void 0 : _a.call(window, optimisedAppearId)) &&
|
|
250
|
+
((_b = window.MotionHasOptimisedAnimation) === null || _b === void 0 ? void 0 : _b.call(window, optimisedAppearId)));
|
|
251
|
+
useIsomorphicLayoutEffect(() => {
|
|
252
|
+
if (!visualElement)
|
|
253
|
+
return;
|
|
254
|
+
isMounted.current = true;
|
|
255
|
+
window.MotionIsMounted = true;
|
|
256
|
+
visualElement.updateFeatures();
|
|
257
|
+
microtask.render(visualElement.render);
|
|
258
|
+
/**
|
|
259
|
+
* Ideally this function would always run in a useEffect.
|
|
260
|
+
*
|
|
261
|
+
* However, if we have optimised appear animations to handoff from,
|
|
262
|
+
* it needs to happen synchronously to ensure there's no flash of
|
|
263
|
+
* incorrect styles in the event of a hydration error.
|
|
264
|
+
*
|
|
265
|
+
* So if we detect a situtation where optimised appear animations
|
|
266
|
+
* are running, we use useLayoutEffect to trigger animations.
|
|
267
|
+
*/
|
|
268
|
+
if (wantsHandoff.current && visualElement.animationState) {
|
|
269
|
+
visualElement.animationState.animateChanges();
|
|
270
|
+
}
|
|
271
|
+
});
|
|
272
|
+
react.useEffect(() => {
|
|
273
|
+
if (!visualElement)
|
|
274
|
+
return;
|
|
275
|
+
if (!wantsHandoff.current && visualElement.animationState) {
|
|
276
|
+
visualElement.animationState.animateChanges();
|
|
277
|
+
}
|
|
278
|
+
if (wantsHandoff.current) {
|
|
279
|
+
// This ensures all future calls to animateChanges() in this component will run in useEffect
|
|
280
|
+
queueMicrotask(() => {
|
|
281
|
+
var _a;
|
|
282
|
+
(_a = window.MotionHandoffMarkAsComplete) === null || _a === void 0 ? void 0 : _a.call(window, optimisedAppearId);
|
|
283
|
+
});
|
|
284
|
+
wantsHandoff.current = false;
|
|
285
|
+
}
|
|
286
|
+
});
|
|
287
|
+
return visualElement;
|
|
288
|
+
}
|
|
289
|
+
function createProjectionNode(visualElement, props, ProjectionNodeConstructor, initialPromotionConfig) {
|
|
290
|
+
const { layoutId, layout, drag, dragConstraints, layoutScroll, layoutRoot, } = props;
|
|
291
|
+
visualElement.projection = new ProjectionNodeConstructor(visualElement.latestValues, props["data-framer-portal-id"]
|
|
292
|
+
? undefined
|
|
293
|
+
: getClosestProjectingNode(visualElement.parent));
|
|
294
|
+
visualElement.projection.setOptions({
|
|
295
|
+
layoutId,
|
|
296
|
+
layout,
|
|
297
|
+
alwaysMeasureLayout: Boolean(drag) || (dragConstraints && isRefObject(dragConstraints)),
|
|
298
|
+
visualElement,
|
|
299
|
+
/**
|
|
300
|
+
* TODO: Update options in an effect. This could be tricky as it'll be too late
|
|
301
|
+
* to update by the time layout animations run.
|
|
302
|
+
* We also need to fix this safeToRemove by linking it up to the one returned by usePresence,
|
|
303
|
+
* ensuring it gets called if there's no potential layout animations.
|
|
304
|
+
*
|
|
305
|
+
*/
|
|
306
|
+
animationType: typeof layout === "string" ? layout : "both",
|
|
307
|
+
initialPromotionConfig,
|
|
308
|
+
layoutScroll,
|
|
309
|
+
layoutRoot,
|
|
310
|
+
});
|
|
311
|
+
}
|
|
312
|
+
function getClosestProjectingNode(visualElement) {
|
|
313
|
+
if (!visualElement)
|
|
314
|
+
return undefined;
|
|
315
|
+
return visualElement.options.allowProjection !== false
|
|
316
|
+
? visualElement.projection
|
|
317
|
+
: getClosestProjectingNode(visualElement.parent);
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
/**
|
|
321
|
+
* Creates a ref function that, when called, hydrates the provided
|
|
322
|
+
* external ref and VisualElement.
|
|
323
|
+
*/
|
|
324
|
+
function useMotionRef(visualState, visualElement, externalRef) {
|
|
325
|
+
return react.useCallback((instance) => {
|
|
326
|
+
instance && visualState.mount && visualState.mount(instance);
|
|
327
|
+
if (visualElement) {
|
|
328
|
+
if (instance) {
|
|
329
|
+
visualElement.mount(instance);
|
|
330
|
+
}
|
|
331
|
+
else {
|
|
332
|
+
visualElement.unmount();
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
if (externalRef) {
|
|
336
|
+
if (typeof externalRef === "function") {
|
|
337
|
+
externalRef(instance);
|
|
338
|
+
}
|
|
339
|
+
else if (isRefObject(externalRef)) {
|
|
340
|
+
externalRef.current = instance;
|
|
341
|
+
}
|
|
342
|
+
}
|
|
343
|
+
},
|
|
344
|
+
/**
|
|
345
|
+
* Only pass a new ref callback to React if we've received a visual element
|
|
346
|
+
* factory. Otherwise we'll be mounting/remounting every time externalRef
|
|
347
|
+
* or other dependencies change.
|
|
348
|
+
*/
|
|
349
|
+
[visualElement]);
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
/**
|
|
353
|
+
* Decides if the supplied variable is variant label
|
|
354
|
+
*/
|
|
355
|
+
function isVariantLabel(v) {
|
|
356
|
+
return typeof v === "string" || Array.isArray(v);
|
|
357
|
+
}
|
|
358
|
+
|
|
359
|
+
function isAnimationControls(v) {
|
|
360
|
+
return (v !== null &&
|
|
361
|
+
typeof v === "object" &&
|
|
362
|
+
typeof v.start === "function");
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
const variantPriorityOrder = [
|
|
366
|
+
"animate",
|
|
367
|
+
"whileInView",
|
|
368
|
+
"whileFocus",
|
|
369
|
+
"whileHover",
|
|
370
|
+
"whileTap",
|
|
371
|
+
"whileDrag",
|
|
372
|
+
"exit",
|
|
373
|
+
];
|
|
374
|
+
const variantProps = ["initial", ...variantPriorityOrder];
|
|
375
|
+
|
|
376
|
+
function isControllingVariants(props) {
|
|
377
|
+
return (isAnimationControls(props.animate) ||
|
|
378
|
+
variantProps.some((name) => isVariantLabel(props[name])));
|
|
379
|
+
}
|
|
380
|
+
function isVariantNode(props) {
|
|
381
|
+
return Boolean(isControllingVariants(props) || props.variants);
|
|
382
|
+
}
|
|
383
|
+
|
|
384
|
+
function getCurrentTreeVariants(props, context) {
|
|
385
|
+
if (isControllingVariants(props)) {
|
|
386
|
+
const { initial, animate } = props;
|
|
387
|
+
return {
|
|
388
|
+
initial: initial === false || isVariantLabel(initial)
|
|
389
|
+
? initial
|
|
390
|
+
: undefined,
|
|
391
|
+
animate: isVariantLabel(animate) ? animate : undefined,
|
|
392
|
+
};
|
|
393
|
+
}
|
|
394
|
+
return props.inherit !== false ? context : {};
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
function useCreateMotionContext(props) {
|
|
398
|
+
const { initial, animate } = getCurrentTreeVariants(props, react.useContext(MotionContext));
|
|
399
|
+
return react.useMemo(() => ({ initial, animate }), [variantLabelsAsDependency(initial), variantLabelsAsDependency(animate)]);
|
|
400
|
+
}
|
|
401
|
+
function variantLabelsAsDependency(prop) {
|
|
402
|
+
return Array.isArray(prop) ? prop.join(" ") : prop;
|
|
403
|
+
}
|
|
404
|
+
|
|
405
|
+
const featureProps = {
|
|
406
|
+
animation: [
|
|
407
|
+
"animate",
|
|
408
|
+
"variants",
|
|
409
|
+
"whileHover",
|
|
410
|
+
"whileTap",
|
|
411
|
+
"exit",
|
|
412
|
+
"whileInView",
|
|
413
|
+
"whileFocus",
|
|
414
|
+
"whileDrag",
|
|
415
|
+
],
|
|
416
|
+
exit: ["exit"],
|
|
417
|
+
drag: ["drag", "dragControls"],
|
|
418
|
+
focus: ["whileFocus"],
|
|
419
|
+
hover: ["whileHover", "onHoverStart", "onHoverEnd"],
|
|
420
|
+
tap: ["whileTap", "onTap", "onTapStart", "onTapCancel"],
|
|
421
|
+
pan: ["onPan", "onPanStart", "onPanSessionStart", "onPanEnd"],
|
|
422
|
+
inView: ["whileInView", "onViewportEnter", "onViewportLeave"],
|
|
423
|
+
layout: ["layout", "layoutId"],
|
|
424
|
+
};
|
|
425
|
+
const featureDefinitions = {};
|
|
426
|
+
for (const key in featureProps) {
|
|
427
|
+
featureDefinitions[key] = {
|
|
428
|
+
isEnabled: (props) => featureProps[key].some((name) => !!props[name]),
|
|
429
|
+
};
|
|
430
|
+
}
|
|
431
|
+
|
|
432
|
+
function loadFeatures(features) {
|
|
433
|
+
for (const key in features) {
|
|
434
|
+
featureDefinitions[key] = {
|
|
435
|
+
...featureDefinitions[key],
|
|
436
|
+
...features[key],
|
|
437
|
+
};
|
|
438
|
+
}
|
|
439
|
+
}
|
|
440
|
+
|
|
441
|
+
const LayoutGroupContext = react.createContext({});
|
|
442
|
+
|
|
443
|
+
const motionComponentSymbol = Symbol.for("motionComponentSymbol");
|
|
444
|
+
|
|
445
|
+
const noop = (any) => any;
|
|
446
|
+
|
|
447
|
+
let warning = noop;
|
|
448
|
+
let invariant = noop;
|
|
449
|
+
if (process.env.NODE_ENV !== "production") {
|
|
450
|
+
warning = (check, message) => {
|
|
451
|
+
if (!check && typeof console !== "undefined") {
|
|
452
|
+
console.warn(message);
|
|
453
|
+
}
|
|
454
|
+
};
|
|
455
|
+
invariant = (check, message) => {
|
|
456
|
+
if (!check) {
|
|
457
|
+
throw new Error(message);
|
|
458
|
+
}
|
|
459
|
+
};
|
|
460
|
+
}
|
|
461
|
+
|
|
462
|
+
/**
|
|
463
|
+
* Create a `motion` component.
|
|
464
|
+
*
|
|
465
|
+
* This function accepts a Component argument, which can be either a string (ie "div"
|
|
466
|
+
* for `motion.div`), or an actual React component.
|
|
467
|
+
*
|
|
468
|
+
* Alongside this is a config option which provides a way of rendering the provided
|
|
469
|
+
* component "offline", or outside the React render cycle.
|
|
470
|
+
*/
|
|
471
|
+
function createRendererMotionComponent({ preloadedFeatures, createVisualElement, useRender, useVisualState, Component, }) {
|
|
472
|
+
preloadedFeatures && loadFeatures(preloadedFeatures);
|
|
473
|
+
function MotionComponent(props, externalRef) {
|
|
474
|
+
/**
|
|
475
|
+
* If we need to measure the element we load this functionality in a
|
|
476
|
+
* separate class component in order to gain access to getSnapshotBeforeUpdate.
|
|
477
|
+
*/
|
|
478
|
+
let MeasureLayout;
|
|
479
|
+
const configAndProps = {
|
|
480
|
+
...react.useContext(MotionConfigContext),
|
|
481
|
+
...props,
|
|
482
|
+
layoutId: useLayoutId(props),
|
|
483
|
+
};
|
|
484
|
+
const { isStatic } = configAndProps;
|
|
485
|
+
const context = useCreateMotionContext(props);
|
|
486
|
+
const visualState = useVisualState(props, isStatic);
|
|
487
|
+
if (!isStatic && isBrowser) {
|
|
488
|
+
useStrictMode(configAndProps, preloadedFeatures);
|
|
489
|
+
const layoutProjection = getProjectionFunctionality(configAndProps);
|
|
490
|
+
MeasureLayout = layoutProjection.MeasureLayout;
|
|
491
|
+
/**
|
|
492
|
+
* Create a VisualElement for this component. A VisualElement provides a common
|
|
493
|
+
* interface to renderer-specific APIs (ie DOM/Three.js etc) as well as
|
|
494
|
+
* providing a way of rendering to these APIs outside of the React render loop
|
|
495
|
+
* for more performant animations and interactions
|
|
496
|
+
*/
|
|
497
|
+
context.visualElement = useVisualElement(Component, visualState, configAndProps, createVisualElement, layoutProjection.ProjectionNode);
|
|
498
|
+
}
|
|
499
|
+
/**
|
|
500
|
+
* The mount order and hierarchy is specific to ensure our element ref
|
|
501
|
+
* is hydrated by the time features fire their effects.
|
|
502
|
+
*/
|
|
503
|
+
return (jsxRuntime.jsxs(MotionContext.Provider, { value: context, children: [MeasureLayout && context.visualElement ? (jsxRuntime.jsx(MeasureLayout, { visualElement: context.visualElement, ...configAndProps })) : null, useRender(Component, props, useMotionRef(visualState, context.visualElement, externalRef), visualState, isStatic, context.visualElement)] }));
|
|
504
|
+
}
|
|
505
|
+
const ForwardRefMotionComponent = react.forwardRef(MotionComponent);
|
|
506
|
+
ForwardRefMotionComponent[motionComponentSymbol] = Component;
|
|
507
|
+
return ForwardRefMotionComponent;
|
|
508
|
+
}
|
|
509
|
+
function useLayoutId({ layoutId }) {
|
|
510
|
+
const layoutGroupId = react.useContext(LayoutGroupContext).id;
|
|
511
|
+
return layoutGroupId && layoutId !== undefined
|
|
512
|
+
? layoutGroupId + "-" + layoutId
|
|
513
|
+
: layoutId;
|
|
514
|
+
}
|
|
515
|
+
function useStrictMode(configAndProps, preloadedFeatures) {
|
|
516
|
+
const isStrict = react.useContext(LazyContext).strict;
|
|
517
|
+
/**
|
|
518
|
+
* If we're in development mode, check to make sure we're not rendering a motion component
|
|
519
|
+
* as a child of LazyMotion, as this will break the file-size benefits of using it.
|
|
520
|
+
*/
|
|
521
|
+
if (process.env.NODE_ENV !== "production" &&
|
|
522
|
+
preloadedFeatures &&
|
|
523
|
+
isStrict) {
|
|
524
|
+
const strictMessage = "You have rendered a `motion` component within a `LazyMotion` component. This will break tree shaking. Import and render a `m` component instead.";
|
|
525
|
+
configAndProps.ignoreStrict
|
|
526
|
+
? warning(false, strictMessage)
|
|
527
|
+
: invariant(false, strictMessage);
|
|
528
|
+
}
|
|
529
|
+
}
|
|
530
|
+
function getProjectionFunctionality(props) {
|
|
531
|
+
const { drag, layout } = featureDefinitions;
|
|
532
|
+
if (!drag && !layout)
|
|
533
|
+
return {};
|
|
534
|
+
const combined = { ...drag, ...layout };
|
|
535
|
+
return {
|
|
536
|
+
MeasureLayout: (drag === null || drag === void 0 ? void 0 : drag.isEnabled(props)) || (layout === null || layout === void 0 ? void 0 : layout.isEnabled(props))
|
|
537
|
+
? combined.MeasureLayout
|
|
538
|
+
: undefined,
|
|
539
|
+
ProjectionNode: combined.ProjectionNode,
|
|
540
|
+
};
|
|
541
|
+
}
|
|
542
|
+
|
|
543
|
+
/**
|
|
544
|
+
* We keep these listed separately as we use the lowercase tag names as part
|
|
545
|
+
* of the runtime bundle to detect SVG components
|
|
546
|
+
*/
|
|
547
|
+
const lowercaseSVGElements = [
|
|
548
|
+
"animate",
|
|
549
|
+
"circle",
|
|
550
|
+
"defs",
|
|
551
|
+
"desc",
|
|
552
|
+
"ellipse",
|
|
553
|
+
"g",
|
|
554
|
+
"image",
|
|
555
|
+
"line",
|
|
556
|
+
"filter",
|
|
557
|
+
"marker",
|
|
558
|
+
"mask",
|
|
559
|
+
"metadata",
|
|
560
|
+
"path",
|
|
561
|
+
"pattern",
|
|
562
|
+
"polygon",
|
|
563
|
+
"polyline",
|
|
564
|
+
"rect",
|
|
565
|
+
"stop",
|
|
566
|
+
"switch",
|
|
567
|
+
"symbol",
|
|
568
|
+
"svg",
|
|
569
|
+
"text",
|
|
570
|
+
"tspan",
|
|
571
|
+
"use",
|
|
572
|
+
"view",
|
|
573
|
+
];
|
|
574
|
+
|
|
575
|
+
function isSVGComponent(Component) {
|
|
576
|
+
if (
|
|
577
|
+
/**
|
|
578
|
+
* If it's not a string, it's a custom React component. Currently we only support
|
|
579
|
+
* HTML custom React components.
|
|
580
|
+
*/
|
|
581
|
+
typeof Component !== "string" ||
|
|
582
|
+
/**
|
|
583
|
+
* If it contains a dash, the element is a custom HTML webcomponent.
|
|
584
|
+
*/
|
|
585
|
+
Component.includes("-")) {
|
|
586
|
+
return false;
|
|
587
|
+
}
|
|
588
|
+
else if (
|
|
589
|
+
/**
|
|
590
|
+
* If it's in our list of lowercase SVG tags, it's an SVG component
|
|
591
|
+
*/
|
|
592
|
+
lowercaseSVGElements.indexOf(Component) > -1 ||
|
|
593
|
+
/**
|
|
594
|
+
* If it contains a capital letter, it's an SVG component
|
|
595
|
+
*/
|
|
596
|
+
/[A-Z]/u.test(Component)) {
|
|
597
|
+
return true;
|
|
598
|
+
}
|
|
599
|
+
return false;
|
|
600
|
+
}
|
|
601
|
+
|
|
602
|
+
function renderHTML(element, { style, vars }, styleProp, projection) {
|
|
603
|
+
Object.assign(element.style, style, projection && projection.getProjectionStyles(styleProp));
|
|
604
|
+
// Loop over any CSS variables and assign those.
|
|
605
|
+
for (const key in vars) {
|
|
606
|
+
element.style.setProperty(key, vars[key]);
|
|
607
|
+
}
|
|
608
|
+
}
|
|
609
|
+
|
|
610
|
+
/**
|
|
611
|
+
* A set of attribute names that are always read/written as camel case.
|
|
612
|
+
*/
|
|
613
|
+
const camelCaseAttributes = new Set([
|
|
614
|
+
"baseFrequency",
|
|
615
|
+
"diffuseConstant",
|
|
616
|
+
"kernelMatrix",
|
|
617
|
+
"kernelUnitLength",
|
|
618
|
+
"keySplines",
|
|
619
|
+
"keyTimes",
|
|
620
|
+
"limitingConeAngle",
|
|
621
|
+
"markerHeight",
|
|
622
|
+
"markerWidth",
|
|
623
|
+
"numOctaves",
|
|
624
|
+
"targetX",
|
|
625
|
+
"targetY",
|
|
626
|
+
"surfaceScale",
|
|
627
|
+
"specularConstant",
|
|
628
|
+
"specularExponent",
|
|
629
|
+
"stdDeviation",
|
|
630
|
+
"tableValues",
|
|
631
|
+
"viewBox",
|
|
632
|
+
"gradientTransform",
|
|
633
|
+
"pathLength",
|
|
634
|
+
"startOffset",
|
|
635
|
+
"textLength",
|
|
636
|
+
"lengthAdjust",
|
|
637
|
+
]);
|
|
638
|
+
|
|
639
|
+
function renderSVG(element, renderState, _styleProp, projection) {
|
|
640
|
+
renderHTML(element, renderState, undefined, projection);
|
|
641
|
+
for (const key in renderState.attrs) {
|
|
642
|
+
element.setAttribute(!camelCaseAttributes.has(key) ? camelToDash(key) : key, renderState.attrs[key]);
|
|
643
|
+
}
|
|
644
|
+
}
|
|
645
|
+
|
|
646
|
+
const isMotionValue = (value) => Boolean(value && value.getVelocity);
|
|
647
|
+
|
|
648
|
+
const scaleCorrectors = {};
|
|
649
|
+
|
|
650
|
+
/**
|
|
651
|
+
* Generate a list of every possible transform key.
|
|
652
|
+
*/
|
|
653
|
+
const transformPropOrder = [
|
|
654
|
+
"transformPerspective",
|
|
655
|
+
"x",
|
|
656
|
+
"y",
|
|
657
|
+
"z",
|
|
658
|
+
"translateX",
|
|
659
|
+
"translateY",
|
|
660
|
+
"translateZ",
|
|
661
|
+
"scale",
|
|
662
|
+
"scaleX",
|
|
663
|
+
"scaleY",
|
|
664
|
+
"rotate",
|
|
665
|
+
"rotateX",
|
|
666
|
+
"rotateY",
|
|
667
|
+
"rotateZ",
|
|
668
|
+
"skew",
|
|
669
|
+
"skewX",
|
|
670
|
+
"skewY",
|
|
671
|
+
];
|
|
672
|
+
/**
|
|
673
|
+
* A quick lookup for transform props.
|
|
674
|
+
*/
|
|
675
|
+
const transformProps = new Set(transformPropOrder);
|
|
676
|
+
|
|
677
|
+
function isForcedMotionValue(key, { layout, layoutId }) {
|
|
678
|
+
return (transformProps.has(key) ||
|
|
679
|
+
key.startsWith("origin") ||
|
|
680
|
+
((layout || layoutId !== undefined) &&
|
|
681
|
+
(!!scaleCorrectors[key] || key === "opacity")));
|
|
682
|
+
}
|
|
683
|
+
|
|
684
|
+
function scrapeMotionValuesFromProps$1(props, prevProps, visualElement) {
|
|
685
|
+
var _a;
|
|
686
|
+
const { style } = props;
|
|
687
|
+
const newValues = {};
|
|
688
|
+
for (const key in style) {
|
|
689
|
+
if (isMotionValue(style[key]) ||
|
|
690
|
+
(prevProps.style &&
|
|
691
|
+
isMotionValue(prevProps.style[key])) ||
|
|
692
|
+
isForcedMotionValue(key, props) ||
|
|
693
|
+
((_a = visualElement === null || visualElement === void 0 ? void 0 : visualElement.getValue(key)) === null || _a === void 0 ? void 0 : _a.liveStyle) !== undefined) {
|
|
694
|
+
newValues[key] = style[key];
|
|
695
|
+
}
|
|
696
|
+
}
|
|
697
|
+
return newValues;
|
|
698
|
+
}
|
|
699
|
+
|
|
700
|
+
function scrapeMotionValuesFromProps(props, prevProps, visualElement) {
|
|
701
|
+
const newValues = scrapeMotionValuesFromProps$1(props, prevProps, visualElement);
|
|
702
|
+
for (const key in props) {
|
|
703
|
+
if (isMotionValue(props[key]) ||
|
|
704
|
+
isMotionValue(prevProps[key])) {
|
|
705
|
+
const targetKey = transformPropOrder.indexOf(key) !== -1
|
|
706
|
+
? "attr" + key.charAt(0).toUpperCase() + key.substring(1)
|
|
707
|
+
: key;
|
|
708
|
+
newValues[targetKey] = props[key];
|
|
709
|
+
}
|
|
710
|
+
}
|
|
711
|
+
return newValues;
|
|
712
|
+
}
|
|
713
|
+
|
|
714
|
+
function getValueState(visualElement) {
|
|
715
|
+
const state = [{}, {}];
|
|
716
|
+
visualElement === null || visualElement === void 0 ? void 0 : visualElement.values.forEach((value, key) => {
|
|
717
|
+
state[0][key] = value.get();
|
|
718
|
+
state[1][key] = value.getVelocity();
|
|
719
|
+
});
|
|
720
|
+
return state;
|
|
721
|
+
}
|
|
722
|
+
function resolveVariantFromProps(props, definition, custom, visualElement) {
|
|
723
|
+
/**
|
|
724
|
+
* If the variant definition is a function, resolve.
|
|
725
|
+
*/
|
|
726
|
+
if (typeof definition === "function") {
|
|
727
|
+
const [current, velocity] = getValueState(visualElement);
|
|
728
|
+
definition = definition(custom !== undefined ? custom : props.custom, current, velocity);
|
|
729
|
+
}
|
|
730
|
+
/**
|
|
731
|
+
* If the variant definition is a variant label, or
|
|
732
|
+
* the function returned a variant label, resolve.
|
|
733
|
+
*/
|
|
734
|
+
if (typeof definition === "string") {
|
|
735
|
+
definition = props.variants && props.variants[definition];
|
|
736
|
+
}
|
|
737
|
+
/**
|
|
738
|
+
* At this point we've resolved both functions and variant labels,
|
|
739
|
+
* but the resolved variant label might itself have been a function.
|
|
740
|
+
* If so, resolve. This can only have returned a valid target object.
|
|
741
|
+
*/
|
|
742
|
+
if (typeof definition === "function") {
|
|
743
|
+
const [current, velocity] = getValueState(visualElement);
|
|
744
|
+
definition = definition(custom !== undefined ? custom : props.custom, current, velocity);
|
|
745
|
+
}
|
|
746
|
+
return definition;
|
|
747
|
+
}
|
|
748
|
+
|
|
749
|
+
/**
|
|
750
|
+
* Creates a constant value over the lifecycle of a component.
|
|
751
|
+
*
|
|
752
|
+
* Even if `useMemo` is provided an empty array as its final argument, it doesn't offer
|
|
753
|
+
* a guarantee that it won't re-run for performance reasons later on. By using `useConstant`
|
|
754
|
+
* you can ensure that initialisers don't execute twice or more.
|
|
755
|
+
*/
|
|
756
|
+
function useConstant(init) {
|
|
757
|
+
const ref = react.useRef(null);
|
|
758
|
+
if (ref.current === null) {
|
|
759
|
+
ref.current = init();
|
|
760
|
+
}
|
|
761
|
+
return ref.current;
|
|
762
|
+
}
|
|
763
|
+
|
|
764
|
+
const isCustomValue = (v) => {
|
|
765
|
+
return Boolean(v && typeof v === "object" && v.mix && v.toValue);
|
|
766
|
+
};
|
|
767
|
+
|
|
768
|
+
/**
|
|
769
|
+
* If the provided value is a MotionValue, this returns the actual value, otherwise just the value itself
|
|
770
|
+
*
|
|
771
|
+
* TODO: Remove and move to library
|
|
772
|
+
*/
|
|
773
|
+
function resolveMotionValue(value) {
|
|
774
|
+
const unwrappedValue = isMotionValue(value) ? value.get() : value;
|
|
775
|
+
return isCustomValue(unwrappedValue)
|
|
776
|
+
? unwrappedValue.toValue()
|
|
777
|
+
: unwrappedValue;
|
|
778
|
+
}
|
|
779
|
+
|
|
780
|
+
function makeState({ scrapeMotionValuesFromProps, createRenderState, onMount, }, props, context, presenceContext) {
|
|
781
|
+
const state = {
|
|
782
|
+
latestValues: makeLatestValues(props, context, presenceContext, scrapeMotionValuesFromProps),
|
|
783
|
+
renderState: createRenderState(),
|
|
784
|
+
};
|
|
785
|
+
if (onMount) {
|
|
786
|
+
state.mount = (instance) => onMount(props, instance, state);
|
|
787
|
+
}
|
|
788
|
+
return state;
|
|
789
|
+
}
|
|
790
|
+
const makeUseVisualState = (config) => (props, isStatic) => {
|
|
791
|
+
const context = react.useContext(MotionContext);
|
|
792
|
+
const presenceContext = react.useContext(PresenceContext);
|
|
793
|
+
const make = () => makeState(config, props, context, presenceContext);
|
|
794
|
+
return isStatic ? make() : useConstant(make);
|
|
795
|
+
};
|
|
796
|
+
function makeLatestValues(props, context, presenceContext, scrapeMotionValues) {
|
|
797
|
+
const values = {};
|
|
798
|
+
const motionValues = scrapeMotionValues(props, {});
|
|
799
|
+
for (const key in motionValues) {
|
|
800
|
+
values[key] = resolveMotionValue(motionValues[key]);
|
|
801
|
+
}
|
|
802
|
+
let { initial, animate } = props;
|
|
803
|
+
const isControllingVariants$1 = isControllingVariants(props);
|
|
804
|
+
const isVariantNode$1 = isVariantNode(props);
|
|
805
|
+
if (context &&
|
|
806
|
+
isVariantNode$1 &&
|
|
807
|
+
!isControllingVariants$1 &&
|
|
808
|
+
props.inherit !== false) {
|
|
809
|
+
if (initial === undefined)
|
|
810
|
+
initial = context.initial;
|
|
811
|
+
if (animate === undefined)
|
|
812
|
+
animate = context.animate;
|
|
813
|
+
}
|
|
814
|
+
let isInitialAnimationBlocked = presenceContext
|
|
815
|
+
? presenceContext.initial === false
|
|
816
|
+
: false;
|
|
817
|
+
isInitialAnimationBlocked = isInitialAnimationBlocked || initial === false;
|
|
818
|
+
const variantToSet = isInitialAnimationBlocked ? animate : initial;
|
|
819
|
+
if (variantToSet &&
|
|
820
|
+
typeof variantToSet !== "boolean" &&
|
|
821
|
+
!isAnimationControls(variantToSet)) {
|
|
822
|
+
const list = Array.isArray(variantToSet) ? variantToSet : [variantToSet];
|
|
823
|
+
for (let i = 0; i < list.length; i++) {
|
|
824
|
+
const resolved = resolveVariantFromProps(props, list[i]);
|
|
825
|
+
if (resolved) {
|
|
826
|
+
const { transitionEnd, transition, ...target } = resolved;
|
|
827
|
+
for (const key in target) {
|
|
828
|
+
let valueTarget = target[key];
|
|
829
|
+
if (Array.isArray(valueTarget)) {
|
|
830
|
+
/**
|
|
831
|
+
* Take final keyframe if the initial animation is blocked because
|
|
832
|
+
* we want to initialise at the end of that blocked animation.
|
|
833
|
+
*/
|
|
834
|
+
const index = isInitialAnimationBlocked
|
|
835
|
+
? valueTarget.length - 1
|
|
836
|
+
: 0;
|
|
837
|
+
valueTarget = valueTarget[index];
|
|
838
|
+
}
|
|
839
|
+
if (valueTarget !== null) {
|
|
840
|
+
values[key] = valueTarget;
|
|
841
|
+
}
|
|
842
|
+
}
|
|
843
|
+
for (const key in transitionEnd) {
|
|
844
|
+
values[key] = transitionEnd[key];
|
|
845
|
+
}
|
|
846
|
+
}
|
|
847
|
+
}
|
|
848
|
+
}
|
|
849
|
+
return values;
|
|
850
|
+
}
|
|
851
|
+
|
|
852
|
+
const createHtmlRenderState = () => ({
|
|
853
|
+
style: {},
|
|
854
|
+
transform: {},
|
|
855
|
+
transformOrigin: {},
|
|
856
|
+
vars: {},
|
|
857
|
+
});
|
|
858
|
+
|
|
859
|
+
const createSvgRenderState = () => ({
|
|
860
|
+
...createHtmlRenderState(),
|
|
861
|
+
attrs: {},
|
|
862
|
+
});
|
|
863
|
+
|
|
864
|
+
/**
|
|
865
|
+
* Provided a value and a ValueType, returns the value as that value type.
|
|
866
|
+
*/
|
|
867
|
+
const getValueAsType = (value, type) => {
|
|
868
|
+
return type && typeof value === "number"
|
|
869
|
+
? type.transform(value)
|
|
870
|
+
: value;
|
|
871
|
+
};
|
|
872
|
+
|
|
873
|
+
const clamp = (min, max, v) => {
|
|
874
|
+
if (v > max)
|
|
875
|
+
return max;
|
|
876
|
+
if (v < min)
|
|
877
|
+
return min;
|
|
878
|
+
return v;
|
|
879
|
+
};
|
|
880
|
+
|
|
881
|
+
const number = {
|
|
882
|
+
test: (v) => typeof v === "number",
|
|
883
|
+
parse: parseFloat,
|
|
884
|
+
transform: (v) => v,
|
|
885
|
+
};
|
|
886
|
+
const alpha = {
|
|
887
|
+
...number,
|
|
888
|
+
transform: (v) => clamp(0, 1, v),
|
|
889
|
+
};
|
|
890
|
+
const scale = {
|
|
891
|
+
...number,
|
|
892
|
+
default: 1,
|
|
893
|
+
};
|
|
894
|
+
|
|
895
|
+
const createUnitType = (unit) => ({
|
|
896
|
+
test: (v) => typeof v === "string" && v.endsWith(unit) && v.split(" ").length === 1,
|
|
897
|
+
parse: parseFloat,
|
|
898
|
+
transform: (v) => `${v}${unit}`,
|
|
899
|
+
});
|
|
900
|
+
const degrees = /*@__PURE__*/ createUnitType("deg");
|
|
901
|
+
const percent = /*@__PURE__*/ createUnitType("%");
|
|
902
|
+
const px = /*@__PURE__*/ createUnitType("px");
|
|
903
|
+
const progressPercentage = {
|
|
904
|
+
...percent,
|
|
905
|
+
parse: (v) => percent.parse(v) / 100,
|
|
906
|
+
transform: (v) => percent.transform(v * 100),
|
|
907
|
+
};
|
|
908
|
+
|
|
909
|
+
const browserNumberValueTypes = {
|
|
910
|
+
// Border props
|
|
911
|
+
borderWidth: px,
|
|
912
|
+
borderTopWidth: px,
|
|
913
|
+
borderRightWidth: px,
|
|
914
|
+
borderBottomWidth: px,
|
|
915
|
+
borderLeftWidth: px,
|
|
916
|
+
borderRadius: px,
|
|
917
|
+
radius: px,
|
|
918
|
+
borderTopLeftRadius: px,
|
|
919
|
+
borderTopRightRadius: px,
|
|
920
|
+
borderBottomRightRadius: px,
|
|
921
|
+
borderBottomLeftRadius: px,
|
|
922
|
+
// Positioning props
|
|
923
|
+
width: px,
|
|
924
|
+
maxWidth: px,
|
|
925
|
+
height: px,
|
|
926
|
+
maxHeight: px,
|
|
927
|
+
top: px,
|
|
928
|
+
right: px,
|
|
929
|
+
bottom: px,
|
|
930
|
+
left: px,
|
|
931
|
+
// Spacing props
|
|
932
|
+
padding: px,
|
|
933
|
+
paddingTop: px,
|
|
934
|
+
paddingRight: px,
|
|
935
|
+
paddingBottom: px,
|
|
936
|
+
paddingLeft: px,
|
|
937
|
+
margin: px,
|
|
938
|
+
marginTop: px,
|
|
939
|
+
marginRight: px,
|
|
940
|
+
marginBottom: px,
|
|
941
|
+
marginLeft: px,
|
|
942
|
+
// Misc
|
|
943
|
+
backgroundPositionX: px,
|
|
944
|
+
backgroundPositionY: px,
|
|
945
|
+
};
|
|
946
|
+
|
|
947
|
+
const transformValueTypes = {
|
|
948
|
+
rotate: degrees,
|
|
949
|
+
rotateX: degrees,
|
|
950
|
+
rotateY: degrees,
|
|
951
|
+
rotateZ: degrees,
|
|
952
|
+
scale,
|
|
953
|
+
scaleX: scale,
|
|
954
|
+
scaleY: scale,
|
|
955
|
+
scaleZ: scale,
|
|
956
|
+
skew: degrees,
|
|
957
|
+
skewX: degrees,
|
|
958
|
+
skewY: degrees,
|
|
959
|
+
distance: px,
|
|
960
|
+
translateX: px,
|
|
961
|
+
translateY: px,
|
|
962
|
+
translateZ: px,
|
|
963
|
+
x: px,
|
|
964
|
+
y: px,
|
|
965
|
+
z: px,
|
|
966
|
+
perspective: px,
|
|
967
|
+
transformPerspective: px,
|
|
968
|
+
opacity: alpha,
|
|
969
|
+
originX: progressPercentage,
|
|
970
|
+
originY: progressPercentage,
|
|
971
|
+
originZ: px,
|
|
972
|
+
};
|
|
973
|
+
|
|
974
|
+
const int = {
|
|
975
|
+
...number,
|
|
976
|
+
transform: Math.round,
|
|
977
|
+
};
|
|
978
|
+
|
|
979
|
+
const numberValueTypes = {
|
|
980
|
+
...browserNumberValueTypes,
|
|
981
|
+
...transformValueTypes,
|
|
982
|
+
zIndex: int,
|
|
983
|
+
size: px,
|
|
984
|
+
// SVG
|
|
985
|
+
fillOpacity: alpha,
|
|
986
|
+
strokeOpacity: alpha,
|
|
987
|
+
numOctaves: int,
|
|
988
|
+
};
|
|
989
|
+
|
|
990
|
+
const translateAlias = {
|
|
991
|
+
x: "translateX",
|
|
992
|
+
y: "translateY",
|
|
993
|
+
z: "translateZ",
|
|
994
|
+
transformPerspective: "perspective",
|
|
995
|
+
};
|
|
996
|
+
const numTransforms = transformPropOrder.length;
|
|
997
|
+
/**
|
|
998
|
+
* Build a CSS transform style from individual x/y/scale etc properties.
|
|
999
|
+
*
|
|
1000
|
+
* This outputs with a default order of transforms/scales/rotations, this can be customised by
|
|
1001
|
+
* providing a transformTemplate function.
|
|
1002
|
+
*/
|
|
1003
|
+
function buildTransform(latestValues, transform, transformTemplate) {
|
|
1004
|
+
// The transform string we're going to build into.
|
|
1005
|
+
let transformString = "";
|
|
1006
|
+
let transformIsDefault = true;
|
|
1007
|
+
/**
|
|
1008
|
+
* Loop over all possible transforms in order, adding the ones that
|
|
1009
|
+
* are present to the transform string.
|
|
1010
|
+
*/
|
|
1011
|
+
for (let i = 0; i < numTransforms; i++) {
|
|
1012
|
+
const key = transformPropOrder[i];
|
|
1013
|
+
const value = latestValues[key];
|
|
1014
|
+
if (value === undefined)
|
|
1015
|
+
continue;
|
|
1016
|
+
let valueIsDefault = true;
|
|
1017
|
+
if (typeof value === "number") {
|
|
1018
|
+
valueIsDefault = value === (key.startsWith("scale") ? 1 : 0);
|
|
1019
|
+
}
|
|
1020
|
+
else {
|
|
1021
|
+
valueIsDefault = parseFloat(value) === 0;
|
|
1022
|
+
}
|
|
1023
|
+
if (!valueIsDefault || transformTemplate) {
|
|
1024
|
+
const valueAsType = getValueAsType(value, numberValueTypes[key]);
|
|
1025
|
+
if (!valueIsDefault) {
|
|
1026
|
+
transformIsDefault = false;
|
|
1027
|
+
const transformName = translateAlias[key] || key;
|
|
1028
|
+
transformString += `${transformName}(${valueAsType}) `;
|
|
1029
|
+
}
|
|
1030
|
+
if (transformTemplate) {
|
|
1031
|
+
transform[key] = valueAsType;
|
|
1032
|
+
}
|
|
1033
|
+
}
|
|
1034
|
+
}
|
|
1035
|
+
transformString = transformString.trim();
|
|
1036
|
+
// If we have a custom `transform` template, pass our transform values and
|
|
1037
|
+
// generated transformString to that before returning
|
|
1038
|
+
if (transformTemplate) {
|
|
1039
|
+
transformString = transformTemplate(transform, transformIsDefault ? "" : transformString);
|
|
1040
|
+
}
|
|
1041
|
+
else if (transformIsDefault) {
|
|
1042
|
+
transformString = "none";
|
|
1043
|
+
}
|
|
1044
|
+
return transformString;
|
|
1045
|
+
}
|
|
1046
|
+
|
|
1047
|
+
const checkStringStartsWith = (token) => (key) => typeof key === "string" && key.startsWith(token);
|
|
1048
|
+
const isCSSVariableName =
|
|
1049
|
+
/*@__PURE__*/ checkStringStartsWith("--");
|
|
1050
|
+
|
|
1051
|
+
function buildHTMLStyles(state, latestValues, transformTemplate) {
|
|
1052
|
+
const { style, vars, transformOrigin } = state;
|
|
1053
|
+
// Track whether we encounter any transform or transformOrigin values.
|
|
1054
|
+
let hasTransform = false;
|
|
1055
|
+
let hasTransformOrigin = false;
|
|
1056
|
+
/**
|
|
1057
|
+
* Loop over all our latest animated values and decide whether to handle them
|
|
1058
|
+
* as a style or CSS variable.
|
|
1059
|
+
*
|
|
1060
|
+
* Transforms and transform origins are kept separately for further processing.
|
|
1061
|
+
*/
|
|
1062
|
+
for (const key in latestValues) {
|
|
1063
|
+
const value = latestValues[key];
|
|
1064
|
+
if (transformProps.has(key)) {
|
|
1065
|
+
// If this is a transform, flag to enable further transform processing
|
|
1066
|
+
hasTransform = true;
|
|
1067
|
+
continue;
|
|
1068
|
+
}
|
|
1069
|
+
else if (isCSSVariableName(key)) {
|
|
1070
|
+
vars[key] = value;
|
|
1071
|
+
continue;
|
|
1072
|
+
}
|
|
1073
|
+
else {
|
|
1074
|
+
// Convert the value to its default value type, ie 0 -> "0px"
|
|
1075
|
+
const valueAsType = getValueAsType(value, numberValueTypes[key]);
|
|
1076
|
+
if (key.startsWith("origin")) {
|
|
1077
|
+
// If this is a transform origin, flag and enable further transform-origin processing
|
|
1078
|
+
hasTransformOrigin = true;
|
|
1079
|
+
transformOrigin[key] =
|
|
1080
|
+
valueAsType;
|
|
1081
|
+
}
|
|
1082
|
+
else {
|
|
1083
|
+
style[key] = valueAsType;
|
|
1084
|
+
}
|
|
1085
|
+
}
|
|
1086
|
+
}
|
|
1087
|
+
if (!latestValues.transform) {
|
|
1088
|
+
if (hasTransform || transformTemplate) {
|
|
1089
|
+
style.transform = buildTransform(latestValues, state.transform, transformTemplate);
|
|
1090
|
+
}
|
|
1091
|
+
else if (style.transform) {
|
|
1092
|
+
/**
|
|
1093
|
+
* If we have previously created a transform but currently don't have any,
|
|
1094
|
+
* reset transform style to none.
|
|
1095
|
+
*/
|
|
1096
|
+
style.transform = "none";
|
|
1097
|
+
}
|
|
1098
|
+
}
|
|
1099
|
+
/**
|
|
1100
|
+
* Build a transformOrigin style. Uses the same defaults as the browser for
|
|
1101
|
+
* undefined origins.
|
|
1102
|
+
*/
|
|
1103
|
+
if (hasTransformOrigin) {
|
|
1104
|
+
const { originX = "50%", originY = "50%", originZ = 0, } = transformOrigin;
|
|
1105
|
+
style.transformOrigin = `${originX} ${originY} ${originZ}`;
|
|
1106
|
+
}
|
|
1107
|
+
}
|
|
1108
|
+
|
|
1109
|
+
function calcOrigin(origin, offset, size) {
|
|
1110
|
+
return typeof origin === "string"
|
|
1111
|
+
? origin
|
|
1112
|
+
: px.transform(offset + size * origin);
|
|
1113
|
+
}
|
|
1114
|
+
/**
|
|
1115
|
+
* The SVG transform origin defaults are different to CSS and is less intuitive,
|
|
1116
|
+
* so we use the measured dimensions of the SVG to reconcile these.
|
|
1117
|
+
*/
|
|
1118
|
+
function calcSVGTransformOrigin(dimensions, originX, originY) {
|
|
1119
|
+
const pxOriginX = calcOrigin(originX, dimensions.x, dimensions.width);
|
|
1120
|
+
const pxOriginY = calcOrigin(originY, dimensions.y, dimensions.height);
|
|
1121
|
+
return `${pxOriginX} ${pxOriginY}`;
|
|
1122
|
+
}
|
|
1123
|
+
|
|
1124
|
+
const dashKeys = {
|
|
1125
|
+
offset: "stroke-dashoffset",
|
|
1126
|
+
array: "stroke-dasharray",
|
|
1127
|
+
};
|
|
1128
|
+
const camelKeys = {
|
|
1129
|
+
offset: "strokeDashoffset",
|
|
1130
|
+
array: "strokeDasharray",
|
|
1131
|
+
};
|
|
1132
|
+
/**
|
|
1133
|
+
* Build SVG path properties. Uses the path's measured length to convert
|
|
1134
|
+
* our custom pathLength, pathSpacing and pathOffset into stroke-dashoffset
|
|
1135
|
+
* and stroke-dasharray attributes.
|
|
1136
|
+
*
|
|
1137
|
+
* This function is mutative to reduce per-frame GC.
|
|
1138
|
+
*/
|
|
1139
|
+
function buildSVGPath(attrs, length, spacing = 1, offset = 0, useDashCase = true) {
|
|
1140
|
+
// Normalise path length by setting SVG attribute pathLength to 1
|
|
1141
|
+
attrs.pathLength = 1;
|
|
1142
|
+
// We use dash case when setting attributes directly to the DOM node and camel case
|
|
1143
|
+
// when defining props on a React component.
|
|
1144
|
+
const keys = useDashCase ? dashKeys : camelKeys;
|
|
1145
|
+
// Build the dash offset
|
|
1146
|
+
attrs[keys.offset] = px.transform(-offset);
|
|
1147
|
+
// Build the dash array
|
|
1148
|
+
const pathLength = px.transform(length);
|
|
1149
|
+
const pathSpacing = px.transform(spacing);
|
|
1150
|
+
attrs[keys.array] = `${pathLength} ${pathSpacing}`;
|
|
1151
|
+
}
|
|
1152
|
+
|
|
1153
|
+
/**
|
|
1154
|
+
* Build SVG visual attrbutes, like cx and style.transform
|
|
1155
|
+
*/
|
|
1156
|
+
function buildSVGAttrs(state, { attrX, attrY, attrScale, originX, originY, pathLength, pathSpacing = 1, pathOffset = 0,
|
|
1157
|
+
// This is object creation, which we try to avoid per-frame.
|
|
1158
|
+
...latest }, isSVGTag, transformTemplate) {
|
|
1159
|
+
buildHTMLStyles(state, latest, transformTemplate);
|
|
1160
|
+
/**
|
|
1161
|
+
* For svg tags we just want to make sure viewBox is animatable and treat all the styles
|
|
1162
|
+
* as normal HTML tags.
|
|
1163
|
+
*/
|
|
1164
|
+
if (isSVGTag) {
|
|
1165
|
+
if (state.style.viewBox) {
|
|
1166
|
+
state.attrs.viewBox = state.style.viewBox;
|
|
1167
|
+
}
|
|
1168
|
+
return;
|
|
1169
|
+
}
|
|
1170
|
+
state.attrs = state.style;
|
|
1171
|
+
state.style = {};
|
|
1172
|
+
const { attrs, style, dimensions } = state;
|
|
1173
|
+
/**
|
|
1174
|
+
* However, we apply transforms as CSS transforms. So if we detect a transform we take it from attrs
|
|
1175
|
+
* and copy it into style.
|
|
1176
|
+
*/
|
|
1177
|
+
if (attrs.transform) {
|
|
1178
|
+
if (dimensions)
|
|
1179
|
+
style.transform = attrs.transform;
|
|
1180
|
+
delete attrs.transform;
|
|
1181
|
+
}
|
|
1182
|
+
// Parse transformOrigin
|
|
1183
|
+
if (dimensions &&
|
|
1184
|
+
(originX !== undefined || originY !== undefined || style.transform)) {
|
|
1185
|
+
style.transformOrigin = calcSVGTransformOrigin(dimensions, originX !== undefined ? originX : 0.5, originY !== undefined ? originY : 0.5);
|
|
1186
|
+
}
|
|
1187
|
+
// Render attrX/attrY/attrScale as attributes
|
|
1188
|
+
if (attrX !== undefined)
|
|
1189
|
+
attrs.x = attrX;
|
|
1190
|
+
if (attrY !== undefined)
|
|
1191
|
+
attrs.y = attrY;
|
|
1192
|
+
if (attrScale !== undefined)
|
|
1193
|
+
attrs.scale = attrScale;
|
|
1194
|
+
// Build SVG path if one has been defined
|
|
1195
|
+
if (pathLength !== undefined) {
|
|
1196
|
+
buildSVGPath(attrs, pathLength, pathSpacing, pathOffset, false);
|
|
1197
|
+
}
|
|
1198
|
+
}
|
|
1199
|
+
|
|
1200
|
+
const isSVGTag = (tag) => typeof tag === "string" && tag.toLowerCase() === "svg";
|
|
1201
|
+
|
|
1202
|
+
const { schedule: frame, cancel: cancelFrame, state: frameData, steps: frameSteps, } = createRenderBatcher(typeof requestAnimationFrame !== "undefined" ? requestAnimationFrame : noop, true);
|
|
1203
|
+
|
|
1204
|
+
const svgMotionConfig = {
|
|
1205
|
+
useVisualState: makeUseVisualState({
|
|
1206
|
+
scrapeMotionValuesFromProps: scrapeMotionValuesFromProps,
|
|
1207
|
+
createRenderState: createSvgRenderState,
|
|
1208
|
+
onMount: (props, instance, { renderState, latestValues }) => {
|
|
1209
|
+
frame.read(() => {
|
|
1210
|
+
try {
|
|
1211
|
+
renderState.dimensions =
|
|
1212
|
+
typeof instance.getBBox ===
|
|
1213
|
+
"function"
|
|
1214
|
+
? instance.getBBox()
|
|
1215
|
+
: instance.getBoundingClientRect();
|
|
1216
|
+
}
|
|
1217
|
+
catch (e) {
|
|
1218
|
+
// Most likely trying to measure an unrendered element under Firefox
|
|
1219
|
+
renderState.dimensions = {
|
|
1220
|
+
x: 0,
|
|
1221
|
+
y: 0,
|
|
1222
|
+
width: 0,
|
|
1223
|
+
height: 0,
|
|
1224
|
+
};
|
|
1225
|
+
}
|
|
1226
|
+
});
|
|
1227
|
+
frame.render(() => {
|
|
1228
|
+
buildSVGAttrs(renderState, latestValues, isSVGTag(instance.tagName), props.transformTemplate);
|
|
1229
|
+
renderSVG(instance, renderState);
|
|
1230
|
+
});
|
|
1231
|
+
},
|
|
1232
|
+
}),
|
|
1233
|
+
};
|
|
1234
|
+
|
|
1235
|
+
const htmlMotionConfig = {
|
|
1236
|
+
useVisualState: makeUseVisualState({
|
|
1237
|
+
scrapeMotionValuesFromProps: scrapeMotionValuesFromProps$1,
|
|
1238
|
+
createRenderState: createHtmlRenderState,
|
|
1239
|
+
}),
|
|
1240
|
+
};
|
|
1241
|
+
|
|
1242
|
+
function copyRawValuesOnly(target, source, props) {
|
|
1243
|
+
for (const key in source) {
|
|
1244
|
+
if (!isMotionValue(source[key]) && !isForcedMotionValue(key, props)) {
|
|
1245
|
+
target[key] = source[key];
|
|
1246
|
+
}
|
|
1247
|
+
}
|
|
1248
|
+
}
|
|
1249
|
+
function useInitialMotionValues({ transformTemplate }, visualState) {
|
|
1250
|
+
return react.useMemo(() => {
|
|
1251
|
+
const state = createHtmlRenderState();
|
|
1252
|
+
buildHTMLStyles(state, visualState, transformTemplate);
|
|
1253
|
+
return Object.assign({}, state.vars, state.style);
|
|
1254
|
+
}, [visualState]);
|
|
1255
|
+
}
|
|
1256
|
+
function useStyle(props, visualState) {
|
|
1257
|
+
const styleProp = props.style || {};
|
|
1258
|
+
const style = {};
|
|
1259
|
+
/**
|
|
1260
|
+
* Copy non-Motion Values straight into style
|
|
1261
|
+
*/
|
|
1262
|
+
copyRawValuesOnly(style, styleProp, props);
|
|
1263
|
+
Object.assign(style, useInitialMotionValues(props, visualState));
|
|
1264
|
+
return style;
|
|
1265
|
+
}
|
|
1266
|
+
function useHTMLProps(props, visualState) {
|
|
1267
|
+
// The `any` isn't ideal but it is the type of createElement props argument
|
|
1268
|
+
const htmlProps = {};
|
|
1269
|
+
const style = useStyle(props, visualState);
|
|
1270
|
+
if (props.drag && props.dragListener !== false) {
|
|
1271
|
+
// Disable the ghost element when a user drags
|
|
1272
|
+
htmlProps.draggable = false;
|
|
1273
|
+
// Disable text selection
|
|
1274
|
+
style.userSelect =
|
|
1275
|
+
style.WebkitUserSelect =
|
|
1276
|
+
style.WebkitTouchCallout =
|
|
1277
|
+
"none";
|
|
1278
|
+
// Disable scrolling on the draggable direction
|
|
1279
|
+
style.touchAction =
|
|
1280
|
+
props.drag === true
|
|
1281
|
+
? "none"
|
|
1282
|
+
: `pan-${props.drag === "x" ? "y" : "x"}`;
|
|
1283
|
+
}
|
|
1284
|
+
if (props.tabIndex === undefined &&
|
|
1285
|
+
(props.onTap || props.onTapStart || props.whileTap)) {
|
|
1286
|
+
htmlProps.tabIndex = 0;
|
|
1287
|
+
}
|
|
1288
|
+
htmlProps.style = style;
|
|
1289
|
+
return htmlProps;
|
|
1290
|
+
}
|
|
1291
|
+
|
|
1292
|
+
/**
|
|
1293
|
+
* A list of all valid MotionProps.
|
|
1294
|
+
*
|
|
1295
|
+
* @privateRemarks
|
|
1296
|
+
* This doesn't throw if a `MotionProp` name is missing - it should.
|
|
1297
|
+
*/
|
|
1298
|
+
const validMotionProps = new Set([
|
|
1299
|
+
"animate",
|
|
1300
|
+
"exit",
|
|
1301
|
+
"variants",
|
|
1302
|
+
"initial",
|
|
1303
|
+
"style",
|
|
1304
|
+
"values",
|
|
1305
|
+
"variants",
|
|
1306
|
+
"transition",
|
|
1307
|
+
"transformTemplate",
|
|
1308
|
+
"custom",
|
|
1309
|
+
"inherit",
|
|
1310
|
+
"onBeforeLayoutMeasure",
|
|
1311
|
+
"onAnimationStart",
|
|
1312
|
+
"onAnimationComplete",
|
|
1313
|
+
"onUpdate",
|
|
1314
|
+
"onDragStart",
|
|
1315
|
+
"onDrag",
|
|
1316
|
+
"onDragEnd",
|
|
1317
|
+
"onMeasureDragConstraints",
|
|
1318
|
+
"onDirectionLock",
|
|
1319
|
+
"onDragTransitionEnd",
|
|
1320
|
+
"_dragX",
|
|
1321
|
+
"_dragY",
|
|
1322
|
+
"onHoverStart",
|
|
1323
|
+
"onHoverEnd",
|
|
1324
|
+
"onViewportEnter",
|
|
1325
|
+
"onViewportLeave",
|
|
1326
|
+
"globalTapTarget",
|
|
1327
|
+
"ignoreStrict",
|
|
1328
|
+
"viewport",
|
|
1329
|
+
]);
|
|
1330
|
+
/**
|
|
1331
|
+
* Check whether a prop name is a valid `MotionProp` key.
|
|
1332
|
+
*
|
|
1333
|
+
* @param key - Name of the property to check
|
|
1334
|
+
* @returns `true` is key is a valid `MotionProp`.
|
|
1335
|
+
*
|
|
1336
|
+
* @public
|
|
1337
|
+
*/
|
|
1338
|
+
function isValidMotionProp(key) {
|
|
1339
|
+
return (key.startsWith("while") ||
|
|
1340
|
+
(key.startsWith("drag") && key !== "draggable") ||
|
|
1341
|
+
key.startsWith("layout") ||
|
|
1342
|
+
key.startsWith("onTap") ||
|
|
1343
|
+
key.startsWith("onPan") ||
|
|
1344
|
+
key.startsWith("onLayout") ||
|
|
1345
|
+
validMotionProps.has(key));
|
|
1346
|
+
}
|
|
1347
|
+
|
|
1348
|
+
let shouldForward = (key) => !isValidMotionProp(key);
|
|
1349
|
+
function loadExternalIsValidProp(isValidProp) {
|
|
1350
|
+
if (!isValidProp)
|
|
1351
|
+
return;
|
|
1352
|
+
// Explicitly filter our events
|
|
1353
|
+
shouldForward = (key) => key.startsWith("on") ? !isValidMotionProp(key) : isValidProp(key);
|
|
1354
|
+
}
|
|
1355
|
+
/**
|
|
1356
|
+
* Emotion and Styled Components both allow users to pass through arbitrary props to their components
|
|
1357
|
+
* to dynamically generate CSS. They both use the `@emotion/is-prop-valid` package to determine which
|
|
1358
|
+
* of these should be passed to the underlying DOM node.
|
|
1359
|
+
*
|
|
1360
|
+
* However, when styling a Motion component `styled(motion.div)`, both packages pass through *all* props
|
|
1361
|
+
* as it's seen as an arbitrary component rather than a DOM node. Motion only allows arbitrary props
|
|
1362
|
+
* passed through the `custom` prop so it doesn't *need* the payload or computational overhead of
|
|
1363
|
+
* `@emotion/is-prop-valid`, however to fix this problem we need to use it.
|
|
1364
|
+
*
|
|
1365
|
+
* By making it an optionalDependency we can offer this functionality only in the situations where it's
|
|
1366
|
+
* actually required.
|
|
1367
|
+
*/
|
|
1368
|
+
try {
|
|
1369
|
+
/**
|
|
1370
|
+
* We attempt to import this package but require won't be defined in esm environments, in that case
|
|
1371
|
+
* isPropValid will have to be provided via `MotionContext`. In a 6.0.0 this should probably be removed
|
|
1372
|
+
* in favour of explicit injection.
|
|
1373
|
+
*/
|
|
1374
|
+
loadExternalIsValidProp(require("@emotion/is-prop-valid").default);
|
|
1375
|
+
}
|
|
1376
|
+
catch (_a) {
|
|
1377
|
+
// We don't need to actually do anything here - the fallback is the existing `isPropValid`.
|
|
1378
|
+
}
|
|
1379
|
+
function filterProps(props, isDom, forwardMotionProps) {
|
|
1380
|
+
const filteredProps = {};
|
|
1381
|
+
for (const key in props) {
|
|
1382
|
+
/**
|
|
1383
|
+
* values is considered a valid prop by Emotion, so if it's present
|
|
1384
|
+
* this will be rendered out to the DOM unless explicitly filtered.
|
|
1385
|
+
*
|
|
1386
|
+
* We check the type as it could be used with the `feColorMatrix`
|
|
1387
|
+
* element, which we support.
|
|
1388
|
+
*/
|
|
1389
|
+
if (key === "values" && typeof props.values === "object")
|
|
1390
|
+
continue;
|
|
1391
|
+
if (shouldForward(key) ||
|
|
1392
|
+
(forwardMotionProps === true && isValidMotionProp(key)) ||
|
|
1393
|
+
(!isDom && !isValidMotionProp(key)) ||
|
|
1394
|
+
// If trying to use native HTML drag events, forward drag listeners
|
|
1395
|
+
(props["draggable"] &&
|
|
1396
|
+
key.startsWith("onDrag"))) {
|
|
1397
|
+
filteredProps[key] =
|
|
1398
|
+
props[key];
|
|
1399
|
+
}
|
|
1400
|
+
}
|
|
1401
|
+
return filteredProps;
|
|
1402
|
+
}
|
|
1403
|
+
|
|
1404
|
+
function useSVGProps(props, visualState, _isStatic, Component) {
|
|
1405
|
+
const visualProps = react.useMemo(() => {
|
|
1406
|
+
const state = createSvgRenderState();
|
|
1407
|
+
buildSVGAttrs(state, visualState, isSVGTag(Component), props.transformTemplate);
|
|
1408
|
+
return {
|
|
1409
|
+
...state.attrs,
|
|
1410
|
+
style: { ...state.style },
|
|
1411
|
+
};
|
|
1412
|
+
}, [visualState]);
|
|
1413
|
+
if (props.style) {
|
|
1414
|
+
const rawStyles = {};
|
|
1415
|
+
copyRawValuesOnly(rawStyles, props.style, props);
|
|
1416
|
+
visualProps.style = { ...rawStyles, ...visualProps.style };
|
|
1417
|
+
}
|
|
1418
|
+
return visualProps;
|
|
1419
|
+
}
|
|
1420
|
+
|
|
1421
|
+
function createUseRender(forwardMotionProps = false) {
|
|
1422
|
+
const useRender = (Component, props, ref, { latestValues }, isStatic) => {
|
|
1423
|
+
const useVisualProps = isSVGComponent(Component)
|
|
1424
|
+
? useSVGProps
|
|
1425
|
+
: useHTMLProps;
|
|
1426
|
+
const visualProps = useVisualProps(props, latestValues, isStatic, Component);
|
|
1427
|
+
const filteredProps = filterProps(props, typeof Component === "string", forwardMotionProps);
|
|
1428
|
+
const elementProps = Component !== react.Fragment
|
|
1429
|
+
? { ...filteredProps, ...visualProps, ref }
|
|
1430
|
+
: {};
|
|
1431
|
+
/**
|
|
1432
|
+
* If component has been handed a motion value as its child,
|
|
1433
|
+
* memoise its initial value and render that. Subsequent updates
|
|
1434
|
+
* will be handled by the onChange handler
|
|
1435
|
+
*/
|
|
1436
|
+
const { children } = props;
|
|
1437
|
+
const renderedChildren = react.useMemo(() => (isMotionValue(children) ? children.get() : children), [children]);
|
|
1438
|
+
return react.createElement(Component, {
|
|
1439
|
+
...elementProps,
|
|
1440
|
+
children: renderedChildren,
|
|
1441
|
+
});
|
|
1442
|
+
};
|
|
1443
|
+
return useRender;
|
|
1444
|
+
}
|
|
1445
|
+
|
|
1446
|
+
function createMotionComponentFactory(preloadedFeatures, createVisualElement) {
|
|
1447
|
+
return function createMotionComponent(Component, { forwardMotionProps } = { forwardMotionProps: false }) {
|
|
1448
|
+
const baseConfig = isSVGComponent(Component)
|
|
1449
|
+
? svgMotionConfig
|
|
1450
|
+
: htmlMotionConfig;
|
|
1451
|
+
const config = {
|
|
1452
|
+
...baseConfig,
|
|
1453
|
+
preloadedFeatures,
|
|
1454
|
+
useRender: createUseRender(forwardMotionProps),
|
|
1455
|
+
createVisualElement,
|
|
1456
|
+
Component,
|
|
1457
|
+
};
|
|
1458
|
+
return createRendererMotionComponent(config);
|
|
1459
|
+
};
|
|
1460
|
+
}
|
|
1461
|
+
|
|
1462
|
+
const createMinimalMotionComponent =
|
|
1463
|
+
/*@__PURE__*/ createMotionComponentFactory();
|
|
1464
|
+
|
|
1465
|
+
/**
|
|
1466
|
+
* HTML components
|
|
1467
|
+
*/
|
|
1468
|
+
const MotionA = /*@__PURE__*/ createMinimalMotionComponent("a");
|
|
1469
|
+
const MotionAbbr = /*@__PURE__*/ createMinimalMotionComponent("abbr");
|
|
1470
|
+
const MotionAddress =
|
|
1471
|
+
/*@__PURE__*/ createMinimalMotionComponent("address");
|
|
1472
|
+
const MotionArea = /*@__PURE__*/ createMinimalMotionComponent("area");
|
|
1473
|
+
const MotionArticle =
|
|
1474
|
+
/*@__PURE__*/ createMinimalMotionComponent("article");
|
|
1475
|
+
const MotionAside = /*@__PURE__*/ createMinimalMotionComponent("aside");
|
|
1476
|
+
const MotionAudio = /*@__PURE__*/ createMinimalMotionComponent("audio");
|
|
1477
|
+
const MotionB = /*@__PURE__*/ createMinimalMotionComponent("b");
|
|
1478
|
+
const MotionBase = /*@__PURE__*/ createMinimalMotionComponent("base");
|
|
1479
|
+
const MotionBdi = /*@__PURE__*/ createMinimalMotionComponent("bdi");
|
|
1480
|
+
const MotionBdo = /*@__PURE__*/ createMinimalMotionComponent("bdo");
|
|
1481
|
+
const MotionBig = /*@__PURE__*/ createMinimalMotionComponent("big");
|
|
1482
|
+
const MotionBlockquote =
|
|
1483
|
+
/*@__PURE__*/ createMinimalMotionComponent("blockquote");
|
|
1484
|
+
const MotionBody = /*@__PURE__*/ createMinimalMotionComponent("body");
|
|
1485
|
+
const MotionButton = /*@__PURE__*/ createMinimalMotionComponent("button");
|
|
1486
|
+
const MotionCanvas = /*@__PURE__*/ createMinimalMotionComponent("canvas");
|
|
1487
|
+
const MotionCaption =
|
|
1488
|
+
/*@__PURE__*/ createMinimalMotionComponent("caption");
|
|
1489
|
+
const MotionCite = /*@__PURE__*/ createMinimalMotionComponent("cite");
|
|
1490
|
+
const MotionCode = /*@__PURE__*/ createMinimalMotionComponent("code");
|
|
1491
|
+
const MotionCol = /*@__PURE__*/ createMinimalMotionComponent("col");
|
|
1492
|
+
const MotionColgroup =
|
|
1493
|
+
/*@__PURE__*/ createMinimalMotionComponent("colgroup");
|
|
1494
|
+
const MotionData = /*@__PURE__*/ createMinimalMotionComponent("data");
|
|
1495
|
+
const MotionDatalist =
|
|
1496
|
+
/*@__PURE__*/ createMinimalMotionComponent("datalist");
|
|
1497
|
+
const MotionDd = /*@__PURE__*/ createMinimalMotionComponent("dd");
|
|
1498
|
+
const MotionDel = /*@__PURE__*/ createMinimalMotionComponent("del");
|
|
1499
|
+
const MotionDetails =
|
|
1500
|
+
/*@__PURE__*/ createMinimalMotionComponent("details");
|
|
1501
|
+
const MotionDfn = /*@__PURE__*/ createMinimalMotionComponent("dfn");
|
|
1502
|
+
const MotionDialog = /*@__PURE__*/ createMinimalMotionComponent("dialog");
|
|
1503
|
+
const MotionDiv = /*@__PURE__*/ createMinimalMotionComponent("div");
|
|
1504
|
+
const MotionDl = /*@__PURE__*/ createMinimalMotionComponent("dl");
|
|
1505
|
+
const MotionDt = /*@__PURE__*/ createMinimalMotionComponent("dt");
|
|
1506
|
+
const MotionEm = /*@__PURE__*/ createMinimalMotionComponent("em");
|
|
1507
|
+
const MotionEmbed = /*@__PURE__*/ createMinimalMotionComponent("embed");
|
|
1508
|
+
const MotionFieldset =
|
|
1509
|
+
/*@__PURE__*/ createMinimalMotionComponent("fieldset");
|
|
1510
|
+
const MotionFigcaption =
|
|
1511
|
+
/*@__PURE__*/ createMinimalMotionComponent("figcaption");
|
|
1512
|
+
const MotionFigure = /*@__PURE__*/ createMinimalMotionComponent("figure");
|
|
1513
|
+
const MotionFooter = /*@__PURE__*/ createMinimalMotionComponent("footer");
|
|
1514
|
+
const MotionForm = /*@__PURE__*/ createMinimalMotionComponent("form");
|
|
1515
|
+
const MotionH1 = /*@__PURE__*/ createMinimalMotionComponent("h1");
|
|
1516
|
+
const MotionH2 = /*@__PURE__*/ createMinimalMotionComponent("h2");
|
|
1517
|
+
const MotionH3 = /*@__PURE__*/ createMinimalMotionComponent("h3");
|
|
1518
|
+
const MotionH4 = /*@__PURE__*/ createMinimalMotionComponent("h4");
|
|
1519
|
+
const MotionH5 = /*@__PURE__*/ createMinimalMotionComponent("h5");
|
|
1520
|
+
const MotionH6 = /*@__PURE__*/ createMinimalMotionComponent("h6");
|
|
1521
|
+
const MotionHead = /*@__PURE__*/ createMinimalMotionComponent("head");
|
|
1522
|
+
const MotionHeader = /*@__PURE__*/ createMinimalMotionComponent("header");
|
|
1523
|
+
const MotionHgroup = /*@__PURE__*/ createMinimalMotionComponent("hgroup");
|
|
1524
|
+
const MotionHr = /*@__PURE__*/ createMinimalMotionComponent("hr");
|
|
1525
|
+
const MotionHtml = /*@__PURE__*/ createMinimalMotionComponent("html");
|
|
1526
|
+
const MotionI = /*@__PURE__*/ createMinimalMotionComponent("i");
|
|
1527
|
+
const MotionIframe = /*@__PURE__*/ createMinimalMotionComponent("iframe");
|
|
1528
|
+
const MotionImg = /*@__PURE__*/ createMinimalMotionComponent("img");
|
|
1529
|
+
const MotionInput = /*@__PURE__*/ createMinimalMotionComponent("input");
|
|
1530
|
+
const MotionIns = /*@__PURE__*/ createMinimalMotionComponent("ins");
|
|
1531
|
+
const MotionKbd = /*@__PURE__*/ createMinimalMotionComponent("kbd");
|
|
1532
|
+
const MotionKeygen = /*@__PURE__*/ createMinimalMotionComponent("keygen");
|
|
1533
|
+
const MotionLabel = /*@__PURE__*/ createMinimalMotionComponent("label");
|
|
1534
|
+
const MotionLegend = /*@__PURE__*/ createMinimalMotionComponent("legend");
|
|
1535
|
+
const MotionLi = /*@__PURE__*/ createMinimalMotionComponent("li");
|
|
1536
|
+
const MotionLink = /*@__PURE__*/ createMinimalMotionComponent("link");
|
|
1537
|
+
const MotionMain = /*@__PURE__*/ createMinimalMotionComponent("main");
|
|
1538
|
+
const MotionMap = /*@__PURE__*/ createMinimalMotionComponent("map");
|
|
1539
|
+
const MotionMark = /*@__PURE__*/ createMinimalMotionComponent("mark");
|
|
1540
|
+
const MotionMenu = /*@__PURE__*/ createMinimalMotionComponent("menu");
|
|
1541
|
+
const MotionMenuitem =
|
|
1542
|
+
/*@__PURE__*/ createMinimalMotionComponent("menuitem");
|
|
1543
|
+
const MotionMeter = /*@__PURE__*/ createMinimalMotionComponent("meter");
|
|
1544
|
+
const MotionNav = /*@__PURE__*/ createMinimalMotionComponent("nav");
|
|
1545
|
+
const MotionObject = /*@__PURE__*/ createMinimalMotionComponent("object");
|
|
1546
|
+
const MotionOl = /*@__PURE__*/ createMinimalMotionComponent("ol");
|
|
1547
|
+
const MotionOptgroup =
|
|
1548
|
+
/*@__PURE__*/ createMinimalMotionComponent("optgroup");
|
|
1549
|
+
const MotionOption = /*@__PURE__*/ createMinimalMotionComponent("option");
|
|
1550
|
+
const MotionOutput = /*@__PURE__*/ createMinimalMotionComponent("output");
|
|
1551
|
+
const MotionP = /*@__PURE__*/ createMinimalMotionComponent("p");
|
|
1552
|
+
const MotionParam = /*@__PURE__*/ createMinimalMotionComponent("param");
|
|
1553
|
+
const MotionPicture =
|
|
1554
|
+
/*@__PURE__*/ createMinimalMotionComponent("picture");
|
|
1555
|
+
const MotionPre = /*@__PURE__*/ createMinimalMotionComponent("pre");
|
|
1556
|
+
const MotionProgress =
|
|
1557
|
+
/*@__PURE__*/ createMinimalMotionComponent("progress");
|
|
1558
|
+
const MotionQ = /*@__PURE__*/ createMinimalMotionComponent("q");
|
|
1559
|
+
const MotionRp = /*@__PURE__*/ createMinimalMotionComponent("rp");
|
|
1560
|
+
const MotionRt = /*@__PURE__*/ createMinimalMotionComponent("rt");
|
|
1561
|
+
const MotionRuby = /*@__PURE__*/ createMinimalMotionComponent("ruby");
|
|
1562
|
+
const MotionS = /*@__PURE__*/ createMinimalMotionComponent("s");
|
|
1563
|
+
const MotionSamp = /*@__PURE__*/ createMinimalMotionComponent("samp");
|
|
1564
|
+
const MotionScript = /*@__PURE__*/ createMinimalMotionComponent("script");
|
|
1565
|
+
const MotionSection =
|
|
1566
|
+
/*@__PURE__*/ createMinimalMotionComponent("section");
|
|
1567
|
+
const MotionSelect = /*@__PURE__*/ createMinimalMotionComponent("select");
|
|
1568
|
+
const MotionSmall = /*@__PURE__*/ createMinimalMotionComponent("small");
|
|
1569
|
+
const MotionSource = /*@__PURE__*/ createMinimalMotionComponent("source");
|
|
1570
|
+
const MotionSpan = /*@__PURE__*/ createMinimalMotionComponent("span");
|
|
1571
|
+
const MotionStrong = /*@__PURE__*/ createMinimalMotionComponent("strong");
|
|
1572
|
+
const MotionStyle = /*@__PURE__*/ createMinimalMotionComponent("style");
|
|
1573
|
+
const MotionSub = /*@__PURE__*/ createMinimalMotionComponent("sub");
|
|
1574
|
+
const MotionSummary =
|
|
1575
|
+
/*@__PURE__*/ createMinimalMotionComponent("summary");
|
|
1576
|
+
const MotionSup = /*@__PURE__*/ createMinimalMotionComponent("sup");
|
|
1577
|
+
const MotionTable = /*@__PURE__*/ createMinimalMotionComponent("table");
|
|
1578
|
+
const MotionTbody = /*@__PURE__*/ createMinimalMotionComponent("tbody");
|
|
1579
|
+
const MotionTd = /*@__PURE__*/ createMinimalMotionComponent("td");
|
|
1580
|
+
const MotionTextarea =
|
|
1581
|
+
/*@__PURE__*/ createMinimalMotionComponent("textarea");
|
|
1582
|
+
const MotionTfoot = /*@__PURE__*/ createMinimalMotionComponent("tfoot");
|
|
1583
|
+
const MotionTh = /*@__PURE__*/ createMinimalMotionComponent("th");
|
|
1584
|
+
const MotionThead = /*@__PURE__*/ createMinimalMotionComponent("thead");
|
|
1585
|
+
const MotionTime = /*@__PURE__*/ createMinimalMotionComponent("time");
|
|
1586
|
+
const MotionTitle = /*@__PURE__*/ createMinimalMotionComponent("title");
|
|
1587
|
+
const MotionTr = /*@__PURE__*/ createMinimalMotionComponent("tr");
|
|
1588
|
+
const MotionTrack = /*@__PURE__*/ createMinimalMotionComponent("track");
|
|
1589
|
+
const MotionU = /*@__PURE__*/ createMinimalMotionComponent("u");
|
|
1590
|
+
const MotionUl = /*@__PURE__*/ createMinimalMotionComponent("ul");
|
|
1591
|
+
const MotionVideo = /*@__PURE__*/ createMinimalMotionComponent("video");
|
|
1592
|
+
const MotionWbr = /*@__PURE__*/ createMinimalMotionComponent("wbr");
|
|
1593
|
+
const MotionWebview =
|
|
1594
|
+
/*@__PURE__*/ createMinimalMotionComponent("webview");
|
|
1595
|
+
/**
|
|
1596
|
+
* SVG components
|
|
1597
|
+
*/
|
|
1598
|
+
const MotionAnimate =
|
|
1599
|
+
/*@__PURE__*/ createMinimalMotionComponent("animate");
|
|
1600
|
+
const MotionCircle = /*@__PURE__*/ createMinimalMotionComponent("circle");
|
|
1601
|
+
const MotionDefs = /*@__PURE__*/ createMinimalMotionComponent("defs");
|
|
1602
|
+
const MotionDesc = /*@__PURE__*/ createMinimalMotionComponent("desc");
|
|
1603
|
+
const MotionEllipse =
|
|
1604
|
+
/*@__PURE__*/ createMinimalMotionComponent("ellipse");
|
|
1605
|
+
const MotionG = /*@__PURE__*/ createMinimalMotionComponent("g");
|
|
1606
|
+
const MotionImage = /*@__PURE__*/ createMinimalMotionComponent("image");
|
|
1607
|
+
const MotionLine = /*@__PURE__*/ createMinimalMotionComponent("line");
|
|
1608
|
+
const MotionFilter = /*@__PURE__*/ createMinimalMotionComponent("filter");
|
|
1609
|
+
const MotionMarker = /*@__PURE__*/ createMinimalMotionComponent("marker");
|
|
1610
|
+
const MotionMask = /*@__PURE__*/ createMinimalMotionComponent("mask");
|
|
1611
|
+
const MotionMetadata =
|
|
1612
|
+
/*@__PURE__*/ createMinimalMotionComponent("metadata");
|
|
1613
|
+
const MotionPath = /*@__PURE__*/ createMinimalMotionComponent("path");
|
|
1614
|
+
const MotionPattern =
|
|
1615
|
+
/*@__PURE__*/ createMinimalMotionComponent("pattern");
|
|
1616
|
+
const MotionPolygon =
|
|
1617
|
+
/*@__PURE__*/ createMinimalMotionComponent("polygon");
|
|
1618
|
+
const MotionPolyline =
|
|
1619
|
+
/*@__PURE__*/ createMinimalMotionComponent("polyline");
|
|
1620
|
+
const MotionRect = /*@__PURE__*/ createMinimalMotionComponent("rect");
|
|
1621
|
+
const MotionStop = /*@__PURE__*/ createMinimalMotionComponent("stop");
|
|
1622
|
+
const MotionSvg = /*@__PURE__*/ createMinimalMotionComponent("svg");
|
|
1623
|
+
const MotionSymbol = /*@__PURE__*/ createMinimalMotionComponent("symbol");
|
|
1624
|
+
const MotionText = /*@__PURE__*/ createMinimalMotionComponent("text");
|
|
1625
|
+
const MotionTspan = /*@__PURE__*/ createMinimalMotionComponent("tspan");
|
|
1626
|
+
const MotionUse = /*@__PURE__*/ createMinimalMotionComponent("use");
|
|
1627
|
+
const MotionView = /*@__PURE__*/ createMinimalMotionComponent("view");
|
|
1628
|
+
const MotionClipPath =
|
|
1629
|
+
/*@__PURE__*/ createMinimalMotionComponent("clipPath");
|
|
1630
|
+
const MotionFeBlend =
|
|
1631
|
+
/*@__PURE__*/ createMinimalMotionComponent("feBlend");
|
|
1632
|
+
const MotionFeColorMatrix =
|
|
1633
|
+
/*@__PURE__*/ createMinimalMotionComponent("feColorMatrix");
|
|
1634
|
+
const MotionFeComponentTransfer =
|
|
1635
|
+
/*@__PURE__*/ createMinimalMotionComponent("feComponentTransfer");
|
|
1636
|
+
const MotionFeComposite =
|
|
1637
|
+
/*@__PURE__*/ createMinimalMotionComponent("feComposite");
|
|
1638
|
+
const MotionFeConvolveMatrix =
|
|
1639
|
+
/*@__PURE__*/ createMinimalMotionComponent("feConvolveMatrix");
|
|
1640
|
+
const MotionFeDiffuseLighting =
|
|
1641
|
+
/*@__PURE__*/ createMinimalMotionComponent("feDiffuseLighting");
|
|
1642
|
+
const MotionFeDisplacementMap =
|
|
1643
|
+
/*@__PURE__*/ createMinimalMotionComponent("feDisplacementMap");
|
|
1644
|
+
const MotionFeDistantLight =
|
|
1645
|
+
/*@__PURE__*/ createMinimalMotionComponent("feDistantLight");
|
|
1646
|
+
const MotionFeDropShadow =
|
|
1647
|
+
/*@__PURE__*/ createMinimalMotionComponent("feDropShadow");
|
|
1648
|
+
const MotionFeFlood =
|
|
1649
|
+
/*@__PURE__*/ createMinimalMotionComponent("feFlood");
|
|
1650
|
+
const MotionFeFuncA =
|
|
1651
|
+
/*@__PURE__*/ createMinimalMotionComponent("feFuncA");
|
|
1652
|
+
const MotionFeFuncB =
|
|
1653
|
+
/*@__PURE__*/ createMinimalMotionComponent("feFuncB");
|
|
1654
|
+
const MotionFeFuncG =
|
|
1655
|
+
/*@__PURE__*/ createMinimalMotionComponent("feFuncG");
|
|
1656
|
+
const MotionFeFuncR =
|
|
1657
|
+
/*@__PURE__*/ createMinimalMotionComponent("feFuncR");
|
|
1658
|
+
const MotionFeGaussianBlur =
|
|
1659
|
+
/*@__PURE__*/ createMinimalMotionComponent("feGaussianBlur");
|
|
1660
|
+
const MotionFeImage =
|
|
1661
|
+
/*@__PURE__*/ createMinimalMotionComponent("feImage");
|
|
1662
|
+
const MotionFeMerge =
|
|
1663
|
+
/*@__PURE__*/ createMinimalMotionComponent("feMerge");
|
|
1664
|
+
const MotionFeMergeNode =
|
|
1665
|
+
/*@__PURE__*/ createMinimalMotionComponent("feMergeNode");
|
|
1666
|
+
const MotionFeMorphology =
|
|
1667
|
+
/*@__PURE__*/ createMinimalMotionComponent("feMorphology");
|
|
1668
|
+
const MotionFeOffset =
|
|
1669
|
+
/*@__PURE__*/ createMinimalMotionComponent("feOffset");
|
|
1670
|
+
const MotionFePointLight =
|
|
1671
|
+
/*@__PURE__*/ createMinimalMotionComponent("fePointLight");
|
|
1672
|
+
const MotionFeSpecularLighting =
|
|
1673
|
+
/*@__PURE__*/ createMinimalMotionComponent("feSpecularLighting");
|
|
1674
|
+
const MotionFeSpotLight =
|
|
1675
|
+
/*@__PURE__*/ createMinimalMotionComponent("feSpotLight");
|
|
1676
|
+
const MotionFeTile = /*@__PURE__*/ createMinimalMotionComponent("feTile");
|
|
1677
|
+
const MotionFeTurbulence =
|
|
1678
|
+
/*@__PURE__*/ createMinimalMotionComponent("feTurbulence");
|
|
1679
|
+
const MotionForeignObject =
|
|
1680
|
+
/*@__PURE__*/ createMinimalMotionComponent("foreignObject");
|
|
1681
|
+
const MotionLinearGradient =
|
|
1682
|
+
/*@__PURE__*/ createMinimalMotionComponent("linearGradient");
|
|
1683
|
+
const MotionRadialGradient =
|
|
1684
|
+
/*@__PURE__*/ createMinimalMotionComponent("radialGradient");
|
|
1685
|
+
const MotionTextPath =
|
|
1686
|
+
/*@__PURE__*/ createMinimalMotionComponent("textPath");
|
|
1687
|
+
|
|
1688
|
+
exports.a = MotionA;
|
|
1689
|
+
exports.abbr = MotionAbbr;
|
|
1690
|
+
exports.address = MotionAddress;
|
|
1691
|
+
exports.animate = MotionAnimate;
|
|
1692
|
+
exports.area = MotionArea;
|
|
1693
|
+
exports.article = MotionArticle;
|
|
1694
|
+
exports.aside = MotionAside;
|
|
1695
|
+
exports.audio = MotionAudio;
|
|
1696
|
+
exports.b = MotionB;
|
|
1697
|
+
exports.base = MotionBase;
|
|
1698
|
+
exports.bdi = MotionBdi;
|
|
1699
|
+
exports.bdo = MotionBdo;
|
|
1700
|
+
exports.big = MotionBig;
|
|
1701
|
+
exports.blockquote = MotionBlockquote;
|
|
1702
|
+
exports.body = MotionBody;
|
|
1703
|
+
exports.button = MotionButton;
|
|
1704
|
+
exports.canvas = MotionCanvas;
|
|
1705
|
+
exports.caption = MotionCaption;
|
|
1706
|
+
exports.circle = MotionCircle;
|
|
1707
|
+
exports.cite = MotionCite;
|
|
1708
|
+
exports.clipPath = MotionClipPath;
|
|
1709
|
+
exports.code = MotionCode;
|
|
1710
|
+
exports.col = MotionCol;
|
|
1711
|
+
exports.colgroup = MotionColgroup;
|
|
1712
|
+
exports.create = createMinimalMotionComponent;
|
|
1713
|
+
exports.data = MotionData;
|
|
1714
|
+
exports.datalist = MotionDatalist;
|
|
1715
|
+
exports.dd = MotionDd;
|
|
1716
|
+
exports.defs = MotionDefs;
|
|
1717
|
+
exports.del = MotionDel;
|
|
1718
|
+
exports.desc = MotionDesc;
|
|
1719
|
+
exports.details = MotionDetails;
|
|
1720
|
+
exports.dfn = MotionDfn;
|
|
1721
|
+
exports.dialog = MotionDialog;
|
|
1722
|
+
exports.div = MotionDiv;
|
|
1723
|
+
exports.dl = MotionDl;
|
|
1724
|
+
exports.dt = MotionDt;
|
|
1725
|
+
exports.ellipse = MotionEllipse;
|
|
1726
|
+
exports.em = MotionEm;
|
|
1727
|
+
exports.embed = MotionEmbed;
|
|
1728
|
+
exports.feBlend = MotionFeBlend;
|
|
1729
|
+
exports.feColorMatrix = MotionFeColorMatrix;
|
|
1730
|
+
exports.feComponentTransfer = MotionFeComponentTransfer;
|
|
1731
|
+
exports.feComposite = MotionFeComposite;
|
|
1732
|
+
exports.feConvolveMatrix = MotionFeConvolveMatrix;
|
|
1733
|
+
exports.feDiffuseLighting = MotionFeDiffuseLighting;
|
|
1734
|
+
exports.feDisplacementMap = MotionFeDisplacementMap;
|
|
1735
|
+
exports.feDistantLight = MotionFeDistantLight;
|
|
1736
|
+
exports.feDropShadow = MotionFeDropShadow;
|
|
1737
|
+
exports.feFlood = MotionFeFlood;
|
|
1738
|
+
exports.feFuncA = MotionFeFuncA;
|
|
1739
|
+
exports.feFuncB = MotionFeFuncB;
|
|
1740
|
+
exports.feFuncG = MotionFeFuncG;
|
|
1741
|
+
exports.feFuncR = MotionFeFuncR;
|
|
1742
|
+
exports.feGaussianBlur = MotionFeGaussianBlur;
|
|
1743
|
+
exports.feImage = MotionFeImage;
|
|
1744
|
+
exports.feMerge = MotionFeMerge;
|
|
1745
|
+
exports.feMergeNode = MotionFeMergeNode;
|
|
1746
|
+
exports.feMorphology = MotionFeMorphology;
|
|
1747
|
+
exports.feOffset = MotionFeOffset;
|
|
1748
|
+
exports.fePointLight = MotionFePointLight;
|
|
1749
|
+
exports.feSpecularLighting = MotionFeSpecularLighting;
|
|
1750
|
+
exports.feSpotLight = MotionFeSpotLight;
|
|
1751
|
+
exports.feTile = MotionFeTile;
|
|
1752
|
+
exports.feTurbulence = MotionFeTurbulence;
|
|
1753
|
+
exports.fieldset = MotionFieldset;
|
|
1754
|
+
exports.figcaption = MotionFigcaption;
|
|
1755
|
+
exports.figure = MotionFigure;
|
|
1756
|
+
exports.filter = MotionFilter;
|
|
1757
|
+
exports.footer = MotionFooter;
|
|
1758
|
+
exports.foreignObject = MotionForeignObject;
|
|
1759
|
+
exports.form = MotionForm;
|
|
1760
|
+
exports.g = MotionG;
|
|
1761
|
+
exports.h1 = MotionH1;
|
|
1762
|
+
exports.h2 = MotionH2;
|
|
1763
|
+
exports.h3 = MotionH3;
|
|
1764
|
+
exports.h4 = MotionH4;
|
|
1765
|
+
exports.h5 = MotionH5;
|
|
1766
|
+
exports.h6 = MotionH6;
|
|
1767
|
+
exports.head = MotionHead;
|
|
1768
|
+
exports.header = MotionHeader;
|
|
1769
|
+
exports.hgroup = MotionHgroup;
|
|
1770
|
+
exports.hr = MotionHr;
|
|
1771
|
+
exports.html = MotionHtml;
|
|
1772
|
+
exports.i = MotionI;
|
|
1773
|
+
exports.iframe = MotionIframe;
|
|
1774
|
+
exports.image = MotionImage;
|
|
1775
|
+
exports.img = MotionImg;
|
|
1776
|
+
exports.input = MotionInput;
|
|
1777
|
+
exports.ins = MotionIns;
|
|
1778
|
+
exports.kbd = MotionKbd;
|
|
1779
|
+
exports.keygen = MotionKeygen;
|
|
1780
|
+
exports.label = MotionLabel;
|
|
1781
|
+
exports.legend = MotionLegend;
|
|
1782
|
+
exports.li = MotionLi;
|
|
1783
|
+
exports.line = MotionLine;
|
|
1784
|
+
exports.linearGradient = MotionLinearGradient;
|
|
1785
|
+
exports.link = MotionLink;
|
|
1786
|
+
exports.main = MotionMain;
|
|
1787
|
+
exports.map = MotionMap;
|
|
1788
|
+
exports.mark = MotionMark;
|
|
1789
|
+
exports.marker = MotionMarker;
|
|
1790
|
+
exports.mask = MotionMask;
|
|
1791
|
+
exports.menu = MotionMenu;
|
|
1792
|
+
exports.menuitem = MotionMenuitem;
|
|
1793
|
+
exports.metadata = MotionMetadata;
|
|
1794
|
+
exports.meter = MotionMeter;
|
|
1795
|
+
exports.nav = MotionNav;
|
|
1796
|
+
exports.object = MotionObject;
|
|
1797
|
+
exports.ol = MotionOl;
|
|
1798
|
+
exports.optgroup = MotionOptgroup;
|
|
1799
|
+
exports.option = MotionOption;
|
|
1800
|
+
exports.output = MotionOutput;
|
|
1801
|
+
exports.p = MotionP;
|
|
1802
|
+
exports.param = MotionParam;
|
|
1803
|
+
exports.path = MotionPath;
|
|
1804
|
+
exports.pattern = MotionPattern;
|
|
1805
|
+
exports.picture = MotionPicture;
|
|
1806
|
+
exports.polygon = MotionPolygon;
|
|
1807
|
+
exports.polyline = MotionPolyline;
|
|
1808
|
+
exports.pre = MotionPre;
|
|
1809
|
+
exports.progress = MotionProgress;
|
|
1810
|
+
exports.q = MotionQ;
|
|
1811
|
+
exports.radialGradient = MotionRadialGradient;
|
|
1812
|
+
exports.rect = MotionRect;
|
|
1813
|
+
exports.rp = MotionRp;
|
|
1814
|
+
exports.rt = MotionRt;
|
|
1815
|
+
exports.ruby = MotionRuby;
|
|
1816
|
+
exports.s = MotionS;
|
|
1817
|
+
exports.samp = MotionSamp;
|
|
1818
|
+
exports.script = MotionScript;
|
|
1819
|
+
exports.section = MotionSection;
|
|
1820
|
+
exports.select = MotionSelect;
|
|
1821
|
+
exports.small = MotionSmall;
|
|
1822
|
+
exports.source = MotionSource;
|
|
1823
|
+
exports.span = MotionSpan;
|
|
1824
|
+
exports.stop = MotionStop;
|
|
1825
|
+
exports.strong = MotionStrong;
|
|
1826
|
+
exports.style = MotionStyle;
|
|
1827
|
+
exports.sub = MotionSub;
|
|
1828
|
+
exports.summary = MotionSummary;
|
|
1829
|
+
exports.sup = MotionSup;
|
|
1830
|
+
exports.svg = MotionSvg;
|
|
1831
|
+
exports.symbol = MotionSymbol;
|
|
1832
|
+
exports.table = MotionTable;
|
|
1833
|
+
exports.tbody = MotionTbody;
|
|
1834
|
+
exports.td = MotionTd;
|
|
1835
|
+
exports.text = MotionText;
|
|
1836
|
+
exports.textPath = MotionTextPath;
|
|
1837
|
+
exports.textarea = MotionTextarea;
|
|
1838
|
+
exports.tfoot = MotionTfoot;
|
|
1839
|
+
exports.th = MotionTh;
|
|
1840
|
+
exports.thead = MotionThead;
|
|
1841
|
+
exports.time = MotionTime;
|
|
1842
|
+
exports.title = MotionTitle;
|
|
1843
|
+
exports.tr = MotionTr;
|
|
1844
|
+
exports.track = MotionTrack;
|
|
1845
|
+
exports.tspan = MotionTspan;
|
|
1846
|
+
exports.u = MotionU;
|
|
1847
|
+
exports.ul = MotionUl;
|
|
1848
|
+
exports.use = MotionUse;
|
|
1849
|
+
exports.video = MotionVideo;
|
|
1850
|
+
exports.view = MotionView;
|
|
1851
|
+
exports.wbr = MotionWbr;
|
|
1852
|
+
exports.webview = MotionWebview;
|