postcss-zindex
Advanced tools
Comparing version 5.0.2 to 5.1.0
{ | ||
"name": "postcss-zindex", | ||
"version": "5.0.2", | ||
"version": "5.1.0", | ||
"description": "Reduce z-index values with PostCSS.", | ||
"main": "src/index.js", | ||
"types": "types/index.d.ts", | ||
"files": [ | ||
"LICENSE-MIT", | ||
"src" | ||
"src", | ||
"types" | ||
], | ||
@@ -10,0 +12,0 @@ "keywords": [ |
'use strict'; | ||
const LayerCache = require('./lib/layerCache'); | ||
/** @typedef {{startIndex?: number}} Options */ | ||
/** | ||
* @type {import('postcss').PluginCreator<Options>} | ||
* @param {Options} opts | ||
* @return {import('postcss').Plugin} | ||
*/ | ||
function pluginCreator(opts = {}) { | ||
@@ -11,2 +17,3 @@ return { | ||
OnceExit(css) { | ||
/** @type {import('postcss').Declaration[]} */ | ||
const nodes = []; | ||
@@ -13,0 +20,0 @@ let abort = false; |
'use strict'; | ||
/** @constructor */ | ||
function LayerCache() { | ||
@@ -6,2 +7,7 @@ this._values = new Map(); | ||
/** | ||
* @param {number} a | ||
* @param {number} b | ||
* @return {number} | ||
*/ | ||
function ascending(a, b) { | ||
@@ -11,2 +17,6 @@ return a - b; | ||
/** | ||
* @param {number} startIndex | ||
* @return {void} | ||
*/ | ||
LayerCache.prototype.optimizeValues = function (startIndex) { | ||
@@ -19,2 +29,6 @@ const sortedValues = Array.from(this._values.keys()).sort(ascending); | ||
/** | ||
* @param {string} value | ||
* @return {void} | ||
*/ | ||
LayerCache.prototype.addValue = function (value) { | ||
@@ -31,2 +45,6 @@ let parsedValue = parseInt(value, 10); | ||
/** | ||
* @param {string} value | ||
* @return {string} | ||
*/ | ||
LayerCache.prototype.getValue = function (value) { | ||
@@ -33,0 +51,0 @@ let parsedValue = parseInt(value, 10); |
9605
7
129