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

@verevoir/editor

v1.8.0

Published

Lightweight React content editing components driven by Verevoir schema definitions

Readme

@verevoir/editor

Lightweight React components that auto-render content editing forms from @verevoir/schema block definitions. Pass a BlockDefinition and data; the editor renders correct inputs based on each field's UIHint.

No validation logic lives here — the schema engine handles that. No storage dependency — the editor is pure UI.

Install

npm install @verevoir/editor

Peer dependencies: react, react-dom, and zod must be installed in your project to avoid duplicate instances.

Quick Start

import { defineBlock, text, richText, boolean } from '@verevoir/schema';
import { BlockEditor, useBlockForm } from '@verevoir/editor';

const hero = defineBlock({
  name: 'hero',
  fields: {
    title: text('Title'),
    body: richText('Body'),
    visible: boolean('Visible'),
  },
});

function HeroEditor() {
  const [state, actions] = useBlockForm(hero, {
    title: '',
    body: '',
    visible: true,
  });
  return (
    <BlockEditor block={hero} value={state.value} onChange={actions.onChange} />
  );
}

Preview Frame

Viewport-switching preview container with zoom control. Renders children in a scaled, width-constrained surface — no knowledge of content blocks.

import { PreviewFrame } from '@verevoir/editor';

<PreviewFrame defaultViewport="Tablet">
  <h1>{page.title}</h1>
  <div dangerouslySetInnerHTML={{ __html: page.body }} />
</PreviewFrame>;

Custom viewports:

<PreviewFrame
  viewports={[
    { label: 'Small', width: 320 },
    { label: 'Large', width: 1440 },
  ]}
  defaultViewport="Large"
>
  {children}
</PreviewFrame>

Example Styles

The editor renders unstyled HTML with data- attributes. Optional CSS files provide a sensible starting point — import them to use, or copy and adapt:

// Style BlockEditor form fields
import '@verevoir/editor/styles/editor-form.css';

// Style PreviewFrame
import '@verevoir/editor/styles/preview-frame.css';

For editor-form.css, wrap your BlockEditor in a container with data-editor-form:

<div data-editor-form>
  <BlockEditor block={block} value={value} onChange={onChange} />
</div>

Architecture

| File | Responsibility | | --------------------------- | -------------------------------------------------------------------------------------------------- | | src/types.ts | Shared prop types — FieldEditorProps, BlockEditorProps, FieldOverrides | | src/utils.ts | unwrapSchema() strips ZodOptional/ZodDefault wrappers; inferUIHint() maps Zod types to UIHints | | src/BlockEditor.tsx | Top-level component — takes BlockDefinition, iterates fields, delegates to FieldRenderer | | src/FieldRenderer.tsx | Dispatch — maps UIHint to field component, resolves overrides (field-name > UIHint > default) | | src/PreviewFrame.tsx | Viewport-switching preview with zoom — renders children in a scaled, width-constrained surface | | src/fields/*.tsx | Eight built-in field components: Text, RichText, Number, Boolean, Select, Array, Object, Reference | | src/hooks/useBlockForm.ts | Optional hook — manages form state, validation via schema engine, dirty tracking | | src/styles/*.css | Optional example CSS for PreviewFrame and BlockEditor forms |

Design Decisions

  • Fully controlled components — no internal form state; BlockEditor takes value + onChange.
  • Rich text = textarea for v1 — overridable via the override mechanism.
  • Override mechanismoverrides prop maps field names or UIHints to custom components.
  • Zod introspection — SelectField reads ZodEnum.options, ArrayField reads ZodArray.element, ObjectField reads ZodObject.shape.
  • No <form> tag — the developer controls form submission, styling, and layout.

Documentation

Development

npm install    # Install dependencies (links @verevoir/schema from ../schema-engine)
make build     # Compile via tsup (ESM + CJS + .d.ts)
make test      # Run vitest (jsdom, no Docker needed)
make lint      # Check formatting