import type { Rule } from 'unocss' ; import { ConvertToCssObject , generatorLayer , getUnitAndNum } from '../utils' ; import { UNIT_ENUM_STR , NONNEGATIVE_NUMBER_REGEX_STR } from '../constant' ; export const minMaxHeightWidth = ( ) => [ [ new RegExp ( `^(max-h|max-height)-(?<num>${ NONNEGATIVE_NUMBER_REGEX_STR })(?<unit>${ UNIT_ENUM_STR })?$` ) , ( { groups } ) => { const { num , unit } = groups as { num : string ; unit ? : string ; } ; return ConvertToCssObject ( [ `max-height:${ getUnitAndNum ( unit , num ) }` ] ) ; } , generatorLayer ( 30 ) , ] , [ new RegExp ( `^(min-h|min-height)-(?<num>${ NONNEGATIVE_NUMBER_REGEX_STR })(?<unit>${ UNIT_ENUM_STR })?$` ) , ( { groups } ) => { const { num , unit } = groups as { num : string ; unit ? : string ; } ; return ConvertToCssObject ( [ `min-height: ${ getUnitAndNum ( unit , num ) }` ] ) ; } , generatorLayer ( 40 ) , ] , [ new RegExp ( `^(max-w|max-width)-(?<num>${ NONNEGATIVE_NUMBER_REGEX_STR })(?<unit>${ UNIT_ENUM_STR })?$` ) , ( { groups } ) => { const { num , unit } = groups as { num : string ; unit ? : string ; } ; return ConvertToCssObject ( [ `max-width: ${ getUnitAndNum ( unit , num ) }` ] ) ; } , generatorLayer ( 31 ) , ] , [ new RegExp ( `^(min-w|min-width)-(?<num>${ NONNEGATIVE_NUMBER_REGEX_STR })(?<unit>${ UNIT_ENUM_STR })?$` ) , ( { groups } ) => { const { num , unit } = groups as { num : string ; unit ? : string ; } ; return ConvertToCssObject ( [ `min-width: ${ getUnitAndNum ( unit , num ) }` ] ) ; } , generatorLayer ( 41 ) , ] , ] as Rule [ ] ;