Stellar evolution with rotation and magnetic fields II. General equations for the transport by Tayler-Spruit dynamo