Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: emotion-js/emotion
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: emotion@10.0.14
Choose a base ref
...
head repository: emotion-js/emotion
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: emotion@10.0.17
Choose a head ref

Commits on Jun 26, 2019

  1. Verified

    This commit was signed with the committer’s verified signature.
    almeidx Almeida
    Copy the full SHA
    ea56579 View commit details
  2. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    c257d2a View commit details

Commits on Jul 4, 2019

  1. Add Option to Keep CSS Comments in babel-plugin-emotion. Fixes #1325 (#…

    …1336)
    
    * Add ability to retain CSS comments with specific allowed values in order to support stylis plugins such as those that use cssjanus library, which depend on special css comments.
    
    * Simplify comment-checking.
    Zenwolf authored and emmatown committed Jul 4, 2019

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    284f8fa View commit details

Commits on Jul 8, 2019

  1. 1

    Partially verified

    This commit is signed with the committer’s verified signature.
    Jiralite’s contribution has been verified via SSH key.
    We cannot verify signatures from co-authors, and some of the co-authors attributed to this commit require their commits to be signed.
    Copy the full SHA
    8638c41 View commit details

Commits on Jul 9, 2019

  1. Add explicit react-native and sketch pkg.json entries for @emotion/ca…

    …che package (#1412)
    
    * Update @emotion/cache entry for react-native and sketch
    
    * Add changeset
    
    * Update with preconstruct fix
    
    * Fix incorrect entries for sketch
    
    * Fix incorrect entries for sketch
    donysukardi authored and Andarist committed Jul 9, 2019
    Copy the full SHA
    61e61ed View commit details

Commits on Jul 29, 2019

  1. Make site use MDX (#1449)

    * WIP site things
    
    * Remove some unused stuff
    
    * Progress on using mdx
    
    * More progress
    
    * More progress
    
    * It's working
    
    * Fix more things
    
    * Try something
    
    * Try a thing
    
    * Try a thing
    
    * More
    
    * Try another thing
    
    * Try another thing
    
    * Try another thing
    
    * Try more things
    
    * Yarn lock thing
    
    * Fix image
    emmatown authored Jul 29, 2019
    Copy the full SHA
    2ca4d26 View commit details

Commits on Aug 2, 2019

  1. Copy the full SHA
    4a3b18a View commit details
  2. Extract rather than inline styles in Global component when in compat …

    …mode (#1443)
    
    * Extract rather than inline styles in Global component when in compat mode
    
    * Add a changeset
    
    * Update a comment
    emmatown authored Aug 2, 2019
    Copy the full SHA
    188dc0e View commit details
  3. Prevent site header from breaking mobile layout (#1413)

    The width of the nav links in the site header breaks the layout in viewports narrower than ~520pts. Allow the navigation links to horizontally scroll to prevent the entire site layout from scrolling horizontally.
    tinymachine authored and emmatown committed Aug 2, 2019
    Copy the full SHA
    e826214 View commit details
  4. Fix jsx pragma example in migration guide (#1438)

    * Fix jsx pragma example in migration guide
    
    * Align comments that indicate a transition
    
    * Fix and make grammar consistent
    lychyi authored and emmatown committed Aug 2, 2019
    Copy the full SHA
    6d79b0b View commit details
  5. Copy the full SHA
    85c90f4 View commit details
  6. Add a changeset

    emmatown committed Aug 2, 2019
    Copy the full SHA
    2a7bcf0 View commit details
  7. Copy the full SHA
    5e047e0 View commit details
  8. Update changesets things

    emmatown committed Aug 2, 2019
    Copy the full SHA
    4a671bb View commit details

Commits on Aug 5, 2019

  1. Copy the full SHA
    431e76f View commit details
  2. Add @emotion/core to the install command, since it's a dependency o…

    …f `@emotion/native`. (#1454)
    tian-yi authored and emmatown committed Aug 5, 2019
    Copy the full SHA
    8f04bb3 View commit details
  3. docs: update babel-preset-css-prop (#1423)

    * docs: update babel-preset-css-prop
    
    * Update README.md
    Krzysztof Ε»uraw authored and emmatown committed Aug 5, 2019
    Copy the full SHA
    59b58b9 View commit details

Commits on Aug 9, 2019

  1. Update README.md

    Closes #1464
    emmatown authored Aug 9, 2019
    Copy the full SHA
    866973c View commit details
  2. Add a changeset

    emmatown committed Aug 9, 2019
    Copy the full SHA
    1ea9b3a View commit details

Commits on Aug 16, 2019

  1. Copy the full SHA
    47262b6 View commit details
  2. Version packages

    emmatown committed Aug 16, 2019
    Copy the full SHA
    5193881 View commit details

Commits on Aug 23, 2019

  1. Add warnings about using illegal escape sequances (#1478)

    * Add warnings about using illegal escape sequances
    
    * Fix things
    
    * Add changesets
    
    * sequance -> sequence
    Andarist authored and emmatown committed Aug 23, 2019
    Copy the full SHA
    66cda64 View commit details

Commits on Aug 27, 2019

  1. Remove react native bundles for core and cache in favour of different…

    … isBrowser detection (#1482)
    emmatown authored Aug 27, 2019
    Copy the full SHA
    10514a8 View commit details

Commits on Aug 28, 2019

  1. Copy the full SHA
    2c443e4 View commit details

Commits on Aug 31, 2019

  1. Fix autoLabel crash on css used as a computed key of an object (#…

    …1485)
    
    * Guard against undefined key.name
    
    * Add a test to reflect the fail case
    
    * Add changeset
    
    * Better test file name
    
    * Add snap files from new tests
    
    * Tweak changeset description
    
    * Change condition to check if property is computed
    JSteunou authored and Andarist committed Aug 31, 2019
    Copy the full SHA
    b22b4ca View commit details
  2. jest-emotion: Fix snapshots when using fragments & deep mode (#1477)

    * jest-emotion: Fix snapshots when using fragments & deep mode
    
    Fixes #1463
    
    * Refactor how enzyme deep serializer is used in tests
    
    * Tweak changeset description
    liamcmitchell-sc authored and Andarist committed Aug 31, 2019
    Copy the full SHA
    fa5ffa8 View commit details
  3. Fix printing speedy styles (#1486)

    * Fix printing speedy styles
    
    * Suppress flow error
    Andarist authored and emmatown committed Aug 31, 2019
    Copy the full SHA
    c8de890 View commit details
  4. Fix "Edit this page" link for docs (#1484)

    With #1449, the "Edit this page" link at the top of https://emotion.sh/docs/introduction, https://emotion.sh/docs/class-names, etc are now broken as they direct to `.md` instead of `.mdx`. This PR addresses this issue.
    
    Line 128 does not seem to need `.mdx` because the `README.md` files in `/packages`'s directories have not been converted to `.mdx`.
    therobinkim authored and emmatown committed Aug 31, 2019
    Copy the full SHA
    e20cf6a View commit details
  5. fix: Remove warn when using nth selector with extract critical (#1483)

    * fix: Remove warn when using nth selector with extract critical
    
    * Added changeset info
    
    * Fixed test
    JakeGinnivan authored and emmatown committed Aug 31, 2019
    Copy the full SHA
    16ff233 View commit details
  6. Copy the full SHA
    c1acb76 View commit details
  7. Version Packages (#1487)

    github-actions[bot] authored and emmatown committed Aug 31, 2019
    Copy the full SHA
    db69d22 View commit details
Showing with 10,544 additions and 8,613 deletions.
  1. +133 βˆ’1 .changeset/config.js
  2. +2 βˆ’0 .flowconfig
  3. +3 βˆ’0 .flowconfig-ci
  4. +30 βˆ’0 .github/workflows/release.yml
  5. +1 βˆ’0 README.md
  6. +6 βˆ’3 babel.config.js
  7. 0 docs/{babel-macros.md β†’ babel-macros.mdx}
  8. 0 docs/{babel.md β†’ babel.mdx}
  9. 0 docs/{cache-provider.md β†’ cache-provider.mdx}
  10. 0 docs/{class-names.md β†’ class-names.mdx}
  11. 0 docs/{composition.md β†’ composition.mdx}
  12. 0 docs/{css-prop.md β†’ css-prop.mdx}
  13. 0 docs/{extract-static.md β†’ extract-static.mdx}
  14. 0 docs/{globals.md β†’ globals.mdx}
  15. +0 βˆ’51 docs/homepage-buttons.md
  16. 0 docs/{install.md β†’ install.mdx}
  17. 0 docs/{instances.md β†’ instances.mdx}
  18. 0 docs/{introduction.md β†’ introduction.mdx}
  19. 0 docs/{keyframes.md β†’ keyframes.mdx}
  20. 0 docs/{labels.md β†’ labels.mdx}
  21. 0 docs/{media-queries.md β†’ media-queries.mdx}
  22. +25 βˆ’9 docs/{migrating-to-emotion-10.md β†’ migrating-to-emotion-10.mdx}
  23. 0 docs/{nested.md β†’ nested.mdx}
  24. 0 docs/{object-styles.md β†’ object-styles.mdx}
  25. 0 docs/{source-maps.md β†’ source-maps.mdx}
  26. 0 docs/{ssr.md β†’ ssr.mdx}
  27. 0 docs/{styled.md β†’ styled.mdx}
  28. 0 docs/{testing.md β†’ testing.mdx}
  29. 0 docs/{theming.md β†’ theming.mdx}
  30. 0 docs/{typescript.md β†’ typescript.mdx}
  31. 0 docs/{with-props.md β†’ with-props.mdx}
  32. +32 βˆ’29 package.json
  33. +21 βˆ’2 packages/babel-plugin-emotion/CHANGELOG.md
  34. +30 βˆ’0 packages/babel-plugin-emotion/__tests__/__snapshots__/css.js.snap
  35. +31 βˆ’3 packages/babel-plugin-emotion/__tests__/__snapshots__/styled.js.snap
  36. +109 βˆ’1 packages/babel-plugin-emotion/__tests__/__snapshots__/vanilla-emotion.js.snap
  37. +7 βˆ’0 packages/babel-plugin-emotion/__tests__/css-macro/__fixtures__/object-dynamic-property.js
  38. +30 βˆ’0 packages/babel-plugin-emotion/__tests__/css-macro/__snapshots__/index.js.snap
  39. +10 βˆ’0 packages/babel-plugin-emotion/__tests__/styled-macro/__fixtures__/label.js
  40. +31 βˆ’3 packages/babel-plugin-emotion/__tests__/styled-macro/__snapshots__/index.js.snap
  41. +48 βˆ’0 packages/babel-plugin-emotion/__tests__/vanilla-emotion-macro/__fixtures__/comments.js
  42. +109 βˆ’1 packages/babel-plugin-emotion/__tests__/vanilla-emotion-macro/__snapshots__/index.js.snap
  43. +3 βˆ’2 packages/babel-plugin-emotion/package.json
  44. 0 packages/babel-plugin-emotion/src/{macro.js β†’ emotion-macro.js}
  45. +1 βˆ’1 packages/babel-plugin-emotion/src/index.js
  46. +11 βˆ’6 packages/babel-plugin-emotion/src/utils/label.js
  47. +21 βˆ’1 packages/babel-plugin-emotion/src/utils/minify-utils.js
  48. +1 βˆ’1 packages/babel-plugin-jsx-pragmatic/CHANGELOG.md
  49. +7 βˆ’1 packages/babel-preset-css-prop/CHANGELOG.md
  50. +1 βˆ’1 packages/babel-preset-css-prop/README.md
  51. +4 βˆ’4 packages/babel-preset-css-prop/package.json
  52. +14 βˆ’1 packages/cache/CHANGELOG.md
  53. +6 βˆ’6 packages/cache/package.json
  54. +6 βˆ’2 packages/cache/src/index.js
  55. +22 βˆ’1 packages/core/CHANGELOG.md
  56. +99 βˆ’0 packages/core/__tests__/__snapshots__/keyframes.js.snap
  57. +8 βˆ’8 packages/core/__tests__/__snapshots__/server.js.snap
  58. +11 βˆ’0 packages/core/__tests__/compat/__snapshots__/server.js.snap
  59. +17 βˆ’3 packages/core/__tests__/compat/server.js
  60. +18 βˆ’0 packages/core/__tests__/css.js
  61. +69 βˆ’0 packages/core/__tests__/keyframes.js
  62. +8 βˆ’16 packages/core/package.json
  63. +7 βˆ’1 packages/core/src/context.js
  64. +14 βˆ’10 packages/core/src/global.js
  65. +10 βˆ’3 packages/core/src/jsx.js
  66. +1 βˆ’1 packages/create-emotion-server/CHANGELOG.md
  67. +1 βˆ’1 packages/create-emotion/CHANGELOG.md
  68. +2 βˆ’6 packages/create-emotion/src/index.js
  69. +2 βˆ’2 packages/css/CHANGELOG.md
  70. +7 βˆ’1 packages/emotion-server/CHANGELOG.md
  71. +4 βˆ’4 packages/emotion-server/package.json
  72. +20 βˆ’0 packages/emotion-server/test/index.test.js
  73. +9 βˆ’3 packages/emotion-theming/CHANGELOG.md
  74. +5 βˆ’5 packages/emotion-theming/package.json
  75. +7 βˆ’1 packages/emotion/CHANGELOG.md
  76. +2 βˆ’2 packages/emotion/package.json
  77. +47 βˆ’0 packages/emotion/test/no-babel/warnings.test.js
  78. +2 βˆ’2 packages/eslint-plugin-emotion/CHANGELOG.md
  79. +1 βˆ’1 packages/hash/CHANGELOG.md
  80. +3 βˆ’3 packages/is-prop-valid/CHANGELOG.md
  81. +10 βˆ’2 packages/jest-emotion/CHANGELOG.md
  82. +4 βˆ’4 packages/jest-emotion/package.json
  83. +7 βˆ’0 packages/jest-emotion/src/index.js
  84. +17 βˆ’2 packages/jest-emotion/src/utils.js
  85. +10 βˆ’0 packages/jest-emotion/test/__snapshots__/printer.test.js.snap
  86. +21 βˆ’0 packages/jest-emotion/test/__snapshots__/react-enzyme.test.js.snap
  87. +25 βˆ’1 packages/jest-emotion/test/printer.test.js
  88. +36 βˆ’6 packages/jest-emotion/test/react-enzyme.test.js
  89. +1 βˆ’1 packages/memoize/CHANGELOG.md
  90. +2 βˆ’2 packages/native/CHANGELOG.md
  91. +2 βˆ’2 packages/native/README.md
  92. +1 βˆ’1 packages/primitives-core/CHANGELOG.md
  93. +1 βˆ’1 packages/primitives/CHANGELOG.md
  94. +14 βˆ’2 packages/serialize/CHANGELOG.md
  95. +1 βˆ’1 packages/serialize/package.json
  96. +24 βˆ’3 packages/serialize/src/index.js
  97. +1 βˆ’1 packages/sheet/CHANGELOG.md
  98. +15 βˆ’2 packages/styled-base/CHANGELOG.md
  99. +4 βˆ’4 packages/styled-base/package.json
  100. +11 βˆ’0 packages/styled-base/src/index.js
  101. +47 βˆ’11 packages/styled-base/types/index.d.ts
  102. +16 βˆ’4 packages/styled/CHANGELOG.md
  103. +50 βˆ’0 packages/styled/__tests__/warnings.js
  104. +4 βˆ’4 packages/styled/package.json
  105. +15 βˆ’1 packages/styled/types/tests.tsx
  106. +1 βˆ’1 packages/stylis/CHANGELOG.md
  107. +1 βˆ’1 packages/unitless/CHANGELOG.md
  108. +1 βˆ’1 packages/utils/CHANGELOG.md
  109. +1 βˆ’1 packages/weak-memoize/CHANGELOG.md
  110. +3 βˆ’3 scripts/babel-preset-emotion-dev/package.json
  111. +1 βˆ’0 scripts/babel-preset-emotion-dev/src/index.js
  112. +1 βˆ’1 scripts/benchmarks/package.json
  113. +1 βˆ’1 site/CHANGELOG.md
  114. +16 βˆ’9 site/gatsby-config.js
  115. +6 βˆ’5 site/gatsby-node.js
  116. +22 βˆ’20 site/package.json
  117. +0 βˆ’6 site/plugins/gatsby-plugin-emotion-next-compat/gatsby-node.js
  118. +1 βˆ’1 site/plugins/gatsby-remark-fix-links/index.js
  119. +4 βˆ’2 site/src/.eslintrc.js
  120. +2 βˆ’4 site/src/components/DocMetadata.js
  121. +2 βˆ’0 site/src/components/DocWrapper.js
  122. +2 βˆ’1 site/src/components/Link.js
  123. +3 βˆ’2 site/src/components/Playground.js
  124. +0 βˆ’58 site/src/components/RenderHAST.js
  125. +2 βˆ’0 site/src/components/Search.js
  126. +12 βˆ’3 site/src/components/SiteHeader.js
  127. +2 βˆ’0 site/src/layouts/index.js
  128. +13 βˆ’9 site/src/pages/community.js
  129. +13 βˆ’10 site/src/templates/doc.js
  130. +0 βˆ’54 site/src/utils/demo-buttons.js
  131. +28 βˆ’0 site/src/utils/global.js
  132. +2 βˆ’1 site/src/utils/markdown-styles.js
  133. +8,936 βˆ’8,161 yarn.lock
134 changes: 133 additions & 1 deletion .changeset/config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,137 @@
require('dotenv').config()
const { getInfo } = require('@changesets/get-github-info')

const fetch = require('node-fetch')
const DataLoader = require('dataloader')

function makeQuery(repos) {
return `
query {
${Object.keys(repos)
.map(
(repo, i) =>
`a${i}: repository(
owner: ${JSON.stringify(repo.split('/')[0])}
name: ${JSON.stringify(repo.split('/')[1])}
) {
${repos[repo]
.map(
(commit, i) => `a${commit}: object(expression: ${JSON.stringify(
commit
)}) {
... on Commit {
commitUrl
associatedPullRequests(first: 1) {
nodes {
number
url
}
}
author {
user {
login
url
}
}
}}`
)
.join('\n')}
}`
)
.join('\n')}
}
`
}

// why are we using dataloader?
// it provides use with two things
// 1. caching
// since getInfo will be called inside of changeset's getReleaseLine
// and there could be a lot of release lines for a single commit
// caching is important so we don't do a bunch of requests for the same commit
// 2. batching
// getReleaseLine will be called a large number of times but it'll be called at the same time
// so instead of doing a bunch of network requests, we can do a single one.
const GHDataLoader = new DataLoader(async requests => {
if (!process.env.GITHUB_TOKEN) {
throw new Error(
'Please create a GitHub personal access token at https://github.com/settings/tokens/new and add it as the GITHUB_TOKEN environment variable'
)
}
let repos = {}
requests.forEach(({ commit, repo }) => {
if (repos[repo] === undefined) {
repos[repo] = []
}
repos[repo].push(commit)
})

const data = await fetch(
`https://api.github.com/graphql?access_token=${process.env.GITHUB_TOKEN}`,
{
method: 'POST',
body: JSON.stringify({ query: makeQuery(repos) })
}
).then(x => x.json())

// this is mainly for the case where there's an authentication problem
if (!data.data) {
throw new Error(
`An error occurred when fetching data from GitHub\n${JSON.stringify(
data
)}`
)
}

let cleanedData = {}
let dataKeys = Object.keys(data.data)
Object.keys(repos).forEach((repo, index) => {
cleanedData[repo] = {}
for (let nearlyCommit in data.data[dataKeys[index]]) {
cleanedData[repo][nearlyCommit.substring(1)] =
data.data[dataKeys[index]][nearlyCommit]
}
})

return requests.map(({ repo, commit }) => cleanedData[repo][commit])
})

async function getInfo(request) {
if (!request.commit) {
throw new Error('Please pass a commit SHA to getInfo')
}

if (!request.repo) {
throw new Error(
'Please pass a GitHub repository in the form of userOrOrg/repoName to getInfo'
)
}

const data = await GHDataLoader.load(request)
return {
user: data.author && data.author.user ? data.author.user.login : null,
pull:
data.associatedPullRequests &&
data.associatedPullRequests.nodes &&
data.associatedPullRequests.nodes[0]
? data.associatedPullRequests.nodes[0].number
: null,
links: {
commit: `[${request.commit}](${data.commitUrl})`,
pull:
data.associatedPullRequests &&
data.associatedPullRequests.nodes &&
data.associatedPullRequests.nodes[0]
? `[#${data.associatedPullRequests.nodes[0].number}](${
data.associatedPullRequests.nodes[0].url
})`
: null,
user:
data.author && data.author.user
? `[@${data.author.user.login}](${data.author.user.url})`
: null
}
}
}

/*
Hey, welcome to the changeset config! This file has been generated
2 changes: 2 additions & 0 deletions .flowconfig
Original file line number Diff line number Diff line change
@@ -7,6 +7,7 @@
.*/node_modules/graphql/.*
.*/node_modules/metro.*
.*/node_modules/preact/.*
.*/node_modules/@parcel/.*

[untyped]
.*/node_modules/polished/.*
@@ -22,3 +23,4 @@

[options]
suppress_comment=.*\\$FlowFixMe
sharedmemory.hash_table_pow=21
3 changes: 3 additions & 0 deletions .flowconfig-ci
Original file line number Diff line number Diff line change
@@ -7,6 +7,8 @@
.*/node_modules/graphql/.*
.*/node_modules/metro.*
.*/node_modules/preact/.*
.*/node_modules/@parcel/.*


[untyped]
.*/node_modules/polished/.*
@@ -23,3 +25,4 @@
[options]
suppress_comment=.*\\$FlowFixMe
server.max_workers=1
sharedmemory.hash_table_pow=21
30 changes: 30 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Release

on:
push:
branches:
- master

jobs:
release:
name: Release
runs-on: ubuntu-latest
steps:
- name: Checkout Repo
uses: actions/checkout@master

- name: Setup Node.js 10.x
uses: actions/setup-node@master
with:
version: 10.x

- name: Install Yarn
run: npm install --global yarn

- name: Install Dependencies
run: yarn

- name: Create Pull Request
uses: changesets/action@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -86,6 +86,7 @@ Look here πŸ‘‰ _[emotion babel plugin feature table and documentation](https://g
- [design-system-utils](https://github.com/mrmartineau/design-system-utils) - Utilities to give better access to your design system.
- [polished](https://github.com/styled-components/polished) - Lightweight set of Sass/Compass-style mixins/helpers for writing styles in JavaScript.
- [monad-ui](https://github.com/muhajirdev/monad-ui/) - Utility First CSS-In-JS
- [css-in-js-media](https://github.com/zx6658/css-in-js-media) - you can deal with responsive design using css-in-js easily with this `css-in-js-media` which is similar with include-media

### In the Wild

9 changes: 6 additions & 3 deletions babel.config.js
Original file line number Diff line number Diff line change
@@ -10,14 +10,17 @@ module.exports = api => {
overrides: [
{
test: filename =>
(!filename.includes('no-babel') &&
filename &&
((!filename.includes('no-babel') &&
needsBabelPluginEmotion(filename)) ||
filename.includes(path.join('__tests__', 'babel')),
filename.includes(path.join('__tests__', 'babel'))),
plugins: ['babel-plugin-emotion']
},
{
test: filename =>
filename.includes('source-map') && needsBabelPluginEmotion(filename),
filename &&
filename.includes('source-map') &&
needsBabelPluginEmotion(filename),
plugins: [['babel-plugin-emotion', { sourceMap: true }]]
}
]
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
51 changes: 0 additions & 51 deletions docs/homepage-buttons.md

This file was deleted.

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -10,9 +10,9 @@ Emotion 10 is a significant change to Emotion, so it requires some changes to yo
# Thinking

The most significant change in Emotion 10 is that it doesn't let you easily access the underlying class names. Instead of thinking in class names, you have to think in terms of styles and composing them together. (you can still use class names directly if you want to, but you won't get new features like zero-config server rendering)
The most significant change in Emotion 10 is that it doesn't let you easily access the underlying class names. Instead of thinking in class names, you have to think in terms of styles and composing them together (you can still use class names directly if you want to, but you won't get new features like zero-config server rendering).

For example, in Emotion 9, you might have had two classes from `css` and compose them together with `cx`, but in Emotion 10, you create 2 styles and compose them together in the css prop like this.
For example, in Emotion 9, you might have had two classes from `css` and compose them together with `cx`, but in Emotion 10, you create two styles and compose them together in the `css` prop like this:

```jsx
// Emotion 9
@@ -55,20 +55,22 @@ const SomeComponent = props => (

Incremental migration is something really important to Emotion because we don't want anyone to have to rewrite their entire app.

The upgrades to emotion 10 are split into two parts. The first part can be done automatically by using [`eslint-plugin-emotion`](./eslint-plugin-emotion#emotion-10-codemods).
The upgrades to Emotion 10 are split into two parts. The first part can be done automatically by using [`eslint-plugin-emotion`](./eslint-plugin-emotion#emotion-10-codemods).

## Codemoddable

- Change all react-emotion imports so that styled is imported from `@emotion/styled` and all the emotion exports are split into a second import.
- Change all `react-emotion` imports so that `styled` is imported from `@emotion/styled` and all the `emotion` exports are split into a second import.

```jsx
import styled, { css } from 'react-emotion'

// ↓ ↓ ↓ ↓ ↓ ↓

import styled from '@emotion/styled'
import { css } from 'emotion'
```

- Add a css call to the css prop when a template literal is used.
- Add a `css` call to the `css` prop when a template literal is used.

```jsx
let element = (
@@ -92,11 +94,24 @@ let element = (
)
```

- Add a `jsx` import and set jsx pragma
- Add a `jsx` import and set the jsx pragma at the top of the source file.

```jsx
import { css } from '@emotion/core'

let element = (
<div
css={css`
color: hotpink;
`}
/>
)

// ↓ ↓ ↓ ↓ ↓ ↓

/** @jsx jsx */
import { css, jsx } from '@emotion/core'

let element = (
<div
css={css`
@@ -126,9 +141,9 @@ render(
)
```

## Manual Steps over time
## Manual Steps Over Time

- Change css usage to css prop
- Change `css` usage to `css` prop

```jsx
import { css } from 'emotion'
@@ -141,6 +156,7 @@ let element = (
)

// ↓ ↓ ↓ ↓ ↓ ↓

/** @jsx jsx */
import { jsx, css } from '@emotion/core'

@@ -153,7 +169,7 @@ let element = (
)
```

If you have components that accepts props like `wrapperClassName` or etc. you can use the [`ClassNames` component](./class-names.md).
If you have components that accepts props like `wrapperClassName`, etc., you can use the [`ClassNames` component](./class-names.md).

```jsx
import { css } from 'emotion'
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loading