dirs && invokeDirectiveHook(n2, n1, parentComponent, 'updated')
}, parentSuspense)
}
+
+ if (el._isVueCE && !el._def.shadowRoot) {
+ el._updateSlots(n2.children)
+ }
}
// The fast path for blocks.
* @internal custom element interception hook
*/
ce?: (instance: ComponentInternalInstance) => void
+ /**
+ * @internal
+ */
+ slotName?: string
}
// Since v-if and v-for are the two possible ways node structure can dynamically
anchor: vnode.anchor,
ctx: vnode.ctx,
ce: vnode.ce,
+ slotName: vnode.slotName,
}
// if the vnode will be replaced by the cloned one, it is necessary
type EmitsOptions,
type EmitsToProps,
type ExtractPropTypes,
+ Fragment,
type MethodOptions,
type RenderFunction,
type SetupContext,
type SlotsType,
type VNode,
+ type VNodeArrayChildren,
type VNodeProps,
createVNode,
defineComponent,
getCurrentInstance,
+ isVNode,
nextTick,
unref,
warn,
}
}
+ /**
+ * @internal
+ */
+ _updateSlots(children: VNode[]): void {
+ children.forEach(child => {
+ this._slots![child.slotName!] = collectElements(
+ child.children as VNodeArrayChildren,
+ )
+ })
+ }
+
/**
* @internal
*/
const el = __DEV__ ? useHost('useShadowRoot') : useHost()
return el && el.shadowRoot
}
+
+function collectElements(children: VNodeArrayChildren): Node[] {
+ const nodes: Node[] = []
+ for (const vnode of children) {
+ if (isArray(vnode)) {
+ nodes.push(...collectElements(vnode))
+ } else if (isVNode(vnode)) {
+ if (vnode.type === Fragment) {
+ nodes.push(...collectElements(vnode.children as VNodeArrayChildren))
+ } else if (vnode.el) {
+ nodes.push(vnode.el as Node)
+ }
+ }
+ }
+ return nodes
+}