Skip to content

Commit

Permalink
Merge pull request #157 from tomvanswam/dev
Browse files Browse the repository at this point in the history
v1.1.1
  • Loading branch information
tomvanswam committed Mar 10, 2021
2 parents e80c940 + c312bdf commit 8fb27cb
Show file tree
Hide file tree
Showing 7 changed files with 859 additions and 776 deletions.
2 changes: 1 addition & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ module.exports = {
parser: '@typescript-eslint/parser', // Specifies the ESLint parser
extends: [
'plugin:@typescript-eslint/recommended', // Uses the recommended rules from the @typescript-eslint/eslint-plugin
'prettier/@typescript-eslint', // Uses eslint-config-prettier to disable ESLint rules from @typescript-eslint/eslint-plugin that would conflict with prettier
'prettier', // Uses eslint-config-prettier to disable ESLint rules from @typescript-eslint/eslint-plugin that would conflict with prettier
'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.
],
parserOptions: {
Expand Down
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -435,6 +435,10 @@ compass:
language: pt
```

### More YAML examples

See the [issues with the `config how-to` label](https://github.com/tomvanswam/compass-card/issues?q=label%3A%22config+how-to%22) for more configuration examples.

## Upgrade from version v0.x.x to v1.0.0 +

v1.0.0 has breaking changes, meaning the card wil not work as expected after updating.
Expand Down
1,564 changes: 814 additions & 750 deletions package-lock.json

Large diffs are not rendered by default.

28 changes: 14 additions & 14 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "compass-card",
"version": "1.1.0",
"version": "1.1.1",
"description": "Lovelace compass-card",
"keywords": [
"home-assistant",
Expand All @@ -15,32 +15,32 @@
"author": "Tom van Swam <tom@vanswam.com>",
"license": "MIT",
"dependencies": {
"custom-card-helpers": "^1.6.6",
"home-assistant-js-websocket": "^5.7.0",
"custom-card-helpers": "^1.7.0",
"home-assistant-js-websocket": "^5.9.0",
"lit-element": "^2.4.0",
"lit-html": "^1.3.0"
},
"devDependencies": {
"@babel/core": "^7.12.10",
"@babel/plugin-proposal-class-properties": "^7.12.1",
"@babel/plugin-proposal-decorators": "^7.12.12",
"@rollup/plugin-babel": "^5.2.2",
"@rollup/plugin-commonjs": "^17.0.0",
"@babel/core": "^7.13.10",
"@babel/plugin-proposal-class-properties": "^7.13.0",
"@babel/plugin-proposal-decorators": "^7.13.5",
"@rollup/plugin-babel": "^5.3.0",
"@rollup/plugin-commonjs": "^17.1.0",
"@rollup/plugin-json": "^4.1.0",
"@rollup/plugin-node-resolve": "^11.0.1",
"@typescript-eslint/eslint-plugin": "^4.12.0",
"@typescript-eslint/parser": "^4.12.0",
"eslint": "^7.17.0",
"@typescript-eslint/eslint-plugin": "^4.17.0",
"@typescript-eslint/parser": "^4.17.0",
"eslint": "^7.21.0",
"eslint-config-airbnb-base": "^14.2.1",
"eslint-config-prettier": "^7.1.0",
"eslint-config-prettier": "^8.1.0",
"eslint-plugin-import": "^2.22.1",
"eslint-plugin-prettier": "^3.3.1",
"prettier": "^2.2.1",
"rollup": "^2.36.1",
"rollup-plugin-serve": "^1.1.0",
"rollup-plugin-terser": "^7.0.2",
"rollup-plugin-typescript2": "^0.29.0",
"typescript": "^4.1.3"
"rollup-plugin-typescript2": "^0.30.0",
"typescript": "^4.2.3"
},
"scripts": {
"start": "rollup -c --watch",
Expand Down
10 changes: 5 additions & 5 deletions src/compass-card.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,11 +73,11 @@ export class CompassCard extends LitElement {
}

this.colors = {
accent: getComputedStyle(document.documentElement).getPropertyValue('--accent-color').trim(),
primary: getComputedStyle(document.documentElement).getPropertyValue('--primary-color').trim(),
stateIcon: getComputedStyle(document.documentElement).getPropertyValue('--state-icon-color').trim(),
secondaryText: getComputedStyle(document.documentElement).getPropertyValue('--secondary-text-color').trim(),
primaryText: getComputedStyle(document.documentElement).getPropertyValue('--primary-text-color').trim(),
accent: 'var(--accent-color)',
primary: 'var(--primary-color)',
stateIcon: 'var(--state-icon-color)',
secondaryText: 'var(--secondary-text-color)',
primaryText: 'var(--primary-text-color)',
};

this._config = {
Expand Down
2 changes: 1 addition & 1 deletion src/const.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { localize } from './localize/localize';

export const CARD_VERSION = '1.1.0';
export const CARD_VERSION = '1.1.1';
export const ICONS = {
compass: 'mdi:compass',
};
Expand Down
25 changes: 20 additions & 5 deletions src/editor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -162,14 +162,29 @@ export class CompassCardEditor extends LitElement implements LovelaceCardEditor
}
break;
case 'indicator_sensors[0].sensor':
const sensorsIndicatorSensor = [...this._config.indicator_sensors];
sensorsIndicatorSensor[0] = { ...this._config.indicator_sensors[0], sensor: target.value || '' };
this._config = { ...this._config, indicator_sensors: sensorsIndicatorSensor };
if (this._config.indicator_sensors[0].sensor !== target.value) {
const sensorsIndicatorSensor = [...this._config.indicator_sensors];
sensorsIndicatorSensor[0] = { ...this._config.indicator_sensors[0], sensor: target.value || '' };
if (sensorsIndicatorSensor[0].attribute) {
delete sensorsIndicatorSensor[0].attribute;
}
this._config = { ...this._config, indicator_sensors: sensorsIndicatorSensor };
}
break;
case 'value_sensors[0].sensor':
const valuesSensorsSensor = this._config.value_sensors ? [...this._config.value_sensors] : [];
valuesSensorsSensor[0] = { ...valuesSensorsSensor[0], sensor: target.value || '' };
this._config = { ...this._config, value_sensors: valuesSensorsSensor };
if (valuesSensorsSensor[0] === undefined) {
valuesSensorsSensor[0] = { sensor: target.value || '' };
this._config = { ...this._config, value_sensors: valuesSensorsSensor };
} else {
if (valuesSensorsSensor[0].sensor !== target.value) {
valuesSensorsSensor[0] = { ...valuesSensorsSensor[0], sensor: target.value || '' };
if (valuesSensorsSensor[0].attribute) {
delete valuesSensorsSensor[0].attribute;
}
this._config = { ...this._config, value_sensors: valuesSensorsSensor };
}
}
break;
case 'indicator_sensors[0].indicator.type':
const indicatorType: CCIndicatorConfig = { ...this._config.indicator_sensors[0]?.indicator, type: target.value };
Expand Down

0 comments on commit 8fb27cb

Please sign in to comment.