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

@hilum/designer

v4.7.5

Published

Engine-agnostic canvas-editor chrome — DesignerShell, Toolbar, Panel, Pane + generic useHistory and useKeybindings hooks

Readme

@hilum/designer

Engine-agnostic canvas-editor chrome. Provides the shell, toolbar, side panels, collapsible panes, and generic hooks (undo/redo stack, keyboard shortcuts) — works with any kind of editing surface (free-positioned canvas, form builder, layout editor, code editor).

For the actual canvas (pan/zoom viewport, layers, drag/resize), use @hilum/designer-canvas on top.

Components

  • <DesignerShell> — root layout (full viewport, themed)
  • <DesignerWorkspace> / <DesignerWorkspaceViewport> — floating-chrome positioning boundary and safe canvas region
  • <DesignerHeader> / <DesignerSidebar> / <DesignerPanel> — chrome
  • <DesignerPanelHeader> / <DesignerPanelTabs> — panel title bar and value-based tabs
  • <DesignerPane> (+ DesignerPaneTitle, DesignerPaneContent) — collapsible property panel section with showFor predicate
  • <DesignerPropertyRow> / DesignerPropertyLabel / DesignerPropertyControls / DesignerPropertyField / DesignerPropertyGroup — inspector rows
  • TwoValueControl / FourValueControl / SpacingControl / CornerRadiusControl — compound numeric inputs
  • <DesignerToolbar> + DesignerToolbarGroup / DesignerToolbarButton / DesignerToolbarSeparator — composable toolbar
  • <FontPicker> — searchable font-family picker with live previews (compact density)

Floating workspace

Use the workspace primitives when desktop editor chrome should float over a full-bleed surface. Without safeInsets, the viewport fills the workspace and floating panels overlay the canvas. Add safeInsets when an editor instead needs an unobscured region for fit and center calculations.

Floating rails and panels size themselves to their content. Their configured top and bottom insets define a maximum available height; overflowing content scrolls inside the surface instead of stretching it to the full workspace.

<DesignerWorkspace>
  <DesignerWorkspaceViewport>{canvas}</DesignerWorkspaceViewport>

  <DesignerSidebar variant="floating" floatingInset={{ left: 0 }} items={tools} />
  <DesignerPanel side="left" variant="floating" width={280} floatingInset={{ left: 60 }}>
    {library}
  </DesignerPanel>
  <DesignerPanel side="right" variant="floating" width={304}>
    {inspector}
  </DesignerPanel>

  <DesignerToolbar boundary="workspace" center="boundary">
    {actions}
  </DesignerToolbar>
</DesignerWorkspace>

To reserve an unobscured canvas between the floating surfaces, configure safe insets and center the toolbar within the same region:

<DesignerWorkspace safeInsets={{ top: 16, right: 336, bottom: 72, left: 376 }}>
  <DesignerWorkspaceViewport>{canvas}</DesignerWorkspaceViewport>

  <DesignerSidebar variant="floating" items={tools} />
  <DesignerPanel side="left" variant="floating" width={280} floatingInset={{ left: 76 }}>
    {library}
  </DesignerPanel>
  <DesignerPanel side="right" variant="floating" width={304}>
    {inspector}
  </DesignerPanel>

  <DesignerToolbar boundary="workspace" center="safe-area">
    {actions}
  </DesignerToolbar>
</DesignerWorkspace>

The existing inline desktop and sheet/bottom mobile variants remain available.

Inspector grid

<DesignerPropertyRow layout="grid"> is the Figma inspector row: two equal field columns plus a fixed action column (24px in compact density, 32px in default), with the label spanning the row above the fields. Every grid row keeps the action column, so field edges line up down the panel whether or not a row has an action.

  • Children (or the children of a DesignerPropertyControls) fill columns 1 and 2 and stretch to their cell. A row's only field spans both columns.
  • <DesignerPropertyField span={2}> (or data-span="2") spans both columns; span={1} keeps a lone field in column 1. A field can hold several controls.
  • action, and any icon-only Button child, sit centred in the action column.

<DesignerPaneTitle muted> is for an empty or optional section: a muted, normal-weight title next to an action such as a "+" button. In compact density the title is flush with the field labels and the collapse chevron trails the actions.

<DesignerPane collapsible>
  <DesignerPaneTitle>Position</DesignerPaneTitle>
  <DesignerPaneContent>
    <DesignerPropertyRow layout="grid" label="Position" action={constraintsButton}>
      <InputNumber label="X" value={x} onChange={setX} />
      <InputNumber label="Y" value={y} onChange={setY} />
    </DesignerPropertyRow>
    <DesignerPropertyRow layout="grid" label="Rotation">
      <InputNumber label={<RotateCw />} aria-label="Rotation" unit="°" value={r} onChange={setR} />
      <DesignerPropertyField className="gap-0.5">
        {flipHorizontalButton}
        {flipVerticalButton}
      </DesignerPropertyField>
      <Button size="icon-sm" variant="ghost" aria-label="Rotate 90°">
        <RotateCwSquare />
      </Button>
    </DesignerPropertyRow>
  </DesignerPaneContent>
</DesignerPane>

<DesignerPane>
  <DesignerPaneTitle muted action={addFillButton}>
    Fill
  </DesignerPaneTitle>
</DesignerPane>

Header actions

DesignerHeader takes a structured action cluster at its inline end. The primary action is never cut off; secondary actions show inline on wide headers (up to maxVisibleSecondaryActions, default 2) and collapse into a "More actions" menu otherwise. Free-form right content renders before them and is clipped first.

<DesignerHeader
  left={<ProjectName />}
  center={<ModeSwitcher />}
  right={<Presence />}
  primaryAction={{ label: "Publish", onAction: publish, loading: publishing }}
  secondaryActions={[
    { label: "Preview", href: previewUrl },
    { label: "Share", onAction: share },
    { label: "Version history", onAction: openHistory },
  ]}
/>

Font picker

<FontPicker
  aria-label="Heading font"
  fonts={[{ family: "Inter", category: "sans-serif", weights: [400, 700] }, …]}
  value={settings.headingFont}
  onChange={(family) => update({ headingFont: family })}
  // Load faces lazily as options scroll into view (e.g. a Google Fonts <link>).
  onLoadFont={(font) => loadGoogleFont(font.family)}
/>

Each option previews its family with a "Family", <generic> stack, so it renders in the category's generic face until the font has loaded. Under a strict CSP, load fonts with <link rel="stylesheet"> or the FontFace API (style-src must allow the font CSS origin).

Search matches family names (case-insensitive substring, in the order of fonts), so "play" finds "Playfair Display" but not every display font. A query that names a category exactly ("serif", "display", "sans serif") also lists that category's other fonts, after the name matches.

Hooks

  • useShellContext() / <ShellProvider> — selection, active tool, read-only flag
  • useHistory<T>(initial, options?) — generic undo/redo stack
  • useKeybindings(bindings, options?) — keyboard shortcut registry

useHistory

const history = useHistory<Doc>(initialDoc, { limit: 100 });

history.setState(next); // records one undo step
history.replaceState(next); // overwrites without recording
const prev = history.undo(); // returns the new present state synchronously
const next = history.redo();

// Group a gesture (e.g. a drag) into a single undo step:
history.beginTransaction();
history.setState(a); // folded into the transaction
history.setState(b);
history.commitTransaction(); // one entry; or cancelTransaction() to revert

limit caps the undo depth (default 100; oldest entries are dropped). Transactions nest; only the outermost commit records. undo / redo commit an open transaction first. getState() reads the latest state from event handlers.

useKeybindings

useKeybindings([
  { key: "z", code: "KeyZ", mod: "platform", action: undo },
  { key: "z", code: "KeyZ", mod: "platform", shift: true, action: redo },
  { key: "delete", action: remove },
  { key: "s", mod: "platform", allowInInputs: true, action: save },
]);
  • key matches KeyboardEvent.key (case-insensitive); code matches the physical KeyboardEvent.code (layout-independent). Either one matching is enough.
  • mod: "platform" means Cmd on macOS/iOS and Ctrl elsewhere. mod: true accepts either Ctrl or Cmd. ctrl, meta, shift and alt must match exactly.
  • Bindings are skipped while focus is in an input, textarea, select or contentEditable element unless the binding sets allowInInputs: true (skipInputs: false still works).
  • The first matching binding wins and preventDefault() is called unless preventDefault: false.
  • Bindings are read through a ref, so an inline array doesn't re-subscribe the listener on each render. Options: disabled, target (default window), platform ("apple" / "other", default detected).