clojurescript

ClojureScript, a dialect of Clojure that compiles to JavaScript http://clojurescript.org | Currently at 1.10.879
Helins 2021-01-26T19:21:04.101200Z

I cannot find much about this besides anecdotal mentions. Was there any concrete attempt at building something akin to Svelte? Concrete attempts to eschew the virtual DOM mania using some macro magic ?

mkvlr 2021-01-26T19:22:53.101600Z

@adam678 check out https://github.com/thheller/shadow-experiments#highly-experimental-code by @thheller

👍 3
😎 1
thheller 2021-01-26T19:22:55.101700Z

I built and use this nowadays https://github.com/thheller/shadow-experiments

👍 1
thheller 2021-01-26T19:23:13.102200Z

but its nowhere near ready for "public" use. good enough for experiments though 😉

dgb23 2021-01-26T19:23:46.103600Z

its pretty impressive actually

Helins 2021-01-26T19:23:48.103700Z

@mkvlr Thanks, I was aware of shadow.arborist but not all this :)

phronmophobic 2021-01-26T19:23:52.103900Z

my library, https://github.com/phronmophobic/membrane/ , does not have a virtual dom

👍 2
thheller 2021-01-26T19:29:31.104400Z

I do use it for all my stuff now but this is the only public repo in case you want to look over it 😛

Helins 2021-01-26T19:51:43.105Z

It's a bit of a shame you are working on all that alone. You should establish your own team of super heroes and fight JS crime.

😂 1
Helins 2021-01-26T20:14:47.107900Z

I remember reading that 'conarrative/precept' (https://github.com/CoNarrative/precept), which sadly doesn't look much active anymore, could be a hint of a solution towards having a data-driven DOM without the need for a virtual one nor anything sophisticated in that respect. I can somewhat understand why, to some extent on a superficial level. However it pretty much died out from what I see.

Helins 2021-01-26T20:27:51.108200Z

This is probably a gross oversimplification, but at first, on a data level it looked like it was about reproducing a reagent-like state management in cross-platform fashion (feel free to correct me). Then I got a bit confused while looking at the Fulcro example. Essentially, how would one use this library in the browser without relying on any React framework?

clyfe 2021-01-26T20:31:03.108400Z

It did have https://github.com/clyfe/clara-eav.

2021-01-26T21:05:57.109400Z

I have a wrapper for lit-html that accepts Hiccup-style [:div [:span.some-class "text content"]] syntax that I've just pushed to Github https://github.com/shepheb/lit-up

simongray 2021-01-27T08:10:05.132100Z

Not familiar with lit-html either, but this looks interesting.

2021-01-28T14:30:33.153900Z

yeah, I thought about just rebuilding it - lit-html is tiny, only a few KB in production. but there's also lots of fiddly logic in there to determine minimal DOM updates to bridge what's there now to what's needed. I'd rather punt that 🙂

2021-01-26T21:06:30.110100Z

I don't know if whatever lit-html does under the hood counts as a "virtual DOM", but it's fast and powered by pure functions, so it's a very tidy fit in CLJS.

phronmophobic 2021-01-26T21:14:34.110200Z

this state management is quite different from reagent.

phronmophobic 2021-01-26T21:15:38.110400Z

I don't have a good example project for the web, since I'm primarily focused on desktop, but you can check out https://github.com/phronmophobic/membrane/blob/master/src/membrane/webgltest.cljs#L72 and https://github.com/phronmophobic/membrane/blob/master/docs/webgl.md

phronmophobic 2021-01-26T21:15:45.110800Z

which both use webGL

phronmophobic 2021-01-26T21:16:54.111Z

if you do want to render to DOM nodes, there is a backend for https://github.com/exupero/vdom

phronmophobic 2021-01-26T21:17:43.111300Z

the idea is that your UI code remains the same regardless of which backend you choose.

2021-01-26T21:19:56.111500Z

Published to https://github.com/shepheb/lit-up not on Clojars yet because I can't spare the time to set that up right now.

sova-soars-the-sora 2021-01-26T21:25:05.112500Z

is there a cljs cheat sheet for manipulating CSS properties of dom elements?

phronmophobic 2021-01-26T21:25:48.112600Z

another goal is that you should be able to mix and max your state management library (reagent, re-frame, fulcro, etc) with your target platform (DOM, webGL, javaFX, swing, skia, etc)

Helins 2021-01-26T21:26:31.112900Z

It is probably too soon to ask but would you say that it is bound to remain a research project or do you truly believe that it has a chance for outperforming React-like libs by design?

phronmophobic 2021-01-26T21:26:41.113100Z

the membrane fulcro example is using fulcro on desktop

thheller 2021-01-26T21:35:37.113300Z

for me it already is

thheller 2021-01-26T21:37:18.113500Z

the DOM parts are performant enough and rarely the issue. even in react apps. the issue is mostly in how most react components are written with no concern for performance. (eg. wrapping 10 layers of higher order components to get a dumb div that acts as button)

thheller 2021-01-26T21:37:44.113700Z

so yeah you can write bad performing components in pretty much all frameworks, mine included

Piotr Brzeziński 2021-01-26T22:04:01.114900Z

Hey! I’m using shadowcljs with reagent and I’m trying to display an image in my app like [:img {:src "./public/images/stopwatch-solid.svg"}] but the path is incorrect and am not sure how to set it up. Any pointers appreciated.

Piotr Brzeziński 2021-01-26T22:08:17.115300Z

Or should I just store the SVG inline in the file as a string? :thinking_face:

blak3mill3r 2021-01-26T22:16:02.116400Z

perhaps the path public/ is already being hosted by whatever web server you are using (this is common) in which case it might just work if you did [:img {:src "/images/stopwatch-solid.svg"}]

blak3mill3r 2021-01-26T22:17:09.117100Z

however, baking the SVG into the cljs output is not a bad idea (it saves 1 extra HTTP request which might speed things up under some circumstances)

blak3mill3r 2021-01-26T22:17:39.117600Z

@peb.brzezinski

Piotr Brzeziński 2021-01-26T22:39:06.118Z

Awesome, thanks for your answer!

Piotr Brzeziński 2021-01-26T22:40:02.118500Z

Changing the URL to images/stopwatch-solid.svg has helped 👍