diff --git a/package-lock.json b/package-lock.json index 98e9e2d..d17dfbc 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "direflow-cli", - "version": "3.5.3", + "version": "3.5.4", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "direflow-cli", - "version": "3.5.3", + "version": "3.5.4", "license": "MIT", "dependencies": { "boxen": "^4.1.0", diff --git a/packages/direflow-component/package-lock.json b/packages/direflow-component/package-lock.json index eb1b4cc..1c81e66 100644 --- a/packages/direflow-component/package-lock.json +++ b/packages/direflow-component/package-lock.json @@ -1,11 +1,12 @@ { "name": "direflow-component", - "version": "3.5.3", + "version": "3.5.4", "lockfileVersion": 2, "requires": true, "packages": { "": { - "version": "3.5.3", + "name": "direflow-component", + "version": "3.5.4", "license": "MIT", "dependencies": { "chalk": "2.4.2", @@ -24,8 +25,8 @@ "typescript": "3.9.3" }, "peerDependencies": { - "react": "^16.13.1", - "react-dom": "^16.13.1" + "react": "16.13.1", + "react-dom": "16.13.1" } }, "node_modules/@types/lodash": { diff --git a/packages/direflow-component/src/DireflowComponent.tsx b/packages/direflow-component/src/DireflowComponent.tsx index 74d29b4..9fde6ce 100644 --- a/packages/direflow-component/src/DireflowComponent.tsx +++ b/packages/direflow-component/src/DireflowComponent.tsx @@ -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 () => { /** @@ -57,6 +58,7 @@ class DireflowComponent { component, shadow, anonymousSlot, + namedSlots, plugins, callback, ).create(); diff --git a/packages/direflow-component/src/WebComponentFactory.tsx b/packages/direflow-component/src/WebComponentFactory.tsx index a65b7c9..771e307 100644 --- a/packages/direflow-component/src/WebComponentFactory.tsx +++ b/packages/direflow-component/src/WebComponentFactory.tsx @@ -16,6 +16,7 @@ class WebComponentFactory { private rootComponent: React.FC | React.ComponentClass, private shadow?: boolean, private anonymousSlot?: boolean, + private namedSlots?: string[], private plugins?: IDireflowPlugin[], private connectCallback?: (element: HTMLElement) => void, ) { @@ -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 = ( - {React.createElement(factory.rootComponent, this.reactProps(), anonymousSlot)} + {React.createElement(factory.rootComponent, this.reactProps(), [anonymousSlot, namedSlots])} ); diff --git a/packages/direflow-component/src/types/DireflowConfig.ts b/packages/direflow-component/src/types/DireflowConfig.ts index a2872b9..9a3a30e 100644 --- a/packages/direflow-component/src/types/DireflowConfig.ts +++ b/packages/direflow-component/src/types/DireflowConfig.ts @@ -9,6 +9,7 @@ export interface IDireflowConfig { tagname: string; useShadow?: boolean; useAnonymousSlot?: boolean; + useNamedSlots?: string[]; } export interface IDireflowPlugin { diff --git a/packages/direflow-scripts/package-lock.json b/packages/direflow-scripts/package-lock.json index 0996528..91efd44 100644 --- a/packages/direflow-scripts/package-lock.json +++ b/packages/direflow-scripts/package-lock.json @@ -1,11 +1,12 @@ { "name": "direflow-scripts", - "version": "3.5.3", + "version": "3.5.4", "lockfileVersion": 2, "requires": true, "packages": { "": { - "version": "3.5.3", + "name": "direflow-scripts", + "version": "3.5.4", "license": "MIT", "dependencies": { "@svgr/webpack": "4.3.2",