adobe / react-webcomponent

This projects automates the wrapping of a React component in a CustomElement.
Apache License 2.0
105 stars 19 forks source link

Add a @byContent selector for reparenting child content #5

Closed cuberoot closed 5 years ago

cuberoot commented 5 years ago

Description

This is the implementation of a @byContent decorator that would allow the capturing of arbitrary DOM content that the web component user has placed into a wrapped web component.

Related Issue

https://github.com/adobe/react-webcomponent/issues/4

Motivation and Context

Adding this feature would allow us to turn a React container component into a web component. So, we could write containers such as popovers and dialogs in React and wrap them as web components. The user of the web components could pass in arbitrary content to be hosted in the container.

How Has This Been Tested?

I have developed a basic container control using this code and I have added a new test to the test suite to test it.

Screenshots (if appropriate):

Types of changes

Checklist:

cuberoot commented 5 years ago

@alex-mirea I fixed up all of the the code review issues that you flagged. Thanks!