It warms my heart to see that people use and enjoy Reveal
A little comment on your snippet: you don’t need to call rx/as
inside the defstream
blocks since Reveal will mark emitted regions with the value anyway. Also, you shouldn’t use (when ...)
as an argument to rx/vertical
— it expects functions and not nulls.
I would write it like that:
(require '[vlaaad.reveal.ext :as rx])
(rx/defstream ::big-map [m]
(rx/horizontal
(rx/raw-string "#big-map{" {:fill :object})
(rx/entries (select-keys m (:visible-keys (meta m))))
(rx/raw-string "}" {:fill :object})))
(def big-map
(-> {:big-map (range 1000) :cool :info}
(with-meta {:vlaaad.reveal.stream/type ::big-map
:visible-keys [:cool]})))
You can then build on it even more stuff if necessary. For example, it can show remaining keys annotated with corresponding values, and then you can write a contextual action that allows looking at the value for a selected remaining key. I also think it’s nice that the big-map
function actually does not depend on Reveal: it’s just namespaced keywords in the meta, which means you can leave this metadata in production code and it won’t cause any trouble, while in the dev environment it will be picked up by Reveal.