Skip to content

Commit

Permalink
Change state_color property default to true to follow Glance cards. U…
Browse files Browse the repository at this point in the history
…pdate package versions and some refactorings. Fixes #61 (#62)

* Change state_color property default to true to follow Glance cards. Update package versions and some refactorings. Fixes #61

* Use yarn

* Change release steps
  • Loading branch information
junalmeida authored Mar 29, 2023
1 parent 7c20fbf commit 887b1ed
Show file tree
Hide file tree
Showing 12 changed files with 1,665 additions and 1,604 deletions.
10 changes: 7 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,11 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: '18'
cache: 'yarn'
- name: Install
run: yarn install --frozen-lockfile
- name: Build
run: |
npm install
npm run build
run: yarn build
15 changes: 10 additions & 5 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,17 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- uses: actions/setup-node@v3
with:
node-version: '18'
cache: 'yarn'

- name: Install
run: yarn install --frozen-lockfile

# Build
- name: Build the file
run: |
npm install
npm run build
- name: Build
run: yarn build

# Upload build file to the release as an asset.
- name: Upload zip to release
Expand Down
16 changes: 16 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "msedge",
"request": "launch",
"name": "Launch Edge",
"preLaunchTask": "start",
"url": "http://10.0.0.2:8123",
"webRoot": "${workspaceFolder}"
}
]
}
20 changes: 15 additions & 5 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,21 @@
"version": "2.0.0",
"tasks": [
{
"type": "yarn",
"task": "start",
"problemMatcher": [],
"label": "yarn: start",
"detail": "rollup -c --watch"
"type": "npm",
"script": "start",
"problemMatcher": [
{
"base": "$tsc-watch",
"background": {
"activeOnStart": true,
"beginsPattern": ".*bundles.*",
"endsPattern": ".*created dist in.*"
},
}
],
"group": "build",
"isBackground": true,
"label": "start",
}
]
}
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,17 @@ For `tap_action` options, see https://www.home-assistant.io/dashboards/actions/.
camera_view: 'auto' # auto, live (optional)
shadow: true # Draws a drop shadow on icons (optional)
hide_unavailable: false # Hide unavailable entities (optional)
state_color: true # enable or disable HA colors for all entities
tap_action:
action: navigate
navigation_path: /lovelace/living-room
entities: #optional, lists area entities automatically if ommited.
- entity: media_player.living_room_tv
state_color: false # enable or disable HA colors for this entity
- entity: switch.fireplace_on_off
- entity: cover.window_covering
tap_action:
action: toggle
- entity: media_player.speaker
- entity: light.living_room_lamp
- entity: sensor.hallway_humidity
Expand Down
62 changes: 28 additions & 34 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "minimalistic-area-card",
"version": "1.1.8",
"version": "1.1.9",
"description": "Minimalistic Area Card for Home Assistant",
"keywords": [
"home-assistant",
Expand All @@ -15,47 +15,41 @@
"author": "Marcos Junior <junalmeida@gmail.com>",
"license": "MIT",
"dependencies": {
"@lit-labs/scoped-registry-mixin": "^1.0.0",
"@material/mwc-formfield": "^0.25.3",
"@material/mwc-list": "^0.25.3",
"@material/mwc-menu": "^0.25.3",
"@material/mwc-notched-outline": "^0.25.3",
"@material/mwc-ripple": "^0.25.3",
"@material/mwc-select": "^0.25.3",
"@material/mwc-switch": "^0.25.3",
"@material/mwc-textfield": "^0.25.3",
"@lit-labs/scoped-registry-mixin": "^1.0.1",
"@material/mwc-formfield": "^0.27.0",
"@material/mwc-list": "^0.27.0",
"@material/mwc-menu": "^0.27.0",
"@material/mwc-notched-outline": "^0.27.0",
"@material/mwc-ripple": "^0.27.0",
"@material/mwc-select": "^0.27.0",
"@material/mwc-switch": "^0.27.0",
"@material/mwc-textfield": "^0.27.0",
"custom-card-helpers": "^1.9.0",
"home-assistant-js-websocket": "^8.0.1",
"lit": "^2.5.0"
"lit": "^2.7.0"
},
"devDependencies": {
"@babel/core": "^7.15.0",
"@babel/plugin-proposal-class-properties": "^7.14.5",
"@babel/plugin-proposal-decorators": "^7.14.5",
"@rollup/plugin-json": "^4.1.0",
"@typescript-eslint/eslint-plugin": "^4.33.0",
"@typescript-eslint/parser": "^4.33.0",
"eslint": "^7.32.0",
"eslint-config-airbnb-base": "^14.2.1",
"eslint-config-prettier": "^8.3.0",
"eslint-plugin-import": "^2.24.0",
"eslint-plugin-prettier": "^4.0.0",
"prettier": "^2.4.1",
"rollup": "^2.58.0",
"@babel/core": "^7.21.3",
"@babel/plugin-proposal-class-properties": "^7.18.6",
"@babel/plugin-proposal-decorators": "^7.21.0",
"@rollup/plugin-json": "^6.0.0",
"@typescript-eslint/eslint-plugin": "^5.57.0",
"@typescript-eslint/parser": "^5.57.0",
"eslint": "^8.37.0",
"eslint-config-airbnb-base": "^15.0.0",
"eslint-config-prettier": "^8.8.0",
"eslint-plugin-import": "^2.27.5",
"eslint-plugin-prettier": "^4.2.1",
"prettier": "^2.8.7",
"rollup": "^2.79.1",
"rollup-plugin-babel": "^4.4.0",
"rollup-plugin-commonjs": "^10.1.0",
"rollup-plugin-node-resolve": "^5.2.0",
"rollup-plugin-serve": "^1.1.0",
"rollup-plugin-serve": "^2.0.2",
"rollup-plugin-terser": "^7.0.2",
"rollup-plugin-typescript2": "^0.30.0",
"typescript": "^4.4.3",
"tslib": "2.4.0"
},
"resolutions": {
"lit": "^2.5.0",
"lit-html": "2.5.0",
"lit-element": "3.2.0",
"@lit/reactive-element": "1.5.0"
"rollup-plugin-typescript2": "^0.34.1",
"typescript": "^5.0.2",
"tslib": "2.5.0"
},
"scripts": {
"start": "rollup -c rollup.config.dev.js --watch",
Expand Down
1 change: 1 addition & 0 deletions rollup.config.dev.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import { ignoreSwitchFiles } from './elements/ignore/switch';

export default {
input: ['src/minimalistic-area-card.ts'],
strictDeprecations: true,
output: {
dir: './dist',
format: 'es',
Expand Down
1 change: 1 addition & 0 deletions rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ const plugins = [
export default [
{
input: 'src/minimalistic-area-card.ts',
strictDeprecations: true,
output: {
dir: 'dist',
format: 'es',
Expand Down
14 changes: 7 additions & 7 deletions src/editor.ts
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
/* eslint-disable @typescript-eslint/no-explicit-any */
import { LitElement, html, TemplateResult, css, CSSResultGroup } from 'lit';
import { HomeAssistant, fireEvent, LovelaceCardEditor } from 'custom-card-helpers';
import { fireEvent, HomeAssistant, LovelaceCardEditor } from 'custom-card-helpers';
import { css, CSSResultGroup, html, LitElement, TemplateResult } from 'lit';

import { ScopedRegistryHost } from '@lit-labs/scoped-registry-mixin';
import { BoilerplateCardConfig } from './types';
import { customElement, property, state } from 'lit/decorators';
import { formfieldDefinition } from '../elements/formfield';
import { selectDefinition } from '../elements/select';
import { switchDefinition } from '../elements/switch';
import { textfieldDefinition } from '../elements/textfield';
import { MinimalisticAreaCardConfig } from './types';

@customElement('boilerplate-card-editor')
export class BoilerplateCardEditor extends ScopedRegistryHost(LitElement) implements LovelaceCardEditor {
@property({ attribute: false }) public hass?: HomeAssistant;

@state() private _config?: BoilerplateCardConfig;
@state() private _config?: MinimalisticAreaCardConfig;

@state() private _helpers?: any;

Expand All @@ -27,7 +27,7 @@ export class BoilerplateCardEditor extends ScopedRegistryHost(LitElement) implem
...formfieldDefinition,
};

public setConfig(config: BoilerplateCardConfig): void {
public setConfig(config: MinimalisticAreaCardConfig): void {
this._config = config;

this.loadCardHelpers();
Expand Down Expand Up @@ -76,8 +76,8 @@ export class BoilerplateCardEditor extends ScopedRegistryHost(LitElement) implem
@closed=${(ev) => ev.stopPropagation()}
>
${entities.map((entity) => {
return html`<mwc-list-item .value=${entity}>${entity}</mwc-list-item>`;
})}
return html`<mwc-list-item .value=${entity}>${entity}</mwc-list-item>`;
})}
</mwc-select>
<mwc-textfield
label="Name (Optional)"
Expand Down
Loading

0 comments on commit 887b1ed

Please sign in to comment.