Diffractive heavy quarkonium photoproduction and electroproduction in QCD