motion-v 0.2.6 → 0.3.1-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/index.js +5858 -0
- package/dist/es/animation/use-animate.mjs +31 -0
- package/dist/es/components/AnimatePresence.vue.mjs +71 -0
- package/dist/es/components/AnimatePresence.vue2.mjs +4 -0
- package/dist/es/components/Motion.vue.mjs +116 -0
- package/dist/es/components/Motion.vue2.mjs +4 -0
- package/dist/es/components/Primitive.mjs +29 -0
- package/dist/es/components/Slot.mjs +36 -0
- package/dist/es/components/context.mjs +6 -0
- package/dist/es/components/presence.mjs +16 -0
- package/dist/es/components/renderSlotFragments.mjs +13 -0
- package/dist/es/constants/index.mjs +20 -0
- package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/animation/GroupPlaybackControls.mjs +76 -0
- package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/animation/animate/index.mjs +27 -0
- package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/animation/animate/resolve-subjects.mjs +16 -0
- package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/animation/animate/sequence.mjs +14 -0
- package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/animation/animate/single-value.mjs +11 -0
- package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/animation/animate/subject.mjs +38 -0
- package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/animation/animators/AcceleratedAnimation.mjs +243 -0
- package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/animation/animators/BaseAnimation.mjs +95 -0
- package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/animation/animators/MainThreadAnimation.mjs +275 -0
- package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/animation/animators/drivers/driver-frameloop.mjs +17 -0
- package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/animation/animators/utils/accelerated-values.mjs +12 -0
- package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/animation/animators/utils/can-animate.mjs +30 -0
- package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/animation/animators/waapi/NativeAnimation.mjs +162 -0
- package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/animation/animators/waapi/animate-elements.mjs +31 -0
- package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/animation/animators/waapi/animate-style.mjs +13 -0
- package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/animation/animators/waapi/easing.mjs +37 -0
- package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/animation/animators/waapi/index.mjs +20 -0
- package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/animation/animators/waapi/utils/attach-timeline.mjs +7 -0
- package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/animation/animators/waapi/utils/get-final-keyframe.mjs +9 -0
- package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/animation/animators/waapi/utils/linear.mjs +13 -0
- package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/animation/animators/waapi/utils/memo-supports.mjs +12 -0
- package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/animation/animators/waapi/utils/style.mjs +10 -0
- package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/animation/animators/waapi/utils/supports-flags.mjs +6 -0
- package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/animation/animators/waapi/utils/supports-linear-easing.mjs +12 -0
- package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/animation/animators/waapi/utils/supports-partial-keyframes.mjs +12 -0
- package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/animation/animators/waapi/utils/supports-waapi.mjs +5 -0
- package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/animation/generators/inertia.mjs +67 -0
- package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/animation/generators/keyframes.mjs +37 -0
- package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/animation/generators/spring/find.mjs +83 -0
- package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/animation/generators/spring/index.mjs +83 -0
- package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/animation/generators/utils/calc-duration.mjs +15 -0
- package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/animation/generators/utils/is-generator.mjs +6 -0
- package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/animation/generators/utils/velocity.mjs +9 -0
- package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/animation/interfaces/motion-value.mjs +73 -0
- package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/animation/interfaces/visual-element-target.mjs +59 -0
- package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/animation/optimized-appear/data-id.mjs +7 -0
- package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/animation/optimized-appear/get-appear-id.mjs +7 -0
- package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/animation/sequence/create.mjs +153 -0
- package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/animation/sequence/utils/calc-time.mjs +15 -0
- package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/animation/sequence/utils/edit.mjs +26 -0
- package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/animation/sequence/utils/sort.mjs +14 -0
- package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/animation/utils/create-visual-element.mjs +43 -0
- package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/animation/utils/default-transitions.mjs +33 -0
- package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/animation/utils/get-value-transition.mjs +6 -0
- package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/animation/utils/is-animatable.mjs +16 -0
- package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/animation/utils/is-animation-controls.mjs +6 -0
- package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/animation/utils/is-dom-keyframes.mjs +6 -0
- package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/animation/utils/is-keyframes-target.mjs +6 -0
- package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/animation/utils/is-none.mjs +13 -0
- package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/animation/utils/is-transition-defined.mjs +6 -0
- package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/animation/utils/stagger.mjs +26 -0
- package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/easing/anticipate.mjs +5 -0
- package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/easing/back.mjs +11 -0
- package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/easing/circ.mjs +10 -0
- package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/easing/cubic-bezier.mjs +28 -0
- package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/easing/ease.mjs +9 -0
- package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/easing/modifiers/mirror.mjs +4 -0
- package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/easing/modifiers/reverse.mjs +4 -0
- package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/easing/steps.mjs +12 -0
- package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/easing/utils/create-generator-easing.mjs +14 -0
- package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/easing/utils/get-easing-for-segment.mjs +8 -0
- package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/easing/utils/is-bezier-definition.mjs +4 -0
- package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/easing/utils/is-easing-array.mjs +6 -0
- package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/easing/utils/map.mjs +35 -0
- package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/frameloop/batcher.mjs +75 -0
- package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/frameloop/frame.mjs +9 -0
- package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/frameloop/index-legacy.mjs +11 -0
- package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/frameloop/render-step.mjs +63 -0
- package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/frameloop/sync-time.mjs +21 -0
- package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/motion/features/definitions.mjs +29 -0
- package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/motion/utils/is-forced-motion-value.mjs +8 -0
- package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/projection/geometry/conversion.mjs +22 -0
- package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/projection/geometry/models.mjs +9 -0
- package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/projection/styles/scale-correction.mjs +4 -0
- package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/projection/utils/measure.mjs +7 -0
- package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/render/VisualElement.mjs +372 -0
- package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/render/dom/DOMKeyframesResolver.mjs +101 -0
- package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/render/dom/DOMVisualElement.mjs +21 -0
- package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/render/dom/resize/handle-element.mjs +62 -0
- package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/render/dom/resize/handle-window.mjs +31 -0
- package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/render/dom/resize/index.mjs +8 -0
- package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/render/dom/scroll/index.mjs +63 -0
- package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/render/dom/scroll/info.mjs +51 -0
- package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/render/dom/scroll/observe.mjs +18 -0
- package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/render/dom/scroll/offsets/edge.mjs +33 -0
- package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/render/dom/scroll/offsets/index.mjs +38 -0
- package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/render/dom/scroll/offsets/inset.mjs +36 -0
- package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/render/dom/scroll/offsets/offset.mjs +23 -0
- package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/render/dom/scroll/offsets/presets.mjs +21 -0
- package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/render/dom/scroll/on-scroll-handler.mjs +39 -0
- package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/render/dom/scroll/supports.mjs +5 -0
- package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/render/dom/scroll/track.mjs +67 -0
- package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/render/dom/utils/camel-to-dash.mjs +4 -0
- package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/render/dom/utils/css-variables-conversion.mjs +31 -0
- package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/render/dom/utils/is-css-variable.mjs +14 -0
- package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/render/dom/utils/is-svg-element.mjs +6 -0
- package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/render/dom/utils/resolve-element.mjs +23 -0
- package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/render/dom/utils/unit-conversion.mjs +65 -0
- package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/render/dom/value-types/animatable-none.mjs +12 -0
- package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/render/dom/value-types/defaults.mjs +25 -0
- package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/render/dom/value-types/dimensions.mjs +10 -0
- package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/render/dom/value-types/find.mjs +9 -0
- package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/render/dom/value-types/get-as-type.mjs +6 -0
- package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/render/dom/value-types/number-browser.mjs +41 -0
- package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/render/dom/value-types/number.mjs +18 -0
- package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/render/dom/value-types/test.mjs +4 -0
- package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/render/dom/value-types/transform.mjs +31 -0
- package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/render/dom/value-types/type-auto.mjs +7 -0
- package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/render/dom/value-types/type-int.mjs +8 -0
- package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/render/dom/viewport/index.mjs +37 -0
- package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/render/html/HTMLVisualElement.mjs +55 -0
- package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/render/html/utils/build-styles.mjs +42 -0
- package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/render/html/utils/build-transform.mjs +47 -0
- package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/render/html/utils/make-none-animatable.mjs +22 -0
- package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/render/html/utils/render.mjs +9 -0
- package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/render/html/utils/scrape-motion-values.mjs +16 -0
- package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/render/html/utils/transform.mjs +24 -0
- package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/render/object/ObjectVisualElement.mjs +41 -0
- package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/render/store.mjs +4 -0
- package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/render/svg/SVGVisualElement.mjs +45 -0
- package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/render/svg/utils/build-attrs.mjs +46 -0
- package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/render/svg/utils/camel-case-attrs.mjs +28 -0
- package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/render/svg/utils/is-svg-tag.mjs +4 -0
- package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/render/svg/utils/path.mjs +20 -0
- package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/render/svg/utils/render.mjs +12 -0
- package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/render/svg/utils/scrape-motion-values.mjs +16 -0
- package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/render/svg/utils/transform-origin.mjs +12 -0
- package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/render/utils/KeyframesResolver.mjs +134 -0
- package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/render/utils/is-controlling-variants.mjs +13 -0
- package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/render/utils/is-variant-label.mjs +6 -0
- package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/render/utils/motion-values.mjs +37 -0
- package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/render/utils/resolve-dynamic-variants.mjs +8 -0
- package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/render/utils/resolve-variants.mjs +25 -0
- package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/render/utils/setters.mjs +22 -0
- package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/render/utils/variant-props.mjs +14 -0
- package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/utils/GlobalConfig.mjs +7 -0
- package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/utils/array.mjs +13 -0
- package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/utils/clamp.mjs +10 -0
- package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/utils/delay.mjs +22 -0
- package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/utils/distance.mjs +10 -0
- package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/utils/errors.mjs +19 -0
- package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/utils/hsla-to-rgba.mjs +39 -0
- package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/utils/interpolate.mjs +49 -0
- package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/utils/is-browser.mjs +4 -0
- package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/utils/is-numerical-string.mjs +4 -0
- package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/utils/is-zero-value-string.mjs +4 -0
- package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/utils/memo.mjs +11 -0
- package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/utils/mix/color.mjs +44 -0
- package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/utils/mix/complex.mjs +84 -0
- package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/utils/mix/immediate.mjs +6 -0
- package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/utils/mix/index.mjs +12 -0
- package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/utils/mix/number.mjs +6 -0
- package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/utils/mix/visibility.mjs +12 -0
- package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/utils/noop.mjs +4 -0
- package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/utils/offsets/default.mjs +9 -0
- package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/utils/offsets/fill.mjs +12 -0
- package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/utils/offsets/time.mjs +6 -0
- package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/utils/pipe.mjs +5 -0
- package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/utils/progress.mjs +7 -0
- package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/utils/reduced-motion/index.mjs +18 -0
- package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/utils/reduced-motion/state.mjs +6 -0
- package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/utils/resolve-value.mjs +7 -0
- package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/utils/subscription-manager.mjs +32 -0
- package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/utils/time-conversion.mjs +6 -0
- package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/utils/transform.mjs +21 -0
- package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/utils/velocity-per-second.mjs +6 -0
- package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/utils/warn-once.mjs +10 -0
- package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/utils/wrap.mjs +7 -0
- package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/value/index.mjs +282 -0
- package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/value/types/color/hex.mjs +37 -0
- package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/value/types/color/hsla.mjs +14 -0
- package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/value/types/color/index.mjs +21 -0
- package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/value/types/color/rgba.mjs +18 -0
- package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/value/types/color/utils.mjs +21 -0
- package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/value/types/complex/filter.mjs +27 -0
- package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/value/types/complex/index.mjs +84 -0
- package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/value/types/numbers/index.mjs +19 -0
- package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/value/types/numbers/units.mjs +23 -0
- package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/value/types/utils/color-regex.mjs +4 -0
- package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/value/types/utils/float-regex.mjs +4 -0
- package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/value/types/utils/is-nullish.mjs +6 -0
- package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/value/types/utils/sanitize.mjs +4 -0
- package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/value/types/utils/single-color-regex.mjs +4 -0
- package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/value/use-will-change/add-will-change.mjs +10 -0
- package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/value/use-will-change/is.mjs +7 -0
- package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/value/utils/is-motion-value.mjs +4 -0
- package/dist/es/external/.pnpm/hey-listen@1.0.8/external/hey-listen/dist/hey-listen.es.mjs +20 -0
- package/dist/es/features/events.mjs +69 -0
- package/dist/es/features/feature-manager.mjs +29 -0
- package/dist/es/features/feature.mjs +10 -0
- package/dist/es/features/gestures/base.mjs +19 -0
- package/dist/es/features/gestures/hover.mjs +42 -0
- package/dist/es/features/gestures/in-view.mjs +35 -0
- package/dist/es/features/gestures/press.mjs +37 -0
- package/dist/es/features/svg.mjs +31 -0
- package/dist/es/index.mjs +104 -0
- package/dist/es/state/event.mjs +6 -0
- package/dist/es/state/motion-state.mjs +175 -0
- package/dist/es/state/schedule.mjs +30 -0
- package/dist/es/state/style.mjs +117 -0
- package/dist/es/state/transform.mjs +68 -0
- package/dist/es/state/utils.mjs +119 -0
- package/dist/es/utils/createContext.mjs +25 -0
- package/dist/es/utils/events.mjs +8 -0
- package/dist/es/utils/motion-value.mjs +6 -0
- package/dist/es/utils/use-animation-frame.mjs +20 -0
- package/dist/es/utils/use-in-view.mjs +25 -0
- package/dist/es/value/use-combine-values.mjs +27 -0
- package/dist/es/value/use-computed.mjs +20 -0
- package/dist/es/value/use-motion-template.mjs +22 -0
- package/dist/es/value/use-scroll.mjs +56 -0
- package/dist/es/value/use-spring.mjs +59 -0
- package/dist/es/value/use-time.mjs +10 -0
- package/dist/es/value/use-transform.mjs +29 -0
- package/dist/src/animation/index.d.ts +1 -0
- package/dist/src/animation/use-animate.d.ts +8 -0
- package/dist/src/components/Motion.d.ts +3 -3
- package/dist/src/features/events.d.ts +1 -1
- package/dist/src/features/feature-manager.d.ts +9 -0
- package/dist/src/features/feature.d.ts +0 -7
- package/dist/src/features/index.d.ts +2 -1
- package/dist/src/index.d.ts +3 -0
- package/dist/src/state/motion-state.d.ts +1 -1
- package/dist/src/state/utils.d.ts +1 -1
- package/dist/src/types/state.d.ts +3 -2
- package/dist/src/utils/index.d.ts +2 -0
- package/dist/src/utils/use-dom-ref.d.ts +1 -0
- package/dist/src/utils/use-in-view.d.ts +3 -0
- package/package.json +8 -7
- package/dist/index.js +0 -4011
- package/dist/index.umd.cjs +0 -1
- package/dist/src/components/usePrimitiveElement.d.ts +0 -5
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
import { startWaapiAnimation } from "./index.mjs";
|
|
2
|
+
import { createGeneratorEasing } from "../../../easing/utils/create-generator-easing.mjs";
|
|
3
|
+
import { browserNumberValueTypes } from "../../../render/dom/value-types/number-browser.mjs";
|
|
4
|
+
import { invariant } from "../../../utils/errors.mjs";
|
|
5
|
+
import { noop } from "../../../utils/noop.mjs";
|
|
6
|
+
import { secondsToMilliseconds, millisecondsToSeconds } from "../../../utils/time-conversion.mjs";
|
|
7
|
+
import { isGenerator } from "../../generators/utils/is-generator.mjs";
|
|
8
|
+
import { attachTimeline } from "./utils/attach-timeline.mjs";
|
|
9
|
+
import { getFinalKeyframe } from "./utils/get-final-keyframe.mjs";
|
|
10
|
+
import { setCSSVar, setStyle } from "./utils/style.mjs";
|
|
11
|
+
import { supportsLinearEasing } from "./utils/supports-linear-easing.mjs";
|
|
12
|
+
import { supportsPartialKeyframes } from "./utils/supports-partial-keyframes.mjs";
|
|
13
|
+
import { supportsWaapi } from "./utils/supports-waapi.mjs";
|
|
14
|
+
const state = /* @__PURE__ */ new WeakMap();
|
|
15
|
+
function hydrateKeyframes(valueName, keyframes, read) {
|
|
16
|
+
for (let i = 0; i < keyframes.length; i++) {
|
|
17
|
+
if (keyframes[i] === null) {
|
|
18
|
+
keyframes[i] = i === 0 ? read() : keyframes[i - 1];
|
|
19
|
+
}
|
|
20
|
+
if (typeof keyframes[i] === "number" && browserNumberValueTypes[valueName]) {
|
|
21
|
+
keyframes[i] = browserNumberValueTypes[valueName].transform(keyframes[i]);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
if (!supportsPartialKeyframes() && keyframes.length < 2) {
|
|
25
|
+
keyframes.unshift(read());
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
const defaultEasing = "easeOut";
|
|
29
|
+
function getElementAnimationState(element) {
|
|
30
|
+
const animationState = state.get(element) || /* @__PURE__ */ new Map();
|
|
31
|
+
state.set(element, animationState);
|
|
32
|
+
return state.get(element);
|
|
33
|
+
}
|
|
34
|
+
class NativeAnimation {
|
|
35
|
+
constructor(element, valueName, valueKeyframes, options) {
|
|
36
|
+
const isCSSVar = valueName.startsWith("--");
|
|
37
|
+
this.setValue = isCSSVar ? setCSSVar : setStyle;
|
|
38
|
+
this.options = options;
|
|
39
|
+
this.updateFinishedPromise();
|
|
40
|
+
invariant(typeof options.type !== "string", `animateMini doesn't support "type" as a string. Did you mean to import { spring } from "framer-motion"?`);
|
|
41
|
+
const existingAnimation = getElementAnimationState(element).get(valueName);
|
|
42
|
+
existingAnimation && existingAnimation.stop();
|
|
43
|
+
const readInitialKeyframe = () => {
|
|
44
|
+
return valueName.startsWith("--") ? element.style.getPropertyValue(valueName) : window.getComputedStyle(element)[valueName];
|
|
45
|
+
};
|
|
46
|
+
if (!Array.isArray(valueKeyframes)) {
|
|
47
|
+
valueKeyframes = [valueKeyframes];
|
|
48
|
+
}
|
|
49
|
+
hydrateKeyframes(valueName, valueKeyframes, readInitialKeyframe);
|
|
50
|
+
if (isGenerator(options.type)) {
|
|
51
|
+
const generatorOptions = createGeneratorEasing(options, 100, options.type);
|
|
52
|
+
options.ease = supportsLinearEasing() ? generatorOptions.ease : defaultEasing;
|
|
53
|
+
options.duration = secondsToMilliseconds(generatorOptions.duration);
|
|
54
|
+
options.type = "keyframes";
|
|
55
|
+
} else {
|
|
56
|
+
options.ease = options.ease || defaultEasing;
|
|
57
|
+
}
|
|
58
|
+
this.removeAnimation = () => {
|
|
59
|
+
var _a;
|
|
60
|
+
return (_a = state.get(element)) === null || _a === void 0 ? void 0 : _a.delete(valueName);
|
|
61
|
+
};
|
|
62
|
+
const onFinish = () => {
|
|
63
|
+
this.setValue(element, valueName, getFinalKeyframe(valueKeyframes, this.options));
|
|
64
|
+
this.cancel();
|
|
65
|
+
this.resolveFinishedPromise();
|
|
66
|
+
};
|
|
67
|
+
if (!supportsWaapi()) {
|
|
68
|
+
onFinish();
|
|
69
|
+
} else {
|
|
70
|
+
this.animation = startWaapiAnimation(element, valueName, valueKeyframes, options);
|
|
71
|
+
if (options.autoplay === false) {
|
|
72
|
+
this.animation.pause();
|
|
73
|
+
}
|
|
74
|
+
this.animation.onfinish = onFinish;
|
|
75
|
+
if (this.pendingTimeline) {
|
|
76
|
+
attachTimeline(this.animation, this.pendingTimeline);
|
|
77
|
+
}
|
|
78
|
+
getElementAnimationState(element).set(valueName, this);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
get duration() {
|
|
82
|
+
return millisecondsToSeconds(this.options.duration || 300);
|
|
83
|
+
}
|
|
84
|
+
get time() {
|
|
85
|
+
var _a;
|
|
86
|
+
if (this.animation) {
|
|
87
|
+
return millisecondsToSeconds(((_a = this.animation) === null || _a === void 0 ? void 0 : _a.currentTime) || 0);
|
|
88
|
+
}
|
|
89
|
+
return 0;
|
|
90
|
+
}
|
|
91
|
+
set time(newTime) {
|
|
92
|
+
if (this.animation) {
|
|
93
|
+
this.animation.currentTime = secondsToMilliseconds(newTime);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
get speed() {
|
|
97
|
+
return this.animation ? this.animation.playbackRate : 1;
|
|
98
|
+
}
|
|
99
|
+
set speed(newSpeed) {
|
|
100
|
+
if (this.animation) {
|
|
101
|
+
this.animation.playbackRate = newSpeed;
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
get state() {
|
|
105
|
+
return this.animation ? this.animation.playState : "finished";
|
|
106
|
+
}
|
|
107
|
+
get startTime() {
|
|
108
|
+
return this.animation ? this.animation.startTime : null;
|
|
109
|
+
}
|
|
110
|
+
play() {
|
|
111
|
+
if (this.state === "finished") {
|
|
112
|
+
this.updateFinishedPromise();
|
|
113
|
+
}
|
|
114
|
+
this.animation && this.animation.play();
|
|
115
|
+
}
|
|
116
|
+
pause() {
|
|
117
|
+
this.animation && this.animation.pause();
|
|
118
|
+
}
|
|
119
|
+
stop() {
|
|
120
|
+
if (!this.animation || this.state === "idle" || this.state === "finished") {
|
|
121
|
+
return;
|
|
122
|
+
}
|
|
123
|
+
if (this.animation.commitStyles) {
|
|
124
|
+
this.animation.commitStyles();
|
|
125
|
+
}
|
|
126
|
+
this.cancel();
|
|
127
|
+
}
|
|
128
|
+
complete() {
|
|
129
|
+
this.animation && this.animation.finish();
|
|
130
|
+
}
|
|
131
|
+
cancel() {
|
|
132
|
+
this.removeAnimation();
|
|
133
|
+
try {
|
|
134
|
+
this.animation && this.animation.cancel();
|
|
135
|
+
} catch (e) {
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
139
|
+
* Allows the returned animation to be awaited or promise-chained. Currently
|
|
140
|
+
* resolves when the animation finishes at all but in a future update could/should
|
|
141
|
+
* reject if its cancels.
|
|
142
|
+
*/
|
|
143
|
+
then(resolve, reject) {
|
|
144
|
+
return this.currentFinishedPromise.then(resolve, reject);
|
|
145
|
+
}
|
|
146
|
+
updateFinishedPromise() {
|
|
147
|
+
this.currentFinishedPromise = new Promise((resolve) => {
|
|
148
|
+
this.resolveFinishedPromise = resolve;
|
|
149
|
+
});
|
|
150
|
+
}
|
|
151
|
+
attachTimeline(timeline) {
|
|
152
|
+
if (!this.animation) {
|
|
153
|
+
this.pendingTimeline = timeline;
|
|
154
|
+
} else {
|
|
155
|
+
attachTimeline(this.animation, timeline);
|
|
156
|
+
}
|
|
157
|
+
return noop;
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
export {
|
|
161
|
+
NativeAnimation
|
|
162
|
+
};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { resolveElements } from "../../../render/dom/utils/resolve-element.mjs";
|
|
2
|
+
import { invariant } from "../../../utils/errors.mjs";
|
|
3
|
+
import { secondsToMilliseconds } from "../../../utils/time-conversion.mjs";
|
|
4
|
+
import { getValueTransition } from "../../utils/get-value-transition.mjs";
|
|
5
|
+
import { NativeAnimation } from "./NativeAnimation.mjs";
|
|
6
|
+
function animateElements(elementOrSelector, keyframes, options, scope) {
|
|
7
|
+
const elements = resolveElements(elementOrSelector, scope);
|
|
8
|
+
const numElements = elements.length;
|
|
9
|
+
invariant(Boolean(numElements), "No valid element provided.");
|
|
10
|
+
const animations = [];
|
|
11
|
+
for (let i = 0; i < numElements; i++) {
|
|
12
|
+
const element = elements[i];
|
|
13
|
+
const elementTransition = { ...options };
|
|
14
|
+
if (typeof elementTransition.delay === "function") {
|
|
15
|
+
elementTransition.delay = elementTransition.delay(i, numElements);
|
|
16
|
+
}
|
|
17
|
+
for (const valueName in keyframes) {
|
|
18
|
+
const valueKeyframes = keyframes[valueName];
|
|
19
|
+
const valueOptions = {
|
|
20
|
+
...getValueTransition(options, valueName)
|
|
21
|
+
};
|
|
22
|
+
valueOptions.duration = valueOptions.duration ? secondsToMilliseconds(valueOptions.duration) : valueOptions.duration;
|
|
23
|
+
valueOptions.delay = secondsToMilliseconds(valueOptions.delay || 0);
|
|
24
|
+
animations.push(new NativeAnimation(element, valueName, valueKeyframes, valueOptions));
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
return animations;
|
|
28
|
+
}
|
|
29
|
+
export {
|
|
30
|
+
animateElements
|
|
31
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { GroupPlaybackControls } from "../../GroupPlaybackControls.mjs";
|
|
2
|
+
import { animateElements } from "./animate-elements.mjs";
|
|
3
|
+
const createScopedWaapiAnimate = (scope) => {
|
|
4
|
+
function scopedAnimate(elementOrSelector, keyframes, options) {
|
|
5
|
+
return new GroupPlaybackControls(animateElements(elementOrSelector, keyframes, options, scope));
|
|
6
|
+
}
|
|
7
|
+
return scopedAnimate;
|
|
8
|
+
};
|
|
9
|
+
const animateMini = /* @__PURE__ */ createScopedWaapiAnimate();
|
|
10
|
+
export {
|
|
11
|
+
animateMini,
|
|
12
|
+
createScopedWaapiAnimate
|
|
13
|
+
};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { isBezierDefinition } from "../../../easing/utils/is-bezier-definition.mjs";
|
|
2
|
+
import { generateLinearEasing } from "./utils/linear.mjs";
|
|
3
|
+
import { supportsLinearEasing } from "./utils/supports-linear-easing.mjs";
|
|
4
|
+
function isWaapiSupportedEasing(easing) {
|
|
5
|
+
return Boolean(typeof easing === "function" && supportsLinearEasing() || !easing || typeof easing === "string" && (easing in supportedWaapiEasing || supportsLinearEasing()) || isBezierDefinition(easing) || Array.isArray(easing) && easing.every(isWaapiSupportedEasing));
|
|
6
|
+
}
|
|
7
|
+
const cubicBezierAsString = ([a, b, c, d]) => `cubic-bezier(${a}, ${b}, ${c}, ${d})`;
|
|
8
|
+
const supportedWaapiEasing = {
|
|
9
|
+
linear: "linear",
|
|
10
|
+
ease: "ease",
|
|
11
|
+
easeIn: "ease-in",
|
|
12
|
+
easeOut: "ease-out",
|
|
13
|
+
easeInOut: "ease-in-out",
|
|
14
|
+
circIn: /* @__PURE__ */ cubicBezierAsString([0, 0.65, 0.55, 1]),
|
|
15
|
+
circOut: /* @__PURE__ */ cubicBezierAsString([0.55, 0, 1, 0.45]),
|
|
16
|
+
backIn: /* @__PURE__ */ cubicBezierAsString([0.31, 0.01, 0.66, -0.59]),
|
|
17
|
+
backOut: /* @__PURE__ */ cubicBezierAsString([0.33, 1.53, 0.69, 0.99])
|
|
18
|
+
};
|
|
19
|
+
function mapEasingToNativeEasing(easing, duration) {
|
|
20
|
+
if (!easing) {
|
|
21
|
+
return void 0;
|
|
22
|
+
} else if (typeof easing === "function" && supportsLinearEasing()) {
|
|
23
|
+
return generateLinearEasing(easing, duration);
|
|
24
|
+
} else if (isBezierDefinition(easing)) {
|
|
25
|
+
return cubicBezierAsString(easing);
|
|
26
|
+
} else if (Array.isArray(easing)) {
|
|
27
|
+
return easing.map((segmentEasing) => mapEasingToNativeEasing(segmentEasing, duration) || supportedWaapiEasing.easeOut);
|
|
28
|
+
} else {
|
|
29
|
+
return supportedWaapiEasing[easing];
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
export {
|
|
33
|
+
cubicBezierAsString,
|
|
34
|
+
isWaapiSupportedEasing,
|
|
35
|
+
mapEasingToNativeEasing,
|
|
36
|
+
supportedWaapiEasing
|
|
37
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { mapEasingToNativeEasing } from "./easing.mjs";
|
|
2
|
+
function startWaapiAnimation(element, valueName, keyframes, { delay = 0, duration = 300, repeat = 0, repeatType = "loop", ease, times } = {}) {
|
|
3
|
+
const keyframeOptions = { [valueName]: keyframes };
|
|
4
|
+
if (times)
|
|
5
|
+
keyframeOptions.offset = times;
|
|
6
|
+
const easing = mapEasingToNativeEasing(ease, duration);
|
|
7
|
+
if (Array.isArray(easing))
|
|
8
|
+
keyframeOptions.easing = easing;
|
|
9
|
+
return element.animate(keyframeOptions, {
|
|
10
|
+
delay,
|
|
11
|
+
duration,
|
|
12
|
+
easing: !Array.isArray(easing) ? easing : "linear",
|
|
13
|
+
fill: "both",
|
|
14
|
+
iterations: repeat + 1,
|
|
15
|
+
direction: repeatType === "reverse" ? "alternate" : "normal"
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
export {
|
|
19
|
+
startWaapiAnimation
|
|
20
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
const isNotNull = (value) => value !== null;
|
|
2
|
+
function getFinalKeyframe(keyframes, { repeat, repeatType = "loop" }, finalKeyframe) {
|
|
3
|
+
const resolvedKeyframes = keyframes.filter(isNotNull);
|
|
4
|
+
const index = repeat && repeatType !== "loop" && repeat % 2 === 1 ? 0 : resolvedKeyframes.length - 1;
|
|
5
|
+
return !index || finalKeyframe === void 0 ? resolvedKeyframes[index] : finalKeyframe;
|
|
6
|
+
}
|
|
7
|
+
export {
|
|
8
|
+
getFinalKeyframe
|
|
9
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { progress } from "../../../../utils/progress.mjs";
|
|
2
|
+
const resolution = 10;
|
|
3
|
+
const generateLinearEasing = (easing, duration) => {
|
|
4
|
+
let points = "";
|
|
5
|
+
const numPoints = Math.max(Math.round(duration / resolution), 2);
|
|
6
|
+
for (let i = 0; i < numPoints; i++) {
|
|
7
|
+
points += easing(progress(0, numPoints - 1, i)) + ", ";
|
|
8
|
+
}
|
|
9
|
+
return `linear(${points.substring(0, points.length - 2)})`;
|
|
10
|
+
};
|
|
11
|
+
export {
|
|
12
|
+
generateLinearEasing
|
|
13
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { memo } from "../../../../utils/memo.mjs";
|
|
2
|
+
import { supportsFlags } from "./supports-flags.mjs";
|
|
3
|
+
function memoSupports(callback, supportsFlag) {
|
|
4
|
+
const memoized = memo(callback);
|
|
5
|
+
return () => {
|
|
6
|
+
var _a;
|
|
7
|
+
return (_a = supportsFlags[supportsFlag]) !== null && _a !== void 0 ? _a : memoized();
|
|
8
|
+
};
|
|
9
|
+
}
|
|
10
|
+
export {
|
|
11
|
+
memoSupports
|
|
12
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { memoSupports } from "./memo-supports.mjs";
|
|
2
|
+
const supportsLinearEasing = /* @__PURE__ */ memoSupports(() => {
|
|
3
|
+
try {
|
|
4
|
+
document.createElement("div").animate({ opacity: 0 }, { easing: "linear(0, 1)" });
|
|
5
|
+
} catch (e) {
|
|
6
|
+
return false;
|
|
7
|
+
}
|
|
8
|
+
return true;
|
|
9
|
+
}, "linearEasing");
|
|
10
|
+
export {
|
|
11
|
+
supportsLinearEasing
|
|
12
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { memo } from "../../../../utils/memo.mjs";
|
|
2
|
+
const supportsPartialKeyframes = /* @__PURE__ */ memo(() => {
|
|
3
|
+
try {
|
|
4
|
+
document.createElement("div").animate({ opacity: [1] });
|
|
5
|
+
} catch (e) {
|
|
6
|
+
return false;
|
|
7
|
+
}
|
|
8
|
+
return true;
|
|
9
|
+
});
|
|
10
|
+
export {
|
|
11
|
+
supportsPartialKeyframes
|
|
12
|
+
};
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { spring } from "./spring/index.mjs";
|
|
2
|
+
import { calcGeneratorVelocity } from "./utils/velocity.mjs";
|
|
3
|
+
function inertia({ keyframes, velocity = 0, power = 0.8, timeConstant = 325, bounceDamping = 10, bounceStiffness = 500, modifyTarget, min, max, restDelta = 0.5, restSpeed }) {
|
|
4
|
+
const origin = keyframes[0];
|
|
5
|
+
const state = {
|
|
6
|
+
done: false,
|
|
7
|
+
value: origin
|
|
8
|
+
};
|
|
9
|
+
const isOutOfBounds = (v) => min !== void 0 && v < min || max !== void 0 && v > max;
|
|
10
|
+
const nearestBoundary = (v) => {
|
|
11
|
+
if (min === void 0)
|
|
12
|
+
return max;
|
|
13
|
+
if (max === void 0)
|
|
14
|
+
return min;
|
|
15
|
+
return Math.abs(min - v) < Math.abs(max - v) ? min : max;
|
|
16
|
+
};
|
|
17
|
+
let amplitude = power * velocity;
|
|
18
|
+
const ideal = origin + amplitude;
|
|
19
|
+
const target = modifyTarget === void 0 ? ideal : modifyTarget(ideal);
|
|
20
|
+
if (target !== ideal)
|
|
21
|
+
amplitude = target - origin;
|
|
22
|
+
const calcDelta = (t) => -amplitude * Math.exp(-t / timeConstant);
|
|
23
|
+
const calcLatest = (t) => target + calcDelta(t);
|
|
24
|
+
const applyFriction = (t) => {
|
|
25
|
+
const delta = calcDelta(t);
|
|
26
|
+
const latest = calcLatest(t);
|
|
27
|
+
state.done = Math.abs(delta) <= restDelta;
|
|
28
|
+
state.value = state.done ? target : latest;
|
|
29
|
+
};
|
|
30
|
+
let timeReachedBoundary;
|
|
31
|
+
let spring$1;
|
|
32
|
+
const checkCatchBoundary = (t) => {
|
|
33
|
+
if (!isOutOfBounds(state.value))
|
|
34
|
+
return;
|
|
35
|
+
timeReachedBoundary = t;
|
|
36
|
+
spring$1 = spring({
|
|
37
|
+
keyframes: [state.value, nearestBoundary(state.value)],
|
|
38
|
+
velocity: calcGeneratorVelocity(calcLatest, t, state.value),
|
|
39
|
+
// TODO: This should be passing * 1000
|
|
40
|
+
damping: bounceDamping,
|
|
41
|
+
stiffness: bounceStiffness,
|
|
42
|
+
restDelta,
|
|
43
|
+
restSpeed
|
|
44
|
+
});
|
|
45
|
+
};
|
|
46
|
+
checkCatchBoundary(0);
|
|
47
|
+
return {
|
|
48
|
+
calculatedDuration: null,
|
|
49
|
+
next: (t) => {
|
|
50
|
+
let hasUpdatedFrame = false;
|
|
51
|
+
if (!spring$1 && timeReachedBoundary === void 0) {
|
|
52
|
+
hasUpdatedFrame = true;
|
|
53
|
+
applyFriction(t);
|
|
54
|
+
checkCatchBoundary(t);
|
|
55
|
+
}
|
|
56
|
+
if (timeReachedBoundary !== void 0 && t >= timeReachedBoundary) {
|
|
57
|
+
return spring$1.next(t - timeReachedBoundary);
|
|
58
|
+
} else {
|
|
59
|
+
!hasUpdatedFrame && applyFriction(t);
|
|
60
|
+
return state;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
export {
|
|
66
|
+
inertia
|
|
67
|
+
};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { easeInOut } from "../../easing/ease.mjs";
|
|
2
|
+
import { isEasingArray } from "../../easing/utils/is-easing-array.mjs";
|
|
3
|
+
import { easingDefinitionToFunction } from "../../easing/utils/map.mjs";
|
|
4
|
+
import { interpolate } from "../../utils/interpolate.mjs";
|
|
5
|
+
import { defaultOffset } from "../../utils/offsets/default.mjs";
|
|
6
|
+
import { convertOffsetToTimes } from "../../utils/offsets/time.mjs";
|
|
7
|
+
function defaultEasing(values, easing) {
|
|
8
|
+
return values.map(() => easing || easeInOut).splice(0, values.length - 1);
|
|
9
|
+
}
|
|
10
|
+
function keyframes({ duration = 300, keyframes: keyframeValues, times, ease = "easeInOut" }) {
|
|
11
|
+
const easingFunctions = isEasingArray(ease) ? ease.map(easingDefinitionToFunction) : easingDefinitionToFunction(ease);
|
|
12
|
+
const state = {
|
|
13
|
+
done: false,
|
|
14
|
+
value: keyframeValues[0]
|
|
15
|
+
};
|
|
16
|
+
const absoluteTimes = convertOffsetToTimes(
|
|
17
|
+
// Only use the provided offsets if they're the correct length
|
|
18
|
+
// TODO Maybe we should warn here if there's a length mismatch
|
|
19
|
+
times && times.length === keyframeValues.length ? times : defaultOffset(keyframeValues),
|
|
20
|
+
duration
|
|
21
|
+
);
|
|
22
|
+
const mapTimeToKeyframe = interpolate(absoluteTimes, keyframeValues, {
|
|
23
|
+
ease: Array.isArray(easingFunctions) ? easingFunctions : defaultEasing(keyframeValues, easingFunctions)
|
|
24
|
+
});
|
|
25
|
+
return {
|
|
26
|
+
calculatedDuration: duration,
|
|
27
|
+
next: (t) => {
|
|
28
|
+
state.value = mapTimeToKeyframe(t);
|
|
29
|
+
state.done = t >= duration;
|
|
30
|
+
return state;
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
export {
|
|
35
|
+
defaultEasing,
|
|
36
|
+
keyframes
|
|
37
|
+
};
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { warning } from "../../../utils/errors.mjs";
|
|
2
|
+
import { clamp } from "../../../utils/clamp.mjs";
|
|
3
|
+
import { secondsToMilliseconds, millisecondsToSeconds } from "../../../utils/time-conversion.mjs";
|
|
4
|
+
const safeMin = 1e-3;
|
|
5
|
+
const minDuration = 0.01;
|
|
6
|
+
const maxDuration = 10;
|
|
7
|
+
const minDamping = 0.05;
|
|
8
|
+
const maxDamping = 1;
|
|
9
|
+
function findSpring({ duration = 800, bounce = 0.25, velocity = 0, mass = 1 }) {
|
|
10
|
+
let envelope;
|
|
11
|
+
let derivative;
|
|
12
|
+
warning(duration <= secondsToMilliseconds(maxDuration), "Spring duration must be 10 seconds or less");
|
|
13
|
+
let dampingRatio = 1 - bounce;
|
|
14
|
+
dampingRatio = clamp(minDamping, maxDamping, dampingRatio);
|
|
15
|
+
duration = clamp(minDuration, maxDuration, millisecondsToSeconds(duration));
|
|
16
|
+
if (dampingRatio < 1) {
|
|
17
|
+
envelope = (undampedFreq2) => {
|
|
18
|
+
const exponentialDecay = undampedFreq2 * dampingRatio;
|
|
19
|
+
const delta = exponentialDecay * duration;
|
|
20
|
+
const a = exponentialDecay - velocity;
|
|
21
|
+
const b = calcAngularFreq(undampedFreq2, dampingRatio);
|
|
22
|
+
const c = Math.exp(-delta);
|
|
23
|
+
return safeMin - a / b * c;
|
|
24
|
+
};
|
|
25
|
+
derivative = (undampedFreq2) => {
|
|
26
|
+
const exponentialDecay = undampedFreq2 * dampingRatio;
|
|
27
|
+
const delta = exponentialDecay * duration;
|
|
28
|
+
const d = delta * velocity + velocity;
|
|
29
|
+
const e = Math.pow(dampingRatio, 2) * Math.pow(undampedFreq2, 2) * duration;
|
|
30
|
+
const f = Math.exp(-delta);
|
|
31
|
+
const g = calcAngularFreq(Math.pow(undampedFreq2, 2), dampingRatio);
|
|
32
|
+
const factor = -envelope(undampedFreq2) + safeMin > 0 ? -1 : 1;
|
|
33
|
+
return factor * ((d - e) * f) / g;
|
|
34
|
+
};
|
|
35
|
+
} else {
|
|
36
|
+
envelope = (undampedFreq2) => {
|
|
37
|
+
const a = Math.exp(-undampedFreq2 * duration);
|
|
38
|
+
const b = (undampedFreq2 - velocity) * duration + 1;
|
|
39
|
+
return -safeMin + a * b;
|
|
40
|
+
};
|
|
41
|
+
derivative = (undampedFreq2) => {
|
|
42
|
+
const a = Math.exp(-undampedFreq2 * duration);
|
|
43
|
+
const b = (velocity - undampedFreq2) * (duration * duration);
|
|
44
|
+
return a * b;
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
const initialGuess = 5 / duration;
|
|
48
|
+
const undampedFreq = approximateRoot(envelope, derivative, initialGuess);
|
|
49
|
+
duration = secondsToMilliseconds(duration);
|
|
50
|
+
if (isNaN(undampedFreq)) {
|
|
51
|
+
return {
|
|
52
|
+
stiffness: 100,
|
|
53
|
+
damping: 10,
|
|
54
|
+
duration
|
|
55
|
+
};
|
|
56
|
+
} else {
|
|
57
|
+
const stiffness = Math.pow(undampedFreq, 2) * mass;
|
|
58
|
+
return {
|
|
59
|
+
stiffness,
|
|
60
|
+
damping: dampingRatio * 2 * Math.sqrt(mass * stiffness),
|
|
61
|
+
duration
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
const rootIterations = 12;
|
|
66
|
+
function approximateRoot(envelope, derivative, initialGuess) {
|
|
67
|
+
let result = initialGuess;
|
|
68
|
+
for (let i = 1; i < rootIterations; i++) {
|
|
69
|
+
result = result - envelope(result) / derivative(result);
|
|
70
|
+
}
|
|
71
|
+
return result;
|
|
72
|
+
}
|
|
73
|
+
function calcAngularFreq(undampedFreq, dampingRatio) {
|
|
74
|
+
return undampedFreq * Math.sqrt(1 - dampingRatio * dampingRatio);
|
|
75
|
+
}
|
|
76
|
+
export {
|
|
77
|
+
calcAngularFreq,
|
|
78
|
+
findSpring,
|
|
79
|
+
maxDamping,
|
|
80
|
+
maxDuration,
|
|
81
|
+
minDamping,
|
|
82
|
+
minDuration
|
|
83
|
+
};
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { millisecondsToSeconds, secondsToMilliseconds } from "../../../utils/time-conversion.mjs";
|
|
2
|
+
import { calcGeneratorVelocity } from "../utils/velocity.mjs";
|
|
3
|
+
import { findSpring, calcAngularFreq } from "./find.mjs";
|
|
4
|
+
const durationKeys = ["duration", "bounce"];
|
|
5
|
+
const physicsKeys = ["stiffness", "damping", "mass"];
|
|
6
|
+
function isSpringType(options, keys) {
|
|
7
|
+
return keys.some((key) => options[key] !== void 0);
|
|
8
|
+
}
|
|
9
|
+
function getSpringOptions(options) {
|
|
10
|
+
let springOptions = {
|
|
11
|
+
velocity: 0,
|
|
12
|
+
stiffness: 100,
|
|
13
|
+
damping: 10,
|
|
14
|
+
mass: 1,
|
|
15
|
+
isResolvedFromDuration: false,
|
|
16
|
+
...options
|
|
17
|
+
};
|
|
18
|
+
if (!isSpringType(options, physicsKeys) && isSpringType(options, durationKeys)) {
|
|
19
|
+
const derived = findSpring(options);
|
|
20
|
+
springOptions = {
|
|
21
|
+
...springOptions,
|
|
22
|
+
...derived,
|
|
23
|
+
mass: 1
|
|
24
|
+
};
|
|
25
|
+
springOptions.isResolvedFromDuration = true;
|
|
26
|
+
}
|
|
27
|
+
return springOptions;
|
|
28
|
+
}
|
|
29
|
+
function spring({ keyframes, restDelta, restSpeed, ...options }) {
|
|
30
|
+
const origin = keyframes[0];
|
|
31
|
+
const target = keyframes[keyframes.length - 1];
|
|
32
|
+
const state = { done: false, value: origin };
|
|
33
|
+
const { stiffness, damping, mass, duration, velocity, isResolvedFromDuration } = getSpringOptions({
|
|
34
|
+
...options,
|
|
35
|
+
velocity: -millisecondsToSeconds(options.velocity || 0)
|
|
36
|
+
});
|
|
37
|
+
const initialVelocity = velocity || 0;
|
|
38
|
+
const dampingRatio = damping / (2 * Math.sqrt(stiffness * mass));
|
|
39
|
+
const initialDelta = target - origin;
|
|
40
|
+
const undampedAngularFreq = millisecondsToSeconds(Math.sqrt(stiffness / mass));
|
|
41
|
+
const isGranularScale = Math.abs(initialDelta) < 5;
|
|
42
|
+
restSpeed || (restSpeed = isGranularScale ? 0.01 : 2);
|
|
43
|
+
restDelta || (restDelta = isGranularScale ? 5e-3 : 0.5);
|
|
44
|
+
let resolveSpring;
|
|
45
|
+
if (dampingRatio < 1) {
|
|
46
|
+
const angularFreq = calcAngularFreq(undampedAngularFreq, dampingRatio);
|
|
47
|
+
resolveSpring = (t) => {
|
|
48
|
+
const envelope = Math.exp(-dampingRatio * undampedAngularFreq * t);
|
|
49
|
+
return target - envelope * ((initialVelocity + dampingRatio * undampedAngularFreq * initialDelta) / angularFreq * Math.sin(angularFreq * t) + initialDelta * Math.cos(angularFreq * t));
|
|
50
|
+
};
|
|
51
|
+
} else if (dampingRatio === 1) {
|
|
52
|
+
resolveSpring = (t) => target - Math.exp(-undampedAngularFreq * t) * (initialDelta + (initialVelocity + undampedAngularFreq * initialDelta) * t);
|
|
53
|
+
} else {
|
|
54
|
+
const dampedAngularFreq = undampedAngularFreq * Math.sqrt(dampingRatio * dampingRatio - 1);
|
|
55
|
+
resolveSpring = (t) => {
|
|
56
|
+
const envelope = Math.exp(-dampingRatio * undampedAngularFreq * t);
|
|
57
|
+
const freqForT = Math.min(dampedAngularFreq * t, 300);
|
|
58
|
+
return target - envelope * ((initialVelocity + dampingRatio * undampedAngularFreq * initialDelta) * Math.sinh(freqForT) + dampedAngularFreq * initialDelta * Math.cosh(freqForT)) / dampedAngularFreq;
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
return {
|
|
62
|
+
calculatedDuration: isResolvedFromDuration ? duration || null : null,
|
|
63
|
+
next: (t) => {
|
|
64
|
+
const current = resolveSpring(t);
|
|
65
|
+
if (!isResolvedFromDuration) {
|
|
66
|
+
let currentVelocity = 0;
|
|
67
|
+
if (dampingRatio < 1) {
|
|
68
|
+
currentVelocity = t === 0 ? secondsToMilliseconds(initialVelocity) : calcGeneratorVelocity(resolveSpring, t, current);
|
|
69
|
+
}
|
|
70
|
+
const isBelowVelocityThreshold = Math.abs(currentVelocity) <= restSpeed;
|
|
71
|
+
const isBelowDisplacementThreshold = Math.abs(target - current) <= restDelta;
|
|
72
|
+
state.done = isBelowVelocityThreshold && isBelowDisplacementThreshold;
|
|
73
|
+
} else {
|
|
74
|
+
state.done = t >= duration;
|
|
75
|
+
}
|
|
76
|
+
state.value = state.done ? target : current;
|
|
77
|
+
return state;
|
|
78
|
+
}
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
export {
|
|
82
|
+
spring
|
|
83
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
const maxGeneratorDuration = 2e4;
|
|
2
|
+
function calcGeneratorDuration(generator) {
|
|
3
|
+
let duration = 0;
|
|
4
|
+
const timeStep = 50;
|
|
5
|
+
let state = generator.next(duration);
|
|
6
|
+
while (!state.done && duration < maxGeneratorDuration) {
|
|
7
|
+
duration += timeStep;
|
|
8
|
+
state = generator.next(duration);
|
|
9
|
+
}
|
|
10
|
+
return duration >= maxGeneratorDuration ? Infinity : duration;
|
|
11
|
+
}
|
|
12
|
+
export {
|
|
13
|
+
calcGeneratorDuration,
|
|
14
|
+
maxGeneratorDuration
|
|
15
|
+
};
|