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

@dooboostore/dom-editor

v1.0.1

Published

A visual drag-and-drop DOM editor for creating and manipulating HTML structures with real-time preview

Readme

@dooboostore/dom-editor

NPM version Build and Test License: MIT

Full Documentation: https://dooboostore-develop.github.io/@dooboostore/dom-editor

A visual drag-and-drop DOM editor for building, editing, and exporting HTML structures in real time.

Features

  • Visual drag and drop editing for element trees.
  • Structured JSON export/import (NodeData) for persistence.
  • Runtime property panel for attributes and content editing.
  • Mobile-friendly interaction with drag delay control.
  • Root-first API usage plus bundle-entry support.
  • ESM/CJS/UMD/ESM-bundle outputs.

Installation

npm install @dooboostore/dom-editor
yarn add @dooboostore/dom-editor
pnpm add @dooboostore/dom-editor

Import Guide

Root import (recommended)

import { DomEditor } from '@dooboostore/dom-editor';

Bundle entry import

import { DomEditor } from '@dooboostore/dom-editor/bundle-entry';

Quick Start

Basic Usage

import { DomEditor } from '@dooboostore/dom-editor';

const editor = new DomEditor('#editor-container', {
  debug: true,
  enableMobileSupport: true
});

// Get the generated HTML
const html = editor.getContent();
console.log(html);

With Custom Options

import { DomEditor, DomEditorOptions } from '@dooboostore/dom-editor';

const options: DomEditorOptions = {
  initialContent: '<section class="hero"><h1>Hello</h1></section>',
  debug: false,
  dragDelay: 500, // milliseconds
  enableMobileSupport: true,
  customStyles: `
    .my-custom-element {
      background: linear-gradient(45deg, #ff6b35, #f7931e);
      color: white;
    }
  `
};

const editor = new DomEditor(document.getElementById('editor-container')!, options);

Structured Data Import

import { DomEditor, NodeData } from '@dooboostore/dom-editor';

const initialTree: NodeData = {
  nodeType: 'element',
  tagName: 'div',
  className: 'container',
  children: [
    {
      nodeType: 'element',
      tagName: 'h2',
      children: [{ nodeType: 'text', textContent: 'Welcome' }]
    }
  ]
};

const editor = new DomEditor('#editor', { initialContent: initialTree });

HTML Usage (UMD Bundle)

<!DOCTYPE html>
<html>
<head>
  <title>DOM Editor Example</title>
</head>
<body>
  <div id="editor-container"></div>
  
  <script src="https://unpkg.com/@dooboostore/dom-editor/dist/umd-bundle/dooboostore-dom-editor.umd.js"></script>
  <script>
    const editor = new dooboostoreDomEditor.DomEditor('#editor-container', {
      debug: true
    });
  </script>
</body>
</html>

API Reference

DomEditor Class

Constructor

new DomEditor(target: string | HTMLElement, options?: DomEditorOptions)

Options

interface DomEditorOptions {
  /** Initial content: HTML string or structured NodeData */
  initialContent?: string | NodeData;
  /** Enable debug mode */
  debug?: boolean;
  /** Custom CSS styles to inject */
  customStyles?: string;
  /** Drag activation delay in milliseconds (default: 500) */
  dragDelay?: number;
  /** Enable mobile touch support */
  enableMobileSupport?: boolean;
}

Methods

Content I/O
// Load HTML string or structured NodeData
editor.loadContent('<div>New content</div>');
editor.loadContent(nodeData);

// Get current HTML content
const html = editor.getContent();

// Export structured root element data
const data = editor.exportData(); // ElementNodeData

// Import structured data
editor.importData(data);
Lifecycle
// Destroy editor and clean up
editor.destroy();

Data Types

ElementData

interface ElementData {
  nodeType: 'element';
  tagName: string;
  id?: string;
  className?: string;
  attributes?: Record<string, string>;
  children?: NodeData[];
}

interface TextNodeData {
  nodeType: 'text';
  textContent: string;
}

type NodeData = ElementData | TextNodeData;

Features in Detail

Drag & Drop System

  • Smart Activation: 500ms hold delay prevents accidental drags
  • Visual Feedback: Clear indicators for drop zones and positions
  • Mobile Optimized: Touch-friendly with scroll detection
  • Nested Support: Drag elements into other elements as children

Property Editor

  • Live Editing: Change tag names, attributes, and content in real-time
  • Attribute Management: Add, edit, and remove HTML attributes
  • Visual Interface: User-friendly forms for all editing operations

Content Export/Import

  • Export current edited tree as JSON.
  • Import JSON into editor and resume editing flow.
  • Export HTML string for direct embedding.

Mobile Support

  • Touch Events: Full touch event handling for mobile devices
  • Scroll Detection: Smart detection between scroll and drag intentions
  • Responsive Design: Works on all screen sizes

Animation System

  • Smooth Transitions: CSS-based animations for all interactions
  • Visual Feedback: Hover effects, selection indicators, and drag previews
  • Performance Optimized: Hardware-accelerated transforms

Browser Support

  • Chrome 80+
  • Firefox 75+
  • Safari 13+
  • Edge 80+

Examples

Basic HTML Builder

import { DomEditor } from '@dooboostore/dom-editor';

const editor = new DomEditor('#builder');

// Add event listener for content changes
document.getElementById('export-btn')?.addEventListener('click', () => {
  const html = editor.getContent();
  console.log('Generated HTML:', html);
});

Persist and Restore

const saved = editor.exportData();
localStorage.setItem('dom-editor:data', JSON.stringify(saved));

const raw = localStorage.getItem('dom-editor:data');
if (raw) {
  editor.importData(JSON.parse(raw));
}

Form Builder

import { DomEditor } from '@dooboostore/dom-editor';

const formBuilder = new DomEditor('#form-builder', {
  initialContent: `
    <form>
      <div class="form-group">
        <label>Name:</label>
        <input type="text" name="name" />
      </div>
    </form>
  `
});

Page Layout Designer

import { DomEditor } from '@dooboostore/dom-editor';

const layoutDesigner = new DomEditor('#layout-designer', {
  customStyles: `
    .layout-section {
      min-height: 200px;
      border: 2px dashed #ccc;
      padding: 20px;
    }
    .layout-header {
      background: #f8f9fa;
      padding: 20px;
    }
  `
});

Development

Building from Source

# Clone the repository
git clone https://github.com/dooboostore-develop/packages.git
cd packages/source/packages/@dooboostore/dom-editor

# Install dependencies
pnpm install

# Build all formats
pnpm run build

# Watch mode for development
pnpm run watch

Available Scripts

  • pnpm run build - Build all formats (ESM, CJS, UMD)
  • pnpm run build:esm - Build ES modules
  • pnpm run build:cjs - Build CommonJS modules
  • pnpm run build:umd-bundle - Build UMD bundle
  • pnpm run watch - Watch mode for development
  • pnpm run typecheck - Type checking

Best Practices

  • Initialize the editor with a stable container element size.
  • Use structured NodeData for long-term persistence or server sync.
  • Sanitize untrusted HTML before passing it into loadContent.
  • Call destroy() when unmounting to clean up editor resources.

Troubleshooting

Issue: Element not found: #selector in constructor
Solution: ensure target element exists before creating DomEditor.

Issue: Dragging feels too sensitive on touch devices
Solution: increase dragDelay in options.

Issue: Imported JSON fails
Solution: root object must be nodeType: 'element' and follow NodeData schema.

Contributing

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

License

MIT © dooboostore

Support