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 🙏

© 2024 – Pkg Stats / Ryan Hefner

pytket-circuit-renderer

v0.10.6

Published

A Vue 3 component for rendering pytket circuits.

Downloads

909

Readme

pytket-circuit-renderer

This is a Vue 3 component for rendering pytket circuits.

Installation

Via package manager:

npm install pytket-circuit-renderer

Or include directly in a script tag. Make sure to also load the css.

<script type="application/javascript" src="https://unpkg.com/pytket-circuit-renderer@latest/dist/pytket-circuit-renderer.umd.js"></script>
<link rel="stylesheet" href="https://unpkg.com/pytket-circuit-renderer@latest/dist/pytket-circuit-renderer.css">

Usage

Note that this component depends on Vue 3. If using a package manager, simply import and use as normal: import { circuitDisplayContainer } from "pytket-circuit-renderer"

If loading the script directly, locate the module as below: const circuitDisplayContainer = window["pytket-circuit-renderer"].default

You can then include the circuit display as a component in your vue app:

const app = {
    components: { circuitDisplayContainer },
    ...
};

If using v0.3.0 or later (or v0.2.1), make sure to also enable a required config option in your vue app before mounting:

app.config.unwrapInjectedRef = true

The component will be exposed as <circuit-display-component>.

You can either render json passed directly via the circuit-raw prop:

<circuit-display-container :circuit-raw="circuitJson"></circuit-display-container>

Or collect it from an element on the page by specifying the query string:

<circuit-display-container :circuit-element-str="'#circuit-json-to-display'"></circuit-display-container>

You can supply either a single circuit or a list of circuits. In the case of a list, the circuits will be displayed alongside each other. The stacking orientation is controlled by the viewFormat prop, and can be either row (default) or column.

Note that the display container includes a choice of rendering options. You can choose to specify default options when first mounting the component:

<circuit-display-container :circuit-raw="circuitJson" :init-render-options="{'zxStyle': true, ...}"></circuit-display>

The render options you can specify are the following:

  • zxStyle: Render gates as zx-spiders where applicable.
  • condenseCBits: Display classical wires as a single wire.
  • recursive: Display nested circuits recursively where possible.
  • condensed: Display the circuit on one line only, rather than wrapping around.
  • darkTheme : Default to dark mode if not in system theme mode.
  • systemTheme : Default to system theme. On by default.
  • transparentBg: Display the circuit with a transparent background.
  • cropParams: Crop long gate parameters.
  • interpretMath: Render math names and parameters via latex.

It is advised that you also set the theme to avoid clashes.

Check the example folder for a basic sample app that uses this component.

Development

To get started with the project locally, first install the npm dependencies via npm install.

Test

You should then be able to run storybook to manually inspect the components via npm run storybook. Automated tests via cypress can be run using npm run test.

Build

To compile the component library use npm run parser then npm run build-lib. Opening test\index.html gives an example app that uses the locally built circuit renderer. Note that you must be serving the local files, for example by first running serve . in the project root directory.