reveal

Docs: https://vlaaad.github.io/reveal/ Source: https://github.com/vlaaad/reveal
phronmophobic 2021-02-28T01:57:53.021400Z

At some point I was working on a similar concept. It worked ok, but I stopped work on it since I wanted to editor to run in the browser, but the mechanism relied on being able to produce and eval code which is a real pain to do with cljs. My approach was slightly different. I built a handful of different types of editors: • text area • number slider • toggle • counter • key-value editor • List editor • Label (no editing, just display the value) • etc Editors could be composed. For example, a key-value editor could be composed of labels (for keys) and number sliders (for numeric values). Each editor could return whether it could edit a value produced by a given spec. Each editor could also provide extra options for configuration (eg. the key-value editor had options for its layout). I used https://github.com/stathissideris/spec-provider so that I could generate specs from example data. I also implemented a function that given a spec, would use heuristics to try and create what it thought would be the most appropriate editor. I even had an editor-editor so that you could tweak the editor that was produced heuristically.

(start-form-builder {:x 2,
                       :y 10,
                       :data ":/gamedata/enemies/test-enemy.json",
                       :character
                       {:role "Enemy",
                        :wisdom 10,
                        :weapon "",
                        :firearm "",
                        :experience 100,
                        :mana 10,
                        :inventory
                        [{:data ":/gamedata/items/plants/healing-herb.json", :count 2}
                         {:data ":/gamedata/items/weapons/sword.json", :count 2}],
                        :strength 10,
                        :healthMax 200,
                        :manaMax 10,
                        :health 200,
                        :gender "male",
                        :stealth 0}})
The example form is below. There's also the editor-editor which is super ugly, but would let you tweak the produced form.