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

annota

v0.11.1

Published

An annotation framework for React and Svelte

Readme

Annota

Annota is a framework-independent annotation engine for large, zoomable images. Digital pathology is its primary use case, but the core model deliberately understands only annotations, geometry, layers, spatial candidates, interaction, history, and rendering. Cell, nucleus, diagnosis, relationships, statistics, and persistence belong to the application domain.

Installation

npm install annota openseadragon
# Install only the framework integration you use:
npm install react react-dom
# or
npm install svelte

React and Svelte are optional peers. Canonical imports are separated:

import { createAnnotator, type AnnotationInput } from 'annota';
import { AnnotaProvider, Viewer, Annotator, useAnnotator } from 'annota/react';
import { AnnotaProvider, Viewer, Annotator } from 'annota/svelte';
import { PointTool, PolygonTool } from 'annota/tools';
import { loadH5Masks, loadInstanceMask } from 'annota/loaders';
import 'annota/styles.css';

The root package is framework-independent. Existing React consumers can temporarily migrate root component imports through annota/legacy-react; that compatibility entry and annota/dist/index.css are deprecated since 0.11 and planned for removal in 2.0.

Framework-independent usage

const annotator = await createAnnotator({
  viewer,
  annotations: [{
    id: 'region-1',
    layerId: 'regions',
    shape: {
      type: 'polygon',
      points: [{ x: 10, y: 10 }, { x: 80, y: 10 }, { x: 40, y: 60 }],
    },
    properties: { reviewState: 'pending' },
  }],
});

const dispose = annotator.events.on('annotation:update', event => {
  if (!event.context.transient) persist(event.annotation);
});

try {
  annotator.annotations.update('region-1', {
    properties: { reviewState: 'approved' },
  });
} finally {
  dispose();
  annotator.destroy();
}

Annota computes and freezes geometry bounds on every write. Public collections are detached snapshots; all stable writes pass through the façade, history, transaction, event, store, spatial, and rendering pipeline. Geometry operations reject results containing holes with GEOMETRY_UNSUPPORTED because the current shape model cannot represent interior rings; they never silently fill those holes.

Capability API

  • annotations: add, batch upsert, patch, remove, replace, get, and list.
  • selection: set, clear, and read selected IDs.
  • layers: create, update, remove, and control visibility, opacity, lock, and z-index.
  • spatial.search: fast bounds candidates only.
  • geometry: exact intersects, contains, intersection, IoU, merge, and split operations.
  • history: undo, redo, state, and clear.
  • events: typed, disposable subscriptions with source, transactionId, and transient.
  • tools: active interactive tool boundary.

Layer z-index controls only drawing order. Hidden layers are excluded from rendering and hit testing; locked layers remain readable and visible but cannot be edited by users or tools.

Domain mapping for instance masks

The core decoder does not interpret class IDs:

const annotations = await loadInstanceMask(buffer, {
  decodePixel(pixel) {
    const instanceId = (pixel.r << 8) | pixel.g;
    return instanceId === 0
      ? null
      : { instanceId, attributes: { classId: pixel.b } };
  },
  mapProperties(instance) {
    return {
      entityType: 'cell',
      cellClass: mapClass(instance.attributes?.classId),
    };
  },
});

Without mapProperties, output contains only generic source, instance ID, attributes, and area.

Performance

Annota uses PixiJS, viewport culling, R-tree candidate queries, cached rendering, and fixed-seed benchmarks. Run pnpm build && pnpm benchmark for the reproducible 1k/10k/50k core workload. Hardware-dependent frame-rate claims are intentionally not published without a fixed browser and device result.

Development and migration

pnpm install
pnpm typecheck
pnpm exec vitest run
pnpm build
pnpm --dir docs build
pnpm test:consumer
pnpm benchmark:ci

See the migration guide, CONTRIBUTING.md, and PUBLISHING.md.

License

MIT