From 3833eb29433d88efa5a705d2f712c512c4d54ab6 Mon Sep 17 00:00:00 2001
From: Christoph Reiter <reiter.christoph@gmail.com>
Date: Thu, 7 Apr 2022 11:51:57 +0200
Subject: [PATCH] Port to new createScopedElement()

This got added in scoped-element 2.1.0 and is more or less the same
as getShadowRootDocument()
---
 packages/app-shell/src/app-shell.js                 | 4 ++--
 packages/file-handling/src/clipboard.js             | 6 +++---
 packages/file-handling/src/nextcloud-file-picker.js | 6 +++---
 3 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/packages/app-shell/src/app-shell.js b/packages/app-shell/src/app-shell.js
index 1a8c9b13..d110230d 100644
--- a/packages/app-shell/src/app-shell.js
+++ b/packages/app-shell/src/app-shell.js
@@ -2,7 +2,7 @@ import {createInstance} from './i18n.js';
 import {html, css} from 'lit';
 import {ScopedElementsMixin} from '@open-wc/scoped-elements';
 import {LanguageSelect} from '@dbp-toolkit/language-select';
-import {Icon, getShadowRootDocument} from '@dbp-toolkit/common';
+import {Icon} from '@dbp-toolkit/common';
 import {AuthKeycloak} from '@dbp-toolkit/auth';
 import {AuthMenuButton} from './auth-menu-button.js';
 import {Notification} from '@dbp-toolkit/notification';
@@ -828,7 +828,7 @@ export class AppShell extends ScopedElementsMixin(DBPLitElement) {
             this.defineScopedElement(activity.element, customElements.get(activity.element));
         });
 
-        let elm = getShadowRootDocument(this).createElement(activity.element);
+        let elm = this.createScopedElement(activity.element);
 
         this._onActivityAdded(elm);
         this._lastElm = elm;
diff --git a/packages/file-handling/src/clipboard.js b/packages/file-handling/src/clipboard.js
index dfc50819..b1f14527 100644
--- a/packages/file-handling/src/clipboard.js
+++ b/packages/file-handling/src/clipboard.js
@@ -4,7 +4,7 @@ import {ScopedElementsMixin} from '@open-wc/scoped-elements';
 import * as commonUtils from '@dbp-toolkit/common/utils';
 import * as commonStyles from '@dbp-toolkit/common/styles';
 import * as fileHandlingStyles from '@dbp-toolkit/file-handling/src/styles';
-import {Icon, getShadowRootDocument} from '@dbp-toolkit/common';
+import {Icon} from '@dbp-toolkit/common';
 import {TabulatorFull as Tabulator} from 'tabulator-tables';
 import {humanFileSize} from '@dbp-toolkit/common/i18next';
 import {name as pkgName} from '@dbp-toolkit/file-handling/package.json';
@@ -161,7 +161,7 @@ export class Clipboard extends ScopedElementsMixin(AdapterLitElement) {
                             let icon =
                                 `<${icon_tag} name="empty-file" class="nextcloud-picker-icon ` +
                                 `"></${icon_tag}>`;
-                            let div = getShadowRootDocument(this).createElement('div');
+                            let div = this.createScopedElement('div');
                             div.innerHTML = icon;
                             return div;
 
@@ -175,7 +175,7 @@ export class Clipboard extends ScopedElementsMixin(AdapterLitElement) {
                         field: 'name',
                         sorter: 'alphanum',
                         formatter: (cell) => {
-                            let div = getShadowRootDocument(this).createElement('div');
+                            let div = this.createScopedElement('div');
                             div.classList.add('filename');
                             div.innerHTML = cell.getValue();
                             return div;
diff --git a/packages/file-handling/src/nextcloud-file-picker.js b/packages/file-handling/src/nextcloud-file-picker.js
index 1c992c99..b747c3c1 100644
--- a/packages/file-handling/src/nextcloud-file-picker.js
+++ b/packages/file-handling/src/nextcloud-file-picker.js
@@ -2,7 +2,7 @@ import {createInstance} from './i18n';
 import {css, html} from 'lit';
 import {ScopedElementsMixin} from '@open-wc/scoped-elements';
 import DBPLitElement from '@dbp-toolkit/common/dbp-lit-element';
-import {Icon, MiniSpinner, getShadowRootDocument} from '@dbp-toolkit/common';
+import {Icon, MiniSpinner} from '@dbp-toolkit/common';
 import * as commonUtils from '@dbp-toolkit/common/utils';
 import * as commonStyles from '@dbp-toolkit/common/styles';
 import {createClient, parseXML} from 'webdav/web';
@@ -216,7 +216,7 @@ export class NextcloudFilePicker extends ScopedElementsMixin(DBPLitElement) {
                                 cell.getValue() === 'directory'
                                     ? `<${icon_tag} name="folder" class="nextcloud-picker-icon"></${icon_tag}>`
                                     : icon;
-                            let div = getShadowRootDocument(this).createElement('div');
+                            let div = this.createScopedElement('div');
                             div.innerHTML = html;
                             return div;
                         },
@@ -229,7 +229,7 @@ export class NextcloudFilePicker extends ScopedElementsMixin(DBPLitElement) {
                         field: 'basename',
                         sorter: 'alphanum',
                         formatter: (cell) => {
-                            let div = getShadowRootDocument(this).createElement('div');
+                            let div = this.createScopedElement('div');
                             div.classList.add('filename');
                             div.innerHTML = cell.getValue();
                             return div;
-- 
GitLab