motion-v
Version:
<h1 align="center"> <img width="35" height="35" alt="Motion logo" src="https://github.com/user-attachments/assets/00d6d1c3-72c4-4c2f-a664-69da13182ffc" /><br />Motion for Vue</h1>
16 lines (15 loc) • 465 B
JavaScript
import { getMotionElement } from "../components/hooks/use-motion-elm.mjs";
import { ref } from "vue";
function useDomRef() {
const dom = ref(null);
return new Proxy(dom, {
get(target, key) {
if (typeof key === "string" || typeof key === "symbol") return Reflect.get(target, key);
},
set(target, key, value) {
if (key === "value") return Reflect.set(target, key, getMotionElement(value?.$el || value));
return true;
}
});
}
export { useDomRef };