Silind-Software / direflow

🧩 Use the best of two worlds. Create fast, performant, native Web Components using React.
https://direflow.io
MIT License
501 stars 78 forks source link

feat: add useNamedSlots to support named slots #261

Open FrankKai opened 2 years ago

FrankKai commented 2 years ago

What does this pull request introduce? Please describe
Add useNamedSlots to support named slots.

How did you verify that your changes work as expected? Please describe
Add useNamedSlots option for DireflowComponent.create's configuration.

Example
Please describe how we can try out your changes

import { DireflowComponent } from "direflow-component";

export default DireflowComponent.create({
  configuration: {
    tagname: "test-comp",
    useShadow: true,
    useNamedSlots: ['slot1', 'slot2']
  },
});
<test-comp>
    <p slot="slot1">I'm slot1</p>

    <div slot="slot2">I'm slot2</div>
</test-comp>

Screenshots
If applicable, add screenshots to demonstrate your changes.

image

Version
Which version is your changes included in?
3.5.4

Did you remember to update the version of Direflow as explained here:
https://github.com/Silind-Software/direflow/blob/master/CONTRIBUTING.md#version