routie dev init since i didn't adhere to any proper guidance up until now
This commit is contained in:
+63
@@ -0,0 +1,63 @@
|
||||
//#region node_modules/vuetify/lib/composables/forwardRefs.js
|
||||
var Refs = Symbol("Forwarded refs");
|
||||
/** Omit properties starting with P */
|
||||
/** Omit keyof $props from T */
|
||||
function getDescriptor(obj, key) {
|
||||
let currentObj = obj;
|
||||
while (currentObj) {
|
||||
const descriptor = Reflect.getOwnPropertyDescriptor(currentObj, key);
|
||||
if (descriptor) return descriptor;
|
||||
currentObj = Object.getPrototypeOf(currentObj);
|
||||
}
|
||||
}
|
||||
function forwardRefs(target, ...refs) {
|
||||
target[Refs] = refs;
|
||||
return new Proxy(target, {
|
||||
get(target, key) {
|
||||
if (Reflect.has(target, key)) return Reflect.get(target, key);
|
||||
if (typeof key === "symbol" || key.startsWith("$") || key.startsWith("__")) return;
|
||||
for (const ref of refs) if (ref.value && Reflect.has(ref.value, key)) {
|
||||
const val = Reflect.get(ref.value, key);
|
||||
return typeof val === "function" ? val.bind(ref.value) : val;
|
||||
}
|
||||
},
|
||||
has(target, key) {
|
||||
if (Reflect.has(target, key)) return true;
|
||||
if (typeof key === "symbol" || key.startsWith("$") || key.startsWith("__")) return false;
|
||||
for (const ref of refs) if (ref.value && Reflect.has(ref.value, key)) return true;
|
||||
return false;
|
||||
},
|
||||
set(target, key, value) {
|
||||
if (Reflect.has(target, key)) return Reflect.set(target, key, value);
|
||||
if (typeof key === "symbol" || key.startsWith("$") || key.startsWith("__")) return false;
|
||||
for (const ref of refs) if (ref.value && Reflect.has(ref.value, key)) return Reflect.set(ref.value, key, value);
|
||||
return false;
|
||||
},
|
||||
getOwnPropertyDescriptor(target, key) {
|
||||
const descriptor = Reflect.getOwnPropertyDescriptor(target, key);
|
||||
if (descriptor) return descriptor;
|
||||
if (typeof key === "symbol" || key.startsWith("$") || key.startsWith("__")) return;
|
||||
for (const ref of refs) {
|
||||
if (!ref.value) continue;
|
||||
const descriptor = getDescriptor(ref.value, key) ?? ("_" in ref.value ? getDescriptor(ref.value._?.setupState, key) : void 0);
|
||||
if (descriptor) return descriptor;
|
||||
}
|
||||
for (const ref of refs) {
|
||||
const childRefs = ref.value && ref.value[Refs];
|
||||
if (!childRefs) continue;
|
||||
const queue = childRefs.slice();
|
||||
while (queue.length) {
|
||||
const ref = queue.shift();
|
||||
const descriptor = getDescriptor(ref.value, key);
|
||||
if (descriptor) return descriptor;
|
||||
const childRefs = ref.value && ref.value[Refs];
|
||||
if (childRefs) queue.push(...childRefs);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
//#endregion
|
||||
export { forwardRefs as t };
|
||||
|
||||
//# sourceMappingURL=forwardRefs-CW3d8km7.js.map
|
||||
Reference in New Issue
Block a user