Merge pull request #908 from ing-bank/fix/lit-element2.4.0

feat: update to latest lit-element version
This commit is contained in:
gerjanvangeest 2020-08-27 11:54:26 +02:00 committed by GitHub
commit 28e7fde1c5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
22 changed files with 56 additions and 47 deletions

View file

@ -0,0 +1,13 @@
---
'@lion/calendar': minor
'@lion/core': minor
'@lion/form-core': minor
'@lion/input': minor
'@lion/input-datepicker': minor
'@lion/overlays': minor
'providence-analytics': minor
'@lion/select-rich': minor
'@lion/switch': minor
---
Update to lit-element 2.4.0, changed all uses of \_requestUpdate into requestUpdateInterval

View file

@ -234,8 +234,8 @@ export class LionCalendar extends LocalizeMixin(LitElement) {
/** /**
* @override * @override
*/ */
_requestUpdate(name, oldValue) { requestUpdateInternal(name, oldValue) {
super._requestUpdate(name, oldValue); super.requestUpdateInternal(name, oldValue);
const map = { const map = {
disableDates: () => this.__disableDatesChanged(), disableDates: () => this.__disableDatesChanged(),

View file

@ -31,8 +31,8 @@
"dependencies": { "dependencies": {
"@open-wc/dedupe-mixin": "^1.2.18", "@open-wc/dedupe-mixin": "^1.2.18",
"@open-wc/scoped-elements": "^1.0.3", "@open-wc/scoped-elements": "^1.0.3",
"lit-element": "~2.3.0", "lit-element": "~2.4.0",
"lit-html": "^1.0.0" "lit-html": "^1.3.0"
}, },
"keywords": [ "keywords": [
"lion", "lion",

View file

@ -10,7 +10,6 @@ import { dedupeMixin } from '@open-wc/dedupe-mixin';
*/ */
const DisabledMixinImplementation = superclass => const DisabledMixinImplementation = superclass =>
// eslint-disable-next-line no-shadow // eslint-disable-next-line no-shadow
// @ts-expect-error we're overriding private _requestUpdate
class DisabledMixinHost extends superclass { class DisabledMixinHost extends superclass {
static get properties() { static get properties() {
return { return {
@ -55,9 +54,8 @@ const DisabledMixinImplementation = superclass =>
* @param {PropertyKey} name * @param {PropertyKey} name
* @param {?} oldValue * @param {?} oldValue
*/ */
_requestUpdate(name, oldValue) { requestUpdateInternal(name, oldValue) {
// @ts-expect-error super.requestUpdateInternal(name, oldValue);
super._requestUpdate(name, oldValue);
if (name === 'disabled') { if (name === 'disabled') {
if (this.__isUserSettingDisabled) { if (this.__isUserSettingDisabled) {
this.__restoreDisabledTo = this.disabled; this.__restoreDisabledTo = this.disabled;

View file

@ -11,7 +11,6 @@ import { DisabledMixin } from './DisabledMixin.js';
*/ */
const DisabledWithTabIndexMixinImplementation = superclass => const DisabledWithTabIndexMixinImplementation = superclass =>
// eslint-disable-next-line no-shadow // eslint-disable-next-line no-shadow
// @ts-expect-error we're overriding private _requestUpdate
class DisabledWithTabIndexMixinHost extends DisabledMixin(superclass) { class DisabledWithTabIndexMixinHost extends DisabledMixin(superclass) {
static get properties() { static get properties() {
return { return {
@ -60,9 +59,8 @@ const DisabledWithTabIndexMixinImplementation = superclass =>
* @param {PropertyKey} name * @param {PropertyKey} name
* @param {?} oldValue * @param {?} oldValue
*/ */
_requestUpdate(name, oldValue) { requestUpdateInternal(name, oldValue) {
// @ts-expect-error super.requestUpdateInternal(name, oldValue);
super._requestUpdate(name, oldValue);
if (name === 'disabled') { if (name === 'disabled') {
if (this.disabled) { if (this.disabled) {

View file

@ -119,8 +119,8 @@ const FormatMixinImplementation = superclass =>
* @param {string} name * @param {string} name
* @param {any} oldVal * @param {any} oldVal
*/ */
_requestUpdate(name, oldVal) { requestUpdateInternal(name, oldVal) {
super._requestUpdate(name, oldVal); super.requestUpdateInternal(name, oldVal);
if (name === 'modelValue' && this.modelValue !== oldVal) { if (name === 'modelValue' && this.modelValue !== oldVal) {
this._onModelValueChanged({ modelValue: this.modelValue }, { modelValue: oldVal }); this._onModelValueChanged({ modelValue: this.modelValue }, { modelValue: oldVal });

View file

@ -67,14 +67,14 @@ const InteractionStateMixinImplementation = superclass =>
* @param {PropertyKey} name * @param {PropertyKey} name
* @param {*} oldVal * @param {*} oldVal
*/ */
_requestUpdate(name, oldVal) { requestUpdateInternal(name, oldVal) {
super._requestUpdate(name, oldVal); super.requestUpdateInternal(name, oldVal);
if (name === 'touched' && this.touched !== oldVal) { if (name === 'touched' && this.touched !== oldVal) {
this._onTouchedChanged(); this._onTouchedChanged();
} }
if (name === 'modelValue') { if (name === 'modelValue') {
// We do this in _requestUpdate because we don't want to fire another re-render (e.g. when doing this in updated) // We do this in requestUpdateInternal because we don't want to fire another re-render (e.g. when doing this in updated)
// Furthermore, we cannot do it on model-value-changed event because it isn't fired initially. // Furthermore, we cannot do it on model-value-changed event because it isn't fired initially.
this.filled = !this._isEmpty(); this.filled = !this._isEmpty();
} }

View file

@ -48,8 +48,8 @@ export const ChoiceInputMixin = superclass =>
} }
} }
_requestUpdate(name, oldValue) { requestUpdateInternal(name, oldValue) {
super._requestUpdate(name, oldValue); super.requestUpdateInternal(name, oldValue);
if (name === 'modelValue') { if (name === 'modelValue') {
if (this.modelValue.checked !== this.checked) { if (this.modelValue.checked !== this.checked) {
@ -177,7 +177,7 @@ export const ChoiceInputMixin = superclass =>
/** /**
* @override * @override
* hasChanged is designed for async (updated) callback, also check for sync * hasChanged is designed for async (updated) callback, also check for sync
* (_requestUpdate) callback * (requestUpdateInternal) callback
*/ */
_onModelValueChanged({ modelValue }, { modelValue: old }) { _onModelValueChanged({ modelValue }, { modelValue: old }) {
if (this.constructor._classProperties.get('modelValue').hasChanged(modelValue, old)) { if (this.constructor._classProperties.get('modelValue').hasChanged(modelValue, old)) {

View file

@ -17,8 +17,8 @@ import { dedupeMixin } from '@lion/core';
* - makes the propertyAccessor.`hasChanged` compatible in synchronous updates: * - makes the propertyAccessor.`hasChanged` compatible in synchronous updates:
* `updateSync` will only be called when new value differs from old value. * `updateSync` will only be called when new value differs from old value.
* See: https://lit-element.polymer-project.org/guide/lifecycle#haschanged * See: https://lit-element.polymer-project.org/guide/lifecycle#haschanged
* - it is a stable abstaction on top of a protected/non offical lifecycle LitElement api. * - it is a stable abstraction on top of a protected/non official lifecycle LitElement api.
* Whenever the implementation of `_requestUpdate` changes (this happened in the past for * Whenever the implementation of `requestUpdateInternal` changes (this happened in the past for
* `requestUpdate`) we only have to change our abstraction instead of all our components * `requestUpdate`) we only have to change our abstraction instead of all our components
* @type {SyncUpdatableMixin} * @type {SyncUpdatableMixin}
*/ */
@ -78,8 +78,8 @@ const SyncUpdatableMixinImplementation = superclass =>
* @param {string} name * @param {string} name
* @param {*} oldValue * @param {*} oldValue
*/ */
_requestUpdate(name, oldValue) { requestUpdateInternal(name, oldValue) {
super._requestUpdate(name, oldValue); super.requestUpdateInternal(name, oldValue);
this.__SyncUpdatableNamespace = this.__SyncUpdatableNamespace || {}; this.__SyncUpdatableNamespace = this.__SyncUpdatableNamespace || {};
const ns = this.__SyncUpdatableNamespace; const ns = this.__SyncUpdatableNamespace;
@ -98,8 +98,8 @@ const SyncUpdatableMixinImplementation = superclass =>
} }
/** /**
* @desc A public abstraction that has the exact same api as `_requestUpdate`. * @desc A public abstraction that has the exact same api as `requestUpdateInternal`.
* All code previously present in _requestUpdate can be placed in this method. * All code previously present in requestUpdateInternal can be placed in this method.
* @param {string} name * @param {string} name
* @param {*} oldValue * @param {*} oldValue
*/ */

View file

@ -151,9 +151,9 @@ describe('SyncUpdatableMixin', () => {
* @param {string} name * @param {string} name
* @param {*} oldValue * @param {*} oldValue
*/ */
_requestUpdate(name, oldValue) { requestUpdateInternal(name, oldValue) {
// @ts-ignore the private override is on purpose // @ts-ignore the private override is on purpose
super._requestUpdate(name, oldValue); super.requestUpdateInternal(name, oldValue);
if (name === 'prop') { if (name === 'prop') {
propChangedCount += 1; propChangedCount += 1;
} }

View file

@ -172,8 +172,8 @@ export class LionInputDatepicker extends ScopedElementsMixin(OverlayMixin(LionIn
return `${this.localName}-${Math.random().toString(36).substr(2, 10)}`; return `${this.localName}-${Math.random().toString(36).substr(2, 10)}`;
} }
_requestUpdate(name, oldValue) { requestUpdateInternal(name, oldValue) {
super._requestUpdate(name, oldValue); super.requestUpdateInternal(name, oldValue);
if (name === 'disabled' || name === 'readOnly') { if (name === 'disabled' || name === 'readOnly') {
this.__toggleInvokerDisabled(); this.__toggleInvokerDisabled();

View file

@ -53,8 +53,8 @@ export class LionInput extends LionField {
this.type = 'text'; this.type = 'text';
} }
_requestUpdate(name, oldValue) { requestUpdateInternal(name, oldValue) {
super._requestUpdate(name, oldValue); super.requestUpdateInternal(name, oldValue);
if (name === 'readOnly') { if (name === 'readOnly') {
this.__delegateReadOnly(); this.__delegateReadOnly();
} }

View file

@ -40,8 +40,8 @@ export const OverlayMixin = dedupeMixin(
this.__config = value; this.__config = value;
} }
_requestUpdate(name, oldValue) { requestUpdateInternal(name, oldValue) {
super._requestUpdate(name, oldValue); super.requestUpdateInternal(name, oldValue);
if (name === 'opened') { if (name === 'opened') {
this.dispatchEvent(new Event('opened-changed')); this.dispatchEvent(new Event('opened-changed'));
} }

View file

@ -45,7 +45,7 @@
"htm": "^3.0.3", "htm": "^3.0.3",
"inquirer": "^7.0.0", "inquirer": "^7.0.0",
"is-negated-glob": "^1.0.0", "is-negated-glob": "^1.0.0",
"lit-element": "~2.3.0", "lit-element": "~2.4.0",
"ora": "^3.4.0", "ora": "^3.4.0",
"parse5": "^5.1.1", "parse5": "^5.1.1",
"read-package-tree": "5.3.1", "read-package-tree": "5.3.1",

View file

@ -56,7 +56,7 @@ async function findMembersPerAstEntry(ast, fullCurrentFilePath, projectPath) {
// // Handle methods // // Handle methods
// const mBlacklistPlatform = ['constructor', 'connectedCallback', 'disconnectedCallback']; // const mBlacklistPlatform = ['constructor', 'connectedCallback', 'disconnectedCallback'];
// const mBlacklistLitEl = [ // const mBlacklistLitEl = [
// '_requestUpdate', // 'requestUpdateInternal',
// 'createRenderRoot', // 'createRenderRoot',
// 'render', // 'render',
// 'updated', // 'updated',

View file

@ -179,7 +179,7 @@
"accessType": "public" "accessType": "public"
}, },
{ {
"name": "_requestUpdate", "name": "requestUpdateInternal",
"accessType": "protected" "accessType": "protected"
}, },
{ {

View file

@ -30,7 +30,7 @@ export class ExtendedComp extends MyCompMixin(RefClass) {
static get properties() {} static get properties() {}
static get styles() {} static get styles() {}
get updateComplete() {} get updateComplete() {}
_requestUpdate() {} requestUpdateInternal() {}
createRenderRoot() {} createRenderRoot() {}
render() {} render() {}
updated() {} updated() {}

View file

@ -213,7 +213,7 @@ describe('Analyzer "find-classes"', () => {
static get properties() {} static get properties() {}
static get styles() {} static get styles() {}
get updateComplete() {} get updateComplete() {}
_requestUpdate() {} requestUpdateInternal() {}
createRenderRoot() {} createRenderRoot() {}
render() {} render() {}
updated() {} updated() {}

View file

@ -57,8 +57,8 @@ export class LionOption extends DisabledMixin(ChoiceInputMixin(FormRegisteringMi
this.__registerEventListeners(); this.__registerEventListeners();
} }
_requestUpdate(name, oldValue) { requestUpdateInternal(name, oldValue) {
super._requestUpdate(name, oldValue); super.requestUpdateInternal(name, oldValue);
if (name === 'active') { if (name === 'active') {
this.dispatchEvent(new Event('active-changed', { bubbles: true })); this.dispatchEvent(new Event('active-changed', { bubbles: true }));

View file

@ -228,8 +228,8 @@ export class LionSelectRich extends ScopedElementsMixin(
} }
} }
_requestUpdate(name, oldValue) { requestUpdateInternal(name, oldValue) {
super._requestUpdate(name, oldValue); super.requestUpdateInternal(name, oldValue);
if (name === 'interactionMode') { if (name === 'interactionMode') {
if (this.interactionMode === 'auto') { if (this.interactionMode === 'auto') {
this.interactionMode = detectInteractionMode(); this.interactionMode = detectInteractionMode();

View file

@ -124,8 +124,8 @@ export class LionSwitchButton extends DisabledWithTabIndexMixin(LitElement) {
* *
* @override * @override
*/ */
_requestUpdate(name, oldValue) { requestUpdateInternal(name, oldValue) {
super._requestUpdate(name, oldValue); super.requestUpdateInternal(name, oldValue);
if (this.isConnected && name === 'checked') { if (this.isConnected && name === 'checked') {
this.setAttribute('aria-checked', `${this.checked}`); this.setAttribute('aria-checked', `${this.checked}`);
} }

View file

@ -7413,7 +7413,7 @@ listr2@^2.1.0:
rxjs "^6.6.2" rxjs "^6.6.2"
through "^2.3.8" through "^2.3.8"
lit-element@^2.2.1, lit-element@^2.3.1: lit-element@^2.2.1, lit-element@^2.3.1, lit-element@~2.4.0:
version "2.4.0" version "2.4.0"
resolved "https://registry.yarnpkg.com/lit-element/-/lit-element-2.4.0.tgz#b22607a037a8fc08f5a80736dddf7f3f5d401452" resolved "https://registry.yarnpkg.com/lit-element/-/lit-element-2.4.0.tgz#b22607a037a8fc08f5a80736dddf7f3f5d401452"
integrity sha512-pBGLglxyhq/Prk2H91nA0KByq/hx/wssJBQFiYqXhGDvEnY31PRGYf1RglVzyLeRysu0IHm2K0P196uLLWmwFg== integrity sha512-pBGLglxyhq/Prk2H91nA0KByq/hx/wssJBQFiYqXhGDvEnY31PRGYf1RglVzyLeRysu0IHm2K0P196uLLWmwFg==
@ -7427,7 +7427,7 @@ lit-element@~2.3.0:
dependencies: dependencies:
lit-html "^1.1.1" lit-html "^1.1.1"
lit-html@^1.0.0, lit-html@^1.1.1, lit-html@^1.2.1: lit-html@^1.0.0, lit-html@^1.1.1, lit-html@^1.2.1, lit-html@^1.3.0:
version "1.3.0" version "1.3.0"
resolved "https://registry.yarnpkg.com/lit-html/-/lit-html-1.3.0.tgz#c80f3cc5793a6dea6c07172be90a70ab20e56034" resolved "https://registry.yarnpkg.com/lit-html/-/lit-html-1.3.0.tgz#c80f3cc5793a6dea6c07172be90a70ab20e56034"
integrity sha512-0Q1bwmaFH9O14vycPHw8C/IeHMk/uSDldVLIefu/kfbTBGIc44KGH6A8p1bDfxUfHdc8q6Ct7kQklWoHgr4t1Q== integrity sha512-0Q1bwmaFH9O14vycPHw8C/IeHMk/uSDldVLIefu/kfbTBGIc44KGH6A8p1bDfxUfHdc8q6Ct7kQklWoHgr4t1Q==