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

@hirokisakabe/pom-editor

v0.7.0

Published

Reusable browser editor for pom with XML, AST, preview, and diagnostics UI.

Readme


Features

  • Complete Browser EditorPomEditor provides XML / AST mode switching, debounced preview, diagnostics, Refresh, pagination, and optional host actions.
  • Drag-and-Drop Structure Editing — Reorder siblings, move nodes between VStack / HStack / Layer containers, pull container children up to the root, or nest a container inside another — all by dragging in the AST tree.
  • Distinct "between" vs "inside" Drop Targets — Dropping on the gap before/after a row inserts as a sibling; dropping on a container body itself nests the node inside.
  • XML In / XML Out — Accepts a pom XML string via xml and returns the updated XML via onChange after each edit, so it drops into any editor / preview layout.
  • AST-Aware Tree View — Renders the parsed pom AST as a labeled tree so the structure of slides and nested containers is visible at a glance.
  • Powered by @dnd-kit/core — Built on @dnd-kit/core's PointerSensor for pointer-driven drag interactions.

Installation

Requires Node.js 22+ and React 18+

npm install @hirokisakabe/pom-editor react

@hirokisakabe/pom is pulled in automatically as a regular dependency — no separate install needed.

Quick Start

Complete editor

import { PomEditor } from "@hirokisakabe/pom-editor";

<PomEditor
  xml={xml}
  onChange={setXml}
  onPreview={async (nextXml, { signal }) => {
    const response = await fetch("/api/preview", {
      method: "POST",
      body: JSON.stringify({ xml: nextXml }),
      signal,
    });
    return response.json();
  }}
  onDownload={(nextXml) => downloadPptx(nextXml)}
  onExportImages={(nextXml, { format, scope, currentSlide }) =>
    exportImages(nextXml, {
      format,
      slides: scope === "current" ? [currentSlide] : undefined,
    })
  }
/>;

Preview generation and file operations stay in the host application. onDownload, onExportImages, onSave, and onCopyPreview are optional, and their actions only appear when the corresponding callback is provided. Image export adds PNG / SVG and current / all slide controls to the toolbar. SVG preview results are sanitized before they are inserted into the document.

Standalone AST editor

import { PomAstEditor } from "@hirokisakabe/pom-editor";
import { useState } from "react";

const initialXml = `
<Slide>
  <VStack gap="16" padding="24">
    <Text fontSize="32" bold="true">Title</Text>
    <Text>Body text</Text>
  </VStack>
</Slide>
`;

function App() {
  const [xml, setXml] = useState(initialXml);

  return (
    <div style={{ display: "flex", height: "100vh" }}>
      <div style={{ width: 300, borderRight: "1px solid #e5e7eb" }}>
        <PomAstEditor xml={xml} onChange={setXml} />
      </div>
      <div style={{ flex: 1, padding: 24 }}>
        <pre>{xml}</pre>
      </div>
    </div>
  );
}

API

<PomEditor />

| Prop | Type | Description | | ---------------- | ---------------------------------------------------------------------- | ------------------------------------------------ | | xml | string | Controlled pom XML source | | onChange | (xml: string) => void | Receives XML and AST edits | | onPreview | (xml, { signal }) => Promise<{ svgs } \| { errors }> | Host-provided preview adapter | | onDownload | (xml: string) => void \| Promise<void> | Optional Download action | | onExportImages | (xml, options: PomEditorImageExportOptions) => void \| Promise<void> | Optional PNG / SVG image export action | | onSave | (xml: string) => void \| Promise<void> | Optional Save action | | onCopyPreview | (svg: string) => void \| Promise<void> | Optional preview image copy action | | toolbarStart | ReactNode | Host content before the standard toolbar actions | | toolbarEnd | ReactNode | Host content after the standard toolbar actions | | debounceMs | number | Preview debounce delay (default: 500) | | className | string | Optional class name for the editor root | | style | CSSProperties | Optional inline style for the editor root |

<PomAstEditor xml onChange />

| Prop | Type | Description | | ------------------ | ----------------------- | ------------------------------------------------------------------ | | xml | string | pom XML string (one or more <Slide> elements) | | onChange | (xml: string) => void | Called with updated XML after each drag-and-drop reorder | | onRequestXmlMode | () => void | Optional callback shown after parse errors to return to XML source |

Renders a tree of nodes from the parsed XML. Each row supports two drop targets:

  • A thin gap between rows — drop here to insert as a sibling at that position (works across parents, so a node can be moved to any container or pulled up to the root).
  • The container row body itself — drop here to nest the dragged node as the last child of that container (VStack / HStack / Layer only). Drops on non-container bodies are ignored.

Top-level slides can be reordered via the root-level gaps. Cycle-forming drops (e.g. moving a container into its own descendant) are silently rejected.

License

MIT