vidoriel
v0.0.4
Published
Virtual dom template engine to create user interfaces and render them server- and browser-side.
Downloads
8
Maintainers
Readme
= Vidoriel is a virtual dom template engine
See the documentation for further details
== Quick use
import { View } from 'vidoriel';
function submit({ data, form, event, vnode }) {
alert('Look in console!');
console.log('data:', data);
console.log('form:', form);
console.log('event:', event);
console.log('vnode:', vnode);
}
const main = new View(`<main-container>
<form :submit={submit}>
<input type="text" value="This is a value.">
<button type="submit">{label}</button>
</form>
</main-container>`, { label: 'CLICK ME!' }, { submit });
const index = new View(`<!DOCTYPE html>
<html lang="{en}">
<head>
<title>{title}</title>
</head>
<body>
{main}
</body>
</html>`, { main });
// to get the html string for server side output:
const html = index.display();
// to hydrate the view browser side:
main.mount('main-container');
// change the data and then patch into real dom:
main.data.label = 'CLICK ME AGAIN!';
main.render(); // changes should be applied to the real dom now
== Credits Vidoriel uses snabbdom under the hood