A unified computational formulation for multi-component and multi-phase flows