Files
NapCatQQ/.pnpm-store/v3/files/32/f90150a153f7519892cce4b260ce65a1dec6875774f77488fb000e9de1d4094a368cc6201e972554b0af0e1d5e756a6c4405d681e347b8e79a9469b084055e
T
TanTan e311ca3275
Build NapCat Artifacts / Windows Loader Test (push) Canceled after 0s
Build NapCat Artifacts / Type Check & Test (push) Canceled after 0s
Build NapCat Artifacts / Build NapCat.Framework (push) Canceled after 0s
Build NapCat Artifacts / Build NapCat.Shell (push) Canceled after 0s
docs: 仓库链接指向本镜像仓库
2026-11-13 09:25:58 +08:00

23 lines
847 B
Plaintext

"use client";
import { attachSpring, isMotionValue } from 'motion-dom';
import { useContext, useInsertionEffect } from 'react';
import { MotionConfigContext } from '../context/MotionConfigContext.mjs';
import { useMotionValue } from './use-motion-value.mjs';
import { useTransform } from './use-transform.mjs';
function useSpring(source, options = {}) {
const { isStatic } = useContext(MotionConfigContext);
const getFromSource = () => (isMotionValue(source) ? source.get() : source);
// isStatic will never change, allowing early hooks return
if (isStatic) {
return useTransform(getFromSource);
}
const value = useMotionValue(getFromSource());
useInsertionEffect(() => {
return attachSpring(value, source, options);
}, [value, JSON.stringify(options)]);
return value;
}
export { useSpring };