A Modal Interface Theory for Component-based Design