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

senangwebs-unfold

v1.0.2

Published

An advanced, interactive JavaScript library for visualizing and editing JSON data.

Readme

SenangWebs Unfold (SWU)

An advanced, interactive JavaScript library for visualizing and editing JSON data as an interactive flowchart-style graph.

License: MIT

SenangWebs Unfold Preview

Features

  • Visual JSON Editing - Interactive, flowchart-style representation of JSON data
  • Two-Way Sync - Real-time synchronization between visual graph and raw JSON text
  • In-Place Editing - Edit keys and values directly in the visual interface
  • Pan & Zoom - Navigate large JSON structures with smooth pan and zoom controls
  • Zero Dependencies - Pure vanilla JavaScript, no external libraries required
  • Theming Support - Built-in light and dark themes with customizable colors
  • State Preservation - Remembers which nodes are expanded across edits
  • Dual Initialization - Use declarative HTML attributes or JavaScript API

Installation

Via NPM

npm install senangwebs-unfold

Manual Installation

  1. Clone or download this repository
  2. Run npm install to install dependencies
  3. Run npm run build to generate the distribution files
  4. Include the CSS and JS files in your HTML:
<link
  rel="stylesheet"
  href="https://unpkg.com/senangwebs-unfold@latest/dist/swu.css"
/>
<script src="https://unpkg.com/senangwebs-unfold@latest/dist/swu.js"></script>

Quick Start

Method 1: Declarative HTML

<div
  data-swu
  data-swu-canvas-background="#ededed"
  data-swu-accent-color="#ff6600"
  data-swu-theme="light"
  data-swu-direction="horizontal"
>
  <div data-input-wrapper></div>
  <div data-swu-viewer-container></div>
</div>

<script src="https://unpkg.com/senangwebs-unfold@latest/dist/swu.js"></script>

The library will automatically initialize on page load.

Method 2: JavaScript API

<div id="demo"></div>

<script src="https://unpkg.com/senangwebs-unfold@latest/dist/swu.js"></script>
<script>
  const editor = new SWU(document.getElementById("demo"), {
    canvasBackground: "#f0f0f0",
    accentColor: "#9333ea",
    theme: "light",
    json: {
      name: "My App",
      version: "1.0.0",
      features: ["editing", "visualization"],
    },
  });
</script>

API Reference

Constructor

new SWU(containerElement, options);

Parameters:

  • containerElement (HTMLElement) - The DOM element where SWU will be rendered
  • options (Object) - Configuration options:
    • json (String | Object) - Initial JSON data
    • inputJSON (String | Object) - Alias for json
    • textarea (HTMLTextAreaElement) - External textarea for two-way binding
    • canvasBackground (String) - Background color for the canvas (default: #e9ecef)
    • accentColor (String) - Accent color for UI elements (default: #3b82f6)
    • theme (String) - Theme: 'light' or 'dark' (default: 'light')
    • direction (String) - Layout direction: 'horizontal' (left-to-right) or 'vertical' (top-to-bottom) (default: 'horizontal')

Public Methods

.render(json)

Renders or updates the visualization with new JSON data.

editor.render({ name: "New Data" });

.getJson()

Returns the current JSON data as a JavaScript object.

const currentData = editor.getJson();

.destroy()

Cleans up all DOM elements and event listeners.

editor.destroy();

Events

onChange

Emitted when JSON data is modified through the UI.

editor.on("onChange", (jsonData) => {
  console.log("Data changed:", jsonData);
});

onError

Emitted when invalid JSON is entered in the textarea.

editor.on("onError", (error) => {
  console.error("JSON error:", error);
});

Usage Guide

Navigating the Graph

  • Pan: Click and drag the background to move around
  • Zoom: Use mouse wheel to zoom in/out
  • Unfold/Collapse: Click on expandable nodes (Objects/Arrays) to toggle visibility

Editing Data

  • Edit Values: Double-click on any primitive value (string, number, boolean, null) to edit
  • Edit Keys: Double-click on object keys to rename them (array indices cannot be edited)
  • Commit Changes: Press Enter or click outside the input field
  • Cancel Edit: Press Escape to cancel

Data Types

The library automatically color-codes different data types:

  • Keys: Pink/Rose
  • Strings: Green
  • Numbers: Blue
  • Booleans: Orange
  • Null: Gray

Examples

See the included demo files:

  • demo-declarative.html - Declarative HTML initialization
  • demo-api.html - JavaScript API initialization
  • demo-dark.html - Dark theme example
  • demo-vertical.html - Vertical direction (top-to-bottom) example

Building from Source

# Install dependencies
npm install

# Build for production
npm run build

# Build for development with watch mode
npm run dev

Contributing

Contributions are welcome! Please feel free to submit issues or pull requests.

License

MIT License