reinaldonj / million

Virtual DOM into the future! πŸ’₯🦁✨

Home Page:https://millionjs.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

What is Million?

Million is a lightweight (<1kb) compiler-augmented Virtual DOM. It's fast!

Current Virtual DOM implementations are inadequateβ€”Ranging from overcomplicated to abandoned, most are unusable without sacrificing raw performance and size.

Million aims to fix this, providing a library-agnostic Virtual DOM to serve as the core for Javascript libraries that focus on precompilation and static analysis.

πŸ“š Learn Million in 10 minutes! β†’

Why Million?

Advantages

Use Cases

  • 🦁 Built for libraries that compile
  • πŸ“¦ Lightweight bundle size (<1kb brotli+min)
  • ⚑ Fast runtime operations
  • πŸ› οΈ Composable using drivers, sensible by default

Installing Million

Inside your project directory, run the following command:

npm install million

Quick Start

Here is an extremely simple implementation of a Hello World page using Million.

import { _, m, render } from 'million';

render(document.body, m('h1', _, ['Hello World!']));

// <h1>Hello World</h1> rendered to <body>

render() function has a standard interface that is used in many Virtual DOM libraries. First argument is a DOM node that will be used as the parent DOM reference, and the second one is a Virtual DOM to render.

m() function will instantiate a "Virtual DOM" node for an element.

_ is a shorthand for the undefined value.

β†’ More examples

Resources & Contributing Back

Looking for the docs? Check the documentation out.

Want to talk to the community? Hop in our Discord and share your ideas and what you've build with Million.

Have a question about Million? Post it on the Discord or GitHub Discussions and ask the community for help.

Find a bug? Head over to our issue tracker and we'll do our best to help. We love pull requests, too!

We expect all Million contributors to abide by the terms of our Code of Conduct.

β†’ Start contributing on GitHub (pnpm welcome)

Acknowledgments

Million takes heavy inspiration from snabbdom, ivi, mikado, and more. Feel free to check them out if you're interested in an alternative library to use.

Million is being used in open source work like tinypages, hacky, and more.

Sponsors

Vercel   Deta

Want your logo here? β†’ Sponsor Million

License

Million is MIT-licensed open-source software and research project by Aiden Bai.

View count

About

Virtual DOM into the future! πŸ’₯🦁✨

https://millionjs.org

License:MIT License


Languages

Language:TypeScript 89.1%Language:JavaScript 4.6%Language:HTML 3.4%Language:CSS 2.3%Language:Shell 0.6%