Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(x-installer): extend domElement type to allow ShadowRoot #1670

Merged
merged 1 commit into from
Dec 9, 2024
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,11 @@ export interface InstallXOptions<API extends XAPI = XAPI> 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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -289,13 +289,13 @@ export class XInstaller {
* returns an Element or element selector to use.
* If it is not present, a new <div> 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!);
}
Expand Down
Loading