The thermodynamics of multi-phase multi-component equilibrium in nanoconfinement