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 1e1e5127_e2df_8612_b7e7_d738cde5407a["normalizeScopedSlots()"] 81712410_81a9_d297_5ff3_adabfc4f54fd["normalize-scoped-slots.ts"] 1e1e5127_e2df_8612_b7e7_d738cde5407a -->|defined in| 81712410_81a9_d297_5ff3_adabfc4f54fd f4a31343_8d36_5571_8c89_ce5e074a5044["initRender()"] f4a31343_8d36_5571_8c89_ce5e074a5044 -->|calls| 1e1e5127_e2df_8612_b7e7_d738cde5407a a3383990_e98a_f7ae_9ab4_763f5e3094ee["renderMixin()"] a3383990_e98a_f7ae_9ab4_763f5e3094ee -->|calls| 1e1e5127_e2df_8612_b7e7_d738cde5407a c5286b65_3542_0b12_cbd4_8f0583f72f9a["FunctionalRenderContext()"] c5286b65_3542_0b12_cbd4_8f0583f72f9a -->|calls| 1e1e5127_e2df_8612_b7e7_d738cde5407a 72a3f991_d789_17e8_708a_f9561a217d44["normalizeScopedSlot()"] 1e1e5127_e2df_8612_b7e7_d738cde5407a -->|calls| 72a3f991_d789_17e8_708a_f9561a217d44 bf7c246d_6539_8adc_387f_fd0feda1e5c5["proxyNormalSlot()"] 1e1e5127_e2df_8612_b7e7_d738cde5407a -->|calls| bf7c246d_6539_8adc_387f_fd0feda1e5c5 style 1e1e5127_e2df_8612_b7e7_d738cde5407a 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