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.

2 lines
976 B

2 years ago
import e from"postcss-selector-parser";function t(e){return"attribute"===e.type&&e.insensitive}function s(e,t,n){const c=n.charAt(t);if(""===c)return e;let o=e.map((e=>e+c));const r=c.toLocaleUpperCase();return r!==c&&(o=o.concat(e.map((e=>e+r)))),s(o,t+1,n)}function n(e){return s([""],0,e.value).map((t=>{const s=e.clone({spaces:{after:e.spaces.after,before:e.spaces.before},insensitive:!1});return s.setValue(t),s}))}function c(s){let c=[];s.each((s=>{(function(e){return e.some(t)})(s)&&(c=c.concat(function(s){let c=[e.selector({value:"",nodes:[]})];return s.walk((e=>{if(!t(e))return void c.forEach((t=>{t.append(e.clone())}));const s=n(e),o=[];s.forEach((e=>{c.forEach((t=>{const s=t.clone({});s.append(e),o.push(s)}))})),c=o})),c}(s)),s.remove())})),c.length&&c.forEach((e=>s.append(e)))}const o=()=>({postcssPlugin:"postcss-attribute-case-insensitive",Rule(t){t.selector.includes("i]")&&(t.selector=e(c).processSync(t.selector))}});o.postcss=!0;export{o as default};