Comparing version 0.1.1 to 0.1.2
@@ -51,3 +51,5 @@ module.exports = { | ||
'dot-location': [2, 'property'], | ||
'dot-notation': [2, { 'allowPattern': '^[a-z]+(_[a-z]+)+$' }], | ||
'dot-notation': [2, { | ||
'allowPattern': '^[a-z]+(_[a-z]+)+$' | ||
}], | ||
'eqeqeq': 2, | ||
@@ -77,3 +79,10 @@ 'no-alert': 2, | ||
'no-magic-numbers': 0, | ||
'no-multi-spaces': [2, { exceptions : { Array: true, Property: true, VariableDeclarator: true, ImportDeclaration: true }}], | ||
'no-multi-spaces': [2, { | ||
exceptions: { | ||
Array: true, | ||
Property: true, | ||
VariableDeclarator: true, | ||
ImportDeclaration: true | ||
} | ||
}], | ||
'no-multi-str': 2, | ||
@@ -113,4 +122,9 @@ 'no-native-reassign': 2, | ||
'no-undef-init': 2, | ||
'no-unused-vars': [1, {'vars': 'all', 'args': 'none' }], | ||
'no-use-before-define': [2, { "functions": false }], | ||
'no-unused-vars': [1, { | ||
'vars': 'all', | ||
'args': 'none' | ||
}], | ||
'no-use-before-define': [2, { | ||
"functions": false | ||
}], | ||
@@ -130,17 +144,34 @@ /* Node.js and CommonJS */ | ||
'block-spacing': [2, 'always'], | ||
'brace-style': [2, '1tbs', { "allowSingleLine": true }], | ||
'brace-style': [2, '1tbs', { | ||
"allowSingleLine": true | ||
}], | ||
'camelcase': 2, | ||
'comma-spacing': 2, | ||
'comma-style': [2, 'first', { exceptions: { ArrayExpression: true, ObjectExpression: true }}], | ||
'comma-style': [2, 'first', { | ||
exceptions: { | ||
ArrayExpression: true, | ||
ObjectExpression: true | ||
} | ||
}], | ||
'consistent-this': [2, 'self'], | ||
'eol-last': 2, | ||
'indent': [2, 2, { | ||
MemberExpression: 1, | ||
VariableDeclarator: { const: 2 }, | ||
FunctionExpression: { parameters: 'off' }, | ||
CallExpression: 'off', | ||
ArrayExpression: 'first', | ||
ObjectExpression: 'first' | ||
MemberExpression: 'off', | ||
VariableDeclarator: { | ||
const: 2 | ||
}, | ||
FunctionExpression: { | ||
parameters: 'first' | ||
}, | ||
CallExpression: { | ||
arguments: 'off' | ||
}, | ||
ArrayExpression: 'first', | ||
ObjectExpression: 'first' | ||
}], | ||
'key-spacing': [0, { beforeColon: false, afterColon: true, mode: 'minimum' }], | ||
'key-spacing': [0, { | ||
beforeColon: false, | ||
afterColon: true, | ||
mode: 'minimum' | ||
}], | ||
'keyword-spacing': 2, | ||
@@ -154,3 +185,5 @@ 'linebreak-style': 2, | ||
'max-statements-per-line': 2, | ||
'new-cap': [2, { capIsNew: false }], | ||
'new-cap': [2, { | ||
capIsNew: false | ||
}], | ||
'new-parens': 2, | ||
@@ -157,0 +190,0 @@ 'newline-after-var': 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){return t.indexOf(e,t.length-e.length)>-1}function n(t){return t.charAt(0).toLowerCase()+t.slice(1)}function r(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])}function o(t){return t.replace(/-([a-z])/g,function(t){return t[1].toUpperCase()})}function i(t){return t.replace(/([A-Z])/g,"-$1").toLowerCase()}function u(t){return t.charAt(0)+(t.match(/([A-Z])/g)||[]).join("").toLowerCase()}function c(t){var e=u(t),n=L[e]&&L[e]!==t?t:e;return M[n]=t,n}function f(t){return Object.keys(t).sort().map(function(e){return e.replace(/CLASS_NAME/g,t[e])}).join("")}function a(t){var e=[],n=[],r=!1;return Object.keys(t).forEach(function(o){"@"===o.charAt(0)?(e.push([o,t[o]]),delete t[o]):" "===o.charAt(0)||":"===o.charAt(0)?(n.push([o,t[o]]),delete t[o]):r=!0}),(r?l(".CLASS_NAME",t):"")+n.map(function(t){return l(".CLASS_NAME"+t[0],t[1])}).join("")+e.map(function(t){return t[0]+"{"+l(".CLASS_NAME",t[1])+"}"}).join("")}function l(t,e){return t+"{"+s("string"==typeof e?p(e):e.style||e)+"}"}function s(t){return Object.keys(d(t)).map(function(e){return g(t,e)}).join("")}function d(t){return Object.keys(t).forEach(function(e){e in P&&(t[P[e]]=t[e],delete t[e]);var n=t[e];n||0===n||""===n?"content"===e&&'"'!==n.charAt(0)?t[e]='"'+n+'"':t[e]=b(e,n):delete t[e]}),t}function p(t){return t.indexOf(";")>-1?m(t):y(t)}function m(t){return t.split(";").reduce(function(t,e){var n=e.trim().split(":"),r=n[0],i=n[1];return r&&i&&(t[o(r.trim())]=i.trim()),t},{})}function y(t){return t.split("\n").reduce(function(t,e){var n=e.trim().split(" ");if(n.length>1){var r=o(n.shift().trim());t[M[r]||r]=n.join(" ").trim()}return t},{})}function h(t){throw new Error("not implemented")}function g(t,e){return(T.test(e)?"-":"")+i(e)+":"+b(e,t[e])+";"}function b(t,e){return e+("number"==typeof e&&N.indexOf(t)>-1?"px":"")}function v(){U=!1,_.textContent=R+f(B)}function A(t){R+=String(t),j()}function O(t){var e=a(t);if(e in B)return B[e];var n=q+ ++Z;return B[e]=n,j(),n}function j(){U||(U=!0,W.resolve().then(v))}function w(t){var e=arguments;if(Array.isArray(t)&&Array.isArray(t.raw))arguments[0]={raw:arguments[0]},r(D,p(String.raw.apply(null,arguments)));else for(var n=0;n<arguments.length;n++)"string"==typeof e[n]?r(D,p(e[n])):"object"==typeof e[n]&&r(D,e[n].style||e[n]);return w}function k(t,e){w[t]=w[c(t)]=x(e||t)}function x(t){return function(e){return D[t]=void 0!==e&&e,w}}function S(t,e){return D=V,D[t]=e,w}function E(t){return function(){return V=D,D={},t}}function C(t,e){Object.defineProperty(w,t,{get:e})}var L={d:"display",bc:"backgroundColor",b:"border",bt:"borderTop",bl:"borderLeft",br:"borderRight",bb:"borderBottom",h:"height",w:"width",c:"color",o:"opacity",fs:"fontSize",m:"margin",mt:"marginTop",ml:"marginLeft",mr:"marginRight",mb:"marginBottom",p:"padding",pt:"paddingTop",pl:"paddingLeft",pr:"paddingRight",pb:"paddingBottom",bs:"boxShadow",ta:"textAlign",tt:"textTransform",ff:"fontFamily",t:"transform"},M=Object.create(null),$=Object.keys(t(document.documentElement.style)).filter(function(t){return"string"==typeof document.documentElement.style[t]}),P=Object.create(null,{}),T=/^(o|O|ms|MS|Ms|moz|Moz|webkit|Webkit|WebKit)([A-Z])/,z=window.navigator.userAgent.indexOf("Edge")>-1,N=function(){var t=document.createElement("div");return $.filter(function(n){try{t.style[n]="1px",t.style.setProperty(n,"1px")}catch(t){return}return e(!z&&t.style[n]||t.style.getPropertyValue(n),"px")}).concat("gridGap")}(),_=document.createElement("style"),B=Object.create(null,{}),R="",Z=0,U=!1,W=window.Promise||{resolve:function(){return{then:function(t){return setTimeout(t,0)}}}};document.head.appendChild(_);var q="b"+("000"+(46656*Math.random()|0).toString(36)).slice(-3)+("000"+(46656*Math.random()|0).toString(36)).slice(-3),F=0,G={},K=["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"],V={},D={};return w.toString=function(){return"."+w.class},w.forceUpdate=v,w.$keyframes=function(t){var e=Object.keys(t).map(function(e){return l(e,t[e])}).join("");if(e in G)return G[e];var n=q+ ++F;return G[e]=n,A("@keyframes "+n+"{"+e+"}"),n},w.prepend=A,w.helper=function(t,e){return 1===arguments.length?h(t):"function"!=typeof e?(delete w[t],void C(t,function(){return r(D,e),w})):void(w[t]=function(){return r(D,e.apply(null,arguments)),w})},w.css=function(t,e){A(l(t,e.style||e))},$.forEach(function(t){if(T.test(t)){var e=n(t.replace(T,"$2"));if(-1===$.indexOf(e))return P[e]=t,k(e,t)}k(t)}),C("style",function(){var t=d(D);return D={},t}),C("class",function(){var t=O(D);return D={},t}),C("$animate",E(function(t,e){return D=V,w.animation(w.$keyframes(e)+" "+t),w})),C("$media",E(function(t,e){return S("@media "+t,e.style||e)})),C("$nest",E(function(t,e){return S((0===t.indexOf(":")?"":" ")+t,e.style||e)})),K.forEach(function(t){return C("$"+o(t),E(function(e,n){return S(":"+t+(n?"("+e+")":""),n?n.style||n:e.style||e)}))}),w}); | ||
!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){return t.indexOf(e,t.length-e.length)>-1}function n(t){return t.charAt(0).toLowerCase()+t.slice(1)}function r(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])}function i(t){return t.replace(/-([a-z])/g,function(t){return t[1].toUpperCase()})}function o(t){return t.replace(/([A-Z])/g,"-$1").toLowerCase()}function u(t){return t.charAt(0)+(t.match(/([A-Z])/g)||[]).join("").toLowerCase()}function c(t){var e=u(t),n=L[e]&&L[e]!==t?t:e;return M[n]=t,n}function f(t){return Object.keys(t).sort().map(function(e){return e.replace(/CLASS_NAME/g,t[e])}).join("")}function a(t){var e=[],n=[],r=!1;return Object.keys(t).forEach(function(i){"@"===i.charAt(0)?(e.push([i,t[i]]),delete t[i]):" "===i.charAt(0)||":"===i.charAt(0)?(n.push([i,t[i]]),delete t[i]):r=!0}),(r?l(".CLASS_NAME",t):"")+n.map(function(t){return l(".CLASS_NAME"+t[0],t[1])}).join("")+e.map(function(t){return t[0]+"{"+l(".CLASS_NAME",t[1])+"}"}).join("")}function l(t,e){return t+"{"+s("string"==typeof e?p(e):e.style||e)+"}"}function s(t){return Object.keys(d(t)).map(function(e){return g(t,e)}).join("")}function d(t){return Object.keys(t).forEach(function(e){e in P&&(t[P[e]]=t[e],delete t[e]);var n=t[e];n||0===n||""===n?"content"===e&&'"'!==n.charAt(0)?t[e]='"'+n+'"':t[e]=b(e,n):delete t[e]}),t}function p(t){return t.indexOf(";")>-1?m(t):y(t)}function m(t){return t.split(";").reduce(function(t,e){var n=e.trim().split(":"),r=n[0],o=n[1];return r&&o&&(t[i(r.trim())]=o.trim()),t},{})}function y(t){return t.split("\n").reduce(function(t,e){var n=e.trim().split(" ");if(n.length>1){var r=i(n.shift().trim());t[M[r]||r]=n.join(" ").trim()}return t},{})}function h(t){throw new Error("not implemented")}function g(t,e){return(z.test(e)?"-":"")+o(e)+":"+b(e,t[e])+";"}function b(t,e){return e+("number"==typeof e&&T.indexOf(t)>-1?"px":"")}function v(){D=!1,_.textContent=Z+f(R)}function A(t){Z+=String(t),O()}function j(t){var e=a(t);if(e in R)return R[e];var n=W+ ++B;return R[e]=n,O(),n}function O(){D||(D=!0,U.resolve().then(v))}function w(t){var e=arguments;if(Array.isArray(t)&&Array.isArray(t.raw))arguments[0]={raw:arguments[0]},r(K,p(String.raw.apply(null,arguments)));else for(var n=0;n<arguments.length;n++)"string"==typeof e[n]?r(K,p(e[n])):"object"==typeof e[n]&&r(K,e[n].style||e[n]);return w}function x(t,e){w[t]=w[c(t)]=k(e||t)}function k(t){return function(e){return K[t]=void 0!==e&&e,w}}function S(t,e){return K=I,K[t]=e,w}function E(t){return function(){return I=K,K={},t}}function C(t,e){Object.defineProperty(w,t,{get:e})}var L={ai:"alignItems",b:"bottom",bc:"backgroundColor",br:"borderRadius",bs:"boxShadow",c:"color",d:"display",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"},M=Object.create(null),$=Object.keys(t(document.documentElement.style)).filter(function(t){return"string"==typeof document.documentElement.style[t]}),P=Object.create(null,{}),z=/^(o|O|ms|MS|Ms|moz|Moz|webkit|Webkit|WebKit)([A-Z])/,N=window.navigator.userAgent.indexOf("Edge")>-1,T=function(){var t=document.createElement("div");return $.filter(function(n){try{t.style[n]="1px",t.style.setProperty(n,"1px")}catch(t){return}return e(!N&&t.style[n]||t.style.getPropertyValue(n),"px")}).concat("gridGap")}(),_=document.createElement("style"),R=Object.create(null,{}),Z="",B=0,D=!1,U=window.Promise||{resolve:function(){return{then:function(t){return setTimeout(t,0)}}}};document.head.appendChild(_);var W="b"+("000"+(46656*Math.random()|0).toString(36)).slice(-3)+("000"+(46656*Math.random()|0).toString(36)).slice(-3),q=0,F={},G=["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"],I={},K={};return w.toString=function(){return"."+w.class},w.forceUpdate=v,w.$keyframes=function(t){var e=Object.keys(t).map(function(e){return l(e,t[e])}).join("");if(e in F)return F[e];var n=W+ ++q;return F[e]=n,A("@keyframes "+n+"{"+e+"}"),n},w.prepend=A,w.helper=function(t,e){return 1===arguments.length?h(t):e===w||"function"!=typeof e?(delete w[t],void C(t,function(){return r(K,e.style||e),w})):void(w[t]=function(){return r(K,e.apply(null,arguments)),w})},w.css=function(t,e){A(l(t,e.style||e))},$.forEach(function(t){if(z.test(t)){var e=n(t.replace(z,"$2"));if(-1===$.indexOf(e))return P[e]=t,x(e,t)}x(t)}),C("style",function(){var t=d(K);return K={},t}),C("class",function(){var t=j(K);return K={},t}),C("$animate",E(function(t,e){return K=I,w.animation(w.$keyframes(e)+" "+t),w})),C("$media",E(function(t,e){return S("@media "+t,e.style||e)})),C("$nest",E(function(t,e){return S((0===t.indexOf(":")?"":" ")+t,e.style||e)})),G.forEach(function(t){return C("$"+i(t),E(function(e,n){return S(":"+t+(n?"("+e+")":""),n?n.style||n:e.style||e)}))}),w}); | ||
//# sourceMappingURL=bss.js.map |
@@ -135,6 +135,6 @@ import keyframes from './keyframes' | ||
if (typeof styling !== 'function') { | ||
if (styling === bss || typeof styling !== 'function') { | ||
delete bss[name] // Needed to avoid weird get calls in chrome | ||
addGetter(name, () => { | ||
assign(style, styling) | ||
assign(style, styling.style || styling) | ||
return bss | ||
@@ -141,0 +141,0 @@ }) |
export default { | ||
d : 'display', | ||
ai : 'alignItems', | ||
b : 'bottom', | ||
bc : 'backgroundColor', | ||
b : 'border', | ||
bt : 'borderTop', | ||
bl : 'borderLeft', | ||
br : 'borderRight', | ||
bb : 'borderBottom', | ||
h : 'height', | ||
w : 'width', | ||
br : 'borderRadius', | ||
bs : 'boxShadow', | ||
c : 'color', | ||
o : 'opacity', | ||
d : 'display', | ||
fd : 'flexDirection', | ||
ff : 'fontFamily', | ||
fs : 'fontSize', | ||
h : 'height', | ||
jc : 'justifyContent', | ||
l : 'left', | ||
m : 'margin', | ||
mt : 'marginTop', | ||
mb : 'marginBottom', | ||
ml : 'marginLeft', | ||
mr : 'marginRight', | ||
mb : 'marginBottom', | ||
mt : 'marginTop', | ||
o : 'opacity', | ||
p : 'padding', | ||
pt : 'paddingTop', | ||
pb : 'paddingBottom', | ||
pl : 'paddingLeft', | ||
pr : 'paddingRight', | ||
pb : 'paddingBottom', | ||
bs : 'boxShadow', | ||
pt : 'paddingTop', | ||
r : 'right', | ||
t : 'top', | ||
ta : 'textAlign', | ||
td : 'textDecoration', | ||
tt : 'textTransform', | ||
ff : 'fontFamily', | ||
t : 'transform' | ||
w : 'width', | ||
} |
{ | ||
"name": "bss", | ||
"version": "0.1.1", | ||
"version": "0.1.2", | ||
"description": "Better Style Sheets", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
@@ -39,3 +39,3 @@ [![version](https://img.shields.io/npm/v/bss.svg)]() [![gzipped](http://img.badgesize.io/porsager/bss/master/bss.js.svg?compression=gzip&label=gzipped)]() [![license](https://img.shields.io/github/license/porsager/wright.svg)]() | ||
Here's a quick example of using bss togher with [mithril](https://github.com/mithriljs/mithril.js) | ||
See the example [live here](https://flems.io) | ||
See the example [live here](https://flems.io/#0=N4IgtglgJlA2CmIBcBWFA6AzCgNCA9gK4AuADicsQE6Hx4DO8CAxsfFMiOgFb0h4AzCAj5IA2qAB2AQzCIkXXvxDN8ktus4JiAAjU6AvDuq0AOpPNh0YIuoAUUfM0Jz16AEb4oATxw7g5jo6AG4Q8ADuSCGSXvCGAHw6YHYA5AAWAIwpOgDUOu4ezKlU7CkAlOhFKeFpEGzl6AL0dpgATBXE0qnM8OrwVOV+AZJBQfTE3ghRBe5F+gBk8zopAOYlvQ3jk3SBo2rMsBDMANZRdmUJeiNGAIRquwC+fikAEkyw+Drh+FSwUOXmB5lEAPAC6eEOkmOogkIEIv04aWIZHoSAA9GjCJJSMcVpV8GA0ZBiGkqMIAAIZdBUzDKCakeQgJR4UjSYjMNLwGFiDJ4dgASUkUHgAA9TCBlLsdModAAfWU6NnUfgZABsOFaAAYcJhMGrMDq9arMOCeXhWOxxTpFjK7FKgjLgjFhegODg1RqACyGjIATgNur9JpwZpAxAgwXgAFEEK5iOYZaMgvLorFXQT0KySuoY-A44YDEYdAASRzMdDSVgR6Ox3rxkajMoJvCmYgPcytgRYqtqfitb0ADgA7IbWnrR3rQaCnqB4bBEcjSKiMVicXjVIT3PQ+Hh6YylGCHkA) | ||
@@ -57,3 +57,3 @@ ``` js | ||
Creates the following in the dom. | ||
Creates the following in the dom, which toggles the style attribute on click. | ||
``` html | ||
@@ -70,3 +70,3 @@ | ||
<body> | ||
<h1 class="bdp4f3o1" style="background:red;">Hello world</h1> | ||
<h1 class="bdp4f3o1" style="background:green;">Hello world</h1> | ||
</body> | ||
@@ -157,3 +157,3 @@ ``` | ||
Short property names can also be used and are the acronyms of full css properties with collisions [handpicked by popularity](https://github.com/porsager/bss/lib/popular.js) | ||
Short property names can also be used and are the acronyms of full css properties with collisions [handpicked by popularity](lib/popular.js) | ||
@@ -178,3 +178,3 @@ ``` js | ||
b.helper('f1', b.fontSize('3rem')) | ||
b.helper('pa1', b.padding('0.25rem')) | ||
b.helper('p1', b.padding('0.25rem')) | ||
``` | ||
@@ -181,0 +181,0 @@ |
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
58345
845