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

@openmaic/editor

v0.0.4

Published

Composable slide editing core, React surface, and UI for OpenMAIC.

Readme

@openmaic/editor

Composable slide-editing package for OpenMAIC.

  • @openmaic/editor/core: document operations, transactions, and undo/redo history.
  • @openmaic/editor/react: editable slide interaction surface and rich-text editors.
  • @openmaic/editor/ui: editor toolbars, insertion controls, and context menus.

Dependencies

@openmaic/editor
├─> @openmaic/renderer   (reuses the read-only slide renderer)
└─> @openmaic/dsl        (document and element data contracts)

@openmaic/renderer does not depend on @openmaic/editor, so the package boundary remains one-way and free of circular dependencies.

The host application owns controlled document state, selection, persistence, and the final onTransaction sink. @openmaic/editor owns built-in element adapters, insertion defaults, toolbars, dialogs, clipboard behavior, shortcuts, and the conversion of UI intents into editor transactions. Hosts may provide stable capabilities such as locale, element ID generation, and a generic asset picker; they do not configure individual element types.

Install and styles

The editor uses the renderer and DSL directly. Install them alongside the renderer's required peers and KaTeX so the host can import their public styles:

pnpm add @openmaic/editor @openmaic/dsl @openmaic/renderer \
  react react-dom motion tailwindcss katex

Import the renderer fonts and KaTeX stylesheet once from the application shell:

import '@openmaic/renderer/fonts.css';
import 'katex/dist/katex.min.css';

The renderer emits Tailwind 4 classes. Configure Tailwind to scan node_modules/@openmaic/renderer/dist/**/*.{js,cjs} as described in the @openmaic/renderer setup. Charts and code elements also need the renderer's optional echarts and shiki peers respectively.

Editor surface

EditableSlideCanvasWithUI is a controlled editor surface. The host provides the current slide and selection, then applies and persists the canonical transactions emitted by the editor. This complete example keeps undo history in React state; a production host can persist history.present whenever it changes:

import { useCallback, useState } from 'react';
import type { SlideContent } from '@openmaic/dsl';
import { applyEditorTransaction, createEditorHistory, type EditorTransaction } from '@openmaic/editor/core';
import { EMPTY_SELECTION, type Selection } from '@openmaic/editor/react';
import { EditableSlideCanvasWithUI, type EditorInsertItem } from '@openmaic/editor/ui';

const insertItems: EditorInsertItem[] = ['text', 'image', 'table', 'audio'];

export function SlideEditor({ initialContent }: { initialContent: SlideContent }) {
  const [history, setHistory] = useState(() => createEditorHistory(initialContent));
  const [selection, setSelection] = useState<Selection>(EMPTY_SELECTION);
  const applyTransaction = useCallback((transaction: EditorTransaction) => {
    setHistory((current) => applyEditorTransaction(current, transaction));
  }, []);

  return (
    <div style={{ width: '100%', height: '100%', minHeight: 480 }}>
      <EditableSlideCanvasWithUI
        slide={history.present.canvas}
        selection={selection}
        onSelectionChange={setSelection}
        onTransaction={applyTransaction}
        insertItems={insertItems}
        snapping
      />
    </div>
  );
}

insertItems is optional. It controls both which insert buttons are visible and their display order. When omitted, the toolbar uses this built-in order:

text, image, table, chart, line, background, latex, video, audio

Pass an empty array to hide the insert toolbar. Repeated values are displayed once, at their first position. This option only changes insert-button visibility and ordering; it does not disable rendering or editing existing elements of those types.

Localization

The editor has built-in Chinese and English labels. A host can provide any other language through a framework-independent translate capability:

const host: EditorHostCapabilities = {
  locale,
  translate: (key, params, defaultMessage) =>
    appTranslate(`edit.${key}`, { ...params, defaultValue: defaultMessage }),
};

<EditableSlideCanvasWithUI host={host} {...props} />;

Changing locale or translate causes visible editor controls and open overlays to use the new language without resetting the controlled document or selection. The editor does not depend on a specific i18n library; appTranslate may come from i18next, react-intl, a local dictionary, or any other translation system. Missing external translations can use defaultMessage, which contains the editor's built-in fallback label.