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] let slot = slots[name]
// vapor slots rendered in vdom // vapor slots rendered in vdom
if (slot && slots.__interop) { if (slot && slots._vapor) {
const ret = (openBlock(), createBlock(VaporSlot, props)) const ret = (openBlock(), createBlock(VaporSlot, props))
ret.vs = { slot, fallback } ret.vs = { slot, fallback }
return ret return ret

View File

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

View File

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

View File

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