Spectral decomposition of black-hole perturbations on hyperboloidal slices