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

@burnmark-io/designer-react

v0.2.0

Published

React hook for the burnmark label design engine

Readme

@burnmark-io/designer-react

React 18+ hook for @burnmark-io/designer-core — the headless label design engine behind burnmark.io.

Wraps a LabelDesigner instance with reactive state, a debounced render loop with stale-result cancellation, selection management, and the full designer action surface.

Install

pnpm add @burnmark-io/designer-react @burnmark-io/designer-core react

react (>=18) and @burnmark-io/designer-core are peer dependencies.

Quick start

import { useLabelDesigner } from '@burnmark-io/designer-react';

export function Editor() {
  const { document, bitmap, isRendering, canUndo, canRedo, add, undo, redo } = useLabelDesigner({
    canvas: { widthDots: 696, heightDots: 0, dpi: 300 },
  });

  function addHello() {
    add({
      type: 'text',
      x: 10,
      y: 10,
      width: 200,
      height: 40,
      rotation: 0,
      opacity: 1,
      locked: false,
      visible: true,
      color: '#000000',
      content: 'Hello',
      fontFamily: 'Burnmark Sans',
      fontSize: 20,
      fontWeight: 'normal',
      fontStyle: 'normal',
      textAlign: 'left',
      verticalAlign: 'top',
      letterSpacing: 0,
      lineHeight: 1.2,
      invert: false,
      wrap: false,
      autoHeight: false,
    });
  }

  return (
    <div>
      <button onClick={addHello}>Add text</button>
      <button disabled={!canUndo} onClick={undo}>
        Undo
      </button>
      <button disabled={!canRedo} onClick={redo}>
        Redo
      </button>
      {isRendering && <p>rendering…</p>}
      <p>{document.objects.length} objects</p>
    </div>
  );
}

What you get back

| name | type | description | | --------------------- | ---------------------------------- | ----------------------------------------------- | | designer | LabelDesigner | Raw instance — escape hatch | | document | LabelDocument | Current document. Re-reads on every render | | canUndo / canRedo | boolean | History state | | bitmap | LabelBitmap \| null | Latest render (debounced 200ms) | | planes | Map<string, LabelBitmap> \| null | Multi-plane render when capabilities is set | | isRendering | boolean | True while a render is in flight | | renderWarning | RenderWarning \| null | Non-fatal warning from the core render pipeline | | renderError | Error \| null | Render failure | | selection | string[] | Selected object IDs — auto-pruned on remove | | select / deselect | (ids) => void / () => void | Selection actions |

Plus the full designer action surface: add, update, remove, reorder, get, getAll, setCanvas, undo, redo, clearHistory, loadDocument, newDocument, toJSON, fromJSON, getPlaceholders, applyVariables, render (force immediate), exportPng, exportPdf, exportSheet, exportBundled.

Options

useLabelDesigner({
  canvas?: Partial<CanvasConfig>;            // when hook constructs the designer
  name?: string;
  designer?: LabelDesigner;                  // wrap an externally-owned instance
  capabilities?: PrinterCapabilities;        // switches render to multi-plane mode
  renderDebounceMs?: number;                 // default 200
  renderOnMount?: boolean;                   // default true — initial bitmap without user action
  maxHistoryDepth?: number;
  assetLoader?: AssetLoader;
});

Notes

  • The designer is constructed once and cached in a ref — subsequent re-renders with a new options object do not re-initialise it. If you need to reset state, call loadDocument, newDocument, or fromJSON.
  • Core mutates the document object in place. The hook forces re-renders via a version counter so in-place mutations are visible.
  • renderBitmap/renderPlanes are cancellable via a generation counter — stale async results from superseded renders are discarded silently.
  • StrictMode safe: the effect's subscribe/cleanup cycle is idempotent.
  • SSR safe: no browser APIs are touched at construction; render scheduling only starts inside useEffect, which does not run on the server.
  • exportBundled() returns { blob, missing } — the list of asset keys the bundler could not resolve, mirroring the core contract.

License

MIT