This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2016-02-26
Channels
- # aatree (1)
- # admin-announcements (1)
- # beginners (84)
- # boot (239)
- # braid-chat (5)
- # braveandtrue (20)
- # cider (42)
- # cljsjs (4)
- # cljsrn (31)
- # clojars (18)
- # clojure (101)
- # clojure-austin (1)
- # clojure-gamedev (4)
- # clojure-madison (2)
- # clojure-poland (30)
- # clojure-russia (37)
- # clojurescript (95)
- # core-async (7)
- # cryogen (1)
- # css (3)
- # cursive (14)
- # datomic (8)
- # devcards (7)
- # dirac (2)
- # editors (2)
- # emacs (2)
- # funcool (1)
- # hoplon (15)
- # immutant (30)
- # ldnclj (37)
- # lein-figwheel (6)
- # leiningen (8)
- # luminus (5)
- # mount (1)
- # off-topic (59)
- # om (325)
- # om-next (7)
- # onyx (95)
- # parinfer (162)
- # proton (1)
- # re-frame (4)
- # reagent (23)
- # slack-help (4)
- # yada (43)
ah, I see. so the cheatsheet is all CLJS, then? we have CLJ/CLJS in an uberjar that gets deployed and my issue is mostly one of timing (how to get in before jarring but after cljsbuild).
I've got it mostly resolved now, but am running into unexpected issues with accessing project resources from a leinigen plugin
yes, the "build" of the cheatsheet consists of static content. nothing dynamic
Anyone use this cljsjs package? https://clojars.org/cljsjs/fixed-data-table
How do I import the style sheets?
Or do I have to copy and paste them manually?
currentoor: I used it in JS. It was actually really bad for performance, we had about 10 columns, and it is optimized for rows. Additionally it did not support touch. That was the 0.5 version and I think they had a rewrite though.
Had 3 fps on my mbp when scrolling horizontally. Eeks. We ended up using react-infinite which performs well for our usecase. But I guess we only have 250 rows or so.
also @bbss that sounds like my usecase as well, how did you include it in the project?
i noticed it’s not a cljsjs package
oh i see
so i’d probably have to resort to a script tag?
but if you are looking for instructions on how to use external libs I think they can be found on the cljsjs repo
yeah script tag can work but I think you won't be able to use the closure compiler unless you provide the externs
right
by any chance have you use this? https://github.com/adazzle/react-data-grid
@currentoor: One solution is to use Less/Sass compiler which can read imports from classpath: https://github.com/cljsjs/packages/wiki/Non-JS-Assets#importing-using-lesssass-compiler
@juhoteperi: thanks I’ll check it out.
well that worked splendidly!
hey all, i am trying to use a react component (specifically react-dropzone: https://github.com/okonet/react-dropzone) but i’m getting an error: A valid ReactComponent must be returned. i’m using reagent/adapt-react-class to transform the react object into something i can use in reagent like this:
(def Dropzone (js/require "react-dropzone"))
(def dz (reagent/adapt-react-class Dropzone))
(defn build-dropzone []
[:div "test hello"
[dz {:on-drop #(.log js/console “dropzone dropped”)} [:div “upload"]])
test-zone.core=> (println Dropzone)
#object[Dropzone "function Dropzone(props, context) {
_classCallCheck(this, Dropzone);
_React$Component.call(this, props, context);
this.onClick = this.onClick.bind(this);
this.onDragEnter = this.onDragEnter.bind(this);
this.onDragLeave = this.onDragLeave.bind(this);
this.onDragOver = this.onDragOver.bind(this);
this.onDrop = this.onDrop.bind(this);
this.state = {
isDragActive: false
};
}"]
nil
What do people use to create simple line graphs in ClojureScript?
@doglooksgood: you need ^:export
the function
goog.exportSymbol(….)
https://closure-library.googlecode.com/git-history/docs/namespace_goog.html
speaking of which :export
should really take strings along with true
, fixing that in master
String for aliases?
I’m new to both Clojure and ClojureScript, so please bear with me if I’m having trouble even asking this question:
I’m using Secretary for routing and it has a macro defroute
that takes a symbol argument (amongst others). defroute
creates a function with the same name as the symbol. I would like to use the macro inside a loop and make it create named functions for each item I am looping over. But nothing I try works.
The macro is defined like so:
(defmacro ^{:arglists '([name? route destruct & body])}
defroute
"Add a route to the dispatcher."
[route destruct & body]
(let [[fn-name route destruct body] (if (symbol? route)
[route destruct (first body) (rest body)]
[nil route destruct body])
fn-spec `([& args#]
(apply secretary.core/render-route* ~route args#))
fn-body (if fn-name
(concat (list 'defn fn-name) fn-spec)
(cons 'fn fn-spec))]
(when-not ((some-fn map? vector?) destruct)
(throw (IllegalArgumentException. (str "defroute bindings must be a map or vector, given " (pr-str destruct)))))
`(let [action# (fn [params#]
(cond
(map? params#)
(let [~(if (vector? destruct)
{:keys destruct}
destruct) params#]
~@body)
(vector? params#)
(let [~destruct params#]
~@body)))]
(secretary.core/add-route! ~route action#)
~fn-body)))
@pez: Not sure how to do that, but it seems like it's a lot of work (especially if you are new to Clojure) - is there a specific reason you need to do that? It might be worth looking at some of the other routing libraries to see if one of them matches your needs a bit better - there's a good list under "HTTP Routing" on http://www.clojure-toolbox.com/
@shaun-mahood: thanks! Yes, I have specific reasons for this need (even if I might have tricked myself into having these reasons). That toolbox link is totally awesome. I’m still curious into how I would be able to run that macro in a loop, but I will also have a good look at silk
and bidi
. The latter actually seems to “think” the same way as I do.
This: Bi-directional URI dispatch. Like Compojure, but when you want to go both ways. If you are serving REST resources, you should be providing links to other resources, and without full support for forming URIs from handlers your code will become coupled with your routing. In short, hard-coded URIs will eventually break.
@pez: Yeah, it really makes a difference (especially when starting out) to find libraries that work the same way I want them to - I spent a lot of my first time with Clojure trying to bend things in ways they weren't meant to go and it wasn't pretty.
Yes. In this case the reason I want to be able to bend secretary
is that I want to use data structures for my routes. So I created a data structure and then need to wrap Secretary’s DSL in a loop… Then reading just the first paragraphs of the bidi
pitch: In bidi, routes are data structures, there are no macros here. Generally speaking, data structures are to be preferred over code structures. When routes are defined in a data structure there are numerous advantages - they can be read in from a configuration file, generated, computed, transformed by functions and introspected - all things which macro-based DSLs make harder.
I found several libs: https://github.com/exupero/vdom and https://clojars.org/cljsjs/virtual-dom
Which one would you recommend? How do I make the VDom API accessible on the page? No I need to use externs or not I wonder?
@pez if you keep going down that route I’d like to give a shameless plug for https://github.com/venantius/accountant 😛
or rather, higher level navigation abstraction on top of whatever you want underneath it
@venantius: You should get that onto clojure-toolbox
@shaun-mahood: I just submitted a PR to do that
I haven’t been keeping my projects up to date with the toolbox for a while so I just had to submit 4 PRs, lol
@venantius: Indeed, SPA it is. 😃 My colleague actually tried to sell Accountant on me, but I wasn’t ready. Will look into that as well. Though, I got the impression that it came with a HTML5 requirement, which I might not be ready to accept.
it does. but these days the HTML5 expectation should already cover a pretty significant majority
I wanted to use something like https://github.com/dubiousdavid/dominator and https://github.com/jamesmacaulay/zelkova
@kmandrup: cljsjs/virtual-dom is just a foreign lib for virtual-dom. vdom is more or less just some utilities for it in Clojurescript.
I honestly don't understand the obsession with React... feels like overkill in some cases, when all you want is the virtual dom functionality
Vtree, a realtime tree diffing alg. https://github.com/Matt-Esch/virtual-dom/blob/master/vtree/README.md
@kmandrup: I’m new to the whole virtual dom thing and found it via reagent
and thus found React. When would you “just want” virtual dom functionality?
Look at ELM, works fine just with signals and virtual dom... all the new React design patterns are inspired by the Elm architecture
@venantius: I will ponder what a HTML5 requirement would mean for our business. I think we might have a slice of the user base where IE < 10 is a bit too common.
I’d be very interested in having someone submit a PR to accountant to provide SPA event handling in a non-HTML5 environment
@kmandrup agreed! IIRC, cljsjs/virtual-dom is a wrapper on the matt-esch library. however, the majority of the community uses solutions that wrap react. reagent is nice, as far as those solutions go.
in js i always used https://www.npmjs.com/package/main-loop
Following up on my questions about fingerpinting static assets yesterday, I published a leiningen plugin that's aimed at playing nice with lein-cljsbuild
and to a lesser extent other build systems that emit JSON manifests (we use gulp-rev
too), you can check it out here: https://clojars.org/lein-buster
and by published, I mean just published, as evidenced by my awesome download stats there 😄
@pez keechma has a very simple router that only translates data (map -> url and url -> map) http://keechma.com/api/keechma.router.html
Hey Bruce, let's say I am creating a library, replumb for instance, and I don't want to include in my jar the resources
folder...what I do is :resource-paths []
in my project.clj
root. But now figwhell does not see it anymore. An idea would be to add :resources-paths
to figwheel. Summoning @bhauman 😄
(maybe there is another more obvious solution but I can't see it now)
@richiardiandrea: there's a jar-exclusions
in leiningen
:jar-exclusions [#"resources"]
should do it
yeah, did not know
we'll see but the figwheel patch has already been submitted 😄 https://github.com/bhauman/lein-figwheel/issues/349
¯\(ツ)/¯