Skip to content

chore: add support for priority in CSS rules#539

Merged
layershifter merged 2 commits intomicrosoft:mainfrom
layershifter:chore/priorities-support
Apr 23, 2024
Merged

chore: add support for priority in CSS rules#539
layershifter merged 2 commits intomicrosoft:mainfrom
layershifter:chore/priorities-support

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

@github-actions
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 force-pushed the chore/priorities-support branch from 9b4ca2f to bddf2fa Compare April 17, 2024 12:03
@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
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.

2 participants