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

@shnea/editor

v0.1.5

Published

Reusable Tiptap-based editor and viewer package with configurable file-service upload integration.

Readme

@shnea/editor

@shnea/editor is a reusable Tiptap-based editor package for Shnea services.

It provides:

  • ShneaEditor: a rich text editor wrapper for article, comment, sms, and no-toolbar presets
  • ShneaViewer: a sanitized HTML viewer with click-to-zoom image preview
  • createFileServiceUploadAdapter: a file-service integration helper for image and file uploads

ShneaEditor itself is not tied to file-service. If your app has its own upload API, pass a custom uploadAdapter. Use createFileServiceUploadAdapter only when you want to call Shnea file-service.

Install

npm install @shnea/editor

Usage

import { ShneaEditor, createFileServiceUploadAdapter } from '@shnea/editor';
import '@shnea/editor/editor.css';

const uploadAdapter = createFileServiceUploadAdapter({
  baseUrl: import.meta.env.VITE_FILE_SERVICE_BASE_URL,
  bearerToken: accessToken,
  retentionCategory: 'editor',
});

<ShneaEditor
  mode="article"
  value={value}
  onChange={(html) => setValue(html)}
  uploadAdapter={uploadAdapter}
/>;

Modes

  • article: full toolbar preset
  • comment: compact writing preset
  • sms: byte-limited preset
  • no-toolbar: editor preset without toolbar UI

Fonts

  • Pretendard 400/600 is loaded by default for editor font selection.
  • Other bundled font options are loaded lazily when selected in the toolbar.

Upload adapter choice

Use one of these two patterns:

  • Use createFileServiceUploadAdapter when you want to upload to Shnea file-service.
  • Use a custom uploadAdapter when you want to upload to your own file API.

@shnea/editor does not read env vars or manage tokens by itself. The consuming app is responsible for preparing and passing upload configuration.

Editor upload behavior:

  • Raster images are converted to compressed webp before upload.
  • Large images are resized down to a max edge of 2560px before encoding.
  • gif and svg uploads are left unchanged.
  • The editor shows an in-place loading overlay while uploads are running.

1. Use Shnea file-service

import { ShneaEditor, createFileServiceUploadAdapter } from '@shnea/editor';

const uploadAdapter = createFileServiceUploadAdapter({
  baseUrl: import.meta.env.VITE_FILE_SERVICE_BASE_URL,
  bearerToken: accessToken,
  retentionCategory: 'editor',
});

2. Use your own upload API

import { ShneaEditor } from '@shnea/editor';

const uploadAdapter = async (file: File) => {
  const formData = new FormData();
  formData.append('file', file);

  const response = await fetch('/api/uploads', {
    method: 'POST',
    body: formData,
  });

  if (!response.ok) {
    throw new Error('Upload failed');
  }

  const data = await response.json();

  return {
    url: data.previewUrl ?? data.url,
    name: data.name ?? file.name,
    fileId: data.fileId,
    previewUrl: data.previewUrl ?? data.url,
    downloadUrl: data.downloadUrl ?? data.url,
    mimeType: file.type,
    size: file.size,
  };
};

File service integration

  • Uploads use POST /files/upload with Bearer JWT.
  • createFileServiceUploadAdapter sends retentionCategory=editor by default.
  • Override retentionCategory per consumer app when a different retention policy is required.
  • Reads use the returned previewUrl or downloadUrl.
  • Store fileId as the canonical attachment reference in the consuming service.
  • Handle 401, 413, and 507 as explicit upload failures.

Detailed integration docs:

Scripts

  • npm run build: build the package
  • npm run check: TypeScript type-check
  • npm run test: alias of check

Environment

The package itself does not read env vars directly. If you use createFileServiceUploadAdapter, the consuming app should provide:

  • FILE_SERVICE_BASE_URL
  • a valid upload Bearer token