Decompose the new diagram code

pull out all the primitives. Some went to app.'s

Next, make a setDiagramDefaults() method.

Then setDiagramCss() method.
whoops. don't understand global functions as well as I thought.