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

@jschofield/play-ground

v0.4.0

Published

Interactive code editor/playground web component built with Lit and CodeMirror

Readme

@jschofield/play-ground

Interactive code editor and live preview web component built with Lit and CodeMirror 6. A split-pane playground for HTML/CSS/JS — like a lightweight CodePen you can embed anywhere.

Install

npm install @jschofield/play-ground

Peer dependencies

This component requires the following peer dependencies:

npm install lit prettier codemirror @codemirror/commands @codemirror/lang-html @codemirror/lang-javascript @codemirror/language @codemirror/state @codemirror/view @lezer/highlight @replit/codemirror-vim

| Peer | Version | |---|---| | lit | ^3.0.0 | | prettier | ^3.0.0 | | codemirror | ^6.0.1 | | @codemirror/commands | ^6.3.3 | | @codemirror/lang-html | ^6.4.8 | | @codemirror/lang-javascript | ^6.2.1 | | @codemirror/language | ^6.10.1 | | @codemirror/state | ^6.4.1 | | @codemirror/view | ^6.24.1 | | @lezer/highlight | ^1.2.0 | | @replit/codemirror-vim | ^6.3.0 |

Usage

<script type="module">
  import '@jschofield/play-ground';
</script>

<play-ground>
  <template>
    <style>
      h1 { color: tomato; }
    </style>
    <h1>Hello!</h1>
  </template>
</play-ground>

Inline HTML attribute

<play-ground html="<h1>Quick example</h1>"></play-ground>

Code folding

Collapse specific lines on initial load (useful for hiding boilerplate):

<play-ground fold="1,5">
  <template>
    <!-- line 1 is folded -->
    ...
  </template>
</play-ground>

Without a bundler

This component has many CodeMirror peer dependencies, so a bundler is strongly recommended. If you must go without one, you'll need an import map for all peers:

<script type="importmap">
{
  "imports": {
    "lit": "https://esm.run/lit",
    "lit/": "https://esm.run/lit/",
    "prettier/standalone": "https://esm.run/prettier/standalone",
    "prettier/plugins/": "https://esm.run/prettier/plugins/",
    "codemirror": "https://esm.run/codemirror",
    "@codemirror/commands": "https://esm.run/@codemirror/commands",
    "@codemirror/lang-html": "https://esm.run/@codemirror/lang-html",
    "@codemirror/lang-javascript": "https://esm.run/@codemirror/lang-javascript",
    "@codemirror/language": "https://esm.run/@codemirror/language",
    "@codemirror/state": "https://esm.run/@codemirror/state",
    "@codemirror/view": "https://esm.run/@codemirror/view",
    "@lezer/highlight": "https://esm.run/@lezer/highlight",
    "@replit/codemirror-vim": "https://esm.run/@replit/codemirror-vim"
  }
}
</script>
<script type="module" src="https://esm.run/@jschofield/play-ground"></script>

Attributes

| Attribute | Type | Default | Description | |---|---|---|---| | html | string | "" | Initial HTML content (alternative to <template>) | | fold | string | "" | Comma-separated line numbers to fold on load |

Features

  • Live preview updates as you type (200ms debounce)
  • Format button (Prettier with HTML/CSS/JS support)
  • Vim mode toggle (persists across page via shared state)
  • Sandboxed iframe preview (allow-scripts allow-forms allow-same-origin)
  • Responsive: stacks vertically below 900px

License

MIT