diff options
Diffstat (limited to 'node_modules/@csstools/postcss-nested-calc/dist')
| -rw-r--r-- | node_modules/@csstools/postcss-nested-calc/dist/index.cjs | 2 | ||||
| -rw-r--r-- | node_modules/@csstools/postcss-nested-calc/dist/index.mjs | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/node_modules/@csstools/postcss-nested-calc/dist/index.cjs b/node_modules/@csstools/postcss-nested-calc/dist/index.cjs index a52f3cd7..27ae530a 100644 --- a/node_modules/@csstools/postcss-nested-calc/dist/index.cjs +++ b/node_modules/@csstools/postcss-nested-calc/dist/index.cjs @@ -1 +1 @@ -"use strict";var e=require("postcss-value-parser");const t=/calc\(/gim;function hasFallback(e){const t=e.parent;if(!t)return!1;const r=t.index(e);for(let a=0;a<r;a++){const r=t.nodes[a];if("decl"===r.type&&r.prop.toLowerCase()===e.prop.toLowerCase())return!0}return!1}const creator=r=>{const a=Object.assign({preserve:!0},r);return{postcssPlugin:"postcss-nested-calc",Declaration(r,{result:n}){if((r.value.match(t)||[]).length<2)return;if(r.variable)return;if(hasFallback(r))return;const o=r.value;let s;try{s=e(o)}catch(e){return void r.warn(n,`Failed to parse value '${o}'. Leaving the original value intact.`)}if(void 0===s)return;e.walk(s.nodes,(t=>{t.type&&"function"===t.type&&"calc"===t.value.toLowerCase()&&e.walk(t.nodes,(e=>{if(e.type&&"function"===e.type)return"calc"===e.value.toLowerCase()&&void(e.value="")}))}),!0);const c=String(s);c!==o&&(r.cloneBefore({value:c}),a.preserve||r.remove())}}};creator.postcss=!0,module.exports=creator; +"use strict";var e=require("postcss-value-parser"),t=require("@csstools/utilities");const r=/calc\(/gim;const creator=s=>{const a=Object.assign({preserve:!0},s);return{postcssPlugin:"postcss-nested-calc",Declaration(s,{result:o}){if((s.value.match(r)||[]).length<2)return;if(s.variable)return;if(t.hasFallback(s))return;const c=s.value;let l;try{l=e(c)}catch(e){return void s.warn(o,`Failed to parse value '${c}'. Leaving the original value intact.`)}if(void 0===l)return;e.walk(l.nodes,(t=>{t.type&&"function"===t.type&&"calc"===t.value.toLowerCase()&&e.walk(t.nodes,(e=>{if(e.type&&"function"===e.type)return"calc"===e.value.toLowerCase()&&void(e.value="")}))}),!0);const n=String(l);n!==c&&(s.cloneBefore({value:n}),a.preserve||s.remove())}}};creator.postcss=!0,module.exports=creator; diff --git a/node_modules/@csstools/postcss-nested-calc/dist/index.mjs b/node_modules/@csstools/postcss-nested-calc/dist/index.mjs index 41363381..5ef02cad 100644 --- a/node_modules/@csstools/postcss-nested-calc/dist/index.mjs +++ b/node_modules/@csstools/postcss-nested-calc/dist/index.mjs @@ -1 +1 @@ -import e from"postcss-value-parser";const t=/calc\(/gim;function hasFallback(e){const t=e.parent;if(!t)return!1;const r=t.index(e);for(let a=0;a<r;a++){const r=t.nodes[a];if("decl"===r.type&&r.prop.toLowerCase()===e.prop.toLowerCase())return!0}return!1}const creator=r=>{const a=Object.assign({preserve:!0},r);return{postcssPlugin:"postcss-nested-calc",Declaration(r,{result:o}){if((r.value.match(t)||[]).length<2)return;if(r.variable)return;if(hasFallback(r))return;const n=r.value;let s;try{s=e(n)}catch(e){return void r.warn(o,`Failed to parse value '${n}'. Leaving the original value intact.`)}if(void 0===s)return;e.walk(s.nodes,(t=>{t.type&&"function"===t.type&&"calc"===t.value.toLowerCase()&&e.walk(t.nodes,(e=>{if(e.type&&"function"===e.type)return"calc"===e.value.toLowerCase()&&void(e.value="")}))}),!0);const c=String(s);c!==n&&(r.cloneBefore({value:c}),a.preserve||r.remove())}}};creator.postcss=!0;export{creator as default}; +import e from"postcss-value-parser";import{hasFallback as t}from"@csstools/utilities";const r=/calc\(/gim;const creator=s=>{const a=Object.assign({preserve:!0},s);return{postcssPlugin:"postcss-nested-calc",Declaration(s,{result:o}){if((s.value.match(r)||[]).length<2)return;if(s.variable)return;if(t(s))return;const n=s.value;let c;try{c=e(n)}catch(e){return void s.warn(o,`Failed to parse value '${n}'. Leaving the original value intact.`)}if(void 0===c)return;e.walk(c.nodes,(t=>{t.type&&"function"===t.type&&"calc"===t.value.toLowerCase()&&e.walk(t.nodes,(e=>{if(e.type&&"function"===e.type)return"calc"===e.value.toLowerCase()&&void(e.value="")}))}),!0);const l=String(c);l!==n&&(s.cloneBefore({value:l}),a.preserve||s.remove())}}};creator.postcss=!0;export{creator as default}; |
