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

jsab

v0.3.0

Published

Create HTML and CSS using javascript

Downloads

29

Readme

JSAB - JavaScript Application Builder

JSAB (Javascript Application Builder) is a JavaScript/TypeScript library for programmatically creating and building HTML documents. It provides a simple and intuitive way to construct web pages using a fluent API, without writing HTML directly. This approach is ideal for developers who want to generate static websites, build web applications with a strong focus on structure and content, or automate the creation of web content.

Core Concepts

The library is built around a few core concepts:

  • Application: The main container for your website. It holds all the HTML documents (pages) and provides a method to build the final output.
  • HtmlDocument: Represents a single HTML page. It has a head and a body and can be customized with a title and other metadata.
  • Elements: The building blocks of your web pages. Elements are TypeScript classes that correspond to HTML tags (e.g., H1Element, PElement, DivElement). They can be nested to create complex layouts and structures.

Getting Started

To use JSAB, you first need to create an Application instance. Then, you can create HtmlDocument objects for each page of your website. Finally, you can add elements to the body of each document to build the content.

Here is a simple example of how to create a website with two pages:

import { Application, H1Element, HtmlDocument, PElement } from 'jsab';

const homePage = new HtmlDocument('Home')
    .setTitle("Hello World - Home");
const aboutPage = new HtmlDocument('About')
    .setTitle("Hello World - About");

homePage.body
    .addElement(
        new H1Element()
        .addText("Welcome to our Website!")
    )
    .addElement(
        new PElement()
        .addText("This is the home page.")
    );

aboutPage.body
    .addElement(
        new H1Element()
        .addText("About Us")
    )
    .addElement(
        new PElement()
        .addText("This is the about page.")
    );

const app = new Application('Hello World Website')
    .addHtmlDocument(homePage)
    .addHtmlDocument(aboutPage);

app.build('dist');

This code will generate a website with two HTML files, Home.html and About.html, in the dist directory.

Elements

JSAB provides a variety of elements to structure and format your web pages. Here is a list of the available elements and how to use them:

Container Elements

Container elements are used to group other elements together and create the layout of your page.

  • BodyElement: The main content of the HTML document. It is automatically created when you create an HtmlDocument.

  • DivElement: A generic container for flow content. It can be used to group elements for styling or to create logical sections.

    new DivElement()
        .addElement(new PElement().addText("This is a paragraph inside a div."))
        .addElement(new PElement().addText("This is another paragraph inside the same div."))
  • FooterElement: Represents the footer of a page or section.

    new FooterElement()
        .addElement(new PElement().addText("Copyright 2025 My Website"))
  • HeadElement: Contains machine-readable information (metadata) about the document. It is automatically created when you create an HtmlDocument.

  • HeaderElement: Represents the header of a page or section.

    new HeaderElement()
        .addElement(new H1Element().addText("This is the main heading"))
  • MainElement: Represents the main content of the <body> of a document.

    new MainElement()
        .addElement(new PElement().addText("This is the main content of the page."))

Text Elements

Text elements are used to add and format text content.

  • H1Element: Represents a level 1 heading. Heading from level 1 to level 6 are supported.

    new H1Element().addText("This is a top-level heading")
  • PElement: Represents a paragraph.

    new PElement().addText("This is a paragraph of text.")
  • AElement: Represents a hyperlink.

    new AElement()
        .addText("Visit Google")
        .addAttribute(new HrefAttribute().setHref("https://www.google.com"));
  • BElement: Represents a section of text to be rendered in bold.

    new BElement().addText("This text will be bold.")
  • IElement: Represents a section of text to be rendered in italic.

    new IElement().addText("This text will be italic.")

Other Elements

  • TitleElement: Represents the title of the HTML document. It is set via the setTitle method on the HtmlDocument instance.

    const homePage = new HtmlDocument('Home')
        .setTitle("My Website - Home");

Attributes

Elements can have attributes that provide additional information. Here are the currently supported attributes:

  • IdAttribute: Represents the id attribute, which specifies a unique ID for an HTML element.

    import { IdAttribute } from "jsab";
    
    new DivElement()
        .addAttribute(new IdAttribute().setId("myUniqueDiv"));
  • HrefAttribute: Represents the href attribute, which specifies the URL of the page the link goes to. This is typically used with AElement.

    import { AElement, HrefAttribute } from "jsab";
    
    new AElement()
        .addText("Go to Example")
        .addAttribute(new HrefAttribute().setHref("https://www.example.com"));
  • ClassAttribute: Represents the class attribute, which specifies one or more class names for an element.

    import { ClassAttribute } from "jsab";
    
    new DivElement()
        .addAttribute(new ClassAttribute().addClass("my-class"));

License

This project is licensed under the ISC License. See the LICENSE.md file for more details.

Copyright and Development

This project is copyrighted by Nerexon and developed by Alataq.

  • Copyright © 2025 Nerexon
  • Developed by Alataq