Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@emotion/cache

Package Overview
Dependencies
Maintainers
2
Versions
77
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@emotion/cache - npm Package Compare versions

Comparing version 0.8.8 to 10.0.0-beta.0

dist/cache.browser.cjs.js

159

dist/cache.cjs.js
'use strict';
function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; }
var sheet = require('@emotion/sheet');
var utils = require('@emotion/utils');
var Stylis = _interopDefault(require('@emotion/stylis'));
// https://github.com/thysultan/stylis.js/tree/master/plugins/rule-sheet
// inlined to avoid umd wrapper and peerDep warnings/installing stylis
// since we use stylis after closure compiler
var delimiter = '/*|*/';
var needle = delimiter + '}';
function toSheet(block) {
if (block) {
current.push(block + '}');
}
if (process.env.NODE_ENV === 'production') {
module.exports = require('./cache.cjs.prod.js');
} else {
module.exports = require('./cache.cjs.dev.js');
}
var ruleSheet = function ruleSheet(context, content, selectors, parents, line, column, length, at, depth) {
switch (context) {
case -1:
{
current = [];
break;
}
case 2:
if (at === 0) return content + delimiter;
break;
// at-rule
case 3:
switch (at) {
// @font-face, @page
case 102:
case 112:
{
current.push(selectors[0] + content);
return '';
}
default:
{
return content + delimiter;
}
}
case -2:
{
content.split(needle).forEach(toSheet);
return current;
}
}
};
var current;
var createCache = function createCache(options) {
if (options === undefined) options = {};
var key = options.key || 'css';
var stylisOptions;
if (options.prefix !== undefined) {
stylisOptions = {
prefix: options.prefix
};
}
var stylis = new Stylis(stylisOptions);
stylis.use(options.stylisPlugins)(ruleSheet);
if (process.env.NODE_ENV !== 'production') {
// $FlowFixMe
if (/[^a-z-]/.test(key)) {
throw new Error("Emotion key must only contain lower case alphabetical characters and - but \"" + key + "\" was passed");
}
var sourceMapRegEx = /\/\*#\ssourceMappingURL=data:application\/json;\S+\s+\*\//;
var currentSourceMap;
stylis.use(function (context, content, selectors) {
switch (context) {
case -1:
{
var result = sourceMapRegEx.exec(content);
if (result) {
currentSourceMap = result[0];
}
break;
}
case 2:
{
for (var i = 0, len = selectors.length; len > i; i++) {
// :last-child isn't included here since it's safe
// because a style element will never be the last element
var match = selectors[i].match(/:(first|nth|nth-last)-child/);
if (match !== null) {
console.error("The pseudo class \"" + match[1] + "\" is potentially unsafe when doing server-side rendering. Try changing it to \"" + match[1] + "-of-type\"");
}
}
break;
}
case -2:
{
if (currentSourceMap) {
content.forEach(function (rule, i) {
content[i] = rule + currentSourceMap;
});
currentSourceMap = '';
}
}
}
});
}
var inserted = {}; // $FlowFixMe
var container;
if (utils.isBrowser) {
container = options.container || document.head;
var nodes = document.querySelectorAll("style[data-emotion-" + key + "]");
Array.prototype.forEach.call(nodes, function (node) {
var attrib = node.getAttribute("data-emotion-" + key); // $FlowFixMe
attrib.split(' ').forEach(function (id) {
inserted[id] = true;
});
if (node.parentNode !== container) {
container.appendChild(node);
}
});
}
var context = {
stylis: stylis,
key: key,
sheet: new sheet.StyleSheet({
key: key,
container: container,
nonce: options.nonce
}),
inserted: inserted,
registered: {},
theme: {}
};
return context;
};
module.exports = createCache;

@@ -17,3 +17,3 @@ import { StyleSheet } from '@emotion/sheet';

var ruleSheet = function ruleSheet(context, content, selectors, parents, line, column, length, at, depth) {
var ruleSheet = function ruleSheet(context, content, selectors, parents, line, column, length, ns, depth, at) {
switch (context) {

@@ -25,22 +25,56 @@ case -1:

}
// property
case 1:
{
switch (content.charCodeAt(0)) {
case 64:
{
// @import
if (depth === 0) {
current.push(content + ';');
return '';
}
break;
}
// charcode for l
case 108:
{
// charcode for b
// this ignores label
if (content.charCodeAt(2) === 98) {
return '';
}
}
}
break;
}
// selector
case 2:
if (at === 0) return content + delimiter;
break;
{
if (ns === 0) return content + delimiter;
break;
}
// at-rule
case 3:
switch (at) {
// @font-face, @page
case 102:
case 112:
{
current.push(selectors[0] + content);
return '';
}
{
switch (ns) {
// @font-face, @page
case 102:
case 112:
{
current.push(selectors[0] + content);
return '';
}
default:
{
return content + delimiter;
}
default:
{
return content + (at === 0 ? delimiter : '');
}
}
}

@@ -78,17 +112,4 @@

var sourceMapRegEx = /\/\*#\ssourceMappingURL=data:application\/json;\S+\s+\*\//;
var currentSourceMap;
stylis.use(function (context, content, selectors) {
switch (context) {
case -1:
{
var result = sourceMapRegEx.exec(content);
if (result) {
currentSourceMap = result[0];
}
break;
}
case 2:

@@ -102,3 +123,3 @@ {

if (match !== null) {
console.error("The pseudo class \"" + match[1] + "\" is potentially unsafe when doing server-side rendering. Try changing it to \"" + match[1] + "-of-type\"");
console.error("The pseudo class \"" + match[0] + "\" is potentially unsafe when doing server-side rendering. Try changing it to \"" + match[1] + "-of-type\"");
}

@@ -109,12 +130,2 @@ }

}
case -2:
{
if (currentSourceMap) {
content.forEach(function (rule, i) {
content[i] = rule + currentSourceMap;
});
currentSourceMap = '';
}
}
}

@@ -144,3 +155,3 @@ });

var context = {
var cache = {
stylis: stylis,

@@ -151,11 +162,12 @@ key: key,

container: container,
nonce: options.nonce
nonce: options.nonce,
speedy: options.speedy
}),
nonce: options.nonce,
inserted: inserted,
registered: {},
theme: {}
registered: {}
};
return context;
return cache;
};
export default createCache;

@@ -1,2 +0,2 @@

!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):e.emotionCache=t()}(this,function(){"use strict";var n=function(){function e(e){this.isSpeedy=void 0===e.speedy||e.speedy,this.maxLength=this.isSpeedy?65e3:1,this.tags=[],this.ctr=0,this.nonce=e.nonce,this.key=e.key,this.container=e.container}var t=e.prototype;return t.insert=function(e){if(this.ctr%this.maxLength==0){var t,r=(a=this,(c=document.createElement("style")).setAttribute("data-emotion",a.key),void 0!==a.nonce&&c.setAttribute("nonce",a.nonce),c.appendChild(document.createTextNode("")),c);t=0===this.tags.length?this.before:this.tags[this.tags.length-1].nextSibling,this.container.insertBefore(r,t),this.tags.push(r)}var a,c,s=this.tags[this.tags.length-1];if(this.isSpeedy){var i=function(e){if(e.sheet)return e.sheet;for(var t=0;t<document.styleSheets.length;t++)if(document.styleSheets[t].ownerNode===e)return document.styleSheets[t]}(s);try{i.insertRule(e,i.cssRules.length)}catch(e){}}else s.appendChild(document.createTextNode(e));this.ctr++},t.flush=function(){this.tags.forEach(function(e){return e.parentNode.removeChild(e)}),this.tags=[],this.ctr=0},e}();function o(e){function z(e,t,r){var a=t.trim().split(f),c=(t=a).length,s=e.length;switch(s){case 0:case 1:var i=0;for(e=0===s?"":e[0]+" ";i<c;++i)t[i]=h(e,t[i],r).trim();break;default:var n=i=0;for(t=[];i<c;++i)for(var o=0;o<s;++o)t[n++]=h(e[o]+" ",a[i],r).trim()}return t}function h(e,t,r){var a=t.charCodeAt(0);switch(a<33&&(a=(t=t.trim()).charCodeAt(0)),a){case 38:return t.replace(c,"$1"+e.trim());case 58:return e.trim()+t.replace(c,"$1"+e.trim());default:if(0<1*r&&0<t.indexOf("\f"))return t.replace(c,(58===e.charCodeAt(0)?"":"$1")+e.trim())}return e+t}function E(e,t,r,a){var c=e+";",s=2*t+3*r+4*a;if(944===s){e=c.indexOf(":",9)+1;var i=c.substring(e,c.length-1).trim();return i=c.substring(0,e).trim()+i+";",1===I||2===I&&N(i,1)?"-webkit-"+i+i:i}if(0===I||2===I&&!N(c,1))return c;switch(s){case 1015:return 97===c.charCodeAt(10)?"-webkit-"+c+c:c;case 951:return 116===c.charCodeAt(3)?"-webkit-"+c+c:c;case 963:return 110===c.charCodeAt(5)?"-webkit-"+c+c:c;case 1009:if(100!==c.charCodeAt(4))break;case 969:case 942:return"-webkit-"+c+c;case 978:return"-webkit-"+c+"-moz-"+c+c;case 1019:case 983:return"-webkit-"+c+"-moz-"+c+"-ms-"+c+c;case 883:if(45===c.charCodeAt(8))return"-webkit-"+c+c;if(0<c.indexOf("image-set(",11))return c.replace(p,"$1-webkit-$2")+c;break;case 932:if(45===c.charCodeAt(4))switch(c.charCodeAt(5)){case 103:return"-webkit-box-"+c.replace("-grow","")+"-webkit-"+c+"-ms-"+c.replace("grow","positive")+c;case 115:return"-webkit-"+c+"-ms-"+c.replace("shrink","negative")+c;case 98:return"-webkit-"+c+"-ms-"+c.replace("basis","preferred-size")+c}return"-webkit-"+c+"-ms-"+c+c;case 964:return"-webkit-"+c+"-ms-flex-"+c+c;case 1023:if(99!==c.charCodeAt(8))break;return"-webkit-box-pack"+(i=c.substring(c.indexOf(":",15)).replace("flex-","").replace("space-between","justify"))+"-webkit-"+c+"-ms-flex-pack"+i+c;case 1005:return o.test(c)?c.replace(n,":-webkit-")+c.replace(n,":-moz-")+c:c;case 1e3:switch(t=(i=c.substring(13).trim()).indexOf("-")+1,i.charCodeAt(0)+i.charCodeAt(t)){case 226:i=c.replace(u,"tb");break;case 232:i=c.replace(u,"tb-rl");break;case 220:i=c.replace(u,"lr");break;default:return c}return"-webkit-"+c+"-ms-"+i+c;case 1017:if(-1===c.indexOf("sticky",9))break;case 975:switch(t=(c=e).length-10,s=(i=(33===c.charCodeAt(t)?c.substring(0,t):c).substring(e.indexOf(":",7)+1).trim()).charCodeAt(0)+(0|i.charCodeAt(7))){case 203:if(i.charCodeAt(8)<111)break;case 115:c=c.replace(i,"-webkit-"+i)+";"+c;break;case 207:case 102:c=c.replace(i,"-webkit-"+(102<s?"inline-":"")+"box")+";"+c.replace(i,"-webkit-"+i)+";"+c.replace(i,"-ms-"+i+"box")+";"+c}return c+";";case 938:if(45===c.charCodeAt(5))switch(c.charCodeAt(6)){case 105:return i=c.replace("-items",""),"-webkit-"+c+"-webkit-box-"+i+"-ms-flex-"+i+c;case 115:return"-webkit-"+c+"-ms-flex-item-"+c.replace(b,"")+c;default:return"-webkit-"+c+"-ms-flex-line-pack"+c.replace("align-content","").replace(b,"")+c}break;case 973:case 989:if(45!==c.charCodeAt(3)||122===c.charCodeAt(4))break;case 931:case 953:if(!0===k.test(e))return 115===(i=e.substring(e.indexOf(":")+1)).charCodeAt(0)?E(e.replace("stretch","fill-available"),t,r,a).replace(":fill-available",":stretch"):c.replace(i,"-webkit-"+i)+c.replace(i,"-moz-"+i.replace("fill-",""))+c;break;case 962:if(c="-webkit-"+c+(102===c.charCodeAt(5)?"-ms-"+c:"")+c,211===r+a&&105===c.charCodeAt(13)&&0<c.indexOf("transform",10))return c.substring(0,c.indexOf(";",27)+1).replace(l,"$1-webkit-$2")+c}return c}function N(e,t){var r=e.indexOf(1===t?":":"{"),a=e.substring(0,3!==t?r:10);return r=e.substring(r+1,e.length-1),i(2!==t?a:a.replace(s,"$1"),r,t)}function j(e,t){var r=E(t,t.charCodeAt(0),t.charCodeAt(1),t.charCodeAt(2));return r!==t+";"?r.replace(a," or ($1)").substring(4):"("+t+")"}function B(e,t,r,a,c,s,i,n,o,h){for(var l,f=0,u=t;f<K;++f)switch(l=g[f].call(d,e,u,r,a,c,s,i,n,o,h)){case void 0:case!1:case!0:case null:break;default:u=l}if(u!==t)return u}function t(e){return void 0!==(e=e.prefix)&&(i=null,e?"function"!=typeof e?I=1:(I=2,i=e):I=0),t}function d(e,t){var r=e;if(r.charCodeAt(0)<33&&(r=r.trim()),r=[r],0<K){var a=B(-1,t,r,r,G,D,0,0,0,0);void 0!==a&&"string"==typeof a&&(t=a)}var c=function e(t,r,a,c,s){for(var i,n,o,h,l,f=0,u=0,d=0,b=0,k=0,p=0,g=o=i=0,w=0,m=0,A=0,C=0,v=a.length,x=v-1,y="",$="",O="",S="";w<v;){if(n=a.charCodeAt(w),w===x&&0!==u+b+d+f&&(0!==u&&(n=47===u?10:47),b=d=f=0,v++,x++),0===u+b+d+f){if(w===x&&(0<m&&(y=y.replace(R,"")),0<y.trim().length)){switch(n){case 32:case 9:case 59:case 13:case 10:break;default:y+=a.charAt(w)}n=59}switch(n){case 123:for(i=(y=y.trim()).charCodeAt(0),o=1,C=++w;w<v;){switch(n=a.charCodeAt(w)){case 123:o++;break;case 125:o--;break;case 47:switch(n=a.charCodeAt(w+1)){case 42:case 47:e:{for(g=w+1;g<x;++g)switch(a.charCodeAt(g)){case 47:if(42===n&&42===a.charCodeAt(g-1)&&w+2!==g){w=g+1;break e}break;case 10:if(47===n){w=g+1;break e}}w=g}}break;case 91:n++;case 40:n++;case 34:case 39:for(;w++<x&&a.charCodeAt(w)!==n;);}if(0===o)break;w++}switch(o=a.substring(C,w),0===i&&(i=(y=y.replace(L,"").trim()).charCodeAt(0)),i){case 64:switch(0<m&&(y=y.replace(R,"")),n=y.charCodeAt(1)){case 100:case 109:case 115:case 45:m=r;break;default:m=J}if(C=(o=e(r,m,o,n,s+1)).length,0<K&&(l=B(3,o,m=z(J,y,A),r,G,D,C,n,s,c),y=m.join(""),void 0!==l&&0===(C=(o=l.trim()).length)&&(n=0,o="")),0<C)switch(n){case 115:y=y.replace(P,j);case 100:case 109:case 45:o=y+"{"+o+"}";break;case 107:o=(y=y.replace(T,"$1 $2"))+"{"+o+"}",o=1===I||2===I&&N("@"+o,3)?"@-webkit-"+o+"@"+o:"@"+o;break;default:o=y+o,112===c&&($+=o,o="")}else o="";break;default:o=e(r,z(r,y,A),o,c,s+1)}O+=o,o=A=m=g=i=0,y="",n=a.charCodeAt(++w);break;case 125:case 59:if(1<(C=(y=(0<m?y.replace(R,""):y).trim()).length))switch(0===g&&(i=y.charCodeAt(0),45===i||96<i&&i<123)&&(C=(y=y.replace(" ",":")).length),0<K&&void 0!==(l=B(1,y,r,t,G,D,$.length,c,s,c))&&0===(C=(y=l.trim()).length)&&(y="\0\0"),i=y.charCodeAt(0),n=y.charCodeAt(1),i){case 0:break;case 64:if(105===n||99===n){S+=y+a.charAt(w);break}default:58!==y.charCodeAt(C-1)&&($+=E(y,i,n,y.charCodeAt(2)))}A=m=g=i=0,y="",n=a.charCodeAt(++w)}}switch(n){case 13:case 10:47===u?u=0:0===1+i&&107!==c&&0<y.length&&(m=1,y+="\0"),0<K*M&&B(0,y,r,t,G,D,$.length,c,s,c),D=1,G++;break;case 59:case 125:if(0===u+b+d+f){D++;break}default:switch(D++,h=a.charAt(w),n){case 9:case 32:if(0===b+f+u)switch(k){case 44:case 58:case 9:case 32:h="";break;default:32!==n&&(h=" ")}break;case 0:h="\\0";break;case 12:h="\\f";break;case 11:h="\\v";break;case 38:0===b+u+f&&(m=A=1,h="\f"+h);break;case 108:if(0===b+u+f+H&&0<g)switch(w-g){case 2:112===k&&58===a.charCodeAt(w-3)&&(H=k);case 8:111===p&&(H=p)}break;case 58:0===b+u+f&&(g=w);break;case 44:0===u+d+b+f&&(m=1,h+="\r");break;case 34:case 39:0===u&&(b=b===n?0:0===b?n:b);break;case 91:0===b+u+d&&f++;break;case 93:0===b+u+d&&f--;break;case 41:0===b+u+f&&d--;break;case 40:if(0===b+u+f){if(0===i)switch(2*k+3*p){case 533:break;default:i=1}d++}break;case 64:0===u+d+b+f+g+o&&(o=1);break;case 42:case 47:if(!(0<b+f+d))switch(u){case 0:switch(2*n+3*a.charCodeAt(w+1)){case 235:u=47;break;case 220:C=w,u=42}break;case 42:47===n&&42===k&&C+2!==w&&(33===a.charCodeAt(C+2)&&($+=a.substring(C,w+1)),h="",u=0)}}0===u&&(y+=h)}p=k,k=n,w++}if(0<(C=$.length)){if(m=r,0<K&&void 0!==(l=B(2,$,m,t,G,D,C,c,s,c))&&0===($=l).length)return S+$+O;if($=m.join(",")+"{"+$+"}",0!=I*H){switch(2!==I||N($,2)||(H=0),H){case 111:$=$.replace(F,":-moz-$1")+$;break;case 112:$=$.replace(q,"::-webkit-input-$1")+$.replace(q,"::-moz-$1")+$.replace(q,":-ms-input-$1")+$}H=0}}return S+$+O}(J,r,t,0,0);return 0<K&&(void 0!==(a=B(-2,c,r,r,G,D,c.length,0,0,0))&&(c=a)),"",H=0,D=G=1,c}var L=/^\0+/g,R=/[\0\r\f]/g,n=/: */g,o=/zoo|gra/,l=/([,: ])(transform)/g,f=/,\r+?/g,c=/([\t\r\n ])*\f?&/g,T=/@(k\w+)\s*(\S*)\s*/,q=/::(place)/g,F=/:(read-only)/g,u=/[svh]\w+-[tblr]{2}/,P=/\(\s*(.*)\s*\)/g,a=/([\s\S]*?);/g,b=/-self|flex-/g,s=/[^]*?(:[rp][el]a[\w-]+)[^]*/,k=/stretch|:\s*\w+\-(?:conte|avail)/,p=/([^-])(image-set\()/,D=1,G=1,H=0,I=1,J=[],g=[],K=0,i=null,M=0;return d.use=function e(t){switch(t){case void 0:case null:K=g.length=0;break;default:switch(t.constructor){case Array:for(var r=0,a=t.length;r<a;++r)e(t[r]);break;case Function:g[K++]=t;break;case Boolean:M=0|!!t}}return e},d.set=t,void 0!==e&&t(e),d}var h="/*|*/";function l(e){e&&f.push(e+"}")}var f,u=function(e,t,r,a,c,s,i,n,o){switch(e){case-1:f=[];break;case 2:if(0===n)return t+h;break;case 3:switch(n){case 102:case 112:return f.push(r[0]+t),"";default:return t+h}case-2:return t.split("/*|*/}").forEach(l),f}};return function(e){void 0===e&&(e={});var t,r=e.key||"css";void 0!==e.prefix&&(t={prefix:e.prefix});var a=new o(t);a.use(e.stylisPlugins)(u);var c,s={};c=e.container||document.head;var i=document.querySelectorAll("style[data-emotion-"+r+"]");return Array.prototype.forEach.call(i,function(e){e.getAttribute("data-emotion-"+r).split(" ").forEach(function(e){s[e]=!0}),e.parentNode!==c&&c.appendChild(e)}),{stylis:a,key:r,sheet:new n({key:r,container:c,nonce:e.nonce}),inserted:s,registered:{},theme:{}}}});
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):e.emotionCache=t()}(this,function(){"use strict";var n=function(){function e(e){this.isSpeedy=void 0===e.speedy||e.speedy,this.tags=[],this.ctr=0,this.nonce=e.nonce,this.key=e.key,this.container=e.container}var t=e.prototype;return t.insert=function(e){if(this.ctr%(this.isSpeedy?65e3:1)==0){var t,r=(a=this,(c=document.createElement("style")).setAttribute("data-emotion",a.key),void 0!==a.nonce&&c.setAttribute("nonce",a.nonce),c.appendChild(document.createTextNode("")),c);t=0===this.tags.length?this.before:this.tags[this.tags.length-1].nextSibling,this.container.insertBefore(r,t),this.tags.push(r)}var a,c,s=this.tags[this.tags.length-1];if(this.isSpeedy){var i=function(e){if(e.sheet)return e.sheet;for(var t=0;t<document.styleSheets.length;t++)if(document.styleSheets[t].ownerNode===e)return document.styleSheets[t]}(s);try{var n=105===e.charCodeAt(1)&&64===e.charCodeAt(0);i.insertRule(e,n?0:i.cssRules.length)}catch(e){}}else s.appendChild(document.createTextNode(e));this.ctr++},t.flush=function(){this.tags.forEach(function(e){return e.parentNode.removeChild(e)}),this.tags=[],this.ctr=0},e}();function o(e){function z(e,t,r){var a=t.trim().split(f),c=(t=a).length,s=e.length;switch(s){case 0:case 1:var i=0;for(e=0===s?"":e[0]+" ";i<c;++i)t[i]=h(e,t[i],r).trim();break;default:var n=i=0;for(t=[];i<c;++i)for(var o=0;o<s;++o)t[n++]=h(e[o]+" ",a[i],r).trim()}return t}function h(e,t,r){var a=t.charCodeAt(0);switch(a<33&&(a=(t=t.trim()).charCodeAt(0)),a){case 38:return t.replace(c,"$1"+e.trim());case 58:return e.trim()+t.replace(c,"$1"+e.trim());default:if(0<1*r&&0<t.indexOf("\f"))return t.replace(c,(58===e.charCodeAt(0)?"":"$1")+e.trim())}return e+t}function E(e,t,r,a){var c=e+";",s=2*t+3*r+4*a;if(944===s){e=c.indexOf(":",9)+1;var i=c.substring(e,c.length-1).trim();return i=c.substring(0,e).trim()+i+";",1===J||2===J&&N(i,1)?"-webkit-"+i+i:i}if(0===J||2===J&&!N(c,1))return c;switch(s){case 1015:return 97===c.charCodeAt(10)?"-webkit-"+c+c:c;case 951:return 116===c.charCodeAt(3)?"-webkit-"+c+c:c;case 963:return 110===c.charCodeAt(5)?"-webkit-"+c+c:c;case 1009:if(100!==c.charCodeAt(4))break;case 969:case 942:return"-webkit-"+c+c;case 978:return"-webkit-"+c+"-moz-"+c+c;case 1019:case 983:return"-webkit-"+c+"-moz-"+c+"-ms-"+c+c;case 883:if(45===c.charCodeAt(8))return"-webkit-"+c+c;if(0<c.indexOf("image-set(",11))return c.replace(p,"$1-webkit-$2")+c;break;case 932:if(45===c.charCodeAt(4))switch(c.charCodeAt(5)){case 103:return"-webkit-box-"+c.replace("-grow","")+"-webkit-"+c+"-ms-"+c.replace("grow","positive")+c;case 115:return"-webkit-"+c+"-ms-"+c.replace("shrink","negative")+c;case 98:return"-webkit-"+c+"-ms-"+c.replace("basis","preferred-size")+c}return"-webkit-"+c+"-ms-"+c+c;case 964:return"-webkit-"+c+"-ms-flex-"+c+c;case 1023:if(99!==c.charCodeAt(8))break;return"-webkit-box-pack"+(i=c.substring(c.indexOf(":",15)).replace("flex-","").replace("space-between","justify"))+"-webkit-"+c+"-ms-flex-pack"+i+c;case 1005:return o.test(c)?c.replace(n,":-webkit-")+c.replace(n,":-moz-")+c:c;case 1e3:switch(t=(i=c.substring(13).trim()).indexOf("-")+1,i.charCodeAt(0)+i.charCodeAt(t)){case 226:i=c.replace(u,"tb");break;case 232:i=c.replace(u,"tb-rl");break;case 220:i=c.replace(u,"lr");break;default:return c}return"-webkit-"+c+"-ms-"+i+c;case 1017:if(-1===c.indexOf("sticky",9))break;case 975:switch(t=(c=e).length-10,s=(i=(33===c.charCodeAt(t)?c.substring(0,t):c).substring(e.indexOf(":",7)+1).trim()).charCodeAt(0)+(0|i.charCodeAt(7))){case 203:if(i.charCodeAt(8)<111)break;case 115:c=c.replace(i,"-webkit-"+i)+";"+c;break;case 207:case 102:c=c.replace(i,"-webkit-"+(102<s?"inline-":"")+"box")+";"+c.replace(i,"-webkit-"+i)+";"+c.replace(i,"-ms-"+i+"box")+";"+c}return c+";";case 938:if(45===c.charCodeAt(5))switch(c.charCodeAt(6)){case 105:return i=c.replace("-items",""),"-webkit-"+c+"-webkit-box-"+i+"-ms-flex-"+i+c;case 115:return"-webkit-"+c+"-ms-flex-item-"+c.replace(b,"")+c;default:return"-webkit-"+c+"-ms-flex-line-pack"+c.replace("align-content","").replace(b,"")+c}break;case 973:case 989:if(45!==c.charCodeAt(3)||122===c.charCodeAt(4))break;case 931:case 953:if(!0===k.test(e))return 115===(i=e.substring(e.indexOf(":")+1)).charCodeAt(0)?E(e.replace("stretch","fill-available"),t,r,a).replace(":fill-available",":stretch"):c.replace(i,"-webkit-"+i)+c.replace(i,"-moz-"+i.replace("fill-",""))+c;break;case 962:if(c="-webkit-"+c+(102===c.charCodeAt(5)?"-ms-"+c:"")+c,211===r+a&&105===c.charCodeAt(13)&&0<c.indexOf("transform",10))return c.substring(0,c.indexOf(";",27)+1).replace(l,"$1-webkit-$2")+c}return c}function N(e,t){var r=e.indexOf(1===t?":":"{"),a=e.substring(0,3!==t?r:10);return r=e.substring(r+1,e.length-1),i(2!==t?a:a.replace(s,"$1"),r,t)}function j(e,t){var r=E(t,t.charCodeAt(0),t.charCodeAt(1),t.charCodeAt(2));return r!==t+";"?r.replace(a," or ($1)").substring(4):"("+t+")"}function B(e,t,r,a,c,s,i,n,o,h){for(var l,f=0,u=t;f<L;++f)switch(l=w[f].call(d,e,u,r,a,c,s,i,n,o,h)){case void 0:case!1:case!0:case null:break;default:u=l}if(u!==t)return u}function t(e){return void 0!==(e=e.prefix)&&(i=null,e?"function"!=typeof e?J=1:(J=2,i=e):J=0),t}function d(e,t){var r=e;if(r.charCodeAt(0)<33&&(r=r.trim()),r=[r],0<L){var a=B(-1,t,r,r,H,G,0,0,0,0);void 0!==a&&"string"==typeof a&&(t=a)}var c=function e(t,r,a,c,s){for(var i,n,o,h,l,f=0,u=0,d=0,b=0,k=0,p=0,w=o=i=0,g=0,m=0,A=0,C=0,v=a.length,y=v-1,x="",$="",O="",S="";g<v;){if(n=a.charCodeAt(g),g===y&&0!==u+b+d+f&&(0!==u&&(n=47===u?10:47),b=d=f=0,v++,y++),0===u+b+d+f){if(g===y&&(0<m&&(x=x.replace(T,"")),0<x.trim().length)){switch(n){case 32:case 9:case 59:case 13:case 10:break;default:x+=a.charAt(g)}n=59}switch(n){case 123:for(i=(x=x.trim()).charCodeAt(0),o=1,C=++g;g<v;){switch(n=a.charCodeAt(g)){case 123:o++;break;case 125:o--;break;case 47:switch(n=a.charCodeAt(g+1)){case 42:case 47:e:{for(w=g+1;w<y;++w)switch(a.charCodeAt(w)){case 47:if(42===n&&42===a.charCodeAt(w-1)&&g+2!==w){g=w+1;break e}break;case 10:if(47===n){g=w+1;break e}}g=w}}break;case 91:n++;case 40:n++;case 34:case 39:for(;g++<y&&a.charCodeAt(g)!==n;);}if(0===o)break;g++}switch(o=a.substring(C,g),0===i&&(i=(x=x.replace(R,"").trim()).charCodeAt(0)),i){case 64:switch(0<m&&(x=x.replace(T,"")),n=x.charCodeAt(1)){case 100:case 109:case 115:case 45:m=r;break;default:m=K}if(C=(o=e(r,m,o,n,s+1)).length,0<L&&(l=B(3,o,m=z(K,x,A),r,H,G,C,n,s,c),x=m.join(""),void 0!==l&&0===(C=(o=l.trim()).length)&&(n=0,o="")),0<C)switch(n){case 115:x=x.replace(D,j);case 100:case 109:case 45:o=x+"{"+o+"}";break;case 107:o=(x=x.replace(q,"$1 $2"))+"{"+o+"}",o=1===J||2===J&&N("@"+o,3)?"@-webkit-"+o+"@"+o:"@"+o;break;default:o=x+o,112===c&&($+=o,o="")}else o="";break;default:o=e(r,z(r,x,A),o,c,s+1)}O+=o,o=A=m=w=i=0,x="",n=a.charCodeAt(++g);break;case 125:case 59:if(1<(C=(x=(0<m?x.replace(T,""):x).trim()).length))switch(0===w&&(i=x.charCodeAt(0),45===i||96<i&&i<123)&&(C=(x=x.replace(" ",":")).length),0<L&&void 0!==(l=B(1,x,r,t,H,G,$.length,c,s,c))&&0===(C=(x=l.trim()).length)&&(x="\0\0"),i=x.charCodeAt(0),n=x.charCodeAt(1),i){case 0:break;case 64:if(105===n||99===n){S+=x+a.charAt(g);break}default:58!==x.charCodeAt(C-1)&&($+=E(x,i,n,x.charCodeAt(2)))}A=m=w=i=0,x="",n=a.charCodeAt(++g)}}switch(n){case 13:case 10:47===u?u=0:0===1+i&&107!==c&&0<x.length&&(m=1,x+="\0"),0<L*M&&B(0,x,r,t,H,G,$.length,c,s,c),G=1,H++;break;case 59:case 125:if(0===u+b+d+f){G++;break}default:switch(G++,h=a.charAt(g),n){case 9:case 32:if(0===b+f+u)switch(k){case 44:case 58:case 9:case 32:h="";break;default:32!==n&&(h=" ")}break;case 0:h="\\0";break;case 12:h="\\f";break;case 11:h="\\v";break;case 38:0===b+u+f&&(m=A=1,h="\f"+h);break;case 108:if(0===b+u+f+I&&0<w)switch(g-w){case 2:112===k&&58===a.charCodeAt(g-3)&&(I=k);case 8:111===p&&(I=p)}break;case 58:0===b+u+f&&(w=g);break;case 44:0===u+d+b+f&&(m=1,h+="\r");break;case 34:case 39:0===u&&(b=b===n?0:0===b?n:b);break;case 91:0===b+u+d&&f++;break;case 93:0===b+u+d&&f--;break;case 41:0===b+u+f&&d--;break;case 40:if(0===b+u+f){if(0===i)switch(2*k+3*p){case 533:break;default:i=1}d++}break;case 64:0===u+d+b+f+w+o&&(o=1);break;case 42:case 47:if(!(0<b+f+d))switch(u){case 0:switch(2*n+3*a.charCodeAt(g+1)){case 235:u=47;break;case 220:C=g,u=42}break;case 42:47===n&&42===k&&C+2!==g&&(33===a.charCodeAt(C+2)&&($+=a.substring(C,g+1)),h="",u=0)}}0===u&&(x+=h)}p=k,k=n,g++}if(0<(C=$.length)){if(m=r,0<L&&void 0!==(l=B(2,$,m,t,H,G,C,c,s,c))&&0===($=l).length)return S+$+O;if($=m.join(",")+"{"+$+"}",0!=J*I){switch(2!==J||N($,2)||(I=0),I){case 111:$=$.replace(P,":-moz-$1")+$;break;case 112:$=$.replace(F,"::-webkit-input-$1")+$.replace(F,"::-moz-$1")+$.replace(F,":-ms-input-$1")+$}I=0}}return S+$+O}(K,r,t,0,0);return 0<L&&(void 0!==(a=B(-2,c,r,r,H,G,c.length,0,0,0))&&(c=a)),"",I=0,G=H=1,c}var R=/^\0+/g,T=/[\0\r\f]/g,n=/: */g,o=/zoo|gra/,l=/([,: ])(transform)/g,f=/,\r+?/g,c=/([\t\r\n ])*\f?&/g,q=/@(k\w+)\s*(\S*)\s*/,F=/::(place)/g,P=/:(read-only)/g,u=/[svh]\w+-[tblr]{2}/,D=/\(\s*(.*)\s*\)/g,a=/([\s\S]*?);/g,b=/-self|flex-/g,s=/[^]*?(:[rp][el]a[\w-]+)[^]*/,k=/stretch|:\s*\w+\-(?:conte|avail)/,p=/([^-])(image-set\()/,G=1,H=1,I=0,J=1,K=[],w=[],L=0,i=null,M=0;return d.use=function e(t){switch(t){case void 0:case null:L=w.length=0;break;default:switch(t.constructor){case Array:for(var r=0,a=t.length;r<a;++r)e(t[r]);break;case Function:w[L++]=t;break;case Boolean:M=0|!!t}}return e},d.set=t,void 0!==e&&t(e),d}var l="/*|*/";function f(e){e&&u.push(e+"}")}var u,h=function(e,t,r,a,c,s,i,n,o,h){switch(e){case-1:u=[];break;case 1:switch(t.charCodeAt(0)){case 64:if(0===o)return u.push(t+";"),"";break;case 108:if(98===t.charCodeAt(2))return""}break;case 2:if(0===n)return t+l;break;case 3:switch(n){case 102:case 112:return u.push(r[0]+t),"";default:return t+(0===h?l:"")}case-2:return t.split("/*|*/}").forEach(f),u}};return function(e){void 0===e&&(e={});var t,r=e.key||"css";void 0!==e.prefix&&(t={prefix:e.prefix});var a=new o(t);a.use(e.stylisPlugins)(h);var c,s={};c=e.container||document.head;var i=document.querySelectorAll("style[data-emotion-"+r+"]");return Array.prototype.forEach.call(i,function(e){e.getAttribute("data-emotion-"+r).split(" ").forEach(function(e){s[e]=!0}),e.parentNode!==c&&c.appendChild(e)}),{stylis:a,key:r,sheet:new n({key:r,container:c,nonce:e.nonce,speedy:e.speedy}),nonce:e.nonce,inserted:s,registered:{}}}});
//# sourceMappingURL=index.min.js.map
{
"name": "@emotion/cache",
"version": "0.8.8",
"version": "10.0.0-beta.0",
"description": "emotion's cache",
"main": "dist/cache.cjs.js",
"module": "dist/cache.esm.js",
"types": "types/index.d.ts",
"license": "MIT",
"repository": "https://github.com/emotion-js/emotion/tree/master/next-packages/cache",
"repository": "https://github.com/emotion-js/emotion/tree/master/packages/cache",
"scripts": {
"test:typescript": "dtslint types"
},
"dependencies": {
"@emotion/sheet": "^0.8.1",
"@emotion/stylis": "^0.7.1",
"@emotion/utils": "^0.8.2"
"@emotion/sheet": "^0.9.0",
"@emotion/stylis": "^0.8.0",
"@emotion/utils": "^0.9.0"
},
"devDependencies": {
"dtslint": "^0.3.0"
},
"publishConfig": {

@@ -19,6 +26,10 @@ "access": "public"

"src",
"dist"
"dist",
"types"
],
"umd:main": "./dist/index.min.js",
"gitHead": "94fed7652759a0f1962da66b922299398e39fe4d"
"browser": {
"./dist/cache.cjs.js": "./dist/cache.browser.cjs.js",
"./dist/cache.esm.js": "./dist/cache.browser.esm.js"
}
}
// @flow
import { StyleSheet } from '@emotion/sheet'
import { isBrowser, type CSSContextType } from '@emotion/utils'
import { isBrowser, type EmotionCache } from '@emotion/utils'
import Stylis from '@emotion/stylis'

@@ -19,6 +19,7 @@ import ruleSheetPlugin from './rule-sheet'

key?: string,
container?: HTMLElement
container?: HTMLElement,
speedy?: boolean
}
let createCache = (options?: Options): CSSContextType => {
let createCache = (options?: Options): EmotionCache => {
if (options === undefined) options = {}

@@ -45,13 +46,4 @@ let key = options.key || 'css'

}
let sourceMapRegEx = /\/\*#\ssourceMappingURL=data:application\/json;\S+\s+\*\//
let currentSourceMap
stylis.use((context, content, selectors) => {
switch (context) {
case -1: {
let result = sourceMapRegEx.exec(content)
if (result) {
currentSourceMap = result[0]
}
break
}
case 2: {

@@ -65,3 +57,3 @@ for (let i = 0, len = selectors.length; len > i; i++) {

`The pseudo class "${
match[1]
match[0]
}" is potentially unsafe when doing server-side rendering. Try changing it to "${

@@ -75,11 +67,2 @@ match[1]

}
case -2: {
if (currentSourceMap) {
content.forEach((rule, i) => {
content[i] = rule + currentSourceMap
})
currentSourceMap = ''
}
}
}

@@ -108,3 +91,3 @@ })

const context: CSSContextType = {
const cache: EmotionCache = {
stylis,

@@ -115,11 +98,12 @@ key,

container,
nonce: options.nonce
nonce: options.nonce,
speedy: options.speedy
}),
nonce: options.nonce,
inserted,
registered: {},
theme: {}
registered: {}
}
return context
return cache
}
export default createCache

@@ -25,4 +25,5 @@ // @flow

length,
at,
depth
ns,
depth,
at
) => {

@@ -34,8 +35,32 @@ switch (context) {

}
case 2:
if (at === 0) return content + delimiter
// property
case 1: {
switch (content.charCodeAt(0)) {
case 64: {
// @import
if (depth === 0) {
current.push(content + ';')
return ''
}
break
}
// charcode for l
case 108: {
// charcode for b
// this ignores label
if (content.charCodeAt(2) === 98) {
return ''
}
}
}
break
}
// selector
case 2: {
if (ns === 0) return content + delimiter
break
}
// at-rule
case 3:
switch (at) {
case 3: {
switch (ns) {
// @font-face, @page

@@ -48,5 +73,6 @@ case 102:

default: {
return content + delimiter
return content + (at === 0 ? delimiter : '')
}
}
}
case -2: {

@@ -53,0 +79,0 @@ content.split(needle).forEach(toSheet)

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc