Skip to content
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

Consider adding a specific styling API to better integrate with constructible stylesheets #391

Closed
sorvell opened this issue Dec 20, 2018 · 1 comment
Assignees
Milestone

Comments

@sorvell
Copy link
Member

sorvell commented Dec 20, 2018

Constructible stylesheets are soon coming to the web platform. They should provide a significant performance improvement for styling Shadow DOM!

The intention of the API is to allow sharing of stylesheets between shadowRoots that use the same styling, and this is a perfect fit for custom elements. It does strongly discourage modifying styles per instance since the stylesheet would be shared across all elements of a given type.

Because of this, it may not make sense for users to put non-dynamic <style> elements into the render method since it looks like these styles can change. Although this is not the case when shady-render is used, that's a polyfill specific limitation rather than part of the core design.

Perhaps a static get style() could be added which is how users declare element styling.

If so, we either need to integrate this feature with shady-render or stop using it.

We should probably consider if this is worth doing prior to a 1.0 release.

@sorvell sorvell added this to the 1.0.0 milestone Dec 20, 2018
@sorvell sorvell self-assigned this Dec 20, 2018
@daKmoR
Copy link
Contributor

daKmoR commented Dec 20, 2018

+1 for static get style()

we are using something like this for a while now and it's really nice to work with :)

we sort of have a variation of https://github.com/lit-styles/lit-styles/tree/master/packages/styled-lit-element - maybe get some inspiration from it :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants