This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2023-02-21
Channels
- # announcements (7)
- # babashka (16)
- # beginners (174)
- # biff (7)
- # calva (20)
- # cider (3)
- # clerk (6)
- # cljsrn (4)
- # clojure (98)
- # clojure-europe (57)
- # clojure-italy (3)
- # clojure-nl (1)
- # clojure-portugal (1)
- # clojure-spec (15)
- # clojure-uk (7)
- # code-reviews (3)
- # cursive (23)
- # data-science (1)
- # datomic (26)
- # dev-tooling (2)
- # emacs (5)
- # figwheel-main (4)
- # fulcro (3)
- # honeysql (20)
- # hyperfiddle (20)
- # malli (8)
- # membrane (31)
- # nextjournal (5)
- # pathom (1)
- # polylith (20)
- # re-frame (14)
- # reitit (8)
- # releases (2)
- # shadow-cljs (50)
- # specter (2)
- # sql (22)
- # xtdb (5)
@pez i've switched to calva, how do i configure the indentation of fulcro-style dom to not align vertically?
There is a setting to tell Calva where to look for cljfmt config file. This should be an edn file. See https://calva.io/formatting/#configuration
Is there a cljfmt rule that people use to do this?
From there it is about adding the indentation rules into that file. You seem to want [[:inner 0]]
for electric/dom
. Maybe something like
{:indents {hyperfiddle.electric/dom [[:inner 0]]}
:alias-map {"dom" "electric/dom"}}
If the config file is within the workspace Calva will hotreload it. So you can have a :experimentation
(or whatever) section in it and experiment within the file. (`tab` formats the current enclosing form).
Was the alias-map necessary? I'm guessing it might be because Calva only formats the minimal amount of text, so cljfmt doesn't have an ns-form...
hyperfiddle.electric-dom2/div [[:inner 0]]
didn't resolve the aliases
dom/div did resolve the aliases but i need the regex anyway
FYI: cljfmt and Cursive are quite incompatible around some default formatting so it can get a bit of a whitespace war with the require forms and some other cases. I've never quite figured it out. (And no-one else has either, for all I know.)
yeah we see that too
Made by @sr in Sweden, https://github.com/formicagreen/electric-clojure-painter/blob/master/src/app/canvas.cljc
so what would be the equivalent of mount/unmount in react like libraries… m/observe
looks like it is used like that, but I don’t really grok it yet
you can use these, i'll consider them for inclusion in the core ns
(defmacro on-mount [& body] `(new (m/observe #(do (% nil) ~@body (fn [])))))
(defmacro on-unmount [& body] `(new (m/observe #(do (% nil) (fn [] ~@body)))))
; usage
; note the body is ordinary Clojure, not Electric, so no transfers, side effects only
(on-mount (swap! !selected# select-if-first dom/node))
(on-unmount (swap! !selected# ?pass-on-to-first dom/node))
did you see this? https://github.com/hyperfiddle/electric/blob/master/src-docs/user/electric/e_object.cljc
(from a thread yesterday)