source: trip-planner-front/node_modules/postcss-ordered-values/dist/rules/boxShadow.js@ bdd6491

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

initial commit

  • Property mode set to 100644
File size: 1.5 KB
Line 
1"use strict";
2
3Object.defineProperty(exports, "__esModule", {
4 value: true
5});
6exports.default = normalizeBoxShadow;
7
8var _postcssValueParser = require("postcss-value-parser");
9
10var _cssnanoUtils = require("cssnano-utils");
11
12var _addSpace = _interopRequireDefault(require("../lib/addSpace"));
13
14var _getValue = _interopRequireDefault(require("../lib/getValue"));
15
16function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
17
18// box-shadow: inset? && <length>{2,4} && <color>?
19function normalizeBoxShadow(parsed) {
20 let args = (0, _cssnanoUtils.getArguments)(parsed);
21 let abort = false;
22 let values = args.reduce((list, arg) => {
23 let val = [];
24 let state = {
25 inset: [],
26 color: []
27 };
28 arg.forEach(node => {
29 const {
30 type,
31 value
32 } = node;
33
34 if (type === 'function' && ~value.toLowerCase().indexOf('calc')) {
35 abort = true;
36 return;
37 }
38
39 if (type === 'space') {
40 return;
41 }
42
43 if ((0, _postcssValueParser.unit)(value)) {
44 val = [...val, node, (0, _addSpace.default)()];
45 } else if (value.toLowerCase() === 'inset') {
46 state.inset = [...state.inset, node, (0, _addSpace.default)()];
47 } else {
48 state.color = [...state.color, node, (0, _addSpace.default)()];
49 }
50 });
51 return [...list, [...state.inset, ...val, ...state.color]];
52 }, []);
53
54 if (abort) {
55 return parsed.toString();
56 }
57
58 return (0, _getValue.default)(values);
59}
60
61module.exports = exports.default;
Note: See TracBrowser for help on using the repository browser.