Skip to content
This repository has been archived by the owner on Mar 12, 2020. It is now read-only.

Work with any virtual-dom library #11

Closed
cjh9 opened this issue Apr 17, 2018 · 8 comments
Closed

Work with any virtual-dom library #11

cjh9 opened this issue Apr 17, 2018 · 8 comments

Comments

@cjh9
Copy link

cjh9 commented Apr 17, 2018

Hi there again :) I'm currently unavailable to ultradom because of this jorgebucaran/superfine#66

Is it possible to use another virtual-dom library for this awesome transition-library, like https://github.com/yelouafi/petit-dom? What is required for the virtual-dom library, to implement oncreate, ondelete hooks? Possibility to supply style as an object? Would be awesome with some documentation of how to get it to work.

By the way, I love the new API, crystal clear 🥇 🏆 🎉

And by the way n.2 shouldn't the default easing be 'ease-in-out'? That's the default in the browser and is used by 2/3 of your examples 😆

@jorgebucaran
Copy link
Collaborator

jorgebucaran commented Apr 17, 2018

@cjh9 Maybe this changes it? It's not published, yet, so you'll need to pull from the master branch to check. 👋

Related

@zaceno
Copy link
Owner

zaceno commented Apr 17, 2018

@jorgebucaran is the plan to merge that diff optimization to ultradom as well?

@cjh9 Thanks!

Good point about default easing... I just went with linear since it seems the most plain. But you're right. I should go with whatever the browser defaults to.

As for requirements to petit-dom to be compatible with my transitions lib.... I think it would probably be easier to make a fork that works with petit-dom. 😅 Style-as-object doesn't matter. But it does depend on the lifecycle events working in the same way and having the same vdom structure (lifecycle event handlers in .attributes).

But actually: if you don't need the Move transition, you probably don't even need this ported to petit-dom. Petit-dom leaves "removed" (but still transitioning out) keyed elements in the same place of the DOM until properly removed afaik.

A large chunk of the code in this lib is for compensating layout changes that happen when we remove a keyed node from the vdom, and it gets shifted to the bottom in the real dom (using the same mechanism as I do for move-transitions)

@cjh9
Copy link
Author

cjh9 commented Apr 17, 2018

@zaceno Yes, that is what I'm aiming to do :) So is this just depending on having lifecycle events oncreate, onupdate, onremove and ondestroy, that are optionally returning promises and resolves before the 'verb' is happening? Which of those are mandatory for hyperapp/transitions?

Related: yelouafi/petit-dom#7

@jorgebucaran merging into ultradom would be awesome :)

@jorgebucaran
Copy link
Collaborator

@cjh9 Did you try it?

jorgebucaran/superfine#111

@cjh9
Copy link
Author

cjh9 commented Apr 17, 2018

@jorgebucaran I will, but maybe there could be a part in the documentation? "How to get this to work with other virtual-dom libraries", you need X, Y and Z etc.

@jorgebucaran
Copy link
Collaborator

jorgebucaran commented Apr 17, 2018

@cjh9 There is a little confusion here.

You said:

I'm currently unavailable to ultradom because of this jorgebucaran/superfine#66

I poorly tried to mean:

Check if jorgebucaran/hyperapp#663 fixes it.


As for:

How to get this to work with other virtual-dom libraries...

I have zero interest in making @hyperapp/transitions work with other libraries.

EDIT: I am not at all against it, it's up to @zaceno. 😄

@cjh9
Copy link
Author

cjh9 commented Apr 17, 2018

@jorgebucaran No, I didn't but I also will try the new ultradom :) But why are you changing the api? Most other virtual-dom libraries gives you the possibility to patch subparts.

Just checked the source, I think everything will work, out of the box, just add oncreate, onupdate and onremove hooks. And I'm not using JSX, so just need to remember that the first parameter are the props, and the second are the composed children. Will also try that later :)

@zaceno
Copy link
Owner

zaceno commented Jun 27, 2018

@cjh9 I tried working with petit-dom for a while, but wasn't able to get it to work. Adding the lifecycle methods on the elements like Hyperapp has seems quite tricky. petit-dom's "hooks" are on "custom components" (classes) -- not elements.

In case you're interested I made a virtual-dom engine of my own https://github.com/zaceno/zxdom It has element-lifecycle events like Hyperapp but also supports patching individual elements. hyperapp-transitions only needs some minor edits to work with zxdom. There is such a fork in the example folder on that repo. It's still pretty fresh so don't use it for anything serious. Just thought you might be interested.

Anyway, like @jorgebucaran said before: compatibility with other vdom engines than Hyperapp's (even Superfine) will not be a goal for Hyperapp-transitions. So I'm closing here.

@zaceno zaceno closed this as completed Jun 27, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants