Internal: Create centralized place for rendering styles - take 2 [ED-19458]#31784
Internal: Create centralized place for rendering styles - take 2 [ED-19458]#31784ronros-elementor merged 191 commits intoelementor:mainfrom
Conversation
… feature/ED-19458
| $this->enqueue_fonts(); | ||
| } | ||
|
|
||
| private function initialize_styles( array $styles_by_key ) { |
There was a problem hiding this comment.
why is it called initialize_styles and initialize_style ?
do we have some more stuff we're going to add here other than the fonts?
| $style_file->get_media() | ||
| ); | ||
|
|
||
| $this->add_fonts_to_enqueue( $style_key ); |
There was a problem hiding this comment.
can't we merge it with what we're doing in initialize_styles ?
it feels a bit decoupled when we first initialize and then running this here
There was a problem hiding this comment.
The initialize part is actually to clear all collected fonts under a given style key, in case cache is invalid.
The latter guarantees we're enqueuing all fonts after we executed all the relevant "render_css" callbacks of all breakpoints, because before the css file generations - we have no clue which fonts are used in which style definition, and if we'd clean out the fonts after we ran over all breakpoints - we'll reset the fonts after them being added as part of the css rendering execution
So the steps are:
If cache is invalid -
- Empty recorded fonts
- Populate fonts as part of
render_css - Enqueue all recorded fonts
If cache is valid -
- Enqueue all recorded fonts
| @@ -0,0 +1 @@ | |||
| .test-style-grow-only{flex:2;}.test-style-grow-shrink{flex:1 2;}.test-style-basis-only{flex:0 1 100px;} No newline at end of file | |||
There was a problem hiding this comment.
I assume so, as it corresponds to the prior tests/phpunit/elementor/modules/atomic-widgets/styles/__snapshots__/Test_Atomic_Styles__test_parse_atomic_widget_styles__append_css_of_styles_with_flex_partial_values__1.txt, but with one difference due to the test structure (without the .elementor prefix)
…es [ED-21536] (#33455) - Moved cache invalidation to occur from within the `Atomic_Styles_Manager`, instead of directly invalidating each caching flag from its corresponding "styles provider" class. - Changed the atomic styles manager's API a bit, to not use the `$style_key` argument, which is essentially just an `implode` of the `$cache_keys` array - instead will only use the `$cache_keys`. - Added back an accidentally removed tests file (removed at [ED-19458](#31784)) [ED-19458]: https://elementor.atlassian.net/browse/ED-19458?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ <!--start_gitstream_placeholder--> ### ✨ PR Description Purpose: Refactor style registration and cache invalidation system to improve CSS file management and deletion of invalidated styles. Main changes: - Replaced string keys with path arrays for better hierarchy organization of style definitions - Added file deletion mechanism when invalidating cached styles via new clear_styles method - Implemented get_node method in Cache_Validity to traverse cache structure for targeted invalidation _Generated by LinearB AI and added by gitStream._ <sub>AI-generated content may contain inaccuracies. Please verify before using. 💡 **Tip:** You can customize your AI Description using **Guidelines** [Learn how](https://docs.gitstream.cm/automation-actions/#describe-changes)</sub> <!--end_gitstream_placeholder--> --------- Co-authored-by: ElementorBot <48412871+elementorbot@users.noreply.github.com> Co-authored-by: Omer Israeli <94297319+Omerisra6@users.noreply.github.com>
✨ PR Description
Purpose: Add centralized rendering system for atomic widget styles with caching and breakpoint support
Main changes:
Generated by LinearB AI and added by gitStream.
AI-generated content may contain inaccuracies. Please verify before using. We'd love your feedback! 🚀