It does not implement @colshacol 's proposal for modularizing classes as I assumed he was going to implement it; but I'm willing to add it too should he not have time.
It's certainly not perfect, but it works and no longer relies on parsing view as strings and back to JS.
Differences from the original API
Children now work
Includes a test suite & reorganised files
Functional components now work
setStyles now automatically adds px to numbers passed as style values (eg 400 becomes 400px automatically).
The l() API changed. Previously you'd do l(this.foo) and now you have to do l(component, 'foo') (see examples below). component gets passed explicitly to the view function of components.
l() is dynamic now (the view function no longer gets parsed to a string and back).
The l() API includes a process method (see examples below) so that separate list and cond functions are no longer necessary. This process method is very flexible.
This PR includes my refactor.
It does not implement @colshacol 's proposal for modularizing classes as I assumed he was going to implement it; but I'm willing to add it too should he not have time.
It's certainly not perfect, but it works and no longer relies on parsing view as strings and back to JS.
Differences from the original API
setStyles
now automatically addspx
to numbers passed as style values (eg400
becomes400px
automatically).l()
API changed. Previously you'd dol(this.foo)
and now you have to dol(component, 'foo')
(see examples below).component
gets passed explicitly to theview
function of components.l()
is dynamic now (the view function no longer gets parsed to a string and back).l()
API includes aprocess
method (see examples below) so that separatelist
andcond
functions are no longer necessary. Thisprocess
method is very flexible.See component.test.js for more examples.