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

postcss-grid-system

Package Overview
Dependencies
Maintainers
1
Versions
33
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

postcss-grid-system - npm Package Compare versions

Comparing version 0.4.13 to 0.4.14

15

lib/blocs-query.js

@@ -10,7 +10,7 @@ "use strict";

var _utils = _interopRequireDefault(require("./utils"));
var _utils = require("./utils");
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
const blocsQuery = (blocs, node, opts, breakpoint) => {
var _default = (blocs, node, opts, breakpoint) => {
if (blocs.length) {

@@ -23,11 +23,9 @@ const blocWidth = {};

if (blocs[unit] && blocs[unit][width] && blocs[unit][width][1]) {
_utils.default.selectorsAdd(blocWidth[width], blocs[unit][width][1]);
_utils.default.selectorsAdd(blocLeft[width], blocs[unit][width][1]);
(0, _utils.selectorsAdd)(blocWidth[width], blocs[unit][width][1]);
(0, _utils.selectorsAdd)(blocLeft[width], blocs[unit][width][1]);
}
if (blocs[unit] && blocs[unit][width] && blocs[unit][width][0]) {
_utils.default.selectorsAdd(blocWidth[width], blocs[unit][width][0]);
_utils.default.selectorsAdd(blocRight[width], blocs[unit][width][0]);
(0, _utils.selectorsAdd)(blocWidth[width], blocs[unit][width][0]);
(0, _utils.selectorsAdd)(blocRight[width], blocs[unit][width][0]);
}

@@ -101,3 +99,2 @@ };

var _default = blocsQuery;
exports.default = _default;

7

lib/blocs.js

@@ -10,11 +10,11 @@ "use strict";

var _utils = _interopRequireDefault(require("./utils"));
var _utils = require("./utils");
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
const b = (blocs, node, opts) => {
var _default = (blocs, node, opts) => {
if (blocs.length) {
const bloc = _postcss.default.rule();
bloc.selectors = _utils.default.flatten(blocs);
bloc.selectors = (0, _utils.flatten)(blocs);
bloc.append({

@@ -45,3 +45,2 @@ prop: 'margin-right',

var _default = b;
exports.default = _default;

@@ -10,7 +10,7 @@ "use strict";

var _utils = _interopRequireDefault(require("./utils"));
var _utils = require("./utils");
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
const columnsQuery = (columns, node, opts, breakpoint) => {
var _default = (columns, node, opts, breakpoint) => {
if (columns.length) {

@@ -40,3 +40,3 @@ const columnCount = {};

if (i1) {
_utils.default.selectorsAdd(columnCount[i1], columns[units][width][0]);
(0, _utils.selectorsAdd)(columnCount[i1], columns[units][width][0]);
}

@@ -56,3 +56,2 @@ }

var _default = columnsQuery;
exports.default = _default;

@@ -10,11 +10,11 @@ "use strict";

var _utils = _interopRequireDefault(require("./utils"));
var _utils = require("./utils");
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
const c = (columns, node, opts) => {
var _default = (columns, node, opts) => {
if (columns.length) {
const columnsGap = _postcss.default.rule();
columnsGap.selectors = _utils.default.flatten(columns);
columnsGap.selectors = (0, _utils.flatten)(columns);
columnsGap.append({

@@ -28,3 +28,2 @@ prop: 'column-gap',

var _default = c;
exports.default = _default;

@@ -10,7 +10,7 @@ "use strict";

var _utils = _interopRequireDefault(require("./utils"));
var _utils = require("./utils");
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
const containersQuery = (containers, node, opts, breakpoint) => {
var _default = (containers, node, opts, breakpoint) => {
if (containers.length) {

@@ -23,3 +23,3 @@ const containerQuery = _postcss.default.rule();

if (containers[i] && containers[i].length) {
_utils.default.selectorsAdd(containerQuery, containers[i]);
(0, _utils.selectorsAdd)(containerQuery, containers[i]);
}

@@ -36,3 +36,2 @@ }

var _default = containersQuery;
exports.default = _default;

@@ -10,11 +10,11 @@ "use strict";

var _utils = _interopRequireDefault(require("./utils"));
var _utils = require("./utils");
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
const c = (containers, node, opts) => {
var _default = (containers, node, opts) => {
if (containers.length) {
const container = _postcss.default.rule();
container.selectors = _utils.default.flatten(containers);
container.selectors = (0, _utils.flatten)(containers);
container.append({

@@ -48,3 +48,2 @@ prop: 'padding-left',

var _default = c;
exports.default = _default;

@@ -12,3 +12,3 @@ "use strict";

const fractionsQuery = (fractions, node, opts) => {
var _default = (fractions, node, opts) => {
if (fractions && fractions.length) {

@@ -54,3 +54,2 @@ for (let total = 2; total < fractions.length; total += 1) {

var _default = fractionsQuery;
exports.default = _default;

@@ -10,11 +10,11 @@ "use strict";

var _utils = _interopRequireDefault(require("./utils"));
var _utils = require("./utils");
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
const f = (fractions, node, opts) => {
var _default = (fractions, node, opts) => {
if (fractions.length) {
const fraction = _postcss.default.rule();
fraction.selectors = _utils.default.flatten(fractions);
fraction.selectors = (0, _utils.flatten)(fractions);
fraction.append({

@@ -45,3 +45,2 @@ prop: 'margin-right',

var _default = f;
exports.default = _default;

@@ -33,3 +33,3 @@ "use strict";

// import util from 'util';
const gridSystem = (e, rootCss, opts) => {
var _default = (e, rootCss, opts) => {
(0, _containers.default)(e.containers, rootCss, opts);

@@ -68,3 +68,2 @@ (0, _rows.default)(e.rows, rootCss, opts);

var _default = gridSystem;
exports.default = _default;
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _postcss = _interopRequireDefault(require("postcss"));
var _utils = _interopRequireDefault(require("./utils"));
var _utils = require("./utils");

@@ -16,3 +11,3 @@ var _gridSystem = _interopRequireDefault(require("./grid-system"));

const postcssGridSystem = _postcss.default.plugin('postcss-grid-system', opts => {
module.exports = _postcss.default.plugin('postcss-grid-system', opts => {
const options = {

@@ -47,9 +42,7 @@ width: 20.5,

e.containers[breakpoint].push(decl.parent.selector);
_utils.default.nodeClean(decl, true);
(0, _utils.nodeClean)(decl, true);
} else if (value[0] === 'row') {
e.rows[breakpoint] = e.rows[breakpoint] || [];
e.rows[breakpoint].push(decl.parent.selector);
_utils.default.nodeClean(decl, true);
(0, _utils.nodeClean)(decl, true);
} else if (value[0] === 'bloc') {

@@ -67,3 +60,3 @@ e.blocs[breakpoint] = e.blocs[breakpoint] || [];

_utils.default.nodeClean(decl, true);
(0, _utils.nodeClean)(decl, true);
} else if (value[0] === 'fraction') {

@@ -75,4 +68,3 @@ const i = value[1].split('/');

e.fractions[breakpoint][i[1]][i[0]].push(decl.parent.selector);
_utils.default.nodeClean(decl, true);
(0, _utils.nodeClean)(decl, true);
} else if (value[0] === 'columns') {

@@ -85,4 +77,3 @@ const i = value[1].split('-');

e.columns[breakpoint][i[0]][i[1]].push(decl.parent.selector);
_utils.default.nodeClean(decl, true);
(0, _utils.nodeClean)(decl, true);
}

@@ -107,7 +98,5 @@ }

e.rules[gridMediaAtRule.params].push(rule);
_utils.default.nodeClean(rule, true);
(0, _utils.nodeClean)(rule, true);
});
_utils.default.nodeClean(gridMediaAtRule);
(0, _utils.nodeClean)(gridMediaAtRule);
});

@@ -120,5 +109,2 @@ walkDecls(root, 0); // console.log(util.inspect(e.blocs, false, null))

};
});
var _default = postcssGridSystem;
exports.default = _default;
});

@@ -10,7 +10,7 @@ "use strict";

var _utils = _interopRequireDefault(require("./utils"));
var _utils = require("./utils");
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
const r = (rows, node, opts) => {
var _default = (rows, node, opts) => {
if (rows.length) {

@@ -21,3 +21,3 @@ const row = _postcss.default.rule();

row.selectors = _utils.default.flatten(rows);
row.selectors = (0, _utils.flatten)(rows);
row.append({

@@ -69,3 +69,2 @@ prop: 'clear',

var _default = r;
exports.default = _default;

@@ -8,3 +8,3 @@ "use strict";

const rulesQuery = (rules, node) => {
var _default = (rules, node) => {
if (rules) {

@@ -17,3 +17,2 @@ for (let rule = 0; rule < rules.length; rule += 1) {

var _default = rulesQuery;
exports.default = _default;

@@ -6,32 +6,31 @@ "use strict";

});
exports.default = void 0;
const utils = {
flatten(arr) {
const that = this;
return arr.reduce((flat, next) => {
if (!next) {
return flat;
}
exports.nodeClean = exports.selectorsAdd = exports.flatten = void 0;
return flat.concat(Array.isArray(next) ? that.flatten(next) : next);
}, []);
},
const flatten = arr => arr.reduce((flat, next) => {
if (!next) {
return flat;
}
selectorsAdd(rule, selectors) {
if (selectors) {
const r = rule;
r.selector = r.selector ? `${r.selector}, ${selectors.toString()}` : selectors.toString();
}
},
return flat.concat(Array.isArray(next) ? flatten(next) : next);
}, []);
nodeClean(node, cleanParent) {
if (cleanParent && node.parent.nodes.length === 1) {
node.parent.remove();
} else {
node.remove();
}
exports.flatten = flatten;
const selectorsAdd = (rule, selectors) => {
if (selectors) {
const r = rule;
r.selector = r.selector ? `${r.selector}, ${selectors.toString()}` : selectors.toString();
}
};
exports.selectorsAdd = selectorsAdd;
const nodeClean = (node, cleanParent) => {
if (cleanParent && node.parent.nodes.length === 1) {
node.parent.remove();
} else {
node.remove();
}
};
var _default = utils;
exports.default = _default;
exports.nodeClean = nodeClean;
{
"name": "postcss-grid-system",
"version": "0.4.13",
"version": "0.4.14",
"description": "A PostCSS plugin to create grids based on a fixed column width.",

@@ -5,0 +5,0 @@ "keywords": [

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