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

garret-widget-sdk

v0.0.3

Published

Build widgets for Garret. createSDK(React, client) binds the hook logic to a realm's React + capability client; re-exports garret-core. The one package widget authors install.

Readme

garret-widget-sdk

Build widgets for Garret — the macOS desktop layer for developer focus.

A widget declares a manifest (what it is, its config, the capabilities it needs) and a render component. The framework injects an sdk — typed live-data hooks bound to a host capability client — so the same widget code runs in the native host today and in an isolated sandbox tomorrow; only the injected sdk's transport differs.

Install

npm i garret-widget-sdk react lucide-react

react and lucide-react are peer dependencies. Ships dual ESM + CJS.

Define a widget

import { defineWidget, field, type WidgetRenderProps } from 'garret-widget-sdk'

interface Config {
  repo: string
}

export default defineWidget<Config>({
  apiVersion: 1, // host contract version (host rejects incompatible majors)
  manifest: {
    id: 'github-issues',
    name: 'GitHub Issues',
    defaultSize: { w: 4, h: 4 },
    // Capabilities you need — shown at install, enforced by the sandbox.
    permissions: ['network:api.github.com'],
    configSchema: {
      repo: field.text({ label: 'Repository', placeholder: 'owner/name', required: true })
    }
  },
  render({ config, sdk }: WidgetRenderProps<Config>) {
    // `sdk` is injected by the host — never call createSDK yourself in production.
    const { data, loading, error } = sdk.usePolledQuery<{ title: string }[]>(
      'github', 'issues', { repo: config.repo }
    )
    if (loading) return <p>Loading…</p>
    if (error) return <p>Failed: {error}</p>
    return <ul>{data?.map((i) => <li key={i.title}>{i.title}</li>)}</ul>
  }
})

sdk exposes usePolledQuery, useServiceStatus, useFileWatch, services, fetch (host-mediated HTTP, no CORS), storage (per-widget), and openExternal — the same surface Garret's built-in widgets use.

Test it — no Garret required

garret-widget-sdk/testing gives you a fake host client, so you build the sdk yourself and render in jsdom (vitest / jest + @testing-library/react):

import * as React from 'react'
import { render, screen } from '@testing-library/react'
import { createSDK } from 'garret-widget-sdk'
import { createMockClient } from 'garret-widget-sdk/testing'
import Widget from './widget'

test('renders issues', async () => {
  const sdk = createSDK(React, createMockClient({
    query: async (_id, method) => (method === 'issues' ? [{ title: 'A bug' }] : [])
  }))
  const Render = Widget.render
  render(<Render config={{ repo: 'a/b' }} ctx={fakeCtx} sdk={sdk} />)
  expect(await screen.findByText('A bug')).toBeInTheDocument()
})

createMockClient also fakes fetch/storage and returns emitPoll(update) / emitWatch(id) so you can drive live-refresh paths.

Layers

  • garret-core — pure, no React: types, field + validators, canonicalKey, the GarretClient capability interface, and GarretSDK. Re-exported from this package.
  • garret-widget-sdkcreateSDK(React, client) (the realm-bound hook logic) + WidgetStatus.

Internals: the host calls createSDK(React, client) once per widget realm and injects the result as WidgetRenderProps.sdk. A sandbox runtime must create a fresh sdk per iframe load (don't reuse one across mounts).

Status

Authoring + unit-testing work today. The host runtime that loads a third-party widget and injects a live, permission-enforced client (the sandboxed iframe + postMessage bridge) is in progress — the prerequisite for distributing widgets to other users.