Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom element slots #714

Merged
merged 10 commits into from
Apr 6, 2020
Merged

Conversation

rorticus
Copy link
Contributor

@rorticus rorticus commented Apr 2, 2020

Type: feature

The following has been addressed in the PR:

Description:

Adding custom element support for (some) child functions.

The following scenarios are supported now,

Render Func

Dojo

<Foo>
    { () => <Bar /> }
</Foo>

Custom Elements

<element-foo>
    <element-bar></element-bar>
</element-foo>

Named Renders

Dojo

<Foo>
    {{ 
      bar: <Bar />, 
      qux: [<Qux />, <Qux />]
    }}
</Foo>

Custom Elements

<element-foo>
    <element-bar slot="bar"></element-bar>
    <element-qux slot="qux"></element-qux>
    <element-qux slot="qux"></element-qux>
</element-foo>

Named Render Funcs

Dojo

<Foo>
    {{ 
      bar: () => <Bar />, 
      qux: () => <Qux /> 
    }}
</Foo>

Custom Elements

<element-foo>
    <element-bar slot="bar"></element-bar>
    <element-qux slot="qux"></element-qux>
</element-foo>

Render Funcs with parameters

Dojo

<Foo>
{{
    bar: (active) => <Bar active={active} />
}}
</Foo>

Custom Elements

<element-foo>
    <element-bar id="bar" slot="bar"></element-bar>
</element-foo>

<script>
bar.addEventListener('render', function ({ detail: [active]}) {
    this.active = active;
});
</script>

Resolves #708

@codesandbox-ci
Copy link

codesandbox-ci bot commented Apr 2, 2020

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit 4c72f58:

Sandbox Source
frosty-bird-8co7w Configuration

@codesandbox-ci
Copy link

codesandbox-ci bot commented Apr 2, 2020

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit a9acca5:

Sandbox Source
mystifying-benz-inq7w Configuration

@codecov
Copy link

codecov bot commented Apr 2, 2020

Codecov Report

Merging #714 into master will increase coverage by 0.00%.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #714   +/-   ##
=======================================
  Coverage   97.75%   97.76%           
=======================================
  Files         120      120           
  Lines        6949     6974   +25     
  Branches     1577     1585    +8     
=======================================
+ Hits         6793     6818   +25     
  Misses        156      156           
Impacted Files Coverage Δ
src/core/registerCustomElement.ts 97.59% <100.00%> (+0.32%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 32bab69...a9acca5. Read the comment docs.

@rorticus rorticus marked this pull request as ready for review April 2, 2020 17:40
@rorticus rorticus changed the title WIP of custom element slots Custom element slots Apr 3, 2020
@matt-gadd
Copy link
Contributor

This is going to be huge 👍

@rorticus rorticus merged commit 7393784 into dojo:master Apr 6, 2020
@rorticus rorticus deleted the custom-element-slots-v2 branch April 6, 2020 15:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Custom Element support for child functions and named child functions
2 participants