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

site-shell-core

v0.3.1

Published

Framework-agnostic core logic for the site-shell terminal widget

Readme

site-shell-core

Framework-agnostic core logic for the astro-site-shell terminal widget.

If you're using Astro, use astro-site-shell instead. This package is for integrating the terminal into other frameworks such as Vue, React, Svelte, or vanilla JS.

Demo

Live Demo

Install

npm install site-shell-core

Usage

new Terminal(root, opts?)

Pass the root element and options — the terminal queries .terminal-output, .terminal-input, and .terminal-prompt internally.

import { Terminal } from 'site-shell-core';
import 'site-shell-core/styles/terminal.css';

const terminal = new Terminal(document.getElementById('terminal'), {
  promptLabel: 'you@mysite',
  pages: [
    { name: 'about', url: '/about', title: 'About' },
  ],
  collections: [
    {
      name: 'posts',
      entries: [
        { name: 'hello', url: '/posts/hello', title: 'Hello World' },
      ],
    },
  ],
});

// Clean up
terminal.destroy();

Options (TerminalOptions)

| Field | Type | Required | Description | |---|---|---|---| | promptLabel | string | — | Prompt string (default: 'user@site') | | pages | FileEntry[] | — | Top-level pages | | collections | Collection[] | — | Collections, each mapped to a subdirectory | | disabledCommands | string[] | — | Commands to disable (e.g. ['sl', 'open']) | | customCommands | CustomCommand[] | — | Custom commands to register at init |

Terminal instance

| Method | Description | |---|---| | destroy() | Remove all event listeners | | addCommand(cmd) | Register a custom command at runtime |

CustomCommand

| Field | Type | Required | Description | |---|---|---|---| | name | string | ✓ | Command name | | run | (args: string[]) => string \| string[] \| void | ✓ | Handler. Return a string or string[] to print output | | description | string | — | Description shown in help |

HTML structure

The root element must contain these three child elements:

<div id="terminal">
  <div class="terminal-output"></div>
  <div class="terminal-input-row">
    <span class="terminal-prompt"></span>
    <input type="text" class="terminal-input" />
  </div>
</div>

Framework examples

Vue 3

<template>
  <div ref="termRef" class="terminal">
    <div class="terminal-output"></div>
    <div class="terminal-input-row">
      <span class="terminal-prompt"></span>
      <input type="text" class="terminal-input" />
    </div>
  </div>
</template>

<script setup lang="ts">
import { ref, onMounted, onUnmounted } from 'vue';
import { Terminal } from 'site-shell-core';
import 'site-shell-core/styles/terminal.css';

const props = defineProps<{ promptLabel?: string }>();
const termRef = ref<HTMLElement>();
let terminal: Terminal;

onMounted(() => {
  terminal = new Terminal(termRef.value!, { promptLabel: props.promptLabel });
});

onUnmounted(() => terminal?.destroy());
</script>

React

import { useEffect, useRef } from 'react';
import { Terminal } from 'site-shell-core';
import 'site-shell-core/styles/terminal.css';

export function TerminalWidget({ promptLabel }: { promptLabel?: string }) {
  const termRef = useRef<HTMLDivElement>(null);

  useEffect(() => {
    const terminal = new Terminal(termRef.current!, { promptLabel });
    return () => terminal.destroy();
  }, []);

  return (
    <div ref={termRef} className="terminal">
      <div className="terminal-output"></div>
      <div className="terminal-input-row">
        <span className="terminal-prompt"></span>
        <input type="text" className="terminal-input" />
      </div>
    </div>
  );
}

CSS

site-shell-core/styles/terminal.css includes color classes for output lines (.ol-dir / .ol-file / .ol-err / .ol-muted) and the animation for the sl command. Container styles (.terminal, etc.) are left to each framework's implementation.

License

MIT