normalizeScopedSlots() — vue Function Reference
Architecture documentation for the normalizeScopedSlots() function in normalize-scoped-slots.ts from the vue codebase.
Entity Profile
Dependency Diagram
graph TD 7f59d675_8a0c_03b6_a7a6_985942631eb0["normalizeScopedSlots()"] e088d580_2e3e_9093_295c_70dc92327b67["initRender()"] e088d580_2e3e_9093_295c_70dc92327b67 -->|calls| 7f59d675_8a0c_03b6_a7a6_985942631eb0 70955a0b_0285_0cc3_de2f_6b5cc0bcd0dd["renderMixin()"] 70955a0b_0285_0cc3_de2f_6b5cc0bcd0dd -->|calls| 7f59d675_8a0c_03b6_a7a6_985942631eb0 7687c516_230a_8fa2_229a_3ce9660be4d2["FunctionalRenderContext()"] 7687c516_230a_8fa2_229a_3ce9660be4d2 -->|calls| 7f59d675_8a0c_03b6_a7a6_985942631eb0 c7f1d55d_2699_9c30_8e7e_777b218e0242["normalizeScopedSlot()"] 7f59d675_8a0c_03b6_a7a6_985942631eb0 -->|calls| c7f1d55d_2699_9c30_8e7e_777b218e0242 1cb19543_8993_089d_9305_b30238c646d1["proxyNormalSlot()"] 7f59d675_8a0c_03b6_a7a6_985942631eb0 -->|calls| 1cb19543_8993_089d_9305_b30238c646d1 style 7f59d675_8a0c_03b6_a7a6_985942631eb0 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
src/core/vdom/helpers/normalize-scoped-slots.ts lines 9–63
export function normalizeScopedSlots(
ownerVm: Component,
scopedSlots: { [key: string]: Function } | undefined,
normalSlots: { [key: string]: VNode[] },
prevScopedSlots?: { [key: string]: Function }
): any {
let res
const hasNormalSlots = Object.keys(normalSlots).length > 0
const isStable = scopedSlots ? !!scopedSlots.$stable : !hasNormalSlots
const key = scopedSlots && scopedSlots.$key
if (!scopedSlots) {
res = {}
} else if (scopedSlots._normalized) {
// fast path 1: child component re-render only, parent did not change
return scopedSlots._normalized
} else if (
isStable &&
prevScopedSlots &&
prevScopedSlots !== emptyObject &&
key === prevScopedSlots.$key &&
!hasNormalSlots &&
!prevScopedSlots.$hasNormal
) {
// fast path 2: stable scoped slots w/ no normal slots to proxy,
// only need to normalize once
return prevScopedSlots
} else {
res = {}
for (const key in scopedSlots) {
if (scopedSlots[key] && key[0] !== '$') {
res[key] = normalizeScopedSlot(
ownerVm,
normalSlots,
key,
scopedSlots[key]
)
}
}
}
// expose normal slots on scopedSlots
for (const key in normalSlots) {
if (!(key in res)) {
res[key] = proxyNormalSlot(normalSlots, key)
}
}
// avoriaz seems to mock a non-extensible $scopedSlots object
// and when that is passed down this would cause an error
if (scopedSlots && Object.isExtensible(scopedSlots)) {
scopedSlots._normalized = res
}
def(res, '$stable', isStable)
def(res, '$key', key)
def(res, '$hasNormal', hasNormalSlots)
return res
}
Domain
Subdomains
Source
Frequently Asked Questions
What does normalizeScopedSlots() do?
normalizeScopedSlots() is a function in the vue codebase.
What does normalizeScopedSlots() call?
normalizeScopedSlots() calls 2 function(s): normalizeScopedSlot, proxyNormalSlot.
What calls normalizeScopedSlots()?
normalizeScopedSlots() is called by 3 function(s): FunctionalRenderContext, initRender, renderMixin.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free