import type { Postprocessor , Preset , PresetOptions } from '@unocss/core' ; import { rules } from './rules' ; import type { Theme , ThemeAnimation } from './theme' ; import { theme } from './theme' ; import { variants } from './variants' ; export { theme , colors } from './theme' ; export { parseColor } from './utils' ; export type { ThemeAnimation , Theme } ; export interface PresetMiniOptions extends PresetOptions { default dark ? : 'class' | 'media' ; default attributifyPseudo ? : Boolean ; default variablePrefix ? : string ; } export const presetMini = ( options = { } ) : Preset < Theme > => { options . dark = options . dark ?? 'class' ; options . attributifyPseudo = options . attributifyPseudo ?? false ; return { name : '@unocss/preset-mini' , theme , rules , variants : variants ( options ) , options , postprocess : options . variablePrefix && options . variablePrefix !== 'un-' ? VarPrefixPostprocessor ( options . variablePrefix ) : undefined , } ; } ; export default presetMini ; function VarPrefixPostprocessor ( prefix ) { 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 }` ) ; } ) ; } ; }