-
Notifications
You must be signed in to change notification settings - Fork 5k
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
create a vdom output type #2840
Conversation
nteractors have started making a VDOM(
div([
h1('Now Incredibly Declarative'),
p(['Can you believe we wrote ', bold('all this from scratch'), '?']),
img(src="https://media.giphy.com/media/xUPGcguWZHRC2HyBRS/giphy.gif"),
p('SO COOL!'),
])
) Now Incredibly DeclarativeCan you believe we wrote all this from scratch? SO COOL! |
e1f9fd2
to
5d95a0c
Compare
Where I'm a bit stuck is in figuring out how I could do update displays without nuking the previous element (thereby losing the actual benefit of the stateful display). |
5d95a0c
to
e77ebb7
Compare
By the way, does anyone know if there's a way to get |
@minrk can you think of a good strategy for how I could make update less destructive? I was confused here about the difference between |
Awesome! |
Generally
I don't see an obvious way to handle the update-in-place, other than to possibly push down the possible replacement logic into each |
Ok, at first I worried about doing that. Perhaps that's ok though. I could end up making updates for the other mimetypes smoother as a result. |
I think it's fine if you figure out a way to make it work. |
e77ebb7
to
4b46b1b
Compare
As requested by @mpacer, here's a GIF showing what happens when the update happens to the VDOM output. I'd actually love to get this in as is then work on the update semantics later so that I'm not changing any base APIs within the outputs. |
Is this normal? |
Looks like this is happening on
|
Fixed in #2866. |
4b46b1b
to
df841d6
Compare
62f94f2
to
b3974b9
Compare
If possible, I'd like to merge this one as is and not worry about the display updates portion of this as it works just not as well as it could. |
@rgbkrk Sorry I haven't had a chance to review this yet! If you can resolve the Travis issue, then feel free to merge. Otherwise, I will have a look at it tonight 👍 |
Yeah I have no idea how to resolve the issue on Travis. I'm getting a timeout error for the codemirror cell. |
I can't figure out this Travis issue, but I can reproduce it by running the tests locally... @minrk Any idea what might be going on here? https://travis-ci.org/jupyter/notebook/jobs/279802361#L816 |
I have this sneaky feeling that |
b3974b9
to
f80d84e
Compare
The main blocker is the test suite, which has been a work in progress to migrate off of the old slimerjs / phantomjs setup. cc @takluyver |
At least to me, I'm dropping this PR for the time being pending classic notebook being brought to the future with npm packages. As it stands, most development is invested in all the newer frontends whether nteract or jupyterlab (or Hydrogen, Neutron, etc.). Totally cool if you bring it forward. 😄 Looking at the commits, I'd prefer to have this package be based on |
Closing, since we ended up not switching to npm packages. Thanks for experimenting with this @rgbkrk! |
This implements a renderer for declarative "VDOM" style output (HTML as JSON if you will). It's not even really vdom, as you could do this with
document.createElement
and enough patience. Maybe sprinkling some morph dom on top. This was first done in nteract and made to be non-specific to React (phosphor should be able to handle it too). Similar PR in nteract: nteract/nteract#1866application/vdom.v1+json
SpecificationThe top level element must be a
VDOMEl
as described below:Goals
The eventual goal is to be able to do display updates that keep DOM state (only changing the nodes that matter):
Here's it working in classic:
/cc @willingc @gnestor @lheagy @mariusvniekerk @Carreau @jackparmer