-
Notifications
You must be signed in to change notification settings - Fork 7
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
Shadow DOM only #19
Comments
Hi There, I would be glad if someone could convince me otherwise |
Hello @EranGrin, Thanks for replying so fast. So basically we use Vue in a monolith website. Most of the HTML is rendered by the backend and we use Vue to enhance the interactivity of the website. |
I had a look at the vue core code, it might be possible to override the attach shadow dom, but I'm not sure what will be the entire implications. |
The main issue I've read so far is the impossibility of using |
I am not sure if you are aware of this, but CSS custom properties (variables) can penetrate the Shadow DOM |
Yes I know, I'm refering to global CSS. The goal being not to have to rewrite all styles for the default button / headings / etc. |
@lbineau good news. I found a way to resolve the problem. It might take me a few days more to pack it and make some clean-ups. I spent a lot of time on this today, and I have to do some work that makes money as well. |
@EranGrin Fantastic! What was the fix for you? Just a general description of it would be great |
New Release 1.5.0 is live 🔥 |
First of all nice work @EranGrin, I checked your demo very cool! Would your Shadow Dom logic apply to this PR? vuejs/core#4404 - that would be a big win for the "reactivity sprinkling" use case that @lbineau described. I admit I am in scenario where I'm building a Wordpress Theme and want to inject vue logic for certain e-commerce scenarios, and have had to create a process to bundle "web component" styles and import that specific stylesheet into the <style> of each vue component i use as a web component. This does lead to tailwind base classes being duplicated across all my shadow doms, it works, its just i'm adding about 50kb of inline css for each shadow dom I add, just to leverage tailwind. Being able to just use the main css file that the page as a whole uses would be ideal. |
Hi @firescript, I have doubt if vue core team will ever accept this PR as it's adding this strange path html-parsed-element.ts instead of the Regarding your use case, you could also use the wrapper as is without shadow Dom. |
Thanks a lot for working on that topic, that's great news! I'll test it locally because the stackblitz link is failing to install customElements.define('vue-app', class extends HTMLElement {
app;
constructor() {
super();
if (this.dataset.vApp !== undefined) return
this.app = createApp(App})
}
connectedCallback () {
// Use in DOM root component template
// https://vuejs.org/guide/essentials/application.html#in-dom-root-component-template
this.app.mount(this)
}
disconnectedCallback () {
this.app.unmount()
this.app = null
}
}) The approach is very naive but at least it worked in my case. |
@firescript |
Hello @EranGrin,
Thank you for creating this library. I think the main issue with Vue 3 WebComponents is their lack of support for normal DOM and just support of shadow DOM. It creates some issues with styling scopes, ex: not possible to use an external CSS stylesheet.
Does your library support both?
Best regards.
The text was updated successfully, but these errors were encountered: