Connecting Unseen Domains: Cross-Domain Invariant Learning in Recommendation