Skip to content

Commit ed1b89f

Browse files
committed
add some comments/links about Lit
1 parent a102dd0 commit ed1b89f

File tree

3 files changed

+10
-5
lines changed

3 files changed

+10
-5
lines changed

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "boilerplate-card",
3-
"version": "1.3.1",
3+
"version": "1.3.2",
44
"description": "Lovelace boilerplate-card",
55
"keywords": [
66
"home-assistant",

src/boilerplate-card.ts

+8-3
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,13 @@ import {
1818
handleAction,
1919
LovelaceCardEditor,
2020
getLovelace,
21-
} from 'custom-card-helpers';
21+
} from 'custom-card-helpers'; // This is a community maintained npm module with common helper functions/types
2222

2323
import './editor';
2424

25-
import { BoilerplateCardConfig } from './types';
25+
import type { BoilerplateCardConfig } from './types';
2626
import { actionHandler } from './action-handler-directive';
2727
import { CARD_VERSION } from './const';
28-
2928
import { localize } from './localize/localize';
3029

3130
/* eslint no-console: 0 */
@@ -35,6 +34,7 @@ console.info(
3534
'color: white; font-weight: bold; background: dimgray',
3635
);
3736

37+
// This puts your card into the UI card picker dialog
3838
(window as any).customCards = (window as any).customCards || [];
3939
(window as any).customCards.push({
4040
type: 'boilerplate-card',
@@ -54,9 +54,11 @@ export class BoilerplateCard extends LitElement {
5454
}
5555

5656
// TODO Add any properities that should cause your element to re-render here
57+
// https://lit-element.polymer-project.org/guide/properties
5758
@property({ attribute: false }) public hass!: HomeAssistant;
5859
@internalProperty() private config!: BoilerplateCardConfig;
5960

61+
// https://lit-element.polymer-project.org/guide/properties#accessors-custom
6062
public setConfig(config: BoilerplateCardConfig): void {
6163
// TODO Check for required fields and that they are of the proper format
6264
if (!config) {
@@ -73,6 +75,7 @@ export class BoilerplateCard extends LitElement {
7375
};
7476
}
7577

78+
// https://lit-element.polymer-project.org/guide/lifecycle#shouldupdate
7679
protected shouldUpdate(changedProps: PropertyValues): boolean {
7780
if (!this.config) {
7881
return false;
@@ -81,6 +84,7 @@ export class BoilerplateCard extends LitElement {
8184
return hasConfigOrEntityChanged(this, changedProps, false);
8285
}
8386

87+
// https://lit-element.polymer-project.org/guide/templates
8488
protected render(): TemplateResult | void {
8589
// TODO Check for stateObj or other necessary things and render a warning if missing
8690
if (this.config.show_warning) {
@@ -130,6 +134,7 @@ export class BoilerplateCard extends LitElement {
130134
`;
131135
}
132136

137+
// https://lit-element.polymer-project.org/guide/styles
133138
static get styles(): CSSResult {
134139
return css``;
135140
}

src/const.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
export const CARD_VERSION = '1.3.1';
1+
export const CARD_VERSION = '1.3.2';

0 commit comments

Comments
 (0)