Fork me on GitHub
#nbb
<
2022-09-21
>
dabrazhe16:09:17

Hi, checking out nbb. What's the minimal workflow to target a web browser? I would like to try a ClojureScript graphics or animation library. Is nbb a good fit for this use case?

borkdude16:09:18

nbb doesn't target the browser, it runs on Node.js

borkdude16:09:57

Perhaps #scittle is more what you want combined with e.g. vega-lite

borkdude16:09:26

But for command line / server side libraries Node.js might have some graphical stuff

borkdude16:09:25

I think some folks have also used #scittle with vega-lite

borkdude17:09:52

So @U066L8B18 - do you have any suggestions for @dennisa?

Daniel Slutsky17:09:14

It looks wonderful. I'll try to think about possible use cases. :thinking_face: 🙏 Mentioning also @U7CAHM72M who created an EDN version of the Vega-Lite official examples: https://behrica.github.io/vl-galery/convert/ and @U06C63VL4, the author of https://github.com/jsa-aerial/hanami.

borkdude17:09:12

@U066L8B18 What I was getting it is I think you made some stuff with scittle + vega-lite, which I hoped you could share with @dennisa

borkdude17:09:32

But I could be misremembering it

cldwalker17:09:29

https://github.com/cldwalker/bb-clis/blob/master/doc/scripts.md#bb-vis is the updated readme to that script. I haven't used it in awhile unfortunately. For what I was doing, vl2* commands were all that I needed to interface with. If I ever need to dip into the vega-lite api I'd definitely switch to nbb 🙂

Daniel Slutsky17:09:31

Oh, sorry. Yes, I do use Vega-Lite from Scittle, simply to render plots in an html page. How would that be useful in an #nbb script?

borkdude17:09:00

Well, I first pointed @dennisa to #nbb but it wasn't clear to me he wished to target the browser

Daniel Slutsky17:09:05

Here is a piece of cljs code I'm using from #scittle to render a Vega / Vega-Lite spec: https://github.com/scicloj/clay/blob/d09b981342124ba8fb4769e682c7a52d7070aedd/src/scicloj/clay/v1/tool/scittle/cljs_generation.clj#L19

(defn vega [spec]
     [:div
      {:ref (fn [el]
              (-> el
                  (js/vegaEmbed (clj->js spec)
                                (clj->js {:renderer :svg}))
                  (.then (fn [res]))
                  (.catch (fn [err] (println (str "vegaEmbed error: " err))))))}])
It works when the following dependencies are in the page:


🙏 1
Daniel Slutsky17:09:39

Please tell me if I can help some how. I'm curious to hear about troubles & surprises.

dabrazhe17:09:14

Hi! actually browser does not matter that much, nice to have. I want to create a minimal setup that is easy to install and can render graphics and simple animation based on primitives

👍 1
dabrazhe17:09:35

Vega appears to be geared towards business chart. But if it can render other sort of graphics it would be interesting to learn more

Daniel Slutsky17:09:19

For browser-free uses of Vega, there is also Darkstar: https://github.com/applied-science/darkstar

Daniel Slutsky17:09:25

> But if it can render other sort of graphics it would be interesting to learn more Curious to hear more about what you have in mind and would find useful.

dabrazhe14:09:06

These projects look pretty great, and elaborate, thank you. I guess I am looking for smth more simple. Like maria.cloud, but run locally with VSC and minimal installation, that kids can use without being overwhelmed. I have to backtrack a little.

👍 1