Skip to content

Commit

Permalink
Merge pull request #150 from JonahKr/dev
Browse files Browse the repository at this point in the history
v2.5.10
  • Loading branch information
JonahKr authored Oct 23, 2023
2 parents 1fc6a2f + 320e4a4 commit 6faf5f4
Show file tree
Hide file tree
Showing 8 changed files with 2,989 additions and 1,631 deletions.
3,836 changes: 2,612 additions & 1,224 deletions package-lock.json

Large diffs are not rendered by default.

42 changes: 21 additions & 21 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "power-distribution-card",
"version": "2.5.9",
"version": "2.5.10",
"license": "MIT",
"author": "JonahKr",
"description": "A Lovelace Card for visualizing power distributions.",
Expand Down Expand Up @@ -28,32 +28,32 @@
"rollup": "rollup -c"
},
"dependencies": {
"@mdi/js": "^7.1.96",
"@mdi/js": "^7.3.67",
"custom-card-helpers": "1.9.0",
"lit": "2.6.1",
"lit": "3.0.0",
"resize-observer-polyfill": "1.5.1",
"sortablejs": "1.15.0"
},
"devDependencies": {
"@babel/core": "7.21.3",
"@babel/core": "7.23.2",
"@babel/plugin-proposal-class-properties": "7.18.6",
"@babel/plugin-proposal-decorators": "7.21.0",
"@rollup/plugin-babel": "6.0.3",
"@rollup/plugin-commonjs": "24.0.1",
"@rollup/plugin-json": "6.0.0",
"@rollup/plugin-node-resolve": "15.0.1",
"@rollup/plugin-terser": "^0.4.0",
"@rollup/plugin-typescript": "^11.0.0",
"@types/sortablejs": "^1.15.1",
"@typescript-eslint/eslint-plugin": "5.55.0",
"@typescript-eslint/parser": "5.55.0",
"eslint": "8.36.0",
"@babel/plugin-proposal-decorators": "7.23.2",
"@rollup/plugin-babel": "6.0.4",
"@rollup/plugin-commonjs": "25.0.7",
"@rollup/plugin-json": "6.0.1",
"@rollup/plugin-node-resolve": "15.2.3",
"@rollup/plugin-terser": "^0.4.4",
"@rollup/plugin-typescript": "^11.1.5",
"@types/sortablejs": "^1.15.4",
"@typescript-eslint/eslint-plugin": "6.8.0",
"@typescript-eslint/parser": "6.8.0",
"eslint": "8.52.0",
"eslint-config-airbnb-base": "15.0.0",
"eslint-config-prettier": "8.7.0",
"eslint-plugin-import": "2.27.5",
"eslint-plugin-prettier": "4.2.1",
"prettier": "2.8.4",
"rollup": "3.19.1",
"typescript": "5.0.2"
"eslint-config-prettier": "9.0.0",
"eslint-plugin-import": "2.28.1",
"eslint-plugin-prettier": "5.0.1",
"prettier": "3.0.3",
"rollup": "4.1.4",
"typescript": "5.2.2"
}
}
15 changes: 7 additions & 8 deletions src/action-handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,10 @@ import { noChange } from 'lit';
import { AttributePart, directive, Directive, DirectiveParameters } from 'lit/directive.js';

import { deepEqual } from './deep-equal';
import { DEV_FLAG } from './util';

export const actions = ['more-info', 'toggle', 'navigate', 'url', 'call-service', 'none'] as const;

interface ActionHandler extends HTMLElement {
interface ActionHandlerMock extends HTMLElement {
holdTime: number;
bind(element: Element, options?: ActionHandlerOptions): void;
}
Expand All @@ -26,12 +25,12 @@ export interface ActionHandlerOptions {
disabled?: boolean;
}

class ActionHandler extends HTMLElement implements ActionHandler {
class ActionHandler extends HTMLElement implements ActionHandlerMock {
public holdTime = 500;
protected timer?: number;
private dblClickTimeout?: number;

public bind(element: ActionHandlerElement, options: ActionHandlerOptions) {
public bind(element: ActionHandlerElement, options: ActionHandlerOptions = {}) {
if (element.actionHandler && deepEqual(options, element.actionHandler.options)) {
return;
}
Expand Down Expand Up @@ -73,15 +72,15 @@ class ActionHandler extends HTMLElement implements ActionHandler {
}
}

customElements.define('action-handler-power-distribution-card' + DEV_FLAG, ActionHandler);
customElements.define('action-handler-power-distribution-card', ActionHandler);

const getActionHandler = (): ActionHandler => {
const body = document.body;
if (body.querySelector('action-handler-power-distribution-card' + DEV_FLAG)) {
return body.querySelector('action-handler-power-distribution-card' + DEV_FLAG) as ActionHandler;
if (body.querySelector('action-handler-power-distribution-card')) {
return body.querySelector('action-handler-power-distribution-card') as ActionHandler;
}

const actionhandler = document.createElement('action-handler-power-distribution-card' + DEV_FLAG);
const actionhandler = document.createElement('action-handler-power-distribution-card');
body.appendChild(actionhandler);

return actionhandler as ActionHandler;
Expand Down
5 changes: 3 additions & 2 deletions src/editor/editor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import {
} from '../types';
import { localize } from '../localize/localize';

import { DEV_FLAG } from '../util';
import './item-editor';
import './items-editor';

Expand All @@ -26,7 +25,7 @@ const center = ['none', 'card', 'bars'];
const bar_presets = ['autarky', 'ratio', ''];
const actions = ['more-info', 'toggle', 'navigate', 'url', 'call-service', 'none'];

@customElement('power-distribution-card-editor' + DEV_FLAG)
@customElement('power-distribution-card-editor')
export class PowerDistributionCardEditor extends LitElement implements LovelaceCardEditor {
@property({ attribute: false }) public hass?: HomeAssistant;
@state() private _config!: PDCConfig;
Expand All @@ -48,6 +47,8 @@ export class PowerDistributionCardEditor extends LitElement implements LovelaceC
if (!customElements.get('ha-entity-picker')) {
(customElements.get('hui-entities-card') as HassCustomElement)?.getConfigElement();
}

console.log(this.hass);
}

protected render(): TemplateResult | void {
Expand Down
Loading

0 comments on commit 6faf5f4

Please sign in to comment.