postcss-zindex
Advanced tools
Comparing version 5.0.0 to 5.0.1
@@ -6,2 +6,10 @@ # Change Log | ||
## [5.0.1](https://github.com/cssnano/cssnano/compare/postcss-zindex@5.0.0...postcss-zindex@5.0.1) (2021-05-19) | ||
**Note:** Version bump only for package postcss-zindex | ||
# [5.0.0](https://github.com/cssnano/cssnano/compare/postcss-zindex@5.0.0-rc.2...postcss-zindex@5.0.0) (2021-04-06) | ||
@@ -8,0 +16,0 @@ |
@@ -41,3 +41,3 @@ "use strict"; | ||
cache.optimizeValues(); // Second pass; optimize | ||
cache.optimizeValues(opts.startIndex || 1); // Second pass; optimize | ||
@@ -44,0 +44,0 @@ nodes.forEach(decl => { |
@@ -8,11 +8,4 @@ "use strict"; | ||
var _has = _interopRequireDefault(require("has")); | ||
var _uniqs = _interopRequireDefault(require("uniqs")); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
function LayerCache(opts) { | ||
this._values = []; | ||
this._startIndex = opts.startIndex || 1; | ||
function LayerCache() { | ||
this._values = new Map(); | ||
} | ||
@@ -24,19 +17,10 @@ | ||
function reduceValues(list, value, index) { | ||
list[value] = index + this._startIndex; | ||
return list; | ||
} | ||
LayerCache.prototype.optimizeValues = function (startIndex) { | ||
const sortedValues = Array.from(this._values.keys()).sort(ascending); | ||
LayerCache.prototype._findValue = function (value) { | ||
if ((0, _has.default)(this._values, value)) { | ||
return this._values[value]; | ||
for (let i = 0; i < sortedValues.length; i++) { | ||
this._values.set(sortedValues[i], i + startIndex); | ||
} | ||
return false; | ||
}; | ||
LayerCache.prototype.optimizeValues = function () { | ||
this._values = (0, _uniqs.default)(this._values).sort(ascending).reduce(reduceValues.bind(this), {}); | ||
}; | ||
LayerCache.prototype.addValue = function (value) { | ||
@@ -49,3 +33,3 @@ let parsedValue = parseInt(value, 10); // pass only valid values | ||
this._values.push(parsedValue); | ||
this._values.set(parsedValue, parsedValue); | ||
}; | ||
@@ -55,3 +39,3 @@ | ||
let parsedValue = parseInt(value, 10); | ||
return this._findValue(parsedValue) || value; | ||
return this._values.get(parsedValue) || value; | ||
}; | ||
@@ -58,0 +42,0 @@ |
{ | ||
"name": "postcss-zindex", | ||
"version": "5.0.0", | ||
"version": "5.0.1", | ||
"description": "Reduce z-index values with PostCSS.", | ||
@@ -8,3 +8,3 @@ "main": "dist/index.js", | ||
"prebuild": "del-cli dist", | ||
"build": "cross-env BABEL_ENV=publish babel src --config-file ../../babel.config.js --out-dir dist --ignore \"**/__tests__/\"", | ||
"build": "cross-env BABEL_ENV=publish babel src --config-file ../../babel.config.json --out-dir dist --ignore \"**/__tests__/\"", | ||
"prepublish": "yarn build" | ||
@@ -26,6 +26,2 @@ }, | ||
"license": "MIT", | ||
"dependencies": { | ||
"has": "^1.0.3", | ||
"uniqs": "^2.0.0" | ||
}, | ||
"homepage": "https://github.com/cssnano/cssnano", | ||
@@ -45,8 +41,8 @@ "author": { | ||
"devDependencies": { | ||
"postcss": "^8.2.1" | ||
"postcss": "^8.2.15" | ||
}, | ||
"peerDependencies": { | ||
"postcss": "^8.2.1" | ||
"postcss": "^8.2.15" | ||
}, | ||
"gitHead": "0e2c3bf5835bafcdc8783bef66f730a24194c8f3" | ||
"gitHead": "28c247175032fa03f04911cde56ad82d74d211cc" | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1
8510
74
- Removedhas@^1.0.3
- Removeduniqs@^2.0.0
- Removedhas@1.0.4(transitive)
- Removeduniqs@2.0.0(transitive)