wip(ssr): restructure
This commit is contained in:
@@ -103,6 +103,7 @@ export { registerRuntimeCompiler } from './component'
|
||||
|
||||
// For server-renderer
|
||||
export { createComponentInstance, setupComponent } from './component'
|
||||
export { renderComponentRoot } from './componentRenderUtils'
|
||||
|
||||
// Types -----------------------------------------------------------------------
|
||||
|
||||
|
||||
@@ -4,7 +4,9 @@ import {
|
||||
isString,
|
||||
isObject,
|
||||
EMPTY_ARR,
|
||||
extend
|
||||
extend,
|
||||
normalizeClass,
|
||||
normalizeStyle
|
||||
} from '@vue/shared'
|
||||
import {
|
||||
ComponentInternalInstance,
|
||||
@@ -378,43 +380,6 @@ export function normalizeChildren(vnode: VNode, children: unknown) {
|
||||
vnode.shapeFlag |= type
|
||||
}
|
||||
|
||||
function normalizeStyle(
|
||||
value: unknown
|
||||
): Record<string, string | number> | void {
|
||||
if (isArray(value)) {
|
||||
const res: Record<string, string | number> = {}
|
||||
for (let i = 0; i < value.length; i++) {
|
||||
const normalized = normalizeStyle(value[i])
|
||||
if (normalized) {
|
||||
for (const key in normalized) {
|
||||
res[key] = normalized[key]
|
||||
}
|
||||
}
|
||||
}
|
||||
return res
|
||||
} else if (isObject(value)) {
|
||||
return value
|
||||
}
|
||||
}
|
||||
|
||||
export function normalizeClass(value: unknown): string {
|
||||
let res = ''
|
||||
if (isString(value)) {
|
||||
res = value
|
||||
} else if (isArray(value)) {
|
||||
for (let i = 0; i < value.length; i++) {
|
||||
res += normalizeClass(value[i]) + ' '
|
||||
}
|
||||
} else if (isObject(value)) {
|
||||
for (const name in value) {
|
||||
if (value[name]) {
|
||||
res += name + ' '
|
||||
}
|
||||
}
|
||||
}
|
||||
return res.trim()
|
||||
}
|
||||
|
||||
const handlersRE = /^on|^vnode/
|
||||
|
||||
export function mergeProps(...args: (Data & VNodeProps)[]) {
|
||||
|
||||
Reference in New Issue
Block a user