Skip to content

Latest commit

 

History

History
34 lines (26 loc) · 1.87 KB

2022-7.md

File metadata and controls

34 lines (26 loc) · 1.87 KB

November 2022

November 6th

Oh hi there! Looks like I haven't written anything in here since 2020, oh how time flies! Actually, how does this even get published on the internet? Ok. Github pages, so I just write a markdown file and commit it and then that's it. Nice! Well, since 2020 I've not been able to write any open source code, things have been pretty hectic. I want to change that but between my dayjob and life stuff I don't have a lot of free time. I think the best approach might be to take some of what me and the team have been working on at my job, pull out the stuff that's more generally useful and publish it as open source libraries! Best candidate is our work on a system for building Clojurescript frontend components we call Beam Forms, or beamforms, or beam.forms? We'll see what sticks.

The idea is to take a specification in the form of nested maps like so:

{:type :section
 :children [{:type :plain-text
             :value "Hello!"}]}

And compile that into a hiccup form like [:section [:span "Hello!"]]

Which seems pointlessly more verbose! It gets a bit more interesting when we want to build stateful components. For example:

{:form/actions {:inc {:local (fn [{:keys [n]}]
                               {:n (if n (inc n) 1)})}}
 :form/tree {:type :flex
             :style {:align-items :center
                     :margin-left 10}
             :children [{:type :action-btn
                         :label "+"
                         :action :inc}
                        {:type :plain-text
                         :style {:margin-left 10}
                         :state {:value (fn [{:keys [n]}]
                                          (str "Count: " (or n 0)))}}]}}

I'm hopeful that it's fairly clear what this does just by reading it. I'm so hopeful that I'm not going to say anything else for the moment. I'll come back later!