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

@recogito/custom-annotation-view-example

v0.0.10

Published

An example plugin that adds a new annotation view route

Readme

Example Plugin: Custom Annotation View

A proof of concept for using a plugin to inject a custom annotation view, fully replacing the standard Recogito Studio text-/image annotation view. This plugin currently provides:

  1. A new Astro page route at /[lang]/annotate-custom/[contextId]/[documentId]
  2. A new menu option in the Document Card, which opens the document in the custom view.

Overview

Injected Page Route

The annotation view is injected using the standard Astro Integrations mechanism. The page itself is a minimal .astro file (see here) that:

  • Computes the realtime channel ID (derived from the server-side env variable).
  • Instantiates the React entry-point component.

[!NOTE] The React component is instantiated with client:only. This is necessary because OpenSeadragon is not compatible with SSR! Initially, I had trouble with client:only failing in Vite (client:load was fine):

The request url [...] is outside of Vite serving allow list

I got around this by explicitely allowing the parent directory in the dev app config. This ajdustment should only be necessary in dev mode, and wouldn't be needed in a Recogito Studio production deployment. But I haven't tested yet!

Document Menu Extension

The GoToExampleCustomView extension adds a new menu entry to the project:document-actions extension point, providing a link to the custom route.

[!WARNING] Currently, we have no mechanism for disabling or replace the standard Open document and Open document in new tab entries. This may be worth thinking about for later!

Custom Annotation View

The annotation view itself is a a React single page app. It receives the following input props from the .astro page:

  • documentId
  • contextId
  • channelId for realtime annotation updates

[!IMPORTANT] Currently, the component strictly expects a TEI document. It will just fail with other content types (plaintext, PDF, image). Later, we should implement separate React SPAs, and conditionally load them from the .astro page.)

Implementation Notes:

  • Backend interaction happens through the SDK. This requires an .env file with valid credentials in the .dev/ folder.
  • I added convenience hooks for easier access to document, context and stored file content.
  • Similarly, I added a simplified SupabaseStorageAdapter, adapted from the core codebase. This component transparently handles annotation storage and realtime sync.

Installation

To test this plugin, you'll need access to a live Recogito Studio backend. For most development, I recommended running the plugin through the SDK development app (already included in this repo), though setup is tricky.

1. Build the Plugin

First, build the plugin itself:

cd .dev
npm install
cd ..
npm install
npm run build

2. Install in a Local Recogito Client

  1. Clone a local copy of the recogito-client.
  2. Make sure a valid .env file is configured in your client.
  3. Add this plugin as a local file: dependendency in package.json (modify the path as needed):
"depdendencies": {
  // ...
  "@recogito/custom-annotation-view-example": "file:../example-plugin-annotation-view"
  // ...
}
  1. Register the plugin in astro.config.mjs:
import { defineConfig } from 'astro/config';
import react from '@astrojs/react';
import netlify from '@astrojs/netlify';
+ import CustomViewPlugin from '@recogito/custom-annotation-view-example';

export default defineConfig({
  integrations: [
    react(),
+    CustomViewPlugin()
  ],
  output: 'server',
  adapter: netlify(),
  vite: {
    ssr: {
      noExternal: ['clsx', '@phosphor-icons/*', '@radix-ui/*']
    },
    optimizeDeps: {
      esbuildOptions: {
        target: 'esnext'
      }
    }
  }
});
  1. Start Recogito Studio with npm start.
  2. To verify installation was successful: open a project, go to Project SettingsPlugins and check if the plugin is available in the plugin gallery.
  3. Navigate to a TEI document, open it in the annotation view, and note its contextID and documentId from the URL (e.g. http://localhost:4321/en/annotate/[contextId]/[document-id])

3. Run with the Development App

For active development, it's easier to use the plugin outside of Recogito Studio, with the SDK development app (with hot-reloading).

Requirements:

  • A valid .env file in the .dev/ folder with backend credentials.
  • You must be logged in to Recogito Studio. The dev app does not currently provide a login mechanism. Therefore the ugly workaround is:
    • Start a local Recogito Client (e.g. at http://localhost:4321) and log in.
    • Stop Recogito, then run the dev app on the same port. This reuses the login credentials from your earlier session.

Finally, open a valid context/document manually:

http://localhost:4321/en/annotate-custom/[contextId]/[documentId]