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

@fabrika/annotations

v0.2.0

Published

React annotation state, text/block/region locators, editor and feedback surface.

Readme

@fabrika/annotations

React annotation state, text/block/image-region locators, editors, popovers and markdown serialization. No Bun runtime, canvas compiler, revision store or question/response state is required. Preact hosts can map React imports to preact/compat.

State and persistence

import {
	AnnotationHostContext,
	AnnotationProvider,
	useAnnotations,
} from '@fabrika/annotations'
import type { AnnotationState } from '@fabrika/annotations'

const drafts = new Map<string, AnnotationState>()
const loadState = async (scope: string) => drafts.get(scope) ?? null
const saveState = (scope: string, state: AnnotationState) => {
	drafts.set(scope, state)
}

function Notes() {
	const { generalNote, setGeneralNote } = useAnnotations()
	return (
		<textarea
			value={generalNote}
			onChange={(event) => setGeneralNote(event.currentTarget.value)}
		/>
	)
}

export function Review() {
	return (
		<AnnotationHostContext.Provider
			value={{
				sessionId: 'review',
				isShared: false,
				fsAvailable: false,
				uploadUrl: null,
			}}
		>
			<AnnotationProvider
				scope="review:image-1"
				loadState={loadState}
				saveState={saveState}
			>
				<Notes />
			</AnnotationProvider>
		</AnnotationHostContext.Provider>
	)
}

scope identifies one draft. Changing it resets the draft and cancels stale loads. The host supplies stable loadState and saveState callbacks. Persisted state contains only annotations and generalNote; remote annotations are merged for display but are not saved as local annotations.

Hosts with their own persistence coordinator can use useAnnotationState with controlled state and provide its result through AnnotationCtx.Provider.

AnnotationHost declares upload and file capabilities. It does not load canvas modules. findAnnotationElement(annotation, root) accepts a host-selected DOM root. The optional canvasFile annotation metadata is retained for existing serialized records; this package does not interpret canvas navigation or revisions.

Bundling and styles

An annotation locator implements AnnotationTarget<L>: parse, format and find, with optional restore and describe. Text, document blocks and image regions are included. Creation and lookup must use the same selector.

For one browser bundle, import the package normally. For multiple independently built bundles, externalize @fabrika/annotations/runtime in all of them and map it to one shared runtime bundle. That module owns annotation, session and host contexts. Never inline a second copy into the components bundle.

Import @fabrika/annotations/styles.css into a Tailwind v4 stylesheet to scan the surface classes. The host supplies theme tokens; the canvas kernel provides its own theme through @fabrika/canvas-kernel/styles.css.