{"action":"created","comment":{"url":"https://api.github.com/repos/styled-components/styled-components/pulls/comments/192563330","pull_request_review_id":125369898,"id":192563330,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDE5MjU2MzMzMA==","diff_hunk":"@@ -0,0 +1,62 @@\n+// @flow\n+import React from 'react'\n+import PropTypes from 'prop-types'\n+import { CONTEXT_KEY, STATIC_EXECUTION_CONTEXT } from '../constants'\n+import _GlobalStyle from '../models/GlobalStyle'\n+import StyleSheet from '../models/StyleSheet'\n+import ServerStyleSheet from '../models/ServerStyleSheet'\n+import type { CSSConstructor, Interpolation, Stringifier } from '../types'\n+import withTheme from '../hoc/withTheme'\n+import hashStr from '../vendor/glamor/hash'\n+\n+export default (stringifyRules: Stringifier, css: CSSConstructor) => {\n+  const GlobalStyle = _GlobalStyle(stringifyRules)\n+\n+  const createGlobalStyle = (\n+    strings: Array<string>,\n+    ...interpolations: Array<Interpolation>\n+  ) => {\n+    const rules = css(strings, ...interpolations)\n+    const id = `sc-global-${hashStr(JSON.stringify(rules))}`\n+    const style = new GlobalStyle(rules, id)\n+\n+    class GlobalStyleComponent extends React.Component {\n+      static contextTypes = {\n+        [CONTEXT_KEY]: PropTypes.oneOfType([\n+          PropTypes.instanceOf(StyleSheet),\n+          PropTypes.instanceOf(ServerStyleSheet),\n+        ]),\n+      }\n+\n+      static styledComponentId = id\n+\n+      componentWillMount() {\n+        const { props } = this\n+        const sheet = this.context[CONTEXT_KEY] || StyleSheet.master\n+        const context = style.isStatic ? STATIC_EXECUTION_CONTEXT : { ...props }\n+\n+        style.createStyles(context, sheet)\n+      }\n+\n+      componentWillReceiveProps(props: { [prop: string]: any }) {\n+        const sheet = this.context[CONTEXT_KEY] || StyleSheet.master\n+        const context = style.isStatic ? STATIC_EXECUTION_CONTEXT : { ...props }\n+\n+        style.updateStyles(context, sheet)\n+      }\n+\n+      componentWillUnmount() {\n+        const sheet = this.context[CONTEXT_KEY] || StyleSheet.master\n+        style.removeStyles(sheet)\n+      }\n+\n+      render() {\n+        return null","path":"src/constructors/createGlobalStyle.js","position":null,"original_position":54,"commit_id":"b9c16918e36461d8093e431feb0719425ebc39f0","original_commit_id":"3e2b5e812a1538cbed2365606103377ff3870fba","user":{"login":"migueloller","id":5677929,"node_id":"MDQ6VXNlcjU2Nzc5Mjk=","avatar_url":"https://avatars3.githubusercontent.com/u/5677929?v=4","gravatar_id":"","url":"https://api.github.com/users/migueloller","html_url":"https://github.com/migueloller","followers_url":"https://api.github.com/users/migueloller/followers","following_url":"https://api.github.com/users/migueloller/following{/other_user}","gists_url":"https://api.github.com/users/migueloller/gists{/gist_id}","starred_url":"https://api.github.com/users/migueloller/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/migueloller/subscriptions","organizations_url":"https://api.github.com/users/migueloller/orgs","repos_url":"https://api.github.com/users/migueloller/repos","events_url":"https://api.github.com/users/migueloller/events{/privacy}","received_events_url":"https://api.github.com/users/migueloller/received_events","type":"User","site_admin":false},"body":"Awesome work! Thanks @marionebl!","created_at":"2018-06-02T16:04:39Z","updated_at":"2018-06-02T16:04:39Z","html_url":"https://github.com/styled-components/styled-components/pull/1493#discussion_r192563330","pull_request_url":"https://api.github.com/repos/styled-components/styled-components/pulls/1493","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/styled-components/styled-components/pulls/comments/192563330"},"html":{"href":"https://github.com/styled-components/styled-components/pull/1493#discussion_r192563330"},"pull_request":{"href":"https://api.github.com/repos/styled-components/styled-components/pulls/1493"}},"in_reply_to_id":187933654},"pull_request":{"url":"https://api.github.com/repos/styled-components/styled-components/pulls/1493","id":167249736,"node_id":"MDExOlB1bGxSZXF1ZXN0MTY3MjQ5NzM2","html_url":"https://github.com/styled-components/styled-components/pull/1493","diff_url":"https://github.com/styled-components/styled-components/pull/1493.diff","patch_url":"https://github.com/styled-components/styled-components/pull/1493.patch","issue_url":"https://api.github.com/repos/styled-components/styled-components/issues/1493","number":1493,"state":"open","locked":false,"title":"Add component-based global styling API","user":{"login":"marionebl","id":4248851,"node_id":"MDQ6VXNlcjQyNDg4NTE=","avatar_url":"https://avatars1.githubusercontent.com/u/4248851?v=4","gravatar_id":"","url":"https://api.github.com/users/marionebl","html_url":"https://github.com/marionebl","followers_url":"https://api.github.com/users/marionebl/followers","following_url":"https://api.github.com/users/marionebl/following{/other_user}","gists_url":"https://api.github.com/users/marionebl/gists{/gist_id}","starred_url":"https://api.github.com/users/marionebl/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/marionebl/subscriptions","organizations_url":"https://api.github.com/users/marionebl/orgs","repos_url":"https://api.github.com/users/marionebl/repos","events_url":"https://api.github.com/users/marionebl/events{/privacy}","received_events_url":"https://api.github.com/users/marionebl/received_events","type":"User","site_admin":false},"body":"Picks up work by @JamieDixon in #1416\r\n* originally motivated by #1333  \r\n* newly motivated by #1491 \r\n\r\n**ToDo**\r\n\r\n* [x] Solve merge conflicts\r\n* [x] Add tests for new behaviour\r\n* [x] Add support for function interpolation\r\n* [x] Add support for themes\r\n* [x] ~~Add support for `keyframes``` interpolation~~\r\n\r\n**Example**\r\n\r\n```js\r\nimport React from 'react';\r\nimport {render} from 'react-dom';\r\nimport {ThemeProvider, createGlobalStyle} from 'styled-components'\r\n\r\nconst GlobalStyle = createGlobalStyle`\r\n  * {\r\n    box-sizing:  border-box;\r\n  }\r\n  body {\r\n    background: ${props => props.theme.background};\r\n    font-family: ${props => props.fontFamily};\r\n  }\r\n`\r\n\r\nconst App = () => (\r\n  <ThemeProvider theme={{background: 'palevioletred'}}>\r\n     <GlobalStyle fontFamily=\"Consolas\" />\r\n  </ThemeProvider>\r\n)\r\n\r\nrender(<App />, document.querySelector('[data-root]'))\r\n```\r\n\r\n**Demo**\r\n* ~~https://codesandbox.io/s/r43k57q4q~~\r\n* https://codesandbox.io/s/xow4x7p284\r\n\r\n**Published versions**\r\n\r\n```\r\nnpm install @marionebl/styled-components@3.3.0\r\n```\r\n","created_at":"2018-02-05T20:43:55Z","updated_at":"2018-06-02T16:04:39Z","closed_at":null,"merged_at":null,"merge_commit_sha":"52610fd8fc3d9ea167f8b5fed3d64bdabdb1ed13","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[{"id":681958264,"node_id":"MDU6TGFiZWw2ODE5NTgyNjQ=","url":"https://api.github.com/repos/styled-components/styled-components/labels/WIP%20:hourglass_flowing_sand:","name":"WIP :hourglass_flowing_sand:","color":"fef2c0","default":false}],"milestone":null,"commits_url":"https://api.github.com/repos/styled-components/styled-components/pulls/1493/commits","review_comments_url":"https://api.github.com/repos/styled-components/styled-components/pulls/1493/comments","review_comment_url":"https://api.github.com/repos/styled-components/styled-components/pulls/comments{/number}","comments_url":"https://api.github.com/repos/styled-components/styled-components/issues/1493/comments","statuses_url":"https://api.github.com/repos/styled-components/styled-components/statuses/b9c16918e36461d8093e431feb0719425ebc39f0","head":{"label":"marionebl:create-global-style","ref":"create-global-style","sha":"b9c16918e36461d8093e431feb0719425ebc39f0","user":{"login":"marionebl","id":4248851,"node_id":"MDQ6VXNlcjQyNDg4NTE=","avatar_url":"https://avatars1.githubusercontent.com/u/4248851?v=4","gravatar_id":"","url":"https://api.github.com/users/marionebl","html_url":"https://github.com/marionebl","followers_url":"https://api.github.com/users/marionebl/followers","following_url":"https://api.github.com/users/marionebl/following{/other_user}","gists_url":"https://api.github.com/users/marionebl/gists{/gist_id}","starred_url":"https://api.github.com/users/marionebl/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/marionebl/subscriptions","organizations_url":"https://api.github.com/users/marionebl/orgs","repos_url":"https://api.github.com/users/marionebl/repos","events_url":"https://api.github.com/users/marionebl/events{/privacy}","received_events_url":"https://api.github.com/users/marionebl/received_events","type":"User","site_admin":false},"repo":{"id":120295790,"node_id":"MDEwOlJlcG9zaXRvcnkxMjAyOTU3OTA=","name":"styled-components","full_name":"marionebl/styled-components","owner":{"login":"marionebl","id":4248851,"node_id":"MDQ6VXNlcjQyNDg4NTE=","avatar_url":"https://avatars1.githubusercontent.com/u/4248851?v=4","gravatar_id":"","url":"https://api.github.com/users/marionebl","html_url":"https://github.com/marionebl","followers_url":"https://api.github.com/users/marionebl/followers","following_url":"https://api.github.com/users/marionebl/following{/other_user}","gists_url":"https://api.github.com/users/marionebl/gists{/gist_id}","starred_url":"https://api.github.com/users/marionebl/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/marionebl/subscriptions","organizations_url":"https://api.github.com/users/marionebl/orgs","repos_url":"https://api.github.com/users/marionebl/repos","events_url":"https://api.github.com/users/marionebl/events{/privacy}","received_events_url":"https://api.github.com/users/marionebl/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/marionebl/styled-components","description":"Visual primitives for the component age. Use the best bits of ES6 and CSS to style your apps without stress 💅","fork":true,"url":"https://api.github.com/repos/marionebl/styled-components","forks_url":"https://api.github.com/repos/marionebl/styled-components/forks","keys_url":"https://api.github.com/repos/marionebl/styled-components/keys{/key_id}","collaborators_url":"https://api.github.com/repos/marionebl/styled-components/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/marionebl/styled-components/teams","hooks_url":"https://api.github.com/repos/marionebl/styled-components/hooks","issue_events_url":"https://api.github.com/repos/marionebl/styled-components/issues/events{/number}","events_url":"https://api.github.com/repos/marionebl/styled-components/events","assignees_url":"https://api.github.com/repos/marionebl/styled-components/assignees{/user}","branches_url":"https://api.github.com/repos/marionebl/styled-components/branches{/branch}","tags_url":"https://api.github.com/repos/marionebl/styled-components/tags","blobs_url":"https://api.github.com/repos/marionebl/styled-components/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/marionebl/styled-components/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/marionebl/styled-components/git/refs{/sha}","trees_url":"https://api.github.com/repos/marionebl/styled-components/git/trees{/sha}","statuses_url":"https://api.github.com/repos/marionebl/styled-components/statuses/{sha}","languages_url":"https://api.github.com/repos/marionebl/styled-components/languages","stargazers_url":"https://api.github.com/repos/marionebl/styled-components/stargazers","contributors_url":"https://api.github.com/repos/marionebl/styled-components/contributors","subscribers_url":"https://api.github.com/repos/marionebl/styled-components/subscribers","subscription_url":"https://api.github.com/repos/marionebl/styled-components/subscription","commits_url":"https://api.github.com/repos/marionebl/styled-components/commits{/sha}","git_commits_url":"https://api.github.com/repos/marionebl/styled-components/git/commits{/sha}","comments_url":"https://api.github.com/repos/marionebl/styled-components/comments{/number}","issue_comment_url":"https://api.github.com/repos/marionebl/styled-components/issues/comments{/number}","contents_url":"https://api.github.com/repos/marionebl/styled-components/contents/{+path}","compare_url":"https://api.github.com/repos/marionebl/styled-components/compare/{base}...{head}","merges_url":"https://api.github.com/repos/marionebl/styled-components/merges","archive_url":"https://api.github.com/repos/marionebl/styled-components/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/marionebl/styled-components/downloads","issues_url":"https://api.github.com/repos/marionebl/styled-components/issues{/number}","pulls_url":"https://api.github.com/repos/marionebl/styled-components/pulls{/number}","milestones_url":"https://api.github.com/repos/marionebl/styled-components/milestones{/number}","notifications_url":"https://api.github.com/repos/marionebl/styled-components/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/marionebl/styled-components/labels{/name}","releases_url":"https://api.github.com/repos/marionebl/styled-components/releases{/id}","deployments_url":"https://api.github.com/repos/marionebl/styled-components/deployments","created_at":"2018-02-05T11:27:34Z","updated_at":"2018-02-05T11:27:37Z","pushed_at":"2018-06-02T14:07:56Z","git_url":"git://github.com/marionebl/styled-components.git","ssh_url":"git@github.com:marionebl/styled-components.git","clone_url":"https://github.com/marionebl/styled-components.git","svn_url":"https://github.com/marionebl/styled-components","homepage":"http://styled-components.com","size":4337,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"styled-components:master","ref":"master","sha":"6536d1f779c286e7906e4f41519f70481ccf04d1","user":{"login":"styled-components","id":20658825,"node_id":"MDEyOk9yZ2FuaXphdGlvbjIwNjU4ODI1","avatar_url":"https://avatars2.githubusercontent.com/u/20658825?v=4","gravatar_id":"","url":"https://api.github.com/users/styled-components","html_url":"https://github.com/styled-components","followers_url":"https://api.github.com/users/styled-components/followers","following_url":"https://api.github.com/users/styled-components/following{/other_user}","gists_url":"https://api.github.com/users/styled-components/gists{/gist_id}","starred_url":"https://api.github.com/users/styled-components/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/styled-components/subscriptions","organizations_url":"https://api.github.com/users/styled-components/orgs","repos_url":"https://api.github.com/users/styled-components/repos","events_url":"https://api.github.com/users/styled-components/events{/privacy}","received_events_url":"https://api.github.com/users/styled-components/received_events","type":"Organization","site_admin":false},"repo":{"id":65794292,"node_id":"MDEwOlJlcG9zaXRvcnk2NTc5NDI5Mg==","name":"styled-components","full_name":"styled-components/styled-components","owner":{"login":"styled-components","id":20658825,"node_id":"MDEyOk9yZ2FuaXphdGlvbjIwNjU4ODI1","avatar_url":"https://avatars2.githubusercontent.com/u/20658825?v=4","gravatar_id":"","url":"https://api.github.com/users/styled-components","html_url":"https://github.com/styled-components","followers_url":"https://api.github.com/users/styled-components/followers","following_url":"https://api.github.com/users/styled-components/following{/other_user}","gists_url":"https://api.github.com/users/styled-components/gists{/gist_id}","starred_url":"https://api.github.com/users/styled-components/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/styled-components/subscriptions","organizations_url":"https://api.github.com/users/styled-components/orgs","repos_url":"https://api.github.com/users/styled-components/repos","events_url":"https://api.github.com/users/styled-components/events{/privacy}","received_events_url":"https://api.github.com/users/styled-components/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/styled-components/styled-components","description":"Visual primitives for the component age. Use the best bits of ES6 and CSS to style your apps without stress 💅","fork":false,"url":"https://api.github.com/repos/styled-components/styled-components","forks_url":"https://api.github.com/repos/styled-components/styled-components/forks","keys_url":"https://api.github.com/repos/styled-components/styled-components/keys{/key_id}","collaborators_url":"https://api.github.com/repos/styled-components/styled-components/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/styled-components/styled-components/teams","hooks_url":"https://api.github.com/repos/styled-components/styled-components/hooks","issue_events_url":"https://api.github.com/repos/styled-components/styled-components/issues/events{/number}","events_url":"https://api.github.com/repos/styled-components/styled-components/events","assignees_url":"https://api.github.com/repos/styled-components/styled-components/assignees{/user}","branches_url":"https://api.github.com/repos/styled-components/styled-components/branches{/branch}","tags_url":"https://api.github.com/repos/styled-components/styled-components/tags","blobs_url":"https://api.github.com/repos/styled-components/styled-components/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/styled-components/styled-components/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/styled-components/styled-components/git/refs{/sha}","trees_url":"https://api.github.com/repos/styled-components/styled-components/git/trees{/sha}","statuses_url":"https://api.github.com/repos/styled-components/styled-components/statuses/{sha}","languages_url":"https://api.github.com/repos/styled-components/styled-components/languages","stargazers_url":"https://api.github.com/repos/styled-components/styled-components/stargazers","contributors_url":"https://api.github.com/repos/styled-components/styled-components/contributors","subscribers_url":"https://api.github.com/repos/styled-components/styled-components/subscribers","subscription_url":"https://api.github.com/repos/styled-components/styled-components/subscription","commits_url":"https://api.github.com/repos/styled-components/styled-components/commits{/sha}","git_commits_url":"https://api.github.com/repos/styled-components/styled-components/git/commits{/sha}","comments_url":"https://api.github.com/repos/styled-components/styled-components/comments{/number}","issue_comment_url":"https://api.github.com/repos/styled-components/styled-components/issues/comments{/number}","contents_url":"https://api.github.com/repos/styled-components/styled-components/contents/{+path}","compare_url":"https://api.github.com/repos/styled-components/styled-components/compare/{base}...{head}","merges_url":"https://api.github.com/repos/styled-components/styled-components/merges","archive_url":"https://api.github.com/repos/styled-components/styled-components/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/styled-components/styled-components/downloads","issues_url":"https://api.github.com/repos/styled-components/styled-components/issues{/number}","pulls_url":"https://api.github.com/repos/styled-components/styled-components/pulls{/number}","milestones_url":"https://api.github.com/repos/styled-components/styled-components/milestones{/number}","notifications_url":"https://api.github.com/repos/styled-components/styled-components/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/styled-components/styled-components/labels{/name}","releases_url":"https://api.github.com/repos/styled-components/styled-components/releases{/id}","deployments_url":"https://api.github.com/repos/styled-components/styled-components/deployments","created_at":"2016-08-16T06:41:32Z","updated_at":"2018-06-02T15:40:24Z","pushed_at":"2018-06-02T14:02:44Z","git_url":"git://github.com/styled-components/styled-components.git","ssh_url":"git@github.com:styled-components/styled-components.git","clone_url":"https://github.com/styled-components/styled-components.git","svn_url":"https://github.com/styled-components/styled-components","homepage":"http://styled-components.com","size":4255,"stargazers_count":16644,"watchers_count":16644,"language":"JavaScript","has_issues":true,"has_projects":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":974,"mirror_url":null,"archived":false,"open_issues_count":138,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":974,"open_issues":138,"watchers":16644,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/styled-components/styled-components/pulls/1493"},"html":{"href":"https://github.com/styled-components/styled-components/pull/1493"},"issue":{"href":"https://api.github.com/repos/styled-components/styled-components/issues/1493"},"comments":{"href":"https://api.github.com/repos/styled-components/styled-components/issues/1493/comments"},"review_comments":{"href":"https://api.github.com/repos/styled-components/styled-components/pulls/1493/comments"},"review_comment":{"href":"https://api.github.com/repos/styled-components/styled-components/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/styled-components/styled-components/pulls/1493/commits"},"statuses":{"href":"https://api.github.com/repos/styled-components/styled-components/statuses/b9c16918e36461d8093e431feb0719425ebc39f0"}},"author_association":"MEMBER"}}
{"actor":{"display_login":"migueloller"}}