Repository navigation
Conversation
|
@kevin9327 is attempting to deploy a commit to the Meta Open Source Team on Vercel. A member of the Team first needs to authorize it. |
| const styles = stylex.create({ | ||
| x: { transitionDuration: '0MS' }, | ||
| y: { animationDelay: '0S' }, | ||
| z: { transform: '0DEG' }, |
Collaborator
There was a problem hiding this comment.
Nice optimizations!
Would transform: rotate(0DEG) be more accurate?
This branch has not been deployed
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.
What changed / motivation ?
The
zero-dimensionsvalue normalizer keeps the unit of a zero angle (0deg), time (0s), flex value (0fr) and percentage, and drops it for lengths. It compared the unit case-sensitively, but CSS units are ASCII case-insensitive, so the uppercase spellings fell through to the length branch and lost their unit:transition-duration:0is dropped by the browser, so the declaration silently does nothing, and0instead of0frchanges the track sizing.The fix lower-cases the unit before comparing. The uppercase spellings now compile to exactly the same CSS and class names as the lowercase ones (
0s,0deg,0fr); nothing changes for lowercase input.Linked PR/Issues
None. I found no open issue or PR about this. (Independent of #1999, which touches the
timingsnormalizer.)Additional Context
New test in
packages/@stylexjs/babel-plugin/__tests__/transform-value-normalization-test.js:0MS,0S,0DEGand0FR 1frcompile to0s,0s,0degand0fr 1fr. It fails onmain(transition-duration:0) and passes with the fix. The other 20 tests in that file still pass.I ran the babel-plugin suite from a sparse checkout with the published
@stylexjs/stylex/@stylexjs/shared0.19.1 instead of the workspace builds: 1010 passed, and the one failing test (legacy/stylex-transform-call-test.js) fails identically onmainin that setup.AI assistance: I used an AI coding assistant to help find and write this fix. I reviewed the change and ran the tests above myself.
Pre-flight checklist
Contribution Guidelines