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

@haneinfo/frontend-shell

v1.8.0

Published

Readme

Frontend shell

Shared dashboard layout, navigation, UI primitives, preferences, and application i18n support. See sidebar navigation and preferences for integration details.

Button hover

Buttons keep their resting backgrounds on hover and use a current-color border or inset shadow; destructive and link hover text also moves toward the theme foreground. Rest, dimensions and keyboard focus styles stay unchanged. See button hover contrast for the theme contract and known resting-color limitations, and the P7 validation report.

Shell control labels

ThemeSwitcher, Sheet close, Breadcrumb (including More), and ListPagination use shell-owned zh-TW/en text from I18nProvider, following useSidebarLabels. No new App catalog keys are needed; without a provider these controls use zh-TW. Theme names include the current light, dark, or system mode. App text takes precedence: ThemeSwitcher accepts aria-label, SheetContent accepts closeLabel, Breadcrumb accepts aria-label, BreadcrumbEllipsis accepts children, and ListPagination keeps previousText, nextText, and infoText. ListPagination remains usable from server components with function-valued link builders; only its default text leaves read the client i18n context.

SidebarTrigger, LocaleSwitcher, ThemeSwitcher, and NotificationBell are 44×44px below the sm breakpoint (max-sm, 640px). Desktop/tablet sizes stay 28px for the sidebar trigger and 32px for the other controls. The existing 48px DashboardShell header accommodates them. Mobile action grouping and search layout belong to the consuming App/template (follow-up T1). Closing a mobile sidebar opened with SidebarTrigger restores focus to that trigger.

ListPagination links and disabled buttons have a minimum 44px height and width at max-sm; the desktop sm button variant remains 28px high. Disabled buttons explicitly use type="button".

See the P3 validation report for measurements, default axe scans, desktop pixel comparison, keyboard checks, and screenshot review.

Server API requests

createApiFetch shares the API origin, access-token lookup and cache: 'no-store' between JSON requests and binary downloads. Pass getBaseUrl to override NEXT_PUBLIC_API_URL. Without an access token it does not add Authorization. Caller headers can override the bearer token.

Use the default mode for JSON endpoints. Its existing signature and behavior are unchanged: it sends Content-Type: application/json, parses successful JSON, returns undefined for 204, and throws ApiError with the existing backend error fields.

import { createApiFetch } from '@haneinfo/frontend-shell';

const apiFetch = createApiFetch({ getAccessToken });
const report = await apiFetch<{ code: string }>('/reports/example');

Use responseType: 'binary' for PDF, PNG, CSV, XLSX or other responses that must stream. This overload returns (path: string, init?: RequestInit) => Promise<Response>. Successful responses are returned unchanged, with their status, headers and unread body; even 204 returns a Response. There is no default Content-Type in this mode. When sending JSON, set the request header explicitly; strings and byte buffers both pass through unchanged. All standard HeadersInit forms are supported without mutating the caller's headers.

import { ApiError, createApiFetch } from '@haneinfo/frontend-shell';

const apiBinaryFetch = createApiFetch({ getAccessToken, responseType: 'binary' });

try {
  const upstream = await apiBinaryFetch('/reports/example/run', {
    method: 'POST',
    headers: { 'Content-Type': 'application/json' },
    body: JSON.stringify({ format: 'pdf', parameters: {} }),
    signal: request.signal,
  });
  const headers = new Headers({
    'Cache-Control': 'no-store',
    'X-Content-Type-Options': 'nosniff',
  });
  for (const name of ['Content-Type', 'Content-Disposition', 'Content-Length']) {
    const value = upstream.headers.get(name);
    if (value) headers.set(name, value);
  }
  return new Response(upstream.body, { status: upstream.status, headers });
} catch (error) {
  if (!(error instanceof ApiError)) throw error;
  return Response.json({ error: error.code ?? 'REPORT_EXECUTION_FAILED' }, {
    status: error.statusCode,
  });
}

Only failed HTTP responses are parsed as JSON in binary mode. ApiError.statusCode comes from the HTTP response, even if its JSON body says otherwise. code is the first string in code, then message, matching /^[A-Z][A-Z0-9_]+$/. The error's message is that code, or HTTP <status> when no code is valid; details is undefined and traceId is empty. Backend prose, status text, stacks and other diagnostics are discarded. Apps still map allowed codes to their own messages. Network, token-provider and cancellation failures propagate to the caller; cancellation remains effective while the returned body streams. A proxy owns its response header allowlist and permissions.

The existing wildcard export already exposes this overload and CreateApiBinaryFetchOptions. See the P2 validation report for the four reports route-handler migration drafts. Reports adoption follows the G2 release in R5.

Sidebar accessibility

DashboardShell exposes one main landmark. Desktop/tablet sidebars, including icon mode and collapsible="none", contain brand, navigation, page slot, user menu, and resize handle in a named region. NavMain exposes a named nav in both desktop and mobile branches. The mobile Sheet keeps its named modal dialog, with no nested complementary landmark. When closed, the Sheet and its navigation are absent; when open, Radix hides the background from the accessibility tree.

Sidebar labels follow I18nProvider (zh-TW or en) using shell-owned text, like other shell-owned controls. Apps do not need to add catalog keys. Standalone sidebar primitives without a provider use zh-TW. Existing props, exports, types, classes, and data-slot / data-sidebar attributes remain compatible; explicit desktop ARIA props still override defaults.

See the validation report for the landmark outline, component/default axe coverage, screenshot comparison, and limitations.