webdevcody/sketchlab.app 是从 https://github.com/webdevcody/sketchlab.app. 导入的特工技能候选人。
概览
webdevcody/sketchlab.app 是从 https://github.com/webdevcody/sketchlab.app. 导入的特工技能候选人。
概述(AI 翻译)
一个快速的、仅浏览器的图表工具(想象一下小型的Figma/Excalidraw)。绘制形状, 用自动吸附的线条连接起来,插入图标,所有自动保存都会生效 本地。无后端——板块存储在IndexedDB,并通过单一URL共享。
堆叠
- 渲染: PixiJS v8(WebGL)——GPU加速,按需渲染。
- **状态:**纳米存储器——微小的反应原子。无反应。
- Persistence: 通过
idb-keyvalIndexedDB。 - 共享: 板块 JSON →
lz-string查询字符串压缩→。 - Build: Vite + TypeScript。以静态文件形式发布(由 nginx 在 Dockerfile 中提供)。
命令
Claude 代码技能(生成图表到Sketch Lab)
代理可以发送 Sketch Lab GeneratedGraph JSON 并以 ?g= URL 打开。
该技能托管在应用中:
安装到 Claude Code:
然后重启Claude代码,要求Sketch Lab图。代理构建
https://sketchlab.webdevcody.com/?g= 并打开了它。
表演如何用多种形式保持平坦
- 脏集更新,不是完整差值。 动作会变异纳米存储器 并且 告诉
本页由 AI 翻译,技术细节请以原文为准。
README
以下为原文 README 节选,完整内容请查看原文。
Sketch Lab
A fast, browser-only diagram tool (think a tiny Figma/Excalidraw). Draw shapes, connect them with auto-snapping lines, drop in icons, and everything auto-saves locally. No backend — boards live in IndexedDB and are shareable via a single URL.
Stack
- Rendering: PixiJS v8 (WebGL) — GPU-accelerated, render-on-demand.
- State: nanostores — tiny reactive atoms. No React.
- Persistence: IndexedDB via
idb-keyval. - Sharing: board JSON →
lz-stringcompression → query string. - Build: Vite + TypeScript. Ships as static files (served by nginx in the Dockerfile).
Commands
npm install
npm run dev # local dev server (http://localhost:5173)
npm run build # type-check + production build to dist/
npm run preview # serve the production build
Claude Code skill (generate diagrams into Sketch Lab)
Agents can emit Sketch Lab GeneratedGraph JSON and open it with a ?g= URL.
The skill is hosted with the app:
Install into Claude Code:
mkdir -p ~/.claude/skills/sketch-lab
curl -fsSL https://sketchlab.webdevcody.com/skills/sketch-lab/SKILL.md \
-o ~/.claude/skills/sketch-lab/SKILL.md
Then restart Claude Code and ask for a Sketch Lab diagram. The agent builds
https://sketchlab.webdevcody.com/?g= and opens it.
How performance is kept flat with many shapes
- Dirty-set updates, not full diffs. Actions mutate the nanostore and tell the
renderer exactly which node/edge ids changed (
scene.updateNode(id)). Dragging one of thousands of shapes touches only that node + its incident edges. - Render-on-demand. The Pixi ticker is stopped;
app.render()is scheduled once per animation frame only when something is dirty. - Per-view redraw guards. A shape’s
Graphicsis only re-tessellated when its geometry/style actually changes; moving it just sets a container transform. - All hit-testing in world space (not Pixi’s event tree), so selection/marquee/ connect/resize are O(changed), and the camera is a single container transform.
Architecture
src/
state/ types, nanostore atoms (store.ts), mutation actions (actions.ts)
render/ Pixi scene singleton (scene.ts), shape/edge view builders,
geometry/snapping math, vector icon registry
interaction/ controller.ts (pointer/keyboard state machine), camera, viewport,
text-editor overlay, "/" icon palette
persistence/ IndexedDB (db.ts), autosave, URL share encode/decode
ui/ dashboard, editor chrome (toolbar/colors/zoom), DOM helpers, router
main.ts hash router: editor (#/board/:id), ?b= board share, ?g= GeneratedGraph import
Shortcuts
V select · T text · R rectangle · O circle · L connector line ·
推荐工具
换一个关键词,或者移除筛选条件。
安装
npx skillfish add webdevcody/sketchlab.app