From 3359d8fef294ebb129f1279072d11e6bacc56ffd Mon Sep 17 00:00:00 2001 From: Patrizio Bekerle <patrizio@bekerle.com> Date: Tue, 12 Jan 2021 10:53:09 +0100 Subject: [PATCH] Integrate AdapterLitElement (dbp/apps/library#77) --- packages/app-shell/src/auth-menu-button.js | 8 ++++---- packages/app-shell/src/tugraz-logo.js | 9 +++++---- packages/auth/src/auth-keycloak.js | 8 ++++---- packages/common/dbp-lit-element.js | 4 ++-- packages/notification/src/notification.js | 4 ++-- 5 files changed, 17 insertions(+), 16 deletions(-) diff --git a/packages/app-shell/src/auth-menu-button.js b/packages/app-shell/src/auth-menu-button.js index 8e96197e..c8908443 100644 --- a/packages/app-shell/src/auth-menu-button.js +++ b/packages/app-shell/src/auth-menu-button.js @@ -3,13 +3,13 @@ import {html, css} from 'lit-element'; import {unsafeHTML} from 'lit-html/directives/unsafe-html.js'; import {ScopedElementsMixin} from '@open-wc/scoped-elements'; import * as commonStyles from '@dbp-toolkit/common/styles'; -import {LitElement} from "lit-element"; import {Icon, EventBus} from '@dbp-toolkit/common'; +import {AdapterLitElement} from "@dbp-toolkit/provider/src/adapter-lit-element"; const i18n = createI18nInstance(); -export class AuthMenuButton extends ScopedElementsMixin(LitElement) { +export class AuthMenuButton extends ScopedElementsMixin(AdapterLitElement) { constructor() { super(); @@ -28,11 +28,11 @@ export class AuthMenuButton extends ScopedElementsMixin(LitElement) { } static get properties() { - return { + return this.getProperties({ lang: { type: String }, showImage: { type: Boolean, attribute: 'show-image' }, _loginData: { type: Object, attribute: false }, - }; + }); } onWindowResize() { diff --git a/packages/app-shell/src/tugraz-logo.js b/packages/app-shell/src/tugraz-logo.js index 33fd8a30..de1d7a12 100644 --- a/packages/app-shell/src/tugraz-logo.js +++ b/packages/app-shell/src/tugraz-logo.js @@ -1,10 +1,11 @@ -import {html, LitElement, css} from 'lit-element'; +import {html, css} from 'lit-element'; import * as commonStyles from '@dbp-toolkit/common/styles'; import {createI18nInstance} from './i18n.js'; +import {AdapterLitElement} from "@dbp-toolkit/provider/src/adapter-lit-element"; const i18n = createI18nInstance(); -export class TUGrazLogo extends LitElement { +export class TUGrazLogo extends AdapterLitElement { constructor() { super(); @@ -13,9 +14,9 @@ export class TUGrazLogo extends LitElement { } static get properties() { - return { + return this.getProperties({ lang: { type: String } - }; + }); } update(changedProperties) { diff --git a/packages/auth/src/auth-keycloak.js b/packages/auth/src/auth-keycloak.js index 06f34fbf..f57c681d 100644 --- a/packages/auth/src/auth-keycloak.js +++ b/packages/auth/src/auth-keycloak.js @@ -3,8 +3,8 @@ import JSONLD from '@dbp-toolkit/common/jsonld'; import * as commonUtils from '@dbp-toolkit/common/utils'; import {EventBus} from '@dbp-toolkit/common'; import {KeycloakWrapper} from './keycloak.js'; -import {LitElement} from "lit-element"; import {LoginStatus} from './util.js'; +import {AdapterLitElement} from "@dbp-toolkit/provider/src/adapter-lit-element"; /** @@ -20,7 +20,7 @@ import {LoginStatus} from './util.js'; * window.DBPPerson: Person json object of the user (optional, enable by setting the `load-person` attribute, * which will dispatch a `dbp-auth-person-init` event when loaded) */ -export class AuthKeycloak extends LitElement { +export class AuthKeycloak extends AdapterLitElement { constructor() { super(); this.lang = 'de'; @@ -158,7 +158,7 @@ export class AuthKeycloak extends LitElement { } static get properties() { - return { + return this.getProperties({ lang: { type: String }, forceLogin: { type: Boolean, attribute: 'force-login' }, tryLogin: { type: Boolean, attribute: 'try-login' }, @@ -176,7 +176,7 @@ export class AuthKeycloak extends LitElement { silentCheckSsoRedirectUri: { type: String, attribute: 'silent-check-sso-redirect-uri' }, scope: { type: String }, idpHint: { type: String, attribute: 'idp-hint' }, - }; + }); } connectedCallback() { diff --git a/packages/common/dbp-lit-element.js b/packages/common/dbp-lit-element.js index 4c336c8a..0a1f687c 100644 --- a/packages/common/dbp-lit-element.js +++ b/packages/common/dbp-lit-element.js @@ -1,6 +1,6 @@ -import {LitElement} from "lit-element"; +import {AdapterLitElement} from "@dbp-toolkit/provider/src/adapter-lit-element"; -export default class DBPLitElement extends LitElement { +export default class DBPLitElement extends AdapterLitElement { _(selector) { return this.shadowRoot === null ? this.querySelector(selector) : this.shadowRoot.querySelector(selector); } diff --git a/packages/notification/src/notification.js b/packages/notification/src/notification.js index 51247ff8..5e68e1d5 100644 --- a/packages/notification/src/notification.js +++ b/packages/notification/src/notification.js @@ -17,9 +17,9 @@ export class Notification extends DBPLitElement { * See: https://lit-element.polymer-project.org/guide/properties#initialize */ static get properties() { - return { + return this.getProperties({ lang: { type: String }, - }; + }); } connectedCallback() { -- GitLab