npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

jodi-ui-dom

v2.0.0

Published

JavaScript/TypeScript UI library based on IncrementalDOM

Readme

JodiUI - DOM

JavaScript/TypeScript UI library based on IncrementalDOM.

This is mostly inspired by the way React handles things with JSX, but without that X part.

How does it work?

This example is in TypeScript, but this lib will work with ES5 as well.

This code:

import {el, elVoid, text, render, s, d, k} from 'jodi-ui-dom';

const node = document.querySelector('div.app');
let inputValue = 'lorem';
let label = 'Foo';
 
render(node, () => { // render calls IncrementalsDOM's patch underneath
    // el opens a div with specified properties, executes a callback and then closes a div
    // it also returns rendered element
    el('div', s({'class': 'wrapper'}, () => {
        el('form', () => {
            el('label', () => text(label));
            // when using el or elVoid you can specify properties as static or dynamic.
            // It's an IncrementalDOM's feature designed to improve performance
            elVoid('input', s({'name': 'foo'}), d({'value': inputValue}));
        });
    });
});

will render this DOM structure under our div.app node:

<div class="wrapper">
    <form>
        <label>Foo</label>
        <input name="foo" value="lorem">
    </form>
</div>

When you change inputValue and/or value and render on the same node using the same code then IncrementalDOM will update existing DOM tree without re-rendering it.

Why?

HTML code itself can be messy. When you need to add multiple attributes to elements you either produce a very long lines or you break those lines making the whole thing much less readable.

By using external templating syntax like the one shipped with Angular (1 or 2), Aurelia or Vue you have to learn that new templating syntax and deal with it's limitations. For example: in Angular 2 you cannot use TypeScript enumerables or render something conditionally without creating additional tag.

When using stuff like Handlebars (no VirtualDOM, nor IncremetalDOM) you have to render the whole template even if you changed only one thing in your data. It cannot be used for forms (this would take focus out of an input element) or media payers (it would reset a player and stop playback). Not to mention that manipulating DOM is generally slow.

React with it's JSX and VirtualDOM solve those problems (mostly). You don't have some strange templating syntax, you can use regular JS loops, conditionals and functions. Yet you have XML mixed with it and it might make the whole code very unreadable as well

Every templating language needs additional transpiler which either works in runtime (impacting app's performace) or it's transpiled during compilation (which makes compilation slower, requires additional tools and might cause problems with existing - like source maps). Not to mention a need for IDE and other text editors plugins to help you work with this code.

Jodi aims to solve those problems by providing an easy-to-use JS/TS API that lets you produce readable and dynamic templates.

Installation

npm install --save jodi-ui-dom

Usage examples

import {el, elVoid, text, render} from 'path/to/jodi-ui/dom';

const node = document.querySelector('div.app');

// open a single element and immediately close it
render(node, () => {
    el('div');
});

// open element and write some text inside it, then close an element
render(node, () => {
    el('div', () => {
        text('foo');
    });
});

// create an element which doesn't require to be closed
render(node, () => {
    elVoid('input');
});

// create an element with a child and a static property
// which won't be updated upon next render on a same node
render(node, () => {
    el('div', s({'class': 'foo'}), () => {
        elVoid('input');
    });
});

// create an element with a child, a static property
// and a dynamic property which will be updated (unlike static property)
// if new values will be provided
render(node, () => {
    el('div', s({'id': 'foo1'}), d({'class': 'foo'}), () => {
        elVoid('input');
    });
});

// create multiple nested items with one line
render(node, () => {
    el(['table', 'tr', 'td']);
});

// create items with some keys specified
render(node, () => {
    el('table', () => {
        for (let i = 0; i < 10; i++) {
            el('tr', k('row-' + i), () => {
                // some fields and contents...
            });
        }
    });
});

Components

Need components with lifecycle callbacks and states? Check: JodiUI Components