first
This commit is contained in:
22
node_modules/postcss-colormin/LICENSE-MIT
generated
vendored
Normal file
22
node_modules/postcss-colormin/LICENSE-MIT
generated
vendored
Normal 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.
|
45
node_modules/postcss-colormin/README.md
generated
vendored
Normal file
45
node_modules/postcss-colormin/README.md
generated
vendored
Normal file
@ -0,0 +1,45 @@
|
||||
# [postcss][postcss]-colormin
|
||||
|
||||
> Minify colors in your CSS files with PostCSS.
|
||||
|
||||
## Install
|
||||
|
||||
With [npm](https://npmjs.org/package/postcss-colormin) do:
|
||||
|
||||
```
|
||||
npm install postcss-colormin --save
|
||||
```
|
||||
|
||||
|
||||
## Example
|
||||
|
||||
```js
|
||||
var postcss = require('postcss')
|
||||
var colormin = require('postcss-colormin');
|
||||
|
||||
var css = 'h1 {color: rgba(255, 0, 0, 1)}';
|
||||
console.log(postcss(colormin()).process(css).css);
|
||||
|
||||
// => 'h1 {color:red}'
|
||||
```
|
||||
|
||||
For more examples see the [tests](src/__tests__/index.js).
|
||||
|
||||
|
||||
## 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
|
15
node_modules/postcss-colormin/node_modules/.bin/browserslist
generated
vendored
Normal file
15
node_modules/postcss-colormin/node_modules/.bin/browserslist
generated
vendored
Normal file
@ -0,0 +1,15 @@
|
||||
#!/bin/sh
|
||||
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
|
||||
|
||||
case `uname` in
|
||||
*CYGWIN*) basedir=`cygpath -w "$basedir"`;;
|
||||
esac
|
||||
|
||||
if [ -x "$basedir/node" ]; then
|
||||
"$basedir/node" "$basedir/../../../browserslist/cli.js" "$@"
|
||||
ret=$?
|
||||
else
|
||||
node "$basedir/../../../browserslist/cli.js" "$@"
|
||||
ret=$?
|
||||
fi
|
||||
exit $ret
|
7
node_modules/postcss-colormin/node_modules/.bin/browserslist.cmd
generated
vendored
Normal file
7
node_modules/postcss-colormin/node_modules/.bin/browserslist.cmd
generated
vendored
Normal file
@ -0,0 +1,7 @@
|
||||
@IF EXIST "%~dp0\node.exe" (
|
||||
"%~dp0\node.exe" "%~dp0\..\..\..\browserslist\cli.js" %*
|
||||
) ELSE (
|
||||
@SETLOCAL
|
||||
@SET PATHEXT=%PATHEXT:;.JS;=;%
|
||||
node "%~dp0\..\..\..\browserslist\cli.js" %*
|
||||
)
|
76
node_modules/postcss-colormin/package.json
generated
vendored
Normal file
76
node_modules/postcss-colormin/package.json
generated
vendored
Normal file
@ -0,0 +1,76 @@
|
||||
{
|
||||
"_from": "postcss-colormin@^5.3.1",
|
||||
"_id": "postcss-colormin@5.3.1",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-UsWQG0AqTFQmpBegeLLc1+c3jIqBNB0zlDGRWR+dQ3pRKJL1oeMzyqmH3o2PIfn9MBdNrVPWhDbT769LxCTLJQ==",
|
||||
"_location": "/postcss-colormin",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "postcss-colormin@^5.3.1",
|
||||
"name": "postcss-colormin",
|
||||
"escapedName": "postcss-colormin",
|
||||
"rawSpec": "^5.3.1",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "^5.3.1"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/cssnano-preset-default"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/postcss-colormin/-/postcss-colormin-5.3.1.tgz",
|
||||
"_shasum": "86c27c26ed6ba00d96c79e08f3ffb418d1d1988f",
|
||||
"_spec": "postcss-colormin@^5.3.1",
|
||||
"_where": "C:\\Users\\zhouxueli\\Desktop\\scheduling-app\\node_modules\\cssnano-preset-default",
|
||||
"author": {
|
||||
"name": "Ben Briggs",
|
||||
"email": "beneb.info@gmail.com",
|
||||
"url": "http://beneb.info"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/cssnano/cssnano/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"dependencies": {
|
||||
"browserslist": "^4.21.4",
|
||||
"caniuse-api": "^3.0.0",
|
||||
"colord": "^2.9.1",
|
||||
"postcss-value-parser": "^4.2.0"
|
||||
},
|
||||
"deprecated": false,
|
||||
"description": "Minify colors in your CSS files with PostCSS.",
|
||||
"devDependencies": {
|
||||
"@types/caniuse-api": "^3.0.2",
|
||||
"postcss": "^8.2.15"
|
||||
},
|
||||
"engines": {
|
||||
"node": "^10 || ^12 || >=14.0"
|
||||
},
|
||||
"files": [
|
||||
"src",
|
||||
"LICENSE-MIT",
|
||||
"types"
|
||||
],
|
||||
"homepage": "https://github.com/cssnano/cssnano",
|
||||
"keywords": [
|
||||
"color",
|
||||
"colors",
|
||||
"compression",
|
||||
"css",
|
||||
"minify",
|
||||
"postcss",
|
||||
"postcss-plugin"
|
||||
],
|
||||
"license": "MIT",
|
||||
"main": "src/index.js",
|
||||
"name": "postcss-colormin",
|
||||
"peerDependencies": {
|
||||
"postcss": "^8.2.15"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/cssnano/cssnano.git"
|
||||
},
|
||||
"types": "types/index.d.ts",
|
||||
"version": "5.3.1"
|
||||
}
|
159
node_modules/postcss-colormin/src/index.js
generated
vendored
Normal file
159
node_modules/postcss-colormin/src/index.js
generated
vendored
Normal file
@ -0,0 +1,159 @@
|
||||
'use strict';
|
||||
const browserslist = require('browserslist');
|
||||
const { isSupported } = require('caniuse-api');
|
||||
const valueParser = require('postcss-value-parser');
|
||||
const minifyColor = require('./minifyColor');
|
||||
|
||||
/**
|
||||
* @param {{nodes: valueParser.Node[]}} parent
|
||||
* @param {(node: valueParser.Node, index: number, parent: {nodes: valueParser.Node[]}) => false | undefined} callback
|
||||
* @return {void}
|
||||
*/
|
||||
function walk(parent, callback) {
|
||||
parent.nodes.forEach((node, index) => {
|
||||
const bubble = callback(node, index, parent);
|
||||
|
||||
if (node.type === 'function' && bubble !== false) {
|
||||
walk(node, callback);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/*
|
||||
* IE 8 & 9 do not properly handle clicks on elements
|
||||
* with a `transparent` `background-color`.
|
||||
*
|
||||
* https://developer.mozilla.org/en-US/docs/Web/Events/click#Internet_Explorer
|
||||
*/
|
||||
const browsersWithTransparentBug = new Set(['ie 8', 'ie 9']);
|
||||
const mathFunctions = new Set(['calc', 'min', 'max', 'clamp']);
|
||||
|
||||
/**
|
||||
* @param {valueParser.Node} node
|
||||
* @return {boolean}
|
||||
*/
|
||||
function isMathFunctionNode(node) {
|
||||
if (node.type !== 'function') {
|
||||
return false;
|
||||
}
|
||||
return mathFunctions.has(node.value.toLowerCase());
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string} value
|
||||
* @param {Record<string, boolean>} options
|
||||
* @return {string}
|
||||
*/
|
||||
function transform(value, options) {
|
||||
const parsed = valueParser(value);
|
||||
|
||||
walk(parsed, (node, index, parent) => {
|
||||
if (node.type === 'function') {
|
||||
if (/^(rgb|hsl)a?$/i.test(node.value)) {
|
||||
const { value: originalValue } = node;
|
||||
|
||||
node.value = minifyColor(valueParser.stringify(node), options);
|
||||
/** @type {string} */ (node.type) = 'word';
|
||||
|
||||
const next = parent.nodes[index + 1];
|
||||
|
||||
if (
|
||||
node.value !== originalValue &&
|
||||
next &&
|
||||
(next.type === 'word' || next.type === 'function')
|
||||
) {
|
||||
parent.nodes.splice(
|
||||
index + 1,
|
||||
0,
|
||||
/** @type {valueParser.SpaceNode} */ ({
|
||||
type: 'space',
|
||||
value: ' ',
|
||||
})
|
||||
);
|
||||
}
|
||||
} else if (isMathFunctionNode(node)) {
|
||||
return false;
|
||||
}
|
||||
} else if (node.type === 'word') {
|
||||
node.value = minifyColor(node.value, options);
|
||||
}
|
||||
});
|
||||
|
||||
return parsed.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {Record<string, boolean>} options
|
||||
* @param {string[]} browsers
|
||||
* @return {Record<string, boolean>}
|
||||
*/
|
||||
function addPluginDefaults(options, browsers) {
|
||||
const defaults = {
|
||||
// Does the browser support 4 & 8 character hex notation
|
||||
transparent:
|
||||
browsers.some((b) => browsersWithTransparentBug.has(b)) === false,
|
||||
// Does the browser support "transparent" value properly
|
||||
alphaHex: isSupported('css-rrggbbaa', browsers),
|
||||
name: true,
|
||||
};
|
||||
return { ...defaults, ...options };
|
||||
}
|
||||
/**
|
||||
* @type {import('postcss').PluginCreator<Record<string, boolean>>}
|
||||
* @param {Record<string, boolean>} config
|
||||
* @return {import('postcss').Plugin}
|
||||
*/
|
||||
function pluginCreator(config = {}) {
|
||||
return {
|
||||
postcssPlugin: 'postcss-colormin',
|
||||
|
||||
prepare(result) {
|
||||
/** @type {typeof result.opts & browserslist.Options} */
|
||||
const resultOptions = result.opts || {};
|
||||
const browsers = browserslist(null, {
|
||||
stats: resultOptions.stats,
|
||||
path: __dirname,
|
||||
env: resultOptions.env,
|
||||
});
|
||||
|
||||
const cache = new Map();
|
||||
const options = addPluginDefaults(config, browsers);
|
||||
|
||||
return {
|
||||
OnceExit(css) {
|
||||
css.walkDecls((decl) => {
|
||||
if (
|
||||
/^(composes|font|src$|filter|-webkit-tap-highlight-color)/i.test(
|
||||
decl.prop
|
||||
)
|
||||
) {
|
||||
return;
|
||||
}
|
||||
|
||||
const value = decl.value;
|
||||
|
||||
if (!value) {
|
||||
return;
|
||||
}
|
||||
|
||||
const cacheKey = JSON.stringify({ value, options, browsers });
|
||||
|
||||
if (cache.has(cacheKey)) {
|
||||
decl.value = cache.get(cacheKey);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
const newValue = transform(value, options);
|
||||
|
||||
decl.value = newValue;
|
||||
cache.set(cacheKey, newValue);
|
||||
});
|
||||
},
|
||||
};
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
pluginCreator.postcss = true;
|
||||
module.exports = pluginCreator;
|
28
node_modules/postcss-colormin/src/minifyColor.js
generated
vendored
Normal file
28
node_modules/postcss-colormin/src/minifyColor.js
generated
vendored
Normal file
@ -0,0 +1,28 @@
|
||||
'use strict';
|
||||
const { colord, extend } = require('colord');
|
||||
const namesPlugin = require('colord/plugins/names');
|
||||
const minifierPlugin = require('colord/plugins/minify');
|
||||
|
||||
extend(/** @type {any[]} */ ([namesPlugin, minifierPlugin]));
|
||||
|
||||
/**
|
||||
* Performs color value minification
|
||||
*
|
||||
* @param {string} input - CSS value
|
||||
* @param {Record<string, boolean>} options object with colord.minify() options
|
||||
* @return {string}
|
||||
*/
|
||||
module.exports = function minifyColor(input, options = {}) {
|
||||
const instance = colord(input);
|
||||
|
||||
if (instance.isValid()) {
|
||||
// Try to shorten the string if it is a valid CSS color value
|
||||
const minified = instance.minify(options);
|
||||
|
||||
// Fall back to the original input if it's smaller or has equal length
|
||||
return minified.length < input.length ? minified : input.toLowerCase();
|
||||
} else {
|
||||
// Possibly malformed, so pass through
|
||||
return input;
|
||||
}
|
||||
};
|
10
node_modules/postcss-colormin/types/index.d.ts
generated
vendored
Normal file
10
node_modules/postcss-colormin/types/index.d.ts
generated
vendored
Normal file
@ -0,0 +1,10 @@
|
||||
export = pluginCreator;
|
||||
/**
|
||||
* @type {import('postcss').PluginCreator<Record<string, boolean>>}
|
||||
* @param {Record<string, boolean>} config
|
||||
* @return {import('postcss').Plugin}
|
||||
*/
|
||||
declare function pluginCreator(config?: Record<string, boolean>): import('postcss').Plugin;
|
||||
declare namespace pluginCreator {
|
||||
const postcss: true;
|
||||
}
|
2
node_modules/postcss-colormin/types/minifyColor.d.ts
generated
vendored
Normal file
2
node_modules/postcss-colormin/types/minifyColor.d.ts
generated
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
declare function _exports(input: string, options?: Record<string, boolean>): string;
|
||||
export = _exports;
|
Reference in New Issue
Block a user