Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@yowasp/wavedrom

Package Overview
Dependencies
Maintainers
2
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@yowasp/wavedrom

WaveDrom generates diagrams for digital waveforms, bit fields, and simple combinational circuits

  • 3.5.0-7
  • Source
  • npm
  • Socket score

Version published
Maintainers
2
Created
Source

YoWASP WaveDrom package

This package provides a self-contained WaveDrom renderer for JavaScript and Python applications. See the overview of the YoWASP project for details.

Command-line tool

This package installs a command-line tool yowasp-wavedrom.

Usage: yowasp-wavedrom [<input.json>] [<output.svg>]

API reference (JavaScript)

The @yowasp/wavedrom package has one entry point, render(source): string. It accepts a JavaScript object in the WaveJSON format and returns an SVG image serialized as a string:

import { render } from '@yowasp/wavedrom';

console.log(render({signal: [{ name: "clk", wave: "p..." }, { name: "data", wave: "01.0" }]}));
// => <svg.../svg>

API reference (Python)

The yowasp-wavedrom package has one entry point, render(source) -> str. It accepts a Python dictionary in the WaveJSON format and returns an SVG image serialized as a string:

from yowasp_wavedrom import render

print(render({"signal": [{ "name": "clk", "wave": "p..." }, { "name": "data", "wave": "01.0" }]}))
# => <svg.../svg>

Implementation notes

This package embeds the upstream WaveDrom library bundled with the minimal amount of dependencies necessary to produce a serialized SVG, and, for the Python package, with a JavaScript runtime. In addition, the output is post-processed compared to the upstream library as follows:

  • The id attribute of the root <svg> element is removed.
  • The stylesheets are altered to take into account dark color scheme preference via media queries.
    • By default, the diagrams automatically switch between light and dark color schemes based on the user preference. The light variant is the default upstream WaveDrom color scheme, and the dark variant is the same but with colors inverted. Unfortunately, it is not feasible to use media queries to switch between the default/light skin and the dark skin for waveform diagrams, and an inversion filter is used instead.
  • Several otherwise blocking bugs are worked around.

Updates

Unlike most YoWASP packages, this package does not automatically track upstream releases. Please open a pull request bumping the version of wavedrom in package-in.json if you need a feature from a newer version of WaveDrom.

License

This package is covered by the MIT license.

FAQs

Package last updated on 07 Apr 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc