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

@hfu.digital/boardkit-react

v2026.4.25

Published

React component library for BoardKit — dual-canvas renderer, hooks, and real-time collaboration UI

Downloads

2,982

Readme

@hfu.digital/boardkit-react

React component library for BoardKit. Provides a dual-canvas renderer, input pipeline, gesture recognition, and hooks for real-time collaboration.

Installation

bun add @hfu.digital/boardkit-react socket.io-client

Peer Dependencies

bun add react react-dom socket.io-client

Quick Start

import { BoardKitProvider, BoardCanvas, useCollaboration } from '@hfu.digital/boardkit-react';

function App() {
    return (
        <BoardKitProvider
            config={{
                apiUrl: 'http://localhost:3000/api',
                wsUrl: 'http://localhost:3000',
                authToken: 'your-jwt-token',
            }}
        >
            <Board />
        </BoardKitProvider>
    );
}

function Board() {
    useCollaboration('my-board');
    return <BoardCanvas />;
}

Architecture

BoardKitProvider

Wraps your app and provides context for all hooks. Creates stable instances of:

  • BoardStore — Mutable store outside React with slice-based pub/sub
  • Canvas2DRenderer — Dual-canvas rendering engine
  • ToolRegistry — Registered drawing tools

Dual-Canvas Renderer

Two stacked <canvas> elements for optimal performance:

  • Static layer: Re-renders only when the scene nonce changes (element create/update/delete)
  • Interactive layer: Re-renders every frame via requestAnimationFrame (previews, cursors, selections)

Input Pipeline

Translates DOM PointerEvents into BoardKit InputEvent objects:

PointerEvent → InputPipeline → GestureRecognizer → Tool.onPointerX()
  → ToolResult { mutations, preview }

Handles space+drag panning and wheel zoom automatically.

Hooks

useCollaboration(boardId)

Connects to the BoardKit Socket.IO server with automatic reconnection (max 5 attempts, exponential backoff):

const { connectionState, sendMutations, sendCursor, disconnect } = useCollaboration('board-1');

useBoard

Board CRUD operations via REST API.

useViewport

Pan, zoom, and viewport state management.

useTool

Active tool selection and configuration.

useHistory

Undo/redo integration.

useGrid

Grid visibility and snapping configuration.

useFollowMode

Follow another participant's viewport.

useImageImport

Import images onto the canvas.

useErrorRecovery

Handle and recover from connection/sync errors.

usePageNavigation

Multi-page navigation, creation, and reordering.

usePresence

Participant list and cursor positions.

useKeyboardShortcuts

Global keyboard shortcuts for common operations (Ctrl+Z undo, Ctrl+Y redo, Delete, etc.).

useExport

Client-side PNG and server-side export.

Store

BoardStore lives outside React for performance. Hooks use useSyncExternalStore to bridge into React's rendering cycle:

import { useBoardKit } from '@hfu.digital/boardkit-react';

function MyComponent() {
    const { store } = useBoardKit();
    // Subscribe to specific slices for granular re-renders
    store.subscribe('scene', (scene) => { /* ... */ });
}

License

MIT