diff options
Diffstat (limited to 'node_modules/@csstools/postcss-trigonometric-functions')
9 files changed, 358 insertions, 0 deletions
diff --git a/node_modules/@csstools/postcss-trigonometric-functions/CHANGELOG.md b/node_modules/@csstools/postcss-trigonometric-functions/CHANGELOG.md new file mode 100644 index 00000000..9ec73779 --- /dev/null +++ b/node_modules/@csstools/postcss-trigonometric-functions/CHANGELOG.md @@ -0,0 +1,71 @@ +# Changes to PostCSS Trigonometric Functions + +### 3.0.2 + +_September 24, 2023_ + +- Updated [`@csstools/css-tokenizer`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-tokenizer) to [`2.2.1`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-tokenizer/CHANGELOG.md#221) (patch) +- Updated [`@csstools/css-parser-algorithms`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-parser-algorithms) to [`2.3.2`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-parser-algorithms/CHANGELOG.md#232) (patch) +- Updated [`@csstools/css-calc`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-calc) to [`1.1.4`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-calc/CHANGELOG.md#114) (patch) + +### 3.0.1 + +_July 24, 2023_ + +- Use the latest utilities from `@csstools/css-tokenizer` to reduce the bundle size. +- Updated [`@csstools/css-tokenizer`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-tokenizer) to [`2.2.0`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-tokenizer/CHANGELOG.md#220) (minor) +- Updated [`@csstools/css-parser-algorithms`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-parser-algorithms) to [`2.3.1`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-parser-algorithms/CHANGELOG.md#231) (patch) +- Updated [`@csstools/css-calc`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-calc) to [`1.1.3`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-calc/CHANGELOG.md#113) (patch) + +### 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/)) +- Updated [`@csstools/css-parser-algorithms`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-parser-algorithms) to [`2.3.0`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-parser-algorithms/CHANGELOG.md#230) (minor) +- Updated [`@csstools/css-calc`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-calc) to [`1.1.2`](https://github.com/csstools/postcss-plugins/tree/main/packages/css-calc/CHANGELOG.md#112) (patch) + +### 2.1.1 + +_April 10, 2023_ + +- Updated `@csstools/css-tokenizer` to `2.1.1` (patch) +- Updated `@csstools/css-parser-algorithms` to `2.1.1` (patch) +- Updated `@csstools/css-calc` to `1.1.1` (patch) + +### 2.1.0 + +_March 21, 2023_ + +- Added: `@csstools/css-calc` +- Added: unit conversions (`sin(30deg + (.125turn / 3))`) + +### 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.2 + +_July 8, 2022_ + +- Fix case insensitive matching. + +### 1.0.1 + +_May 31, 2022_ + +- Ensure that the plugin works in node 14 + +### 1.0.0 + +_May 20, 2022_ + +- Initial version diff --git a/node_modules/@csstools/postcss-trigonometric-functions/LICENSE.md b/node_modules/@csstools/postcss-trigonometric-functions/LICENSE.md new file mode 100644 index 00000000..e8ae93b9 --- /dev/null +++ b/node_modules/@csstools/postcss-trigonometric-functions/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-trigonometric-functions/README.md b/node_modules/@csstools/postcss-trigonometric-functions/README.md new file mode 100644 index 00000000..2c1f3cc7 --- /dev/null +++ b/node_modules/@csstools/postcss-trigonometric-functions/README.md @@ -0,0 +1,162 @@ +# PostCSS Trigonometric Functions [<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-trigonometric-functions.svg" height="20">][npm-url] [<img alt="CSS Standard Status" src="https://cssdb.org/images/badges/trigonometric-functions.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] + +```bash +npm install @csstools/postcss-trigonometric-functions --save-dev +``` + +[PostCSS Trigonometric Functions] lets you use `sin`, `cos`, `tan`, `asin`, `acos`, `atan` and `atan2` to be able to compute trigonometric relationships following the [CSS Values 4] specification. + +```pcss +.trigonometry { + line-height: sin(pi / 4); + line-height: cos(.125turn); + line-height: tan(50grad); + transform: rotate(asin(-1)); + transform: rotate(asin(sin(30deg + 1.0471967rad))); + transform: rotate(acos(-1)); + transform: rotate(acos(cos(0 / 2 + 1 - 1))); + transform: rotate(atan(infinity)); + transform: rotate(atan(e - 2.7182818284590452354)); + transform: rotate(atan2(-infinity,-infinity)); + transform: rotate(atan2(-infinity,infinity)); + transform: rotate(atan2(-infinity,infinity)); + transform: rotate(atan2(90, 15)); +} + +/* becomes */ + +.trigonometry { + line-height: 0.70711; + line-height: 0.70711; + line-height: 1; + transform: rotate(-90deg); + transform: rotate(89.99995deg); + transform: rotate(180deg); + transform: rotate(0deg); + transform: rotate(90deg); + transform: rotate(0deg); + transform: rotate(-135deg); + transform: rotate(-45deg); + transform: rotate(-45deg); + transform: rotate(80.53768deg); +} +``` + +## Usage + +Add [PostCSS Trigonometric Functions] to your project: + +```bash +npm install postcss @csstools/postcss-trigonometric-functions --save-dev +``` + +Use it as a [PostCSS] plugin: + +```js +const postcss = require('postcss'); +const postcssTrigonometricFunctions = require('@csstools/postcss-trigonometric-functions'); + +postcss([ + postcssTrigonometricFunctions(/* pluginOptions */) +]).process(YOUR_CSS /*, processOptions */); +``` + +[PostCSS Trigonometric Functions] 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) + +## ⚠️ About custom properties + +Given the dynamic nature of custom properties it's impossible to know what the variable value is, which means the plugin can't compute a final value for the stylesheet. + +Because of that, any usage that contains a `var` is skipped. + +## Units + +[PostCSS Trigonometric Functions] lets you use different special units that are within the spec and computed at run time to be able to calculate the result of the trigonometric function. + +The following units are supported: + +* `pi`: Computes to `Math.PI` which is `3.141592653589793` +* `e`: Computes to `Math.E` which is `2.718281828459045` +* `infinity`, `-infinity`: Compute to `Infinity` and `-Infinity` respectively. Note that the usage is case insensitive so `InFiNiTy` is a valid value. + +Some calculations (such as `sin(-infinity)`) might return `NaN` as per the spec. Given that `NaN` can't be replaced with a value that's useful to CSS it is left as is, as the result will be effectively ignored by the browser. + +## Options + +### preserve + +The `preserve` option determines whether the original notation +is preserved. By default, it is not preserved. + +```js +postcssTrigonometricFunctions({ preserve: true }) +``` + +```pcss +.trigonometry { + line-height: sin(pi / 4); + line-height: cos(.125turn); + line-height: tan(50grad); + transform: rotate(asin(-1)); + transform: rotate(asin(sin(30deg + 1.0471967rad))); + transform: rotate(acos(-1)); + transform: rotate(acos(cos(0 / 2 + 1 - 1))); + transform: rotate(atan(infinity)); + transform: rotate(atan(e - 2.7182818284590452354)); + transform: rotate(atan2(-infinity,-infinity)); + transform: rotate(atan2(-infinity,infinity)); + transform: rotate(atan2(-infinity,infinity)); + transform: rotate(atan2(90, 15)); +} + +/* becomes */ + +.trigonometry { + line-height: 0.70711; + line-height: sin(pi / 4); + line-height: 0.70711; + line-height: cos(.125turn); + line-height: 1; + line-height: tan(50grad); + transform: rotate(-90deg); + transform: rotate(asin(-1)); + transform: rotate(89.99995deg); + transform: rotate(asin(sin(30deg + 1.0471967rad))); + transform: rotate(180deg); + transform: rotate(acos(-1)); + transform: rotate(0deg); + transform: rotate(acos(cos(0 / 2 + 1 - 1))); + transform: rotate(90deg); + transform: rotate(atan(infinity)); + transform: rotate(0deg); + transform: rotate(atan(e - 2.7182818284590452354)); + transform: rotate(-135deg); + transform: rotate(atan2(-infinity,-infinity)); + transform: rotate(-45deg); + transform: rotate(atan2(-infinity,infinity)); + transform: rotate(-45deg); + transform: rotate(atan2(-infinity,infinity)); + transform: rotate(80.53768deg); + transform: rotate(atan2(90, 15)); +} +``` + +[cli-url]: https://github.com/csstools/postcss-plugins/actions/workflows/test.yml?query=workflow/test +[css-url]: https://cssdb.org/#trigonometric-functions +[discord]: https://discord.gg/bUadyRwkJS +[npm-url]: https://www.npmjs.com/package/@csstools/postcss-trigonometric-functions + +[PostCSS]: https://github.com/postcss/postcss +[PostCSS Trigonometric Functions]: https://github.com/csstools/postcss-plugins/tree/main/plugins/postcss-trigonometric-functions +[CSS Values 4]: https://www.w3.org/TR/css-values-4/#trig-funcs diff --git a/node_modules/@csstools/postcss-trigonometric-functions/dist/calc.d.ts b/node_modules/@csstools/postcss-trigonometric-functions/dist/calc.d.ts new file mode 100644 index 00000000..5a1ee11e --- /dev/null +++ b/node_modules/@csstools/postcss-trigonometric-functions/dist/calc.d.ts @@ -0,0 +1 @@ +export declare function calc(css: string): string; diff --git a/node_modules/@csstools/postcss-trigonometric-functions/dist/checks.d.ts b/node_modules/@csstools/postcss-trigonometric-functions/dist/checks.d.ts new file mode 100644 index 00000000..6623beb7 --- /dev/null +++ b/node_modules/@csstools/postcss-trigonometric-functions/dist/checks.d.ts @@ -0,0 +1,2 @@ +export declare const FUNCTION_NAME_REGEXP: RegExp; +export declare const FUNCTION_CALL_REGEXP: RegExp; diff --git a/node_modules/@csstools/postcss-trigonometric-functions/dist/index.cjs b/node_modules/@csstools/postcss-trigonometric-functions/dist/index.cjs new file mode 100644 index 00000000..6fe36838 --- /dev/null +++ b/node_modules/@csstools/postcss-trigonometric-functions/dist/index.cjs @@ -0,0 +1 @@ +"use strict";var s=require("@csstools/css-calc"),e=require("@csstools/css-parser-algorithms"),o=require("@csstools/css-tokenizer");const t=["asin","acos","atan","atan2","sin","cos","tan"],n=new RegExp(`^(${t.join("|")})$`,"i"),c=new RegExp(`(${t.join("|")})\\(`,"i");function calc(t){const c=o.tokenize({css:t});return c.some((s=>s[0]===o.TokenType.Function&&n.test(s[4].value)))?e.stringify(s.calcFromComponentValues(e.parseCommaSeparatedListOfComponentValues(c),{precision:5,toCanonicalUnits:!0})):t}const creator=s=>{const e=Object.assign({preserve:!1},s);return{postcssPlugin:"postcss-trigonometric-functions",Declaration(s){if(!c.test(s.value))return;const o=calc(s.value);o!==s.value&&(s.cloneBefore({value:o}),e.preserve||s.remove())}}};creator.postcss=!0,module.exports=creator; diff --git a/node_modules/@csstools/postcss-trigonometric-functions/dist/index.d.ts b/node_modules/@csstools/postcss-trigonometric-functions/dist/index.d.ts new file mode 100644 index 00000000..40ac49ea --- /dev/null +++ b/node_modules/@csstools/postcss-trigonometric-functions/dist/index.d.ts @@ -0,0 +1,8 @@ +import type { PluginCreator } from 'postcss'; +/** postcss-trigonometric-functions plugin options */ +export type pluginOptions = { + /** Preserve the original notation. default: false */ + preserve?: boolean; +}; +declare const creator: PluginCreator<pluginOptions>; +export default creator; diff --git a/node_modules/@csstools/postcss-trigonometric-functions/dist/index.mjs b/node_modules/@csstools/postcss-trigonometric-functions/dist/index.mjs new file mode 100644 index 00000000..8fed33de --- /dev/null +++ b/node_modules/@csstools/postcss-trigonometric-functions/dist/index.mjs @@ -0,0 +1 @@ +import{calcFromComponentValues as s}from"@csstools/css-calc";import{stringify as o,parseCommaSeparatedListOfComponentValues as t}from"@csstools/css-parser-algorithms";import{tokenize as e,TokenType as n}from"@csstools/css-tokenizer";const c=["asin","acos","atan","atan2","sin","cos","tan"],r=new RegExp(`^(${c.join("|")})$`,"i"),a=new RegExp(`(${c.join("|")})\\(`,"i");function calc(c){const a=e({css:c});return a.some((s=>s[0]===n.Function&&r.test(s[4].value)))?o(s(t(a),{precision:5,toCanonicalUnits:!0})):c}const creator=s=>{const o=Object.assign({preserve:!1},s);return{postcssPlugin:"postcss-trigonometric-functions",Declaration(s){if(!a.test(s.value))return;const t=calc(s.value);t!==s.value&&(s.cloneBefore({value:t}),o.preserve||s.remove())}}};creator.postcss=!0;export{creator as default}; diff --git a/node_modules/@csstools/postcss-trigonometric-functions/package.json b/node_modules/@csstools/postcss-trigonometric-functions/package.json new file mode 100644 index 00000000..95a0b08f --- /dev/null +++ b/node_modules/@csstools/postcss-trigonometric-functions/package.json @@ -0,0 +1,94 @@ +{ + "name": "@csstools/postcss-trigonometric-functions", + "description": "Use sin(), cos(), tan(), acos(), atan(), and atan2() to compute trigonometric relationships", + "version": "3.0.2", + "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": { + "@csstools/css-calc": "^1.1.4", + "@csstools/css-parser-algorithms": "^2.3.2", + "@csstools/css-tokenizer": "^2.2.1" + }, + "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-trigonometric-functions#readme", + "repository": { + "type": "git", + "url": "https://github.com/csstools/postcss-plugins.git", + "directory": "plugins/postcss-trigonometric-functions" + }, + "bugs": "https://github.com/csstools/postcss-plugins/issues", + "keywords": [ + "acos", + "acos2", + "asin", + "atan", + "cos", + "css", + "postcss-plugin", + "sin", + "tan", + "trigonometric" + ], + "csstools": { + "cssdbId": "trigonometric-functions", + "exportName": "postcssTrigonometricFunctions", + "humanReadableName": "PostCSS Trigonometric Functions", + "specUrl": "https://www.w3.org/TR/css-values-4/#trig-funcs" + }, + "volta": { + "extends": "../../package.json" + } +} |
