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
Documentation of ivi-html #7
Comments
Here is a working solution: https://codesandbox.io/s/8ypkk1nqy9
No
It is possible to consume web components in ivi and there shouldn't be any problems, but there is no support for writing custom components. There are so many different edge cases for scheduling, events, handling errors and it would require to add a huge chunk of code to the library to deal with this edge cases. Sorry for the inconvenience because of the bad documentation, I'll try to explain what I've changed to fix it: fsm.js:L187, fsm.js:L193, ...: All element factories has interface fsm.js:L209: This line is correct, but when there is a single child, it is unnecessary to wrap it into array. fsm.js:L202: ivi is using slightly different way to attach events, there is a special node fsm.js:L201: It is an edge case and usually this edge cases are handled automagically, ivi is using a way much simpler model, by default everything is a DOM attribute, and to handle edge cases there are AttributeDirectives. fsm.js:L249: Children lists is an extremely complicated topic with so many different edge cases, pros and cons for different solutions. In ivi, dynamic lists should be wrapped in index.js:L49: I've replaced it with simple Also, I slightly refactored code to remove code duplication. |
wow, that's great. I did not expect you to actually solve all the issues. I think this would be a great resource for other people coming to ivi for the first time, and maybe you could feature the example among others. I remember having seen this issue asking for examples : #4 Your component-like refactoring is great. That is the great advantage behind hyperscript/ivi-html, it is just javascript so refactoring is trivial. I agree with you on My workflow is to receive html, css from a web designer, to turn that into hyperscript (with the online converter http://html-to-hyperscript.paqmind.com/), and then write the app logic around that. So decorating with Would be great though is if web components would work seamlessly. Unfortunately it seems there is still some way to go before that can be used uniformly across browsers, which is why I use only custom elements (no shadow dom, no DOM events emitted by the component but use of a trivial event emitter - 300 bytes min-gzipped). In any case, thank you for the support. I now have a much clearer vision of how to use ivi and its performance optimizations. Final codesandbox is here : https://codesandbox.io/s/3x9x5v4kq5 |
Hello there again,
I am trying to move the following application to ivi. I have it already in inferno, nerv, and react. Trying to make it work with ivi but I am encountering some issues probably linked to undocumented behaviour of element factories. I already solved an issue related to the fact that the first argument of the element factory (say
div
) is a list of classes (or so it seems). So ".class" should become "class" without the dot. Attributes seem to be attributes, and hopefully there is no funky edge case. But I have this which I can't work aroundThis is the
next
value, which indeed features nou
properties :Any idea what I am doing wrong? I assume, that this may be because my first
render
is on an element (#app) while the subsequent renders are on the first child of that element. Dorender
in ivi have to be always on the same element? Could also be that the problem is that I am using webcomponent and custom tags :const movieSearch = htmlElementFactory("movie-search");
?I have a codesandbox but the error is swallowed there : https://codesandbox.io/s/0y56rx6zkl
Else, the repo corresponding to the sandbox is here : https://github.com/brucou/movie-search-app-ivi
The text was updated successfully, but these errors were encountered: