devpanel: refactor template viewer dom tree