Хотите использовать элемент стиля вshadowRoot.adoptedStyleSheets?
h1 { color: red }
customElements.define('test-elem', class extends HTMLElement {
constructor () {
super()
const shadow = this.attachShadow({ mode: 'closed' })
shadow.adoptedStyleSheets = [style.sheet]
shadow.append(template.content.cloneNode(true))
}
})
Подробнее здесь: https://stackoverflow.com/questions/646 ... y-on-shado
Мобильная версия