60 lines
1.8 KiB
JavaScript
60 lines
1.8 KiB
JavaScript
import { toArray, definePreset } from '@unocss/core';
|
|
import presetMini, { presetMini as presetMini$1 } from '@unocss/preset-mini';
|
|
export { colors, preflights } from '@unocss/preset-mini';
|
|
import { shortcuts } from './shortcuts.mjs';
|
|
import { theme } from './theme.mjs';
|
|
import { r as rules } from './shared/preset-wind.BPNbmKYQ.mjs';
|
|
import { b as variants } from './shared/preset-wind.BwVsieym.mjs';
|
|
import './shared/preset-wind.BzmnsdqZ.mjs';
|
|
import '@unocss/preset-mini/utils';
|
|
import '@unocss/preset-mini/rules';
|
|
import '@unocss/preset-mini/theme';
|
|
import './shared/preset-wind.DjKJQ_OR.mjs';
|
|
import '@unocss/rule-utils';
|
|
import '@unocss/preset-mini/variants';
|
|
|
|
function important(option) {
|
|
if (option == null || option === false)
|
|
return [];
|
|
const wrapWithIs = (selector) => {
|
|
if (selector.startsWith(":is(") && selector.endsWith(")"))
|
|
return selector;
|
|
if (selector.includes("::"))
|
|
return selector.replace(/(.*?)((?:\s\*)?::.*)/, ":is($1)$2");
|
|
return `:is(${selector})`;
|
|
};
|
|
return [
|
|
option === true ? (util) => {
|
|
util.entries.forEach((i) => {
|
|
if (i[1] != null && !String(i[1]).endsWith("!important"))
|
|
i[1] += " !important";
|
|
});
|
|
} : (util) => {
|
|
if (!util.selector.startsWith(option))
|
|
util.selector = `${option} ${wrapWithIs(util.selector)}`;
|
|
}
|
|
];
|
|
}
|
|
|
|
function postprocessors(options) {
|
|
return [
|
|
...toArray(presetMini(options).postprocess),
|
|
...important(options.important)
|
|
];
|
|
}
|
|
|
|
const presetWind = definePreset((options = {}) => {
|
|
options.important = options.important ?? false;
|
|
return {
|
|
...presetMini$1(options),
|
|
name: "@unocss/preset-wind",
|
|
theme,
|
|
rules,
|
|
shortcuts,
|
|
variants: variants(options),
|
|
postprocess: postprocessors(options)
|
|
};
|
|
});
|
|
|
|
export { presetWind as default, presetWind, rules, shortcuts, theme, variants };
|