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
669 B
2 lines
669 B
2 years ago
|
import e from"postcss-selector-parser";const s=s=>{s=Object(s);const r=Boolean(!("preserve"in s)||s.preserve),t=String(s.replaceWith||".focus-visible"),o=e().astSync(t);return{postcssPlugin:"postcss-focus-visible",Rule(s,{result:t}){if(!s.selector.includes(":focus-visible"))return;let c;try{const r=e((e=>{e.walkPseudos((e=>{":focus-visible"===e.value&&(e.nodes&&e.nodes.length||e.replaceWith(o.clone({})))}))})).processSync(s.selector);c=String(r)}catch(e){return void s.warn(t,`Failed to parse selector : ${s.selector}`)}if(void 0===c)return;if(c===s.selector)return;const l=s.clone({selector:c});r?s.before(l):s.replaceWith(l)}}};s.postcss=!0;export{s as default};
|