Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
  • 02:52
    emugel commented #90
  • 02:13
    kevinresol commented #92
  • 01:54
    emugel commented #92
  • 01:46
    emugel commented #92
  • 01:42
    emugel commented #92
  • 01:42
    emugel commented #92
  • 01:42
    emugel commented #92
  • 01:32
    kevinresol commented #92
  • 01:31
    emugel commented #92
  • 01:31
    emugel commented #92
  • 01:29
    emugel commented #92
  • 01:29
    emugel commented #92
  • 01:19
    emugel commented #92
  • 01:15
    emugel commented #92
  • 01:13
    emugel commented #92
  • 01:10
    emugel edited #92
  • 01:09
    emugel commented #92
  • Nov 30 16:01
    back2dos commented #92
  • Nov 30 15:36
    emugel edited #92
  • Nov 30 15:34
    emugel edited #92
Kevin Leung
@kevinresol
But tbh I didn't do very complex stuff with it. I'm using it to display some 3D models plus some basic camera control.
Rudy Ges
@kLabz
If material-ui users have an opinion about this: kLabz/haxe-material-ui#21 please share (there if possible?)
(cross-posting this here too since I think @kevinresol at least uses/used material-ui but isn't in haxe-react gitter if I'm not mistaking)
Rudy Ges
@kLabz
Welp, gave up on hxcs and hxcpp targets for now x)
Found https://nodegui.org/ which has react wrappers and uh seems to work fine so far (will start writing proper externs and porting my app)
Should work fine with coconut too, if some of you want to write "native" (Qt) applications using coconut and js target (nodejs bindings for qt)
Kevin Leung
@kevinresol
awesome
does it run a v8 to script the native Qt?
Rudy Ges
@kLabz
Seems like it yeah
Should be fast enough, it's no electron x)
Rudy Ges
@kLabz
Not covering qtquick (so so material design etc) nor mobile atm though
Rudy Ges
@kLabz
Any idea why I get "Markup literals must be processed by a macro" when I add -lib coconut.react-dom to a react project? (that uses -D react-auto-jsx to wrap all @:markup expr in render in a jsx() call)
Also, should I use View instead of ReactComponent pretty much everywhere? (except externs)
Juraj Kirchheim
@back2dos
not necessarily ... coconut views are a bit heavier (particularly memory wise), but are pretty good at avoiding rerenders
as for the error, no idea ... please raise an issue in coconut.react-core
But yeah, had nodegui on my radar for a while now: MVCoconut/coconut.ui#83 ^^
Rudy Ges
@kLabz
It works nicely so far :P
Uldis Baurovskis
@hansagames

Hi, struggling a bit with coconut.ui for feathersui,
there are lot of object properties in feather framework, for example, layout, at the moment I create them as properties and then set their values in render method that is not very convient, but I could not find any other way. Maybe someone have better ideas how to handle such complex propreties in hxx?
Example code:

class TestView extends View {
    final verticalLayout = new VerticalLayout();
    public function render() {
        verticalLayout.gap = 10.0;
        return hxx('
            <LayoutGroup layout=${verticalLayout}>
                <TranslatedText
                    textId="game_play_content_1_text"
                    textCollection="rules"
                    style="rulesText"
                />
            </LayoutGroup>
        ');
    }
}

In react I add such stuff in constructor but as I understand coconut view can not have custom constructor

Scott
@scottPlusPlus
Is there a way to check I have haxeshim installed correctly? Anything I need to do other than
yarn global add haxeshim
Clark Jones
@clarkjones
Hi @kevinresol, Are there any known issues with vdom and storybook? Not sure what I'm missing here but I can't seem to get my components to display using storybook-coconut. The story nav is there and render functions are being called but not actually displaying. I had this working at one point with an older version of haxe and coconut though
Kevin Leung
@kevinresol
not sure... I only used react recently...
5 replies
Emugel
@emugel
say instead of a @:computed variable, one uses a function f(x:X):Promised<Y> (because computed properties can't have parameters). Would returning Promised<Y>provide automatic updates in the views? Or should one instead return Observable then bind it?
Kevin Leung
@kevinresol
you can keep track of the parameter and thus the result
@:editable var param:X;
@:computed var result:Promised<Y> = f(param);
but usually you don't want to produce Promised manually
but produce them via @:loaded instead
@:editable var param:X;
@:attr f:X->Promise<Y>;
@:loaded var result:Y = f(param);
Emugel
@emugel
right but then you need as many @:editable and @:computed entries as your variable X can take. So for 3 values you end up with 6 lines
or same in the second example. If you loaded a table, and you want to select a cell from this table, then you have to use a function
Kevin Leung
@kevinresol
you need to keep track of the selection somewhere anyway
I mean you will need a @:editable or @:observable for the cell address anyway
Emugel
@emugel
in my case they are not editable, it is simply like multiplication of tables based on rates
and i am wondering if it is ok to use Observable, or if i missed something
Kevin Leung
@kevinresol
In my experience, normally I don't need to use Observable manually
Emugel
@emugel
I will try your approach, one cell, one view. It's probably the simplest
Kevin Leung
@kevinresol
@back2dos is it possible to create a custom/adhoc reconciler+render in coconut?
like https://github.com/pmndrs/react-three-fiber which has a <Canvas> component and everything inside that has its own reconciler+render
Juraj Kirchheim
@back2dos
Anything is possible ... fundamentally, the view base class is something that accepts an Observable<RenderResult> (and a few callbacks) and then how that renders is the implementators business
but perhaps I don't quite understand your question
Juraj Kirchheim
@back2dos
what I can say is that conceptually, coconut.ui has no notion of a reconciler ... indeed coconut.html has none
Kevin Leung
@kevinresol
I don't fully understand it too, but what I guess is that I want to receive a sub-tree of the react virtual dom (coconut.react.RenderResult), perform custom reconcilation on it and render custom stuff with it. With all these happening within a larger react app.
but I now believe this shouldn't really involve coconut
Juraj Kirchheim
@back2dos
if it's react on both ends, I guess react can take care of it ^^
Rudy Ges
@kLabz
Emugel
@emugel
how do you guys make unit tests with coconut? first of all i'm interested in testing models. But let's say in general , what is your opinion of unit tests and coconut apps
Emugel
@emugel
maybe first i will see if i can have something simple with travix
Kevin Leung
@kevinresol
I wish to know too
Currently I have some tests for Models
and I want to make some UI tests using automation engines such as cypress.io
Emugel
@emugel

So, I discovered puppeteer with lix run travix run js, this seems like what I was dreaming of :).

Now however I am getting ReferenceError: require is not defined at this line var coconut_react_internal_NativeComponent = require("react").Component;. Is there anything I can do? (for now, all I see is ask the question and go grab some beers)

Emugel
@emugel
think this is the answer https://github.com/kLabz/haxe-react/blob/next/README.md#react-js-dependency (second compile with browserify or download from CDN). With travix though I don't know how
Emugel
@emugel
If someone knows, please help! For now will sleep...
Juraj Kirchheim
@back2dos
uhm, I suppose the easiest way to deal with it is by bundling a CDN version of react with the build using https://github.com/back2dos/embed-js
(and setting -D react_global)