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 🙏

© 2025 – Pkg Stats / Ryan Hefner

react-openqasm-editor

v0.0.2

Published

A powerful, customizable code editor for OpenQASM (Open Quantum Assembly Language) based on Monaco Editor.

Readme

OpenQASM Editor

A powerful, customizable code editor for OpenQASM (Open Quantum Assembly Language) based on Monaco Editor.

Features

  • Syntax highlighting for OpenQASM language
  • Code completion with intelligent suggestions
  • Hover information for language elements
  • Code formatting capabilities
  • Diagnostics and error detection
  • Customizable themes and editor options
  • Built-in quantum code example templates

Installation

npm install openqasm-editor
# or
yarn add openqasm-editor

Usage

import { OpenQASMEditor } from 'openqasm-editor';

function App() {
  const handleEditorChange = (value, event) => {
    console.log('Editor content:', value);
  };

  const handleEditorMount = (editor) => {
    // You can access the editor instance here
    console.log('Editor mounted:', editor);
  };

  return (
    <OpenQASMEditor
      width="800px"
      height="500px"
      theme="vs-dark" // or "vs-light"
      defaultvalue={`OPENQASM 2.0;
include "qelib1.inc";

// Quantum program
qreg q[2];
creg c[2];

h q[0];
cx q[0], q[1];
measure q -> c;`}
      onChange={handleEditorChange}
      onMount={handleEditorMount}
      options={{
        // Monaco editor options
        fontSize: 14,
        lineNumbers: 'on',
        minimap: { enabled: false },
        // Add any other Monaco editor options here
      }}
    />
  );
}

Props

| Prop | Type | Default | Description | | -------------- | ---------- | ----------------------- | -------------------------------------- | | width | string | 800px | Width of the editor | | height | string | 500px | Height of the editor | | theme | string | vs-dark | Editor theme (vs-dark or vs-light) | | defaultvalue | string | Basic quantum program | Initial code in the editor | | value | string | undefined | Controlled value for the editor | | options | object | {} | Monaco editor options | | onChange | function | noop | Called when editor content changes | | onMount | function | noop | Called when editor is mounted |

Development

Setup

git clone https://github.com/xy2002/openqasm-editor
npm install 
npm run generate-antlr
npm run build

Scripts

  • pnpm dev - Start development server
  • pnpm build - Build the library
  • pnpm lint - Run ESLint
  • pnpm storybook - Run Storybook for component development
  • pnpm generate-antlr - Generate ANTLR parser for OpenQASM grammar

OpenQASM Language

This editor supports the OpenQASM 2.0 specification, which is an intermediate representation for quantum circuits. The language includes:

  • Quantum register and classical register declarations
  • Gate definitions and applications
  • Measurements
  • Conditional operations
  • Mathematical expressions for rotations and phases

For more information on OpenQASM, see the OpenQASM specification.