wip: revert some changes

This commit is contained in:
daiwei 2025-03-06 14:35:16 +08:00
parent 31d9247eb7
commit 3cb3e1ac39
4 changed files with 4 additions and 21 deletions

View File

@ -35,7 +35,7 @@ export function renderSlot(
let slot = slots[name]
// vapor slots rendered in vdom
if (slot && slots.__interop) {
if (slot && slots._vapor) {
const ret = (openBlock(), createBlock(VaporSlot, props))
ret.vs = { slot, fallback }
return ret

View File

@ -56,7 +56,6 @@ import {
type VaporSlot,
dynamicSlotsProxyHandlers,
getSlot,
staticSlotsProxyHandler,
} from './componentSlots'
import { hmrReload, hmrRerender } from './hmr'
@ -417,7 +416,7 @@ export class VaporComponentInstance implements GenericComponentInstance {
this.slots = rawSlots
? rawSlots.$
? new Proxy(rawSlots, dynamicSlotsProxyHandlers)
: new Proxy(rawSlots, staticSlotsProxyHandler)
: rawSlots
: EMPTY_OBJ
}

View File

@ -16,24 +16,8 @@ export type DynamicSlot = { name: string; fn: VaporSlot }
export type DynamicSlotFn = () => DynamicSlot | DynamicSlot[]
export type DynamicSlotSource = StaticSlots | DynamicSlotFn
export const staticSlotsProxyHandler: ProxyHandler<any> = {
get(target, key) {
if (key === '__vapor') {
return true
} else {
return target[key]
}
},
}
export const dynamicSlotsProxyHandlers: ProxyHandler<RawSlots> = {
get: (target, key: string) => {
if (key === '__vapor') {
return true
} else {
return getSlot(target, key)
}
},
get: getSlot,
has: (target, key: string) => !!getSlot(target, key),
getOwnPropertyDescriptor(target, key: string) {
const slot = getSlot(target, key)

View File

@ -133,7 +133,7 @@ const vaporSlotPropsProxyHandler: ProxyHandler<
const vaporSlotsProxyHandler: ProxyHandler<any> = {
get(target, key) {
if (key === '__interop') {
if (key === '_vapor') {
return target
} else {
return target[key]