dot-canvas-designer
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseDot Canvas Designer
Dot Canvas 设计器
Use this skill when the user wants to design or revise a Dot. Canvas API card, dashboard, status panel, or layout.
windowDataDo not use this skill merely to send an existing payload to a device. For device operations, use .
dot-device-openapi当用户想要设计或修改Dot. Canvas API卡片、仪表盘、状态面板或布局时,使用此技能。
windowData请勿仅使用此技能向设备发送现有负载。设备操作请使用。
dot-device-openapiOutput Boundary
输出范围
Produce a Canvas payload or a object. Do not handle API keys, device IDs, or device sending here.
windowDataWhen the user asks to design and send a Canvas card:
- Use this skill to build the Canvas payload.
- Use to send it.
dot-device-openapi
生成Canvas负载或对象。此处不处理API密钥、设备ID或设备发送操作。
windowData当用户要求设计并发送Canvas卡片时:
- 使用此技能构建Canvas负载。
- 使用发送负载。
dot-device-openapi
Composition Model
组合模型
Build as JSON, not JSX, JavaScript, raw HTML, external CSS, or an image.
windowDataRoot shape:
json
{
"default": [
{
"type": "div",
"props": {
"tw": "flex flex-col flex-1 bg-white text-black",
"children": "Hello Dot."
}
}
]
}Element shape:
- :
type,div, orspanimg - : render props
props - : Tailwind-like utility classes
props.tw - : explicit inline style object
props.style - : a string, one element object, or an array of element objects
props.children
Dynamic values should read Canvas through simple expressions such as .
dataget{{get inputData "title" default="-"}}以JSON格式构建,而非JSX、JavaScript、原始HTML、外部CSS或图片。
windowData根结构:
json
{
"default": [
{
"type": "div",
"props": {
"tw": "flex flex-col flex-1 bg-white text-black",
"children": "Hello Dot."
}
}
]
}元素结构:
- :
type,div, orspanimg - : 渲染属性
props - : 类Tailwind的工具类
props.tw - : 显式内联样式对象
props.style - : 字符串、单个元素对象或元素对象数组
props.children
动态值应通过简单的表达式读取Canvas ,例如。
getdata{{get inputData "title" default="-"}}Supported Template Logic
支持的模板逻辑
Use stable display-layer helpers only:
- /
$for: list structures$empty - /
$ifAny/$then: structural conditions$else - /
if: short content branches based on whether a value has contentelse - : short text branches
compare - : date display
formatDate - : number display
formatCompactNumber - : read JSON paths
get
Avoid internal cleaning or transformation helpers such as , , , or in public Canvas payloads. Do data cleanup and heavy computation before building the JSON payload.
imageSrcstripHtmlmathregexMatch仅使用稳定的显示层辅助工具:
- /
$for: 列表结构$empty - /
$ifAny/$then: 结构化条件判断$else - /
if: 基于值是否有内容的短内容分支else - : 短文本分支
compare - : 日期显示
formatDate - : 数字显示
formatCompactNumber - : 读取JSON路径
get
在公开的Canvas负载中,避免使用、、或等内部清理或转换辅助工具。在构建JSON负载前完成数据清理和大量计算。
imageSrcstripHtmlmathregexMatchLayout Guidance
布局指南
- Prefer one bounded root container with ,
flex,w-full, and explicit background/text colors.h-full - Use ,
min-w-0, fixed heights,min-h-0,overflow-hidden,lineClamp, andtextOverflowwhen text could overflow.whiteSpace - The outermost Canvas element usually should not add padding; device layout spacing comes from .
layoutFull - Use or
layoutFull.twfor full-bleed rendering, background, or padding overrides.layoutFull.style - Keep element count and nesting low. Compose clear sections instead of deeply nested decoration.
- 优先使用带有、
flex、w-full以及明确背景/文本颜色的单个有界根容器。h-full - 当文本可能溢出时,使用、
min-w-0、固定高度、min-h-0、overflow-hidden、lineClamp和textOverflow。whiteSpace - 最外层Canvas元素通常不应添加内边距;设备布局间距来自。
layoutFull - 使用或
layoutFull.tw实现全屏渲染、背景或内边距覆盖。layoutFull.style - 保持元素数量和嵌套层级较低。组合清晰的区块,而非深度嵌套的装饰元素。
References
参考资料
references/windowdata.mdreferences/examples.md
references/windowdata.mdreferences/examples.md