This commit is contained in:
2024-03-22 03:47:51 +05:30
parent 8bcf3d211e
commit 89819f6fe2
28440 changed files with 3211033 additions and 2 deletions

22
node_modules/postcss-zindex/LICENSE-MIT generated vendored Normal file
View File

@@ -0,0 +1,22 @@
Copyright (c) Ben Briggs <beneb.info@gmail.com> (http://beneb.info)
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the "Software"), to deal in the Software without
restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following
conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.

85
node_modules/postcss-zindex/README.md generated vendored Normal file
View File

@@ -0,0 +1,85 @@
# [postcss][postcss]-zindex
> Reduce z-index values with PostCSS.
## Install
With [npm](https://npmjs.org/package/postcss-zindex) do:
```
npm install postcss-zindex --save
```
## Example
Sometimes, you may introduce z-index values into your CSS that are larger than
necessary, in order to improve your understanding of how each stack relates to
the others. For example, you might have a modal overlay at `5000` and the dialog
for it at `5500` - so that modal classes occupy the `5xxx` space.
But in production, it is unnecessary to use such large values for z-index where
smaller values would suffice. This module will reduce all z-index declarations
whilst respecting your original intent; such that the overlay becomes `1` and
the dialog becomes `2`. For more examples, see the [tests](test.js).
### Input
```css
.modal {
z-index: 5000
}
.modal-overlay {
z-index: 5500
}
```
### Output
```css
.modal {
z-index: 1
}
.modal-overlay {
z-index: 2
}
```
Note that this module does not attempt to normalize relative z-index values,
such as `-1`; indeed, it will abort immediately when encountering these values
as it cannot be sure that rebasing mixed positive & negative values will keep
the stacking context intact. Be careful with using this module alongside
JavaScript injected CSS; ideally you should have already extracted all of your
stacking context into CSS.
## API
### zindex([options])
#### options
##### startIndex
Type: `number`
Default: `1`
Set this to any other positive integer if you want to override z-indices from
other sources outside your control. For example if a third party widget has a
maximum z-index of `99`, you can set this to `100` and not have to worry about
stacking conflicts.
## Usage
See the [PostCSS documentation](https://github.com/postcss/postcss#usage) for
examples for your environment.
## Contributors
See [CONTRIBUTORS.md](https://github.com/cssnano/cssnano/blob/master/CONTRIBUTORS.md).
## License
MIT © [Ben Briggs](http://beneb.info)
[postcss]: https://github.com/postcss/postcss

42
node_modules/postcss-zindex/package.json generated vendored Normal file
View File

@@ -0,0 +1,42 @@
{
"name": "postcss-zindex",
"version": "5.1.0",
"description": "Reduce z-index values with PostCSS.",
"main": "src/index.js",
"types": "types/index.d.ts",
"files": [
"LICENSE-MIT",
"src",
"types"
],
"keywords": [
"css",
"normalize",
"optimise",
"optimisation",
"postcss",
"postcss-plugin",
"z-index"
],
"license": "MIT",
"homepage": "https://github.com/cssnano/cssnano",
"author": {
"name": "Ben Briggs",
"email": "beneb.info@gmail.com",
"url": "http://beneb.info"
},
"repository": "cssnano/cssnano",
"bugs": {
"url": "https://github.com/cssnano/cssnano/issues"
},
"engines": {
"node": "^10 || ^12 || >=14.0"
},
"devDependencies": {
"postcss": "^8.2.15"
},
"peerDependencies": {
"postcss": "^8.2.15"
},
"readme": "# [postcss][postcss]-zindex\n\n> Reduce z-index values with PostCSS.\n\n## Install\n\nWith [npm](https://npmjs.org/package/postcss-zindex) do:\n\n```\nnpm install postcss-zindex --save\n```\n\n## Example\n\nSometimes, you may introduce z-index values into your CSS that are larger than\nnecessary, in order to improve your understanding of how each stack relates to\nthe others. For example, you might have a modal overlay at `5000` and the dialog\nfor it at `5500` - so that modal classes occupy the `5xxx` space.\n\nBut in production, it is unnecessary to use such large values for z-index where\nsmaller values would suffice. This module will reduce all z-index declarations\nwhilst respecting your original intent; such that the overlay becomes `1` and\nthe dialog becomes `2`. For more examples, see the [tests](test.js).\n\n### Input\n\n```css\n.modal {\n z-index: 5000\n}\n\n.modal-overlay {\n z-index: 5500\n}\n```\n\n### Output\n\n```css\n.modal {\n z-index: 1\n}\n\n.modal-overlay {\n z-index: 2\n}\n```\n\nNote that this module does not attempt to normalize relative z-index values,\nsuch as `-1`; indeed, it will abort immediately when encountering these values\nas it cannot be sure that rebasing mixed positive & negative values will keep\nthe stacking context intact. Be careful with using this module alongside\nJavaScript injected CSS; ideally you should have already extracted all of your\nstacking context into CSS.\n\n## API\n\n### zindex([options])\n\n#### options\n\n##### startIndex\n\nType: `number`\nDefault: `1`\n\nSet this to any other positive integer if you want to override z-indices from\nother sources outside your control. For example if a third party widget has a\nmaximum z-index of `99`, you can set this to `100` and not have to worry about\nstacking conflicts.\n\n## Usage\n\nSee the [PostCSS documentation](https://github.com/postcss/postcss#usage) for\nexamples for your environment.\n\n## Contributors\n\nSee [CONTRIBUTORS.md](https://github.com/cssnano/cssnano/blob/master/CONTRIBUTORS.md).\n\n## License\n\nMIT © [Ben Briggs](http://beneb.info)\n\n[postcss]: https://github.com/postcss/postcss\n"
}

55
node_modules/postcss-zindex/src/index.js generated vendored Normal file
View File

@@ -0,0 +1,55 @@
'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 = {}) {
return {
postcssPlugin: 'postcss-zindex',
prepare() {
const cache = new LayerCache();
return {
OnceExit(css) {
/** @type {import('postcss').Declaration[]} */
const nodes = [];
let abort = false;
// First pass; cache all z indexes
css.walkDecls(/z-index/i, (decl) => {
// Check that no negative values exist. Rebasing is only
// safe if all indices are positive numbers.
if (decl.value[0] === '-') {
abort = true;
// Stop PostCSS iterating through the rest of the decls
return false;
}
nodes.push(decl);
cache.addValue(decl.value);
});
// Abort if we found any negative values
// or there are no z-index declarations
if (abort || !nodes.length) {
return;
}
cache.optimizeValues(opts.startIndex || 1);
// Second pass; optimize
nodes.forEach((decl) => {
// Need to coerce to string so that the
// AST is updated correctly
decl.value = cache.getValue(decl.value).toString();
});
},
};
},
};
}
pluginCreator.postcss = true;
module.exports = pluginCreator;

52
node_modules/postcss-zindex/src/lib/layerCache.js generated vendored Normal file
View File

@@ -0,0 +1,52 @@
'use strict';
/** @constructor */
function LayerCache() {
this._values = new Map();
}
/**
* @param {number} a
* @param {number} b
* @return {number}
*/
function ascending(a, b) {
return a - b;
}
/**
* @param {number} startIndex
* @return {void}
*/
LayerCache.prototype.optimizeValues = function (startIndex) {
const sortedValues = Array.from(this._values.keys()).sort(ascending);
for (let i = 0; i < sortedValues.length; i++) {
this._values.set(sortedValues[i], i + startIndex);
}
};
/**
* @param {string} value
* @return {void}
*/
LayerCache.prototype.addValue = function (value) {
let parsedValue = parseInt(value, 10);
// pass only valid values
if (!parsedValue || parsedValue < 0) {
return;
}
this._values.set(parsedValue, parsedValue);
};
/**
* @param {string} value
* @return {string}
*/
LayerCache.prototype.getValue = function (value) {
let parsedValue = parseInt(value, 10);
return this._values.get(parsedValue) || value;
};
module.exports = LayerCache;

15
node_modules/postcss-zindex/types/index.d.ts generated vendored Normal file
View File

@@ -0,0 +1,15 @@
export = pluginCreator;
/** @typedef {{startIndex?: number}} Options */
/**
* @type {import('postcss').PluginCreator<Options>}
* @param {Options} opts
* @return {import('postcss').Plugin}
*/
declare function pluginCreator(opts?: Options): import('postcss').Plugin;
declare namespace pluginCreator {
export { postcss, Options };
}
type Options = {
startIndex?: number;
};
declare var postcss: true;

21
node_modules/postcss-zindex/types/lib/layerCache.d.ts generated vendored Normal file
View File

@@ -0,0 +1,21 @@
export = LayerCache;
/** @constructor */
declare function LayerCache(): void;
declare class LayerCache {
_values: Map<any, any>;
/**
* @param {number} startIndex
* @return {void}
*/
optimizeValues(startIndex: number): void;
/**
* @param {string} value
* @return {void}
*/
addValue(value: string): void;
/**
* @param {string} value
* @return {string}
*/
getValue(value: string): string;
}