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
package/dist/es/external/.pnpm/framer-motion@11.11.11/external/framer-motion/dist/es/value/index.mjs
ADDED
|
@@ -0,0 +1,282 @@
|
|
|
1
|
+
import { SubscriptionManager } from "../utils/subscription-manager.mjs";
|
|
2
|
+
import { velocityPerSecond } from "../utils/velocity-per-second.mjs";
|
|
3
|
+
import { warnOnce } from "../utils/warn-once.mjs";
|
|
4
|
+
import { time } from "../frameloop/sync-time.mjs";
|
|
5
|
+
import { frame } from "../frameloop/frame.mjs";
|
|
6
|
+
const MAX_VELOCITY_DELTA = 30;
|
|
7
|
+
const isFloat = (value) => {
|
|
8
|
+
return !isNaN(parseFloat(value));
|
|
9
|
+
};
|
|
10
|
+
const collectMotionValues = {
|
|
11
|
+
current: void 0
|
|
12
|
+
};
|
|
13
|
+
class MotionValue {
|
|
14
|
+
/**
|
|
15
|
+
* @param init - The initiating value
|
|
16
|
+
* @param config - Optional configuration options
|
|
17
|
+
*
|
|
18
|
+
* - `transformer`: A function to transform incoming values with.
|
|
19
|
+
*
|
|
20
|
+
* @internal
|
|
21
|
+
*/
|
|
22
|
+
constructor(init, options = {}) {
|
|
23
|
+
this.version = "11.11.11";
|
|
24
|
+
this.canTrackVelocity = null;
|
|
25
|
+
this.events = {};
|
|
26
|
+
this.updateAndNotify = (v, render = true) => {
|
|
27
|
+
const currentTime = time.now();
|
|
28
|
+
if (this.updatedAt !== currentTime) {
|
|
29
|
+
this.setPrevFrameValue();
|
|
30
|
+
}
|
|
31
|
+
this.prev = this.current;
|
|
32
|
+
this.setCurrent(v);
|
|
33
|
+
if (this.current !== this.prev && this.events.change) {
|
|
34
|
+
this.events.change.notify(this.current);
|
|
35
|
+
}
|
|
36
|
+
if (render && this.events.renderRequest) {
|
|
37
|
+
this.events.renderRequest.notify(this.current);
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
this.hasAnimated = false;
|
|
41
|
+
this.setCurrent(init);
|
|
42
|
+
this.owner = options.owner;
|
|
43
|
+
}
|
|
44
|
+
setCurrent(current) {
|
|
45
|
+
this.current = current;
|
|
46
|
+
this.updatedAt = time.now();
|
|
47
|
+
if (this.canTrackVelocity === null && current !== void 0) {
|
|
48
|
+
this.canTrackVelocity = isFloat(this.current);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
setPrevFrameValue(prevFrameValue = this.current) {
|
|
52
|
+
this.prevFrameValue = prevFrameValue;
|
|
53
|
+
this.prevUpdatedAt = this.updatedAt;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Adds a function that will be notified when the `MotionValue` is updated.
|
|
57
|
+
*
|
|
58
|
+
* It returns a function that, when called, will cancel the subscription.
|
|
59
|
+
*
|
|
60
|
+
* When calling `onChange` inside a React component, it should be wrapped with the
|
|
61
|
+
* `useEffect` hook. As it returns an unsubscribe function, this should be returned
|
|
62
|
+
* from the `useEffect` function to ensure you don't add duplicate subscribers..
|
|
63
|
+
*
|
|
64
|
+
* ```jsx
|
|
65
|
+
* export const MyComponent = () => {
|
|
66
|
+
* const x = useMotionValue(0)
|
|
67
|
+
* const y = useMotionValue(0)
|
|
68
|
+
* const opacity = useMotionValue(1)
|
|
69
|
+
*
|
|
70
|
+
* useEffect(() => {
|
|
71
|
+
* function updateOpacity() {
|
|
72
|
+
* const maxXY = Math.max(x.get(), y.get())
|
|
73
|
+
* const newOpacity = transform(maxXY, [0, 100], [1, 0])
|
|
74
|
+
* opacity.set(newOpacity)
|
|
75
|
+
* }
|
|
76
|
+
*
|
|
77
|
+
* const unsubscribeX = x.on("change", updateOpacity)
|
|
78
|
+
* const unsubscribeY = y.on("change", updateOpacity)
|
|
79
|
+
*
|
|
80
|
+
* return () => {
|
|
81
|
+
* unsubscribeX()
|
|
82
|
+
* unsubscribeY()
|
|
83
|
+
* }
|
|
84
|
+
* }, [])
|
|
85
|
+
*
|
|
86
|
+
* return <motion.div style={{ x }} />
|
|
87
|
+
* }
|
|
88
|
+
* ```
|
|
89
|
+
*
|
|
90
|
+
* @param subscriber - A function that receives the latest value.
|
|
91
|
+
* @returns A function that, when called, will cancel this subscription.
|
|
92
|
+
*
|
|
93
|
+
* @deprecated
|
|
94
|
+
*/
|
|
95
|
+
onChange(subscription) {
|
|
96
|
+
if (process.env.NODE_ENV !== "production") {
|
|
97
|
+
warnOnce(false, `value.onChange(callback) is deprecated. Switch to value.on("change", callback).`);
|
|
98
|
+
}
|
|
99
|
+
return this.on("change", subscription);
|
|
100
|
+
}
|
|
101
|
+
on(eventName, callback) {
|
|
102
|
+
if (!this.events[eventName]) {
|
|
103
|
+
this.events[eventName] = new SubscriptionManager();
|
|
104
|
+
}
|
|
105
|
+
const unsubscribe = this.events[eventName].add(callback);
|
|
106
|
+
if (eventName === "change") {
|
|
107
|
+
return () => {
|
|
108
|
+
unsubscribe();
|
|
109
|
+
frame.read(() => {
|
|
110
|
+
if (!this.events.change.getSize()) {
|
|
111
|
+
this.stop();
|
|
112
|
+
}
|
|
113
|
+
});
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
return unsubscribe;
|
|
117
|
+
}
|
|
118
|
+
clearListeners() {
|
|
119
|
+
for (const eventManagers in this.events) {
|
|
120
|
+
this.events[eventManagers].clear();
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* Attaches a passive effect to the `MotionValue`.
|
|
125
|
+
*
|
|
126
|
+
* @internal
|
|
127
|
+
*/
|
|
128
|
+
attach(passiveEffect, stopPassiveEffect) {
|
|
129
|
+
this.passiveEffect = passiveEffect;
|
|
130
|
+
this.stopPassiveEffect = stopPassiveEffect;
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* Sets the state of the `MotionValue`.
|
|
134
|
+
*
|
|
135
|
+
* @remarks
|
|
136
|
+
*
|
|
137
|
+
* ```jsx
|
|
138
|
+
* const x = useMotionValue(0)
|
|
139
|
+
* x.set(10)
|
|
140
|
+
* ```
|
|
141
|
+
*
|
|
142
|
+
* @param latest - Latest value to set.
|
|
143
|
+
* @param render - Whether to notify render subscribers. Defaults to `true`
|
|
144
|
+
*
|
|
145
|
+
* @public
|
|
146
|
+
*/
|
|
147
|
+
set(v, render = true) {
|
|
148
|
+
if (!render || !this.passiveEffect) {
|
|
149
|
+
this.updateAndNotify(v, render);
|
|
150
|
+
} else {
|
|
151
|
+
this.passiveEffect(v, this.updateAndNotify);
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
setWithVelocity(prev, current, delta) {
|
|
155
|
+
this.set(current);
|
|
156
|
+
this.prev = void 0;
|
|
157
|
+
this.prevFrameValue = prev;
|
|
158
|
+
this.prevUpdatedAt = this.updatedAt - delta;
|
|
159
|
+
}
|
|
160
|
+
/**
|
|
161
|
+
* Set the state of the `MotionValue`, stopping any active animations,
|
|
162
|
+
* effects, and resets velocity to `0`.
|
|
163
|
+
*/
|
|
164
|
+
jump(v, endAnimation = true) {
|
|
165
|
+
this.updateAndNotify(v);
|
|
166
|
+
this.prev = v;
|
|
167
|
+
this.prevUpdatedAt = this.prevFrameValue = void 0;
|
|
168
|
+
endAnimation && this.stop();
|
|
169
|
+
if (this.stopPassiveEffect)
|
|
170
|
+
this.stopPassiveEffect();
|
|
171
|
+
}
|
|
172
|
+
/**
|
|
173
|
+
* Returns the latest state of `MotionValue`
|
|
174
|
+
*
|
|
175
|
+
* @returns - The latest state of `MotionValue`
|
|
176
|
+
*
|
|
177
|
+
* @public
|
|
178
|
+
*/
|
|
179
|
+
get() {
|
|
180
|
+
if (collectMotionValues.current) {
|
|
181
|
+
collectMotionValues.current.push(this);
|
|
182
|
+
}
|
|
183
|
+
return this.current;
|
|
184
|
+
}
|
|
185
|
+
/**
|
|
186
|
+
* @public
|
|
187
|
+
*/
|
|
188
|
+
getPrevious() {
|
|
189
|
+
return this.prev;
|
|
190
|
+
}
|
|
191
|
+
/**
|
|
192
|
+
* Returns the latest velocity of `MotionValue`
|
|
193
|
+
*
|
|
194
|
+
* @returns - The latest velocity of `MotionValue`. Returns `0` if the state is non-numerical.
|
|
195
|
+
*
|
|
196
|
+
* @public
|
|
197
|
+
*/
|
|
198
|
+
getVelocity() {
|
|
199
|
+
const currentTime = time.now();
|
|
200
|
+
if (!this.canTrackVelocity || this.prevFrameValue === void 0 || currentTime - this.updatedAt > MAX_VELOCITY_DELTA) {
|
|
201
|
+
return 0;
|
|
202
|
+
}
|
|
203
|
+
const delta = Math.min(this.updatedAt - this.prevUpdatedAt, MAX_VELOCITY_DELTA);
|
|
204
|
+
return velocityPerSecond(parseFloat(this.current) - parseFloat(this.prevFrameValue), delta);
|
|
205
|
+
}
|
|
206
|
+
/**
|
|
207
|
+
* Registers a new animation to control this `MotionValue`. Only one
|
|
208
|
+
* animation can drive a `MotionValue` at one time.
|
|
209
|
+
*
|
|
210
|
+
* ```jsx
|
|
211
|
+
* value.start()
|
|
212
|
+
* ```
|
|
213
|
+
*
|
|
214
|
+
* @param animation - A function that starts the provided animation
|
|
215
|
+
*
|
|
216
|
+
* @internal
|
|
217
|
+
*/
|
|
218
|
+
start(startAnimation) {
|
|
219
|
+
this.stop();
|
|
220
|
+
return new Promise((resolve) => {
|
|
221
|
+
this.hasAnimated = true;
|
|
222
|
+
this.animation = startAnimation(resolve);
|
|
223
|
+
if (this.events.animationStart) {
|
|
224
|
+
this.events.animationStart.notify();
|
|
225
|
+
}
|
|
226
|
+
}).then(() => {
|
|
227
|
+
if (this.events.animationComplete) {
|
|
228
|
+
this.events.animationComplete.notify();
|
|
229
|
+
}
|
|
230
|
+
this.clearAnimation();
|
|
231
|
+
});
|
|
232
|
+
}
|
|
233
|
+
/**
|
|
234
|
+
* Stop the currently active animation.
|
|
235
|
+
*
|
|
236
|
+
* @public
|
|
237
|
+
*/
|
|
238
|
+
stop() {
|
|
239
|
+
if (this.animation) {
|
|
240
|
+
this.animation.stop();
|
|
241
|
+
if (this.events.animationCancel) {
|
|
242
|
+
this.events.animationCancel.notify();
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
this.clearAnimation();
|
|
246
|
+
}
|
|
247
|
+
/**
|
|
248
|
+
* Returns `true` if this value is currently animating.
|
|
249
|
+
*
|
|
250
|
+
* @public
|
|
251
|
+
*/
|
|
252
|
+
isAnimating() {
|
|
253
|
+
return !!this.animation;
|
|
254
|
+
}
|
|
255
|
+
clearAnimation() {
|
|
256
|
+
delete this.animation;
|
|
257
|
+
}
|
|
258
|
+
/**
|
|
259
|
+
* Destroy and clean up subscribers to this `MotionValue`.
|
|
260
|
+
*
|
|
261
|
+
* The `MotionValue` hooks like `useMotionValue` and `useTransform` automatically
|
|
262
|
+
* handle the lifecycle of the returned `MotionValue`, so this method is only necessary if you've manually
|
|
263
|
+
* created a `MotionValue` via the `motionValue` function.
|
|
264
|
+
*
|
|
265
|
+
* @public
|
|
266
|
+
*/
|
|
267
|
+
destroy() {
|
|
268
|
+
this.clearListeners();
|
|
269
|
+
this.stop();
|
|
270
|
+
if (this.stopPassiveEffect) {
|
|
271
|
+
this.stopPassiveEffect();
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
function motionValue(init, options) {
|
|
276
|
+
return new MotionValue(init, options);
|
|
277
|
+
}
|
|
278
|
+
export {
|
|
279
|
+
MotionValue,
|
|
280
|
+
collectMotionValues,
|
|
281
|
+
motionValue
|
|
282
|
+
};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { rgba } from "./rgba.mjs";
|
|
2
|
+
import { isColorString } from "./utils.mjs";
|
|
3
|
+
function parseHex(v) {
|
|
4
|
+
let r = "";
|
|
5
|
+
let g = "";
|
|
6
|
+
let b = "";
|
|
7
|
+
let a = "";
|
|
8
|
+
if (v.length > 5) {
|
|
9
|
+
r = v.substring(1, 3);
|
|
10
|
+
g = v.substring(3, 5);
|
|
11
|
+
b = v.substring(5, 7);
|
|
12
|
+
a = v.substring(7, 9);
|
|
13
|
+
} else {
|
|
14
|
+
r = v.substring(1, 2);
|
|
15
|
+
g = v.substring(2, 3);
|
|
16
|
+
b = v.substring(3, 4);
|
|
17
|
+
a = v.substring(4, 5);
|
|
18
|
+
r += r;
|
|
19
|
+
g += g;
|
|
20
|
+
b += b;
|
|
21
|
+
a += a;
|
|
22
|
+
}
|
|
23
|
+
return {
|
|
24
|
+
red: parseInt(r, 16),
|
|
25
|
+
green: parseInt(g, 16),
|
|
26
|
+
blue: parseInt(b, 16),
|
|
27
|
+
alpha: a ? parseInt(a, 16) / 255 : 1
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
const hex = {
|
|
31
|
+
test: /* @__PURE__ */ isColorString("#"),
|
|
32
|
+
parse: parseHex,
|
|
33
|
+
transform: rgba.transform
|
|
34
|
+
};
|
|
35
|
+
export {
|
|
36
|
+
hex
|
|
37
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { alpha } from "../numbers/index.mjs";
|
|
2
|
+
import { percent } from "../numbers/units.mjs";
|
|
3
|
+
import { sanitize } from "../utils/sanitize.mjs";
|
|
4
|
+
import { isColorString, splitColor } from "./utils.mjs";
|
|
5
|
+
const hsla = {
|
|
6
|
+
test: /* @__PURE__ */ isColorString("hsl", "hue"),
|
|
7
|
+
parse: /* @__PURE__ */ splitColor("hue", "saturation", "lightness"),
|
|
8
|
+
transform: ({ hue, saturation, lightness, alpha: alpha$1 = 1 }) => {
|
|
9
|
+
return "hsla(" + Math.round(hue) + ", " + percent.transform(sanitize(saturation)) + ", " + percent.transform(sanitize(lightness)) + ", " + sanitize(alpha.transform(alpha$1)) + ")";
|
|
10
|
+
}
|
|
11
|
+
};
|
|
12
|
+
export {
|
|
13
|
+
hsla
|
|
14
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { hex } from "./hex.mjs";
|
|
2
|
+
import { hsla } from "./hsla.mjs";
|
|
3
|
+
import { rgba } from "./rgba.mjs";
|
|
4
|
+
const color = {
|
|
5
|
+
test: (v) => rgba.test(v) || hex.test(v) || hsla.test(v),
|
|
6
|
+
parse: (v) => {
|
|
7
|
+
if (rgba.test(v)) {
|
|
8
|
+
return rgba.parse(v);
|
|
9
|
+
} else if (hsla.test(v)) {
|
|
10
|
+
return hsla.parse(v);
|
|
11
|
+
} else {
|
|
12
|
+
return hex.parse(v);
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
transform: (v) => {
|
|
16
|
+
return typeof v === "string" ? v : v.hasOwnProperty("red") ? rgba.transform(v) : hsla.transform(v);
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
export {
|
|
20
|
+
color
|
|
21
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { clamp } from "../../../utils/clamp.mjs";
|
|
2
|
+
import { number, alpha } from "../numbers/index.mjs";
|
|
3
|
+
import { sanitize } from "../utils/sanitize.mjs";
|
|
4
|
+
import { isColorString, splitColor } from "./utils.mjs";
|
|
5
|
+
const clampRgbUnit = (v) => clamp(0, 255, v);
|
|
6
|
+
const rgbUnit = {
|
|
7
|
+
...number,
|
|
8
|
+
transform: (v) => Math.round(clampRgbUnit(v))
|
|
9
|
+
};
|
|
10
|
+
const rgba = {
|
|
11
|
+
test: /* @__PURE__ */ isColorString("rgb", "red"),
|
|
12
|
+
parse: /* @__PURE__ */ splitColor("red", "green", "blue"),
|
|
13
|
+
transform: ({ red, green, blue, alpha: alpha$1 = 1 }) => "rgba(" + rgbUnit.transform(red) + ", " + rgbUnit.transform(green) + ", " + rgbUnit.transform(blue) + ", " + sanitize(alpha.transform(alpha$1)) + ")"
|
|
14
|
+
};
|
|
15
|
+
export {
|
|
16
|
+
rgbUnit,
|
|
17
|
+
rgba
|
|
18
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { floatRegex } from "../utils/float-regex.mjs";
|
|
2
|
+
import { isNullish } from "../utils/is-nullish.mjs";
|
|
3
|
+
import { singleColorRegex } from "../utils/single-color-regex.mjs";
|
|
4
|
+
const isColorString = (type, testProp) => (v) => {
|
|
5
|
+
return Boolean(typeof v === "string" && singleColorRegex.test(v) && v.startsWith(type) || testProp && !isNullish(v) && Object.prototype.hasOwnProperty.call(v, testProp));
|
|
6
|
+
};
|
|
7
|
+
const splitColor = (aName, bName, cName) => (v) => {
|
|
8
|
+
if (typeof v !== "string")
|
|
9
|
+
return v;
|
|
10
|
+
const [a, b, c, alpha] = v.match(floatRegex);
|
|
11
|
+
return {
|
|
12
|
+
[aName]: parseFloat(a),
|
|
13
|
+
[bName]: parseFloat(b),
|
|
14
|
+
[cName]: parseFloat(c),
|
|
15
|
+
alpha: alpha !== void 0 ? parseFloat(alpha) : 1
|
|
16
|
+
};
|
|
17
|
+
};
|
|
18
|
+
export {
|
|
19
|
+
isColorString,
|
|
20
|
+
splitColor
|
|
21
|
+
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { complex } from "./index.mjs";
|
|
2
|
+
import { floatRegex } from "../utils/float-regex.mjs";
|
|
3
|
+
const maxDefaults = /* @__PURE__ */ new Set(["brightness", "contrast", "saturate", "opacity"]);
|
|
4
|
+
function applyDefaultFilter(v) {
|
|
5
|
+
const [name, value] = v.slice(0, -1).split("(");
|
|
6
|
+
if (name === "drop-shadow")
|
|
7
|
+
return v;
|
|
8
|
+
const [number] = value.match(floatRegex) || [];
|
|
9
|
+
if (!number)
|
|
10
|
+
return v;
|
|
11
|
+
const unit = value.replace(number, "");
|
|
12
|
+
let defaultValue = maxDefaults.has(name) ? 1 : 0;
|
|
13
|
+
if (number !== value)
|
|
14
|
+
defaultValue *= 100;
|
|
15
|
+
return name + "(" + defaultValue + unit + ")";
|
|
16
|
+
}
|
|
17
|
+
const functionRegex = /\b([a-z-]*)\(.*?\)/gu;
|
|
18
|
+
const filter = {
|
|
19
|
+
...complex,
|
|
20
|
+
getAnimatableNone: (v) => {
|
|
21
|
+
const functions = v.match(functionRegex);
|
|
22
|
+
return functions ? functions.map(applyDefaultFilter).join(" ") : v;
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
export {
|
|
26
|
+
filter
|
|
27
|
+
};
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { color } from "../color/index.mjs";
|
|
2
|
+
import { colorRegex } from "../utils/color-regex.mjs";
|
|
3
|
+
import { floatRegex } from "../utils/float-regex.mjs";
|
|
4
|
+
import { sanitize } from "../utils/sanitize.mjs";
|
|
5
|
+
function test(v) {
|
|
6
|
+
var _a, _b;
|
|
7
|
+
return isNaN(v) && typeof v === "string" && (((_a = v.match(floatRegex)) === null || _a === void 0 ? void 0 : _a.length) || 0) + (((_b = v.match(colorRegex)) === null || _b === void 0 ? void 0 : _b.length) || 0) > 0;
|
|
8
|
+
}
|
|
9
|
+
const NUMBER_TOKEN = "number";
|
|
10
|
+
const COLOR_TOKEN = "color";
|
|
11
|
+
const VAR_TOKEN = "var";
|
|
12
|
+
const VAR_FUNCTION_TOKEN = "var(";
|
|
13
|
+
const SPLIT_TOKEN = "${}";
|
|
14
|
+
const complexRegex = /var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu;
|
|
15
|
+
function analyseComplexValue(value) {
|
|
16
|
+
const originalValue = value.toString();
|
|
17
|
+
const values = [];
|
|
18
|
+
const indexes = {
|
|
19
|
+
color: [],
|
|
20
|
+
number: [],
|
|
21
|
+
var: []
|
|
22
|
+
};
|
|
23
|
+
const types = [];
|
|
24
|
+
let i = 0;
|
|
25
|
+
const tokenised = originalValue.replace(complexRegex, (parsedValue) => {
|
|
26
|
+
if (color.test(parsedValue)) {
|
|
27
|
+
indexes.color.push(i);
|
|
28
|
+
types.push(COLOR_TOKEN);
|
|
29
|
+
values.push(color.parse(parsedValue));
|
|
30
|
+
} else if (parsedValue.startsWith(VAR_FUNCTION_TOKEN)) {
|
|
31
|
+
indexes.var.push(i);
|
|
32
|
+
types.push(VAR_TOKEN);
|
|
33
|
+
values.push(parsedValue);
|
|
34
|
+
} else {
|
|
35
|
+
indexes.number.push(i);
|
|
36
|
+
types.push(NUMBER_TOKEN);
|
|
37
|
+
values.push(parseFloat(parsedValue));
|
|
38
|
+
}
|
|
39
|
+
++i;
|
|
40
|
+
return SPLIT_TOKEN;
|
|
41
|
+
});
|
|
42
|
+
const split = tokenised.split(SPLIT_TOKEN);
|
|
43
|
+
return { values, split, indexes, types };
|
|
44
|
+
}
|
|
45
|
+
function parseComplexValue(v) {
|
|
46
|
+
return analyseComplexValue(v).values;
|
|
47
|
+
}
|
|
48
|
+
function createTransformer(source) {
|
|
49
|
+
const { split, types } = analyseComplexValue(source);
|
|
50
|
+
const numSections = split.length;
|
|
51
|
+
return (v) => {
|
|
52
|
+
let output = "";
|
|
53
|
+
for (let i = 0; i < numSections; i++) {
|
|
54
|
+
output += split[i];
|
|
55
|
+
if (v[i] !== void 0) {
|
|
56
|
+
const type = types[i];
|
|
57
|
+
if (type === NUMBER_TOKEN) {
|
|
58
|
+
output += sanitize(v[i]);
|
|
59
|
+
} else if (type === COLOR_TOKEN) {
|
|
60
|
+
output += color.transform(v[i]);
|
|
61
|
+
} else {
|
|
62
|
+
output += v[i];
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
return output;
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
const convertNumbersToZero = (v) => typeof v === "number" ? 0 : v;
|
|
70
|
+
function getAnimatableNone(v) {
|
|
71
|
+
const parsed = parseComplexValue(v);
|
|
72
|
+
const transformer = createTransformer(v);
|
|
73
|
+
return transformer(parsed.map(convertNumbersToZero));
|
|
74
|
+
}
|
|
75
|
+
const complex = {
|
|
76
|
+
test,
|
|
77
|
+
parse: parseComplexValue,
|
|
78
|
+
createTransformer,
|
|
79
|
+
getAnimatableNone
|
|
80
|
+
};
|
|
81
|
+
export {
|
|
82
|
+
analyseComplexValue,
|
|
83
|
+
complex
|
|
84
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { clamp } from "../../../utils/clamp.mjs";
|
|
2
|
+
const number = {
|
|
3
|
+
test: (v) => typeof v === "number",
|
|
4
|
+
parse: parseFloat,
|
|
5
|
+
transform: (v) => v
|
|
6
|
+
};
|
|
7
|
+
const alpha = {
|
|
8
|
+
...number,
|
|
9
|
+
transform: (v) => clamp(0, 1, v)
|
|
10
|
+
};
|
|
11
|
+
const scale = {
|
|
12
|
+
...number,
|
|
13
|
+
default: 1
|
|
14
|
+
};
|
|
15
|
+
export {
|
|
16
|
+
alpha,
|
|
17
|
+
number,
|
|
18
|
+
scale
|
|
19
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
const createUnitType = (unit) => ({
|
|
2
|
+
test: (v) => typeof v === "string" && v.endsWith(unit) && v.split(" ").length === 1,
|
|
3
|
+
parse: parseFloat,
|
|
4
|
+
transform: (v) => `${v}${unit}`
|
|
5
|
+
});
|
|
6
|
+
const degrees = /* @__PURE__ */ createUnitType("deg");
|
|
7
|
+
const percent = /* @__PURE__ */ createUnitType("%");
|
|
8
|
+
const px = /* @__PURE__ */ createUnitType("px");
|
|
9
|
+
const vh = /* @__PURE__ */ createUnitType("vh");
|
|
10
|
+
const vw = /* @__PURE__ */ createUnitType("vw");
|
|
11
|
+
const progressPercentage = {
|
|
12
|
+
...percent,
|
|
13
|
+
parse: (v) => percent.parse(v) / 100,
|
|
14
|
+
transform: (v) => percent.transform(v * 100)
|
|
15
|
+
};
|
|
16
|
+
export {
|
|
17
|
+
degrees,
|
|
18
|
+
percent,
|
|
19
|
+
progressPercentage,
|
|
20
|
+
px,
|
|
21
|
+
vh,
|
|
22
|
+
vw
|
|
23
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { isWillChangeMotionValue } from "./is.mjs";
|
|
2
|
+
function addValueToWillChange(visualElement, key) {
|
|
3
|
+
const willChange = visualElement.getValue("willChange");
|
|
4
|
+
if (isWillChangeMotionValue(willChange)) {
|
|
5
|
+
return willChange.add(key);
|
|
6
|
+
}
|
|
7
|
+
}
|
|
8
|
+
export {
|
|
9
|
+
addValueToWillChange
|
|
10
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
var warning = function() {
|
|
2
|
+
};
|
|
3
|
+
var invariant = function() {
|
|
4
|
+
};
|
|
5
|
+
if (process.env.NODE_ENV !== "production") {
|
|
6
|
+
warning = function(check, message) {
|
|
7
|
+
if (!check && typeof console !== "undefined") {
|
|
8
|
+
console.warn(message);
|
|
9
|
+
}
|
|
10
|
+
};
|
|
11
|
+
invariant = function(check, message) {
|
|
12
|
+
if (!check) {
|
|
13
|
+
throw new Error(message);
|
|
14
|
+
}
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
export {
|
|
18
|
+
invariant,
|
|
19
|
+
warning
|
|
20
|
+
};
|