(There's probably a better place to put this than a github issue, but responding in a Medium comment made the code sections impractical)
I'm pretty excited for this framework.
I love/use Vue, but I've known I'll eventually have to switch away from it because of the virtual DOM. React has all of the fundamental problems, I've been keeping up with Svelte as I think they have the right idea with $:
and no virtual DOM, but it is flawed with change detection and other aspects. So seeing this as a combination of Svelte and Vue gives me hope that Manilla can be (not the perfect framework, but) the framework without any fatal design flaws.
I hope this feedback will help
#divRef
is awesome #1 needed feature that was lacking in all frameworks I know of. I'm absolutely thrilled to see it
<CustomComponent />
(react style) also awesome, it really connects the JS to the HTML
- Functional components (also react style) awesome as well Vue greatly needed/needs these for creating simple wrappers
- Deep reactivity / two-way data binding is a must, and it looks like Malina nails that 👌
- Scoped CSS is also must. I've heard Malina has it, but I'm not quite sure how it is implemented. I haven't fully explored malina's
$class
feature but it looks interesting.
- I hope web-components + shadow DOM will be supported, that could be game changing
- I hope scss (or similar) will be supported, but isn't a must-have.
- Finally, there's only one major complaint I have so far. The framework is great and simple; no virtual DOM, nearly HTML compliant, even the
$:
is valid JavaScript. When I open up a random project/file that happens to use Malina (before even hearing about Malina or looking at the documentation), all of it makes sense because it uses JS, HTML, and CSS
... well almost. Suddenly my eyes hit {#if }
and I know there is some magic going on. Suddenly I go from having a full understanding (based on universally agreed on web-dev syntax) to needing to read documentation for a very specific framework and having no clear understanding of what is going on (e.g.)
{#each todos as item, index}
{index}:
<Item :item @remove={remove(index)} />
<br />
{\each}
- .
- Are these server-side executed or runtime?
- What scope do they have access to?
- Can I put a console.log inside of them?
- If I saw
#if
, I'd assume theres a #for
(nope, have to go read documentation)
remove
is a function, and its being called with index
and its return value is being attached to the element, wait no, then the code wouldn't work? (Vue has this same confusing syntax problem, with roots being from HTML)
- Are they reactive to changes in the variables?
I think this initial doubt/confusion/required-additional-framework-specific-learning can be avoided by reusing existing syntax. I don't think Vue's going with the html-compliant v-if
was a great choice (and I know Malina seeks to remedy the problems with that), but I do think reusing an existing spec (even HTML) was better than inventing an entirely new syntax. I think Malina can do better, not necessarily with JSX (although that would be fine with me), but even just words/patterns that map to JS or HTML concepts like
<div>
<#for (let [item, index] of Object.entries(todos)) >
{index}:
<Item :item @remove={remove(index)} />
<br />
<#for />
</div>
or to make it standout more
<if()>
#for (let [item, index] of Object.entries(todos)) {
{index}:
<Item :item @remove={remove(index)} />
<br />
}
</div>
When I see @click
I know I can also use @mouseover
but when I see #if
idk if I can use #else#if
or #elseif
or #else_if
or #elsif
or something entirely different. Everything in the template becomes an edgecase I have to look up and memorize, making it much harder to learn and less likely to be adopted. This is a major problem for me, but its not a fundamental problem like change detection or scoped css.
At least that's my 2 cents. I look forward to seeing the progress on this project!