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>

23 lines (22 loc) 726 B
import { useCombineMotionValues } from "./use-combine-values.mjs"; import { isMotionValue } from "../external/.pnpm/motion-dom@12.23.12/external/motion-dom/dist/es/value/utils/is-motion-value.mjs"; function useMotionTemplate(fragments, ...values) { const numFragments = fragments.length; function buildValue() { let output = ""; for (let i = 0; i < numFragments; i++) { output += fragments[i]; const value2 = values[i]; if (value2) { output += isMotionValue(value2) ? value2.get() : value2; } } return output; } const { value, subscribe } = useCombineMotionValues(buildValue); subscribe(values.filter(isMotionValue)); return value; } export { useMotionTemplate };