Skip to content

Support sending styles in Hyperview fragments #411

Description

@flochtililoch

Right now, the styles definition is represented under the <styles> element, which by spec requires to be an immediate children of the <screen> element. Hyperview fragments by spec only return elements that can be appended to a element.

Proposal: define a new <fragment> element, modeled after the <screen> element, that will serve the purpose of nesting content and styles in two separate elements. For example:

Document Fragment
<doc xmlns="https://hyperview.org/hyperview">
  <screen>
    <styles>
      <style id="primary" color="blue" />
    </styles>
    <body>
      <text style="primary">Hello</text>
    </body>
  </screen>
</doc>

Current

<text style="secondary">World!</text>

Proposed

<doc xmlns="https://hyperview.org/hyperview">
  <fragment>
    <styles>
      <style id="secondary" color="green" />
    </styles>
    <body>
      <text style="secondary">World!</text>
    </body>
  </fragment>
</doc>

We would need for this to update the existing parsing code to change the validation logic while preserving support for the old format, then extract the stylesheet here (like it's done here) and merge it in the existing stylesheet (stored on the React state).

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions