source: trip-planner-front/node_modules/postcss-overflow-shorthand/index.es.mjs@ 76712b2

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

initial commit

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