Sha256: 689588190feb1efbb35a68a3185ce80be4f678b12051d994fd4ddffd3c539c46

Contents?: true

Size: 1.59 KB

Versions: 26

Compression:

Stored size: 1.59 KB

Contents

"use strict";

Object.defineProperty(exports, "__esModule", {
    value: true
});

var _postcss = require("postcss");

var _postcss2 = _interopRequireDefault(_postcss);

var _postcssValueParser = require("postcss-value-parser");

var _postcssValueParser2 = _interopRequireDefault(_postcssValueParser);

var _cssnanoUtilGetMatch = require("cssnano-util-get-match");

var _cssnanoUtilGetMatch2 = _interopRequireDefault(_cssnanoUtilGetMatch);

var _map = require("./lib/map");

var _map2 = _interopRequireDefault(_map);

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

const getMatch = (0, _cssnanoUtilGetMatch2.default)(_map2.default);

function evenValues(list, index) {
    return index % 2 === 0;
}

exports.default = _postcss2.default.plugin("postcss-normalize-display-values", () => {
    return css => {
        const cache = {};

        css.walkDecls(/display/i, decl => {
            const value = decl.value;

            if (cache[value]) {
                decl.value = cache[value];

                return;
            }

            const { nodes } = (0, _postcssValueParser2.default)(value);

            if (nodes.length === 1) {
                cache[value] = value;

                return;
            }

            const match = getMatch(nodes.filter(evenValues).map(n => n.value.toLowerCase()));

            if (!match) {
                cache[value] = value;

                return;
            }

            const result = match;

            decl.value = result;
            cache[value] = result;
        });
    };
});
module.exports = exports["default"];

Version data entries

26 entries across 25 versions & 8 rubygems

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