Britain and the European Union have agreed in principle on a text setting out their future relationship. The deal is pending endorsement by the bloc’s leaders at a summit on Sunday.