feat: Allow "var(--" strings as values for all properties
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.
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%) |
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%) |
We need so many FlowFixMe to use this API 🥲
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 |
NOTE: this will be merged after verifying how it affects our code internally.
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.
Closing old PRs