WonderDash Widget Skill (v5 — WebView + Index + File-Per-Widget)
You manage widgets on the user's WonderDash mobile dashboard by writing individual JSON files to a GitHub repository, with a dashboard.json index that controls visibility and order.
Setup
WonderDash sends you a setup message containing:
- - Repo URL: INLINECODE1
- SSH Private Key: An Ed25519 key in OpenSSH PEM format
Save the SSH key and configure access:
CODEBLOCK0
Repo Structure
CODEBLOCK1
Dashboard Index (dashboard.json)
The index file at the repo root controls which widgets appear and in what order:
CODEBLOCK2
- - Array order = display order on the dashboard
- Each entry is a widget ID referencing INLINECODE3
- Widgets not in the array are hidden (archived) — their files are kept
- If
dashboard.json doesn't exist, all widgets in widgets/ are shown (unordered)
Widget Format
Each widget file (widgets/{id}.json) contains a single widget object:
CODEBLOCK3
Fields:
- - id (string): Unique slug identifier — must match the filename (e.g.,
weather → widgets/weather.json) - size (
"S" | "M" | "L"): Widget display size - renderer (
"webview" | "html", optional): Rendering engine. Default is "html" (native). Use "webview" for rich visuals. - html (string): Self-contained HTML with inline styles
Renderers
"webview" — Rich widgets (recommended for most widgets)
Renders in a full browser engine. Supports:
- - CSS gradients, shadows,
border-radius, INLINECODE18 - CSS animations (
@keyframes, transition) - SVG (charts, icons, sparklines)
- Canvas
- JavaScript (live clocks, counters, data formatting)
- Base64 inline images (
<img src="data:image/png;base64,...">) - Full CSS flexbox and grid
The app wraps your HTML in a document with dark theme defaults (background: #1f2937, color: #fff, system font). You just provide the body content.
"html" — Lightweight widgets (default)
Renders via native components (no browser). Faster and lighter, but limited to basic HTML elements and inline styles. No JS, no animations, no gradients, no SVG. Good for simple text/number displays.
Use "webview" for anything visual. Use "html" only for the simplest text-only widgets where performance matters more than appearance.
Widget Sizes
Modeled after Apple's iOS widget system:
| Size | Dimensions | Layout | Best for |
|---|
| S (Small) | 174 × 174 px | Square, 1 column | Single metric, status, icon |
| M (Medium) |
361 × 174 px | Full width, short | Info card, sparkline, summary |
|
L (Large) | 361 × 382 px | Full width, tall | Chart, table, calendar, feed |
Two small widgets fit side-by-side. Medium and large span the full width.
Creating a Widget
Two steps: create the widget file, then add it to the index.
CODEBLOCK4
Updating a Widget
Edit the widget file and push. No change to dashboard.json needed unless reordering.
CODEBLOCK5
Reordering / Archiving / Deleting
- - Reorder: Rearrange the array in
dashboard.json, commit, push. - Archive: Remove the ID from
dashboard.json — widget file stays in repo. - Restore: Add the ID back to the array.
- Delete permanently: Remove from
dashboard.json + git rm widgets/{id}.json, commit, push.
The user pulls down on their dashboard to refresh. Changes appear after a manual refresh.
Design Guidelines
- - Dark theme. Background:
#1f2937 (gray-800). Text: #ffffff. Secondary: #9ca3af (gray-400). Accent: #3b82f6 (blue-500). Success: #22c55e. Warning: #eab308. Error: #ef4444. - Self-contained. No external resources (CDNs, APIs, remote images). Everything inline.
- JSON escaping. Escape quotes in HTML when inside JSON strings. Use
\" for double quotes inside style attributes, or use single quotes in HTML (style='...'). - Fit the size. Content must fit within the widget dimensions without scrolling. WebView has
overflow: hidden by default. - Subtle animation. Use gentle transitions and animations to add polish — avoid flashy or distracting effects.
Examples
Small — Gradient metric (widgets/temperature.json)
A temperature display with gradient background and subtle glow.
CODEBLOCK6
Small — Animated status (widgets/api-status.json)
A pulsing status indicator with CSS animation.
CODEBLOCK7
Medium — SVG sparkline chart (widgets/revenue.json)
A revenue card with an inline SVG sparkline.
CODEBLOCK8
Medium — Gradient info card (widgets/next-meeting.json)
A meeting card with gradient accent border.
CODEBLOCK9
Large — Price chart with SVG (widgets/btc-price.json)
A Bitcoin price chart with gradient fill, grid lines, and price labels.
CODEBLOCK10
Large — Calendar grid (widgets/calendar.json)
A monthly calendar with CSS grid and highlighted dates.
CODEBLOCK11
Example dashboard.json
CODEBLOCK12
WonderDash 小组件技能 (v5 — WebView + 索引 + 每个小组件独立文件)
您通过将独立的 JSON 文件写入 GitHub 仓库,并配合控制可见性和排序的 dashboard.json 索引文件,来管理用户 WonderDash 移动仪表盘上的小组件。
设置
WonderDash 会向您发送一条包含以下内容的设置消息:
- - 仓库 URL: git@github.com:{用户名}/wonderdash-widgets.git
- SSH 私钥: 一个 OpenSSH PEM 格式的 Ed25519 密钥
保存 SSH 密钥并配置访问权限:
bash
保存密钥
cat > ~/.ssh/wonderdash_deploy << KEYEOF
<在此粘贴密钥>
KEYEOF
chmod 600 ~/.ssh/wonderdash_deploy
添加 SSH 配置
cat >> ~/.ssh/config << EOF
Host wonderdash-github
HostName github.com
User git
IdentityFile ~/.ssh/wonderdash_deploy
IdentitiesOnly yes
EOF
克隆仓库
git clone wonderdash-github:{用户名}/wonderdash-widgets.git
仓库结构
wonderdash-widgets/
├── dashboard.json ← 索引:控制哪些小组件可见及其排序
├── widgets/
│ ├── weather.json ← 小组件内容
│ ├── portfolio.json
│ ├── tasks.json
│ └── old-widget.json ← 已归档:文件存在但未在索引中列出
仪表盘索引 (dashboard.json)
位于仓库根目录的索引文件控制哪些小组件显示以及显示顺序:
json
{
widgets: [weather, portfolio, tasks]
}
- - 数组顺序 = 仪表盘上的显示顺序
- 每个条目是一个小组件 ID,引用 widgets/{id}.json
- 不在数组中的小组件将被隐藏(归档)——其文件会被保留
- 如果 dashboard.json 不存在,则显示 widgets/ 目录下的所有小组件(无序)
小组件格式
每个小组件文件(widgets/{id}.json)包含一个小组件对象:
json
{
id: weather,
size: S,
renderer: webview,
html:
...
}
字段说明:
- - id(字符串):唯一标识符——必须与文件名匹配(例如 weather → widgets/weather.json)
- size(S | M | L):小组件显示尺寸
- renderer(webview | html,可选):渲染引擎。默认为 html(原生)。使用 webview 可获得丰富的视觉效果。
- html(字符串):包含内联样式的自包含 HTML
渲染器
webview — 丰富小组件(推荐用于大多数小组件)
在完整的浏览器引擎中渲染。支持:
- - CSS 渐变、阴影、border-radius、backdrop-filter
- CSS 动画(@keyframes、transition)
- SVG(图表、图标、迷你走势图)
- Canvas
- JavaScript(实时时钟、计数器、数据格式化)
- Base64 内联图片(
) - 完整的 CSS flexbox 和 grid
应用会将您的 HTML 包装在具有深色主题默认样式的文档中(background: #1f2937、color: #fff、系统字体)。您只需提供主体内容。
html — 轻量级小组件(默认)
通过原生组件渲染(无浏览器)。速度更快、更轻量,但仅限于基本的 HTML 元素和内联样式。不支持 JS、动画、渐变、SVG。适用于简单的文本/数字显示。
任何视觉化内容请使用 webview。 仅在性能比外观更重要的最简单纯文本小组件中使用 html。
小组件尺寸
仿照 Apple 的 iOS 小组件系统设计:
| 尺寸 | 尺寸 | 布局 | 最佳用途 |
|---|
| S(小) | 174 × 174 像素 | 方形,1 列 | 单一指标、状态、图标 |
| M(中) |
361 × 174 像素 | 全宽,短 | 信息卡片、迷你走势图、摘要 |
|
L(大) | 361 × 382 像素 | 全宽,高 | 图表、表格、日历、信息流 |
两个小尺寸小组件可并排显示。中尺寸和大尺寸小组件占据全宽。
创建小组件
分两步:创建小组件文件,然后将其添加到索引中。
bash
cd wonderdash-widgets
mkdir -p widgets
1. 创建小组件文件
cat > widgets/weather.json << EOF
{
id: weather,
size: S,
renderer: webview,
html: ...
}
EOF
2. 添加到 dashboard.json 索引
如果 dashboard.json 尚不存在,请创建它:
echo { widgets: [weather] } > dashboard.json
如果已存在,请读取它,将新 ID 追加到 widgets 数组,然后写回。
git add widgets/weather.json dashboard.json
git commit -m 添加天气小组件
git push
更新小组件
编辑小组件文件并推送。除非需要重新排序,否则无需更改 dashboard.json。
bash
git add widgets/weather.json
git commit -m 更新天气小组件
git push
重新排序 / 归档 / 删除
- - 重新排序: 重新排列 dashboard.json 中的数组,提交,推送。
- 归档: 从 dashboard.json 中移除 ID——小组件文件保留在仓库中。
- 恢复: 将 ID 添加回数组。
- 永久删除: 从 dashboard.json 中移除 + git rm widgets/{id}.json,提交,推送。
用户下拉仪表盘即可刷新。更改在手动刷新后生效。
设计指南
- - 深色主题。 背景:#1f2937(gray-800)。文本:#ffffff。次要:#9ca3af(gray-400)。强调色:#3b82f6(blue-500)。成功:#22c55e。警告:#eab308。错误:#ef4444。
- 自包含。 无外部资源(CDN、API、远程图片)。所有内容内联。
- JSON 转义。 在 JSON 字符串中对 HTML 中的引号进行转义。在 style 属性内使用 \ 表示双引号,或在 HTML 中使用单引号(style=...)。
- 适配尺寸。 内容必须适合小组件尺寸,无需滚动。WebView 默认具有 overflow: hidden。
- 微妙的动画。 使用柔和的过渡和动画来增加精致感——避免花哨或分散注意力的效果。
示例
小尺寸 — 渐变指标(widgets/temperature.json)
带有渐变背景和柔和光晕的温度显示。
json
{
id: temperature,
size: S,
renderer: webview,
html:
}
小尺寸 — 动画状态(widgets/api-status.json)
带有 CSS 动画的脉冲状态指示器。
json
{
id: api-status,
size: S,
renderer: webview,
html:
标签
skill
ai