Parece que no puedo hacer que el tema funcione con LitElement. Puedo configurar los otros elementos de configuración sin problema, pero Twind no reconoce el tema. También vale la pena mencionar que no recibo ningún error al compilar. ¿Alguien tiene una solución rápida?
import {LitElement, html} from 'lit'; import {setup, warn, create, cssomSheet} from 'twind'; setup({ mode: warn, theme: { colors: { purple: '#2013', }, }, }); const sheet = cssomSheet({target: new CSSStyleSheet()}); const {tw} = create({sheet}); export class MyApp extends LitElement { static styles = [sheet.target]; static get properties() { return { name: {type: String}, }; } constructor() { super(); this.name = 'World'; } render() { return html` <h1 class="${tw`text(3xl purple)`}">${this.name}!</h1> `; } } window.customElements.define('my-app', MyApp);Probablemente, el problema es el shadow-dom. Si puede usar Twind, puede intentar renderizar a light-dom, en lugar de shadow-dom.
Para usar light-dom, agregue este método en su clase de componente web:
createRenderRoot() { return this; }Por otro lado, no estoy seguro de que funcione sin Lit...