From 900eb9c0c9bce7b48897b86ca11e4f1ec82d783b Mon Sep 17 00:00:00 2001 From: davidglezz Date: Wed, 4 Dec 2024 16:27:03 +0100 Subject: [PATCH] feat(x-installer): extend domElement type to allow ShadowRoot Signed-off-by: davidglezz --- .../x-components/src/x-installer/x-installer/types.ts | 6 +++++- .../src/x-installer/x-installer/x-installer.ts | 8 ++++---- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/packages/x-components/src/x-installer/x-installer/types.ts b/packages/x-components/src/x-installer/x-installer/types.ts index dedf6e3a5d..caa4acff1c 100644 --- a/packages/x-components/src/x-installer/x-installer/types.ts +++ b/packages/x-components/src/x-installer/x-installer/types.ts @@ -30,7 +30,11 @@ export interface InstallXOptions extends XPluginOptions * An Element | string | function to indicate the HTML element that will contain the Vue * application. If it isn't passed, the {@link XInstaller} will create the target element. */ - domElement?: Element | string | ((snippetConfig: NormalisedSnippetConfig) => Element | string); + domElement?: + | Element + | ShadowRoot + | string + | ((snippetConfig: NormalisedSnippetConfig) => Element | ShadowRoot | string); /** * The XPlugin which will be installed. If not passed, an instance of {@link XPlugin} will be * installed. diff --git a/packages/x-components/src/x-installer/x-installer/x-installer.ts b/packages/x-components/src/x-installer/x-installer/x-installer.ts index 5e03672ee7..9b88464318 100644 --- a/packages/x-components/src/x-installer/x-installer/x-installer.ts +++ b/packages/x-components/src/x-installer/x-installer/x-installer.ts @@ -289,13 +289,13 @@ export class XInstaller { * returns an Element or element selector to use. * If it is not present, a new
Element is created and appended to the body. * - * @param domElement - {@link InstallXOptions.domElement | Element, string or function} Used - * to mount the Vue Application. + * @param domElement - {@link InstallXOptions.domElement} Element, ShadowRoot, string or function + * used to mount the Vue Application. * - * @returns The Element to use as mounting target for the Vue Application. + * @returns The Element or ShadowRoot to use as mounting target for the Vue Application. * @internal */ - protected getMountingTarget(domElement?: InstallXOptions['domElement']): Element { + protected getMountingTarget(domElement?: InstallXOptions['domElement']): Element | ShadowRoot { if (isFunction(domElement)) { domElement = domElement(this.snippetConfig!); }