parcoursup/node_modules/riot/esm/api/component.js
lalBi94 7bc56c09b5 $
2023-03-05 13:23:23 +01:00

27 lines
745 B
JavaScript

/* Riot WIP, @license MIT */
import compose from 'cumpa';
import { createComponentFromWrapper } from '../core/create-component-from-wrapper.js';
/**
* Helper method to create component without relying on the registered ones
* @param {Object} implementation - component implementation
* @returns {Function} function that will allow you to mount a riot component on a DOM node
*/
function component(implementation) {
return function (el, props, _temp) {
let {
slots,
attributes,
parentScope
} = _temp === void 0 ? {} : _temp;
return compose(c => c.mount(el, parentScope), c => c({
props,
slots,
attributes
}), createComponentFromWrapper)(implementation);
};
}
export { component };