Skip to content
This repository was archived by the owner on Sep 23, 2023. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 5 additions & 4 deletions packages/direflow-component/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions packages/direflow-component/src/DireflowComponent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ class DireflowComponent {
const tagName = configuration.tagname || 'direflow-component';
const shadow = configuration.useShadow !== undefined ? configuration.useShadow : true;
const anonymousSlot = configuration.useAnonymousSlot !== undefined ? configuration.useAnonymousSlot : false;
const namedSlots = Array.isArray(configuration.useNamedSlots) ? configuration.useNamedSlots : false;

(async () => {
/**
Expand All @@ -57,6 +58,7 @@ class DireflowComponent {
component,
shadow,
anonymousSlot,
namedSlots,
plugins,
callback,
).create();
Expand Down
4 changes: 3 additions & 1 deletion packages/direflow-component/src/WebComponentFactory.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ class WebComponentFactory {
private rootComponent: React.FC<any> | React.ComponentClass<any, any>,
private shadow?: boolean,
private anonymousSlot?: boolean,
private namedSlots?: string[],
private plugins?: IDireflowPlugin[],
private connectCallback?: (element: HTMLElement) => void,
) {
Expand Down Expand Up @@ -230,9 +231,10 @@ class WebComponentFactory {
*/
public mountReactApp(options?: { initial: boolean }) {
const anonymousSlot = factory.anonymousSlot ? React.createElement('slot') : undefined;
const namedSlots = factory.namedSlots ? factory.namedSlots.map((name) => React.createElement('slot', { name })) : undefined;
const application = (
<EventProvider value={this.eventDispatcher}>
{React.createElement(factory.rootComponent, this.reactProps(), anonymousSlot)}
{React.createElement(factory.rootComponent, this.reactProps(), [anonymousSlot, namedSlots])}
</EventProvider>
);

Expand Down
1 change: 1 addition & 0 deletions packages/direflow-component/src/types/DireflowConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ export interface IDireflowConfig {
tagname: string;
useShadow?: boolean;
useAnonymousSlot?: boolean;
useNamedSlots?: string[];
}

export interface IDireflowPlugin {
Expand Down
5 changes: 3 additions & 2 deletions packages/direflow-scripts/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.