Comparing version 3.0.0-beta5 to 3.0.0-rc.1
module.exports = { | ||
root: true, | ||
env: { | ||
node: true, | ||
browser: true, | ||
es6: true | ||
"env": { | ||
"node": true, | ||
"es6": true | ||
}, | ||
parserOptions: { | ||
ecmaVersion: 6, | ||
sourceType: 'module', | ||
ecmaFeatures: { | ||
experimentalObjectRestSpread: true | ||
} | ||
"parserOptions": { | ||
"ecmaVersion": 9, | ||
"sourceType": "module" | ||
}, | ||
@@ -15,0 +11,0 @@ rules: { |
@@ -1,2 +0,2 @@ | ||
var el = typeof document !== 'undefined' && document.createElement('div'); | ||
var el = typeof document !== 'undefined' && document.createElement('div'); // eslint-disable-line | ||
@@ -35,3 +35,3 @@ var cache = { | ||
.concat(Object.keys( | ||
typeof document === 'undefined' ? {} : findWidth(document.documentElement.style) | ||
typeof document === 'undefined' ? {} : findWidth(document.documentElement.style) // eslint-disable-line | ||
)) | ||
@@ -92,3 +92,3 @@ .filter(function (x, i, xs) { return x.indexOf('-') === -1 && x !== 'length' && xs.indexOf(x) === i; }) | ||
var doc = window && typeof window.document === 'object' && window.document | ||
var doc = document !== 'undefined' && window.document // eslint-disable-line | ||
, validChar = function (c, ci) { return ci ? function (x) { return c.indexOf(x.toLowerCase()) > -1; } : function (x) { return c.indexOf(x) > -1; }; } | ||
@@ -100,2 +100,3 @@ , isProp = validChar('abcdefghijklmnopqrstuvwxyz-') | ||
, isValueSep = validChar(' ,)') | ||
, isNumber = function (x) { return typeof x === 'number'; } | ||
, vendorMap = Object.create(null, {}) | ||
@@ -176,5 +177,4 @@ , vendorValuePrefix = Object.create(null, {}) | ||
? value.map(function (x) { return x.content || x; }).join('\n') | ||
: typeof value === 'object' | ||
? keyframes(value) | ||
: value) + xs[i]; | ||
: value) | ||
+ xs[i]; | ||
} | ||
@@ -199,25 +199,9 @@ | ||
function keyframes(x) { | ||
var content = '{' + | ||
Object.keys(x).reduce(function (acc, key) { return acc + key + '{' + propsParse(x[key].trim()) + '}'; } | ||
, '') | ||
+ '}'; | ||
if (content in cache) | ||
{ return cache[content] } | ||
var name = b.prefix + ++b.count; | ||
cache[content] = name; | ||
insert('@keyframes ' + name + content); | ||
return name | ||
} | ||
function vendor(x) { | ||
if (properties.indexOf(x) === -1) { | ||
if (vendorMap[x]) { | ||
b.debug && console.log(x, 'prefixed to', vendorMap[x]); | ||
b.debug && console.log(x, 'prefixed to', vendorMap[x]); // eslint-disable-line | ||
return vendorMap[x] | ||
} | ||
b.debug && console.log(x, 'not found'); | ||
b.debug && console.log(x, 'not found'); // eslint-disable-line | ||
} | ||
@@ -248,3 +232,3 @@ return x | ||
} catch (e) { | ||
b.debug && console.log('Ignored error:', e); | ||
b.debug && console.log('Ignored error:', e); // eslint-disable-line | ||
} | ||
@@ -271,3 +255,4 @@ } | ||
var at = false | ||
var ani = false | ||
, at = false | ||
, supports = false | ||
@@ -288,4 +273,7 @@ , name = false; | ||
if (s[i] === '}' || i === s.length - 1) { | ||
parseAddProps(at || supports || rules, i, x, props, level); | ||
parseAddProps(ani || at || supports || rules, i, x, props, level); | ||
if (ani && !level.length) { | ||
(at || supports || rules).push(ani.selector + '{' + ani.join('') + '}'); | ||
ani = false; | ||
} | ||
if (at && !level.length) { | ||
@@ -302,3 +290,5 @@ (supports || rules).push(at.selector + '{' + at.join('') + '}'); | ||
var selector = s.slice(props.end, i).trim().replace(/,[\s]*/, ',& '); | ||
parseAddProps(at || supports || rules, i, x, props, level); | ||
if (selector.indexOf('animation') === 0) | ||
{ props.out.push(['animation', selector.slice(10) + ' ' + x]); } | ||
parseAddProps(ani || at || supports || rules, i, x, props, level); | ||
props.prop = props.value = null; | ||
@@ -309,3 +299,5 @@ selector.indexOf('@supports') === 0 | ||
? at = Object.assign([], { selector: ats.reduce(function (acc, fn) { return fn(acc); }, selector.trim()) }) | ||
: level.push(selector); | ||
: selector.indexOf('animation') === 0 | ||
? ani = Object.assign([], { selector: '@keyframes ' + x }) | ||
: level.push(selector); | ||
} | ||
@@ -331,14 +323,2 @@ } | ||
function propsParse(s) { | ||
var x = propsState(); | ||
for (var i = 0; i <= s.length; i++) | ||
{ propsParseLoop(s, i, s[i], x); } | ||
return x.out.reduce(function (acc, ref) { | ||
var a = ref[0]; | ||
var b = ref[1]; | ||
return acc + a + ':' + b + ';'; | ||
}, '') | ||
} | ||
function propsState() { | ||
@@ -364,3 +344,3 @@ return { | ||
x.prop = i; | ||
} else if (typeof x.prop === 'number' && (i === s.length - 1 || (!x.value && (isPropEnd(v) || (x.lean && v === '\n'))))) { | ||
} else if (isNumber(x.prop) && (i === s.length - 1 || (!x.value && (isPropEnd(v) || (x.lean && v === '\n'))))) { | ||
x.value = i + 1; | ||
@@ -375,3 +355,13 @@ } | ||
if (!x.quote && x.prop !== null && (i === s.length - 1 || v === ';' || s[i + 1] === '}' || (x.lean && s[i - 1] !== ',' && v === '\n'))) { | ||
if (!x.quote | ||
&& x.prop !== null | ||
&& (i === s.length - 1 | ||
|| v === ';' | ||
|| s[i + 1] === '}' | ||
|| (x.lean | ||
&& s[i - 1] !== ',' | ||
&& v === '\n' | ||
) | ||
) | ||
) { | ||
x.out.push( | ||
@@ -378,0 +368,0 @@ propParse( |
@@ -7,3 +7,3 @@ (function (global, factory) { | ||
var el = typeof document !== 'undefined' && document.createElement('div'); | ||
var el = typeof document !== 'undefined' && document.createElement('div'); // eslint-disable-line | ||
@@ -42,3 +42,3 @@ var cache = { | ||
.concat(Object.keys( | ||
typeof document === 'undefined' ? {} : findWidth(document.documentElement.style) | ||
typeof document === 'undefined' ? {} : findWidth(document.documentElement.style) // eslint-disable-line | ||
)) | ||
@@ -99,3 +99,3 @@ .filter(function (x, i, xs) { return x.indexOf('-') === -1 && x !== 'length' && xs.indexOf(x) === i; }) | ||
var doc = window && typeof window.document === 'object' && window.document | ||
var doc = document !== 'undefined' && window.document // eslint-disable-line | ||
, validChar = function (c, ci) { return ci ? function (x) { return c.indexOf(x.toLowerCase()) > -1; } : function (x) { return c.indexOf(x) > -1; }; } | ||
@@ -107,2 +107,3 @@ , isProp = validChar('abcdefghijklmnopqrstuvwxyz-') | ||
, isValueSep = validChar(' ,)') | ||
, isNumber = function (x) { return typeof x === 'number'; } | ||
, vendorMap = Object.create(null, {}) | ||
@@ -183,5 +184,4 @@ , vendorValuePrefix = Object.create(null, {}) | ||
? value.map(function (x) { return x.content || x; }).join('\n') | ||
: typeof value === 'object' | ||
? keyframes(value) | ||
: value) + xs[i]; | ||
: value) | ||
+ xs[i]; | ||
} | ||
@@ -206,25 +206,9 @@ | ||
function keyframes(x) { | ||
var content = '{' + | ||
Object.keys(x).reduce(function (acc, key) { return acc + key + '{' + propsParse(x[key].trim()) + '}'; } | ||
, '') | ||
+ '}'; | ||
if (content in cache) | ||
{ return cache[content] } | ||
var name = b.prefix + ++b.count; | ||
cache[content] = name; | ||
insert('@keyframes ' + name + content); | ||
return name | ||
} | ||
function vendor(x) { | ||
if (properties.indexOf(x) === -1) { | ||
if (vendorMap[x]) { | ||
b.debug && console.log(x, 'prefixed to', vendorMap[x]); | ||
b.debug && console.log(x, 'prefixed to', vendorMap[x]); // eslint-disable-line | ||
return vendorMap[x] | ||
} | ||
b.debug && console.log(x, 'not found'); | ||
b.debug && console.log(x, 'not found'); // eslint-disable-line | ||
} | ||
@@ -255,3 +239,3 @@ return x | ||
} catch (e) { | ||
b.debug && console.log('Ignored error:', e); | ||
b.debug && console.log('Ignored error:', e); // eslint-disable-line | ||
} | ||
@@ -278,3 +262,4 @@ } | ||
var at = false | ||
var ani = false | ||
, at = false | ||
, supports = false | ||
@@ -295,4 +280,7 @@ , name = false; | ||
if (s[i] === '}' || i === s.length - 1) { | ||
parseAddProps(at || supports || rules, i, x, props, level); | ||
parseAddProps(ani || at || supports || rules, i, x, props, level); | ||
if (ani && !level.length) { | ||
(at || supports || rules).push(ani.selector + '{' + ani.join('') + '}'); | ||
ani = false; | ||
} | ||
if (at && !level.length) { | ||
@@ -309,3 +297,5 @@ (supports || rules).push(at.selector + '{' + at.join('') + '}'); | ||
var selector = s.slice(props.end, i).trim().replace(/,[\s]*/, ',& '); | ||
parseAddProps(at || supports || rules, i, x, props, level); | ||
if (selector.indexOf('animation') === 0) | ||
{ props.out.push(['animation', selector.slice(10) + ' ' + x]); } | ||
parseAddProps(ani || at || supports || rules, i, x, props, level); | ||
props.prop = props.value = null; | ||
@@ -316,3 +306,5 @@ selector.indexOf('@supports') === 0 | ||
? at = Object.assign([], { selector: ats.reduce(function (acc, fn) { return fn(acc); }, selector.trim()) }) | ||
: level.push(selector); | ||
: selector.indexOf('animation') === 0 | ||
? ani = Object.assign([], { selector: '@keyframes ' + x }) | ||
: level.push(selector); | ||
} | ||
@@ -338,14 +330,2 @@ } | ||
function propsParse(s) { | ||
var x = propsState(); | ||
for (var i = 0; i <= s.length; i++) | ||
{ propsParseLoop(s, i, s[i], x); } | ||
return x.out.reduce(function (acc, ref) { | ||
var a = ref[0]; | ||
var b = ref[1]; | ||
return acc + a + ':' + b + ';'; | ||
}, '') | ||
} | ||
function propsState() { | ||
@@ -371,3 +351,3 @@ return { | ||
x.prop = i; | ||
} else if (typeof x.prop === 'number' && (i === s.length - 1 || (!x.value && (isPropEnd(v) || (x.lean && v === '\n'))))) { | ||
} else if (isNumber(x.prop) && (i === s.length - 1 || (!x.value && (isPropEnd(v) || (x.lean && v === '\n'))))) { | ||
x.value = i + 1; | ||
@@ -382,3 +362,13 @@ } | ||
if (!x.quote && x.prop !== null && (i === s.length - 1 || v === ';' || s[i + 1] === '}' || (x.lean && s[i - 1] !== ',' && v === '\n'))) { | ||
if (!x.quote | ||
&& x.prop !== null | ||
&& (i === s.length - 1 | ||
|| v === ';' | ||
|| s[i + 1] === '}' | ||
|| (x.lean | ||
&& s[i - 1] !== ',' | ||
&& v === '\n' | ||
) | ||
) | ||
) { | ||
x.out.push( | ||
@@ -385,0 +375,0 @@ propParse( |
@@ -1,2 +0,2 @@ | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e=e||self).b=t()}(this,(function(){"use strict";var e="undefined"!=typeof document&&document.createElement("div"),t={flex:0,border:1,transform:1,"line-height":0,"box-shadow":1,"border-top":1,"border-left":1,"border-right":1,"border-bottom":1};function n(n){if(n in t)return t[n];try{return e.style[n]="1px",e.style.setProperty(n,"1px"),t[n]="1px"===e.style[n].slice(-3)}catch(e){return t[n]=!1}}var r=/^(o|O|ms|MS|Ms|moz|Moz|webkit|Webkit|WebKit)([A-Z])/,o=function(e){return e.replace(/(\B[A-Z])/g,"-$1").toLowerCase()},i=function(e){return e?e.hasOwnProperty("width")?e:i(Object.getPrototypeOf(e)):{}},u=["float"].concat(Object.keys("undefined"==typeof document?{}:i(document.documentElement.style))).filter((function(e,t,n){return-1===e.indexOf("-")&&"length"!==e&&n.indexOf(e)===t})).map((function(e){return e.match(r)?"-"+o(e):o(e)})).sort(),l=function(e,t){var n;return Object.assign(e,((n={})[t.split("-").map((function(e){return e[0]})).join("")]=t,n))},c=Object.assign(u.reduce(l,{}),["align-items","bottom","background-color","border-radius","box-shadow","background-image","color","display","float","flex-direction","font-family","font-size","height","justify-content","left","line-height","letter-spacing","margin","margin-bottom","margin-left","margin-right","margin-top","opacity","padding","padding-bottom","padding-left","padding-right","padding-top","right","top","text-align","text-decoration","text-transform","width"].reduce(l,{}));function a(e){return c[e]||e}var s=window&&"object"==typeof window.document&&window.document,f=function(e,t){return t?function(t){return e.indexOf(t.toLowerCase())>-1}:function(t){return e.indexOf(t)>-1}},p=f("abcdefghijklmnopqrstuvwxyz-"),d=f("abcdefghijklmnopqrstuvwxyz0123456789-_",!0),g=f("'\""),m=f(" :"),h=f(" ,)"),v=Object.create(null,{}),b=Object.create(null,{}),x=function(){return"bss"+("000000"+(Math.random()*Math.pow(36,6)|0).toString(36)).slice(-6)};function y(e){void 0===e&&(e={});var t=e.style;void 0===t&&(t=s&&s.querySelector&&s.querySelector(".bss_style")||s.createElement("style"));var r=e.prefix;void 0===r&&(r=t&&t.getAttribute("id")||x());var o=e.append;void 0===o&&(o=!0);var i={},l=[],c=[],f=y();return f.count=0,f.rules=t&&t.textContent&&t.textContent.split(f.prefix+"{}")||[],f.debug=!1,f.dev=!1,f.prefix=r,f.properties=u,f.at=function(e){return c.unshift("function"==typeof e?e:function(t){return e[t.slice(1)]||t})},f.prop=function(e){return l.unshift(e)},f.create=y,f.ssr=function(){return'<style class="bss_style" id="'+f.prefix+'">'+f.rules.join(f.prefix+"{}")+"</style>"},f.global=function(){q(O(f.apply(f,arguments).content).trim(),"__raw").forEach((function(e){return w(e.replace(/.__raw/g,"").trim())}))},f.prop((function(e){if(-1===u.indexOf(e)){if(v[e])return f.debug&&console.log(e,"prefixed to",v[e]),v[e];f.debug&&console.log(e,"not found")}return e})),f.prop(a),t&&(t.id=f.prefix),f;function b(){return this.className?this.className:(this.className=f.prefix+ ++f.count,q(O(this.content).trim(),this.className).forEach(w),this.className)}function y(e){return function(t){for(var n=[],r=arguments.length-1;r-- >0;)n[r]=arguments[r+1];for(var o=(e||"")+t[0],u=1;u<t.length;u++){var l=n[u-1];o+=(l&&l.toString===b?l.content:Array.isArray(l)?l.map((function(e){return e.content||e})).join("\n"):"object"==typeof l?j(l):l)+t[u]}if(o in i)return i[o];var c=y("\n"+o+"\n");return c.toString=c.valueOf=b,c.content=o,i[o]=c,c}}function j(e){var t="{"+Object.keys(e).reduce((function(t,n){return t+n+"{"+function(e){for(var t={prop:null,value:null,out:[],lean:!0,comma:0,end:0,quote:!1},n=0;n<=e.length;n++)z(e,n,e[n],t);return t.out.reduce((function(e,t){return e+t[0]+":"+t[1]+";"}),"")}(e[n].trim())+"}"}),"")+"}";if(t in i)return i[t];var n=f.prefix+ ++f.count;return i[t]=n,w("@keyframes "+n+t),n}function O(e){return e.replace(/\/\/.*?(\n|$)/g,"\n").replace(/\/\*[\s\S]*?\*\//g,"")}function w(e){o&&(t&&s.head&&s.head.appendChild(t),o=!1);var n=0===e.indexOf("@import")?0:f.rules.length;if(0===n?f.rules.unshift(e):f.rules.push(e),f.dev&&t)t.textContent=f.rules.map(k).join("\n");else if(t&&t.sheet)try{t.sheet.insertRule(e,n)}catch(e){f.debug&&console.log("Ignored error:",e)}}function k(e){return e.replace(/{/g," {\n").replace(/([;{])\n*/g,"$1\n ").replace(/(.*):(.*);/g,"$1: $2;").replace(/[\s]*}/g,"\n}\n").replace(/,\s*/g,", ").replace(/@.*{[\s\S]*?}[\s]*}/g,(function(e){return e.split("\n").reduce((function(e,t,n,r){return e+(n<r.length-1?"\n":"")+(n>1&&n<r.length-2?" ":"")+t}),"")})).trim().replace("}\n\n}","}\n}")}function q(e,t){for(var n=[],r={prop:null,value:null,out:[],lean:!0,comma:0,end:0,quote:!1},o=[],i=!1,u=!1,l=!1,a=0;a<e.length;a++)if(a>0&&l&&!d(e[a])&&(t=e.slice(1,a)+"-"+t,l=!1),l||0===a&&"."===e[a])l=!0;else if(z(e,a,e[a],r),"}"===e[a]||a===e.length-1)$(i||u||n,a,t,r,o),i&&!o.length&&((u||n).push(i.selector+"{"+i.join("")+"}"),i=!1),u&&!o.length&&(n.push(u.selector+"{"+u.join("")+"}"),u=!1),o.pop();else if("{"===e[a]){var s=e.slice(r.end,a).trim().replace(/,[\s]*/,",& ");$(i||u||n,a,t,r,o),r.prop=r.value=null,0===s.indexOf("@supports")?u=Object.assign([],{selector:s}):"@"===s[0]?i=Object.assign([],{selector:c.reduce((function(e,t){return t(e)}),s.trim())}):o.push(s)}return n}function $(e,t,n,r,o){var i=r.out.length&&r.out.map((function(e){return e.join(":")})).join(";");i&&e.push((o.length&&"&"===o[0][0]||0===(!e.selector||e.selector.indexOf("@keyframes "))?"":"."+n+(o.length&&":"!==o[0][0]?" ":""))+o.join(" ").replace(/&/g,"."+n).replace(/ :/g,":")+"{"+i+";}"),r.end=t+1,r.out=[]}function z(e,t,r,o){!o.value&&null!==o.prop&&o.lean&&":"===r&&(o.lean=!1),!o.value&&null!==o.prop&&o.out.length&&","===r?(o.value=o.comma,o.prop=o.out[o.out.length-1][0]):!o.value&&null===o.prop&&p(r)?o.prop=t:"number"==typeof o.prop&&(t===e.length-1||!o.value&&(m(r)||o.lean&&"\n"===r))&&(o.value=t+1),function(e,t,r,o){o.value&&g(r)&&(o.quote=!o.quote);!o.quote&&null!==o.prop&&(t===e.length-1||";"===r||"}"===e[t+1]||o.lean&&","!==e[t-1]&&"\n"===r)&&(o.out.push(function(e){var t=e[0],r=e[1];t=l.reduce((function(e,t){return t(e)}),t.trim());for(var o="",i=0,u="px",c=0;c<r.length;c++){if(h(r[c])||c===r.length-1){var a=r.slice(i,c+1).trim();o+=(u&&n(t)?a.replace(/(^|[( ,])([-0-9.]+)([ ,)]|$)/g,"$1$2"+u+"$3").trim():a)+(","===r[c]?"":" "),i=c+1}"("!==r[c]&&")"!==r[c-1]||(u=0===r.slice(i,c).indexOf("translate")?"px":0===r.slice(i,c).indexOf("rotate")?"deg":"")}return[t,o.trim().replace(/[\n ]+/g," ")]}(e.slice(o.prop,t+1).match(/\s*([a-z-]+)[\s:]*([^;]+)/).slice(1))),o.end=t+1,o.comma=o.value,o.value=o.prop=null,o.lean=!0)}(e,t,r,o)}}u.forEach((function(e){var t=e.match(/-(ms|o|webkit|moz)-/g);if(t){var n=e.replace(/-(ms|o|webkit|moz)-/,"");if(-1===u.indexOf(n))return"flexDirection"===n&&(b.flex="-"+t[1].toLowerCase()+"-flex"),void(v[n]=e)}}));var j=y();return j.create=y,j})); | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e=e||self).b=t()}(this,(function(){"use strict";var e="undefined"!=typeof document&&document.createElement("div"),t={flex:0,border:1,transform:1,"line-height":0,"box-shadow":1,"border-top":1,"border-left":1,"border-right":1,"border-bottom":1};function n(n){if(n in t)return t[n];try{return e.style[n]="1px",e.style.setProperty(n,"1px"),t[n]="1px"===e.style[n].slice(-3)}catch(e){return t[n]=!1}}var r=/^(o|O|ms|MS|Ms|moz|Moz|webkit|Webkit|WebKit)([A-Z])/,o=function(e){return e.replace(/(\B[A-Z])/g,"-$1").toLowerCase()},i=function(e){return e?e.hasOwnProperty("width")?e:i(Object.getPrototypeOf(e)):{}},u=["float"].concat(Object.keys("undefined"==typeof document?{}:i(document.documentElement.style))).filter((function(e,t,n){return-1===e.indexOf("-")&&"length"!==e&&n.indexOf(e)===t})).map((function(e){return e.match(r)?"-"+o(e):o(e)})).sort(),l=function(e,t){var n;return Object.assign(e,((n={})[t.split("-").map((function(e){return e[0]})).join("")]=t,n))},a=Object.assign(u.reduce(l,{}),["align-items","bottom","background-color","border-radius","box-shadow","background-image","color","display","float","flex-direction","font-family","font-size","height","justify-content","left","line-height","letter-spacing","margin","margin-bottom","margin-left","margin-right","margin-top","opacity","padding","padding-bottom","padding-left","padding-right","padding-top","right","top","text-align","text-decoration","text-transform","width"].reduce(l,{}));function c(e){return a[e]||e}var s="undefined"!==document&&window.document,f=function(e,t){return t?function(t){return e.indexOf(t.toLowerCase())>-1}:function(t){return e.indexOf(t)>-1}},p=f("abcdefghijklmnopqrstuvwxyz-"),d=f("abcdefghijklmnopqrstuvwxyz0123456789-_",!0),g=f("'\""),m=f(" :"),h=f(" ,)"),v=function(e){return"number"==typeof e},x=Object.create(null,{}),b=Object.create(null,{}),y=function(){return"bss"+("000000"+(Math.random()*Math.pow(36,6)|0).toString(36)).slice(-6)};function O(e){void 0===e&&(e={});var t=e.style;void 0===t&&(t=s&&s.querySelector&&s.querySelector(".bss_style")||s.createElement("style"));var r=e.prefix;void 0===r&&(r=t&&t.getAttribute("id")||y());var o=e.append;void 0===o&&(o=!0);var i={},l=[],a=[],f=O();return f.count=0,f.rules=t&&t.textContent&&t.textContent.split(f.prefix+"{}")||[],f.debug=!1,f.dev=!1,f.prefix=r,f.properties=u,f.at=function(e){return a.unshift("function"==typeof e?e:function(t){return e[t.slice(1)]||t})},f.prop=function(e){return l.unshift(e)},f.create=O,f.ssr=function(){return'<style class="bss_style" id="'+f.prefix+'">'+f.rules.join(f.prefix+"{}")+"</style>"},f.global=function(){$(j(f.apply(f,arguments).content).trim(),"__raw").forEach((function(e){return w(e.replace(/.__raw/g,"").trim())}))},f.prop((function(e){if(-1===u.indexOf(e)){if(x[e])return f.debug&&console.log(e,"prefixed to",x[e]),x[e];f.debug&&console.log(e,"not found")}return e})),f.prop(c),t&&(t.id=f.prefix),f;function b(){return this.className?this.className:(this.className=f.prefix+ ++f.count,$(j(this.content).trim(),this.className).forEach(w),this.className)}function O(e){return function(t){for(var n=[],r=arguments.length-1;r-- >0;)n[r]=arguments[r+1];for(var o=(e||"")+t[0],u=1;u<t.length;u++){var l=n[u-1];o+=(l&&l.toString===b?l.content:Array.isArray(l)?l.map((function(e){return e.content||e})).join("\n"):l)+t[u]}if(o in i)return i[o];var a=O("\n"+o+"\n");return a.toString=a.valueOf=b,a.content=o,i[o]=a,a}}function j(e){return e.replace(/\/\/.*?(\n|$)/g,"\n").replace(/\/\*[\s\S]*?\*\//g,"")}function w(e){o&&(t&&s.head&&s.head.appendChild(t),o=!1);var n=0===e.indexOf("@import")?0:f.rules.length;if(0===n?f.rules.unshift(e):f.rules.push(e),f.dev&&t)t.textContent=f.rules.map(k).join("\n");else if(t&&t.sheet)try{t.sheet.insertRule(e,n)}catch(e){f.debug&&console.log("Ignored error:",e)}}function k(e){return e.replace(/{/g," {\n").replace(/([;{])\n*/g,"$1\n ").replace(/(.*):(.*);/g,"$1: $2;").replace(/[\s]*}/g,"\n}\n").replace(/,\s*/g,", ").replace(/@.*{[\s\S]*?}[\s]*}/g,(function(e){return e.split("\n").reduce((function(e,t,n,r){return e+(n<r.length-1?"\n":"")+(n>1&&n<r.length-2?" ":"")+t}),"")})).trim().replace("}\n\n}","}\n}")}function $(e,t){for(var n=[],r={prop:null,value:null,out:[],lean:!0,comma:0,end:0,quote:!1},o=[],i=!1,u=!1,l=!1,c=!1,s=0;s<e.length;s++)if(s>0&&c&&!d(e[s])&&(t=e.slice(1,s)+"-"+t,c=!1),c||0===s&&"."===e[s])c=!0;else if(z(e,s,e[s],r),"}"===e[s]||s===e.length-1)q(i||u||l||n,s,t,r,o),i&&!o.length&&((u||l||n).push(i.selector+"{"+i.join("")+"}"),i=!1),u&&!o.length&&((l||n).push(u.selector+"{"+u.join("")+"}"),u=!1),l&&!o.length&&(n.push(l.selector+"{"+l.join("")+"}"),l=!1),o.pop();else if("{"===e[s]){var f=e.slice(r.end,s).trim().replace(/,[\s]*/,",& ");0===f.indexOf("animation")&&r.out.push(["animation",f.slice(10)+" "+t]),q(i||u||l||n,s,t,r,o),r.prop=r.value=null,0===f.indexOf("@supports")?l=Object.assign([],{selector:f}):"@"===f[0]?u=Object.assign([],{selector:a.reduce((function(e,t){return t(e)}),f.trim())}):0===f.indexOf("animation")?i=Object.assign([],{selector:"@keyframes "+t}):o.push(f)}return n}function q(e,t,n,r,o){var i=r.out.length&&r.out.map((function(e){return e.join(":")})).join(";");i&&e.push((o.length&&"&"===o[0][0]||0===(!e.selector||e.selector.indexOf("@keyframes "))?"":"."+n+(o.length&&":"!==o[0][0]?" ":""))+o.join(" ").replace(/&/g,"."+n).replace(/ :/g,":")+"{"+i+";}"),r.end=t+1,r.out=[]}function z(e,t,r,o){!o.value&&null!==o.prop&&o.lean&&":"===r&&(o.lean=!1),!o.value&&null!==o.prop&&o.out.length&&","===r?(o.value=o.comma,o.prop=o.out[o.out.length-1][0]):!o.value&&null===o.prop&&p(r)?o.prop=t:v(o.prop)&&(t===e.length-1||!o.value&&(m(r)||o.lean&&"\n"===r))&&(o.value=t+1),function(e,t,r,o){o.value&&g(r)&&(o.quote=!o.quote);!o.quote&&null!==o.prop&&(t===e.length-1||";"===r||"}"===e[t+1]||o.lean&&","!==e[t-1]&&"\n"===r)&&(o.out.push(function(e){var t=e[0],r=e[1];t=l.reduce((function(e,t){return t(e)}),t.trim());for(var o="",i=0,u="px",a=0;a<r.length;a++){if(h(r[a])||a===r.length-1){var c=r.slice(i,a+1).trim();o+=(u&&n(t)?c.replace(/(^|[( ,])([-0-9.]+)([ ,)]|$)/g,"$1$2"+u+"$3").trim():c)+(","===r[a]?"":" "),i=a+1}"("!==r[a]&&")"!==r[a-1]||(u=0===r.slice(i,a).indexOf("translate")?"px":0===r.slice(i,a).indexOf("rotate")?"deg":"")}return[t,o.trim().replace(/[\n ]+/g," ")]}(e.slice(o.prop,t+1).match(/\s*([a-z-]+)[\s:]*([^;]+)/).slice(1))),o.end=t+1,o.comma=o.value,o.value=o.prop=null,o.lean=!0)}(e,t,r,o)}}u.forEach((function(e){var t=e.match(/-(ms|o|webkit|moz)-/g);if(t){var n=e.replace(/-(ms|o|webkit|moz)-/,"");if(-1===u.indexOf(n))return"flexDirection"===n&&(b.flex="-"+t[1].toLowerCase()+"-flex"),void(x[n]=e)}}));var j=O();return j.create=O,j})); | ||
//# sourceMappingURL=bss.min.js.map |
@@ -5,3 +5,3 @@ import px from './px.js' | ||
const doc = window && typeof window.document === 'object' && window.document | ||
const doc = document !== 'undefined' && window.document // eslint-disable-line | ||
, validChar = (c, ci) => ci ? x => c.indexOf(x.toLowerCase()) > -1 : x => c.indexOf(x) > -1 | ||
@@ -13,2 +13,3 @@ , isProp = validChar('abcdefghijklmnopqrstuvwxyz-') | ||
, isValueSep = validChar(' ,)') | ||
, isNumber = x => typeof x === 'number' | ||
, vendorMap = Object.create(null, {}) | ||
@@ -86,5 +87,4 @@ , vendorValuePrefix = Object.create(null, {}) | ||
? value.map(x => x.content || x).join('\n') | ||
: typeof value === 'object' | ||
? keyframes(value) | ||
: value) + xs[i] | ||
: value) | ||
+ xs[i] | ||
} | ||
@@ -109,26 +109,9 @@ | ||
function keyframes(x) { | ||
const content = '{' + | ||
Object.keys(x).reduce((acc, key) => | ||
acc + key + '{' + propsParse(x[key].trim()) + '}' | ||
, '') | ||
+ '}' | ||
if (content in cache) | ||
return cache[content] | ||
const name = b.prefix + ++b.count | ||
cache[content] = name | ||
insert('@keyframes ' + name + content) | ||
return name | ||
} | ||
function vendor(x) { | ||
if (properties.indexOf(x) === -1) { | ||
if (vendorMap[x]) { | ||
b.debug && console.log(x, 'prefixed to', vendorMap[x]) | ||
b.debug && console.log(x, 'prefixed to', vendorMap[x]) // eslint-disable-line | ||
return vendorMap[x] | ||
} | ||
b.debug && console.log(x, 'not found') | ||
b.debug && console.log(x, 'not found') // eslint-disable-line | ||
} | ||
@@ -159,3 +142,3 @@ return x | ||
} catch (e) { | ||
b.debug && console.log('Ignored error:', e) | ||
b.debug && console.log('Ignored error:', e) // eslint-disable-line | ||
} | ||
@@ -184,3 +167,4 @@ } | ||
let at = false | ||
let ani = false | ||
, at = false | ||
, supports = false | ||
@@ -201,4 +185,7 @@ , name = false | ||
if (s[i] === '}' || i === s.length - 1) { | ||
parseAddProps(at || supports || rules, i, x, props, level) | ||
parseAddProps(ani || at || supports || rules, i, x, props, level) | ||
if (ani && !level.length) { | ||
(at || supports || rules).push(ani.selector + '{' + ani.join('') + '}') | ||
ani = false | ||
} | ||
if (at && !level.length) { | ||
@@ -215,3 +202,5 @@ (supports || rules).push(at.selector + '{' + at.join('') + '}') | ||
const selector = s.slice(props.end, i).trim().replace(/,[\s]*/, ',& ') | ||
parseAddProps(at || supports || rules, i, x, props, level) | ||
if (selector.indexOf('animation') === 0) | ||
props.out.push(['animation', selector.slice(10) + ' ' + x]) | ||
parseAddProps(ani || at || supports || rules, i, x, props, level) | ||
props.prop = props.value = null | ||
@@ -222,3 +211,5 @@ selector.indexOf('@supports') === 0 | ||
? at = Object.assign([], { selector: ats.reduce((acc, fn) => fn(acc), selector.trim()) }) | ||
: level.push(selector) | ||
: selector.indexOf('animation') === 0 | ||
? ani = Object.assign([], { selector: '@keyframes ' + x }) | ||
: level.push(selector) | ||
} | ||
@@ -244,3 +235,3 @@ } | ||
function propsParse(s) { | ||
function propsParse(s) { // eslint-disable-line | ||
const x = propsState() | ||
@@ -272,3 +263,3 @@ for (let i = 0; i <= s.length; i++) | ||
x.prop = i | ||
} else if (typeof x.prop === 'number' && (i === s.length - 1 || (!x.value && (isPropEnd(v) || (x.lean && v === '\n'))))) { | ||
} else if (isNumber(x.prop) && (i === s.length - 1 || (!x.value && (isPropEnd(v) || (x.lean && v === '\n'))))) { | ||
x.value = i + 1 | ||
@@ -283,3 +274,13 @@ } | ||
if (!x.quote && x.prop !== null && (i === s.length - 1 || v === ';' || s[i + 1] === '}' || (x.lean && s[i - 1] !== ',' && v === '\n'))) { | ||
if (!x.quote | ||
&& x.prop !== null | ||
&& (i === s.length - 1 | ||
|| v === ';' | ||
|| s[i + 1] === '}' | ||
|| (x.lean | ||
&& s[i - 1] !== ',' | ||
&& v === '\n' | ||
) | ||
) | ||
) { | ||
x.out.push( | ||
@@ -286,0 +287,0 @@ propParse( |
@@ -8,3 +8,3 @@ const vendorRegex = /^(o|O|ms|MS|Ms|moz|Moz|webkit|Webkit|WebKit)([A-Z])/ | ||
.concat(Object.keys( | ||
typeof document === 'undefined' ? {} : findWidth(document.documentElement.style) | ||
typeof document === 'undefined' ? {} : findWidth(document.documentElement.style) // eslint-disable-line | ||
)) | ||
@@ -11,0 +11,0 @@ .filter((x, i, xs) => x.indexOf('-') === -1 && x !== 'length' && xs.indexOf(x) === i) |
@@ -1,2 +0,2 @@ | ||
const el = typeof document !== 'undefined' && document.createElement('div') | ||
const el = typeof document !== 'undefined' && document.createElement('div') // eslint-disable-line | ||
@@ -3,0 +3,0 @@ const cache = { |
{ | ||
"name": "bss", | ||
"version": "3.0.0-beta5", | ||
"version": "3.0.0-rc.1", | ||
"description": "Better Style Sheets", | ||
@@ -8,4 +8,5 @@ "main": "dist/bss.js", | ||
"scripts": { | ||
"test": "TEST=true npm run build && ospec", | ||
"prepublishOnly": "npm run build", | ||
"test": "TEST=true npm run build && node tests/index.js", | ||
"lint": "eslint lib && eslint tests", | ||
"prepublishOnly": "npm run lint && npm run build", | ||
"build": "rollup -c" | ||
@@ -17,3 +18,2 @@ }, | ||
"devDependencies": { | ||
"ospec": "3.1.0", | ||
"rollup": "1.14.6", | ||
@@ -20,0 +20,0 @@ "rollup-plugin-buble": "0.19.6", |
@@ -1,2 +0,2 @@ | ||
const o = require('ospec') | ||
const { t, ot, not } = require('./test') | ||
@@ -62,132 +62,179 @@ const styleEl = function() { | ||
o.spec('bss', function() { | ||
t('global', () => { | ||
b.global` | ||
html { | ||
width 50 | ||
} | ||
` | ||
return [ | ||
b.rules.pop(), | ||
'html{width:50px;}' | ||
] | ||
}) | ||
o.beforeEach(() => { | ||
b.rules = [] | ||
b.count = 0 | ||
}) | ||
o('global', () => { | ||
b.global` | ||
html { | ||
width 50 | ||
} | ||
` | ||
o(b.rules.pop()).equals('html{width:50px;}') | ||
}) | ||
o('Nested classes', () => { | ||
b` | ||
t('Nested classes', () => { | ||
b` | ||
${ b` | ||
c white | ||
${ b` | ||
c white | ||
${ b` | ||
position relative | ||
${ b`font-size 20` } | ||
`} | ||
position relative | ||
${ b`font-size 20` } | ||
`} | ||
bc blue | ||
`.toString() | ||
`} | ||
bc blue | ||
`.toString() | ||
o(b.rules.shift().replace(/.*{/, '{')).equals( | ||
'{color:white;position:relative;font-size:20px;background-color:blue;}' | ||
) | ||
}) | ||
return [ | ||
b.rules.shift().replace(/.*{/, '{'), | ||
'{color:white;position:relative;font-size:20px;background-color:blue;}' | ||
] | ||
}) | ||
o('Pseudo works', () => { | ||
b` | ||
:hover { | ||
opacity 0.5 | ||
} | ||
`.toString() | ||
o(b.rules.pop()).equals(cn() + ':hover{opacity:0.5;}') | ||
}) | ||
t('Pseudo works', () => { | ||
b` | ||
:hover { | ||
opacity 0.5 | ||
} | ||
`.toString() | ||
o('Fails gracefully on bad prop syntax', () => { | ||
b` | ||
transform translateY(20) | ||
rotate(${ 'sdfk' }) | ||
`.toString() | ||
o(b.rules.pop()).equals(cn() + '{transform:translateY(20px);rotate:(sdfk);}') | ||
}) | ||
return [ | ||
b.rules.pop(), | ||
cn() + ':hover{opacity:0.5;}' | ||
] | ||
}) | ||
o('Support multiline props', () => { | ||
b` | ||
transform: translateY(20) | ||
rotate(${ 'sdfk' }); | ||
`.toString() | ||
o(b.rules.pop()).equals(cn() + '{transform:translateY(20px) rotate(sdfk);}') | ||
}) | ||
t('Fails gracefully on bad prop syntax', () => { | ||
b` | ||
transform translateY(20) | ||
rotate(${ 'sdfk' }) | ||
`.toString() | ||
o('White space around colon', () => { | ||
b`position:absolute; | ||
position: absolute; | ||
position :absolute; | ||
position : absolute; | ||
position: | ||
absolute; | ||
position: | ||
absolute`.toString() | ||
o(b.rules.pop()).equals(cn() + | ||
'{position:absolute;position:absolute;position:absolute;position:absolute;position:absolute;position:absolute;}' | ||
) | ||
}) | ||
return [ | ||
b.rules.pop(), | ||
cn() + '{transform:translateY(20px);rotate:(sdfk);}' | ||
] | ||
}) | ||
o('Multiline property values', () => { | ||
b`position: absolute; | ||
transform: translate(-50%, -50%) | ||
rotate(-45deg);`.toString() | ||
o(b.rules.pop()).equals(cn() + '{position:absolute;transform:translate(-50%, -50%) rotate(-45deg);}') | ||
}) | ||
t('Support multiline props', () => { | ||
b` | ||
transform: translateY(20) | ||
rotate(${ 'sdfk' }); | ||
`.toString() | ||
o('Comments in strings', () => { | ||
b`position: absolute; // This is absolute | ||
transform: translate(-50%, -50%) // This is multi line | ||
rotate(-45deg); // And here it ends`.toString() | ||
o(b.rules.pop()).equals(cn() + '{position:absolute;transform:translate(-50%, -50%) rotate(-45deg);}') | ||
}) | ||
return [ | ||
b.rules.pop(), | ||
cn() + '{transform:translateY(20px) rotate(sdfk);}' | ||
] | ||
}) | ||
o('@keyframes', () => { | ||
b` | ||
@keyframes wat { | ||
from { margin-top: 50px; } | ||
50% { margin-top: 150px; } | ||
to { margin-top: 100px; } | ||
t('White space around colon', () => { | ||
b`position:absolute; | ||
position: absolute; | ||
position :absolute; | ||
position : absolute; | ||
position: | ||
absolute; | ||
position: | ||
absolute`.toString() | ||
return [ | ||
b.rules.pop(), | ||
cn() + '{position:absolute;position:absolute;position:absolute;' | ||
+ 'position:absolute;position:absolute;position:absolute;}' | ||
] | ||
}) | ||
t('Multiline property values', () => { | ||
b`position: absolute; | ||
transform: translate(-50%, -50%) | ||
rotate(-45deg);`.toString() | ||
return [ | ||
b.rules.pop(), | ||
cn() + '{position:absolute;transform:translate(-50%, -50%) rotate(-45deg);}' | ||
] | ||
}) | ||
t('Comments in strings', () => { | ||
b`position: absolute; // This is absolute | ||
transform: translate(-50%, -50%) // This is multi line | ||
rotate(-45deg); // And here it ends`.toString() | ||
return [ | ||
b.rules.pop(), | ||
cn() + '{position:absolute;transform:translate(-50%, -50%) rotate(-45deg);}' | ||
] | ||
}) | ||
t('@keyframes', () => { | ||
b` | ||
@keyframes wat { | ||
from { margin-top: 50px; } | ||
50% { margin-top: 150px; } | ||
to { margin-top: 100px; } | ||
} | ||
`.toString() | ||
return [ | ||
b.rules.pop(), | ||
'@keyframes wat{from{margin-top:50px;}50%{margin-top:150px;}to{margin-top:100px;}}' | ||
] | ||
}) | ||
t('@media', () => { | ||
b` | ||
@media screen and (min-width: 900px) { | ||
article { | ||
padding: 1rem 3rem; | ||
} | ||
`.toString() | ||
o(b.rules.pop()).equals('@keyframes wat{from{margin-top:50px;}50%{margin-top:150px;}to{margin-top:100px;}}') | ||
}) | ||
} | ||
`.toString() | ||
o('@media', () => { | ||
b` | ||
@media screen and (min-width: 900px) { | ||
article { | ||
padding: 1rem 3rem; | ||
} | ||
return [ | ||
b.rules.pop(), | ||
'@media screen and (min-width: 900px){' + cn() + ' article{padding:1rem 3rem;}}' | ||
] | ||
}) | ||
t('@media @media', () => { | ||
b` | ||
@media screen and (min-width: 900px) { | ||
article { | ||
padding: 1rem 3rem; | ||
} | ||
`.toString() | ||
o(b.rules.pop()).equals('@media screen and (min-width: 900px){' + cn() + ' article{padding:1rem 3rem;}}') | ||
}) | ||
} | ||
o('@media @media', () => { | ||
b` | ||
@media screen and (min-width: 900px) { | ||
article { | ||
padding: 1rem 3rem; | ||
} | ||
@media screen and (min-width: 1500px) { | ||
article { | ||
padding: 2rem 6rem; | ||
} | ||
} | ||
`.toString() | ||
@media screen and (min-width: 1500px) { | ||
article { | ||
padding: 2rem 6rem; | ||
} | ||
return [ | ||
b.rules.pop() | ||
+ b.rules.pop(), | ||
'@media screen and (min-width: 1500px){' + cn() + ' article{padding:2rem 6rem;}}' | ||
+ '@media screen and (min-width: 900px){' + cn() + ' article{padding:1rem 3rem;}}' | ||
] | ||
}) | ||
t('@supports', () => { | ||
b` | ||
@supports (display: flex) { | ||
article { | ||
display: flex; | ||
} | ||
`.toString() | ||
} | ||
`.toString() | ||
o(b.rules.pop()).equals('@media screen and (min-width: 1500px){' + cn() + ' article{padding:2rem 6rem;}}') | ||
o(b.rules.pop()).equals('@media screen and (min-width: 900px){' + cn() + ' article{padding:1rem 3rem;}}') | ||
}) | ||
return [ | ||
b.rules.pop(), | ||
'@supports (display: flex){' + cn() + ' article{display:flex;}}' | ||
] | ||
}) | ||
o('@supports', () => { | ||
b` | ||
@supports (display: flex) { | ||
t('@media inside @supports', () => { | ||
b` | ||
@supports (display: flex) { | ||
@media screen and (min-width: 900px) { | ||
article { | ||
@@ -197,82 +244,90 @@ display: flex; | ||
} | ||
`.toString() | ||
o(b.rules.pop()).equals('@supports (display: flex){' + cn() + ' article{display:flex;}}') | ||
}) | ||
} | ||
`.toString() | ||
return [ | ||
b.rules.pop(), | ||
'@supports (display: flex){@media screen and (min-width: 900px){' + cn() + ' article{display:flex;}}}' | ||
] | ||
}) | ||
o('@media inside @supports', () => { | ||
b` | ||
@supports (display: flex) { | ||
@media screen and (min-width: 900px) { | ||
article { | ||
display: flex; | ||
} | ||
} | ||
} | ||
`.toString() | ||
o(b.rules.pop()).equals( | ||
'@supports (display: flex){@media screen and (min-width: 900px){' + cn() + ' article{display:flex;}}}' | ||
) | ||
}) | ||
t('Nested comma selectors are all wrapped', () => { | ||
b` | ||
div,span { | ||
o 0 | ||
} | ||
`.toString() | ||
o('Nested comma selectors are all wrapped', () => { | ||
b` | ||
div,span { | ||
o 0 | ||
} | ||
`.toString() | ||
o(b.rules.pop()).equals(cn() + ' div,' + cn() + ' span{opacity:0;}') | ||
}) | ||
return [ | ||
b.rules.pop(), | ||
cn() + ' div,' + cn() + ' span{opacity:0;}' | ||
] | ||
}) | ||
o('Auto px', () => { | ||
b` | ||
bc rgba(200,200,200,0.5) | ||
border 10 solid rgb(255,0,0) | ||
transform translate(60) rotate(40) | ||
`.toString() | ||
o(b.rules.pop()).equals(cn() + '{' | ||
+ 'background-color:rgba(200,200,200,0.5);' | ||
+ 'border:10px solid rgb(255,0,0);' | ||
+ 'transform:translate(60px) rotate(40deg);' | ||
+ '}' | ||
) | ||
}) | ||
t('Auto px', () => { | ||
b` | ||
bc rgba(200,200,200,0.5) | ||
border 10 solid rgb(255,0,0) | ||
transform translate(60) rotate(40) | ||
`.toString() | ||
return [ | ||
b.rules.pop(), | ||
cn() + '{' | ||
+ 'background-color:rgba(200,200,200,0.5);' | ||
+ 'border:10px solid rgb(255,0,0);' | ||
+ 'transform:translate(60px) rotate(40deg);' | ||
+ '}' | ||
] | ||
}) | ||
o('Inline animation', () => { | ||
b`animation 1s ${{ | ||
from: 'margin-bottom 0', | ||
'50%': 'margin-top 50', | ||
to: 'margin-top 100' | ||
}} | ||
`.toString() | ||
o(b.rules.pop()).equals(cn() + '{animation:1s ' + (b.prefix + (b.count - 1)) + ';}') | ||
o(b.rules.pop()).equals('@keyframes ' + b.prefix + '1{from{margin-bottom:0px;}50%{margin-top:50px;}to{margin-top:100px;}}') | ||
}) | ||
t('Inline animation', () => { | ||
b`animation 1s { | ||
from { margin-bottom 0 } | ||
50% { margin-top 50 } | ||
to { margin-top 100 } | ||
} | ||
`.toString() | ||
o('Chaining composition', () => { | ||
const red = b`bc red` | ||
red` | ||
c white | ||
`.toString() | ||
o(b.rules.pop()).equals(cn() + '{background-color:red;color:white;}') | ||
}) | ||
return [ | ||
b.rules.pop() + b.rules.pop(), | ||
'@keyframes ' + b.prefix + b.count + '{from{margin-bottom:0px;}50%{margin-top:50px;}to{margin-top:100px;}}' | ||
+ cn() + '{animation:1s ' + b.prefix + b.count + ';}' | ||
] | ||
}) | ||
o('Inline mixin', () => { | ||
const red = b`bc red` | ||
b` | ||
${ red } | ||
c white | ||
`.toString() | ||
o(b.rules.pop()).equals(cn() + '{background-color:red;color:white;}') | ||
}) | ||
t('Chaining composition', () => { | ||
const red = b`bc red` | ||
red` | ||
c white | ||
`.toString() | ||
o('Inline mixins', () => { | ||
const red = b`bc red` | ||
, round = b`br 10` | ||
b` | ||
${ [red, round] } | ||
c white | ||
`.toString() | ||
o(b.rules.pop()).equals(cn() + '{background-color:red;border-radius:10px;color:white;}') | ||
}) | ||
return [ | ||
b.rules.pop(), | ||
cn() + '{background-color:red;color:white;}' | ||
] | ||
}) | ||
t('Inline mixin', () => { | ||
const red = b`bc red` | ||
b` | ||
${ red } | ||
c white | ||
`.toString() | ||
return [ | ||
b.rules.pop(), | ||
cn() + '{background-color:red;color:white;}' | ||
] | ||
}) | ||
t('Inline mixins', () => { | ||
const red = b`bc red` | ||
, round = b`br 10` | ||
b` | ||
${ [red, round] } | ||
c white | ||
`.toString() | ||
return [ | ||
b.rules.pop(), | ||
cn() + '{background-color:red;border-radius:10px;color:white;}' | ||
] | ||
}) |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
144313
4
20
1714