feat: inject template styles to shadow dom #58
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What does this PR do
The goal of this PR is to allow the use of shadow dom and still be able to style elements and children via "normal" classnames.
Also installs
libharfbuzz-icu0 libenchant1c2a
to the host system as the ubuntu lts changed from 18.04 to 20.04.Why is this PR needed
As web components with shadow dom are isolated, global styles do not apply, the styles need to be available inside the components shadow dom.
This PR adds the possibility to pass styles to the
options
object of theregister
method. If given styles, the method appends a<template>
element (if it does not exist already) with the given styles to the<head>
and appends a copy to the components_root
.Example
I've created an example to showcase the feature CodeSandbox preact-custom-element style-injection