first
This commit is contained in:
22
node_modules/postcss-normalize-repeat-style/LICENSE-MIT
generated
vendored
Normal file
22
node_modules/postcss-normalize-repeat-style/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.
|
44
node_modules/postcss-normalize-repeat-style/README.md
generated
vendored
Normal file
44
node_modules/postcss-normalize-repeat-style/README.md
generated
vendored
Normal file
@ -0,0 +1,44 @@
|
||||
# [postcss][postcss]-normalize-repeat-style
|
||||
|
||||
> Normalize repeat styles with PostCSS.
|
||||
|
||||
## Install
|
||||
|
||||
With [npm](https://npmjs.org/package/postcss-normalize-repeat-style) do:
|
||||
|
||||
```
|
||||
npm install postcss-normalize-repeat-style --save
|
||||
```
|
||||
|
||||
## Example
|
||||
|
||||
### Input
|
||||
|
||||
```css
|
||||
h1 {
|
||||
background: url(image.jpg) repeat no-repeat
|
||||
}
|
||||
```
|
||||
|
||||
### Output
|
||||
|
||||
```css
|
||||
h1 {
|
||||
background: url(image.jpg) repeat-x
|
||||
}
|
||||
```
|
||||
|
||||
## 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
|
63
node_modules/postcss-normalize-repeat-style/package.json
generated
vendored
Normal file
63
node_modules/postcss-normalize-repeat-style/package.json
generated
vendored
Normal file
@ -0,0 +1,63 @@
|
||||
{
|
||||
"_from": "postcss-normalize-repeat-style@^5.1.1",
|
||||
"_id": "postcss-normalize-repeat-style@5.1.1",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-mFpLspGWkQtBcWIRFLmewo8aC3ImN2i/J3v8YCFUwDnPu3Xz4rLohDO26lGjwNsQxB3YF0KKRwspGzE2JEuS0g==",
|
||||
"_location": "/postcss-normalize-repeat-style",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "postcss-normalize-repeat-style@^5.1.1",
|
||||
"name": "postcss-normalize-repeat-style",
|
||||
"escapedName": "postcss-normalize-repeat-style",
|
||||
"rawSpec": "^5.1.1",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "^5.1.1"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/cssnano-preset-default"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/postcss-normalize-repeat-style/-/postcss-normalize-repeat-style-5.1.1.tgz",
|
||||
"_shasum": "e9eb96805204f4766df66fd09ed2e13545420fb2",
|
||||
"_spec": "postcss-normalize-repeat-style@^5.1.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": {
|
||||
"postcss-value-parser": "^4.2.0"
|
||||
},
|
||||
"deprecated": false,
|
||||
"description": "Convert two value syntax for repeat-style into one value.",
|
||||
"devDependencies": {
|
||||
"postcss": "^8.2.15"
|
||||
},
|
||||
"engines": {
|
||||
"node": "^10 || ^12 || >=14.0"
|
||||
},
|
||||
"files": [
|
||||
"LICENSE-MIT",
|
||||
"src",
|
||||
"types"
|
||||
],
|
||||
"homepage": "https://github.com/cssnano/cssnano",
|
||||
"license": "MIT",
|
||||
"main": "src/index.js",
|
||||
"name": "postcss-normalize-repeat-style",
|
||||
"peerDependencies": {
|
||||
"postcss": "^8.2.15"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/cssnano/cssnano.git"
|
||||
},
|
||||
"types": "types/index.d.ts",
|
||||
"version": "5.1.1"
|
||||
}
|
180
node_modules/postcss-normalize-repeat-style/src/index.js
generated
vendored
Normal file
180
node_modules/postcss-normalize-repeat-style/src/index.js
generated
vendored
Normal file
@ -0,0 +1,180 @@
|
||||
'use strict';
|
||||
const valueParser = require('postcss-value-parser');
|
||||
const mappings = require('./lib/map');
|
||||
|
||||
/**
|
||||
* @param {unknown} item
|
||||
* @param {number} index
|
||||
* @return {boolean}
|
||||
*/
|
||||
function evenValues(item, index) {
|
||||
return index % 2 === 0;
|
||||
}
|
||||
|
||||
const repeatKeywords = new Set(mappings.values());
|
||||
|
||||
/**
|
||||
* @param {valueParser.Node} node
|
||||
* @return {boolean}
|
||||
*/
|
||||
function isCommaNode(node) {
|
||||
return node.type === 'div' && node.value === ',';
|
||||
}
|
||||
|
||||
const variableFunctions = new Set(['var', 'env', 'constant']);
|
||||
/**
|
||||
* @param {valueParser.Node} node
|
||||
* @return {boolean}
|
||||
*/
|
||||
function isVariableFunctionNode(node) {
|
||||
if (node.type !== 'function') {
|
||||
return false;
|
||||
}
|
||||
|
||||
return variableFunctions.has(node.value.toLowerCase());
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string} value
|
||||
* @return {string}
|
||||
*/
|
||||
function transform(value) {
|
||||
const parsed = valueParser(value);
|
||||
|
||||
if (parsed.nodes.length === 1) {
|
||||
return value;
|
||||
}
|
||||
/** @type {{start: number?, end: number?}[]} */
|
||||
const ranges = [];
|
||||
let rangeIndex = 0;
|
||||
let shouldContinue = true;
|
||||
|
||||
parsed.nodes.forEach((node, index) => {
|
||||
// After comma (`,`) follows next background
|
||||
if (isCommaNode(node)) {
|
||||
rangeIndex += 1;
|
||||
shouldContinue = true;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (!shouldContinue) {
|
||||
return;
|
||||
}
|
||||
|
||||
// After separator (`/`) follows `background-size` values
|
||||
// Avoid them
|
||||
if (node.type === 'div' && node.value === '/') {
|
||||
shouldContinue = false;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (!ranges[rangeIndex]) {
|
||||
ranges[rangeIndex] = {
|
||||
start: null,
|
||||
end: null,
|
||||
};
|
||||
}
|
||||
|
||||
// Do not try to be processed `var and `env` function inside background
|
||||
if (isVariableFunctionNode(node)) {
|
||||
shouldContinue = false;
|
||||
ranges[rangeIndex].start = null;
|
||||
ranges[rangeIndex].end = null;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
const isRepeatKeyword =
|
||||
node.type === 'word' && repeatKeywords.has(node.value.toLowerCase());
|
||||
|
||||
if (ranges[rangeIndex].start === null && isRepeatKeyword) {
|
||||
ranges[rangeIndex].start = index;
|
||||
ranges[rangeIndex].end = index;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (ranges[rangeIndex].start !== null) {
|
||||
if (node.type === 'space') {
|
||||
return;
|
||||
} else if (isRepeatKeyword) {
|
||||
ranges[rangeIndex].end = index;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
});
|
||||
|
||||
ranges.forEach((range) => {
|
||||
if (range.start === null) {
|
||||
return;
|
||||
}
|
||||
|
||||
const nodes = parsed.nodes.slice(
|
||||
range.start,
|
||||
/** @type {number} */ (range.end) + 1
|
||||
);
|
||||
|
||||
if (nodes.length !== 3) {
|
||||
return;
|
||||
}
|
||||
const key = nodes
|
||||
.filter(evenValues)
|
||||
.map((n) => n.value.toLowerCase())
|
||||
.toString();
|
||||
|
||||
const match = mappings.get(key);
|
||||
|
||||
if (match) {
|
||||
nodes[0].value = match;
|
||||
nodes[1].value = nodes[2].value = '';
|
||||
}
|
||||
});
|
||||
|
||||
return parsed.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* @type {import('postcss').PluginCreator<void>}
|
||||
* @return {import('postcss').Plugin}
|
||||
*/
|
||||
function pluginCreator() {
|
||||
return {
|
||||
postcssPlugin: 'postcss-normalize-repeat-style',
|
||||
prepare() {
|
||||
const cache = new Map();
|
||||
return {
|
||||
OnceExit(css) {
|
||||
css.walkDecls(
|
||||
/^(background(-repeat)?|(-\w+-)?mask-repeat)$/i,
|
||||
(decl) => {
|
||||
const value = decl.value;
|
||||
|
||||
if (!value) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (cache.has(value)) {
|
||||
decl.value = cache.get(value);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
const result = transform(value);
|
||||
|
||||
decl.value = result;
|
||||
cache.set(value, result);
|
||||
}
|
||||
);
|
||||
},
|
||||
};
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
pluginCreator.postcss = true;
|
||||
module.exports = pluginCreator;
|
9
node_modules/postcss-normalize-repeat-style/src/lib/map.js
generated
vendored
Normal file
9
node_modules/postcss-normalize-repeat-style/src/lib/map.js
generated
vendored
Normal file
@ -0,0 +1,9 @@
|
||||
'use strict';
|
||||
module.exports = new Map([
|
||||
[['repeat', 'no-repeat'].toString(), 'repeat-x'],
|
||||
[['no-repeat', 'repeat'].toString(), 'repeat-y'],
|
||||
[['repeat', 'repeat'].toString(), 'repeat'],
|
||||
[['space', 'space'].toString(), 'space'],
|
||||
[['round', 'round'].toString(), 'round'],
|
||||
[['no-repeat', 'no-repeat'].toString(), 'no-repeat'],
|
||||
]);
|
9
node_modules/postcss-normalize-repeat-style/types/index.d.ts
generated
vendored
Normal file
9
node_modules/postcss-normalize-repeat-style/types/index.d.ts
generated
vendored
Normal file
@ -0,0 +1,9 @@
|
||||
export = pluginCreator;
|
||||
/**
|
||||
* @type {import('postcss').PluginCreator<void>}
|
||||
* @return {import('postcss').Plugin}
|
||||
*/
|
||||
declare function pluginCreator(): import('postcss').Plugin;
|
||||
declare namespace pluginCreator {
|
||||
const postcss: true;
|
||||
}
|
15
node_modules/postcss-normalize-repeat-style/types/lib/map.d.ts
generated
vendored
Normal file
15
node_modules/postcss-normalize-repeat-style/types/lib/map.d.ts
generated
vendored
Normal file
@ -0,0 +1,15 @@
|
||||
declare const _exports: {
|
||||
clear(): void;
|
||||
delete(key: string): boolean;
|
||||
forEach(callbackfn: (value: string, key: string, map: Map<string, string>) => void, thisArg?: any): void;
|
||||
get(key: string): string | undefined;
|
||||
has(key: string): boolean;
|
||||
set(key: string, value: string): Map<string, string>;
|
||||
readonly size: number;
|
||||
entries(): IterableIterator<[string, string]>;
|
||||
keys(): IterableIterator<string>;
|
||||
values(): IterableIterator<string>;
|
||||
[Symbol.iterator](): IterableIterator<[string, string]>;
|
||||
readonly [Symbol.toStringTag]: string;
|
||||
};
|
||||
export = _exports;
|
Reference in New Issue
Block a user