Is Kind/Clay etc more focused for notebooks - actual code files? I'm curious about using it to render various things inside my chatbot ui but didn't see a clear path for that at first glance.
We are working on extracting the relevant parts of Clay as a separate library that will serve as a model implementation of Kindly visualizations.
Probably, such a library will not be useful for all use cases. Some projects will need their own Kindly implementation, depending on their stack (Reagent based / HTML based / etc.).
To help us plan, it would be helpful to share your use case as a topic thread of the #visual-tools https://clojurians.zulipchat.com/#narrow/stream/313390-visual-tools of the Clojurians Zulip chat.
For now, I'd recommend looking into Clay's internals and using the parts that you need for your case to support Kindly.
Thanks. I will jump into the Zulip channel. The use case is somewhat unspecified at present as I am also still experimenting. Just seeing what kind of visions can emerge into some form when thinking about iterative/conversational/literate programming alongside an LLM.
Here’s some shared-very-early-to-discuss-in-public-please-dont-laugh-at-my-drawrings code that shows how to bypass the usual Clay entry points and use some internal apis to render individual forms and return hiccup/html/svg directly instead of the default machinery that renders to files on disk. I’ve had a busy couple of months since I touched this so there may be easier ways to do this directly with clay now, and I can’t remember exactly which kinds work and which are buggy and which definitely don’t work. On mobile and can’t figure out how to link to lines directly but the ui namespace and the impl.clay.* is what you would want to look at to see kind of what’s minimally required to render with clay/kindly. https://github.com/casselc/playdoh
I'm doing something similar but less dynamic, which is getting daily generated Clay output (certain graphs and datatables) into WordPress admin dashboard (PHP templating). Found some useful breadcrumbs here (`clay/make-hiccup`) https://clojurians.zulipchat.com/#narrow/stream/313390-visual-tools/topic/clay.2C.20clerk.2C.20blog-posting.20woes.
Thanks for pointing it out, @j.s. Good to know you are using it. You are right. Possibly, it may help with @grounded_sage's use case. For example,
(clay/make-hiccup
{:single-value (kind/plotly
{:data [{:x [0 1 3 2]
:y [0 6 4 5]
:z [0 8 9 7]
:type :scatter3d
:mode :lines+markers
:opacity 0.5
:line {:width 5}
:marker {:size 4
:colorscale :Viridis}}]
:layout {:title "Plotly example"}})})
results in:
[[:script
{:type "text/javascript",
:src #object[java.net.URI 0x201a12f7 ".clay_files/plotly0.js"]}]
[:div
{:style {:height "400px", :width "100%"}}
[:script
"Plotly.newPlot(document.currentScript.parentElement,\n [{\"x\":[0,1,3,2],\"y\":[0,6,4,5],\"z\":[0,8,9,7],\"type\":\"scatter3d\",\"mode\":\"lines+markers\",\"opacity\":0.5,\"line\":{\"width\":5},\"marker\":{\"size\":4,\"colorscale\":\"Viridis\"}}], {\"title\":\"Plotly example\"}, {});"]]
[:div {:style {:height "2px", :width "100%", :background-color "grey"}}]
[:div nil]]
Yes, it'd be good to keep discussing this at the Zulip topic thread that @j.s proposed.