@emotion/cache
Advanced tools
Comparing version
@@ -73,2 +73,24 @@ 'use strict'; | ||
var createCache = function createCache() { | ||
var inserted = {}; | ||
function _ref(id) { | ||
inserted[id] = true; | ||
} | ||
function _ref2(node) { | ||
var attrib = node.getAttribute('data-emotion-ssr'); // $FlowFixMe | ||
attrib.split(' ').forEach(_ref); | ||
if (node.parentNode !== document.head) { | ||
// $FlowFixMe | ||
document.head.appendChild(node); | ||
} | ||
} | ||
if (utils.isBrowser) { | ||
var nodes = document.querySelectorAll('style[data-emotion-ssr]'); | ||
Array.prototype.forEach.call(nodes, _ref2); | ||
} | ||
var context = { | ||
@@ -79,3 +101,3 @@ stylis: stylis, | ||
}), | ||
inserted: {}, | ||
inserted: inserted, | ||
registered: {}, | ||
@@ -82,0 +104,0 @@ theme: {} |
@@ -71,2 +71,24 @@ import { Stylis } from 'emotion-utils'; | ||
var createCache = function createCache() { | ||
var inserted = {}; | ||
function _ref(id) { | ||
inserted[id] = true; | ||
} | ||
function _ref2(node) { | ||
var attrib = node.getAttribute('data-emotion-ssr'); // $FlowFixMe | ||
attrib.split(' ').forEach(_ref); | ||
if (node.parentNode !== document.head) { | ||
// $FlowFixMe | ||
document.head.appendChild(node); | ||
} | ||
} | ||
if (isBrowser) { | ||
var nodes = document.querySelectorAll('style[data-emotion-ssr]'); | ||
Array.prototype.forEach.call(nodes, _ref2); | ||
} | ||
var context = { | ||
@@ -77,3 +99,3 @@ stylis: stylis, | ||
}), | ||
inserted: {}, | ||
inserted: inserted, | ||
registered: {}, | ||
@@ -80,0 +102,0 @@ theme: {} |
{ | ||
"name": "@emotion/cache", | ||
"version": "0.4.1", | ||
"version": "0.5.0", | ||
"description": "emotion's cache", | ||
@@ -11,5 +11,5 @@ "main": "dist/index.cjs.js", | ||
"@emotion/sheet": "^0.2.0", | ||
"@emotion/types": "^0.2.3", | ||
"@emotion/utils": "^0.4.1", | ||
"emotion-utils": "^9.0.1" | ||
"@emotion/types": "^0.5.0", | ||
"@emotion/utils": "^0.5.0", | ||
"emotion-utils": "^9.1.0" | ||
}, | ||
@@ -16,0 +16,0 @@ "publishConfig": { |
@@ -8,6 +8,23 @@ // @flow | ||
const createCache = () => { | ||
let inserted = {} | ||
if (isBrowser) { | ||
const nodes = document.querySelectorAll('style[data-emotion-ssr]') | ||
Array.prototype.forEach.call(nodes, (node: HTMLStyleElement) => { | ||
const attrib = node.getAttribute('data-emotion-ssr') | ||
// $FlowFixMe | ||
attrib.split(' ').forEach(id => { | ||
inserted[id] = true | ||
}) | ||
if (node.parentNode !== document.head) { | ||
// $FlowFixMe | ||
document.head.appendChild(node) | ||
} | ||
}) | ||
} | ||
const context: CSSContextType = { | ||
stylis, | ||
sheet: new StyleSheet({ key: '' }), | ||
inserted: {}, | ||
inserted, | ||
registered: {}, | ||
@@ -14,0 +31,0 @@ theme: {} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
16941
24.45%286
19.67%+ Added
+ Added
- Removed
- Removed
Updated
Updated
Updated