-
-
Notifications
You must be signed in to change notification settings - Fork 177
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fiber #60
Fiber #60
Conversation
Note that 2447 lines of the diff is yarn.lock. The primary fiber implementation is 182 lines of code. |
That's really cool @iamdustan. Tell me when you are done with it and will merge. I guess we'll have to wait a bit for react 16 to be released though.
Should we engage a discussion with react team about this? |
I’ve half-spoken to them about how to distribute the reconciler. There isn’t a clear direction yet and I don’t think it’s high-pri. I’m going to start another conversation in the React Internals facebook group about it. |
Added a couple more examples and have event handlers working. Honestly, idk if the last three items (async work) matters at this point. ReactDOM has it disabled for the initial fiber release and I think that’s okay here, too. Regarding the publishing stuff, I’ll be opening an official issue on the React issue tracker later tonight or tomorrow. I think merging and publishing this as an alpha is okay (it should be feature compatible with previous releases, just on fiber and requiring a specific package of react and react-dom for the time being) |
Thanks @iamdustan. I'll try to review the code thoroughly soon. I agree the most blocking point at that time is the fact that we'll need to rely on another renderer to get the necessary files to depend on. Just ping me on the issue you'll open please. |
I am also open to modify some features of the library to "modernize" them in the process. The class system comes to mind :) |
Issue for ReactFiberReconciler package opened at facebook/react#9103. |
Yes there was some idea once to adapt the CSS layout to the blessed styles. But I am not sure to see what it would entail. |
Awesome work @iamdustan ! I have played with your example, but failed with making inputs work having this . Tried on iterm2 and terminal. Is there a way to set focus on input without mouse involved? this is 90% use case for cli apps, I believe |
@Lapanoid you should check |
@Lapanoid yeah, I’ve never had a lot of fun with blessed forms. I’ve had success with iterm2, but not with default Terminal.app |
If I remember correctly, Terminal.app indeed has a lot of quirks, notably the mouse does not work and some focus events also. But it should be possible to devise a kind of form using tabulations & keys I guess. |
@iamdustan My concern about react in terminal, that it should not break basic terminal functionality which are REPL and input.. All this gorgeous things will not get much traction if they are not play well with input. |
@Yomguithereal sorry this is not right place for this discussion, I will create separate issue |
I had no luck using a Edit: Upon further investigation, a list component will render correctly if it is the only element being rendered. Nesting inside another element will not. |
@mashaal could you post a brief demo and I’ll debug? |
@iamdustan https://gist.github.com/mashaal/2212d99f35dcadac2dfa096f7ae8623e first example does render the list, second does not -- tried wrapping it in |
@iamdustan don't hesitate to comment on the thread when you feel we can start to work towards a merge. |
This PR makes me happy in a way no PR should. |
Will do @Yomguithereal. 😄 Working through a few more issues (eg. facebook/react#11463) and then having you do an actual integration test somewhere would be really helpful. |
Do you have an idea on how to do that with such a library? |
Maybe I meant a manual test 😇 I’ve added a few new examples, but I’m not sure if I broke the dashboard one or if it never really worked for me. |
@Yomguithereal I think this is ready for a test drive. |
Thanks ! I'll try to migrate https://github.com/byteclubfr/socket.io-monitor-cli over this new version to see how it goes. |
package.json
Outdated
}, | ||
"dependencies": { | ||
"invariant": "^2.2.0", | ||
"lodash": "^3.x.x" | ||
"lodash": "^3.x.x", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess we can upgrade lodash
to v4 now.
package.json
Outdated
"react-motion": "^0.5.2", | ||
"react-reconciler": "0.5.0", | ||
"ws": "^1.1.0", | ||
"yoga-layout": "^1.2.0" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't those dependencies be in devDependencies
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Derp. Yoga-layout was added as part of an unfinished experiment so I just removed it. I’m not really sure if ws
should be a devDep, peerDep, or regularDep. It’s required to use react-devtools
which can be used in production mode (I’m pretty sure on that). Putting that as a devDep means consumers would have to add ws
on their side, right?
@iamdustan where are we on this? Doesn't some deps remain where they should not? |
I think that this is ready. I removed one of the dependencies completely, but I think the other may be necessary still for |
This means devtool integration wouldn't work without those deps? Do you think we could offload some of them in peer deps with docs for people wanting to use the devtools. |
Is this PR ready to be used by others? Are there any remaining tasks that I can help with to push this along? |
@jonhermansen. This PR should be usable right now. I am just waiting an answer regarding dependencies to merge. |
Derp. Missed the last question, @Yomguithereal. I just bumped a few versions and removed the dependency and added a guard during setup for it. |
@iamdustan. I will merge & release now so that people can use your goodies. I'll try to find some time in the near future to work a bit on the library. Do you want me to add you as a contributor so you can freely edit the library? |
Is this still the case? |
Negative, the official renderer means that is no longer valid. |
Early Preview. Testing my approach from iamdustan/tiny-react-renderer#24.
Will update description later tonight or tomorrow.To test:
yarn install
node run.js
node_modules/.bin/react-devtools
This PR is intended to reimplement
react-blessed
on top ofReactFiberReconciler
, the new (almost supported) renderer API. It is keeping the React 14.xstack
reconciler support around for now by moving those files tosrc/stack
. The shared utilities between stack and fiber have been moved tosrc/shared
. The Fiber reconciler is entirely implemented right now insrc/fiber/fiber.js
. The other two filessrc/fiber/index.js
andsrc/fiber/devtools.js
exist to supportreact-devtools
integration.TODO:
Examples (as test cases)
Reconciler API
removeChild
insertBefore
*Text*
methodsscreen.render()
callsfigure out how to publish/version (current requirement involvesnpm install
ing an official renderer to get access toreact-{renderer}/lib/ReactFiberReconciler.js