Comparing version 5.1.0 to 5.1.1
@@ -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.emotion=e.emotion||{})}(this,function(e){function t(e){return e[e.length-1]}function n(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]}function r(){var e=document.createElement("style");return e.type="text/css",e.setAttribute("data-emotion",""),e.appendChild(document.createTextNode("")),(document.head||document.getElementsByTagName("head")[0]).appendChild(e),e}function i(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.speedy,n=void 0===t?!E&&!b:t,r=e.maxLength,i=void 0===r?x&&S?4e3:65e3:r;this.isSpeedy=n,this.sheet=void 0,this.tags=[],this.maxLength=i,this.ctr=0}function o(e){var t=e.join(",");return u(t,t.length).toString(36)}function s(){for(var e="",t=arguments.length,n=Array(t),r=0;r<t;r++)n[r]=arguments[r];for(var i=0;i<n.length;i++)e+=JSON.stringify(n[i]);return u(e,e.length).toString(36)}function u(e,t){for(var n=1540483477,r=t^e.length,i=e.length,o=0;i>=4;){var s=c(e,o);s=f(s,n),s=f(s^=s>>>24,n),r=f(r,n),r^=s,o+=4,i-=4}switch(i){case 3:r^=a(e,o),r=f(r^=e.charCodeAt(o+2)<<16,n);break;case 2:r=f(r^=a(e,o),n);break;case 1:r=f(r^=e.charCodeAt(o),n)}return r^=r>>>13,r=f(r,n),(r^=r>>>15)>>>0}function c(e,t){return e.charCodeAt(t++)+(e.charCodeAt(t++)<<8)+(e.charCodeAt(t++)<<16)+(e.charCodeAt(t)<<24)}function a(e,t){return e.charCodeAt(t++)+(e.charCodeAt(t++)<<8)}function f(e,t){return(65535&(e|=0))*(t|=0)+(((e>>>16)*t&65535)<<16)|0}function h(t,n){var r=o([t].concat(n)),i="vars-"+r;if(e.inserted[r])return i;var s=n.map(function(e,n){return"--"+t+"-"+n+": "+e}).join("; ");return w.insert("."+i+" {"+s+"}"),e.inserted[r]=!0,i}function d(t){var n=o(t);e.inserted[n]||(e.inserted[n]=!0,t.forEach(function(e){return w.insert(e)}))}function l(t){var n=s(t),r="css-"+n,i="."+r;return e.inserted[n]?r:(p(i,t).forEach(function(e){return w.insert(e)}),e.inserted[n]=!0,r)}function p(e,t,n){var r=[],i=[];for(var o in t){(function(o){var s=t[o],u=void 0===s?"undefined":C(s);"number"===u||"string"===u?r.push(y(o,s)):Array.isArray(s)?s.forEach(function(e){r.push(y(o,e))}):/^:/.test(o)?p(e+o,s,n).forEach(function(e){return i.push(e)}):/^@media/.test(o)?p(e,s,o).forEach(function(e){return i.push(e)}):p(e+" "+o,s,n).forEach(function(e){return i.push(e)})})(o)}return i.unshift(m(e,r,n)),i}function y(e,t){return g(e)+":"+v(e,t)}function m(e,t,n){var r=e+"{"+t.join(";")+"}";return n?n+"{"+r+"}":r}function g(e){return(""+e).replace(/[A-Z]|^ms/g,"-$&").toLowerCase()}function v(e,t){return"number"!=typeof t||j[e]?t:t+"px"}var x="undefined"!=typeof window,E="development"===process.env.NODE_ENV||!process.env.NODE_ENV,b="test"===process.env.NODE_ENV,S=function(){if(x){var e=document.createElement("div");return e.innerHTML="\x3c!--[if lt IE 10]><i></i><![endif]--\x3e",1===e.getElementsByTagName("i").length}}();Object.assign(i.prototype,{getSheet:function(){return n(t(this.tags))},inject:function(){var e=this;if(this.injected)throw new Error("already injected!");x?this.tags[0]=r():this.sheet={cssRules:[],insertRule:function(t){e.sheet.cssRules.push({cssText:t})}},this.injected=!0},speedy:function(e){if(0!==this.ctr)throw new Error("cannot change speedy now");this.isSpeedy=!!e},_insert:function(e){try{var t=this.getSheet();t.insertRule(e,-1!==e.indexOf("@import")?0:t.cssRules.length)}catch(t){E&&console.warn("illegal rule",e)}},insert:function(e){if(x)if(this.isSpeedy&&this.getSheet().insertRule)this._insert(e);else if(-1!==e.indexOf("@import")){var n=t(this.tags);n.insertBefore(document.createTextNode(e),n.firstChild)}else t(this.tags).appendChild(document.createTextNode(e));else this.sheet.insertRule(e,-1!==e.indexOf("@import")?0:this.sheet.cssRules.length);return this.ctr++,x&&this.ctr%this.maxLength==0&&this.tags.push(r()),this.ctr-1},delete:function(e){return this.replace(e,"")},flush:function(){x?(this.tags.forEach(function(e){return e.parentNode.removeChild(e)}),this.tags=[],this.sheet=null,this.ctr=0):this.sheet.cssRules=[],this.injected=!1},rules:function(){if(!x)return this.sheet.cssRules;var e=[];return this.tags.forEach(function(t){return e.splice.apply(e,[e.length,0].concat(Array.from(n(t).cssRules)))}),e}});var C="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},w=new i;w.inject(),e.inserted={};var A=d,j={animationIterationCount:1,boxFlex:1,boxFlexGroup:1,boxOrdinalGroup:1,columnCount:1,flex:1,flexGrow:1,flexPositive:1,flexShrink:1,flexNegative:1,flexOrder:1,gridRow:1,gridColumn:1,fontWeight:1,lineClamp:1,lineHeight:1,opacity:1,order:1,orphans:1,tabSize:1,widows:1,zIndex:1,zoom:1,fillOpacity:1,stopOpacity:1,strokeDashoffset:1,strokeOpacity:1,strokeWidth:1};e.sheet=w,e.flush=function(){w.flush(),e.inserted={},w.inject()},e.css=function(t,n,r){Array.isArray(t)||(t=[t]);var i=t.reduce(function(e,t){return e+="string"==typeof t?" "+t:" "+l(t)},"").trim();if(r){var s=r.apply(void 0,n),u=o(s);return e.inserted[u]||(e.inserted[u]=!0,s.map(function(e){return e.replace(new RegExp(t[0],"gm"),t[0]+"-"+u)}).forEach(function(e){return w.insert(e)})),t[0]+"-"+u+" "+i}return i+(n&&n.length>0?" "+h(t[0],n):"")},e.injectGlobal=d,e.fontFace=A,e.keyframes=function(t,n){var r=o(n),i=t+"-"+r;return e.inserted[r]||(e.inserted[r]=!0,n.forEach(function(e){w.insert("@keyframes "+i+" "+e)})),i},e.hydrate=function(t){t.forEach(function(t){return e.inserted[t]=!0})},e.objStyle=l,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.emotion=e.emotion||{})}(this,function(e){function t(e){return e[e.length-1]}function n(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]}function r(){var e=document.createElement("style");return e.type="text/css",e.setAttribute("data-emotion",""),e.appendChild(document.createTextNode("")),(document.head||document.getElementsByTagName("head")[0]).appendChild(e),e}function i(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.speedy,n=void 0===t?!E&&!b:t,r=e.maxLength,i=void 0===r?x&&S?4e3:65e3:r;this.isSpeedy=n,this.sheet=void 0,this.tags=[],this.maxLength=i,this.ctr=0}function o(e){var t=e.join(",");return u(t,t.length).toString(36)}function s(){for(var e="",t=arguments.length,n=Array(t),r=0;r<t;r++)n[r]=arguments[r];for(var i=0;i<n.length;i++)e+=JSON.stringify(n[i]);return u(e,e.length).toString(36)}function u(e,t){for(var n=1540483477,r=t^e.length,i=e.length,o=0;i>=4;){var s=c(e,o);s=f(s,n),s=f(s^=s>>>24,n),r=f(r,n),r^=s,o+=4,i-=4}switch(i){case 3:r^=a(e,o),r=f(r^=e.charCodeAt(o+2)<<16,n);break;case 2:r=f(r^=a(e,o),n);break;case 1:r=f(r^=e.charCodeAt(o),n)}return r^=r>>>13,r=f(r,n),(r^=r>>>15)>>>0}function c(e,t){return e.charCodeAt(t++)+(e.charCodeAt(t++)<<8)+(e.charCodeAt(t++)<<16)+(e.charCodeAt(t)<<24)}function a(e,t){return e.charCodeAt(t++)+(e.charCodeAt(t++)<<8)}function f(e,t){return(65535&(e|=0))*(t|=0)+(((e>>>16)*t&65535)<<16)|0}function h(t,n){var r=o([t].concat(n)),i="vars-"+r;if(e.inserted[r])return i;var s=n.map(function(e,n){return"--"+t+"-"+n+": "+e}).join("; ");return w.insert("."+i+" {"+s+"}"),e.inserted[r]=!0,i}function d(t){var n=o(t);e.inserted[n]||(e.inserted[n]=!0,t.forEach(function(e){return w.insert(e)}))}function l(t){var n=s(t),r="css-"+n,i="."+r;return e.inserted[n]?r:(p(i,t).forEach(function(e){return w.insert(e)}),e.inserted[n]=!0,r)}function p(e,t,n){var r=[],i=[];for(var o in t){(function(o){var s=t[o],u=void 0===s?"undefined":C(s);"number"===u||"string"===u?r.push(m(o,s)):Array.isArray(s)?s.forEach(function(e){r.push(m(o,e))}):/^:/.test(o)?p(e+o,s,n).forEach(function(e){return i.push(e)}):/^@media/.test(o)?p(e,s,o).forEach(function(e){return i.push(e)}):p(e+" "+o,s,n).forEach(function(e){return i.push(e)})})(o)}return i.unshift(y(e,r,n)),i}function m(e,t){return g(e)+":"+v(e,t)}function y(e,t,n){var r=e+"{"+t.join(";")+"}";return n?n+"{"+r+"}":r}function g(e){return(""+e).replace(/[A-Z]|^ms/g,"-$&").toLowerCase()}function v(e,t){return"number"!=typeof t||A[e]?t:t+"px"}var x="undefined"!=typeof window,E="development"===process.env.NODE_ENV||!process.env.NODE_ENV,b="test"===process.env.NODE_ENV,S=function(){if(x){var e=document.createElement("div");return e.innerHTML="\x3c!--[if lt IE 10]><i></i><![endif]--\x3e",1===e.getElementsByTagName("i").length}}();Object.assign(i.prototype,{getSheet:function(){return n(t(this.tags))},inject:function(){var e=this;if(this.injected)throw new Error("already injected!");x?this.tags[0]=r():this.sheet={cssRules:[],insertRule:function(t){e.sheet.cssRules.push({cssText:t})}},this.injected=!0},speedy:function(e){if(0!==this.ctr)throw new Error("cannot change speedy now");this.isSpeedy=!!e},_insert:function(e){try{var t=this.getSheet();t.insertRule(e,-1!==e.indexOf("@import")?0:t.cssRules.length)}catch(t){E&&console.warn("illegal rule",e)}},insert:function(e){if(x)if(this.isSpeedy&&this.getSheet().insertRule)this._insert(e);else if(-1!==e.indexOf("@import")){var n=t(this.tags);n.insertBefore(document.createTextNode(e),n.firstChild)}else t(this.tags).appendChild(document.createTextNode(e));else this.sheet.insertRule(e,-1!==e.indexOf("@import")?0:this.sheet.cssRules.length);return this.ctr++,x&&this.ctr%this.maxLength==0&&this.tags.push(r()),this.ctr-1},delete:function(e){return this.replace(e,"")},flush:function(){x?(this.tags.forEach(function(e){return e.parentNode.removeChild(e)}),this.tags=[],this.sheet=null,this.ctr=0):this.sheet.cssRules=[],this.injected=!1},rules:function(){if(!x)return this.sheet.cssRules;var e=[];return this.tags.forEach(function(t){return e.splice.apply(e,[e.length,0].concat(Array.from(n(t).cssRules)))}),e}});var C="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},w=new i;w.inject(),e.inserted={};var j=d,A={animationIterationCount:1,boxFlex:1,boxFlexGroup:1,boxOrdinalGroup:1,columnCount:1,flex:1,flexGrow:1,flexPositive:1,flexShrink:1,flexNegative:1,flexOrder:1,gridRow:1,gridColumn:1,fontWeight:1,lineClamp:1,lineHeight:1,opacity:1,order:1,orphans:1,tabSize:1,widows:1,zIndex:1,zoom:1,fillOpacity:1,stopOpacity:1,strokeDashoffset:1,strokeOpacity:1,strokeWidth:1};e.sheet=w,e.flush=function(){w.flush(),e.inserted={},w.inject()},e.css=function(t,n,r){Array.isArray(t)||(t=[t]);var i=t.map(function(e){return"string"==typeof e?e:l(e)}).join(" ").trim();if(r){var s=r.apply(void 0,n),u=o(s);return e.inserted[u]||(e.inserted[u]=!0,s.map(function(e){return e.replace(new RegExp(t[0],"gm"),t[0]+"-"+u)}).forEach(function(e){return w.insert(e)})),t[0]+"-"+u+" "+i}return i+(n&&n.length>0?" "+h(t[0],n):"")},e.injectGlobal=d,e.fontFace=j,e.keyframes=function(t,n){var r=o(n),i=t+"-"+r;return e.inserted[r]||(e.inserted[r]=!0,n.forEach(function(e){w.insert("@keyframes "+i+" "+e)})),i},e.hydrate=function(t){t.forEach(function(t){return e.inserted[t]=!0})},e.objStyle=l,Object.defineProperty(e,"__esModule",{value:!0})}); | ||
//# sourceMappingURL=DO-NOT-USE.min.js.map |
@@ -70,3 +70,4 @@ 'use strict'; | ||
hasOtherMatch = _inline.hasOtherMatch, | ||
composes = _inline.composes; | ||
composes = _inline.composes, | ||
hasCssFunction = _inline.hasCssFunction; | ||
@@ -85,3 +86,3 @@ if (hash === '0') { | ||
var args = [tag, t.arrayExpression(inputClasses), t.arrayExpression(vars)]; | ||
if (!hasOtherMatch && !state.inline) { | ||
if (!hasOtherMatch && !state.inline && !hasCssFunction) { | ||
state.insertStaticRules(rules); | ||
@@ -88,0 +89,0 @@ } else { |
@@ -50,12 +50,6 @@ 'use strict'; | ||
var computedClassName = classes.reduce(function (out, cls) { | ||
if (typeof cls === 'string') { | ||
out += ' ' + cls; | ||
return out; | ||
} | ||
var computedClassName = classes.map(function (cls) { | ||
return typeof cls === 'string' ? cls : objStyle(cls); | ||
}).join(' ').trim(); | ||
out += ' ' + objStyle(cls); | ||
return out; | ||
}, '').trim(); | ||
if (content) { | ||
@@ -62,0 +56,0 @@ // inline mode |
@@ -66,5 +66,6 @@ 'use strict'; | ||
hasOtherMatch = _parseCSS.hasOtherMatch, | ||
composes = _parseCSS.composes; | ||
composes = _parseCSS.composes, | ||
hasCssFunction = _parseCSS.hasCssFunction; | ||
return { hash: hash, name: name, rules: rules, hasVar: hasVar, hasOtherMatch: hasOtherMatch, composes: composes }; | ||
return { hash: hash, name: name, rules: rules, hasVar: hasVar, hasOtherMatch: hasOtherMatch, composes: composes, hasCssFunction: hasCssFunction }; | ||
} | ||
@@ -71,0 +72,0 @@ |
@@ -40,4 +40,8 @@ 'use strict'; | ||
var composes = 0; | ||
var hasCssFunction = false; | ||
root.walkDecls(function (decl) { | ||
if (decl.prop === 'name') decl.remove(); | ||
if (decl.value.match(/attr/)) { | ||
hasCssFunction = true; | ||
} | ||
if (options.canCompose) { | ||
@@ -67,3 +71,3 @@ if (decl.prop === 'composes') { | ||
}); | ||
if (!options.inlineMode && vars === options.matches) { | ||
if (!options.inlineMode && vars === options.matches && !hasCssFunction) { | ||
root.walkDecls(function (decl) { | ||
@@ -81,3 +85,4 @@ decl.value = decl.value.replace(/xxx(\S)xxx/gm, function (match, p1) { | ||
hasVar: !!vars && vars !== composes || !!(options.inlineMode && options.matches), | ||
composes: composes | ||
composes: composes, | ||
hasCssFunction: hasCssFunction | ||
}; | ||
@@ -84,0 +89,0 @@ } |
@@ -17,3 +17,3 @@ 'use strict'; | ||
}; | ||
var className = (0, _index.css)(cls, vars.map(getValue), content); | ||
var className = (0, _index.css)(cls.map(getValue), vars.map(getValue), content); | ||
@@ -20,0 +20,0 @@ return _react2.default.createElement(tag, Object.assign({}, props, { |
@@ -12,3 +12,3 @@ 'use strict'; | ||
var o = { html: html, ids: [], css: '', rules: [] }; | ||
var regex = /css-([a-zA-Z0-9]+)/gm; | ||
var regex = /css(?:[a-zA-Z0-9-]*)-([a-zA-Z0-9]+)/gm; | ||
var match = void 0; | ||
@@ -23,3 +23,3 @@ var ids = {}; | ||
o.rules = _index.sheet.sheet.cssRules.filter(function (x) { | ||
var regex = /css-([a-zA-Z0-9]+)/gm; | ||
var regex = /css(?:[a-zA-Z0-9-]*)-([a-zA-Z0-9]+)/gm; | ||
var match = regex.exec(x.cssText); | ||
@@ -26,0 +26,0 @@ if (match && ids[match[1] + '']) { |
{ | ||
"name": "emotion", | ||
"version": "5.1.0", | ||
"version": "5.1.1", | ||
"description": "high performance css-in-js", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
@@ -159,3 +159,3 @@ import fs from 'fs' | ||
function buildCallExpression (identifier, tag, path) { | ||
let { hash, rules, name, hasOtherMatch, composes } = inline( | ||
let { hash, rules, name, hasOtherMatch, composes, hasCssFunction } = inline( | ||
path.node.quasi, | ||
@@ -188,3 +188,3 @@ identifierName, | ||
] | ||
if (!hasOtherMatch && !state.inline) { | ||
if (!hasOtherMatch && !state.inline && !hasCssFunction) { | ||
state.insertStaticRules(rules) | ||
@@ -191,0 +191,0 @@ } else { |
@@ -41,11 +41,4 @@ // @flow | ||
const computedClassName = classes | ||
.reduce((out: string, cls): string => { | ||
if (typeof cls === 'string') { | ||
out += ' ' + cls | ||
return out | ||
} | ||
out += ' ' + objStyle(cls) | ||
return out | ||
}, '') | ||
.map((cls): string => typeof cls === 'string' ? cls : objStyle(cls)) | ||
.join(' ') | ||
.trim() | ||
@@ -52,0 +45,0 @@ |
@@ -59,3 +59,4 @@ // @flow | ||
hasOtherMatch: boolean, | ||
composes: number | ||
composes: number, | ||
hasCssFunction: boolean | ||
} { | ||
@@ -74,3 +75,4 @@ let strs = quasi.quasis.map(x => x.value.cooked) | ||
hasOtherMatch, | ||
composes | ||
composes, | ||
hasCssFunction | ||
} = parseCSS(`.${name}-${hash} { ${src} }`, { | ||
@@ -83,3 +85,3 @@ inlineMode: inlineMode, | ||
}) | ||
return { hash, name, rules, hasVar, hasOtherMatch, composes } | ||
return { hash, name, rules, hasVar, hasOtherMatch, composes, hasCssFunction } | ||
} | ||
@@ -86,0 +88,0 @@ |
@@ -24,3 +24,3 @@ // @flow | ||
} | ||
): { rules: string[], hasOtherMatch: boolean, hasVar: boolean, composes: number } { | ||
): { rules: string[], hasOtherMatch: boolean, hasVar: boolean, composes: number, hasCssFunction: boolean } { | ||
// todo - handle errors | ||
@@ -32,4 +32,8 @@ const root = parse(css) | ||
let composes = 0 | ||
let hasCssFunction = false | ||
root.walkDecls(decl => { | ||
if (decl.prop === 'name') decl.remove() | ||
if (decl.value.match(/attr/)) { | ||
hasCssFunction = true | ||
} | ||
if (options.canCompose) { | ||
@@ -59,3 +63,3 @@ if (decl.prop === 'composes') { | ||
}) | ||
if (!options.inlineMode && vars === options.matches) { | ||
if (!options.inlineMode && vars === options.matches && !hasCssFunction) { | ||
root.walkDecls((decl) => { | ||
@@ -73,3 +77,4 @@ decl.value = decl.value.replace(/xxx(\S)xxx/gm, (match, p1) => { | ||
hasVar: (!!vars && vars !== composes) || !!(options.inlineMode && options.matches), | ||
composes | ||
composes, | ||
hasCssFunction | ||
} | ||
@@ -76,0 +81,0 @@ } |
@@ -14,3 +14,3 @@ import React from 'react' | ||
const className = css( | ||
cls, | ||
cls.map(getValue), | ||
vars.map(getValue), | ||
@@ -17,0 +17,0 @@ content |
@@ -7,3 +7,3 @@ import { sheet, inserted } from './index' | ||
let o = { html, ids: [], css: '', rules: [] } | ||
let regex = /css-([a-zA-Z0-9]+)/gm | ||
let regex = /css(?:[a-zA-Z0-9-]*)-([a-zA-Z0-9]+)/gm | ||
let match | ||
@@ -18,3 +18,3 @@ let ids = {} | ||
o.rules = sheet.sheet.cssRules.filter(x => { | ||
let regex = /css-([a-zA-Z0-9]+)/gm | ||
let regex = /css(?:[a-zA-Z0-9-]*)-([a-zA-Z0-9]+)/gm | ||
let match = regex.exec(x.cssText) | ||
@@ -21,0 +21,0 @@ if (match && ids[match[1] + '']) { |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
110604
2244