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
1.1 KiB

2 years ago
"use strict";function e(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var t=e(require("postcss-selector-parser"));function n(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 c(e){return s([""],0,e.value).map((t=>{const n=e.clone({spaces:{after:e.spaces.after,before:e.spaces.before},insensitive:!1});return n.setValue(t),n}))}function o(e){let s=[];e.each((e=>{(function(e){return e.some(n)})(e)&&(s=s.concat(function(e){let s=[t.default.selector({value:"",nodes:[]})];return e.walk((e=>{if(!n(e))return void s.forEach((t=>{t.append(e.clone())}));const t=c(e),o=[];t.forEach((e=>{s.forEach((t=>{const n=t.clone({});n.append(e),o.push(n)}))})),s=o})),s}(e)),e.remove())})),s.length&&s.forEach((t=>e.append(t)))}const r=()=>({postcssPlugin:"postcss-attribute-case-insensitive",Rule(e){e.selector.includes("i]")&&(e.selector=t.default(o).processSync(e.selector))}});r.postcss=!0,module.exports=r;