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

chore: add support for priority in CSS rules #539

Merged
merged 2 commits into from
Apr 23, 2024

Conversation

layershifter
Copy link
Member

@layershifter layershifter commented Apr 17, 2024

What's done?

This PR adds support for additional priority property in meta of CSS rules, this allows to order CSS rules based on it.

For example:

const rules = [
  '.bar { color: blue }',
  ['.foo { color: red }', { p: -1 }],
]

Will produce following CSS:

.foo { color: red }
.bar { color: blue }

These changes are needed to support CSS shorthands.

Minor notes

  • sortCSSRules() have been refactored to have clearer implementation
  • Snapshots in sortCSSRules() have been updated to be clearer

Copy link

github-actions bot commented Apr 17, 2024

📊 Bundle size report

Package & Exports Baseline (minified/GZIP) PR Change
react
__styles
3.841 kB
1.705 kB
4.187 kB
1.832 kB
346 B
127 B
react
makeResetStyles (runtime)
19.285 kB
7.429 kB
19.64 kB
7.562 kB
355 B
133 B
react
makeStaticStyles (runtime)
9.225 kB
4.051 kB
9.576 kB
4.182 kB
351 B
131 B
react
makeStyles (runtime)
24.002 kB
9.141 kB
24.357 kB
9.275 kB
355 B
134 B
shadow-dom
createShadowDOMRenderer
3.468 kB
1.467 kB
3.814 kB
1.628 kB
346 B
161 B
Unchanged fixtures
Package & Exports Size (minified/GZIP)
core
__resetStyles (makeResetStyles)
273 B
197 B
core
__styles (makeStyles)
1.727 kB
832 B
core
makeResetStyles (runtime)
17.14 kB
6.569 kB
core
makeStyles (runtime)
21.852 kB
8.301 kB
core
mergeClasses
1.865 kB
900 B
core
shorthands.padding()
4.781 kB
1.537 kB
react
__css
1.723 kB
812 B
🤖 This report was generated against 160afd71392c3952b102d2e88ef1881ca5cc4a20

@layershifter layershifter force-pushed the chore/priorities-support branch 7 times, most recently from ae88650 to 9b4ca2f Compare April 17, 2024 11:55
@layershifter layershifter marked this pull request as ready for review April 17, 2024 12:12
@layershifter layershifter requested a review from a team as a code owner April 17, 2024 12:12
@layershifter layershifter merged commit e514e2f into microsoft:main Apr 23, 2024
4 checks passed
@layershifter layershifter deleted the chore/priorities-support branch April 23, 2024 12:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants