@communities-webruntime/services
Version:
If you would like to run Lightning Web Runtime without the CLI, we expose some of our programmatic APIs available in Node.js. If you're looking for the CLI documentation [you can find that here](https://www.npmjs.com/package/@communities-webruntime/cli).
32 lines • 1.38 kB
JavaScript
/**
* Copyright (c) 2021, salesforce.com, inc.
* All rights reserved.
* SPDX-License-Identifier: MIT
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
*/
import { moduleSpecifierToElementName } from '@communities-webruntime/common';
import { attributes, buildSlot, regions } from './template-utils.js';
export class DefaultComponentTemplateGenerator {
generate({ cmp, attributeSet, containerRegion, isRenderDesignMode, isThemeLayout, }) {
const elem = moduleSpecifierToElementName(cmp.descriptor);
const attrs = attributes(cmp, attributeSet);
// If we're in designmode, the component isn't rendered in a slot but instead is rendered
// directly by the webruntime-generated-component wrapper
const slot = !isRenderDesignMode ? buildSlot(containerRegion) : ` `;
const rgns = regions({
regionList: cmp.regions,
isThemeLayout: !!isThemeLayout,
attributeSet: attrs.attributes,
isRenderDesignMode,
});
return {
html: `<${elem}${attrs.html}${slot}>${rgns}</${elem}>`,
attrs,
};
}
// No componentName, as it represents all components without a custom generator
getComponentName() {
return ``;
}
}
//# sourceMappingURL=default-component-template-generator.js.map