cgrand / enlivez

8 stars 0 forks source link

Day #8 #17

Closed cgrand closed 5 years ago

cgrand commented 5 years ago

Small victory

=> (let [adom (atom nil)
         root (fragment-component [:ul :_]
                [[[1] (with-component 
                        (fragment-component [:li :_ "is" :_]
                          [[[1] (terminal-component identity)]
                           [[3] (terminal-component #(if % "done" "yet to do"))]]))]])
         root (root #(reset! adom %))]
     (doto root
       (ensure-path! [[0] [12345] [0] ["title"]])
       (ensure-path! [[0] [12345]])
       (ensure-path! [[0] [12345] [1] [false]]))
     @adom)
[:ul ([:li "title" "is" "yet to do"])]
cgrand commented 5 years ago

getting close, however in 9b9ca2e39066aaf99af8f9482d7050180d03aa1e there's a remaining tension between Component, Template and something unnamed (those function taking ump! args).

(ump! stands for update mount point)

These functions should be templates.

At runtime a template should be able to enumerate its queries and instantiate a component at a given mount point.

However templates currently have a compile time responsibility: emitting code.

Given the clj/cljs split of macros it may be simpler to distinguish compile time and runtime.

cgrand commented 5 years ago

Oh and runtime query enum is required for template composition