mrmiguu / coco

Golang WebAssembly Framework
MIT License
110 stars 4 forks source link

Redesign to be more Go-idiomatic #12

Open mrmiguu opened 5 years ago

mrmiguu commented 5 years ago

This redesign will allow current users of Go to more intuitively engage with Coco for frontend web design.

e.g.

main.go

image

App.html

image

Please comment, question and criticize!

mrmiguu commented 5 years ago

I was able to get embedding channels in DOM elements (like .Click and .Blur above) working. I started working on a variation of triangle numbers to catch the longest combination names first to infer what the user meant to bind. I'm considering switching to a more reliable pattern, like the name should always end or begin with the event binding (like TestHeadingDblClick or DblClickTestHeading).

mrmiguu commented 5 years ago

New architectural pipeline:

image

mrmiguu commented 5 years ago

Have been working heavily on the pipeline. 99% of all cases for custom (hybrid) templates have been proven (preprocessing vs. executing). Should have a branch and/or commit for this design coming very soon.

mrmiguu commented 5 years ago

Wiring up events requires listeners to be set after the template is executed by Go's HTML template engine (and our custom preprocessor stage).

Here is the awesome result:

image image image

A skeleton of the template and binding structure is created, allowing for template.HTMLAttr() to protect preprocessor bindings for events in element attributes, like the pair of:

<div {{.Click}}>

and

Click <-chan bool