diff options
| author | littleblack111 <littleblack11111@gmail.com> | 2023-10-14 15:05:55 +0800 |
|---|---|---|
| committer | littleblack111 <littleblack11111@gmail.com> | 2023-10-14 15:05:55 +0800 |
| commit | c06f7ee0a40255214c477e13d9b956a7e07c2900 (patch) | |
| tree | f5982a568ef8fab865d0142e71c7494fea3e4c1b /node_modules/@csstools/postcss-nested-calc | |
| parent | 3fd9400d4dccc25aa29b5702216732e0b7542073 (diff) | |
postcss,(plugins): nanocss, postcss-preset-env
Diffstat (limited to 'node_modules/@csstools/postcss-nested-calc')
9 files changed, 229 insertions, 0 deletions
diff --git a/node_modules/@csstools/postcss-nested-calc/CHANGELOG.md b/node_modules/@csstools/postcss-nested-calc/CHANGELOG.md new file mode 100644 index 00000000..fc9be8f1 --- /dev/null +++ b/node_modules/@csstools/postcss-nested-calc/CHANGELOG.md @@ -0,0 +1,31 @@ +# Changes to PostCSS Nested Calc + +### 3.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/)) + +### 2.0.2 + +_February 9, 2023_ + +- Reduce the amount of duplicate fallback CSS. + +### 2.0.1 + +_January 28, 2023_ + +- Improve `types` declaration in `package.json` + +### 2.0.0 + +_January 24, 2023_ + +- Updated: Support for Node v14+ (major). + +### 1.0.0 + +_August 15, 2022_ + +- Initial version diff --git a/node_modules/@csstools/postcss-nested-calc/LICENSE.md b/node_modules/@csstools/postcss-nested-calc/LICENSE.md new file mode 100644 index 00000000..e8ae93b9 --- /dev/null +++ b/node_modules/@csstools/postcss-nested-calc/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/@csstools/postcss-nested-calc/README.md b/node_modules/@csstools/postcss-nested-calc/README.md new file mode 100644 index 00000000..fb7beee0 --- /dev/null +++ b/node_modules/@csstools/postcss-nested-calc/README.md @@ -0,0 +1,80 @@ +# PostCSS Nested Calc [<img src="https://postcss.github.io/postcss/logo.svg" alt="PostCSS Logo" width="90" height="90" align="right">][PostCSS] + +[<img alt="npm version" src="https://img.shields.io/npm/v/@csstools/postcss-nested-calc.svg" height="20">][npm-url] [<img alt="CSS Standard Status" src="https://cssdb.org/images/badges/nested-calc.svg" height="20">][css-url] [<img alt="Build Status" src="https://github.com/csstools/postcss-plugins/workflows/test/badge.svg" height="20">][cli-url] [<img alt="Discord" src="https://shields.io/badge/Discord-5865F2?logo=discord&logoColor=white">][discord] + +[PostCSS Nested Calc] lets you use nested `calc()` expressions following the [CSS Values and Units 4 specification]. + +```pcss +.example { + order: calc(1 + calc(2 * 2)); +} + +/* becomes */ + +.example { + order: calc(1 + (2 * 2)); + order: calc(1 + calc(2 * 2)); +} +``` + +## Usage + +Add [PostCSS Nested Calc] to your project: + +```bash +npm install postcss @csstools/postcss-nested-calc --save-dev +``` + +Use it as a [PostCSS] plugin: + +```js +const postcss = require('postcss'); +const postcssNestedCalc = require('@csstools/postcss-nested-calc'); + +postcss([ + postcssNestedCalc(/* pluginOptions */) +]).process(YOUR_CSS /*, processOptions */); +``` + +[PostCSS Nested Calc] runs in all Node environments, with special +instructions for: + +- [Node](INSTALL.md#node) +- [PostCSS CLI](INSTALL.md#postcss-cli) +- [PostCSS Load Config](INSTALL.md#postcss-load-config) +- [Webpack](INSTALL.md#webpack) +- [Next.js](INSTALL.md#nextjs) +- [Gulp](INSTALL.md#gulp) +- [Grunt](INSTALL.md#grunt) + +## Options + +### preserve + +The `preserve` option determines whether the original notation +is preserved. By default the original values are preserved. + +```js +postcssNestedCalc({ preserve: false }) +``` + +```pcss +.example { + order: calc(1 + calc(2 * 2)); +} + +/* becomes */ + +.example { + order: calc(1 + (2 * 2)); +} +``` + +[cli-url]: https://github.com/csstools/postcss-plugins/actions/workflows/test.yml?query=workflow/test +[css-url]: https://cssdb.org/#nested-calc +[discord]: https://discord.gg/bUadyRwkJS +[npm-url]: https://www.npmjs.com/package/@csstools/postcss-nested-calc + +[PostCSS]: https://github.com/postcss/postcss +[PostCSS Nested Calc]: https://github.com/csstools/postcss-plugins/tree/main/plugins/postcss-nested-calc +[CSS Values and Units 4 specification]: https://www.w3.org/TR/css-values/#calc-func diff --git a/node_modules/@csstools/postcss-nested-calc/dist/has-fallback-decl.d.ts b/node_modules/@csstools/postcss-nested-calc/dist/has-fallback-decl.d.ts new file mode 100644 index 00000000..d7ae8d89 --- /dev/null +++ b/node_modules/@csstools/postcss-nested-calc/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/@csstools/postcss-nested-calc/dist/index.cjs b/node_modules/@csstools/postcss-nested-calc/dist/index.cjs new file mode 100644 index 00000000..a52f3cd7 --- /dev/null +++ b/node_modules/@csstools/postcss-nested-calc/dist/index.cjs @@ -0,0 +1 @@ +"use strict";var e=require("postcss-value-parser");const t=/calc\(/gim;function hasFallback(e){const t=e.parent;if(!t)return!1;const r=t.index(e);for(let a=0;a<r;a++){const r=t.nodes[a];if("decl"===r.type&&r.prop.toLowerCase()===e.prop.toLowerCase())return!0}return!1}const creator=r=>{const a=Object.assign({preserve:!0},r);return{postcssPlugin:"postcss-nested-calc",Declaration(r,{result:n}){if((r.value.match(t)||[]).length<2)return;if(r.variable)return;if(hasFallback(r))return;const o=r.value;let s;try{s=e(o)}catch(e){return void r.warn(n,`Failed to parse value '${o}'. Leaving the original value intact.`)}if(void 0===s)return;e.walk(s.nodes,(t=>{t.type&&"function"===t.type&&"calc"===t.value.toLowerCase()&&e.walk(t.nodes,(e=>{if(e.type&&"function"===e.type)return"calc"===e.value.toLowerCase()&&void(e.value="")}))}),!0);const c=String(s);c!==o&&(r.cloneBefore({value:c}),a.preserve||r.remove())}}};creator.postcss=!0,module.exports=creator; diff --git a/node_modules/@csstools/postcss-nested-calc/dist/index.d.ts b/node_modules/@csstools/postcss-nested-calc/dist/index.d.ts new file mode 100644 index 00000000..139448be --- /dev/null +++ b/node_modules/@csstools/postcss-nested-calc/dist/index.d.ts @@ -0,0 +1,8 @@ +import type { PluginCreator } from 'postcss'; +/** postcss-nested-calc plugin options */ +export type pluginOptions = { + /** Preserve the original notation. default: true */ + preserve?: boolean; +}; +declare const creator: PluginCreator<pluginOptions>; +export default creator; diff --git a/node_modules/@csstools/postcss-nested-calc/dist/index.mjs b/node_modules/@csstools/postcss-nested-calc/dist/index.mjs new file mode 100644 index 00000000..41363381 --- /dev/null +++ b/node_modules/@csstools/postcss-nested-calc/dist/index.mjs @@ -0,0 +1 @@ +import e from"postcss-value-parser";const t=/calc\(/gim;function hasFallback(e){const t=e.parent;if(!t)return!1;const r=t.index(e);for(let a=0;a<r;a++){const r=t.nodes[a];if("decl"===r.type&&r.prop.toLowerCase()===e.prop.toLowerCase())return!0}return!1}const creator=r=>{const a=Object.assign({preserve:!0},r);return{postcssPlugin:"postcss-nested-calc",Declaration(r,{result:o}){if((r.value.match(t)||[]).length<2)return;if(r.variable)return;if(hasFallback(r))return;const n=r.value;let s;try{s=e(n)}catch(e){return void r.warn(o,`Failed to parse value '${n}'. Leaving the original value intact.`)}if(void 0===s)return;e.walk(s.nodes,(t=>{t.type&&"function"===t.type&&"calc"===t.value.toLowerCase()&&e.walk(t.nodes,(e=>{if(e.type&&"function"===e.type)return"calc"===e.value.toLowerCase()&&void(e.value="")}))}),!0);const c=String(s);c!==n&&(r.cloneBefore({value:c}),a.preserve||r.remove())}}};creator.postcss=!0;export{creator as default}; diff --git a/node_modules/@csstools/postcss-nested-calc/dist/occurrences.d.ts b/node_modules/@csstools/postcss-nested-calc/dist/occurrences.d.ts new file mode 100644 index 00000000..61f8b784 --- /dev/null +++ b/node_modules/@csstools/postcss-nested-calc/dist/occurrences.d.ts @@ -0,0 +1 @@ +export declare function numberOfCalcOccurrences(value: string): number; diff --git a/node_modules/@csstools/postcss-nested-calc/package.json b/node_modules/@csstools/postcss-nested-calc/package.json new file mode 100644 index 00000000..3f36e0b1 --- /dev/null +++ b/node_modules/@csstools/postcss-nested-calc/package.json @@ -0,0 +1,87 @@ +{ + "name": "@csstools/postcss-nested-calc", + "description": "Use nested calc() expressions in CSS", + "version": "3.0.0", + "contributors": [ + { + "name": "Antonio Laguna", + "email": "antonio@laguna.es", + "url": "https://antonio.laguna.es" + }, + { + "name": "Romain Menke", + "email": "romainmenke@gmail.com" + } + ], + "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": { + "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 && node ../../.github/bin/generate-docs/readme.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-nested-calc#readme", + "repository": { + "type": "git", + "url": "https://github.com/csstools/postcss-plugins.git", + "directory": "plugins/postcss-nested-calc" + }, + "bugs": "https://github.com/csstools/postcss-plugins/issues", + "keywords": [ + "calc", + "css", + "math", + "nested", + "postcss-plugin" + ], + "csstools": { + "cssdbId": "nested-calc", + "exportName": "postcssNestedCalc", + "humanReadableName": "PostCSS Nested Calc", + "specUrl": "https://www.w3.org/TR/css-values/#calc-func" + }, + "volta": { + "extends": "../../package.json" + } +} |
