Skip to content

Commit

Permalink
Reduce redrawing
Browse files Browse the repository at this point in the history
  • Loading branch information
thomasloven committed Mar 1, 2021
1 parent 27d1689 commit eedcb74
Show file tree
Hide file tree
Showing 12 changed files with 6 additions and 24 deletions.
4 changes: 2 additions & 2 deletions card-mod.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions src/card-mod.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ export class CardMod extends LitElement {
m.removedNodes.forEach((n) => {
if ((n as any).localName !== "card-mod") stop = false;
});
if (stop) return;
}

this.refresh();
Expand Down
2 changes: 2 additions & 0 deletions src/main.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { fireEvent } from "card-tools/src/event.js";
import "./card-mod";
import "./patch/ha-card";
import "./patch/hui-entities-card";
Expand All @@ -11,3 +12,4 @@ import "./patch/hui-card-element-editor";
import "./patch/hui-picture-elements-card";
import "./patch/ha-icon";
import "./mod-card";
fireEvent("ll-rebuild", {});
3 changes: 0 additions & 3 deletions src/patch/ha-card.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { fireEvent } from "card-tools/src/event.js";
import { applyToElement, findConfig } from "../helpers";

customElements.whenDefined("ha-card").then(() => {
Expand Down Expand Up @@ -62,6 +61,4 @@ customElements.whenDefined("ha-card").then(() => {
window.setTimeout(() => cardMod.refresh(), 1000);
});
};

fireEvent("ll-rebuild", {});
});
2 changes: 0 additions & 2 deletions src/patch/ha-sidebar.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { fireEvent } from "card-tools/src/event.js";
import { selectTree } from "card-tools/src/helpers";
import { applyToElement } from "../helpers";

Expand All @@ -14,7 +13,6 @@ customElements.whenDefined("ha-sidebar").then(() => {
applyToElement(this, "sidebar");
};

fireEvent("ll-rebuild", {});
selectTree(
document,
"home-assistant$home-assistant-main$app-drawer-layout app-drawer ha-sidebar",
Expand Down
3 changes: 0 additions & 3 deletions src/patch/hui-entities-card.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { fireEvent } from "card-tools/src/event.js";
import { applyToElement } from "../helpers";

customElements.whenDefined("hui-entities-card").then(() => {
Expand Down Expand Up @@ -31,6 +30,4 @@ customElements.whenDefined("hui-entities-card").then(() => {
retval.values[0].addEventListener("ll-rebuild", apply);
return retval;
};

fireEvent("ll-rebuild", {});
});
3 changes: 0 additions & 3 deletions src/patch/hui-glance-card.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { fireEvent } from "card-tools/src/event.js";
import { applyToElement } from "../helpers";

const ENTITY_STYLES = `
Expand Down Expand Up @@ -51,6 +50,4 @@ customElements.whenDefined("hui-glance-card").then(() => {
);
}
};

fireEvent("ll-rebuild", {});
});
3 changes: 0 additions & 3 deletions src/patch/hui-picture-elements-card.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { fireEvent } from "card-tools/src/event.js";
import { applyToElement } from "../helpers";

customElements.whenDefined("hui-picture-elements-card").then(() => {
Expand All @@ -20,6 +19,4 @@ customElements.whenDefined("hui-picture-elements-card").then(() => {
applyToElement(el, "element", config?.card_mod?.style, { config });
}
};

fireEvent("ll-rebuild", {});
});
1 change: 0 additions & 1 deletion src/patch/hui-root.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ customElements.whenDefined("hui-root").then(() => {
applyToElement(this, "root");
};

fireEvent("ll-rebuild", {});
selectTree(
document,
"home-assistant$home-assistant-main$app-drawer-layout partial-panel-resolver ha-panel-lovelace$hui-root",
Expand Down
3 changes: 0 additions & 3 deletions src/patch/hui-state-label-badge.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { fireEvent } from "card-tools/src/event.js";
import { applyToElement } from "../helpers";

customElements.whenDefined("hui-state-label-badge").then(() => {
Expand All @@ -23,6 +22,4 @@ customElements.whenDefined("hui-state-label-badge").then(() => {
}
);
};

fireEvent("ll-rebuild", {});
});
3 changes: 0 additions & 3 deletions src/patch/hui-view.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { fireEvent } from "card-tools/src/event.js";
import { applyToElement } from "../helpers";

customElements.whenDefined("hui-view").then(() => {
Expand All @@ -11,6 +10,4 @@ customElements.whenDefined("hui-view").then(() => {
_firstUpdated?.bind(this)(changedProperties);
applyToElement(this, "view");
};

fireEvent("ll-rebuild", {});
});

0 comments on commit eedcb74

Please sign in to comment.