@soil/arch
Version:
Architectural constructs for web applications.
22 lines • 805 B
JavaScript
import { extend } from './extend';
import { assignProps } from '../../shared/functions/assignProps';
/**
* Define a custom UI component, i.e. a piece of code whose (only) purpose is to
* render HTML and/or SVG elements on the screen and manage the user interaction
* with these.
*
* Components created with this function will behave very similarly to native
* HTML and SVG elements – custom elements can be considered special cases of
* native ones (as in Web Components).
*/
export function element(definition) {
return function (props, children) {
var _a = definition(children), elem = _a[0], api = _a[1];
extend(elem, api);
if (props !== undefined) {
assignProps(elem, props);
}
return elem;
};
}
//# sourceMappingURL=element.js.map