Spreading tailwindcss/defaultTheme exports keeps bare values#14257
Merged
philipp-spiess merged 5 commits intoAug 29, 2024
Conversation
This was referenced Aug 26, 2024
philipp-spiess
added a commit
that referenced
this pull request
Aug 26, 2024
We noticed that when the `defaultTheme` (change for this is coming in #14257) defines a tuple that is also defined in the CSS theme, the values are incorrectly merged as objects instead of overwritten. However, CSS theme values should take precedence, even when they use tuple syntax. Proper coverage of this will come once `#14257` is merged when calling `theme(fontSize.xs[1].lineHeight)` will also have a default value passed in from the `defaultTheme`.
philipp-spiess
added a commit
that referenced
this pull request
Aug 26, 2024
While working on #14257, we noticed two issues with the CSS `theme()` function: 1. In V3 it's possible to set arrays inside the theme object. An example for this is the default font families as defined here: https://github.com/tailwindlabs/tailwindcss/blob/main/stubs/config.full.js#L303-L311. We now properly join these arrays that are not tuples. 2. We noticed that in the case where there are no modifiers, the fallback values for the CSS `theme()` function had the first word removed. A regression test for this was added.
43a3aea to
b4fbe0c
Compare
philipp-spiess
commented
Aug 26, 2024
philipp-spiess
commented
Aug 26, 2024
philipp-spiess
commented
Aug 26, 2024
philipp-spiess
added a commit
that referenced
this pull request
Aug 27, 2024
We noticed that when the `defaultTheme` (change for this is coming in #14257) defines a tuple that is also defined in the CSS theme, the values are incorrectly merged as objects instead of overwritten. However, CSS theme values should take precedence, even when they use tuple syntax. Proper coverage of this will come once `#14257` is merged when calling `theme(fontSize.xs[1].lineHeight)` will also have a default value passed in from the `defaultTheme`.
philipp-spiess
added a commit
that referenced
this pull request
Aug 27, 2024
While working on #14257, we noticed two issues with the CSS `theme()` function: 1. In V3 it's possible to set arrays inside the theme object. An example for this is the default font families as defined here: https://github.com/tailwindlabs/tailwindcss/blob/main/stubs/config.full.js#L303-L311. We now properly join these arrays that are not tuples. 2. We noticed that in the case where there are no modifiers, the fallback values for the CSS `theme()` function had the first word removed. A regression test for this was added.
ad744e3 to
d211be1
Compare
thecrypticace
approved these changes
Aug 29, 2024
philipp-spiess
added a commit
that referenced
this pull request
Aug 29, 2024
While working on #14257, we noticed two issues with the CSS `theme()` function: 1. In V3 it's possible to set arrays inside the theme object. An example for this is the default font families as defined here: https://github.com/tailwindlabs/tailwindcss/blob/main/stubs/config.full.js#L303-L311. We now properly join these arrays that are not tuples. 2. We noticed that in the case where there are no modifiers, the fallback values for the CSS `theme()` function had the first word removed. A regression test for this was added.
philipp-spiess
added a commit
that referenced
this pull request
Aug 29, 2024
In #14221 we added a new export to the `tailwindcss` package: `tailwindcss/defaultTheme`. This is build on top of the full config from V3 and will allow plugins to keep being compatible. However, spreading in from this package has overwritten the bare value callback handler. This PR fixes it by sharing the bare value callbacks with the compat config.
philipp-spiess
added a commit
that referenced
this pull request
Aug 29, 2024
While working on #14257, we noticed two issues with the CSS `theme()` function: 1. In V3 it's possible to set arrays inside the theme object. An example for this is the default font families as defined here: https://github.com/tailwindlabs/tailwindcss/blob/main/stubs/config.full.js#L303-L311. We now properly join these arrays that are not tuples. 2. We noticed that in the case where there are no modifiers, the fallback values for the CSS `theme()` function had the first word removed. A regression test for this was added.
philipp-spiess
added a commit
that referenced
this pull request
Aug 29, 2024
In #14221 we added a new export to the `tailwindcss` package: `tailwindcss/defaultTheme`. This is build on top of the full config from V3 and will allow plugins to keep being compatible. However, spreading in from this package has overwritten the bare value callback handler. This PR fixes it by sharing the bare value callbacks with the compat config.
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
In #14221 we added a new export to the
tailwindcsspackage:tailwindcss/defaultTheme. This is build on top of the full config from V3 and will allow plugins to keep being compatible.However, spreading in from this package has overwritten the bare value callback handler. This PR fixes it by sharing the bare value callbacks with the compat config.