feat: update to latest lit-element version

This commit is contained in:
qa46hx 2020-08-27 09:58:49 +02:00
parent efabe97691
commit 65ecd43276
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
*/
_requestUpdate(name, oldValue) {
super._requestUpdate(name, oldValue);
requestUpdateInternal(name, oldValue) {
super.requestUpdateInternal(name, oldValue);
const map = {
disableDates: () => this.__disableDatesChanged(),

View file

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

View file

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

View file

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

View file

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

View file

@ -67,14 +67,14 @@ const InteractionStateMixinImplementation = superclass =>
* @param {PropertyKey} name
* @param {*} oldVal
*/
_requestUpdate(name, oldVal) {
super._requestUpdate(name, oldVal);
requestUpdateInternal(name, oldVal) {
super.requestUpdateInternal(name, oldVal);
if (name === 'touched' && this.touched !== oldVal) {
this._onTouchedChanged();
}
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.
this.filled = !this._isEmpty();
}

View file

@ -48,8 +48,8 @@ export const ChoiceInputMixin = superclass =>
}
}
_requestUpdate(name, oldValue) {
super._requestUpdate(name, oldValue);
requestUpdateInternal(name, oldValue) {
super.requestUpdateInternal(name, oldValue);
if (name === 'modelValue') {
if (this.modelValue.checked !== this.checked) {
@ -177,7 +177,7 @@ export const ChoiceInputMixin = superclass =>
/**
* @override
* hasChanged is designed for async (updated) callback, also check for sync
* (_requestUpdate) callback
* (requestUpdateInternal) callback
*/
_onModelValueChanged({ modelValue }, { 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:
* `updateSync` will only be called when new value differs from old value.
* 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.
* Whenever the implementation of `_requestUpdate` changes (this happened in the past for
* - it is a stable abstraction on top of a protected/non official lifecycle LitElement api.
* 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
* @type {SyncUpdatableMixin}
*/
@ -78,8 +78,8 @@ const SyncUpdatableMixinImplementation = superclass =>
* @param {string} name
* @param {*} oldValue
*/
_requestUpdate(name, oldValue) {
super._requestUpdate(name, oldValue);
requestUpdateInternal(name, oldValue) {
super.requestUpdateInternal(name, oldValue);
this.__SyncUpdatableNamespace = 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`.
* All code previously present in _requestUpdate can be placed in this method.
* @desc A public abstraction that has the exact same api as `requestUpdateInternal`.
* All code previously present in requestUpdateInternal can be placed in this method.
* @param {string} name
* @param {*} oldValue
*/

View file

@ -151,9 +151,9 @@ describe('SyncUpdatableMixin', () => {
* @param {string} name
* @param {*} oldValue
*/
_requestUpdate(name, oldValue) {
requestUpdateInternal(name, oldValue) {
// @ts-ignore the private override is on purpose
super._requestUpdate(name, oldValue);
super.requestUpdateInternal(name, oldValue);
if (name === 'prop') {
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)}`;
}
_requestUpdate(name, oldValue) {
super._requestUpdate(name, oldValue);
requestUpdateInternal(name, oldValue) {
super.requestUpdateInternal(name, oldValue);
if (name === 'disabled' || name === 'readOnly') {
this.__toggleInvokerDisabled();

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -7413,7 +7413,7 @@ listr2@^2.1.0:
rxjs "^6.6.2"
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"
resolved "https://registry.yarnpkg.com/lit-element/-/lit-element-2.4.0.tgz#b22607a037a8fc08f5a80736dddf7f3f5d401452"
integrity sha512-pBGLglxyhq/Prk2H91nA0KByq/hx/wssJBQFiYqXhGDvEnY31PRGYf1RglVzyLeRysu0IHm2K0P196uLLWmwFg==
@ -7427,7 +7427,7 @@ lit-element@~2.3.0:
dependencies:
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"
resolved "https://registry.yarnpkg.com/lit-html/-/lit-html-1.3.0.tgz#c80f3cc5793a6dea6c07172be90a70ab20e56034"
integrity sha512-0Q1bwmaFH9O14vycPHw8C/IeHMk/uSDldVLIefu/kfbTBGIc44KGH6A8p1bDfxUfHdc8q6Ct7kQklWoHgr4t1Q==