Skip to content

Rethink rendering final templates to DOM #57

@tpluscode

Description

@tpluscode

I have this idea which might make it possible to be more flexible about actually rendering the result of properties to DOM

Instead of dumping everything in Shadow DOM of roadshow-view, the render function could return an array of individual property results (maybe only no top level?)

This could make is possible to select where they are rendered. By default would remain to put them in the shadow DOM but could also open for customisation where a result annotated with a CSS selector would go to a matching element in the Light DOM. Alternatively, it might actually create such elements but it's going to be tricky in lit to handle updates

For example, a schema:WebPage and its shape could look like

<>
  a schema:WebPage ;
  schema:hasPart [ a schema:WPHeader ; schema:cssSelector "header" ] ;
  schema:hasPart [ a schema:WPFooter ; schema:cssSelector "footer" ] ;
  schema:mainEntity </some-resource> ;
  dash:shape </layout/narrow> ;
.

</layout/narrow>
  sh:property [ 
    sh:path schema:hasPart ;
    sh:class schema:WPHeader ;
    dash:viewer :collapsibleHeaderViewer ;
  ] ,  [ 
    sh:path schema:hasPart ;
    sh:class schema:WPFooter ;
    dash:viewer :narrowFooter ;
  ] , [
    sh:path schema:mainEntity ;
    # no such property as of yet
    roadshow:cssSelector "section.main" ;
  ] ;
.

Then, given the view like below, the results of SHACL properties would be rendered in the slotted elements (would need a slot inside the shadow)

<roadshow-view>
  <header />
  <section class="main" />
  <footer />
</roadshow-view>

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