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

@rokkit/app

v1.2.0

Published

App-level controls for Rokkit applications - theme management and UI chrome

Readme

@rokkit/app

App-level controls for Rokkit applications — color mode management and theme switching.

Install

npm install @rokkit/app
# or
bun add @rokkit/app

Overview

@rokkit/app provides the application-level plumbing for Rokkit projects:

  • ColorModeManager — reactive class that tracks system / light / dark mode, resolves system to the actual OS preference, and syncs to the active theme target
  • ThemeSwitcherToggle — Svelte component for a three-way light/dark/system toggle
  • resolveMode — utility to resolve 'system' to 'light' or 'dark' via matchMedia

Works directly with @rokkit/unocss dark mode: ColorModeManager sets data-mode on the <html> element, which the UnoCSS preset uses as its dark mode selector.

Requires Svelte 5.

Usage

ColorModeManager

ColorModeManager is a Svelte 5 reactive class ($state internals). Instantiate it with a theme target — typically the vibe singleton from @rokkit/states.

import { ColorModeManager } from '@rokkit/app'
import { vibe } from '@rokkit/states'

const modeManager = new ColorModeManager(vibe)

// Read current mode
console.log(modeManager.mode) // 'system' | 'light' | 'dark'
console.log(modeManager.resolved) // 'light' | 'dark'

// Change mode
modeManager.mode = 'dark'
modeManager.mode = 'system' // will re-resolve from OS preference

Listening for OS preference changes

Call listen() inside onMount or a $effect.root. It returns a cleanup function.

<script>
  import { onMount } from 'svelte'
  import { ColorModeManager } from '@rokkit/app'
  import { vibe } from '@rokkit/states'

  const modeManager = new ColorModeManager(vibe)

  onMount(() => {
    return modeManager.listen() // returns cleanup fn, called on destroy
  })
</script>

When mode is 'system', the manager automatically updates resolved whenever the OS preference changes.

ThemeSwitcherToggle

Drop-in Svelte component that renders a three-way toggle (light / dark / system). Pass the ColorModeManager instance as a prop.

<script>
  import { ThemeSwitcherToggle, ColorModeManager } from '@rokkit/app'
  import { vibe } from '@rokkit/states'

  const modeManager = new ColorModeManager(vibe)
</script>

<ThemeSwitcherToggle {modeManager} />

resolveMode utility

import { resolveMode } from '@rokkit/app'

resolveMode('system') // 'light' or 'dark' based on OS preference
resolveMode('dark') // 'dark'
resolveMode('light') // 'light'

API

| Export | Description | | --------------------- | ----------------------------------------------------- | | ColorModeManager | Reactive class for tracking and resolving color mode | | ThemeSwitcherToggle | Svelte component — three-way light/dark/system toggle | | resolveMode(mode) | Resolve 'system' to actual 'light' | 'dark' | | ColorMode | Type: 'system' \| 'light' \| 'dark' | | ResolvedMode | Type: 'light' \| 'dark' |

ColorModeManager members

| Member | Type | Description | | ---------- | --------------------- | ------------------------------------------------ | | mode | ColorMode (get/set) | Current three-way mode selection | | resolved | ResolvedMode (get) | Actual light or dark value | | listen() | () => () => void | Start OS preference listener; returns cleanup fn |


Part of Rokkit — a Svelte 5 component library and design system.