You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

1 lines
1.2 KiB

import e from"postcss-value-parser";var l=new Map([["block,flow","block"],["block,flow-root","flow-root"],["inline,flow","inline"],["inline,flow-root","inline-block"],["run-in,flow","run-in"],["list-item,block,flow","list-item"],["inline,flow,list-item","inline list-item"],["block,flex","flex"],["inline,flex","inline-flex"],["block,grid","grid"],["inline,grid","inline-grid"],["inline,ruby","ruby"],["block,table","table"],["inline,table","inline-table"],["table-cell,flow","table-cell"],["table-caption,flow","table-caption"],["ruby-base,flow","ruby-base"],["ruby-text,flow","ruby-text"]]);const n=n=>{const t=!("preserve"in Object(n))||Boolean(n.preserve);return{postcssPlugin:"postcss-normalize-display-values",prepare(){const n=new Map;return{Declaration:{display(i){const o=i.value;if(!o)return;if(n.has(o))return void(i.value!==n.get(o)&&(t?i.cloneBefore({value:n.get(o)}):i.value=n.get(o)));const r=function(n){const{nodes:t}=e(n);if(1===t.length)return n;const i=t.filter((e=>"word"===e.type)).map((e=>e.value.toLowerCase()));if(i.length<=1)return n;return l.get(i.join(","))||n}(o);i.value!==r&&(t?i.cloneBefore({value:r}):i.value=r),n.set(o,r)}}}}}};n.postcss=!0;export{n as default};