-
Notifications
You must be signed in to change notification settings - Fork 50
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Web Components support? #7
Comments
Not yet. In general, ShadowDOM is not supported (I need to add that to the list!) |
Updated the README. Gonna leave this open in case anyone has an idea how to handle ShadowDOM without doing something horrible. |
Thanks. Yeah I guess that would require quite a few changes. The API could be something like (unless I'm missing something): import {unsafeCSS, css, html, LitElement} from 'lit';
export class Simple extends LitElement {
static get styles() {
this.qc = new QC();
return unsafeCSS(this.qc.transpileStyleSheet(css`something`.toString()));
}
connectedCallback() {
super.connectedCallback();
this.constructor.qc.connect(this.shadowRoot);
}
disconnectedCallback() {
this.constructor.qc.disconnect(this.shadowRoot);
super.disconnectedCallback();
}
render() {
return html`bla`
}
} |
For web components, we typically use constructable stylesheets which would add another layer of complexity. Supporting web components would be a huge win though. |
Is anyone working on it? if not is there a general "plan of attack"? would a For lit specifically, I think there it will need another method before in order to convert constructible stylesheets and besides that @lazka suggestions could work right? or is there more to take into account besides a mutation observer and converted css rules? hmmm thinking about it... lits styles are "static" but I assume those styles will need to be updated whenever the mutation observer "fires" 🤔 |
Hello!, has there been any update ? :) |
Thank you for your issue! As of the latest version (currently in alpha), Shadow DOM is unfortunately not supported yet, but we'd gladly consider PRs. Generally speaking, I don't think we'd want to expose and force you to use non-standard APIs and hooks to get things working though. Instead, I think the approach we'd like to see would e.g. monkey patch |
@devknoll monkey patching
https://developer.mozilla.org/en-US/docs/Web/API/CSS_Object_Model any thoughts/ideas around this? |
@devknoll Think I may have it sorted, updating PR now. |
We've moved the polyfill to maintenance mode and aren't currently considering additional features. For Web Component + Shadow DOM support, I'd encourage you to continue to follow @Marshal27 who was working on support for this in #57. |
Posting the link here for posterity. https://github.com/Marshal27/shadow-container-query-polyfill |
Are there any plans to make it possible to just apply this to a single web component without changing any global state? For example with https://lit.dev/ ?
The text was updated successfully, but these errors were encountered: