Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

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.5.0 to 1.5.1

4

bss.esm.js

@@ -181,3 +181,3 @@ var pseudos = [

var base = {};
var extra = suffix.indexOf('&') > -1 && suffix.indexOf(',') === -1 ? '' : '&';
var rules = [];

@@ -196,3 +196,3 @@

rules.unshift(
((single || (suffix.charAt(0) === ' ') ? '' : '&') + '&' + suffix).replace(/&/g, selector) +
((single || (suffix.charAt(0) === ' ') ? '' : '&') + extra + suffix).replace(/&/g, selector).trim() +
'{' + stylesToCss(base) + '}'

@@ -199,0 +199,0 @@ );

@@ -187,3 +187,3 @@ (function (global, factory) {

var base = {};
var extra = suffix.indexOf('&') > -1 && suffix.indexOf(',') === -1 ? '' : '&';
var rules = [];

@@ -202,3 +202,3 @@

rules.unshift(
((single || (suffix.charAt(0) === ' ') ? '' : '&') + '&' + suffix).replace(/&/g, selector) +
((single || (suffix.charAt(0) === ' ') ? '' : '&') + extra + suffix).replace(/&/g, selector).trim() +
'{' + stylesToCss(base) + '}'

@@ -205,0 +205,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 i={ai:"alignItems",b:"bottom",bc:"backgroundColor",br:"borderRadius",bs:"boxShadow",bi:"backgroundImage",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"},o=["float"].concat(Object.keys("undefined"==typeof document?{}:function t(e){return e?e.hasOwnProperty("width")?e:t(Object.getPrototypeOf(e)):{}}(document.documentElement.style)).filter(function(t){return-1===t.indexOf("-")&&"length"!==t}));var u=/^-?-?[a-z][a-z-_0-9]*$/i,t=function(e,r){return void 0===r&&(r={}),function(t){return t in r?r[t]:r[t]=e(t)}};function l(t,e,r){e in t?l(t,"!"+e,r):t[e]=function t(e,r){return Array.isArray(r)?r.map(function(t){return d(e,t)}).join(" "):"string"==typeof r?t(e,r.split(" ")):d(e,r)}(e,r)}var c=Object.create(null,{}),a=Object.create(null,{}),f=/^(o|O|ms|MS|Ms|moz|Moz|webkit|Webkit|WebKit)([A-Z])/,r=t(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:"",boxShadow:"px",border:"px",borderTop:"px",borderRight:"px",borderBottom:"px",borderLeft:"px"});function s(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r]);return t}function p(t){return t.slice("-"===t.charAt(0)?1:0).replace(/-([a-z])/g,function(t){return t[1].toUpperCase()})}function y(e,r,n,i){void 0===n&&(n="");var o={},c=[];return Object.keys(e).forEach(function(t){"@"===t.charAt(0)?c.push(t+"{"+y(e[t],r,n,i)+"}"):"object"==typeof e[t]?c=c.concat(y(e[t],r,n+t,i)):o[t]=e[t]}),Object.keys(o).length&&c.unshift(((i||" "===n.charAt(0)?"":"&")+"&"+n).replace(/&/g,r)+"{"+h(o)+"}"),c}var n=/,(?=(?:(?:[^"]*"){2})*[^"]*$)/;function h(i){return Object.keys(i).reduce(function(t,e){return t+(r=e.replace(/!/g,""),n=i[e],r=r in c?c[r]:r,(f.test(r)?"-":"")+(g(r)?r:r.replace(/(\B[A-Z])/g,"-$1").toLowerCase())+":"+n+";");var r,n},"")}function d(t,e){return e in a?a[e]:e+(isNaN(e)||null===e||"boolean"==typeof e||g(t)?"":r(t))}function g(t){return"-"===t.charAt(0)&&"-"===t.charAt(1)}var b="object"==typeof document&&document.createElement("style");b&&document.head&&document.head.appendChild(b);var m=b&&b.sheet,_=!1,v=Object.create(null,{}),j=[],O=0,x="b"+("000"+(46656*Math.random()|0).toString(36)).slice(-3)+("000"+(46656*Math.random()|0).toString(36)).slice(-3);function A(t,e){if(j.push(t),_)return b.textContent=j.join("\n");try{m&&m.insertRule(t,1<arguments.length?e:m.cssRules.length)}catch(t){}}var k=Object.create(null);function w(t,e){var r=$(w);return t&&s(r.__style,D.apply(null,arguments)),r}function S(t,e){Object.defineProperty(w,t,{configurable:!0,value:e})}function $(t){var e=Object.create(w,{__style:{value:s({},t.__style)},style:{enumerable:!0,get:function(){var r=this;return Object.keys(this.__style).reduce(function(t,e){return"number"!=typeof r.__style[e]&&"string"!=typeof r.__style[e]||(t[e.replace(/^!/,"")]=r.__style[e]),t},{})}}});return t===w&&(w.__style={}),e}function E(t,e,r){t[e.split(n).map(function(t){return(":"===(t=t.trim()).charAt(0)||"["===t.charAt(0)?"":" ")+t}).join(",&")]=D(r)}function P(r){return function(t){var e=$(this);return t||0===t?0<arguments.length&&l(e.__style,r,Array.prototype.slice.call(arguments)):delete e.__style[r],e}}function C(t,e){y(D(e),t,"",!0).forEach(A)}function L(e,n){if(1===arguments.length)return Object.keys(e).forEach(function(t){return L(t,e[t])});delete w[e],"function"==typeof n?(L[e]=n,Object.defineProperty(w,e,{configurable:!0,value:function(t){var e=$(this),r=T(t)?n(N(t,arguments)):n.apply(null,arguments);return s(e.__style,r.__style),e}})):(L[e]=D(n),Object.defineProperty(w,e,{configurable:!0,get:function(){var t=$(this);return s(t.__style,D(n)),t}}))}function R(t){var e,r=(e=t).charAt(0)+(e.match(/([A-Z])/g)||[]).join("").toLowerCase(),n=i[r]&&i[r]!==t?t:r;return k[n]=t,n}Object.defineProperties(w,{__style:{configurable:!0,writable:!0,value:{}},valueOf:{configurable:!0,writable:!0,value:function(){return"."+this.class}},toString:{configurable:!0,writable:!0,value:function(){return this.class}}}),S("setDebug",function(t){_=t}),S("$keyframes",function(r){var t=Object.keys(r).reduce(function(t,e){return t+e+"{"+h(D(r[e]))+"}"},"");if(t in B)return B[t];var e=x+M++;return A("@keyframes "+(B[t]=e)+"{"+t+"}"),e}),S("$media",function(t,e){var r=$(this);t&&(r.__style["@media "+t]=D(e));return r}),S("$import",function(t){t&&A("@import "+t+";",0);return $(this)}),S("$nest",function(e,t){var r=$(this);1===arguments.length?Object.keys(e).forEach(function(t){return E(r.__style,t,e[t])}):e&&E(r.__style,e,t);return r}),S("getSheet",function(){var t=j.join("");return j=[],v=Object.create(null,{}),O=0,t}),S("getRules",function(){return j}),S("helper",L),S("css",function(e,t){1===arguments.length?Object.keys(e).forEach(function(t){return C(t,e[t])}):C(e,t);return $(this)}),S("classPrefix",x),o.forEach(function(t){var e,r=t.match(f);if(r){var n=(e=t.replace(f,"$2")).charAt(0).toLowerCase()+e.slice(1);if(-1===o.indexOf(n))return"flexDirection"===n&&(a.flex="-"+r[1].toLowerCase()+"-flex"),S(n,P(c[n]=t)),void S(R(n),w[n])}S(t,P(t)),S(R(t),w[t])}),S("content",function(t){var e=$(this);return null==t||!1===t?delete e.__style.content:e.__style.content='"'+t+'"',e}),Object.defineProperty(w,"class",{set:function(t){this.__class=t},get:function(){return this.__class||function(t){var e=JSON.stringify(t);if(e in v)return v[e];for(var r=x+ ++O,n=y(t,"."+r),i=0;i<n.length;i++)A(n[i]);return v[e]=r}(this.__style)}}),[":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(n){return S("$"+p(n.replace(/:/g,"")),function(t,e){var r=$(this);return T(t)?r.__style[n]=D.apply(null,arguments):(t||e)&&(r.__style[n+(e?"("+t+")":"")]=D(e||t)),r})}),w.helper("$animate",function(t,e){return w.animation(w.$keyframes(e)+" "+t)});var z=t(function(t){var c,a="";return t.trim().replace(/\/\*[\s\S]*?\*\/|([^:]|^)\/\/.*/g,"").split(/;|\n/).reduce(function(t,e){if(!e)return t;var r=(e=a+e.trim()).replace(/[ :]+/," ").split(" "),n=r[0],i=r.slice(1);if(a=","===e.charAt(e.length-1)?e:"")return t;if(","===e.charAt(0)||!u.test(n))return t[c]+=" "+e,t;if(!n)return t;var o="-"===n.charAt(0)&&"-"===n.charAt(1)?n:p(n);return c=k[o]||o,o in L?s(t,"function"==typeof L[o]?L[o].apply(L,i).__style:L[o]):0<i.length&&l(t,c,i),t},{})}),M=0,B={};function D(t,e){var r;return"string"==typeof t?"string"==typeof e||"number"==typeof e?((r={})[t]=e,r):z(t):T(t)?z(N(t,arguments)):t.__style||function n(i){return Object.keys(i).reduce(function(t,e){var r=i[e];return e=k[e]||e,(r||0===r||""===r)&&("content"===e&&'"'!==r.charAt(0)?t[e]='"'+r+'"':"object"==typeof r?t[e]=n(r):l(t,e,r)),t},{})}(t)}function T(t){return Array.isArray(t)&&"string"==typeof t[0]}function N(t,e){for(var r="",n=0;n<t.length;n++)r+=t[n]+(e[n+1]||"");return r}return 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";var i={ai:"alignItems",b:"bottom",bc:"backgroundColor",br:"borderRadius",bs:"boxShadow",bi:"backgroundImage",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"},o=["float"].concat(Object.keys("undefined"==typeof document?{}:function t(e){return e?e.hasOwnProperty("width")?e:t(Object.getPrototypeOf(e)):{}}(document.documentElement.style)).filter(function(t){return-1===t.indexOf("-")&&"length"!==t}));var u=/^-?-?[a-z][a-z-_0-9]*$/i,t=function(e,n){return void 0===n&&(n={}),function(t){return t in n?n[t]:n[t]=e(t)}};function l(t,e,n){e in t?l(t,"!"+e,n):t[e]=function t(e,n){return Array.isArray(n)?n.map(function(t){return h(e,t)}).join(" "):"string"==typeof n?t(e,n.split(" ")):h(e,n)}(e,n)}var c=Object.create(null,{}),a=Object.create(null,{}),f=/^(o|O|ms|MS|Ms|moz|Moz|webkit|Webkit|WebKit)([A-Z])/,n=t(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:"",boxShadow:"px",border:"px",borderTop:"px",borderRight:"px",borderBottom:"px",borderLeft:"px"});function s(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);return t}function p(t){return t.slice("-"===t.charAt(0)?1:0).replace(/-([a-z])/g,function(t){return t[1].toUpperCase()})}function y(e,n,r,i){void 0===r&&(r="");var o={},t=-1<r.indexOf("&")&&-1===r.indexOf(",")?"":"&",c=[];return Object.keys(e).forEach(function(t){"@"===t.charAt(0)?c.push(t+"{"+y(e[t],n,r,i)+"}"):"object"==typeof e[t]?c=c.concat(y(e[t],n,r+t,i)):o[t]=e[t]}),Object.keys(o).length&&c.unshift(((i||" "===r.charAt(0)?"":"&")+t+r).replace(/&/g,n).trim()+"{"+d(o)+"}"),c}var r=/,(?=(?:(?:[^"]*"){2})*[^"]*$)/;function d(i){return Object.keys(i).reduce(function(t,e){return t+(n=e.replace(/!/g,""),r=i[e],n=n in c?c[n]:n,(f.test(n)?"-":"")+(g(n)?n:n.replace(/(\B[A-Z])/g,"-$1").toLowerCase())+":"+r+";");var n,r},"")}function h(t,e){return e in a?a[e]:e+(isNaN(e)||null===e||"boolean"==typeof e||g(t)?"":n(t))}function g(t){return"-"===t.charAt(0)&&"-"===t.charAt(1)}var b="object"==typeof document&&document.createElement("style");b&&document.head&&document.head.appendChild(b);var m=b&&b.sheet,_=!1,v=Object.create(null,{}),j=[],O=0,x="b"+("000"+(46656*Math.random()|0).toString(36)).slice(-3)+("000"+(46656*Math.random()|0).toString(36)).slice(-3);function A(t,e){if(j.push(t),_)return b.textContent=j.join("\n");try{m&&m.insertRule(t,1<arguments.length?e:m.cssRules.length)}catch(t){}}var k=Object.create(null);function w(t,e){var n=$(w);return t&&s(n.__style,D.apply(null,arguments)),n}function S(t,e){Object.defineProperty(w,t,{configurable:!0,value:e})}function $(t){var e=Object.create(w,{__style:{value:s({},t.__style)},style:{enumerable:!0,get:function(){var n=this;return Object.keys(this.__style).reduce(function(t,e){return"number"!=typeof n.__style[e]&&"string"!=typeof n.__style[e]||(t[e.replace(/^!/,"")]=n.__style[e]),t},{})}}});return t===w&&(w.__style={}),e}function E(t,e,n){t[e.split(r).map(function(t){return(":"===(t=t.trim()).charAt(0)||"["===t.charAt(0)?"":" ")+t}).join(",&")]=D(n)}function P(n){return function(t){var e=$(this);return t||0===t?0<arguments.length&&l(e.__style,n,Array.prototype.slice.call(arguments)):delete e.__style[n],e}}function C(t,e){y(D(e),t,"",!0).forEach(A)}function L(e,r){if(1===arguments.length)return Object.keys(e).forEach(function(t){return L(t,e[t])});delete w[e],"function"==typeof r?(L[e]=r,Object.defineProperty(w,e,{configurable:!0,value:function(t){var e=$(this),n=T(t)?r(N(t,arguments)):r.apply(null,arguments);return s(e.__style,n.__style),e}})):(L[e]=D(r),Object.defineProperty(w,e,{configurable:!0,get:function(){var t=$(this);return s(t.__style,D(r)),t}}))}function R(t){var e,n=(e=t).charAt(0)+(e.match(/([A-Z])/g)||[]).join("").toLowerCase(),r=i[n]&&i[n]!==t?t:n;return k[r]=t,r}Object.defineProperties(w,{__style:{configurable:!0,writable:!0,value:{}},valueOf:{configurable:!0,writable:!0,value:function(){return"."+this.class}},toString:{configurable:!0,writable:!0,value:function(){return this.class}}}),S("setDebug",function(t){_=t}),S("$keyframes",function(n){var t=Object.keys(n).reduce(function(t,e){return t+e+"{"+d(D(n[e]))+"}"},"");if(t in B)return B[t];var e=x+M++;return A("@keyframes "+(B[t]=e)+"{"+t+"}"),e}),S("$media",function(t,e){var n=$(this);t&&(n.__style["@media "+t]=D(e));return n}),S("$import",function(t){t&&A("@import "+t+";",0);return $(this)}),S("$nest",function(e,t){var n=$(this);1===arguments.length?Object.keys(e).forEach(function(t){return E(n.__style,t,e[t])}):e&&E(n.__style,e,t);return n}),S("getSheet",function(){var t=j.join("");return j=[],v=Object.create(null,{}),O=0,t}),S("getRules",function(){return j}),S("helper",L),S("css",function(e,t){1===arguments.length?Object.keys(e).forEach(function(t){return C(t,e[t])}):C(e,t);return $(this)}),S("classPrefix",x),o.forEach(function(t){var e,n=t.match(f);if(n){var r=(e=t.replace(f,"$2")).charAt(0).toLowerCase()+e.slice(1);if(-1===o.indexOf(r))return"flexDirection"===r&&(a.flex="-"+n[1].toLowerCase()+"-flex"),S(r,P(c[r]=t)),void S(R(r),w[r])}S(t,P(t)),S(R(t),w[t])}),S("content",function(t){var e=$(this);return null==t||!1===t?delete e.__style.content:e.__style.content='"'+t+'"',e}),Object.defineProperty(w,"class",{set:function(t){this.__class=t},get:function(){return this.__class||function(t){var e=JSON.stringify(t);if(e in v)return v[e];for(var n=x+ ++O,r=y(t,"."+n),i=0;i<r.length;i++)A(r[i]);return v[e]=n}(this.__style)}}),[":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(r){return S("$"+p(r.replace(/:/g,"")),function(t,e){var n=$(this);return T(t)?n.__style[r]=D.apply(null,arguments):(t||e)&&(n.__style[r+(e?"("+t+")":"")]=D(e||t)),n})}),w.helper("$animate",function(t,e){return w.animation(w.$keyframes(e)+" "+t)});var z=t(function(t){var c,a="";return t.trim().replace(/\/\*[\s\S]*?\*\/|([^:]|^)\/\/.*/g,"").split(/;|\n/).reduce(function(t,e){if(!e)return t;var n=(e=a+e.trim()).replace(/[ :]+/," ").split(" "),r=n[0],i=n.slice(1);if(a=","===e.charAt(e.length-1)?e:"")return t;if(","===e.charAt(0)||!u.test(r))return t[c]+=" "+e,t;if(!r)return t;var o="-"===r.charAt(0)&&"-"===r.charAt(1)?r:p(r);return c=k[o]||o,o in L?s(t,"function"==typeof L[o]?L[o].apply(L,i).__style:L[o]):0<i.length&&l(t,c,i),t},{})}),M=0,B={};function D(t,e){var n;return"string"==typeof t?"string"==typeof e||"number"==typeof e?((n={})[t]=e,n):z(t):T(t)?z(N(t,arguments)):t.__style||function r(i){return Object.keys(i).reduce(function(t,e){var n=i[e];return e=k[e]||e,(n||0===n||""===n)&&("content"===e&&'"'!==n.charAt(0)?t[e]='"'+n+'"':"object"==typeof n?t[e]=r(n):l(t,e,n)),t},{})}(t)}function T(t){return Array.isArray(t)&&"string"==typeof t[0]}function N(t,e){for(var n="",r=0;r<t.length;r++)n+=t[r]+(e[r+1]||"");return n}return w});
//# sourceMappingURL=bss.min.js.map
## v[Unreleased]
## v1.5.1 -
- Add better `&`` handling in `$nest`
## v1.5.0 -

@@ -4,0 +7,0 @@ - Support comments in template strings

@@ -82,3 +82,3 @@ export const cssProperties = ['float'].concat(Object.keys(

const base = {}
const extra = suffix.indexOf('&') > -1 && suffix.indexOf(',') === -1 ? '' : '&'
let rules = []

@@ -97,3 +97,3 @@

rules.unshift(
((single || (suffix.charAt(0) === ' ') ? '' : '&') + '&' + suffix).replace(/&/g, selector) +
((single || (suffix.charAt(0) === ' ') ? '' : '&') + extra + suffix).replace(/&/g, selector).trim() +
'{' + stylesToCss(base) + '}'

@@ -100,0 +100,0 @@ )

{
"name": "bss",
"version": "1.5.0",
"version": "1.5.1",
"description": "Better Style Sheets",

@@ -5,0 +5,0 @@ "main": "bss.js",

@@ -247,3 +247,8 @@ [![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/bss.svg)]()

`&` is a placeholder for the generated class like in `sass/less`.
Once you use `&` in `$nest` you take full responsibility of adding the generated class in the correct places to avoid creating global selectors.
One case where this could happen is if using the comma seperator to make multiple selectores, like doing `$nest('th &, tr', ...)`. This would create a global `tr` style. To do this right the code would need to be `$nest('th &, tr &, ...)`.
Normally bss handles this for you such that `$nest('th, tr', ...)` will be scoped locally, but using `&` overrides this behavior.
## `.$media` @media queries

@@ -250,0 +255,0 @@

@@ -201,3 +201,9 @@ const o = require('ospec')

const cls = b.$nest({ 'th &' : b('background blue') }).class
o(b.getSheet()).equals(`.${cls} th .${cls}{background:blue;}`)
o(b.getSheet()).equals(`th .${cls}{background:blue;}`)
const cls2 = b.$nest({ 'th&' : b('background blue') }).class
o(b.getSheet()).equals(`th.${cls2}{background:blue;}`)
const cls3 = b.$nest({ '& th' : b('background blue') }).class
o(b.getSheet()).equals(`.${cls3} th{background:blue;}`)
})

@@ -204,0 +210,0 @@

Sorry, the diff of this file is not supported yet

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