Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR was opened by the Changesets release GitHub action. When you're ready to do a release, you can merge this and the packages will be published to npm automatically. If you're not ready to do a release yet, that's fine, whenever you add more changesets to next, this PR will be updated.
Releases
@emotion/[email protected]
Major Changes
c5b12d90#1220 Thanks @mitchellhamilton! - Removed support for theinstancesoption, any usage of it should be replaced with theimportMapoptionb8476e08#1675 Thanks @mitchellhamilton! - Renamebabel-plugin-emotionto@emotion/babel-plugin. Please replace"plugins": ["emotion"]with"plugins": ["@emotion"]in your Babel config.c65c5d88#1622 Thanks @Andarist! - Drop Babel 6 supportc7850e61#1656 Thanks @Andarist! -autoLabeloption no longer is a simple boolean. Instead we accept now 3 values:dev-only(the default),alwaysandnever.Each possible value for this option produces different output code:
dev-onlywe optimize the production code, so there are no labels added there, but at the same time we keep labels for development environments,alwayswe always add labels when possible,neverwe disable this entirely and no labels are added.b7d21373#2080 Thanks @Andarist! -cssPropOptimizationdefaults now totrueregardless of the@emotion/reactimport presence.Minor Changes
c672175b#1130 Thanks @jtmthf! - Adjust how arrays passed to css prop are transformed so function elements can be resolved at runtime.5e803106#1893 Thanks @Andarist! - Added support for converting assignment expressions to labels in cases like this:0a4a22ff#1651 Thanks @Andarist! - AllowlabelFormatoption to be a function.5c7ec859#1805 Thanks @Andarist! - Requirements for a label extraction have been relaxed. In certain situations it was previously required for a containing function to have a PascalCased name.c5b12d90#1220 Thanks @mitchellhamilton! - Added theimportMapoption which allows you to tell@emotion/babel-pluginwhat imports it should look at to determine what it should transform so if you re-export Emotion's exports, you can still use the Babel transforms828111cd#1639 Thanks @Andarist! -Globalgets handled by the Babel plugin now - this gives inline css-less expressions source maps.Patch Changes
b0ad4f0c#1602 Thanks @Andarist! - Avoid transpiling vanilla emotion calls in already transpiled code to avoid double labels and such9e998e37#1817 Thanks @Andarist! - 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& :hoverthe whitespace before colon has a semantic meaning and needs to be preserved.Updated dependencies [
e3d7db87,8a896a31,5c55fd17,a085003d,5d692a6a,c6431074]:@emotion/[email protected]
Major Changes
c5b12d90#1220 Thanks @mitchellhamilton! - Removed support for theinstancesoption, any usage of it should be replaced with theimportMapoptionc7850e61#1656 Thanks @Andarist! -autoLabeloption no longer is a simple boolean. Instead we accept now 3 values:dev-only(the default),alwaysandnever.Each possible value for this option produces different output code:
dev-onlywe optimize the production code, so there are no labels added there, but at the same time we keep labels for development environments,alwayswe always add labels when possible,neverwe disable this entirely and no labels are added.9e3671c4#2076 Thanks @Andarist! - Removedruntimeoption that was introduced to this preset and deprecated shortly after that. If you want to configureruntime: "automatic", replace@emotion/babel-preset-css-propwith@babel/preset-reactand@emotion/babel-plugin. You can find out how to configure things properly here: https://emotion.sh/docs/css-prop#babel-presetMinor Changes
c672175b#1130 Thanks @jtmthf! - Adjust how arrays passed to css prop are transformed so function elements can be resolved at runtime.0a4a22ff#1651 Thanks @Andarist! - AllowlabelFormatoption to be a function.c5b12d90#1220 Thanks @mitchellhamilton! - Added theimportMapoption which allows you to tell@emotion/babel-pluginwhat imports it should look at to determine what it should transform so if you re-export Emotion's exports, you can still use the Babel transformsPatch Changes
c672175b,c5b12d90,5e803106,b8476e08,0a4a22ff,b0ad4f0c,9e998e37,c65c5d88,5c7ec859,c7850e61,b7d21373,c5b12d90,828111cd]:@emotion/[email protected]
Major Changes
105de5c8#1572 Thanks @Andarist! - From now onkeyoption is required. Please make sure it's unique (and not equal to"css") as it's used for linking styles to your cache. If multiple caches share the same key they might "fight" for each other's style elements.9e998e37#1817 Thanks @Andarist! - The parser we use (Stylis) 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. The most notable ones that might affect Emotion users are:
prefixoption. This was always limited to turning off all of some of the prefixes as all available prefixes were on by default. Theprefixoption 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.stylisPlugins. If you plan to use customstylisPluginsand you want to have your styles prefixed automatically you must include prefixer in your customstylisPlugins. You can importprefixerfrom thestylismodule to do that.@importrules 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.Minor Changes
4a891bf6#1473 Thanks @jcharry! - The newprependoption can make Emotion add style tags at the beginning of the specified DOM container instead of the end.Patch Changes
a8eb4e75#1998 Thanks @Andarist! - Styles are now correctly extracted from the correct cache (key-sensitive) on the server.105de5c8#1572 Thanks @Andarist! - Fixed issue with SSRed styles causing a React rehydration mismatch between server & client when cache was created in render.39be057b#1997 Thanks @Andarist! - From now on an empty rule will get inserted into the DOM in non-production environments if it gets created by the user. This helps to grab usedkeys from the (JS)DOM even for caches that have not inserted any actual rules to the document yet. It allows@emotion/jestto find those and serialize Emotion classes properly in situations like this:Updated dependencies [
42df3f3b,4a891bf6,1e4a741d,debaad9a,dfe79aca,9e998e37,9e998e37]:@emotion/[email protected]
Major Changes
b8476e08#1675 Thanks @mitchellhamilton! - Move createcreate-emotionto@emotion/css/create-instance. Please change any imports ofcreate-emotionto import@emotion/css/create-instanceor use the@emotion/pkg-renamingESLint rule from@emotion/eslint-plugin.b8476e08#1675 Thanks @mitchellhamilton! - Renameemotionto@emotion/css. Please change any imports ofemotionto import@emotion/cssor use the@emotion/pkg-renamingESLint rule from@emotion/eslint-plugin.5bea60b1#1807 Thanks @Andarist! - Removed support for interpolating class names returned fromcss, so this will no longer be possible:This has already been deprecated for the lifetime of v10.
a293f907#1600 Thanks @mitchellhamilton! - UMD filenames have been changed.843bfb11#1630 Thanks @Andarist! - Removed default export from@emotion/css- it's main purpose was to allowcssto be a Babel macro, but since babel-plugin-macros allows us to keep imports nowadays this is no longer needed.@emotion/react/macrohas been added to account for this use case and appropriate changes has been made to@emotion/babel-pluginto facilitate those changes.If you have used
@emotion/cssdirectly (it was always reexported from@emotion/react) or you have been using its macro then you should update your code like this:You can also use the
@emotion/pkg-renamingESLint rule from@emotion/eslint-pluginto do this for you.105de5c8#1572 Thanks @Andarist! - Thekeyoption is now required when creating a custom instance of a cache. Please make sure it's unique (and not equal to'css') as it's used for linking styles to your cache. If multiple caches share the same key they might "fight" for each other's style elements.9e998e37#1817 Thanks @Andarist! - The parser we use (Stylis) 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. The most notable ones that might affect Emotion users are:
prefixoption. This was always limited to turning off all of some of the prefixes as all available prefixes were on by default. Theprefixoption 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.stylisPlugins. If you plan to use customstylisPluginsand you want to have your styles prefixed automatically you must include prefixer in your customstylisPlugins. You can importprefixerfrom thestylismodule to do that.@importrules 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.Minor Changes
5d692a6a#1956 Thanks @eps1lon! - Upgradedcsstypedependency to its v3. This is what we use to provide TypeScript typings for object styles. The upgrade should not affect any consuming code but it's worth mentioning if any edge case scenarios arise.Patch Changes
6d32d82b#1848 Thanks @osdiab! - Addedspeedymethod to the TS type declaration of thesheetobject available on Emotion instances. In addition to that -StyleSheettype is no longer exported from this package and insteadCSSStyleSheetis available now. TheStyleSheettype might still be imported from@emotion/sheet, but it has nospeedymethod and thus it's not the same as what is available in this package asCSSStyleSheet.Updated dependencies [
c672175b,a8eb4e75,e3d7db87,8a896a31,42df3f3b,c5b12d90,4a891bf6,5e803106,b8476e08,1e4a741d,debaad9a,0a4a22ff,5c55fd17,b0ad4f0c,9e998e37,c65c5d88,5c7ec859,a085003d,dfe79aca,c7850e61,105de5c8,39be057b,b7d21373,105de5c8,5d692a6a,c5b12d90,9e998e37,c6431074,828111cd,9e998e37,9e998e37]:@emotion/[email protected]
Major Changes
b8476e08#1675 Thanks @mitchellhamilton! - Renameeslint-plugin-emotionto@emotion/eslint-plugin. Please replace"plugins": ["emotion"]with"plugins": ["@emotion"]andemotion/with@emotion/in your rules config in your ESLint config.Minor Changes
8b59959f#1659 Thanks @Andarist! - Respectsyntax-preferencerule when using css prop.b8476e08#1675 Thanks @mitchellhamilton! - Added@emotion/pkg-renamingrule for Emotion 11 migration.58e8c110#2034 Thanks @Andarist! - ESLint 7 has been added to the peer dependency range (ESLint 6 keeps being supported).@emotion/[email protected]
Major Changes
923ded01#1643 Thanks @JakeGinnivan! - AllowisPropValidto take anyPropertyKeyas an argument (instead of juststring).Minor Changes
69446cb5#1971 Thanks @mjcampagna! -translategot added to the list of the valid props.Patch Changes
a085003d#1613 Thanks @Andarist! - Add missing#__PURE__annotations@emotion/[email protected]
Major Changes
ca599c5f#1901 Thanks @Andarist! -test&printare no longer exported as named exports. If you want to access the default serializer just access the default export. This means that@emotion/jest(previouslyjest-emotion) can't be used directly in thesnapshotSerializersoption, you should use@emotion/jest/serializerinstead for this.702f3fd2#1620 Thanks @spudly! - Added theTparameter to theMatchersinterface in the TypeScript definitions to make this module compatible with@types/jest@^24.0.20.ca599c5f#1901 Thanks @Andarist! - Refactored to use new serializers API which has been introduced in Jest 21.b8476e08#1675 Thanks @mitchellhamilton! - Renamejest-emotionto@emotion/jest. Please replace"snapshotSerializers": ["jest-emotion"]with"snapshotSerializers": ["@emotion/jest/serializer"]if you're using the snapshot serializer. Also replace any imports ofjest-emotionwith@emotion/jestor use the@emotion/pkg-renamingESLint rule from@emotion/eslint-plugin.cd77efbf#1920 Thanks @Andarist! - The root entry (@emotion/jest) no longer hasdefaultandserializerexports. You can still importcreateSerializerfrom it to create your own serializer if needed.cd77efbf#1920 Thanks @Andarist! -@emotion/jest/serializer's main purpose is compatibility with Jest'ssnapshotSerializersoption, so it no longer has a default export - it only hastest&serializeexports. You can importcreateSerializerfrom the root entry (@emotion/jest) and create your own serializer if needed.Minor Changes
b8476e08#1675 Thanks @mitchellhamilton! - Improve support for Enzyme's shallow rendering with the addition of the@emotion/jest/enzyme-serializersnapshot serializer.ca599c5f#1901 Thanks @Andarist! - Improved printing of nested at-rules.ca599c5f#1901 Thanks @Andarist! - Fixed an issue with all styles being recognized as changed in Jest 25 on unrelated changes.Patch Changes
3abcf673#2043 Thanks @Andarist! -@types/jesthas been moved from the dependencies to the optional peer dependencies as it should not be installed automatically for users not using TypeScript.e67a5be9#1604 Thanks @Andarist! - Take specificity into account when matching styles8a88e771#1880 Thanks @Jimmydalecleveland! - Improved stability of the generated snapshots - styles are extracted now based on the order in which the associated with them class names appear in the serialized elements rather than based on the order of the actual rules in the document.e67a5be9#1604 Thanks @Andarist! - Match rules in declarations with component used as a selectorae8c1d9d#1902 Thanks @Andarist! - Added support for handling regular React elements (objects returned fromReact.createElement) in the serializer andtoHaveStyleRulematcher. It's possible to get those elements when traversing Enzyme's trees.Updated dependencies []:
@emotion/[email protected]
Major Changes
95ea2839#2014 Thanks @Andarist! - Updatedcss-to-react-nativedependency to the 3.x version - it comes with some breaking changes listed here.95ea2839#2014 Thanks @Andarist! - Functions are no longer accepted as values for thestyleprop. This unifies the behavior with the web version of Emotion asstyle's equivalent isclassNameprop and functions are not resolved for it.139ea336#2060 Thanks @efoken! -StyleSheet.createis used now under the hood. This means that when used in combination with React Native Web atomic class names are applied on components instead of inline styles.79036056#967 Thanks @mitchellhamilton! - Use hooks internally for improved bundle size and a better tree in React DevToolsMinor Changes
843bfb11#1630 Thanks @Andarist! -@emotion/native&@emotion/primitivespackages come with macros now. Both can be used as@emotion/native/macro&@emotion/primitives/macrorespectively.456be9a6#1634 Thanks @patsissons! - Added TypeScript type definitions.2d597857#2058 Thanks @efoken! - Added support for theasprop.f1b7c9d6#1642 Thanks @Andarist! - Added basic support for accepting customshouldForwardPropoption.Patch Changes
11fc27f8#1750 Thanks @Zn4rK! - Match supported components to what is exported from the latest version of React Native (0.61.5).db16ac35#2013 Thanks @Andarist! - Fixed an issue with styles being lost for nested factory calls like:Updated dependencies [
95ea2839,db16ac35,95ea2839,139ea336,79036056,2d597857]:@emotion/[email protected]
Major Changes
95ea2839#2014 Thanks @Andarist! - Updatedcss-to-react-nativedependency to the 3.x version - it comes with some breaking changes listed here.95ea2839#2014 Thanks @Andarist! - Functions are no longer accepted as values for thestyleprop. This unifies the behavior with the web version of Emotion asstyle's equivalent isclassNameprop and functions are not resolved for it.139ea336#2060 Thanks @efoken! -StyleSheet.createis used now under the hood. This means that when used in combination with React Native Web atomic class names are applied on components instead of inline styles.79036056#967 Thanks @mitchellhamilton! - Use hooks internally for improved bundle size and a better tree in React DevToolsMinor Changes
843bfb11#1630 Thanks @Andarist! -@emotion/native&@emotion/primitivespackages come with macros now. Both can be used as@emotion/native/macro&@emotion/primitives/macrorespectively.2d597857#2058 Thanks @efoken! - Added support for theasprop.f1b7c9d6#1642 Thanks @Andarist! - Added basic support for accepting customshouldForwardPropoption.Patch Changes
db16ac35#2013 Thanks @Andarist! - Fixed an issue with styles being lost for nested factory calls like:Updated dependencies [
c672175b,923ded01,c5b12d90,5e803106,95ea2839,b8476e08,0a4a22ff,b0ad4f0c,9e998e37,c65c5d88,5c7ec859,db16ac35,a085003d,c7850e61,95ea2839,b7d21373,139ea336,c5b12d90,79036056,2d597857,828111cd,69446cb5]:@emotion/[email protected]
Major Changes
95ea2839#2014 Thanks @Andarist! - Updatedcss-to-react-nativedependency to the 3.x version - it comes with some breaking changes listed here.95ea2839#2014 Thanks @Andarist! - Functions are no longer accepted as values for thestyleprop. This unifies the behavior with the web version of Emotion asstyle's equivalent isclassNameprop and functions are not resolved for it.139ea336#2060 Thanks @efoken! -StyleSheet.createis used now under the hood. This means that when used in combination with React Native Web atomic class names are applied on components instead of inline styles.79036056#967 Thanks @mitchellhamilton! - Use hooks internally for improved bundle size and a better tree in React DevToolsMinor Changes
2d597857#2058 Thanks @efoken! - Added support for theasprop.Patch Changes
db16ac35#2013 Thanks @Andarist! - Fixed an issue with styles being lost for nested factory calls like:@emotion/[email protected]
Major Changes
c6431074#1609 Thanks @tomsseisums! - It's now easier to provide a type forTheme. Instead of creating custom instances (like before) you can augment the builtinThemeinterface like this:a8c99429#1600 Thanks @mitchellhamilton! - TypeScript types have been significantly restructured. These changes:cssfunction has been restricted to prevent passing invalid typesstyled's generic parameter has been changed, if you were specifying theComponentTypeyou will need to remove that generic parameterstyledno longer takes a secondExtraPropsparameter - instead of that move it to after thestyledcall. So instead of writingstyled<typeof MyComponent, ExtraProps>(MyComponent)({})you should now be writingstyled(MyComponent)<ExtraProps>({})If you encounter build issues after upgrade, try removing any manually specified generic types and let them be inferred.
105de5c8#1572 Thanks @Andarist! -[data-emotion]attribute on SSRed styled has changed. You should never rely on it though.b8476e08#1675 Thanks @mitchellhamilton! - Rename@emotion/coreto@emotion/react. Please change any imports of@emotion/coreto import@emotion/reactor use the@emotion/pkg-renamingESLint rule from@emotion/eslint-plugin.a293f907#1600 Thanks @mitchellhamilton! - UMD filenames have been changed.843bfb11#1630 Thanks @Andarist! - Removed default export from@emotion/css- it's main purpose was to allowcssto be a Babel macro, but since babel-plugin-macros allows us to keep imports nowadays this is no longer needed.@emotion/react/macrohas been added to account for this use case and appropriate changes has been made to@emotion/babel-pluginto facilitate those changes.If you have used
@emotion/cssdirectly (it was always reexported from@emotion/react) or you have been using its macro then you should update your code like this:You can also use the
@emotion/pkg-renamingESLint rule from@emotion/eslint-pluginto do this for you.79036056#967 Thanks @mitchellhamilton! - Use hooks internally for improved bundle size and a better tree in React DevTools9e998e37#1817 Thanks @Andarist! - The parser we use (Stylis) 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. The most notable ones that might affect Emotion users are:
prefixoption. This was always limited to turning off all of some of the prefixes as all available prefixes were on by default. Theprefixoption 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.stylisPlugins. If you plan to use customstylisPluginsand you want to have your styles prefixed automatically you must include prefixer in your customstylisPlugins. You can importprefixerfrom thestylismodule to do that.@importrules 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.cbb8b796#1628 Thanks @Andarist! -emotion-theminghas been removed and all its exports were moved to@emotion/reactpackage. Please import them like thisimport { useTheme, ThemeProvider, withTheme } from '@emotion/react'from now on.Minor Changes
c672175b#1130 Thanks @jtmthf! - Support functions in arrays passed tocssprop andGlobal's styles prop. This allows for composition of theme-accepting functions.828111cd#1639 Thanks @Andarist! -Globalimported from macro entry (@emotion/react/macro) gets source maps generated now when inline css-less expression is used as value of thestylesprop.5d692a6a#1956 Thanks @eps1lon! - Upgradedcsstypedependency to its v3. This is what we use to provide TypeScript typings for object styles. The upgrade should not affect any consuming code but it's worth mentioning if any edge case scenarios arise.Patch Changes
7dea6d7a#1734 Thanks @Andarist! - Fixed styles inserted by<Global/>component not inheritingspeedyoption from a cache passed to a wrapping<CacheProvider/>.58dc08a6#1837 Thanks @arcanis! - Fixed TS compatibility under PnP environments by making@types/reactan optional peer dependency.5c55fd17#1653 Thanks @Andarist! - Fix to what location generated source maps are pointing in case of composed styles.f57a7229#1941 Thanks @Andarist! - The way in which we provide TypeScript support for thecssprop has changed. Based on the usage of our JSX factories, we can add support forcssprop only for components that supportclassNameprop (as our JSX factory functions take the providedcssprop, resolve it and pass the generatedclassNameto the rendered component).For the classic runtime this has been implemented using technique described here. What is important - we no longer extend any global interfaces, so people shouldn't bump anymore into type conflicts for the
cssprop when using different libraries withcssprop support, such asstyled-components.For the automatic runtime this has been implemented by exporting
JSXnamespace from the appropriate entries but this is only supported in TypeScript 4.1 or higher.However, if you are stuck with older version of TypeScript or using the classic runtime implicitly by using our
@emotion/babel-preset-css-propthen it's not possible to leverage leveragecssprop support being added conditionally based on a type of rendered component. For those cases we have added a special file that can be imported once to add support for thecssprop globally, for all components. Use it like this:/// <reference types="@emotion/react/types/css-prop" />In this particular case we are forced to extend the existing
React.Attributesinterface. Previously we've been extending bothReact.DOMAttributes<T>andJSX.IntrinsicAttributes. This change is really minor and shouldn't affect any consuming code.a085003d#1613 Thanks @Andarist! - Add missing#__PURE__annotations75e2f9e1#1810 Thanks @Andarist! - Add a dev-only warning about styles created withcssfrom@emotion/reactbeing passed tocxfrom<ClassNames/>.d62d9101#1677 Thanks @ajs139! - Warn if@emotion/reactis initialized more than once in the same development environment.Updated dependencies [
a8eb4e75,e3d7db87,8a896a31,42df3f3b,4a891bf6,1e4a741d,debaad9a,5c55fd17,a085003d,dfe79aca,105de5c8,39be057b,105de5c8,5d692a6a,9e998e37,c6431074,9e998e37,9e998e37]:@emotion/[email protected]
Major Changes
c6431074#1609 Thanks @tomsseisums! - ReworkedInterpolation-related types. Correct types should now be provided to all flavours of Emotion.Minor Changes
5d692a6a#1956 Thanks @eps1lon! - Upgradedcsstypedependency to its v3. This is what we use to provide TypeScript typings for object styles. The upgrade should not affect any consuming code but it's worth mentioning if any edge case scenarios arise.Patch Changes
e3d7db87#1732 Thanks @Andarist! - An additional semicolon is now inserted after interpolated arrays to cover cases when it doesn't have a trailing semi itself and thus breaking composition with styles coming after it.8a896a31#1611 Thanks @Andarist! - Throw error about invalid content property values instead of just logging error to the console.5c55fd17#1653 Thanks @Andarist! - Fix to what location generated source maps are pointing in case of composed styles.a085003d#1613 Thanks @Andarist! - Add missing#__PURE__annotationsUpdated dependencies [
debaad9a,9e998e37]:@emotion/[email protected]
Major Changes
105de5c8#1572 Thanks @Andarist! -[data-emotion]attribute on SSRed styled has changed. You should never rely on it though.b8476e08#1675 Thanks @mitchellhamilton! - Renameemotion-serverto@emotion/server. Please change any imports ofemotion-serverto import@emotion/serveror use the@emotion/pkg-renamingESLint rule from@emotion/eslint-plugin.b8476e08#1675 Thanks @mitchellhamilton! - Movecreate-emotion-serverto@emotion/server/create-instance. Please change any imports ofcreate-emotion-serverto import@emotion/server/create-instanceor use the@emotion/pkg-renamingESLint rule from@emotion/eslint-plugin.Patch Changes
debaad9a,9e998e37]:@emotion/[email protected]
Major Changes
9e998e37#1817 Thanks @Andarist! -@importrules 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.Minor Changes
4a891bf6#1473 Thanks @jcharry! - The newprependoption can make Emotion add style tags at the beginning of the specified DOM container instead of the end.dfe79aca#1696 Thanks @Andarist! - Addedhydratemethod which can be used for SSRed styles. They become a part of a sheet and can be flushed.Patch Changes
42df3f3b#2028 Thanks @Andarist! - Generated style elements gotdata-s="1"attribute so@emotion/cachecan recognize them as being already owned by another Emotion copy to avoid messing up existing style elements when initializing a new copy.1e4a741d#1697 Thanks @Andarist! - Removed mentions ofmaxLengthoption in types & docs as it has been removed some time ago.@emotion/[email protected]
Major Changes
79036056#967 Thanks @mitchellhamilton! - Remove support for deprecatedinnerRefpropc6431074#1609 Thanks @tomsseisums! - It's now easier to provide a type forTheme. Instead of creating custom instances (like before) you can augment the builtinThemeinterface like this:a8c99429#1600 Thanks @mitchellhamilton! - TypeScript types have been significantly restructured. These changes:cssfunction has been restricted to prevent passing invalid typesstyled's generic parameter has been changed, if you were specifying theComponentTypeyou will need to remove that generic parameterstyledno longer takes a secondExtraPropsparameter - instead of that move it to after thestyledcall. So instead of writingstyled<typeof MyComponent, ExtraProps>(MyComponent)({})you should now be writingstyled(MyComponent)<ExtraProps>({})If you encounter build issues after upgrade, try removing any manually specified generic types and let them be inferred.
105de5c8#1572 Thanks @Andarist! -[data-emotion]attribute on SSRed styled has changed. You should never rely on it though.a293f907#1600 Thanks @mitchellhamilton! - UMD filenames have been changed.f9feab1a#1575 Thanks @mitchellhamilton! - Removed support for@emotion/styled-basepackage. It has been moved to@emotion/styledand is available as@emotion/styled/base. This simplifies how the regular and base versions relate to each other and eliminates problems with stricter package managers when@emotion/styled-basewas not installed explicitly by a user.79036056#967 Thanks @mitchellhamilton! - Use hooks internally for improved bundle size and a better tree in React DevTools9e998e37#1817 Thanks @Andarist! - The parser we use (Stylis) 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. The most notable ones that might affect Emotion users are:
prefixoption. This was always limited to turning off all of some of the prefixes as all available prefixes were on by default. Theprefixoption 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.stylisPlugins. If you plan to use customstylisPluginsand you want to have your styles prefixed automatically you must include prefixer in your customstylisPlugins. You can importprefixerfrom thestylismodule to do that.@importrules 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.Minor Changes
4d3b60d0#1874 Thanks @connor-baer! - Added basic TS type support forasprop on styled components. It's possible to pass any component to it but it has no effect on other accepted props. This means that it's not 100% type-safe so use it sparingly and with care.a8c99429#1600 Thanks @mitchellhamilton! - AddedCreateStyledoverload to handle whenshouldForwardPropis a custom type guard for intrinsic props.As an example, if you want to override the type of the
colorprop:18c0d5f4#1668 Thanks @animecyc! - CustomshouldForwardPropis being preserved now when using.withComponent. Also, when passing an additionalshouldForwardPropin.withComponent's options (like this:SomeComponent.withComponent('span', { shouldForwardProp })) it's being composed with the potentially existingshouldForwardProp.5d692a6a#1956 Thanks @eps1lon! - Upgradedcsstypedependency to its v3. This is what we use to provide TypeScript typings for object styles. The upgrade should not affect any consuming code but it's worth mentioning if any edge case scenarios arise.Patch Changes
58dc08a6#1837 Thanks @arcanis! - Fixed TS compatibility under PnP environments by making@types/reactan optional peer dependency.22935470#1588 Thanks @FezVrasta! -StyledComponentFlow type is now polymorphic, that means you can now define the component prop types to get better type safety.Updated dependencies [
c672175b,923ded01,e3d7db87,8a896a31,c5b12d90,5e803106,b8476e08,debaad9a,0a4a22ff,5c55fd17,b0ad4f0c,9e998e37,c65c5d88,5c7ec859,a085003d,c7850e61,b7d21373,5d692a6a,c5b12d90,c6431074,828111cd,9e998e37,69446cb5]:@emotion/[email protected]
Major Changes
9e998e37#1817 Thanks @Andarist! -insertStylesno longer callscache.insertwith a scoped class name as a selector when inserting keyframes. The change is internal and has no effect on Emotion users.Patch Changes
debaad9a#1999 Thanks @RoystonS! - Fixed TypeScript definition of theEmotionCacheby replacing the non-existentstylismethod withinsertthat is available at runtime.[email protected]
Major Changes
b8476e08#1675 Thanks @mitchellhamilton! - Renamebabel-plugin-emotionto@emotion/babel-plugin. Please replace"plugins": ["emotion"]with"plugins": ["@emotion"]in your Babel config.@emotion/[email protected]
Major Changes
b8476e08#1675 Thanks @mitchellhamilton! - Rename@emotion/coreto@emotion/react. Please change any imports of@emotion/coreto import@emotion/reactor use the@emotion/pkg-renamingESLint rule from@emotion/eslint-plugin.[email protected]
Major Changes
b8476e08#1675 Thanks @mitchellhamilton! - Move createcreate-emotionto@emotion/css/create-instance. Please change any imports ofcreate-emotionto import@emotion/css/create-instanceor use the@emotion/pkg-renamingESLint rule from@emotion/eslint-plugin.[email protected]
Major Changes
b8476e08#1675 Thanks @mitchellhamilton! - Movecreate-emotion-serverto@emotion/server/create-instance. Please change any imports ofcreate-emotion-serverto import@emotion/server/create-instanceor use the@emotion/pkg-renamingESLint rule from@emotion/eslint-plugin.[email protected]
Major Changes
b8476e08#1675 Thanks @mitchellhamilton! - Renameemotionto@emotion/css. Please change any imports ofemotionto import@emotion/cssor use the@emotion/pkg-renamingESLint rule from@emotion/eslint-plugin.[email protected]
Major Changes
b8476e08#1675 Thanks @mitchellhamilton! - Renameemotion-serverto@emotion/server. Please change any imports ofemotion-serverto import@emotion/serveror use the@emotion/pkg-renamingESLint rule from@emotion/eslint-plugin.[email protected]
Major Changes
cbb8b796#1628 Thanks @Andarist! -emotion-theminghas been removed and all its exports were moved to@emotion/reactpackage. Please import them like thisimport { useTheme, ThemeProvider, withTheme } from '@emotion/react'from now on.[email protected]
Major Changes
b8476e08#1675 Thanks @mitchellhamilton! - Renameeslint-plugin-emotionto@emotion/eslint-plugin. Please replace"plugins": ["emotion"]with"plugins": ["@emotion"]andemotion/with@emotion/in your rules config in your ESLint config.[email protected]
Major Changes
b8476e08#1675 Thanks @mitchellhamilton! - Renamejest-emotionto@emotion/jest. Please replace"snapshotSerializers": ["jest-emotion"]with"snapshotSerializers": ["@emotion/jest/serializer"]if you're using the snapshot serializer. Also replace any imports ofjest-emotionwith@emotion/jestor use the@emotion/pkg-renamingESLint rule from@emotion/eslint-plugin.@emotion/[email protected]
Major Changes
f9feab1a#1575 Thanks @mitchellhamilton! - Removed support for@emotion/styled-basepackage. It has been moved to@emotion/styledand is available as@emotion/styled/base. This simplifies how the regular and base versions relate to each other and eliminates problems with stricter package managers when@emotion/styled-basewas not installed explicitly by a user.@emotion/[email protected]
[email protected]
Patch Changes
c672175b,c5b12d90,5e803106,b8476e08,0a4a22ff,b0ad4f0c,9e998e37,c65c5d88,5c7ec859,c7850e61,b7d21373,c5b12d90,828111cd]: