UNPKG

motion-v

Version:

<p align="center"> <img width="100" height="100" alt="Motion logo" src="https://user-images.githubusercontent.com/7850794/164965523-3eced4c4-6020-467e-acde-f11b7900ad62.png" /> </p> <h1 align="center">Motion for Vue</h1>

37 lines (36 loc) 908 B
import { lazyMotionContextProvider } from "./context.mjs"; import { defineComponent, ref } from "vue"; const LazyMotion = defineComponent({ name: "LazyMotion", inheritAttrs: false, props: { features: { type: [Object, Function], default: () => [] }, strict: { type: Boolean, default: false } }, setup(props, { slots }) { const features = ref(Array.isArray(props.features) ? props.features : []); if (!Array.isArray(props.features)) { const featuresPromise = typeof props.features === "function" ? props.features() : props.features; featuresPromise.then((feats) => { features.value = feats; }); } lazyMotionContextProvider({ features, strict: props.strict }); return () => { var _a; return (_a = slots.default) == null ? void 0 : _a.call(slots); }; } }); export { LazyMotion };