summaryrefslogtreecommitdiff
path: root/node_modules/@csstools/postcss-logical-viewport-units/dist/index.mjs
diff options
context:
space:
mode:
authorlittleblack111 <littleblack11111@gmail.com>2024-05-14 14:05:49 +0800
committerlittleblack111 <littleblack11111@gmail.com>2024-05-14 14:05:49 +0800
commit06823fbf1c2e763a5bf76c3990ca98fbbcd98691 (patch)
tree4280bece3888d12a022093bf1a9cd1b049393602 /node_modules/@csstools/postcss-logical-viewport-units/dist/index.mjs
parent1368909b3cd552dbb0d12d5863c597f5be46177d (diff)
updated node_modules
Diffstat (limited to 'node_modules/@csstools/postcss-logical-viewport-units/dist/index.mjs')
-rw-r--r--node_modules/@csstools/postcss-logical-viewport-units/dist/index.mjs2
1 files changed, 1 insertions, 1 deletions
diff --git a/node_modules/@csstools/postcss-logical-viewport-units/dist/index.mjs b/node_modules/@csstools/postcss-logical-viewport-units/dist/index.mjs
index 0d970cf1..3c50fd65 100644
--- a/node_modules/@csstools/postcss-logical-viewport-units/dist/index.mjs
+++ b/node_modules/@csstools/postcss-logical-viewport-units/dist/index.mjs
@@ -1 +1 @@
-import{tokenizer as t,TokenType as e,stringify as o}from"@csstools/css-tokenizer";function hasFeature(o){{const t=o.toLowerCase();if(!t.includes("vb")&&!t.includes("vi"))return!1}const r=t({css:o});for(;;){const t=r.nextToken();if(!t)break;if(t[0]===e.EOF)break;if(t[0]!==e.Dimension)continue;const o=t[4].unit.toLowerCase();if("vb"===o||"vi"===o)return!0}return!1}function hasSupportsAtRuleAncestor(t){let e=t.parent;for(;e;)if("atrule"===e.type){if("supports"===e.name.toLowerCase()&&hasFeature(e.params))return!0;e=e.parent}else e=e.parent;return!1}var r;function transform(r,n){const i=t({css:r}),s=[];let a=!1;for(;;){const t=i.nextToken();if(!t)break;if(s.push(t),t[0]===e.EOF)break;if(t[0]!==e.Dimension)continue;const o=t[4].unit.toLowerCase();let r;"vi"===o?r=n.vi:"vb"===o&&(r=n.vb),r&&(t[1]=t[4].value.toString()+r,t[4].unit=r,a=!0)}return a?o(...s):r}!function(t){t.TopToBottom="top-to-bottom",t.BottomToTop="bottom-to-top",t.RightToLeft="right-to-left",t.LeftToRight="left-to-right"}(r||(r={}));const n=/(?:vi|vb)\b/i,creator=t=>{const e=Object.assign({inlineDirection:r.LeftToRight,preserve:!0},t);switch(e.inlineDirection){case r.LeftToRight:case r.RightToLeft:case r.TopToBottom:case r.BottomToTop:break;default:throw new Error(`[postcss-logical-viewport-units] "inlineDirection" must be one of ${Object.values(r).join(", ")}`)}const o=[r.LeftToRight,r.RightToLeft].includes(e.inlineDirection),i={vb:"vh",vi:"vw"};return o||(i.vb="vw",i.vi="vh"),{postcssPlugin:"postcss-logical-viewport-units",Declaration(t,{atRule:o}){{if(!n.test(t.value))return;const e=t.prev();if(e&&"decl"===e.type&&e.prop===t.prop)return;if(hasSupportsAtRuleAncestor(t))return}const r=transform(t.value,i);if(r===t.value)return;if(t.cloneBefore({value:r}),!e.preserve)return void t.remove();if(!t.variable)return;const s=o({name:"supports",params:"(top: 1vi)",source:t.source}),a=t.parent;if(!a)return;const c=a.cloneAfter({nodes:[]});c.append(t),s.append(c),a.after(s)}}};creator.postcss=!0;export{creator as default};
+import{hasFallback as t,hasSupportsAtRuleAncestor as o}from"@csstools/utilities";import{tokenizer as e,isTokenEOF as i,isTokenDimension as n,stringify as r}from"@csstools/css-tokenizer";var s;function transform(t,o){const s=e({css:t}),c=[];let u=!1;for(;;){const t=s.nextToken();if(!t)break;if(c.push(t),i(t))break;if(!n(t))continue;const e=t[4].unit.toLowerCase();let r;"vi"===e?r=o.vi:"vb"===e&&(r=o.vb),r&&(t[1]=t[4].value.toString()+r,t[4].unit=r,u=!0)}return u?r(...c):t}!function(t){t.TopToBottom="top-to-bottom",t.BottomToTop="bottom-to-top",t.RightToLeft="right-to-left",t.LeftToRight="left-to-right"}(s||(s={}));const c={test(t){{const o=t.toLowerCase();if(!o.includes("vb")&&!o.includes("vi"))return!1}const o=e({css:t});for(;;){const t=o.nextToken();if(!t)break;if(i(t))break;if(!n(t))continue;const e=t[4].unit.toLowerCase();if("vb"===e||"vi"===e)return!0}return!1}},u=/(?:vi|vb)\b/i,creator=e=>{const i=Object.assign({inlineDirection:s.LeftToRight,preserve:!0},e);switch(i.inlineDirection){case s.LeftToRight:case s.RightToLeft:case s.TopToBottom:case s.BottomToTop:break;default:throw new Error(`[postcss-logical-viewport-units] "inlineDirection" must be one of ${Object.values(s).join(", ")}`)}const n=[s.LeftToRight,s.RightToLeft].includes(i.inlineDirection),r={vb:"vh",vi:"vw"};return n||(r.vb="vw",r.vi="vh"),{postcssPlugin:"postcss-logical-viewport-units",Declaration(e,{atRule:n}){if(!u.test(e.value))return;if(t(e))return;if(o(e,c))return;const s=transform(e.value,r);if(s===e.value)return;if(e.cloneBefore({value:s}),!i.preserve)return void e.remove();if(!e.variable)return;const a=n({name:"supports",params:"(top: 1vi)",source:e.source}),f=e.parent;if(!f)return;const v=f.cloneAfter({nodes:[]});v.append(e),a.append(v),f.after(a)}}};creator.postcss=!0;export{creator as default};