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 e490d83e_fe82_d38d_a362_5157771a3160["normalizeScopedSlots()"] 091d06a8_6793_746a_7499_d22a1d025196["normalize-scoped-slots.ts"] e490d83e_fe82_d38d_a362_5157771a3160 -->|defined in| 091d06a8_6793_746a_7499_d22a1d025196 bdbcb4df_444f_38c6_ba9d_20ef23f9091f["initRender()"] bdbcb4df_444f_38c6_ba9d_20ef23f9091f -->|calls| e490d83e_fe82_d38d_a362_5157771a3160 663f50a8_8d82_e040_32bd_1250a516fe5f["renderMixin()"] 663f50a8_8d82_e040_32bd_1250a516fe5f -->|calls| e490d83e_fe82_d38d_a362_5157771a3160 2b1a34a9_e713_84e7_6b26_d06155dba96c["FunctionalRenderContext()"] 2b1a34a9_e713_84e7_6b26_d06155dba96c -->|calls| e490d83e_fe82_d38d_a362_5157771a3160 1b52839f_58e1_4d85_bfad_8c56ba11960f["normalizeScopedSlot()"] e490d83e_fe82_d38d_a362_5157771a3160 -->|calls| 1b52839f_58e1_4d85_bfad_8c56ba11960f 14f0b836_67f8_36e0_adac_77a150e32676["proxyNormalSlot()"] e490d83e_fe82_d38d_a362_5157771a3160 -->|calls| 14f0b836_67f8_36e0_adac_77a150e32676 style e490d83e_fe82_d38d_a362_5157771a3160 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, defined in src/core/vdom/helpers/normalize-scoped-slots.ts.
Where is normalizeScopedSlots() defined?
normalizeScopedSlots() is defined in src/core/vdom/helpers/normalize-scoped-slots.ts at line 9.
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