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

wt-huatu

v1.4.0

Published

wt-huatu, a graph drawing library. Let's draw in a programming way.

Downloads

123

Readme

wt-huatu logo

wt-huatu, is a Drawing Library to draw something mathematically, logically, hierarchically and programmatically.

For quick and fruitful info, please go to the official site: https://github.com/littlefattie/wt-huatu.

It is written in Typescript, can be used as a library, to be integrated into your project. For example, you can embed it into a customized markdown renderer to use it as some text-to-image renderer. Or it can be used as some drawing tool when using the online editor at https://littlefattie.github.io/wt-huatu-editor/.

Quick and intuitive explanation. It will convert some text description like this:

# --- Vars ------
vars:
  r: 100
  degAB: datan(0.25/1.25)

# --- Points ------
points:
  pA: (0, 0)

# --- Shapes ------
shapes:
  lnAB: line; pA; -degAB
cpoints:
  pB: lnAB; r

shapes2:
  cA: circle; pA; r
  cB: circle; pB; r

xpoints2:
  pC: cA; cB; n;    # Pick the northern point of the intersections
  pD: lnAB; cA; w;  # Pick the western
  pE: lnAB; cB; e;  # Pick the eastern

shapes3:
  triABC: triangle; pA; pB; pC;

# --- Draw --------
draw:
  - cA; fill, none; stroke; 1, cc
  - cB; fill, none; stroke; 1, cc
  - triABC; fill, yellow; stroke; 1, cc
  - circle; pA; 2 ||| fill; grey
  - circle; pB; 2 ||| fill; grey
  - circle; pC; 2 ||| fill; grey
  - circle; pD; 2 ||| fill; grey
  - circle; pE; 2 ||| fill; grey
  - label; at; pA; w; 20; h; 22; anchor; mr ||| $A$
  - label; at; pB; w; 20; h; 22; anchor; ml ||| $B$
  - label; at; pC; w; 20; h; 22; anchor; bm ||| $C$
  - label; at; pD; w; 20; h; 22; anchor; tr ||| $D$
  - label; at; pE; w; 20; h; 22; anchor; bl ||| $E$

to some SVG image like this:

wt-huatu example of introduction

There are some examples in the folder examples, which are used as the library is developed. They are simply .yml files, except some special syntax.

There are more examples in the shared repository at https://wt-huatu.org/repo.

And there are some documents presented at https://wt-huatu.org/doc. The documents are not fully covering all the features of the lib, it is a continuing process, as we add more, it will be updated.

You can use it as a npm package.

Install by

npm install wt-huatu

Then use it in node.js, or some front-end browser-like environment, following is some example (in node.js):

import {
  WtHuatu,
  renderWtHuatuYml,
  renderYmlInput
} from "wt-huatu";

import fs from "fs";

// 设计输入
// The design input file
const htDesignInput = `
# Example WT-HUATU design file
# --- Vars ------
vars:
  r: 100
  degAB: datan(0.25/1.25)

# --- Points ------
points:
  pA: (0, 0)

# --- Shapes ------
shapes:
  lnAB: line; pA; -degAB
cpoints:
  pB: lnAB; r

shapes2:
  cA: circle; pA; r
  cB: circle; pB; r

xpoints2:
  pC: cA; cB; n;
  pD: lnAB; cA; w;
  pE: lnAB; cB; e;

shapes3:
  triABC: triangle; pA; pB; pC;

# --- Draw --------
draw:
  - cA; fill, none; stroke; 1, cc
  - cB; fill, none; stroke; 1, cc
  - triABC; fill, yellow; stroke; 1, cc
  - circle; pA; 2 ||| fill; grey
  - circle; pB; 2 ||| fill; grey
  - circle; pC; 2 ||| fill; grey
  - circle; pD; 2 ||| fill; grey
  - circle; pE; 2 ||| fill; grey
  - label; at; pA; w; 20; h; 22; anchor; mr ||| $A$
  - label; at; pB; w; 20; h; 22; anchor; ml ||| $B$
  - label; at; pC; w; 20; h; 22; anchor; bm ||| $C$
  - label; at; pD; w; 20; h; 22; anchor; tr ||| $D$
  - label; at; pE; w; 20; h; 22; anchor; bl ||| $E$
`;

// 用例1:直接生成嵌入svg文件的Html文件(字符串),可直接在浏览器中查看及打印。
// Usage 1: Generate the svg-image-embedded html directly, you can browse it in a browser.
const svgHtml1 = await renderWtHuatuYml(htDesignInput);
fs.writeFileSync("./test-wt-huatu.html", svgHtml1);

// 用例2:编译解析后获取完全体结果
// Usage 2: Render the input to get a full-functional Object `WtHuatu`
const parsedRes = await renderYmlInput(htDesignInput, {});
// WtHuatu对象, 可以查看其所有成员变量,以便于进行二次开发
// 或者选择性生成全部或部分所设计/定义的图形元素
// The parsed WtHuatu object, you can inspect all the members and call the methods,
// make secondary developments or intergrate into your own applications,
// Or you can use this object to generate part or all the designed drawing elements ever designed
const htObj = parsedRes.huatu;
// 从唯一的输出任务(draw)生成svg文件(字符串),可以将此SVG文件保存为单独的文件或者嵌入到
// 其他支持SVG格式的图形处理软件中
// Output the svg file of the only job `draw`, you can save this to seperate file
// Or embed itinto other systems that can handle SVGs.
const svg1 = parsedRes.rendered.find(x => x.jobName === 'draw').html;
// 保存svg到文件
// Save to local SVG format image file
fs.writeFileSync("./test-wt-huatu.svg", svg1);

If you are interested, let's draw!