clojurescript

Grigory Shepelev 2024-12-07T14:54:02.791119Z

How do I style nested element using reagent + reagent-materual-ui? I am trying to set width propery of the nested video element with

{:style
 {:display :inline-block
 :video {:height "200px"}}}
so it'd conform to in js/ts
sx = {'display': 'inline-block' , 'video': {'height' : '200px'}}
? It won't work.

p-himik 2024-12-07T14:59:01.074999Z

Can you provide a full JSX element that uses those values?

liebs 2024-12-07T15:21:47.697469Z

I'm pretty sure you just need to write {:sx {:display :inline-block :video {:height "200px"}}} . Why are you putting the :style key in there?

Grigory Shepelev 2024-12-07T15:27:36.513299Z

hm. it's probably because I'm trying do to this on ["video-react" :refer [Player]] which doesn't support sx .

Grigory Shepelev 2024-12-07T15:27:45.045719Z

[:> Player (merge {:plays-inline true :src uri :sx {:video {:width "200px"}}} props)]

Grigory Shepelev 2024-12-07T15:27:52.006989Z

I need to adapt it somehow.

Grigory Shepelev 2024-12-07T15:28:04.428649Z

@p-himik @bhlieberman93

Grigory Shepelev 2024-12-07T15:29:00.247839Z

is there any way to fix that?

liebs 2024-12-07T15:29:27.940719Z

I just peeked at the website for video-react and it looks like it uses an external stylesheet for this component

Grigory Shepelev 2024-12-07T15:31:37.333569Z

@bhlieberman93 yes, but I want that exact component to be restyled. not react-videos

liebs 2024-12-07T15:33:40.163559Z

It's been some time since I used MUI but I would check out styled components https://mui.com/system/styled/

liebs 2024-12-07T15:33:46.232819Z

reagent-mui supports them

Takis_ 2024-12-07T17:40:56.683799Z

hello, i asked before sometime, for Clojurescript and node modules, there is no auto-complete and editor help right? (for methods, fields etc) i am using cursive but i can change the editor if it works with some other editor, even if it doesn't work, is there a work-around on this?

p-himik 2024-12-07T17:43:46.111379Z

You seem to be asking this question once a year. :) I believe nothing has changed since 2023.

p-himik 2024-12-07T17:44:29.919579Z

Personally, I rely on docs, sources, and run-time object inspection.

p-himik 2024-12-07T17:45:24.582219Z

It's not that dissimilar to how you already work with Clojure - of course, there's auto-complete for vars, but you don't know which function can be called on which value without also knowing what the function expects and that the value actually is.

Takis_ 2024-12-07T17:46:43.747779Z

yes! new year 2025 will bring the change! thank you

Takis_ 2024-12-07T17:47:20.291819Z

i am just spoiled from clojure that it works

Takis_ 2024-12-07T17:47:43.446909Z

but i think its useful anyways, not just spoiled, we will see next year!

p-himik 2024-12-07T17:52:38.113239Z

> i am just spoiled from clojure that it works Does it? If we're talking about auto-completion during interop, then in Cursive it reliably works only for static fields on classes that you have already imported. Members can also be auto-completed, but from my perspective it's just guesswork that often doesn't auto-complete even something that I have already used.

p-himik 2024-12-07T17:53:42.919979Z

And in a similar scenario, auto-completion for JS interop seems to be working.

Takis_ 2024-12-07T18:03:06.311299Z

in clojure when class was imported i could access easy methods/fields , i want something like this , but as far as i know we dont have it in ClojureScript.

import fsPr from "fs/promises";

Takis_ 2024-12-07T18:09:07.759729Z

p-himik 2024-12-07T18:13:03.009899Z

It works for non-static members only if the corresponding class is imported in the same namespace. And even then - I'm 80% sure it didn't work for me in some cases, but I wouldn't be able to recall for which classes exactly. So if you have to pass some Java value to a different namespace, you're out of luck. Or if you want to call a member and are fine with using reflection - also out of luck.

p-himik 2024-12-07T18:14:58.550429Z

But yeah, my example with js/Array is not that good since it's a built-in class and not something that you import.

liebs 2024-12-07T18:31:15.957049Z

In cursive you do get some completions on goog modules if I'm not mistaken.

Takis_ 2024-12-07T18:52:11.231629Z

in Clojure i had zero problems with java interop autocomplete, i could use all java things fine, i dont know what is goog modules, but in general i want to use it with node.js libraries and npm libraries

Takis_ 2024-12-07T18:53:13.147279Z

its ok, in 2025 maybe will be fixed!

liebs 2024-12-07T18:56:36.352409Z

goog modules are those that are distributed in the Google Closure Library, which is in maintenance mode but is still bundled with ClojureScript. This is a guess, but since those source files are on the class path, I think Cursive is able to pick them up and provide completions. I wonder if you could add other JS sources to the class path and achieve the same result think_beret

p-himik 2024-12-07T19:11:41.090779Z

Doesn't seem like it. I doubt it has anything to do with classpath.

liebs 2024-12-07T19:20:03.537029Z

Maybe not the classpath alone, but Intellij has some built-in JS support I believe, and I wonder if that contributes as well. But idk, it's a shot in the dark.

p-himik 2024-12-07T19:27:50.866589Z

I don't think it does, unfortunately: https://github.com/cursive-ide/cursive/issues/1252

cfleming 2024-12-07T20:02:05.723809Z

I actually think 2025 will be the year for this! It does depend on the classpath, Cursive does actually parse all the goog stuff, and it has some support for built-in JS stuff, but that is fairly out of date. My plan is to base the support on TypeScript types, because parsing JS and figuring it out statically is nightmare fuel.

p-himik 2024-12-07T20:11:50.906809Z

Hmm. I made the above comment after adding a JS file to the classpath (tried ESM and CJS), including it in a CLJS file (both as "..." and as "/..." since it was available at src/) - no auto-completion whatsoever.

cfleming 2024-12-07T20:25:39.048799Z

Yes, the current support is mostly focused on goog modules, and handles those pretty well - back in the day, that was the most important things. But it's hard to support JS modules well statically. I think there is something there but I haven't kept it up to date and it never worked very well.

p-himik 2024-12-07T20:26:42.702509Z

Is it not possible to use whatever machinery IDEA already has for JS? After all, it somewhat works.

Takis_ 2024-12-07T20:39:53.752769Z

when this added we party! 2025 or when you manage to do it, thank you anyways

cfleming 2024-12-07T20:58:56.585449Z

> Is it not possible to use whatever machinery IDEA already has for JS? Unfortunately, this is harder than it sounds. All the JS support is predicated on the idea that you have a file of something that looks something like JS (e.g. TypeScript, CoffeeScript). For something like CLJS where it looks nothing like it, and the internal AST nodes don't extend the JS equivalents, it just doesn't work that well. They have recently updated their JS support with a new internal API though, so I will check with them if any of that has changed.

cfleming 2024-12-07T20:59:33.237959Z

Similarly for LSP support - if your file doesn't look like JS, you're out of luck.