massive refactor

Have removed the typescript source files. moved everything under source,
updated the src and updated the build.js source.

Classes are now namespaced, and index.ts is now compiled along side a
typescript.api.d.ts file.

Better diagnostics.