type RawSlots,
type StaticSlots,
type VaporSlot,
- currentSlotOwner,
dynamicSlotsProxyHandlers,
+ getScopeOwner,
getSlot,
setCurrentSlotOwner,
} from './componentSlots'
: rawSlots
: EMPTY_OBJ
- // Use currentSlotOwner for scopeId inheritance when inside a slot
- // This ensures components created in slots inherit the slot owner's scopeId
- const scopeOwner = currentSlotOwner || currentInstance
+ const scopeOwner = getScopeOwner()
this.scopeId = scopeOwner && scopeOwner.type.__scopeId
// apply custom element special handling
;(el as any).$root = isSingleRoot
if (!isHydrating) {
- // Use currentSlotOwner for scopeId when inside a slot
- const scopeOwner = currentSlotOwner || currentInstance
+ const scopeOwner = getScopeOwner()
const scopeId = scopeOwner!.type.__scopeId
if (scopeId) setScopeId(el, [scopeId])
}
* Get the effective slot instance for accessing rawSlots and scopeId.
* Prefers currentSlotOwner (if inside a slot), falls back to currentInstance.
*/
-export function getSlotInstance(): VaporComponentInstance {
+export function getScopeOwner(): VaporComponentInstance {
return (currentSlotOwner || currentInstance) as VaporComponentInstance
}
const _isLastInsertion = isLastInsertion
if (!isHydrating) resetInsertionState()
- // Use slot owner if inside a slot (forwarded slots), otherwise use currentInstance
- const instance = getSlotInstance()
+ const instance = getScopeOwner()
const rawSlots = instance.rawSlots
const slotProps = rawProps
? new Proxy(rawProps, rawPropsProxyHandlers)
} from '@vue/shared'
import { type RawProps, rawPropsProxyHandlers } from './componentProps'
import type { RawSlots, VaporSlot } from './componentSlots'
-import { currentSlotScopeIds, getSlotInstance } from './componentSlots'
+import { currentSlotScopeIds, getScopeOwner } from './componentSlots'
import { renderEffect } from './renderEffect'
import { _next, createTextNode } from './dom/node'
import { optimizePropertyLookup } from './dom/prop'
frag.nodes = vnode.el as any
}
- // Use currentSlotOwner for scopeId when inside a slot
- const scopeOwner = getSlotInstance()
+ const scopeOwner = getScopeOwner()
vnode.scopeId = (scopeOwner && scopeOwner.type.__scopeId) || null
vnode.slotScopeIds = currentSlotScopeIds