Skip to content

Commit

Permalink
Merge branch 'dev' into rspack
Browse files Browse the repository at this point in the history
  • Loading branch information
wendevlin authored Nov 26, 2024
2 parents b631fb0 + 09c5dab commit 819b38e
Show file tree
Hide file tree
Showing 14 changed files with 556 additions and 554 deletions.
1 change: 1 addition & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ on:
release:
types:
- published
workflow_dispatch:

env:
PYTHON_VERSION: "3.12"
Expand Down
584 changes: 292 additions & 292 deletions .yarn/releases/yarn-4.5.1.cjs → .yarn/releases/yarn-4.5.2.cjs

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion .yarnrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ enableGlobalCache: false

nodeLinker: node-modules

yarnPath: .yarn/releases/yarn-4.5.1.cjs
yarnPath: .yarn/releases/yarn-4.5.2.cjs
20 changes: 10 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@
"@codemirror/commands": "6.7.1",
"@codemirror/language": "6.10.3",
"@codemirror/legacy-modes": "6.4.2",
"@codemirror/search": "6.5.7",
"@codemirror/search": "6.5.8",
"@codemirror/state": "6.4.1",
"@codemirror/view": "6.34.3",
"@codemirror/view": "6.35.0",
"@egjs/hammerjs": "2.0.17",
"@formatjs/intl-datetimeformat": "6.16.5",
"@formatjs/intl-displaynames": "6.8.5",
Expand Down Expand Up @@ -89,8 +89,8 @@
"@polymer/polymer": "3.5.2",
"@replit/codemirror-indentation-markers": "6.5.3",
"@thomasloven/round-slider": "0.6.0",
"@vaadin/combo-box": "24.5.3",
"@vaadin/vaadin-themable-mixin": "24.5.3",
"@vaadin/combo-box": "24.5.4",
"@vaadin/vaadin-themable-mixin": "24.5.4",
"@vibrant/color": "3.2.1-alpha.1",
"@vibrant/core": "3.2.1-alpha.1",
"@vibrant/quantizer-mmcq": "3.2.1-alpha.1",
Expand Down Expand Up @@ -122,7 +122,7 @@
"lit": "2.8.0",
"lit-html": "2.8.0",
"luxon": "3.5.0",
"marked": "15.0.1",
"marked": "15.0.2",
"memoize-one": "6.0.0",
"node-vibrant": "3.2.1-alpha.1",
"proxy-polyfill": "0.3.2",
Expand Down Expand Up @@ -170,8 +170,8 @@
"@rspack/cli": "1.1.3",
"@rspack/core": "1.1.3",
"@types/babel__plugin-transform-runtime": "7.9.5",
"@types/chromecast-caf-receiver": "6.0.18",
"@types/chromecast-caf-sender": "1.0.10",
"@types/chromecast-caf-receiver": "6.0.19",
"@types/chromecast-caf-sender": "1.0.11",
"@types/color-name": "2.0.0",
"@types/glob": "8.1.0",
"@types/html-minifier-terser": "7.0.2",
Expand All @@ -180,7 +180,7 @@
"@types/leaflet-draw": "1.0.11",
"@types/lodash.merge": "4.6.9",
"@types/luxon": "3.4.2",
"@types/mocha": "10.0.9",
"@types/mocha": "10.0.10",
"@types/qrcode": "1.5.5",
"@types/serve-handler": "6.1.4",
"@types/sortablejs": "1.15.8",
Expand Down Expand Up @@ -233,7 +233,7 @@
"terser-webpack-plugin": "5.3.10",
"transform-async-modules-webpack-plugin": "1.1.1",
"ts-lit-plugin": "2.0.2",
"typescript": "5.6.3",
"typescript": "5.7.2",
"vitest": "2.1.5",
"webpack-stats-plugin": "1.1.3",
"webpackbar": "7.0.0",
Expand All @@ -250,5 +250,5 @@
"@fullcalendar/daygrid": "6.1.15",
"globals": "15.12.0"
},
"packageManager": "[email protected].1"
"packageManager": "[email protected].2"
}
16 changes: 12 additions & 4 deletions src/components/ha-alert.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {
mdiClose,
mdiInformationOutline,
} from "@mdi/js";
import { css, html, LitElement } from "lit";
import { css, html, LitElement, nothing } from "lit";
import { customElement, property } from "lit/decorators";
import { classMap } from "lit/directives/class-map";
import { fireEvent } from "../common/dom/fire_event";
Expand Down Expand Up @@ -37,6 +37,8 @@ class HaAlert extends LitElement {

@property({ type: Boolean }) public dismissable = false;

@property({ type: Boolean }) public narrow = false;

public render() {
return html`
<div
Expand All @@ -50,9 +52,11 @@ class HaAlert extends LitElement {
<ha-svg-icon .path=${ALERT_ICONS[this.alertType]}></ha-svg-icon>
</slot>
</div>
<div class="content">
<div class=${classMap({ content: true, narrow: this.narrow })}>
<div class="main-content">
${this.title ? html`<div class="title">${this.title}</div>` : ""}
${this.title
? html`<div class="title">${this.title}</div>`
: nothing}
<slot></slot>
</div>
<div class="action">
Expand All @@ -63,7 +67,7 @@ class HaAlert extends LitElement {
label="Dismiss alert"
.path=${mdiClose}
></ha-icon-button>`
: ""}
: nothing}
</slot>
</div>
</div>
Expand Down Expand Up @@ -105,6 +109,10 @@ class HaAlert extends LitElement {
width: 100%;
text-align: var(--float-start);
}
.content.narrow {
flex-direction: column;
align-items: flex-end;
}
.action {
z-index: 1;
width: min-content;
Expand Down
30 changes: 22 additions & 8 deletions src/components/ha-web-rtc-player.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ class HaWebRtcPlayer extends LitElement {

private _sessionId?: string;

private _candidatesList: string[] = [];
private _candidatesList: RTCIceCandidate[] = [];

protected override render(): TemplateResult {
if (this._error) {
Expand Down Expand Up @@ -252,7 +252,8 @@ class HaWebRtcPlayer extends LitElement {
this.hass,
this.entityid!,
event.session_id,
candidate
// toJSON returns RTCIceCandidateInit
candidate.toJSON()
)
);
this._candidatesList = [];
Expand All @@ -266,9 +267,17 @@ class HaWebRtcPlayer extends LitElement {
this._logEvent("remote ice candidate", event.candidate);

try {
await this._peerConnection?.addIceCandidate(
new RTCIceCandidate({ candidate: event.candidate, sdpMid: "0" })
);
// The spdMid or sdpMLineIndex is required so set sdpMid="0" if not
// sent from the backend.
const candidate =
event.candidate.sdpMid || event.candidate.sdpMLineIndex != null
? new RTCIceCandidate(event.candidate)
: new RTCIceCandidate({
candidate: event.candidate.candidate,
sdpMid: "0",
});

await this._peerConnection?.addIceCandidate(candidate);
} catch (err: any) {
// eslint-disable-next-line no-console
console.error(err);
Expand All @@ -285,17 +294,22 @@ class HaWebRtcPlayer extends LitElement {
return;
}

this._logEvent("local ice candidate", event.candidate?.candidate);
this._logEvent(
"local ice candidate",
event.candidate?.candidate,
event.candidate?.sdpMLineIndex
);

if (this._sessionId) {
addWebRtcCandidate(
this.hass,
this.entityid,
this._sessionId,
event.candidate?.candidate
// toJSON returns RTCIceCandidateInit
event.candidate.toJSON()
);
} else {
this._candidatesList.push(event.candidate?.candidate);
this._candidatesList.push(event.candidate);
}
};

Expand Down
6 changes: 3 additions & 3 deletions src/data/camera.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ export interface WebRtcAnswer {

export interface WebRtcCandidate {
type: "candidate";
candidate: string;
candidate: RTCIceCandidateInit;
}

export interface WebRtcError {
Expand Down Expand Up @@ -139,13 +139,13 @@ export const addWebRtcCandidate = (
hass: HomeAssistant,
entity_id: string,
session_id: string,
candidate: string
candidate: RTCIceCandidateInit
) =>
hass.callWS({
type: "camera/webrtc/candidate",
entity_id,
session_id,
candidate,
candidate: candidate,
});

export const fetchCameraPrefs = (hass: HomeAssistant, entityId: string) =>
Expand Down
3 changes: 3 additions & 0 deletions src/layouts/ha-init-page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,9 @@ class HaInitPage extends LitElement {
}

private _retry() {
if (this._retryInterval) {
clearInterval(this._retryInterval);
}
location.reload();
}

Expand Down
55 changes: 24 additions & 31 deletions src/panels/config/scene/ha-scene-editor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -383,37 +383,22 @@ export class HaSceneEditor extends SubscribeMixin(
narrow: !this.isWide,
})}
>
${this._mode === "live"
? html` <ha-alert
alert-type="info"
.title=${this.hass.localize(
"ui.panel.config.scene.editor.live_preview"
)}
>
${this.hass.localize(
"ui.panel.config.scene.editor.live_preview_detail"
)}
<ha-button slot="action" @click=${this._exitLiveMode}
>${this.hass.localize(
"ui.panel.config.scene.editor.back_to_review_mode"
)}</ha-button
>
</ha-alert>`
: html` <ha-alert
alert-type="info"
.title=${this.hass.localize(
"ui.panel.config.scene.editor.review_mode"
)}
>
${this.hass.localize(
"ui.panel.config.scene.editor.review_mode_detail"
)}
<ha-button slot="action" @click=${this._enterLiveMode}
>${this.hass.localize(
"ui.panel.config.scene.editor.live_preview"
)}</ha-button
>
</ha-alert>`}
<ha-alert
alert-type="info"
.narrow=${this.narrow}
.title=${this.hass.localize(
`ui.panel.config.scene.editor.${this._mode === "live" ? "live_preview" : "review_mode"}`
)}
>
${this.hass.localize(
`ui.panel.config.scene.editor.${this._mode === "live" ? "live_preview_detail" : "review_mode_detail"}`
)}
<ha-button slot="action" @click=${this._toggleLiveMode}>
${this.hass.localize(
`ui.panel.config.scene.editor.${this._mode === "live" ? "back_to_review_mode" : "live_preview"}`
)}
</ha-button>
</ha-alert>
<ha-card outlined>
<div class="card-content">
<ha-textfield
Expand Down Expand Up @@ -760,6 +745,14 @@ export class HaSceneEditor extends SubscribeMixin(
this._mode = "yaml";
}

private async _toggleLiveMode() {
if (this._mode === "live") {
this._exitLiveMode();
} else {
await this._enterLiveMode();
}
}

private async _enterLiveMode() {
if (this._dirty) {
const result = await showConfirmationDialog(this, {
Expand Down
Loading

0 comments on commit 819b38e

Please sign in to comment.