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

tinyjs-framework

v1.1.3

Published

Tiny JavaScript framework

Readme

TinyJS

TinyJS is a lightweight JavaScript library for dynamically creating HTML elements with deep property assignment. It simplifies DOM manipulation by allowing you to generate any standard HTML tag programmatically, apply properties, append content, and select DOM elements with ease.

Features

  • Dynamically create HTML elements: Generate any standard HTML tag with ease.
  • Deep property assignment: Supports nested property structures for complex elements.
  • Simplified content appending: Accepts strings or elements as child content.
  • DOM element selection: Use $ and $$() to select elements from the DOM.
  • Reactive State Management: Utilize createState for reactive data binding. See this repository for an example using this new function.

How It Works

TinyJS attaches functions for each HTML tag (like div, span, a, etc.) to the global window object. You can create elements by simply calling the tag name as a function, passing in optional properties and child elements.

Additionally, TinyJS introduces two new helper functions:

  • $: A wrapper around document.querySelector, simplifying DOM element selection.
    Example:

    const post = $('#post_1'); // Selects the element with id 'post_1'
  • $$(): A wrapper around document.querySelectorAll that returns an array of DOM elements, allowing for easy iteration.
    Example:

    const items = $$('.item'); // Selects all elements with class 'item'
    items.forEach(item => {
      console.log(item);
    });

Example

const myDiv = div(
  {id: 'container', className: 'my-class'}, 
  h1('Hello World'), 
  p('This is a dynamically generated paragraph.')
);

document.body.appendChild(myDiv);

In this example, the div, h1, and p elements are created dynamically with their attributes and content specified as arguments.

Usage

  1. Include the tiny.js script in your project.
  2. Use any valid HTML tag as a function to create elements, assign properties, and append children.
  3. Use $ to select a single DOM element and $$() for multiple elements.
  4. Append the created elements to the DOM.

Installation

Simply include the tiny.js file in your project:

<script src="tiny.js"></script>

Advanced Example

You can deeply assign properties to elements:

const styledButton = button(
  {style: {backgroundColor: 'blue', color: 'white'}, onclick: () => alert('you clicked me')}, 
  'Click Me!'
);

document.body.appendChild(styledButton);

In this example, the button element is styled directly using the style property.

Supported Tags

TinyJS supports a wide range of HTML tags, including:

  • Basic text elements: p, span, strong, em, etc.
  • Interactive elements: button, input, select, etc.
  • Media elements: img, audio, video, etc.
  • Container elements: div, section, article, footer, etc.

Contribution

Make sure to open an issue before submitting a PR.

This README was generated by ChatGPT