feat: update error message on using styles outside shadow roots

This commit is contained in:
ayo 2026-05-08 14:37:43 +02:00
parent 64a2a3fc87
commit 005bd2e8ae

View file

@ -208,14 +208,13 @@ export class WebComponent extends HTMLElement {
try {
const styleObj = new CSSStyleSheet()
styleObj.replaceSync(this.constructor.styles)
console.log(this.constructor.styles, this.constructor.props)
this.#host.adoptedStyleSheets = [
...this.#host.adoptedStyleSheets,
styleObj,
]
} catch (e) {
console.error(
'ERR: Constructable stylesheets are only supported in shadow roots',
'ERR: Constructable stylesheets are only supported in shadow roots. Use `static shadowRootInit` https://webcomponent.io/shadow-dom/',
e
)
}