From c06f7ee0a40255214c477e13d9b956a7e07c2900 Mon Sep 17 00:00:00 2001 From: littleblack111 Date: Sat, 14 Oct 2023 15:05:55 +0800 Subject: postcss,(plugins): nanocss, postcss-preset-env --- .../postcss-double-position-gradients/CHANGELOG.md | 142 +++++++++++++++++++++ .../postcss-double-position-gradients/LICENSE.md | 18 +++ .../postcss-double-position-gradients/README.md | 125 ++++++++++++++++++ .../dist/has-fallback-decl.d.ts | 2 + .../dist/has-supports-at-rule-ancestor.d.ts | 2 + .../dist/index.cjs | 1 + .../dist/index.d.ts | 10 ++ .../dist/index.mjs | 1 + .../dist/is-gradient.d.ts | 2 + .../postcss-double-position-gradients/package.json | 84 ++++++++++++ 10 files changed, 387 insertions(+) create mode 100644 node_modules/postcss-double-position-gradients/CHANGELOG.md create mode 100644 node_modules/postcss-double-position-gradients/LICENSE.md create mode 100644 node_modules/postcss-double-position-gradients/README.md create mode 100644 node_modules/postcss-double-position-gradients/dist/has-fallback-decl.d.ts create mode 100644 node_modules/postcss-double-position-gradients/dist/has-supports-at-rule-ancestor.d.ts create mode 100644 node_modules/postcss-double-position-gradients/dist/index.cjs create mode 100644 node_modules/postcss-double-position-gradients/dist/index.d.ts create mode 100644 node_modules/postcss-double-position-gradients/dist/index.mjs create mode 100644 node_modules/postcss-double-position-gradients/dist/is-gradient.d.ts create mode 100644 node_modules/postcss-double-position-gradients/package.json (limited to 'node_modules/postcss-double-position-gradients') diff --git a/node_modules/postcss-double-position-gradients/CHANGELOG.md b/node_modules/postcss-double-position-gradients/CHANGELOG.md new file mode 100644 index 00000000..0d6567e7 --- /dev/null +++ b/node_modules/postcss-double-position-gradients/CHANGELOG.md @@ -0,0 +1,142 @@ +# Changes to PostCSS Double Position Gradients + +### 5.0.2 + +_October 9, 2023_ + +- Updated [`@csstools/postcss-progressive-custom-properties`](https://github.com/csstools/postcss-plugins/tree/main/plugins/postcss-progressive-custom-properties) to [`3.0.2`](https://github.com/csstools/postcss-plugins/tree/main/plugins/postcss-progressive-custom-properties/CHANGELOG.md#302) (patch) + +### 5.0.1 + +_September 18, 2023_ + +- Improve performance +- Updated [`@csstools/postcss-progressive-custom-properties`](https://github.com/csstools/postcss-plugins/tree/main/plugins/postcss-progressive-custom-properties) to [`3.0.1`](https://github.com/csstools/postcss-plugins/tree/main/plugins/postcss-progressive-custom-properties/CHANGELOG.md#301) (patch) + +### 5.0.0 + +_July 3, 2023_ + +- Change license to `MIT-0` ([read more about this change in the blog post](https://preset-env.cssdb.org/blog/license-change/)) +- Updated [`@csstools/postcss-progressive-custom-properties`](https://github.com/csstools/postcss-plugins/tree/main/plugins/postcss-progressive-custom-properties) to [`3.0.0`](https://github.com/csstools/postcss-plugins/tree/main/plugins/postcss-progressive-custom-properties/CHANGELOG.md#300) (major) + +### 4.0.4 + +_June 1, 2023_ + +- Updated `@csstools/postcss-progressive-custom-properties` to `2.3.0` (minor) + +### 4.0.3 + +_May 19, 2023_ + +- Updated `@csstools/postcss-progressive-custom-properties` to `2.2.0` (minor) + +### 4.0.2 + +_February 8, 2023_ + +- Reduce the amount of duplicate fallback CSS. + +### 4.0.1 + +_January 28, 2023_ + +- Improve `types` declaration in `package.json` + +### 4.0.0 + +_January 24, 2023_ + +- Updated: Support for Node v14+ (major). + +### 3.1.2 + +_July 8, 2022_ + +- Fix case insensitive matching. + +### 3.1.1 + +_March 7, 2022_ + +- Add TypeScript support +- Fix color functions. +- Fix `at` keyword with `at 20px 20px` being interpreted as a double position color stop. + +### 3.1.0 + +_February 15, 2022_ + +- Ignore values in relevant `@supports` rules. +- Support double position gradients in Custom Properties. + +```css +@supports (order: linear-gradient(90deg, black 25% 50%, blue 50% 75%)) { + .support { + /* is not processed */ + order: linear-gradient(90deg, black 25% 50%, blue 50% 75%); + } +} +``` + +### 3.0.5 + +_February 5, 2022_ + +- Improved `es module` and `commonjs` compatibility + +### 3.0.4 + +_January 2, 2022_ + +- Removed Sourcemaps from package tarball. +- Moved CLI to CLI Package. See [announcement](https://github.com/csstools/postcss-plugins/discussions/121). + +### 3.0.3 + +_December 14, 2021_ + +- Fixed: infinite loop in complex gradients. + +### 3.0.2 + +_December 13, 2021_ + +- Changed: now uses `postcss-value-parser` for parsing. +- Updated: documentation + +### 3.0.1 + +_November 18, 2021_ + +- Added: Safeguards against postcss-values-parser potentially throwing an error. + +- Fixed: Issue with some gradients creating an infinite loop. + +- Updated: `postcss-value-parser` to 6.0.1 (patch) +- Updated: `eslint` to 8.2.0 (major) +- Updated: `postcss` to 8.3.11 (patch) + +- Removed: yarn.lock is no longer version controlled + +### 3.0.0 + +_September 17, 2021_ + +- Updated: Support for PostCS 8+ (major). +- Updated: Support for Node 12+ (major). + +### 2.0.0 + +_April 25, 2020_ + +- Updated: `postcss` to 7.0.27 (patch) +- Updated: `postcss-value-parser` to 3.2.1 (major) +- Updated: Support for Node 10+ (major) + +### 1.0.0 + +_October 28, 2018_ + +- Initial version diff --git a/node_modules/postcss-double-position-gradients/LICENSE.md b/node_modules/postcss-double-position-gradients/LICENSE.md new file mode 100644 index 00000000..e8ae93b9 --- /dev/null +++ b/node_modules/postcss-double-position-gradients/LICENSE.md @@ -0,0 +1,18 @@ +MIT No Attribution (MIT-0) + +Copyright © CSSTools Contributors + +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. + +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. diff --git a/node_modules/postcss-double-position-gradients/README.md b/node_modules/postcss-double-position-gradients/README.md new file mode 100644 index 00000000..6604ff5d --- /dev/null +++ b/node_modules/postcss-double-position-gradients/README.md @@ -0,0 +1,125 @@ +# PostCSS Double Position Gradients [PostCSS][postcss] + +[NPM Version][npm-url] +[CSS Standard Status][css-url] +[Discord][discord] + +[PostCSS Double Position Gradients] lets you use double-position gradients in +CSS, following the [CSS Image Values and Replaced Content] specification. + +```pcss +.linear-gradient { + background-image: linear-gradient(90deg, black 25% 50%, blue 50% 75%); +} + +.conic-gradient { + background-image: conic-gradient(yellowgreen 40%, gold 0deg 75%, #f06 0deg); +} + +/* becomes */ + +.linear-gradient { + background-image: linear-gradient(90deg, black 25%, black 50%, blue 50%, blue 75%); + background-image: linear-gradient(90deg, black 25% 50%, blue 50% 75%); +} + +.conic-gradient { + background-image: conic-gradient(yellowgreen 40%, gold 0deg, gold 75%, #f06 0deg); + background-image: conic-gradient(yellowgreen 40%, gold 0deg 75%, #f06 0deg); +} +``` + +## Usage + +Add [PostCSS Double Position Gradients] to your project: + +```bash +npm install postcss-double-position-gradients --save-dev +``` + +Use [PostCSS Double Position Gradients] to process your CSS: + +```js +const postcssDoublePositionGradients = require('postcss-double-position-gradients'); + +postcssDoublePositionGradients.process(YOUR_CSS /*, processOptions, pluginOptions */); +``` + +Or use it as a [PostCSS] plugin: + +```js +const postcss = require('postcss'); +const postcssDoublePositionGradients = require('postcss-double-position-gradients'); + +postcss([ + postcssDoublePositionGradients(/* pluginOptions */) +]).process(YOUR_CSS /*, processOptions */); +``` + +[PostCSS Double Position Gradients] runs in all Node environments, with special instructions for: + +| [Node](INSTALL.md#node) | [PostCSS CLI](INSTALL.md#postcss-cli) | [Webpack](INSTALL.md#webpack) | [Gulp](INSTALL.md#gulp) | [Grunt](INSTALL.md#grunt) | +| --- | --- | --- | --- | --- | + +## Options + +### preserve + +The `preserve` option determines whether the original double-position gradients +should be preserved. By default, double-position gradients are preserved. + +```js +postcssDoublePositionGradients({ preserve: false }) +``` + +```css +.linear-gradient { + background-image: linear-gradient(90deg, black 25% 50%, blue 50% 75%); +} + +.conic-gradient { + background-image: conic-gradient(yellowgreen 40%, gold 0deg 75%, #f06 0deg); +} + +/* becomes */ + +.linear-gradient { + background-image: linear-gradient(90deg, black 25%, black 50%, blue 50%, blue 75%); +} + +.conic-gradient { + background-image: conic-gradient(yellowgreen 40%, gold 0deg, gold 75%, #f06 0deg); +} +``` + +### enableProgressiveCustomProperties + +The `enableProgressiveCustomProperties` option determines whether the original notation +is wrapped with `@supports` when used in Custom Properties. By default, it is enabled. + +⚠️ We only recommend disabling this when you set `preserve` to `false` or if you bring your own fix for Custom Properties. See what the plugin does in its [README](https://github.com/csstools/postcss-plugins/tree/main/plugins/postcss-progressive-custom-properties#readme). + +```js +postcssDoublePositionGradients({ enableProgressiveCustomProperties: false }) +``` + +```pcss +:root { + --a-gradient: linear-gradient(90deg, black 25% 50%, blue 50% 75%); +} + +/* becomes */ + +:root { + --a-gradient: linear-gradient(90deg, black 25%, black 50%, blue 50%, blue 75%); /* will never be used, not even in older browser */ + --a-gradient: linear-gradient(90deg, black 25% 50%, blue 50% 75%); +} +``` + +[css-url]: https://cssdb.org/#double-position-gradients +[discord]: https://discord.gg/bUadyRwkJS +[npm-url]: https://www.npmjs.com/package/postcss-double-position-gradients + +[CSS Image Values and Replaced Content]: https://www.w3.org/TR/css-images-4/#color-stop-syntax +[PostCSS]: https://github.com/postcss/postcss +[PostCSS Double Position Gradients]: https://github.com/csstools/postcss-plugins/tree/main/plugins/postcss-double-position-gradients diff --git a/node_modules/postcss-double-position-gradients/dist/has-fallback-decl.d.ts b/node_modules/postcss-double-position-gradients/dist/has-fallback-decl.d.ts new file mode 100644 index 00000000..d7ae8d89 --- /dev/null +++ b/node_modules/postcss-double-position-gradients/dist/has-fallback-decl.d.ts @@ -0,0 +1,2 @@ +import type { Declaration } from 'postcss'; +export declare function hasFallback(node: Declaration): boolean; diff --git a/node_modules/postcss-double-position-gradients/dist/has-supports-at-rule-ancestor.d.ts b/node_modules/postcss-double-position-gradients/dist/has-supports-at-rule-ancestor.d.ts new file mode 100644 index 00000000..a46009ec --- /dev/null +++ b/node_modules/postcss-double-position-gradients/dist/has-supports-at-rule-ancestor.d.ts @@ -0,0 +1,2 @@ +import type { Node } from 'postcss'; +export declare function hasSupportsAtRuleAncestor(node: Node): boolean; diff --git a/node_modules/postcss-double-position-gradients/dist/index.cjs b/node_modules/postcss-double-position-gradients/dist/index.cjs new file mode 100644 index 00000000..3c38b391 --- /dev/null +++ b/node_modules/postcss-double-position-gradients/dist/index.cjs @@ -0,0 +1 @@ +"use strict";var e=require("@csstools/postcss-progressive-custom-properties"),t=require("postcss-value-parser");function hasFallback(e){const t=e.parent;if(!t)return!1;const r=e.prop.toLowerCase(),s=t.index(e);for(let e=0;e"div"===e.type&&","===e.value;function isNumericNode(e){try{return!1!==t.unit(null==e?void 0:e.value)}catch(e){return!1}}const basePlugin=e=>({postcssPlugin:"postcss-double-position-gradients",Declaration(n,{result:i}){if(!r.test(n.value))return;if(hasFallback(n))return;if(hasSupportsAtRuleAncestor(n))return;let a;try{a=t(n.value)}catch(e){n.warn(i,`Failed to parse value '${n.value}' as a CSS gradient. Leaving the original value intact.`)}if(void 0===a)return;a.walk((e=>{if("function"!==e.type||!s.test(e.value))return;const t=e.nodes.filter((e=>"comment"!==e.type&&"space"!==e.type));let r=!1;t.forEach(((t,s,n)=>{if("word"===t.type&&o.includes(t.value.toLowerCase())&&(r=!0),"div"===t.type&&","===t.value&&(r=!1),r)return;const i=Object(n[s-1]),a=Object(n[s-2]),c=Object(n[s+1]);if(a.type&&isNumericNode(i)&&isNumericNode(t)){const r=a,s={type:"div",value:",",before:isPunctuationCommaNode(c)?c.before:"",after:isPunctuationCommaNode(c)?"":" ",sourceIndex:0,sourceEndIndex:0};e.nodes.splice(e.nodes.indexOf(t)-1,0,s,r)}}))}));const c=a.toString();c!==n.value&&(n.cloneBefore({value:c}),null!=e&&e.preserve||n.remove())}});basePlugin.postcss=!0;const postcssPlugin=t=>{const r=Object.assign({enableProgressiveCustomProperties:!0,preserve:!0},t);return r.enableProgressiveCustomProperties&&r.preserve?{postcssPlugin:"postcss-double-position-gradients",plugins:[e(),basePlugin(r)]}:basePlugin(r)};postcssPlugin.postcss=!0,module.exports=postcssPlugin; diff --git a/node_modules/postcss-double-position-gradients/dist/index.d.ts b/node_modules/postcss-double-position-gradients/dist/index.d.ts new file mode 100644 index 00000000..75ff88fb --- /dev/null +++ b/node_modules/postcss-double-position-gradients/dist/index.d.ts @@ -0,0 +1,10 @@ +import type { PluginCreator } from 'postcss'; +/** postcss-double-position-gradients plugin options */ +export type pluginOptions = { + /** Preserve the original notation. default: true */ + preserve?: boolean; + /** Enable "@csstools/postcss-progressive-custom-properties". default: true */ + enableProgressiveCustomProperties?: boolean; +}; +declare const postcssPlugin: PluginCreator; +export default postcssPlugin; diff --git a/node_modules/postcss-double-position-gradients/dist/index.mjs b/node_modules/postcss-double-position-gradients/dist/index.mjs new file mode 100644 index 00000000..f3fe49ec --- /dev/null +++ b/node_modules/postcss-double-position-gradients/dist/index.mjs @@ -0,0 +1 @@ +import e from"@csstools/postcss-progressive-custom-properties";import t from"postcss-value-parser";function hasFallback(e){const t=e.parent;if(!t)return!1;const r=e.prop.toLowerCase(),s=t.index(e);for(let e=0;e"div"===e.type&&","===e.value;function isNumericNode(e){try{return!1!==t.unit(null==e?void 0:e.value)}catch(e){return!1}}const basePlugin=e=>({postcssPlugin:"postcss-double-position-gradients",Declaration(n,{result:i}){if(!r.test(n.value))return;if(hasFallback(n))return;if(hasSupportsAtRuleAncestor(n))return;let a;try{a=t(n.value)}catch(e){n.warn(i,`Failed to parse value '${n.value}' as a CSS gradient. Leaving the original value intact.`)}if(void 0===a)return;a.walk((e=>{if("function"!==e.type||!s.test(e.value))return;const t=e.nodes.filter((e=>"comment"!==e.type&&"space"!==e.type));let r=!1;t.forEach(((t,s,n)=>{if("word"===t.type&&o.includes(t.value.toLowerCase())&&(r=!0),"div"===t.type&&","===t.value&&(r=!1),r)return;const i=Object(n[s-1]),a=Object(n[s-2]),c=Object(n[s+1]);if(a.type&&isNumericNode(i)&&isNumericNode(t)){const r=a,s={type:"div",value:",",before:isPunctuationCommaNode(c)?c.before:"",after:isPunctuationCommaNode(c)?"":" ",sourceIndex:0,sourceEndIndex:0};e.nodes.splice(e.nodes.indexOf(t)-1,0,s,r)}}))}));const c=a.toString();c!==n.value&&(n.cloneBefore({value:c}),null!=e&&e.preserve||n.remove())}});basePlugin.postcss=!0;const postcssPlugin=t=>{const r=Object.assign({enableProgressiveCustomProperties:!0,preserve:!0},t);return r.enableProgressiveCustomProperties&&r.preserve?{postcssPlugin:"postcss-double-position-gradients",plugins:[e(),basePlugin(r)]}:basePlugin(r)};postcssPlugin.postcss=!0;export{postcssPlugin as default}; diff --git a/node_modules/postcss-double-position-gradients/dist/is-gradient.d.ts b/node_modules/postcss-double-position-gradients/dist/is-gradient.d.ts new file mode 100644 index 00000000..72378209 --- /dev/null +++ b/node_modules/postcss-double-position-gradients/dist/is-gradient.d.ts @@ -0,0 +1,2 @@ +export declare const HAS_GRADIENT_FUNCTION: RegExp; +export declare const IS_GRADIENT_FUNCTION: RegExp; diff --git a/node_modules/postcss-double-position-gradients/package.json b/node_modules/postcss-double-position-gradients/package.json new file mode 100644 index 00000000..a94cfc0d --- /dev/null +++ b/node_modules/postcss-double-position-gradients/package.json @@ -0,0 +1,84 @@ +{ + "name": "postcss-double-position-gradients", + "description": "Use double-position gradients in CSS", + "version": "5.0.2", + "author": "Jonathan Neal ", + "license": "MIT-0", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/csstools" + }, + { + "type": "opencollective", + "url": "https://opencollective.com/csstools" + } + ], + "engines": { + "node": "^14 || ^16 || >=18" + }, + "main": "dist/index.cjs", + "module": "dist/index.mjs", + "types": "dist/index.d.ts", + "exports": { + ".": { + "types": "./dist/index.d.ts", + "import": "./dist/index.mjs", + "require": "./dist/index.cjs", + "default": "./dist/index.mjs" + } + }, + "files": [ + "CHANGELOG.md", + "LICENSE.md", + "README.md", + "dist" + ], + "dependencies": { + "@csstools/postcss-progressive-custom-properties": "^3.0.2", + "postcss-value-parser": "^4.2.0" + }, + "peerDependencies": { + "postcss": "^8.4" + }, + "devDependencies": { + "@csstools/postcss-tape": "*" + }, + "scripts": { + "build": "rollup -c ../../rollup/default.mjs", + "docs": "node ../../.github/bin/generate-docs/install.mjs", + "lint": "node ../../.github/bin/format-package-json.mjs", + "prepublishOnly": "npm run build && npm run test", + "test": "node .tape.mjs && node ./test/_import.mjs && node ./test/_require.cjs", + "test:rewrite-expects": "REWRITE_EXPECTS=true node .tape.mjs" + }, + "homepage": "https://github.com/csstools/postcss-plugins/tree/main/plugins/postcss-double-position-gradients#readme", + "repository": { + "type": "git", + "url": "https://github.com/csstools/postcss-plugins.git", + "directory": "plugins/postcss-double-position-gradients" + }, + "bugs": "https://github.com/csstools/postcss-plugins/issues", + "keywords": [ + "color", + "conic", + "css", + "double", + "gradients", + "linear", + "position", + "postcss", + "postcss-plugin", + "radial", + "repeating", + "stop", + "syntax" + ], + "csstools": { + "exportName": "postcssDoublePositionGradients", + "humanReadableName": "PostCSS Double Position Gradients" + }, + "volta": { + "extends": "../../package.json" + } +} -- cgit v1.2.3