You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is needed to make it possible for custom components to use the @CssImport annotation in Flow.
There is a prototype based on older version of LitElement and especially the static getStyles API.
Please note that the old API was removed in the latest major version of Lit.
Reacted by Kari Söderholm, Jean-Christophe Gueriaud and christophe geiser
Is it working in Vaadin 23? In Vaadin 23.0.3 the Lit component is being finalized well before that the registerStyles call in generated-flow-imports.js (especially if we use decorators)
Lit component is being finalized well before that the registerStyles
@jorginius Yeah I also noticed this change in timing. With PolymerElement, a component doesn't finalize before a first instance of it gets added to the DOM. With LitElement, the getter for styles gets called even without having a single component instance attached.
So in case of using LitElement + ThemableMixin, a developed needs to make sure to register all styles before the component definitions get imported
Note that even with PolymerElement, the following will only work as long as there's no instance of a <vaadin-button> in the DOM beforehand. Otherwise, vaadin-button would finalize before reaching the style imports on the second line.
Activity
web-padawan commentedon Oct 28, 2021
Addressed by #2594 but the API is considered experimental for now.
web-padawan commentedon Dec 28, 2021
Lit support is implemented by #3093 and #3123 and will be available in Vaadin 23. Closing as done.
jorginius commentedon Apr 22, 2022
Is it working in Vaadin 23? In Vaadin 23.0.3 the Lit component is being finalized well before that the registerStyles call in generated-flow-imports.js (especially if we use decorators)
Besides, LitElement has a static method finalize(): boolean and ThemableMixin seems to assume that said method is just in polymer (call is(), etc.)
web-padawan commentedon Apr 22, 2022
@jorginius Could you please create a new issue with more detailed explanation and a code example to reproduce?
TatuLund commentedon Apr 22, 2022
@jorginius To some extent yes, here is an example
https://github.com/TatuLund/TabSheet/blob/master/src/main/resources/META-INF/resources/frontend/tab-sheet.ts
Style module needs to be included in theme folder
https://github.com/TatuLund/TabSheet/blob/master/frontend/themes/mytheme/components/tab-sheet.css
It is not currently working with
@CssImport(value = "./tab-sheet.css", themeFor="tabSheet")tomivirkki commentedon Apr 22, 2022
@jorginius Yeah I also noticed this change in timing. With PolymerElement, a component doesn't finalize before a first instance of it gets added to the DOM. With LitElement, the getter for styles gets called even without having a single component instance attached.
So in case of using LitElement + ThemableMixin, a developed needs to make sure to register all styles before the component definitions get imported
Note that even with PolymerElement, the following will only work as long as there's no instance of a
<vaadin-button>in the DOM beforehand. Otherwise,vaadin-buttonwould finalize before reaching the style imports on the second line.jorginius commentedon Apr 22, 2022
Many thanks @TatuLund . I was using
@CssImport()and i hadn't added theis()method.tomivirkki commentedon Apr 22, 2022
Good catch, added an explicit check here #3723