Handles layout of UI components.
@spec layout_tree(diff_result :: any(), new_tree_for_reference :: map() | nil) :: map() | any()