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

native-document

v1.0.76

Published

[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT) [![Build Status](https://img.shields.io/badge/Build-Passing-brightgreen.svg)](#) [![Version](https://img.shields.io/badge/Version-1.0.0-orange.svg)](

Readme

NativeDocument

License: MIT Build Status Version Bundle Size

A reactive JavaScript framework that preserves native DOM simplicity without sacrificing modern features

NativeDocument combines the familiarity of vanilla JavaScript with the power of modern reactivity. No compilation, no virtual DOM, just pure JavaScript with an intuitive API.

Why NativeDocument?

Instant Start

<script src="https://cdn.jsdelivr.net/gh/afrocodeur/native-document/dist/native-document.min.js"></script>

Familiar API

import { Div, Button } from 'native-document/src/elements';
import { Observable } from 'native-document';

// CDN
// const { Div, Button } = NativeDocument.elements;
// const { Observable } = NativeDocument;

const count = Observable(0);

const App = Div({ class: 'app' }, [
    Div([ 'Count ', count]),
    // OR Div(`Count ${count}`),
    Button('Increment').nd.onClick(() => count.set(count.val() + 1))
]);

document.body.appendChild(App);

Complete Features

  • Native reactivity with observables
  • Global store for state management
  • Built-in conditional rendering
  • Full-featured router (hash, history, memory modes)
  • Advanced debugging system
  • Automatic memory management via FinalizationRegistry

Quick Installation

Option 1: CDN (Instant Start)

<script src="https://cdn.jsdelivr.net/gh/afrocodeur/native-document/dist/native-document.min.js"></script>
<script>
  const { Div } = NativeDocument.elements
  const { Observable } = NativeDocument
  // Your code here
</script>

Option 2: Vite Template (Complete Project)

npx degit afrocodeur/native-document-vite my-app
cd my-app
npm install
npm run start

Option 3: NPM/Yarn

npm install native-document
# or
yarn add native-document

Quick Example

import { Div, Input, Button, ShowIf, ForEach } from 'native-document/src/elements'
import { Observable } from 'native-document'

// CDN
// const { Div, Input, Button, ShowIf, ForEach } = NativeDocument.elements;
// const { Observable } = NativeDocument;

// Reactive state
const todos = Observable.array([])
const newTodo = Observable('')

// Todo Component
const TodoApp = Div({ class: 'todo-app' }, [

    // Input for new todo
    Input({ placeholder: 'Add new task...', value: newTodo }),

    // Add button
    Button('Add Todo').nd.onClick(() => {
        if (newTodo.val().trim()) {
            todos.push({ id: Date.now(), text: newTodo.val(), done: false })
            newTodo.set('')
        }
    }),

    // Todo list
    ForEach(todos, (todo, index) =>
        Div({ class: 'todo-item' }, [
            Input({ type: 'checkbox', checked: todo.done }),
            `${todo.text}`,
            Button('Delete').nd.onClick(() => todos.splice(index.val(), 1))
        ]), /*item key (string | callback) */(item) => item),

    // Empty state
    ShowIf(
        todos.check(list => list.length === 0),
        Div({ class: 'empty' }, 'No todos yet!')
    )
]);

document.body.appendChild(TodoApp)

Core Concepts

Observables

Reactive data that automatically updates the DOM:

import { Div } from 'native-document/src/elements'
import { Observable } from 'native-document'

// CDN
// const { Div  } = NativeDocument.elements;
// const { Observable } = NativeDocument;

const user = Observable({ name: 'John', age: 25 });
const greeting = Observable.computed(() => `Hello ${user.$value.name}!`, [user])
// Or const greeting = Observable.computed(() => `Hello ${user.val().name}!`, [user])

document.body.appendChild(Div(greeting));

// user.name = 'Fausty'; // will not work
// user.$value = { ...user.$value, name: ' Hermes!' }; // will work
// user.set(data => ({ ...data, name: 'Hermes!' })); // will work
user.set({ ...user.val(), name: 'Hermes!' });

Elements

Familiar HTML element creation with reactive bindings:

import { Div, Button } from 'native-document/src/elements'
import { Observable } from 'native-document'

// CDN
// const { Div, Button  } = NativeDocument.elements;
// const { Observable } = NativeDocument;

const App  = function() {
    const isVisible = Observable(true)
    
    return Div([
        Div({
            class: { 'hidden': isVisible.check(v => !v) },
            style: { opacity: isVisible.check(v => v ? 1 : 0.2) }
        }, 'Content'),
        Button('Toggle').nd.onClick(() => isVisible.set(v => !v)),
    ]);
};

document.body.appendChild(App());

Conditional Rendering

Built-in components for dynamic content:

ShowIf(user.check(u => u.isLoggedIn), 
  Div('Welcome back!')
)

Match(theme, {
  'dark': Div({ class: 'dark-mode' }),
  'light': Div({ class: 'light-mode' })
})

Switch(condition, onTrue, onFalse)

When(condition)
    .show(onTrue)
    .otherwise(onFalse)

Documentation

Key Features Deep Dive

Performance Optimized

  • Direct DOM manipulation (no virtual DOM overhead)
  • Automatic batching of updates
  • Lazy evaluation of computed values
  • Efficient list rendering with keyed updates

Developer Experience

// Built-in debugging
Observable.debug.enable()

// Argument validation
const createUser = (function (name, age) {
  // Auto-validates argument types
}).args(ArgTypes.string('name'), ArgTypes.number('age'))

// Error boundaries
const AppWithBoundayError = App.errorBoundary(() => {
    return Div('Error in the Create User component');
})

document.body.appendChild(AppWithBoundayError());

Contributing

We welcome contributions! Please see our Contributing Guide for details.

Development Setup

git clone https://github.com/afrocodeur/native-document
cd native-document
npm install
npm run dev

License

MIT © AfroCodeur

❤️ Support the Project

NativeDocument is developed and maintained in my spare time.
If it helps you build better applications, consider supporting its development:

Ko-fi

You can also support the project via crypto donations:

  • USDT (TRC20)
  • USDT (BSC)
  • USDC (Base)
0xCe426776DDb07256aBd58c850dd57041BC85Ea7D

Your support helps me:

  • Maintain and improve NativeDocument
  • Write better documentation and examples
  • Fix bugs and ship new features
  • Produce tutorials and learning content

Thanks for your support! 🙏

Acknowledgments

Thanks to all contributors and the JavaScript community for inspiration.


Ready to build with native simplicity? Get Started →