Open sccolbert opened 5 years ago
Great news. I think this path makes a ton of sense and gives a nice tradeoff of being able to use a vdom approach in phosphor natively without depending on react/preact, but also being interoperable (eventually).
I like this plan a lot. Do you think you could do one of your mentorship sessions on this package?
This is a rewrite of the existing
virtualdom
package, to be compatible with JSX/TSX. The JSX typings are assembled from Preact (mostly) and React (some), with some custom tweaks as needed.The typings right now are good, but it assumes every HTML element has all attributes available. We can improve this in the future.
The typings support SVG, but I'm 99% sure it's not going to work yet. I'm sure I'll need to add some code to handle SVG elements properly.
It supports intrinsic elements and now also function components. I still don't think we need support for class-based components, since we already have widgets with their own life-cycle paradigm. The purpose of this package is to provide a tool for easily rendering leaf content out-of-the-box with Phosphor.
This code is fast. On my machine, the included example takes just 15us to render updates.
For Phosphor 2.0, my plan is to deprecate the
virtualdom
package and replace it with this. For core widgets which make use of custom renderers, I will make the renderer interface more generic so that users can implement their own renderers using any third party package (React, Vue, lit-html, etc...). The default renderers will use this package.@blink1073 @afshin @ellisonbg @jasongrout @telamonian