@nexim/element
Version:
Utility functions and mixins for building high-performance web components with Lit.
28 lines • 823 B
TypeScript
import type { Class } from '@alwatr/type-helper';
import type { LitElement } from 'lit';
/**
* A mixin to enable light DOM rendering and style encapsulation for LitElement components.
* @typeParam T - The base class to extend.
*
* @returns A class that extends the base class with light DOM functionality.
*
* @example
* ```ts
* import {LitElement, html, css} from 'lit';
* import {LightDomMixin} from '@nexim/element';
*
* class MyLightDomElement extends LightDomMixin(LitElement) {
* static styles = css`
* p {
* color: blue;
* }
* `;
*
* protected override render() {
* return html`<p>Hello, light DOM!</p>`;
* }
* }
* ```
*/
export declare function lightDomMixin<T extends Class<LitElement> = Class<LitElement>>(superClass: T): T;
//# sourceMappingURL=light-dom.d.ts.map