Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Allow "var(--" strings as values for all properties #650

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

nmn
Copy link
Contributor

@nmn nmn commented Jul 22, 2024

What changed / motivation ?

CSS properties are typed in StyleX, and while some properties allow arbitrary strings, many don't. These properties should still permit usages of string referencing CSS variables. The new StringPrefix<> type in Flow makes this possible.

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Jul 22, 2024
Copy link

compressed-size: runtime library

Size change: +0.00 kB
Total size: 2.52 kB

Filename: gzip (minify) kB size kB change % change
./packages/stylex/lib/StyleXSheet.js 1.48 (3.75) +0.00 (+0.00) +0.1% (+0.1%)
View unchanged
Filename: gzip (minify) kB size kB change % change
./packages/stylex/lib/stylex.js 1.04 (3.22) 0.00 (0.00) 0.0% (0.0%)

Copy link

compressed-size: e2e bundles

Size change: 0.00 kB
Total size: 1125.68 kB

View unchanged
Filename: gzip (minify) kB size kB change % change
./apps/rollup-example/.build/bundle.js 1002.49 (10185.35) 0.00 (0.00) 0.0% (0.0%)
./apps/rollup-example/.build/stylex.css 123.19 (774.43) 0.00 (0.00) 0.0% (0.0%)

@necolas
Copy link
Contributor

necolas commented Jul 24, 2024

We need so many FlowFixMe to use this API 🥲

Copy link

github-actions bot commented Sep 10, 2024

workflow: benchmarks/size

Comparison of minified (terser) and compressed (brotli) size results, measured in bytes. Smaller is better.

@stylexjs/[email protected] size:compare
./size-compare.js /tmp/tmp.yZNU1UH0mS /tmp/tmp.JKLLiRdqtC

Results Base Patch Ratio
stylex/lib/stylex.js
· compressed 899 899 1.00
· minified 3,223 3,223 1.00
stylex/lib/StyleXSheet.js
· compressed 1,266 1,266 1.00
· minified 3,776 3,776 1.00
rollup-example/.build/bundle.js
· compressed 563,484 563,484 1.00
· minified 10,185,368 10,185,368 1.00
rollup-example/.build/stylex.css
· compressed 99,154 99,154 1.00
· minified 745,649 745,649 1.00

@nmn
Copy link
Contributor Author

nmn commented Sep 10, 2024

NOTE: this will be merged after verifying how it affects our code internally.

@nmn
Copy link
Contributor Author

nmn commented Oct 3, 2024

Update: The StringPrefix type still isn't ready. It has some strange bugs when being used for reads. So, this PR will have to wait for now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants