Judge preserves millions in federal homeless grants to Bay Area that Trump sought to limit