import { useCombineMotionValues } from "./use-combine-values.mjs"; import { collectMotionValues } from "motion-dom"; import { watchEffect } from "vue"; //#region src/value/use-computed.ts function useComputed(computed) { /** * Open session of collectMotionValues. Any MotionValue that calls get() * will be saved into this array. */ collectMotionValues.current = []; const { value, subscribe, unsubscribe, updateValue } = useCombineMotionValues(computed); subscribe(collectMotionValues.current); collectMotionValues.current = void 0; watchEffect(() => { unsubscribe(); collectMotionValues.current = []; updateValue(); subscribe(collectMotionValues.current); collectMotionValues.current = void 0; }); return value; } //#endregion export { useComputed };