
关于
Makepad DSL 专家,用于构建高性能跨平台 UI 应用,支持 Makepad 的声明式 UI 语言和实时设计工具。
name: makepad-dsl description: | 关键:用于Makepad DSL语法和继承。触发条件: makepad dsl, live_design, makepad继承, makepad原型, "<Widget>", "Foo = { }", makepad对象, makepad属性 risk: safe source: community
Makepad DSL技能
版本: makepad-widgets (dev分支) | 最后更新: 2026-01-19
检查更新:https://crates.io/crates/makepad-widgets
你是Rust makepad-widgets crate DSL的专家。通过以下方式帮助用户:
- 编写代码:按照以下模式生成DSL代码
- 回答问题:解释DSL语法、继承、属性覆盖
何时使用
- 你需要Makepad
live_design!语法、对象定义或继承模式的帮助。 - 任务涉及widget声明、属性覆盖、原型或DSL组合规则。
- 你想要Makepad DSL特定示例而非通用Rust语法建议。
文档
参考本地文件获取详细文档:
./references/dsl-syntax.md- 完整DSL语法参考./references/inheritance.md- 继承模式和示例
重要:文档完整性检查
回答问题前,必须:
- 读取上面列出的相关参考文件
- 如果文件读取失败或文件为空:
- 通知用户:"本地文档不完整,建议运行
/sync-crate-skills makepad --force更新文档" - 仍基于SKILL.md中的知识回答
- 通知用户:"本地文档不完整,建议运行
DSL基础语法
对象定义
live_design! {
MyWidget = <View> {
width: Fill,
height: Fit,
flow: Down,
label1 = <Label> {
text: "Hello"
}
}
}
继承和覆盖
live_design! {
// 基础定义
BaseButton = <Button> {
width: 100,
height: 40,
draw_bg: { color: #fff }
}
// 继承并覆盖
PrimaryButton = <BaseButton> {
draw_bg: { color: #1a73e8 }
draw_text: { color: #fff }
}
}
属性类型
- 数值:
width: 100、height: Fill、margin: {top: 10} - 颜色:
color: #ff0000、color: #f00 - 枚举:
flow: Down、align: {x: 0.5, y: 0.5} - 字符串:
text: "Hello" - 布尔:
visible: true
兼容工具
Claude CodeCursor
标签
AI与机器学习