Skip to content

Commit

Permalink
Merge dev to get self-injection fix
Browse files Browse the repository at this point in the history
  • Loading branch information
steverep committed May 3, 2024
2 parents 878a00b + 84b436c commit ce2b52e
Show file tree
Hide file tree
Showing 7 changed files with 250 additions and 254 deletions.
25 changes: 14 additions & 11 deletions build-scripts/bundle.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ const env = require("./env.cjs");
const paths = require("./paths.cjs");
const { dependencies } = require("../package.json");

const BABEL_PLUGINS = path.join(__dirname, "babel-plugins");

// GitHub base URL to use for production source maps
// Nightly builds use the commit SHA, otherwise assumes there is a tag that matches the version
module.exports.sourceMapURL = () => {
Expand Down Expand Up @@ -100,22 +102,12 @@ module.exports.babelOptions = ({ latestBuild, isProdBuild, isTestBuild }) => ({
],
plugins: [
[
path.resolve(
paths.polymer_dir,
"build-scripts/babel-plugins/inline-constants-plugin.cjs"
),
path.join(BABEL_PLUGINS, "inline-constants-plugin.cjs"),
{
modules: ["@mdi/js"],
ignoreModuleNotFound: true,
},
],
[
path.resolve(
paths.polymer_dir,
"build-scripts/babel-plugins/custom-polyfill-plugin.js"
),
{ method: "usage-global" },
],
// Minify template literals for production
isProdBuild && [
"template-html-minifier",
Expand Down Expand Up @@ -153,6 +145,17 @@ module.exports.babelOptions = ({ latestBuild, isProdBuild, isTestBuild }) => ({
],
sourceMaps: !isTestBuild,
overrides: [
{
// Add plugin to inject various polyfills, excluding the polyfills
// themselves to prevent self- injection.
plugins: [
[
path.join(BABEL_PLUGINS, "custom-polyfill-plugin.js"),
{ method: "usage-global" },
],
],
exclude: /\/node_modules\/(?:unfetch|proxy-polyfill)\//,
},
{
// Use unambiguous for dependencies so that require() is correctly injected into CommonJS files
// Exclusions are needed in some cases where ES modules have no static imports or exports, such as polyfills
Expand Down
12 changes: 6 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"license": "Apache-2.0",
"type": "module",
"dependencies": {
"@babel/runtime": "7.24.4",
"@babel/runtime": "7.24.5",
"@braintree/sanitize-url": "7.0.1",
"@codemirror/autocomplete": "6.16.0",
"@codemirror/commands": "6.5.0",
Expand Down Expand Up @@ -150,11 +150,11 @@
"xss": "1.0.15"
},
"devDependencies": {
"@babel/core": "7.24.4",
"@babel/core": "7.24.5",
"@babel/helper-define-polyfill-provider": "0.6.2",
"@babel/plugin-proposal-decorators": "7.24.1",
"@babel/plugin-transform-runtime": "7.24.3",
"@babel/preset-env": "7.24.4",
"@babel/preset-env": "7.24.5",
"@babel/preset-typescript": "7.24.1",
"@bundle-stats/plugin-webpack-filter": "4.12.2",
"@koa/cors": "5.0.0",
Expand Down Expand Up @@ -185,8 +185,8 @@
"@types/tar": "6.1.13",
"@types/ua-parser-js": "0.7.39",
"@types/webspeechapi": "0.0.29",
"@typescript-eslint/eslint-plugin": "7.7.1",
"@typescript-eslint/parser": "7.7.1",
"@typescript-eslint/eslint-plugin": "7.8.0",
"@typescript-eslint/parser": "7.8.0",
"@web/dev-server": "0.1.38",
"@web/dev-server-rollup": "0.4.1",
"babel-loader": "9.1.3",
Expand All @@ -202,7 +202,7 @@
"eslint-plugin-import": "2.29.1",
"eslint-plugin-lit": "1.11.0",
"eslint-plugin-lit-a11y": "4.1.2",
"eslint-plugin-unused-imports": "3.1.0",
"eslint-plugin-unused-imports": "3.2.0",
"eslint-plugin-wc": "2.1.0",
"fancy-log": "2.0.0",
"fs-extra": "11.2.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ export class DialogEnergyDeviceSettings
type="text"
.disabled=${!this._device}
.value=${this._device?.name || ""}
@change=${this._nameChanged}
@input=${this._nameChanged}
>
</ha-textfield>
Expand Down
3 changes: 3 additions & 0 deletions src/panels/config/zone/ha-config-zone.ts
Original file line number Diff line number Diff line change
Expand Up @@ -573,6 +573,9 @@ export class HaConfigZone extends SubscribeMixin(LitElement) {
flex-grow: 1;
height: 100%;
}
.flex mwc-list {
padding-bottom: 64px;
}
.flex mwc-list,
.flex .empty {
border-left: 1px solid var(--divider-color);
Expand Down
36 changes: 16 additions & 20 deletions src/panels/energy/ha-panel-energy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,27 +88,23 @@ class PanelEnergy extends LitElement {
collectionKey="energy_dashboard"
>
${this.hass.user?.is_admin
? html`
<ha-list-item
slot="overflow-menu"
graphic="icon"
@request-selected=${this._navigateConfig}
>
<ha-svg-icon slot="graphic" .path=${mdiPencil}>
</ha-svg-icon>
${this.hass!.localize("ui.panel.energy.configure")}
</ha-list-item>
<ha-list-item
slot="overflow-menu"
graphic="icon"
@request-selected=${this._dumpCSV}
>
<ha-svg-icon slot="graphic" .path=${mdiDownload}>
</ha-svg-icon>
${this.hass!.localize("ui.panel.energy.download_data")}
</ha-list-item>
`
? html` <ha-list-item
slot="overflow-menu"
graphic="icon"
@request-selected=${this._navigateConfig}
>
<ha-svg-icon slot="graphic" .path=${mdiPencil}> </ha-svg-icon>
${this.hass!.localize("ui.panel.energy.configure")}
</ha-list-item>`
: nothing}
<ha-list-item
slot="overflow-menu"
graphic="icon"
@request-selected=${this._dumpCSV}
>
<ha-svg-icon slot="graphic" .path=${mdiDownload}> </ha-svg-icon>
${this.hass!.localize("ui.panel.energy.download_data")}
</ha-list-item>
</hui-energy-period-selector>
</div>
</div>
Expand Down
14 changes: 4 additions & 10 deletions src/panels/lovelace/card-features/hui-alarm-modes-card-feature.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,17 @@ import "../../../components/ha-control-select";
import type { ControlSelectOption } from "../../../components/ha-control-select";
import "../../../components/ha-control-slider";
import {
ALARM_MODES,
AlarmControlPanelEntity,
AlarmMode,
ALARM_MODES,
supportedAlarmModes,
} from "../../../data/alarm_control_panel";
import { UNAVAILABLE } from "../../../data/entity";
import { showEnterCodeDialog } from "../../../dialogs/enter-code/show-enter-code-dialog";
import { HomeAssistant } from "../../../types";
import { LovelaceCardFeature, LovelaceCardFeatureEditor } from "../types";
import { AlarmModesCardFeatureConfig } from "./types";
import { showEnterCodeDialog } from "../../../dialogs/enter-code/show-enter-code-dialog";
import { filterModes } from "./common/filter-modes";
import { AlarmModesCardFeatureConfig } from "./types";

export const supportsAlarmModesCardFeature = (stateObj: HassEntity) => {
const domain = computeDomain(stateObj.entity_id);
Expand All @@ -43,15 +43,9 @@ class HuiAlarmModeCardFeature

@state() _currentMode?: AlarmMode;

static getStubConfig(_, stateObj?: HassEntity): AlarmModesCardFeatureConfig {
static getStubConfig(): AlarmModesCardFeatureConfig {
return {
type: "alarm-modes",
modes: stateObj
? (Object.keys(ALARM_MODES) as AlarmMode[]).filter((mode) => {
const feature = ALARM_MODES[mode as AlarmMode].feature;
return !feature || supportsFeature(stateObj, feature);
})
: [],
};
}

Expand Down
Loading

0 comments on commit ce2b52e

Please sign in to comment.