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

stylis

Package Overview
Dependencies
Maintainers
1
Versions
174
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

stylis - npm Package Compare versions

Comparing version 0.6.8 to 0.7.0

4

CHANGELOG.md

@@ -0,1 +1,5 @@

## 0.7.0 (December 12, 2016)
- add inline `:global()` function, change `@root` to `@global`
## 0.6.8 (December 06, 2016)

@@ -2,0 +6,0 @@

2

package.json

@@ -5,3 +5,3 @@ {

"description": "stylis is a small css compiler",
"version": "0.6.8",
"version": "0.7.0",
"homepage": "https://github.com/thysultan/stylis.js",

@@ -8,0 +8,0 @@ "license": "MIT",

@@ -6,3 +6,3 @@ # Stylis

- ~1020bytes minified+gzipped
- ~1Kb minified+gzipped
- ~2kb minified

@@ -35,3 +35,3 @@

// a line comment
// removes line comment

@@ -42,3 +42,3 @@ .name {

@root {
@global {
body {

@@ -49,7 +49,7 @@ background: yellow;

span, h1 {
span, h1, :global(h2) {
color:red;
/**
* removes block comments and line comments
* removes block comments
*/

@@ -104,3 +104,4 @@ }

#user span,
#user h1 {
#user h1,
h2 {
color: red;

@@ -184,3 +185,3 @@ }

```html
<script src=https://unpkg.com/stylis@0.6.8/stylis.min.js></script>
<script src=https://unpkg.com/stylis@0.7.0/stylis.min.js></script>
```

@@ -187,0 +188,0 @@

@@ -110,4 +110,4 @@ /*!

// @keyframe/@root, `k` or @root, `r` character
if (second === 107 || second === 114) {
// @keyframe/@global, `k` or @global, `g` character
if (second === 107 || second === 103) {
special++;

@@ -197,17 +197,30 @@

}
// :host
else if (firstChar === 58 && selector.charCodeAt(1) === 104) {
var nextChar = (selector = selector.substring(5)).charCodeAt(0);
// :host(selector)
if (nextChar === 40) {
selector = prefix + selector.substring(1).replace(')', '');
}
// :host-context(selector)
else if (nextChar === 45) {
selector = selector.substring(9, selector.indexOf(')')) + ' ' + prefix + ' {';
// :
else if (firstChar === 58) {
var secondChar = selector.charCodeAt(1);
// :host
if (secondChar === 104) {
var nextChar = (selector = selector.substring(5)).charCodeAt(0);
// :host(selector)
if (nextChar === 40) {
selector = prefix + selector.substring(1).replace(')', '');
}
// :host-context(selector)
else if (nextChar === 45) {
selector = selector.substring(9, selector.indexOf(')')) + ' ' + prefix + ' {';
}
// :host
else {
selector = prefix + selector;
}
}
// :host
// :global()
else if (secondChar === 103) {
selector = selector.substring(8).replace(')', '');
}
// :hover, :active, :focus, etc...
else {
selector = prefix + selector;
selector = prefix + (firstChar === 58 ? '' : ' ') + selector;
}

@@ -226,3 +239,3 @@ }

// @root/@keyframes
// @global/@keyframes
if (special !== 0) {

@@ -238,3 +251,3 @@ // find the closing tag

if (close === 2) {
// @root
// @global
if (type === 0) {

@@ -241,0 +254,0 @@ line = '';

@@ -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="",o=e.charCodeAt(0)||0;if(91===o){var l=e.substring(1,e.length-1).split("="),a=(n=l[1]).charCodeAt(0);34!==a&&39!==a||(n=n.substring(1,n.length-1)),s="["+l[0]+"='"+n+"']"}else n=35===o||46===o||62===o?(s=e).substring(1):s=e;for(var d=void 0===i||i===!0?n:"",f=void 0===r||r===!0?n:"",h="",c="",u="",b=t.length,g=0,A=0,o=0,C=0,v=1,w=0;g<b;){var m=t.charCodeAt(g);if(123===m||125===m||59===m){c+=t[g];var p=c.charCodeAt(0);32===p&&(p=(c=c.trim()).charCodeAt(0));var x=c.charCodeAt(1)||0;if(47===p&&42===x&&(p=(c=c.substring(c.indexOf("*/")+2)).charCodeAt(0),x=c.charCodeAt(1)||0),64===p)1===v&&(v=0,0!==h.length&&(h=s+" {"+h+"}")),107!==x&&114!==x||(A++,107===x?(u=c.substring(1,11)+d+c.substring(11),c="@-webkit-"+u,o=1):c="");else{var k=c.charCodeAt(2)||0;if(97===p&&110===x&&105===k){for(var y=c.substring(10).split(","),O="animation:",z=0,j=y.length;z<j;z++)O+=(0===z?"":",")+f+y[z].trim();c="-webkit-"+O+O}else if(97===p&&112===x&&112===k)c="-webkit-"+c+"-moz-"+c+c;else if(104===p&&121===x&&112===k||117===p&&115===x&&101===k)c="-webkit-"+c+"-moz-"+c+"-ms-"+c+c;else if(102===p&&108===x&&101===k||111===p&&114===x&&100===k)c="-webkit-"+c+c;else if(116===p&&114===x&&97===k)c="-webkit-"+c+(102===c.charCodeAt(5)?"-ms-"+c:"")+c;else if(100===p&&105===x&&115===k)c.indexOf("flex")>-1&&(c="display:-webkit-flex; display:flex;");else if(123===m&&(1===v&&(v=0,0!==h.length&&(h=s+" {"+h+"}")),0===A)){for(var q=c.split(","),O="",z=0,j=q.length;z<j;z++){var e=q[z],B=e.charCodeAt(0);if(32===B&&(B=(e=e.trim()).charCodeAt(0)),38===B)e=s+e.substring(1);else if(58===B&&104===e.charCodeAt(1)){var D=(e=e.substring(5)).charCodeAt(0);e=40===D?s+e.substring(1).replace(")",""):45===D?e.substring(9,e.indexOf(")"))+" "+s+" {":s+e}else e=s+(58===B?"":" ")+e;O+=0===z?e:","+e}c=O}0!==A&&(125===m?C++:123===m&&0!==C&&C--,2===C?(0===o?c="":(c="}@"+u+"}",u=""),o=0,C=A>1?1:0,A--):1===o&&(u+=c))}h+=c,c="",w=0}else 1!==w||13!==m&&10!==m?9!==m&&13!==m&&10!==m&&(47===m&&0===w&&(w=1),c+=t[g]):c="";g++}return 1===v&&0!==h.length?s+" {"+h+"}":h}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="",o=e.charCodeAt(0)||0;if(91===o){var l=e.substring(1,e.length-1).split("="),a=(n=l[1]).charCodeAt(0);34!==a&&39!==a||(n=n.substring(1,n.length-1)),s="["+l[0]+"='"+n+"']"}else n=35===o||46===o||62===o?(s=e).substring(1):s=e;for(var f=void 0===i||i===!0?n:"",d=void 0===r||r===!0?n:"",c="",h="",u="",b=t.length,g=0,v=0,o=0,A=0,C=1,w=0;g<b;){var p=t.charCodeAt(g);if(123===p||125===p||59===p){h+=t[g];var m=h.charCodeAt(0);32===m&&(m=(h=h.trim()).charCodeAt(0));var x=h.charCodeAt(1)||0;if(47===m&&42===x&&(m=(h=h.substring(h.indexOf("*/")+2)).charCodeAt(0),x=h.charCodeAt(1)||0),64===m)1===C&&(C=0,0!==c.length&&(c=s+" {"+c+"}")),107!==x&&103!==x||(v++,107===x?(u=h.substring(1,11)+f+h.substring(11),h="@-webkit-"+u,o=1):h="");else{var k=h.charCodeAt(2)||0;if(97===m&&110===x&&105===k){for(var y=h.substring(10).split(","),O="animation:",z=0,j=y.length;z<j;z++)O+=(0===z?"":",")+d+y[z].trim();h="-webkit-"+O+O}else if(97===m&&112===x&&112===k)h="-webkit-"+h+"-moz-"+h+h;else if(104===m&&121===x&&112===k||117===m&&115===x&&101===k)h="-webkit-"+h+"-moz-"+h+"-ms-"+h+h;else if(102===m&&108===x&&101===k||111===m&&114===x&&100===k)h="-webkit-"+h+h;else if(116===m&&114===x&&97===k)h="-webkit-"+h+(102===h.charCodeAt(5)?"-ms-"+h:"")+h;else if(100===m&&105===x&&115===k)h.indexOf("flex")>-1&&(h="display:-webkit-flex; display:flex;");else if(123===p&&(1===C&&(C=0,0!==c.length&&(c=s+" {"+c+"}")),0===v)){for(var q=h.split(","),O="",z=0,j=q.length;z<j;z++){var e=q[z],B=e.charCodeAt(0);if(32===B&&(B=(e=e.trim()).charCodeAt(0)),38===B)e=s+e.substring(1);else if(58===B){var D=e.charCodeAt(1);if(104===D){var E=(e=e.substring(5)).charCodeAt(0);e=40===E?s+e.substring(1).replace(")",""):45===E?e.substring(9,e.indexOf(")"))+" "+s+" {":s+e}else e=103===D?e.substring(8).replace(")",""):s+(58===B?"":" ")+e}else e=s+(58===B?"":" ")+e;O+=0===z?e:","+e}h=O}0!==v&&(125===p?A++:123===p&&0!==A&&A--,2===A?(0===o?h="":(h="}@"+u+"}",u=""),o=0,A=v>1?1:0,v--):1===o&&(u+=h))}c+=h,h="",w=0}else 1!==w||13!==p&&10!==p?9!==p&&13!==p&&10!==p&&(47===p&&0===w&&(w=1),h+=t[g]):h="";g++}return 1===C&&0!==c.length?s+" {"+c+"}":c}return t});
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