Summary
Extract host-context utilities into clients/web/src/components/elements/AppRenderer/hostContext.ts: read the current theme and Mantine design tokens from the DOM, measure the host container, and assemble an initial McpUiHostContext snapshot.
Why
Today the Apps host only tells a widget about theme. The ext-apps spec's hostContext also carries styles, display mode, and container dimensions. Centralizing snapshot/measurement logic in a pure module keeps the renderer thin and makes the follow-up features (full hostContext delivery, live host-context-changed, size-changed) testable in isolation.
Reference implementation (PR #1510)
Re-implement informed by these changes at 33fac3f:
Depends on
Nothing — Wave 1 foundation, parallel-safe. Consumed later by the hostContext-delivery and size-changed issues.
Notes
- Coverage gate ≥90 on all four dimensions; happy-dom quirks around
getBoundingClientRect/computed styles may need justified /* v8 ignore */ comments per AGENTS.md — one line, statement-level (see repo guidance on JSX-adjacent ignores).
Part of the PR #1510 decomposition (see tracking issue).
Summary
Extract host-context utilities into
clients/web/src/components/elements/AppRenderer/hostContext.ts: read the current theme and Mantine design tokens from the DOM, measure the host container, and assemble an initialMcpUiHostContextsnapshot.Why
Today the Apps host only tells a widget about
theme. The ext-apps spec'shostContextalso carries styles, display mode, and container dimensions. Centralizing snapshot/measurement logic in a pure module keeps the renderer thin and makes the follow-up features (full hostContext delivery, livehost-context-changed, size-changed) testable in isolation.Reference implementation (PR #1510)
Re-implement informed by these changes at
33fac3f:currentTheme(),currentStyles()(Mantine tokens →McpUiHostStylesviaSTYLE_VARIABLE_SOURCES),measureContainerDimensions(),snapshotHostContext()(+156 lines)Depends on
Nothing — Wave 1 foundation, parallel-safe. Consumed later by the hostContext-delivery and size-changed issues.
Notes
getBoundingClientRect/computed styles may need justified/* v8 ignore */comments per AGENTS.md — one line, statement-level (see repo guidance on JSX-adjacent ignores).Part of the PR #1510 decomposition (see tracking issue).