-
Notifications
You must be signed in to change notification settings - Fork 319
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
Move style gathering from class finalization to initialization #866
Conversation
Also fixed a few formatting issues. |
IMO, this is a breaking change. As an example, we are using Would it be possible to keep @dfreedm @justinfagnani WDYT? |
@web-padawan |
@justinfagnani thanks for pointing out. FWIW, we currently rely on static _includeStyle(moduleName: string) {
// Hack to bypass TypeScript private property check
// eslint-disable-next-line dot-notation
this['_styles'].push(unsafeCSS(cssFromModule(moduleName)));
} So I will have to adjust that to use But then again, we can't modify Can you consider the following changes in scope of this PR?
Either option should work for our case.
|
@web-padawan this is the code in question, yeah? https://github.com/vaadin/component-mixins/blob/f0e0f1953a2cd2d937d91ca7311e34cf784157f4/packages/themable-element/themable-element.ts#L31 Taking a look now.... |
Also, @aomarks do you know why the Tachometer tests are stuck? |
|
By moving style gathering to initialization, stylesheets will only be created for elements that have booted, and not for elements that have only be registered. This should be performance positive for applications with less than ideal loading behaviors.
2cf1bab
to
2f4151e
Compare
Rebased with #868 |
Override `getStyles()` to integrate a style injection system.
Apologies for the delay, dropped the ball on this after the Holiday break. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Still LGTM!
@web-padawan hows this look to you? You'd override getStyles()
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
@@ -20,6 +20,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/). | |||
|
|||
### Fixed | |||
* Properties annotated with the `eventOptions` decorator will now survive property renaming optimizations when used with tsickle and Closure JS Compiler. | |||
* Moved style gathering from `finalize` to `initialize` to be more lazy, and create stylesheets on the first instance initializing [#866](https://github.com/Polymer/lit-element/pull/866). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you think it makes sense to add statis getStyles()
mention to "Added"?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, will do!
By moving style gathering to initialization, stylesheets will only be
created for elements that have booted, and not for elements that have
only be registered.
This should be performance positive for applications with less than
ideal loading behaviors.
Fixes #870