summaryrefslogtreecommitdiff
path: root/node_modules/postcss-lab-function/dist
diff options
context:
space:
mode:
authorlittleblack111 <littleblack11111@gmail.com>2024-01-04 11:07:54 +0800
committerlittleblack111 <littleblack11111@gmail.com>2024-01-04 11:07:54 +0800
commit275f9dc0bdf3e58aa36b800f55f8648fbc55d8af (patch)
tree81c7cf120fb703cfd5e3162f2366033d9fe5c7f8 /node_modules/postcss-lab-function/dist
parent2b4ab36917baef56c7ce1602966f941be15af785 (diff)
upgrade
Diffstat (limited to 'node_modules/postcss-lab-function/dist')
-rw-r--r--node_modules/postcss-lab-function/dist/index.cjs2
-rw-r--r--node_modules/postcss-lab-function/dist/index.mjs2
2 files changed, 2 insertions, 2 deletions
diff --git a/node_modules/postcss-lab-function/dist/index.cjs b/node_modules/postcss-lab-function/dist/index.cjs
index 3693b63e..df5bd239 100644
--- a/node_modules/postcss-lab-function/dist/index.cjs
+++ b/node_modules/postcss-lab-function/dist/index.cjs
@@ -1 +1 @@
-"use strict";var e=require("@csstools/postcss-progressive-custom-properties"),s=require("@csstools/css-tokenizer"),r=require("@csstools/css-color-parser"),t=require("@csstools/css-parser-algorithms");function hasFallback(e){const s=e.parent;if(!s)return!1;const r=e.prop.toLowerCase(),t=s.index(e);for(let e=0;e<t;e++){const t=s.nodes[e];if("decl"===t.type&&t.prop.toLowerCase()===r)return!0}return!1}function hasSupportsAtRuleAncestor(e){let s=e.parent;for(;s;)if("atrule"===s.type){if("supports"===s.name.toLowerCase()){if(-1!==s.params.toLowerCase().indexOf("lab("))return!0;if(-1!==s.params.toLowerCase().indexOf("lch("))return!0}s=s.parent}else s=s.parent;return!1}const a=/(lab|lch)\(/i,o=/^(lab|lch)$/i,basePlugin=e=>({postcssPlugin:"postcss-lab-function",Declaration:n=>{const i=n.value;if(!a.test(i))return;if(hasFallback(n))return;if(hasSupportsAtRuleAncestor(n))return;const l=s.tokenize({css:i}),u=t.replaceComponentValues(t.parseCommaSeparatedListOfComponentValues(l),(e=>{if(t.isFunctionNode(e)&&o.test(e.getName())){const s=r.color(e);if(!s)return;if(s.syntaxFlags.has(r.SyntaxFlag.Experimental))return;if(s.syntaxFlags.has(r.SyntaxFlag.HasNoneKeywords))return;if(s.syntaxFlags.has(r.SyntaxFlag.RelativeColorSyntax))return;return r.serializeRGB(s)}})),p=t.stringify(u);if(p===i)return;let c=p;e?.subFeatures.displayP3&&(c=t.stringify(t.replaceComponentValues(t.parseCommaSeparatedListOfComponentValues(l),(e=>{if(t.isFunctionNode(e)&&o.test(e.getName())){const s=r.color(e);if(!s)return;if(s.syntaxFlags.has(r.SyntaxFlag.HasNoneKeywords))return;if(s.syntaxFlags.has(r.SyntaxFlag.RelativeColorSyntax))return;return r.colorDataFitsRGB_Gamut(s)?r.serializeRGB(s):r.serializeP3(s)}})))),n.cloneBefore({value:p}),e?.subFeatures.displayP3&&c!==p&&n.cloneBefore({value:c}),e?.preserve||n.remove()}});basePlugin.postcss=!0;const postcssPlugin=s=>{const r=Object.assign({enableProgressiveCustomProperties:!0,preserve:!1,subFeatures:{displayP3:!0}},s);return r.subFeatures=Object.assign({displayP3:!0},r.subFeatures),r.enableProgressiveCustomProperties&&(r.preserve||r.subFeatures.displayP3)?{postcssPlugin:"postcss-lab-function",plugins:[e(),basePlugin(r)]}:basePlugin(r)};postcssPlugin.postcss=!0,module.exports=postcssPlugin;
+"use strict";var e=require("@csstools/postcss-progressive-custom-properties"),s=require("@csstools/css-tokenizer"),t=require("@csstools/css-color-parser"),r=require("@csstools/css-parser-algorithms");function hasFallback(e){const s=e.parent;if(!s)return!1;const t=e.prop.toLowerCase(),r=s.index(e);for(let e=0;e<r;e++){const r=s.nodes[e];if("decl"===r.type&&r.prop.toLowerCase()===t)return!0}return!1}function hasSupportsAtRuleAncestor(e){let s=e.parent;for(;s;)if("atrule"===s.type){if("supports"===s.name.toLowerCase()){if(-1!==s.params.toLowerCase().indexOf("lab("))return!0;if(-1!==s.params.toLowerCase().indexOf("lch("))return!0}s=s.parent}else s=s.parent;return!1}const a=/(lab|lch)\(/i,o=/^(lab|lch)$/i,basePlugin=e=>({postcssPlugin:"postcss-lab-function",Declaration:n=>{const l=n.value;if(!a.test(l))return;if(hasFallback(n))return;if(hasSupportsAtRuleAncestor(n))return;const i=s.tokenize({css:l}),u=r.replaceComponentValues(r.parseCommaSeparatedListOfComponentValues(i),(e=>{if(!r.isFunctionNode(e)||!o.test(e.getName()))return;const s=t.color(e);return s&&!(s.syntaxFlags.has(t.SyntaxFlag.Experimental)||s.syntaxFlags.has(t.SyntaxFlag.HasNoneKeywords)||s.syntaxFlags.has(t.SyntaxFlag.RelativeColorSyntax))?t.serializeRGB(s):void 0})),p=r.stringify(u);if(p===l)return;let c=p;e?.subFeatures.displayP3&&(c=r.stringify(r.replaceComponentValues(r.parseCommaSeparatedListOfComponentValues(i),(e=>{if(!r.isFunctionNode(e)||!o.test(e.getName()))return;const s=t.color(e);return s&&!(s.syntaxFlags.has(t.SyntaxFlag.Experimental)||s.syntaxFlags.has(t.SyntaxFlag.HasNoneKeywords)||s.syntaxFlags.has(t.SyntaxFlag.RelativeColorSyntax))?t.colorDataFitsRGB_Gamut(s)?t.serializeRGB(s):t.serializeP3(s):void 0})))),n.cloneBefore({value:p}),e?.subFeatures.displayP3&&c!==p&&n.cloneBefore({value:c}),e?.preserve||n.remove()}});basePlugin.postcss=!0;const postcssPlugin=s=>{const t=Object.assign({enableProgressiveCustomProperties:!0,preserve:!1,subFeatures:{displayP3:!0}},s);return t.subFeatures=Object.assign({displayP3:!0},t.subFeatures),t.enableProgressiveCustomProperties&&(t.preserve||t.subFeatures.displayP3)?{postcssPlugin:"postcss-lab-function",plugins:[e(),basePlugin(t)]}:basePlugin(t)};postcssPlugin.postcss=!0,module.exports=postcssPlugin;
diff --git a/node_modules/postcss-lab-function/dist/index.mjs b/node_modules/postcss-lab-function/dist/index.mjs
index b5b9e2df..7cb9ea59 100644
--- a/node_modules/postcss-lab-function/dist/index.mjs
+++ b/node_modules/postcss-lab-function/dist/index.mjs
@@ -1 +1 @@
-import s from"@csstools/postcss-progressive-custom-properties";import{tokenize as e}from"@csstools/css-tokenizer";import{color as r,SyntaxFlag as t,serializeRGB as o,colorDataFitsRGB_Gamut as a,serializeP3 as n}from"@csstools/css-color-parser";import{replaceComponentValues as i,parseCommaSeparatedListOfComponentValues as l,isFunctionNode as u,stringify as p}from"@csstools/css-parser-algorithms";function hasFallback(s){const e=s.parent;if(!e)return!1;const r=s.prop.toLowerCase(),t=e.index(s);for(let s=0;s<t;s++){const t=e.nodes[s];if("decl"===t.type&&t.prop.toLowerCase()===r)return!0}return!1}function hasSupportsAtRuleAncestor(s){let e=s.parent;for(;e;)if("atrule"===e.type){if("supports"===e.name.toLowerCase()){if(-1!==e.params.toLowerCase().indexOf("lab("))return!0;if(-1!==e.params.toLowerCase().indexOf("lch("))return!0}e=e.parent}else e=e.parent;return!1}const c=/(lab|lch)\(/i,f=/^(lab|lch)$/i,basePlugin=s=>({postcssPlugin:"postcss-lab-function",Declaration:m=>{const b=m.value;if(!c.test(b))return;if(hasFallback(m))return;if(hasSupportsAtRuleAncestor(m))return;const g=e({css:b}),y=i(l(g),(s=>{if(u(s)&&f.test(s.getName())){const e=r(s);if(!e)return;if(e.syntaxFlags.has(t.Experimental))return;if(e.syntaxFlags.has(t.HasNoneKeywords))return;if(e.syntaxFlags.has(t.RelativeColorSyntax))return;return o(e)}})),d=p(y);if(d===b)return;let h=d;s?.subFeatures.displayP3&&(h=p(i(l(g),(s=>{if(u(s)&&f.test(s.getName())){const e=r(s);if(!e)return;if(e.syntaxFlags.has(t.HasNoneKeywords))return;if(e.syntaxFlags.has(t.RelativeColorSyntax))return;return a(e)?o(e):n(e)}})))),m.cloneBefore({value:d}),s?.subFeatures.displayP3&&h!==d&&m.cloneBefore({value:h}),s?.preserve||m.remove()}});basePlugin.postcss=!0;const postcssPlugin=e=>{const r=Object.assign({enableProgressiveCustomProperties:!0,preserve:!1,subFeatures:{displayP3:!0}},e);return r.subFeatures=Object.assign({displayP3:!0},r.subFeatures),r.enableProgressiveCustomProperties&&(r.preserve||r.subFeatures.displayP3)?{postcssPlugin:"postcss-lab-function",plugins:[s(),basePlugin(r)]}:basePlugin(r)};postcssPlugin.postcss=!0;export{postcssPlugin as default};
+import s from"@csstools/postcss-progressive-custom-properties";import{tokenize as e}from"@csstools/css-tokenizer";import{color as t,SyntaxFlag as r,serializeRGB as o,colorDataFitsRGB_Gamut as a,serializeP3 as n}from"@csstools/css-color-parser";import{replaceComponentValues as l,parseCommaSeparatedListOfComponentValues as i,isFunctionNode as p,stringify as u}from"@csstools/css-parser-algorithms";function hasFallback(s){const e=s.parent;if(!e)return!1;const t=s.prop.toLowerCase(),r=e.index(s);for(let s=0;s<r;s++){const r=e.nodes[s];if("decl"===r.type&&r.prop.toLowerCase()===t)return!0}return!1}function hasSupportsAtRuleAncestor(s){let e=s.parent;for(;e;)if("atrule"===e.type){if("supports"===e.name.toLowerCase()){if(-1!==e.params.toLowerCase().indexOf("lab("))return!0;if(-1!==e.params.toLowerCase().indexOf("lch("))return!0}e=e.parent}else e=e.parent;return!1}const c=/(lab|lch)\(/i,f=/^(lab|lch)$/i,basePlugin=s=>({postcssPlugin:"postcss-lab-function",Declaration:m=>{const b=m.value;if(!c.test(b))return;if(hasFallback(m))return;if(hasSupportsAtRuleAncestor(m))return;const g=e({css:b}),y=l(i(g),(s=>{if(!p(s)||!f.test(s.getName()))return;const e=t(s);return e&&!(e.syntaxFlags.has(r.Experimental)||e.syntaxFlags.has(r.HasNoneKeywords)||e.syntaxFlags.has(r.RelativeColorSyntax))?o(e):void 0})),d=u(y);if(d===b)return;let h=d;s?.subFeatures.displayP3&&(h=u(l(i(g),(s=>{if(!p(s)||!f.test(s.getName()))return;const e=t(s);return e&&!(e.syntaxFlags.has(r.Experimental)||e.syntaxFlags.has(r.HasNoneKeywords)||e.syntaxFlags.has(r.RelativeColorSyntax))?a(e)?o(e):n(e):void 0})))),m.cloneBefore({value:d}),s?.subFeatures.displayP3&&h!==d&&m.cloneBefore({value:h}),s?.preserve||m.remove()}});basePlugin.postcss=!0;const postcssPlugin=e=>{const t=Object.assign({enableProgressiveCustomProperties:!0,preserve:!1,subFeatures:{displayP3:!0}},e);return t.subFeatures=Object.assign({displayP3:!0},t.subFeatures),t.enableProgressiveCustomProperties&&(t.preserve||t.subFeatures.displayP3)?{postcssPlugin:"postcss-lab-function",plugins:[s(),basePlugin(t)]}:basePlugin(t)};postcssPlugin.postcss=!0;export{postcssPlugin as default};