Skip to content

Commit c560549

Browse files
committed
feat(root): use config to render plugins
as they follow a common plugin interface, they can now easily be mapped
1 parent 273d9c3 commit c560549

1 file changed

Lines changed: 7 additions & 3 deletions

File tree

src/components/root/root.component.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import type { CustomElementDeclaration } from 'custom-elements-manifest/schema';
22

33
import { LitElement, type TemplateResult, html, unsafeCSS } from 'lit';
4+
import { unsafeStatic, withStatic } from 'lit/static-html.js';
45
import { customElement, property, state } from 'lit/decorators.js';
56
import { ifDefined } from 'lit/directives/if-defined.js';
67
import { map } from 'lit/directives/map.js';
@@ -181,9 +182,12 @@ export class Root extends Routable(ColorSchemable(LitElement)) {
181182
protected renderElement(tagName: string): TemplateResult {
182183
return html`
183184
<wcp-preview-frame initial-preview-tab="${ifDefined(this.initialPreviewTab)}">
184-
<wcp-preview-frame-examples .element="${this.manifest?.elements.get(tagName)}"></wcp-preview-frame-examples>
185-
<wcp-preview-frame-readme .element="${this.manifest?.elements.get(tagName)}"></wcp-preview-frame-readme>
186-
<wcp-preview-frame-viewer .element="${this.manifest?.elements.get(tagName)}"></wcp-preview-frame-viewer>
185+
${map(
186+
this.config?.previewFramePlugins ?? [],
187+
(plugin) => withStatic(html)`
188+
<${unsafeStatic(plugin)} .element="${this.manifest?.elements.get(tagName)}"></${unsafeStatic(plugin)}>
189+
`
190+
)}
187191
</wcp-preview-frame>
188192
`;
189193
}

0 commit comments

Comments
 (0)