squint 2024-06-21

I am thinking about using squint for a web component library (using Lit) where my components take ClojureScript data structures passed to them as props. How easy is it to deal with CLJS data in squint, since maps, vectors, etc. look very different on the js side and may be difficult to destructure and iterate over? Is there nice formatting available for printing? Ideally, I would like to avoid having to convert the data using something like https://github.com/jorinvo/edn-data Maybe Cherry would be a better alternative in that case? Building web components in CLJS has not been a good experience, since there is no native support for js classes. I recently found https://github.com/raystubbs/zero/ , which works very well so far, so I might actually stick with it. But I also want to try something more established like Lit and reduce CLJS machinary, since I have to interop with JS libraries like D3 a lot for visualizations.

@peterhfmnn Why would you need to pass CLJS values to JS web components and not just "JSON"?

I created a library for both CLJ and CLJS whose output the web components use to create visualizations. I would like to use both by importing them into Observable or Clerk notebooks and directly in CLJS apps.

Yes, I have seen the Lit example from your Twitter/X update, which brought me to consider squint. :)

How does your CLJ library work with web components, which are a front-end thing?

squint (output) may play well with observable since it's just ES6 which should play well with any other JS library

I'm not sure if it makes sense to use squint within CLJS if you're passing around EDN values, unless you convert them to JS values first, probably

Yeah, maybe sticking with CLJS/zero would make more sense in this case, since I already have an indirect dependency on my CLJS library.

My library can be used from CLJ to do some calculations and transformations without needing the visualization part (where the web components come in).

I haven't looked at the zero library but shadow-cljs also supports the defclass macro which is shown in the example above

Hi, I'm just curious if it's possible in a squint macro to read from the file system? I'd like to populate a variable on compile time. I know that the macros are interpreted via SCI, but I am not having any luck doing something like this:

(defmacro test []
  (require '["fs" :as fs])
  (println fs)
  (fs/existsSync "README.md"))

I guess we could fix this

Please create an issue