@emotion/utils
Advanced tools
Comparing version 0.9.0 to 0.10.0
@@ -1,2 +0,2 @@ | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t(e.emotionUtils={})}(this,function(e){"use strict";e.isBrowser=!0,e.getRegisteredStyles=function(t,i,e){var s="";return e.split(" ").forEach(function(e){void 0!==t[e]?i.push(t[e]):s+=e+" "}),s},e.insertStyles=function(e,t,i){var s=e.key+"-"+t.name;if(!1===i&&void 0===e.registered[s]&&(e.registered[s]=t.styles),void 0===e.inserted[t.name]){var n=t;do{var o=e.stylis("."+s,n.styles);e.inserted[n.name]=!0,o.forEach(e.sheet.insert,e.sheet),n=n.next}while(void 0!==n)}},Object.defineProperty(e,"__esModule",{value:!0})}); | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t(e.emotionUtils={})}(this,function(e){"use strict";e.isBrowser=!0,e.getRegisteredStyles=function(t,i,e){var n="";return e.split(" ").forEach(function(e){void 0!==t[e]?i.push(t[e]):n+=e+" "}),n},e.insertStyles=function(e,t,i){var n=e.key+"-"+t.name;if(!1===i&&void 0===e.registered[n]&&(e.registered[n]=t.styles),void 0===e.inserted[t.name])for(var o=t;e.insert("."+n,o,e.sheet,!0),void 0!==(o=o.next););},Object.defineProperty(e,"__esModule",{value:!0})}); | ||
//# sourceMappingURL=index.min.js.map |
@@ -37,15 +37,4 @@ 'use strict'; | ||
do { | ||
var rules = cache.stylis("." + className, current.styles); | ||
cache.inserted[current.name] = true; | ||
var maybeStyles = cache.insert("." + className, current, cache.sheet, true); | ||
if (process.env.NODE_ENV !== 'production' && current.map !== undefined) { | ||
for (var i = 0; i < rules.length; i++) { | ||
rules[i] += current.map; | ||
} | ||
} | ||
{ | ||
rules.forEach(cache.sheet.insert, cache.sheet); | ||
} | ||
current = current.next; | ||
@@ -52,0 +41,0 @@ } while (current !== undefined); |
@@ -33,15 +33,4 @@ var isBrowser = true; | ||
do { | ||
var rules = cache.stylis("." + className, current.styles); | ||
cache.inserted[current.name] = true; | ||
var maybeStyles = cache.insert("." + className, current, cache.sheet, true); | ||
if (process.env.NODE_ENV !== 'production' && current.map !== undefined) { | ||
for (var i = 0; i < rules.length; i++) { | ||
rules[i] += current.map; | ||
} | ||
} | ||
{ | ||
rules.forEach(cache.sheet.insert, cache.sheet); | ||
} | ||
current = current.next; | ||
@@ -48,0 +37,0 @@ } while (current !== undefined); |
@@ -38,28 +38,8 @@ 'use strict'; | ||
do { | ||
var rules = cache.stylis("." + className, current.styles); | ||
cache.inserted[current.name] = true; | ||
var maybeStyles = cache.insert("." + className, current, cache.sheet, true); | ||
if (process.env.NODE_ENV !== 'production' && current.map !== undefined) { | ||
for (var i = 0; i < rules.length; i++) { | ||
rules[i] += current.map; | ||
} | ||
if (!isBrowser && maybeStyles !== undefined) { | ||
stylesForSSR += maybeStyles; | ||
} | ||
if (isBrowser) { | ||
rules.forEach(cache.sheet.insert, cache.sheet); | ||
} else { | ||
var joinedRules = rules.join(''); | ||
if (cache.compat === undefined) { | ||
// in regular mode, we don't set the styles on the inserted cache | ||
// since we don't need to and that would be wasting memory | ||
// we return them so that they are rendered in a style tag | ||
stylesForSSR += joinedRules; | ||
} else { | ||
// in compat mode, we put the styles on the inserted cache so | ||
// that emotion-server can pull out the styles | ||
cache.inserted[current.name] = joinedRules; | ||
} | ||
} | ||
current = current.next; | ||
@@ -66,0 +46,0 @@ } while (current !== undefined); |
@@ -26,12 +26,5 @@ "use strict"; | ||
do { | ||
var rules = cache.stylis("." + className, current.styles); | ||
if (((cache.inserted[current.name] = !0), isBrowser)) | ||
rules.forEach(cache.sheet.insert, cache.sheet); | ||
else { | ||
var joinedRules = rules.join(""); | ||
void 0 === cache.compat | ||
? (stylesForSSR += joinedRules) | ||
: (cache.inserted[current.name] = joinedRules); | ||
} | ||
current = current.next; | ||
var maybeStyles = cache.insert("." + className, current, cache.sheet, !0); | ||
isBrowser || void 0 === maybeStyles || (stylesForSSR += maybeStyles), | ||
(current = current.next); | ||
} while (void 0 !== current); | ||
@@ -38,0 +31,0 @@ if (!isBrowser && 0 !== stylesForSSR.length) return stylesForSSR; |
@@ -34,28 +34,8 @@ var isBrowser = typeof document !== 'undefined'; | ||
do { | ||
var rules = cache.stylis("." + className, current.styles); | ||
cache.inserted[current.name] = true; | ||
var maybeStyles = cache.insert("." + className, current, cache.sheet, true); | ||
if (process.env.NODE_ENV !== 'production' && current.map !== undefined) { | ||
for (var i = 0; i < rules.length; i++) { | ||
rules[i] += current.map; | ||
} | ||
if (!isBrowser && maybeStyles !== undefined) { | ||
stylesForSSR += maybeStyles; | ||
} | ||
if (isBrowser) { | ||
rules.forEach(cache.sheet.insert, cache.sheet); | ||
} else { | ||
var joinedRules = rules.join(''); | ||
if (cache.compat === undefined) { | ||
// in regular mode, we don't set the styles on the inserted cache | ||
// since we don't need to and that would be wasting memory | ||
// we return them so that they are rendered in a style tag | ||
stylesForSSR += joinedRules; | ||
} else { | ||
// in compat mode, we put the styles on the inserted cache so | ||
// that emotion-server can pull out the styles | ||
cache.inserted[current.name] = joinedRules; | ||
} | ||
} | ||
current = current.next; | ||
@@ -62,0 +42,0 @@ } while (current !== undefined); |
{ | ||
"name": "@emotion/utils", | ||
"version": "0.9.0", | ||
"version": "0.10.0", | ||
"description": "internal utils for emotion", | ||
@@ -5,0 +5,0 @@ "main": "dist/utils.cjs.js", |
@@ -49,25 +49,11 @@ // @flow | ||
do { | ||
let rules = cache.stylis(`.${className}`, current.styles) | ||
cache.inserted[current.name] = true | ||
if (process.env.NODE_ENV !== 'production' && current.map !== undefined) { | ||
for (let i = 0; i < rules.length; i++) { | ||
rules[i] += current.map | ||
} | ||
let maybeStyles = cache.insert( | ||
`.${className}`, | ||
current, | ||
cache.sheet, | ||
true | ||
) | ||
if (!isBrowser && maybeStyles !== undefined) { | ||
stylesForSSR += maybeStyles | ||
} | ||
if (isBrowser) { | ||
rules.forEach(cache.sheet.insert, cache.sheet) | ||
} else { | ||
let joinedRules = rules.join('') | ||
if (cache.compat === undefined) { | ||
// in regular mode, we don't set the styles on the inserted cache | ||
// since we don't need to and that would be wasting memory | ||
// we return them so that they are rendered in a style tag | ||
stylesForSSR += joinedRules | ||
} else { | ||
// in compat mode, we put the styles on the inserted cache so | ||
// that emotion-server can pull out the styles | ||
cache.inserted[current.name] = joinedRules | ||
} | ||
} | ||
current = current.next | ||
@@ -74,0 +60,0 @@ } while (current !== undefined) |
// @flow | ||
export type RegisteredCache = { [string]: string } | ||
/*:: | ||
import { StyleSheet } from '@emotion/sheet' | ||
interface StyleSheet { | ||
container: HTMLElement; | ||
nonce: string | void; | ||
key: string; | ||
insert(rule: string): void; | ||
flush(): void; | ||
tags: Array<HTMLStyleElement>; | ||
} | ||
*/ | ||
export type EmotionCache = { | ||
stylis: (string, string) => Array<string>, | ||
inserted: { [string]: string | true }, | ||
registered: RegisteredCache, | ||
sheet: StyleSheet, | ||
key: string, | ||
compat?: true, | ||
nonce?: string | ||
} | ||
export type RegisteredCache = { [string]: string } | ||
@@ -31,1 +17,16 @@ export type Interpolation = any | ||
|} | ||
export type EmotionCache = { | ||
inserted: { [string]: string | true }, | ||
registered: RegisteredCache, | ||
sheet: StyleSheet, | ||
key: string, | ||
compat?: true, | ||
nonce?: string, | ||
insert: ( | ||
selector: string, | ||
serialized: SerializedStyles, | ||
sheet: StyleSheet, | ||
shouldCache: boolean | ||
) => string | void | ||
} |
Sorry, the diff of this file is not supported yet
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
2
0
17787
413