Skip to content
项目

wavedrom/wavedrom.github.io

在 GitHub 查看

关于

数字时序图编辑器

设计与媒体

这些数字如何统计

实测星标增长

24小时
0
7天
-2
15天
-1
1个月
+3

各周期内的星标净变化,周期相互重叠,并非每日新增。缺失的测量保持空白。星标代表关注度,不代表软件质量。

README.md

原文

WaveDrom

WaveDrom Website & Editor

Source of wavedrom.com: documentation site, ecosystem directory, and the real-time WaveDrom Editor (web + desktop) for digital timing diagrams (signal), register & bitfield maps (reg) and logic schematics (assign), powered by WaveDrom and WaveJSON.

Editor wavedrom.com/editor.html (installable PWA, works offline)
Tutorials Timing · Registers · Schematics
Ecosystem wavedrom.com/ecosystem.html
Desktop app GitHub Releases — Windows, macOS, Linux
Command line wavedrom npm package: npx wavedrom -i diagram.json5 > diagram.svg

Desktop App

Download the package for your platform from the latest release:

Platform Package
Windows x64 wavedrom-editor-v<version>-win-x64.zip
macOS Apple Silicon wavedrom-editor-v<version>-osx-arm64.zip
macOS Intel wavedrom-editor-v<version>-osx-x64.zip
Linux x64 wavedrom-editor-v<version>-linux-x64.tar.gz
Linux arm64 wavedrom-editor-v<version>-linux-arm64.tar.gz

The apps are not signed by Apple / Microsoft, so the operating system warns on first launch:

  • macOS reports "wavedrom-editor is damaged and can't be opened". Unzip, move the app to /Applications, then remove the download quarantine flag once:
    xattr -dr com.apple.quarantine /Applications/wavedrom-editor.app
    
  • Windows SmartScreen: More info → Run anyway.
  • Linux: extract and run ./wavedrom-editor inside the extracted folder.

Using the Editor

  • Edit WaveJSON on one side, see the diagram live on the other. Drag the divider to resize, click its handle to rotate the layout.
  • Menu (bottom right): Load / Save (Ctrl+O / Ctrl+S), Export SVG / PNG, Expand URL, theme.
  • Share a diagram as a link: editor.html?<url-encoded WaveJSON> (Expand URL copies it). Opening a link does not overwrite your saved diagram until you edit it.
  • WaveJSON is a JavaScript expression: besides plain JSON5-style objects you can generate diagrams with code. A small set of lodash helpers is available as _:
    {signal: _.range(4).map(i => ({name: 'd' + i, wave: _.repeat('01', i + 1)}))}
    
    The result must be pure data; window, document and WaveDrom are not available.

Security model

WaveJSON from links or files is untrusted code. The editor never evaluates it in the page (web) or in a Node.js-enabled frame (desktop): it runs in a Web Worker inside a sandboxed iframe with an opaque origin, no network and no Node.js APIs, limited to 3 s per evaluation (infinite loops are stopped). The returned SVG is rebuilt from an allowlist. Rationale, architecture and test results: docs/sandbox.md.

Development

Requires Node.js 22+.

npm install
npm run build        # generate static HTML, CSS and JS bundles
npm run serve        # local preview at http://localhost:4173 (PORT=… to change)
npm test             # ESLint + Mocha unit tests
Script Purpose
npm run build:dev unminified bundles with inline source maps
npm run coverage tests with c8 coverage report
npm run ecosystem:collect refresh data/ecosystem.json metadata
npm run build:wde build the desktop app packages (see below)

Repository layout

Path Contents
lib/pages/ page generators (landing, editor-page, tutorial*, ecosystem, privacy)
lib/layout.js, lib/styles.js, lib/samples.js shared layout, site CSS, WaveJSON samples
lib/runtime/ browser code: site.js, editor.js, sandbox (sandbox.js, wd-worker.js, wavejson.js, safe-svg.js), ga4.js
bin/ build.js (pages + esbuild bundles), serve.js, collect-ecosystem.js
test/ Mocha tests
schema/, data/, content/ WaveJSON JSON schema, ecosystem data, glossary
WaveDromEditor/package.json NW.js manifest of the desktop app
docs/ design notes
*.html, assets/, skins/, wavedrom.min.js, service-worker.js generated / published site (GitHub Pages serves the repository root)

Generated files are committed: run npm run build before committing source changes.

Updating the WaveDrom engine

npm run build copies wavedrom.min.js and skins/*.js from node_modules/wavedrom/ and bundles the editor sandbox worker from the same package. After bumping wavedrom (or onml):

npm install
npm run build
npm test

Building the Desktop App

The desktop app is the same editor.html, packaged with NW.js:

npm run build:wde                # ./build-wde.sh
./build-wde.sh --stage-only      # only stage the app into src/, no NW.js download

build-wde.sh runs npm run build, stages the app into src/, fetches the packaging script from drom/simple-nwjs-app and writes the packages listed above to build/. NW.js runtimes are cached in cache/ and verified against the official SHA-256 checksums. The NW.js and app versions are set on its last line:

bash build.sh --name wavedrom-editor --nwversion v0.121.0 --version v<version>

Releasing

  1. Bump the version in package.json, WaveDromEditor/package.json, lib/layout.js (footer), service-worker.js (CACHE_NAME) and build-wde.sh (--version, optionally --nwversion).
  2. Build, test and commit:
    npm run build:wde
    npm test
    git commit -am "v<version>"
    git push origin master
    
  3. Smoke-test the packages (web editor, desktop app on each OS).
  4. Tag and publish to GitHub Releases with gh; keep the macOS / Windows first-launch notes from Desktop App in the release notes:
    git tag v<version> && git push origin v<version>
    gh release create v<version> \
      build/wavedrom-editor-v<version>-*.tar.gz \
      build/wavedrom-editor-v<version>-*.zip \
      --title "v<version>" \
      --notes-file TMP_RELEASE_NOTES.md
    

Community

Questions, discussions and bug reports: WaveDrom User Group or GitHub Issues.

License

MIT

探索相关项目

加载中…