@public-ui/components
Version:
Contains all web components that belong to KoliBri - The accessible HTML-Standard.
33 lines (32 loc) • 974 B
JavaScript
/*!
* KoliBri - The accessible HTML-Standard
*/
function buildDefaultPropsFromConfig(config) {
var _a, _b;
const defaults = {};
for (const def of [...((_a = config.required) !== null && _a !== void 0 ? _a : []), ...((_b = config.optional) !== null && _b !== void 0 ? _b : [])]) {
defaults[def.propName] = def.getDefaultValue();
}
return defaults;
}
export class BaseController {
constructor(stateAccess, propsConfig) {
this.rawProps = {};
this.setState = stateAccess.setState;
this.getState = stateAccess.getState;
this.renderProps = buildDefaultPropsFromConfig(propsConfig);
}
setRawProp(key, value) {
this.rawProps[key] = value;
}
getRawProp(key) {
return this.rawProps[key];
}
setRenderProp(key, value) {
this.renderProps[key] = value;
}
getRenderProp(key) {
return this.renderProps[key];
}
}
//# sourceMappingURL=base-controller.js.map