add reactive controller methods and fix UI.controller()

A layout can change its controller which might need to invalidate a
helper method which calls UI.controller().

Also tests reactive state variables.

cc @tmeasday, @zol