Stop a theme border overruling an explicit border width - #349
Open
sadiqk2 wants to merge 1 commit into
Open
Conversation
`border-theme-outline` has to imply *a* width, or a theme border is invisible. It asserted `borderWidth => 1` outright, so whether `border-2 border-theme-outline` rendered 1px or 2px depended on which class came last in the string: `parse()` merges each token's result in order, so the theme token overwrote the explicit width when it came second, and lost to it when it came first. The failure has no visible cause on a device — the classes are both there, in the order the author wrote them, and one of them silently wins. A theme border now emits `borderWidthDefault`, and `parse()` collapses that into `borderWidth` at the end only if nothing else set one. The result is order-independent and the key never reaches the output, so the renderers see exactly what they saw before for a bare theme border. This affects the super-native demo: `border border-theme-outline` combinations appear in its own templates.
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.
The bug
border-theme-*has to imply a width — without one a theme border is invisible — but it assertedborderWidth => 1outright.TailwindParser::parse()merges each token's result in string order, so the implied width overwrote an explicit one whenever the theme class came second:Same two classes, same intent, different result depending on the order they were typed — and nothing on the device hints at why, since both classes are present and one of them silently wins.
The fix
A theme border now emits
borderWidthDefault, andparse()collapses that intoborderWidthat the very end, only when no class set one explicitly. The outcome no longer depends on order, and the internal key never reaches the parsed output — a bareborder-theme-primaryproduces exactly what it produced before.Verification
tests/Unit/Edge/ThemeClassTokensTest.php: both class orders, a bare theme border keeping its 1px, and the internal key never leaking into the output.mainand passes with this change.vendor/bin/pestfor the Edge suites: 114 passed. Full suite matchesmain's baseline — the 13 failures on both are in the Android splash-screen and release-build tests and are unrelated to this change.vendor/bin/pint --testclean on both touched files.border border-theme-outlinepairs appear in super-native's own templates, so this affects the demo as well as apps.