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

14th
Jun 2017
Roberto Leibman
@rleibman
Jun 14 2017 15:24
I think I got a handle on it this morning
Øyvind Raddum Berg
@oyvindberg
Jun 14 2017 15:36
yeah sure i can help out with that
also, now that i read further back, wonderful! will have a look later today
Øyvind Raddum Berg
@oyvindberg
Jun 14 2017 15:42
also bear in mind that the importer is written during a few late nights, so if something there doesnt make sense to you, it might mean that it doesnt make sense at all :)
Øyvind Raddum Berg
@oyvindberg
Jun 14 2017 16:04
by the way, that visitor code you posted seems ok to me, without having compared it to an actual tree
Roberto Leibman
@rleibman
Jun 14 2017 17:33
Yeah, I was missing the part that split the name from the importer, I'm making tons of progress now, I'm trying to figure out why it's not picking up a comment as a comment and it thinks it's a property.
Øyvind Raddum Berg
@oyvindberg
Jun 14 2017 19:11
oooh yes, the comment parsing code :D
im sure there are improvements to be made
Roberto Leibman
@rleibman
Jun 14 2017 22:16
I checked in my latest code, down to < 300 compiler errors, a bunch of those have to do with ElementalUI, some components take children but don't have a children field, so the constructors don't reflect children, I need to see how to manage that.
Roberto Leibman
@rleibman
Jun 14 2017 22:24
Another problem I'm having is that the elemental Button class does not declare it's methods, I think what's going on is that it's "inheriting" the methods of button, but since they're not declared the generator is not creating them either.
Øyvind Raddum Berg
@oyvindberg
Jun 14 2017 22:35
impressive progress there!
Roberto Leibman
@rleibman
Jun 14 2017 22:36
It should not be this hard!
Øyvind Raddum Berg
@oyvindberg
Jun 14 2017 22:36
agreed
but hopefully scalajs-react wont change much more, and if we manage to generalise the importer it should be easier going forward
Roberto Leibman
@rleibman
Jun 14 2017 22:37
I agree.
Øyvind Raddum Berg
@oyvindberg
Jun 14 2017 22:37
about children, that is something that i have looked at before
it would probably be possible to figure out by looking at the render method, but probably difficult in the general case
i would be alright with defaulting all components to having children
also if we are missing a method or two, its hardly critical
if somebody desperately needs that method, its easy enough to create a wrapper trait and cast to it in client code
another thing that is irritating, and which would vaguely be possible to understand from render, is which component or element receives the "other" props
that is manually annotated for now
Roberto Leibman
@rleibman
Jun 14 2017 22:41
Right, so if I'm understanding what you're saying and my reading of the button class (for example: https://github.com/elementalui/elemental/blob/master/src/components/Button.js), then it passes the props it doesn't use to the underlying button.
Øyvind Raddum Berg
@oyvindberg
Jun 14 2017 22:41
exactly
  val components: Seq[ComponentDef] =
    Seq(
      ComponentDef(CompName("AppBar"), Option(Paper)),
      ComponentDef(CompName("AutoComplete"), Some(TextField)),
      ComponentDef(CompName("Avatar"), multipleChildren = false),
....
there its annotated whether a component has more than one child, and which component it "inherits" from
Roberto Leibman
@rleibman
Jun 14 2017 22:42
Well, it's kind of important, since you can't do much with a button if you don't have OnClick.
Øyvind Raddum Berg
@oyvindberg
Jun 14 2017 22:42
yes exactly
Roberto Leibman
@rleibman
Jun 14 2017 22:42
Ah, that's probably what I want!
Øyvind Raddum Berg
@oyvindberg
Jun 14 2017 22:43
so that multipleChildren can probably be changed to say "no children"
im not sure if we can express having one child anymore
Roberto Leibman
@rleibman
Jun 14 2017 22:44
We can, but it's not as useful, one is a degerenate case of many.
Øyvind Raddum Berg
@oyvindberg
Jun 14 2017 22:44
yes, i wouldnt be sad to see that go