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

jayesstee

v0.13.1

Published

Pure javascript templating

Readme

jayesstee - Javascript Templating (JST)

Overview

Yes, another templating module. This one is quite small, super simple and is 100% pure javascript. You can step through your templates with a JS debugger.

The module can both create simple HTML output in string form (useful for spitting out some HTML in node.js) or can be used in the browser and fill in the DOM with HTMLElements, etc. It can also manage CSS with local scoping. Finally it adds some basic support for events and input data retrieval.

Take a look at these codepens for working examples: https://codepen.io/collection/nxdMer

Examples

Most basic usage - no templates or refreshable objects

Add a div with an unordered-list into the body of the page:

import jst from "jayesstee";

// Promote all elements to global (or add 'jst.' in front of everything)
jst.makeGlobal();

jst("body").appendChild(
    $div({id: "main", "class": "main-class"},
        $ul(
            $li({id: "one"},   "First Entry"),
            $li({id: "two"},   "Second Entry"),
            $li({id: "three"}, "Third Entry")
        )
    )
);

Build a page using jst.Components

import jst from 'jayesstee';

jst.makeGlobal();

class Page extends jst.Component  {
    constructor(appData) {
        super();
        this.header = new Header(appData);
        this.body   = new Body(appData);
    }
    cssGlobal() {
        return {
          body: {fontFamily: "Arial", padding$px: 0, margin$px: 0}
        };      
    }
    render() {
        return $div({cn: "page"},
                    this.header,
                    this.body);
    }
}

class Body extends jst.Component {
    constructor(appData) {
        super();
        this.table  = new Table(appData.tableConfig, appData.tableData);
    }
    render() {
        return $div({cn: "body"},
                    this.table);
    }
}

class Header extends jst.Component {
    constructor(appData) {
        super();
        this.headerInfo = appData.headerInfo;
    }
    render() {
        return $div({cn: "-header"},
                    $div({cn: "-title"},
                         this.headerInfo.title),
                    $div({cn: "-userInfo"},
                         this.headerInfo.userInfo)
                   );
    }
    cssLocal() {
      return {
        header$c: {backgroundColor: "black", color: "white", padding$px: 5},
        title$c: {fontSize: "150%", display: "inline-block"},
        userInfo$c: {display: "inline-block", float: "right", verticalAlign: "bottom"}
      }
    }
}

const templates = {
  table: (fieldInfo, fieldsToShow, collection) => 
    $table(
      {cn: "table"},
      $thead(
        $tr(fieldsToShow.map(field => $th(fieldInfo[field].title)))
      ),
      $tbody(
        collection.map(entry => $tr(
          fieldsToShow.map(field => $td(entry[field]))
        ))
      )
    )
};

class Table extends jst.Component {
    constructor(config, data) {
        super();
        this.config = config;
        this.data   = data;
    }
    cssLocal() {
      return {'tableContainer$c': {margin$px: 10}, 
              table: {borderCollapse: "collapse"}, 
              'td,th': {border$px: [1, "solid", "black"], padding$px: 4},
              th: {backgroundColor: "black", color: "white"}
             };
    }
    render() {
        return $div({cn: "-tableContainer"},
                    templates.table(this.config.fieldInfo,
                                    this.config.fieldsToShow,
                                    this.data.collection)
                    );
    }
    setConfig(config) {
        this.config = config;
        this.refresh(); // Refresh only the table on the page
    }
    setData(data) {
        this.data = data;
        this.refresh(); // Refresh only the table on the page
    }
}

// Now create a page - this won't yet render it
let page = new Page({
    headerInfo: {
        title: "My Title",
        userInfo: "my-name" 
    },
    tableConfig: {
        fieldInfo: {
            name:   {title: "Name"},
            height: {title: "Height"},
            age:    {title: "Age"},
            weight: {title: "Weight"},
        },
        fieldsToShow: ["name", "height", "weight"]
    },
    tableData: {
        collection: [
            {name: "Bob",     height: 73, age: 31, weight: 180},
            {name: "Sam",     height: 69, age: 16, weight: 160},
            {name: "Ruth",    height: 64, age: 55, weight: 150},
            {name: "Navneet", height: 60, age: 34, weight: 110}
        ]
    }
});

// Now add it to the document
jst("body").appendChild(page);

CodePen for previous example

Another more dynamic demo of spinning tables:

CodePen Spinners

Copyright 2018 Edward Funnekotter All rights reserved