Comparing version 1.0.7 to 1.1.0
35
bss.js
@@ -40,3 +40,3 @@ (function (global, factory) { | ||
w : 'width' | ||
}; | ||
} | ||
@@ -65,3 +65,3 @@ var shorts = Object.create(null); | ||
var last = '' | ||
, prev; | ||
, prev;; | ||
@@ -167,3 +167,3 @@ return string.replace(/;/g, '\n').split('\n').reduce(function (acc, line) { | ||
var acronym = initials(prop) | ||
, short = popular[acronym] && popular[acronym] !== prop ? prop : acronym; | ||
, short = popular[acronym] && popular[acronym] !== prop ? prop : acronym;; | ||
@@ -174,7 +174,5 @@ shorts[short] = prop; | ||
function objectToRules(style) { | ||
var base = {} | ||
, rules = []; | ||
, rules = [];; | ||
@@ -210,4 +208,2 @@ var hasBase = false; | ||
function propToString(style, k) { | ||
@@ -230,3 +226,3 @@ return (vendorRegex.test(k) ? '-' : '') | ||
var rules = []; | ||
var count$1 = 0; | ||
var count = 0; | ||
@@ -260,3 +256,3 @@ var classPrefix = 'b' + ('000' + ((Math.random() * 46656) | 0).toString(36)).slice(-3) + | ||
var rules = objectToRules(style) | ||
, css = rules.join(''); | ||
, css = rules.join('');; | ||
@@ -266,3 +262,3 @@ if (css in classes) | ||
var className = classPrefix + (++count$1); | ||
var className = classPrefix + (++count); | ||
@@ -277,6 +273,6 @@ rules.map(function (rule) { return insert(rule.replace(/\.\$/, '.' + className)); } | ||
var count = 0; | ||
var count$1 = 0; | ||
var keyframeCache = {}; | ||
var keyframes = function(props) { | ||
function keyframes(props) { | ||
var content = Object.keys(props).map(function (key) { return selectorBlock(key, props[key].style || props[key]); } | ||
@@ -288,3 +284,3 @@ ).join(''); | ||
var name = classPrefix + ++count; | ||
var name = classPrefix + ++count$1; | ||
keyframeCache[content] = name; | ||
@@ -294,3 +290,3 @@ insert('@keyframes ' + name + '{' + content + '}'); | ||
return name | ||
}; | ||
} | ||
@@ -352,3 +348,3 @@ var pseudos = [ | ||
'grammar-error' | ||
]; | ||
] | ||
@@ -375,3 +371,8 @@ function bss(input, value) { | ||
function chain(instance) { | ||
var newInstance = Object.create(bss, { style: { value: instance.style } }); | ||
var newInstance = Object.create(bss, { | ||
style: { | ||
value: instance.style, | ||
enumerable: true | ||
} | ||
}); | ||
@@ -378,0 +379,0 @@ if (instance === bss) |
@@ -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";function t(e){return e.hasOwnProperty("width")?e:t(Object.getPrototypeOf(e))}function e(t,e){var n;return"string"==typeof t?"string"==typeof e||"number"==typeof e?(n={},n[t]=e,n):b(t):Array.isArray(t)&&Array.isArray(t.raw)?(arguments[0]={raw:t},b(String.raw.apply(null,arguments))):t.style||function(t){return Object.keys(t).reduce(function(e,n){var r=t[n];return r||0===r||""===r?("content"===n&&'"'!==r.charAt(0)?e[n]='"'+r+'"':e[n in v?v[n]:n]=c(n,r),e):e},{})}(t)}function n(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])}function r(t){return t.slice("-"===t.charAt(0)?1:0).replace(/-([a-z])/g,function(t){return t[1].toUpperCase()})}function i(t){var e=function(t){return t.charAt(0)+(t.match(/([A-Z])/g)||[]).join("").toLowerCase()}(t),n=d[e]&&d[e]!==t?t:e;return y[n]=t,n}function o(t){var e={},n=[],r=!1;return Object.keys(t).forEach(function(i){"@"===i.charAt(0)?n.push(i+"{"+o(t[i])+"}"):" "===i.charAt(0)||":"===i.charAt(0)?n.push(u(".$"+i,t[i])):(e[i]=t[i],r=!0)}),r&&n.unshift(u(".$",e)),n}function u(t,e){return t+"{"+function(t){return Object.keys(t).map(function(e){return function(t,e){return(j.test(e)?"-":"")+function(t){return t.replace(/([A-Z])/g,"-$1").toLowerCase()}(e)+":"+t[e]+";"}(t,e)}).join("")}("string"==typeof e?b(e):e)+"}"}function c(t,e){return e+(isNaN(e)?"":O(t))}function a(t,e){if(C.push(t),$)return w.textContent+=t;x&&x.insertRule(t,arguments.length>1?e:x.cssRules.length)}function f(t,r){return n(f.style,e.apply(null,arguments)),s(f)}function s(t){var e=Object.create(f,{style:{value:t.style}});return t===f&&(f.style={}),e}function l(t){return function(e){return e||0===e?arguments.length>0&&(this.style[t]=1===arguments.length?c(t,e):Array.prototype.slice.call(arguments).map(function(e){return c(t,e)}).join(" ")):delete this.style[t],s(this)}}function h(t,n){if(1===arguments.length)return Object.keys(t).forEach(function(e){return h(e,t[e])});a(u(t,e(n)),0)}function p(t,r){return 1===arguments.length?Object.keys(t).forEach(function(e){return p(e,t[e])}):"object"==typeof r?(delete f[t],void Object.defineProperty(f,t,{get:function(){return n(this.style,e(r)),s(this)}})):void(f[t]=function(){var t=r.apply(null,arguments);return n(this.style,t.style),s(this)})}var d={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"},y=Object.create(null),m=Object.keys(t(document.documentElement.style)).filter(function(t){return-1===t.indexOf("-")}),g=function(t,e){return void 0===e&&(e={}),function(n){return n in e?e[n]:e[n]=t(n)}},b=g(function(t){var e,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[e]+=i,t;var o=i.split(/[:\s]/);if(o.length>1){var u=r(o.shift().trim());t[e=y[u]||u]=o.filter(function(t){return t}).map(function(t){return c(e,t.trim())}).join(" ")}return t},{})}),v=Object.create(null,{}),j=/^(o|O|ms|MS|Ms|moz|Moz|webkit|Webkit|WebKit)([A-Z])/,O=g(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:""}),k=window.document,A=Object.create(null,{}),w=k&&k.createElement("style");w&&k.head.appendChild(w);var x=w&&w.sheet,$=!1,C=[],E=0,S="b"+("000"+(46656*Math.random()|0).toString(36)).slice(-3)+("000"+(46656*Math.random()|0).toString(36)).slice(-3),P=0,L={};return f.setDebug=function(t){$=t},f.style={},f.valueOf=function(){return"."+this.class},f.$keyframes=function(t){var e=Object.keys(t).map(function(e){return u(e,t[e].style||t[e])}).join("");if(e in L)return L[e];var n=S+ ++P;return L[e]=n,a("@keyframes "+n+"{"+e+"}"),n},f.getSheet=function(){var t=C.join("");return C=[],t},f.helper=p,f.css=h,f.classPrefix=S,m.forEach(function(t){if(j.test(t)){var e=function(t){return t.charAt(0).toLowerCase()+t.slice(1)}(t.replace(j,"$2"));if(-1===m.indexOf(e))return v[e]=t,void(f[e]=f[i(e)]=l(t))}f[t]=f[i(t)]=l(t)}),f.content=function(t){return this.style.content='"'+t+'"',s(this)},Object.defineProperty(f,"class",{get:function(){return function(t){var e=o(t),n=e.join("");if(n in A)return A[n];var r=S+ ++E;return e.map(function(t){return a(t.replace(/\.\$/,"."+r))}),A[n]=r,r}(this.style)}}),f.$media=function(t,n){return t&&(this.style["@media "+t]=e(n)),s(this)},f.$nest=function(t,n){return t&&(this.style[(":"===t.charAt(0)?"":" ")+t]=e(n)),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 f["$"+r(t)]=function(n,r){return this.style[":"+t+(r?"("+n+")":"")]=e(r||n),s(this)}}),f.helper("$animate",function(t,e){return f.animation(f.$keyframes(e)+" "+t)}),f}); | ||
!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),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("-")});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.endsWith(",")?i:"")return t;if(i.startsWith(","))return t[n]+=i,t;var o=i.split(/[:\s]/);if(o.length>1){var a=s(o.shift().trim());t[n=e[a]||a]=o.filter(function(t){return t}).map(function(t){return p(n,t.trim())}).join(" ")}return t},{})}),o=Object.create(null,{}),a=/^(o|O|ms|MS|Ms|moz|Moz|webkit|Webkit|WebKit)([A-Z])/;function c(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]=p(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 f(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])}function s(t){return t.slice("-"===t.charAt(0)?1:0).replace(/-([a-z])/g,function(t){return t[1].toUpperCase()})}function l(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).map(function(e){return function(t,e){return(a.test(e)?"-":"")+(n=e,n.replace(/([A-Z])/g,"-$1").toLowerCase())+":"+t[e]+";";var n}(t,e)}).join("")}("string"==typeof e?i(e):e)+"}"}function p(t,e){return e+(isNaN(e)?"":u(t))}var d=window.document,y=Object.create(null,{}),m=d&&d.createElement("style");m&&d.head.appendChild(m);var g=m&&m.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 m.textContent+=t;g&&g.insertRule(t,arguments.length>1?e:g.cssRules.length)}function A(t){var e=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),n=e.join("");if(n in y)return y[n];var r=O+ ++j;return e.map(function(t){return k(t.replace(/\.\$/,"."+r))}),y[n]=r,r}var w=0,x={};function $(t,e){return f($.style,c.apply(null,arguments)),C($)}function C(t){var e=Object.create($,{style:{value:t.style,enumerable:!0}});return t===$&&($.style={}),e}function E(t){return function(e){return e||0===e?arguments.length>0&&(this.style[t]=1===arguments.length?p(t,e):Array.prototype.slice.call(arguments).map(function(e){return p(t,e)}).join(" ")):delete this.style[t],C(this)}}return $.setDebug=function(t){b=t},$.style={},$.valueOf=function(){return"."+this.class},$.$keyframes=function(t){var e=Object.keys(t).map(function(e){return h(e,t[e].style||t[e])}).join("");if(e in x)return x[e];var n=O+ ++w;return x[e]=n,k("@keyframes "+n+"{"+e+"}"),n},$.getSheet=function(){var t=v.join("");return v=[],t},$.helper=function t(e,n){if(1===arguments.length)return Object.keys(e).forEach(function(n){return t(n,e[n])});if("object"==typeof n)return delete $[e],void Object.defineProperty($,e,{get:function(){return f(this.style,c(n)),C(this)}});$[e]=function(){var t=n.apply(null,arguments);return f(this.style,t.style),C(this)}},$.css=function t(e,n){if(1===arguments.length)return Object.keys(e).forEach(function(n){return t(n,e[n])});k(h(e,c(n)),0)},$.classPrefix=O,n.forEach(function(t){if(a.test(t)){var e=(r=t.replace(a,"$2")).charAt(0).toLowerCase()+r.slice(1);if(-1===n.indexOf(e))return o[e]=t,void($[e]=$[l(e)]=E(t))}var r;$[t]=$[l(t)]=E(t)}),$.content=function(t){return this.style.content='"'+t+'"',C(this)},Object.defineProperty($,"class",{get:function(){return A(this.style)}}),$.$media=function(t,e){return t&&(this.style["@media "+t]=c(e)),C(this)},$.$nest=function(t,e){return t&&(this.style[(":"===t.charAt(0)?"":" ")+t]=c(e)),C(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 $["$"+s(t)]=function(e,n){return this.style[":"+t+(n?"("+e+")":"")]=c(n||e),C(this)}}),$.helper("$animate",function(t,e){return $.animation($.$keyframes(e)+" "+t)}),$}); | ||
//# sourceMappingURL=bss.min.js.map |
## [Unreleased] | ||
## 1.0.7 - | ||
Fix regression that snuck in with a 1.0.6 commit | ||
## 1.0.6 - | ||
Support comma separated prop values on multiple lines fixes | ||
Allow px for multiple values in shorthand lean string | ||
Allow conditionals for `$media` and `$nest` | ||
## 1.0.5 - | ||
Revert usage of getComputedStyle for prop resolution | ||
## 1.0.4 - | ||
@@ -4,0 +18,0 @@ |
@@ -45,3 +45,8 @@ import keyframes from './keyframes' | ||
function chain(instance) { | ||
const newInstance = Object.create(bss, { style: { value: instance.style } }) | ||
const newInstance = Object.create(bss, { | ||
style: { | ||
value: instance.style, | ||
enumerable: true | ||
} | ||
}) | ||
@@ -48,0 +53,0 @@ if (instance === bss) |
{ | ||
"name": "bss", | ||
"version": "1.0.7", | ||
"version": "1.1.0", | ||
"description": "Better Style Sheets", | ||
@@ -10,3 +10,2 @@ "main": "bss.js", | ||
"prepublish": "npm run build", | ||
"popular": "node scripts/popular", | ||
"build": "rollup -c" | ||
@@ -16,9 +15,10 @@ }, | ||
"license": "WTFPL", | ||
"devDependencies": { | ||
"ospec": "1.3.1", | ||
"rollup": "0.52.1", | ||
"rollup-plugin-buble": "0.18.0", | ||
"devDependencies": {}, | ||
"dependencies": { | ||
"ospec": "1.4.0", | ||
"rollup": "0.56.0", | ||
"rollup-plugin-buble": "0.19.2", | ||
"rollup-plugin-filesize": "1.5.0", | ||
"rollup-plugin-uglify": "2.0.1" | ||
"rollup-plugin-uglify": "3.0.0" | ||
} | ||
} |
@@ -10,2 +10,3 @@ import buble from 'rollup-plugin-buble' | ||
file: 'bss.js', | ||
exports: 'default', | ||
format: 'umd', | ||
@@ -15,3 +16,2 @@ name: 'b', | ||
}, | ||
exports: 'default', | ||
plugins: process.env.TEST | ||
@@ -27,2 +27,3 @@ ? [] | ||
file: 'bss.min.js', | ||
exports: 'default', | ||
format: 'umd', | ||
@@ -32,3 +33,2 @@ name: 'b', | ||
}, | ||
exports: 'default', | ||
plugins: [ | ||
@@ -35,0 +35,0 @@ buble(), |
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
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
0
2
0
88151
5
17
1187
+ Addedospec@1.4.0
+ Addedrollup@0.56.0
+ Addedrollup-plugin-buble@0.19.2
+ Addedrollup-plugin-filesize@1.5.0
+ Addedrollup-plugin-uglify@3.0.0
+ Addedacorn@6.4.2(transitive)
+ Addedacorn-dynamic-import@4.0.0(transitive)
+ Addedacorn-jsx@5.3.2(transitive)
+ Addedansi-align@2.0.0(transitive)
+ Addedansi-regex@3.0.1(transitive)
+ Addedansi-styles@3.2.1(transitive)
+ Addedboxen@1.3.0(transitive)
+ Addedbuble@0.19.8(transitive)
+ Addedcamelcase@4.1.0(transitive)
+ Addedchalk@2.4.2(transitive)
+ Addedcli-boxes@1.0.0(transitive)
+ Addedcolor-convert@1.9.3(transitive)
+ Addedcolor-name@1.1.3(transitive)
+ Addedcolors@1.4.0(transitive)
+ Addedcommander@2.14.1(transitive)
+ Addedcross-spawn@5.1.0(transitive)
+ Addeddeep-assign@2.0.0(transitive)
+ Addedduplexer@0.1.2(transitive)
+ Addedescape-string-regexp@1.0.5(transitive)
+ Addedestree-walker@0.6.1(transitive)
+ Addedexeca@0.7.0(transitive)
+ Addedfilesize@3.6.1(transitive)
+ Addedget-stream@3.0.0(transitive)
+ Addedgzip-size@3.0.0(transitive)
+ Addedhas-flag@3.0.0(transitive)
+ Addedis-fullwidth-code-point@2.0.0(transitive)
+ Addedis-obj@1.0.1(transitive)
+ Addedis-stream@1.1.0(transitive)
+ Addedisexe@2.0.0(transitive)
+ Addedjsesc@0.5.0(transitive)
+ Addedlru-cache@4.1.5(transitive)
+ Addedmagic-string@0.25.9(transitive)
+ Addedminimist@1.2.8(transitive)
+ Addednpm-run-path@2.0.2(transitive)
+ Addedos-homedir@2.0.0(transitive)
+ Addedospec@1.4.0(transitive)
+ Addedp-finally@1.0.0(transitive)
+ Addedpath-key@2.0.1(transitive)
+ Addedpseudomap@1.0.2(transitive)
+ Addedregenerate@1.4.2(transitive)
+ Addedregenerate-unicode-properties@9.0.0(transitive)
+ Addedregexpu-core@4.8.0(transitive)
+ Addedregjsgen@0.5.2(transitive)
+ Addedregjsparser@0.7.0(transitive)
+ Addedrollup@0.56.0(transitive)
+ Addedrollup-plugin-buble@0.19.2(transitive)
+ Addedrollup-plugin-filesize@1.5.0(transitive)
+ Addedrollup-plugin-uglify@3.0.0(transitive)
+ Addedrollup-pluginutils@2.8.2(transitive)
+ Addedshebang-command@1.2.0(transitive)
+ Addedshebang-regex@1.0.0(transitive)
+ Addedsignal-exit@3.0.7(transitive)
+ Addedsource-map@0.6.1(transitive)
+ Addedsourcemap-codec@1.4.8(transitive)
+ Addedstring-width@2.1.1(transitive)
+ Addedstrip-ansi@4.0.0(transitive)
+ Addedstrip-eof@1.0.0(transitive)
+ Addedsupports-color@5.5.0(transitive)
+ Addedterm-size@1.2.0(transitive)
+ Addeduglify-es@3.3.10(transitive)
+ Addedunicode-canonical-property-names-ecmascript@2.0.1(transitive)
+ Addedunicode-match-property-ecmascript@2.0.0(transitive)
+ Addedunicode-match-property-value-ecmascript@2.2.0(transitive)
+ Addedunicode-property-aliases-ecmascript@2.1.0(transitive)
+ Addedwhich@1.3.1(transitive)
+ Addedwidest-line@2.0.1(transitive)
+ Addedyallist@2.1.2(transitive)