Skip to content

web: extract hostContext utilities for the Apps host (AppRenderer/hostContext.ts) #1559

Description

@cliffhall

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).

Metadata

Metadata

Assignees

Labels

v2Issues and PRs for v2

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions