montagejs/montage — pull request #1202 by kriskowal (2013-06-18 03:50:22+00:00)
Title: Add tree.reel and fix content swaps in controller

This adds a tree component, which allows a template to be repeated and
indented depending on the state in the corresponding tree controller.
The tree view does not impose any UI for disclosure triangles or other
visualization than indentation.

Alternate means of visualizing depth are a matter for further
elaboration.

Previously, swapping the content of a tree controller would retain the
expanded and collapsed state of the previous tree. This commit adds an
abstraction layer to the Tree Controller that allows it to have
independent view-model trees for each article of content, retained
loosely in a WeakMap so the tree controller does not implicitly leak if
old trees are discarded and new ones allocated.

Thank you @aadsm for getting me unstuck on this.