stylis-rule-sheet
Advanced tools
Comparing version 0.0.1 to 0.0.2
36
index.js
@@ -11,2 +11,3 @@ (function (factory) { | ||
var stack = [] | ||
var children = [] | ||
@@ -19,21 +20,26 @@ function toString (selectors, content) { | ||
switch (context) { | ||
// property context | ||
case 1: | ||
return | ||
// selector context | ||
case 2: | ||
// @at-rule context | ||
// @at-rule content? | ||
if (at > 0) | ||
return | ||
// #a { #b {}} ? | ||
if (depth > 1) | ||
return stack.push(toString(selectors, content)), '' | ||
switch (depth) { | ||
// normal {} | ||
case 1: | ||
stack.push(toString(selectors, content)) | ||
callback(toString(selectors, content)) | ||
if (stack.length > 0) { | ||
stack.forEach(callback) | ||
stack = [] | ||
if (children.length > 0) | ||
children = (stack.push.apply(stack, children), []) | ||
break | ||
// flat/nested | ||
default: | ||
children.push(toString(selectors, content)) | ||
} | ||
return '' | ||
// @at-rule context | ||
case 3: | ||
@@ -45,3 +51,3 @@ switch (at) { | ||
case 112: | ||
return callback(selectors[0]+content), '' | ||
stack.push(selectors[0]+content) | ||
// @viewport | ||
@@ -53,7 +59,13 @@ // @counter-style | ||
case 100: | ||
return | ||
break | ||
default: | ||
return callback(toString(selectors, content)), '' | ||
stack.push(toString(selectors, content)) | ||
} | ||
return '' | ||
// post process context | ||
case -2: | ||
children.forEach(callback) | ||
stack.forEach(callback) | ||
children = [] | ||
stack = [] | ||
@@ -60,0 +72,0 @@ } |
@@ -5,3 +5,3 @@ { | ||
"description": "stylis plugin to extract individual rules to use with insertRule API", | ||
"version": "0.0.1", | ||
"version": "0.0.2", | ||
"homepage": "https://github.com/thysultan/stylis.js", | ||
@@ -8,0 +8,0 @@ "license": "MIT", |
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
2672
63