/
index.ts
34 lines (29 loc) · 1.03 KB
/
index.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import type { Preset } from '@unocss/core'
import type { PresetMiniOptions, Theme } from '@unocss/preset-mini'
import { rules, shortcuts, theme, variants } from '@unocss/preset-wind'
import { VarPrefixPostprocessor, preflights } from '@unocss/preset-mini'
import { variantColorMix } from './variants/mix'
export type { Theme }
export interface PresetUnoOptions extends PresetMiniOptions {}
export const presetUno = (options: PresetUnoOptions = {}): Preset<Theme> => {
options.dark = options.dark ?? 'class'
options.attributifyPseudo = options.attributifyPseudo ?? false
options.preflight = options.preflight ?? true
return {
name: '@unocss/preset-uno',
theme,
rules,
shortcuts,
variants: [
...variants(options),
variantColorMix,
],
options,
postprocess: options.variablePrefix && options.variablePrefix !== 'un-'
? VarPrefixPostprocessor(options.variablePrefix)
: undefined,
preflights: options.preflight ? preflights : [],
prefix: options.prefix,
}
}
export default presetUno