Comparing version 1.1.6 to 1.1.7
@@ -22,2 +22,3 @@ (function (global, factory) { | ||
l : 'left', | ||
lh : 'lineHeight', | ||
ls : 'letterSpacing', | ||
@@ -69,3 +70,3 @@ m : 'margin', | ||
line = last + line.trim(); | ||
last = line.endsWith(',') ? line : ''; | ||
last = line.slice(-1) === ',' ? line : ''; | ||
if (last) | ||
@@ -242,3 +243,3 @@ { return acc } | ||
if (debug) | ||
{ return styleSheet.textContent += rule } | ||
{ return styleSheet.textContent = rules.join('\n') } | ||
@@ -245,0 +246,0 @@ sheet && sheet.insertRule(rule, arguments.length > 1 |
@@ -1,2 +0,2 @@ | ||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):t.b=e()}(this,function(){"use strict";var t={ai:"alignItems",b:"bottom",bc:"backgroundColor",br:"borderRadius",bs:"boxShadow",c:"color",d:"display",f:"float",fd:"flexDirection",ff:"fontFamily",fs:"fontSize",h:"height",jc:"justifyContent",l:"left",ls:"letterSpacing",m:"margin",mb:"marginBottom",ml:"marginLeft",mr:"marginRight",mt:"marginTop",o:"opacity",p:"padding",pb:"paddingBottom",pl:"paddingLeft",pr:"paddingRight",pt:"paddingTop",r:"right",t:"top",ta:"textAlign",td:"textDecoration",tt:"textTransform",w:"width"},e=Object.create(null),r=Object.keys(function t(e){return e.hasOwnProperty("width")?e:t(Object.getPrototypeOf(e))}(document.documentElement.style)).filter(function(t){return-1===t.indexOf("-")&&"length"!==t});var n=function(t,e){return void 0===e&&(e={}),function(r){return r in e?e[r]:e[r]=t(r)}},i=n(function(t){var r,n="";return t.replace(/;/g,"\n").split("\n").reduce(function(t,i){if(i=n+i.trim(),n=i.endsWith(",")?i:"")return t;if(i.startsWith(","))return t[r]+=i,t;var o=i.split(/[:\s]/);if(o.length>1){var a=l(o.shift().trim());t[r=e[a]||a]=o.filter(function(t){return t}).reduce(function(t,e){return t+d(r,e.trim())+" "},"").trim()}return t},{})}),o=Object.create(null,{}),a=/^(o|O|ms|MS|Ms|moz|Moz|webkit|Webkit|WebKit)([A-Z])/;function c(t,e){var r,n;return"string"==typeof t?"string"==typeof e||"number"==typeof e?((r={})[t]=e,r):i(t):Array.isArray(t)&&Array.isArray(t.raw)?(arguments[0]={raw:t},i(String.raw.apply(null,arguments))):t.style||(n=t,Object.keys(n).reduce(function(t,e){var r=n[e];return r||0===r||""===r?("content"===e&&'"'!==r.charAt(0)?t[e]='"'+r+'"':t[e in o?o[e]:e]=d(e,r),t):t},{}))}var u=n(function(t){var e=document.createElement("div");try{return e.style[t]="1px",e.style.setProperty(t,"1px"),"1px"===e.style[t].slice(-3)?"px":""}catch(t){return""}},{flex:""});function f(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])}function l(t){return t.slice("-"===t.charAt(0)?1:0).replace(/-([a-z])/g,function(t){return t[1].toUpperCase()})}function s(r){var n,i=(n=r).charAt(0)+(n.match(/([A-Z])/g)||[]).join("").toLowerCase(),o=t[i]&&t[i]!==r?r:i;return e[o]=r,o}function h(t,e){return t+"{"+function(t){return Object.keys(t).reduce(function(e,r){return e+function(t,e){return(a.test(e)?"-":"")+(r=e,r.replace(/([A-Z])/g,"-$1").toLowerCase())+":"+t[e]+";";var r}(t,r)},"")}("string"==typeof e?i(e):e)+"}"}function d(t,e){return e+(isNaN(e)?"":u(t))}var p=window.document,y=Object.create(null,{}),g=p&&p.createElement("style");g&&p.head.appendChild(g);var m=g&&g.sheet,b=!1,v=[],O=0,j="b"+("000"+(46656*Math.random()|0).toString(36)).slice(-3)+("000"+(46656*Math.random()|0).toString(36)).slice(-3);function k(t,e){if(v.push(t),b)return g.textContent+=t;m&&m.insertRule(t,arguments.length>1?e:m.cssRules.length)}function w(t){var e=JSON.stringify(t);if(e in y)return y[e];for(var r=function t(e){var r={},n=[],i=!1;return Object.keys(e).forEach(function(o){"@"===o.charAt(0)?n.push(o+"{"+t(e[o])+"}"):" "===o.charAt(0)||":"===o.charAt(0)?n.push(h(".$"+o,e[o])):(r[o]=e[o],i=!0)}),i&&n.unshift(h(".$",r)),n}(t),n=j+ ++O,i=0;i<r.length;i++)k(r[i].replace(/\.\$/,"."+n));return y[e]=n,n}var A=0,x={};function $(t,e){return f($.style,c.apply(null,arguments)),S($)}function P(t,e){Object.defineProperty($,t,{configurable:!0,value:e})}function S(t){var e=Object.create($,{style:{value:t.style,enumerable:!0}});return t===$&&($.style={}),e}function C(t){return function(e){return e||0===e?arguments.length>0&&(this.style[t]=1===arguments.length?d(t,e):Array.prototype.slice.call(arguments).map(function(e){return d(t,e)}).join(" ")):delete this.style[t],S(this)}}return Object.defineProperty($,"valueOf",{configurable:!0,writable:!0,value:function(){return"."+this.class}}),$.style={},P("setDebug",function(t){b=t}),P("$keyframes",function(t){var e=Object.keys(t).reduce(function(e,r){return e+h(r,t[r].style||t[r])},"");if(e in x)return x[e];var r=j+ ++A;return x[e]=r,k("@keyframes "+r+"{"+e+"}"),r}),P("getSheet",function(){var t=v.join("");return v=[],t}),P("helper",function t(e,r){if(1===arguments.length)return Object.keys(e).forEach(function(r){return t(r,e[r])});delete $[e];"object"==typeof r?Object.defineProperty($,e,{configurable:!0,get:function(){return f(this.style,c(r)),S(this)}}):Object.defineProperty($,e,{configurable:!0,value:function(){var t=r.apply(null,arguments);return f(this.style,t.style),S(this)}})}),P("css",function t(e,r){if(1===arguments.length)return Object.keys(e).forEach(function(r){return t(r,e[r])});k(h(e,c(r)),0)}),P("classPrefix",j),r.forEach(function(t){if(a.test(t)){var e=(n=t.replace(a,"$2")).charAt(0).toLowerCase()+n.slice(1);if(-1===r.indexOf(e))return o[e]=t,P(e,C(t)),void P(s(e),$[e])}var n;P(t,C(t)),P(s(t),$[t])}),P("content",function(t){return this.style.content='"'+t+'"',S(this)}),Object.defineProperty($,"class",{set:function(t){this.__class=t},get:function(){return this.__class||w(this.style)}}),P("$media",function(t,e){return t&&(this.style["@media "+t]=c(e)),S(this)}),P("$nest",function(t,e){return t&&(this.style[(":"===t.charAt(0)?"":" ")+t]=c(e)),S(this)}),["active","any","checked","default","disabled","empty","enabled","first","first-child","first-of-type","fullscreen","focus","hover","indeterminate","in-range","invalid","last-child","last-of-type","left","link","only-child","only-of-type","optional","out-of-range","read-only","read-write","required","right","root","scope","target","valid","visited","dir","lang","not","nth-child","nth-last-child","nth-last-of-type","nth-of-type","after","before","first-letter","first-line","selection","backdrop","placeholder","marker","spelling-error","grammar-error"].forEach(function(t){return P("$"+l(t),function(e,r){return this.style[":"+t+(r?"("+e+")":"")]=c(r||e),S(this)})}),$.helper("$animate",function(t,e){return $.animation($.$keyframes(e)+" "+t)}),$}); | ||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):t.b=e()}(this,function(){"use strict";var t={ai:"alignItems",b:"bottom",bc:"backgroundColor",br:"borderRadius",bs:"boxShadow",c:"color",d:"display",f:"float",fd:"flexDirection",ff:"fontFamily",fs:"fontSize",h:"height",jc:"justifyContent",l:"left",lh:"lineHeight",ls:"letterSpacing",m:"margin",mb:"marginBottom",ml:"marginLeft",mr:"marginRight",mt:"marginTop",o:"opacity",p:"padding",pb:"paddingBottom",pl:"paddingLeft",pr:"paddingRight",pt:"paddingTop",r:"right",t:"top",ta:"textAlign",td:"textDecoration",tt:"textTransform",w:"width"},e=Object.create(null),n=Object.keys(function t(e){return e.hasOwnProperty("width")?e:t(Object.getPrototypeOf(e))}(document.documentElement.style)).filter(function(t){return-1===t.indexOf("-")&&"length"!==t});var r=function(t,e){return void 0===e&&(e={}),function(n){return n in e?e[n]:e[n]=t(n)}},i=r(function(t){var n,r="";return t.replace(/;/g,"\n").split("\n").reduce(function(t,i){if(i=r+i.trim(),r=","===i.slice(-1)?i:"")return t;if(i.startsWith(","))return t[n]+=i,t;var o=i.split(/[:\s]/);if(o.length>1){var c=f(o.shift().trim());t[n=e[c]||c]=o.filter(function(t){return t}).reduce(function(t,e){return t+d(n,e.trim())+" "},"").trim()}return t},{})}),o=Object.create(null,{}),c=/^(o|O|ms|MS|Ms|moz|Moz|webkit|Webkit|WebKit)([A-Z])/;function a(t,e){var n,r;return"string"==typeof t?"string"==typeof e||"number"==typeof e?((n={})[t]=e,n):i(t):Array.isArray(t)&&Array.isArray(t.raw)?(arguments[0]={raw:t},i(String.raw.apply(null,arguments))):t.style||(r=t,Object.keys(r).reduce(function(t,e){var n=r[e];return n||0===n||""===n?("content"===e&&'"'!==n.charAt(0)?t[e]='"'+n+'"':t[e in o?o[e]:e]=d(e,n),t):t},{}))}var u=r(function(t){var e=document.createElement("div");try{return e.style[t]="1px",e.style.setProperty(t,"1px"),"1px"===e.style[t].slice(-3)?"px":""}catch(t){return""}},{flex:""});function l(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])}function f(t){return t.slice("-"===t.charAt(0)?1:0).replace(/-([a-z])/g,function(t){return t[1].toUpperCase()})}function s(n){var r,i=(r=n).charAt(0)+(r.match(/([A-Z])/g)||[]).join("").toLowerCase(),o=t[i]&&t[i]!==n?n:i;return e[o]=n,o}function h(t,e){return t+"{"+function(t){return Object.keys(t).reduce(function(e,n){return e+function(t,e){return(c.test(e)?"-":"")+(n=e,n.replace(/([A-Z])/g,"-$1").toLowerCase())+":"+t[e]+";";var n}(t,n)},"")}("string"==typeof e?i(e):e)+"}"}function d(t,e){return e+(isNaN(e)?"":u(t))}var p=window.document,y=Object.create(null,{}),g=p&&p.createElement("style");g&&p.head.appendChild(g);var m=g&&g.sheet,b=!1,v=[],j=0,O="b"+("000"+(46656*Math.random()|0).toString(36)).slice(-3)+("000"+(46656*Math.random()|0).toString(36)).slice(-3);function k(t,e){if(v.push(t),b)return g.textContent=v.join("\n");m&&m.insertRule(t,arguments.length>1?e:m.cssRules.length)}function w(t){var e=JSON.stringify(t);if(e in y)return y[e];for(var n=function t(e){var n={},r=[],i=!1;return Object.keys(e).forEach(function(o){"@"===o.charAt(0)?r.push(o+"{"+t(e[o])+"}"):" "===o.charAt(0)||":"===o.charAt(0)?r.push(h(".$"+o,e[o])):(n[o]=e[o],i=!0)}),i&&r.unshift(h(".$",n)),r}(t),r=O+ ++j,i=0;i<n.length;i++)k(n[i].replace(/\.\$/,"."+r));return y[e]=r,r}var A=0,x={};function $(t,e){return l($.style,a.apply(null,arguments)),S($)}function P(t,e){Object.defineProperty($,t,{configurable:!0,value:e})}function S(t){var e=Object.create($,{style:{value:t.style,enumerable:!0}});return t===$&&($.style={}),e}function C(t){return function(e){return e||0===e?arguments.length>0&&(this.style[t]=1===arguments.length?d(t,e):Array.prototype.slice.call(arguments).map(function(e){return d(t,e)}).join(" ")):delete this.style[t],S(this)}}return Object.defineProperty($,"valueOf",{configurable:!0,writable:!0,value:function(){return"."+this.class}}),$.style={},P("setDebug",function(t){b=t}),P("$keyframes",function(t){var e=Object.keys(t).reduce(function(e,n){return e+h(n,t[n].style||t[n])},"");if(e in x)return x[e];var n=O+ ++A;return x[e]=n,k("@keyframes "+n+"{"+e+"}"),n}),P("getSheet",function(){var t=v.join("");return v=[],t}),P("helper",function t(e,n){if(1===arguments.length)return Object.keys(e).forEach(function(n){return t(n,e[n])});delete $[e];"object"==typeof n?Object.defineProperty($,e,{configurable:!0,get:function(){return l(this.style,a(n)),S(this)}}):Object.defineProperty($,e,{configurable:!0,value:function(){var t=n.apply(null,arguments);return l(this.style,t.style),S(this)}})}),P("css",function t(e,n){if(1===arguments.length)return Object.keys(e).forEach(function(n){return t(n,e[n])});k(h(e,a(n)),0)}),P("classPrefix",O),n.forEach(function(t){if(c.test(t)){var e=(r=t.replace(c,"$2")).charAt(0).toLowerCase()+r.slice(1);if(-1===n.indexOf(e))return o[e]=t,P(e,C(t)),void P(s(e),$[e])}var r;P(t,C(t)),P(s(t),$[t])}),P("content",function(t){return this.style.content='"'+t+'"',S(this)}),Object.defineProperty($,"class",{set:function(t){this.__class=t},get:function(){return this.__class||w(this.style)}}),P("$media",function(t,e){return t&&(this.style["@media "+t]=a(e)),S(this)}),P("$nest",function(t,e){return t&&(this.style[(":"===t.charAt(0)?"":" ")+t]=a(e)),S(this)}),["active","any","checked","default","disabled","empty","enabled","first","first-child","first-of-type","fullscreen","focus","hover","indeterminate","in-range","invalid","last-child","last-of-type","left","link","only-child","only-of-type","optional","out-of-range","read-only","read-write","required","right","root","scope","target","valid","visited","dir","lang","not","nth-child","nth-last-child","nth-last-of-type","nth-of-type","after","before","first-letter","first-line","selection","backdrop","placeholder","marker","spelling-error","grammar-error"].forEach(function(t){return P("$"+f(t),function(e,n){return this.style[":"+t+(n?"("+e+")":"")]=a(n||e),S(this)})}),$.helper("$animate",function(t,e){return $.animation($.$keyframes(e)+" "+t)}),$}); | ||
//# sourceMappingURL=bss.min.js.map |
## [Unreleased] | ||
## 1.1.7 - | ||
Fix browsers that doesn't support endsWith | ||
Add shorthand `lh` for lineHeight | ||
Fix rules missing in debug mode | ||
## 1.1.6 - | ||
@@ -4,0 +9,0 @@ Fix Safari 9 bug |
@@ -16,2 +16,3 @@ export default { | ||
l : 'left', | ||
lh : 'lineHeight', | ||
ls : 'letterSpacing', | ||
@@ -18,0 +19,0 @@ m : 'margin', |
@@ -32,3 +32,3 @@ import { | ||
if (debug) | ||
return styleSheet.textContent += rule | ||
return styleSheet.textContent = rules.join('\n') | ||
@@ -35,0 +35,0 @@ sheet && sheet.insertRule(rule, arguments.length > 1 |
@@ -26,3 +26,3 @@ import popular from './popular' | ||
line = last + line.trim() | ||
last = line.endsWith(',') ? line : '' | ||
last = line.slice(-1) === ',' ? line : '' | ||
if (last) | ||
@@ -29,0 +29,0 @@ return acc |
{ | ||
"name": "bss", | ||
"version": "1.1.6", | ||
"version": "1.1.7", | ||
"description": "Better Style Sheets", | ||
@@ -5,0 +5,0 @@ "main": "bss.js", |
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
92698
1235