source: trip-planner-front/node_modules/postcss-overflow-shorthand/index.cjs.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.8 KB
Line 
1'use strict';
2
3function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; }
4
5var postcss = _interopDefault(require('postcss'));
6
7function _toArray(arr) {
8 return _arrayWithHoles(arr) || _iterableToArray(arr) || _nonIterableRest();
9}
10
11function _arrayWithHoles(arr) {
12 if (Array.isArray(arr)) return arr;
13}
14
15function _iterableToArray(iter) {
16 if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter);
17}
18
19function _nonIterableRest() {
20 throw new TypeError("Invalid attempt to destructure non-iterable instance");
21}
22
23const space = postcss.list.space; // overflow shorthand property matcher
24
25const overflowPropertyRegExp = /^overflow$/i;
26var index = postcss.plugin('postcss-overflow-shorthand', opts => {
27 const preserve = 'preserve' in Object(opts) ? Boolean(opts.preserve) : true;
28 return root => {
29 // for each overflow declaration
30 root.walkDecls(overflowPropertyRegExp, decl => {
31 // split the declaration values
32 const _space = space(decl.value),
33 _space2 = _toArray(_space),
34 overflowX = _space2[0],
35 overflowY = _space2[1],
36 invalidatingValues = _space2.slice(2); // if there are two values, but no invalidating values
37
38
39 if (overflowY && !invalidatingValues.length) {
40 // insert the overflow-* longhand declarations
41 decl.cloneBefore({
42 prop: `${decl.prop}-x`,
43 value: overflowX
44 });
45 decl.cloneBefore({
46 prop: `${decl.prop}-y`,
47 value: overflowY
48 }); // conditionally remove the original declaration
49
50 if (!preserve) {
51 decl.remove();
52 }
53 }
54 });
55 };
56});
57
58module.exports = index;
59//# sourceMappingURL=index.cjs.js.map
Note: See TracBrowser for help on using the repository browser.