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

@shafayath-jr/cms-live-preview

v1.0.0

Published

Shared live-preview / inline-editing kit for CMS-driven sites: the context, editable field/section/image components, and postMessage listeners that let a site render itself inside the CMS's preview iframe and be edited in place.

Readme

@shafayath-jr/cms-live-preview

Shared live-preview / inline-editing kit for CMS-driven sites: the context, editable field/section/image components, and postMessage listeners that let a site render itself inside the CMS's preview iframe and be edited in place.

This repo is public and available on npm — install it with npm install @shafayath-jr/cms-live-preview. There's nothing secret in here (no API keys, no business logic).

Install

npm install @shafayath-jr/cms-live-preview

Wiring into a site

// app/layout.tsx
import {
  CmsPreviewProvider,
  CmsPreviewListener,
  CmsEditModeListener,
  CmsImageEditManager,
} from "@shafayath-jr/cms-live-preview";

<CmsPreviewProvider>
  <CmsPreviewListener />
  <CmsImageEditManager />
  {children}
</CmsPreviewProvider>
// a page component
import { useCmsPreview, EditableField, EditableSection } from "@shafayath-jr/cms-live-preview";

const contents = useCmsPreview(sectionId, serverContents);

<EditableSection sectionId={sectionId}>
  <EditableField as="h1" sectionId={sectionId} fieldName="title" value={contents.title} />
  <EditableField richText sectionId={sectionId} fieldName="body" value={contents.body} />
</EditableSection>

Images: tag the <img> itself with data-cms-field="..." inside an EditableSectionCmsImageEditManager finds it via DOM scan, no per-image wiring needed. Flat content fields only (see "Known limitations" below).

Tailwind v4 setup (required)

Every component here ships its own Tailwind utility classes (the Save button, image-change overlay, editable-field focus rings, section Edit border). Tailwind v4 excludes node_modules from its automatic source detection, so without an explicit @source these classes silently generate no CSS — the whole editing UI renders unstyled while everything else on the site looks fine, which is easy to miss since it only shows up in CMS edit mode.

Add to the consuming site's global CSS:

@import "tailwindcss";
@source "../../node_modules/@shafayath-jr/cms-live-preview/dist";

(adjust the ../../ depth to however many levels your CSS file sits below the project root).

Known limitations

  • CmsImageEditManager only supports flat content fields (e.g. top_left_image). It has no equivalent of EditableField's buildValue callback, so images inside an array of entities (a campus's image, a course's image, a news story's image) aren't wireable yet without corrupting the array on save.

Releasing a fix

# bump version in package.json, then:
git commit -am "..."
git tag vX.Y.Z
git push origin main
git push origin vX.Y.Z

Then in each consuming site: bump the #vX.Y.Z tag in package.json and run npm install @shafayath-jr/cms-live-preview@git+https://github.com/shafayath-jr/pen-cms-preview.git#vX.Y.Z explicitly — plain npm install does not reliably re-resolve a changed git tag on its own.