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

@sanatanai/create

v1.0.4

Published

Create HTML elements with a simple syntax.

Readme

Sanatan AI - Create

A modern, minimal, and efficient JavaScript utility for creating HTML elements with a simple, expressive syntax. Inspired by the need to reduce boilerplate and make DOM manipulation more declarative and readable.


Features

  • Declarative Element Creation: Create elements with tag, classes, IDs, properties, children, event listeners, and parent in a single call.
  • Flexible API: Supports text, HTML, or nested elements as children.
  • Event Listener Helper: Add multiple event listeners easily.
  • Lightweight & Dependency-Free: No external dependencies, pure JavaScript.

Installation

npm install @sanatanai/create

Or use directly in your browser via CDN:

<script type="module">
	import { Create } from 'https://unpkg.com/@sanatanai/create/index.js';
</script>

Usage

Classic vs. Create

// Classic way
const div = document.createElement('div');
div.className = 'mydiv';
div.hidden = true;
div.appendChild(document.createElement('p'));
div.addEventListener('click', myFn);
div.addEventListener('mousemove', myFn2);
divParent.appendChild(div);

// With Create
import { Create } from '@sanatanai/create';
const div = Create('div.mydiv', {hidden: true},Create('p'), [['click', myFn], ['mousemove', myFn2]], divParent);

API Reference

Create(selector, properties, childs, events, parentElement)

| Parameter | Type | Description | |--------------- |--------------------------------------------------|---------------------------------------------------------------------------------------------| | selector | string | Selector-like string (e.g., div.main#hero) | | properties | object | Properties/attributes to set on the element (e.g., {hidden: true, style: {color: 'red'}}) | | childs | Element[] \| Element \| string | Child node, Array of child nodes or text content | | events | [string, fn] \| Array<[string, fn]>| Event listeners (single or array of [event, handler]) | | parentElement| Element | Parent to append the created element to |

Returns the created Element.

Example

const btn = Create('button.btn#main', { type: 'button', style: { color: 'white', background: 'blue' } }, 'Click Me', ['click', () => alert('Clicked!')], document.body);

evListener(events, element, listener)

Add one or more event listeners to an element.

  • events: Comma-separated string of event names (e.g., 'click,mouseover')
  • element: Target element
  • listener: Event handler function

Advanced Usage

  • Multiple Classes/IDs:
    • Create('div.class1.class2#id1#id2') will add all classes and IDs.
  • Style Object:
    • Pass a style object in properties for inline styles.
  • HTML Content:
    • If childs contains <, it will be set as innerHTML.

License

MIT © Sanatan AI


Links