Comparing version 0.8.0 to 0.8.1
@@ -0,1 +1,5 @@ | ||
## 0.8.1 (December 19, 2016) | ||
- patch 0.8.0 regression with @media blocks skipping namespaces | ||
## 0.8.0 (December 19, 2016) | ||
@@ -2,0 +6,0 @@ |
@@ -5,3 +5,3 @@ { | ||
"description": "stylis is a small css compiler", | ||
"version": "0.8.0", | ||
"version": "0.8.1", | ||
"homepage": "https://github.com/thysultan/stylis.js", | ||
@@ -8,0 +8,0 @@ "license": "MIT", |
@@ -19,5 +19,7 @@ # Stylis | ||
// flat css | ||
font-size: 2em; | ||
font-family: sans-serif; | ||
// polyfill for shadow dom selectors | ||
:host { | ||
@@ -41,2 +43,3 @@ color: red; | ||
// inject to global scope | ||
@global { | ||
@@ -48,2 +51,3 @@ body { | ||
// inject to global scope inline | ||
span, h1, :global(h2) { | ||
@@ -57,3 +61,4 @@ color:red; | ||
&{ | ||
// prefixing | ||
& { | ||
animation: slidein 3s ease infinite; | ||
@@ -65,2 +70,3 @@ display: flex; | ||
// namespaced animations | ||
&:before { | ||
@@ -70,2 +76,3 @@ animation: slidein 3s ease infinite; | ||
// namespaced keyframes | ||
@keyframes slidein { | ||
@@ -76,2 +83,3 @@ from { transform: translate(10px); } | ||
// flat namespaced css in @media | ||
@media (max-width: 600px) { | ||
@@ -225,3 +233,3 @@ display: block; | ||
```html | ||
<script src=https://unpkg.com/stylis@0.8.0/stylis.min.js></script> | ||
<script src=https://unpkg.com/stylis@0.8.1/stylis.min.js></script> | ||
``` | ||
@@ -228,0 +236,0 @@ |
@@ -187,3 +187,3 @@ /*! | ||
if (special === 0) { | ||
if (special === 0 || type === 2) { | ||
// nested selector | ||
@@ -228,3 +228,3 @@ if (depth === 2) { | ||
// create block and update styles length | ||
len += (styles += (prevSel.join(',') + '{' + inner + '}').replace(/&| +&/g, '')).length; | ||
len += (styles += (prevSel.join(',') + '{'+inner+'}').replace(/&| +&/g, '')).length; | ||
@@ -231,0 +231,0 @@ // clear current line, to avoid add block elements to the normal flow |
@@ -1,1 +0,1 @@ | ||
!function(e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e(global):"function"==typeof define&&define.amd?define(e(window)):window.stylis=e(window)}(function(e){"use strict";function t(e,t,i,r){var s="",n="",l=e.charCodeAt(0)||0;if(91===l){var a=e.substring(1,e.length-1).split("="),o=(n=a[1]).charCodeAt(0);34!==o&&39!==o||(n=n.substring(1,n.length-1)),s="["+a[0]+"='"+n+"']"}else n=35===l||46===l||62===l?(s=e).substring(1):s=e;for(var f=void 0===i||i===!0?n:"",d=void 0===r||r===!0?n:"",g="",h="",c="",b="",u="",v=t.length,p=0,A=0,l=0,C=0,m=0,w=0;p<v;){var k=t.charCodeAt(p);if(123===k||125===k||59===k){h+=t[p];var x=h.charCodeAt(0);32===x&&(x=(h=h.trim()).charCodeAt(0));var y=h.charCodeAt(1)||0;if(47===x&&42===y&&(x=(h=h.substring(h.indexOf("*/")+2)).charCodeAt(0),y=h.charCodeAt(1)||0),1===m)h="",m=0;else if(64===x)107===y||103===y?107===y?(c=h.substring(1,11)+f+h.substring(11),h="@-webkit-"+c,l=1):h="":109===y&&(l=2),A++;else{var O=h.charCodeAt(2)||0;if(97===x&&110===y&&105===O){for(var j=h.substring(10).split(","),z="animation:",q=0,B=j.length;q<B;q++)z+=(0===q?"":",")+d+j[q].trim();h="-webkit-"+z+z}else if(97===x&&112===y&&112===O)h="-webkit-"+h+"-moz-"+h+h;else if(104===x&&121===y&&112===O||117===x&&115===y&&101===O)h="-webkit-"+h+"-moz-"+h+"-ms-"+h+h;else if(102===x&&108===y&&101===O||111===x&&114===y&&100===O)h="-webkit-"+h+h;else if(116===x&&114===y&&97===O)h="-webkit-"+h+(102===h.charCodeAt(5)?"-ms-"+h:"")+h;else if(100===x&&105===y&&115===O)h.indexOf("flex")>-1&&(h="display:-webkit-flex; display:flex;");else if(123===k){if(w++,0===A)if(2===w){p++;for(var D="",E=h.substring(0,h.length-1).split(","),F=b.substring(0,b.length-1).split(","),G=1;p<v;){var o=t.charCodeAt(p);if(123===o?G++:125===o&&G--,0===G)break;D+=t[p++]}for(var q=0,B=F.length;q<B;q++){var H=F[q];F[q]="";for(var I=0,J=E.length;I<J;I++)F[q]+=(H.replace(s,"").trim()+" "+E[I].trim()).trim()+(I===J-1?"":",")}v+=(t+=(F.join(",")+"{"+D+"}").replace(/&| +&/g,"")).length,h="",w--}else{for(var K=h.split(","),z="",q=0,B=K.length;q<B;q++){var e=K[q],L=e.charCodeAt(0);if(32===L&&(L=(e=e.trim()).charCodeAt(0)),91===L)for(var I=q+1,J=B-q;I<J;I++){var M=(e+=","+K[I]).trim();if(93===M.charCodeAt(M.length-1)){B-=I,K.splice(q,I);break}}if(38===L)e=s+e.substring(1);else if(58===L){var N=e.charCodeAt(1);if(104===N){var P=(e=e.substring(5)).charCodeAt(0);e=40===P?s+e.substring(1).replace(")",""):45===P?e.substring(9,e.indexOf(")"))+" "+s+" {":s+e}else e=103===N?e.substring(8).replace(")",""):s+(58===L?"":" ")+e}else e=s+(58===L?"":" ")+e;z+=0===q?e:","+e}b=h=z}}else 125===k&&0!==w&&w--;0!==A?(125===k?C++:123===k&&0!==C&&C--,2===C?(0===l?h="":1===l?(h="}@"+c+"}",c=""):2===l&&(0!==c.length&&(h=s+" {"+c+"}"+h),c=""),l=0,C--,A--):1===l?c+=h:2===l&&0===w&&125!==k&&(c+=h,h="")):0===w&&125!==k&&(u+=h,h="")}g+=h,h="",m=0}else 1!==m||13!==k&&10!==k?9!==k&&13!==k&&10!==k&&(47===k&&0===m&&(m=1),h+=t[p]):h="";p++}return g+(0===u.length?"":s+" {"+u+"}")}return t}); | ||
!function(e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e(global):"function"==typeof define&&define.amd?define(e(window)):window.stylis=e(window)}(function(e){"use strict";function t(e,t,i,r){var s="",n="",l=e.charCodeAt(0)||0;if(91===l){var a=e.substring(1,e.length-1).split("="),o=(n=a[1]).charCodeAt(0);34!==o&&39!==o||(n=n.substring(1,n.length-1)),s="["+a[0]+"='"+n+"']"}else n=35===l||46===l||62===l?(s=e).substring(1):s=e;for(var f=void 0===i||i===!0?n:"",d=void 0===r||r===!0?n:"",g="",h="",c="",b="",u="",v=t.length,p=0,A=0,l=0,C=0,m=0,w=0;p<v;){var k=t.charCodeAt(p);if(123===k||125===k||59===k){h+=t[p];var x=h.charCodeAt(0);32===x&&(x=(h=h.trim()).charCodeAt(0));var y=h.charCodeAt(1)||0;if(47===x&&42===y&&(x=(h=h.substring(h.indexOf("*/")+2)).charCodeAt(0),y=h.charCodeAt(1)||0),1===m)h="",m=0;else if(64===x)107===y||103===y?107===y?(c=h.substring(1,11)+f+h.substring(11),h="@-webkit-"+c,l=1):h="":109===y&&(l=2),A++;else{var O=h.charCodeAt(2)||0;if(97===x&&110===y&&105===O){for(var j=h.substring(10).split(","),z="animation:",q=0,B=j.length;q<B;q++)z+=(0===q?"":",")+d+j[q].trim();h="-webkit-"+z+z}else if(97===x&&112===y&&112===O)h="-webkit-"+h+"-moz-"+h+h;else if(104===x&&121===y&&112===O||117===x&&115===y&&101===O)h="-webkit-"+h+"-moz-"+h+"-ms-"+h+h;else if(102===x&&108===y&&101===O||111===x&&114===y&&100===O)h="-webkit-"+h+h;else if(116===x&&114===y&&97===O)h="-webkit-"+h+(102===h.charCodeAt(5)?"-ms-"+h:"")+h;else if(100===x&&105===y&&115===O)h.indexOf("flex")>-1&&(h="display:-webkit-flex; display:flex;");else if(123===k){if(w++,0===A||2===l)if(2===w){p++;for(var D="",E=h.substring(0,h.length-1).split(","),F=b.substring(0,b.length-1).split(","),G=1;p<v;){var o=t.charCodeAt(p);if(123===o?G++:125===o&&G--,0===G)break;D+=t[p++]}for(var q=0,B=F.length;q<B;q++){var H=F[q];F[q]="";for(var I=0,J=E.length;I<J;I++)F[q]+=(H.replace(s,"").trim()+" "+E[I].trim()).trim()+(I===J-1?"":",")}v+=(t+=(F.join(",")+"{"+D+"}").replace(/&| +&/g,"")).length,h="",w--}else{for(var K=h.split(","),z="",q=0,B=K.length;q<B;q++){var e=K[q],L=e.charCodeAt(0);if(32===L&&(L=(e=e.trim()).charCodeAt(0)),91===L)for(var I=q+1,J=B-q;I<J;I++){var M=(e+=","+K[I]).trim();if(93===M.charCodeAt(M.length-1)){B-=I,K.splice(q,I);break}}if(38===L)e=s+e.substring(1);else if(58===L){var N=e.charCodeAt(1);if(104===N){var P=(e=e.substring(5)).charCodeAt(0);e=40===P?s+e.substring(1).replace(")",""):45===P?e.substring(9,e.indexOf(")"))+" "+s+" {":s+e}else e=103===N?e.substring(8).replace(")",""):s+(58===L?"":" ")+e}else e=s+(58===L?"":" ")+e;z+=0===q?e:","+e}b=h=z}}else 125===k&&0!==w&&w--;0!==A?(125===k?C++:123===k&&0!==C&&C--,2===C?(0===l?h="":1===l?(h="}@"+c+"}",c=""):2===l&&(0!==c.length&&(h=s+" {"+c+"}"+h),c=""),l=0,C--,A--):1===l?c+=h:2===l&&0===w&&125!==k&&(c+=h,h="")):0===w&&125!==k&&(u+=h,h="")}g+=h,h="",m=0}else 1!==m||13!==k&&10!==k?9!==k&&13!==k&&10!==k&&(47===k&&0===m&&(m=1),h+=t[p]):h="";p++}return g+(0===u.length?"":s+" {"+u+"}")}return t}); |
29570
334