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

@sigx/live-code

v0.1.2

Published

Live code blocks for sigx documentation — interactive code examples with a prebundled Monaco editor

Readme

@sigx/live-code

Live code blocks for SignalX documentation — interactive code examples with a Monaco editor. Renders static syntax-highlighted code with a "Try Live" button that opens a full-screen playground for editing and running code in the browser.

The Monaco editor is provided by @sigx/monaco-editor (peer dependency), which ships prebundled assets and a Vite plugin so Monaco doesn't slow down the host app's cold start.

Install

npm install @sigx/live-code @sigx/monaco-editor

@sigx/monaco-editor is a peer dependency. It provides the prebundled Monaco runtime and the Vite plugin that serves it without slowing down dependency optimization.

Setup

1. Wire the Vite plugin

// vite.config.ts
import { defineConfig } from 'vite';
import { monacoPlugin } from '@sigx/monaco-editor/vite';

export default defineConfig({
    plugins: [monacoPlugin()]
});

2. Import the styles

// main.ts
import '@sigx/live-code/styles';

Usage

As a JSX component

Drop a <LiveCodeBlock> anywhere in your sigx UI:

import { LiveCodeBlock } from '@sigx/live-code';

const example = `
import { component, signal, render } from 'sigx';

const App = component(() => {
    const count = signal(0);
    return () => <button onClick={() => count.value++}>Count: {count.value}</button>;
});

render(<App />, document.getElementById('app')!);
`.trim();

<LiveCodeBlock code={example} language="tsx" />

The block renders syntax-highlighted code with a "Try Live" button that opens a full-screen Monaco-powered playground (LiveCodeModal) where the code can be edited and executed in the browser.

From SSG / static markdown

If you render code blocks at build time (e.g. via a markdown pipeline), call initLiveCodeBlocks() from the client to attach the playground to every <pre data-live-code> element:

// client entry
import { initLiveCodeBlocks } from '@sigx/live-code/client';

initLiveCodeBlocks();

Embedded editor + preview

For docs pages that should always show the editor (no modal), use LiveCodeWindow:

import { LiveCodeWindow } from '@sigx/live-code';

<LiveCodeWindow code={example} language="tsx" />

Registering additional modules

By default, code in the playground can import from sigx, @sigx/router, @sigx/store, and @sigx/daisyui. To expose more modules to user code, register them with configureLiveCode:

import { configureLiveCode } from '@sigx/live-code';
import * as myLib from 'my-lib';

configureLiveCode({
    modules: [
        {
            name: 'my-lib',
            globalName: 'MyLib',
            module: myLib,
            // optional: ambient .d.ts string for editor IntelliSense
            types: `declare module 'my-lib' { export function hello(): string; }`
        }
    ]
});

Theming

import { SIGX_DARK_THEME, SIGX_LIGHT_THEME, createEditor } from '@sigx/live-code';

const editor = await createEditor(container, {
    value: '...',
    language: 'typescript',
    theme: SIGX_DARK_THEME // 'github-dark' | 'github-light' | any Shiki theme
});

Key Exports

Components

  • LiveCodeBlock — Static code display with "Try Live" button
  • LiveCodeWindow — Embeddable editor + preview window
  • LiveCodeModal — Full-screen playground modal
  • LivePreview — Code output preview pane

Editor (re-exported / wired from @sigx/monaco-editor)

  • loadMonaco / createEditor — Lazy-loaded Monaco editor integration with sigx ambient types
  • configureMonacoLoader — Custom Monaco loader configuration

Execution

  • runCode / executeCode — Transpile and execute TSX in the browser
  • transpileTsx / transformImports — Code transformation utilities

Runtime

  • initRuntime / initAllRuntimes — Initialize available module runtimes
  • configureLiveCode — Register additional modules for the playground

Documentation

Full documentation and guides are available at the SignalX repository.

License

MIT