import { Style } from '../style' ; import { Query } from '../query' ; import { hyphenateProperty } from '../utils/parse' ; export default function media ( list , style ) { return { [ `@media ${ typeof list === 'string' ? list : query ( list ) }` ] : style } ; } export function query ( list ) { let result = '' ; let feature ; for ( feature in list ) { if ( result ) { result += ' and ' ; } const value = list [ feature ] ; result += value === true ? `(${ hyphenateProperty ( feature ) })` : `(${ hyphenateProperty ( feature ) }: ${ value })` ; } return result ; }