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 ad2344e6_3a5b_8f6e_1810_1802147c80c8["normalizeScopedSlots()"] fa879678_0767_c9f5_f3e2_55c3620ec148["initRender()"] fa879678_0767_c9f5_f3e2_55c3620ec148 -->|calls| ad2344e6_3a5b_8f6e_1810_1802147c80c8 0c80f6b1_99f1_9c51_75ee_9bd37a1ef857["renderMixin()"] 0c80f6b1_99f1_9c51_75ee_9bd37a1ef857 -->|calls| ad2344e6_3a5b_8f6e_1810_1802147c80c8 2a3d2c68_f002_d816_7b35_bdbc95f4434c["FunctionalRenderContext()"] 2a3d2c68_f002_d816_7b35_bdbc95f4434c -->|calls| ad2344e6_3a5b_8f6e_1810_1802147c80c8 4654ec48_ee34_3880_324a_14ac626facd2["normalizeScopedSlot()"] ad2344e6_3a5b_8f6e_1810_1802147c80c8 -->|calls| 4654ec48_ee34_3880_324a_14ac626facd2 adcfcba5_6c4a_7556_e2e8_bb8a9f1bca7a["proxyNormalSlot()"] ad2344e6_3a5b_8f6e_1810_1802147c80c8 -->|calls| adcfcba5_6c4a_7556_e2e8_bb8a9f1bca7a style ad2344e6_3a5b_8f6e_1810_1802147c80c8 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