diff options
Diffstat (limited to 'node_modules/@csstools/postcss-text-decoration-shorthand')
7 files changed, 287 insertions, 0 deletions
diff --git a/node_modules/@csstools/postcss-text-decoration-shorthand/CHANGELOG.md b/node_modules/@csstools/postcss-text-decoration-shorthand/CHANGELOG.md new file mode 100644 index 00000000..00ec3a12 --- /dev/null +++ b/node_modules/@csstools/postcss-text-decoration-shorthand/CHANGELOG.md @@ -0,0 +1,82 @@ +# Changes to PostCSS Text Decoration Shorthand + +### 3.0.3 + +_September 18, 2023_ + +- Improve performance + +### 3.0.2 + +_September 2, 2023_ + +- Updated [`@csstools/color-helpers`](https://github.com/csstools/postcss-plugins/tree/main/packages/color-helpers) to [`3.0.2`](https://github.com/csstools/postcss-plugins/tree/main/packages/color-helpers/CHANGELOG.md#302) (patch) + +### 3.0.1 + +_August 28, 2023_ + +- Updated [`@csstools/color-helpers`](https://github.com/csstools/postcss-plugins/tree/main/packages/color-helpers) to [`3.0.1`](https://github.com/csstools/postcss-plugins/tree/main/packages/color-helpers/CHANGELOG.md#301) (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/color-helpers`](https://github.com/csstools/postcss-plugins/tree/main/packages/color-helpers) to [`3.0.0`](https://github.com/csstools/postcss-plugins/tree/main/packages/color-helpers/CHANGELOG.md#300) (major) + +### 2.2.4 + +_May 19, 2023_ + +- Updated `@csstools/color-helpers` to `2.1.0` (minor) + + +### 2.2.3 + +_April 10, 2023_ + +- Updated: `@csstools/color-helpers` to `v2.0.0` + +### 2.2.2 + +_March 25, 2023_ + +- Add `color-mix` as a known color function. + +### 2.2.1 + +_February 13, 2023_ + +- Updated: `preserve` option defaults to `true` + +### 2.2.0 + +_February 2, 2023_ + +- Add: `@csstools/color-helpers` dependency for the named colors list. + +### 2.1.0 + +_January 28, 2023_ + +- Add: support for multiple line values (`text-decoration: overline underline;`) + +### 2.0.1 + +_January 28, 2023_ + +- Improve `types` declaration in `package.json` + +### 2.0.0 + +_January 24, 2023_ + +- Updated: Support for Node v14+ (major). +- Add: `-webkit-text-decoration` shorthand for single value `text-decoration: underline;`. [autoprefixer 1473](https://github.com/postcss/autoprefixer/issues/1473#issuecomment-1243370592) + +### 1.0.0 + +_August 15, 2022_ + +- Initial version diff --git a/node_modules/@csstools/postcss-text-decoration-shorthand/LICENSE.md b/node_modules/@csstools/postcss-text-decoration-shorthand/LICENSE.md new file mode 100644 index 00000000..e8ae93b9 --- /dev/null +++ b/node_modules/@csstools/postcss-text-decoration-shorthand/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-text-decoration-shorthand/README.md b/node_modules/@csstools/postcss-text-decoration-shorthand/README.md new file mode 100644 index 00000000..4e16d512 --- /dev/null +++ b/node_modules/@csstools/postcss-text-decoration-shorthand/README.md @@ -0,0 +1,88 @@ +# PostCSS Text Decoration Shorthand [<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-text-decoration-shorthand.svg" height="20">][npm-url] [<img alt="CSS Standard Status" src="https://cssdb.org/images/badges/text-decoration-shorthand.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-text-decoration-shorthand --save-dev +``` + +[PostCSS Text Decoration Shorthand] lets you use `text-decoration` as a shorthand following the [Text Decoration Specification]. + +```pcss +.example { + text-decoration: wavy underline purple 25%; +} + +/* becomes */ + +.example { + text-decoration: underline; + text-decoration: underline wavy purple; + text-decoration-thickness: calc(0.01em * 25); + text-decoration: wavy underline purple 25%; +} +``` + +## Usage + +Add [PostCSS Text Decoration Shorthand] to your project: + +```bash +npm install postcss @csstools/postcss-text-decoration-shorthand --save-dev +``` + +Use it as a [PostCSS] plugin: + +```js +const postcss = require('postcss'); +const postcssTextDecorationShorthand = require('@csstools/postcss-text-decoration-shorthand'); + +postcss([ + postcssTextDecorationShorthand(/* pluginOptions */) +]).process(YOUR_CSS /*, processOptions */); +``` + +[PostCSS Text Decoration Shorthand] 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, it is preserved. + +```js +postcssTextDecorationShorthand({ preserve: false }) +``` + +```pcss +.example { + text-decoration: wavy underline purple 25%; +} + +/* becomes */ + +.example { + text-decoration: underline; + text-decoration: underline wavy purple; + text-decoration-thickness: calc(0.01em * 25); +} +``` + +[cli-url]: https://github.com/csstools/postcss-plugins/actions/workflows/test.yml?query=workflow/test +[css-url]: https://cssdb.org/#text-decoration-shorthand +[discord]: https://discord.gg/bUadyRwkJS +[npm-url]: https://www.npmjs.com/package/@csstools/postcss-text-decoration-shorthand + +[PostCSS]: https://github.com/postcss/postcss +[PostCSS Text Decoration Shorthand]: https://github.com/csstools/postcss-plugins/tree/main/plugins/postcss-text-decoration-shorthand +[Text Decoration Specification]: https://drafts.csswg.org/css-text-decor-4/#text-decoration-property diff --git a/node_modules/@csstools/postcss-text-decoration-shorthand/dist/index.cjs b/node_modules/@csstools/postcss-text-decoration-shorthand/dist/index.cjs new file mode 100644 index 00000000..44f618a9 --- /dev/null +++ b/node_modules/@csstools/postcss-text-decoration-shorthand/dist/index.cjs @@ -0,0 +1 @@ +"use strict";var e=require("@csstools/color-helpers"),o=require("postcss-value-parser");const r=/^text-decoration$/i,creator=e=>{const c=Object.assign({preserve:!0},e);return{postcssPlugin:"postcss-text-decoration-shorthand",prepare(){const e=new Map;return{OnceExit:()=>{e.clear()},Declaration:u=>{if(!r.test(u.prop))return;const a=u.parent;if(!a)return;const i=a.index(u);if(a.nodes.some((o=>"decl"===o.type&&r.test(o.prop)&&e.get(u.value)===o.value&&a.index(o)!==i)))return;const d=o(u.value),p=d.nodes.filter((e=>"space"!==e.type&&"comment"!==e.type));if(p.find((e=>"var"===e.value.toLowerCase()&&"function"===e.type)))return;if(p.find((e=>"word"===e.type&&t.includes(e.value))))return;const f={line:[],style:null,color:null,thickness:null};for(let e=0;e<p.length;e++){const r=p[e];if(f.line.length||"word"!==r.type||!n.includes(r.value.toLowerCase()))if(f.line.length||"word"!==r.type||"none"!==r.value.toLowerCase())if(f.style||"word"!==r.type||!s.includes(r.value.toLowerCase()))if(f.thickness||"word"!==r.type||!l.includes(r.value.toLowerCase()))if(f.thickness||"function"!==r.type||"calc"!==r.value.toLowerCase())if(f.color||!nodeIsAColor(r)){if("word"!==r.type)return;{let e;try{e=o.unit(r.value)}catch(e){return}if(!e||!e.unit)return;f.thickness=r,"%"===e.unit&&(f.thickness={before:"",after:"",sourceIndex:0,sourceEndIndex:0,type:"function",value:"calc",nodes:[{before:"",after:"",sourceIndex:0,sourceEndIndex:0,type:"word",value:"0.01em"},{before:"",after:"",sourceIndex:0,sourceEndIndex:0,type:"space",value:" "},{before:"",after:"",sourceIndex:0,sourceEndIndex:0,type:"word",value:"*"},{before:"",after:"",sourceIndex:0,sourceEndIndex:0,type:"space",value:" "},{before:"",after:"",sourceIndex:0,sourceEndIndex:0,type:"word",value:e.number}]})}}else f.color=r;else f.thickness=r;else f.thickness=r;else f.style=r;else f.line.push(r);else{const o=r;let t=r;for(;;){const o=p[e+1];if(!o||"word"!==o.type||!n.includes(o.value.toLowerCase()))break;t=o,e++}f.line=d.nodes.slice(d.nodes.indexOf(o),d.nodes.indexOf(t)+1)}}f.line.length||f.line.push({before:"",after:"",sourceIndex:0,sourceEndIndex:0,type:"word",value:"none"}),f.style||(f.style={before:"",after:"",sourceIndex:0,sourceEndIndex:0,type:"word",value:"solid"}),f.color||(f.color={before:"",after:"",sourceIndex:0,sourceEndIndex:0,type:"word",value:"currentColor"});const v=o.stringify(f.line);if(u.value.toLowerCase()===v.toLowerCase()){const e=u.next();return void(e&&"decl"===e.type&&"text-decoration"===e.prop.toLowerCase()||u.cloneBefore({prop:"-webkit-text-decoration",value:v}))}u.cloneBefore({prop:"text-decoration",value:v});const y=o.stringify([...f.line,{before:"",after:"",sourceIndex:0,sourceEndIndex:0,type:"space",value:" "},f.style,{before:"",after:"",sourceIndex:0,sourceEndIndex:0,type:"space",value:" "},f.color]);f.thickness&&u.cloneBefore({prop:"text-decoration",value:y}),f.thickness&&u.cloneBefore({prop:"text-decoration-thickness",value:o.stringify([f.thickness])}),e.set(u.value,v),e.set(y,v),c.preserve||u.remove()}}}}};function nodeIsAColor(e){return!("word"!==e.type||!e.value.startsWith("#"))||(!("word"!==e.type||!u.includes(e.value.toLowerCase()))||!("function"!==e.type||!c.includes(e.value.toLowerCase())))}creator.postcss=!0;const t=["unset","inherit","initial","revert","revert-layer"],n=["underline","overline","line-through","blink","spelling-error","grammar-error"],s=["solid","double","dotted","dashed","wavy"],l=["auto","from-font"],c=["color","color-mix","hsl","hsla","hwb","lab","lch","oklab","oklch","rgb","rgba"],u=["currentcolor","transparent",...Object.keys(e.namedColors)];module.exports=creator; diff --git a/node_modules/@csstools/postcss-text-decoration-shorthand/dist/index.d.ts b/node_modules/@csstools/postcss-text-decoration-shorthand/dist/index.d.ts new file mode 100644 index 00000000..c9808969 --- /dev/null +++ b/node_modules/@csstools/postcss-text-decoration-shorthand/dist/index.d.ts @@ -0,0 +1,8 @@ +import type { PluginCreator } from 'postcss'; +/** postcss-text-decoration-shorthand 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-text-decoration-shorthand/dist/index.mjs b/node_modules/@csstools/postcss-text-decoration-shorthand/dist/index.mjs new file mode 100644 index 00000000..09cd53e2 --- /dev/null +++ b/node_modules/@csstools/postcss-text-decoration-shorthand/dist/index.mjs @@ -0,0 +1 @@ +import{namedColors as e}from"@csstools/color-helpers";import o from"postcss-value-parser";const r=/^text-decoration$/i,creator=e=>{const c=Object.assign({preserve:!0},e);return{postcssPlugin:"postcss-text-decoration-shorthand",prepare(){const e=new Map;return{OnceExit:()=>{e.clear()},Declaration:a=>{if(!r.test(a.prop))return;const u=a.parent;if(!u)return;const i=u.index(a);if(u.nodes.some((o=>"decl"===o.type&&r.test(o.prop)&&e.get(a.value)===o.value&&u.index(o)!==i)))return;const d=o(a.value),p=d.nodes.filter((e=>"space"!==e.type&&"comment"!==e.type));if(p.find((e=>"var"===e.value.toLowerCase()&&"function"===e.type)))return;if(p.find((e=>"word"===e.type&&t.includes(e.value))))return;const f={line:[],style:null,color:null,thickness:null};for(let e=0;e<p.length;e++){const r=p[e];if(f.line.length||"word"!==r.type||!n.includes(r.value.toLowerCase()))if(f.line.length||"word"!==r.type||"none"!==r.value.toLowerCase())if(f.style||"word"!==r.type||!s.includes(r.value.toLowerCase()))if(f.thickness||"word"!==r.type||!l.includes(r.value.toLowerCase()))if(f.thickness||"function"!==r.type||"calc"!==r.value.toLowerCase())if(f.color||!nodeIsAColor(r)){if("word"!==r.type)return;{let e;try{e=o.unit(r.value)}catch(e){return}if(!e||!e.unit)return;f.thickness=r,"%"===e.unit&&(f.thickness={before:"",after:"",sourceIndex:0,sourceEndIndex:0,type:"function",value:"calc",nodes:[{before:"",after:"",sourceIndex:0,sourceEndIndex:0,type:"word",value:"0.01em"},{before:"",after:"",sourceIndex:0,sourceEndIndex:0,type:"space",value:" "},{before:"",after:"",sourceIndex:0,sourceEndIndex:0,type:"word",value:"*"},{before:"",after:"",sourceIndex:0,sourceEndIndex:0,type:"space",value:" "},{before:"",after:"",sourceIndex:0,sourceEndIndex:0,type:"word",value:e.number}]})}}else f.color=r;else f.thickness=r;else f.thickness=r;else f.style=r;else f.line.push(r);else{const o=r;let t=r;for(;;){const o=p[e+1];if(!o||"word"!==o.type||!n.includes(o.value.toLowerCase()))break;t=o,e++}f.line=d.nodes.slice(d.nodes.indexOf(o),d.nodes.indexOf(t)+1)}}f.line.length||f.line.push({before:"",after:"",sourceIndex:0,sourceEndIndex:0,type:"word",value:"none"}),f.style||(f.style={before:"",after:"",sourceIndex:0,sourceEndIndex:0,type:"word",value:"solid"}),f.color||(f.color={before:"",after:"",sourceIndex:0,sourceEndIndex:0,type:"word",value:"currentColor"});const v=o.stringify(f.line);if(a.value.toLowerCase()===v.toLowerCase()){const e=a.next();return void(e&&"decl"===e.type&&"text-decoration"===e.prop.toLowerCase()||a.cloneBefore({prop:"-webkit-text-decoration",value:v}))}a.cloneBefore({prop:"text-decoration",value:v});const y=o.stringify([...f.line,{before:"",after:"",sourceIndex:0,sourceEndIndex:0,type:"space",value:" "},f.style,{before:"",after:"",sourceIndex:0,sourceEndIndex:0,type:"space",value:" "},f.color]);f.thickness&&a.cloneBefore({prop:"text-decoration",value:y}),f.thickness&&a.cloneBefore({prop:"text-decoration-thickness",value:o.stringify([f.thickness])}),e.set(a.value,v),e.set(y,v),c.preserve||a.remove()}}}}};function nodeIsAColor(e){return!("word"!==e.type||!e.value.startsWith("#"))||(!("word"!==e.type||!a.includes(e.value.toLowerCase()))||!("function"!==e.type||!c.includes(e.value.toLowerCase())))}creator.postcss=!0;const t=["unset","inherit","initial","revert","revert-layer"],n=["underline","overline","line-through","blink","spelling-error","grammar-error"],s=["solid","double","dotted","dashed","wavy"],l=["auto","from-font"],c=["color","color-mix","hsl","hsla","hwb","lab","lch","oklab","oklch","rgb","rgba"],a=["currentcolor","transparent",...Object.keys(e)];export{creator as default}; diff --git a/node_modules/@csstools/postcss-text-decoration-shorthand/package.json b/node_modules/@csstools/postcss-text-decoration-shorthand/package.json new file mode 100644 index 00000000..6d1d6006 --- /dev/null +++ b/node_modules/@csstools/postcss-text-decoration-shorthand/package.json @@ -0,0 +1,89 @@ +{ + "name": "@csstools/postcss-text-decoration-shorthand", + "description": "Use text-decoration in it's shorthand form in CSS", + "version": "3.0.3", + "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/color-helpers": "^3.0.2", + "postcss-value-parser": "^4.2.0" + }, + "peerDependencies": { + "postcss": "^8.4" + }, + "devDependencies": { + "@csstools/postcss-tape": "*", + "autoprefixer": "^10.4.15" + }, + "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-text-decoration-shorthand#readme", + "repository": { + "type": "git", + "url": "https://github.com/csstools/postcss-plugins.git", + "directory": "plugins/postcss-text-decoration-shorthand" + }, + "bugs": "https://github.com/csstools/postcss-plugins/issues", + "keywords": [ + "css", + "postcss-plugin", + "shorthand", + "text-decoration", + "text-decoration-thickness" + ], + "csstools": { + "cssdbId": "text-decoration-shorthand", + "exportName": "postcssTextDecorationShorthand", + "humanReadableName": "PostCSS Text Decoration Shorthand", + "specUrl": "https://drafts.csswg.org/css-text-decor-4/#text-decoration-property" + }, + "volta": { + "extends": "../../package.json" + } +} |
