Comparing version 1.0.2 to 1.0.3
@@ -54,3 +54,3 @@ module.exports = { | ||
}], | ||
'eqeqeq': 2, | ||
'eqeqeq': 1, | ||
'no-alert': 2, | ||
@@ -63,3 +63,3 @@ 'no-caller': 2, | ||
'no-empty-pattern': 2, | ||
'no-eq-null': 2, | ||
'no-eq-null': 1, | ||
'no-eval': 2, | ||
@@ -66,0 +66,0 @@ 'no-extend-native': 2, |
32
bss.js
@@ -22,2 +22,3 @@ (function (global, factory) { | ||
l : 'left', | ||
ls : 'letterSpacing', | ||
m : 'margin', | ||
@@ -44,11 +45,7 @@ mb : 'marginBottom', | ||
var cssProperties = Object.keys( | ||
findWidth(document.documentElement.style) | ||
).filter(function (prop) { return typeof document.documentElement.style[prop] === 'string'; }); | ||
var style = window.getComputedStyle(document.documentElement, null); | ||
function findWidth(obj) { | ||
return obj.hasOwnProperty('width') | ||
? obj | ||
: findWidth(Object.getPrototypeOf(obj)) | ||
} | ||
var cssProperties = style && typeof style.width === 'string' | ||
? Object.keys(style).filter(function (a) { return a % 1 !== 0; }) | ||
: Array.prototype.slice.call(style, 0, style.length).map(hyphenToCamelCase); | ||
@@ -60,6 +57,7 @@ var vendorMap = Object.create(null, {}); | ||
function parse(input, value) { | ||
var obj; | ||
if (typeof input === 'string') { | ||
if (typeof value === 'string' || typeof value === 'number') | ||
{ return (( obj = {}, obj[input] = value, obj )) | ||
var obj; } | ||
{ return (( obj = {}, obj[input] = value, obj)) } | ||
@@ -399,10 +397,8 @@ return stringToObject(input) | ||
return function CssProperty(value) { | ||
var arguments$1 = arguments; | ||
var this$1 = this; | ||
for (var i = 0; i < arguments.length; i++) { | ||
if (prop in this$1.style) | ||
{ this$1.style[prop] += ' ' + addPx(prop, arguments$1[i]); } | ||
else if (arguments$1[i] || arguments$1[i] === 0) | ||
{ this$1.style[prop] = addPx(prop, arguments$1[i]); } | ||
if (!value && value !== 0) { | ||
delete this.style[prop]; | ||
} else if (arguments.length > 0) { | ||
this.style[prop] = arguments.length === 1 | ||
? addPx(prop, value) | ||
: Array.prototype.slice.call(arguments).map(function (v) { return addPx(prop, v); }).join(' '); | ||
} | ||
@@ -409,0 +405,0 @@ |
@@ -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){if("string"==typeof t){if("string"==typeof e||"number"==typeof e){return n={},n[t]=e,n;var n}return h(t)}return Array.isArray(t)&&Array.isArray(t.raw)?(arguments[0]={raw:t},h(String.raw.apply(null,arguments))):t.style||r(t)}function n(t){return t.charAt(0).toLowerCase()+t.slice(1)}function r(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 x?x[n]:n]=p(n,r),e):e},{})}function i(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])}function o(t){return t.slice("-"===t.charAt(0)?1:0).replace(/-([a-z])/g,function(t){return t[1].toUpperCase()})}function u(t){return t.replace(/([A-Z])/g,"-$1").toLowerCase()}function c(t){return t.charAt(0)+(t.match(/([A-Z])/g)||[]).join("").toLowerCase()}function a(t){var e=c(t),n=k[e]&&k[e]!==t?t:e;return w[n]=t,n}function f(t){var e={},n=[],r=!1;return Object.keys(t).forEach(function(i){"@"===i.charAt(0)?n.push(i+"{"+f(t[i])+"}"):" "===i.charAt(0)||":"===i.charAt(0)?n.push(s(".$"+i,t[i])):(e[i]=t[i],r=!0)}),r&&n.unshift(s(".$",e)),n}function s(t,e){return t+"{"+l("string"==typeof e?h(e):e)+"}"}function l(t){return Object.keys(t).map(function(e){return d(t,e)}).join("")}function h(t){return t.replace(/;/g,"\n").split("\n").reduce(function(t,e){var n=e.trim().split(/[: ]/);if(n.length>1){var r=o(n.shift().trim());t[w[r]||r]=p(w[r]||r,n.join(" ").trim())}return t},{})}function d(t,e){return($.test(e)?"-":"")+u(e)+":"+t[e]+";"}function p(t,e){return e+(isNaN(e)?"":E(t))}function y(t,e){if(R.push(t),M)return S.textContent+=t;L&&L.insertRule(t,arguments.length>1?e:L.cssRules.length)}function m(t){var e=f(t),n=e.join("");if(n in P)return P[n];var r=D+ ++z;return e.map(function(t){return y(t.replace(/\.\$/,"."+r))}),P[n]=r,r}function g(t,n){return i(g.style,e.apply(null,arguments)),b(g)}function b(t){var e=Object.create(g,{style:{value:t.style}});return t===g&&(g.style={}),e}function v(t){return function(e){for(var n=arguments,r=this,i=0;i<arguments.length;i++)t in r.style?r.style[t]+=" "+p(t,n[i]):(n[i]||0===n[i])&&(r.style[t]=p(t,n[i]));return b(this)}}function j(t,n){if(1===arguments.length)return Object.keys(t).forEach(function(e){return j(e,t[e])});y(s(t,e(n)),0)}function O(t,n){return 1===arguments.length?Object.keys(t).forEach(function(e){return O(e,t[e])}):"object"==typeof n?(delete g[t],void Object.defineProperty(g,t,{get:function(){return i(this.style,e(n)),b(this)}})):void(g[t]=function(){var t=n.apply(null,arguments);return i(this.style,t.style),b(this)})}var k={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",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"},w=Object.create(null),A=Object.keys(t(document.documentElement.style)).filter(function(t){return"string"==typeof document.documentElement.style[t]}),x=Object.create(null,{}),$=/^(o|O|ms|MS|Ms|moz|Moz|webkit|Webkit|WebKit)([A-Z])/,E=function(t,e){return void 0===e&&(e={}),function(n){return n in e?e[n]:e[n]=t(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:""}),C=window.document,P=Object.create(null,{}),S=C&&C.createElement("style");S&&C.head.appendChild(S);var L=S&&S.sheet,M=!1,R=[],z=0,D="b"+("000"+(46656*Math.random()|0).toString(36)).slice(-3)+("000"+(46656*Math.random()|0).toString(36)).slice(-3),T=0,Z={},B=["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"];return g.setDebug=function(t){M=t},g.style={},g.valueOf=function(){return"."+this.class},g.$keyframes=function(t){var e=Object.keys(t).map(function(e){return s(e,t[e].style||t[e])}).join("");if(e in Z)return Z[e];var n=D+ ++T;return Z[e]=n,y("@keyframes "+n+"{"+e+"}"),n},g.getSheet=function(){var t=R.join("");return R=[],t},g.helper=O,g.css=j,g.classPrefix=D,A.forEach(function(t){if($.test(t)){var e=n(t.replace($,"$2"));if(-1===A.indexOf(e))return x[e]=t,void(g[e]=g[a(e)]=v(t))}g[t]=g[a(t)]=v(t)}),g.content=function(t){return this.style.content='"'+t+'"',b(this)},Object.defineProperty(g,"class",{get:function(){return m(this.style)}}),g.$media=function(t,n){return this.style["@media "+t]=e(n),b(this)},g.$nest=function(t,n){return this.style[(":"===t.charAt(0)?"":" ")+t]=e(n),b(this)},B.forEach(function(t){return g["$"+o(t)]=function(n,r){return this.style[":"+t+(r?"("+n+")":"")]=e(r||n),b(this)}}),g.helper("$animate",function(t,e){return g.animation(g.$keyframes(e)+" "+t)}),g}); | ||
!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(t,e){var n;return"string"==typeof t?"string"==typeof e||"number"==typeof e?(n={},n[t]=e,n):c(t):Array.isArray(t)&&Array.isArray(t.raw)?(arguments[0]={raw:t},c(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 b?b[n]:n]=u(n,r),e):e},{})}(t)}function e(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])}function n(t){return t.slice("-"===t.charAt(0)?1:0).replace(/-([a-z])/g,function(t){return t[1].toUpperCase()})}function r(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 i(t){var e={},n=[],r=!1;return Object.keys(t).forEach(function(c){"@"===c.charAt(0)?n.push(c+"{"+i(t[c])+"}"):" "===c.charAt(0)||":"===c.charAt(0)?n.push(o(".$"+c,t[c])):(e[c]=t[c],r=!0)}),r&&n.unshift(o(".$",e)),n}function o(t,e){return t+"{"+function(t){return Object.keys(t).map(function(e){return function(t,e){return(v.test(e)?"-":"")+function(t){return t.replace(/([A-Z])/g,"-$1").toLowerCase()}(e)+":"+t[e]+";"}(t,e)}).join("")}("string"==typeof e?c(e):e)+"}"}function c(t){return t.replace(/;/g,"\n").split("\n").reduce(function(t,e){var r=e.trim().split(/[: ]/);if(r.length>1){var i=n(r.shift().trim());t[y[i]||i]=u(y[i]||i,r.join(" ").trim())}return t},{})}function u(t,e){return e+(isNaN(e)?"":j(t))}function a(t,e){if($.push(t),x)return w.textContent+=t;O&&O.insertRule(t,arguments.length>1?e:O.cssRules.length)}function l(n,r){return e(l.style,t.apply(null,arguments)),s(l)}function s(t){var e=Object.create(l,{style:{value:t.style}});return t===l&&(l.style={}),e}function f(t){return function(e){return e||0===e?arguments.length>0&&(this.style[t]=1===arguments.length?u(t,e):Array.prototype.slice.call(arguments).map(function(e){return u(t,e)}).join(" ")):delete this.style[t],s(this)}}function p(e,n){if(1===arguments.length)return Object.keys(e).forEach(function(t){return p(t,e[t])});a(o(e,t(n)),0)}function h(n,r){return 1===arguments.length?Object.keys(n).forEach(function(t){return h(t,n[t])}):"object"==typeof r?(delete l[n],void Object.defineProperty(l,n,{get:function(){return e(this.style,t(r)),s(this)}})):void(l[n]=function(){var t=r.apply(null,arguments);return e(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=window.getComputedStyle(document.documentElement,null),g=m&&"string"==typeof m.width?Object.keys(m).filter(function(t){return t%1!=0}):Array.prototype.slice.call(m,0,m.length).map(n),b=Object.create(null,{}),v=/^(o|O|ms|MS|Ms|moz|Moz|webkit|Webkit|WebKit)([A-Z])/,j=function(t,e){return void 0===e&&(e={}),function(n){return n in e?e[n]:e[n]=t(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:""}),A=window.document,k=Object.create(null,{}),w=A&&A.createElement("style");w&&A.head.appendChild(w);var O=w&&w.sheet,x=!1,$=[],C=0,S="b"+("000"+(46656*Math.random()|0).toString(36)).slice(-3)+("000"+(46656*Math.random()|0).toString(36)).slice(-3),E=0,L={};return l.setDebug=function(t){x=t},l.style={},l.valueOf=function(){return"."+this.class},l.$keyframes=function(t){var e=Object.keys(t).map(function(e){return o(e,t[e].style||t[e])}).join("");if(e in L)return L[e];var n=S+ ++E;return L[e]=n,a("@keyframes "+n+"{"+e+"}"),n},l.getSheet=function(){var t=$.join("");return $=[],t},l.helper=h,l.css=p,l.classPrefix=S,g.forEach(function(t){if(v.test(t)){var e=function(t){return t.charAt(0).toLowerCase()+t.slice(1)}(t.replace(v,"$2"));if(-1===g.indexOf(e))return b[e]=t,void(l[e]=l[r(e)]=f(t))}l[t]=l[r(t)]=f(t)}),l.content=function(t){return this.style.content='"'+t+'"',s(this)},Object.defineProperty(l,"class",{get:function(){return function(t){var e=i(t),n=e.join("");if(n in k)return k[n];var r=S+ ++C;return e.map(function(t){return a(t.replace(/\.\$/,"."+r))}),k[n]=r,r}(this.style)}}),l.$media=function(e,n){return this.style["@media "+e]=t(n),s(this)},l.$nest=function(e,n){return this.style[(":"===e.charAt(0)?"":" ")+e]=t(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(e){return l["$"+n(e)]=function(n,r){return this.style[":"+e+(r?"("+n+")":"")]=t(r||n),s(this)}}),l.helper("$animate",function(t,e){return l.animation(l.$keyframes(e)+" "+t)}),l}); | ||
//# sourceMappingURL=bss.min.js.map |
## [Unreleased] | ||
## 1.0.3 - | ||
Added `letter-spacing` as preferred `ls` shortname | ||
Fixed unsetting props when using setter functions | ||
Use getComputedStyle for property registration (fixes safari 5) | ||
## 1.0.2 - | ||
Convenience toString helper changed to valueOf | ||
Fixed px being added to flex shorthand unexpectedly | ||
Lazy registration of px value properties | ||
Add multiple properties per line for css strings | ||
## 1.0.1 - | ||
Fixed px property registration in edge | ||
Fixed px addition for shorthands | ||
## 1.0.0 - 2017-09-05 | ||
@@ -4,0 +22,0 @@ |
@@ -96,7 +96,8 @@ import keyframes from './keyframes' | ||
return function CssProperty(value) { | ||
for (let i = 0; i < arguments.length; i++) { | ||
if (prop in this.style) | ||
this.style[prop] += ' ' + addPx(prop, arguments[i]) | ||
else if (arguments[i] || arguments[i] === 0) | ||
this.style[prop] = addPx(prop, arguments[i]) | ||
if (!value && value !== 0) { | ||
delete this.style[prop] | ||
} else if (arguments.length > 0) { | ||
this.style[prop] = arguments.length === 1 | ||
? addPx(prop, value) | ||
: Array.prototype.slice.call(arguments).map(v => addPx(prop, v)).join(' ') | ||
} | ||
@@ -103,0 +104,0 @@ |
@@ -16,2 +16,3 @@ export default { | ||
l : 'left', | ||
ls : 'letterSpacing', | ||
m : 'margin', | ||
@@ -18,0 +19,0 @@ mb : 'marginBottom', |
@@ -5,11 +5,7 @@ import popular from './popular' | ||
export const cssProperties = Object.keys( | ||
findWidth(document.documentElement.style) | ||
).filter(prop => typeof document.documentElement.style[prop] === 'string') | ||
const style = window.getComputedStyle(document.documentElement, null) | ||
function findWidth(obj) { | ||
return obj.hasOwnProperty('width') | ||
? obj | ||
: findWidth(Object.getPrototypeOf(obj)) | ||
} | ||
export const cssProperties = style && typeof style.width === 'string' | ||
? Object.keys(style).filter(a => a % 1 !== 0) | ||
: Array.prototype.slice.call(style, 0, style.length).map(hyphenToCamelCase) | ||
@@ -16,0 +12,0 @@ export const vendorMap = Object.create(null, {}) |
{ | ||
"name": "bss", | ||
"version": "1.0.2", | ||
"version": "1.0.3", | ||
"description": "Better Style Sheets", | ||
@@ -15,10 +15,8 @@ "main": "bss.js", | ||
"devDependencies": { | ||
"rollup": "^0.43.0", | ||
"rollup-plugin-buble": "^0.15.0", | ||
"rollup-plugin-filesize": "^1.4.2", | ||
"rollup-plugin-uglify": "^2.0.1" | ||
}, | ||
"dependencies": { | ||
"ospec": "1.3.1" | ||
"ospec": "1.3.1", | ||
"rollup": "0.52.1", | ||
"rollup-plugin-buble": "0.18.0", | ||
"rollup-plugin-filesize": "1.5.0", | ||
"rollup-plugin-uglify": "2.0.1" | ||
} | ||
} |
@@ -7,7 +7,9 @@ import buble from 'rollup-plugin-buble' | ||
{ | ||
entry: 'lib/index.js', | ||
dest: 'bss.js', | ||
format: 'umd', | ||
moduleName: 'b', | ||
sourceMap: true, | ||
input: 'lib/index.js', | ||
output: { | ||
file: 'bss.js', | ||
format: 'umd', | ||
name: 'b', | ||
sourcemap: true | ||
}, | ||
exports: 'default', | ||
@@ -21,7 +23,9 @@ plugins: process.env.TEST | ||
}, { | ||
entry: 'lib/index.js', | ||
dest: 'bss.min.js', | ||
format: 'umd', | ||
moduleName: 'b', | ||
sourceMap: true, | ||
input: 'lib/index.js', | ||
output: { | ||
file: 'bss.min.js', | ||
format: 'umd', | ||
name: 'b', | ||
sourcemap: true | ||
}, | ||
exports: 'default', | ||
@@ -28,0 +32,0 @@ plugins: [ |
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
85479
0
17
1131
5
- Removedospec@1.3.1
- Removedospec@1.3.1(transitive)