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

@docengine/editor

v0.1.1

Published

Embeddable document template editor built on Editor.js with inline fields, design mode, and JSON import/export.

Readme

@docengine/editor

Embeddable document template editor built on Editor.js with inline fields, design mode, and JSON import/export.

Install

npm install @docengine/editor @editorjs/editorjs

See SPECIFICATIONS.md for the full interface reference (data contracts, export formats, catalogs, pickers, tool config).

Quick start

import { createEditor } from '@docengine/editor';
import '@docengine/editor/styles.css';

styles.css bundles Inter (weights 400, 500, 600) via @fontsource/inter. If your host app loads Inter another way, you can omit the bundled faces and rely on the same stack from EDITOR_FONT_FAMILY / Page setup.

// Optional: theme bridge for PrimeVue 4 / OpenVue or Salesforce Lightning
// import '@docengine/editor/themes/bridge.css';
// import '@docengine/editor/themes/prime.css';

themes/prime.css maps Template design chrome (--me-surface-*, accents, formula picker, design panels) to PrimeVue/OpenVue semantic tokens so light and dark hosts (e.g. darkModeSelector: '.app-dark') stay readable. Prefer this over host-app CSS overrides for dark mode.

const docEngine = createEditor({
  holder: '#editor',
  data: {
    time: Date.now(),
    fieldSchemas: {},
    blocks: [],
  },
  catalogs: {
    lists: { /* commonListId → { items, withCode? } */ },
    trees: { /* commonTreeId → { tree } */ },
  },
});

await docEngine.ready;
const doc = await docEngine.exportDoc();

API

createEditor(options)

| Option | Description | |--------|-------------| | holder | DOM element or CSS selector | | data | Initial { time, fieldSchemas, blocks } | | defaultDocument | Fallback when loading empty data | | catalogs | { lists, trees } for commonListId / commonTreeId | | designMode | Start in design mode | | tools | ['documentSection', 'templateBlock'] (+ optional visionTable) | | visionTableTool | Custom Editor.js tool class for legacy tables | | imageUpload | { uploadUrl, stub } | | onChange | (doc) => void | | onSchemaChange | (fieldSchemas) => void |

Instance methods

  • getDocument(), exportDoc(), exportTemplate(), exportFields()
  • load(data) — document, template, or fields JSON
  • setDesignMode(bool), preview(), exportPdf(options?), validate(), destroy()

Deprecated alias (still works): exportDocument() → exportFields().

Utilities (import without mounting)

IO_VERSION, buildDocExport, buildFieldsExport, normalizeImportedDoc, validateRequiredFields, renderDocumentPreview, exportDocumentPdf, SchemaRegistry, createCatalogProvider, getFieldTypes, registerField, FIELD_TYPES

Date fields require the separate plugin @docengine/field-date (see SPEC §14.2).

Web Component

import { defineDocEditorElement } from '@docengine/editor';

defineDocEditorElement();
// <doc-editor design-mode></doc-editor>

Theming (PrimeVue 4 / Salesforce Lightning)

Import the base stylesheet, then the shared bridge and one host adapter:

import '@docengine/editor/styles.css';
import '@docengine/editor/themes/bridge.css';
import '@docengine/editor/themes/prime.css'; // or themes/slds.css

Salesforce LWC: From the monorepo root run npm run build:sf, then deploy Static Resources from apps/salesforce/force-app/:

npm run build:sf
# DocEngineCss + DocEngineBundle → apps/salesforce/force-app/main/default/staticresources/

Or import the CSS only in a Vite host:

import '@docengine/editor/themes/lwc.css'; // dist/editor-lwc.css

See integrations/lwc/ for a reference Lightning component and integrations/salesforce/ARCHITECTURE.md for the AppExchange data model.

Add class doc-editor-host to your editor container (and optionally sticky chrome wrapper). Map document field typography via fieldValueStyle.default. See SPECIFICATIONS.md §15.1 for full integration notes.

Demo

See apps/ophthalmology-demo in the monorepo for a full ophthalmology template example.