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

just-dom

v1.0.9

Published

Libreria per semplificare la manipolazione del DOM

Downloads

551

Readme

Just DOM

A lightweight JavaScript library to simplify DOM manipulation.

npm version bundle size downloads license

Features

  • Simplified DOM element creation
  • Handling attributes, styles, and events in a single interface
  • Support for all standard HTML tags
  • Utility functions for CSS class manipulation, routing, and fetch API
  • No external dependencies
  • Small size (< 20KB)
  • Full TypeScript support

Installation

npm install just-dom

Usage

Import

Easy DOM supports different import methods for maximum flexibility:

// Import the main DOM object (recommended)
import DOM from 'just-dom';

// Import individual utility functions
import { classNames, fetcher, getElement } from 'just-dom';

// Mixed import
import DOM, { classNames, fetcher } from 'just-dom';

Creating DOM elements

import DOM from 'just-dom';

// Using tag helpers
const header = DOM.h1({ className: 'title' }, ['Welcome to Easy DOM']);

const btn = DOM.button(
  { 
    className: 'btn primary',
    onclick: () => alert('Clicked!')
  },
  ['Click here']
);

// Nesting elements
const container = DOM.div({ className: 'container' }, [header, btn]);

Utility functions

import { classNames, fetcher, getElement, createElFromHTMLString } from 'just-dom';

// Creating conditional classes
const btnClass = classNames({
  'btn': true,
  'btn-primary': true,
  'disabled': false
}); // Result: "btn btn-primary"

// Making HTTP requests
const data = await fetcher('https://api.example.com/data', {
  method: 'POST',
  body: JSON.stringify({ key: 'value' })
});

// Selecting existing DOM elements
const element = getElement('#my-id');

// Creating a reference to an element
const ref = createRef();
DOM.div({ ref }, 'Hello');

// Using the reference to manipulate the element
ref.current.style.color = 'red';

// Creating elements from HTML string
const fragment = createElFromHTMLString('<div>Hello</div><p>World</p>');
document.body.appendChild(fragment);

Routing (requires vanilla-router)

import { Outlet } from 'just-dom';

const routerOutlet = Outlet('app');
document.body.appendChild(routerOutlet);

TypeScript Support

Easy DOM includes complete TypeScript type declarations. No additional packages are required.

import DOM, { DOMAttributes } from 'just-dom';

// Properties have hints and type checking
const button = DOM.button({ 
  className: 'btn',
  disabled: false,
  onclick: (e: MouseEvent) => console.log('Clicked!', e)
}, ['Click me']);

// Defining custom properties
interface MyButtonProps extends DOMAttributes<HTMLButtonElement> {
  variant?: 'primary' | 'secondary' | 'danger';
}

function createButton(props: MyButtonProps, children: string[]) {
  return DOM.button({
    ...props,
    className: `btn btn-${props.variant || 'primary'}`
  }, children);
}

Compatibility

  • All modern browsers (Chrome, Firefox, Safari, Edge)
  • IE11 with appropriate polyfills

Development

# Install dependencies
npm install

# Build the project
npm run build

# Run tests
npm test

License

MIT