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

@riganb/use-content

v0.2.0

Published

A lightweight, local-first visual content editor tool for development environments.

Readme

@riganb/use-content

A lightweight, type-safe, headless content injection hook and live-editing developer panel for React applications. Author content configurations directly inside your components and manipulate values live with zero application configuration.


✨ Features

  • Zero-Config Dashboard: An atmospheric, responsive twilight-purple developer panel injected automatically into your development application root.
  • Inline Schema Registration: Write component mock schemas directly where they live; fields self-register instantly upon runtime mounting.
  • Formatted JSON Export: Copy the current registered content values as formatted JSON for sharing with teammates.
  • Discriminated Type Safety: Tight TypeScript union coupling that guarantees initValue types match their assigned control primitives perfectly.
  • Explicit Environment Control: ContentProvider defaults from NODE_ENV, but enabled or a contentClient can force the live developer context on preview deployments or force the empty production path anywhere.

📦 Installation

Install the library along with its peer dependencies using your package manager of choice:

npm install @riganb/use-content

🚀 Quick Start

1. Wrap Your Application Root

To orchestrate dynamic state syncing, place the environment-aware ContentProvider at the root of your React layout tree:

import React from 'react';
import { ContentProvider } from '@riganb/use-content';

export function App() {
  return (
    <ContentProvider>
      <MyFeatureComponent />
    </ContentProvider>
  );
}

ContentProvider uses the developer context by default unless process.env.NODE_ENV === 'production'. Pass enabled when the deployment environment should decide independently from NODE_ENV:

<ContentProvider enabled={process.env.NEXT_PUBLIC_CONTENT_ENABLED === 'true'}>
  <MyFeatureComponent />
</ContentProvider>

For shared configuration, create a content client and pass it to the provider:

import { ContentProvider, createContentClient } from '@riganb/use-content';

const contentClient = createContentClient({
  enabled: process.env.NEXT_PUBLIC_CONTENT_ENABLED === 'true',
});

export function App() {
  return (
    <ContentProvider client={contentClient}>
      <MyFeatureComponent />
    </ContentProvider>
  );
}

2. Register Mock Content Hooks Inside Components

Call useContent anywhere inside your consumer tree. Pass a typed, self-contained schema configuration object to automatically render reactive dashboard primitives in development:

import React from 'react';
import { useContent } from '@riganb/use-content';

export function MyFeatureComponent() {
  // Primitives register instantly and enforce type inference downstream
  const content = useContent({
    heroTitle: {
      label: 'Main Hero Title',
      type: 'string',
      initValue: 'Welcome to the Future',
    },
    maxCapacity: {
      label: 'Maximum Operational Limit',
      type: 'number',
      initValue: 120,
    },
    isMaintenanceMode: {
      label: 'Enable System Blackout',
      type: 'boolean',
      initValue: false,
    },
  });

  return (
    <div style={{ padding: '24px' }}>
      <h1>{content.heroTitle}</h1>
      <p>Room Limit: {content.maxCapacity} passengers</p>
      {content.isMaintenanceMode && <div className="alert">System Overhaul Active</div>}
    </div>
  );
}

🛠️ Dynamic Core Schemes

The hook engine parses three core presentational primitives dynamically:

| Control Type | Output Type | Live Interactive Primitives | | --- | --- | --- | | 'string' | string | High-fidelity text inputs featuring soft border focus transitions. | | 'number' | number | Floating-point text controls equipped with structural verification guards. | | 'boolean' | boolean | Smoothly animated, sliding iOS-style toggles built with custom bezier transitions. |


⚡ Production Infrastructure

This package implements an environment-aware default inside its main provider.

When enabled is omitted, production builds use the no-op behavior because process.env.NODE_ENV === 'production'. In that mode, useContent skips registration and returns each field's initValue.

Preview deployments can opt into the full live panel by passing enabled={true} or a client configured with { enabled: true }. Production deployments can force the empty context by passing enabled={false}.

The main entry does not statically import the developer panel. When content editing is enabled, the panel loads through a dynamic import so production bundles can keep the main path lightweight.


📜 License

Distributed under the MIT Open-Source License. See the accompanying LICENSE file for full legislative details.