<commit_before>import { isNullOrUndefined } from './utils';
import { createUniversalElement } from './universal';

function VNode(blueprint) {
	this.bp = blueprint;
	this.dom = null;
	this.instance = null;
	this.tag = null;
	this.children = null;
	this.style = null;
	this.className = null;
	this.attrs = null;
	this.events = null;
	this.hooks = null;
	this.key = null;
}

VNode.prototype = {
	setAttrs(attrs) {
		this.attrs = attrs;
		return this;
	},
	setTag(tag) {
		this.tag = tag;
		return this;
	},
	setStyle(style) {
		this.style = style;
		return this;
	},
	setClassName(className) {
		this.className = className;
		return this;
	},
	setChildren(children) {
		this.children = children;
		return this;
	},
	setHooks(hooks) {
		this.hooks = hooks;
		return this;
	},
	setEvents(events) {
		this.events = events;
		return this;
	},
	setKey(key) {
		this.key = key;
		return this;
	}
};

export function createVNode(tpl) {
	return new VNode(tpl);
}

export function createBlueprint(shape, childrenType) {
	const tag = shape.tag || null;
	const tagIsDynamic = tag && tag.arg !== undefined ? true : false;

	const children = !isNullOrUndefined(shape.children) ? shape.children : null;
	const childrenIsDynamic = children && children.arg !== undefined ? true : false;

	const attrs = shape.attrs || null;
	const attrsIsDynamic = attrs && attrs.arg !== undefined ? true : false;

	const hooks = shape.hooks || null;
	const hooksIsDynamic = hooks && hooks.arg !== undefined ? true : false;

	const events = shape.events || null;
	const eventsIsDynamic = events && events.arg !== undefined ? true : false;

	const key = shape.key !== undefined ? shape.key : null;
	const keyIsDynamic = !isNullOrUndefined(key) && !isNullOrUndefined(key.arg);

	const style = shape.style || null;
	const styleIsDynamic = style && style.arg !== undefined ? true : false;

	const className = shape.className !== undefined ? shape.className : null;
	const classNameIsDynamic = className && className.arg !== undefined ? true : false;

	const blueprint = {
		dom: null,
		pools: {
			keyed: {},
			nonKeyed: []
		},
		tag: !tagIsDynamic ? tag : null,
		className: className !== '' && className ? className : null,
		style: style !== '' && style ? style : null,
		isComponent: tagIsDynamic,
		hasAttrs: attrsIsDynamic,
		hasHooks: hooksIsDynamic,
		hasEvents: eventsIsDynamic,
		hasStyle: styleIsDynamic || (style !== '' && style ? true : false),
		hasClassName: classNameIsDynamic || (className !== '' && className ? true : false),
		childrenType: childrenType === undefined ? (children ? 5 : 0) : childrenType,
		attrKeys: null,
		eventKeys: null,
		isSVG: shape.isSVG || false
	};

	return function () {
		const vNode = new VNode(blueprint);

		if (tagIsDynamic === true) {
			vNode.tag = arguments[tag.arg];
		}
		if (childrenIsDynamic === true) {
			vNode.children = arguments[children.arg];
		}
		if (attrsIsDynamic === true) {
			vNode.attrs = arguments[attrs.arg];
		} else {
			if (tagIsDynamic && attrs) {
				vNode.attrs = attrs;
			}
		}
		if (hooksIsDynamic === true) {
			vNode.hooks = arguments[hooks.arg];
		}
		if (eventsIsDynamic === true) {
			vNode.events = arguments[events.arg];
		}
		if (keyIsDynamic === true) {
			vNode.key = arguments[key.arg];
		}
		if (styleIsDynamic === true) {
			vNode.style = arguments[style.arg];
		} else {
			vNode.style = blueprint.style;
		}
		if (classNameIsDynamic === true) {
			vNode.className = arguments[className.arg];
		} else {
			vNode.className = blueprint.className;
		}


		return vNode;
	};
}
<commit_msg>blueprints now use static attrs correctly<commit_after>import { isNullOrUndefined } from './utils';
import { createUniversalElement } from './universal';

function VNode(blueprint) {
	this.bp = blueprint;
	this.dom = null;
	this.instance = null;
	this.tag = null;
	this.children = null;
	this.style = null;
	this.className = null;
	this.attrs = null;
	this.events = null;
	this.hooks = null;
	this.key = null;
}

VNode.prototype = {
	setAttrs(attrs) {
		this.attrs = attrs;
		return this;
	},
	setTag(tag) {
		this.tag = tag;
		return this;
	},
	setStyle(style) {
		this.style = style;
		return this;
	},
	setClassName(className) {
		this.className = className;
		return this;
	},
	setChildren(children) {
		this.children = children;
		return this;
	},
	setHooks(hooks) {
		this.hooks = hooks;
		return this;
	},
	setEvents(events) {
		this.events = events;
		return this;
	},
	setKey(key) {
		this.key = key;
		return this;
	}
};

export function createVNode(tpl) {
	return new VNode(tpl);
}

export function createBlueprint(shape, childrenType) {
	const tag = shape.tag || null;
	const tagIsDynamic = tag && tag.arg !== undefined ? true : false;

	const children = !isNullOrUndefined(shape.children) ? shape.children : null;
	const childrenIsDynamic = children && children.arg !== undefined ? true : false;

	const attrs = shape.attrs || null;
	const attrsIsDynamic = attrs && attrs.arg !== undefined ? true : false;

	const hooks = shape.hooks || null;
	const hooksIsDynamic = hooks && hooks.arg !== undefined ? true : false;

	const events = shape.events || null;
	const eventsIsDynamic = events && events.arg !== undefined ? true : false;

	const key = shape.key !== undefined ? shape.key : null;
	const keyIsDynamic = !isNullOrUndefined(key) && !isNullOrUndefined(key.arg);

	const style = shape.style || null;
	const styleIsDynamic = style && style.arg !== undefined ? true : false;

	const className = shape.className !== undefined ? shape.className : null;
	const classNameIsDynamic = className && className.arg !== undefined ? true : false;

	const blueprint = {
		dom: null,
		pools: {
			keyed: {},
			nonKeyed: []
		},
		tag: !tagIsDynamic ? tag : null,
		className: className !== '' && className ? className : null,
		style: style !== '' && style ? style : null,
		isComponent: tagIsDynamic,
		hasAttrs: attrsIsDynamic || (attrs ? true : false),
		hasHooks: hooksIsDynamic,
		hasEvents: eventsIsDynamic,
		hasStyle: styleIsDynamic || (style !== '' && style ? true : false),
		hasClassName: classNameIsDynamic || (className !== '' && className ? true : false),
		childrenType: childrenType === undefined ? (children ? 5 : 0) : childrenType,
		attrKeys: null,
		eventKeys: null,
		isSVG: shape.isSVG || false
	};

	return function () {
		const vNode = new VNode(blueprint);

		if (tagIsDynamic === true) {
			vNode.tag = arguments[tag.arg];
		}
		if (childrenIsDynamic === true) {
			vNode.children = arguments[children.arg];
		}
		if (attrsIsDynamic === true) {
			vNode.attrs = arguments[attrs.arg];
		} else {
			vNode.attrs = attrs;
		}
		if (hooksIsDynamic === true) {
			vNode.hooks = arguments[hooks.arg];
		}
		if (eventsIsDynamic === true) {
			vNode.events = arguments[events.arg];
		}
		if (keyIsDynamic === true) {
			vNode.key = arguments[key.arg];
		}
		if (styleIsDynamic === true) {
			vNode.style = arguments[style.arg];
		} else {
			vNode.style = blueprint.style;
		}
		if (classNameIsDynamic === true) {
			vNode.className = arguments[className.arg];
		} else {
			vNode.className = blueprint.className;
		}


		return vNode;
	};
}

{'fraction_non_alphanumeric': 0.14426321709786277, 'fraction_numerical': 0.0005624296962879641, 'mean_word_length': 3.682685977616853, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6931149', 'n_tokens_mistral': 2513, 'n_tokens_neox': 2353, 'n_words': 581}