This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-01-05
Channels
- # aleph (1)
- # announcements (18)
- # babashka (145)
- # beginners (70)
- # calva (34)
- # cider (3)
- # clj-kondo (98)
- # cljdoc (5)
- # cljs-dev (13)
- # clojure (134)
- # clojure-europe (57)
- # clojure-nl (4)
- # clojure-uk (4)
- # clojurescript (40)
- # code-reviews (3)
- # conjure (1)
- # core-async (5)
- # data-science (3)
- # datomic (8)
- # fulcro (9)
- # google-cloud (2)
- # inf-clojure (9)
- # jobs (1)
- # lsp (9)
- # malli (25)
- # polylith (4)
- # reitit (4)
- # releases (2)
- # remote-jobs (3)
- # rewrite-clj (8)
- # shadow-cljs (34)
- # tools-build (1)
- # tools-deps (67)
Hello. How can I access a custom value, defined in :compiler-options
inside of (defmacro ...)
? I got the tip, that it can be accessed througt &env
, but I can not find it there. And I can not find any documentation on this.
I lay out in some detail here a problem I had getting a dependency automatically pulled from Clojars. https://clojurians.slack.com/archives/C6N245JGG/p1641343140421100 A manual clojure -P
did the trick, but is there anything like leiningen
s ability to pull dependencies automagically with deps?
Is there a trick to generate externs when the library is written in typescript? I tried http://jmmk.github.io/javascript-externs-generator/, but most of the externs are missing when comparing to the original "vanilla" JS version.
Maybe compile the typescript into JavaScript and then run the generator on the dist folder?
I'm using the distribution JS https://unpkg.com/[email protected]/dist/browser/oidc-client-ts.js
don't use externs generators. you only need externs for the stuff you actually use and for that its better to rely on externs inference and use some ^js
hints where necessary
externs generators generate way too much typically. no point in generating 1000 externs if you only use 2 things that would actually need them
Alas, it's for packaging in cljsjs, so I need to provide the externs 😕
that is not true. if you write a library and properly typehint where needed your own library code then no further externs should be needed at all
oh wait .. ok this is only JS code no actual CLJS code? then externs would indeed be required
Yes it's a JS library
@U0ERZQ1K2 did you ever figure this out? I’m trying to do the same thing for the same library. I did find this generator https://jmmk.github.io/javascript-externs-generator/ but I’m not sure if it will work
You might have missed it, but a few lines above I mentioned trying this exact generator 😉
You can use my fork until it's processed into cljsjs https://github.com/cljsjs/packages/pull/2221
thanks @U0ERZQ1K2 I’m also looking into using https://github.com/jgrodziski/keycloak-clojure with our python backend which uses Flask which uses Authlib OIDC.
is there a way to tell if some data is a javascript entity (instead of a clojure entity), i.e. an object or an array vs a vector or a keyword?
You can check for this property https://github.com/clojure/clojurescript/blob/199264152d087e10254a6e96fa70165308ae8261/src/main/clojure/cljs/core.cljc#L1784 (`cljs$lang$type` )
And if you need to check just for plain JS objects and arrays, there are array?
and object?
.
I believe coll?
should cover all cases of the built-in Clojure(Script) data structures, please correct me if I'm wrong.
That being said, you mentioned keywords as well. Obviously coll?
for a keyword would be false.
(coll? :a)
=> falsewhat is the meaning of :<>
and :>
in hiccup vectors? (as in this https://github.com/dakra/mui-templates/blob/master/src/mui_templates/views/sign_in.cljs)
Documented here: https://github.com/reagent-project/reagent/blob/master/doc/ReactFeatures.md
What is the simplest way/library to do color gradients given a value from say, 0-100? I don’t need to do full-on dataviz like maps or charts—literally just coloring table cells. (Sorry if this isn’t a CLJS-specific question per se; I’m doing front-end for the first time in years)
If you’d like to avoid pulling in a dependency, the Google closure library has https://google.github.io/closure-library/api/goog.color.html
(require '[goog.color :as gcolor])
(-> "#0073e6" gcolor/hexToRgb (gcolor/darken 0.5) gcolor/rgbArrayToHex)
=> "#003a73"
I’ve created gradients like this
;; Zone colors
(def base-color "#0073e6")
(def zone-colors
(into {}
(for [n (range 1 (inc 10))]
[(keyword (str "zone" n))
(-> base-color
gcolor/hexToRgb
(gcolor/lighten (/ n 10))
gcolor/rgbArrayToHex)])))
@U6N4HSMFW Got the color scaling working with Google Closure and it’s pretty great! Thanks again