-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Stylis v4 tryout * Move @import rules in test to be first * Improved compat plugin * Add tests for orphanated pseudos * orphanated -> orphaned * Upgrade stylis and improve compat plugin * Improve compat plugin - avoid double compilation * Shorten compat plugin a little bit * Add guard for global top-level rules in the compat plugin * Fix tagged templates minifier (#1836) * Add TS test to check for excessive instantiation regressions * Fix tagged templates minifier * Use non-forked stylis for minification * Pass missing argument to toInputTree and fix isAutoInsertedRule for parent-less rules * Temporarily add @emotion/stylis as dep of @emotion/babel-plugin * Update snapshots * Make compat plugin be always included * move removeLabel into omnipresentPlugins * Stop special-casing @import insertion * fix getServerStylisCache * Remove outdated docs around stylisPlugins and prefix options * Add changesets * Add note about prefixer being just a plugin to stylisPlugins docs * Actually use officially published Stylis v4 * Improve error message about incorrect @import insertion * Fix flow errors * Reword error messages and changeset content Co-authored-by: Mitchell Hamilton <[email protected]> * update snapshots * Remove mention of `@import` not being usable in `css` calls as it wasnt true for @emotion/react+<Global/> * Add mention to the changeset about where one can find a prefixer * Update .changeset/warm-ties-drop.md Co-authored-by: Mitchell Hamilton <[email protected]>
- Loading branch information
Showing
76 changed files
with
1,765 additions
and
4,473 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'@emotion/babel-plugin': patch | ||
--- | ||
|
||
Fixed an issue in our tagged template expressions minifier which has caused whitespace before nested orphaned pseudo selectors being incorrectly removed. In a selector like `& :hover` the whitespace before colon has a semantic meaning and needs to be preserved. |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'@emotion/sheet': major | ||
--- | ||
|
||
`@import` rules are no longer special-cased - they no longer are always inserted at the beginning of the stylesheet. The responsibility to put them first has been moved to a consumer of this package. |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
--- | ||
'@emotion/cache': major | ||
'@emotion/css': major | ||
'@emotion/react': major | ||
'@emotion/styled': major | ||
--- | ||
|
||
The parser we use ([Stylis](https://github.com/thysultan/stylis.js)) got upgraded. It fixes some long-standing parsing edge cases while being smaller and faster 🚀 | ||
|
||
It has been completely rewritten and comes with some breaking changes. Most notable ones that might affect Emotion users are: | ||
|
||
- plugins written for the former Stylis v3 are not compatible with the new version. To learn more on how to write a plugin for Stylis v4 you can check out its [README](https://github.com/thysultan/stylis.js#middleware) and the source code of core plugins. | ||
- vendor-prefixing was previously customizable using `prefix` option. This was always limited to turning off all of some of the prefixes as all available prefixes were on by default. The `prefix` option is gone and to customize which prefixes are applied you need to fork (copy-paste) the prefixer plugin and adjust it to your needs. While this being somewhat more problematic to setup at first we believe that the vast majority of users were not customizing this anyway. By not including the possibility to customize this through an extra option the final solution is more performant because there is no extra overhead of checking if a particular property should be prefixed or not. | ||
- Prefixer is now just a plugin which happens to be put in default `stylisPlugins`. If you plan to use custom `stylisPlugins` and you want to have your styles prefixed automatically you must include prefixer in your custom `stylisPlugins`. You can import `prefixer` from the `stylis` module to do that. | ||
- `@import` rules are no longer special-cased. The responsibility to put them first has been moved to the author of the styles. They also can't be nested within other rules now. It's only possible to write them at the top level of global styles. |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'@emotion/utils': major | ||
--- | ||
|
||
`insertStyles` no longer calls `cache.insert` with a scoped class name as a selector when inserting keyframes. The change is internal and has no effect on Emotion users. |
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
8 changes: 8 additions & 0 deletions
8
packages/babel-plugin/__tests__/vanilla-emotion-macro/__fixtures__/nested-orphaned-pseudo.js
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import { css } from '@emotion/css/macro' | ||
|
||
// whitespace before pseudo should be preserved | ||
css` | ||
& :hover { | ||
color: hotpink; | ||
} | ||
` |
Oops, something went wrong.