From 11ac8e4b08d2c16919080e1b66ba8e40ff67f284 Mon Sep 17 00:00:00 2001 From: Paulus Schoutsen Date: Sun, 8 Sep 2019 11:54:17 -0700 Subject: [PATCH 01/26] Convert preact to tsx (#3643) --- package.json | 2 +- src/common/preact/event.ts | 15 +++--- .../js/{automation.js => automation.tsx} | 29 +++++------ .../{condition_edit.js => condition_edit.tsx} | 15 +++--- .../{condition_row.js => condition_row.tsx} | 6 +-- .../js/condition/{device.js => device.tsx} | 24 ++++----- .../js/condition/{index.js => index.tsx} | 8 +-- .../{numeric_state.js => numeric_state.tsx} | 17 ++++--- .../js/condition/{state.js => state.tsx} | 17 ++++--- .../config/js/condition/{sun.js => sun.tsx} | 14 ++++-- .../condition/{template.js => template.tsx} | 7 +-- .../config/js/condition/{time.js => time.tsx} | 7 +-- .../config/js/condition/{zone.js => zone.tsx} | 28 +++++------ .../{json_textarea.js => json_textarea.tsx} | 21 +++++--- src/panels/config/js/preact-types.ts | 16 ++++++ .../config/js/{script.js => script.tsx} | 26 ++++++---- .../{action_edit.js => action_edit.tsx} | 9 ++-- .../script/{action_row.js => action_row.tsx} | 6 +-- .../{call_service.js => call_service.tsx} | 23 ++++----- .../js/script/{condition.js => condition.tsx} | 12 ++--- .../config/js/script/{delay.js => delay.tsx} | 7 +-- .../config/js/script/{index.js => index.tsx} | 8 +-- .../config/js/script/{wait.js => wait.tsx} | 19 ++++--- .../js/trigger/{device.js => device.tsx} | 21 ++++---- .../config/js/trigger/{event.js => event.tsx} | 18 ++++--- .../{geo_location.js => geo_location.tsx} | 27 +++++----- .../{homeassistant.js => homeassistant.tsx} | 16 +++--- .../config/js/trigger/{index.js => index.tsx} | 15 +++--- .../config/js/trigger/{mqtt.js => mqtt.tsx} | 7 +-- .../{numeric_state.js => numeric_state.tsx} | 17 ++++--- .../config/js/trigger/{state.js => state.tsx} | 17 ++++--- .../config/js/trigger/{sun.js => sun.tsx} | 17 ++++--- .../js/trigger/{template.js => template.tsx} | 7 +-- .../config/js/trigger/{time.js => time.tsx} | 7 +-- .../{time_pattern.js => time_pattern.tsx} | 7 +-- .../{trigger_edit.js => trigger_edit.tsx} | 27 +++++----- .../{trigger_row.js => trigger_row.tsx} | 30 +++++------ .../js/trigger/{webhook.js => webhook.tsx} | 8 +-- .../config/js/trigger/{zone.js => zone.tsx} | 50 +++++++++---------- 39 files changed, 332 insertions(+), 295 deletions(-) rename src/panels/config/js/{automation.js => automation.tsx} (86%) rename src/panels/config/js/condition/{condition_edit.js => condition_edit.tsx} (87%) rename src/panels/config/js/condition/{condition_row.js => condition_row.tsx} (94%) rename src/panels/config/js/condition/{device.js => device.tsx} (63%) rename src/panels/config/js/condition/{index.js => index.tsx} (87%) rename src/panels/config/js/condition/{numeric_state.js => numeric_state.tsx} (81%) rename src/panels/config/js/condition/{state.js => state.tsx} (75%) rename src/panels/config/js/condition/{sun.js => sun.tsx} (89%) rename src/panels/config/js/condition/{template.js => template.tsx} (78%) rename src/panels/config/js/condition/{time.js => time.tsx} (81%) rename src/panels/config/js/condition/{zone.js => zone.tsx} (69%) rename src/panels/config/js/{json_textarea.js => json_textarea.tsx} (70%) rename src/panels/config/js/{script.js => script.tsx} (77%) rename src/panels/config/js/script/{action_edit.js => action_edit.tsx} (90%) rename src/panels/config/js/script/{action_row.js => action_row.tsx} (94%) rename src/panels/config/js/script/{call_service.js => call_service.tsx} (65%) rename src/panels/config/js/script/{condition.js => condition.tsx} (60%) rename src/panels/config/js/script/{delay.js => delay.tsx} (76%) rename src/panels/config/js/script/{index.js => index.tsx} (87%) rename src/panels/config/js/script/{wait.js => wait.tsx} (77%) rename src/panels/config/js/trigger/{device.js => device.tsx} (66%) rename src/panels/config/js/trigger/{event.js => event.tsx} (73%) rename src/panels/config/js/trigger/{geo_location.js => geo_location.tsx} (80%) rename src/panels/config/js/trigger/{homeassistant.js => homeassistant.tsx} (80%) rename src/panels/config/js/trigger/{index.js => index.tsx} (79%) rename src/panels/config/js/trigger/{mqtt.js => mqtt.tsx} (82%) rename src/panels/config/js/trigger/{numeric_state.js => numeric_state.tsx} (86%) rename src/panels/config/js/trigger/{state.js => state.tsx} (84%) rename src/panels/config/js/trigger/{sun.js => sun.tsx} (82%) rename src/panels/config/js/trigger/{template.js => template.tsx} (78%) rename src/panels/config/js/trigger/{time.js => time.tsx} (76%) rename src/panels/config/js/trigger/{time_pattern.js => time_pattern.tsx} (85%) rename src/panels/config/js/trigger/{trigger_edit.js => trigger_edit.tsx} (89%) rename src/panels/config/js/trigger/{trigger_row.js => trigger_row.tsx} (94%) rename src/panels/config/js/trigger/{webhook.js => webhook.tsx} (76%) rename src/panels/config/js/trigger/{zone.js => zone.tsx} (75%) diff --git a/package.json b/package.json index 3be9a261e9..08ff2b45ea 100644 --- a/package.json +++ b/package.json @@ -8,7 +8,7 @@ "version": "1.0.0", "scripts": { "build": "script/build_frontend", - "lint": "eslint src hassio/src gallery/src && tslint 'src/**/*.ts' 'hassio/src/**/*.ts' 'gallery/src/**/*.ts' 'cast/src/**/*.ts' 'test-mocha/**/*.ts' && polymer lint && tsc", + "lint": "eslint src hassio/src gallery/src && tslint 'src/**/*.ts' 'src/**/*.tsx' 'hassio/src/**/*.ts' 'gallery/src/**/*.ts' 'cast/src/**/*.ts' 'test-mocha/**/*.ts' && polymer lint && tsc", "mocha": "node_modules/.bin/ts-mocha -p test-mocha/tsconfig.test.json --opts test-mocha/mocha.opts", "test": "npm run lint && npm run mocha", "docker_build": "sh ./script/docker_run.sh build $npm_package_version", diff --git a/src/common/preact/event.ts b/src/common/preact/event.ts index db04b0c600..7e4ec871e9 100644 --- a/src/common/preact/event.ts +++ b/src/common/preact/event.ts @@ -1,11 +1,12 @@ -interface OnChangeComponent { - props: { - index: number; - onChange(index: number, data: object); - }; -} +// interface OnChangeComponent { +// props: { +// index: number; +// onChange(index: number, data: object); +// }; +// } -export function onChangeEvent(this: OnChangeComponent, prop, ev) { +// export function onChangeEvent(this: OnChangeComponent, prop, ev) { +export function onChangeEvent(this: any, prop, ev) { const origData = this.props[prop]; if (ev.target.value === origData[ev.target.name]) { diff --git a/src/panels/config/js/automation.js b/src/panels/config/js/automation.tsx similarity index 86% rename from src/panels/config/js/automation.js rename to src/panels/config/js/automation.tsx index 26cf2bb782..bb3ff51ee8 100644 --- a/src/panels/config/js/automation.js +++ b/src/panels/config/js/automation.tsx @@ -8,7 +8,7 @@ import Trigger from "./trigger/index"; import Condition from "./condition/index"; import Script from "./script/index"; -export default class Automation extends Component { +export default class Automation extends Component { constructor() { super(); @@ -18,29 +18,26 @@ export default class Automation extends Component { this.actionChanged = this.actionChanged.bind(this); } - onChange(ev) { - this.props.onChange( - Object.assign({}, this.props.automation, { - [ev.target.name]: ev.target.value, - }) - ); + public onChange(ev) { + this.props.onChange({ + ...this.props.automation, + [ev.target.name]: ev.target.value, + }); } - triggerChanged(trigger) { - this.props.onChange(Object.assign({}, this.props.automation, { trigger })); + public triggerChanged(trigger) { + this.props.onChange({ ...this.props.automation, trigger }); } - conditionChanged(condition) { - this.props.onChange( - Object.assign({}, this.props.automation, { condition }) - ); + public conditionChanged(condition) { + this.props.onChange({ ...this.props.automation, condition }); } - actionChanged(action) { - this.props.onChange(Object.assign({}, this.props.automation, { action })); + public actionChanged(action) { + this.props.onChange({ ...this.props.automation, action }); } - render({ automation, isWide, hass, localize }) { + public render({ automation, isWide, hass, localize }) { const { alias, trigger, condition, action } = automation; return ( diff --git a/src/panels/config/js/condition/condition_edit.js b/src/panels/config/js/condition/condition_edit.tsx similarity index 87% rename from src/panels/config/js/condition/condition_edit.js rename to src/panels/config/js/condition/condition_edit.tsx index 5609ef8a96..3816675aff 100644 --- a/src/panels/config/js/condition/condition_edit.js +++ b/src/panels/config/js/condition/condition_edit.tsx @@ -23,25 +23,26 @@ const TYPES = { const OPTIONS = Object.keys(TYPES).sort(); -export default class ConditionRow extends Component { +export default class ConditionRow extends Component { constructor() { super(); this.typeChanged = this.typeChanged.bind(this); } - typeChanged(ev) { + public typeChanged(ev) { const type = ev.target.selectedItem.attributes.condition.value; if (type !== this.props.condition.condition) { - this.props.onChange( - this.props.index, - Object.assign({ condition: type }, TYPES[type].defaultConfig) - ); + this.props.onChange(this.props.index, { + condition: type, + ...TYPES[type].defaultConfig, + }); } } - render({ index, condition, onChange, hass, localize }) { + public render({ index, condition, onChange, hass, localize }) { + // tslint:disable-next-line: variable-name const Comp = TYPES[condition.condition]; const selected = OPTIONS.indexOf(condition.condition); diff --git a/src/panels/config/js/condition/condition_row.js b/src/panels/config/js/condition/condition_row.tsx similarity index 94% rename from src/panels/config/js/condition/condition_row.js rename to src/panels/config/js/condition/condition_row.tsx index 34f51af6fa..c0cd7821de 100644 --- a/src/panels/config/js/condition/condition_row.js +++ b/src/panels/config/js/condition/condition_row.tsx @@ -7,14 +7,14 @@ import "../../../../components/ha-card"; import ConditionEdit from "./condition_edit"; -export default class ConditionRow extends Component { +export default class ConditionRow extends Component { constructor() { super(); this.onDelete = this.onDelete.bind(this); } - onDelete() { + public onDelete() { // eslint-disable-next-line if ( confirm( @@ -27,7 +27,7 @@ export default class ConditionRow extends Component { } } - render(props) { + public render(props) { return (
diff --git a/src/panels/config/js/condition/device.js b/src/panels/config/js/condition/device.tsx similarity index 63% rename from src/panels/config/js/condition/device.js rename to src/panels/config/js/condition/device.tsx index fdcb6a02e8..30962fec46 100644 --- a/src/panels/config/js/condition/device.js +++ b/src/panels/config/js/condition/device.tsx @@ -3,32 +3,28 @@ import { h, Component } from "preact"; import "../../../../components/device/ha-device-picker"; import "../../../../components/device/ha-device-condition-picker"; -import { onChangeEvent } from "../../../../common/preact/event"; - -export default class DeviceCondition extends Component { +export default class DeviceCondition extends Component { constructor() { super(); - this.onChange = onChangeEvent.bind(this, "condition"); this.devicePicked = this.devicePicked.bind(this); this.deviceConditionPicked = this.deviceConditionPicked.bind(this); - this.state.device_id = undefined; + this.state = { device_id: undefined }; } - devicePicked(ev) { + public devicePicked(ev) { this.setState({ device_id: ev.target.value }); } - deviceConditionPicked(ev) { + public deviceConditionPicked(ev) { const deviceCondition = ev.target.value; - this.props.onChange( - this.props.index, - (this.props.condition = deviceCondition) - ); + this.props.onChange(this.props.index, deviceCondition); } /* eslint-disable camelcase */ - render({ condition, hass }, { device_id }) { - if (device_id === undefined) device_id = condition.device_id; + public render({ condition, hass }, { device_id }) { + if (device_id === undefined) { + device_id = condition.device_id; + } return (
@@ -50,7 +46,7 @@ export default class DeviceCondition extends Component { } } -DeviceCondition.defaultConfig = { +(DeviceCondition as any).defaultConfig = { device_id: "", domain: "", entity_id: "", diff --git a/src/panels/config/js/condition/index.js b/src/panels/config/js/condition/index.tsx similarity index 87% rename from src/panels/config/js/condition/index.js rename to src/panels/config/js/condition/index.tsx index 8fae56e179..16c4c05c57 100644 --- a/src/panels/config/js/condition/index.js +++ b/src/panels/config/js/condition/index.tsx @@ -4,7 +4,7 @@ import "../../../../components/ha-card"; import ConditionRow from "./condition_row"; -export default class Condition extends Component { +export default class Condition extends Component { constructor() { super(); @@ -12,7 +12,7 @@ export default class Condition extends Component { this.conditionChanged = this.conditionChanged.bind(this); } - addCondition() { + public addCondition() { const condition = this.props.condition.concat({ condition: "state", }); @@ -20,7 +20,7 @@ export default class Condition extends Component { this.props.onChange(condition); } - conditionChanged(index, newValue) { + public conditionChanged(index, newValue) { const condition = this.props.condition.concat(); if (newValue === null) { @@ -32,7 +32,7 @@ export default class Condition extends Component { this.props.onChange(condition); } - render({ condition, hass, localize }) { + public render({ condition, hass, localize }) { return (
{condition.map((cnd, idx) => ( diff --git a/src/panels/config/js/condition/numeric_state.js b/src/panels/config/js/condition/numeric_state.tsx similarity index 81% rename from src/panels/config/js/condition/numeric_state.js rename to src/panels/config/js/condition/numeric_state.tsx index 571b2a52b1..eb739101aa 100644 --- a/src/panels/config/js/condition/numeric_state.js +++ b/src/panels/config/js/condition/numeric_state.tsx @@ -5,7 +5,8 @@ import "../../../../components/entity/ha-entity-picker"; import { onChangeEvent } from "../../../../common/preact/event"; -export default class NumericStateCondition extends Component { +export default class NumericStateCondition extends Component { + private onChange: (obj: any) => void; constructor() { super(); @@ -13,15 +14,15 @@ export default class NumericStateCondition extends Component { this.entityPicked = this.entityPicked.bind(this); } - entityPicked(ev) { - this.props.onChange( - this.props.index, - Object.assign({}, this.props.condition, { entity_id: ev.target.value }) - ); + public entityPicked(ev) { + this.props.onChange(this.props.index, { + ...this.props.condition, + entity_id: ev.target.value, + }); } /* eslint-disable camelcase */ - render({ condition, hass, localize }) { + public render({ condition, hass, localize }) { const { value_template, entity_id, below, above } = condition; return (
@@ -61,6 +62,6 @@ export default class NumericStateCondition extends Component { } } -NumericStateCondition.defaultConfig = { +(NumericStateCondition as any).defaultConfig = { entity_id: "", }; diff --git a/src/panels/config/js/condition/state.js b/src/panels/config/js/condition/state.tsx similarity index 75% rename from src/panels/config/js/condition/state.js rename to src/panels/config/js/condition/state.tsx index 4249ef60cd..53bb383e15 100644 --- a/src/panels/config/js/condition/state.js +++ b/src/panels/config/js/condition/state.tsx @@ -4,7 +4,8 @@ import "../../../../components/entity/ha-entity-picker"; import { onChangeEvent } from "../../../../common/preact/event"; -export default class StateCondition extends Component { +export default class StateCondition extends Component { + private onChange: (obj: any) => void; constructor() { super(); @@ -12,15 +13,15 @@ export default class StateCondition extends Component { this.entityPicked = this.entityPicked.bind(this); } - entityPicked(ev) { - this.props.onChange( - this.props.index, - Object.assign({}, this.props.condition, { entity_id: ev.target.value }) - ); + public entityPicked(ev) { + this.props.onChange(this.props.index, { + ...this.props.condition, + entity_id: ev.target.value, + }); } /* eslint-disable camelcase */ - render({ condition, hass, localize }) { + public render({ condition, hass, localize }) { const { entity_id, state } = condition; const cndFor = condition.for; return ( @@ -45,7 +46,7 @@ export default class StateCondition extends Component { } } -StateCondition.defaultConfig = { +(StateCondition as any).defaultConfig = { entity_id: "", state: "", }; diff --git a/src/panels/config/js/condition/sun.js b/src/panels/config/js/condition/sun.tsx similarity index 89% rename from src/panels/config/js/condition/sun.js rename to src/panels/config/js/condition/sun.tsx index 793a91af52..0243e08495 100644 --- a/src/panels/config/js/condition/sun.js +++ b/src/panels/config/js/condition/sun.tsx @@ -5,7 +5,11 @@ import "@polymer/paper-radio-group/paper-radio-group"; import { onChangeEvent } from "../../../../common/preact/event"; -export default class SunCondition extends Component { +export default class SunCondition extends Component { + private onChange: (obj: any) => void; + private afterPicked: (obj: any) => void; + private beforePicked: (obj: any) => void; + constructor() { super(); @@ -14,8 +18,8 @@ export default class SunCondition extends Component { this.beforePicked = this.radioGroupPicked.bind(this, "before"); } - radioGroupPicked(key, ev) { - const condition = Object.assign({}, this.props.condition); + public radioGroupPicked(key, ev) { + const condition = { ...this.props.condition }; if (ev.target.selected) { condition[key] = ev.target.selected; @@ -26,7 +30,7 @@ export default class SunCondition extends Component { this.props.onChange(this.props.index, condition); } - render({ condition, localize }) { + public render({ condition, localize }) { /* eslint-disable camelcase */ const { after, after_offset, before, before_offset } = condition; return ( @@ -101,4 +105,4 @@ export default class SunCondition extends Component { } } -SunCondition.defaultConfig = {}; +(SunCondition as any).defaultConfig = {}; diff --git a/src/panels/config/js/condition/template.js b/src/panels/config/js/condition/template.tsx similarity index 78% rename from src/panels/config/js/condition/template.js rename to src/panels/config/js/condition/template.tsx index bab5763fc8..f4cd50dc3c 100644 --- a/src/panels/config/js/condition/template.js +++ b/src/panels/config/js/condition/template.tsx @@ -3,14 +3,15 @@ import "../../../../components/ha-textarea"; import { onChangeEvent } from "../../../../common/preact/event"; -export default class TemplateCondition extends Component { +export default class TemplateCondition extends Component { + private onChange: (obj: any) => void; constructor() { super(); this.onChange = onChangeEvent.bind(this, "condition"); } - render({ condition, localize }) { + public render({ condition, localize }) { /* eslint-disable camelcase */ const { value_template } = condition; return ( @@ -29,6 +30,6 @@ export default class TemplateCondition extends Component { } } -TemplateCondition.defaultConfig = { +(TemplateCondition as any).defaultConfig = { value_template: "", }; diff --git a/src/panels/config/js/condition/time.js b/src/panels/config/js/condition/time.tsx similarity index 81% rename from src/panels/config/js/condition/time.js rename to src/panels/config/js/condition/time.tsx index 269b3dad8b..427f81e9b2 100644 --- a/src/panels/config/js/condition/time.js +++ b/src/panels/config/js/condition/time.tsx @@ -3,7 +3,8 @@ import "@polymer/paper-input/paper-input"; import { onChangeEvent } from "../../../../common/preact/event"; -export default class TimeCondition extends Component { +export default class TimeCondition extends Component { + private onChange: (obj: any) => void; constructor() { super(); @@ -11,7 +12,7 @@ export default class TimeCondition extends Component { } /* eslint-disable camelcase */ - render({ condition, localize }) { + public render({ condition, localize }) { const { after, before } = condition; return (
@@ -36,4 +37,4 @@ export default class TimeCondition extends Component { } } -TimeCondition.defaultConfig = {}; +(TimeCondition as any).defaultConfig = {}; diff --git a/src/panels/config/js/condition/zone.js b/src/panels/config/js/condition/zone.tsx similarity index 69% rename from src/panels/config/js/condition/zone.js rename to src/panels/config/js/condition/zone.tsx index a09ae77e2a..4dc79962bc 100644 --- a/src/panels/config/js/condition/zone.js +++ b/src/panels/config/js/condition/zone.tsx @@ -1,6 +1,5 @@ import { h, Component } from "preact"; import "../../../../components/entity/ha-entity-picker"; -import { onChangeEvent } from "../../../../common/preact/event"; import hasLocation from "../../../../common/entity/has_location"; import computeStateDomain from "../../../../common/entity/compute_state_domain"; @@ -8,31 +7,30 @@ function zoneAndLocationFilter(stateObj) { return hasLocation(stateObj) && computeStateDomain(stateObj) !== "zone"; } -export default class ZoneCondition extends Component { +export default class ZoneCondition extends Component { constructor() { super(); - this.onChange = onChangeEvent.bind(this, "condition"); this.entityPicked = this.entityPicked.bind(this); this.zonePicked = this.zonePicked.bind(this); } - entityPicked(ev) { - this.props.onChange( - this.props.index, - Object.assign({}, this.props.condition, { entity_id: ev.target.value }) - ); + public entityPicked(ev) { + this.props.onChange(this.props.index, { + ...this.props.condition, + entity_id: ev.target.value, + }); } - zonePicked(ev) { - this.props.onChange( - this.props.index, - Object.assign({}, this.props.condition, { zone: ev.target.value }) - ); + public zonePicked(ev) { + this.props.onChange(this.props.index, { + ...this.props.condition, + zone: ev.target.value, + }); } /* eslint-disable camelcase */ - render({ condition, hass, localize }) { + public render({ condition, hass, localize }) { const { entity_id, zone } = condition; return (
@@ -61,7 +59,7 @@ export default class ZoneCondition extends Component { } } -ZoneCondition.defaultConfig = { +(ZoneCondition as any).defaultConfig = { entity_id: "", zone: "", }; diff --git a/src/panels/config/js/json_textarea.js b/src/panels/config/js/json_textarea.tsx similarity index 70% rename from src/panels/config/js/json_textarea.js rename to src/panels/config/js/json_textarea.tsx index 23f2a873dc..2fd947acdf 100644 --- a/src/panels/config/js/json_textarea.js +++ b/src/panels/config/js/json_textarea.tsx @@ -1,15 +1,18 @@ import { h, Component } from "preact"; import "../../../components/ha-textarea"; -export default class JSONTextArea extends Component { +export default class JSONTextArea extends Component { constructor(props) { super(props); - this.state.isValid = true; - this.state.value = JSON.stringify(props.value || {}, null, 2); + this.state = { + isvalid: true, + value: JSON.stringify(props.value || {}, null, 2), + }; + this.onChange = this.onChange.bind(this); } - onChange(ev) { + public onChange(ev) { const value = ev.target.value; let parsed; let isValid; @@ -31,16 +34,18 @@ export default class JSONTextArea extends Component { } } - componentWillReceiveProps({ value }) { - if (value === this.props.value) return; + public componentWillReceiveProps({ value }) { + if (value === this.props.value) { + return; + } this.setState({ value: JSON.stringify(value, null, 2), isValid: true, }); } - render({ label }, { value, isValid }) { - const style = { + public render({ label }, { value, isValid }) { + const style: any = { minWidth: 300, width: "100%", }; diff --git a/src/panels/config/js/preact-types.ts b/src/panels/config/js/preact-types.ts index 95d790ede4..d8442845af 100644 --- a/src/panels/config/js/preact-types.ts +++ b/src/panels/config/js/preact-types.ts @@ -7,6 +7,22 @@ declare global { namespace JSX { interface IntrinsicElements { "paper-input": Partial; + "ha-config-section": any; + "ha-card": any; + "paper-radio-button": any; + "paper-radio-group": any; + "ha-entity-picker": any; + "paper-listbox": any; + "paper-item": any; + "paper-menu-button": any; + "paper-dropdown-menu-light": any; + "paper-icon-button": any; + "ha-device-picker": any; + "ha-device-condition-picker": any; + "ha-textarea": any; + "ha-service-picker": any; + "mwc-button": any; + "ha-device-trigger-picker": any; } } } diff --git a/src/panels/config/js/script.js b/src/panels/config/js/script.tsx similarity index 77% rename from src/panels/config/js/script.js rename to src/panels/config/js/script.tsx index 867cc5d4a4..c36ce7e78f 100644 --- a/src/panels/config/js/script.js +++ b/src/panels/config/js/script.tsx @@ -6,7 +6,13 @@ import "../../../components/ha-card"; import Script from "./script/index"; -export default class ScriptEditor extends Component { +export default class ScriptEditor extends Component<{ + onChange: (...args: any[]) => any; + script: any; + isWide: any; + hass: any; + localize: any; +}> { constructor() { super(); @@ -14,19 +20,19 @@ export default class ScriptEditor extends Component { this.sequenceChanged = this.sequenceChanged.bind(this); } - onChange(ev) { - this.props.onChange( - Object.assign({}, this.props.script, { - [ev.target.name]: ev.target.value, - }) - ); + public onChange(ev) { + this.props.onChange({ + ...this.props.script, + [ev.target.name]: ev.target.value, + }); } - sequenceChanged(sequence) { - this.props.onChange(Object.assign({}, this.props.script, { sequence })); + public sequenceChanged(sequence) { + this.props.onChange({ ...this.props.script, sequence }); } - render({ script, isWide, hass, localize }) { + // @ts-ignore + public render({ script, isWide, hass, localize }) { const { alias, sequence } = script; return ( diff --git a/src/panels/config/js/script/action_edit.js b/src/panels/config/js/script/action_edit.tsx similarity index 90% rename from src/panels/config/js/script/action_edit.js rename to src/panels/config/js/script/action_edit.tsx index b114ab512e..a4f0a02d32 100644 --- a/src/panels/config/js/script/action_edit.js +++ b/src/panels/config/js/script/action_edit.tsx @@ -21,6 +21,7 @@ const OPTIONS = Object.keys(TYPES).sort(); function getType(action) { const keys = Object.keys(TYPES); + // tslint:disable-next-line: prefer-for-of for (let i = 0; i < keys.length; i++) { if (keys[i] in action) { return keys[i]; @@ -29,14 +30,14 @@ function getType(action) { return null; } -export default class Action extends Component { +export default class Action extends Component { constructor() { super(); this.typeChanged = this.typeChanged.bind(this); } - typeChanged(ev) { + public typeChanged(ev) { const newType = ev.target.selectedItem.attributes.action.value; const oldType = getType(this.props.action); @@ -45,9 +46,11 @@ export default class Action extends Component { } } - render({ index, action, onChange, hass, localize }) { + public render({ index, action, onChange, hass, localize }) { const type = getType(action); + // tslint:disable-next-line: variable-name const Comp = type && TYPES[type]; + // @ts-ignore const selected = OPTIONS.indexOf(type); if (!Comp) { diff --git a/src/panels/config/js/script/action_row.js b/src/panels/config/js/script/action_row.tsx similarity index 94% rename from src/panels/config/js/script/action_row.js rename to src/panels/config/js/script/action_row.tsx index a8f0da3838..67634a3b97 100644 --- a/src/panels/config/js/script/action_row.js +++ b/src/panels/config/js/script/action_row.tsx @@ -7,14 +7,14 @@ import "../../../../components/ha-card"; import ActionEdit from "./action_edit"; -export default class Action extends Component { +export default class Action extends Component { constructor() { super(); this.onDelete = this.onDelete.bind(this); } - onDelete() { + public onDelete() { // eslint-disable-next-line if ( confirm( @@ -27,7 +27,7 @@ export default class Action extends Component { } } - render(props) { + public render(props) { return (
diff --git a/src/panels/config/js/script/call_service.js b/src/panels/config/js/script/call_service.tsx similarity index 65% rename from src/panels/config/js/script/call_service.js rename to src/panels/config/js/script/call_service.tsx index 0584e9cc3c..5182248c26 100644 --- a/src/panels/config/js/script/call_service.js +++ b/src/panels/config/js/script/call_service.tsx @@ -3,7 +3,7 @@ import "../../../../components/ha-service-picker"; import JSONTextArea from "../json_textarea"; -export default class CallServiceAction extends Component { +export default class CallServiceAction extends Component { constructor() { super(); @@ -11,21 +11,18 @@ export default class CallServiceAction extends Component { this.serviceDataChanged = this.serviceDataChanged.bind(this); } - serviceChanged(ev) { - this.props.onChange( - this.props.index, - Object.assign({}, this.props.action, { service: ev.target.value }) - ); + public serviceChanged(ev) { + this.props.onChange(this.props.index, { + ...this.props.action, + service: ev.target.value, + }); } - serviceDataChanged(data) { - this.props.onChange( - this.props.index, - Object.assign({}, this.props.action, { data }) - ); + public serviceDataChanged(data) { + this.props.onChange(this.props.index, { ...this.props.action, data }); } - render({ action, hass, localize }) { + public render({ action, hass, localize }) { const { service, data } = action; return ( @@ -47,7 +44,7 @@ export default class CallServiceAction extends Component { } } -CallServiceAction.defaultConfig = { +(CallServiceAction as any).defaultConfig = { alias: "", service: "", data: {}, diff --git a/src/panels/config/js/script/condition.js b/src/panels/config/js/script/condition.tsx similarity index 60% rename from src/panels/config/js/script/condition.js rename to src/panels/config/js/script/condition.tsx index 01421c9306..f930256f08 100644 --- a/src/panels/config/js/script/condition.js +++ b/src/panels/config/js/script/condition.tsx @@ -3,9 +3,9 @@ import { h, Component } from "preact"; import StateCondition from "../condition/state"; import ConditionEdit from "../condition/condition_edit"; -export default class ConditionAction extends Component { +export default class ConditionAction extends Component { // eslint-disable-next-line - render({ action, index, onChange, hass, localize }) { + public render({ action, index, onChange, hass, localize }) { return ( { + private onChange: (obj: any) => void; constructor() { super(); this.onChange = onChangeEvent.bind(this, "action"); } - render({ action, localize }) { + public render({ action, localize }) { const { delay } = action; return (
@@ -26,6 +27,6 @@ export default class DelayAction extends Component { } } -DelayAction.defaultConfig = { +(DelayAction as any).defaultConfig = { delay: "", }; diff --git a/src/panels/config/js/script/index.js b/src/panels/config/js/script/index.tsx similarity index 87% rename from src/panels/config/js/script/index.js rename to src/panels/config/js/script/index.tsx index a5343cdd5e..8d1eb75ffc 100644 --- a/src/panels/config/js/script/index.js +++ b/src/panels/config/js/script/index.tsx @@ -4,7 +4,7 @@ import "../../../../components/ha-card"; import ActionRow from "./action_row"; -export default class Script extends Component { +export default class Script extends Component { constructor() { super(); @@ -12,7 +12,7 @@ export default class Script extends Component { this.actionChanged = this.actionChanged.bind(this); } - addAction() { + public addAction() { const script = this.props.script.concat({ service: "", }); @@ -20,7 +20,7 @@ export default class Script extends Component { this.props.onChange(script); } - actionChanged(index, newValue) { + public actionChanged(index, newValue) { const script = this.props.script.concat(); if (newValue === null) { @@ -32,7 +32,7 @@ export default class Script extends Component { this.props.onChange(script); } - render({ script, hass, localize }) { + public render({ script, hass, localize }) { return (
{script.map((act, idx) => ( diff --git a/src/panels/config/js/script/wait.js b/src/panels/config/js/script/wait.tsx similarity index 77% rename from src/panels/config/js/script/wait.js rename to src/panels/config/js/script/wait.tsx index 17817b634e..bfde440211 100644 --- a/src/panels/config/js/script/wait.js +++ b/src/panels/config/js/script/wait.tsx @@ -5,7 +5,8 @@ import "../../../../components/ha-textarea"; import { onChangeEvent } from "../../../../common/preact/event"; -export default class WaitAction extends Component { +export default class WaitAction extends Component { + private onChange: (obj: any) => void; constructor() { super(); @@ -15,16 +16,14 @@ export default class WaitAction extends Component { // Gets fired on mount. If empty, onChangeEvent removes attribute. // Without the attribute this action is no longer matched to this component. - onTemplateChange(ev) { - this.props.onChange( - this.props.index, - Object.assign({}, this.props.action, { - [ev.target.getAttribute("name")]: ev.target.value, - }) - ); + public onTemplateChange(ev) { + this.props.onChange(this.props.index, { + ...this.props.action, + [ev.target.getAttribute("name")]: ev.target.value, + }); } - render({ action, localize }) { + public render({ action, localize }) { /* eslint-disable camelcase */ const { wait_template, timeout } = action; return ( @@ -51,7 +50,7 @@ export default class WaitAction extends Component { } } -WaitAction.defaultConfig = { +(WaitAction as any).defaultConfig = { wait_template: "", timeout: "", }; diff --git a/src/panels/config/js/trigger/device.js b/src/panels/config/js/trigger/device.tsx similarity index 66% rename from src/panels/config/js/trigger/device.js rename to src/panels/config/js/trigger/device.tsx index ee4ef4d982..58d4dd65da 100644 --- a/src/panels/config/js/trigger/device.js +++ b/src/panels/config/js/trigger/device.tsx @@ -4,29 +4,28 @@ import "../../../../components/device/ha-device-picker"; import "../../../../components/device/ha-device-trigger-picker"; import "../../../../components/device/ha-device-automation-picker"; -import { onChangeEvent } from "../../../../common/preact/event"; - -export default class DeviceTrigger extends Component { +export default class DeviceTrigger extends Component { constructor() { super(); - this.onChange = onChangeEvent.bind(this, "trigger"); this.devicePicked = this.devicePicked.bind(this); this.deviceTriggerPicked = this.deviceTriggerPicked.bind(this); - this.state.device_id = undefined; + this.state = { device_id: undefined }; } - devicePicked(ev) { + public devicePicked(ev) { this.setState({ device_id: ev.target.value }); } - deviceTriggerPicked(ev) { + public deviceTriggerPicked(ev) { const deviceTrigger = ev.target.value; - this.props.onChange(this.props.index, (this.props.trigger = deviceTrigger)); + this.props.onChange(this.props.index, deviceTrigger); } /* eslint-disable camelcase */ - render({ trigger, hass }, { device_id }) { - if (device_id === undefined) device_id = trigger.device_id; + public render({ trigger, hass }, { device_id }) { + if (device_id === undefined) { + device_id = trigger.device_id; + } return (
@@ -48,7 +47,7 @@ export default class DeviceTrigger extends Component { } } -DeviceTrigger.defaultConfig = { +(DeviceTrigger as any).defaultConfig = { device_id: "", domain: "", entity_id: "", diff --git a/src/panels/config/js/trigger/event.js b/src/panels/config/js/trigger/event.tsx similarity index 73% rename from src/panels/config/js/trigger/event.js rename to src/panels/config/js/trigger/event.tsx index c41a2faf1c..45f36b4904 100644 --- a/src/panels/config/js/trigger/event.js +++ b/src/panels/config/js/trigger/event.tsx @@ -4,7 +4,8 @@ import "@polymer/paper-input/paper-input"; import JSONTextArea from "../json_textarea"; import { onChangeEvent } from "../../../../common/preact/event"; -export default class EventTrigger extends Component { +export default class EventTrigger extends Component { + private onChange: (obj: any) => void; constructor() { super(); @@ -13,14 +14,15 @@ export default class EventTrigger extends Component { } /* eslint-disable camelcase */ - eventDataChanged(event_data) { - this.props.onChange( - this.props.index, - Object.assign({}, this.props.trigger, { event_data }) - ); + // tslint:disable-next-line: variable-name + public eventDataChanged(event_data) { + this.props.onChange(this.props.index, { + ...this.props.trigger, + event_data, + }); } - render({ trigger, localize }) { + public render({ trigger, localize }) { const { event_type, event_data } = trigger; return (
@@ -44,7 +46,7 @@ export default class EventTrigger extends Component { } } -EventTrigger.defaultConfig = { +(EventTrigger as any).defaultConfig = { event_type: "", event_data: {}, }; diff --git a/src/panels/config/js/trigger/geo_location.js b/src/panels/config/js/trigger/geo_location.tsx similarity index 80% rename from src/panels/config/js/trigger/geo_location.js rename to src/panels/config/js/trigger/geo_location.tsx index 1b06943633..bc20980f84 100644 --- a/src/panels/config/js/trigger/geo_location.js +++ b/src/panels/config/js/trigger/geo_location.tsx @@ -5,7 +5,8 @@ import "../../../../components/entity/ha-entity-picker"; import { onChangeEvent } from "../../../../common/preact/event"; -export default class GeolocationTrigger extends Component { +export default class GeolocationTrigger extends Component { + private onChange: (obj: any) => void; constructor() { super(); @@ -14,22 +15,22 @@ export default class GeolocationTrigger extends Component { this.radioGroupPicked = this.radioGroupPicked.bind(this); } - zonePicked(ev) { - this.props.onChange( - this.props.index, - Object.assign({}, this.props.trigger, { zone: ev.target.value }) - ); + public zonePicked(ev) { + this.props.onChange(this.props.index, { + ...this.props.trigger, + zone: ev.target.value, + }); } - radioGroupPicked(ev) { - this.props.onChange( - this.props.index, - Object.assign({}, this.props.trigger, { event: ev.target.selected }) - ); + public radioGroupPicked(ev) { + this.props.onChange(this.props.index, { + ...this.props.trigger, + event: ev.target.selected, + }); } /* eslint-disable camelcase */ - render({ trigger, hass, localize }) { + public render({ trigger, hass, localize }) { const { source, zone, event } = trigger; return ( @@ -78,7 +79,7 @@ export default class GeolocationTrigger extends Component { } } -GeolocationTrigger.defaultConfig = { +(GeolocationTrigger as any).defaultConfig = { source: "", zone: "", event: "enter", diff --git a/src/panels/config/js/trigger/homeassistant.js b/src/panels/config/js/trigger/homeassistant.tsx similarity index 80% rename from src/panels/config/js/trigger/homeassistant.js rename to src/panels/config/js/trigger/homeassistant.tsx index 732a549987..79f6a45c36 100644 --- a/src/panels/config/js/trigger/homeassistant.js +++ b/src/panels/config/js/trigger/homeassistant.tsx @@ -2,22 +2,22 @@ import { h, Component } from "preact"; import "@polymer/paper-radio-button/paper-radio-button"; import "@polymer/paper-radio-group/paper-radio-group"; -export default class HassTrigger extends Component { +export default class HassTrigger extends Component { constructor() { super(); this.radioGroupPicked = this.radioGroupPicked.bind(this); } - radioGroupPicked(ev) { - this.props.onChange( - this.props.index, - Object.assign({}, this.props.trigger, { event: ev.target.selected }) - ); + public radioGroupPicked(ev) { + this.props.onChange(this.props.index, { + ...this.props.trigger, + event: ev.target.selected, + }); } /* eslint-disable camelcase */ - render({ trigger, localize }) { + public render({ trigger, localize }) { const { event } = trigger; return (
@@ -47,6 +47,6 @@ export default class HassTrigger extends Component { } } -HassTrigger.defaultConfig = { +(HassTrigger as any).defaultConfig = { event: "start", }; diff --git a/src/panels/config/js/trigger/index.js b/src/panels/config/js/trigger/index.tsx similarity index 79% rename from src/panels/config/js/trigger/index.js rename to src/panels/config/js/trigger/index.tsx index 63c51c1733..fa196e418e 100644 --- a/src/panels/config/js/trigger/index.js +++ b/src/panels/config/js/trigger/index.tsx @@ -5,7 +5,7 @@ import "../../../../components/ha-card"; import TriggerRow from "./trigger_row"; import StateTrigger from "./state"; -export default class Trigger extends Component { +export default class Trigger extends Component { constructor() { super(); @@ -13,15 +13,16 @@ export default class Trigger extends Component { this.triggerChanged = this.triggerChanged.bind(this); } - addTrigger() { - const trigger = this.props.trigger.concat( - Object.assign({ platform: "state" }, StateTrigger.defaultConfig) - ); + public addTrigger() { + const trigger = this.props.trigger.concat({ + platform: "state", + ...(StateTrigger as any).defaultConfig, + }); this.props.onChange(trigger); } - triggerChanged(index, newValue) { + public triggerChanged(index, newValue) { const trigger = this.props.trigger.concat(); if (newValue === null) { @@ -33,7 +34,7 @@ export default class Trigger extends Component { this.props.onChange(trigger); } - render({ trigger, hass, localize }) { + public render({ trigger, hass, localize }) { return (
{trigger.map((trg, idx) => ( diff --git a/src/panels/config/js/trigger/mqtt.js b/src/panels/config/js/trigger/mqtt.tsx similarity index 82% rename from src/panels/config/js/trigger/mqtt.js rename to src/panels/config/js/trigger/mqtt.tsx index f59c7618f5..283c0e8bb0 100644 --- a/src/panels/config/js/trigger/mqtt.js +++ b/src/panels/config/js/trigger/mqtt.tsx @@ -3,7 +3,8 @@ import "@polymer/paper-input/paper-input"; import { onChangeEvent } from "../../../../common/preact/event"; -export default class MQTTTrigger extends Component { +export default class MQTTTrigger extends Component { + private onChange: (obj: any) => void; constructor() { super(); @@ -11,7 +12,7 @@ export default class MQTTTrigger extends Component { } /* eslint-disable camelcase */ - render({ trigger, localize }) { + public render({ trigger, localize }) { const { topic, payload } = trigger; return (
@@ -36,6 +37,6 @@ export default class MQTTTrigger extends Component { } } -MQTTTrigger.defaultConfig = { +(MQTTTrigger as any).defaultConfig = { topic: "", }; diff --git a/src/panels/config/js/trigger/numeric_state.js b/src/panels/config/js/trigger/numeric_state.tsx similarity index 86% rename from src/panels/config/js/trigger/numeric_state.js rename to src/panels/config/js/trigger/numeric_state.tsx index ac006cb2cf..b706703fc8 100644 --- a/src/panels/config/js/trigger/numeric_state.js +++ b/src/panels/config/js/trigger/numeric_state.tsx @@ -6,7 +6,8 @@ import "../../../../components/entity/ha-entity-picker"; import { onChangeEvent } from "../../../../common/preact/event"; -export default class NumericStateTrigger extends Component { +export default class NumericStateTrigger extends Component { + private onChange: (obj: any) => void; constructor() { super(); @@ -14,15 +15,15 @@ export default class NumericStateTrigger extends Component { this.entityPicked = this.entityPicked.bind(this); } - entityPicked(ev) { - this.props.onChange( - this.props.index, - Object.assign({}, this.props.trigger, { entity_id: ev.target.value }) - ); + public entityPicked(ev) { + this.props.onChange(this.props.index, { + ...this.props.trigger, + entity_id: ev.target.value, + }); } /* eslint-disable camelcase */ - render({ trigger, hass, localize }) { + public render({ trigger, hass, localize }) { const { value_template, entity_id, below, above } = trigger; let trgFor = trigger.for; @@ -82,6 +83,6 @@ export default class NumericStateTrigger extends Component { } } -NumericStateTrigger.defaultConfig = { +(NumericStateTrigger as any).defaultConfig = { entity_id: "", }; diff --git a/src/panels/config/js/trigger/state.js b/src/panels/config/js/trigger/state.tsx similarity index 84% rename from src/panels/config/js/trigger/state.js rename to src/panels/config/js/trigger/state.tsx index fe3d4e7acc..825731a5c6 100644 --- a/src/panels/config/js/trigger/state.js +++ b/src/panels/config/js/trigger/state.tsx @@ -5,7 +5,8 @@ import "../../../../components/entity/ha-entity-picker"; import { onChangeEvent } from "../../../../common/preact/event"; -export default class StateTrigger extends Component { +export default class StateTrigger extends Component { + private onChange: (obj: any) => void; constructor() { super(); @@ -13,15 +14,15 @@ export default class StateTrigger extends Component { this.entityPicked = this.entityPicked.bind(this); } - entityPicked(ev) { - this.props.onChange( - this.props.index, - Object.assign({}, this.props.trigger, { entity_id: ev.target.value }) - ); + public entityPicked(ev) { + this.props.onChange(this.props.index, { + ...this.props.trigger, + entity_id: ev.target.value, + }); } /* eslint-disable camelcase */ - render({ trigger, hass, localize }) { + public render({ trigger, hass, localize }) { const { entity_id, to } = trigger; const trgFrom = trigger.from; let trgFor = trigger.for; @@ -73,6 +74,6 @@ export default class StateTrigger extends Component { } } -StateTrigger.defaultConfig = { +(StateTrigger as any).defaultConfig = { entity_id: "", }; diff --git a/src/panels/config/js/trigger/sun.js b/src/panels/config/js/trigger/sun.tsx similarity index 82% rename from src/panels/config/js/trigger/sun.js rename to src/panels/config/js/trigger/sun.tsx index a0bd5bc990..f3f7e85769 100644 --- a/src/panels/config/js/trigger/sun.js +++ b/src/panels/config/js/trigger/sun.tsx @@ -6,7 +6,8 @@ import "@polymer/paper-radio-group/paper-radio-group"; import { onChangeEvent } from "../../../../common/preact/event"; -export default class SunTrigger extends Component { +export default class SunTrigger extends Component { + private onChange: (obj: any) => void; constructor() { super(); @@ -14,15 +15,15 @@ export default class SunTrigger extends Component { this.radioGroupPicked = this.radioGroupPicked.bind(this); } - radioGroupPicked(ev) { - this.props.onChange( - this.props.index, - Object.assign({}, this.props.trigger, { event: ev.target.selected }) - ); + public radioGroupPicked(ev) { + this.props.onChange(this.props.index, { + ...this.props.trigger, + event: ev.target.selected, + }); } /* eslint-disable camelcase */ - render({ trigger, localize }) { + public render({ trigger, localize }) { const { offset, event } = trigger; return (
@@ -61,6 +62,6 @@ export default class SunTrigger extends Component { } } -SunTrigger.defaultConfig = { +(SunTrigger as any).defaultConfig = { event: "sunrise", }; diff --git a/src/panels/config/js/trigger/template.js b/src/panels/config/js/trigger/template.tsx similarity index 78% rename from src/panels/config/js/trigger/template.js rename to src/panels/config/js/trigger/template.tsx index ae2b1d8ed0..deec5a18b4 100644 --- a/src/panels/config/js/trigger/template.js +++ b/src/panels/config/js/trigger/template.tsx @@ -4,14 +4,15 @@ import "../../../../components/ha-textarea"; import { onChangeEvent } from "../../../../common/preact/event"; -export default class TemplateTrigger extends Component { +export default class TemplateTrigger extends Component { + private onChange: (obj: any) => void; constructor() { super(); this.onChange = onChangeEvent.bind(this, "trigger"); } - render({ trigger, localize }) { + public render({ trigger, localize }) { /* eslint-disable camelcase */ const { value_template } = trigger; return ( @@ -30,6 +31,6 @@ export default class TemplateTrigger extends Component { } } -TemplateTrigger.defaultConfig = { +(TemplateTrigger as any).defaultConfig = { value_template: "", }; diff --git a/src/panels/config/js/trigger/time.js b/src/panels/config/js/trigger/time.tsx similarity index 76% rename from src/panels/config/js/trigger/time.js rename to src/panels/config/js/trigger/time.tsx index dd2c4c535d..e181aff3dc 100644 --- a/src/panels/config/js/trigger/time.js +++ b/src/panels/config/js/trigger/time.tsx @@ -4,7 +4,8 @@ import "@polymer/paper-input/paper-input"; import { onChangeEvent } from "../../../../common/preact/event"; -export default class TimeTrigger extends Component { +export default class TimeTrigger extends Component { + private onChange: (obj: any) => void; constructor() { super(); @@ -12,7 +13,7 @@ export default class TimeTrigger extends Component { } /* eslint-disable camelcase */ - render({ trigger, localize }) { + public render({ trigger, localize }) { const { at } = trigger; return (
@@ -29,6 +30,6 @@ export default class TimeTrigger extends Component { } } -TimeTrigger.defaultConfig = { +(TimeTrigger as any).defaultConfig = { at: "", }; diff --git a/src/panels/config/js/trigger/time_pattern.js b/src/panels/config/js/trigger/time_pattern.tsx similarity index 85% rename from src/panels/config/js/trigger/time_pattern.js rename to src/panels/config/js/trigger/time_pattern.tsx index 1dda842275..a4dd8a78f1 100644 --- a/src/panels/config/js/trigger/time_pattern.js +++ b/src/panels/config/js/trigger/time_pattern.tsx @@ -4,7 +4,8 @@ import "@polymer/paper-input/paper-input"; import { onChangeEvent } from "../../../../common/preact/event"; -export default class TimePatternTrigger extends Component { +export default class TimePatternTrigger extends Component { + private onChange: (obj: any) => void; constructor() { super(); @@ -12,7 +13,7 @@ export default class TimePatternTrigger extends Component { } /* eslint-disable camelcase */ - render({ trigger, localize }) { + public render({ trigger, localize }) { const { hours, minutes, seconds } = trigger; return (
@@ -45,7 +46,7 @@ export default class TimePatternTrigger extends Component { } } -TimePatternTrigger.defaultConfig = { +(TimePatternTrigger as any).defaultConfig = { hours: "", minutes: "", seconds: "", diff --git a/src/panels/config/js/trigger/trigger_edit.js b/src/panels/config/js/trigger/trigger_edit.tsx similarity index 89% rename from src/panels/config/js/trigger/trigger_edit.js rename to src/panels/config/js/trigger/trigger_edit.tsx index e0234ed550..a52af204c3 100644 --- a/src/panels/config/js/trigger/trigger_edit.js +++ b/src/panels/config/js/trigger/trigger_edit.tsx @@ -36,25 +36,15 @@ const TYPES = { const OPTIONS = Object.keys(TYPES).sort(); -export default class TriggerEdit extends Component { +export default class TriggerEdit extends Component { constructor() { super(); this.typeChanged = this.typeChanged.bind(this); } - typeChanged(ev) { - const type = ev.target.selectedItem.attributes.platform.value; - - if (type !== this.props.trigger.platform) { - this.props.onChange( - this.props.index, - Object.assign({ platform: type }, TYPES[type].defaultConfig) - ); - } - } - - render({ index, trigger, onChange, hass, localize }) { + public render({ index, trigger, onChange, hass, localize }) { + // tslint:disable-next-line: variable-name const Comp = TYPES[trigger.platform]; const selected = OPTIONS.indexOf(trigger.platform); @@ -102,4 +92,15 @@ export default class TriggerEdit extends Component {
); } + + private typeChanged(ev) { + const type = ev.target.selectedItem.attributes.platform.value; + + if (type !== this.props.trigger.platform) { + this.props.onChange(this.props.index, { + platform: type, + ...TYPES[type].defaultConfig, + }); + } + } } diff --git a/src/panels/config/js/trigger/trigger_row.js b/src/panels/config/js/trigger/trigger_row.tsx similarity index 94% rename from src/panels/config/js/trigger/trigger_row.js rename to src/panels/config/js/trigger/trigger_row.tsx index 3cb123402f..7853a8d9dc 100644 --- a/src/panels/config/js/trigger/trigger_row.js +++ b/src/panels/config/js/trigger/trigger_row.tsx @@ -7,27 +7,14 @@ import "../../../../components/ha-card"; import TriggerEdit from "./trigger_edit"; -export default class TriggerRow extends Component { +export default class TriggerRow extends Component { constructor() { super(); this.onDelete = this.onDelete.bind(this); } - onDelete() { - // eslint-disable-next-line - if ( - confirm( - this.props.localize( - "ui.panel.config.automation.editor.triggers.delete_confirm" - ) - ) - ) { - this.props.onChange(this.props.index, null); - } - } - - render(props) { + public render(props) { return (
@@ -61,4 +48,17 @@ export default class TriggerRow extends Component { ); } + + private onDelete() { + // eslint-disable-next-line + if ( + confirm( + this.props.localize( + "ui.panel.config.automation.editor.triggers.delete_confirm" + ) + ) + ) { + this.props.onChange(this.props.index, null); + } + } } diff --git a/src/panels/config/js/trigger/webhook.js b/src/panels/config/js/trigger/webhook.tsx similarity index 76% rename from src/panels/config/js/trigger/webhook.js rename to src/panels/config/js/trigger/webhook.tsx index 8ce125559f..86960fc654 100644 --- a/src/panels/config/js/trigger/webhook.js +++ b/src/panels/config/js/trigger/webhook.tsx @@ -2,15 +2,15 @@ import { h, Component } from "preact"; import "@polymer/paper-input/paper-input"; import { onChangeEvent } from "../../../../common/preact/event"; - -export default class WebhookTrigger extends Component { +export default class WebhookTrigger extends Component { + private onChange: (obj: any) => void; constructor() { super(); this.onChange = onChangeEvent.bind(this, "trigger"); } - render({ trigger, localize }) { + public render({ trigger, localize }) { const { webhook_id: webhookId } = trigger; return (
@@ -27,6 +27,6 @@ export default class WebhookTrigger extends Component { } } -WebhookTrigger.defaultConfig = { +(WebhookTrigger as any).defaultConfig = { webhook_id: "", }; diff --git a/src/panels/config/js/trigger/zone.js b/src/panels/config/js/trigger/zone.tsx similarity index 75% rename from src/panels/config/js/trigger/zone.js rename to src/panels/config/js/trigger/zone.tsx index be3b385a01..392f61a137 100644 --- a/src/panels/config/js/trigger/zone.js +++ b/src/panels/config/js/trigger/zone.tsx @@ -3,7 +3,6 @@ import "@polymer/paper-radio-button/paper-radio-button"; import "@polymer/paper-radio-group/paper-radio-group"; import "../../../../components/entity/ha-entity-picker"; -import { onChangeEvent } from "../../../../common/preact/event"; import hasLocation from "../../../../common/entity/has_location"; import computeStateDomain from "../../../../common/entity/compute_state_domain"; @@ -11,39 +10,17 @@ function zoneAndLocationFilter(stateObj) { return hasLocation(stateObj) && computeStateDomain(stateObj) !== "zone"; } -export default class ZoneTrigger extends Component { +export default class ZoneTrigger extends Component { constructor() { super(); - this.onChange = onChangeEvent.bind(this, "trigger"); this.radioGroupPicked = this.radioGroupPicked.bind(this); this.entityPicked = this.entityPicked.bind(this); this.zonePicked = this.zonePicked.bind(this); } - entityPicked(ev) { - this.props.onChange( - this.props.index, - Object.assign({}, this.props.trigger, { entity_id: ev.target.value }) - ); - } - - zonePicked(ev) { - this.props.onChange( - this.props.index, - Object.assign({}, this.props.trigger, { zone: ev.target.value }) - ); - } - - radioGroupPicked(ev) { - this.props.onChange( - this.props.index, - Object.assign({}, this.props.trigger, { event: ev.target.selected }) - ); - } - /* eslint-disable camelcase */ - render({ trigger, hass, localize }) { + public render({ trigger, hass, localize }) { const { entity_id, zone, event } = trigger; return (
@@ -91,9 +68,30 @@ export default class ZoneTrigger extends Component {
); } + + private entityPicked(ev) { + this.props.onChange(this.props.index, { + ...this.props.trigger, + entity_id: ev.target.value, + }); + } + + private zonePicked(ev) { + this.props.onChange(this.props.index, { + ...this.props.trigger, + zone: ev.target.value, + }); + } + + private radioGroupPicked(ev) { + this.props.onChange(this.props.index, { + ...this.props.trigger, + event: ev.target.selected, + }); + } } -ZoneTrigger.defaultConfig = { +(ZoneTrigger as any).defaultConfig = { entity_id: "", zone: "", event: "enter", From b7ea66c30f0aa3590c077e93c17b66a7d7f0010c Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sun, 8 Sep 2019 11:54:37 -0700 Subject: [PATCH 02/26] Bump eslint-utils from 1.3.1 to 1.4.2 (#3651) Bumps [eslint-utils](https://github.com/mysticatea/eslint-utils) from 1.3.1 to 1.4.2. - [Release notes](https://github.com/mysticatea/eslint-utils/releases) - [Commits](https://github.com/mysticatea/eslint-utils/compare/v1.3.1...v1.4.2) Signed-off-by: dependabot[bot] --- yarn.lock | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/yarn.lock b/yarn.lock index db118c96b2..a2f616636c 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5716,14 +5716,16 @@ eslint-scope@^4.0.0, eslint-scope@^4.0.3: estraverse "^4.1.1" eslint-utils@^1.3.1: - version "1.3.1" - resolved "https://registry.yarnpkg.com/eslint-utils/-/eslint-utils-1.3.1.tgz#9a851ba89ee7c460346f97cf8939c7298827e512" - integrity sha512-Z7YjnIldX+2XMcjr7ZkgEsOj/bREONV60qYeB/bjMAqqqZ4zxKyWX+BOUkdmRmA9riiIPVvo5x86m5elviOk0Q== + version "1.4.2" + resolved "https://registry.yarnpkg.com/eslint-utils/-/eslint-utils-1.4.2.tgz#166a5180ef6ab7eb462f162fd0e6f2463d7309ab" + integrity sha512-eAZS2sEUMlIeCjBeubdj45dmBHQwPHWyBcT1VSYB7o9x9WRRqKxyUoiXlRjyAwzN7YEzHJlYg0NmzDRWx6GP4Q== + dependencies: + eslint-visitor-keys "^1.0.0" eslint-visitor-keys@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-1.0.0.tgz#3f3180fb2e291017716acb4c9d6d5b5c34a6a81d" - integrity sha512-qzm/XxIbxm/FHyH341ZrbnMUpe+5Bocte9xkmFMzPMjRaZMcXww+MpBptFvtU+79L362nqiLhekCxCxDPaUMBQ== + version "1.1.0" + resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-1.1.0.tgz#e2a82cea84ff246ad6fb57f9bde5b46621459ec2" + integrity sha512-8y9YjtM1JBJU/A9Kc+SbaOV4y29sSWckBwMHa+FGtVj5gN/sbnKDf6xJUl+8g7FAij9LVaP8C24DUiH/f/2Z9A== eslint@^5.15.3: version "5.15.3" From 205e12150ff2d9678d8b3659b2e8db157472ab24 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sun, 8 Sep 2019 11:55:03 -0700 Subject: [PATCH 03/26] Bump lodash.template from 4.4.0 to 4.5.0 (#3653) Bumps [lodash.template](https://github.com/lodash/lodash) from 4.4.0 to 4.5.0. - [Release notes](https://github.com/lodash/lodash/releases) - [Commits](https://github.com/lodash/lodash/compare/4.4.0...4.5.0) Signed-off-by: dependabot[bot] --- package.json | 2 +- yarn.lock | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/package.json b/package.json index 08ff2b45ea..5c124b3044 100644 --- a/package.json +++ b/package.json @@ -148,7 +148,7 @@ "html-webpack-plugin": "^3.2.0", "husky": "^1.3.1", "lint-staged": "^8.1.5", - "lodash.template": "^4.4.0", + "lodash.template": "^4.5.0", "merge-stream": "^1.0.1", "mocha": "^6.0.2", "parse5": "^5.1.0", diff --git a/yarn.lock b/yarn.lock index a2f616636c..d70fa11a2a 100644 --- a/yarn.lock +++ b/yarn.lock @@ -8789,7 +8789,7 @@ lodash._reinterpolate@^2.4.1, lodash._reinterpolate@~2.4.1: resolved "https://registry.yarnpkg.com/lodash._reinterpolate/-/lodash._reinterpolate-2.4.1.tgz#4f1227aa5a8711fc632f5b07a1f4607aab8b3222" integrity sha1-TxInqlqHEfxjL1sHofRgequLMiI= -lodash._reinterpolate@~3.0.0: +lodash._reinterpolate@^3.0.0, lodash._reinterpolate@~3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/lodash._reinterpolate/-/lodash._reinterpolate-3.0.0.tgz#0ccf2d89166af03b3663c796538b75ac6e114d9d" integrity sha1-DM8tiRZq8Ds2Y8eWU4t1rG4RTZ0= @@ -8985,12 +8985,12 @@ lodash.template@^2.4.1: lodash.templatesettings "~2.4.1" lodash.values "~2.4.1" -lodash.template@^4.4.0: - version "4.4.0" - resolved "https://registry.yarnpkg.com/lodash.template/-/lodash.template-4.4.0.tgz#e73a0385c8355591746e020b99679c690e68fba0" - integrity sha1-5zoDhcg1VZF0bgILmWecaQ5o+6A= +lodash.template@^4.4.0, lodash.template@^4.5.0: + version "4.5.0" + resolved "https://registry.yarnpkg.com/lodash.template/-/lodash.template-4.5.0.tgz#f976195cf3f347d0d5f52483569fe8031ccce8ab" + integrity sha512-84vYFxIkmidUiFxidA/KjjH9pAycqW+h980j7Fuz5qxRtO9pgB7MDFTdys1N7A5mcucRiDyEq4fusljItR1T/A== dependencies: - lodash._reinterpolate "~3.0.0" + lodash._reinterpolate "^3.0.0" lodash.templatesettings "^4.0.0" lodash.templatesettings@^4.0.0: From a2f23c068b5c0113b6ede59e3d782827ae3e4b09 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sun, 8 Sep 2019 11:55:12 -0700 Subject: [PATCH 04/26] Bump lodash.mergewith from 4.6.1 to 4.6.2 (#3654) Bumps [lodash.mergewith](https://github.com/lodash/lodash) from 4.6.1 to 4.6.2. - [Release notes](https://github.com/lodash/lodash/releases) - [Commits](https://github.com/lodash/lodash/commits) Signed-off-by: dependabot[bot] --- yarn.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/yarn.lock b/yarn.lock index d70fa11a2a..302a3b93cb 100644 --- a/yarn.lock +++ b/yarn.lock @@ -8936,9 +8936,9 @@ lodash.keys@~2.4.1: lodash.isobject "~2.4.1" lodash.mergewith@^4.6.1: - version "4.6.1" - resolved "https://registry.yarnpkg.com/lodash.mergewith/-/lodash.mergewith-4.6.1.tgz#639057e726c3afbdb3e7d42741caa8d6e4335927" - integrity sha512-eWw5r+PYICtEBgrBE5hhlT6aAa75f411bgDz/ZL2KZqYV03USvucsxcHUIlGTDTECs1eunpI7HOV7U+WLDvNdQ== + version "4.6.2" + resolved "https://registry.yarnpkg.com/lodash.mergewith/-/lodash.mergewith-4.6.2.tgz#617121f89ac55f59047c7aec1ccd6654c6590f55" + integrity sha512-GK3g5RPZWTRSeLSpgP8Xhra+pnjBC56q9FZYe1d5RN3TJ35dbkGy3YqBSMbyCrlbi+CM9Z3Jk5yTL7RCsqboyQ== lodash.noop@~2.4.1: version "2.4.1" From e19c210af2b62568360ab678c31356ac3c5a6810 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sun, 8 Sep 2019 11:58:11 -0700 Subject: [PATCH 05/26] Bump jquery from 3.3.1 to 3.4.0 (#3652) Bumps [jquery](https://github.com/jquery/jquery) from 3.3.1 to 3.4.0. - [Release notes](https://github.com/jquery/jquery/releases) - [Commits](https://github.com/jquery/jquery/compare/3.3.1...3.4.0) Signed-off-by: dependabot[bot] --- package.json | 2 +- yarn.lock | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index 5c124b3044..490d0a6c84 100644 --- a/package.json +++ b/package.json @@ -81,7 +81,7 @@ "hls.js": "^0.12.4", "home-assistant-js-websocket": "4.3.1", "intl-messageformat": "^2.2.0", - "jquery": "^3.3.1", + "jquery": "^3.4.0", "js-yaml": "^3.13.1", "leaflet": "^1.4.0", "lit-element": "^2.2.0", diff --git a/yarn.lock b/yarn.lock index 302a3b93cb..3d1afed364 100644 --- a/yarn.lock +++ b/yarn.lock @@ -8214,10 +8214,10 @@ joi@^14.3.1: isemail "3.x.x" topo "3.x.x" -"jquery@>= 1.4.1", jquery@^3.3.1: - version "3.3.1" - resolved "https://registry.yarnpkg.com/jquery/-/jquery-3.3.1.tgz#958ce29e81c9790f31be7792df5d4d95fc57fbca" - integrity sha512-Ubldcmxp5np52/ENotGxlLe6aGMvmF4R8S6tZjsP6Knsaxd/xp3Zrh50cG93lR6nPXyUFwzN3ZSOQI0wRJNdGg== +"jquery@>= 1.4.1", jquery@^3.4.0: + version "3.4.0" + resolved "https://registry.yarnpkg.com/jquery/-/jquery-3.4.0.tgz#8de513fa0fa4b2c7d2e48a530e26f0596936efdf" + integrity sha512-ggRCXln9zEqv6OqAGXFEcshF5dSBvCkzj6Gm2gzuR5fWawaX8t7cxKVkkygKODrDAzKdoYw3l/e3pm3vlT4IbQ== js-levenshtein@^1.1.3: version "1.1.6" From 7e7158b81678298cae2ce332dd546543e6afec9b Mon Sep 17 00:00:00 2001 From: Bram Kragten Date: Sun, 8 Sep 2019 22:43:28 +0200 Subject: [PATCH 06/26] Pick unused entities for lovelace cards (#3614) * Pick unused entities for lovelace cards * Type * Table layout for unused entities * properties * remove unused import * mwc-button Need to find a way to set the color * add icons to pick view dialog * Comments * Lint * Restore unused entities for yaml mode * Remove _elements * decorators, types, comments * flexbox + comments * remove unused import --- package.json | 10 +- src/components/ha-checkbox.ts | 20 ++ src/components/ha-fab.ts | 49 ++++ .../lovelace/cards/hui-alarm-panel-card.ts | 2 +- src/panels/lovelace/cards/hui-gauge-card.ts | 2 +- .../lovelace/cards/hui-history-graph-card.js | 4 + src/panels/lovelace/cards/hui-light-card.ts | 2 +- .../lovelace/cards/hui-media-control-card.js | 2 +- src/panels/lovelace/cards/hui-sensor-card.ts | 2 +- .../lovelace/common/create-row-element.ts | 1 + .../common/directives/long-press-directive.ts | 27 +- .../card-editor/hui-dialog-edit-card.ts | 14 +- .../card-editor/show-edit-card-dialog.ts | 1 + .../select-view/hui-dialog-select-view.ts | 79 ++++++ .../select-view/show-select-view-dialog.ts | 19 ++ .../editor/unused-entities/hui-select-row.ts | 151 +++++++++++ .../unused-entities/hui-unused-entities.ts | 213 ++++++++++++++++ src/panels/lovelace/hui-root.ts | 35 ++- src/panels/lovelace/hui-unused-entities.ts | 112 -------- src/panels/lovelace/hui-view.ts | 2 +- src/resources/ha-style.ts | 1 + yarn.lock | 239 +++++++++++------- 22 files changed, 746 insertions(+), 241 deletions(-) create mode 100644 src/components/ha-checkbox.ts create mode 100644 src/components/ha-fab.ts create mode 100644 src/panels/lovelace/editor/select-view/hui-dialog-select-view.ts create mode 100644 src/panels/lovelace/editor/select-view/show-select-view-dialog.ts create mode 100644 src/panels/lovelace/editor/unused-entities/hui-select-row.ts create mode 100644 src/panels/lovelace/editor/unused-entities/hui-unused-entities.ts delete mode 100644 src/panels/lovelace/hui-unused-entities.ts diff --git a/package.json b/package.json index 490d0a6c84..e24dd98503 100644 --- a/package.json +++ b/package.json @@ -17,9 +17,11 @@ "author": "Paulus Schoutsen (http://paulusschoutsen.nl)", "license": "Apache-2.0", "dependencies": { - "@material/mwc-base": "^0.6.0", - "@material/mwc-button": "^0.6.0", - "@material/mwc-ripple": "^0.6.0", + "@material/mwc-base": "^0.8.0", + "@material/mwc-button": "^0.8.0", + "@material/mwc-checkbox": "^0.8.0", + "@material/mwc-fab": "^0.8.0", + "@material/mwc-ripple": "0.8.0", "@mdi/svg": "4.3.95", "@polymer/app-layout": "^3.0.2", "@polymer/app-localize-behavior": "^3.0.1", @@ -84,7 +86,7 @@ "jquery": "^3.4.0", "js-yaml": "^3.13.1", "leaflet": "^1.4.0", - "lit-element": "^2.2.0", + "lit-element": "^2.2.1", "lit-html": "^1.1.0", "marked": "^0.6.1", "mdn-polyfills": "^5.16.0", diff --git a/src/components/ha-checkbox.ts b/src/components/ha-checkbox.ts new file mode 100644 index 0000000000..99c294f4f7 --- /dev/null +++ b/src/components/ha-checkbox.ts @@ -0,0 +1,20 @@ +import { Constructor, customElement } from "lit-element"; +import "@material/mwc-checkbox"; +// tslint:disable-next-line +import { Checkbox } from "@material/mwc-checkbox"; +// tslint:disable-next-line +const MwcCheckbox = customElements.get("mwc-checkbox") as Constructor; + +@customElement("ha-checkbox") +export class HaCheckbox extends MwcCheckbox { + protected firstUpdated() { + super.firstUpdated(); + this.style.setProperty("--mdc-theme-secondary", "var(--primary-color)"); + } +} + +declare global { + interface HTMLElementTagNameMap { + "ha-checkbox": HaCheckbox; + } +} diff --git a/src/components/ha-fab.ts b/src/components/ha-fab.ts new file mode 100644 index 0000000000..f7ffee55fe --- /dev/null +++ b/src/components/ha-fab.ts @@ -0,0 +1,49 @@ +import { + classMap, + html, + customElement, + Constructor, +} from "@material/mwc-base/base-element"; +import { ripple } from "@material/mwc-ripple/ripple-directive.js"; + +import "@material/mwc-fab"; +// tslint:disable-next-line +import { Fab } from "@material/mwc-fab"; +// tslint:disable-next-line +const MwcFab = customElements.get("mwc-fab") as Constructor; + +@customElement("ha-fab") +export class HaFab extends MwcFab { + // We override the render method because we don't have an icon font and mwc-fab doesn't support our svg-icon sets. + // Based on version mwc-fab 0.8 + protected render() { + const classes = { + "mdc-fab--mini": this.mini, + "mdc-fab--exited": this.exited, + "mdc-fab--extended": this.extended, + }; + const showLabel = this.label !== "" && this.extended; + return html` + + `; + } +} + +declare global { + interface HTMLElementTagNameMap { + "ha-fab": HaFab; + } +} diff --git a/src/panels/lovelace/cards/hui-alarm-panel-card.ts b/src/panels/lovelace/cards/hui-alarm-panel-card.ts index f9b3a2a1a1..e8a9fccc80 100644 --- a/src/panels/lovelace/cards/hui-alarm-panel-card.ts +++ b/src/panels/lovelace/cards/hui-alarm-panel-card.ts @@ -43,7 +43,7 @@ class HuiAlarmPanelCard extends LitElement implements LovelaceCard { } public static getStubConfig() { - return { states: ["arm_home", "arm_away"] }; + return { states: ["arm_home", "arm_away"], entity: "" }; } @property() public hass?: HomeAssistant; diff --git a/src/panels/lovelace/cards/hui-gauge-card.ts b/src/panels/lovelace/cards/hui-gauge-card.ts index 0c8bf158ab..25b00ddb61 100644 --- a/src/panels/lovelace/cards/hui-gauge-card.ts +++ b/src/panels/lovelace/cards/hui-gauge-card.ts @@ -37,7 +37,7 @@ class HuiGaugeCard extends LitElement implements LovelaceCard { return document.createElement("hui-gauge-card-editor"); } public static getStubConfig(): object { - return {}; + return { entity: "" }; } @property() public hass?: HomeAssistant; diff --git a/src/panels/lovelace/cards/hui-history-graph-card.js b/src/panels/lovelace/cards/hui-history-graph-card.js index 453ffe22ab..50e74828a6 100644 --- a/src/panels/lovelace/cards/hui-history-graph-card.js +++ b/src/panels/lovelace/cards/hui-history-graph-card.js @@ -8,6 +8,10 @@ import "../../../data/ha-state-history-data"; import { processConfigEntities } from "../common/process-config-entities"; class HuiHistoryGraphCard extends PolymerElement { + static getStubConfig() { + return { entities: [] }; + } + static get template() { return html` - `; - } - - private _createElements(): void { - if (!this._hass) { - return; - } - const domains: { [domain: string]: string[] } = {}; - computeUnusedEntities(this._hass, this._config!).forEach((entity) => { - const domain = computeDomain(entity); - - if (!(domain in domains)) { - domains[domain] = []; - } - domains[domain].push(entity); - }); - this._elements = Object.keys(domains) - .sort() - .map((domain) => { - const el = createCardElement({ - type: "entities", - title: this._hass!.localize(`domain.${domain}`) || domain, - entities: domains[domain].map((entity) => ({ - entity, - secondary_info: "entity-id", - })), - show_header_toggle: false, - }); - el.hass = this._hass; - return el; - }); - } -} - -declare global { - interface HTMLElementTagNameMap { - "hui-unused-entities": HuiUnusedEntities; - } -} -customElements.define("hui-unused-entities", HuiUnusedEntities); diff --git a/src/panels/lovelace/hui-view.ts b/src/panels/lovelace/hui-view.ts index d8bf24004b..811ed0405d 100644 --- a/src/panels/lovelace/hui-view.ts +++ b/src/panels/lovelace/hui-view.ts @@ -6,6 +6,7 @@ import { TemplateResult, } from "lit-element"; +import "@polymer/paper-fab/paper-fab"; import "../../components/entity/ha-state-label-badge"; // This one is for types // tslint:disable-next-line @@ -16,7 +17,6 @@ import applyThemesOnElement from "../../common/dom/apply_themes_on_element"; import { LovelaceViewConfig, LovelaceCardConfig } from "../../data/lovelace"; import { HomeAssistant } from "../../types"; import { classMap } from "lit-html/directives/class-map"; - import { Lovelace, LovelaceCard } from "./types"; import { createCardElement } from "./common/create-card-element"; import { computeCardSize } from "./common/compute-card-size"; diff --git a/src/resources/ha-style.ts b/src/resources/ha-style.ts index cb2fc997c7..d171a11c76 100644 --- a/src/resources/ha-style.ts +++ b/src/resources/ha-style.ts @@ -125,6 +125,7 @@ documentContainer.innerHTML = ` /* mwc */ --mdc-theme-primary: var(--primary-color); + --mdc-theme-secondary: var(--accent-color); } diff --git a/yarn.lock b/yarn.lock index 3d1afed364..8a4a58a039 100644 --- a/yarn.lock +++ b/yarn.lock @@ -726,126 +726,181 @@ dependencies: base64-js "^1.3.0" -"@material/animation@^1.0.0": - version "1.0.0" - resolved "https://registry.yarnpkg.com/@material/animation/-/animation-1.0.0.tgz#dfd8575c8b031203917dc838ac0e3c0fe0f6709b" - integrity sha512-Ed5/vggn6ZhSJ87yn3ZS1d826VJNFz73jHF2bSsgRtHDoB8KCuOwQMfdgAgDa4lKDF6CDIPCKBZPKrs2ubehdw== +"@material/animation@^3.1.0": + version "3.1.0" + resolved "https://registry.yarnpkg.com/@material/animation/-/animation-3.1.0.tgz#ab04e7c2e92ab370a2b28d12af1b88538d23014f" + integrity sha512-ZfP95awrPBLhpaCTPNx+xKYPp2D88fzf5p5YNVp6diUAGRpq3g12Aq7qJfIHDXAFo5CtrYhgOKRqIKxUVcFisQ== dependencies: tslib "^1.9.3" -"@material/base@^1.0.0": - version "1.0.0" - resolved "https://registry.yarnpkg.com/@material/base/-/base-1.0.0.tgz#e4ef0b22c54aa887af94f5988fb1c0cb3245beba" - integrity sha512-5dxFp46x5FA+Epg6YHLzN+5zRt9S2wR84UdvVAEJ1egea94m9UHUg7y9tAnNSN16aexRSywmzyLwPr+i8PGEYA== +"@material/base@^3.0.0", "@material/base@^3.1.0": + version "3.1.0" + resolved "https://registry.yarnpkg.com/@material/base/-/base-3.1.0.tgz#ab933896ab6390d4e1d2f9797b74a90f47db272a" + integrity sha512-pWEBHyPrMV3rdnjqWWH96h5t3MxQI6V1J9jOor+UBG7bXQtr6InTabTqhz5CLY7r+qZU8YvNh2OKIy8heP0cyQ== dependencies: tslib "^1.9.3" -"@material/button@^1.0.0": - version "1.1.1" - resolved "https://registry.yarnpkg.com/@material/button/-/button-1.1.1.tgz#35af0d295f6ce6e3df9d4978485b5294d794f682" - integrity sha512-03aEyzZBIeqpgZkqLjro/enz8ORUnfQslBUdAgkPqdjh1X0oIEugr3UaFyC5QlSBTU3j3GIsnKIxWaggkRenpQ== +"@material/button@^3.0.0": + version "3.1.0" + resolved "https://registry.yarnpkg.com/@material/button/-/button-3.1.0.tgz#bee60a7a5ec0a7c3dcb242dac48bbdaf16bac66b" + integrity sha512-DBx3UYtvh8/Vn8/2oDrwrpkyGQrZCElcbkJy8CnZtftbb1P5qVKGvXqEeoND3d0AWTIwdKDYbX3X0zSXQUe3iA== dependencies: - "@material/elevation" "^1.1.0" - "@material/feature-targeting" "^0.44.1" - "@material/ripple" "^1.1.0" - "@material/rtl" "^0.42.0" - "@material/shape" "^1.1.1" - "@material/theme" "^1.1.0" - "@material/typography" "^1.0.0" + "@material/elevation" "^3.1.0" + "@material/feature-targeting" "^3.1.0" + "@material/ripple" "^3.1.0" + "@material/rtl" "^3.1.0" + "@material/shape" "^3.1.0" + "@material/theme" "^3.1.0" + "@material/typography" "^3.1.0" -"@material/dom@^1.1.0": - version "1.1.0" - resolved "https://registry.yarnpkg.com/@material/dom/-/dom-1.1.0.tgz#3bd3d1a3415b4181118fecb182d93beda56a6f8c" - integrity sha512-+HWW38ZaM2UBPu4+7QCusLDSf4tFT31rsEXHkTkxYSg/QpDivfPx6YDz4OmYtafmhPR1d1YjqB3MYysUHdodyw== +"@material/checkbox@^3.0.0": + version "3.1.0" + resolved "https://registry.yarnpkg.com/@material/checkbox/-/checkbox-3.1.0.tgz#bb8eadda0d260e75e8a7479418490eec846a8520" + integrity sha512-Rcv6Srj2p3MTsODPLJLgRzGW142ovQTKblkCy9AxABZriQUPRCV/fkJwB0LlqecHgubhnjhtj2Zui0o9jhfu/w== + dependencies: + "@material/animation" "^3.1.0" + "@material/base" "^3.1.0" + "@material/dom" "^3.1.0" + "@material/feature-targeting" "^3.1.0" + "@material/ripple" "^3.1.0" + "@material/rtl" "^3.1.0" + "@material/theme" "^3.1.0" + tslib "^1.9.3" + +"@material/dom@^3.1.0": + version "3.1.0" + resolved "https://registry.yarnpkg.com/@material/dom/-/dom-3.1.0.tgz#1e58cad0cd5e1d9d6f6cb07422e327ad34a9d405" + integrity sha512-RtBLSkrBjMfHwknaGBifAIC8cBWF9pXjz2IYqfI2braB6SfQI4vhdJviwyiA5BmA/psn3cKpBUZbHI0ym0O0SQ== dependencies: tslib "^1.9.3" -"@material/elevation@^1.1.0": - version "1.1.0" - resolved "https://registry.yarnpkg.com/@material/elevation/-/elevation-1.1.0.tgz#def23c360ae067b43c1632a331b9883b9f679cc5" - integrity sha512-m4eATJvDhWK1BT+yA1iHz5mhAk8cV9olC4mjVzm4PTAqhDH2yya4WzjN1HPVHE/a65ObyZ7V4qopxu9MRocm3A== +"@material/elevation@^3.1.0": + version "3.1.0" + resolved "https://registry.yarnpkg.com/@material/elevation/-/elevation-3.1.0.tgz#2fcbde47653cc115519a39acc2d04b34e4cff12b" + integrity sha512-e45LqiG6LfbR1M52YkSLA7pQPeYJOuOVzLp27xy2072TnLuJexMxhEaG4O1novEIjsTtMjqfrfJ/koODU5vEew== dependencies: - "@material/animation" "^1.0.0" - "@material/feature-targeting" "^0.44.1" - "@material/theme" "^1.1.0" + "@material/animation" "^3.1.0" + "@material/feature-targeting" "^3.1.0" + "@material/theme" "^3.1.0" -"@material/feature-targeting@^0.44.1": - version "0.44.1" - resolved "https://registry.yarnpkg.com/@material/feature-targeting/-/feature-targeting-0.44.1.tgz#afafc80294e5efab94bee31a187273d43d34979a" - integrity sha512-90cc7njn4aHbH9UxY8qgZth1W5JgOgcEdWdubH1t7sFkwqFxS5g3zgxSBt46TygFBVIXNZNq35Xmg80wgqO7Pg== - -"@material/mwc-base@^0.6.0": - version "0.6.0" - resolved "https://registry.yarnpkg.com/@material/mwc-base/-/mwc-base-0.6.0.tgz#2077b5f94c3d8fa2a65736b02c3d380314ea1154" - integrity sha512-AiMEoU3dkLhuEnK5HJ0yMrdcyq5rUq9LdooxOSLMzPRr/ALT8YS14/oklufYiPagehzJcL0MeiyL40OlSpkyBA== +"@material/fab@^3.0.0": + version "3.1.0" + resolved "https://registry.yarnpkg.com/@material/fab/-/fab-3.1.0.tgz#2ea42ee0e351b94f8ce2510bd292f7f9d05ef6eb" + integrity sha512-/mYsi9u/N7m9XlRR7tyCEh3WlYjrUqKS9FjxTdB08r6v04bTK5G7XTAtnvPrW47QCVWV0iL3FM2iwO0sVXqzZg== dependencies: - "@material/base" "^1.0.0" - lit-element "^2.0.1" + "@material/animation" "^3.1.0" + "@material/elevation" "^3.1.0" + "@material/feature-targeting" "^3.1.0" + "@material/ripple" "^3.1.0" + "@material/rtl" "^3.1.0" + "@material/shape" "^3.1.0" + "@material/theme" "^3.1.0" + "@material/typography" "^3.1.0" + +"@material/feature-targeting@^3.1.0": + version "3.1.0" + resolved "https://registry.yarnpkg.com/@material/feature-targeting/-/feature-targeting-3.1.0.tgz#a6f6cacd1e0c9b60dc82f2f3bb2de8cfd472252b" + integrity sha512-aXAa1Pv6w32URacE9LfMsl9zI6hFwx1K0Lp3Xpyf4rAkmaAB6z0gOkhicOrVFc0f64YheJgHjE7hJFieVenQdw== + +"@material/mwc-base@^0.8.0": + version "0.8.0" + resolved "https://registry.yarnpkg.com/@material/mwc-base/-/mwc-base-0.8.0.tgz#35b8c6e73feb9c262272f723ed0c271939997365" + integrity sha512-9qyC6eOKduzHaKmo6p5x53OAw2+mCB4t5roesqYiOUL8lJ8ZVssDczQvzSAKOcRd4JY8RyTgtpJFjBrScmWz8g== + dependencies: + "@material/base" "^3.0.0" + "@material/dom" "^3.1.0" + lit-element "^2.2.1" lit-html "^1.0.0" + tslib "^1.10.0" -"@material/mwc-button@^0.6.0": - version "0.6.0" - resolved "https://registry.yarnpkg.com/@material/mwc-button/-/mwc-button-0.6.0.tgz#5264623ab7bfc80cc0a118ae9188a2c69b4a8e8c" - integrity sha512-oZTXXtg5z7tqvbFN5gMWsya/OU1ThEQ8ZZ/KN4PzDHGoYcjGLWWYTyDtarfP2VfJn+pRL0Ql5+l3i8j1i4Vr8Q== +"@material/mwc-button@^0.8.0": + version "0.8.0" + resolved "https://registry.yarnpkg.com/@material/mwc-button/-/mwc-button-0.8.0.tgz#32576f27383e9f60c3eedfa1e0a3b6c6ab85529a" + integrity sha512-f4BelOfCFVlNJuNQuO9nImYv21STPg4iStrzG7N11ptACFj6TxuOR9ghT9xAHHIL26RIySGq/N+eAy9nuFynIQ== dependencies: - "@material/button" "^1.0.0" - "@material/mwc-base" "^0.6.0" - "@material/mwc-icon" "^0.6.0" - "@material/mwc-ripple" "^0.6.0" + "@material/button" "^3.0.0" + "@material/mwc-base" "^0.8.0" + "@material/mwc-icon" "^0.8.0" + "@material/mwc-ripple" "^0.8.0" + tslib "^1.10.0" -"@material/mwc-icon@^0.6.0": - version "0.6.0" - resolved "https://registry.yarnpkg.com/@material/mwc-icon/-/mwc-icon-0.6.0.tgz#67a71d95aa9a6d2379c5896673c2d0f1f2666e4e" - integrity sha512-Pm4nalbSfsgMz0K8dRaE2tBsyiCozrlgh9iEtBvRdYV6IzPJacXjqsf8+2faW3lfmh4PRLQzVJ7Fldm+ljxzBA== +"@material/mwc-checkbox@^0.8.0": + version "0.8.0" + resolved "https://registry.yarnpkg.com/@material/mwc-checkbox/-/mwc-checkbox-0.8.0.tgz#83105189c6fccca69e2342c27540bc23d910a15c" + integrity sha512-5qRfoON6FttQoAeTrzI00ODlO+k8dTAREKtZs4cpP3eM0KQqajS4ZaOJhtIa/ew/8XKoEShoSgRaEEtFbR91Fw== dependencies: - "@material/mwc-base" "^0.6.0" + "@material/checkbox" "^3.0.0" + "@material/mwc-base" "^0.8.0" + "@material/mwc-ripple" "^0.8.0" + tslib "^1.10.0" -"@material/mwc-ripple@^0.6.0": - version "0.6.0" - resolved "https://registry.yarnpkg.com/@material/mwc-ripple/-/mwc-ripple-0.6.0.tgz#602eb1855acd7e02d79398290ff223f9335976e3" - integrity sha512-K0b3VtKTlUd2RLaSJd6y9lBX47A84QjsK4eMn3PhDlWG7CkfhRf5XBZrOf/wzrqNf2/0w5of+8rFkohTraLHiw== +"@material/mwc-fab@^0.8.0": + version "0.8.0" + resolved "https://registry.yarnpkg.com/@material/mwc-fab/-/mwc-fab-0.8.0.tgz#8e9afac962789bd98e2417712092f1358f355531" + integrity sha512-IzRIYX9Xze9cc4CWGrz2Ncg9U5PmDTyKFVcHwGmyM0UQ2Il8gQxrpt7DxiDQT2gutKhlr+nHo71fQifk6Zi2mQ== dependencies: - "@material/mwc-base" "^0.6.0" - "@material/ripple" "^1.0.0" + "@material/fab" "^3.0.0" + "@material/mwc-base" "^0.8.0" + "@material/mwc-icon" "^0.8.0" + "@material/mwc-ripple" "^0.8.0" + tslib "^1.10.0" + +"@material/mwc-icon@^0.8.0": + version "0.8.0" + resolved "https://registry.yarnpkg.com/@material/mwc-icon/-/mwc-icon-0.8.0.tgz#6dd04def560f1147be1f6d1b0b45a26e1199a97c" + integrity sha512-jhSol1nV1KzxTXm82q16/Rzfy8epmfLehL2L0+mOCGvka4VUL/GJkjfbaKJMKwQWjXAgaOzHX7D9vVyr3EA5wg== + dependencies: + "@material/mwc-base" "^0.8.0" + tslib "^1.10.0" + +"@material/mwc-ripple@0.8.0", "@material/mwc-ripple@^0.8.0": + version "0.8.0" + resolved "https://registry.yarnpkg.com/@material/mwc-ripple/-/mwc-ripple-0.8.0.tgz#a18e43a087e4356de8740d082378d58a166aa93c" + integrity sha512-hJL+8xNunE+GUk+dtgeIVL9BJM5QPl5uyIufxzGEbVu+pmUfVDml+3HQLapO6Q5MQZMZpO4tDNwJNx9HOAo5KQ== + dependencies: + "@material/dom" "^3.1.0" + "@material/mwc-base" "^0.8.0" + "@material/ripple" "^3.0.0" lit-html "^1.0.0" + tslib "^1.10.0" -"@material/ripple@^1.0.0", "@material/ripple@^1.1.0": - version "1.1.0" - resolved "https://registry.yarnpkg.com/@material/ripple/-/ripple-1.1.0.tgz#236016fb30c8366faf143297df2c38166d84ffbc" - integrity sha512-mkfDBZAmxjpRG7V9TrfOmLxt1g/wvGHCXtYPgvH7W8ozjf53edqxLOFENEdvHbie27y9nyixzXn0gzU0HnxSeA== +"@material/ripple@^3.0.0", "@material/ripple@^3.1.0": + version "3.1.0" + resolved "https://registry.yarnpkg.com/@material/ripple/-/ripple-3.1.0.tgz#5cb581e9a70415c50c8b92ecd8628d5eeae34c74" + integrity sha512-mYvd2iWbQyVd6aLS9alHShoL05p/D0cvh5h1ga3atz55azooMLhGsbbE1YlEqUDKHKNuNvdVFm+0IfWdvvRgsw== dependencies: - "@material/animation" "^1.0.0" - "@material/base" "^1.0.0" - "@material/dom" "^1.1.0" - "@material/feature-targeting" "^0.44.1" - "@material/theme" "^1.1.0" + "@material/animation" "^3.1.0" + "@material/base" "^3.1.0" + "@material/dom" "^3.1.0" + "@material/feature-targeting" "^3.1.0" + "@material/theme" "^3.1.0" tslib "^1.9.3" -"@material/rtl@^0.42.0": - version "0.42.0" - resolved "https://registry.yarnpkg.com/@material/rtl/-/rtl-0.42.0.tgz#1836e78186c2d8b996f6fbf97adab203535335bc" - integrity sha512-VrnrKJzhmspsN8WXHuxxBZ69yM5IwhCUqWr1t1eNfw3ZEvEj7i1g3P31HGowKThIN1dc1Wh4LE14rCISWCtv5w== +"@material/rtl@^3.1.0": + version "3.1.0" + resolved "https://registry.yarnpkg.com/@material/rtl/-/rtl-3.1.0.tgz#8a5254bcf6c4d897e16206d52ba98b8eb98d45b7" + integrity sha512-HH19edQNb139zC+1SZ6/C9G92E54fUrnnW9AAF7t5eGjGdF26YJXJ/uhz+TnFhNUMi/QGrKUSycd4o73nU1m4A== -"@material/shape@^1.1.1": - version "1.1.1" - resolved "https://registry.yarnpkg.com/@material/shape/-/shape-1.1.1.tgz#7a5368694bc3555e69ea547950904b46fa1024bf" - integrity sha512-Jge/h1XBLjdLlam4QMSzVgM99e/N8+elQROPkltqVP7eyLc17BwM3aP5cLVfZDgrJgvsjUxbgAP1H1j8sqmUyg== +"@material/shape@^3.1.0": + version "3.1.0" + resolved "https://registry.yarnpkg.com/@material/shape/-/shape-3.1.0.tgz#7ccac6606d0ae45b779b3e52b8921c09c2b2f429" + integrity sha512-Oyvs7YjHfByA0e9IVVp7ojAlPwgSu3Bl0cioiE0OdkidkAaNu0izM2ryRzMBDH5o8+lRD0kpZoT+9CVVCdaYIg== dependencies: - "@material/feature-targeting" "^0.44.1" + "@material/feature-targeting" "^3.1.0" -"@material/theme@^1.1.0": - version "1.1.0" - resolved "https://registry.yarnpkg.com/@material/theme/-/theme-1.1.0.tgz#9c95dd804168c23c30589fcf09ecc5af5b3d1adc" - integrity sha512-YYUV9Rhbx4r/EMb/zoOYJUWjhXChNaLlH1rqt3vpNVyxRcxGqoVMGp5u1XALBCFiD9dACPKLIkKyRYa928nmPQ== +"@material/theme@^3.1.0": + version "3.1.0" + resolved "https://registry.yarnpkg.com/@material/theme/-/theme-3.1.0.tgz#d31147bbc9e20bdaa3e322c9e898e4fc98807d8c" + integrity sha512-N4JX+akOwg1faAvFvIEhDcwW4cZfUpwEn8lct6Vs3WczjLF6/KdIoLVaYh+eVl1bzfsoIuWvx56j0B1PjXZw9g== dependencies: - "@material/feature-targeting" "^0.44.1" + "@material/feature-targeting" "^3.1.0" -"@material/typography@^1.0.0": - version "1.0.0" - resolved "https://registry.yarnpkg.com/@material/typography/-/typography-1.0.0.tgz#327ecfcac5ee3af8a3a102f3f125a761202f4189" - integrity sha512-Oeqbjci1cC7jTE8/n3dwnkqKe9ZeWiaE+rgMtRYtRFw1HvAw14SpGA5EEAS/Li2Hu2KZ50FYCe3HYqShfxtChA== +"@material/typography@^3.1.0": + version "3.1.0" + resolved "https://registry.yarnpkg.com/@material/typography/-/typography-3.1.0.tgz#5a3aee31f49f6b8c87ebc91b77c5b896b280c492" + integrity sha512-aSNBQvVxIH1kORSYdLGuSTivx6oJ1MSOSTUAsUwhXPQLQlvbdFeZaqUp7xgn+EvRsHGRFhWk5YGuiBds9+7zQg== dependencies: - "@material/feature-targeting" "^0.44.1" + "@material/feature-targeting" "^3.1.0" "@mdi/svg@4.3.95": version "4.3.95" @@ -8590,10 +8645,10 @@ listr@^0.14.2: p-map "^2.0.0" rxjs "^6.3.3" -lit-element@^2.0.1, lit-element@^2.2.0: - version "2.2.0" - resolved "https://registry.yarnpkg.com/lit-element/-/lit-element-2.2.0.tgz#e853be38021f0c7743a10180affdf84b8a02400c" - integrity sha512-Mzs3H7IO4wAnpzqreHw6dQqp9IG+h/oN8X9pgNbMZbE7x6B0aNOwP5Nveox/5HE+65ZfW2PeULEjoHkrwpTnuQ== +lit-element@^2.2.1: + version "2.2.1" + resolved "https://registry.yarnpkg.com/lit-element/-/lit-element-2.2.1.tgz#79c94d8cfdc2d73b245656e37991bd1e4811d96f" + integrity sha512-ipDcgQ1EpW6Va2Z6dWm79jYdimVepO5GL0eYkZrFvdr0OD/1N260Q9DH+K5HXHFrRoC7dOg+ZpED2XE0TgGdXw== dependencies: lit-html "^1.0.0" From fe31f532b66e0571d329e00e09380714de5eb3af Mon Sep 17 00:00:00 2001 From: Paulus Schoutsen Date: Sun, 8 Sep 2019 23:38:58 -0700 Subject: [PATCH 07/26] Update ESLint (#3664) --- hassio/src/ansi-to-html.js | 4 +- package.json | 14 +- src/cards/ha-history_graph-card.js | 13 +- src/components/entity/ha-chart-base.js | 5 +- src/data/ha-state-history-data.js | 2 +- .../more-info/controls/more-info-group.js | 7 +- src/dialogs/more-info/more-info-controls.js | 5 +- src/entrypoints/service-worker-hass.js | 6 +- .../customize/ha-customize-attribute.js | 6 +- .../config/customize/ha-form-customize.js | 20 +- .../service/developer-tools-service.js | 6 +- .../lovelace/cards/hui-history-graph-card.js | 4 +- yarn.lock | 272 ++++++++++++------ 13 files changed, 221 insertions(+), 143 deletions(-) diff --git a/hassio/src/ansi-to-html.js b/hassio/src/ansi-to-html.js index d9ab04a690..438873127c 100644 --- a/hassio/src/ansi-to-html.js +++ b/hassio/src/ansi-to-html.js @@ -102,7 +102,7 @@ export function parseTextToColoredPre(text) { if (match[1] === undefined) continue; - for (const colorCode of match[1].split(";")) { + match[1].split(";").forEach((colorCode) => { switch (parseInt(colorCode)) { case 0: // reset @@ -195,7 +195,7 @@ export function parseTextToColoredPre(text) { state.backgroundColor = null; break; } - } + }); } addSpan(text.substring(i)); diff --git a/package.json b/package.json index e24dd98503..d7490e5ff1 100644 --- a/package.json +++ b/package.json @@ -128,13 +128,13 @@ "compression-webpack-plugin": "^2.0.0", "copy-webpack-plugin": "^5.0.2", "del": "^4.0.0", - "eslint": "^5.15.3", - "eslint-config-airbnb-base": "^13.1.0", - "eslint-config-prettier": "^4.1.0", - "eslint-import-resolver-webpack": "^0.11.0", - "eslint-plugin-import": "^2.16.0", - "eslint-plugin-prettier": "^3.0.1", - "eslint-plugin-react": "^7.12.4", + "eslint": "^6.3.0", + "eslint-config-airbnb-base": "^14.0.0", + "eslint-config-prettier": "^6.2.0", + "eslint-import-resolver-webpack": "^0.11.1", + "eslint-plugin-import": "^2.18.2", + "eslint-plugin-prettier": "^3.1.0", + "eslint-plugin-react": "^7.14.3", "fs-extra": "^7.0.1", "gulp": "^4.0.0", "gulp-foreach": "^0.1.0", diff --git a/src/cards/ha-history_graph-card.js b/src/cards/ha-history_graph-card.js index db594d5617..5685c23515 100644 --- a/src/cards/ha-history_graph-card.js +++ b/src/cards/ha-history_graph-card.js @@ -97,14 +97,11 @@ class HaHistoryGraphCard extends EventsMixin(PolymerElement) { this.cacheConfig.refresh !== (stateObj.attributes.refresh || 0) || this.cacheConfig.hoursToShow !== (stateObj.attributes.hours_to_show || 24) ) { - this.cacheConfig = Object.assign( - {}, - { - refresh: stateObj.attributes.refresh || 0, - cacheKey: stateObj.entity_id, - hoursToShow: stateObj.attributes.hours_to_show || 24, - } - ); + this.cacheConfig = { + refresh: stateObj.attributes.refresh || 0, + cacheKey: stateObj.entity_id, + hoursToShow: stateObj.attributes.hours_to_show || 24, + }; } } diff --git a/src/components/entity/ha-chart-base.js b/src/components/entity/ha-chart-base.js index 7d0a45d4b4..2621feee3e 100644 --- a/src/components/entity/ha-chart-base.js +++ b/src/components/entity/ha-chart-base.js @@ -287,11 +287,12 @@ class HaChartBase extends mixinBehaviors( } positionX += this._chart.canvas.offsetLeft; // Display, position, and set styles for font - this.tooltip = Object.assign({}, this.tooltip, { + this.tooltip = { + ...this.tooltip, opacity: 1, left: `${positionX}px`, top: `${positionY}px`, - }); + }; } _legendClick(event) { diff --git a/src/data/ha-state-history-data.js b/src/data/ha-state-history-data.js index bd97a759b2..f4b8a449f1 100644 --- a/src/data/ha-state-history-data.js +++ b/src/data/ha-state-history-data.js @@ -163,7 +163,7 @@ class HaStateHistoryData extends LocalizeMixin(PolymerElement) { localize, language ).then((stateHistory) => { - this._setData(Object.assign({}, stateHistory)); + this._setData({ ...stateHistory }); }); }, cacheConfig.refresh * 1000); } diff --git a/src/dialogs/more-info/controls/more-info-group.js b/src/dialogs/more-info/controls/more-info-group.js index be2b086650..f9f3632c84 100644 --- a/src/dialogs/more-info/controls/more-info-group.js +++ b/src/dialogs/more-info/controls/more-info-group.js @@ -79,10 +79,11 @@ class MoreInfoGroup extends PolymerElement { // Groups need to be filtered out or we'll show content of // first child above the children of the current group if (groupDomain !== "group") { - groupDomainStateObj = Object.assign({}, baseStateObj, { + groupDomainStateObj = { + ...baseStateObj, entity_id: stateObj.entity_id, - attributes: Object.assign({}, baseStateObj.attributes), - }); + attributes: { ...baseStateObj.attributes }, + }; for (let i = 0; i < states.length; i++) { if (groupDomain !== computeStateDomain(states[i])) { diff --git a/src/dialogs/more-info/more-info-controls.js b/src/dialogs/more-info/more-info-controls.js index 849a4a1452..faf50be95a 100644 --- a/src/dialogs/more-info/more-info-controls.js +++ b/src/dialogs/more-info/more-info-controls.js @@ -193,9 +193,10 @@ class MoreInfoControls extends EventsMixin(PolymerElement) { } if (this._cacheConfig.cacheKey !== `more_info.${newVal.entity_id}`) { - this._cacheConfig = Object.assign({}, this._cacheConfig, { + this._cacheConfig = { + ...this._cacheConfig, cacheKey: `more_info.${newVal.entity_id}`, - }); + }; } } diff --git a/src/entrypoints/service-worker-hass.js b/src/entrypoints/service-worker-hass.js index 8a0225d17b..45f37aa92d 100644 --- a/src/entrypoints/service-worker-hass.js +++ b/src/entrypoints/service-worker-hass.js @@ -80,11 +80,7 @@ function initPushNotifications() { event.waitUntil( self.registration .getNotifications({ tag: data.tag }) - .then(function(notifications) { - for (const n of notifications) { - n.close(); - } - }) + .then((notifications) => notifications.forEach((n) => n.close())) ); return; } diff --git a/src/panels/config/customize/ha-customize-attribute.js b/src/panels/config/customize/ha-customize-attribute.js index 832c9442cb..fdfc7f9dad 100644 --- a/src/panels/config/customize/ha-customize-attribute.js +++ b/src/panels/config/customize/ha-customize-attribute.js @@ -48,9 +48,9 @@ class HaCustomizeAttribute extends PolymerElement { tapButton() { if (this.item.secondary) { - this.item = Object.assign({}, this.item, { secondary: false }); + this.item = { ...this.item, secondary: false }; } else { - this.item = Object.assign({}, this.item, { closed: true }); + this.item = { ...this.item, closed: true }; } } @@ -73,7 +73,7 @@ class HaCustomizeAttribute extends PolymerElement { this.$.child = child = document.createElement(tag.toLowerCase()); child.className = "form-control"; child.addEventListener("item-changed", () => { - this.item = Object.assign({}, child.item); + this.item = { ...child.item }; }); } child.setProperties({ item: this.item }); diff --git a/src/panels/config/customize/ha-form-customize.js b/src/panels/config/customize/ha-form-customize.js index 4e9a2763ed..865fcb1fda 100644 --- a/src/panels/config/customize/ha-form-customize.js +++ b/src/panels/config/customize/ha-form-customize.js @@ -141,17 +141,15 @@ class HaFormCustomize extends PolymerElement { } _initOpenObject(key, value, secondary, config) { - return Object.assign( - { - attribute: key, - value: value, - closed: false, - domain: computeStateDomain(this.entity), - secondary: secondary, - description: key, - }, - config - ); + return { + attribute: key, + value: value, + closed: false, + domain: computeStateDomain(this.entity), + secondary: secondary, + description: key, + ...config, + }; } loadEntity(entity) { diff --git a/src/panels/developer-tools/service/developer-tools-service.js b/src/panels/developer-tools/service/developer-tools-service.js index 450e8b291d..59f14a119e 100644 --- a/src/panels/developer-tools/service/developer-tools-service.js +++ b/src/panels/developer-tools/service/developer-tools-service.js @@ -224,7 +224,7 @@ class HaPanelDevService extends PolymerElement { const fields = serviceDomains[domain][service].fields; return Object.keys(fields).map(function(field) { - return Object.assign({ key: field }, fields[field]); + return { key: field, ...fields[field] }; }); } @@ -282,9 +282,9 @@ class HaPanelDevService extends PolymerElement { _fillExampleData() { const example = {}; - for (const attribute of this._attributes) { + this._attributes.forEach((attribute) => { example[attribute.key] = attribute.example; - } + }); this.serviceData = JSON.stringify(example, null, 2); } diff --git a/src/panels/lovelace/cards/hui-history-graph-card.js b/src/panels/lovelace/cards/hui-history-graph-card.js index 50e74828a6..129d83d1a7 100644 --- a/src/panels/lovelace/cards/hui-history-graph-card.js +++ b/src/panels/lovelace/cards/hui-history-graph-card.js @@ -70,12 +70,12 @@ class HuiHistoryGraphCard extends PolymerElement { const _entities = []; const _names = {}; - for (const entity of entities) { + entities.forEach((entity) => { _entities.push(entity.entity); if (entity.name) { _names[entity.entity] = entity.name; } - } + }); this.setProperties({ _cacheConfig: { diff --git a/yarn.lock b/yarn.lock index 8a4a58a039..be74dac0f2 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2490,10 +2490,10 @@ acorn-jsx@^3.0.0: dependencies: acorn "^3.0.4" -acorn-jsx@^5.0.0: - version "5.0.1" - resolved "https://registry.yarnpkg.com/acorn-jsx/-/acorn-jsx-5.0.1.tgz#32a064fd925429216a09b141102bfdd185fae40e" - integrity sha512-HJ7CfNHrfJLlNTzIEUTj43LNWGkqpRLxm3YjAlcD0ACydk9XynzYsCBHxut+iqt+1aBXkx9UP/w/ZqMr13XIzg== +acorn-jsx@^5.0.2: + version "5.0.2" + resolved "https://registry.yarnpkg.com/acorn-jsx/-/acorn-jsx-5.0.2.tgz#84b68ea44b373c4f8686023a551f61a21b7c4a4f" + integrity sha512-tiNTrP1MP0QrChmD2DdupCr6HWSFeKVw5d/dHTu4Y7rkAkRhU/Dt7dphAfIUyxtHpl/eBVip5uTNSpQJHylpAw== acorn@^3.0.4: version "3.3.0" @@ -2505,11 +2505,16 @@ acorn@^5.5.0, acorn@^5.5.3: resolved "https://registry.yarnpkg.com/acorn/-/acorn-5.7.3.tgz#67aa231bf8812974b85235a96771eb6bd07ea279" integrity sha512-T/zvzYRfbVojPWahDsE5evJdHb3oJoQfFbsrKM7w5Zcs++Tr257tia3BmMP8XYVjp1S9RZXQMh7gao96BlqZOw== -acorn@^6.0.5, acorn@^6.0.7, acorn@^6.1.1: +acorn@^6.0.5, acorn@^6.1.1: version "6.1.1" resolved "https://registry.yarnpkg.com/acorn/-/acorn-6.1.1.tgz#7d25ae05bb8ad1f9b699108e1094ecd7884adc1f" integrity sha512-jPTiwtOxaHNaAPg/dmrJ/beuzLRnXtB0kQPQ8JpotKJgTB6rX6c8mlf315941pyjBSaPg8NHXS9fhP4u17DpGA== +acorn@^7.0.0: + version "7.0.0" + resolved "https://registry.yarnpkg.com/acorn/-/acorn-7.0.0.tgz#26b8d1cd9a9b700350b71c0905546f64d1284e7a" + integrity sha512-PaF/MduxijYYt7unVGRuds1vBC9bFxbNf+VWqhOClfdgy7RlVkQqt610ig1/yxTgsDIfW1cWDel5EBbOy3jdtQ== + adm-zip@~0.4.3: version "0.4.13" resolved "https://registry.yarnpkg.com/adm-zip/-/adm-zip-0.4.13.tgz#597e2f8cc3672151e1307d3e95cddbc75672314a" @@ -2547,6 +2552,16 @@ ajv@^6.1.0, ajv@^6.5.5, ajv@^6.9.1: json-schema-traverse "^0.4.1" uri-js "^4.2.2" +ajv@^6.10.0: + version "6.10.2" + resolved "https://registry.yarnpkg.com/ajv/-/ajv-6.10.2.tgz#d3cea04d6b017b2894ad69040fec8b623eb4bd52" + integrity sha512-TXtUUEYHuaTEbLZWIKUr5pmBuhDLy+8KYtPYdcV8qC+pOZL+NKqYwvWSRrVXHn+ZmRRAu8vJTAznH7Oag6RVRw== + dependencies: + fast-deep-equal "^2.0.1" + fast-json-stable-stringify "^2.0.0" + json-schema-traverse "^0.4.1" + uri-js "^4.2.2" + ansi-align@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/ansi-align/-/ansi-align-1.1.0.tgz#2f0c1658829739add5ebb15e6b0c6e3423f016ba" @@ -4516,6 +4531,11 @@ configstore@^3.0.0: write-file-atomic "^2.0.0" xdg-basedir "^3.0.0" +confusing-browser-globals@^1.0.7: + version "1.0.8" + resolved "https://registry.yarnpkg.com/confusing-browser-globals/-/confusing-browser-globals-1.0.8.tgz#93ffec1f82a6e2bf2bc36769cc3a92fa20e502f3" + integrity sha512-lI7asCibVJ6Qd3FGU7mu4sfG4try4LX3+GVS+Gv8UlrEf2AeW57piecapnog2UHZSbcX/P/1UDWVaTsblowlZg== + connect-history-api-fallback@^1.3.0: version "1.6.0" resolved "https://registry.yarnpkg.com/connect-history-api-fallback/-/connect-history-api-fallback-1.6.0.tgz#8b32089359308d111115d81cad3fceab888f97bc" @@ -5657,19 +5677,19 @@ escape-string-regexp@1.0.5, escape-string-regexp@^1.0.0, escape-string-regexp@^1 resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz#1b61c0562190a8dff6ae3bb2cf0200ca130b86d4" integrity sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ= -eslint-config-airbnb-base@^13.1.0: - version "13.1.0" - resolved "https://registry.yarnpkg.com/eslint-config-airbnb-base/-/eslint-config-airbnb-base-13.1.0.tgz#b5a1b480b80dfad16433d6c4ad84e6605052c05c" - integrity sha512-XWwQtf3U3zIoKO1BbHh6aUhJZQweOwSt4c2JrPDg9FP3Ltv3+YfEv7jIDB8275tVnO/qOHbfuYg3kzw6Je7uWw== +eslint-config-airbnb-base@^14.0.0: + version "14.0.0" + resolved "https://registry.yarnpkg.com/eslint-config-airbnb-base/-/eslint-config-airbnb-base-14.0.0.tgz#8a7bcb9643d13c55df4dd7444f138bf4efa61e17" + integrity sha512-2IDHobw97upExLmsebhtfoD3NAKhV4H0CJWP3Uprd/uk+cHuWYOczPVxQ8PxLFUAw7o3Th1RAU8u1DoUpr+cMA== dependencies: - eslint-restricted-globals "^0.1.1" + confusing-browser-globals "^1.0.7" object.assign "^4.1.0" - object.entries "^1.0.4" + object.entries "^1.1.0" -eslint-config-prettier@^4.1.0: - version "4.1.0" - resolved "https://registry.yarnpkg.com/eslint-config-prettier/-/eslint-config-prettier-4.1.0.tgz#181364895899fff9fd3605fecb5c4f20e7d5f395" - integrity sha512-zILwX9/Ocz4SV2vX7ox85AsrAgXV3f2o2gpIicdMIOra48WYqgUnWNH/cR/iHtmD2Vb3dLSC3LiEJnS05Gkw7w== +eslint-config-prettier@^6.2.0: + version "6.2.0" + resolved "https://registry.yarnpkg.com/eslint-config-prettier/-/eslint-config-prettier-6.2.0.tgz#80e0b8714e3f6868c4ac2a25fbf39c02e73527a7" + integrity sha512-VLsgK/D+S/FEsda7Um1+N8FThec6LqE3vhcMyp8mlmto97y3fGf3DX7byJexGuOb1QY0Z/zz222U5t+xSfcZDQ== dependencies: get-stdin "^6.0.0" @@ -5681,10 +5701,10 @@ eslint-import-resolver-node@^0.3.2: debug "^2.6.9" resolve "^1.5.0" -eslint-import-resolver-webpack@^0.11.0: - version "0.11.0" - resolved "https://registry.yarnpkg.com/eslint-import-resolver-webpack/-/eslint-import-resolver-webpack-0.11.0.tgz#75d08ee06fc55eb24bd75147b7b4b6756886b12f" - integrity sha512-vX8rYSPdKtTLkK2FoU1ZRyEsl6wP1FB40ytjrEgMhzUkEkBLuZAkv1KNR+2Ml7lzMOObXI3yaEDiaQ/Yvoczhw== +eslint-import-resolver-webpack@^0.11.1: + version "0.11.1" + resolved "https://registry.yarnpkg.com/eslint-import-resolver-webpack/-/eslint-import-resolver-webpack-0.11.1.tgz#fcf1fd57a775f51e18f442915f85dd6ba45d2f26" + integrity sha512-eK3zR7xVQR/MaoBWwGuD+CULYVuqe5QFlDukman71aI6IboCGzggDUohHNfu1ZeBnbHcUHJc0ywWoXUBNB6qdg== dependencies: array-find "^1.0.0" debug "^2.6.8" @@ -5694,32 +5714,33 @@ eslint-import-resolver-webpack@^0.11.0: interpret "^1.0.0" lodash "^4.17.4" node-libs-browser "^1.0.0 || ^2.0.0" - resolve "^1.4.0" + resolve "^1.10.0" semver "^5.3.0" -eslint-module-utils@^2.3.0: - version "2.3.0" - resolved "https://registry.yarnpkg.com/eslint-module-utils/-/eslint-module-utils-2.3.0.tgz#546178dab5e046c8b562bbb50705e2456d7bda49" - integrity sha512-lmDJgeOOjk8hObTysjqH7wyMi+nsHwwvfBykwfhjR1LNdd7C2uFJBvx4OpWYpXOw4df1yE1cDEVd1yLHitk34w== +eslint-module-utils@^2.4.0: + version "2.4.1" + resolved "https://registry.yarnpkg.com/eslint-module-utils/-/eslint-module-utils-2.4.1.tgz#7b4675875bf96b0dbf1b21977456e5bb1f5e018c" + integrity sha512-H6DOj+ejw7Tesdgbfs4jeS4YMFrT8uI8xwd1gtQqXssaR0EQ26L+2O/w6wkYFy2MymON0fTwHmXBvvfLNZVZEw== dependencies: debug "^2.6.8" pkg-dir "^2.0.0" -eslint-plugin-import@^2.16.0: - version "2.16.0" - resolved "https://registry.yarnpkg.com/eslint-plugin-import/-/eslint-plugin-import-2.16.0.tgz#97ac3e75d0791c4fac0e15ef388510217be7f66f" - integrity sha512-z6oqWlf1x5GkHIFgrSvtmudnqM6Q60KM4KvpWi5ubonMjycLjndvd5+8VAZIsTlHC03djdgJuyKG6XO577px6A== +eslint-plugin-import@^2.18.2: + version "2.18.2" + resolved "https://registry.yarnpkg.com/eslint-plugin-import/-/eslint-plugin-import-2.18.2.tgz#02f1180b90b077b33d447a17a2326ceb400aceb6" + integrity sha512-5ohpsHAiUBRNaBWAF08izwUGlbrJoJJ+W9/TBwsGoR1MnlgfwMIKrFeSjWbt6moabiXW9xNvtFz+97KHRfI4HQ== dependencies: + array-includes "^3.0.3" contains-path "^0.1.0" debug "^2.6.9" doctrine "1.5.0" eslint-import-resolver-node "^0.3.2" - eslint-module-utils "^2.3.0" + eslint-module-utils "^2.4.0" has "^1.0.3" - lodash "^4.17.11" minimatch "^3.0.4" + object.values "^1.1.0" read-pkg-up "^2.0.0" - resolve "^1.9.0" + resolve "^1.11.0" eslint-plugin-prettier@^2.2.0: version "2.7.0" @@ -5729,30 +5750,27 @@ eslint-plugin-prettier@^2.2.0: fast-diff "^1.1.1" jest-docblock "^21.0.0" -eslint-plugin-prettier@^3.0.1: - version "3.0.1" - resolved "https://registry.yarnpkg.com/eslint-plugin-prettier/-/eslint-plugin-prettier-3.0.1.tgz#19d521e3981f69dd6d14f64aec8c6a6ac6eb0b0d" - integrity sha512-/PMttrarPAY78PLvV3xfWibMOdMDl57hmlQ2XqFeA37wd+CJ7WSxV7txqjVPHi/AAFKd2lX0ZqfsOc/i5yFCSQ== +eslint-plugin-prettier@^3.1.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/eslint-plugin-prettier/-/eslint-plugin-prettier-3.1.0.tgz#8695188f95daa93b0dc54b249347ca3b79c4686d" + integrity sha512-XWX2yVuwVNLOUhQijAkXz+rMPPoCr7WFiAl8ig6I7Xn+pPVhDhzg4DxHpmbeb0iqjO9UronEA3Tb09ChnFVHHA== dependencies: prettier-linter-helpers "^1.0.0" -eslint-plugin-react@^7.12.4: - version "7.12.4" - resolved "https://registry.yarnpkg.com/eslint-plugin-react/-/eslint-plugin-react-7.12.4.tgz#b1ecf26479d61aee650da612e425c53a99f48c8c" - integrity sha512-1puHJkXJY+oS1t467MjbqjvX53uQ05HXwjqDgdbGBqf5j9eeydI54G3KwiJmWciQ0HTBacIKw2jgwSBSH3yfgQ== +eslint-plugin-react@^7.14.3: + version "7.14.3" + resolved "https://registry.yarnpkg.com/eslint-plugin-react/-/eslint-plugin-react-7.14.3.tgz#911030dd7e98ba49e1b2208599571846a66bdf13" + integrity sha512-EzdyyBWC4Uz2hPYBiEJrKCUi2Fn+BJ9B/pJQcjw5X+x/H2Nm59S4MJIvL4O5NEE0+WbnQwEBxWY03oUk+Bc3FA== dependencies: array-includes "^3.0.3" doctrine "^2.1.0" has "^1.0.3" - jsx-ast-utils "^2.0.1" + jsx-ast-utils "^2.1.0" + object.entries "^1.1.0" object.fromentries "^2.0.0" - prop-types "^15.6.2" - resolve "^1.9.0" - -eslint-restricted-globals@^0.1.1: - version "0.1.1" - resolved "https://registry.yarnpkg.com/eslint-restricted-globals/-/eslint-restricted-globals-0.1.1.tgz#35f0d5cbc64c2e3ed62e93b4b1a7af05ba7ed4d7" - integrity sha1-NfDVy8ZMLj7WLpO0saevBbp+1Nc= + object.values "^1.1.0" + prop-types "^15.7.2" + resolve "^1.10.1" eslint-scope@3.7.1: version "3.7.1" @@ -5762,7 +5780,7 @@ eslint-scope@3.7.1: esrecurse "^4.1.0" estraverse "^4.1.1" -eslint-scope@^4.0.0, eslint-scope@^4.0.3: +eslint-scope@^4.0.0: version "4.0.3" resolved "https://registry.yarnpkg.com/eslint-scope/-/eslint-scope-4.0.3.tgz#ca03833310f6889a3264781aa82e63eb9cfe7848" integrity sha512-p7VutNr1O/QrxysMo3E45FjYDTeXBy0iTltPFNSqKAIfjDSXC+4dj+qfyuD8bfAXrW/y6lW3O76VaYNPKfpKrg== @@ -5770,59 +5788,68 @@ eslint-scope@^4.0.0, eslint-scope@^4.0.3: esrecurse "^4.1.0" estraverse "^4.1.1" -eslint-utils@^1.3.1: +eslint-scope@^5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/eslint-scope/-/eslint-scope-5.0.0.tgz#e87c8887c73e8d1ec84f1ca591645c358bfc8fb9" + integrity sha512-oYrhJW7S0bxAFDvWqzvMPRm6pcgcnWc4QnofCAqRTRfQC0JcwenzGglTtsLyIuuWFfkqDG9vz67cnttSd53djw== + dependencies: + esrecurse "^4.1.0" + estraverse "^4.1.1" + +eslint-utils@^1.4.2: version "1.4.2" resolved "https://registry.yarnpkg.com/eslint-utils/-/eslint-utils-1.4.2.tgz#166a5180ef6ab7eb462f162fd0e6f2463d7309ab" integrity sha512-eAZS2sEUMlIeCjBeubdj45dmBHQwPHWyBcT1VSYB7o9x9WRRqKxyUoiXlRjyAwzN7YEzHJlYg0NmzDRWx6GP4Q== dependencies: eslint-visitor-keys "^1.0.0" -eslint-visitor-keys@^1.0.0: +eslint-visitor-keys@^1.0.0, eslint-visitor-keys@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-1.1.0.tgz#e2a82cea84ff246ad6fb57f9bde5b46621459ec2" integrity sha512-8y9YjtM1JBJU/A9Kc+SbaOV4y29sSWckBwMHa+FGtVj5gN/sbnKDf6xJUl+8g7FAij9LVaP8C24DUiH/f/2Z9A== -eslint@^5.15.3: - version "5.15.3" - resolved "https://registry.yarnpkg.com/eslint/-/eslint-5.15.3.tgz#c79c3909dc8a7fa3714fb340c11e30fd2526b8b5" - integrity sha512-vMGi0PjCHSokZxE0NLp2VneGw5sio7SSiDNgIUn2tC0XkWJRNOIoHIg3CliLVfXnJsiHxGAYrkw0PieAu8+KYQ== +eslint@^6.3.0: + version "6.3.0" + resolved "https://registry.yarnpkg.com/eslint/-/eslint-6.3.0.tgz#1f1a902f67bfd4c354e7288b81e40654d927eb6a" + integrity sha512-ZvZTKaqDue+N8Y9g0kp6UPZtS4FSY3qARxBs7p4f0H0iof381XHduqVerFWtK8DPtKmemqbqCFENWSQgPR/Gow== dependencies: "@babel/code-frame" "^7.0.0" - ajv "^6.9.1" + ajv "^6.10.0" chalk "^2.1.0" cross-spawn "^6.0.5" debug "^4.0.1" doctrine "^3.0.0" - eslint-scope "^4.0.3" - eslint-utils "^1.3.1" - eslint-visitor-keys "^1.0.0" - espree "^5.0.1" + eslint-scope "^5.0.0" + eslint-utils "^1.4.2" + eslint-visitor-keys "^1.1.0" + espree "^6.1.1" esquery "^1.0.1" esutils "^2.0.2" file-entry-cache "^5.0.1" functional-red-black-tree "^1.0.1" - glob "^7.1.2" + glob-parent "^5.0.0" globals "^11.7.0" ignore "^4.0.6" import-fresh "^3.0.0" imurmurhash "^0.1.4" - inquirer "^6.2.2" - js-yaml "^3.12.0" + inquirer "^6.4.1" + is-glob "^4.0.0" + js-yaml "^3.13.1" json-stable-stringify-without-jsonify "^1.0.1" levn "^0.3.0" - lodash "^4.17.11" + lodash "^4.17.14" minimatch "^3.0.4" mkdirp "^0.5.1" natural-compare "^1.4.0" optionator "^0.8.2" - path-is-inside "^1.0.2" progress "^2.0.0" regexpp "^2.0.1" - semver "^5.5.1" - strip-ansi "^4.0.0" - strip-json-comments "^2.0.1" + semver "^6.1.2" + strip-ansi "^5.2.0" + strip-json-comments "^3.0.1" table "^5.2.3" text-table "^0.2.0" + v8-compile-cache "^2.0.3" espree@^3.5.2: version "3.5.4" @@ -5832,14 +5859,14 @@ espree@^3.5.2: acorn "^5.5.0" acorn-jsx "^3.0.0" -espree@^5.0.1: - version "5.0.1" - resolved "https://registry.yarnpkg.com/espree/-/espree-5.0.1.tgz#5d6526fa4fc7f0788a5cf75b15f30323e2f81f7a" - integrity sha512-qWAZcWh4XE/RwzLJejfcofscgMc9CamR6Tn1+XRXNzrvUSSbiAjGOI/fggztjIi7y9VLPqnICMIPiGyr8JaZ0A== +espree@^6.1.1: + version "6.1.1" + resolved "https://registry.yarnpkg.com/espree/-/espree-6.1.1.tgz#7f80e5f7257fc47db450022d723e356daeb1e5de" + integrity sha512-EYbr8XZUhWbYCqQRW0duU5LxzL5bETN6AjKBGy1302qqzPaCH10QbRg3Wvco79Z8x9WbiE8HYB4e75xl6qUYvQ== dependencies: - acorn "^6.0.7" - acorn-jsx "^5.0.0" - eslint-visitor-keys "^1.0.0" + acorn "^7.0.0" + acorn-jsx "^5.0.2" + eslint-visitor-keys "^1.1.0" esprima@^4.0.0: version "4.0.1" @@ -6715,6 +6742,13 @@ glob-parent@^3.0.0, glob-parent@^3.1.0: is-glob "^3.1.0" path-dirname "^1.0.0" +glob-parent@^5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/glob-parent/-/glob-parent-5.0.0.tgz#1dc99f0f39b006d3e92c2c284068382f0c20e954" + integrity sha512-Z2RwiujPRGluePM6j699ktJYxmPpJKCfpGA13jz2hmFZC7gKetzrWvg5KN3+OsIFmydGyZ1AVwERCq1w/ZZwRg== + dependencies: + is-glob "^4.0.1" + glob-stream@^5.3.2: version "5.3.5" resolved "https://registry.yarnpkg.com/glob-stream/-/glob-stream-5.3.5.tgz#a55665a9a8ccdc41915a87c701e32d4e016fad22" @@ -7692,7 +7726,7 @@ inquirer@^1.0.2: strip-ansi "^3.0.0" through "^2.3.6" -inquirer@^6.0.0, inquirer@^6.2.2: +inquirer@^6.0.0: version "6.2.2" resolved "https://registry.yarnpkg.com/inquirer/-/inquirer-6.2.2.tgz#46941176f65c9eb20804627149b743a218f25406" integrity sha512-Z2rREiXA6cHRR9KBOarR3WuLlFzlIfAEIiB45ll5SSadMg7WqOh1MKEjjndfuH5ewXdixWCxqnVfGOQzPeiztA== @@ -7711,6 +7745,25 @@ inquirer@^6.0.0, inquirer@^6.2.2: strip-ansi "^5.0.0" through "^2.3.6" +inquirer@^6.4.1: + version "6.5.2" + resolved "https://registry.yarnpkg.com/inquirer/-/inquirer-6.5.2.tgz#ad50942375d036d327ff528c08bd5fab089928ca" + integrity sha512-cntlB5ghuB0iuO65Ovoi8ogLHiWGs/5yNrtUcKjFhSSiVeAIVpD7koaSU9RM8mpXw5YDi9RdYXGQMaOURB7ycQ== + dependencies: + ansi-escapes "^3.2.0" + chalk "^2.4.2" + cli-cursor "^2.1.0" + cli-width "^2.0.0" + external-editor "^3.0.3" + figures "^2.0.0" + lodash "^4.17.12" + mute-stream "0.0.7" + run-async "^2.2.0" + rxjs "^6.4.0" + string-width "^2.1.0" + strip-ansi "^5.1.0" + through "^2.3.6" + internal-ip@^4.2.0: version "4.2.0" resolved "https://registry.yarnpkg.com/internal-ip/-/internal-ip-4.2.0.tgz#46e81b638d84c338e5c67e42b1a17db67d0814fa" @@ -7968,7 +8021,7 @@ is-glob@^3.1.0: dependencies: is-extglob "^2.1.0" -is-glob@^4.0.0: +is-glob@^4.0.0, is-glob@^4.0.1: version "4.0.1" resolved "https://registry.yarnpkg.com/is-glob/-/is-glob-4.0.1.tgz#7567dbe9f2f5e2467bc77ab83c4a29482407a5dc" integrity sha512-5G0tKtBTFImOqDnLB2hG6Bp2qcKEFduo4tZu9MT/H6NQv/ghhy30o55ufafxJ/LdH79LLs2Kfrn85TLKyA7BUg== @@ -8297,7 +8350,7 @@ js-yaml@3.12.0: argparse "^1.0.7" esprima "^4.0.0" -js-yaml@^3.12.0, js-yaml@^3.13.0, js-yaml@^3.13.1, js-yaml@^3.7.0: +js-yaml@^3.13.0, js-yaml@^3.13.1, js-yaml@^3.7.0: version "3.13.1" resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-3.13.1.tgz#aff151b30bfdfa8e49e05da22e7415e9dfa37847" integrity sha512-YfbcO7jXDdyj0DGxYVSlSeQNHbD7XPWvrVWeVUujrQEoZzWJIRrCPoyk6kL6IAjAG2IolMK4T0hNUe0HOUs5Jw== @@ -8413,12 +8466,13 @@ jsprim@^1.2.2: json-schema "0.2.3" verror "1.10.0" -jsx-ast-utils@^2.0.1: - version "2.0.1" - resolved "https://registry.yarnpkg.com/jsx-ast-utils/-/jsx-ast-utils-2.0.1.tgz#e801b1b39985e20fffc87b40e3748080e2dcac7f" - integrity sha1-6AGxs5mF4g//yHtA43SAgOLcrH8= +jsx-ast-utils@^2.1.0: + version "2.2.1" + resolved "https://registry.yarnpkg.com/jsx-ast-utils/-/jsx-ast-utils-2.2.1.tgz#4d4973ebf8b9d2837ee91a8208cc66f3a2776cfb" + integrity sha512-v3FxCcAf20DayI+uxnCuw795+oOIkVu6EnJ1+kSzhqqTZHNkTZ7B66ZgLp4oLJ/gbA64cI0B7WRoHZMSRdyVRQ== dependencies: array-includes "^3.0.3" + object.assign "^4.1.0" just-debounce@^1.0.0: version "1.0.0" @@ -8652,13 +8706,6 @@ lit-element@^2.2.1: dependencies: lit-html "^1.0.0" -lit-element@^2.2.1: - version "2.2.1" - resolved "https://registry.yarnpkg.com/lit-element/-/lit-element-2.2.1.tgz#79c94d8cfdc2d73b245656e37991bd1e4811d96f" - integrity sha512-ipDcgQ1EpW6Va2Z6dWm79jYdimVepO5GL0eYkZrFvdr0OD/1N260Q9DH+K5HXHFrRoC7dOg+ZpED2XE0TgGdXw== - dependencies: - lit-html "^1.0.0" - lit-html@^1.0.0, lit-html@^1.1.0, lit-html@^1.1.2: version "1.1.2" resolved "https://registry.yarnpkg.com/lit-html/-/lit-html-1.1.2.tgz#2e3560a7075210243649c888ad738eaf0daa8374" @@ -9085,6 +9132,11 @@ lodash@^3.0.0, lodash@^3.10.1: resolved "https://registry.yarnpkg.com/lodash/-/lodash-3.10.1.tgz#5bf45e8e49ba4189e17d482789dfd15bd140b7b6" integrity sha1-W/Rejkm6QYnhfUgnid/RW9FAt7Y= +lodash@^4.17.12, lodash@^4.17.14: + version "4.17.15" + resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.15.tgz#b447f6670a0455bbfeedd11392eff330ea097548" + integrity sha512-8xOcRHvCjnocdS5cpwXQXVzmmh5e5+saE2QGoeQmbKmRS6J3VQppPOIt0MnmE+4xlZoumy0GPG0D0MVIQbNA1A== + log-symbols@2.2.0, log-symbols@^2.2.0: version "2.2.0" resolved "https://registry.yarnpkg.com/log-symbols/-/log-symbols-2.2.0.tgz#5740e1c5d6f0dfda4ad9323b5332107ef6b4c40a" @@ -10062,7 +10114,7 @@ object.defaults@^1.0.0, object.defaults@^1.1.0: for-own "^1.0.0" isobject "^3.0.0" -object.entries@^1.0.4: +object.entries@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/object.entries/-/object.entries-1.1.0.tgz#2024fc6d6ba246aee38bdb0ffd5cfbcf371b7519" integrity sha512-l+H6EQ8qzGRxbkHOd5I/aHRhHDKoQXQ8g0BYt4uSweQU1/J6dZUOyWh9a2Vky35YCKjzmgxOzta2hH6kf9HuXA== @@ -10121,6 +10173,16 @@ object.reduce@^1.0.0: for-own "^1.0.0" make-iterator "^1.0.0" +object.values@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/object.values/-/object.values-1.1.0.tgz#bf6810ef5da3e5325790eaaa2be213ea84624da9" + integrity sha512-8mf0nKLAoFX6VlNVdhGj31SVYpaNFtUnuoOXWyFEstsWRgU837AK+JYM0iAxwkSzGRbwn8cbFmgbyxj1j4VbXg== + dependencies: + define-properties "^1.1.3" + es-abstract "^1.12.0" + function-bind "^1.1.1" + has "^1.0.3" + obuf@^1.0.0, obuf@^1.1.1, obuf@^1.1.2: version "1.1.2" resolved "https://registry.yarnpkg.com/obuf/-/obuf-1.1.2.tgz#09bea3343d41859ebd446292d11c9d4db619084e" @@ -11122,7 +11184,7 @@ prop-types-extra@^1.0.1, prop-types-extra@^1.1.0: react-is "^16.3.2" warning "^3.0.0" -prop-types@^15.5.10, prop-types@^15.6.2: +prop-types@^15.5.10, prop-types@^15.6.2, prop-types@^15.7.2: version "15.7.2" resolved "https://registry.yarnpkg.com/prop-types/-/prop-types-15.7.2.tgz#52c41e75b8c87e72b9d9360e0206b99dcbffa6c5" integrity sha512-8QQikdH7//R2vurIJSutZ1smHYTcLpRWEOlHnzcWHmBYrOGUysKwSsrC89BCiFj3CbrfJ/nXFdJepOVrY1GCHQ== @@ -11789,13 +11851,20 @@ resolve-url@^0.2.1: resolved "https://registry.yarnpkg.com/resolve-url/-/resolve-url-0.2.1.tgz#2c637fe77c893afd2a663fe21aa9080068e2052a" integrity sha1-LGN/53yJOv0qZj/iGqkIAGjiBSo= -resolve@^1.1.6, resolve@^1.1.7, resolve@^1.10.0, resolve@^1.3.2, resolve@^1.4.0, resolve@^1.5.0, resolve@^1.9.0: +resolve@^1.1.6, resolve@^1.1.7, resolve@^1.10.0, resolve@^1.3.2, resolve@^1.4.0, resolve@^1.5.0: version "1.10.0" resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.10.0.tgz#3bdaaeaf45cc07f375656dfd2e54ed0810b101ba" integrity sha512-3sUr9aq5OfSg2S9pNtPA9hL1FVEAjvfOC4leW0SNf/mpnaakz2a9femSd6LqAww2RaFctwyf1lCqnTHuF1rxDg== dependencies: path-parse "^1.0.6" +resolve@^1.10.1, resolve@^1.11.0: + version "1.12.0" + resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.12.0.tgz#3fc644a35c84a48554609ff26ec52b66fa577df6" + integrity sha512-B/dOmuoAik5bKcD6s6nXDCjzUKnaDvdkRyAk6rsmsKLipWj4797iothd7jmmUhWTfinVMU+wc56rYKsit2Qy4w== + dependencies: + path-parse "^1.0.6" + restore-cursor@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/restore-cursor/-/restore-cursor-1.0.1.tgz#34661f46886327fed2991479152252df92daa541" @@ -12001,11 +12070,16 @@ semver-greatest-satisfied-range@^1.1.0: dependencies: sver-compat "^1.5.0" -"semver@2 || 3 || 4 || 5", semver@^5.0.3, semver@^5.1.0, semver@^5.3.0, semver@^5.4.1, semver@^5.5.0, semver@^5.5.1, semver@^5.6.0: +"semver@2 || 3 || 4 || 5", semver@^5.0.3, semver@^5.1.0, semver@^5.3.0, semver@^5.4.1, semver@^5.5.0, semver@^5.6.0: version "5.7.0" resolved "https://registry.yarnpkg.com/semver/-/semver-5.7.0.tgz#790a7cf6fea5459bac96110b29b60412dc8ff96b" integrity sha512-Ya52jSX2u7QKghxeoFGpLwCtGlt7j0oY9DYb5apt9nPlJ42ID+ulTXESnt/qAQcoSERyZ5sl3LDIOw0nAn/5DA== +semver@^6.1.2: + version "6.3.0" + resolved "https://registry.yarnpkg.com/semver/-/semver-6.3.0.tgz#ee0a64c8af5e8ceea67687b133761e1becbd1d3d" + integrity sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw== + send@0.16.2, send@^0.16.1, send@^0.16.2: version "0.16.2" resolved "https://registry.yarnpkg.com/send/-/send-0.16.2.tgz#6ecca1e0f8c156d141597559848df64730a6bbc1" @@ -12705,7 +12779,7 @@ strip-ansi@^4.0.0: dependencies: ansi-regex "^3.0.0" -strip-ansi@^5.0.0, strip-ansi@^5.1.0: +strip-ansi@^5.0.0, strip-ansi@^5.1.0, strip-ansi@^5.2.0: version "5.2.0" resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-5.2.0.tgz#8c9a536feb6afc962bdfa5b104a5091c1ad9c0ae" integrity sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA== @@ -12770,11 +12844,16 @@ strip-indent@^2.0.0: resolved "https://registry.yarnpkg.com/strip-indent/-/strip-indent-2.0.0.tgz#5ef8db295d01e6ed6cbf7aab96998d7822527b68" integrity sha1-XvjbKV0B5u1sv3qrlpmNeCJSe2g= -strip-json-comments@2.0.1, strip-json-comments@^2.0.1, strip-json-comments@~2.0.1: +strip-json-comments@2.0.1, strip-json-comments@~2.0.1: version "2.0.1" resolved "https://registry.yarnpkg.com/strip-json-comments/-/strip-json-comments-2.0.1.tgz#3c531942e908c2697c0ec344858c286c7ca0a60a" integrity sha1-PFMZQukIwml8DsNEhYwobHygpgo= +strip-json-comments@^3.0.1: + version "3.0.1" + resolved "https://registry.yarnpkg.com/strip-json-comments/-/strip-json-comments-3.0.1.tgz#85713975a91fb87bf1b305cca77395e40d2a64a7" + integrity sha512-VTyMAUfdm047mwKl+u79WIdrZxtFtn+nBxHeb844XBQ9uMNTuTHdx2hc5RiAJYqwTj3wc/xe5HLSdJSkJ+WfZw== + subarg@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/subarg/-/subarg-1.0.0.tgz#f62cf17581e996b48fc965699f54c06ae268b8d2" @@ -13752,6 +13831,11 @@ v8-compile-cache@^2.0.2: resolved "https://registry.yarnpkg.com/v8-compile-cache/-/v8-compile-cache-2.0.2.tgz#a428b28bb26790734c4fc8bc9fa106fccebf6a6c" integrity sha512-1wFuMUIM16MDJRCrpbpuEPTUGmM5QMUg0cr3KFwra2XgOgFcPGDQHDh3CszSCD2Zewc/dh/pamNEW8CbfDebUw== +v8-compile-cache@^2.0.3: + version "2.1.0" + resolved "https://registry.yarnpkg.com/v8-compile-cache/-/v8-compile-cache-2.1.0.tgz#e14de37b31a6d194f5690d67efc4e7f6fc6ab30e" + integrity sha512-usZBT3PW+LOjM25wbqIlZwPeJV+3OSz3M1k1Ws8snlW39dZyYL9lOGC5FgPVHfk0jKmjiDV8Z0mIbVQPiwFs7g== + v8flags@^3.0.1: version "3.1.2" resolved "https://registry.yarnpkg.com/v8flags/-/v8flags-3.1.2.tgz#fc5cd0c227428181e6c29b2992e4f8f1da5e0c9f" From 7f10bcbfd162ea52248344c6c23d06ceae34fcef Mon Sep 17 00:00:00 2001 From: Paulus Schoutsen Date: Fri, 6 Sep 2019 23:58:30 -0700 Subject: [PATCH 08/26] Drop Babel --- build-scripts/webpack.js | 19 ++++++- package.json | 1 + src/layouts/home-assistant.ts | 9 +++- src/panels/custom/ha-panel-custom.ts | 1 + .../cards/hui-picture-elements-card.ts | 4 +- src/resources/jquery.roundslider.ondemand.ts | 8 +-- src/state/hass-base-mixin.ts | 12 ++++- tsconfig.json | 1 + yarn.lock | 54 ++++++++++++++++++- 9 files changed, 97 insertions(+), 12 deletions(-) diff --git a/build-scripts/webpack.js b/build-scripts/webpack.js index fa9bfb9edd..d95cc350dc 100644 --- a/build-scripts/webpack.js +++ b/build-scripts/webpack.js @@ -118,7 +118,24 @@ const createAppConfig = ({ isProdBuild, latestBuild, isStatsBuild }) => { devtool: genDevTool(isProdBuild), entry, module: { - rules: [babelLoaderConfig({ latestBuild }), cssLoader, htmlLoader], + rules: [ + { + test: /\.ts|tsx$/, + exclude: /node_modules/, + use: [ + { + loader: "ts-loader", + options: { + compilerOptions: latestBuild + ? { noEmit: false } + : { target: "es5", noEmit: false }, + }, + }, + ], + }, + cssLoader, + htmlLoader, + ], }, optimization: optimization(latestBuild), plugins: [ diff --git a/package.json b/package.json index d7490e5ff1..64911a81f7 100644 --- a/package.json +++ b/package.json @@ -161,6 +161,7 @@ "require-dir": "^1.2.0", "sinon": "^7.3.1", "terser-webpack-plugin": "^1.2.3", + "ts-loader": "^6.0.4", "ts-mocha": "^6.0.0", "tslint": "^5.14.0", "tslint-config-prettier": "^1.18.0", diff --git a/src/layouts/home-assistant.ts b/src/layouts/home-assistant.ts index 09c762e675..551a45a999 100644 --- a/src/layouts/home-assistant.ts +++ b/src/layouts/home-assistant.ts @@ -14,7 +14,7 @@ import { HassElement } from "../state/hass-element"; export class HomeAssistantAppEl extends HassElement { @property() private _route?: Route; - @property() private _error?: boolean; + @property() private _error = false; @property() private _panelUrl?: string; protected render() { @@ -49,6 +49,7 @@ export class HomeAssistantAppEl extends HassElement { } protected updated(changedProps: PropertyValues): void { + super.updated(changedProps); if (changedProps.has("_panelUrl")) { this.panelUrlChanged(this._panelUrl!); this._updateHass({ panelUrl: this._panelUrl }); @@ -70,7 +71,11 @@ export class HomeAssistantAppEl extends HassElement { } } - private _routeChanged(ev) { + private async _routeChanged(ev) { + // routeChangged event listener is called while we're doing the fist render, + // causing the update to be ignored. So delay it to next task (Lit render is sync). + await new Promise((resolve) => setTimeout(resolve, 0)); + const route = ev.detail.value as Route; // If it's the first route that we process, // check if we should navigate away from / diff --git a/src/panels/custom/ha-panel-custom.ts b/src/panels/custom/ha-panel-custom.ts index 563ccb6a18..1703e1e9fa 100644 --- a/src/panels/custom/ha-panel-custom.ts +++ b/src/panels/custom/ha-panel-custom.ts @@ -52,6 +52,7 @@ export class HaPanelCustom extends UpdatingElement { return; } const props = {}; + // @ts-ignore for (const key of changedProps.keys()) { props[key] = this[key]; } diff --git a/src/panels/lovelace/cards/hui-picture-elements-card.ts b/src/panels/lovelace/cards/hui-picture-elements-card.ts index 13157273a5..6d6a07e501 100644 --- a/src/panels/lovelace/cards/hui-picture-elements-card.ts +++ b/src/panels/lovelace/cards/hui-picture-elements-card.ts @@ -22,7 +22,9 @@ class HuiPictureElementsCard extends LitElement implements LovelaceCard { set hass(hass: HomeAssistant) { this._hass = hass; - for (const el of this.shadowRoot!.querySelectorAll("#root > *")) { + for (const el of Array.from( + this.shadowRoot!.querySelectorAll("#root > *") + )) { const element = el as LovelaceElement; element.hass = this._hass; } diff --git a/src/resources/jquery.roundslider.ondemand.ts b/src/resources/jquery.roundslider.ondemand.ts index 3c92056f97..487b367f8b 100644 --- a/src/resources/jquery.roundslider.ondemand.ts +++ b/src/resources/jquery.roundslider.ondemand.ts @@ -1,13 +1,13 @@ import { TemplateResult } from "lit-element"; -type LoadedRoundSlider = Promise<{ +interface LoadedRoundSlider { roundSliderStyle: TemplateResult; jQuery: any; -}>; +} -let loaded: LoadedRoundSlider; +let loaded: Promise; -export const loadRoundslider = async (): LoadedRoundSlider => { +export const loadRoundslider = async (): Promise => { if (!loaded) { loaded = import(/* webpackChunkName: "jquery-roundslider" */ "./jquery.roundslider"); } diff --git a/src/state/hass-base-mixin.ts b/src/state/hass-base-mixin.ts index f41d6752d2..df5d9e7352 100644 --- a/src/state/hass-base-mixin.ts +++ b/src/state/hass-base-mixin.ts @@ -2,6 +2,7 @@ import { Constructor, // @ts-ignore property, + PropertyDeclarations, } from "lit-element"; import { Auth, Connection } from "home-assistant-js-websocket"; import { HomeAssistant } from "../types"; @@ -26,8 +27,15 @@ export default (superClass: Constructor): Constructor => class extends superClass { protected _pendingHass: Partial = {}; private __provideHass: HTMLElement[] = []; - // @ts-ignore - @property() protected hass: HomeAssistant; + + // Decorators not possible in anonymous classes + static get properties(): PropertyDeclarations { + return { + hass: {}, + }; + } + + protected hass!: HomeAssistant; // Exists so all methods can safely call super method protected hassConnected() { diff --git a/tsconfig.json b/tsconfig.json index 7ca6093963..6e9415d1ab 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -12,6 +12,7 @@ "noImplicitReturns": true, "noFallthroughCasesInSwitch": true, "strict": true, + "sourceMap": true, "noImplicitAny": false, "skipLibCheck": true, "resolveJsonModule": true, diff --git a/yarn.lock b/yarn.lock index be74dac0f2..98d2074780 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3653,6 +3653,13 @@ braces@^2.3.1, braces@^2.3.2: split-string "^3.0.2" to-regex "^3.0.1" +braces@^3.0.1: + version "3.0.2" + resolved "https://registry.yarnpkg.com/braces/-/braces-3.0.2.tgz#3454e1a462ee8d599e236df336cd9ea4f8afe107" + integrity sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A== + dependencies: + fill-range "^7.0.1" + brorand@^1.0.1: version "1.1.0" resolved "https://registry.yarnpkg.com/brorand/-/brorand-1.1.0.tgz#12c25efe40a45e3c323eb8675a0a0ce57b22371f" @@ -5518,7 +5525,7 @@ engine.io@~3.3.1: engine.io-parser "~2.1.0" ws "~6.1.0" -enhanced-resolve@^4.1.0: +enhanced-resolve@^4.0.0, enhanced-resolve@^4.1.0: version "4.1.0" resolved "https://registry.yarnpkg.com/enhanced-resolve/-/enhanced-resolve-4.1.0.tgz#41c7e0bfdfe74ac1ffe1e57ad6a5c6c9f3742a7f" integrity sha512-F/7vkyTtyc/llOIn8oWclcB25KdRaiPBpZYDgJHgh/UHtpgT2p2eldQgtQnLtUvfMKPKxbRaQM/hHkvLHt1Vng== @@ -6287,6 +6294,13 @@ fill-range@^4.0.0: repeat-string "^1.6.1" to-regex-range "^2.1.0" +fill-range@^7.0.1: + version "7.0.1" + resolved "https://registry.yarnpkg.com/fill-range/-/fill-range-7.0.1.tgz#1919a6a7c75fe38b2c7c77e5198535da9acdda40" + integrity sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ== + dependencies: + to-regex-range "^5.0.1" + filled-array@^1.0.0: version "1.1.0" resolved "https://registry.yarnpkg.com/filled-array/-/filled-array-1.1.0.tgz#c3c4f6c663b923459a9aa29912d2d031f1507f84" @@ -8070,6 +8084,11 @@ is-number@^4.0.0: resolved "https://registry.yarnpkg.com/is-number/-/is-number-4.0.0.tgz#0026e37f5454d73e356dfe6564699867c6a7f0ff" integrity sha512-rSklcAIlf1OmFdyAqbnWTLVelsQ58uvZ66S/ZyawjWqIviTWCjg2PzVGw8WUA+nNuPTqb4wgA+NszrJ+08LlgQ== +is-number@^7.0.0: + version "7.0.0" + resolved "https://registry.yarnpkg.com/is-number/-/is-number-7.0.0.tgz#7535345b896734d5f80c4d06c50955527a14f12b" + integrity sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng== + is-obj@^1.0.0, is-obj@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/is-obj/-/is-obj-1.0.1.tgz#3e4729ac1f5fde025cd7d83a896dab9f4f67db0f" @@ -9504,6 +9523,14 @@ micromatch@^3.0.4, micromatch@^3.1.10, micromatch@^3.1.4, micromatch@^3.1.8: snapdragon "^0.8.1" to-regex "^3.0.2" +micromatch@^4.0.0: + version "4.0.2" + resolved "https://registry.yarnpkg.com/micromatch/-/micromatch-4.0.2.tgz#4fcb0999bf9fbc2fcbdd212f6d629b9a56c39259" + integrity sha512-y7FpHSbMUMoyPbYUSzO6PaZ6FyRnQOpHuKwbo1G+Knck95XVU4QAiKdGEnj5wwoS7PlOgthX/09u5iFJ+aYf5Q== + dependencies: + braces "^3.0.1" + picomatch "^2.0.5" + miller-rabin@^4.0.0: version "4.0.1" resolved "https://registry.yarnpkg.com/miller-rabin/-/miller-rabin-4.0.1.tgz#f080351c865b0dc562a8462966daa53543c78a4d" @@ -10689,6 +10716,11 @@ performance-now@^2.1.0: resolved "https://registry.yarnpkg.com/performance-now/-/performance-now-2.1.0.tgz#6309f4e0e5fa913ec1c69307ae364b4b377c9e7b" integrity sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns= +picomatch@^2.0.5: + version "2.0.7" + resolved "https://registry.yarnpkg.com/picomatch/-/picomatch-2.0.7.tgz#514169d8c7cd0bdbeecc8a2609e34a7163de69f6" + integrity sha512-oLHIdio3tZ0qH76NybpeneBhYVj0QFTfXEFTc/B3zKQspYfYYkWYgFsmzo+4kvId/bQRcNkVeguI3y+CD22BtA== + pify@^2.0.0, pify@^2.3.0: version "2.3.0" resolved "https://registry.yarnpkg.com/pify/-/pify-2.3.0.tgz#ed141a6ac043a849ea588498e7dca8b15330e90c" @@ -12075,7 +12107,7 @@ semver-greatest-satisfied-range@^1.1.0: resolved "https://registry.yarnpkg.com/semver/-/semver-5.7.0.tgz#790a7cf6fea5459bac96110b29b60412dc8ff96b" integrity sha512-Ya52jSX2u7QKghxeoFGpLwCtGlt7j0oY9DYb5apt9nPlJ42ID+ulTXESnt/qAQcoSERyZ5sl3LDIOw0nAn/5DA== -semver@^6.1.2: +semver@^6.0.0, semver@^6.1.2: version "6.3.0" resolved "https://registry.yarnpkg.com/semver/-/semver-6.3.0.tgz#ee0a64c8af5e8ceea67687b133761e1becbd1d3d" integrity sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw== @@ -13257,6 +13289,13 @@ to-regex-range@^2.1.0: is-number "^3.0.0" repeat-string "^1.6.1" +to-regex-range@^5.0.1: + version "5.0.1" + resolved "https://registry.yarnpkg.com/to-regex-range/-/to-regex-range-5.0.1.tgz#1648c44aae7c8d988a326018ed72f5b4dd0392e4" + integrity sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ== + dependencies: + is-number "^7.0.0" + to-regex@^3.0.1, to-regex@^3.0.2: version "3.0.2" resolved "https://registry.yarnpkg.com/to-regex/-/to-regex-3.0.2.tgz#13cfdd9b336552f30b51f33a8ae1b42a7a7599ce" @@ -13321,6 +13360,17 @@ triple-beam@^1.2.0, triple-beam@^1.3.0: resolved "https://registry.yarnpkg.com/triple-beam/-/triple-beam-1.3.0.tgz#a595214c7298db8339eeeee083e4d10bd8cb8dd9" integrity sha512-XrHUvV5HpdLmIj4uVMxHggLbFSZYIn7HEWsqePZcI50pco+MPqJ50wMGY794X7AOOhxOBAjbkqfAbEe/QMp2Lw== +ts-loader@^6.0.4: + version "6.0.4" + resolved "https://registry.yarnpkg.com/ts-loader/-/ts-loader-6.0.4.tgz#bc331ad91a887a60632d94c9f79448666f2c4b63" + integrity sha512-p2zJYe7OtwR+49kv4gs7v4dMrfYD1IPpOtqiSPCbe8oR+4zEBtdHwzM7A7M91F+suReqgzZrlClk4LRSSp882g== + dependencies: + chalk "^2.3.0" + enhanced-resolve "^4.0.0" + loader-utils "^1.0.2" + micromatch "^4.0.0" + semver "^6.0.0" + ts-mocha@^6.0.0: version "6.0.0" resolved "https://registry.yarnpkg.com/ts-mocha/-/ts-mocha-6.0.0.tgz#40b8c5462ffce6f5dcee5ff729655b2958f26e50" From 594ee7ce9b125ac72e669afbc94793bfd72c8028 Mon Sep 17 00:00:00 2001 From: Paulus Schoutsen Date: Sun, 8 Sep 2019 23:06:45 -0700 Subject: [PATCH 09/26] Update build scripts --- .eslintrc.json | 5 +- build-scripts/babel.js | 48 ----- build-scripts/webpack.js | 38 ++-- gallery/webpack.config.js | 16 +- hassio/webpack.config.js | 16 +- package.json | 11 -- yarn.lock | 371 ++++---------------------------------- 7 files changed, 78 insertions(+), 427 deletions(-) delete mode 100644 build-scripts/babel.js diff --git a/.eslintrc.json b/.eslintrc.json index 76101d674e..5bcf910f99 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -1,12 +1,9 @@ { "extends": "./.eslintrc-hound.json", - "plugins": [ - "react" - ], + "plugins": ["react"], "env": { "browser": true }, - "parser": "babel-eslint", "rules": { "import/no-unresolved": 2, "linebreak-style": 0, diff --git a/build-scripts/babel.js b/build-scripts/babel.js deleted file mode 100644 index 67021b92c4..0000000000 --- a/build-scripts/babel.js +++ /dev/null @@ -1,48 +0,0 @@ -module.exports.babelLoaderConfig = ({ latestBuild }) => { - if (latestBuild === undefined) { - throw Error("latestBuild not defined for babel loader config"); - } - return { - test: /\.m?js$|\.tsx?$/, - use: { - loader: "babel-loader", - options: { - presets: [ - !latestBuild && [ - require("@babel/preset-env").default, - { modules: false }, - ], - [ - require("@babel/preset-typescript").default, - { - jsxPragma: "h", - }, - ], - ].filter(Boolean), - plugins: [ - // Part of ES2018. Converts {...a, b: 2} to Object.assign({}, a, {b: 2}) - [ - "@babel/plugin-proposal-object-rest-spread", - { loose: true, useBuiltIns: true }, - ], - // Only support the syntax, Webpack will handle it. - "@babel/syntax-dynamic-import", - [ - "@babel/transform-react-jsx", - { - pragma: "h", - }, - ], - [ - require("@babel/plugin-proposal-decorators").default, - { decoratorsBeforeExport: true }, - ], - [ - require("@babel/plugin-proposal-class-properties").default, - { loose: true }, - ], - ], - }, - }, - }; -}; diff --git a/build-scripts/webpack.js b/build-scripts/webpack.js index d95cc350dc..606b5d3b52 100644 --- a/build-scripts/webpack.js +++ b/build-scripts/webpack.js @@ -7,7 +7,6 @@ const CompressionPlugin = require("compression-webpack-plugin"); const zopfli = require("@gfx/zopfli"); const ManifestPlugin = require("webpack-manifest-plugin"); const paths = require("./paths.js"); -const { babelLoaderConfig } = require("./babel.js"); let version = fs .readFileSync(path.resolve(paths.polymer_dir, "setup.py"), "utf8") @@ -41,6 +40,20 @@ const resolve = { }, }; +const tsLoader = (latestBuild) => ({ + test: /\.ts|tsx$/, + exclude: /node_modules/, + use: [ + { + loader: "ts-loader", + options: { + compilerOptions: latestBuild + ? { noEmit: false } + : { target: "es5", noEmit: false }, + }, + }, + ], +}); const cssLoader = { test: /\.css$/, use: "raw-loader", @@ -118,24 +131,7 @@ const createAppConfig = ({ isProdBuild, latestBuild, isStatsBuild }) => { devtool: genDevTool(isProdBuild), entry, module: { - rules: [ - { - test: /\.ts|tsx$/, - exclude: /node_modules/, - use: [ - { - loader: "ts-loader", - options: { - compilerOptions: latestBuild - ? { noEmit: false } - : { target: "es5", noEmit: false }, - }, - }, - ], - }, - cssLoader, - htmlLoader, - ], + rules: [tsLoader(latestBuild), cssLoader, htmlLoader], }, optimization: optimization(latestBuild), plugins: [ @@ -203,7 +199,7 @@ const createDemoConfig = ({ isProdBuild, latestBuild, isStatsBuild }) => { compatibility: "./src/entrypoints/compatibility.ts", }, module: { - rules: [babelLoaderConfig({ latestBuild }), cssLoader, htmlLoader], + rules: [tsLoader(latestBuild), cssLoader, htmlLoader], }, optimization: optimization(latestBuild), plugins: [ @@ -250,7 +246,7 @@ const createCastConfig = ({ isProdBuild, latestBuild }) => { devtool: genDevTool(isProdBuild), entry, module: { - rules: [babelLoaderConfig({ latestBuild }), cssLoader, htmlLoader], + rules: [tsLoader(latestBuild), cssLoader, htmlLoader], }, optimization: optimization(latestBuild), plugins: [ diff --git a/gallery/webpack.config.js b/gallery/webpack.config.js index 4ffbef7911..91a962fcb1 100644 --- a/gallery/webpack.config.js +++ b/gallery/webpack.config.js @@ -1,6 +1,5 @@ const path = require("path"); const CopyWebpackPlugin = require("copy-webpack-plugin"); -const { babelLoaderConfig } = require("../build-scripts/babel.js"); const webpackBase = require("../build-scripts/webpack.js"); const isProd = process.env.NODE_ENV === "production"; @@ -17,7 +16,20 @@ module.exports = { entry: "./src/entrypoint.js", module: { rules: [ - babelLoaderConfig({ latestBuild }), + { + test: /\.ts$/, + exclude: /node_modules/, + use: [ + { + loader: "ts-loader", + options: { + compilerOptions: latestBuild + ? { noEmit: false } + : { target: "es5", noEmit: false }, + }, + }, + ], + }, { test: /\.css$/, use: "raw-loader", diff --git a/hassio/webpack.config.js b/hassio/webpack.config.js index e58d2df301..aecb118b29 100644 --- a/hassio/webpack.config.js +++ b/hassio/webpack.config.js @@ -3,7 +3,6 @@ const CompressionPlugin = require("compression-webpack-plugin"); const zopfli = require("@gfx/zopfli"); const config = require("./config.js"); -const { babelLoaderConfig } = require("../build-scripts/babel.js"); const webpackBase = require("../build-scripts/webpack.js"); const isProdBuild = process.env.NODE_ENV === "production"; @@ -19,7 +18,20 @@ module.exports = { }, module: { rules: [ - babelLoaderConfig({ latestBuild }), + { + test: /\.ts$/, + exclude: /node_modules/, + use: [ + { + loader: "ts-loader", + options: { + compilerOptions: latestBuild + ? { noEmit: false } + : { target: "es5", noEmit: false }, + }, + }, + ], + }, { test: /\.(html)$/, use: { diff --git a/package.json b/package.json index 64911a81f7..5497150d25 100644 --- a/package.json +++ b/package.json @@ -105,15 +105,6 @@ "xss": "^1.0.6" }, "devDependencies": { - "@babel/core": "^7.4.0", - "@babel/plugin-external-helpers": "^7.2.0", - "@babel/plugin-proposal-class-properties": "^7.4.0", - "@babel/plugin-proposal-decorators": "^7.4.0", - "@babel/plugin-proposal-object-rest-spread": "^7.4.0", - "@babel/plugin-syntax-dynamic-import": "^7.2.0", - "@babel/plugin-transform-react-jsx": "^7.3.0", - "@babel/preset-env": "^7.4.2", - "@babel/preset-typescript": "^7.3.3", "@gfx/zopfli": "^1.0.11", "@types/chai": "^4.1.7", "@types/chromecast-caf-receiver": "^3.0.12", @@ -122,8 +113,6 @@ "@types/leaflet": "^1.4.3", "@types/memoize-one": "4.1.0", "@types/mocha": "^5.2.6", - "babel-eslint": "^10", - "babel-loader": "^8.0.5", "chai": "^4.2.0", "compression-webpack-plugin": "^2.0.0", "copy-webpack-plugin": "^5.0.2", diff --git a/yarn.lock b/yarn.lock index 98d2074780..388a5819fe 100644 --- a/yarn.lock +++ b/yarn.lock @@ -9,7 +9,7 @@ dependencies: "@babel/highlight" "^7.0.0" -"@babel/core@^7.0.0", "@babel/core@^7.4.0": +"@babel/core@^7.0.0": version "7.4.0" resolved "https://registry.yarnpkg.com/@babel/core/-/core-7.4.0.tgz#248fd6874b7d755010bfe61f557461d4f446d9e9" integrity sha512-Dzl7U0/T69DFOTwqz/FJdnOSWS57NpjNfCwMKHABr589Lg8uX1RrlBIJ7L5Dubt/xkLsx0xH5EBFzlBVes1ayA== @@ -55,14 +55,6 @@ "@babel/helper-explode-assignable-expression" "^7.1.0" "@babel/types" "^7.0.0" -"@babel/helper-builder-react-jsx@^7.3.0": - version "7.3.0" - resolved "https://registry.yarnpkg.com/@babel/helper-builder-react-jsx/-/helper-builder-react-jsx-7.3.0.tgz#a1ac95a5d2b3e88ae5e54846bf462eeb81b318a4" - integrity sha512-MjA9KgwCuPEkQd9ncSXvSyJ5y+j2sICHyrI0M3L+6fnS4wMSNDc1ARXsbTfbb2cXHn17VisSnU/sHFTCxVxSMw== - dependencies: - "@babel/types" "^7.3.0" - esutils "^2.0.0" - "@babel/helper-call-delegate@^7.4.0": version "7.4.0" resolved "https://registry.yarnpkg.com/@babel/helper-call-delegate/-/helper-call-delegate-7.4.0.tgz#f308eabe0d44f451217853aedf4dea5f6fe3294f" @@ -72,18 +64,6 @@ "@babel/traverse" "^7.4.0" "@babel/types" "^7.4.0" -"@babel/helper-create-class-features-plugin@^7.4.0": - version "7.4.0" - resolved "https://registry.yarnpkg.com/@babel/helper-create-class-features-plugin/-/helper-create-class-features-plugin-7.4.0.tgz#30fd090e059d021995c1762a5b76798fa0b51d82" - integrity sha512-2K8NohdOT7P6Vyp23QH4w2IleP8yG3UJsbRKwA4YP6H8fErcLkFuuEEqbF2/BYBKSNci/FWJiqm6R3VhM/QHgw== - dependencies: - "@babel/helper-function-name" "^7.1.0" - "@babel/helper-member-expression-to-functions" "^7.0.0" - "@babel/helper-optimise-call-expression" "^7.0.0" - "@babel/helper-plugin-utils" "^7.0.0" - "@babel/helper-replace-supers" "^7.4.0" - "@babel/helper-split-export-declaration" "^7.4.0" - "@babel/helper-define-map@^7.4.0": version "7.4.0" resolved "https://registry.yarnpkg.com/@babel/helper-define-map/-/helper-define-map-7.4.0.tgz#cbfd8c1b2f12708e262c26f600cd16ed6a3bc6c9" @@ -233,19 +213,19 @@ esutils "^2.0.2" js-tokens "^4.0.0" -"@babel/parser@^7.0.0", "@babel/parser@^7.4.0": +"@babel/parser@^7.4.0": version "7.4.2" resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.4.2.tgz#b4521a400cb5a871eab3890787b4bc1326d38d91" integrity sha512-9fJTDipQFvlfSVdD/JBtkiY0br9BtfvW2R8wo6CX/Ej2eMuV0gWPk1M67Mt3eggQvBqYW1FCEk8BN7WvGm/g5g== -"@babel/plugin-external-helpers@^7.0.0", "@babel/plugin-external-helpers@^7.2.0": +"@babel/plugin-external-helpers@^7.0.0": version "7.2.0" resolved "https://registry.yarnpkg.com/@babel/plugin-external-helpers/-/plugin-external-helpers-7.2.0.tgz#7f4cb7dee651cd380d2034847d914288467a6be4" integrity sha512-QFmtcCShFkyAsNtdCM3lJPmRe1iB+vPZymlB4LnDIKEBj2yKQLQKtoxXxJ8ePT5fwMl4QGg303p4mB0UsSI2/g== dependencies: "@babel/helper-plugin-utils" "^7.0.0" -"@babel/plugin-proposal-async-generator-functions@^7.0.0", "@babel/plugin-proposal-async-generator-functions@^7.2.0": +"@babel/plugin-proposal-async-generator-functions@^7.0.0": version "7.2.0" resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-async-generator-functions/-/plugin-proposal-async-generator-functions-7.2.0.tgz#b289b306669dce4ad20b0252889a15768c9d417e" integrity sha512-+Dfo/SCQqrwx48ptLVGLdE39YtWRuKc/Y9I5Fy0P1DDBB9lsAHpjcEJQt+4IifuSOSTLBKJObJqMvaO1pIE8LQ== @@ -254,32 +234,7 @@ "@babel/helper-remap-async-to-generator" "^7.1.0" "@babel/plugin-syntax-async-generators" "^7.2.0" -"@babel/plugin-proposal-class-properties@^7.4.0": - version "7.4.0" - resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-class-properties/-/plugin-proposal-class-properties-7.4.0.tgz#d70db61a2f1fd79de927eea91f6411c964e084b8" - integrity sha512-t2ECPNOXsIeK1JxJNKmgbzQtoG27KIlVE61vTqX0DKR9E9sZlVVxWUtEW9D5FlZ8b8j7SBNCHY47GgPKCKlpPg== - dependencies: - "@babel/helper-create-class-features-plugin" "^7.4.0" - "@babel/helper-plugin-utils" "^7.0.0" - -"@babel/plugin-proposal-decorators@^7.4.0": - version "7.4.0" - resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-decorators/-/plugin-proposal-decorators-7.4.0.tgz#8e1bfd83efa54a5f662033afcc2b8e701f4bb3a9" - integrity sha512-d08TLmXeK/XbgCo7ZeZ+JaeZDtDai/2ctapTRsWWkkmy7G/cqz8DQN/HlWG7RR4YmfXxmExsbU3SuCjlM7AtUg== - dependencies: - "@babel/helper-create-class-features-plugin" "^7.4.0" - "@babel/helper-plugin-utils" "^7.0.0" - "@babel/plugin-syntax-decorators" "^7.2.0" - -"@babel/plugin-proposal-json-strings@^7.2.0": - version "7.2.0" - resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-json-strings/-/plugin-proposal-json-strings-7.2.0.tgz#568ecc446c6148ae6b267f02551130891e29f317" - integrity sha512-MAFV1CA/YVmYwZG0fBQyXhmj0BHCB5egZHCKWIFVv/XCxAeVGIHfos3SwDck4LvCllENIAg7xMKOG5kH0dzyUg== - dependencies: - "@babel/helper-plugin-utils" "^7.0.0" - "@babel/plugin-syntax-json-strings" "^7.2.0" - -"@babel/plugin-proposal-object-rest-spread@^7.0.0", "@babel/plugin-proposal-object-rest-spread@^7.4.0": +"@babel/plugin-proposal-object-rest-spread@^7.0.0": version "7.4.0" resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-object-rest-spread/-/plugin-proposal-object-rest-spread-7.4.0.tgz#e4960575205eadf2a1ab4e0c79f9504d5b82a97f" integrity sha512-uTNi8pPYyUH2eWHyYWWSYJKwKg34hhgl4/dbejEjL+64OhbHjTX7wEVWMQl82tEmdDsGeu77+s8HHLS627h6OQ== @@ -287,23 +242,6 @@ "@babel/helper-plugin-utils" "^7.0.0" "@babel/plugin-syntax-object-rest-spread" "^7.2.0" -"@babel/plugin-proposal-optional-catch-binding@^7.2.0": - version "7.2.0" - resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-optional-catch-binding/-/plugin-proposal-optional-catch-binding-7.2.0.tgz#135d81edb68a081e55e56ec48541ece8065c38f5" - integrity sha512-mgYj3jCcxug6KUcX4OBoOJz3CMrwRfQELPQ5560F70YQUBZB7uac9fqaWamKR1iWUzGiK2t0ygzjTScZnVz75g== - dependencies: - "@babel/helper-plugin-utils" "^7.0.0" - "@babel/plugin-syntax-optional-catch-binding" "^7.2.0" - -"@babel/plugin-proposal-unicode-property-regex@^7.4.0": - version "7.4.0" - resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-unicode-property-regex/-/plugin-proposal-unicode-property-regex-7.4.0.tgz#202d91ee977d760ef83f4f416b280d568be84623" - integrity sha512-h/KjEZ3nK9wv1P1FSNb9G079jXrNYR0Ko+7XkOx85+gM24iZbPn0rh4vCftk+5QKY7y1uByFataBTmX7irEF1w== - dependencies: - "@babel/helper-plugin-utils" "^7.0.0" - "@babel/helper-regex" "^7.0.0" - regexpu-core "^4.5.4" - "@babel/plugin-syntax-async-generators@^7.0.0", "@babel/plugin-syntax-async-generators@^7.2.0": version "7.2.0" resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-async-generators/-/plugin-syntax-async-generators-7.2.0.tgz#69e1f0db34c6f5a0cf7e2b3323bf159a76c8cb7f" @@ -311,14 +249,7 @@ dependencies: "@babel/helper-plugin-utils" "^7.0.0" -"@babel/plugin-syntax-decorators@^7.2.0": - version "7.2.0" - resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-decorators/-/plugin-syntax-decorators-7.2.0.tgz#c50b1b957dcc69e4b1127b65e1c33eef61570c1b" - integrity sha512-38QdqVoXdHUQfTpZo3rQwqQdWtCn5tMv4uV6r2RMfTqNBuv4ZBhz79SfaQWKTVmxHjeFv/DnXVC/+agHCklYWA== - dependencies: - "@babel/helper-plugin-utils" "^7.0.0" - -"@babel/plugin-syntax-dynamic-import@^7.0.0", "@babel/plugin-syntax-dynamic-import@^7.2.0": +"@babel/plugin-syntax-dynamic-import@^7.0.0": version "7.2.0" resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-dynamic-import/-/plugin-syntax-dynamic-import-7.2.0.tgz#69c159ffaf4998122161ad8ebc5e6d1f55df8612" integrity sha512-mVxuJ0YroI/h/tbFTPGZR8cv6ai+STMKNBq0f8hFxsxWjl94qqhsb+wXbpNMDPU3cfR1TIsVFzU3nXyZMqyK4w== @@ -332,20 +263,6 @@ dependencies: "@babel/helper-plugin-utils" "^7.0.0" -"@babel/plugin-syntax-json-strings@^7.2.0": - version "7.2.0" - resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-json-strings/-/plugin-syntax-json-strings-7.2.0.tgz#72bd13f6ffe1d25938129d2a186b11fd62951470" - integrity sha512-5UGYnMSLRE1dqqZwug+1LISpA403HzlSfsg6P9VXU6TBjcSHeNlw4DxDx7LgpF+iKZoOG/+uzqoRHTdcUpiZNg== - dependencies: - "@babel/helper-plugin-utils" "^7.0.0" - -"@babel/plugin-syntax-jsx@^7.2.0": - version "7.2.0" - resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-jsx/-/plugin-syntax-jsx-7.2.0.tgz#0b85a3b4bc7cdf4cc4b8bf236335b907ca22e7c7" - integrity sha512-VyN4QANJkRW6lDBmENzRszvZf3/4AXaj9YR7GwrWeeN9tEBPuXbmDYVU9bYBN0D70zCWVwUy0HWq2553VCb6Hw== - dependencies: - "@babel/helper-plugin-utils" "^7.0.0" - "@babel/plugin-syntax-object-rest-spread@^7.0.0", "@babel/plugin-syntax-object-rest-spread@^7.2.0": version "7.2.0" resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-object-rest-spread/-/plugin-syntax-object-rest-spread-7.2.0.tgz#3b7a3e733510c57e820b9142a6579ac8b0dfad2e" @@ -353,28 +270,14 @@ dependencies: "@babel/helper-plugin-utils" "^7.0.0" -"@babel/plugin-syntax-optional-catch-binding@^7.2.0": - version "7.2.0" - resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-optional-catch-binding/-/plugin-syntax-optional-catch-binding-7.2.0.tgz#a94013d6eda8908dfe6a477e7f9eda85656ecf5c" - integrity sha512-bDe4xKNhb0LI7IvZHiA13kff0KEfaGX/Hv4lMA9+7TEc63hMNvfKo6ZFpXhKuEp+II/q35Gc4NoMeDZyaUbj9w== - dependencies: - "@babel/helper-plugin-utils" "^7.0.0" - -"@babel/plugin-syntax-typescript@^7.2.0": - version "7.3.3" - resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-typescript/-/plugin-syntax-typescript-7.3.3.tgz#a7cc3f66119a9f7ebe2de5383cce193473d65991" - integrity sha512-dGwbSMA1YhVS8+31CnPR7LB4pcbrzcV99wQzby4uAfrkZPYZlQ7ImwdpzLqi6Z6IL02b8IAL379CaMwo0x5Lag== - dependencies: - "@babel/helper-plugin-utils" "^7.0.0" - -"@babel/plugin-transform-arrow-functions@^7.0.0", "@babel/plugin-transform-arrow-functions@^7.2.0": +"@babel/plugin-transform-arrow-functions@^7.0.0": version "7.2.0" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-arrow-functions/-/plugin-transform-arrow-functions-7.2.0.tgz#9aeafbe4d6ffc6563bf8f8372091628f00779550" integrity sha512-ER77Cax1+8/8jCB9fo4Ud161OZzWN5qawi4GusDuRLcDbDG+bIGYY20zb2dfAFdTRGzrfq2xZPvF0R64EHnimg== dependencies: "@babel/helper-plugin-utils" "^7.0.0" -"@babel/plugin-transform-async-to-generator@^7.0.0", "@babel/plugin-transform-async-to-generator@^7.4.0": +"@babel/plugin-transform-async-to-generator@^7.0.0": version "7.4.0" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-async-to-generator/-/plugin-transform-async-to-generator-7.4.0.tgz#234fe3e458dce95865c0d152d256119b237834b0" integrity sha512-EeaFdCeUULM+GPFEsf7pFcNSxM7hYjoj5fiYbyuiXobW4JhFnjAv9OWzNwHyHcKoPNpAfeRDuW6VyaXEDUBa7g== @@ -383,14 +286,14 @@ "@babel/helper-plugin-utils" "^7.0.0" "@babel/helper-remap-async-to-generator" "^7.1.0" -"@babel/plugin-transform-block-scoped-functions@^7.0.0", "@babel/plugin-transform-block-scoped-functions@^7.2.0": +"@babel/plugin-transform-block-scoped-functions@^7.0.0": version "7.2.0" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-block-scoped-functions/-/plugin-transform-block-scoped-functions-7.2.0.tgz#5d3cc11e8d5ddd752aa64c9148d0db6cb79fd190" integrity sha512-ntQPR6q1/NKuphly49+QiQiTN0O63uOwjdD6dhIjSWBI5xlrbUFh720TIpzBhpnrLfv2tNH/BXvLIab1+BAI0w== dependencies: "@babel/helper-plugin-utils" "^7.0.0" -"@babel/plugin-transform-block-scoping@^7.0.0", "@babel/plugin-transform-block-scoping@^7.4.0": +"@babel/plugin-transform-block-scoping@^7.0.0": version "7.4.0" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-block-scoping/-/plugin-transform-block-scoping-7.4.0.tgz#164df3bb41e3deb954c4ca32ffa9fcaa56d30bcb" integrity sha512-AWyt3k+fBXQqt2qb9r97tn3iBwFpiv9xdAiG+Gr2HpAZpuayvbL55yWrsV3MyHvXk/4vmSiedhDRl1YI2Iy5nQ== @@ -398,7 +301,7 @@ "@babel/helper-plugin-utils" "^7.0.0" lodash "^4.17.11" -"@babel/plugin-transform-classes@^7.0.0", "@babel/plugin-transform-classes@^7.4.0": +"@babel/plugin-transform-classes@^7.0.0": version "7.4.0" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-classes/-/plugin-transform-classes-7.4.0.tgz#e3428d3c8a3d01f33b10c529b998ba1707043d4d" integrity sha512-XGg1Mhbw4LDmrO9rSTNe+uI79tQPdGs0YASlxgweYRLZqo/EQktjaOV4tchL/UZbM0F+/94uOipmdNGoaGOEYg== @@ -412,37 +315,28 @@ "@babel/helper-split-export-declaration" "^7.4.0" globals "^11.1.0" -"@babel/plugin-transform-computed-properties@^7.0.0", "@babel/plugin-transform-computed-properties@^7.2.0": +"@babel/plugin-transform-computed-properties@^7.0.0": version "7.2.0" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-computed-properties/-/plugin-transform-computed-properties-7.2.0.tgz#83a7df6a658865b1c8f641d510c6f3af220216da" integrity sha512-kP/drqTxY6Xt3NNpKiMomfgkNn4o7+vKxK2DDKcBG9sHj51vHqMBGy8wbDS/J4lMxnqs153/T3+DmCEAkC5cpA== dependencies: "@babel/helper-plugin-utils" "^7.0.0" -"@babel/plugin-transform-destructuring@^7.0.0", "@babel/plugin-transform-destructuring@^7.4.0": +"@babel/plugin-transform-destructuring@^7.0.0": version "7.4.0" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-destructuring/-/plugin-transform-destructuring-7.4.0.tgz#acbb9b2418d290107db333f4d6cd8aa6aea00343" integrity sha512-HySkoatyYTY3ZwLI8GGvkRWCFrjAGXUHur5sMecmCIdIharnlcWWivOqDJI76vvmVZfzwb6G08NREsrY96RhGQ== dependencies: "@babel/helper-plugin-utils" "^7.0.0" -"@babel/plugin-transform-dotall-regex@^7.2.0": - version "7.2.0" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-dotall-regex/-/plugin-transform-dotall-regex-7.2.0.tgz#f0aabb93d120a8ac61e925ea0ba440812dbe0e49" - integrity sha512-sKxnyHfizweTgKZf7XsXu/CNupKhzijptfTM+bozonIuyVrLWVUvYjE2bhuSBML8VQeMxq4Mm63Q9qvcvUcciQ== - dependencies: - "@babel/helper-plugin-utils" "^7.0.0" - "@babel/helper-regex" "^7.0.0" - regexpu-core "^4.1.3" - -"@babel/plugin-transform-duplicate-keys@^7.0.0", "@babel/plugin-transform-duplicate-keys@^7.2.0": +"@babel/plugin-transform-duplicate-keys@^7.0.0": version "7.2.0" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-duplicate-keys/-/plugin-transform-duplicate-keys-7.2.0.tgz#d952c4930f312a4dbfff18f0b2914e60c35530b3" integrity sha512-q+yuxW4DsTjNceUiTzK0L+AfQ0zD9rWaTLiUqHA8p0gxx7lu1EylenfzjeIWNkPy6e/0VG/Wjw9uf9LueQwLOw== dependencies: "@babel/helper-plugin-utils" "^7.0.0" -"@babel/plugin-transform-exponentiation-operator@^7.0.0", "@babel/plugin-transform-exponentiation-operator@^7.2.0": +"@babel/plugin-transform-exponentiation-operator@^7.0.0": version "7.2.0" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-exponentiation-operator/-/plugin-transform-exponentiation-operator-7.2.0.tgz#a63868289e5b4007f7054d46491af51435766008" integrity sha512-umh4hR6N7mu4Elq9GG8TOu9M0bakvlsREEC+ialrQN6ABS4oDQ69qJv1VtR3uxlKMCQMCvzk7vr17RHKcjx68A== @@ -450,14 +344,14 @@ "@babel/helper-builder-binary-assignment-operator-visitor" "^7.1.0" "@babel/helper-plugin-utils" "^7.0.0" -"@babel/plugin-transform-for-of@^7.0.0", "@babel/plugin-transform-for-of@^7.4.0": +"@babel/plugin-transform-for-of@^7.0.0": version "7.4.0" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-for-of/-/plugin-transform-for-of-7.4.0.tgz#56c8c36677f5d4a16b80b12f7b768de064aaeb5f" integrity sha512-vWdfCEYLlYSxbsKj5lGtzA49K3KANtb8qCPQ1em07txJzsBwY+cKJzBHizj5fl3CCx7vt+WPdgDLTHmydkbQSQ== dependencies: "@babel/helper-plugin-utils" "^7.0.0" -"@babel/plugin-transform-function-name@^7.0.0", "@babel/plugin-transform-function-name@^7.2.0": +"@babel/plugin-transform-function-name@^7.0.0": version "7.2.0" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-function-name/-/plugin-transform-function-name-7.2.0.tgz#f7930362829ff99a3174c39f0afcc024ef59731a" integrity sha512-kWgksow9lHdvBC2Z4mxTsvc7YdY7w/V6B2vy9cTIPtLEE9NhwoWivaxdNM/S37elu5bqlLP/qOY906LukO9lkQ== @@ -472,14 +366,14 @@ dependencies: "@babel/helper-plugin-utils" "^7.0.0" -"@babel/plugin-transform-literals@^7.0.0", "@babel/plugin-transform-literals@^7.2.0": +"@babel/plugin-transform-literals@^7.0.0": version "7.2.0" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-literals/-/plugin-transform-literals-7.2.0.tgz#690353e81f9267dad4fd8cfd77eafa86aba53ea1" integrity sha512-2ThDhm4lI4oV7fVQ6pNNK+sx+c/GM5/SaML0w/r4ZB7sAneD/piDJtwdKlNckXeyGK7wlwg2E2w33C/Hh+VFCg== dependencies: "@babel/helper-plugin-utils" "^7.0.0" -"@babel/plugin-transform-modules-amd@^7.0.0", "@babel/plugin-transform-modules-amd@^7.2.0": +"@babel/plugin-transform-modules-amd@^7.0.0": version "7.2.0" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-modules-amd/-/plugin-transform-modules-amd-7.2.0.tgz#82a9bce45b95441f617a24011dc89d12da7f4ee6" integrity sha512-mK2A8ucqz1qhrdqjS9VMIDfIvvT2thrEsIQzbaTdc5QFzhDjQv2CkJJ5f6BXIkgbmaoax3zBr2RyvV/8zeoUZw== @@ -487,46 +381,7 @@ "@babel/helper-module-transforms" "^7.1.0" "@babel/helper-plugin-utils" "^7.0.0" -"@babel/plugin-transform-modules-commonjs@^7.4.0": - version "7.4.0" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-modules-commonjs/-/plugin-transform-modules-commonjs-7.4.0.tgz#3b8ec61714d3b75d20c5ccfa157f2c2e087fd4ca" - integrity sha512-iWKAooAkipG7g1IY0eah7SumzfnIT3WNhT4uYB2kIsvHnNSB6MDYVa5qyICSwaTBDBY2c4SnJ3JtEa6ltJd6Jw== - dependencies: - "@babel/helper-module-transforms" "^7.1.0" - "@babel/helper-plugin-utils" "^7.0.0" - "@babel/helper-simple-access" "^7.1.0" - -"@babel/plugin-transform-modules-systemjs@^7.4.0": - version "7.4.0" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-modules-systemjs/-/plugin-transform-modules-systemjs-7.4.0.tgz#c2495e55528135797bc816f5d50f851698c586a1" - integrity sha512-gjPdHmqiNhVoBqus5qK60mWPp1CmYWp/tkh11mvb0rrys01HycEGD7NvvSoKXlWEfSM9TcL36CpsK8ElsADptQ== - dependencies: - "@babel/helper-hoist-variables" "^7.4.0" - "@babel/helper-plugin-utils" "^7.0.0" - -"@babel/plugin-transform-modules-umd@^7.2.0": - version "7.2.0" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-modules-umd/-/plugin-transform-modules-umd-7.2.0.tgz#7678ce75169f0877b8eb2235538c074268dd01ae" - integrity sha512-BV3bw6MyUH1iIsGhXlOK6sXhmSarZjtJ/vMiD9dNmpY8QXFFQTj+6v92pcfy1iqa8DeAfJFwoxcrS/TUZda6sw== - dependencies: - "@babel/helper-module-transforms" "^7.1.0" - "@babel/helper-plugin-utils" "^7.0.0" - -"@babel/plugin-transform-named-capturing-groups-regex@^7.4.2": - version "7.4.2" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-named-capturing-groups-regex/-/plugin-transform-named-capturing-groups-regex-7.4.2.tgz#800391136d6cbcc80728dbdba3c1c6e46f86c12e" - integrity sha512-NsAuliSwkL3WO2dzWTOL1oZJHm0TM8ZY8ZSxk2ANyKkt5SQlToGA4pzctmq1BEjoacurdwZ3xp2dCQWJkME0gQ== - dependencies: - regexp-tree "^0.1.0" - -"@babel/plugin-transform-new-target@^7.4.0": - version "7.4.0" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-new-target/-/plugin-transform-new-target-7.4.0.tgz#67658a1d944edb53c8d4fa3004473a0dd7838150" - integrity sha512-6ZKNgMQmQmrEX/ncuCwnnw1yVGoaOW5KpxNhoWI7pCQdA0uZ0HqHGqenCUIENAnxRjy2WwNQ30gfGdIgqJXXqw== - dependencies: - "@babel/helper-plugin-utils" "^7.0.0" - -"@babel/plugin-transform-object-super@^7.0.0", "@babel/plugin-transform-object-super@^7.2.0": +"@babel/plugin-transform-object-super@^7.0.0": version "7.2.0" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-object-super/-/plugin-transform-object-super-7.2.0.tgz#b35d4c10f56bab5d650047dad0f1d8e8814b6598" integrity sha512-VMyhPYZISFZAqAPVkiYb7dUe2AsVi2/wCT5+wZdsNO31FojQJa9ns40hzZ6U9f50Jlq4w6qwzdBB2uwqZ00ebg== @@ -534,7 +389,7 @@ "@babel/helper-plugin-utils" "^7.0.0" "@babel/helper-replace-supers" "^7.1.0" -"@babel/plugin-transform-parameters@^7.0.0", "@babel/plugin-transform-parameters@^7.4.0": +"@babel/plugin-transform-parameters@^7.0.0": version "7.4.0" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-parameters/-/plugin-transform-parameters-7.4.0.tgz#a1309426fac4eecd2a9439a4c8c35124a11a48a9" integrity sha512-Xqv6d1X+doyiuCGDoVJFtlZx0onAX0tnc3dY8w71pv/O0dODAbusVv2Ale3cGOwfiyi895ivOBhYa9DhAM8dUA== @@ -543,37 +398,28 @@ "@babel/helper-get-function-arity" "^7.0.0" "@babel/helper-plugin-utils" "^7.0.0" -"@babel/plugin-transform-react-jsx@^7.3.0": - version "7.3.0" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-react-jsx/-/plugin-transform-react-jsx-7.3.0.tgz#f2cab99026631c767e2745a5368b331cfe8f5290" - integrity sha512-a/+aRb7R06WcKvQLOu4/TpjKOdvVEKRLWFpKcNuHhiREPgGRB4TQJxq07+EZLS8LFVYpfq1a5lDUnuMdcCpBKg== - dependencies: - "@babel/helper-builder-react-jsx" "^7.3.0" - "@babel/helper-plugin-utils" "^7.0.0" - "@babel/plugin-syntax-jsx" "^7.2.0" - -"@babel/plugin-transform-regenerator@^7.0.0", "@babel/plugin-transform-regenerator@^7.4.0": +"@babel/plugin-transform-regenerator@^7.0.0": version "7.4.0" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-regenerator/-/plugin-transform-regenerator-7.4.0.tgz#0780e27ee458cc3fdbad18294d703e972ae1f6d1" integrity sha512-SZ+CgL4F0wm4npojPU6swo/cK4FcbLgxLd4cWpHaNXY/NJ2dpahODCqBbAwb2rDmVszVb3SSjnk9/vik3AYdBw== dependencies: regenerator-transform "^0.13.4" -"@babel/plugin-transform-shorthand-properties@^7.0.0", "@babel/plugin-transform-shorthand-properties@^7.2.0": +"@babel/plugin-transform-shorthand-properties@^7.0.0": version "7.2.0" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-shorthand-properties/-/plugin-transform-shorthand-properties-7.2.0.tgz#6333aee2f8d6ee7e28615457298934a3b46198f0" integrity sha512-QP4eUM83ha9zmYtpbnyjTLAGKQritA5XW/iG9cjtuOI8s1RuL/3V6a3DeSHfKutJQ+ayUfeZJPcnCYEQzaPQqg== dependencies: "@babel/helper-plugin-utils" "^7.0.0" -"@babel/plugin-transform-spread@^7.0.0", "@babel/plugin-transform-spread@^7.2.0": +"@babel/plugin-transform-spread@^7.0.0": version "7.2.2" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-spread/-/plugin-transform-spread-7.2.2.tgz#3103a9abe22f742b6d406ecd3cd49b774919b406" integrity sha512-KWfky/58vubwtS0hLqEnrWJjsMGaOeSBn90Ezn5Jeg9Z8KKHmELbP1yGylMlm5N6TPKeY9A2+UaSYLdxahg01w== dependencies: "@babel/helper-plugin-utils" "^7.0.0" -"@babel/plugin-transform-sticky-regex@^7.0.0", "@babel/plugin-transform-sticky-regex@^7.2.0": +"@babel/plugin-transform-sticky-regex@^7.0.0": version "7.2.0" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-sticky-regex/-/plugin-transform-sticky-regex-7.2.0.tgz#a1e454b5995560a9c1e0d537dfc15061fd2687e1" integrity sha512-KKYCoGaRAf+ckH8gEL3JHUaFVyNHKe3ASNsZ+AlktgHevvxGigoIttrEJb8iKN03Q7Eazlv1s6cx2B2cQ3Jabw== @@ -581,7 +427,7 @@ "@babel/helper-plugin-utils" "^7.0.0" "@babel/helper-regex" "^7.0.0" -"@babel/plugin-transform-template-literals@^7.0.0", "@babel/plugin-transform-template-literals@^7.2.0": +"@babel/plugin-transform-template-literals@^7.0.0": version "7.2.0" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-template-literals/-/plugin-transform-template-literals-7.2.0.tgz#d87ed01b8eaac7a92473f608c97c089de2ba1e5b" integrity sha512-FkPix00J9A/XWXv4VoKJBMeSkyY9x/TqIh76wzcdfl57RJJcf8CehQ08uwfhCDNtRQYtHQKBTwKZDEyjE13Lwg== @@ -589,22 +435,14 @@ "@babel/helper-annotate-as-pure" "^7.0.0" "@babel/helper-plugin-utils" "^7.0.0" -"@babel/plugin-transform-typeof-symbol@^7.0.0", "@babel/plugin-transform-typeof-symbol@^7.2.0": +"@babel/plugin-transform-typeof-symbol@^7.0.0": version "7.2.0" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-typeof-symbol/-/plugin-transform-typeof-symbol-7.2.0.tgz#117d2bcec2fbf64b4b59d1f9819894682d29f2b2" integrity sha512-2LNhETWYxiYysBtrBTqL8+La0jIoQQnIScUJc74OYvUGRmkskNY4EzLCnjHBzdmb38wqtTaixpo1NctEcvMDZw== dependencies: "@babel/helper-plugin-utils" "^7.0.0" -"@babel/plugin-transform-typescript@^7.3.2": - version "7.4.0" - resolved "https://registry.yarnpkg.com/@babel/plugin-transform-typescript/-/plugin-transform-typescript-7.4.0.tgz#0389ec53a34e80f99f708c4ca311181449a68eb1" - integrity sha512-U7/+zKnRZg04ggM/Bm+xmu2B/PrwyDQTT/V89FXWYWNMxBDwSx56u6jtk9SEbfLFbZaEI72L+5LPvQjeZgFCrQ== - dependencies: - "@babel/helper-plugin-utils" "^7.0.0" - "@babel/plugin-syntax-typescript" "^7.2.0" - -"@babel/plugin-transform-unicode-regex@^7.0.0", "@babel/plugin-transform-unicode-regex@^7.2.0": +"@babel/plugin-transform-unicode-regex@^7.0.0": version "7.2.0" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-unicode-regex/-/plugin-transform-unicode-regex-7.2.0.tgz#4eb8db16f972f8abb5062c161b8b115546ade08b" integrity sha512-m48Y0lMhrbXEJnVUaYly29jRXbQ3ksxPrS1Tg8t+MHqzXhtBYAvI51euOBaoAlZLPHsieY9XPVMf80a5x0cPcA== @@ -613,65 +451,6 @@ "@babel/helper-regex" "^7.0.0" regexpu-core "^4.1.3" -"@babel/preset-env@^7.4.2": - version "7.4.2" - resolved "https://registry.yarnpkg.com/@babel/preset-env/-/preset-env-7.4.2.tgz#2f5ba1de2daefa9dcca653848f96c7ce2e406676" - integrity sha512-OEz6VOZaI9LW08CWVS3d9g/0jZA6YCn1gsKIy/fut7yZCJti5Lm1/Hi+uo/U+ODm7g4I6gULrCP+/+laT8xAsA== - dependencies: - "@babel/helper-module-imports" "^7.0.0" - "@babel/helper-plugin-utils" "^7.0.0" - "@babel/plugin-proposal-async-generator-functions" "^7.2.0" - "@babel/plugin-proposal-json-strings" "^7.2.0" - "@babel/plugin-proposal-object-rest-spread" "^7.4.0" - "@babel/plugin-proposal-optional-catch-binding" "^7.2.0" - "@babel/plugin-proposal-unicode-property-regex" "^7.4.0" - "@babel/plugin-syntax-async-generators" "^7.2.0" - "@babel/plugin-syntax-json-strings" "^7.2.0" - "@babel/plugin-syntax-object-rest-spread" "^7.2.0" - "@babel/plugin-syntax-optional-catch-binding" "^7.2.0" - "@babel/plugin-transform-arrow-functions" "^7.2.0" - "@babel/plugin-transform-async-to-generator" "^7.4.0" - "@babel/plugin-transform-block-scoped-functions" "^7.2.0" - "@babel/plugin-transform-block-scoping" "^7.4.0" - "@babel/plugin-transform-classes" "^7.4.0" - "@babel/plugin-transform-computed-properties" "^7.2.0" - "@babel/plugin-transform-destructuring" "^7.4.0" - "@babel/plugin-transform-dotall-regex" "^7.2.0" - "@babel/plugin-transform-duplicate-keys" "^7.2.0" - "@babel/plugin-transform-exponentiation-operator" "^7.2.0" - "@babel/plugin-transform-for-of" "^7.4.0" - "@babel/plugin-transform-function-name" "^7.2.0" - "@babel/plugin-transform-literals" "^7.2.0" - "@babel/plugin-transform-modules-amd" "^7.2.0" - "@babel/plugin-transform-modules-commonjs" "^7.4.0" - "@babel/plugin-transform-modules-systemjs" "^7.4.0" - "@babel/plugin-transform-modules-umd" "^7.2.0" - "@babel/plugin-transform-named-capturing-groups-regex" "^7.4.2" - "@babel/plugin-transform-new-target" "^7.4.0" - "@babel/plugin-transform-object-super" "^7.2.0" - "@babel/plugin-transform-parameters" "^7.4.0" - "@babel/plugin-transform-regenerator" "^7.4.0" - "@babel/plugin-transform-shorthand-properties" "^7.2.0" - "@babel/plugin-transform-spread" "^7.2.0" - "@babel/plugin-transform-sticky-regex" "^7.2.0" - "@babel/plugin-transform-template-literals" "^7.2.0" - "@babel/plugin-transform-typeof-symbol" "^7.2.0" - "@babel/plugin-transform-unicode-regex" "^7.2.0" - "@babel/types" "^7.4.0" - browserslist "^4.4.2" - core-js-compat "^3.0.0" - invariant "^2.2.2" - js-levenshtein "^1.1.3" - semver "^5.3.0" - -"@babel/preset-typescript@^7.3.3": - version "7.3.3" - resolved "https://registry.yarnpkg.com/@babel/preset-typescript/-/preset-typescript-7.3.3.tgz#88669911053fa16b2b276ea2ede2ca603b3f307a" - integrity sha512-mzMVuIP4lqtn4du2ynEfdO0+RYcslwrZiJHXu4MGaC1ctJiW2fyaeDrtjJGs7R/KebZ1sgowcIoWf4uRpEfKEg== - dependencies: - "@babel/helper-plugin-utils" "^7.0.0" - "@babel/plugin-transform-typescript" "^7.3.2" - "@babel/runtime@7.0.0": version "7.0.0" resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.0.0.tgz#adeb78fedfc855aa05bc041640f3f6f98e85424c" @@ -710,7 +489,7 @@ globals "^11.1.0" lodash "^4.17.11" -"@babel/types@^7.0.0", "@babel/types@^7.0.0-beta.42", "@babel/types@^7.2.0", "@babel/types@^7.2.2", "@babel/types@^7.3.0", "@babel/types@^7.4.0": +"@babel/types@^7.0.0", "@babel/types@^7.0.0-beta.42", "@babel/types@^7.2.0", "@babel/types@^7.2.2", "@babel/types@^7.4.0": version "7.4.0" resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.4.0.tgz#670724f77d24cce6cc7d8cf64599d511d164894c" integrity sha512-aPvkXyU2SPOnztlgo8n9cEiXW755mgyvueUPcpStqdzoSPm0fjO0vQBjLkt3JKJW7ufikfcnMTTPsN1xaTsBPA== @@ -3083,18 +2862,6 @@ babel-code-frame@^6.22.0, babel-code-frame@^6.26.0: esutils "^2.0.2" js-tokens "^3.0.2" -babel-eslint@^10: - version "10.0.1" - resolved "https://registry.yarnpkg.com/babel-eslint/-/babel-eslint-10.0.1.tgz#919681dc099614cd7d31d45c8908695092a1faed" - integrity sha512-z7OT1iNV+TjOwHNLLyJk+HN+YVWX+CLE6fPD2SymJZOZQBs+QIexFjhm4keGTm8MW9xr4EC9Q0PbaLB24V5GoQ== - dependencies: - "@babel/code-frame" "^7.0.0" - "@babel/parser" "^7.0.0" - "@babel/traverse" "^7.0.0" - "@babel/types" "^7.0.0" - eslint-scope "3.7.1" - eslint-visitor-keys "^1.0.0" - babel-extract-comments@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/babel-extract-comments/-/babel-extract-comments-1.0.0.tgz#0a2aedf81417ed391b85e18b4614e693a0351a21" @@ -3151,16 +2918,6 @@ babel-helper-to-multiple-sequence-expressions@^0.4.3: resolved "https://registry.yarnpkg.com/babel-helper-to-multiple-sequence-expressions/-/babel-helper-to-multiple-sequence-expressions-0.4.3.tgz#5b518b1127f47b3038773386a1561a2b48e632b6" integrity sha1-W1GLESf0ezA4dzOGoVYaK0jmMrY= -babel-loader@^8.0.5: - version "8.0.5" - resolved "https://registry.yarnpkg.com/babel-loader/-/babel-loader-8.0.5.tgz#225322d7509c2157655840bba52e46b6c2f2fe33" - integrity sha512-NTnHnVRd2JnRqPC0vW+iOQWU5pchDbYXsG2E6DMXEpMfUcQKclF9gmf3G3ZMhzG7IG9ji4coL0cm+FxeWxDpnw== - dependencies: - find-cache-dir "^2.0.0" - loader-utils "^1.0.2" - mkdirp "^0.5.1" - util.promisify "^1.0.0" - babel-messages@^6.23.0: version "6.23.0" resolved "https://registry.yarnpkg.com/babel-messages/-/babel-messages-6.23.0.tgz#f3cdf4703858035b2a2951c6ec5edf6c62f2630e" @@ -3749,15 +3506,6 @@ browserify-zlib@^0.2.0: dependencies: pako "~1.0.5" -browserslist@^4.4.2, browserslist@^4.5.1: - version "4.5.3" - resolved "https://registry.yarnpkg.com/browserslist/-/browserslist-4.5.3.tgz#969495c410314bc89f14e748505e58be968080f1" - integrity sha512-Tx/Jtrmh6vFg24AelzLwCaCq1IUJiMDM1x/LPzqbmbktF8Zo7F9ONUpOWsFK6TtdON95mSMaQUWqi0ilc8xM6g== - dependencies: - caniuse-lite "^1.0.30000955" - electron-to-chromium "^1.3.122" - node-releases "^1.1.12" - browserstack@^1.2.0: version "1.5.2" resolved "https://registry.yarnpkg.com/browserstack/-/browserstack-1.5.2.tgz#17d8bb76127a1cc0ea416424df80d218f803673f" @@ -3970,11 +3718,6 @@ cancel-token@^0.1.1: dependencies: "@types/node" "^4.0.30" -caniuse-lite@^1.0.30000955: - version "1.0.30000955" - resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30000955.tgz#360fdb9a1e41d6dd996130411334e44a39e4446d" - integrity sha512-6AwmIKgqCYfDWWadRkAuZSHMQP4Mmy96xAXEdRBlN/luQhlRYOKgwOlZ9plpCOsVbBuqbTmGqDK3JUM/nlr8CA== - capture-stack-trace@^1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/capture-stack-trace/-/capture-stack-trace-1.0.1.tgz#a6c0bbe1f38f3aa0b92238ecb6ff42c344d4135d" @@ -4639,26 +4382,6 @@ copy-webpack-plugin@^5.0.2: serialize-javascript "^1.4.0" webpack-log "^2.0.0" -core-js-compat@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/core-js-compat/-/core-js-compat-3.0.0.tgz#cd9810b8000742535a4a43773866185e310bd4f7" - integrity sha512-W/Ppz34uUme3LmXWjMgFlYyGnbo1hd9JvA0LNQ4EmieqVjg2GPYbj3H6tcdP2QGPGWdRKUqZVbVKLNIFVs/HiA== - dependencies: - browserslist "^4.5.1" - core-js "3.0.0" - core-js-pure "3.0.0" - semver "^5.6.0" - -core-js-pure@3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/core-js-pure/-/core-js-pure-3.0.0.tgz#a5679adb4875427c8c0488afc93e6f5b7125859b" - integrity sha512-yPiS3fQd842RZDgo/TAKGgS0f3p2nxssF1H65DIZvZv0Od5CygP8puHXn3IQiM/39VAvgCbdaMQpresrbGgt9g== - -core-js@3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/core-js/-/core-js-3.0.0.tgz#a8dbfa978d29bfc263bfb66c556d0ca924c28957" - integrity sha512-WBmxlgH2122EzEJ6GH8o9L/FeoUKxxxZ6q6VUxoTlsE4EvbTWKJb447eyVxTEuq0LpXjlq/kCB2qgBvsYRkLvQ== - core-js@^2.4.0: version "2.6.5" resolved "https://registry.yarnpkg.com/core-js/-/core-js-2.6.5.tgz#44bc8d249e7fb2ff5d00e0341a7ffb94fbf67895" @@ -5423,11 +5146,6 @@ ejs@^2.5.9: resolved "https://registry.yarnpkg.com/ejs/-/ejs-2.6.1.tgz#498ec0d495655abc6f23cd61868d926464071aa0" integrity sha512-0xy4A/twfrRCnkhfk8ErDi5DqdAsAqeGxht4xkCUrsvhhbQNs7E+4jV0CN7+NKIY0aHE72+XvqtBIXzD31ZbXQ== -electron-to-chromium@^1.3.122: - version "1.3.122" - resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.3.122.tgz#b32a0805f48557bd3c3b8104eadc7fa511b14a9a" - integrity sha512-3RKoIyCN4DhP2dsmleuFvpJAIDOseWH88wFYBzb22CSwoFDSWRc4UAMfrtc9h8nBdJjTNIN3rogChgOy6eFInw== - elegant-spinner@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/elegant-spinner/-/elegant-spinner-1.0.1.tgz#db043521c95d7e303fd8f345bedc3349cfb0729e" @@ -5779,14 +5497,6 @@ eslint-plugin-react@^7.14.3: prop-types "^15.7.2" resolve "^1.10.1" -eslint-scope@3.7.1: - version "3.7.1" - resolved "https://registry.yarnpkg.com/eslint-scope/-/eslint-scope-3.7.1.tgz#3d63c3edfda02e06e01a452ad88caacc7cdcb6e8" - integrity sha1-PWPD7f2gLgbgGkUq2IyqzHzctug= - dependencies: - esrecurse "^4.1.0" - estraverse "^4.1.1" - eslint-scope@^4.0.0: version "4.0.3" resolved "https://registry.yarnpkg.com/eslint-scope/-/eslint-scope-4.0.3.tgz#ca03833310f6889a3264781aa82e63eb9cfe7848" @@ -5909,7 +5619,7 @@ esutils@^1.1.6: resolved "https://registry.yarnpkg.com/esutils/-/esutils-1.1.6.tgz#c01ccaa9ae4b897c6d0c3e210ae52f3c7a844375" integrity sha1-wBzKqa5LiXxtDD4hCuUvPHqEQ3U= -esutils@^2.0.0, esutils@^2.0.2: +esutils@^2.0.2: version "2.0.2" resolved "https://registry.yarnpkg.com/esutils/-/esutils-2.0.2.tgz#0abf4f1caa5bcb1f7a9d8acc6dea4faaa04bac9b" integrity sha1-Cr9PHKpbyx96nYrMbepPqqBLrJs= @@ -8346,11 +8056,6 @@ joi@^14.3.1: resolved "https://registry.yarnpkg.com/jquery/-/jquery-3.4.0.tgz#8de513fa0fa4b2c7d2e48a530e26f0596936efdf" integrity sha512-ggRCXln9zEqv6OqAGXFEcshF5dSBvCkzj6Gm2gzuR5fWawaX8t7cxKVkkygKODrDAzKdoYw3l/e3pm3vlT4IbQ== -js-levenshtein@^1.1.3: - version "1.1.6" - resolved "https://registry.yarnpkg.com/js-levenshtein/-/js-levenshtein-1.1.6.tgz#c6cee58eb3550372df8deb85fad5ce66ce01d59d" - integrity sha512-X2BB11YZtrRqY4EnQcLX5Rh373zbK4alC1FW7D7MBhL2gtcC17cTnr6DmfHZeS0s2rTHjUTMMHfG7gO8SSdw+g== - "js-tokens@^3.0.0 || ^4.0.0", js-tokens@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-4.0.0.tgz#19203fb59991df98e3a287050d4647cdeaf32499" @@ -9970,13 +9675,6 @@ node-pre-gyp@^0.12.0: semver "^5.3.0" tar "^4" -node-releases@^1.1.12: - version "1.1.12" - resolved "https://registry.yarnpkg.com/node-releases/-/node-releases-1.1.12.tgz#1d6baf544316b5422fcd35efe18708370a4e7637" - integrity sha512-Y+AQ1xdjcgaEzpL65PBEF3fnl1FNKnDh9Zm+AUQLIlyyqtSc4u93jyMN4zrjMzdwKQ10RTr3tgY1x7qpsfF/xg== - dependencies: - semver "^5.3.0" - node-status-codes@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/node-status-codes/-/node-status-codes-1.0.0.tgz#5ae5541d024645d32a58fcddc9ceecea7ae3ac2f" @@ -11656,17 +11354,12 @@ regex-not@^1.0.0, regex-not@^1.0.2: extend-shallow "^3.0.2" safe-regex "^1.1.0" -regexp-tree@^0.1.0: - version "0.1.5" - resolved "https://registry.yarnpkg.com/regexp-tree/-/regexp-tree-0.1.5.tgz#7cd71fca17198d04b4176efd79713f2998009397" - integrity sha512-nUmxvfJyAODw+0B13hj8CFVAxhe7fDEAgJgaotBu3nnR+IgGgZq59YedJP5VYTlkEfqjuK6TuRpnymKdatLZfQ== - regexpp@^2.0.1: version "2.0.1" resolved "https://registry.yarnpkg.com/regexpp/-/regexpp-2.0.1.tgz#8d19d31cf632482b589049f8281f93dbcba4d07f" integrity sha512-lv0M6+TkDVniA3aD1Eg0DVpfU/booSu7Eev3TDO/mZKHBfVjgCGTV4t4buppESEYDtkArYFOxTJWv6S5C+iaNw== -regexpu-core@^4.1.3, regexpu-core@^4.5.4: +regexpu-core@^4.1.3: version "4.5.4" resolved "https://registry.yarnpkg.com/regexpu-core/-/regexpu-core-4.5.4.tgz#080d9d02289aa87fe1667a4f5136bc98a6aebaae" integrity sha512-BtizvGtFQKGPUcTy56o3nk1bGRp4SZOTYrDtGNlqCQufptV5IkkLN6Emw+yunAJjzf+C9FQFtvq7IoA3+oMYHQ== @@ -13834,7 +13527,7 @@ util-deprecate@^1.0.1, util-deprecate@~1.0.1: resolved "https://registry.yarnpkg.com/util-deprecate/-/util-deprecate-1.0.2.tgz#450d4dc9fa70de732762fbd2d4a28981419a0ccf" integrity sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8= -util.promisify@1.0.0, util.promisify@^1.0.0: +util.promisify@1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/util.promisify/-/util.promisify-1.0.0.tgz#440f7165a459c9a16dc145eb8e72f35687097030" integrity sha512-i+6qA2MPhvoKLuxnJNpXAGhg7HphQOSUq2LKMZD0m15EiskXUkMvKdF4Uui0WYeCUGea+o2cw/ZuwehtfsrNkA== From c4d888f0605fe9467a407ae70f910c7f18707623 Mon Sep 17 00:00:00 2001 From: Paulus Schoutsen Date: Sun, 8 Sep 2019 23:47:28 -0700 Subject: [PATCH 10/26] Whitelist tags/attributes instead of allow-all (#3657) --- src/resources/markdown_worker.ts | 39 +++++++++++++++++++++++++------- 1 file changed, 31 insertions(+), 8 deletions(-) diff --git a/src/resources/markdown_worker.ts b/src/resources/markdown_worker.ts index ec06680ce0..fd2ee988e3 100644 --- a/src/resources/markdown_worker.ts +++ b/src/resources/markdown_worker.ts @@ -2,9 +2,12 @@ import marked from "marked"; // @ts-ignore import filterXSS from "xss"; -const allowedSvgTags = ["svg", "path"]; +interface WhiteList { + [tag: string]: string[]; +} -const allowedTag = (tag: string) => tag === "ha-icon"; +let whiteListNormal: WhiteList | undefined; +let whiteListSvg: WhiteList | undefined; export const renderMarkdown = ( content: string, @@ -13,10 +16,30 @@ export const renderMarkdown = ( // Do not allow SVG on untrusted content, it allows XSS. allowSvg?: boolean; } = {} -) => - filterXSS(marked(content, markedOptions), { - onIgnoreTag: hassOptions.allowSvg - ? (tag, html) => - allowedTag(tag) || allowedSvgTags.includes(tag) ? html : null - : (tag, html) => (allowedTag(tag) ? html : null), +) => { + if (!whiteListNormal) { + whiteListNormal = { + ...filterXSS.whiteList, + "ha-icon": ["icon"], + }; + } + + let whiteList: WhiteList | undefined; + + if (hassOptions.allowSvg) { + if (!whiteListSvg) { + whiteListSvg = { + ...whiteListNormal, + svg: ["xmlns", "height", "width"], + path: ["transform", "stroke", "d"], + }; + } + whiteList = whiteListSvg; + } else { + whiteList = whiteListNormal; + } + + return filterXSS(marked(content, markedOptions), { + whiteList, }); +}; From 1a5ae99c426e469b6632ca398caf9aabdf480bde Mon Sep 17 00:00:00 2001 From: Paulus Schoutsen Date: Sun, 8 Sep 2019 23:51:30 -0700 Subject: [PATCH 11/26] Update ESLint --- .eslintrc-hound.json | 1 + hassio/src/entrypoint.js | 2 ++ 2 files changed, 3 insertions(+) diff --git a/.eslintrc-hound.json b/.eslintrc-hound.json index 50b04a73e0..9866534ccf 100644 --- a/.eslintrc-hound.json +++ b/.eslintrc-hound.json @@ -1,6 +1,7 @@ { "extends": ["airbnb-base", "prettier"], "parserOptions": { + "ecmaVersion": "2020", "ecmaFeatures": { "jsx": true, "modules": true diff --git a/hassio/src/entrypoint.js b/hassio/src/entrypoint.js index 00219c6730..13e57019fd 100644 --- a/hassio/src/entrypoint.js +++ b/hassio/src/entrypoint.js @@ -1,5 +1,7 @@ window.loadES5Adapter().then(() => { + // eslint-disable-next-line import(/* webpackChunkName: "hassio-icons" */ "./resources/hassio-icons"); + // eslint-disable-next-line import(/* webpackChunkName: "hassio-main" */ "./hassio-main"); }); const styleEl = document.createElement("style"); From 11f917d5f8b2e9432fc9ea0e6baf0816cb331e3f Mon Sep 17 00:00:00 2001 From: Bram Kragten Date: Mon, 9 Sep 2019 14:08:52 +0200 Subject: [PATCH 12/26] Add vibration (#3588) * Add vibration I don't have a device that supports vibrate, and can't find a list of patterns, maybe someone can make some nice patterns? * listen event * Mixin * move logic to mixin --- src/state/haptic-mixin.ts | 28 ++++++++++++++++++++++++++++ src/state/hass-element.ts | 2 ++ 2 files changed, 30 insertions(+) create mode 100644 src/state/haptic-mixin.ts diff --git a/src/state/haptic-mixin.ts b/src/state/haptic-mixin.ts new file mode 100644 index 0000000000..58bd47129a --- /dev/null +++ b/src/state/haptic-mixin.ts @@ -0,0 +1,28 @@ +import { Constructor, LitElement, PropertyValues } from "lit-element"; +import { HassBaseEl } from "./hass-base-mixin"; + +import { HapticType } from "../data/haptics"; + +const hapticPatterns = { + success: [50, 50, 50], + warning: [100, 50, 100], + failure: [200, 100, 200], + light: [50], + medium: [100], + heavy: [200], + selection: [20], +}; + +const handleHaptic = (hapticType: HapticType) => { + navigator.vibrate(hapticPatterns[hapticType]); +}; + +export const hapticMixin = (superClass: Constructor) => + class extends superClass { + protected firstUpdated(changedProps: PropertyValues) { + super.firstUpdated(changedProps); + if (navigator.vibrate) { + window.addEventListener("haptic", (e) => handleHaptic(e.detail)); + } + } + }; diff --git a/src/state/hass-element.ts b/src/state/hass-element.ts index da67ba1385..c225ef9224 100644 --- a/src/state/hass-element.ts +++ b/src/state/hass-element.ts @@ -9,6 +9,7 @@ import { dialogManagerMixin } from "./dialog-manager-mixin"; import { connectionMixin } from "./connection-mixin"; import NotificationMixin from "./notification-mixin"; import DisconnectToastMixin from "./disconnect-toast-mixin"; +import { hapticMixin } from "./haptic-mixin"; import { urlSyncMixin } from "./url-sync-mixin"; import { LitElement } from "lit-element"; @@ -27,4 +28,5 @@ export class HassElement extends ext(HassBaseMixin(LitElement), [ dialogManagerMixin, urlSyncMixin, ZHADialogMixin, + hapticMixin, ]) {} From 8a710202f1ea5e40714ea9cb2a84eae62f62c06f Mon Sep 17 00:00:00 2001 From: Ian Richardson Date: Mon, 9 Sep 2019 07:10:20 -0500 Subject: [PATCH 13/26] Stop effect in more-info-light (#3636) * Convert weather-forecast to LitElement Part of https://github.com/home-assistant/home-assistant-polymer/issues/2095 Not sure how RTL works and how to apply it. Also, thinking I should update if the forecast changes and not just the state. Input? * Revert "Convert weather-forecast to LitElement" This reverts commit e1893b0a83f5973df7a28e5d30c3d4d0496155a1. * Add stop effect button Closes https://github.com/home-assistant/home-assistant-polymer/issues/3619 * address review comments * cleanup --- src/dialogs/more-info/controls/more-info-light.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/dialogs/more-info/controls/more-info-light.js b/src/dialogs/more-info/controls/more-info-light.js index c40fd37497..85c9575936 100644 --- a/src/dialogs/more-info/controls/more-info-light.js +++ b/src/dialogs/more-info/controls/more-info-light.js @@ -1,6 +1,7 @@ import "@polymer/iron-flex-layout/iron-flex-layout-classes"; import "@polymer/paper-item/paper-item"; import "@polymer/paper-listbox/paper-listbox"; + import { html } from "@polymer/polymer/lib/utils/html-tag"; import { PolymerElement } from "@polymer/polymer/polymer-element"; @@ -188,6 +189,7 @@ class MoreInfoLight extends LocalizeMixin(EventsMixin(PolymerElement)) { on-selected-changed="effectChanged" attr-for-selected="item-name" > + stop