From a4a761a3f8a53b9a52a73c1d103923ddc26e0fac Mon Sep 17 00:00:00 2001 From: Miroslav Jancarik Date: Thu, 23 May 2024 15:57:25 +0200 Subject: [PATCH] =?UTF-8?q?fix:=20=F0=9F=90=9B=20auto=20appendChild=20work?= =?UTF-8?q?s=20only=20for=20not=20defined=20remount?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/create-widget/views/preact/template.json | 2 +- packages/create-widget/views/svelte/template.json | 2 +- packages/create-widget/views/uhtml/template.json | 2 +- packages/integration-custom-element/src/index.js | 14 ++++++++++---- 4 files changed, 13 insertions(+), 7 deletions(-) diff --git a/packages/create-widget/views/preact/template.json b/packages/create-widget/views/preact/template.json index 493a971c..456eb815 100644 --- a/packages/create-widget/views/preact/template.json +++ b/packages/create-widget/views/preact/template.json @@ -1,6 +1,6 @@ { "dependencies": { - "@merkur/preact": "0.35.0" + "@merkur/preact": "0.36.0" }, "devDependencies": { "enzyme": "3.11.0", diff --git a/packages/create-widget/views/svelte/template.json b/packages/create-widget/views/svelte/template.json index 0b032139..4a158da6 100644 --- a/packages/create-widget/views/svelte/template.json +++ b/packages/create-widget/views/svelte/template.json @@ -1,6 +1,6 @@ { "dependencies": { - "@merkur/svelte": "0.35.0" + "@merkur/svelte": "0.36.0" }, "devDependencies": {} } diff --git a/packages/create-widget/views/uhtml/template.json b/packages/create-widget/views/uhtml/template.json index ad72e52c..e34f54f3 100644 --- a/packages/create-widget/views/uhtml/template.json +++ b/packages/create-widget/views/uhtml/template.json @@ -1,6 +1,6 @@ { "dependencies": { - "@merkur/uhtml": "0.35.0" + "@merkur/uhtml": "0.36.0" }, "devDependencies": {} } diff --git a/packages/integration-custom-element/src/index.js b/packages/integration-custom-element/src/index.js index 16433d0d..547fec63 100644 --- a/packages/integration-custom-element/src/index.js +++ b/packages/integration-custom-element/src/index.js @@ -59,10 +59,16 @@ function registerCustomElement(options) { customElement: this, }); - (await callbacks?.remount?.(this._widget, { - shadow: this._shadow, - customElement: this, - })) ?? this._shadow.appendChild(widget.container); + if (typeof callbacks?.remount === 'function') { + await callbacks?.remount?.(this._widget, { + shadow: this._shadow, + customElement: this, + }); + } else { + widget.root = this._shadow; + widget.customElement = this; + this._shadow.appendChild(widget.container); + } return; }