Skip to content

Commit 3f39fb4

Browse files
authored
Freeze issue on some browsers + Various fixes
- [x] v3.0.0-beta.5/6 fails to render dashboard on some devices #1461 #1462 #1476 - [x] Light slider with hold to slide (default new behavior) are now limited to min 1%, to turn it off, just tap on the card. You can change that in the editor, or in YAML with `allow_light_slider_to_0: true`. #1295 - [x] Bubble backdrop color no longer works as expected #1294 - [x] Relative time formatting inconsistent with Home Assistant #1228 - [x] [3.0.0-beta.6] Slider doesnt work as expected, when entity step size is not 1 #1478 - [x] Slider does not update for brightness if adjusted outside of the card after being adjusted in the card #1367 - [x] Inconsistent and / or wrong color when using sub buttons on a slider #1448 - [x] All buttons are now hidden when a card’s entity is unavailable (like in a media player or cover card) #1453
1 parent 98f583f commit 3f39fb4

File tree

12 files changed

+272
-312
lines changed

12 files changed

+272
-312
lines changed

src/bubble-card.js

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,9 @@ import { handleMediaPlayer } from './cards/media-player/index.js';
1313
import { handleSelect } from './cards/select/index.js';
1414
import { handleClimate } from './cards/climate/index.js';
1515
import { preloadYAMLStyles } from './tools/style-processor.js';
16-
import { createBubbleDefaultColor, initBubbleColorThemeWatcher } from './tools/style.js';
16+
import { createBubbleDefaultColor } from './tools/style.js';
1717
import BubbleCardEditor from './editor/bubble-card-editor.js';
1818

19-
let themeWatcherInitialized = false;
20-
2119
class BubbleCard extends HTMLElement {
2220
editor = false;
2321
isConnected = false;
@@ -26,13 +24,7 @@ class BubbleCard extends HTMLElement {
2624
connectedCallback() {
2725
this.isConnected = true;
2826
preloadYAMLStyles(this);
29-
30-
if (!themeWatcherInitialized) {
31-
initBubbleColorThemeWatcher();
32-
themeWatcherInitialized = true;
33-
} else {
34-
createBubbleDefaultColor();
35-
}
27+
createBubbleDefaultColor();
3628

3729
if (this._hass) {
3830
this.updateBubbleCard();

src/cards/pop-up/backdrop.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
.bubble-backdrop {
22
position: fixed;
3-
background-color: var(--bubble-backdrop-background-color);
3+
background-color: var(--bubble-backdrop-background-color, var(--bubble-default-backdrop-background-color));
44
top: 0;
55
left: 0;
66
width: 100%;

src/cards/pop-up/create.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ function updateBackdropColor() {
2020
getComputedStyle(document.body).getPropertyValue('--ha-card-background') ||
2121
getComputedStyle(document.body).getPropertyValue('--card-background-color');
2222

23-
document.body.style.setProperty('--bubble-backdrop-background-color', convertToRGBA(themeColorBackground, 0.8, 0.6));
23+
document.body.style.setProperty('--bubble-default-backdrop-background-color', convertToRGBA(themeColorBackground, 0.8, 0.6));
2424
}
2525

2626
colorScheme.addEventListener('change', updateBackdropColor);

src/cards/pop-up/index.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
1-
import { changeEditor, changeIcon, changeLight, changeName, changeState, changeStatus, changeStyle, changeTriggered } from './changes.js';
1+
import { changeEditor, changeStyle, changeTriggered } from './changes.js';
22
import { createHeader, createStructure, prepareStructure } from './create.js';
3-
import { configChanged } from "../../tools/utils.js";
43
import { handleButton } from "../../cards/button/index.js";
5-
import { getButtonType } from "../../cards/button/helpers.js";
64

75
export async function handlePopUp(context) {
86
if (context.cardType !== "pop-up") {
@@ -15,18 +13,20 @@ export async function handlePopUp(context) {
1513
createHeader(context);
1614
createStructure(context);
1715
} else if (context.popUp && context.elements) {
18-
if ((context.config.hash === location.hash || context.editor) || context.config !== context.previousConfig) {
16+
if (context.config.hash === location.hash || context.editor) {
1917
if (context.config.entity || context.config.name) {
2018
handleButton(context, context.elements.header);
2119
}
2220

23-
changeStyle(context);
24-
25-
context.previousConfig = context.config;
21+
requestAnimationFrame(() => {
22+
changeStyle(context);
23+
});
2624
}
2725

2826
if (!context.editor) {
29-
changeTriggered(context);
27+
requestAnimationFrame(() => {
28+
changeTriggered(context);
29+
});
3030
}
3131

3232
changeEditor(context);

src/components/base-card/styles.css

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,10 @@ ha-card {
169169
cursor: not-allowed;
170170
}
171171

172+
.is-unavailable .bubble-buttons-container {
173+
display: none;
174+
}
175+
172176
.is-unavailable {
173177
opacity: 0.5;
174178
}

0 commit comments

Comments
 (0)