feat(framework): support theme dependent custom icon collections #7341
+161
−114
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The PR aims to add support for registering versioned/theme dependent custom icon collections.
Previously, one could register an icon collection (f.e. "my-icons") with the use of
registerIconLoader
and use it with the Icon web component:However, there is no API to register theme dependant version of the same icon, so that whenever the theme is changed the used SVGs are auto-switched behind the scenes.
Proposal
The markup remains the same, so that no changes will be required in the icon usage.
-
registerIconLoader
now can be used to register additional second version (won't fail in case of multiple versions, but at the end the separation is "legacy" vs "sap_horizon" theme families) and use the newly supported field "themeFamily" to define in which themeFamily the icon collection should be used. If "themeFamily" is not present, by default it means in all themes (sap_belize_, sap_fiori_3_) other than "sap_horizon" theme families.*collection (my-legacy-icons, my-horizon-icons) is the name under we will internally store the icon collection
Flow
my-icons/home is set, if sap_fiori_3 is set, effectively show my-legacy-icons/home
my-icons/home is set, if sap_ horizon is set, effectively show my-horizon-icons/home
Fixes: #7312