mirror of
https://github.com/idanoo/GoScrobble.git
synced 2024-11-28 19:35:15 +00:00
31 lines
887 B
JavaScript
31 lines
887 B
JavaScript
|
'use strict';
|
||
|
|
||
|
function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; }
|
||
|
|
||
|
var postcss = _interopDefault(require('postcss'));
|
||
|
|
||
|
const selectorRegExp = /:focus-visible([^\w-]|$)/gi;
|
||
|
var index = postcss.plugin('postcss-focus-visible', opts => {
|
||
|
const replaceWith = String(Object(opts).replaceWith || '.focus-visible');
|
||
|
const preserve = Boolean('preserve' in Object(opts) ? opts.preserve : true);
|
||
|
return root => {
|
||
|
root.walkRules(selectorRegExp, rule => {
|
||
|
const selector = rule.selector.replace(selectorRegExp, ($0, $1) => {
|
||
|
return `${replaceWith}${$1}`;
|
||
|
});
|
||
|
const clone = rule.clone({
|
||
|
selector
|
||
|
});
|
||
|
|
||
|
if (preserve) {
|
||
|
rule.before(clone);
|
||
|
} else {
|
||
|
rule.replaceWith(clone);
|
||
|
}
|
||
|
});
|
||
|
};
|
||
|
});
|
||
|
|
||
|
module.exports = index;
|
||
|
//# sourceMappingURL=index.cjs.js.map
|