Skip to content

Add opt-in DOM semantic data attributes #63

Description

@mahyarmlk

Goal

Add an opt-in way for @intent-framework/dom to expose Intent semantic IDs as data-intent-* attributes in rendered DOM.

This should help debugging, demos, and future tooling by connecting inspectScreen() output to actual rendered HTML.

Context

Intent now has stable semantic IDs in inspectScreen() for screens, asks, actions, flows, surfaces, and resources.

The DOM renderer currently renders semantic HTML, but users cannot easily map rendered elements back to inspected graph nodes.

Desired behavior

Add a new opt-in render option, probably:

renderDom(Screen, {
  target,
  showSemanticIds: true,
})

Exact option name can be chosen after inspecting existing DOM render options.

When enabled, rendered DOM should include stable semantic data attributes where appropriate, for example:

<main data-intent-screen="screen:invite-member">
  <label data-intent-ask="ask:email">Email</label>
  <input data-intent-ask="ask:email" />
  <button data-intent-action="action:invite-member">Invite member</button>
</main>

Use the actual semantic IDs produced by current graph/inspection logic.

Requirements

  • Opt-in only. Default DOM output should not change.

  • Do not use semantic IDs as DOM id attributes.

  • Do not expose data attributes for resources unless there is a real rendered element representing them.

  • Keep accessibility behavior unchanged.

  • Keep existing tests passing.

  • Add focused DOM tests for the new option.

  • Update docs where useful:

    • packages/dom/README.md
    • docs/Inspect-Screen.md
    • maybe docs/Quickstart.md only if it stays tiny

Boundaries

Do not build DevTools.
Do not add CSS styling.
Do not change public graph semantics.
Do not change core runtime behavior.
Do not add a dependency.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    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