Open hsnoil opened 9 months ago
It appears that Mikado mounts listeners on the window object (the root of all listeners) and so events won't know what component to go do. (See src/event.js:391).
Mikado needs to be changed to mount the listener on the base of each component.
I don't understand what you are trying to do. For reactive approach Mikado gives you 2 possibilities: 1. using reactive property notation within template expression and also optionally 2. using observable array. For web components there is explanation in the Readme. None of them was used.
Can you explain me what is your goal? You can give me some example of how the final result should look like but without giving the imlementation, just the result is important to me. I don't understand your example above, also I'm pretty sure that this could be solved better, when I'm understand what you need.
Mikado needs to be changed to mount the listener on the base of each component.
I don't know what you exactly mean with "component". When it is shadow DOM component, then this makes sense to me. But that is just one usage scenario. When using non-shadow DOM components it can't, because it needs a global event delegation solution and binding routing to every template doesn't provide this. It isn't needed to use the event delegation, when you need non-global event capturing then just assign a native listener. This can also be done within custom callbacks.
@john5000 I will add a new feature binding delegation listeners to the shadow root when used.
@hsnoil Probably I understand your example, the confusing part is the use of state.setState
which completely should not be there. Why you use it?
@ts-thomas I know one can just do data.items =
but my goal in long term was to do some auto structuring of what is passed to the values and get more data about where it is, thus the use of a function. But I can see how in this minimum example it looks weird, sorry about that
Also, a side note did you see my other post about how things come out as compiled/textbox
instead of textbox
for the naming? or should I open a new issue for it?
Many frameworks have methods of building portable components before the webcomponent spec, what is the recommended way to do this with Mikado?
What I came up with is something like this (though it feels like I am hacking around the foreach and I'd have to do an app.render(data) on every change, is there a better way?):
index.html
main.js
template/app.html
template/form.html
template/textbox.html