refactor: remove badge component token values from theme - #31099
Merged
Conversation
andrewseguin
marked this pull request as ready for review
May 12, 2025 19:54
crisbeto
approved these changes
May 12, 2025
wagnermaciel
approved these changes
May 12, 2025
andrewseguin
force-pushed
the
direct-m3-tokens-pt1
branch
from
May 13, 2025 03:26
4cbb5a3 to
c5cb560
Compare
andrewseguin
force-pushed
the
direct-m3-tokens-pt1
branch
from
May 13, 2025 03:29
c5cb560 to
128b2e0
Compare
Contributor
Author
|
The changes were merged into the following branches: main, 20.0.x |
andrewseguin
added a commit
that referenced
this pull request
May 13, 2025
Co-authored-by: Andrew Seguin <andrewseguin@google.com> (cherry picked from commit 936d179)
|
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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
thememixin 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.
secondaryinstead 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.