@dark-engine/core
Version:
The lightweight and powerful UI rendering engine without dependencies and written in TypeScript (Browser, Node.js, Android, iOS, Windows, Linux, macOS)
23 lines (22 loc) • 703 B
JavaScript
;
Object.defineProperty(exports, '__esModule', { value: true });
exports.h = exports.createElement = void 0;
const view_1 = require('../view');
const utils_1 = require('../utils');
function createElement(element, props, ...slot) {
if ((0, utils_1.detectIsString)(element)) {
const options = props || {};
options.as = element;
options.slot = slot;
return (0, view_1.View)(options);
}
if ((0, utils_1.detectIsFunction)(element)) {
const options = props || {};
options.slot = slot.length === 1 ? slot[0] : slot;
return element(options);
}
return null;
}
exports.createElement = createElement;
exports.h = createElement;
//# sourceMappingURL=element.js.map