Skip to content

WCCG in Declarative custom elements #32

@sashafirsov

Description

@sashafirsov

Declarative custom elements - teaser

Not a proposal. Here we could outline the purpose and goals. WIGC proposal would follow.

Description

Defines the convention of defining the custom elements via HTML tags.

It is a part of declaratively defined functional web application running even with JS script disabled.

Links

Status

  • list

Initial API Summary/Quick API Proposal

<template element="garden-treat">
    <slot name="icon">🍓</slot>
    <slot>berry</slot>
</template>
<garden-treat>peach<span slot="icon">🍑</span></garden-treat>

Key Scenarios

Simple template use in custom element. The template DOM reuse for same kind of data presented multiple times in UI.

Extended use is a templates library to be reused across multiple pages. This feature requires external resource reference and include into page. Like HTML include.

Live POC for inline and external template library.

Concerns

  • functionality of original Custom Elements usually is defined by JavaScript which gives a full power for business logic of web application. In order to be sufficient the template concept should be extended to support explicit conditions( in current standard only positive text on slot name match is implemented), iteration over collection ( current implementation has only given order slot multiplication ) - needs order customization, transaction (TBD)
  • support of page life cycle: load, (de-)hydration

Dissenting Opinion

Related Specs

Open Questions

  • what is MVP. Static site?
  • full implementation scope. Shopping cart app.

follow up proposals

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