feat(dom): implement true multi-surface DOM rendering#115
Merged
Conversation
Each surface renders as a separate <section> with accessible label and unique DOM id. Multi-surface screens use --<surfaceName> suffixed DOM ids for asks, actions, hints, reasons, and feedback outputs to avoid duplicates. Single-surface screens preserve backward-compatible DOM output (no suffix, no section wrapper). Duplicate ask controls across surfaces share underlying state via reactive subscriptions. Duplicate action buttons execute the same action. Blocked reasons, aria-describedby, Enter key hints, and feedback output are scoped per surface copy. 16 new tests cover multi-surface sectioning, id suffixing, item scoping, shared state (text/checkbox/select), shared actions, enabled/disabled sync, scoped blocked reasons, scoped aria-describedby, per-surface feedback, Enter key per surface, semantic id preservation, and cleanup.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Implements the approved multi-surface DOM rendering from the design proposal at
docs/proposals/Dom-Multi-Surface-Rendering.md(PR #114, merge 665f46d).Before
renderDomrendered only the first surface (screenDef.surfaces[0]) and ignored all others. All asks and actions were rendered into a single<form>inside a single<main>, regardless of which surface they belonged to.After
<section>witharia-labeland unique DOM id<section>wrapper) — fully backward compatible--<surfaceName>suffixed DOM ids for asks, actions, hints, reasons, and feedback outputs to avoid duplicate idsaria-describedby, Enter key hints, and feedback output are scoped per surface copydata-intent-*semantic ids remain identical across duplicate copiesChanged files
packages/dom/src/index.tsbuildDominto helpers (buildSurface,buildForm,buildAskControl,buildActionButton), per-surface subscriptions, state syncpackages/dom/src/dom.test.tsdocs/proposals/Dom-Multi-Surface-Rendering.md.changeset/many-experts-chew.md@intent-framework/domTests added
Validation
All passed:
pnpm test— 322 tests across all packages and examplespnpm typecheck— no errorspnpm build— clean buildpnpm lint— no errorspnpm pack:check— packages packablepnpm changeset status— correctSemantics note
Feedback: when the same action appears in multiple surfaces and executes, both surfaces'
<output>elements show the feedback message (the status change subscription updates all copies). This is the "all copies" behavior and is consistent with the shared-action design.Do not merge automatically
This changes DOM runtime behavior. Requires review.