feat(designer-mode): add dev-only in-app visual inspector#43611
feat(designer-mode): add dev-only in-app visual inspector#43611andrepimenta wants to merge 4 commits into
Conversation
Add Designer Mode, a dev-only visual inspector for the extension UI gated behind the DESIGNER_MODE build flag (dead-code-eliminated when off, so it never ships in normal builds). It lets designers inspect any component, edit styles live, and send plain-language change requests to an AI coding agent that applies them to source. - Vendored core under ui/helpers/designer-mode/core (Shadow-DOM panel, hover/select overlay, toggle, and localhost relay client) - React fiber inspector adapter (react-adapter.ts) - Gated init in ui/index.js and the DESIGNER_MODE flag wired through builds.yml and .metamaskrc.dist - docs/designer-mode.md covering setup for both developers and designers Co-authored-by: Cursor <cursoragent@cursor.com>
Builds ready [4936d98]
⚡ Performance Benchmarks (Total: 🟢 19 pass · 🟡 6 warn · 🔴 0 fail)
Bundle size diffs [🚨 Warning! Bundle size has increased!]
|
Fixes the `Test lint` CI failure by running the repo formatter (oxfmt) over the Designer Mode sources and docs. Co-authored-by: Cursor <cursoragent@cursor.com>
Dynamic import() always uses ESM resolution under nodenext, which requires explicit file extensions — unlike the repo's extensionless static (CJS) imports. Convert the internal dynamic imports to static ones (the whole module is already lazily loaded from ui/index.js, so nothing is lost), drop the type-position import() in utils, and tighten the overlay onSelect guard so a locked element is non-null when passed to panel.show(). Co-authored-by: Cursor <cursoragent@cursor.com>
Builds ready [2635721]
⚡ Performance Benchmarks (Total: 🟢 15 pass · 🟡 9 warn · 🔴 0 fail)
Bundle size diffs [🚨 Warning! Bundle size has increased!]
|
Make the dev-flag default explicit and disabled in the template config so a fresh .metamaskrc never enables Designer Mode unless a developer opts in. Co-authored-by: Cursor <cursoragent@cursor.com>
Builds ready [25cb6ba]
⚡ Performance Benchmarks (Total: 🟢 16 pass · 🟡 9 warn · 🔴 0 fail)
Bundle size diffs [🚨 Warning! Bundle size has increased!]
|
Description
Adds Designer Mode, a dev-only in-app visual inspector for the extension UI.
It lets a designer point at any component in the running extension, see its
component name / source file / computed styles, tweak values live, and send a
plain-language change request to an AI coding agent that applies it to the
source code.
Reason for the change: designers currently can't easily map what they see in
the running extension back to the components/styles in code, and hand-off
requires manual screenshots and back-and-forth.
Solution: a self-contained Shadow-DOM inspector (panel + hover/select
overlay + toggle) that reads component info from React fibers and talks to a
local relay (
localhost:3334) consumed by thedesigner-modeagent skill. Thewhole feature is gated behind the
DESIGNER_MODEbuild flag and isdead-code-eliminated when off, so it never ships in normal or production
builds. No manifest/CSP changes were required.
Includes:
ui/helpers/designer-mode/core(panel, overlay, toggle, relay client)react-adapter.ts)ui/index.js, with the flag wired throughbuilds.ymland.metamaskrc.distdocs/designer-mode.mdcovering setup for both developers and designersChangelog
CHANGELOG entry: null
Manual testing steps
DESIGNER_MODE=trueto your.metamaskrc.yarn skillsto sync thedesigner-modeskill, then start it in your AI assistant and say "enter design mode".yarn start(the flag is read at startup).dist/chrome) in Chrome and open the expanded view (chrome-extension://<id>/home.html).[designer-mode] inspector active — press Ctrl+Shift+D.DESIGNER_MODE=trueand verify no 🎨 button appears and nodesigner-modecode is present in the bundle.Screenshots/Recordings
Before
After
Designer.Mode.Extension.mov
Pre-merge author checklist
Pre-merge reviewer checklist