Initial refactoring for recursive tree expansion.
Split the tree directive into two parts: a fixed outer wrapper, and a nested directive that will ultimately be recursive when the user expands the tree.