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

@petrarca/sonnet-shell

v0.7.0

Published

Application shell, layout, navigation, auth flow, and imperative API for the Petrarca Sonnet component library

Downloads

297

Readme

@petrarca/sonnet-shell

The application frame of the Petrarca Sonnet component library. You write feature areas as modules; the shell composes them into navigation, routes, a command menu and a set of surfaces any module can reach imperatively.

What it provides

A module system. A ShellModule declares its routes, navigation, command menu entries, side pane and contributions to other modules. createModuleRegistry aggregates them and derives the navigation zones and the flattened route list once.

Two navigation layouts. ShellRail, a narrow icon strip with a contextual sub-nav panel, and ShellSidebar, a single-column sidebar with collapsible sections. Both read the same module metadata, and IconRail, Sidebar, SidebarGroup, SidebarItem and SubNavPanel are exported for a custom one.

Shell chrome. RootLayout and AppShell, TopBar, ShellFooter, ShellVersion, SearchTrigger and UserMenu.

An imperative API. notification, dialog, navigation, panel, sidePane, fullscreen and events are plain function calls, so a page reaches a toast, a confirm dialog, a slide-over or another module without prop drilling.

Capability gating. A module can declare what it requires; the application supplies resolveCapability and a policy decides whether an unmet module is hidden, disabled or shown with an explanation.

Auth screens on the ./auth subpath: Login, ProtectedRoute and OrgSelection. Prop-driven, with no auth logic of their own -- organization choice is the orgs and onSelectOrg props of Login.

Install

pnpm add @petrarca/sonnet-shell @petrarca/sonnet-ui @petrarca/sonnet-core

| Peer | Range | Needed for | |---|---|---| | react, react-dom | >=19 | Everything | | react-router-dom | >=7 | Routing, SidebarItem, ProtectedRoute; the shell is built on the router, not adapted to it | | tailwindcss | >=3 | The classes the shell renders |

lucide-react and sonner arrive as regular dependencies.

Usage

Declare modules, build a registry, mount RootLayout as a layout route.

import { createBrowserRouter, RouterProvider, Navigate } from "react-router-dom";
import { RootLayout, createModuleRegistry } from "@petrarca/sonnet-shell";
import type { ShellConfig } from "@petrarca/sonnet-shell";
import home from "@/modules/home";
import widgets from "@/modules/widgets";

const registry = createModuleRegistry([home, widgets]);

const shellConfig: ShellConfig = {
  topBar: <TopBarContent />,
};

const router = createBrowserRouter([
  {
    element: <RootLayout config={shellConfig} registry={registry} />,
    children: [
      { index: true, element: <Navigate to="/home" replace /> },
      ...registry.allRoutes,
    ],
  },
]);

export function AppRouter() {
  return <RouterProvider router={router} />;
}

A module is a plain object with id, label, icon, basePath, navigation and routes, plus optional matchPaths, topNav, commands, contributions, sidePane, layout, useEffects, requires, pinBottom and hidden. The full contract is in modules.

The shell sizes itself from the document and the library does not set document styles, so the app-level layout CSS in getting started is required -- omitting it is the most common setup failure.

Documentation

License

Apache 2.0. See LICENSE.md.