Socket
Socket
Sign inDemoInstall

bss

Package Overview
Dependencies
Maintainers
1
Versions
69
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bss - npm Package Compare versions

Comparing version 1.1.0 to 1.1.1

65

bss.js

@@ -344,15 +344,20 @@ (function (global, factory) {

bss.setDebug = setDebug;
function setProp(prop, value) {
Object.defineProperty(bss, prop, {
value: value
});
}
bss.style = {};
bss.valueOf = function() {
setProp('setDebug', setDebug);
setProp('valueOf', function ValueOf() {
return '.' + this.class
};
});
bss.$keyframes = keyframes;
bss.getSheet = getSheet;
bss.helper = helper;
bss.css = css;
bss.classPrefix = classPrefix;
setProp('$keyframes', keyframes);
setProp('getSheet', getSheet);
setProp('helper', helper);
setProp('css', css);
setProp('classPrefix', classPrefix);

@@ -386,14 +391,17 @@ function chain(instance) {

bss.content = function(arg) {
setProp('content', function Content(arg) {
this.style.content = '"' + arg + '"';
return chain(this)
};
});
Object.defineProperty(bss, 'class', {
set: function(value) {
this.__class = value;
},
get: function() {
return createClass(this.style)
return this.__class || createClass(this.style)
}
});
bss.$media = function(value, style) {
setProp('$media', function Media(value, style) {
if (value)

@@ -403,5 +411,5 @@ { this.style['@media ' + value] = parse(style); }

return chain(this)
};
});
bss.$nest = function(value, style) {
setProp('$nest', function Nest(value, style) {
if (value)

@@ -411,8 +419,8 @@ { this.style[(value.charAt(0) === ':' ? '' : ' ') + value] = parse(style); }

return chain(this)
};
});
pseudos.forEach(function (name) { return bss['$' + hyphenToCamelCase(name)] = function(value, b) {
pseudos.forEach(function (name) { return setProp('$' + hyphenToCamelCase(name), function Pseudo(value, b) {
this.style[':' + name + (b ? '(' + value + ')' : '')] = parse(b || value);
return chain(this)
}; }
}); }
);

@@ -445,5 +453,7 @@

if (typeof styling === 'object') {
delete bss[name]; // Needed to avoid weird get calls in chrome
delete bss[name]; // Needed to avoid weird get calls in chrome
typeof styling === 'object'
?
Object.defineProperty(bss, name, {
configurable: true,
get: function() {

@@ -453,11 +463,12 @@ assign(this.style, parse(styling));

}
})
:
Object.defineProperty(bss, name, {
configurable: true,
value: function Helper() {
var result = styling.apply(null, arguments);
assign(this.style, result.style);
return chain(this)
}
});
return
}
bss[name] = function Helper() {
var result = styling.apply(null, arguments);
assign(this.style, result.style);
return chain(this)
};
}

@@ -464,0 +475,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";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)}),$});
!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=f(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 s(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 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 s($.style,c.apply(null,arguments)),C($)}function P(t,e){Object.defineProperty($,t,{value:e})}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 $.style={},P("setDebug",function(t){b=t}),P("valueOf",function(){return"."+this.class}),P("$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}),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 s(this.style,c(n)),C(this)}}):Object.defineProperty($,e,{configurable:!0,value:function(){var t=n.apply(null,arguments);return s(this.style,t.style),C(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,c(n)),0)}),P("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)}),P("content",function(t){return this.style.content='"'+t+'"',C(this)}),Object.defineProperty($,"class",{set:function(t){this.__class=t},get:function(){return this.__class||A(this.style)}}),P("$media",function(t,e){return t&&(this.style["@media "+t]=c(e)),C(this)}),P("$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 P("$"+f(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

@@ -30,15 +30,20 @@ import keyframes from './keyframes'

bss.setDebug = setDebug
function setProp(prop, value) {
Object.defineProperty(bss, prop, {
value
})
}
bss.style = {}
bss.valueOf = function() {
setProp('setDebug', setDebug)
setProp('valueOf', function ValueOf() {
return '.' + this.class
}
})
bss.$keyframes = keyframes
bss.getSheet = getSheet
bss.helper = helper
bss.css = css
bss.classPrefix = classPrefix
setProp('$keyframes', keyframes)
setProp('getSheet', getSheet)
setProp('helper', helper)
setProp('css', css)
setProp('classPrefix', classPrefix)

@@ -72,14 +77,17 @@ function chain(instance) {

bss.content = function(arg) {
setProp('content', function Content(arg) {
this.style.content = '"' + arg + '"'
return chain(this)
}
})
Object.defineProperty(bss, 'class', {
set: function(value) {
this.__class = value
},
get: function() {
return createClass(this.style)
return this.__class || createClass(this.style)
}
})
bss.$media = function(value, style) {
setProp('$media', function Media(value, style) {
if (value)

@@ -89,5 +97,5 @@ this.style['@media ' + value] = parse(style)

return chain(this)
}
})
bss.$nest = function(value, style) {
setProp('$nest', function Nest(value, style) {
if (value)

@@ -97,9 +105,9 @@ this.style[(value.charAt(0) === ':' ? '' : ' ') + value] = parse(style)

return chain(this)
}
})
pseudos.forEach(name =>
bss['$' + hyphenToCamelCase(name)] = function(value, b) {
setProp('$' + hyphenToCamelCase(name), function Pseudo(value, b) {
this.style[':' + name + (b ? '(' + value + ')' : '')] = parse(b || value)
return chain(this)
}
})
)

@@ -132,5 +140,7 @@

if (typeof styling === 'object') {
delete bss[name] // Needed to avoid weird get calls in chrome
delete bss[name] // Needed to avoid weird get calls in chrome
typeof styling === 'object'
?
Object.defineProperty(bss, name, {
configurable: true,
get: function() {

@@ -141,10 +151,11 @@ assign(this.style, parse(styling))

})
return
}
bss[name] = function Helper() {
const result = styling.apply(null, arguments)
assign(this.style, result.style)
return chain(this)
}
:
Object.defineProperty(bss, name, {
configurable: true,
value: function Helper() {
const result = styling.apply(null, arguments)
assign(this.style, result.style)
return chain(this)
}
})
}

@@ -151,0 +162,0 @@

{
"name": "bss",
"version": "1.1.0",
"version": "1.1.1",
"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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc