source: trip-planner-front/node_modules/postcss-ordered-values/dist/rules/columns.js@ 6a3a178

Last change on this file since 6a3a178 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 1.0 KB
Line 
1"use strict";
2
3Object.defineProperty(exports, "__esModule", {
4 value: true
5});
6exports.columnsRule = exports.column = void 0;
7
8var _postcssValueParser = require("postcss-value-parser");
9
10var _border = _interopRequireDefault(require("./border.js"));
11
12function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
13
14function hasUnit(value) {
15 const parsedVal = (0, _postcssValueParser.unit)(value);
16 return parsedVal && parsedVal.unit !== '';
17}
18
19const column = columns => {
20 const widths = [];
21 const other = [];
22 columns.walk(node => {
23 const {
24 type,
25 value
26 } = node;
27
28 if (type === 'word') {
29 if (hasUnit(value)) {
30 widths.push(value);
31 } else {
32 other.push(value);
33 }
34 }
35 }); // only transform if declaration is not invalid or a single value
36
37 if (other.length === 1 && widths.length === 1) {
38 return `${widths[0].trimStart()} ${other[0].trimStart()}`;
39 }
40
41 return columns;
42};
43
44exports.column = column;
45const columnsRule = _border.default;
46exports.columnsRule = columnsRule;
Note: See TracBrowser for help on using the repository browser.