Update all dependencies

This commit is contained in:
Jérôme Wiedemann 2020-11-06 17:47:03 +00:00
parent 04737e0f46
commit 142d32cd14
7 changed files with 886 additions and 1179 deletions

1
.gitignore vendored
View File

@ -1,4 +1,5 @@
.DS_Store
/node_modules/
/node_modules
.rpt2_cache/
/dist/**

View File

@ -28,39 +28,38 @@
},
"homepage": "https://github.com/custom-cards/button-card#readme",
"devDependencies": {
"@babel/core": "^7.8.7",
"@babel/plugin-proposal-class-properties": "^7.8.3",
"@babel/plugin-proposal-decorators": "^7.8.3",
"@rollup/plugin-commonjs": "^11.0.2",
"@babel/cli": "^7.12.1",
"@babel/core": "^7.12.3",
"@babel/plugin-proposal-class-properties": "^7.12.1",
"@babel/plugin-proposal-decorators": "^7.12.1",
"@rollup/plugin-babel": "^5.2.1",
"@rollup/plugin-commonjs": "^16.0.0",
"@rollup/plugin-json": "^4.0.2",
"@rollup/plugin-node-resolve": "^7.1.1",
"@typescript-eslint/eslint-plugin": "^2.24.0",
"@typescript-eslint/parser": "^2.24.0",
"babel-cli": "^6.26.0",
"eslint": "^6.8.0",
"@rollup/plugin-node-resolve": "^10.0.0",
"@typescript-eslint/eslint-plugin": "^4.6.1",
"@typescript-eslint/parser": "^4.6.1",
"eslint": "7.12.1",
"eslint-config-airbnb-base": "^14.1.0",
"eslint-config-prettier": "^6.10.0",
"eslint-plugin-import": "^2.20.1",
"eslint-config-prettier": "^6.15.0",
"eslint-plugin-import": "^2.22.1",
"eslint-plugin-prettier": "^3.1.2",
"npm": "^6.14.3",
"prettier": "^1.19.0",
"prettier-eslint": "^9.0.1",
"rollup": "^2.1.0",
"rollup-plugin-babel": "^4.4.0",
"rollup-plugin-commonjs": "^10.1.0",
"rollup-plugin-serve": "^1.0.1",
"rollup-plugin-terser": "^5.3.0",
"rollup-plugin-typescript2": "^0.26.0",
"prettier": "^2.1.2",
"prettier-eslint": "^11.0.0",
"rollup": "^2.33.1",
"rollup-plugin-serve": "^1.1.0",
"rollup-plugin-terser": "^7.0.2",
"rollup-plugin-typescript2": "^0.29.0",
"ts-lit-plugin": "^1.1.10",
"typescript": "^3.8.3",
"typescript": "^4.0.5",
"typescript-styled-plugin": "^0.15.0"
},
"dependencies": {
"@ctrl/tinycolor": "^2.6.1",
"@material/mwc-ripple": "^0.15.0",
"@ctrl/tinycolor": "^3.1.6",
"@material/mwc-ripple": "^0.19.1",
"custom-card-helpers": "^1.6.5",
"fast-copy": "^2.1.0",
"home-assistant-js-websocket": "^5.1.0",
"home-assistant-js-websocket": "^5.7.0",
"lit-element": "^2.3.0",
"lit-html": "^1.2.0"
}

View File

@ -1,7 +1,7 @@
import typescript from 'rollup-plugin-typescript2';
import commonjs from '@rollup/plugin-commonjs';
import nodeResolve from '@rollup/plugin-node-resolve';
import babel from 'rollup-plugin-babel';
import babel from '@rollup/plugin-babel';
import { terser } from 'rollup-plugin-terser';
import serve from 'rollup-plugin-serve';
import json from '@rollup/plugin-json';
@ -25,6 +25,7 @@ const plugins = [
json(),
babel({
exclude: 'node_modules/**',
babelHelpers: 'bundled',
}),
dev && serve(serveopts),
!dev &&

View File

@ -76,7 +76,7 @@ class ActionHandler extends HTMLElement implements ActionHandler {
this.appendChild(this.ripple);
this.ripple.primary = true;
['touchcancel', 'mouseout', 'mouseup', 'touchmove', 'mousewheel', 'wheel', 'scroll'].forEach(ev => {
['touchcancel', 'mouseout', 'mouseup', 'touchmove', 'mousewheel', 'wheel', 'scroll'].forEach((ev) => {
document.addEventListener(
ev,
() => {

View File

@ -60,7 +60,7 @@ import * as pjson from '../package.json';
import { deepEqual } from './deep-equal';
let helpers = (window as any).cardHelpers;
const helperPromise = new Promise(async resolve => {
const helperPromise = new Promise(async (resolve) => {
if (helpers) resolve();
if ((window as any).loadCardHelpers) {
helpers = await (window as any).loadCardHelpers();
@ -104,7 +104,7 @@ class ButtonCard extends LitElement {
public set hass(hass: HomeAssistant) {
this._hass = hass;
Object.keys(this._cards).forEach(element => {
Object.keys(this._cards).forEach((element) => {
const el = this._cards[element];
el.hass = this._hass;
});
@ -174,9 +174,7 @@ class ButtonCard extends LitElement {
error: e.toString(),
origConfig: this._config,
});
return html`
${errorCard}
`;
return html` ${errorCard} `;
}
}
@ -244,12 +242,12 @@ class ButtonCard extends LitElement {
if (!this._config!.state) {
return undefined;
}
const hasTemplate = this._config!.state.find(elt => elt.operator === 'template');
const hasTemplate = this._config!.state.find((elt) => elt.operator === 'template');
if (!state && !hasTemplate) {
return undefined;
}
let def: StateConfig | undefined;
const retval = this._config!.state.find(elt => {
const retval = this._config!.state.find((elt) => {
if (elt.operator) {
switch (elt.operator) {
case '==':
@ -318,7 +316,7 @@ class ButtonCard extends LitElement {
if (['number', 'boolean'].includes(typeof value)) return value;
if (!value) return value;
if (['object'].includes(typeof value)) {
Object.keys(value).forEach(key => {
Object.keys(value).forEach((key) => {
value[key] = this._getTemplateOrValue(state, value[key]);
});
return value;
@ -448,7 +446,7 @@ class ButtonCard extends LitElement {
...configStateStyle,
};
}
Object.keys(style).forEach(key => {
Object.keys(style).forEach((key) => {
style[key] = this._getTemplateOrValue(state, style[key]);
});
return style;
@ -476,7 +474,7 @@ class ButtonCard extends LitElement {
...configStateStyle,
};
}
Object.keys(style).forEach(key => {
Object.keys(style).forEach((key) => {
style[key] = this._getTemplateOrValue(state, style[key]);
});
return style;
@ -578,7 +576,7 @@ class ButtonCard extends LitElement {
const fields: any = {};
const cards: any = {};
if (this._config!.custom_fields) {
Object.keys(this._config!.custom_fields).forEach(key => {
Object.keys(this._config!.custom_fields).forEach((key) => {
const value = this._config!.custom_fields![key];
if (!(value as CustomFieldCard).card) {
fields[key] = this._getTemplateOrValue(state, value);
@ -588,7 +586,7 @@ class ButtonCard extends LitElement {
});
}
if (configState && configState.custom_fields) {
Object.keys(configState.custom_fields).forEach(key => {
Object.keys(configState.custom_fields).forEach((key) => {
const value = configState!.custom_fields![key];
if (!(value as CustomFieldCard)!.card) {
fields[key] = this._getTemplateOrValue(state, value);
@ -597,7 +595,7 @@ class ButtonCard extends LitElement {
}
});
}
Object.keys(fields).forEach(key => {
Object.keys(fields).forEach((key) => {
if (fields[key] != undefined) {
const customStyle: StyleInfo = {
...this._buildCustomStyleGeneric(state, configState, key),
@ -611,7 +609,7 @@ class ButtonCard extends LitElement {
`;
}
});
Object.keys(cards).forEach(key => {
Object.keys(cards).forEach((key) => {
if (cards[key] != undefined) {
const customStyle: StyleInfo = {
...this._buildCustomStyleGeneric(state, configState, key),
@ -935,7 +933,7 @@ class ButtonCard extends LitElement {
let result: any = {};
let mergedStateConfig: StateConfig[] | undefined;
const tpls = tpl && Array.isArray(tpl) ? tpl : [tpl];
tpls?.forEach(template => {
tpls?.forEach((template) => {
if (!(ll.config.button_card_templates && ll.config.button_card_templates[template]))
throw new Error(`Button-card template '${template}' is missing!`);
const res = this._configFromLLTemplates(ll, ll.config.button_card_templates[template]);
@ -1014,7 +1012,7 @@ class ButtonCard extends LitElement {
const entitiesRxp = new RegExp(/states\[\s*('|\\")([a-zA-Z0-9_]+\.[a-zA-Z0-9_]+)\1\s*\]/, 'gm');
const entitiesRxp2 = new RegExp(/states\[\s*('|\\")([a-zA-Z0-9_]+\.[a-zA-Z0-9_]+)\1\s*\]/, 'm');
const matched = jsonConfig.match(entitiesRxp);
matched?.forEach(match => {
matched?.forEach((match) => {
const res = match.match(entitiesRxp2);
if (res && !this._entities.includes(res[2])) this._entities.push(res[2]);
});
@ -1031,7 +1029,7 @@ class ButtonCard extends LitElement {
private _loopGroup(entityList: string[] | undefined): void {
if (entityList) {
entityList.forEach(childEntity => {
entityList.forEach((childEntity) => {
if (this._hass?.states[childEntity]) {
if (computeDomain(childEntity) === 'group' && this._hass.states[childEntity].attributes?.entity_id) {
this._loopGroup(this._hass.states[childEntity].attributes.entity_id);
@ -1047,7 +1045,7 @@ class ButtonCard extends LitElement {
private _expandTriggerGroups(): void {
if (this._hass && this._config?.group_expand && this._entities) {
this._entities.forEach(entity => {
this._entities.forEach((entity) => {
if (computeDomain(entity) === 'group') {
this._loopGroup(this._hass?.states[entity].attributes?.entity_id);
}
@ -1068,7 +1066,7 @@ class ButtonCard extends LitElement {
if (!configEval) {
return configEval;
}
Object.keys(configEval).forEach(key => {
Object.keys(configEval).forEach((key) => {
if (typeof configEval[key] === 'object') {
configEval[key] = __evalObject(configEval[key]);
} else {
@ -1092,19 +1090,19 @@ class ButtonCard extends LitElement {
// backward compatibility
@eventOptions({ passive: true })
private handleRippleActivate(evt?: Event): void {
this._ripple.then(r => r && r.startPress && this._rippleHandlers.startPress(evt));
this._ripple.then((r) => r && r.startPress && this._rippleHandlers.startPress(evt));
}
private handleRippleDeactivate(): void {
this._ripple.then(r => r && r.endPress && this._rippleHandlers.endPress());
this._ripple.then((r) => r && r.endPress && this._rippleHandlers.endPress());
}
private handleRippleFocus(): void {
this._ripple.then(r => r && r.startFocus && this._rippleHandlers.startFocus());
this._ripple.then((r) => r && r.startFocus && this._rippleHandlers.startFocus());
}
private handleRippleBlur(): void {
this._ripple.then(r => r && r.endFocus && this._rippleHandlers.endFocus());
this._ripple.then((r) => r && r.endFocus && this._rippleHandlers.endFocus());
}
private _handleAction(ev: any): void {
@ -1157,7 +1155,7 @@ class ButtonCard extends LitElement {
if (this._config!.lock!.exemptions) {
if (!this._hass!.user.name || !this._hass!.user.id) return;
let matched = false;
this._config!.lock!.exemptions.forEach(e => {
this._config!.lock!.exemptions.forEach((e) => {
if (
(!matched && (e as ExemptionUserConfig).user === this._hass!.user.id) ||
(e as ExemptionUsernameConfig).username === this._hass!.user.name

View File

@ -13,10 +13,7 @@ export function computeEntity(entityId: string): string {
export function getColorFromVariable(color: string): string {
if (color.substring(0, 3) === 'var') {
return window
.getComputedStyle(document.documentElement)
.getPropertyValue(color.substring(4).slice(0, -1))
.trim();
return window.getComputedStyle(document.documentElement).getPropertyValue(color.substring(4).slice(0, -1)).trim();
}
return color;
}
@ -99,7 +96,7 @@ export function mergeDeep(...objects: any): any {
const isObject = (obj: any) => obj && typeof obj === 'object';
return objects.reduce((prev: any, obj: any) => {
Object.keys(obj).forEach(key => {
Object.keys(obj).forEach((key) => {
const pVal = prev[key];
const oVal = obj[key];
@ -123,10 +120,10 @@ export function mergeStatesById(
): StateConfig[] {
let resultStateConfigs: StateConfig[] = [];
if (intoStates) {
intoStates.forEach(intoState => {
intoStates.forEach((intoState) => {
let localState = intoState;
if (fromStates) {
fromStates.forEach(fromState => {
fromStates.forEach((fromState) => {
if (fromState.id && intoState.id && fromState.id == intoState.id)
localState = mergeDeep(localState, fromState);
});
@ -137,7 +134,7 @@ export function mergeStatesById(
if (fromStates) {
/* eslint eqeqeq: 0 no-confusing-arrow: 0 */
resultStateConfigs = resultStateConfigs.concat(
fromStates.filter(x => (!intoStates ? true : !intoStates.find(y => (y.id && x.id ? y.id == x.id : false)))),
fromStates.filter((x) => (!intoStates ? true : !intoStates.find((y) => (y.id && x.id ? y.id == x.id : false)))),
);
}
return resultStateConfigs;

1955
yarn.lock

File diff suppressed because it is too large Load Diff