refactor: remove badge component token values from theme #31099
Merged
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.
Refactors the M3 theme config so that it contains system-level values (colors, typography, density, shape, motion, state, elevation) so that component M3 token files can be given the theme config to derive its values.
Previously, M3 token files were used to insert values into the theme config directly when the theme config was created. When a component's
theme
mixin was called, those values were used. This indirection is difficult to follow in the code, making it unclear when values were created and how they are pulled, because the theme files were not actually calling the m3 token files.This change makes the flow very clear: a theme config is created with some system values, and then the token file is directly called from the theme config.
This also clears up the mapping with variant colors, which were also inserted in the theme config in an unintuitive way. Instead, we can just perform a simple string replacement, e.g.
secondary
instead ofprimary
.The change is performed for badge to show how it will be done with the remaining components. Once that is complete, a lot of cleanup can occur to remove unnecessary flows and mixins.