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

@oshon-ai/primitives

v0.9.1

Published

Oshon headless behavior primitives — unstyled accessible building blocks. Behavior, a11y, keyboard, focus, RBAC hooks, audit hooks, i18n slots. No styling (Phase 4 wraps these with Oshon's visual language).

Downloads

292

Readme

@oshon-ai/primitives

Headless behavior primitives for the Oshon design system. Behavior, accessibility, keyboard handling, focus management, RBAC hooks, audit hooks, i18n slots — no styling. Consumers who want the Oshon visual language should pull from @oshon-ai/components (Phase 4); this package is the substrate.

See OSHON.md §3 for the layering rationale.

Install

pnpm add @oshon-ai/primitives

Peer dependencies: react, react-dom (18.x or 19.x).

Usage

import { Button, Dialog, Tooltip } from '@oshon-ai/primitives';

function Example() {
  return (
    <Tooltip.Provider>
      <Dialog.Root>
        <Dialog.Trigger asChild>
          <Button>Delete record</Button>
        </Dialog.Trigger>
        <Dialog.Portal>
          <Dialog.Overlay />
          <Dialog.Content>
            <Dialog.Title>Are you sure?</Dialog.Title>
            <Dialog.Description>This cannot be undone.</Dialog.Description>
            <Dialog.Close asChild>
              <Button>Cancel</Button>
            </Dialog.Close>
          </Dialog.Content>
        </Dialog.Portal>
      </Dialog.Root>
    </Tooltip.Provider>
  );
}

What's in Phase 3a

Three primitives — one proprietary, two Radix-wrapped:

| Primitive | Strategy | ADR | |---|---|---| | Button | Proprietary headless, RSC-safe | ADR-001 | | Dialog | Thin wrap over @radix-ui/react-dialog | ADR-002 | | Tooltip | Thin wrap over @radix-ui/react-tooltip | ADR-003 |

Phase 3b will add Input, Select, Popover, Tabs, and Toggle using the same template.

Package-level contract

Three shared primitives that every component consumes:

  • ComponentManifestSchema — Zod schema for per-component manifests, ported verbatim from MCP_SCHEMA.md §6. Every manifest.ts in this package is validated at test time via scripts/validate-manifests.mjs.
  • PermissionContext + usePermissions() + PermissionProvider — RBAC plumbing. Every primitive respects canView (hides the UI) and canEdit (disables interaction).
  • AuditProvider + useAudit() — audit event plumbing. Every interactive primitive fires events with shape { component, action, meta?, timestamp }. Button and Dialog emit; Tooltip does not (see ADR-003).

Plus resolveMessage() for i18n-aware string resolution. The full i18n runtime lands in Phase 5.

Design principles honored

  • #3 RBAC + audit by default — every primitive accepts permissions and reads AuditProvider (Tooltip carve-out documented in ADR-003)
  • #5 RSC-default — Button stays a server component; Dialog and Tooltip declare 'use client' because they wrap Radix
  • #8 Manifest-driven — every primitive ships manifest.ts validated against ComponentManifestSchema
  • #9 Trust-boundary Zod — manifests parse at test time; malformed manifests fail CI
  • #11 i18n by default — primitives take a messages prop instead of inlining user-visible strings (skeleton; full runtime in Phase 5)

Development

pnpm --filter @oshon-ai/primitives test      # validates manifests + runs vitest
pnpm --filter @oshon-ai/primitives build     # tsup + tsc + .d.cts emit
pnpm --filter @oshon-ai/primitives typecheck # tsc --noEmit

License

MIT.