@csstools/postcss-text-decoration-shorthand 2.0.0 → 2.1.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 +8 -0
- package/dist/index.cjs +1 -1
- package/dist/index.mjs +1 -1
- package/package.json +2 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# Changes to PostCSS Text Decoration Shorthand
|
|
2
2
|
|
|
3
|
+
### 2.1.0 (January 28, 2023)
|
|
4
|
+
|
|
5
|
+
- Add: support for multiple line values (`text-decoration: overline underline;`)
|
|
6
|
+
|
|
7
|
+
### 2.0.1 (January 28, 2023)
|
|
8
|
+
|
|
9
|
+
- Improve `types` declaration in `package.json`
|
|
10
|
+
|
|
3
11
|
### 2.0.0 (January 24, 2023)
|
|
4
12
|
|
|
5
13
|
- Updated: Support for Node v14+ (major).
|
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var e=require("postcss-value-parser");const creator=
|
|
1
|
+
"use strict";var e=require("postcss-value-parser");const creator=n=>{const a=Object.assign({preserve:!1},n);return{postcssPlugin:"postcss-text-decoration-shorthand",prepare(){const n=new Map;return{OnceExit:()=>{n.clear()},Declaration:i=>{if("text-decoration"!==i.prop.toLowerCase())return;const s=i.parent.index(i);if(i.parent.nodes.some((e=>"decl"===e.type&&"text-decoration"===e.prop.toLowerCase()&&n.get(i.value)===e.value&&i.parent.index(e)!==s)))return;const u=e(i.value),d=u.nodes.filter((e=>"space"!==e.type&&"comment"!==e.type));if(d.find((e=>"var"===e.value.toLowerCase()&&"function"===e.type)))return;if(d.find((e=>"word"===e.type&&r.includes(e.value))))return;const c={line:[],style:null,color:null,thickness:null};for(let r=0;r<d.length;r++){const n=d[r];if(c.line.length||"word"!==n.type||!o.includes(n.value.toLowerCase()))if(c.line.length||"word"!==n.type||"none"!==n.value.toLowerCase())if(c.style||"word"!==n.type||!l.includes(n.value.toLowerCase()))if(c.thickness||"word"!==n.type||!t.includes(n.value.toLowerCase()))if(c.thickness||"function"!==n.type||"calc"!==n.value.toLowerCase())if(c.color||!nodeIsAColor(n)){if("word"!==n.type)return;{let r;try{r=e.unit(n.value)}catch(e){return}if(!r||!r.unit)return;c.thickness=n,"%"===r.unit&&(c.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}]})}}else c.color=n;else c.thickness=n;else c.thickness=n;else c.style=n;else c.line.push(n);else{const e=n;let l=n;for(;;){const e=d[r+1];if(!e||"word"!==e.type||!o.includes(e.value.toLowerCase()))break;l=e,r++}c.line=u.nodes.slice(u.nodes.indexOf(e),u.nodes.indexOf(l)+1)}}c.line.length||c.line.push({type:"word",value:"none"}),c.style||(c.style={type:"word",value:"solid"}),c.color||(c.color={type:"word",value:"currentColor"});const p=e.stringify(c.line);if(i.value.toLowerCase()===p.toLowerCase()){const e=i.next();return void(e&&"decl"===e.type&&"text-decoration"===e.prop.toLowerCase()||i.cloneBefore({prop:"-webkit-text-decoration",value:p}))}i.cloneBefore({prop:"text-decoration",value:p});const g=e.stringify([...c.line,{type:"space",value:" "},c.style,{type:"space",value:" "},c.color]);c.thickness&&i.cloneBefore({prop:"text-decoration",value:g}),c.thickness&&i.cloneBefore({prop:"text-decoration-thickness",value:e.stringify([c.thickness])}),n.set(i.value,p),n.set(g,p),a.preserve||i.remove()}}}}};function nodeIsAColor(e){return!("word"!==e.type||!e.value.startsWith("#"))||(!("word"!==e.type||!a.includes(e.value.toLowerCase()))||!("function"!==e.type||!n.includes(e.value.toLowerCase())))}creator.postcss=!0;const r=["unset","inherit","initial","revert","revert-layer"],o=["underline","overline","line-through","blink","spelling-error","grammar-error"],l=["solid","double","dotted","dashed","wavy"],t=["auto","from-font"],n=["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.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import e from"postcss-value-parser";const creator=
|
|
1
|
+
import e from"postcss-value-parser";const creator=n=>{const a=Object.assign({preserve:!1},n);return{postcssPlugin:"postcss-text-decoration-shorthand",prepare(){const n=new Map;return{OnceExit:()=>{n.clear()},Declaration:i=>{if("text-decoration"!==i.prop.toLowerCase())return;const s=i.parent.index(i);if(i.parent.nodes.some((e=>"decl"===e.type&&"text-decoration"===e.prop.toLowerCase()&&n.get(i.value)===e.value&&i.parent.index(e)!==s)))return;const u=e(i.value),d=u.nodes.filter((e=>"space"!==e.type&&"comment"!==e.type));if(d.find((e=>"var"===e.value.toLowerCase()&&"function"===e.type)))return;if(d.find((e=>"word"===e.type&&r.includes(e.value))))return;const c={line:[],style:null,color:null,thickness:null};for(let r=0;r<d.length;r++){const n=d[r];if(c.line.length||"word"!==n.type||!o.includes(n.value.toLowerCase()))if(c.line.length||"word"!==n.type||"none"!==n.value.toLowerCase())if(c.style||"word"!==n.type||!l.includes(n.value.toLowerCase()))if(c.thickness||"word"!==n.type||!t.includes(n.value.toLowerCase()))if(c.thickness||"function"!==n.type||"calc"!==n.value.toLowerCase())if(c.color||!nodeIsAColor(n)){if("word"!==n.type)return;{let r;try{r=e.unit(n.value)}catch(e){return}if(!r||!r.unit)return;c.thickness=n,"%"===r.unit&&(c.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}]})}}else c.color=n;else c.thickness=n;else c.thickness=n;else c.style=n;else c.line.push(n);else{const e=n;let l=n;for(;;){const e=d[r+1];if(!e||"word"!==e.type||!o.includes(e.value.toLowerCase()))break;l=e,r++}c.line=u.nodes.slice(u.nodes.indexOf(e),u.nodes.indexOf(l)+1)}}c.line.length||c.line.push({type:"word",value:"none"}),c.style||(c.style={type:"word",value:"solid"}),c.color||(c.color={type:"word",value:"currentColor"});const p=e.stringify(c.line);if(i.value.toLowerCase()===p.toLowerCase()){const e=i.next();return void(e&&"decl"===e.type&&"text-decoration"===e.prop.toLowerCase()||i.cloneBefore({prop:"-webkit-text-decoration",value:p}))}i.cloneBefore({prop:"text-decoration",value:p});const g=e.stringify([...c.line,{type:"space",value:" "},c.style,{type:"space",value:" "},c.color]);c.thickness&&i.cloneBefore({prop:"text-decoration",value:g}),c.thickness&&i.cloneBefore({prop:"text-decoration-thickness",value:e.stringify([c.thickness])}),n.set(i.value,p),n.set(g,p),a.preserve||i.remove()}}}}};function nodeIsAColor(e){return!("word"!==e.type||!e.value.startsWith("#"))||(!("word"!==e.type||!a.includes(e.value.toLowerCase()))||!("function"!==e.type||!n.includes(e.value.toLowerCase())))}creator.postcss=!0;const r=["unset","inherit","initial","revert","revert-layer"],o=["underline","overline","line-through","blink","spelling-error","grammar-error"],l=["solid","double","dotted","dashed","wavy"],t=["auto","from-font"],n=["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": "2.
|
|
4
|
+
"version": "2.1.0",
|
|
5
5
|
"contributors": [
|
|
6
6
|
{
|
|
7
7
|
"name": "Antonio Laguna",
|
|
@@ -26,6 +26,7 @@
|
|
|
26
26
|
"types": "dist/index.d.ts",
|
|
27
27
|
"exports": {
|
|
28
28
|
".": {
|
|
29
|
+
"types": "./dist/index.d.ts",
|
|
29
30
|
"import": "./dist/index.mjs",
|
|
30
31
|
"require": "./dist/index.cjs",
|
|
31
32
|
"default": "./dist/index.mjs"
|