-
Notifications
You must be signed in to change notification settings - Fork 8
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
get context of next customElement ancestor #8
Comments
Hi @Vanillabacke! Thanks for making this suggestion. Just wanted to let you know that context support is now available for custom elements in Svelte! Thanks to IMHO, this is a huge leap toward bridging the gap between legacy apps (like my site which is a PHP based website) and modern JS component-based front-ends by utilizing a hybrid approach with web components. You keep things composable and continue to populate the data into your front-end by taking a tag-based approach like you might already be doing in other server-side languages like PHP, Ruby, Python, Java and etc. It includes support for light DOM as well as support for slots (something Svelte itself notably doesn't yet support!). I'm so pumped about this last feature because we're going to be using it very heavily in the redesign of our homepage, which will be implemented using Svelte, particularly with the carousels we will be building. Edit: Accidentally included the actual site copy/pasted from my Slack message 😅 Edited that out since it isn't necessary here. |
Hi @patricknelson finally I had some time for testing it. As far as I've tested it, this gives a huge advantage. Thanks a lot for implementing it! I can see a lot of usecases, especially for small projects, where you just simple reuse alle the stuff easily without heavy scripts ❤️ |
Cool! I'm using it heavily in production myself, so I plan on supporting it long term. If you encounter any issues, you know what to do. |
Just wanna share a quick and dirty solution of getting the context kinda working.
Needs a new method in the wrapper class:
And then adopt the context in the opts.component constructor:
Usage for example with a writable:
Parent:
Child:
The text was updated successfully, but these errors were encountered: