refactored API to follow Widget Factory style + added jsdocs - fixes #180 #178