mirror of
https://github.com/home-assistant/frontend.git
synced 2026-11-24 05:38:45 +00:00
Compare commits
6
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0de4f6212c | ||
|
|
1ecbda0567 | ||
|
|
ce97427f46 | ||
|
|
c5b2c965bd | ||
|
|
27fc38b3bf | ||
|
|
9ec8d0ec6f |
No files matched your search
+3
-3
@@ -40,7 +40,7 @@
|
||||
"license": "Apache-2.0",
|
||||
"type": "module",
|
||||
"dependencies": {
|
||||
"@babel/runtime": "8.1.2",
|
||||
"@babel/runtime": "8.1.3",
|
||||
"@braintree/sanitize-url": "7.1.2",
|
||||
"@codemirror/autocomplete": "6.20.4",
|
||||
"@codemirror/commands": "6.11.1",
|
||||
@@ -136,7 +136,7 @@
|
||||
},
|
||||
"devDependencies": {
|
||||
"@ampproject/remapping": "2.3.0",
|
||||
"@babel/core": "8.1.2",
|
||||
"@babel/core": "8.1.3",
|
||||
"@babel/helper-compilation-targets": "8.0.7",
|
||||
"@babel/helper-define-polyfill-provider": "1.0.0",
|
||||
"@babel/plugin-transform-class-properties": "8.0.1",
|
||||
@@ -222,7 +222,7 @@
|
||||
"webpackbar": "7.0.0",
|
||||
"workbox-build": "7.4.1"
|
||||
},
|
||||
"packageManager": "[email protected]1.0",
|
||||
"packageManager": "[email protected]2.0",
|
||||
"volta": {
|
||||
"node": "24.22.3"
|
||||
}
|
||||
|
||||
Generated
+423
-417
File diff suppressed because it is too large.
Load diff
@@ -2372,30 +2372,21 @@ export class HaChartBase extends MobileAwareMixin(LitElement) {
|
||||
margin-inline-start: auto;
|
||||
flex-shrink: 0;
|
||||
pointer-events: auto;
|
||||
/* Inherited, so buttons nested in slots or dropdowns get the frame too */
|
||||
--ha-icon-button-background: var(--card-background-color);
|
||||
--ha-icon-button-border: 1px solid var(--divider-color);
|
||||
--ha-icon-button-border-radius: var(--ha-border-radius-sm);
|
||||
--ha-icon-button-size: 32px;
|
||||
color: var(--primary-color);
|
||||
}
|
||||
.top-controls.small {
|
||||
top: 0;
|
||||
}
|
||||
.chart-controls.small {
|
||||
flex-direction: row;
|
||||
}
|
||||
.chart-controls ha-icon-button,
|
||||
.chart-controls ::slotted(ha-icon-button) {
|
||||
background: var(--card-background-color);
|
||||
border-radius: var(--ha-border-radius-sm);
|
||||
--ha-icon-button-size: 32px;
|
||||
color: var(--primary-color);
|
||||
border: 1px solid var(--divider-color);
|
||||
}
|
||||
.chart-controls.small ha-icon-button,
|
||||
.chart-controls.small ::slotted(ha-icon-button) {
|
||||
--ha-icon-button-size: 22px;
|
||||
--mdc-icon-size: 16px;
|
||||
}
|
||||
.chart-controls ha-icon-button.inactive,
|
||||
.chart-controls ::slotted(ha-icon-button.inactive) {
|
||||
color: var(--state-inactive-color);
|
||||
}
|
||||
.chart-legend {
|
||||
max-height: 60%;
|
||||
overflow-y: auto;
|
||||
|
||||
@@ -217,6 +217,7 @@ export class HaNetworkGraph extends LitElement {
|
||||
<ha-icon-button
|
||||
slot="button"
|
||||
class=${this._physicsEnabled ? "active" : "inactive"}
|
||||
.ariaPressed=${this._physicsEnabled ? "true" : "false"}
|
||||
.path=${mdiGoogleCirclesGroup}
|
||||
@click=${this._togglePhysics}
|
||||
label=${this._localize("ui.panel.config.common.graph.toggle_physics")}
|
||||
@@ -224,6 +225,7 @@ export class HaNetworkGraph extends LitElement {
|
||||
<ha-icon-button
|
||||
slot="button"
|
||||
class=${this._showLabels ? "active" : "inactive"}
|
||||
.ariaPressed=${this._showLabels ? "true" : "false"}
|
||||
.path=${mdiFormatTextVariant}
|
||||
@click=${this._toggleLabels}
|
||||
label=${this._localize("ui.panel.config.common.graph.toggle_labels")}
|
||||
@@ -846,6 +848,10 @@ export class HaNetworkGraph extends LitElement {
|
||||
::slotted(ha-icon-button) {
|
||||
margin-inline-end: var(--ha-space-3);
|
||||
}
|
||||
ha-icon-button.inactive,
|
||||
::slotted(ha-icon-button.inactive) {
|
||||
color: var(--state-inactive-color);
|
||||
}
|
||||
`;
|
||||
}
|
||||
|
||||
|
||||
@@ -22,6 +22,9 @@ export class HaIconButton extends LitElement {
|
||||
@property({ type: String, attribute: "aria-haspopup" })
|
||||
ariaHasPopup!: "false" | "true" | "menu" | "listbox" | "tree" | "grid";
|
||||
|
||||
@property({ attribute: false })
|
||||
ariaPressed!: "false" | "true" | "mixed";
|
||||
|
||||
@property({ attribute: "hide-title", type: Boolean }) hideTitle = false;
|
||||
|
||||
@property({ type: Boolean, reflect: true }) selected = false;
|
||||
@@ -47,6 +50,7 @@ export class HaIconButton extends LitElement {
|
||||
.accessibleLabel=${this.label ?? ""}
|
||||
.title=${this.hideTitle ? "" : (this.label ?? "")}
|
||||
aria-haspopup=${ifDefined(this.ariaHasPopup)}
|
||||
.ariaPressed=${this.ariaPressed ?? null}
|
||||
.disabled=${this.disabled}
|
||||
.iconTag=${this.path ? "ha-svg-icon" : "span"}
|
||||
.href=${this.href}
|
||||
@@ -71,6 +75,9 @@ export class HaIconButton extends LitElement {
|
||||
display: inline-block;
|
||||
outline: none;
|
||||
--ha-button-height: var(--ha-icon-button-size, 48px);
|
||||
background: var(--ha-icon-button-background);
|
||||
border: var(--ha-icon-button-border);
|
||||
border-radius: var(--ha-icon-button-border-radius);
|
||||
}
|
||||
ha-button {
|
||||
position: relative;
|
||||
@@ -82,13 +89,14 @@ export class HaIconButton extends LitElement {
|
||||
--wa-color-on-normal: currentColor;
|
||||
--wa-color-fill-quiet: transparent;
|
||||
--ha-button-label-overflow: visible;
|
||||
--ha-button-border-radius: var(--ha-icon-button-border-radius, 50%);
|
||||
}
|
||||
ha-button::after {
|
||||
content: "";
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
z-index: -1;
|
||||
border-radius: 50%;
|
||||
border-radius: var(--ha-icon-button-border-radius, 50%);
|
||||
background-color: currentColor;
|
||||
opacity: 0;
|
||||
pointer-events: none;
|
||||
|
||||
@@ -382,7 +382,7 @@ class DialogBackupOnboarding
|
||||
@click=${this._copyKeyToClipboard}
|
||||
></ha-icon-button>
|
||||
</div>
|
||||
<ha-row-item>
|
||||
<ha-row-item wrap-supporting-text>
|
||||
<span slot="headline">
|
||||
${this.hass.localize(
|
||||
"ui.panel.config.backup.encryption_key.download_emergency_kit"
|
||||
|
||||
@@ -164,7 +164,7 @@ class DialogChangeBackupEncryptionKey extends LitElement implements HassDialog {
|
||||
@click=${this._copyOldKeyToClipboard}
|
||||
></ha-icon-button>
|
||||
</div>
|
||||
<ha-row-item>
|
||||
<ha-row-item wrap-supporting-text>
|
||||
<span slot="headline">
|
||||
${this.hass.localize(
|
||||
"ui.panel.config.backup.encryption_key.download_old_emergency_kit"
|
||||
@@ -202,7 +202,7 @@ class DialogChangeBackupEncryptionKey extends LitElement implements HassDialog {
|
||||
@click=${this._copyKeyToClipboard}
|
||||
></ha-icon-button>
|
||||
</div>
|
||||
<ha-row-item>
|
||||
<ha-row-item wrap-supporting-text>
|
||||
<span slot="headline">
|
||||
${this.hass.localize(
|
||||
"ui.panel.config.backup.encryption_key.download_emergency_kit"
|
||||
|
||||
@@ -137,7 +137,7 @@ class DialogSetBackupEncryptionKey extends LitElement implements HassDialog {
|
||||
@click=${this._copyKeyToClipboard}
|
||||
></ha-icon-button>
|
||||
</div>
|
||||
<ha-row-item>
|
||||
<ha-row-item wrap-supporting-text>
|
||||
<span slot="headline">
|
||||
${this.hass.localize(
|
||||
"ui.panel.config.backup.encryption_key.download_emergency_kit"
|
||||
|
||||
@@ -72,7 +72,7 @@ class DialogShowBackupEncryptionKey extends LitElement implements HassDialog {
|
||||
@click=${this._copyKeyToClipboard}
|
||||
></ha-icon-button>
|
||||
</div>
|
||||
<ha-row-item>
|
||||
<ha-row-item wrap-supporting-text>
|
||||
<span slot="headline">
|
||||
${this.hass.localize(
|
||||
"ui.panel.config.backup.encryption_key.download_emergency_kit"
|
||||
|
||||
+1
-11
@@ -169,6 +169,7 @@ export class ZWaveJSNetworkVisualization extends SubscribeMixin(LitElement) {
|
||||
<ha-icon-button
|
||||
slot="button"
|
||||
class=${this._showNeighbors ? "active" : "inactive"}
|
||||
.ariaPressed=${this._showNeighbors ? "true" : "false"}
|
||||
.path=${mdiSpiderWeb}
|
||||
.label=${this.hass.localize(
|
||||
"ui.panel.config.zwave_js.visualization.toggle_neighbors"
|
||||
@@ -562,17 +563,6 @@ export class ZWaveJSNetworkVisualization extends SubscribeMixin(LitElement) {
|
||||
ha-input-search {
|
||||
flex: 1;
|
||||
}
|
||||
/* ha-chart-base can't style re-slotted buttons, so mirror its look */
|
||||
ha-icon-button[slot="button"] {
|
||||
background: var(--card-background-color);
|
||||
border-radius: var(--ha-border-radius-sm);
|
||||
--ha-icon-button-size: 32px;
|
||||
color: var(--primary-color);
|
||||
border: 1px solid var(--divider-color);
|
||||
}
|
||||
ha-icon-button[slot="button"].inactive {
|
||||
color: var(--state-inactive-color);
|
||||
}
|
||||
`,
|
||||
];
|
||||
}
|
||||
|
||||
@@ -19,6 +19,7 @@ import memoizeOne from "memoize-one";
|
||||
import { ensureArray } from "../../common/array/ensure-array";
|
||||
import { storage } from "../../common/decorators/storage";
|
||||
import type {
|
||||
HASSDomCurrentTargetEvent,
|
||||
HASSDomEvent,
|
||||
HASSDomTargetEvent,
|
||||
} from "../../common/dom/fire_event";
|
||||
@@ -122,6 +123,8 @@ class HaPanelHistory extends LitElement {
|
||||
// The zoom window shared by all charts, in percent of their x-axis
|
||||
@state() private _zoomRange: [number, number] = [0, 100];
|
||||
|
||||
@state() private _zoomBarHeld = false;
|
||||
|
||||
@state() private _filters: SourceFilters = {};
|
||||
|
||||
// Only one filter is expanded at a time, so that it can use the height
|
||||
@@ -202,7 +205,8 @@ class HaPanelHistory extends LitElement {
|
||||
!!this._mungedStateHistory &&
|
||||
(this._mungedStateHistory.line.length > 0 ||
|
||||
this._mungedStateHistory.timeline.length > 0);
|
||||
const showZoomBar = !loading && hasTargets && hasResults;
|
||||
const hasCharts = !loading && hasTargets && hasResults;
|
||||
const showZoomBar = hasCharts && (this._isZoomed() || this._zoomBarHeld);
|
||||
const sourcesLabel = sourceCount
|
||||
? this.hass.localize("ui.panel.history.sources_count", {
|
||||
count: entityIds.length,
|
||||
@@ -335,8 +339,13 @@ class HaPanelHistory extends LitElement {
|
||||
}
|
||||
</div>
|
||||
${
|
||||
showZoomBar
|
||||
? html`<ha-card class="zoom-bar">
|
||||
hasCharts
|
||||
? html`<ha-card
|
||||
class=${classMap({
|
||||
"zoom-bar": true,
|
||||
"keyboard-only": !showZoomBar,
|
||||
})}
|
||||
>
|
||||
<ha-icon-button
|
||||
.disabled=${!this._isZoomed()}
|
||||
.label=${this.hass.localize(
|
||||
@@ -350,6 +359,11 @@ class HaPanelHistory extends LitElement {
|
||||
.end=${this._zoomRange[1]}
|
||||
@zoom-slider-changed=${this._zoomSliderChanged}
|
||||
@zoom-slider-reset=${this._resetZoom}
|
||||
@pointerdown=${this._holdZoomBar}
|
||||
@focusin=${this._holdZoomBar}
|
||||
@pointerup=${this._releaseZoomBar}
|
||||
@pointercancel=${this._releaseZoomBar}
|
||||
@focusout=${this._releaseZoomBar}
|
||||
></ha-chart-zoom-slider>
|
||||
</ha-card>`
|
||||
: nothing
|
||||
@@ -370,6 +384,7 @@ class HaPanelHistory extends LitElement {
|
||||
ev: HASSDomEvent<HASSDomEvents["history-charts-zoom"]>
|
||||
) {
|
||||
this._zoomRange = [ev.detail.start, ev.detail.end];
|
||||
this._zoomBarHeld = false;
|
||||
}
|
||||
|
||||
private _zoomSliderChanged(
|
||||
@@ -380,7 +395,18 @@ class HaPanelHistory extends LitElement {
|
||||
this._stateHistoryCharts?.zoom(start, end);
|
||||
}
|
||||
|
||||
private _holdZoomBar() {
|
||||
this._zoomBarHeld = true;
|
||||
}
|
||||
|
||||
private _releaseZoomBar(ev: Event & HASSDomCurrentTargetEvent<HTMLElement>) {
|
||||
// A mouse press focuses the slider, so it is kept until it loses focus
|
||||
this._zoomBarHeld =
|
||||
ev.type !== "focusout" && ev.currentTarget.matches(":focus-within");
|
||||
}
|
||||
|
||||
private _resetZoom() {
|
||||
this._zoomBarHeld = false;
|
||||
this._zoomRange = [0, 100];
|
||||
this._stateHistoryCharts?.zoom(0, 100);
|
||||
}
|
||||
@@ -630,6 +656,7 @@ class HaPanelHistory extends LitElement {
|
||||
this._isLoading = true;
|
||||
// The charts are rebuilt once loaded, so they start unzoomed.
|
||||
this._zoomRange = [0, 100];
|
||||
this._zoomBarHeld = false;
|
||||
|
||||
if (this._subscribed) {
|
||||
this._unsubscribeHistory();
|
||||
@@ -1043,6 +1070,11 @@ class HaPanelHistory extends LitElement {
|
||||
);
|
||||
}
|
||||
|
||||
/* Kept in the tab order, as zooming from the keyboard starts here */
|
||||
.zoom-bar.keyboard-only {
|
||||
clip-path: inset(50%);
|
||||
}
|
||||
|
||||
/* Floats like the energy dashboard's date bar */
|
||||
.zoom-bar {
|
||||
position: absolute;
|
||||
|
||||
Reference in new issue
Block a user