@csstools/postcss-text-decoration-shorthand 1.0.0 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -1
- package/README.md +8 -6
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +3 -2
- package/dist/index.mjs +1 -1
- package/package.json +6 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
# Changes to PostCSS Text Decoration Shorthand
|
|
2
2
|
|
|
3
|
-
###
|
|
3
|
+
### 2.0.0 (January 24, 2023)
|
|
4
|
+
|
|
5
|
+
- Updated: Support for Node v14+ (major).
|
|
6
|
+
- Add: `-webkit-text-decoration` shorthand for single value `text-decoration: underline;`. [autoprefixer 1473](https://github.com/postcss/autoprefixer/issues/1473#issuecomment-1243370592)
|
|
7
|
+
|
|
8
|
+
### 1.0.0 (August 15, 2022)
|
|
4
9
|
|
|
5
10
|
- Initial version
|
package/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# PostCSS Text Decoration Shorthand [<img src="https://postcss.github.io/postcss/logo.svg" alt="PostCSS Logo" width="90" height="90" align="right">][
|
|
1
|
+
# PostCSS Text Decoration Shorthand [<img src="https://postcss.github.io/postcss/logo.svg" alt="PostCSS Logo" width="90" height="90" align="right">][PostCSS]
|
|
2
2
|
|
|
3
3
|
[<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]
|
|
4
4
|
|
|
@@ -40,8 +40,13 @@ postcss([
|
|
|
40
40
|
[PostCSS Text Decoration Shorthand] runs in all Node environments, with special
|
|
41
41
|
instructions for:
|
|
42
42
|
|
|
43
|
-
|
|
44
|
-
|
|
43
|
+
- [Node](INSTALL.md#node)
|
|
44
|
+
- [PostCSS CLI](INSTALL.md#postcss-cli)
|
|
45
|
+
- [PostCSS Load Config](INSTALL.md#postcss-load-config)
|
|
46
|
+
- [Webpack](INSTALL.md#webpack)
|
|
47
|
+
- [Next.js](INSTALL.md#nextjs)
|
|
48
|
+
- [Gulp](INSTALL.md#gulp)
|
|
49
|
+
- [Grunt](INSTALL.md#grunt)
|
|
45
50
|
|
|
46
51
|
## Options
|
|
47
52
|
|
|
@@ -74,9 +79,6 @@ postcssTextDecorationShorthand({ preserve: true })
|
|
|
74
79
|
[discord]: https://discord.gg/bUadyRwkJS
|
|
75
80
|
[npm-url]: https://www.npmjs.com/package/@csstools/postcss-text-decoration-shorthand
|
|
76
81
|
|
|
77
|
-
[Gulp PostCSS]: https://github.com/postcss/gulp-postcss
|
|
78
|
-
[Grunt PostCSS]: https://github.com/nDmitry/grunt-postcss
|
|
79
82
|
[PostCSS]: https://github.com/postcss/postcss
|
|
80
|
-
[PostCSS Loader]: https://github.com/postcss/postcss-loader
|
|
81
83
|
[PostCSS Text Decoration Shorthand]: https://github.com/csstools/postcss-plugins/tree/main/plugins/postcss-text-decoration-shorthand
|
|
82
84
|
[Text Decoration Specification]: https://drafts.csswg.org/css-text-decor-4/#text-decoration-property
|
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";
|
|
1
|
+
"use strict";var e=require("postcss-value-parser");const creator=t=>{const a=Object.assign({preserve:!1},t);return{postcssPlugin:"postcss-text-decoration-shorthand",prepare(){const t=new Map;return{OnceExit:()=>{t.clear()},Declaration:n=>{if("text-decoration"!==n.prop.toLowerCase())return;const i=n.parent.index(n);if(n.parent.nodes.some((e=>"decl"===e.type&&"text-decoration"===e.prop.toLowerCase()&&t.get(n.value)===e.value&&n.parent.index(e)!==i)))return;const s=e(n.value).nodes.filter((e=>"space"!==e.type&&"comment"!==e.type));if(s.length>4)return;if(s.find((e=>"var"===e.value.toLowerCase()&&"function"===e.type)))return;if(s.find((e=>"word"===e.type&&r.includes(e.value))))return;const u={line:null,style:null,color:null,thickness:null};for(let e=0;e<s.length;e++){const r=s[e];"word"===r.type&&l.includes(r.value.toLowerCase())?u.line=r:"word"===r.type&&o.includes(r.value.toLowerCase())?u.style=r:nodeIsAColor(r)?u.color=r:"word"!==r.type||"none"!==r.value.toLowerCase()?u.thickness=r:(u.color||(u.color=r),u.line||(u.line=r))}u.line||(u.line={type:"word",value:"none"}),u.style||(u.style={type:"word",value:"solid"}),u.color||(u.color={type:"word",value:"currentColor"});try{const r=e.unit(u.thickness.value);r&&"%"===r.unit&&(u.thickness={type:"function",value:"calc",nodes:[{type:"word",value:"0.01em"},{type:"space",value:" "},{type:"word",value:"*"},{type:"space",value:" "},{type:"word",value:r.number}]})}catch(e){}const d=e.stringify(u.line);if(n.value.toLowerCase()===d){const e=n.next();return void(e&&"decl"===e.type&&"text-decoration"===e.prop.toLowerCase()||n.cloneBefore({prop:"-webkit-text-decoration",value:d}))}n.cloneBefore({prop:"text-decoration",value:d});const c=e.stringify([u.line,{type:"space",value:" "},u.style,{type:"space",value:" "},u.color]);(u.thickness||3!==s.length)&&n.cloneBefore({prop:"text-decoration",value:c}),u.thickness&&n.cloneBefore({prop:"text-decoration-thickness",value:e.stringify([u.thickness])}),t.set(n.value,d),t.set(c,d),a.preserve||n.remove()}}}}};function nodeIsAColor(e){return!("word"!==e.type||!e.value.startsWith("#"))||(!("word"!==e.type||!a.includes(e.value.toLowerCase()))||!("function"!==e.type||!t.includes(e.value.toLowerCase())))}creator.postcss=!0;const r=["unset","inherit","initial","revert","revert-layer"],l=["underline","overline","line-through","blink","spelling-error","grammar-error"],o=["solid","double","dotted","dashed","wavy"],t=["rgb","rgba","hsl","hsla","hwb","lch","lab","color","oklch","oklab"],a=["currentcolor","aliceblue","antiquewhite","aqua","aquamarine","azure","beige","bisque","black","blanchedalmond","blue","blueviolet","brown","burlywood","cadetblue","chartreuse","chocolate","coral","cornflowerblue","cornsilk","crimson","cyan","darkblue","darkcyan","darkgoldenrod","darkgray","darkgreen","darkgrey","darkkhaki","darkmagenta","darkolivegreen","darkorange","darkorchid","darkred","darksalmon","darkseagreen","darkslateblue","darkslategray","darkslategrey","darkturquoise","darkviolet","deeppink","deepskyblue","dimgray","dimgrey","dodgerblue","firebrick","floralwhite","forestgreen","fuchsia","gainsboro","ghostwhite","gold","goldenrod","gray","green","greenyellow","grey","honeydew","hotpink","indianred","indigo","ivory","khaki","lavender","lavenderblush","lawngreen","lemonchiffon","lightblue","lightcoral","lightcyan","lightgoldenrodyellow","lightgray","lightgreen","lightgrey","lightpink","lightsalmon","lightseagreen","lightskyblue","lightslategray","lightslategrey","lightsteelblue","lightyellow","lime","limegreen","linen","magenta","maroon","mediumaquamarine","mediumblue","mediumorchid","mediumpurple","mediumseagreen","mediumslateblue","mediumspringgreen","mediumturquoise","mediumvioletred","midnightblue","mintcream","mistyrose","moccasin","navajowhite","navy","oldlace","olive","olivedrab","orange","orangered","orchid","palegoldenrod","palegreen","paleturquoise","palevioletred","papayawhip","peachpuff","peru","pink","plum","powderblue","purple","rebeccapurple","red","rosybrown","royalblue","saddlebrown","salmon","sandybrown","seagreen","seashell","sienna","silver","skyblue","slateblue","slategray","slategrey","snow","springgreen","steelblue","tan","teal","thistle","tomato","turquoise","violet","wheat","white","whitesmoke","yellow","yellowgreen"];module.exports=creator;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { PluginCreator } from 'postcss';
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
/** postcss-text-decoration-shorthand plugin options */
|
|
3
|
+
export type pluginOptions = {
|
|
4
|
+
/** Preserve the original notation. default: false */
|
|
4
5
|
preserve?: boolean;
|
|
5
6
|
};
|
|
6
7
|
declare const creator: PluginCreator<pluginOptions>;
|
package/dist/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import e from"postcss-value-parser";const
|
|
1
|
+
import e from"postcss-value-parser";const creator=t=>{const a=Object.assign({preserve:!1},t);return{postcssPlugin:"postcss-text-decoration-shorthand",prepare(){const t=new Map;return{OnceExit:()=>{t.clear()},Declaration:n=>{if("text-decoration"!==n.prop.toLowerCase())return;const i=n.parent.index(n);if(n.parent.nodes.some((e=>"decl"===e.type&&"text-decoration"===e.prop.toLowerCase()&&t.get(n.value)===e.value&&n.parent.index(e)!==i)))return;const s=e(n.value).nodes.filter((e=>"space"!==e.type&&"comment"!==e.type));if(s.length>4)return;if(s.find((e=>"var"===e.value.toLowerCase()&&"function"===e.type)))return;if(s.find((e=>"word"===e.type&&r.includes(e.value))))return;const u={line:null,style:null,color:null,thickness:null};for(let e=0;e<s.length;e++){const r=s[e];"word"===r.type&&l.includes(r.value.toLowerCase())?u.line=r:"word"===r.type&&o.includes(r.value.toLowerCase())?u.style=r:nodeIsAColor(r)?u.color=r:"word"!==r.type||"none"!==r.value.toLowerCase()?u.thickness=r:(u.color||(u.color=r),u.line||(u.line=r))}u.line||(u.line={type:"word",value:"none"}),u.style||(u.style={type:"word",value:"solid"}),u.color||(u.color={type:"word",value:"currentColor"});try{const r=e.unit(u.thickness.value);r&&"%"===r.unit&&(u.thickness={type:"function",value:"calc",nodes:[{type:"word",value:"0.01em"},{type:"space",value:" "},{type:"word",value:"*"},{type:"space",value:" "},{type:"word",value:r.number}]})}catch(e){}const d=e.stringify(u.line);if(n.value.toLowerCase()===d){const e=n.next();return void(e&&"decl"===e.type&&"text-decoration"===e.prop.toLowerCase()||n.cloneBefore({prop:"-webkit-text-decoration",value:d}))}n.cloneBefore({prop:"text-decoration",value:d});const c=e.stringify([u.line,{type:"space",value:" "},u.style,{type:"space",value:" "},u.color]);(u.thickness||3!==s.length)&&n.cloneBefore({prop:"text-decoration",value:c}),u.thickness&&n.cloneBefore({prop:"text-decoration-thickness",value:e.stringify([u.thickness])}),t.set(n.value,d),t.set(c,d),a.preserve||n.remove()}}}}};function nodeIsAColor(e){return!("word"!==e.type||!e.value.startsWith("#"))||(!("word"!==e.type||!a.includes(e.value.toLowerCase()))||!("function"!==e.type||!t.includes(e.value.toLowerCase())))}creator.postcss=!0;const r=["unset","inherit","initial","revert","revert-layer"],l=["underline","overline","line-through","blink","spelling-error","grammar-error"],o=["solid","double","dotted","dashed","wavy"],t=["rgb","rgba","hsl","hsla","hwb","lch","lab","color","oklch","oklab"],a=["currentcolor","aliceblue","antiquewhite","aqua","aquamarine","azure","beige","bisque","black","blanchedalmond","blue","blueviolet","brown","burlywood","cadetblue","chartreuse","chocolate","coral","cornflowerblue","cornsilk","crimson","cyan","darkblue","darkcyan","darkgoldenrod","darkgray","darkgreen","darkgrey","darkkhaki","darkmagenta","darkolivegreen","darkorange","darkorchid","darkred","darksalmon","darkseagreen","darkslateblue","darkslategray","darkslategrey","darkturquoise","darkviolet","deeppink","deepskyblue","dimgray","dimgrey","dodgerblue","firebrick","floralwhite","forestgreen","fuchsia","gainsboro","ghostwhite","gold","goldenrod","gray","green","greenyellow","grey","honeydew","hotpink","indianred","indigo","ivory","khaki","lavender","lavenderblush","lawngreen","lemonchiffon","lightblue","lightcoral","lightcyan","lightgoldenrodyellow","lightgray","lightgreen","lightgrey","lightpink","lightsalmon","lightseagreen","lightskyblue","lightslategray","lightslategrey","lightsteelblue","lightyellow","lime","limegreen","linen","magenta","maroon","mediumaquamarine","mediumblue","mediumorchid","mediumpurple","mediumseagreen","mediumslateblue","mediumspringgreen","mediumturquoise","mediumvioletred","midnightblue","mintcream","mistyrose","moccasin","navajowhite","navy","oldlace","olive","olivedrab","orange","orangered","orchid","palegoldenrod","palegreen","paleturquoise","palevioletred","papayawhip","peachpuff","peru","pink","plum","powderblue","purple","rebeccapurple","red","rosybrown","royalblue","saddlebrown","salmon","sandybrown","seagreen","seashell","sienna","silver","skyblue","slateblue","slategray","slategrey","snow","springgreen","steelblue","tan","teal","thistle","tomato","turquoise","violet","wheat","white","whitesmoke","yellow","yellowgreen"];export{creator as default};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@csstools/postcss-text-decoration-shorthand",
|
|
3
3
|
"description": "Use text-decoration in it's shorthand form in CSS",
|
|
4
|
-
"version": "
|
|
4
|
+
"version": "2.0.0",
|
|
5
5
|
"contributors": [
|
|
6
6
|
{
|
|
7
7
|
"name": "Antonio Laguna",
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
"url": "https://opencollective.com/csstools"
|
|
20
20
|
},
|
|
21
21
|
"engines": {
|
|
22
|
-
"node": "^
|
|
22
|
+
"node": "^14 || ^16 || >=18"
|
|
23
23
|
},
|
|
24
24
|
"main": "dist/index.cjs",
|
|
25
25
|
"module": "dist/index.mjs",
|
|
@@ -41,14 +41,15 @@
|
|
|
41
41
|
"postcss-value-parser": "^4.2.0"
|
|
42
42
|
},
|
|
43
43
|
"peerDependencies": {
|
|
44
|
-
"postcss": "^8.
|
|
44
|
+
"postcss": "^8.4"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
47
|
"autoprefixer": "^10.4.8"
|
|
48
48
|
},
|
|
49
49
|
"scripts": {
|
|
50
|
-
"
|
|
51
|
-
"
|
|
50
|
+
"prebuild": "npm run clean",
|
|
51
|
+
"build": "rollup -c ../../rollup/default.mjs",
|
|
52
|
+
"clean": "node -e \"fs.rmSync('./dist', { recursive: true, force: true }); fs.mkdirSync('./dist');\"",
|
|
52
53
|
"docs": "node ../../.github/bin/generate-docs/install.mjs && node ../../.github/bin/generate-docs/readme.mjs",
|
|
53
54
|
"lint": "npm run lint:eslint && npm run lint:package-json",
|
|
54
55
|
"lint:eslint": "eslint ./src --ext .js --ext .ts --ext .mjs --no-error-on-unmatched-pattern",
|