vidoriel

0.0.4 • Public • Published

= 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

Package Sidebar

Install

npm i vidoriel

Weekly Downloads

6

Version

0.0.4

License

MIT

Unpacked Size

40.3 kB

Total Files

9

Last publish

Collaborators

  • worldapi.org