@algorisys/yappydraw

中文文档
0.8.306发布于 2026/11/05AGPL-3.0-onlyTypeScriptES Module零依赖近 30 天下载 4185

The YappyDraw drawing API without the editor: hand-drawn and clean shapes, rendered to SVG in the browser.

原始使用文档

@algorisys/yappydraw

The YappyDraw drawing API without the editor, as a browser ES module. Create shapes in code, then render them as inline SVG. Each shape is a <g data-yappy-id="…">, so CSS and animation libraries can target it.

npm install @algorisys/yappydraw
import { Yappy, mount, fontsReady } from '@algorisys/yappydraw'

await fontsReady()   // before creating any text
const sun = Yappy.createCircle(40, 40, 120, 120, { backgroundColor: '#ffd166', fillStyle: 'hachure' })
mount('#stage')      // inline SVG

Or with no install, from a CDN:

<script type="module">
  import { Yappy, mount } from 'https://cdn.jsdelivr.net/npm/@algorisys/[email protected]/yappy.js'
</script>
ExportWhat
YappyThe full window.Yappy API: create*, importDSL, loadDocument, … (see the in-app Help)
toSVG(options?)SVG markup, element ids on by default. Never downloads a file.
mount(target, options?)Render into an element as inline SVG; returns the <svg>
fontsReady()Load YappyDraw's fonts; await it before creating text
clear()Start a fresh drawing
versionThe YappyDraw version this was built from

Notes

  • Browser only. It needs a DOM and canvas for text measurement.
  • One drawing per page. The store is a module singleton; call clear() before building the next one.
  • Keep chunks/ next to yappy.js. MathJax and the exporters are loaded from there the first time they are used.
  • Licence: AGPL-3.0-only, as the rest of YappyDraw. Check that it suits your project before bundling it into software you distribute or run as a network service.

Source: algorisys-oss/yappydraw @ v0.8.306.

版本与发布记录

@algorisys/yappydraw 共发布 34 个版本,首次发布于 2026/09/14;过去 12 个月发布了 34 个版本。

版本发布日期距今
0.8.306latest2026/11/05今天
0.8.3052026/11/05今天
0.8.3042026/11/051 天前
0.8.3032026/11/033 天前
0.8.3012026/11/024 天前
0.8.3022026/11/024 天前

关于 @algorisys/yappydraw 的常见问题

@algorisys/yappydraw 是什么?

The YappyDraw drawing API without the editor: hand-drawn and clean shapes, rendered to SVG in the browser.

如何安装 @algorisys/yappydraw?

在项目目录运行 npm install @algorisys/yappydraw,或使用 pnpm add / yarn add / bun add。

@algorisys/yappydraw 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@algorisys/yappydraw 支持 ESM 还是 CommonJS?

以 ES Module 形式发布,推荐使用 import 引入。在 CommonJS 项目中,Node.js 20.19+ / 22.12+ 可以直接 require() 不含顶层 await 的 ES Module,更早的版本需要改用动态 import()。

@algorisys/yappydraw 可以商用吗?

@algorisys/yappydraw 使用 AGPL-3.0-only 许可。最严格的 Copyleft:除分发外,通过网络向用户提供基于它的服务也需要开源对应源码。闭源 SaaS 使用前务必评估。以上为概括,不构成法律意见,请以许可原文为准。

@algorisys/yappydraw 的下载量有多少?

根据 npm 官方下载统计,@algorisys/yappydraw 在 2026/10/06 – 2026/11/04 这 30 天内被下载 4,185 次,日均约 140 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@algorisys/yappydraw 还在维护吗?

最新版本 0.8.306 发布于 2026/11/05(今天);至今共发布 34 个版本,其中过去 12 个月发布了 34 个;首次发布于 2026/09/14。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。