These are chat archives for chandu0101/scalajs-react-components

18th
Dec 2015
Øyvind Raddum Berg
@oyvindberg
Dec 18 2015 00:00
@codingismy11to7 hey i had some time to check out MuiPopover that you commented on up there
the type for children is indeed wrong, fixed that now in chandu0101/scalajs-react-components@a50ec6b
and i dont know about onRequestClose - seems to be firing alright here on mui v0.13.4
Steven Scott
@codingismy11to7
Dec 18 2015 18:05
I wrote a macro that auto-generates materialui svg icons and then wrote a script to generate the list of icons from material-ui/lib/svg-icons/index.js. it makes the compile take a lot longer, but it’d be really handy to provide them
interested in a PR?
Øyvind Raddum Berg
@oyvindberg
Dec 18 2015 18:09
Yeah, that would be cool - i have been wanting to do that
Steven Scott
@codingismy11to7
Dec 18 2015 18:10
thing is, when you create your js bundle you have to put in a window.mui.SvgIcons = require('material-ui/lib/svg-icons/index’); line, which isn’t too bad
but the other thing is that it makes the compile take a LONG time
but…it is REALLY useful.
waiting on the first compile to finish, i assume subsequent compiles will be fast
also…my first macro! and it worked!
Øyvind Raddum Berg
@oyvindberg
Dec 18 2015 18:16
We could generate source code instead, we'll see how slow it is
Also congrats - its a rite of passage
Steven Scott
@codingismy11to7
Dec 18 2015 18:17
the other option would be that the end users make their own
object IconsIWant {
  @svgIcon(“ActionSettings”) case class ActionSettings()
  @svgIcon(“NavigationMoreVert”) case class NavigationMoreVert()
}
so the end users’ compile would slow down instead of the library’s compile slowing down. I’d rather have the library compile be slow than making my compile any slower, but, there’s the option
Steven Scott
@codingismy11to7
Dec 18 2015 18:24
they’d also have to enable the macro paradise compiler plugin
Otto Chrons
@ochrons
Dec 18 2015 18:24
why macro, instead of some piece of generator code in the build file?
Steven Scott
@codingismy11to7
Dec 18 2015 18:26
because you have to have npm download material ui before I can scan the file to get the existing icons
so I made the macro that turns @svgIcon(“ActionSettings”) case class ActionSettings() into all the boilerplate, then I wrote a script that i ran manually after doing npm install that generated an object with all the icons, then checked that generated file in
the idea being that it never has to auto-generate, but if material-ui makes a new release with more icons, we can re-run the generator
wow, that really increased the size of the jar. also the compile took 24 minutes on my laptop. i’ll try an approach without macros and see how long that takes and the resulting jar size
Øyvind Raddum Berg
@oyvindberg
Dec 18 2015 18:29
Depends on how slow - we only really need a list of identifiers the icons are imported as - shouldnt be any need to make things that slow
Steven Scott
@codingismy11to7
Dec 18 2015 18:51
the generated version is still slow. maybe i’ll just publish a library that depends on this library, using whichever method comes out to be faster
the problem is basically (i think) that it generates close to 1000 classes
Otto Chrons
@ochrons
Dec 18 2015 19:05
do they get DCEed in fullOpt?
Steven Scott
@codingismy11to7
Dec 18 2015 19:06
i assume so
Steven Scott
@codingismy11to7
Dec 18 2015 19:53
non-macro version drops from 24 minutes to 17. i’m just gonna publish a new library
Roberto Leibman
@rleibman
Dec 18 2015 20:18
Hey @elacin have you tried using SvgIcon?
Steven Scott
@codingismy11to7
Dec 18 2015 20:19
i sure have
Øyvind Raddum Berg
@oyvindberg
Dec 18 2015 20:19
I havent, so no real opinions here
Roberto Leibman
@rleibman
Dec 18 2015 20:20
I'm actually trying to use MuiIconMenu as here http://www.material-ui.com/#/components/icon-menus and I really like that config... it uses SvgIcon
Steven Scott
@codingismy11to7
Dec 18 2015 20:20
i’ve done that
Roberto Leibman
@rleibman
Dec 18 2015 20:20
What do you pass to MuiIconMenu(iconButtonElement = MuiIconButton()(MuiSvgIcon()(whatgoeshere))
Steven Scott
@codingismy11to7
Dec 18 2015 20:21
you’re in luck, i’m right now publishing a library with all the material ui svg icons to maven central
                MuiIconMenu(iconButtonElement = MuiIconButton(tooltip = M("common.options"), onTouchTap = onGearClick)(MuiSvgIcons.ActionSettings()()))(
                  MuiMenuItem(checked = s.showSelected, primaryText = M("message.form.only_show_selected"), onClick = onShowSelected)(),
                  MuiMenuItem(checked = s.showUnselected, primaryText = M("message.form.only_show_unselected"), onClick = onShowUnselected)()
                )
Roberto Leibman
@rleibman
Dec 18 2015 20:23
Sweet!
Steven Scott
@codingismy11to7
Dec 18 2015 20:25
although, don’t try to use the checked = on menu items, the style is all jacked
was trying to work around that this morning before i got onto the icon tangent
Roberto Leibman
@rleibman
Dec 18 2015 20:31
How far along are you to publishing to mvn?
Steven Scott
@codingismy11to7
Dec 18 2015 20:31
it’s been compiling for 12 minutes
should be about 5 more
Roberto Leibman
@rleibman
Dec 18 2015 20:32
ok... looking forward to it. That's a slow compile!
Steven Scott
@codingismy11to7
Dec 18 2015 20:32
there’s almost 1000 icons
This message was deleted
Steven Scott
@codingismy11to7
Dec 18 2015 20:37
(btw @rleibman 0.1.0-SNAPSHOT is already pushed to Sonatype snapshots so you can put that version in for the moment)
Roberto Leibman
@rleibman
Dec 18 2015 21:05
@codingismy11to7, I get a runtime error with code similar to the one you pasted here.
TypeError: Cannot read property 'ActionSettings' of undefined$c_jl_JSConsoleBasedPrintStream.doWriteLinep4TV @ System.scala:302$c_jl_JSConsoleBasedPrintStream.printStringp4TV @ System.scala:275$c_Ljava_io_PrintStream.printlnTV @ System.scala:264(anonymous function) @ Throwables.scala:48$c_jl_Throwable.printStackTraceLjava_io_PrintStreamV @ AnonFunctions.scala:15$c_sjs_concurrent_QueueExecutionContext$.reportFailurejl_ThrowableV @ Throwables.scala:45$c_s_concurrent_impl_CallbackRunnable.runV @ Promise.scala:32(anonymous function) @ QueueExecutionContext.scala:12$c_sjsr_AnonFunction0.applyO @ AnonFunctions.scala:10(anonymous function) @ package.scala:33
System.scala:302 at com.codemettle.scalajs.react.materialui.MuiSvgIcons$ActionSettings.apply(https://tarvalon.gluware.com:8083/js/pachinko-web-opt.js:48113:61)$c_jl_JSConsoleBasedPrintStream.doWriteLine__p4__T__V @ System.scala:302$c_jl_JSConsoleBasedPrintStream.printStringp4TV @ System.scala:275$c_Ljava_io_PrintStream.printlnTV @ System.scala:264(anonymous function) @ Throwables.scala:48$c_jl_Throwable.printStackTraceLjava_io_PrintStreamV @ AnonFunctions.scala:15$c_sjs_concurrent_QueueExecutionContext$.reportFailurejl_ThrowableV @ Throwables.scala:45$c_s_concurrent_impl_CallbackRunnable.runV @ Promise.scala:32(anonymous function) @ QueueExecutionContext.scala:12$c_sjsr_AnonFunction0.applyO @ AnonFunctions.scala:10(anonymous function) @ package.scala:33
System.scala:302 at pages.EnvironmentsPage$$anonfun$43.displayActions$1(https://tarvalon.gluware.com:8083/js/pachinko-web-opt.js:51870:307)$c_jl_JSConsoleBasedPrintStream.doWriteLine
p4TV @ System.scala:302$c_jl_JSConsoleBasedPrintStream.printStringp4TV @ System.scala:275$c_Ljava_io_PrintStream.printlnTV @ System.scala:264(anonymous function) @ Throwables.scala:48$c_jl_Throwable.printStackTraceLjava_io_PrintStreamV @ AnonFunctions.scala:15$c_sjs_concurrent_QueueExecutionContext$.reportFailurejl_ThrowableV @ Throwables.scala:45$c_s_concurrent_impl_CallbackRunnable.runV @ Promise.scala:32(anonymous function) @ QueueExecutionContext.scala:12$c_sjsr_AnonFunction0.apply__O @ AnonFunctions.scala:10(anonymous function) @ package.scala:33
Steven Scott
@codingismy11to7
Dec 18 2015 21:05
the SvgIcons aren’t on the window.mui object by default
so you have to package them to be on there
Roberto Leibman
@rleibman
Dec 18 2015 21:06
Yeah, I added a bundle and put it in, it should be there, b
Steven Scott
@codingismy11to7
Dec 18 2015 21:07
well you can check in the js console, if you type mui.SvgIcons it should exist
because that error is basically saying that property doesn’t exist
Roberto Leibman
@rleibman
Dec 18 2015 21:08
Yeah, that was my guess too.
Steven Scott
@codingismy11to7
Dec 18 2015 21:10
https://github.com/CodeMettle/scalajs-react-components-webjar is what i’m using to build my webjar
Roberto Leibman
@rleibman
Dec 18 2015 21:11
I was using webpack directly, it had
worked so far.
Steven Scott
@codingismy11to7
Dec 18 2015 21:12
let me see the modification you made
Roberto Leibman
@rleibman
Dec 18 2015 21:12
I added
window.mui.SvgIcons = require('material-ui/lib/svg-icons/index');
to a file named svgicons.js
Then I added a line to webpack.config.js including that js.
Steven Scott
@codingismy11to7
Dec 18 2015 21:13
that seems right, but you may want to put it in the same file as the other mui stuff just to give that a try, which is what i’m doing
Roberto Leibman
@rleibman
Dec 18 2015 21:13
Ah, let me try that.
Mhhh... I think I see why it doesn't work as I expect, it used to give me a single mainpage-bundle, but now it's split up. Let me try a few more things.