Sha256: 72cae72d95983b16f146f35d9f70d5fe455c504d17d08efecc26ae66dbbf9d9a

Contents?: true

Size: 1.78 KB

Versions: 26

Compression:

Stored size: 1.78 KB

Contents

'use strict';

function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; }

var postcss = _interopDefault(require('postcss'));

function _toArray(arr) {
  return _arrayWithHoles(arr) || _iterableToArray(arr) || _nonIterableRest();
}

function _arrayWithHoles(arr) {
  if (Array.isArray(arr)) return arr;
}

function _iterableToArray(iter) {
  if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter);
}

function _nonIterableRest() {
  throw new TypeError("Invalid attempt to destructure non-iterable instance");
}

const space = postcss.list.space; // overflow shorthand property matcher

const overflowPropertyRegExp = /^overflow$/i;
var index = postcss.plugin('postcss-overflow-shorthand', opts => {
  const preserve = 'preserve' in Object(opts) ? Boolean(opts.preserve) : true;
  return root => {
    // for each overflow declaration
    root.walkDecls(overflowPropertyRegExp, decl => {
      // split the declaration values
      const _space = space(decl.value),
            _space2 = _toArray(_space),
            overflowX = _space2[0],
            overflowY = _space2[1],
            invalidatingValues = _space2.slice(2); // if there are two values, but no invalidating values


      if (overflowY && !invalidatingValues.length) {
        // insert the overflow-* longhand declarations
        decl.cloneBefore({
          prop: `${decl.prop}-x`,
          value: overflowX
        });
        decl.cloneBefore({
          prop: `${decl.prop}-y`,
          value: overflowY
        }); // conditionally remove the original declaration

        if (!preserve) {
          decl.remove();
        }
      }
    });
  };
});

module.exports = index;
//# sourceMappingURL=index.cjs.js.map

Version data entries

26 entries across 25 versions & 8 rubygems

Version Path
optimacms-0.1.61 spec/dummy/node_modules/postcss-overflow-shorthand/index.cjs.js
disco_app-0.18.0 test/dummy/node_modules/postcss-overflow-shorthand/index.cjs.js
disco_app-0.18.2 test/dummy/node_modules/postcss-overflow-shorthand/index.cjs.js
disco_app-0.16.1 test/dummy/node_modules/postcss-overflow-shorthand/index.cjs.js
disco_app-0.15.2 test/dummy/node_modules/postcss-overflow-shorthand/index.cjs.js
disco_app-0.18.4 test/dummy/node_modules/postcss-overflow-shorthand/index.cjs.js
disco_app-0.18.1 test/dummy/node_modules/postcss-overflow-shorthand/index.cjs.js
disco_app-0.12.7.pre.puma.pre.3 test/dummy/node_modules/postcss-overflow-shorthand/index.cjs.js
disco_app-0.14.0 test/dummy/node_modules/postcss-overflow-shorthand/index.cjs.js
disco_app-0.13.6.pre.puma.pre.3 test/dummy/node_modules/postcss-overflow-shorthand/index.cjs.js
tang-0.2.1 spec/tang_app/node_modules/postcss-overflow-shorthand/index.cjs.js
groonga-client-model-6.0.0 test/apps/rails6.0.3.5/node_modules/postcss-overflow-shorthand/index.cjs.js
groonga-client-model-6.0.0 test/apps/rails6.1.3/node_modules/postcss-overflow-shorthand/index.cjs.js
ruby2js-4.0.4 lib/tasks/testrails/node_modules/postcss-overflow-shorthand/index.cjs.js
ruby2js-4.0.3 lib/tasks/testrails/node_modules/postcss-overflow-shorthand/index.cjs.js
tang-0.2.0 spec/tang_app/node_modules/postcss-overflow-shorthand/index.cjs.js
tang-0.1.0 spec/tang_app/node_modules/postcss-overflow-shorthand/index.cjs.js
tang-0.0.9 spec/tang_app/node_modules/postcss-overflow-shorthand/index.cjs.js
enju_library-0.3.8 spec/dummy/node_modules/postcss-overflow-shorthand/index.cjs.js
jester-data-8.0.0 node_modules/postcss-overflow-shorthand/index.cjs.js