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 🙏

© 2026 – Pkg Stats / Ryan Hefner

elementree

v0.28.15

Published

MV* Framework with Proxy Observables and JS Template Literals

Readme

stability-experimental JavaScript Style Guide Build Status

Elementree

"Celebrate the code of the problem domain as opposed to the framework."

Elementree is an extremely small front-end JavaScript "framework" with a focus on getting the job done with the mimimum amount of framework-y concepts.

Example

<!DOCTYPE html>
<html>
  <body>
    <script type="module">
      import { merge, prepare, render } from 'https://unpkg.com/elementree'

      function View (state) {
        if (!state.email) state.requestUser()
        return render`
          <body>
            <p>Hello! ${state.email}</p>
            <button onclick=${() => state.nextEmail()}>Next Email</button>
          </body>
        `
      }

      const State = {
        id: 1,
        email: '',
        nextEmail() {
          this.email = null
          this.id += 1
        },
        async requestUser() {
          const response = await fetch(`https://reqres.in/api/users/${this.id}`)
          const { data } = await response.json()
          this.email = data.email
        }
      }
      merge('body', prepare(View, State))
    </script>
  </body>
</html>

Elementree API

merge(to: String, view: Function [, state: Object]) -> undefined

merge wires up a view and an optional object representing the application state and merges it to a selector. Simply put, merge renders your root view to the DOM.

The first argument to merge is a string which will be used by document.querySelector, after DOMContentLoaded, to find root element. The second argument is the top-level view. This argument is a Function that returns a function that returns an HTMLElement such as a prepare call. The third, optional, argument is an object representing the application's state. This object will passed to the renderer function as an parent argument (i.e. following the view's state if there is one).

Elementree adds a single property to the application's state object. The route property is a concatenation of location.pathname, location.search and location.hash. Updating the route property will cause a history.pushState. Updating the address through browser interations will update the route property.

If the window object does not exist the call to merge will return the outerHTML on the result of the rendering.

prepare(template: Function [, state: Object]) -> (Function -> HTMLElement)

prepare a template function with a state object, creating a view function. At a minimum, a template function is required to be passed as the first argument. The second argument, which is optional, is an object representing the local view state. If the template function is joined with a state, the state object will ALWAYS be the 0th argument to the view function. All parent arguments will follow.

render`template: String` -> HTMLElement

A tagged template function. Turn a JavaScript template string into an HTMLElement. If the template has more than one root element a DocumentFragment is returned.

html`unescaped: String` -> HTMLElement

Use html to interpolate HTML, without escaping it, directly into your template.

Attribution

This project would suck a whole lot more without the input from my awesome co-workers at Bitovi, the inspiration from @choojs, and the amazing packages from @sindresorhus. Thank you.