mirror of
https://github.com/home-assistant/frontend.git
synced 2025-08-11 02:09:26 +00:00
Compare commits
2 Commits
20230403.0
...
bump-app-d
Author | SHA1 | Date | |
---|---|---|---|
![]() |
4a19b4a397 | ||
![]() |
839f11d10d |
@@ -20,7 +20,7 @@
|
||||
"settings": {
|
||||
"import/resolver": {
|
||||
"webpack": {
|
||||
"config": "./webpack.config.cjs"
|
||||
"config": "./webpack.config.js"
|
||||
}
|
||||
}
|
||||
},
|
||||
|
4
.github/workflows/cast_deployment.yaml
vendored
4
.github/workflows/cast_deployment.yaml
vendored
@@ -22,7 +22,7 @@ jobs:
|
||||
url: ${{ steps.deploy.outputs.NETLIFY_LIVE_URL || steps.deploy.outputs.NETLIFY_URL }}
|
||||
steps:
|
||||
- name: Check out files from GitHub
|
||||
uses: actions/checkout@v3.5.0
|
||||
uses: actions/checkout@v3.3.0
|
||||
with:
|
||||
ref: dev
|
||||
|
||||
@@ -58,7 +58,7 @@ jobs:
|
||||
url: ${{ steps.deploy.outputs.NETLIFY_LIVE_URL || steps.deploy.outputs.NETLIFY_URL }}
|
||||
steps:
|
||||
- name: Check out files from GitHub
|
||||
uses: actions/checkout@v3.5.0
|
||||
uses: actions/checkout@v3.3.0
|
||||
with:
|
||||
ref: master
|
||||
|
||||
|
8
.github/workflows/ci.yaml
vendored
8
.github/workflows/ci.yaml
vendored
@@ -25,7 +25,7 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Check out files from GitHub
|
||||
uses: actions/checkout@v3.5.0
|
||||
uses: actions/checkout@v3.3.0
|
||||
- name: Set up Node ${{ env.NODE_VERSION }}
|
||||
uses: actions/setup-node@v3.6.0
|
||||
with:
|
||||
@@ -48,7 +48,7 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Check out files from GitHub
|
||||
uses: actions/checkout@v3.5.0
|
||||
uses: actions/checkout@v3.3.0
|
||||
- name: Set up Node ${{ env.NODE_VERSION }}
|
||||
uses: actions/setup-node@v3.6.0
|
||||
with:
|
||||
@@ -66,7 +66,7 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Check out files from GitHub
|
||||
uses: actions/checkout@v3.5.0
|
||||
uses: actions/checkout@v3.3.0
|
||||
- name: Set up Node ${{ env.NODE_VERSION }}
|
||||
uses: actions/setup-node@v3.6.0
|
||||
with:
|
||||
@@ -84,7 +84,7 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Check out files from GitHub
|
||||
uses: actions/checkout@v3.5.0
|
||||
uses: actions/checkout@v3.3.0
|
||||
- name: Set up Node ${{ env.NODE_VERSION }}
|
||||
uses: actions/setup-node@v3.6.0
|
||||
with:
|
||||
|
2
.github/workflows/codeql-analysis.yml
vendored
2
.github/workflows/codeql-analysis.yml
vendored
@@ -23,7 +23,7 @@ jobs:
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v3.5.0
|
||||
uses: actions/checkout@v3.3.0
|
||||
with:
|
||||
# We must fetch at least the immediate parents so that if this is
|
||||
# a pull request then we can checkout the head.
|
||||
|
4
.github/workflows/demo_deployment.yaml
vendored
4
.github/workflows/demo_deployment.yaml
vendored
@@ -23,7 +23,7 @@ jobs:
|
||||
url: ${{ steps.deploy.outputs.NETLIFY_LIVE_URL || steps.deploy.outputs.NETLIFY_URL }}
|
||||
steps:
|
||||
- name: Check out files from GitHub
|
||||
uses: actions/checkout@v3.5.0
|
||||
uses: actions/checkout@v3.3.0
|
||||
with:
|
||||
ref: dev
|
||||
|
||||
@@ -59,7 +59,7 @@ jobs:
|
||||
url: ${{ steps.deploy.outputs.NETLIFY_LIVE_URL || steps.deploy.outputs.NETLIFY_URL }}
|
||||
steps:
|
||||
- name: Check out files from GitHub
|
||||
uses: actions/checkout@v3.5.0
|
||||
uses: actions/checkout@v3.3.0
|
||||
with:
|
||||
ref: master
|
||||
|
||||
|
2
.github/workflows/design_deployment.yaml
vendored
2
.github/workflows/design_deployment.yaml
vendored
@@ -17,7 +17,7 @@ jobs:
|
||||
url: ${{ steps.deploy.outputs.NETLIFY_LIVE_URL || steps.deploy.outputs.NETLIFY_URL }}
|
||||
steps:
|
||||
- name: Check out files from GitHub
|
||||
uses: actions/checkout@v3.5.0
|
||||
uses: actions/checkout@v3.3.0
|
||||
|
||||
- name: Set up Node ${{ env.NODE_VERSION }}
|
||||
uses: actions/setup-node@v3.6.0
|
||||
|
2
.github/workflows/design_preview.yaml
vendored
2
.github/workflows/design_preview.yaml
vendored
@@ -22,7 +22,7 @@ jobs:
|
||||
if: github.repository == 'home-assistant/frontend' && contains(github.event.pull_request.labels.*.name, 'needs design preview')
|
||||
steps:
|
||||
- name: Check out files from GitHub
|
||||
uses: actions/checkout@v3.5.0
|
||||
uses: actions/checkout@v3.3.0
|
||||
|
||||
- name: Set up Node ${{ env.NODE_VERSION }}
|
||||
uses: actions/setup-node@v3.6.0
|
||||
|
4
.github/workflows/nightly.yaml
vendored
4
.github/workflows/nightly.yaml
vendored
@@ -21,7 +21,7 @@ jobs:
|
||||
contents: write
|
||||
steps:
|
||||
- name: Checkout the repository
|
||||
uses: actions/checkout@v3.5.0
|
||||
uses: actions/checkout@v3.3.0
|
||||
|
||||
- name: Set up Python ${{ env.PYTHON_VERSION }}
|
||||
uses: actions/setup-python@v4
|
||||
@@ -43,7 +43,7 @@ jobs:
|
||||
LOKALISE_TOKEN: ${{ secrets.LOKALISE_TOKEN }}
|
||||
|
||||
- name: Bump version
|
||||
run: script/version_bump.cjs nightly
|
||||
run: script/version_bump.js nightly
|
||||
|
||||
- name: Build nightly Python wheels
|
||||
run: |
|
||||
|
2
.github/workflows/release.yaml
vendored
2
.github/workflows/release.yaml
vendored
@@ -24,7 +24,7 @@ jobs:
|
||||
contents: write # Required to upload release assets
|
||||
steps:
|
||||
- name: Checkout the repository
|
||||
uses: actions/checkout@v3.5.0
|
||||
uses: actions/checkout@v3.3.0
|
||||
|
||||
- name: Verify version
|
||||
uses: home-assistant/actions/helpers/verify-version@master
|
||||
|
2
.github/workflows/stale.yml
vendored
2
.github/workflows/stale.yml
vendored
@@ -10,7 +10,7 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: 90 days stale policy
|
||||
uses: actions/stale@v8.0.0
|
||||
uses: actions/stale@v7.0.0
|
||||
with:
|
||||
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
days-before-stale: 90
|
||||
|
2
.github/workflows/translations.yaml
vendored
2
.github/workflows/translations.yaml
vendored
@@ -16,7 +16,7 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout the repository
|
||||
uses: actions/checkout@v3.5.0
|
||||
uses: actions/checkout@v3.3.0
|
||||
|
||||
- name: Upload Translations
|
||||
run: |
|
||||
|
@@ -1,6 +1,6 @@
|
||||
const path = require("path");
|
||||
const env = require("./env.cjs");
|
||||
const paths = require("./paths.cjs");
|
||||
const env = require("./env.js");
|
||||
const paths = require("./paths.js");
|
||||
|
||||
// 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
|
||||
@@ -62,7 +62,7 @@ module.exports.definedVars = ({ isProdBuild, latestBuild, defineOverlay }) => ({
|
||||
...defineOverlay,
|
||||
});
|
||||
|
||||
module.exports.htmlMinifierOptions = {
|
||||
const htmlMinifierOptions = {
|
||||
caseSensitive: true,
|
||||
collapseWhitespace: true,
|
||||
conservativeCollapse: true,
|
||||
@@ -70,7 +70,7 @@ module.exports.htmlMinifierOptions = {
|
||||
removeComments: true,
|
||||
removeRedundantAttributes: true,
|
||||
minifyCSS: {
|
||||
compatibility: "*,-properties.zeroUnits",
|
||||
level: 0,
|
||||
},
|
||||
};
|
||||
|
||||
@@ -99,7 +99,7 @@ module.exports.babelOptions = ({ latestBuild, isProdBuild, isTestBuild }) => ({
|
||||
[
|
||||
path.resolve(
|
||||
paths.polymer_dir,
|
||||
"build-scripts/babel-plugins/inline-constants-plugin.cjs"
|
||||
"build-scripts/babel-plugins/inline-constants-plugin.js"
|
||||
),
|
||||
{
|
||||
modules: ["@mdi/js"],
|
||||
@@ -119,6 +119,7 @@ module.exports.babelOptions = ({ latestBuild, isProdBuild, isTestBuild }) => ({
|
||||
"@babel/plugin-proposal-optional-chaining",
|
||||
"@babel/plugin-proposal-nullish-coalescing-operator",
|
||||
["@babel/plugin-proposal-decorators", { decoratorsBeforeExport: true }],
|
||||
"@babel/plugin-proposal-class-static-block",
|
||||
["@babel/plugin-proposal-private-methods", { loose: true }],
|
||||
["@babel/plugin-proposal-private-property-in-object", { loose: true }],
|
||||
["@babel/plugin-proposal-class-properties", { loose: true }],
|
||||
@@ -135,7 +136,7 @@ module.exports.babelOptions = ({ latestBuild, isProdBuild, isTestBuild }) => ({
|
||||
"@polymer/polymer/lib/utils/html-tag": ["html"],
|
||||
},
|
||||
strictCSS: true,
|
||||
htmlMinifier: module.exports.htmlMinifierOptions,
|
||||
htmlMinifier: htmlMinifierOptions,
|
||||
failOnError: true, // we can turn this off in case of false positives
|
||||
},
|
||||
],
|
@@ -1,6 +1,6 @@
|
||||
const fs = require("fs");
|
||||
const path = require("path");
|
||||
const paths = require("./paths.cjs");
|
||||
const paths = require("./paths.js");
|
||||
|
||||
module.exports = {
|
||||
useRollup() {
|
@@ -1,18 +1,18 @@
|
||||
// Run HA develop mode
|
||||
|
||||
const gulp = require("gulp");
|
||||
const env = require("../env.cjs");
|
||||
require("./clean.cjs");
|
||||
require("./translations.cjs");
|
||||
require("./locale-data.cjs");
|
||||
require("./gen-icons-json.cjs");
|
||||
require("./gather-static.cjs");
|
||||
require("./compress.cjs");
|
||||
require("./webpack.cjs");
|
||||
require("./service-worker.cjs");
|
||||
require("./entry-html.cjs");
|
||||
require("./rollup.cjs");
|
||||
require("./wds.cjs");
|
||||
const env = require("../env");
|
||||
require("./clean.js");
|
||||
require("./translations.js");
|
||||
require("./locale-data.js");
|
||||
require("./gen-icons-json.js");
|
||||
require("./gather-static.js");
|
||||
require("./compress.js");
|
||||
require("./webpack.js");
|
||||
require("./service-worker.js");
|
||||
require("./entry-html.js");
|
||||
require("./rollup.js");
|
||||
require("./wds.js");
|
||||
|
||||
gulp.task(
|
||||
"develop-app",
|
@@ -1,13 +1,14 @@
|
||||
const gulp = require("gulp");
|
||||
const env = require("../env.cjs");
|
||||
|
||||
require("./clean.cjs");
|
||||
require("./translations.cjs");
|
||||
require("./gather-static.cjs");
|
||||
require("./webpack.cjs");
|
||||
require("./service-worker.cjs");
|
||||
require("./entry-html.cjs");
|
||||
require("./rollup.cjs");
|
||||
const env = require("../env");
|
||||
|
||||
require("./clean.js");
|
||||
require("./translations.js");
|
||||
require("./gather-static.js");
|
||||
require("./webpack.js");
|
||||
require("./service-worker.js");
|
||||
require("./entry-html.js");
|
||||
require("./rollup.js");
|
||||
|
||||
gulp.task(
|
||||
"develop-cast",
|
@@ -1,7 +1,7 @@
|
||||
const del = import("del");
|
||||
const gulp = require("gulp");
|
||||
const paths = require("../paths.cjs");
|
||||
require("./translations.cjs");
|
||||
const paths = require("../paths");
|
||||
require("./translations");
|
||||
|
||||
gulp.task(
|
||||
"clean",
|
@@ -4,7 +4,7 @@ const gulp = require("gulp");
|
||||
const zopfli = require("gulp-zopfli-green");
|
||||
const merge = require("merge-stream");
|
||||
const path = require("path");
|
||||
const paths = require("../paths.cjs");
|
||||
const paths = require("../paths");
|
||||
|
||||
const zopfliOptions = { threshold: 150 };
|
||||
|
@@ -1,15 +1,16 @@
|
||||
// Run demo develop mode
|
||||
const gulp = require("gulp");
|
||||
const env = require("../env.cjs");
|
||||
|
||||
require("./clean.cjs");
|
||||
require("./translations.cjs");
|
||||
require("./gen-icons-json.cjs");
|
||||
require("./gather-static.cjs");
|
||||
require("./webpack.cjs");
|
||||
require("./service-worker.cjs");
|
||||
require("./entry-html.cjs");
|
||||
require("./rollup.cjs");
|
||||
const env = require("../env");
|
||||
|
||||
require("./clean.js");
|
||||
require("./translations.js");
|
||||
require("./gen-icons-json.js");
|
||||
require("./gather-static.js");
|
||||
require("./webpack.js");
|
||||
require("./service-worker.js");
|
||||
require("./entry-html.js");
|
||||
require("./rollup.js");
|
||||
|
||||
gulp.task(
|
||||
"develop-demo",
|
@@ -3,10 +3,9 @@ const gulp = require("gulp");
|
||||
const fs = require("fs-extra");
|
||||
const path = require("path");
|
||||
const template = require("lodash.template");
|
||||
const { minify } = require("html-minifier-terser");
|
||||
const paths = require("../paths.cjs");
|
||||
const env = require("../env.cjs");
|
||||
const { htmlMinifierOptions, terserOptions } = require("../bundle.cjs");
|
||||
const minify = require("html-minifier").minify;
|
||||
const paths = require("../paths.js");
|
||||
const env = require("../env.js");
|
||||
|
||||
const templatePath = (tpl) =>
|
||||
path.resolve(paths.polymer_dir, "src/html/", `${tpl}.html.template`);
|
||||
@@ -40,12 +39,10 @@ const renderGalleryTemplate = (pth, data = {}) =>
|
||||
|
||||
const minifyHtml = (content) =>
|
||||
minify(content, {
|
||||
...htmlMinifierOptions,
|
||||
conservativeCollapse: false,
|
||||
minifyJS: terserOptions({
|
||||
latestBuild: false, // Shared scripts should be ES5
|
||||
isTestBuild: true, // Don't need source maps
|
||||
}),
|
||||
collapseWhitespace: true,
|
||||
minifyJS: true,
|
||||
minifyCSS: true,
|
||||
removeComments: true,
|
||||
});
|
||||
|
||||
const PAGES = ["onboarding", "authorize"];
|
||||
@@ -66,7 +63,7 @@ gulp.task("gen-pages-dev", (done) => {
|
||||
done();
|
||||
});
|
||||
|
||||
gulp.task("gen-pages-prod", async () => {
|
||||
gulp.task("gen-pages-prod", (done) => {
|
||||
const latestManifest = require(path.resolve(
|
||||
paths.app_output_latest,
|
||||
"manifest.json"
|
||||
@@ -76,23 +73,19 @@ gulp.task("gen-pages-prod", async () => {
|
||||
"manifest.json"
|
||||
));
|
||||
|
||||
const minifiedHTML = [];
|
||||
for (const page of PAGES) {
|
||||
const content = renderTemplate(page, {
|
||||
latestPageJS: latestManifest[`${page}.js`],
|
||||
|
||||
es5PageJS: es5Manifest[`${page}.js`],
|
||||
});
|
||||
|
||||
minifiedHTML.push(
|
||||
minifyHtml(content).then((minified) =>
|
||||
fs.outputFileSync(
|
||||
path.resolve(paths.app_output_root, `${page}.html`),
|
||||
minified
|
||||
)
|
||||
)
|
||||
fs.outputFileSync(
|
||||
path.resolve(paths.app_output_root, `${page}.html`),
|
||||
minifyHtml(content)
|
||||
);
|
||||
}
|
||||
await Promise.all(minifiedHTML);
|
||||
done();
|
||||
});
|
||||
|
||||
gulp.task("gen-index-app-dev", (done) => {
|
||||
@@ -125,7 +118,7 @@ gulp.task("gen-index-app-dev", (done) => {
|
||||
done();
|
||||
});
|
||||
|
||||
gulp.task("gen-index-app-prod", async () => {
|
||||
gulp.task("gen-index-app-prod", (done) => {
|
||||
const latestManifest = require(path.resolve(
|
||||
paths.app_output_latest,
|
||||
"manifest.json"
|
||||
@@ -143,15 +136,13 @@ gulp.task("gen-index-app-prod", async () => {
|
||||
es5CoreJS: es5Manifest["core.js"],
|
||||
es5CustomPanelJS: es5Manifest["custom-panel.js"],
|
||||
});
|
||||
const minified = (await minifyHtml(content)).replace(
|
||||
/#THEMEC/g,
|
||||
"{{ theme_color }}"
|
||||
);
|
||||
const minified = minifyHtml(content).replace(/#THEMEC/g, "{{ theme_color }}");
|
||||
|
||||
fs.outputFileSync(
|
||||
path.resolve(paths.app_output_root, "index.html"),
|
||||
minified
|
||||
);
|
||||
done();
|
||||
});
|
||||
|
||||
gulp.task("gen-index-cast-dev", (done) => {
|
||||
@@ -253,7 +244,7 @@ gulp.task("gen-index-demo-dev", (done) => {
|
||||
done();
|
||||
});
|
||||
|
||||
gulp.task("gen-index-demo-prod", async () => {
|
||||
gulp.task("gen-index-demo-prod", (done) => {
|
||||
const latestManifest = require(path.resolve(
|
||||
paths.demo_output_latest,
|
||||
"manifest.json"
|
||||
@@ -267,12 +258,13 @@ gulp.task("gen-index-demo-prod", async () => {
|
||||
|
||||
es5DemoJS: es5Manifest["main.js"],
|
||||
});
|
||||
const minified = await minifyHtml(content);
|
||||
const minified = minifyHtml(content);
|
||||
|
||||
fs.outputFileSync(
|
||||
path.resolve(paths.demo_output_root, "index.html"),
|
||||
minified
|
||||
);
|
||||
done();
|
||||
});
|
||||
|
||||
gulp.task("gen-index-gallery-dev", (done) => {
|
||||
@@ -287,7 +279,7 @@ gulp.task("gen-index-gallery-dev", (done) => {
|
||||
done();
|
||||
});
|
||||
|
||||
gulp.task("gen-index-gallery-prod", async () => {
|
||||
gulp.task("gen-index-gallery-prod", (done) => {
|
||||
const latestManifest = require(path.resolve(
|
||||
paths.gallery_output_latest,
|
||||
"manifest.json"
|
||||
@@ -295,12 +287,13 @@ gulp.task("gen-index-gallery-prod", async () => {
|
||||
const content = renderGalleryTemplate("index", {
|
||||
latestGalleryJS: latestManifest["entrypoint.js"],
|
||||
});
|
||||
const minified = await minifyHtml(content);
|
||||
const minified = minifyHtml(content);
|
||||
|
||||
fs.outputFileSync(
|
||||
path.resolve(paths.gallery_output_root, "index.html"),
|
||||
minified
|
||||
);
|
||||
done();
|
||||
});
|
||||
|
||||
gulp.task("gen-index-hassio-dev", async () => {
|
@@ -8,7 +8,6 @@ const gulp = require("gulp");
|
||||
const jszip = require("jszip");
|
||||
const tar = require("tar");
|
||||
const { Octokit } = require("@octokit/rest");
|
||||
const { retry } = require("@octokit/plugin-retry");
|
||||
const { createOAuthDeviceAuth } = require("@octokit/auth-oauth-device");
|
||||
|
||||
const MAX_AGE = 24; // hours
|
||||
@@ -96,7 +95,7 @@ gulp.task("fetch-nightly-translations", async function () {
|
||||
|
||||
// Authenticate with token and request workflow runs from GitHub
|
||||
console.log("Fetching new translations...");
|
||||
const octokit = new (Octokit.plugin(retry))({
|
||||
const octokit = new Octokit({
|
||||
userAgent: "Fetch Nightly Translations",
|
||||
auth: tokenAuth.token,
|
||||
});
|
@@ -6,17 +6,17 @@ const { marked } = require("marked");
|
||||
const glob = require("glob");
|
||||
const yaml = require("js-yaml");
|
||||
|
||||
const env = require("../env.cjs");
|
||||
const paths = require("../paths.cjs");
|
||||
const env = require("../env");
|
||||
const paths = require("../paths");
|
||||
|
||||
require("./clean.cjs");
|
||||
require("./translations.cjs");
|
||||
require("./gen-icons-json.cjs");
|
||||
require("./gather-static.cjs");
|
||||
require("./webpack.cjs");
|
||||
require("./service-worker.cjs");
|
||||
require("./entry-html.cjs");
|
||||
require("./rollup.cjs");
|
||||
require("./clean.js");
|
||||
require("./translations.js");
|
||||
require("./gen-icons-json.js");
|
||||
require("./gather-static.js");
|
||||
require("./webpack.js");
|
||||
require("./service-worker.js");
|
||||
require("./entry-html.js");
|
||||
require("./rollup.js");
|
||||
|
||||
gulp.task("gather-gallery-pages", async function gatherPages() {
|
||||
const pageDir = path.resolve(paths.gallery_dir, "src/pages");
|
||||
@@ -89,7 +89,9 @@ gulp.task("gather-gallery-pages", async function gatherPages() {
|
||||
|
||||
// Generate sidebar
|
||||
const sidebarPath = path.resolve(paths.gallery_dir, "sidebar.js");
|
||||
const sidebar = (await import(sidebarPath)).default;
|
||||
// To make watch work during development
|
||||
delete require.cache[sidebarPath];
|
||||
const sidebar = require(sidebarPath);
|
||||
|
||||
const pagesToProcess = {};
|
||||
for (const key of processed) {
|
@@ -3,7 +3,7 @@
|
||||
const gulp = require("gulp");
|
||||
const path = require("path");
|
||||
const fs = require("fs-extra");
|
||||
const paths = require("../paths.cjs");
|
||||
const paths = require("../paths");
|
||||
|
||||
const npmPath = (...parts) =>
|
||||
path.resolve(paths.polymer_dir, "node_modules", ...parts);
|
@@ -134,11 +134,11 @@ gulp.task("gen-icons-json", (done) => {
|
||||
});
|
||||
|
||||
const file = fs.readFileSync(PACKAGE_PATH, { encoding });
|
||||
const packageMeta = JSON.parse(file);
|
||||
const package = JSON.parse(file);
|
||||
|
||||
fs.writeFileSync(
|
||||
path.resolve(OUTPUT_DIR, "iconMetadata.json"),
|
||||
JSON.stringify({ version: packageMeta.version, parts })
|
||||
JSON.stringify({ version: package.version, parts })
|
||||
);
|
||||
|
||||
fs.writeFileSync(
|
@@ -1,13 +1,13 @@
|
||||
const gulp = require("gulp");
|
||||
const env = require("../env.cjs");
|
||||
require("./clean.cjs");
|
||||
require("./compress.cjs");
|
||||
require("./entry-html.cjs");
|
||||
require("./gather-static.cjs");
|
||||
require("./gen-icons-json.cjs");
|
||||
require("./rollup.cjs");
|
||||
require("./translations.cjs");
|
||||
require("./webpack.cjs");
|
||||
const env = require("../env");
|
||||
require("./clean.js");
|
||||
require("./gen-icons-json.js");
|
||||
require("./webpack.js");
|
||||
require("./compress.js");
|
||||
require("./rollup.js");
|
||||
require("./gather-static.js");
|
||||
require("./translations.js");
|
||||
require("./gen-icons-json.js");
|
||||
|
||||
gulp.task(
|
||||
"develop-hassio",
|
@@ -2,7 +2,7 @@ const del = import("del");
|
||||
const path = require("path");
|
||||
const gulp = require("gulp");
|
||||
const fs = require("fs");
|
||||
const paths = require("../paths.cjs");
|
||||
const paths = require("../paths");
|
||||
|
||||
const outDir = "build/locale-data";
|
||||
|
@@ -6,8 +6,8 @@ const handler = require("serve-handler");
|
||||
const http = require("http");
|
||||
const log = require("fancy-log");
|
||||
const open = require("open");
|
||||
const rollupConfig = require("../rollup.cjs");
|
||||
const paths = require("../paths.cjs");
|
||||
const rollupConfig = require("../rollup");
|
||||
const paths = require("../paths");
|
||||
|
||||
const bothBuilds = (createConfigFunc, params) =>
|
||||
gulp.series(
|
||||
@@ -46,7 +46,7 @@ function createServer(serveOptions) {
|
||||
);
|
||||
}
|
||||
|
||||
function watchRollup(createConfig, extraWatchSrc = [], serveOptions = null) {
|
||||
function watchRollup(createConfig, extraWatchSrc = [], serveOptions) {
|
||||
const { inputOptions, outputOptions } = createConfig({
|
||||
isProdBuild: false,
|
||||
latestBuild: true,
|
@@ -5,7 +5,7 @@ const path = require("path");
|
||||
const fs = require("fs-extra");
|
||||
const workboxBuild = require("workbox-build");
|
||||
const sourceMapUrl = require("source-map-url");
|
||||
const paths = require("../paths.cjs");
|
||||
const paths = require("../paths.js");
|
||||
|
||||
const swDest = path.resolve(paths.app_output_root, "service_worker.js");
|
||||
|
@@ -9,11 +9,11 @@ const flatmap = require("gulp-flatmap");
|
||||
const merge = require("gulp-merge-json");
|
||||
const rename = require("gulp-rename");
|
||||
const transform = require("gulp-json-transform");
|
||||
const { mapFiles } = require("../util.cjs");
|
||||
const env = require("../env.cjs");
|
||||
const paths = require("../paths.cjs");
|
||||
const { mapFiles } = require("../util");
|
||||
const env = require("../env");
|
||||
const paths = require("../paths");
|
||||
|
||||
require("./fetch-nightly-translations.cjs");
|
||||
require("./fetch-nightly-translations");
|
||||
|
||||
const inFrontendDir = "translations/frontend";
|
||||
const inBackendDir = "translations/backend";
|
@@ -5,15 +5,15 @@ const webpack = require("webpack");
|
||||
const WebpackDevServer = require("webpack-dev-server");
|
||||
const log = require("fancy-log");
|
||||
const path = require("path");
|
||||
const env = require("../env.cjs");
|
||||
const paths = require("../paths.cjs");
|
||||
const env = require("../env");
|
||||
const paths = require("../paths");
|
||||
const {
|
||||
createAppConfig,
|
||||
createDemoConfig,
|
||||
createCastConfig,
|
||||
createHassioConfig,
|
||||
createGalleryConfig,
|
||||
} = require("../webpack.cjs");
|
||||
} = require("../webpack");
|
||||
|
||||
const bothBuilds = (createConfigFunc, params) => [
|
||||
createConfigFunc({ ...params, latestBuild: true }),
|
@@ -103,7 +103,7 @@ module.exports = function (opts = {}) {
|
||||
}
|
||||
delete optionsObject.type;
|
||||
|
||||
if (!/^.*\//.test(workerFile)) {
|
||||
if (!new RegExp("^.*/").test(workerFile)) {
|
||||
this.warn(
|
||||
`Paths passed to the Worker constructor must be relative or absolute, i.e. start with /, ./ or ../ (just like dynamic import!). Ignoring "${workerFile}".`
|
||||
);
|
@@ -3,18 +3,18 @@ const path = require("path");
|
||||
const commonjs = require("@rollup/plugin-commonjs");
|
||||
const resolve = require("@rollup/plugin-node-resolve");
|
||||
const json = require("@rollup/plugin-json");
|
||||
const { babel } = require("@rollup/plugin-babel");
|
||||
const babel = require("@rollup/plugin-babel").babel;
|
||||
const replace = require("@rollup/plugin-replace");
|
||||
const visualizer = require("rollup-plugin-visualizer");
|
||||
const { string } = require("rollup-plugin-string");
|
||||
const { terser } = require("rollup-plugin-terser");
|
||||
const manifest = require("./rollup-plugins/manifest-plugin.cjs");
|
||||
const worker = require("./rollup-plugins/worker-plugin.cjs");
|
||||
const dontHashPlugin = require("./rollup-plugins/dont-hash-plugin.cjs");
|
||||
const ignore = require("./rollup-plugins/ignore-plugin.cjs");
|
||||
const manifest = require("./rollup-plugins/manifest-plugin");
|
||||
const worker = require("./rollup-plugins/worker-plugin");
|
||||
const dontHashPlugin = require("./rollup-plugins/dont-hash-plugin");
|
||||
const ignore = require("./rollup-plugins/ignore-plugin");
|
||||
|
||||
const bundle = require("./bundle.cjs");
|
||||
const paths = require("./paths.cjs");
|
||||
const bundle = require("./bundle");
|
||||
const paths = require("./paths");
|
||||
|
||||
const extensions = [".js", ".ts"];
|
||||
|
@@ -4,8 +4,8 @@ const TerserPlugin = require("terser-webpack-plugin");
|
||||
const { WebpackManifestPlugin } = require("webpack-manifest-plugin");
|
||||
const log = require("fancy-log");
|
||||
const WebpackBar = require("webpackbar");
|
||||
const paths = require("./paths.cjs");
|
||||
const bundle = require("./bundle.cjs");
|
||||
const paths = require("./paths.js");
|
||||
const bundle = require("./bundle.js");
|
||||
|
||||
class LogStartCompilePlugin {
|
||||
ignoredFirst = false;
|
||||
@@ -152,17 +152,14 @@ const createWebpackConfig = ({
|
||||
},
|
||||
},
|
||||
output: {
|
||||
filename: ({ chunk }) =>
|
||||
!isProdBuild || isStatsBuild || dontHash.has(chunk.name)
|
||||
? "[name].js"
|
||||
: "[name]-[contenthash].js",
|
||||
filename: ({ chunk }) => {
|
||||
if (!isProdBuild || isStatsBuild || dontHash.has(chunk.name)) {
|
||||
return `${chunk.name}.js`;
|
||||
}
|
||||
return `${chunk.name}.${chunk.hash.substr(0, 8)}.js`;
|
||||
},
|
||||
chunkFilename:
|
||||
isProdBuild && !isStatsBuild ? "[id]-[contenthash].js" : "[name].js",
|
||||
assetModuleFilename:
|
||||
isProdBuild && !isStatsBuild ? "[id]-[contenthash][ext]" : "[id][ext]",
|
||||
hashFunction: "xxhash64",
|
||||
hashDigest: "base64url",
|
||||
hashDigestLength: 11, // full length of 64 bit base64url
|
||||
isProdBuild && !isStatsBuild ? "[chunkhash:8].js" : "[id].chunk.js",
|
||||
path: outputPath,
|
||||
publicPath,
|
||||
// To silence warning in worker plugin
|
@@ -1,5 +1,5 @@
|
||||
import rollup from "../build-scripts/rollup.cjs";
|
||||
import env from "../build-scripts/env.cjs";
|
||||
const rollup = require("../build-scripts/rollup.js");
|
||||
const env = require("../build-scripts/env.js");
|
||||
|
||||
const config = rollup.createCastConfig({
|
||||
isProdBuild: env.isProdBuild(),
|
||||
@@ -7,4 +7,4 @@ const config = rollup.createCastConfig({
|
||||
isStatsBuild: env.isStatsBuild(),
|
||||
});
|
||||
|
||||
export default { ...config.inputOptions, output: config.outputOptions };
|
||||
module.exports = { ...config.inputOptions, output: config.outputOptions };
|
||||
|
@@ -1,8 +1,8 @@
|
||||
import webpack from "../build-scripts/webpack.cjs";
|
||||
import env from "../build-scripts/env.cjs";
|
||||
const { createCastConfig } = require("../build-scripts/webpack.js");
|
||||
const { isProdBuild, isStatsBuild } = require("../build-scripts/env.js");
|
||||
|
||||
export default webpack.createCastConfig({
|
||||
isProdBuild: env.isProdBuild(),
|
||||
isStatsBuild: env.isStatsBuild(),
|
||||
module.exports = createCastConfig({
|
||||
isProdBuild: isProdBuild(),
|
||||
isStatsBuild: isStatsBuild(),
|
||||
latestBuild: true,
|
||||
});
|
||||
|
@@ -1,5 +1,5 @@
|
||||
import rollup from "../build-scripts/rollup.cjs";
|
||||
import env from "../build-scripts/env.cjs";
|
||||
const rollup = require("../build-scripts/rollup.js");
|
||||
const env = require("../build-scripts/env.js");
|
||||
|
||||
const config = rollup.createDemoConfig({
|
||||
isProdBuild: env.isProdBuild(),
|
||||
@@ -7,4 +7,4 @@ const config = rollup.createDemoConfig({
|
||||
isStatsBuild: env.isStatsBuild(),
|
||||
});
|
||||
|
||||
export default { ...config.inputOptions, output: config.outputOptions };
|
||||
module.exports = { ...config.inputOptions, output: config.outputOptions };
|
||||
|
@@ -1,19 +1,39 @@
|
||||
import { HassEntity } from "home-assistant-js-websocket";
|
||||
import { HistoryStates } from "../../../src/data/history";
|
||||
import { MockHomeAssistant } from "../../../src/fake_data/provide_hass";
|
||||
|
||||
const generateStateHistory = (
|
||||
state: HassEntity,
|
||||
deltas,
|
||||
start_date: Date,
|
||||
end_date: Date
|
||||
) => {
|
||||
interface HistoryQueryParams {
|
||||
filter_entity_id: string;
|
||||
end_time: string;
|
||||
}
|
||||
|
||||
const parseQuery = <T>(queryString: string) => {
|
||||
const query: any = {};
|
||||
const items = queryString.split("&");
|
||||
for (const item of items) {
|
||||
const parts = item.split("=");
|
||||
const key = decodeURIComponent(parts[0]);
|
||||
const value = parts.length > 1 ? decodeURIComponent(parts[1]) : undefined;
|
||||
query[key] = value;
|
||||
}
|
||||
return query as T;
|
||||
};
|
||||
|
||||
const getTime = (minutesAgo) => {
|
||||
const ts = new Date(Date.now() - minutesAgo * 60 * 1000);
|
||||
return ts.toISOString();
|
||||
};
|
||||
|
||||
const randomTimeAdjustment = (diff) => Math.random() * diff - diff / 2;
|
||||
|
||||
const maxTime = 1440;
|
||||
|
||||
const generateHistory = (state, deltas) => {
|
||||
const changes =
|
||||
typeof deltas[0] === "object"
|
||||
? deltas
|
||||
: deltas.map((st) => ({ state: st }));
|
||||
|
||||
const timeDiff = (end_date.getTime() - start_date.getTime()) / changes.length;
|
||||
const timeDiff = 900 / changes.length;
|
||||
|
||||
return changes.map((change, index) => {
|
||||
let attributes;
|
||||
@@ -27,13 +47,17 @@ const generateStateHistory = (
|
||||
attributes = { ...state.attributes, ...change.attributes };
|
||||
}
|
||||
|
||||
const time = start_date.getTime() + timeDiff * index;
|
||||
const time =
|
||||
index === 0
|
||||
? getTime(maxTime)
|
||||
: getTime(maxTime - index * timeDiff + randomTimeAdjustment(timeDiff));
|
||||
|
||||
return {
|
||||
a: attributes,
|
||||
s: change.state || state.state,
|
||||
lc: time / 1000,
|
||||
lu: time / 1000,
|
||||
attributes,
|
||||
entity_id: state.entity_id,
|
||||
state: change.state || state.state,
|
||||
last_changed: time,
|
||||
last_updated: time,
|
||||
};
|
||||
});
|
||||
};
|
||||
@@ -41,29 +65,15 @@ const generateStateHistory = (
|
||||
const incrementalUnits = ["clients", "queries", "ads"];
|
||||
|
||||
export const mockHistory = (mockHass: MockHomeAssistant) => {
|
||||
mockHass.mockWS(
|
||||
"history/stream",
|
||||
(
|
||||
{
|
||||
entity_ids,
|
||||
start_time,
|
||||
end_time,
|
||||
}: {
|
||||
entity_ids: string[];
|
||||
start_time: string;
|
||||
end_time?: string;
|
||||
},
|
||||
hass,
|
||||
onChange
|
||||
) => {
|
||||
const states: HistoryStates = {};
|
||||
mockHass.mockAPI(
|
||||
/history\/period\/.+/,
|
||||
(hass, _method, path, _parameters) => {
|
||||
const params = parseQuery<HistoryQueryParams>(path.split("?")[1]);
|
||||
const entities = params.filter_entity_id.split(",");
|
||||
|
||||
const start = new Date(start_time);
|
||||
const end = end_time ? new Date(end_time) : new Date();
|
||||
|
||||
for (const entityId of entity_ids) {
|
||||
states[entityId] = [];
|
||||
const results: HassEntity[][] = [];
|
||||
|
||||
for (const entityId of entities) {
|
||||
const state = hass.states[entityId];
|
||||
|
||||
if (!state) {
|
||||
@@ -71,12 +81,7 @@ export const mockHistory = (mockHass: MockHomeAssistant) => {
|
||||
}
|
||||
|
||||
if (!state.attributes.unit_of_measurement) {
|
||||
states[entityId] = generateStateHistory(
|
||||
state,
|
||||
[state.state],
|
||||
start,
|
||||
end
|
||||
);
|
||||
results.push(generateHistory(state, [state.state]));
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -115,23 +120,17 @@ export const mockHistory = (mockHass: MockHomeAssistant) => {
|
||||
numberState - diff + Math.floor(Math.random() * 2 * diff);
|
||||
}
|
||||
|
||||
states[entityId] = generateStateHistory(
|
||||
state,
|
||||
Array.from({ length: statesToGenerate }, genFunc),
|
||||
start,
|
||||
end
|
||||
results.push(
|
||||
generateHistory(
|
||||
{
|
||||
entity_id: state.entity_id,
|
||||
attributes: state.attributes,
|
||||
},
|
||||
Array.from({ length: statesToGenerate }, genFunc)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
setTimeout(() => {
|
||||
onChange?.({
|
||||
states,
|
||||
start_time: start,
|
||||
end_time: end,
|
||||
});
|
||||
}, 1);
|
||||
|
||||
return () => {};
|
||||
return results;
|
||||
}
|
||||
);
|
||||
};
|
||||
|
@@ -1,11 +1,12 @@
|
||||
import webpack from "../build-scripts/webpack.cjs";
|
||||
import env from "../build-scripts/env.cjs";
|
||||
const { createDemoConfig } = require("../build-scripts/webpack.js");
|
||||
const { isProdBuild, isStatsBuild } = require("../build-scripts/env.js");
|
||||
|
||||
// File just used for stats builds
|
||||
|
||||
const latestBuild = true;
|
||||
|
||||
export default webpack.createDemoConfig({
|
||||
isProdBuild: env.isProdBuild(),
|
||||
isStatsBuild: env.isStatsBuild(),
|
||||
module.exports = createDemoConfig({
|
||||
isProdBuild: isProdBuild(),
|
||||
isStatsBuild: isStatsBuild(),
|
||||
latestBuild,
|
||||
});
|
||||
|
@@ -1,5 +1,5 @@
|
||||
import rollup from "../build-scripts/rollup.cjs";
|
||||
import env from "../build-scripts/env.cjs";
|
||||
const rollup = require("../build-scripts/rollup.js");
|
||||
const env = require("../build-scripts/env.js");
|
||||
|
||||
const config = rollup.createGalleryConfig({
|
||||
isProdBuild: env.isProdBuild(),
|
||||
@@ -7,4 +7,4 @@ const config = rollup.createGalleryConfig({
|
||||
isStatsBuild: env.isStatsBuild(),
|
||||
});
|
||||
|
||||
export default { ...config.inputOptions, output: config.outputOptions };
|
||||
module.exports = { ...config.inputOptions, output: config.outputOptions };
|
||||
|
@@ -1,4 +1,4 @@
|
||||
export default [
|
||||
module.exports = [
|
||||
{
|
||||
// This section has no header and so all page links are shown directly in the sidebar
|
||||
category: "concepts",
|
||||
|
@@ -1,8 +1,8 @@
|
||||
import webpack from "../build-scripts/webpack.cjs";
|
||||
import env from "../build-scripts/env.cjs";
|
||||
const { createGalleryConfig } = require("../build-scripts/webpack.js");
|
||||
const { isProdBuild, isStatsBuild } = require("../build-scripts/env.js");
|
||||
|
||||
export default webpack.createGalleryConfig({
|
||||
isProdBuild: env.isProdBuild(),
|
||||
isStatsBuild: env.isStatsBuild(),
|
||||
module.exports = createGalleryConfig({
|
||||
isProdBuild: isProdBuild(),
|
||||
isStatsBuild: isStatsBuild(),
|
||||
latestBuild: true,
|
||||
});
|
||||
|
14
gulpfile.js
14
gulpfile.js
@@ -1,13 +1,3 @@
|
||||
import { globIterate } from "glob";
|
||||
var requireDir = require("require-dir");
|
||||
|
||||
const gulpImports = [];
|
||||
|
||||
for await (const gulpModule of globIterate("build-scripts/gulp/*.?(c|m)js", {
|
||||
dotRelative: true,
|
||||
})) {
|
||||
gulpImports.push(import(gulpModule));
|
||||
}
|
||||
|
||||
// Since all tasks are currently registered with gulp.task(), this is enough
|
||||
// If any are converted to named exports, need to loop and aggregate exports here
|
||||
await Promise.all(gulpImports);
|
||||
requireDir("./build-scripts/gulp/");
|
||||
|
@@ -1,5 +1,5 @@
|
||||
import rollup from "../build-scripts/rollup.cjs";
|
||||
import env from "../build-scripts/env.cjs";
|
||||
const rollup = require("../build-scripts/rollup.js");
|
||||
const env = require("../build-scripts/env.js");
|
||||
|
||||
const config = rollup.createHassioConfig({
|
||||
isProdBuild: env.isProdBuild(),
|
||||
@@ -7,4 +7,4 @@ const config = rollup.createHassioConfig({
|
||||
isStatsBuild: env.isStatsBuild(),
|
||||
});
|
||||
|
||||
export default { ...config.inputOptions, output: config.outputOptions };
|
||||
module.exports = { ...config.inputOptions, output: config.outputOptions };
|
||||
|
@@ -114,6 +114,9 @@ class HassioAddonAudio extends LitElement {
|
||||
ha-card {
|
||||
display: block;
|
||||
}
|
||||
paper-item {
|
||||
width: 450px;
|
||||
}
|
||||
.card-actions {
|
||||
text-align: right;
|
||||
}
|
||||
|
@@ -248,9 +248,9 @@ export class HassioBackups extends LitElement {
|
||||
class="warning"
|
||||
@click=${this._deleteSelected}
|
||||
></ha-icon-button>
|
||||
<simple-tooltip animation-delay="0" for="delete-btn">
|
||||
<paper-tooltip animation-delay="0" for="delete-btn">
|
||||
${this.supervisor.localize("backup.delete_selected")}
|
||||
</simple-tooltip>
|
||||
</paper-tooltip>
|
||||
`}
|
||||
</div>
|
||||
</div> `
|
||||
|
@@ -50,7 +50,20 @@ class HassioMarkdownDialog extends LitElement {
|
||||
haStyleDialog,
|
||||
hassioStyle,
|
||||
css`
|
||||
app-toolbar {
|
||||
margin: 0;
|
||||
padding: 0 16px;
|
||||
color: var(--primary-text-color);
|
||||
background-color: var(--secondary-background-color);
|
||||
}
|
||||
app-toolbar [main-title] {
|
||||
margin-left: 16px;
|
||||
}
|
||||
@media all and (max-width: 450px), all and (max-height: 500px) {
|
||||
app-toolbar {
|
||||
color: var(--text-primary-color);
|
||||
background-color: var(--primary-color);
|
||||
}
|
||||
ha-markdown {
|
||||
padding: 16px;
|
||||
}
|
||||
|
@@ -597,6 +597,10 @@ export class DialogHassioNetwork
|
||||
margin-left: 8px;
|
||||
}
|
||||
|
||||
:host([rtl]) app-toolbar {
|
||||
direction: rtl;
|
||||
text-align: right;
|
||||
}
|
||||
.container {
|
||||
padding: 0 8px 4px;
|
||||
}
|
||||
|
@@ -4,7 +4,7 @@ import "@polymer/paper-input/paper-input";
|
||||
import type { PaperInputElement } from "@polymer/paper-input/paper-input";
|
||||
import "@polymer/paper-item/paper-item";
|
||||
import "@polymer/paper-item/paper-item-body";
|
||||
import "@lrnwebcomponents/simple-tooltip/simple-tooltip";
|
||||
import "@polymer/paper-tooltip/paper-tooltip";
|
||||
import { css, CSSResultGroup, html, LitElement, nothing } from "lit";
|
||||
import { customElement, property, query, state } from "lit/decorators";
|
||||
import memoizeOne from "memoize-one";
|
||||
@@ -128,7 +128,7 @@ class HassioRepositoriesDialog extends LitElement {
|
||||
@click=${this._removeRepository}
|
||||
>
|
||||
</ha-icon-button>
|
||||
<simple-tooltip
|
||||
<paper-tooltip
|
||||
animation-delay="0"
|
||||
position="bottom"
|
||||
offset="1"
|
||||
@@ -138,7 +138,7 @@ class HassioRepositoriesDialog extends LitElement {
|
||||
? "dialog.repositories.used"
|
||||
: "dialog.repositories.remove"
|
||||
)}
|
||||
</simple-tooltip>
|
||||
</paper-tooltip>
|
||||
</div>
|
||||
</paper-item>
|
||||
`
|
||||
|
@@ -1,8 +1,8 @@
|
||||
import webpack from "../build-scripts/webpack.cjs";
|
||||
import env from "../build-scripts/env.cjs";
|
||||
const { createHassioConfig } = require("../build-scripts/webpack.js");
|
||||
const { isProdBuild, isStatsBuild } = require("../build-scripts/env.js");
|
||||
|
||||
export default webpack.createHassioConfig({
|
||||
isProdBuild: env.isProdBuild(),
|
||||
isStatsBuild: env.isStatsBuild(),
|
||||
module.exports = createHassioConfig({
|
||||
isProdBuild: isProdBuild(),
|
||||
isStatsBuild: isStatsBuild(),
|
||||
latestBuild: true,
|
||||
});
|
||||
|
@@ -1,5 +1,5 @@
|
||||
export default {
|
||||
"*.?(c|m){js,ts}": ["eslint --fix", "prettier --write"],
|
||||
module.exports = {
|
||||
"*.{js,ts}": ["prettier --write", "eslint --fix"],
|
||||
"!(/translations)*.{json,css,md,html}": "prettier --write",
|
||||
"translations/*/*.json": (files) =>
|
||||
'printf "%s\n" "Translation files should not be added or modified here. Instead, make the necessary modifications in src/translations/en.json. Other languages are managed externally. Please see https://developers.home-assistant.io/docs/translations/ for details." ' +
|
||||
|
89
package.json
89
package.json
@@ -19,20 +19,19 @@
|
||||
"postinstall": "husky install",
|
||||
"prepack": "pinst --disable",
|
||||
"postpack": "pinst --enable",
|
||||
"test": "instant-mocha --webpack-config ./test/webpack.config.js --require ./test/setup.cjs \"test/**/*.ts\""
|
||||
"test": "instant-mocha --webpack-config ./test/webpack.config.js --require ./test/setup.js \"test/**/*.ts\""
|
||||
},
|
||||
"author": "Paulus Schoutsen <Paulus@PaulusSchoutsen.nl> (http://paulusschoutsen.nl)",
|
||||
"license": "Apache-2.0",
|
||||
"type": "module",
|
||||
"dependencies": {
|
||||
"@braintree/sanitize-url": "6.0.2",
|
||||
"@codemirror/autocomplete": "6.4.2",
|
||||
"@codemirror/commands": "6.2.2",
|
||||
"@codemirror/language": "6.6.0",
|
||||
"@codemirror/legacy-modes": "6.3.2",
|
||||
"@codemirror/search": "6.3.0",
|
||||
"@codemirror/legacy-modes": "6.3.1",
|
||||
"@codemirror/search": "6.2.3",
|
||||
"@codemirror/state": "6.2.0",
|
||||
"@codemirror/view": "6.9.3",
|
||||
"@codemirror/view": "6.9.2",
|
||||
"@egjs/hammerjs": "2.0.17",
|
||||
"@formatjs/intl-datetimeformat": "6.5.1",
|
||||
"@formatjs/intl-getcanonicallocales": "2.1.0",
|
||||
@@ -40,16 +39,14 @@
|
||||
"@formatjs/intl-numberformat": "8.3.5",
|
||||
"@formatjs/intl-pluralrules": "5.1.10",
|
||||
"@formatjs/intl-relativetimeformat": "11.1.10",
|
||||
"@fullcalendar/core": "6.1.5",
|
||||
"@fullcalendar/daygrid": "6.1.5",
|
||||
"@fullcalendar/interaction": "6.1.5",
|
||||
"@fullcalendar/list": "6.1.5",
|
||||
"@fullcalendar/timegrid": "6.1.5",
|
||||
"@lezer/highlight": "1.1.4",
|
||||
"@lit-labs/context": "0.3.0",
|
||||
"@fullcalendar/core": "6.1.4",
|
||||
"@fullcalendar/daygrid": "6.1.4",
|
||||
"@fullcalendar/interaction": "6.1.4",
|
||||
"@fullcalendar/list": "6.1.4",
|
||||
"@fullcalendar/timegrid": "6.1.4",
|
||||
"@lezer/highlight": "1.1.3",
|
||||
"@lit-labs/motion": "1.0.3",
|
||||
"@lit-labs/virtualizer": "1.0.1",
|
||||
"@lrnwebcomponents/simple-tooltip": "4.1.0",
|
||||
"@material/chips": "=14.0.0-canary.53b3cad2f.0",
|
||||
"@material/data-table": "=14.0.0-canary.53b3cad2f.0",
|
||||
"@material/mwc-button": "0.27.0",
|
||||
@@ -72,33 +69,35 @@
|
||||
"@material/mwc-tab-bar": "0.27.0",
|
||||
"@material/mwc-textarea": "0.27.0",
|
||||
"@material/mwc-textfield": "0.27.0",
|
||||
"@material/mwc-top-app-bar": "0.27.0",
|
||||
"@material/mwc-top-app-bar-fixed": "0.27.0",
|
||||
"@material/top-app-bar": "=14.0.0-canary.53b3cad2f.0",
|
||||
"@material/web": "=1.0.0-pre.4",
|
||||
"@mdi/js": "7.2.96",
|
||||
"@mdi/svg": "7.2.96",
|
||||
"@mdi/js": "7.1.96",
|
||||
"@mdi/svg": "7.1.96",
|
||||
"@polymer/app-layout": "3.1.0",
|
||||
"@polymer/iron-flex-layout": "3.0.1",
|
||||
"@polymer/iron-icon": "3.0.1",
|
||||
"@polymer/iron-input": "3.0.1",
|
||||
"@polymer/iron-resizable-behavior": "3.0.1",
|
||||
"@polymer/paper-input": "3.2.1",
|
||||
"@polymer/paper-item": "3.0.1",
|
||||
"@polymer/paper-listbox": "3.0.1",
|
||||
"@polymer/paper-slider": "3.0.1",
|
||||
"@polymer/paper-styles": "3.0.1",
|
||||
"@polymer/paper-tabs": "3.1.0",
|
||||
"@polymer/paper-toast": "3.0.1",
|
||||
"@polymer/polymer": "3.5.1",
|
||||
"@polymer/paper-tooltip": "3.0.1",
|
||||
"@polymer/polymer": "3.4.1",
|
||||
"@thomasloven/round-slider": "0.6.0",
|
||||
"@vaadin/combo-box": "23.3.9",
|
||||
"@vaadin/vaadin-themable-mixin": "23.3.9",
|
||||
"@vaadin/combo-box": "23.3.8",
|
||||
"@vaadin/vaadin-themable-mixin": "23.3.8",
|
||||
"@vibrant/color": "3.2.1-alpha.1",
|
||||
"@vibrant/core": "3.2.1-alpha.1",
|
||||
"@vibrant/quantizer-mmcq": "3.2.1-alpha.1",
|
||||
"@vue/web-component-wrapper": "1.3.0",
|
||||
"@webcomponents/scoped-custom-element-registry": "0.0.8",
|
||||
"@webcomponents/webcomponentsjs": "2.7.0",
|
||||
"app-datepicker": "5.1.1",
|
||||
"app-datepicker": "6.0.0-rc.32",
|
||||
"chart.js": "3.3.2",
|
||||
"comlink": "4.4.1",
|
||||
"core-js": "3.29.1",
|
||||
@@ -109,15 +108,15 @@
|
||||
"deep-freeze": "0.0.1",
|
||||
"fuse.js": "6.6.2",
|
||||
"google-timezones-json": "1.0.2",
|
||||
"hls.js": "1.3.5",
|
||||
"hls.js": "1.3.4",
|
||||
"home-assistant-js-websocket": "8.0.1",
|
||||
"idb-keyval": "6.2.0",
|
||||
"intl-messageformat": "10.3.3",
|
||||
"intl-messageformat": "10.3.1",
|
||||
"js-yaml": "4.1.0",
|
||||
"leaflet": "1.9.3",
|
||||
"leaflet-draw": "1.0.4",
|
||||
"lit": "2.7.0",
|
||||
"marked": "4.3.0",
|
||||
"lit": "2.6.1",
|
||||
"marked": "4.2.12",
|
||||
"memoize-one": "6.0.0",
|
||||
"node-vibrant": "3.2.1-alpha.1",
|
||||
"proxy-polyfill": "0.3.2",
|
||||
@@ -134,8 +133,8 @@
|
||||
"tsparticles-engine": "2.9.3",
|
||||
"tsparticles-preset-links": "2.9.3",
|
||||
"unfetch": "5.0.0",
|
||||
"vis-data": "7.1.6",
|
||||
"vis-network": "9.1.6",
|
||||
"vis-data": "7.1.4",
|
||||
"vis-network": "9.1.4",
|
||||
"vue": "2.7.14",
|
||||
"vue2-daterange-picker": "0.6.8",
|
||||
"weekstart": "2.0.0",
|
||||
@@ -148,9 +147,10 @@
|
||||
"xss": "1.0.14"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/core": "7.21.4",
|
||||
"@babel/core": "7.21.3",
|
||||
"@babel/plugin-external-helpers": "7.18.6",
|
||||
"@babel/plugin-proposal-class-properties": "7.18.6",
|
||||
"@babel/plugin-proposal-class-static-block": "7.21.0",
|
||||
"@babel/plugin-proposal-decorators": "7.21.0",
|
||||
"@babel/plugin-proposal-nullish-coalescing-operator": "7.18.6",
|
||||
"@babel/plugin-proposal-object-rest-spread": "7.20.7",
|
||||
@@ -158,11 +158,10 @@
|
||||
"@babel/plugin-syntax-dynamic-import": "7.8.3",
|
||||
"@babel/plugin-syntax-import-meta": "7.10.4",
|
||||
"@babel/plugin-syntax-top-level-await": "7.14.5",
|
||||
"@babel/preset-env": "7.21.4",
|
||||
"@babel/preset-typescript": "7.21.4",
|
||||
"@babel/preset-env": "7.20.2",
|
||||
"@babel/preset-typescript": "7.21.0",
|
||||
"@koa/cors": "4.0.0",
|
||||
"@octokit/auth-oauth-device": "4.0.4",
|
||||
"@octokit/plugin-retry": "4.1.3",
|
||||
"@octokit/rest": "19.0.7",
|
||||
"@open-wc/dev-server-hmr": "0.1.4",
|
||||
"@rollup/plugin-babel": "6.0.3",
|
||||
@@ -174,7 +173,6 @@
|
||||
"@types/chromecast-caf-sender": "1.0.5",
|
||||
"@types/esprima": "4.0.3",
|
||||
"@types/glob": "8.1.0",
|
||||
"@types/html-minifier-terser": "7.0.0",
|
||||
"@types/js-yaml": "4.0.5",
|
||||
"@types/leaflet": "1.9.3",
|
||||
"@types/leaflet-draw": "1.0.6",
|
||||
@@ -185,18 +183,18 @@
|
||||
"@types/sortablejs": "1.15.1",
|
||||
"@types/tar": "6.1.4",
|
||||
"@types/webspeechapi": "0.0.29",
|
||||
"@typescript-eslint/eslint-plugin": "5.57.0",
|
||||
"@typescript-eslint/parser": "5.57.0",
|
||||
"@web/dev-server": "0.1.37",
|
||||
"@typescript-eslint/eslint-plugin": "5.55.0",
|
||||
"@typescript-eslint/parser": "5.55.0",
|
||||
"@web/dev-server": "0.1.36",
|
||||
"@web/dev-server-rollup": "0.4.0",
|
||||
"babel-loader": "9.1.2",
|
||||
"babel-plugin-template-html-minifier": "4.1.0",
|
||||
"chai": "4.3.7",
|
||||
"del": "7.0.0",
|
||||
"eslint": "8.37.0",
|
||||
"eslint": "8.36.0",
|
||||
"eslint-config-airbnb-base": "15.0.0",
|
||||
"eslint-config-airbnb-typescript": "17.0.0",
|
||||
"eslint-config-prettier": "8.8.0",
|
||||
"eslint-config-prettier": "8.7.0",
|
||||
"eslint-import-resolver-webpack": "0.13.2",
|
||||
"eslint-plugin-disable": "2.0.3",
|
||||
"eslint-plugin-import": "2.27.5",
|
||||
@@ -206,15 +204,15 @@
|
||||
"eslint-plugin-wc": "1.4.0",
|
||||
"esprima": "4.0.1",
|
||||
"fancy-log": "2.0.0",
|
||||
"fs-extra": "11.1.1",
|
||||
"glob": "9.3.2",
|
||||
"fs-extra": "11.1.0",
|
||||
"glob": "9.3.0",
|
||||
"gulp": "4.0.2",
|
||||
"gulp-flatmap": "1.0.2",
|
||||
"gulp-json-transform": "0.4.8",
|
||||
"gulp-merge-json": "2.1.2",
|
||||
"gulp-rename": "2.0.0",
|
||||
"gulp-zopfli-green": "6.0.1",
|
||||
"html-minifier-terser": "7.1.0",
|
||||
"html-minifier": "4.0.0",
|
||||
"husky": "8.0.3",
|
||||
"instant-mocha": "1.5.0",
|
||||
"jszip": "3.10.1",
|
||||
@@ -228,15 +226,16 @@
|
||||
"object-hash": "3.0.0",
|
||||
"open": "8.4.2",
|
||||
"pinst": "3.0.0",
|
||||
"prettier": "2.8.7",
|
||||
"prettier": "2.8.4",
|
||||
"require-dir": "1.2.0",
|
||||
"rollup": "2.79.1",
|
||||
"rollup-plugin-string": "3.0.0",
|
||||
"rollup-plugin-terser": "7.0.2",
|
||||
"rollup-plugin-visualizer": "5.9.0",
|
||||
"serve-handler": "6.1.5",
|
||||
"sinon": "15.0.3",
|
||||
"sinon": "15.0.2",
|
||||
"source-map-url": "0.4.1",
|
||||
"systemjs": "6.14.1",
|
||||
"systemjs": "6.14.0",
|
||||
"tar": "6.1.13",
|
||||
"terser-webpack-plugin": "5.3.7",
|
||||
"ts-lit-plugin": "1.2.1",
|
||||
@@ -245,16 +244,16 @@
|
||||
"vinyl-source-stream": "2.0.0",
|
||||
"webpack": "=5.72.1",
|
||||
"webpack-cli": "5.0.1",
|
||||
"webpack-dev-server": "4.13.1",
|
||||
"webpack-dev-server": "4.12.0",
|
||||
"webpack-manifest-plugin": "5.0.0",
|
||||
"webpackbar": "5.0.2",
|
||||
"workbox-build": "6.5.4"
|
||||
},
|
||||
"_comment": "Polymer 3.2 contained a bug, fixed in https://github.com/Polymer/polymer/pull/5569, add as patch",
|
||||
"resolutions": {
|
||||
"@polymer/polymer": "patch:@polymer/polymer@3.5.1#./.yarn/patches/@polymer/polymer/pr-5569.patch",
|
||||
"@material/mwc-button@^0.25.3": "^0.27.0"
|
||||
"@polymer/polymer": "patch:@polymer/polymer@3.4.1#./.yarn/patches/@polymer/polymer/pr-5569.patch"
|
||||
},
|
||||
"main": "src/home-assistant.js",
|
||||
"prettier": {
|
||||
"trailingComma": "es5",
|
||||
"arrowParens": "always"
|
||||
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
||||
|
||||
[project]
|
||||
name = "home-assistant-frontend"
|
||||
version = "20230403.0"
|
||||
version = "20230309.0"
|
||||
license = {text = "Apache-2.0"}
|
||||
description = "The Home Assistant frontend"
|
||||
readme = "README.md"
|
||||
|
@@ -1,5 +1,5 @@
|
||||
import rollup from "../build-scripts/rollup.cjs";
|
||||
import env from "../build-scripts/env.cjs";
|
||||
const rollup = require("./build-scripts/rollup.js");
|
||||
const env = require("./build-scripts/env.js");
|
||||
|
||||
const config = rollup.createAppConfig({
|
||||
isProdBuild: env.isProdBuild(),
|
||||
@@ -7,4 +7,4 @@ const config = rollup.createAppConfig({
|
||||
isStatsBuild: env.isStatsBuild(),
|
||||
});
|
||||
|
||||
export default { ...config.inputOptions, output: config.outputOptions };
|
||||
module.exports = { ...config.inputOptions, output: config.outputOptions };
|
||||
|
@@ -1,9 +1,9 @@
|
||||
import "@material/mwc-list";
|
||||
import "@polymer/paper-item/paper-item";
|
||||
import "@polymer/paper-item/paper-item-body";
|
||||
import { css, html, LitElement } from "lit";
|
||||
import { customElement, property } from "lit/decorators";
|
||||
import { fireEvent } from "../common/dom/fire_event";
|
||||
import "../components/ha-icon-next";
|
||||
import "../components/ha-list-item";
|
||||
import { AuthProvider } from "../data/auth";
|
||||
import { litLocalizeLiteMixin } from "../mixins/lit-localize-lite-mixin";
|
||||
|
||||
@@ -20,21 +20,18 @@ export class HaPickAuthProvider extends litLocalizeLiteMixin(LitElement) {
|
||||
protected render() {
|
||||
return html`
|
||||
<p>${this.localize("ui.panel.page-authorize.pick_auth_provider")}:</p>
|
||||
<mwc-list>
|
||||
${this.authProviders.map(
|
||||
(provider) => html`
|
||||
<ha-list-item
|
||||
hasMeta
|
||||
role="button"
|
||||
.auth_provider=${provider}
|
||||
@click=${this._handlePick}
|
||||
>
|
||||
${provider.name}
|
||||
<ha-icon-next slot="meta"></ha-icon-next>
|
||||
</ha-list-item>
|
||||
`
|
||||
)}</mwc-list
|
||||
>
|
||||
${this.authProviders.map(
|
||||
(provider) => html`
|
||||
<paper-item
|
||||
role="button"
|
||||
.auth_provider=${provider}
|
||||
@click=${this._handlePick}
|
||||
>
|
||||
<paper-item-body>${provider.name}</paper-item-body>
|
||||
<ha-icon-next></ha-icon-next>
|
||||
</paper-item>
|
||||
`
|
||||
)}
|
||||
`;
|
||||
}
|
||||
|
||||
@@ -43,12 +40,11 @@ export class HaPickAuthProvider extends litLocalizeLiteMixin(LitElement) {
|
||||
}
|
||||
|
||||
static styles = css`
|
||||
paper-item {
|
||||
cursor: pointer;
|
||||
}
|
||||
p {
|
||||
margin-top: 0;
|
||||
}
|
||||
mwc-list {
|
||||
margin: 0 -16px;
|
||||
--mdc-list-side-padding: 16px;
|
||||
}
|
||||
`;
|
||||
}
|
||||
|
@@ -1,19 +1,16 @@
|
||||
import millisecondsToDuration from "./milliseconds_to_duration";
|
||||
import secondsToDuration from "./seconds_to_duration";
|
||||
|
||||
const DAY_IN_MILLISECONDS = 86400000;
|
||||
const HOUR_IN_MILLISECONDS = 3600000;
|
||||
const MINUTE_IN_MILLISECONDS = 60000;
|
||||
const SECOND_IN_MILLISECONDS = 1000;
|
||||
const DAY_IN_SECONDS = 86400;
|
||||
const HOUR_IN_SECONDS = 3600;
|
||||
const MINUTE_IN_SECONDS = 60;
|
||||
|
||||
export const UNIT_TO_MILLISECOND_CONVERT = {
|
||||
ms: 1,
|
||||
s: SECOND_IN_MILLISECONDS,
|
||||
min: MINUTE_IN_MILLISECONDS,
|
||||
h: HOUR_IN_MILLISECONDS,
|
||||
d: DAY_IN_MILLISECONDS,
|
||||
export const UNIT_TO_SECOND_CONVERT = {
|
||||
s: 1,
|
||||
min: MINUTE_IN_SECONDS,
|
||||
h: HOUR_IN_SECONDS,
|
||||
d: DAY_IN_SECONDS,
|
||||
};
|
||||
|
||||
export const formatDuration = (duration: string, units: string): string =>
|
||||
millisecondsToDuration(
|
||||
parseFloat(duration) * UNIT_TO_MILLISECOND_CONVERT[units]
|
||||
) || "0";
|
||||
secondsToDuration(parseFloat(duration) * UNIT_TO_SECOND_CONVERT[units]) ||
|
||||
"0";
|
||||
|
@@ -1,25 +0,0 @@
|
||||
const leftPad = (num: number, digits = 2) => {
|
||||
let paddedNum = "" + num;
|
||||
for (let i = 1; i < digits; i++) {
|
||||
paddedNum = parseInt(paddedNum) < 10 ** i ? `0${paddedNum}` : paddedNum;
|
||||
}
|
||||
return paddedNum;
|
||||
};
|
||||
|
||||
export default function millisecondsToDuration(d: number) {
|
||||
const h = Math.floor(d / 1000 / 3600);
|
||||
const m = Math.floor(((d / 1000) % 3600) / 60);
|
||||
const s = Math.floor(((d / 1000) % 3600) % 60);
|
||||
const ms = Math.floor(d % 1000);
|
||||
|
||||
if (h > 0) {
|
||||
return `${h}:${leftPad(m)}:${leftPad(s)}`;
|
||||
}
|
||||
if (m > 0) {
|
||||
return `${m}:${leftPad(s)}`;
|
||||
}
|
||||
if (s > 0 || ms > 0) {
|
||||
return `${s}${ms > 0 ? `.${leftPad(ms, 3)}` : ``}`;
|
||||
}
|
||||
return null;
|
||||
}
|
@@ -1,111 +0,0 @@
|
||||
import { PropertyDeclaration, PropertyValues, ReactiveElement } from "lit";
|
||||
import { ClassElement } from "../../types";
|
||||
import { shallowEqual } from "../util/shallow-equal";
|
||||
|
||||
/**
|
||||
* Transform function type.
|
||||
*/
|
||||
export interface Transformer<T = any, V = any> {
|
||||
(value: V): T;
|
||||
}
|
||||
|
||||
type ReactiveTransformElement = ReactiveElement & {
|
||||
_transformers: Map<PropertyKey, Transformer>;
|
||||
_watching: Map<PropertyKey, Set<PropertyKey>>;
|
||||
};
|
||||
|
||||
type ReactiveElementClassWithTransformers = typeof ReactiveElement & {
|
||||
prototype: ReactiveTransformElement;
|
||||
};
|
||||
|
||||
/**
|
||||
* Specifies an tranformer callback that is run when the value of the decorated property, or any of the properties in the watching array, changes.
|
||||
* The result of the tranformer is assigned to the decorated property.
|
||||
* The tranformer receives the current as arguments.
|
||||
*/
|
||||
export const transform =
|
||||
<T, V>(config: {
|
||||
transformer: Transformer<T, V>;
|
||||
watch?: PropertyKey[];
|
||||
propertyOptions?: PropertyDeclaration;
|
||||
}): any =>
|
||||
(clsElement: ClassElement) => {
|
||||
const key = String(clsElement.key);
|
||||
return {
|
||||
...clsElement,
|
||||
kind: "method",
|
||||
descriptor: {
|
||||
set(this: ReactiveTransformElement, value: V) {
|
||||
const oldValue = this[`__transform_${key}`];
|
||||
const trnsformr: Transformer<T, V> | undefined =
|
||||
this._transformers.get(key);
|
||||
if (trnsformr) {
|
||||
this[`__transform_${key}`] = trnsformr.call(this, value);
|
||||
} else {
|
||||
this[`__transform_${key}`] = value;
|
||||
}
|
||||
this[`__original_${key}`] = value;
|
||||
this.requestUpdate(key, oldValue);
|
||||
},
|
||||
get(): T {
|
||||
return this[`__transform_${key}`];
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true,
|
||||
},
|
||||
finisher(cls: ReactiveElementClassWithTransformers) {
|
||||
// if we haven't wrapped `willUpdate` in this class, do so
|
||||
if (!cls.prototype._transformers) {
|
||||
cls.prototype._transformers = new Map<PropertyKey, Transformer>();
|
||||
cls.prototype._watching = new Map<PropertyKey, Set<PropertyKey>>();
|
||||
// @ts-ignore
|
||||
const userWillUpdate = cls.prototype.willUpdate;
|
||||
// @ts-ignore
|
||||
cls.prototype.willUpdate = function (
|
||||
this: ReactiveTransformElement,
|
||||
changedProperties: PropertyValues
|
||||
) {
|
||||
userWillUpdate.call(this, changedProperties);
|
||||
const keys = new Set<PropertyKey>();
|
||||
changedProperties.forEach((_v, k) => {
|
||||
const watchers = this._watching;
|
||||
const ks: Set<PropertyKey> | undefined = watchers.get(k);
|
||||
if (ks !== undefined) {
|
||||
ks.forEach((wk) => keys.add(wk));
|
||||
}
|
||||
});
|
||||
keys.forEach((k) => {
|
||||
// trigger setter
|
||||
this[k] = this[`__original_${String(k)}`];
|
||||
});
|
||||
};
|
||||
// clone any existing observers (superclasses)
|
||||
// eslint-disable-next-line no-prototype-builtins
|
||||
} else if (!cls.prototype.hasOwnProperty("_transformers")) {
|
||||
const tranformers = cls.prototype._transformers;
|
||||
cls.prototype._transformers = new Map();
|
||||
tranformers.forEach((v: any, k: PropertyKey) =>
|
||||
cls.prototype._transformers.set(k, v)
|
||||
);
|
||||
}
|
||||
// set this method
|
||||
cls.prototype._transformers.set(clsElement.key, config.transformer);
|
||||
if (config.watch) {
|
||||
// store watchers
|
||||
config.watch.forEach((k) => {
|
||||
let curWatch = cls.prototype._watching.get(k);
|
||||
if (!curWatch) {
|
||||
curWatch = new Set();
|
||||
cls.prototype._watching.set(k, curWatch);
|
||||
}
|
||||
curWatch.add(clsElement.key);
|
||||
});
|
||||
}
|
||||
cls.createProperty(clsElement.key, {
|
||||
noAccessor: true,
|
||||
hasChanged: (v: any, o: any) => !shallowEqual(v, o),
|
||||
...config.propertyOptions,
|
||||
});
|
||||
},
|
||||
};
|
||||
};
|
@@ -93,7 +93,7 @@ export const applyThemesOnElement = (
|
||||
}
|
||||
|
||||
// Nothing was changed
|
||||
if (element.__themes?.cacheKey === cacheKey) {
|
||||
if (element._themes?.cacheKey === cacheKey) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -119,7 +119,7 @@ export const applyThemesOnElement = (
|
||||
}
|
||||
}
|
||||
|
||||
if (!element.__themes?.keys && !Object.keys(themeRules).length) {
|
||||
if (!element._themes?.keys && !Object.keys(themeRules).length) {
|
||||
// No styles to reset, and no styles to set
|
||||
return;
|
||||
}
|
||||
@@ -130,8 +130,8 @@ export const applyThemesOnElement = (
|
||||
: undefined;
|
||||
|
||||
// Add previous set keys to reset them, and new theme
|
||||
const styles = { ...element.__themes?.keys, ...newTheme?.styles };
|
||||
element.__themes = { cacheKey, keys: newTheme?.keys };
|
||||
const styles = { ...element._themes?.keys, ...newTheme?.styles };
|
||||
element._themes = { cacheKey, keys: newTheme?.keys };
|
||||
|
||||
// Set and/or reset styles
|
||||
if (element.updateStyles) {
|
||||
|
@@ -7,10 +7,7 @@ import {
|
||||
UPDATE_SUPPORT_PROGRESS,
|
||||
} from "../../data/update";
|
||||
import { HomeAssistant } from "../../types";
|
||||
import {
|
||||
formatDuration,
|
||||
UNIT_TO_MILLISECOND_CONVERT,
|
||||
} from "../datetime/duration";
|
||||
import { formatDuration, UNIT_TO_SECOND_CONVERT } from "../datetime/duration";
|
||||
import { formatDate } from "../datetime/format_date";
|
||||
import { formatDateTime } from "../datetime/format_date_time";
|
||||
import { formatTime } from "../datetime/format_time";
|
||||
@@ -60,7 +57,7 @@ export const computeStateDisplayFromEntityAttributes = (
|
||||
if (
|
||||
attributes.device_class === "duration" &&
|
||||
attributes.unit_of_measurement &&
|
||||
UNIT_TO_MILLISECOND_CONVERT[attributes.unit_of_measurement]
|
||||
UNIT_TO_SECOND_CONVERT[attributes.unit_of_measurement]
|
||||
) {
|
||||
try {
|
||||
return formatDuration(state, attributes.unit_of_measurement);
|
||||
|
@@ -118,40 +118,24 @@ const FIXED_DOMAIN_ATTRIBUTE_STATES = {
|
||||
"window",
|
||||
],
|
||||
},
|
||||
device_tracker: {
|
||||
source_type: ["bluetooth", "bluetooth_le", "gps", "router"],
|
||||
},
|
||||
fan: {
|
||||
direction: ["forward", "reverse"],
|
||||
},
|
||||
humidifier: {
|
||||
device_class: ["humidifier", "dehumidifier"],
|
||||
},
|
||||
media_player: {
|
||||
device_class: ["tv", "speaker", "receiver"],
|
||||
media_content_type: [
|
||||
"album",
|
||||
"app",
|
||||
"artist",
|
||||
"channel",
|
||||
"channels",
|
||||
"composer",
|
||||
"contibuting_artist",
|
||||
"episode",
|
||||
"game",
|
||||
"genre",
|
||||
"image",
|
||||
"movie",
|
||||
"music",
|
||||
"playlist",
|
||||
"podcast",
|
||||
"season",
|
||||
"track",
|
||||
"tvshow",
|
||||
"url",
|
||||
"video",
|
||||
],
|
||||
repeat: ["off", "one", "all"],
|
||||
},
|
||||
number: {
|
||||
device_class: ["temperature"],
|
||||
|
@@ -1,7 +1,6 @@
|
||||
/** Return an color representing a state. */
|
||||
import { HassEntity } from "home-assistant-js-websocket";
|
||||
import { UNAVAILABLE } from "../../data/entity";
|
||||
import { computeGroupDomain, GroupEntity } from "../../data/group";
|
||||
import { computeCssVariable } from "../../resources/css-variables";
|
||||
import { slugify } from "../string/slugify";
|
||||
import { batteryStateColorProperty } from "./color/battery_color";
|
||||
@@ -53,11 +52,11 @@ export const stateColorCss = (stateObj: HassEntity, state?: string) => {
|
||||
};
|
||||
|
||||
export const domainStateColorProperties = (
|
||||
domain: string,
|
||||
stateObj: HassEntity,
|
||||
state?: string
|
||||
): string[] => {
|
||||
const compareState = state !== undefined ? state : stateObj.state;
|
||||
const domain = computeDomain(stateObj.entity_id);
|
||||
const active = stateActive(stateObj, state);
|
||||
|
||||
const properties: string[] = [];
|
||||
@@ -96,16 +95,8 @@ export const stateColorProperties = (
|
||||
}
|
||||
}
|
||||
|
||||
// Special rules for group coloring
|
||||
if (domain === "group") {
|
||||
const groupDomain = computeGroupDomain(stateObj as GroupEntity);
|
||||
if (groupDomain && STATE_COLORED_DOMAIN.has(groupDomain)) {
|
||||
return domainStateColorProperties(groupDomain, stateObj, state);
|
||||
}
|
||||
}
|
||||
|
||||
if (STATE_COLORED_DOMAIN.has(domain)) {
|
||||
return domainStateColorProperties(domain, stateObj, state);
|
||||
return domainStateColorProperties(stateObj, state);
|
||||
}
|
||||
|
||||
return undefined;
|
||||
|
@@ -1,108 +0,0 @@
|
||||
/**
|
||||
* Compares two values for shallow equality, only 1 level deep.
|
||||
*/
|
||||
export const shallowEqual = (a: any, b: any): boolean => {
|
||||
if (a === b) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (a && b && typeof a === "object" && typeof b === "object") {
|
||||
if (a.constructor !== b.constructor) {
|
||||
return false;
|
||||
}
|
||||
|
||||
let i: number | [any, any];
|
||||
let length: number;
|
||||
if (Array.isArray(a)) {
|
||||
length = a.length;
|
||||
if (length !== b.length) {
|
||||
return false;
|
||||
}
|
||||
for (i = length; i-- !== 0; ) {
|
||||
if (a[i] !== b[i]) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
if (a instanceof Map && b instanceof Map) {
|
||||
if (a.size !== b.size) {
|
||||
return false;
|
||||
}
|
||||
for (i of a.entries()) {
|
||||
if (!b.has(i[0])) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
for (i of a.entries()) {
|
||||
if (i[1] !== b.get(i[0])) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
if (a instanceof Set && b instanceof Set) {
|
||||
if (a.size !== b.size) {
|
||||
return false;
|
||||
}
|
||||
for (i of a.entries()) {
|
||||
if (!b.has(i[0])) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
if (ArrayBuffer.isView(a) && ArrayBuffer.isView(b)) {
|
||||
// @ts-ignore
|
||||
length = a.length;
|
||||
// @ts-ignore
|
||||
if (length !== b.length) {
|
||||
return false;
|
||||
}
|
||||
for (i = length; i-- !== 0; ) {
|
||||
if (a[i] !== b[i]) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
if (a.constructor === RegExp) {
|
||||
return a.source === b.source && a.flags === b.flags;
|
||||
}
|
||||
if (a.valueOf !== Object.prototype.valueOf) {
|
||||
return a.valueOf() === b.valueOf();
|
||||
}
|
||||
if (a.toString !== Object.prototype.toString) {
|
||||
return a.toString() === b.toString();
|
||||
}
|
||||
|
||||
const keys = Object.keys(a);
|
||||
length = keys.length;
|
||||
if (length !== Object.keys(b).length) {
|
||||
return false;
|
||||
}
|
||||
for (i = length; i-- !== 0; ) {
|
||||
if (!Object.prototype.hasOwnProperty.call(b, keys[i])) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
for (i = length; i-- !== 0; ) {
|
||||
const key = keys[i];
|
||||
|
||||
if (a[key] !== b[key]) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// true if both NaN, false otherwise
|
||||
// eslint-disable-next-line no-self-compare
|
||||
return a !== a && b !== b;
|
||||
};
|
@@ -302,7 +302,6 @@ export default class HaChartBase extends LitElement {
|
||||
return css`
|
||||
:host {
|
||||
display: block;
|
||||
position: relative;
|
||||
}
|
||||
.chartContainer {
|
||||
overflow: hidden;
|
||||
|
@@ -61,10 +61,6 @@ class StateHistoryChartLine extends LitElement {
|
||||
this._chartOptions = {
|
||||
parsing: false,
|
||||
animation: false,
|
||||
interaction: {
|
||||
mode: "nearest",
|
||||
axis: "x",
|
||||
},
|
||||
scales: {
|
||||
x: {
|
||||
type: "time",
|
||||
@@ -112,6 +108,7 @@ class StateHistoryChartLine extends LitElement {
|
||||
},
|
||||
plugins: {
|
||||
tooltip: {
|
||||
mode: "nearest",
|
||||
callbacks: {
|
||||
label: (context) =>
|
||||
`${context.dataset.label}: ${formatNumber(
|
||||
@@ -130,13 +127,16 @@ class StateHistoryChartLine extends LitElement {
|
||||
},
|
||||
},
|
||||
},
|
||||
hover: {
|
||||
mode: "nearest",
|
||||
},
|
||||
elements: {
|
||||
line: {
|
||||
tension: 0.1,
|
||||
borderWidth: 1.5,
|
||||
},
|
||||
point: {
|
||||
hitRadius: 50,
|
||||
hitRadius: 5,
|
||||
},
|
||||
},
|
||||
// @ts-expect-error
|
||||
|
@@ -102,7 +102,6 @@ class StatisticsChart extends LitElement {
|
||||
if (
|
||||
changedProps.has("statisticsData") ||
|
||||
changedProps.has("statTypes") ||
|
||||
changedProps.has("chartType") ||
|
||||
changedProps.has("hideLegend")
|
||||
) {
|
||||
this._generateData();
|
||||
@@ -150,10 +149,6 @@ class StatisticsChart extends LitElement {
|
||||
this._chartOptions = {
|
||||
parsing: false,
|
||||
animation: false,
|
||||
interaction: {
|
||||
mode: "nearest",
|
||||
axis: "x",
|
||||
},
|
||||
scales: {
|
||||
x: {
|
||||
type: "time",
|
||||
@@ -191,6 +186,7 @@ class StatisticsChart extends LitElement {
|
||||
},
|
||||
plugins: {
|
||||
tooltip: {
|
||||
mode: "nearest",
|
||||
callbacks: {
|
||||
label: (context) =>
|
||||
`${context.dataset.label}: ${formatNumber(
|
||||
@@ -212,6 +208,9 @@ class StatisticsChart extends LitElement {
|
||||
},
|
||||
},
|
||||
},
|
||||
hover: {
|
||||
mode: "nearest",
|
||||
},
|
||||
elements: {
|
||||
line: {
|
||||
tension: 0.4,
|
||||
@@ -220,7 +219,7 @@ class StatisticsChart extends LitElement {
|
||||
},
|
||||
bar: { borderWidth: 1.5, borderRadius: 4 },
|
||||
point: {
|
||||
hitRadius: 50,
|
||||
hitRadius: 5,
|
||||
},
|
||||
},
|
||||
// @ts-expect-error
|
||||
@@ -317,7 +316,6 @@ class StatisticsChart extends LitElement {
|
||||
}
|
||||
statDataSets.forEach((d, i) => {
|
||||
if (
|
||||
this.chartType === "line" &&
|
||||
prevEndTime &&
|
||||
prevValues &&
|
||||
prevEndTime.getTime() !== start.getTime()
|
||||
|
@@ -48,8 +48,8 @@ class HaDataTableIcon extends LitElement {
|
||||
outline: none;
|
||||
font-size: 10px;
|
||||
line-height: 1;
|
||||
background-color: var(--simple-tooltip-background, #616161);
|
||||
color: var(--simple-tooltip-text-color, white);
|
||||
background-color: var(--paper-tooltip-background, #616161);
|
||||
color: var(--paper-tooltip-text-color, white);
|
||||
padding: 8px;
|
||||
border-radius: 2px;
|
||||
}
|
||||
|
@@ -1,4 +1,4 @@
|
||||
import "@lrnwebcomponents/simple-tooltip/simple-tooltip";
|
||||
import "@polymer/paper-tooltip/paper-tooltip";
|
||||
import type { HassEntity } from "home-assistant-js-websocket";
|
||||
import { css, CSSResultGroup, html, LitElement, nothing } from "lit";
|
||||
import { customElement, property } from "lit/decorators";
|
||||
@@ -45,7 +45,7 @@ class StateInfo extends LitElement {
|
||||
.datetime=${this.stateObj.last_changed}
|
||||
capitalize
|
||||
></ha-relative-time>
|
||||
<simple-tooltip animation-delay="0" for="last_changed">
|
||||
<paper-tooltip animation-delay="0" for="last_changed">
|
||||
<div>
|
||||
<div class="row">
|
||||
<span class="column-name">
|
||||
@@ -72,7 +72,7 @@ class StateInfo extends LitElement {
|
||||
></ha-relative-time>
|
||||
</div>
|
||||
</div>
|
||||
</simple-tooltip>
|
||||
</paper-tooltip>
|
||||
</div>`
|
||||
: html`<div class="extra-info"><slot></slot></div>`}
|
||||
</div>`;
|
||||
|
@@ -1,4 +1,4 @@
|
||||
import "@lrnwebcomponents/simple-tooltip/simple-tooltip";
|
||||
import "@polymer/paper-tooltip/paper-tooltip";
|
||||
import { css, CSSResultGroup, html, LitElement, TemplateResult } from "lit";
|
||||
import { customElement, property } from "lit/decorators";
|
||||
import { fireEvent } from "../common/dom/fire_event";
|
||||
@@ -76,11 +76,11 @@ export class HaAnalytics extends LitElement {
|
||||
</ha-switch>
|
||||
${!baseEnabled
|
||||
? html`
|
||||
<simple-tooltip animation-delay="0" position="right">
|
||||
<paper-tooltip animation-delay="0" position="right">
|
||||
${this.hass.localize(
|
||||
`ui.panel.${this.translationKeyPanel}.analytics.need_base_enabled`
|
||||
)}
|
||||
</simple-tooltip>
|
||||
</paper-tooltip>
|
||||
`
|
||||
: ""}
|
||||
</span>
|
||||
|
@@ -1,6 +1,13 @@
|
||||
// @ts-ignore
|
||||
import chipStyles from "@material/chips/dist/mdc.chips.min.css";
|
||||
import { css, CSSResultGroup, html, LitElement, nothing, unsafeCSS } from "lit";
|
||||
import {
|
||||
css,
|
||||
CSSResultGroup,
|
||||
html,
|
||||
LitElement,
|
||||
TemplateResult,
|
||||
unsafeCSS,
|
||||
} from "lit";
|
||||
import { customElement, property } from "lit/decorators";
|
||||
|
||||
@customElement("ha-chip")
|
||||
@@ -11,14 +18,14 @@ export class HaChip extends LitElement {
|
||||
|
||||
@property({ type: Boolean }) public noText = false;
|
||||
|
||||
protected render() {
|
||||
protected render(): TemplateResult {
|
||||
return html`
|
||||
<div class="mdc-chip ${this.noText ? "no-text" : ""}">
|
||||
${this.hasIcon
|
||||
? html`<div class="mdc-chip__icon mdc-chip__icon--leading">
|
||||
<slot name="icon"></slot>
|
||||
</div>`
|
||||
: nothing}
|
||||
: null}
|
||||
<div class="mdc-chip__ripple"></div>
|
||||
<span role="gridcell">
|
||||
<span role="button" tabindex="0" class="mdc-chip__primary-action">
|
||||
@@ -29,7 +36,7 @@ export class HaChip extends LitElement {
|
||||
? html`<div class="mdc-chip__icon mdc-chip__icon--trailing">
|
||||
<slot name="trailing-icon"></slot>
|
||||
</div>`
|
||||
: nothing}
|
||||
: null}
|
||||
</div>
|
||||
`;
|
||||
}
|
||||
|
@@ -85,7 +85,6 @@ export class HaControlButton extends LitElement {
|
||||
--control-button-background-opacity: 0.2;
|
||||
--control-button-border-radius: 10px;
|
||||
--mdc-icon-size: 20px;
|
||||
color: var(--primary-text-color);
|
||||
width: 40px;
|
||||
height: 40px;
|
||||
-webkit-tap-highlight-color: transparent;
|
||||
@@ -111,8 +110,6 @@ export class HaControlButton extends LitElement {
|
||||
--mdc-ripple-color: var(--control-button-background-color);
|
||||
/* For safari border-radius overflow */
|
||||
z-index: 0;
|
||||
font-size: inherit;
|
||||
color: inherit;
|
||||
}
|
||||
.button::before {
|
||||
content: "";
|
||||
|
@@ -25,6 +25,8 @@ export type ControlSelectOption = {
|
||||
export class HaControlSelect extends LitElement {
|
||||
@property({ type: Boolean, reflect: true }) disabled = false;
|
||||
|
||||
@property() public label?: string;
|
||||
|
||||
@property() public options?: ControlSelectOption[];
|
||||
|
||||
@property() public value?: string;
|
||||
@@ -98,11 +100,10 @@ export class HaControlSelect extends LitElement {
|
||||
|
||||
private _handleKeydown(ev: KeyboardEvent) {
|
||||
if (!this.options || this._activeIndex == null || this.disabled) return;
|
||||
const value = this.options[this._activeIndex].value;
|
||||
switch (ev.key) {
|
||||
case " ":
|
||||
this.value = value;
|
||||
fireEvent(this, "value-changed", { value });
|
||||
this.value = this.options[this._activeIndex].value;
|
||||
fireEvent(this, "value-changed", { value: this.value });
|
||||
break;
|
||||
case "ArrowUp":
|
||||
case "ArrowLeft":
|
||||
@@ -131,7 +132,7 @@ export class HaControlSelect extends LitElement {
|
||||
if (this.disabled) return;
|
||||
const value = (ev.target as any).value;
|
||||
this.value = value;
|
||||
fireEvent(this, "value-changed", { value });
|
||||
fireEvent(this, "value-changed", { value: this.value });
|
||||
}
|
||||
|
||||
private _handleOptionMouseDown(ev: MouseEvent) {
|
||||
@@ -175,7 +176,6 @@ export class HaControlSelect extends LitElement {
|
||||
.value=${option.value}
|
||||
aria-selected=${this.value === option.value}
|
||||
aria-label=${ifDefined(option.label)}
|
||||
title=${ifDefined(option.label)}
|
||||
@click=${this._handleOptionClick}
|
||||
@mousedown=${this._handleOptionMouseDown}
|
||||
@mouseup=${this._handleOptionMouseUp}
|
||||
@@ -204,11 +204,8 @@ export class HaControlSelect extends LitElement {
|
||||
--control-select-background: var(--disabled-color);
|
||||
--control-select-background-opacity: 0.2;
|
||||
--control-select-thickness: 40px;
|
||||
--control-select-border-radius: 10px;
|
||||
--control-select-border-radius: 12px;
|
||||
--control-select-padding: 4px;
|
||||
--control-select-button-border-radius: calc(
|
||||
var(--control-select-border-radius) - var(--control-select-padding)
|
||||
);
|
||||
--mdc-icon-size: 20px;
|
||||
height: var(--control-select-thickness);
|
||||
width: 100%;
|
||||
@@ -265,7 +262,9 @@ export class HaControlSelect extends LitElement {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
border-radius: var(--control-select-button-border-radius);
|
||||
border-radius: calc(
|
||||
var(--control-select-border-radius) - var(--control-select-padding)
|
||||
);
|
||||
overflow: hidden;
|
||||
color: var(--primary-text-color);
|
||||
/* For safari border-radius overflow */
|
||||
@@ -303,16 +302,6 @@ export class HaControlSelect extends LitElement {
|
||||
justify-content: center;
|
||||
flex-direction: column;
|
||||
text-align: center;
|
||||
padding: 2px;
|
||||
width: 100%;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
.option .content span {
|
||||
display: block;
|
||||
width: 100%;
|
||||
-webkit-hyphens: auto;
|
||||
-moz-hyphens: auto;
|
||||
hyphens: auto;
|
||||
}
|
||||
:host([vertical]) {
|
||||
width: var(--control-select-thickness);
|
||||
|
@@ -244,7 +244,6 @@ export class HaControlSlider extends LitElement {
|
||||
})}
|
||||
>
|
||||
<div class="slider-track-background"></div>
|
||||
<slot name="background"></slot>
|
||||
${this.mode === "cursor"
|
||||
? this.value != null
|
||||
? html`
|
||||
@@ -311,13 +310,6 @@ export class HaControlSlider extends LitElement {
|
||||
background: var(--control-slider-background);
|
||||
opacity: var(--control-slider-background-opacity);
|
||||
}
|
||||
::slotted([slot="background"]) {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
}
|
||||
.slider .slider-track-bar {
|
||||
--border-radius: var(--control-slider-border-radius);
|
||||
--handle-size: 4px;
|
||||
@@ -432,7 +424,6 @@ export class HaControlSlider extends LitElement {
|
||||
bottom: 0;
|
||||
left: calc(var(--value, 0) * (100% - var(--cursor-size)));
|
||||
width: var(--cursor-size);
|
||||
box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
|
||||
}
|
||||
.slider .slider-track-cursor:after {
|
||||
height: 50%;
|
||||
|
@@ -41,14 +41,14 @@ export class HaDialogDatePicker extends LitElement {
|
||||
return nothing;
|
||||
}
|
||||
return html`<ha-dialog open @closed=${this.closeDialog}>
|
||||
<app-datepicker
|
||||
<app-date-picker
|
||||
.value=${this._value}
|
||||
.min=${this._params.min}
|
||||
.max=${this._params.max}
|
||||
.locale=${this._params.locale}
|
||||
@datepicker-value-updated=${this._valueChanged}
|
||||
@date-updated=${this._valueChanged}
|
||||
.firstDayOfWeek=${this._params.firstWeekday}
|
||||
></app-datepicker>
|
||||
></app-date-picker>
|
||||
<mwc-button slot="secondaryAction" @click=${this._setToday}>
|
||||
${this.hass.localize("ui.dialogs.date-picker.today")}
|
||||
</mwc-button>
|
||||
@@ -79,35 +79,32 @@ export class HaDialogDatePicker extends LitElement {
|
||||
haStyleDialog,
|
||||
css`
|
||||
ha-dialog {
|
||||
--dialog-content-padding: 0;
|
||||
--justify-action-buttons: space-between;
|
||||
}
|
||||
app-datepicker {
|
||||
--app-datepicker-accent-color: var(--primary-color);
|
||||
--app-datepicker-bg-color: transparent;
|
||||
--app-datepicker-color: var(--primary-text-color);
|
||||
--app-datepicker-disabled-day-color: var(--disabled-text-color);
|
||||
--app-datepicker-focused-day-color: var(--text-primary-color);
|
||||
--app-datepicker-focused-year-bg-color: var(--primary-color);
|
||||
--app-datepicker-selector-color: var(--secondary-text-color);
|
||||
--app-datepicker-separator-color: var(--divider-color);
|
||||
--app-datepicker-weekday-color: var(--secondary-text-color);
|
||||
app-date-picker {
|
||||
--app-focus: var(--primary-text-color);
|
||||
--app-hover: var(--primary-color);
|
||||
--app-on-disabled: var(--disabled-color);
|
||||
--app-on-focus: var(--primary-text-color);
|
||||
--app-on-hover: var(--primary-text-color);
|
||||
--app-on-primary: var(--text-primary-color);
|
||||
--app-on-surface: var(--primary-text-color);
|
||||
--app-on-today: var(--primary-text-color);
|
||||
--app-on-week-number: var(--secondary-text-color);
|
||||
--app-on-weekday: var(--secondary-text-color);
|
||||
--app-primary: var(--primary-color);
|
||||
--app-selected-focus: var(--primary-text-color);
|
||||
--app-selected-hover: var(--primary-color);
|
||||
--app-selected-on-focus: var(--text-primary-color);
|
||||
--app-selected-on-hover: var(--text-primary-color);
|
||||
--app-shape: var(--mdc-shape-medium);
|
||||
--app-surface: transparent;
|
||||
--app-today: var(--primary-text-color);
|
||||
|
||||
margin: auto;
|
||||
}
|
||||
app-datepicker::part(calendar-day):focus {
|
||||
outline: none;
|
||||
}
|
||||
app-datepicker::part(body) {
|
||||
direction: ltr;
|
||||
}
|
||||
@media all and (min-width: 450px) {
|
||||
ha-dialog {
|
||||
--mdc-dialog-min-width: 300px;
|
||||
}
|
||||
}
|
||||
@media all and (max-width: 450px), all and (max-height: 500px) {
|
||||
app-datepicker {
|
||||
width: 100%;
|
||||
}
|
||||
ha-dialog {
|
||||
--mdc-dialog-min-width: 300px;
|
||||
}
|
||||
`,
|
||||
];
|
||||
|
@@ -41,9 +41,7 @@ export class HaDialog extends DialogBase {
|
||||
SUPPRESS_DEFAULT_PRESS_SELECTOR,
|
||||
].join(", ");
|
||||
this._updateScrolledAttribute();
|
||||
this.contentElement?.addEventListener("scroll", this._onScroll, {
|
||||
passive: true,
|
||||
});
|
||||
this.contentElement?.addEventListener("scroll", this._onScroll);
|
||||
}
|
||||
|
||||
disconnectedCallback(): void {
|
||||
|
@@ -1,81 +0,0 @@
|
||||
import {
|
||||
DIRECTION_LEFT,
|
||||
DIRECTION_RIGHT,
|
||||
Manager,
|
||||
Swipe,
|
||||
} from "@egjs/hammerjs";
|
||||
import { DrawerBase } from "@material/mwc-drawer/mwc-drawer-base";
|
||||
import { styles } from "@material/mwc-drawer/mwc-drawer.css";
|
||||
import { css, PropertyValues } from "lit";
|
||||
import { customElement, property } from "lit/decorators";
|
||||
import { fireEvent } from "../common/dom/fire_event";
|
||||
|
||||
const blockingElements = (document as any).$blockingElements;
|
||||
|
||||
@customElement("ha-drawer")
|
||||
export class HaDrawer extends DrawerBase {
|
||||
@property() public direction: "ltr" | "rtl" = "ltr";
|
||||
|
||||
private _mc?: HammerManager;
|
||||
|
||||
protected createAdapter() {
|
||||
return {
|
||||
...super.createAdapter(),
|
||||
trapFocus: () => {
|
||||
blockingElements.push(this);
|
||||
this.appContent.inert = true;
|
||||
document.body.style.overflow = "hidden";
|
||||
},
|
||||
releaseFocus: () => {
|
||||
blockingElements.remove(this);
|
||||
this.appContent.inert = false;
|
||||
document.body.style.overflow = "";
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
protected updated(changedProps: PropertyValues) {
|
||||
super.updated(changedProps);
|
||||
if (changedProps.has("direction")) {
|
||||
this.mdcRoot.dir = this.direction;
|
||||
}
|
||||
if (changedProps.has("open") && this.open && this.type === "modal") {
|
||||
this._mc = new Manager(document, {
|
||||
touchAction: "pan-y",
|
||||
});
|
||||
this._mc.add(
|
||||
new Swipe({
|
||||
direction:
|
||||
this.direction === "rtl" ? DIRECTION_RIGHT : DIRECTION_LEFT,
|
||||
})
|
||||
);
|
||||
this._mc.on("swipeleft swiperight", () => {
|
||||
fireEvent(this, "hass-toggle-menu", { open: false });
|
||||
});
|
||||
} else if (this._mc) {
|
||||
this._mc.destroy();
|
||||
this._mc = undefined;
|
||||
}
|
||||
}
|
||||
|
||||
static override styles = [
|
||||
styles,
|
||||
css`
|
||||
.mdc-drawer {
|
||||
top: 0;
|
||||
}
|
||||
.mdc-drawer.mdc-drawer--modal.mdc-drawer--open {
|
||||
z-index: 200;
|
||||
}
|
||||
.mdc-drawer-app-content {
|
||||
transform: translateZ(0);
|
||||
}
|
||||
`,
|
||||
];
|
||||
}
|
||||
|
||||
declare global {
|
||||
interface HTMLElementTagNameMap {
|
||||
"ha-drawer": HaDrawer;
|
||||
}
|
||||
}
|
@@ -191,9 +191,6 @@ export class HaFileUpload extends LitElement {
|
||||
inset-inline-end: initial !important;
|
||||
direction: var(--direction);
|
||||
}
|
||||
.mdc-text-field__icon--trailing {
|
||||
pointer-events: auto !important;
|
||||
}
|
||||
.dragged:before {
|
||||
position: var(--layout-fit_-_position);
|
||||
top: var(--layout-fit_-_top);
|
||||
|
@@ -1,4 +1,4 @@
|
||||
import { css, CSSResultGroup, html, LitElement, nothing } from "lit";
|
||||
import { css, CSSResultGroup, html, LitElement, TemplateResult } from "lit";
|
||||
import { customElement, property } from "lit/decorators";
|
||||
import type { HomeAssistant } from "../../types";
|
||||
import "./ha-form";
|
||||
@@ -26,7 +26,7 @@ export class HaFormExpendable extends LitElement implements HaFormElement {
|
||||
|
||||
@property() public computeHelper?: (schema: HaFormSchema) => string;
|
||||
|
||||
protected render() {
|
||||
protected render(): TemplateResult {
|
||||
return html`
|
||||
<ha-expansion-panel outlined .expanded=${Boolean(this.schema.expanded)}>
|
||||
<div
|
||||
@@ -38,7 +38,7 @@ export class HaFormExpendable extends LitElement implements HaFormElement {
|
||||
? html` <ha-icon .icon=${this.schema.icon}></ha-icon> `
|
||||
: this.schema.iconPath
|
||||
? html` <ha-svg-icon .path=${this.schema.iconPath}></ha-svg-icon> `
|
||||
: nothing}
|
||||
: null}
|
||||
${this.schema.title}
|
||||
</div>
|
||||
<div class="content">
|
||||
|
@@ -32,9 +32,6 @@ export class HaHeaderBar extends LitElement {
|
||||
return [
|
||||
unsafeCSS(topAppBarStyles),
|
||||
css`
|
||||
.mdc-top-app-bar__row {
|
||||
height: var(--header-height);
|
||||
}
|
||||
.mdc-top-app-bar {
|
||||
position: static;
|
||||
color: var(--mdc-theme-on-primary, #fff);
|
||||
|
@@ -1,5 +1,5 @@
|
||||
import { mdiHelpCircle } from "@mdi/js";
|
||||
import "@lrnwebcomponents/simple-tooltip/simple-tooltip";
|
||||
import "@polymer/paper-tooltip/paper-tooltip";
|
||||
import { css, html, LitElement, TemplateResult } from "lit";
|
||||
import { customElement, property } from "lit/decorators";
|
||||
import "./ha-svg-icon";
|
||||
@@ -13,11 +13,11 @@ export class HaHelpTooltip extends LitElement {
|
||||
protected render(): TemplateResult {
|
||||
return html`
|
||||
<ha-svg-icon .path=${mdiHelpCircle}></ha-svg-icon>
|
||||
<simple-tooltip
|
||||
<paper-tooltip
|
||||
offset="4"
|
||||
.position=${this.position}
|
||||
.fitToVisibleBounds=${true}
|
||||
>${this.label}</simple-tooltip
|
||||
>${this.label}</paper-tooltip
|
||||
>
|
||||
`;
|
||||
}
|
||||
|
@@ -1,6 +1,6 @@
|
||||
import "@material/mwc-list/mwc-list-item";
|
||||
import { mdiDotsVertical } from "@mdi/js";
|
||||
import "@lrnwebcomponents/simple-tooltip/simple-tooltip";
|
||||
import "@polymer/paper-tooltip/paper-tooltip";
|
||||
import { css, html, LitElement, TemplateResult } from "lit";
|
||||
import { customElement, property } from "lit/decorators";
|
||||
import { classMap } from "lit/directives/class-map";
|
||||
@@ -75,12 +75,9 @@ export class HaIconOverflowMenu extends LitElement {
|
||||
? html`<div role="separator"></div>`
|
||||
: html`<div>
|
||||
${item.tooltip
|
||||
? html`<simple-tooltip
|
||||
animation-delay="0"
|
||||
position="left"
|
||||
>
|
||||
? html`<paper-tooltip animation-delay="0" position="left">
|
||||
${item.tooltip}
|
||||
</simple-tooltip>`
|
||||
</paper-tooltip>`
|
||||
: ""}
|
||||
<ha-icon-button
|
||||
@click=${item.action}
|
||||
|
@@ -1,3 +1,4 @@
|
||||
import "@polymer/iron-icon/iron-icon";
|
||||
import {
|
||||
css,
|
||||
CSSResultGroup,
|
||||
@@ -65,8 +66,7 @@ export class HaIcon extends LitElement {
|
||||
return nothing;
|
||||
}
|
||||
if (this._legacy) {
|
||||
return html`<!-- @ts-ignore we don't provice the iron-icon element -->
|
||||
<iron-icon .icon=${this.icon}></iron-icon>`;
|
||||
return html`<iron-icon .icon=${this.icon}></iron-icon>`;
|
||||
}
|
||||
return html`<ha-svg-icon
|
||||
.path=${this._path}
|
||||
|
@@ -1,5 +1,5 @@
|
||||
import { mdiStar } from "@mdi/js";
|
||||
import "@lrnwebcomponents/simple-tooltip/simple-tooltip";
|
||||
import "@polymer/paper-tooltip/paper-tooltip";
|
||||
import {
|
||||
css,
|
||||
CSSResultGroup,
|
||||
|
@@ -2,8 +2,7 @@ import { html, LitElement } from "lit";
|
||||
import { customElement, property } from "lit/decorators";
|
||||
import type { DurationSelector } from "../../data/selector";
|
||||
import type { HomeAssistant } from "../../types";
|
||||
import type { HaDurationData } from "../ha-duration-input";
|
||||
import "../ha-duration-input";
|
||||
import { HaDurationData } from "../ha-duration-input";
|
||||
|
||||
@customElement("ha-selector-duration")
|
||||
export class HaTimeDuration extends LitElement {
|
||||
|
@@ -1,3 +1,4 @@
|
||||
import "@polymer/paper-item/paper-item-body";
|
||||
import { css, CSSResultGroup, html, LitElement, TemplateResult } from "lit";
|
||||
import { customElement, property } from "lit/decorators";
|
||||
|
||||
@@ -12,14 +13,13 @@ export class HaSettingsRow extends LitElement {
|
||||
return html`
|
||||
<div class="prefix-wrap">
|
||||
<slot name="prefix"></slot>
|
||||
<div
|
||||
class="body"
|
||||
<paper-item-body
|
||||
?two-line=${!this.threeLine}
|
||||
?three-line=${this.threeLine}
|
||||
>
|
||||
<slot name="heading"></slot>
|
||||
<div class="secondary"><slot name="description"></slot></div>
|
||||
</div>
|
||||
<div secondary><slot name="description"></slot></div>
|
||||
</paper-item-body>
|
||||
</div>
|
||||
<div class="content"><slot></slot></div>
|
||||
`;
|
||||
@@ -34,38 +34,10 @@ export class HaSettingsRow extends LitElement {
|
||||
align-self: auto;
|
||||
align-items: center;
|
||||
}
|
||||
.body {
|
||||
paper-item-body {
|
||||
padding: 8px 16px 8px 0;
|
||||
overflow: hidden;
|
||||
display: var(--layout-vertical_-_display);
|
||||
flex-direction: var(--layout-vertical_-_flex-direction);
|
||||
justify-content: var(--layout-center-justified_-_justify-content);
|
||||
flex: var(--layout-flex_-_flex);
|
||||
flex-basis: var(--layout-flex_-_flex-basis);
|
||||
}
|
||||
.body[three-line] {
|
||||
min-height: var(--paper-item-body-three-line-min-height, 88px);
|
||||
}
|
||||
.body > * {
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.body > .secondary {
|
||||
font-family: var(--paper-font-body1_-_font-family);
|
||||
-webkit-font-smoothing: var(
|
||||
--paper-font-body1_-_-webkit-font-smoothing
|
||||
);
|
||||
font-size: var(--paper-font-body1_-_font-size);
|
||||
font-weight: var(--paper-font-body1_-_font-weight);
|
||||
line-height: var(--paper-font-body1_-_line-height);
|
||||
|
||||
color: var(
|
||||
--paper-item-body-secondary-color,
|
||||
var(--secondary-text-color)
|
||||
);
|
||||
}
|
||||
.body[two-line] {
|
||||
paper-item-body[two-line] {
|
||||
min-height: calc(
|
||||
var(--paper-item-body-two-line-min-height, 72px) - 16px
|
||||
);
|
||||
@@ -92,7 +64,7 @@ export class HaSettingsRow extends LitElement {
|
||||
::slotted(ha-switch) {
|
||||
padding: 16px 0;
|
||||
}
|
||||
.secondary {
|
||||
div[secondary] {
|
||||
white-space: normal;
|
||||
}
|
||||
.prefix-wrap {
|
||||
|
@@ -28,8 +28,8 @@ import {
|
||||
CSSResultGroup,
|
||||
html,
|
||||
LitElement,
|
||||
nothing,
|
||||
PropertyValues,
|
||||
nothing,
|
||||
} from "lit";
|
||||
import { customElement, eventOptions, property, state } from "lit/decorators";
|
||||
import { classMap } from "lit/directives/class-map";
|
||||
@@ -846,9 +846,17 @@ class HaSidebar extends SubscribeMixin(LitElement) {
|
||||
-ms-user-select: none;
|
||||
-webkit-user-select: none;
|
||||
-moz-user-select: none;
|
||||
border-right: 1px solid var(--divider-color);
|
||||
background-color: var(--sidebar-background-color);
|
||||
width: 100%;
|
||||
box-sizing: border-box;
|
||||
width: 56px;
|
||||
}
|
||||
:host([expanded]) {
|
||||
width: 256px;
|
||||
width: calc(256px + env(safe-area-inset-left));
|
||||
}
|
||||
:host([rtl]) {
|
||||
border-right: 0;
|
||||
border-left: 1px solid var(--divider-color);
|
||||
}
|
||||
.menu {
|
||||
height: var(--header-height);
|
||||
@@ -1062,8 +1070,8 @@ class HaSidebar extends SubscribeMixin(LitElement) {
|
||||
|
||||
.notification-badge,
|
||||
.configuration-badge {
|
||||
left: calc(var(--app-drawer-width) - 42px);
|
||||
position: absolute;
|
||||
left: calc(var(--app-drawer-width, 248px) - 42px);
|
||||
min-width: 20px;
|
||||
box-sizing: border-box;
|
||||
border-radius: 50%;
|
||||
|
@@ -9,7 +9,7 @@ import {
|
||||
mdiSofa,
|
||||
mdiUnfoldMoreVertical,
|
||||
} from "@mdi/js";
|
||||
import "@lrnwebcomponents/simple-tooltip/simple-tooltip";
|
||||
import "@polymer/paper-tooltip/paper-tooltip";
|
||||
import { ComboBoxLightOpenedChangedEvent } from "@vaadin/combo-box/vaadin-combo-box-light";
|
||||
import { HassEntity, HassServiceTarget } from "home-assistant-js-websocket";
|
||||
import { css, CSSResultGroup, html, LitElement, unsafeCSS, nothing } from "lit";
|
||||
@@ -248,10 +248,10 @@ export class HaTargetPicker extends LitElement {
|
||||
.type=${type}
|
||||
@click=${this._handleExpand}
|
||||
></ha-icon-button>
|
||||
<simple-tooltip class="expand" animation-delay="0"
|
||||
<paper-tooltip class="expand" animation-delay="0"
|
||||
>${this.hass.localize(
|
||||
`ui.components.target-picker.expand_${type}`
|
||||
)}</simple-tooltip
|
||||
)}</paper-tooltip
|
||||
>
|
||||
</span>`}
|
||||
<span role="gridcell">
|
||||
@@ -266,10 +266,10 @@ export class HaTargetPicker extends LitElement {
|
||||
.type=${type}
|
||||
@click=${this._handleRemove}
|
||||
></ha-icon-button>
|
||||
<simple-tooltip animation-delay="0"
|
||||
<paper-tooltip animation-delay="0"
|
||||
>${this.hass.localize(
|
||||
`ui.components.target-picker.remove_${type}`
|
||||
)}</simple-tooltip
|
||||
)}</paper-tooltip
|
||||
>
|
||||
</span>
|
||||
</div>
|
||||
@@ -670,7 +670,7 @@ export class HaTargetPicker extends LitElement {
|
||||
.mdc-chip:hover {
|
||||
z-index: 5;
|
||||
}
|
||||
simple-tooltip.expand {
|
||||
paper-tooltip.expand {
|
||||
min-width: 200px;
|
||||
}
|
||||
:host([disabled]) .mdc-chip {
|
||||
|
@@ -1,58 +0,0 @@
|
||||
import { TopAppBarFixedBase } from "@material/mwc-top-app-bar-fixed/mwc-top-app-bar-fixed-base";
|
||||
import { styles } from "@material/mwc-top-app-bar/mwc-top-app-bar.css";
|
||||
import { css } from "lit";
|
||||
import { customElement, property } from "lit/decorators";
|
||||
|
||||
let drawerContent: HTMLElement | undefined;
|
||||
|
||||
@customElement("ha-top-app-bar-fixed")
|
||||
export class HaTopAppBarFixed extends TopAppBarFixedBase {
|
||||
private get _drawerContent() {
|
||||
if (!drawerContent) {
|
||||
drawerContent = document
|
||||
.querySelector("home-assistant")!
|
||||
.renderRoot.querySelector("home-assistant-main")!
|
||||
.renderRoot.querySelector("ha-drawer")!
|
||||
.renderRoot.querySelector(".mdc-drawer-app-content") as HTMLElement;
|
||||
}
|
||||
return drawerContent;
|
||||
}
|
||||
|
||||
@property({ type: Object })
|
||||
get scrollTarget() {
|
||||
return this._scrollTarget || this._drawerContent || window;
|
||||
}
|
||||
|
||||
protected updateRootPosition() {}
|
||||
|
||||
static override styles = [
|
||||
styles,
|
||||
css`
|
||||
.mdc-top-app-bar {
|
||||
position: sticky;
|
||||
top: 0;
|
||||
}
|
||||
.mdc-top-app-bar__row {
|
||||
height: var(--header-height);
|
||||
border-bottom: var(--app-header-border-bottom);
|
||||
}
|
||||
.mdc-top-app-bar--fixed-adjust {
|
||||
padding-top: 0;
|
||||
}
|
||||
.mdc-top-app-bar {
|
||||
--mdc-typography-headline6-font-weight: 400;
|
||||
color: var(--app-header-text-color, var(--mdc-theme-on-primary, #fff));
|
||||
background-color: var(
|
||||
--app-header-background-color,
|
||||
var(--mdc-theme-primary)
|
||||
);
|
||||
}
|
||||
`,
|
||||
];
|
||||
}
|
||||
|
||||
declare global {
|
||||
interface HTMLElementTagNameMap {
|
||||
"ha-top-app-bar-fixed": HaTopAppBarFixed;
|
||||
}
|
||||
}
|
@@ -1,34 +0,0 @@
|
||||
import { TopAppBarBase } from "@material/mwc-top-app-bar/mwc-top-app-bar-base";
|
||||
import { styles } from "@material/mwc-top-app-bar/mwc-top-app-bar.css";
|
||||
import { css } from "lit";
|
||||
import { customElement } from "lit/decorators";
|
||||
|
||||
@customElement("ha-top-app-bar")
|
||||
export class HaTopAppBar extends TopAppBarBase {
|
||||
static override styles = [
|
||||
styles,
|
||||
css`
|
||||
.mdc-top-app-bar__row {
|
||||
height: var(--header-height);
|
||||
border-bottom: var(--app-header-border-bottom);
|
||||
}
|
||||
.mdc-top-app-bar--fixed-adjust {
|
||||
padding-top: var(--header-height);
|
||||
}
|
||||
.mdc-top-app-bar {
|
||||
--mdc-typography-headline6-font-weight: 400;
|
||||
color: var(--app-header-text-color, var(--mdc-theme-on-primary, #fff));
|
||||
background-color: var(
|
||||
--app-header-background-color,
|
||||
var(--mdc-theme-primary)
|
||||
);
|
||||
}
|
||||
`,
|
||||
];
|
||||
}
|
||||
|
||||
declare global {
|
||||
interface HTMLElementTagNameMap {
|
||||
"ha-top-app-bar": HaTopAppBar;
|
||||
}
|
||||
}
|
@@ -50,10 +50,6 @@ export class HaMap extends ReactiveElement {
|
||||
|
||||
@property({ type: Boolean }) public autoFit = false;
|
||||
|
||||
@property({ type: Boolean }) public renderPassive = false;
|
||||
|
||||
@property({ type: Boolean }) public interactiveZones = false;
|
||||
|
||||
@property({ type: Boolean }) public fitZones?: boolean;
|
||||
|
||||
@property({ type: Boolean }) public darkMode?: boolean;
|
||||
@@ -325,10 +321,6 @@ export class HaMap extends ReactiveElement {
|
||||
|
||||
const computedStyles = getComputedStyle(this);
|
||||
const zoneColor = computedStyles.getPropertyValue("--accent-color");
|
||||
const passiveZoneColor = computedStyles.getPropertyValue(
|
||||
"--secondary-text-color"
|
||||
);
|
||||
|
||||
const darkPrimaryColor = computedStyles.getPropertyValue(
|
||||
"--dark-primary-color"
|
||||
);
|
||||
@@ -358,7 +350,7 @@ export class HaMap extends ReactiveElement {
|
||||
|
||||
if (computeStateDomain(stateObj) === "zone") {
|
||||
// DRAW ZONE
|
||||
if (passive && !this.renderPassive) {
|
||||
if (passive) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -382,7 +374,7 @@ export class HaMap extends ReactiveElement {
|
||||
iconSize: [24, 24],
|
||||
className,
|
||||
}),
|
||||
interactive: this.interactiveZones,
|
||||
interactive: false,
|
||||
title,
|
||||
})
|
||||
);
|
||||
@@ -391,7 +383,7 @@ export class HaMap extends ReactiveElement {
|
||||
this._mapZones.push(
|
||||
Leaflet.circle([latitude, longitude], {
|
||||
interactive: false,
|
||||
color: passive ? passiveZoneColor : zoneColor,
|
||||
color: zoneColor,
|
||||
radius,
|
||||
})
|
||||
);
|
||||
|
@@ -5,7 +5,7 @@ import "@material/mwc-button/mwc-button";
|
||||
import "@material/mwc-list/mwc-list";
|
||||
import "@material/mwc-list/mwc-list-item";
|
||||
import { mdiArrowUpRight, mdiPlay, mdiPlus } from "@mdi/js";
|
||||
import "@lrnwebcomponents/simple-tooltip/simple-tooltip";
|
||||
import "@polymer/paper-tooltip/paper-tooltip";
|
||||
import {
|
||||
css,
|
||||
CSSResultGroup,
|
||||
@@ -600,8 +600,8 @@ export class HaMediaPlayerBrowse extends LitElement {
|
||||
</div>
|
||||
<div class="title">
|
||||
${child.title}
|
||||
<simple-tooltip fitToVisibleBounds position="top" offset="4"
|
||||
>${child.title}</simple-tooltip
|
||||
<paper-tooltip fitToVisibleBounds position="top" offset="4"
|
||||
>${child.title}</paper-tooltip
|
||||
>
|
||||
</div>
|
||||
</ha-card>
|
||||
|
@@ -1,4 +1,4 @@
|
||||
import { CSSResultGroup, html, css, LitElement, nothing } from "lit";
|
||||
import { CSSResultGroup, html, css, LitElement, TemplateResult } from "lit";
|
||||
import { customElement, property } from "lit/decorators";
|
||||
import { ifDefined } from "lit/directives/if-defined";
|
||||
|
||||
@@ -8,12 +8,12 @@ export class HaTileImage extends LitElement {
|
||||
|
||||
@property() public imageAlt?: string;
|
||||
|
||||
protected render() {
|
||||
protected render(): TemplateResult {
|
||||
return html`
|
||||
<div class="image">
|
||||
${this.imageUrl
|
||||
? html`<img alt=${ifDefined(this.imageAlt)} src=${this.imageUrl} />`
|
||||
: nothing}
|
||||
: null}
|
||||
</div>
|
||||
`;
|
||||
}
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user