Moved Navigation Bar Functionality to use the New Tree

Notable differences:

* For an external module in file `a/b/c.ts`, the "top-level" container is displayed as `"c"`.
Why we change from class to nested function?