Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
public renderVNodeToQueue(vNode, context, position) {
const flags = vNode.flags;
const type = vNode.type;
const props = vNode.props || EMPTY_OBJ;
const children = vNode.children;
// Handles a component render
if ((flags & VNodeFlags.Component) > 0) {
const isClass = flags & VNodeFlags.ComponentClass;
// Render the
if (isClass) {
const instance = new type(props, context);
const hasNewAPI = Boolean(type.getDerivedStateFromProps);
instance.$BS = false;
instance.$SSR = true;
let childContext;
if (!isUndefined(instance.getChildContext)) {
childContext = instance.getChildContext();
}
if (!isNullOrUndef(childContext)) {
context = combineFrom(context, childContext);
}
if (instance.props === EMPTY_OBJ) {
instance.props = props;
function render(vNode, container, cb) {
_render(vNode, container, cb);
if (vNode && vNode.flags & VNodeFlags.Component) {
return vNode.children;
}
}
public renderNode(vNode, context) {
const flags = vNode.flags;
if ((flags & VNodeFlags.Component) > 0) {
return this.renderComponent(vNode, context, flags & VNodeFlags.ComponentClass);
}
if ((flags & VNodeFlags.Element) > 0) {
return this.renderElement(vNode, context);
}
return this.renderText(vNode);
}
function hydrateVNode(vNode: VNode, parentDOM: Element, currentDom: Element, context: Object, isSVG: boolean, lifecycle: Function[]): Element | null {
const flags = (vNode.flags |= VNodeFlags.InUse);
if (flags & VNodeFlags.Component) {
return hydrateComponent(vNode, parentDOM, currentDom, context, isSVG, (flags & VNodeFlags.ComponentClass) > 0, lifecycle);
}
if (flags & VNodeFlags.Element) {
return hydrateElement(vNode, parentDOM, currentDom, context, isSVG, lifecycle);
}
if (flags & VNodeFlags.Text) {
return hydrateText(vNode, parentDOM, currentDom);
}
if (flags & VNodeFlags.Void) {
return (vNode.dom = currentDom);
}
if (flags & VNodeFlags.Fragment) {
return hydrateFragment(vNode, parentDOM, currentDom, context, isSVG, lifecycle);
}
if (process.env.NODE_ENV !== 'production') {
function renderVNodeToString(vNode, parent, context): string {
const flags = vNode.flags;
const type = vNode.type;
const props = vNode.props || EMPTY_OBJ;
const children = vNode.children;
if ((flags & VNodeFlags.Component) !== 0) {
const isClass = flags & VNodeFlags.ComponentClass;
if (isClass) {
const instance = new type(props, context);
const hasNewAPI = Boolean(type.getDerivedStateFromProps);
instance.$BS = false;
instance.$SSR = true;
let childContext;
if (isFunction(instance.getChildContext)) {
childContext = instance.getChildContext();
}
if (isNullOrUndef(childContext)) {
childContext = context;
} else {
childContext = combineFrom(context, childContext);
props = {};
}
if (childLen === 1) {
children = _children;
} else if (childLen > 1) {
children = [];
while (childLen-- > 0) {
children[childLen] = arguments[childLen + 2];
}
}
props.children = children;
if (flags & VNodeFlags.Component) {
return createComponentVNode(flags, vNodeToClone.type, !vNodeToClone.props && !props ? EMPTY_OBJ : combineFrom(vNodeToClone.props, props), key, ref);
}
if (flags & VNodeFlags.Text) {
return createTextVNode(children);
}
if (flags & VNodeFlags.Fragment) {
return createFragment(childLen === 1 ? [children] : children, ChildFlags.UnknownChildren, key);
}
return normalizeProps(
createVNode(flags, vNodeToClone.type, className, null, ChildFlags.HasInvalidChildren, combineFrom(vNodeToClone.props, props), key, ref)
);
}
export function cloneVNode(vNodeToClone: VNode, props?, _children?): VNode {
const flags = vNodeToClone.flags;
let children = flags & VNodeFlags.Component ? vNodeToClone.props && vNodeToClone.props.children : vNodeToClone.children;
let childLen = arguments.length - 2;
let className = vNodeToClone.className;
let key = vNodeToClone.key;
let ref = vNodeToClone.ref;
if (props) {
if (props.className !== void 0) {
className = props.className as string;
}
if (props.ref !== void 0) {
ref = props.ref;
}
if (props.key !== void 0) {
key = props.key;
}
if (props.children !== void 0) {
children = props.children;
function render(rootInput, container, cb = null, context = EMPTY_OBJ) {
__render(rootInput, container, cb, context);
const input = container.$V;
if (input && input.flags & VNodeFlags.Component) {
return input.children;
}
}