Fork me on GitHub
#reagent
<
2016-09-20
>
eyelidlessness00:09:43

@johanatan i think that's standard DOM behavior for mouseenter/`mouseleave`. i'm not sure if there's a better/more modern/more idiomatic way to proceed, but i'd be looking at js/document.elementFromPoint and dispatching another mouseenter if the element differs

johanatan02:09:58

Ahh good call. Thx!

johanatan02:09:44

Ya I figured it was std behavior-- just also figured there were a std solution (and yours sounds like it should be)

johanatan05:09:20

[of course you'd also need to send mouseleave to the previous element]

grav07:09:49

@reefersleep Re: my api proposal. I did a crude implementation and a pull request: https://github.com/reagent-project/reagent/pull/263

artur07:09:27

Someone said few days ago about upcoming feature to have npm packages available without cljsjs?

pesterhazy10:09:17

@artur I think this is the subject of an upcoming lambdaisland episode

pesterhazy10:09:15

I don't think it's quite there yet

pesterhazy10:09:38

(simply using npm modules using the Closure compiler I mean)

juhoteperi10:09:49

"es6-leftPad" method mentioned there is the one that is interesting

juhoteperi10:09:20

but Cljs compiler and possibly Closure need work before this will be usable

juhoteperi10:09:33

Module processing already works for simple cases, like one CommonJS module

juhoteperi10:09:30

But consuming complete npm projects, with dependencies to other npm projects needs work

pesterhazy10:09:15

the gains from this will be significant though

pesterhazy10:09:23

when it works

pesterhazy10:09:48

I'm assuming the Google Closure developers are keen to tap the NPM universe as well?

juhoteperi10:09:25

I guess so. They might have the support already, there just isn't much documentation.

juhoteperi10:09:14

Unfortunately module dependency resolving done by Closure is pretty much hardcoded for their own usecases

juhoteperi10:09:18

"Full module interop requires the 20160517 release or newer."

juhoteperi10:09:39

we are still on 20160315

juhoteperi10:09:16

Also "When using the grunt/gulp plugins, the root folder is the current working directory of the compiler when executed. Otherwise, the root directory is the root of the filesystem."

juhoteperi10:09:37

And in Cljsjs case the files would be on classpath, instead of file system

pesterhazy10:09:16

well it would be cool to use NPM directly, without going through cljsjs

juhoteperi10:09:30

we need deps.cljs anyway

juhoteperi10:09:48

and I don't see what's cool about npm, I would avoid that nearly at any cost

pesterhazy10:09:17

I'm definitely not a fan

pesterhazy10:09:38

but it has 1000s of packages available

pesterhazy10:09:59

at least as an intermediate step, before pushing libs to cljsjs, it would be great to be able to access those

juhoteperi10:09:19

With module processing and extern inference Cljsjs will be different, there won't be need for any manual packaging

pesterhazy10:09:26

what is deps.cljs needed for?

pesterhazy10:09:51

for the :foreign-libs key?

juhoteperi10:09:56

to define that the file needs to be processed as CommonJS library

juhoteperi10:09:16

{:foreign-libs [{:file "..." :provides ["react"] :module-type "commonjs"]}]}

pesterhazy10:09:48

do we need that for each dependency of the library too?

pesterhazy10:09:58

many libraries have dozens of dependencies

juhoteperi10:09:25

I'm not sure, but I think at least for any file you want to depend on from Cljs

pesterhazy10:09:41

right, that would only be the entry point library then

juhoteperi10:09:44

But I have already tested generating these deps.cljs automatically from npm packages

juhoteperi10:09:08

package.json + boot task => n jar files with dependencies to each other and complete deps.cljs files

plexus10:09:52

There are a couple things that are still big blockers for supporting npm modules

plexus10:09:38

Many packages use webpack or rollup, and their umd-ish output is not understood by closure

plexus10:09:06

If the npm package also contains uncompiled sources then that might be an option though, also something that could be automated, eg detect rollup config and use the same es6 file as entry point

plexus10:09:01

But even with all that, many libs will not conform to the rules of closure, and so even if their packages are understood the code will break in advanced optimization

juhoteperi10:09:35

Hmm, in what case advanced compilation will break stuff?

juhoteperi10:09:13

One case I think is problematic is when module adds stuff to module.exports in a loop

plexus10:09:52

For instance, check out the es6-d3 branch in that repo

plexus10:09:40

Doing an advanced compilation results in tons of warnings, and running it shows there are things that have been renamed in a way that breaks the code

plexus10:09:56

"unsafe use of this" is a common warning

pesterhazy10:09:05

can't we exclude those (foreign) libs from closure compilation?

plexus10:09:33

If you keep using externs, that's basically what we do now

plexus10:09:07

Currently any foreign libs just get concatenated into the final artifact unchanged

plexus10:09:07

Well yeah, but that's really a last resort IMO

juhoteperi10:09:21

We might anyway get extern inference in future

plexus10:09:37

Then you might as well write an externs file manually

pesterhazy10:09:45

well I see it more as a "works for now" solution; once that's done you can improve on that

pesterhazy10:09:01

but just getting npm modules to work somehow would be cool

pesterhazy10:09:13

because it enables something you weren't able to do before

plexus10:09:36

I agree, and it could make cljs much more attractive to js devs

yury.solovyov10:09:03

I wonder if it is possible to mix optimization modes - pass cjls to advanced and npm to simple mode

pesterhazy10:09:37

I just ran into this because I wanted to include https://github.com/github/fetch in planck to experiment with the new API

pesterhazy10:09:00

the fact that this uses commonjs is another barrier

plexus10:09:08

Commonjs is also supported by closure, but many libs that are "commonjs" really have this funky module type checking usually referred to as UMD

plexus10:09:51

Closure also supports UMD, in theory. In practice everyone has their own variant and so it won't detect that properly

pesterhazy10:09:26

maybe we can get around that using some kind of shim/wrapper?

plexus10:09:57

If closure could get support for the format that rollup and webpack spit out that would be massive, but I'm skeptical if someone will get that in

plexus10:09:13

A shim would work if it was a runtime concern but this is compile time. What would work is a preprocessing step that rewrites the code so closure's static analysis knows how to deal with it

pesterhazy11:09:46

great that you're looking into this btw

plexus11:09:03

It's funny, you bang your head against the wall for a week and next thing you know you're kind of the expert ;)

plexus11:09:24

I might even make this a freebie episode because that information just isn't comprehensively available elsewhere, and it's really important for the ecosystem to be able to develop

andre11:09:47

hi guys, how i can watch reagent component state? i'm trying apply reagent/state to my component but it always returns nil

andre11:09:35

i'm trying to apply these functions to the object returned by reagent/render

pesterhazy12:09:24

sorry to reply to a question with a question, why are you using component state?

pesterhazy12:09:49

usually it's better to use a ratom or props instead

andre13:09:10

i'm developing a tool for monitoring reagent components, so i need information about their state, mounted they or not

andre13:09:57

so the great thing will be if i can get tree of mounted components

andre13:09:25

or listen global events. componen did mount

pesterhazy14:09:28

that's probably more of a react issue then?

pesterhazy14:09:17

as fas as I know, reagent.core/state works for the current component primarily (in render and lifecycle methods)

andre15:09:10

ok, thank you