Makepad-skills makepad-2.0-migration
install
source · Clone the upstream repo
git clone https://github.com/ZhangHanDong/makepad-skills
Claude Code · Install into ~/.claude/skills/
T=$(mktemp -d) && git clone --depth=1 https://github.com/ZhangHanDong/makepad-skills "$T" && mkdir -p ~/.claude/skills && cp -r "$T/skills/makepad-2.0-migration" ~/.claude/skills/zhanghandong-makepad-skills-makepad-2-0-migration && rm -rf "$T"
manifest:
skills/makepad-2.0-migration/SKILL.mdsource content
Makepad 1.x to 2.0 Migration Skill
Version: makepad-widgets (dev branch) | Last Updated: 2026-03-03
Overview
Makepad 2.0 is a fundamental architecture shift from compile-time static DSL to runtime scripting. Migration involves syntax changes, derive macro updates, lifecycle method renames, and new patterns for state management.
Documentation
Refer to the local files for detailed documentation:
- Complete migration reference with examples./references/migration-guide.md
Quick Syntax Mapping Table
| Makepad 1.x | Makepad 2.0 | Notes |
|---|---|---|
| | Core macro change |
| | No angle brackets |
| | Colon, not equals |
| | Theme namespace |
| | Merge operator |
| | Derive macro |
| | Lifecycle hooks |
| | Unchanged |
| | Method rename |
| | Method rename |
| | Runtime updates |
| | Enum default |
| | Widget registration |
| | Registration method |
| | Unchanged |
Step-by-Step Migration
Step 1: Replace Macro
// OLD live_design! { import makepad_widgets::base::*; import makepad_widgets::theme_desktop_dark::*; App = {{App}} { ui: <Root> { ... } } } // NEW script_mod! { use mod.prelude.widgets.* startup() do #(App::script_component(vm)){ ui: Root{ // ... UI definition } } }
Step 2: Update Derives
// OLD #[derive(Live, LiveHook, Widget)] pub struct MyWidget { ... } // NEW #[derive(Script, ScriptHook, Widget)] pub struct MyWidget { ... }
Step 3: Update App::run
// OLD impl LiveRegister for App { fn live_register(cx: &mut Cx) { makepad_widgets::live_design(cx); } } // NEW impl App { fn run(vm: &mut ScriptVm) -> Self { crate::makepad_widgets::script_mod(vm); App::from_script_mod(vm, self::script_mod) } }
Step 4: Rename Lifecycle Methods
// OLD impl LiveHook for MyWidget { fn before_apply(&mut self, cx: &mut Cx, ...) { ... } fn after_apply(&mut self, cx: &mut Cx, ...) { ... } } // NEW impl ScriptHook for MyWidget { fn on_before_apply(&mut self, cx: &mut Cx, ...) { ... } fn on_after_apply(&mut self, cx: &mut Cx, ...) { ... } }
Step 5: Update DSL Syntax
// OLD - angle brackets, equals signs <View> { width: Fill, height: Fill show_bg: true draw_bg: { color: (THEME_BG) } title = <Label> { text: "Hello" draw_text: { color: #fff } } } // NEW - curly braces, colons, theme namespace View{ width: Fill height: Fill show_bg: true draw_bg.color: theme.color_bg_app title := Label{ text: "Hello" draw_text.color: #fff } }
Step 6: Replace apply_over with script_eval
// OLD self.label(id!(title)).apply_over(cx, live! { text: "New text" }); // NEW script_eval!(cx, { ui.title.set_text("New text") }); // OR script_apply_eval!(cx, self.ui, { title.text: "New text" });
Key Breaking Changes
- No commas between properties (whitespace-delimited)
- No semicolons anywhere in Splash
- No angle brackets for widget types
- Theme constants use
prefix, nottheme.*
syntax(THEME_*) - Named children use
operator, not:== - Merge operator is
not+:
for extending parent properties:
is MANDATORY on containers (default is 0px, not auto)height: Fit- Registration happens in
, notApp::runlive_register - Field attribute
links to script object (required on some widgets)#[source] - Old
directory contains archived 1.x code for referenceold/
Common Migration Mistakes
| Mistake | Symptom | Fix |
|---|---|---|
Still using | Compile error | Replace with |
Using syntax | Parse error | Use |
Using | Property not applied | Use |
Using | Unknown token | Use |
Missing | Container invisible (0px) | Add |
Using derive | Compile error | Use |
Using | Method not found | Use |
| Using commas between props | Parse error | Remove commas |
Best Practices for Migration
- Start with examples - Study
andexamples/counter
for 2.0 patternsexamples/todo - Migrate one widget at a time - Don't try to convert everything at once
- Check the old/ directory - Compare old vs new widget implementations
- Test
- Most invisible UI is caused by missing heightheight: Fit - Use theme variables - Replace all hardcoded theme colors with
theme.* - Add
- Any View withnew_batch: true
and text children needs itshow_bg