UNPKG

cqfill

Version:

Polyfill for CSS Container Queries

1 lines 1.44 kB
var s=/([\d.]+)([^]*)/,memo=(s,t)=>s in e?e[s]:e[s]=t(s),e=Object.create(null);function postcssCQFill(){return{postcssPlugin:"PostCSS CQFill",Declaration:{contain(s){s.cloneBefore({prop:"--css-contain"})}},AtRule:{container(e){var t;e.params=(t=e.params,memo(t,(e=>e.replace(/\(\s*([\w-]+)\s*(=|<|<=|>|>=)\s*([\w-]+)\s*(?:(<|<=|>|>=)\s*([\w-]+)\s*)?\)/g,((e,t,n,o,c,r)=>{const l=s.test(t),a=.0625*(l?-1:1),[i,p]=l?[o,t]:[t,o];return"("+("="===n[0]?"":">"===n[0]===l?"max-":"min-")+i+":"+("="!==n[0]&&1===n.length?p.replace(s,((s,e,t)=>Number(e)+a*(">"===n?1:-1)+t)):p)+(c?") and ("+(">"===c[0]?"min-":"max-")+i+":"+(1===c.length?r.replace(s,((s,e,t)=>Number(e)+a*(">"===c?-1:1)+t)):r):"")+")"})))));const n=e.cloneBefore({name:"media",params:`\\@container ${e.params}`});n.raws.afterName||(n.raws.afterName=" ")}}}}postcssCQFill.postcss=!0;var t=postcssCQFill,n=Object.defineProperties(t,Object.getOwnPropertyDescriptors({get postcss(){function postcssPlugin(s){const e=t();"function"==typeof e.Once&&e.Once(s),s.walk((s=>{const[t,n]={atrule:["AtRule","name"],comment:["Comment","text"],decl:["Declaration","prop"],rule:["Rule","selector"]}[s.type];if(t in e){const o=e[t];if("function"==typeof o)o(s);else if("object"==typeof o&&null!==o)for(const e in o){const t=s[n];("*"===e||e.includes(t))&&o[e](s)}}}))}return postcssPlugin.postcssPlugin="cqfill/postcss",postcssPlugin.postcssVersion="8.2.13",postcssPlugin}}));globalThis.postcss-7=n