👋 decorators (#1790)

This commit is contained in:
Paulus Schoutsen 2018-10-17 13:58:24 +02:00 committed by GitHub
parent 1dcc645fec
commit e020fd1154
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 20 additions and 67 deletions

View File

@ -20,9 +20,6 @@ module.exports.babelLoaderConfig = ({ latestBuild }) => {
"@babel/plugin-proposal-object-rest-spread",
{ loose: true, useBuiltIns: true },
],
// Used for decorators in typescript
["@babel/plugin-proposal-decorators", { legacy: true }],
["@babel/plugin-proposal-class-properties", { loose: true }],
// Only support the syntax, Webpack will handle it.
"@babel/syntax-dynamic-import",
[

View File

@ -91,8 +91,6 @@
"devDependencies": {
"@babel/core": "^7.1.2",
"@babel/plugin-external-helpers": "^7.0.0",
"@babel/plugin-proposal-class-properties": "^7.1.0",
"@babel/plugin-proposal-decorators": "^7.1.2",
"@babel/plugin-proposal-object-rest-spread": "^7.0.0",
"@babel/plugin-syntax-dynamic-import": "^7.0.0",
"@babel/plugin-transform-react-jsx": "^7.0.0",

View File

@ -1,10 +1,4 @@
import {
html,
LitElement,
property,
customElement,
eventOptions,
} from "@polymer/lit-element";
import { html, LitElement } from "@polymer/lit-element";
import { fireEvent } from "../../../common/dom/fire_event.js";
import "../../../components/ha-card.js";
@ -28,15 +22,18 @@ interface Config extends LovelaceConfig {
service_data?: object;
}
@customElement("hui-entity-button-card" as any)
export class HuiEntityButtonCard extends HassLocalizeLitMixin(LitElement)
implements LovelaceCard {
@property()
protected hass?: HomeAssistant;
@property()
protected config?: Config;
static get properties() {
return {
hass: {},
config: {},
};
}
public getCardSize() {
return 2;
}
@ -156,7 +153,6 @@ export class HuiEntityButtonCard extends HassLocalizeLitMixin(LitElement)
return `hsl(${hue}, 100%, ${100 - sat / 2}%)`;
}
@eventOptions({ passive: true })
private handleClick() {
const config = this.config;
if (!config) {
@ -191,3 +187,5 @@ declare global {
"hui-entity-button-card": HuiEntityButtonCard;
}
}
customElements.define("hui-entity-button-card", HuiEntityButtonCard);

View File

@ -1,10 +1,4 @@
import {
html,
LitElement,
customElement,
property,
eventOptions,
} from "@polymer/lit-element";
import { html, LitElement } from "@polymer/lit-element";
import { classMap } from "lit-html/directives/classMap.js";
import { repeat } from "lit-html/directives/repeat";
@ -41,17 +35,19 @@ interface Config extends LovelaceConfig {
entities: EntityConfig[];
}
@customElement("hui-glance-card" as any)
export class HuiGlanceCard extends HassLocalizeLitMixin(LitElement)
implements LovelaceCard {
@property()
protected hass?: HomeAssistant;
@property()
protected config?: Config;
protected configEntities?: EntityConfig[];
static get properties() {
return {
hass: {},
config: {},
};
}
public getCardSize() {
return 3;
}
@ -185,7 +181,6 @@ export class HuiGlanceCard extends HassLocalizeLitMixin(LitElement)
`;
}
@eventOptions({ passive: true })
private handleClick(ev: MouseEvent) {
const config = (ev.currentTarget as any).entityConf as EntityConfig;
const entityId = config.entity;
@ -210,3 +205,5 @@ declare global {
"hui-glance-card": HuiGlanceCard;
}
}
customElements.define("hui-glance-card", HuiGlanceCard);

View File

@ -9,7 +9,6 @@
"noUnusedParameters": true,
"noImplicitReturns": true,
"noFallthroughCasesInSwitch": true,
"experimentalDecorators": true,
"strict": true,
"noImplicitAny": false
}

View File

@ -542,28 +542,6 @@
"@babel/helper-remap-async-to-generator" "^7.1.0"
"@babel/plugin-syntax-async-generators" "^7.0.0"
"@babel/plugin-proposal-class-properties@^7.1.0":
version "7.1.0"
resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-class-properties/-/plugin-proposal-class-properties-7.1.0.tgz#9af01856b1241db60ec8838d84691aa0bd1e8df4"
integrity sha512-/PCJWN+CKt5v1xcGn4vnuu13QDoV+P7NcICP44BoonAJoPSGwVkgrXihFIQGiEjjPlUDBIw1cM7wYFLARS2/hw==
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.1.0"
"@babel/plugin-syntax-class-properties" "^7.0.0"
"@babel/plugin-proposal-decorators@^7.1.2":
version "7.1.2"
resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-decorators/-/plugin-proposal-decorators-7.1.2.tgz#79829bd75fced6581ec6c7ab1930e8d738e892e7"
integrity sha512-YooynBO6PmBgHvAd0fl5e5Tq/a0pEC6RqF62ouafme8FzdIVH41Mz/u1dn8fFVm4jzEJ+g/MsOxouwybJPuP8Q==
dependencies:
"@babel/helper-plugin-utils" "^7.0.0"
"@babel/helper-replace-supers" "^7.1.0"
"@babel/helper-split-export-declaration" "^7.0.0"
"@babel/plugin-syntax-decorators" "^7.1.0"
"@babel/plugin-proposal-json-strings@^7.0.0":
version "7.0.0"
resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-json-strings/-/plugin-proposal-json-strings-7.0.0.tgz#3b4d7b5cf51e1f2e70f52351d28d44fc2970d01e"
@ -619,20 +597,6 @@
dependencies:
"@babel/helper-plugin-utils" "^7.0.0"
"@babel/plugin-syntax-class-properties@^7.0.0":
version "7.0.0"
resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-class-properties/-/plugin-syntax-class-properties-7.0.0.tgz#e051af5d300cbfbcec4a7476e37a803489881634"
integrity sha512-cR12g0Qzn4sgkjrbrzWy2GE7m9vMl/sFkqZ3gIpAQdrvPDnLM8180i+ANDFIXfjHo9aqp0ccJlQ0QNZcFUbf9w==
dependencies:
"@babel/helper-plugin-utils" "^7.0.0"
"@babel/plugin-syntax-decorators@^7.1.0":
version "7.1.0"
resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-decorators/-/plugin-syntax-decorators-7.1.0.tgz#2fa7c1a7905a299c9853ebcef340306675f9cbdc"
integrity sha512-uQvRSbgQ0nQg3jsmIixXXDCgSpkBolJ9X7NYThMKCcjvE8dN2uWJUzTUNNAeuKOjARTd+wUQV0ztXpgunZYKzQ==
dependencies:
"@babel/helper-plugin-utils" "^7.0.0"
"@babel/plugin-syntax-dynamic-import@^7.0.0":
version "7.0.0"
resolved "https://registry.yarnpkg.com/@babel/plugin-syntax-dynamic-import/-/plugin-syntax-dynamic-import-7.0.0.tgz#6dfb7d8b6c3be14ce952962f658f3b7eb54c33ee"