This is a complicated application to get started with!
Your temp.html is static html , often js libraries will wait until the html has been loaded and then scan the html for domnodes with classes used by the library and then replace those domnodes with the html/domnodes that it creates - this general happens once.
tiddlywiki is dynamic html it continually adds and removes domnodes from the dom.
When using included libraries in tiddlywiki, generally, it is necessary to create the application’s js objects thru a call to the library’s js api, and not created and add domnodes (with the libraries classes) to the dom.
Also js libraries sometime need to be added to the ‘head’ section of the dom, this is achieved by added a ‘$:/tags/RawMarkup’ tag to the tiddler containing the library.