Skip to content
This repository has been archived by the owner on Nov 6, 2019. It is now read-only.

Add vdom package that works with JSX/TSX #447

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Conversation

sccolbert
Copy link
Member

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

@ellisonbg
Copy link
Contributor

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).

@afshin
Copy link
Member

afshin commented Oct 30, 2019

I like this plan a lot. Do you think you could do one of your mentorship sessions on this package?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants