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

swerasty_editor

v0.2.8

Published

A high-performance rich text editor with integrated AI math recognition.

Readme

Swerasty Editor

A professional-grade, React-based rich text editor featuring an integrated AI Math Pad. This editor allows users to draft complex documents with high-quality formatting and insert mathematical or chemical formulas through either keyboard input or AI-powered handwriting recognition.

Key Features

  • Rich Text Formatting: Standard controls for bold, italic, underline, strike-through, font sizing, and colors.
  • AI Math Pad: A specialized modal for formulas:
    • Handwriting Recognition: Draw formulas on a digital canvas and have Gemini convert them to LaTeX.
    • Keyboard Input: Efficiently build formulas using symbol palettes.
    • Chemistry Support: Dedicated mode for chemical elements and reaction arrows.
  • Tables & Images: Seamlessly insert and manage tables and local image uploads.
  • History Management: Reliable undo/redo stack for both text editing and formula drawing.
  • KaTeX Rendering: Real-time, beautiful mathematical rendering.

Getting Started

1. Installation

The editor relies on standard React 19 dependencies. Ensure you have the following in your package.json:

  • react, react-dom
  • @google/genai (for AI features)
  • lucide-react (for iconography)

2. API Key Configuration

To enable the AI Handwriting recognition, you must provide a Google Gemini API Key. You can obtain one from the Google AI Studio.

Usage Guide

Basic Component Implementation

import React, { useRef } from 'react';
import Editor, { EditorRef } from './components/Editor';

const MyComponent = () => {
  const editorRef = useRef<EditorRef>(null);

  return (
    <Editor 
      ref={editorRef}
      initialContent="<h1>Hello Coders</h1>" 
      apiKey="YOUR_GEMINI_API_KEY"   //optional
      onChange={(html) => console.log('Content changed:', html)}
    />
  );
};

How to Get Output

The editor uses an imperative handle pattern. You can retrieve the current HTML content at any time using the getContent() method on the editor reference.

const handleSave = () => {
  if (editorRef.current) {
    const htmlOutput = editorRef.current.getContent();
    // Save htmlOutput to your database or process it
    console.log(htmlOutput);
  }
};

How to Set Content Back

To programmatically update the editor's state (e.g., loading a saved draft), use the setContent(html) method.

const handleLoadDraft = (savedHtml: string) => {
  if (editorRef.current) {
    editorRef.current.setContent(savedHtml);
  }
};

AI Math Pad Instructions

  1. Open the Pad: Click the Σ (AI Math Pad) icon in the toolbar.
  2. Switch Modes: Use the sidebar to toggle between Keyboard (typing LaTeX) and Pencil (drawing).
  3. Recognize: If drawing, click Recognize Drawing. The Gemini AI will analyze your stroke data and convert it into a valid LaTeX string.
  4. Insert: Preview the rendered formula at the bottom of the modal. If it looks correct, click Insert Into Editor.

Technical Details

  • Dependencies: The app uses KaTeX via CDN. Ensure your index.html includes the KaTeX CSS/JS for formulas to render correctly.
  • Styling: Powered by Tailwind CSS (via CDN in the standalone version) and the @tailwindcss/typography plugin for "Prose" styling.
  • Model: Uses gemini-3-pro-preview for high-accuracy handwriting analysis.

Designed for developers who need a powerful, formula-aware editing experience in their web applications.