astro-ghostcms/.pnpm-store/v3/files/e0/8576812d8d1653052c9c32a7baf...

82 lines
2.6 KiB
Plaintext
Raw Normal View History

2024-02-14 19:45:06 +00:00
import { entriesToCss, toArray, definePreset } from '@unocss/core';
import { extractorArbitraryVariants } from '@unocss/extractor-arbitrary-variants';
import { g as globalKeywords } from './shared/preset-mini.0CcynBZx.mjs';
export { f as parseColor } from './shared/preset-mini.0CcynBZx.mjs';
import { t as theme } from './shared/preset-mini.zC_vZg74.mjs';
import { r as rules } from './shared/preset-mini.CoNueTEa.mjs';
import { h as variants } from './shared/preset-mini.eBWIK6gx.mjs';
export { colors } from './colors.mjs';
import '@unocss/rule-utils';
import './shared/preset-mini.0UJFjS_1.mjs';
const preflights = [
{
layer: "preflights",
getCSS(ctx) {
if (ctx.theme.preflightBase) {
const css = entriesToCss(Object.entries(ctx.theme.preflightBase));
const roots = toArray(ctx.theme.preflightRoot ?? ["*,::before,::after", "::backdrop"]);
return roots.map((root) => `${root}{${css}}`).join("");
}
}
}
];
const shorthands = {
position: [
"relative",
"absolute",
"fixed",
"sticky",
"static"
],
globalKeyword: globalKeywords
};
const presetMini = definePreset((options = {}) => {
options.dark = options.dark ?? "class";
options.attributifyPseudo = options.attributifyPseudo ?? false;
options.preflight = options.preflight ?? true;
options.variablePrefix = options.variablePrefix ?? "un-";
return {
name: "@unocss/preset-mini",
theme,
rules,
variants: variants(options),
options,
prefix: options.prefix,
postprocess: VarPrefixPostprocessor(options.variablePrefix),
preflights: options.preflight ? normalizePreflights(preflights, options.variablePrefix) : [],
extractorDefault: options.arbitraryVariants === false ? void 0 : extractorArbitraryVariants,
autocomplete: {
shorthands
}
};
});
function VarPrefixPostprocessor(prefix) {
if (prefix !== "un-") {
return (obj) => {
obj.entries.forEach((i) => {
i[0] = i[0].replace(/^--un-/, `--${prefix}`);
if (typeof i[1] === "string")
i[1] = i[1].replace(/var\(--un-/g, `var(--${prefix}`);
});
};
}
}
function normalizePreflights(preflights3, variablePrefix) {
if (variablePrefix !== "un-") {
return preflights3.map((p) => ({
...p,
getCSS: /* @__PURE__ */ (() => async (ctx) => {
const css = await p.getCSS(ctx);
if (css)
return css.replace(/--un-/g, `--${variablePrefix}`);
})()
}));
}
return preflights3;
}
export { VarPrefixPostprocessor, presetMini as default, normalizePreflights, preflights, presetMini, theme };