Reset default
@theme values for non extend
JS theme config
#14672
+362
−121
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.
Imagine the following setup:
Since the theme object in the JS config contains
colors
in the non-extends
block, you would expect this to not pull in all the default colors imported via@import "tailwindcss";
. This, however, wasn't the case right now since all theme options were purely additive to the CSS.This PR makes it so that non-
extend
theme keys overwrite default CSS theme values. The emphasis is ondefault
here since you still want to be able to overwrite your options via@theme {}
in user space.This now generates the same CSS that our upgrade codemods would also generate as this would apply the new CSS right after the
@import "tailwindcss";
rule resulting in:Keyframes
This PR also adds a new core API to unset keyframes the same way. We previously had no option of doing that but while working on the above codemods we noticed that keyframes should behave the same way:
To do this, the keyframes bookeeping was moved from the main Tailwind CSS v4 file into the
Theme
class.I’m not sure super of the API yet but we would need a way for the codemods to behave the same as out interop layer here. Option B is that we don't reset keyframes the same way we reset other theme variables.