Skip to content

Commit d7bedfe

Browse files
authored
Merge pull request #84 from iantrich/upgrade-deps
upgrade deps
2 parents b8f4526 + 2723462 commit d7bedfe

7 files changed

Lines changed: 1603 additions & 928 deletions

File tree

.devcontainer/ui-lovelace.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ views:
77
style:
88
top: 80.3%
99
left: 77.6%
10+
opacity: 10%
1011
entities:
1112
- switch.ceiling_fan
1213
element:

.eslintrc.js

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,14 @@
11
module.exports = {
2-
parser: '@typescript-eslint/parser', // Specifies the ESLint parser
3-
extends: [
4-
'plugin:@typescript-eslint/recommended', // Uses the recommended rules from the @typescript-eslint/eslint-plugin
5-
'prettier/@typescript-eslint', // Uses eslint-config-prettier to disable ESLint rules from @typescript-eslint/eslint-plugin that would conflict with prettier
6-
'plugin:prettier/recommended', // Enables eslint-plugin-prettier and displays prettier errors as ESLint errors. Make sure this is always the last configuration in the extends array.
7-
],
2+
parser: "@typescript-eslint/parser", // Specifies the ESLint parser
83
parserOptions: {
9-
ecmaVersion: 2018, // Allows for the parsing of modern ECMAScript features
10-
sourceType: 'module', // Allows for the use of imports
11-
experimentalDecorators: true,
4+
ecmaVersion: 2020, // Allows for the parsing of modern ECMAScript features
5+
sourceType: "module" // Allows for the use of imports
126
},
7+
extends: [
8+
"plugin:@typescript-eslint/recommended" // Uses the recommended rules from the @typescript-eslint/eslint-plugin
9+
],
1310
rules: {
14-
"@typescript-eslint/camelcase": 0
11+
// Place to specify ESLint rules. Can be used to overwrite rules specified from the extended configs
12+
// e.g. "@typescript-eslint/explicit-function-return-type": "off",
1513
}
16-
};
14+
};

package.json

Lines changed: 23 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -15,31 +15,33 @@
1515
"author": "Ian Richardson <iantrich@gmail.com>",
1616
"license": "MIT",
1717
"dependencies": {
18-
"custom-card-helpers": "^1.6.6",
1918
"deep-clone-simple": "^1.1.1",
20-
"home-assistant-js-websocket": "^4.4.0",
21-
"lit-element": "^2.4.0",
22-
"lit-html": "^1.3.0"
19+
"custom-card-helpers": "^1.7.2",
20+
"home-assistant-js-websocket": "^5.11.1",
21+
"lit": "^2.0.0-rc.2"
2322
},
2423
"devDependencies": {
25-
"@babel/core": "^7.6.4",
26-
"@babel/plugin-proposal-class-properties": "^7.5.5",
27-
"@babel/plugin-proposal-decorators": "^7.4.0",
28-
"@typescript-eslint/eslint-plugin": "^2.6.0",
29-
"@typescript-eslint/parser": "^2.6.0",
30-
"eslint": "^6.6.0",
31-
"eslint-config-airbnb-base": "^14.0.0",
32-
"eslint-config-prettier": "^6.5.0",
33-
"eslint-plugin-import": "^2.18.2",
34-
"eslint-plugin-prettier": "^3.1.1",
35-
"prettier": "^1.18.2",
36-
"rollup": "^1.26.0",
37-
"rollup-plugin-babel": "^4.3.3",
24+
"@babel/core": "^7.15.0",
25+
"@babel/plugin-proposal-class-properties": "^7.14.5",
26+
"@babel/plugin-proposal-decorators": "^7.14.5",
27+
"@rollup/plugin-json": "^4.1.0",
28+
"@typescript-eslint/eslint-plugin": "^4.33.0",
29+
"@typescript-eslint/parser": "^4.33.0",
30+
"eslint": "^7.32.0",
31+
"eslint-config-airbnb-base": "^14.2.1",
32+
"eslint-config-prettier": "^8.3.0",
33+
"eslint-plugin-import": "^2.24.0",
34+
"eslint-plugin-prettier": "^4.0.0",
35+
"prettier": "^2.4.1",
36+
"rollup": "^2.58.0",
37+
"rollup-plugin-babel": "^4.4.0",
38+
"rollup-plugin-commonjs": "^10.1.0",
3839
"rollup-plugin-node-resolve": "^5.2.0",
39-
"rollup-plugin-serve": "^1.0.1",
40-
"rollup-plugin-typescript2": "^0.24.3",
41-
"rollup-plugin-uglify": "^6.0.3",
42-
"typescript": "^3.6.4"
40+
"rollup-plugin-serve": "^1.1.0",
41+
"rollup-plugin-terser": "^7.0.2",
42+
"rollup-plugin-typescript2": "^0.30.0",
43+
"rollup-plugin-uglify": "^6.0.4",
44+
"typescript": "^4.4.3"
4345
},
4446
"scripts": {
4547
"start": "rollup -c rollup.config.dev.js --watch",

src/config-template-card.ts

Lines changed: 19 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,6 @@
1-
import {
2-
LitElement,
3-
html,
4-
customElement,
5-
property,
6-
TemplateResult,
7-
PropertyValues,
8-
internalProperty,
9-
} from 'lit-element';
1+
import { LitElement, html, customElement, property, TemplateResult, PropertyValues, state } from 'lit-element';
102
import deepClone from 'deep-clone-simple';
11-
import { HomeAssistant } from 'custom-card-helpers';
3+
import { computeCardSize, HomeAssistant, LovelaceCard } from 'custom-card-helpers';
124

135
import { ConfigTemplateConfig } from './types';
146
import { CARD_VERSION } from './const';
@@ -23,8 +15,8 @@ console.info(
2315
@customElement('config-template-card')
2416
export class ConfigTemplateCard extends LitElement {
2517
@property({ attribute: false }) public hass?: HomeAssistant;
26-
@internalProperty() private _config?: ConfigTemplateConfig;
27-
@internalProperty() private _helpers?: any;
18+
@state() private _config?: ConfigTemplateConfig;
19+
@state() private _helpers?: any;
2820
private _initialized = false;
2921

3022
public setConfig(config: ConfigTemplateConfig): void {
@@ -85,6 +77,18 @@ export class ConfigTemplateCard extends LitElement {
8577
return true;
8678
}
8779

80+
public getCardSize(): number | Promise<number> {
81+
if (this.shadowRoot) {
82+
const element = this.shadowRoot.querySelector('#card > *') as LovelaceCard;
83+
if (element) {
84+
console.log('computeCardSize is ' + computeCardSize(element));
85+
return computeCardSize(element);
86+
}
87+
}
88+
89+
return 1;
90+
}
91+
8892
protected render(): TemplateResult | void {
8993
if (
9094
!this._config ||
@@ -129,7 +133,9 @@ export class ConfigTemplateCard extends LitElement {
129133
}
130134

131135
return html`
132-
${element}
136+
<div id="card">
137+
${element}
138+
</div>
133139
`;
134140
}
135141

src/const.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
export const CARD_VERSION = '1.3.5';
1+
export const CARD_VERSION = '1.3.6';

tsconfig.json

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,11 @@
33
"target": "es2017",
44
"module": "esnext",
55
"moduleResolution": "node",
6-
"lib": ["es2017", "dom", "dom.iterable"],
6+
"lib": [
7+
"es2017",
8+
"dom",
9+
"dom.iterable"
10+
],
711
"noEmit": true,
812
"noUnusedParameters": true,
913
"noImplicitReturns": true,
@@ -14,4 +18,4 @@
1418
"resolveJsonModule": true,
1519
"experimentalDecorators": true
1620
}
17-
}
21+
}

0 commit comments

Comments
 (0)