mirror of
https://github.com/home-assistant/frontend.git
synced 2025-08-10 09:57:45 +00:00
Merge branch 'dev' into allthebackupchanges
This commit is contained in:
@@ -124,7 +124,9 @@
|
|||||||
"lit-a11y/no-autofocus": "off",
|
"lit-a11y/no-autofocus": "off",
|
||||||
"lit-a11y/alt-text": "warn",
|
"lit-a11y/alt-text": "warn",
|
||||||
"lit-a11y/anchor-is-valid": "warn",
|
"lit-a11y/anchor-is-valid": "warn",
|
||||||
"lit-a11y/role-has-required-aria-attrs": "warn"
|
"lit-a11y/role-has-required-aria-attrs": "warn",
|
||||||
|
"@typescript-eslint/consistent-type-imports": "error",
|
||||||
|
"@typescript-eslint/no-import-type-side-effects": "error"
|
||||||
},
|
},
|
||||||
"plugins": ["unused-imports"]
|
"plugins": ["unused-imports"]
|
||||||
}
|
}
|
||||||
|
8
.github/workflows/cast_deployment.yaml
vendored
8
.github/workflows/cast_deployment.yaml
vendored
@@ -21,12 +21,12 @@ jobs:
|
|||||||
url: ${{ steps.deploy.outputs.NETLIFY_LIVE_URL || steps.deploy.outputs.NETLIFY_URL }}
|
url: ${{ steps.deploy.outputs.NETLIFY_LIVE_URL || steps.deploy.outputs.NETLIFY_URL }}
|
||||||
steps:
|
steps:
|
||||||
- name: Check out files from GitHub
|
- name: Check out files from GitHub
|
||||||
uses: actions/checkout@v4.2.1
|
uses: actions/checkout@v4.2.2
|
||||||
with:
|
with:
|
||||||
ref: dev
|
ref: dev
|
||||||
|
|
||||||
- name: Setup Node
|
- name: Setup Node
|
||||||
uses: actions/setup-node@v4.0.4
|
uses: actions/setup-node@v4.1.0
|
||||||
with:
|
with:
|
||||||
node-version-file: ".nvmrc"
|
node-version-file: ".nvmrc"
|
||||||
cache: yarn
|
cache: yarn
|
||||||
@@ -57,12 +57,12 @@ jobs:
|
|||||||
url: ${{ steps.deploy.outputs.NETLIFY_LIVE_URL || steps.deploy.outputs.NETLIFY_URL }}
|
url: ${{ steps.deploy.outputs.NETLIFY_LIVE_URL || steps.deploy.outputs.NETLIFY_URL }}
|
||||||
steps:
|
steps:
|
||||||
- name: Check out files from GitHub
|
- name: Check out files from GitHub
|
||||||
uses: actions/checkout@v4.2.1
|
uses: actions/checkout@v4.2.2
|
||||||
with:
|
with:
|
||||||
ref: master
|
ref: master
|
||||||
|
|
||||||
- name: Setup Node
|
- name: Setup Node
|
||||||
uses: actions/setup-node@v4.0.4
|
uses: actions/setup-node@v4.1.0
|
||||||
with:
|
with:
|
||||||
node-version-file: ".nvmrc"
|
node-version-file: ".nvmrc"
|
||||||
cache: yarn
|
cache: yarn
|
||||||
|
18
.github/workflows/ci.yaml
vendored
18
.github/workflows/ci.yaml
vendored
@@ -24,9 +24,9 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Check out files from GitHub
|
- name: Check out files from GitHub
|
||||||
uses: actions/checkout@v4.2.1
|
uses: actions/checkout@v4.2.2
|
||||||
- name: Setup Node
|
- name: Setup Node
|
||||||
uses: actions/setup-node@v4.0.4
|
uses: actions/setup-node@v4.1.0
|
||||||
with:
|
with:
|
||||||
node-version-file: ".nvmrc"
|
node-version-file: ".nvmrc"
|
||||||
cache: yarn
|
cache: yarn
|
||||||
@@ -37,7 +37,7 @@ jobs:
|
|||||||
- name: Build resources
|
- name: Build resources
|
||||||
run: ./node_modules/.bin/gulp gen-icons-json build-translations build-locale-data gather-gallery-pages
|
run: ./node_modules/.bin/gulp gen-icons-json build-translations build-locale-data gather-gallery-pages
|
||||||
- name: Setup lint cache
|
- name: Setup lint cache
|
||||||
uses: actions/cache@v4.1.1
|
uses: actions/cache@v4.1.2
|
||||||
with:
|
with:
|
||||||
path: |
|
path: |
|
||||||
node_modules/.cache/prettier
|
node_modules/.cache/prettier
|
||||||
@@ -58,9 +58,9 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Check out files from GitHub
|
- name: Check out files from GitHub
|
||||||
uses: actions/checkout@v4.2.1
|
uses: actions/checkout@v4.2.2
|
||||||
- name: Setup Node
|
- name: Setup Node
|
||||||
uses: actions/setup-node@v4.0.4
|
uses: actions/setup-node@v4.1.0
|
||||||
with:
|
with:
|
||||||
node-version-file: ".nvmrc"
|
node-version-file: ".nvmrc"
|
||||||
cache: yarn
|
cache: yarn
|
||||||
@@ -76,9 +76,9 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Check out files from GitHub
|
- name: Check out files from GitHub
|
||||||
uses: actions/checkout@v4.2.1
|
uses: actions/checkout@v4.2.2
|
||||||
- name: Setup Node
|
- name: Setup Node
|
||||||
uses: actions/setup-node@v4.0.4
|
uses: actions/setup-node@v4.1.0
|
||||||
with:
|
with:
|
||||||
node-version-file: ".nvmrc"
|
node-version-file: ".nvmrc"
|
||||||
cache: yarn
|
cache: yarn
|
||||||
@@ -100,9 +100,9 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Check out files from GitHub
|
- name: Check out files from GitHub
|
||||||
uses: actions/checkout@v4.2.1
|
uses: actions/checkout@v4.2.2
|
||||||
- name: Setup Node
|
- name: Setup Node
|
||||||
uses: actions/setup-node@v4.0.4
|
uses: actions/setup-node@v4.1.0
|
||||||
with:
|
with:
|
||||||
node-version-file: ".nvmrc"
|
node-version-file: ".nvmrc"
|
||||||
cache: yarn
|
cache: yarn
|
||||||
|
2
.github/workflows/codeql-analysis.yml
vendored
2
.github/workflows/codeql-analysis.yml
vendored
@@ -23,7 +23,7 @@ jobs:
|
|||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
uses: actions/checkout@v4.2.1
|
uses: actions/checkout@v4.2.2
|
||||||
with:
|
with:
|
||||||
# We must fetch at least the immediate parents so that if this is
|
# We must fetch at least the immediate parents so that if this is
|
||||||
# a pull request then we can checkout the head.
|
# a pull request then we can checkout the head.
|
||||||
|
8
.github/workflows/demo_deployment.yaml
vendored
8
.github/workflows/demo_deployment.yaml
vendored
@@ -22,12 +22,12 @@ jobs:
|
|||||||
url: ${{ steps.deploy.outputs.NETLIFY_LIVE_URL || steps.deploy.outputs.NETLIFY_URL }}
|
url: ${{ steps.deploy.outputs.NETLIFY_LIVE_URL || steps.deploy.outputs.NETLIFY_URL }}
|
||||||
steps:
|
steps:
|
||||||
- name: Check out files from GitHub
|
- name: Check out files from GitHub
|
||||||
uses: actions/checkout@v4.2.1
|
uses: actions/checkout@v4.2.2
|
||||||
with:
|
with:
|
||||||
ref: dev
|
ref: dev
|
||||||
|
|
||||||
- name: Setup Node
|
- name: Setup Node
|
||||||
uses: actions/setup-node@v4.0.4
|
uses: actions/setup-node@v4.1.0
|
||||||
with:
|
with:
|
||||||
node-version-file: ".nvmrc"
|
node-version-file: ".nvmrc"
|
||||||
cache: yarn
|
cache: yarn
|
||||||
@@ -58,12 +58,12 @@ jobs:
|
|||||||
url: ${{ steps.deploy.outputs.NETLIFY_LIVE_URL || steps.deploy.outputs.NETLIFY_URL }}
|
url: ${{ steps.deploy.outputs.NETLIFY_LIVE_URL || steps.deploy.outputs.NETLIFY_URL }}
|
||||||
steps:
|
steps:
|
||||||
- name: Check out files from GitHub
|
- name: Check out files from GitHub
|
||||||
uses: actions/checkout@v4.2.1
|
uses: actions/checkout@v4.2.2
|
||||||
with:
|
with:
|
||||||
ref: master
|
ref: master
|
||||||
|
|
||||||
- name: Setup Node
|
- name: Setup Node
|
||||||
uses: actions/setup-node@v4.0.4
|
uses: actions/setup-node@v4.1.0
|
||||||
with:
|
with:
|
||||||
node-version-file: ".nvmrc"
|
node-version-file: ".nvmrc"
|
||||||
cache: yarn
|
cache: yarn
|
||||||
|
4
.github/workflows/design_deployment.yaml
vendored
4
.github/workflows/design_deployment.yaml
vendored
@@ -16,10 +16,10 @@ jobs:
|
|||||||
url: ${{ steps.deploy.outputs.NETLIFY_LIVE_URL || steps.deploy.outputs.NETLIFY_URL }}
|
url: ${{ steps.deploy.outputs.NETLIFY_LIVE_URL || steps.deploy.outputs.NETLIFY_URL }}
|
||||||
steps:
|
steps:
|
||||||
- name: Check out files from GitHub
|
- name: Check out files from GitHub
|
||||||
uses: actions/checkout@v4.2.1
|
uses: actions/checkout@v4.2.2
|
||||||
|
|
||||||
- name: Setup Node
|
- name: Setup Node
|
||||||
uses: actions/setup-node@v4.0.4
|
uses: actions/setup-node@v4.1.0
|
||||||
with:
|
with:
|
||||||
node-version-file: ".nvmrc"
|
node-version-file: ".nvmrc"
|
||||||
cache: yarn
|
cache: yarn
|
||||||
|
4
.github/workflows/design_preview.yaml
vendored
4
.github/workflows/design_preview.yaml
vendored
@@ -21,10 +21,10 @@ jobs:
|
|||||||
if: github.repository == 'home-assistant/frontend' && contains(github.event.pull_request.labels.*.name, 'needs design preview')
|
if: github.repository == 'home-assistant/frontend' && contains(github.event.pull_request.labels.*.name, 'needs design preview')
|
||||||
steps:
|
steps:
|
||||||
- name: Check out files from GitHub
|
- name: Check out files from GitHub
|
||||||
uses: actions/checkout@v4.2.1
|
uses: actions/checkout@v4.2.2
|
||||||
|
|
||||||
- name: Setup Node
|
- name: Setup Node
|
||||||
uses: actions/setup-node@v4.0.4
|
uses: actions/setup-node@v4.1.0
|
||||||
with:
|
with:
|
||||||
node-version-file: ".nvmrc"
|
node-version-file: ".nvmrc"
|
||||||
cache: yarn
|
cache: yarn
|
||||||
|
4
.github/workflows/nightly.yaml
vendored
4
.github/workflows/nightly.yaml
vendored
@@ -20,7 +20,7 @@ jobs:
|
|||||||
contents: write
|
contents: write
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout the repository
|
- name: Checkout the repository
|
||||||
uses: actions/checkout@v4.2.1
|
uses: actions/checkout@v4.2.2
|
||||||
|
|
||||||
- name: Set up Python ${{ env.PYTHON_VERSION }}
|
- name: Set up Python ${{ env.PYTHON_VERSION }}
|
||||||
uses: actions/setup-python@v5
|
uses: actions/setup-python@v5
|
||||||
@@ -28,7 +28,7 @@ jobs:
|
|||||||
python-version: ${{ env.PYTHON_VERSION }}
|
python-version: ${{ env.PYTHON_VERSION }}
|
||||||
|
|
||||||
- name: Setup Node
|
- name: Setup Node
|
||||||
uses: actions/setup-node@v4.0.4
|
uses: actions/setup-node@v4.1.0
|
||||||
with:
|
with:
|
||||||
node-version-file: ".nvmrc"
|
node-version-file: ".nvmrc"
|
||||||
cache: yarn
|
cache: yarn
|
||||||
|
2
.github/workflows/relative-ci.yaml
vendored
2
.github/workflows/relative-ci.yaml
vendored
@@ -17,7 +17,7 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Send bundle stats and build information to RelativeCI
|
- name: Send bundle stats and build information to RelativeCI
|
||||||
uses: relative-ci/agent-action@v2.1.12
|
uses: relative-ci/agent-action@v2.1.13
|
||||||
with:
|
with:
|
||||||
key: ${{ secrets[format('RELATIVE_CI_KEY_{0}_{1}', matrix.bundle, matrix.build)] }}
|
key: ${{ secrets[format('RELATIVE_CI_KEY_{0}_{1}', matrix.bundle, matrix.build)] }}
|
||||||
token: ${{ github.token }}
|
token: ${{ github.token }}
|
||||||
|
8
.github/workflows/release.yaml
vendored
8
.github/workflows/release.yaml
vendored
@@ -23,7 +23,7 @@ jobs:
|
|||||||
contents: write # Required to upload release assets
|
contents: write # Required to upload release assets
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout the repository
|
- name: Checkout the repository
|
||||||
uses: actions/checkout@v4.2.1
|
uses: actions/checkout@v4.2.2
|
||||||
|
|
||||||
- name: Verify version
|
- name: Verify version
|
||||||
uses: home-assistant/actions/helpers/verify-version@master
|
uses: home-assistant/actions/helpers/verify-version@master
|
||||||
@@ -34,7 +34,7 @@ jobs:
|
|||||||
python-version: ${{ env.PYTHON_VERSION }}
|
python-version: ${{ env.PYTHON_VERSION }}
|
||||||
|
|
||||||
- name: Setup Node
|
- name: Setup Node
|
||||||
uses: actions/setup-node@v4.0.4
|
uses: actions/setup-node@v4.1.0
|
||||||
with:
|
with:
|
||||||
node-version-file: ".nvmrc"
|
node-version-file: ".nvmrc"
|
||||||
cache: yarn
|
cache: yarn
|
||||||
@@ -55,7 +55,7 @@ jobs:
|
|||||||
script/release
|
script/release
|
||||||
|
|
||||||
- name: Upload release assets
|
- name: Upload release assets
|
||||||
uses: softprops/action-gh-release@v2.0.8
|
uses: softprops/action-gh-release@v2.0.9
|
||||||
with:
|
with:
|
||||||
files: |
|
files: |
|
||||||
dist/*.whl
|
dist/*.whl
|
||||||
@@ -74,7 +74,7 @@ jobs:
|
|||||||
echo "home-assistant-frontend==$version" > ./requirements.txt
|
echo "home-assistant-frontend==$version" > ./requirements.txt
|
||||||
|
|
||||||
- name: Build wheels
|
- name: Build wheels
|
||||||
uses: home-assistant/wheels@2024.07.1
|
uses: home-assistant/wheels@2024.11.0
|
||||||
with:
|
with:
|
||||||
abi: cp312
|
abi: cp312
|
||||||
tag: musllinux_1_2
|
tag: musllinux_1_2
|
||||||
|
2
.github/workflows/translations.yaml
vendored
2
.github/workflows/translations.yaml
vendored
@@ -13,7 +13,7 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout the repository
|
- name: Checkout the repository
|
||||||
uses: actions/checkout@v4.2.1
|
uses: actions/checkout@v4.2.2
|
||||||
|
|
||||||
- name: Upload Translations
|
- name: Upload Translations
|
||||||
run: |
|
run: |
|
||||||
|
File diff suppressed because one or more lines are too long
@@ -6,4 +6,4 @@ enableGlobalCache: false
|
|||||||
|
|
||||||
nodeLinker: node-modules
|
nodeLinker: node-modules
|
||||||
|
|
||||||
yarnPath: .yarn/releases/yarn-4.5.0.cjs
|
yarnPath: .yarn/releases/yarn-4.5.1.cjs
|
||||||
|
@@ -15,7 +15,7 @@ The Home Assistant build pipeline contains various steps to prepare a build.
|
|||||||
|
|
||||||
Currently in Home Assistant we use a bundler to convert TypeScript, CSS and JSON files to JavaScript files that the browser understands.
|
Currently in Home Assistant we use a bundler to convert TypeScript, CSS and JSON files to JavaScript files that the browser understands.
|
||||||
|
|
||||||
We currently rely on Webpack but also have experimental Rollup support. Both of these programs bundle the converted files in both production and development.
|
We currently rely on Webpack. Both of these programs bundle the converted files in both production and development.
|
||||||
|
|
||||||
For development, bundling is optional. We just want to get the right files in the browser.
|
For development, bundling is optional. We just want to get the right files in the browser.
|
||||||
|
|
||||||
|
@@ -226,13 +226,12 @@ module.exports.config = {
|
|||||||
return {
|
return {
|
||||||
name: "frontend" + nameSuffix(latestBuild),
|
name: "frontend" + nameSuffix(latestBuild),
|
||||||
entry: {
|
entry: {
|
||||||
"service-worker":
|
"service-worker": !latestBuild
|
||||||
!env.useRollup() && !latestBuild
|
? {
|
||||||
? {
|
import: "./src/entrypoints/service-worker.ts",
|
||||||
import: "./src/entrypoints/service-worker.ts",
|
layer: "sw",
|
||||||
layer: "sw",
|
}
|
||||||
}
|
: "./src/entrypoints/service-worker.ts",
|
||||||
: "./src/entrypoints/service-worker.ts",
|
|
||||||
app: "./src/entrypoints/app.ts",
|
app: "./src/entrypoints/app.ts",
|
||||||
authorize: "./src/entrypoints/authorize.ts",
|
authorize: "./src/entrypoints/authorize.ts",
|
||||||
onboarding: "./src/entrypoints/onboarding.ts",
|
onboarding: "./src/entrypoints/onboarding.ts",
|
||||||
|
@@ -3,9 +3,6 @@ const path = require("path");
|
|||||||
const paths = require("./paths.cjs");
|
const paths = require("./paths.cjs");
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
useRollup() {
|
|
||||||
return process.env.ROLLUP === "1";
|
|
||||||
},
|
|
||||||
useWDS() {
|
useWDS() {
|
||||||
return process.env.WDS === "1";
|
return process.env.WDS === "1";
|
||||||
},
|
},
|
||||||
|
@@ -6,7 +6,6 @@ import "./entry-html.js";
|
|||||||
import "./gather-static.js";
|
import "./gather-static.js";
|
||||||
import "./gen-icons-json.js";
|
import "./gen-icons-json.js";
|
||||||
import "./locale-data.js";
|
import "./locale-data.js";
|
||||||
import "./rollup.js";
|
|
||||||
import "./service-worker.js";
|
import "./service-worker.js";
|
||||||
import "./translations.js";
|
import "./translations.js";
|
||||||
import "./wds.js";
|
import "./wds.js";
|
||||||
@@ -27,11 +26,7 @@ gulp.task(
|
|||||||
"build-locale-data"
|
"build-locale-data"
|
||||||
),
|
),
|
||||||
"copy-static-app",
|
"copy-static-app",
|
||||||
env.useWDS()
|
env.useWDS() ? "wds-watch-app" : "webpack-watch-app"
|
||||||
? "wds-watch-app"
|
|
||||||
: env.useRollup()
|
|
||||||
? "rollup-watch-app"
|
|
||||||
: "webpack-watch-app"
|
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -44,7 +39,7 @@ gulp.task(
|
|||||||
"clean",
|
"clean",
|
||||||
gulp.parallel("gen-icons-json", "build-translations", "build-locale-data"),
|
gulp.parallel("gen-icons-json", "build-translations", "build-locale-data"),
|
||||||
"copy-static-app",
|
"copy-static-app",
|
||||||
env.useRollup() ? "rollup-prod-app" : "webpack-prod-app",
|
"webpack-prod-app",
|
||||||
gulp.parallel("gen-pages-app-prod", "gen-service-worker-app-prod"),
|
gulp.parallel("gen-pages-app-prod", "gen-service-worker-app-prod"),
|
||||||
// Don't compress running tests
|
// Don't compress running tests
|
||||||
...(env.isTestBuild() ? [] : ["compress-app"])
|
...(env.isTestBuild() ? [] : ["compress-app"])
|
||||||
|
@@ -1,9 +1,7 @@
|
|||||||
import gulp from "gulp";
|
import gulp from "gulp";
|
||||||
import env from "../env.cjs";
|
|
||||||
import "./clean.js";
|
import "./clean.js";
|
||||||
import "./entry-html.js";
|
import "./entry-html.js";
|
||||||
import "./gather-static.js";
|
import "./gather-static.js";
|
||||||
import "./rollup.js";
|
|
||||||
import "./service-worker.js";
|
import "./service-worker.js";
|
||||||
import "./translations.js";
|
import "./translations.js";
|
||||||
import "./webpack.js";
|
import "./webpack.js";
|
||||||
@@ -19,7 +17,7 @@ gulp.task(
|
|||||||
gulp.parallel("gen-icons-json", "build-translations", "build-locale-data"),
|
gulp.parallel("gen-icons-json", "build-translations", "build-locale-data"),
|
||||||
"copy-static-cast",
|
"copy-static-cast",
|
||||||
"gen-pages-cast-dev",
|
"gen-pages-cast-dev",
|
||||||
env.useRollup() ? "rollup-dev-server-cast" : "webpack-dev-server-cast"
|
"webpack-dev-server-cast"
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -33,7 +31,7 @@ gulp.task(
|
|||||||
"translations-enable-merge-backend",
|
"translations-enable-merge-backend",
|
||||||
gulp.parallel("gen-icons-json", "build-translations", "build-locale-data"),
|
gulp.parallel("gen-icons-json", "build-translations", "build-locale-data"),
|
||||||
"copy-static-cast",
|
"copy-static-cast",
|
||||||
env.useRollup() ? "rollup-prod-cast" : "webpack-prod-cast",
|
"webpack-prod-cast",
|
||||||
"gen-pages-cast-prod"
|
"gen-pages-cast-prod"
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
@@ -1,10 +1,8 @@
|
|||||||
import gulp from "gulp";
|
import gulp from "gulp";
|
||||||
import env from "../env.cjs";
|
|
||||||
import "./clean.js";
|
import "./clean.js";
|
||||||
import "./entry-html.js";
|
import "./entry-html.js";
|
||||||
import "./gather-static.js";
|
import "./gather-static.js";
|
||||||
import "./gen-icons-json.js";
|
import "./gen-icons-json.js";
|
||||||
import "./rollup.js";
|
|
||||||
import "./service-worker.js";
|
import "./service-worker.js";
|
||||||
import "./translations.js";
|
import "./translations.js";
|
||||||
import "./webpack.js";
|
import "./webpack.js";
|
||||||
@@ -24,7 +22,7 @@ gulp.task(
|
|||||||
"build-locale-data"
|
"build-locale-data"
|
||||||
),
|
),
|
||||||
"copy-static-demo",
|
"copy-static-demo",
|
||||||
env.useRollup() ? "rollup-dev-server-demo" : "webpack-dev-server-demo"
|
"webpack-dev-server-demo"
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -39,7 +37,7 @@ gulp.task(
|
|||||||
"translations-enable-merge-backend",
|
"translations-enable-merge-backend",
|
||||||
gulp.parallel("gen-icons-json", "build-translations", "build-locale-data"),
|
gulp.parallel("gen-icons-json", "build-translations", "build-locale-data"),
|
||||||
"copy-static-demo",
|
"copy-static-demo",
|
||||||
env.useRollup() ? "rollup-prod-demo" : "webpack-prod-demo",
|
"webpack-prod-demo",
|
||||||
"gen-pages-demo-prod"
|
"gen-pages-demo-prod"
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
@@ -13,7 +13,7 @@ const srcMeta = "src/translations/translationMetadata.json";
|
|||||||
const encoding = "utf8";
|
const encoding = "utf8";
|
||||||
|
|
||||||
function hasHtml(data) {
|
function hasHtml(data) {
|
||||||
return /<[a-z][\s\S]*>/i.test(data);
|
return /<\S*>/i.test(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
function recursiveCheckHasHtml(file, data, errors, recKey) {
|
function recursiveCheckHasHtml(file, data, errors, recKey) {
|
||||||
|
@@ -56,7 +56,6 @@ const getCommonTemplateVars = () => {
|
|||||||
{ ignorePatch: true, allowHigherVersions: true }
|
{ ignorePatch: true, allowHigherVersions: true }
|
||||||
);
|
);
|
||||||
return {
|
return {
|
||||||
useRollup: env.useRollup(),
|
|
||||||
useWDS: env.useWDS(),
|
useWDS: env.useWDS(),
|
||||||
modernRegex: compileRegex(browserRegexes.concat(haMacOSRegex)).toString(),
|
modernRegex: compileRegex(browserRegexes.concat(haMacOSRegex)).toString(),
|
||||||
};
|
};
|
||||||
|
@@ -4,13 +4,11 @@ import gulp from "gulp";
|
|||||||
import yaml from "js-yaml";
|
import yaml from "js-yaml";
|
||||||
import { marked } from "marked";
|
import { marked } from "marked";
|
||||||
import path from "path";
|
import path from "path";
|
||||||
import env from "../env.cjs";
|
|
||||||
import paths from "../paths.cjs";
|
import paths from "../paths.cjs";
|
||||||
import "./clean.js";
|
import "./clean.js";
|
||||||
import "./entry-html.js";
|
import "./entry-html.js";
|
||||||
import "./gather-static.js";
|
import "./gather-static.js";
|
||||||
import "./gen-icons-json.js";
|
import "./gen-icons-json.js";
|
||||||
import "./rollup.js";
|
|
||||||
import "./service-worker.js";
|
import "./service-worker.js";
|
||||||
import "./translations.js";
|
import "./translations.js";
|
||||||
import "./webpack.js";
|
import "./webpack.js";
|
||||||
@@ -158,9 +156,7 @@ gulp.task(
|
|||||||
"copy-static-gallery",
|
"copy-static-gallery",
|
||||||
"gen-pages-gallery-dev",
|
"gen-pages-gallery-dev",
|
||||||
gulp.parallel(
|
gulp.parallel(
|
||||||
env.useRollup()
|
"webpack-dev-server-gallery",
|
||||||
? "rollup-dev-server-gallery"
|
|
||||||
: "webpack-dev-server-gallery",
|
|
||||||
async function watchMarkdownFiles() {
|
async function watchMarkdownFiles() {
|
||||||
gulp.watch(
|
gulp.watch(
|
||||||
[
|
[
|
||||||
@@ -189,7 +185,7 @@ gulp.task(
|
|||||||
"gather-gallery-pages"
|
"gather-gallery-pages"
|
||||||
),
|
),
|
||||||
"copy-static-gallery",
|
"copy-static-gallery",
|
||||||
env.useRollup() ? "rollup-prod-gallery" : "webpack-prod-gallery",
|
"webpack-prod-gallery",
|
||||||
"gen-pages-gallery-prod"
|
"gen-pages-gallery-prod"
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
@@ -4,7 +4,6 @@ import fs from "fs-extra";
|
|||||||
import gulp from "gulp";
|
import gulp from "gulp";
|
||||||
import path from "path";
|
import path from "path";
|
||||||
import paths from "../paths.cjs";
|
import paths from "../paths.cjs";
|
||||||
import env from "../env.cjs";
|
|
||||||
|
|
||||||
const npmPath = (...parts) =>
|
const npmPath = (...parts) =>
|
||||||
path.resolve(paths.polymer_dir, "node_modules", ...parts);
|
path.resolve(paths.polymer_dir, "node_modules", ...parts);
|
||||||
@@ -69,9 +68,6 @@ function copyPolyfills(staticDir) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function copyLoaderJS(staticDir) {
|
function copyLoaderJS(staticDir) {
|
||||||
if (!env.useRollup()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
const staticPath = genStaticPath(staticDir);
|
const staticPath = genStaticPath(staticDir);
|
||||||
copyFileDir(npmPath("systemjs/dist/s.min.js"), staticPath("js"));
|
copyFileDir(npmPath("systemjs/dist/s.min.js"), staticPath("js"));
|
||||||
copyFileDir(npmPath("systemjs/dist/s.min.js.map"), staticPath("js"));
|
copyFileDir(npmPath("systemjs/dist/s.min.js.map"), staticPath("js"));
|
||||||
@@ -106,6 +102,14 @@ function copyMapPanel(staticDir) {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function copyZXingWasm(staticDir) {
|
||||||
|
const staticPath = genStaticPath(staticDir);
|
||||||
|
copyFileDir(
|
||||||
|
npmPath("zxing-wasm/dist/reader/zxing_reader.wasm"),
|
||||||
|
staticPath("js")
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
gulp.task("copy-locale-data", async () => {
|
gulp.task("copy-locale-data", async () => {
|
||||||
const staticDir = paths.app_output_static;
|
const staticDir = paths.app_output_static;
|
||||||
copyLocaleData(staticDir);
|
copyLocaleData(staticDir);
|
||||||
@@ -143,6 +147,7 @@ gulp.task("copy-static-app", async () => {
|
|||||||
copyMapPanel(staticDir);
|
copyMapPanel(staticDir);
|
||||||
|
|
||||||
// Qr Scanner assets
|
// Qr Scanner assets
|
||||||
|
copyZXingWasm(staticDir);
|
||||||
copyQrScannerWorker(staticDir);
|
copyQrScannerWorker(staticDir);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@@ -5,7 +5,6 @@ import "./compress.js";
|
|||||||
import "./entry-html.js";
|
import "./entry-html.js";
|
||||||
import "./gather-static.js";
|
import "./gather-static.js";
|
||||||
import "./gen-icons-json.js";
|
import "./gen-icons-json.js";
|
||||||
import "./rollup.js";
|
|
||||||
import "./translations.js";
|
import "./translations.js";
|
||||||
import "./webpack.js";
|
import "./webpack.js";
|
||||||
|
|
||||||
@@ -22,7 +21,7 @@ gulp.task(
|
|||||||
"copy-translations-supervisor",
|
"copy-translations-supervisor",
|
||||||
"build-locale-data",
|
"build-locale-data",
|
||||||
"copy-static-supervisor",
|
"copy-static-supervisor",
|
||||||
env.useRollup() ? "rollup-watch-hassio" : "webpack-watch-hassio"
|
"webpack-watch-hassio"
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -38,7 +37,7 @@ gulp.task(
|
|||||||
"copy-translations-supervisor",
|
"copy-translations-supervisor",
|
||||||
"build-locale-data",
|
"build-locale-data",
|
||||||
"copy-static-supervisor",
|
"copy-static-supervisor",
|
||||||
env.useRollup() ? "rollup-prod-hassio" : "webpack-prod-hassio",
|
"webpack-prod-hassio",
|
||||||
"gen-pages-hassio-prod",
|
"gen-pages-hassio-prod",
|
||||||
...// Don't compress running tests
|
...// Don't compress running tests
|
||||||
(env.isTestBuild() ? [] : ["compress-hassio"])
|
(env.isTestBuild() ? [] : ["compress-hassio"])
|
||||||
|
@@ -24,8 +24,11 @@ const convertToJSON = async (
|
|||||||
) => {
|
) => {
|
||||||
let localeData;
|
let localeData;
|
||||||
try {
|
try {
|
||||||
|
// use "pt" for "pt-BR", because "pt-BR" is unsupported by @formatjs
|
||||||
|
const language = lang === "pt-BR" ? "pt" : lang;
|
||||||
|
|
||||||
localeData = await readFile(
|
localeData = await readFile(
|
||||||
join(formatjsDir, pkg, subDir, `${lang}.js`),
|
join(formatjsDir, pkg, subDir, `${language}.js`),
|
||||||
"utf-8"
|
"utf-8"
|
||||||
);
|
);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
@@ -1,147 +0,0 @@
|
|||||||
// Tasks to run Rollup
|
|
||||||
|
|
||||||
import log from "fancy-log";
|
|
||||||
import gulp from "gulp";
|
|
||||||
import http from "http";
|
|
||||||
import open from "open";
|
|
||||||
import path from "path";
|
|
||||||
import { rollup } from "rollup";
|
|
||||||
import handler from "serve-handler";
|
|
||||||
import paths from "../paths.cjs";
|
|
||||||
import rollupConfig from "../rollup.cjs";
|
|
||||||
|
|
||||||
const bothBuilds = (createConfigFunc, params) =>
|
|
||||||
gulp.series(
|
|
||||||
async function buildLatest() {
|
|
||||||
await buildRollup(
|
|
||||||
createConfigFunc({
|
|
||||||
...params,
|
|
||||||
latestBuild: true,
|
|
||||||
})
|
|
||||||
);
|
|
||||||
},
|
|
||||||
async function buildES5() {
|
|
||||||
await buildRollup(
|
|
||||||
createConfigFunc({
|
|
||||||
...params,
|
|
||||||
latestBuild: false,
|
|
||||||
})
|
|
||||||
);
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
function createServer(serveOptions) {
|
|
||||||
const server = http.createServer((request, response) =>
|
|
||||||
handler(request, response, {
|
|
||||||
public: serveOptions.root,
|
|
||||||
})
|
|
||||||
);
|
|
||||||
|
|
||||||
server.listen(
|
|
||||||
serveOptions.port,
|
|
||||||
serveOptions.networkAccess ? "0.0.0.0" : undefined,
|
|
||||||
() => {
|
|
||||||
log.info(`Available at http://localhost:${serveOptions.port}`);
|
|
||||||
open(`http://localhost:${serveOptions.port}`);
|
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
function watchRollup(createConfig, extraWatchSrc = [], serveOptions = null) {
|
|
||||||
const { inputOptions, outputOptions } = createConfig({
|
|
||||||
isProdBuild: false,
|
|
||||||
latestBuild: true,
|
|
||||||
});
|
|
||||||
|
|
||||||
const watcher = rollup.watch({
|
|
||||||
...inputOptions,
|
|
||||||
output: [outputOptions],
|
|
||||||
watch: {
|
|
||||||
include: ["src/**"] + extraWatchSrc,
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
let startedHttp = false;
|
|
||||||
|
|
||||||
watcher.on("event", (event) => {
|
|
||||||
if (event.code === "BUNDLE_END") {
|
|
||||||
log(`Build done @ ${new Date().toLocaleTimeString()}`);
|
|
||||||
} else if (event.code === "ERROR") {
|
|
||||||
log.error(event.error);
|
|
||||||
} else if (event.code === "END") {
|
|
||||||
if (startedHttp || !serveOptions) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
startedHttp = true;
|
|
||||||
createServer(serveOptions);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
gulp.watch(
|
|
||||||
path.join(paths.translations_src, "en.json"),
|
|
||||||
gulp.series("build-translations", "copy-translations-app")
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
async function buildRollup(config) {
|
|
||||||
const bundle = await rollup.rollup(config.inputOptions);
|
|
||||||
await bundle.write(config.outputOptions);
|
|
||||||
}
|
|
||||||
|
|
||||||
gulp.task("rollup-watch-app", () => {
|
|
||||||
watchRollup(rollupConfig.createAppConfig);
|
|
||||||
});
|
|
||||||
|
|
||||||
gulp.task("rollup-watch-hassio", () => {
|
|
||||||
watchRollup(rollupConfig.createHassioConfig, ["hassio/src/**"]);
|
|
||||||
});
|
|
||||||
|
|
||||||
gulp.task("rollup-dev-server-demo", () => {
|
|
||||||
watchRollup(rollupConfig.createDemoConfig, ["demo/src/**"], {
|
|
||||||
root: paths.demo_output_root,
|
|
||||||
port: 8090,
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
gulp.task("rollup-dev-server-cast", () => {
|
|
||||||
watchRollup(rollupConfig.createCastConfig, ["cast/src/**"], {
|
|
||||||
root: paths.cast_output_root,
|
|
||||||
port: 8080,
|
|
||||||
networkAccess: true,
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
gulp.task("rollup-dev-server-gallery", () => {
|
|
||||||
watchRollup(rollupConfig.createGalleryConfig, ["gallery/src/**"], {
|
|
||||||
root: paths.gallery_output_root,
|
|
||||||
port: 8100,
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
gulp.task(
|
|
||||||
"rollup-prod-app",
|
|
||||||
bothBuilds(rollupConfig.createAppConfig, { isProdBuild: true })
|
|
||||||
);
|
|
||||||
|
|
||||||
gulp.task(
|
|
||||||
"rollup-prod-demo",
|
|
||||||
bothBuilds(rollupConfig.createDemoConfig, { isProdBuild: true })
|
|
||||||
);
|
|
||||||
|
|
||||||
gulp.task(
|
|
||||||
"rollup-prod-cast",
|
|
||||||
bothBuilds(rollupConfig.createCastConfig, { isProdBuild: true })
|
|
||||||
);
|
|
||||||
|
|
||||||
gulp.task("rollup-prod-hassio", () =>
|
|
||||||
bothBuilds(rollupConfig.createHassioConfig, { isProdBuild: true })
|
|
||||||
);
|
|
||||||
|
|
||||||
gulp.task("rollup-prod-gallery", () =>
|
|
||||||
buildRollup(
|
|
||||||
rollupConfig.createGalleryConfig({
|
|
||||||
isProdBuild: true,
|
|
||||||
latestBuild: true,
|
|
||||||
})
|
|
||||||
)
|
|
||||||
);
|
|
@@ -1,14 +0,0 @@
|
|||||||
module.exports = function (opts = {}) {
|
|
||||||
const dontHash = opts.dontHash || new Set();
|
|
||||||
|
|
||||||
return {
|
|
||||||
name: "dont-hash",
|
|
||||||
renderChunk(_code, chunk, _options) {
|
|
||||||
if (!chunk.isEntry || !dontHash.has(chunk.name)) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
chunk.fileName = `${chunk.name}.js`;
|
|
||||||
return null;
|
|
||||||
},
|
|
||||||
};
|
|
||||||
};
|
|
@@ -1,24 +0,0 @@
|
|||||||
module.exports = function (userOptions = {}) {
|
|
||||||
// Files need to be absolute paths.
|
|
||||||
// This only works if the file has no exports
|
|
||||||
// and only is imported for its side effects
|
|
||||||
const files = userOptions.files || [];
|
|
||||||
|
|
||||||
if (files.length === 0) {
|
|
||||||
return {
|
|
||||||
name: "ignore",
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
return {
|
|
||||||
name: "ignore",
|
|
||||||
|
|
||||||
load(id) {
|
|
||||||
return files.some((toIgnorePath) => id.startsWith(toIgnorePath))
|
|
||||||
? {
|
|
||||||
code: "",
|
|
||||||
}
|
|
||||||
: null;
|
|
||||||
},
|
|
||||||
};
|
|
||||||
};
|
|
@@ -1,34 +0,0 @@
|
|||||||
const url = require("url");
|
|
||||||
|
|
||||||
const defaultOptions = {
|
|
||||||
publicPath: "",
|
|
||||||
};
|
|
||||||
|
|
||||||
module.exports = function (userOptions = {}) {
|
|
||||||
const options = { ...defaultOptions, ...userOptions };
|
|
||||||
|
|
||||||
return {
|
|
||||||
name: "manifest",
|
|
||||||
generateBundle(outputOptions, bundle) {
|
|
||||||
const manifest = {};
|
|
||||||
|
|
||||||
for (const chunk of Object.values(bundle)) {
|
|
||||||
if (!chunk.isEntry) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
// Add js extension to mimic Webpack manifest.
|
|
||||||
manifest[`${chunk.name}.js`] = url.resolve(
|
|
||||||
options.publicPath,
|
|
||||||
chunk.fileName
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
this.emitFile({
|
|
||||||
type: "asset",
|
|
||||||
source: JSON.stringify(manifest, undefined, 2),
|
|
||||||
name: "manifest.json",
|
|
||||||
fileName: "manifest.json",
|
|
||||||
});
|
|
||||||
},
|
|
||||||
};
|
|
||||||
};
|
|
@@ -1,152 +0,0 @@
|
|||||||
// Worker plugin
|
|
||||||
// Each worker will include all of its dependencies
|
|
||||||
// instead of relying on an importer.
|
|
||||||
|
|
||||||
// Forked from v.1.4.1
|
|
||||||
// https://github.com/surma/rollup-plugin-off-main-thread
|
|
||||||
/**
|
|
||||||
* Copyright 2018 Google Inc. All Rights Reserved.
|
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
* you may not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
const rollup = require("rollup");
|
|
||||||
const path = require("path");
|
|
||||||
const MagicString = require("magic-string");
|
|
||||||
|
|
||||||
const defaultOpts = {
|
|
||||||
// A RegExp to find `new Workers()` calls. The second capture group _must_
|
|
||||||
// capture the provided file name without the quotes.
|
|
||||||
workerRegexp: /new Worker\((["'])(.+?)\1(,[^)]+)?\)/g,
|
|
||||||
plugins: ["node-resolve", "commonjs", "babel", "terser", "ignore"],
|
|
||||||
};
|
|
||||||
|
|
||||||
async function getBundledWorker(workerPath, rollupOptions) {
|
|
||||||
const bundle = await rollup.rollup({
|
|
||||||
...rollupOptions,
|
|
||||||
input: {
|
|
||||||
worker: workerPath,
|
|
||||||
},
|
|
||||||
});
|
|
||||||
const { output } = await bundle.generate({
|
|
||||||
// Generates cleanest output, we shouldn't have any imports/exports
|
|
||||||
// that would be incompatible with ES5.
|
|
||||||
format: "es",
|
|
||||||
// We should not export anything. This will fail build if we are.
|
|
||||||
exports: "none",
|
|
||||||
});
|
|
||||||
|
|
||||||
let code;
|
|
||||||
|
|
||||||
for (const chunkOrAsset of output) {
|
|
||||||
if (chunkOrAsset.name === "worker") {
|
|
||||||
code = chunkOrAsset.code;
|
|
||||||
} else if (chunkOrAsset.type !== "asset") {
|
|
||||||
throw new Error("Unexpected extra output");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return code;
|
|
||||||
}
|
|
||||||
|
|
||||||
module.exports = function (opts = {}) {
|
|
||||||
opts = { ...defaultOpts, ...opts };
|
|
||||||
|
|
||||||
let rollupOptions;
|
|
||||||
let refIds;
|
|
||||||
|
|
||||||
return {
|
|
||||||
name: "hass-worker",
|
|
||||||
|
|
||||||
async buildStart(options) {
|
|
||||||
refIds = {};
|
|
||||||
rollupOptions = {
|
|
||||||
plugins: options.plugins.filter((plugin) =>
|
|
||||||
opts.plugins.includes(plugin.name)
|
|
||||||
),
|
|
||||||
};
|
|
||||||
},
|
|
||||||
|
|
||||||
async transform(code, id) {
|
|
||||||
// Copy the regexp as they are stateful and this hook is async.
|
|
||||||
const workerRegexp = new RegExp(
|
|
||||||
opts.workerRegexp.source,
|
|
||||||
opts.workerRegexp.flags
|
|
||||||
);
|
|
||||||
if (!workerRegexp.test(code)) {
|
|
||||||
return undefined;
|
|
||||||
}
|
|
||||||
|
|
||||||
const ms = new MagicString(code);
|
|
||||||
// Reset the regexp
|
|
||||||
workerRegexp.lastIndex = 0;
|
|
||||||
for (;;) {
|
|
||||||
const match = workerRegexp.exec(code);
|
|
||||||
if (!match) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
const workerFile = match[2];
|
|
||||||
let optionsObject = {};
|
|
||||||
// Parse the optional options object
|
|
||||||
if (match[3] && match[3].length > 0) {
|
|
||||||
// FIXME: ooooof!
|
|
||||||
// eslint-disable-next-line @typescript-eslint/no-implied-eval
|
|
||||||
optionsObject = new Function(`return ${match[3].slice(1)};`)();
|
|
||||||
}
|
|
||||||
delete optionsObject.type;
|
|
||||||
|
|
||||||
if (!/^.*\//.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}".`
|
|
||||||
);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Find worker file and store it as a chunk with ID prefixed for our loader
|
|
||||||
// eslint-disable-next-line no-await-in-loop
|
|
||||||
const resolvedWorkerFile = (await this.resolve(workerFile, id)).id;
|
|
||||||
let chunkRefId;
|
|
||||||
if (resolvedWorkerFile in refIds) {
|
|
||||||
chunkRefId = refIds[resolvedWorkerFile];
|
|
||||||
} else {
|
|
||||||
this.addWatchFile(resolvedWorkerFile);
|
|
||||||
// eslint-disable-next-line no-await-in-loop
|
|
||||||
const source = await getBundledWorker(
|
|
||||||
resolvedWorkerFile,
|
|
||||||
rollupOptions
|
|
||||||
);
|
|
||||||
chunkRefId = refIds[resolvedWorkerFile] = this.emitFile({
|
|
||||||
name: path.basename(resolvedWorkerFile),
|
|
||||||
source,
|
|
||||||
type: "asset",
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
const workerParametersStartIndex = match.index + "new Worker(".length;
|
|
||||||
const workerParametersEndIndex =
|
|
||||||
match.index + match[0].length - ")".length;
|
|
||||||
|
|
||||||
ms.overwrite(
|
|
||||||
workerParametersStartIndex,
|
|
||||||
workerParametersEndIndex,
|
|
||||||
`import.meta.ROLLUP_FILE_URL_${chunkRefId}, ${JSON.stringify(
|
|
||||||
optionsObject
|
|
||||||
)}`
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
return {
|
|
||||||
code: ms.toString(),
|
|
||||||
map: ms.generateMap({ hires: true }),
|
|
||||||
};
|
|
||||||
},
|
|
||||||
};
|
|
||||||
};
|
|
@@ -1,146 +0,0 @@
|
|||||||
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 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 bundle = require("./bundle.cjs");
|
|
||||||
const paths = require("./paths.cjs");
|
|
||||||
|
|
||||||
const extensions = [".js", ".ts"];
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param {Object} arg
|
|
||||||
* @param { import("rollup").InputOption } arg.input
|
|
||||||
*/
|
|
||||||
const createRollupConfig = ({
|
|
||||||
entry,
|
|
||||||
outputPath,
|
|
||||||
defineOverlay,
|
|
||||||
isProdBuild,
|
|
||||||
latestBuild,
|
|
||||||
isStatsBuild,
|
|
||||||
publicPath,
|
|
||||||
dontHash,
|
|
||||||
isWDS,
|
|
||||||
}) => ({
|
|
||||||
/**
|
|
||||||
* @type { import("rollup").InputOptions }
|
|
||||||
*/
|
|
||||||
inputOptions: {
|
|
||||||
input: entry,
|
|
||||||
// Some entry points contain no JavaScript. This setting silences a warning about that.
|
|
||||||
// https://rollupjs.org/configuration-options/#preserveentrysignatures
|
|
||||||
preserveEntrySignatures: false,
|
|
||||||
plugins: [
|
|
||||||
ignore({
|
|
||||||
files: bundle
|
|
||||||
.emptyPackages({ latestBuild })
|
|
||||||
// TEMP HACK: Makes Rollup build work again
|
|
||||||
.concat(
|
|
||||||
require.resolve(
|
|
||||||
"@webcomponents/scoped-custom-element-registry/scoped-custom-element-registry.min"
|
|
||||||
)
|
|
||||||
),
|
|
||||||
}),
|
|
||||||
resolve({
|
|
||||||
extensions,
|
|
||||||
preferBuiltins: false,
|
|
||||||
browser: true,
|
|
||||||
rootDir: paths.polymer_dir,
|
|
||||||
}),
|
|
||||||
commonjs(),
|
|
||||||
json(),
|
|
||||||
babel({
|
|
||||||
...bundle.babelOptions({ latestBuild, isProdBuild }),
|
|
||||||
extensions,
|
|
||||||
babelHelpers: isWDS ? "inline" : "bundled",
|
|
||||||
}),
|
|
||||||
string({
|
|
||||||
// Import certain extensions as strings
|
|
||||||
include: [path.join(paths.polymer_dir, "node_modules/**/*.css")],
|
|
||||||
}),
|
|
||||||
replace(bundle.definedVars({ isProdBuild, latestBuild, defineOverlay })),
|
|
||||||
!isWDS &&
|
|
||||||
manifest({
|
|
||||||
publicPath,
|
|
||||||
}),
|
|
||||||
!isWDS && worker(),
|
|
||||||
!isWDS && dontHashPlugin({ dontHash }),
|
|
||||||
!isWDS && isProdBuild && terser(bundle.terserOptions({ latestBuild })),
|
|
||||||
!isWDS &&
|
|
||||||
isStatsBuild &&
|
|
||||||
visualizer({
|
|
||||||
// https://github.com/btd/rollup-plugin-visualizer#options
|
|
||||||
open: true,
|
|
||||||
sourcemap: true,
|
|
||||||
}),
|
|
||||||
].filter(Boolean),
|
|
||||||
},
|
|
||||||
/**
|
|
||||||
* @type { import("rollup").OutputOptions }
|
|
||||||
*/
|
|
||||||
outputOptions: {
|
|
||||||
// https://rollupjs.org/configuration-options/#output-dir
|
|
||||||
dir: outputPath,
|
|
||||||
// https://rollupjs.org/configuration-options/#output-format
|
|
||||||
format: latestBuild ? "es" : "systemjs",
|
|
||||||
// https://rollupjs.org/configuration-options/#output-externallivebindings
|
|
||||||
externalLiveBindings: false,
|
|
||||||
// https://rollupjs.org/configuration-options/#output-entryfilenames
|
|
||||||
// https://rollupjs.org/configuration-options/#output-chunkfilenames
|
|
||||||
// https://rollupjs.org/configuration-options/#output-assetfilenames
|
|
||||||
entryFileNames:
|
|
||||||
isProdBuild && !isStatsBuild ? "[name]-[hash].js" : "[name].js",
|
|
||||||
chunkFileNames: isProdBuild && !isStatsBuild ? "c.[hash].js" : "[name].js",
|
|
||||||
assetFileNames: isProdBuild && !isStatsBuild ? "a.[hash].js" : "[name].js",
|
|
||||||
// https://rollupjs.org/configuration-options/#output-sourcemap
|
|
||||||
sourcemap: isProdBuild ? true : "inline",
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
const createAppConfig = ({ isProdBuild, latestBuild, isStatsBuild, isWDS }) =>
|
|
||||||
createRollupConfig(
|
|
||||||
bundle.config.app({
|
|
||||||
isProdBuild,
|
|
||||||
latestBuild,
|
|
||||||
isStatsBuild,
|
|
||||||
isWDS,
|
|
||||||
})
|
|
||||||
);
|
|
||||||
|
|
||||||
const createDemoConfig = ({ isProdBuild, latestBuild, isStatsBuild }) =>
|
|
||||||
createRollupConfig(
|
|
||||||
bundle.config.demo({
|
|
||||||
isProdBuild,
|
|
||||||
latestBuild,
|
|
||||||
isStatsBuild,
|
|
||||||
})
|
|
||||||
);
|
|
||||||
|
|
||||||
const createCastConfig = ({ isProdBuild, latestBuild }) =>
|
|
||||||
createRollupConfig(bundle.config.cast({ isProdBuild, latestBuild }));
|
|
||||||
|
|
||||||
const createHassioConfig = ({ isProdBuild, latestBuild }) =>
|
|
||||||
createRollupConfig(bundle.config.hassio({ isProdBuild, latestBuild }));
|
|
||||||
|
|
||||||
const createGalleryConfig = ({ isProdBuild, latestBuild }) =>
|
|
||||||
createRollupConfig(bundle.config.gallery({ isProdBuild, latestBuild }));
|
|
||||||
|
|
||||||
module.exports = {
|
|
||||||
createAppConfig,
|
|
||||||
createDemoConfig,
|
|
||||||
createCastConfig,
|
|
||||||
createHassioConfig,
|
|
||||||
createGalleryConfig,
|
|
||||||
createRollupConfig,
|
|
||||||
};
|
|
@@ -1,10 +0,0 @@
|
|||||||
import rollup from "../build-scripts/rollup.cjs";
|
|
||||||
import env from "../build-scripts/env.cjs";
|
|
||||||
|
|
||||||
const config = rollup.createCastConfig({
|
|
||||||
isProdBuild: env.isProdBuild(),
|
|
||||||
latestBuild: true,
|
|
||||||
isStatsBuild: env.isStatsBuild(),
|
|
||||||
});
|
|
||||||
|
|
||||||
export default { ...config.inputOptions, output: config.outputOptions };
|
|
@@ -1,10 +1,12 @@
|
|||||||
import "@material/mwc-button/mwc-button";
|
import "@material/mwc-button/mwc-button";
|
||||||
import { ActionDetail } from "@material/mwc-list/mwc-list";
|
import "@material/mwc-list/mwc-list";
|
||||||
|
import type { ActionDetail } from "@material/mwc-list/mwc-list";
|
||||||
import { mdiCast, mdiCastConnected, mdiViewDashboard } from "@mdi/js";
|
import { mdiCast, mdiCastConnected, mdiViewDashboard } from "@mdi/js";
|
||||||
import { Auth, Connection } from "home-assistant-js-websocket";
|
import type { Auth, Connection } from "home-assistant-js-websocket";
|
||||||
import { CSSResultGroup, LitElement, TemplateResult, css, html } from "lit";
|
import type { CSSResultGroup, TemplateResult } from "lit";
|
||||||
|
import { LitElement, css, html } from "lit";
|
||||||
import { customElement, property, state } from "lit/decorators";
|
import { customElement, property, state } from "lit/decorators";
|
||||||
import { CastManager } from "../../../../src/cast/cast_manager";
|
import type { CastManager } from "../../../../src/cast/cast_manager";
|
||||||
import {
|
import {
|
||||||
castSendShowLovelaceView,
|
castSendShowLovelaceView,
|
||||||
ensureConnectedCastSession,
|
ensureConnectedCastSession,
|
||||||
@@ -23,7 +25,7 @@ import {
|
|||||||
getLovelaceCollection,
|
getLovelaceCollection,
|
||||||
} from "../../../../src/data/lovelace";
|
} from "../../../../src/data/lovelace";
|
||||||
import { isStrategyDashboard } from "../../../../src/data/lovelace/config/types";
|
import { isStrategyDashboard } from "../../../../src/data/lovelace/config/types";
|
||||||
import { LovelaceViewConfig } from "../../../../src/data/lovelace/config/view";
|
import type { LovelaceViewConfig } from "../../../../src/data/lovelace/config/view";
|
||||||
import "../../../../src/layouts/hass-loading-screen";
|
import "../../../../src/layouts/hass-loading-screen";
|
||||||
import { generateDefaultViewConfig } from "../../../../src/panels/lovelace/common/generate-lovelace-config";
|
import { generateDefaultViewConfig } from "../../../../src/panels/lovelace/common/generate-lovelace-config";
|
||||||
import "./hc-layout";
|
import "./hc-layout";
|
||||||
@@ -89,8 +91,8 @@ class HcCast extends LitElement {
|
|||||||
generateDefaultViewConfig({}, {}, {}, {}, () => ""),
|
generateDefaultViewConfig({}, {}, {}, {}, () => ""),
|
||||||
]
|
]
|
||||||
).map(
|
).map(
|
||||||
(view, idx) =>
|
(view, idx) => html`
|
||||||
html`<ha-list-item
|
<ha-list-item
|
||||||
graphic="avatar"
|
graphic="avatar"
|
||||||
.activated=${this.castManager.status?.lovelacePath ===
|
.activated=${this.castManager.status?.lovelacePath ===
|
||||||
(view.path ?? idx)}
|
(view.path ?? idx)}
|
||||||
@@ -108,8 +110,9 @@ class HcCast extends LitElement {
|
|||||||
: html`<ha-svg-icon
|
: html`<ha-svg-icon
|
||||||
slot="item-icon"
|
slot="item-icon"
|
||||||
.path=${mdiViewDashboard}
|
.path=${mdiViewDashboard}
|
||||||
></ha-svg-icon>`}</ha-list-item
|
></ha-svg-icon>`}
|
||||||
> `
|
</ha-list-item>
|
||||||
|
`
|
||||||
)}</mwc-list
|
)}</mwc-list
|
||||||
>
|
>
|
||||||
`}
|
`}
|
||||||
|
@@ -1,19 +1,23 @@
|
|||||||
import "@material/mwc-button";
|
import "@material/mwc-button";
|
||||||
import { mdiCastConnected, mdiCast } from "@mdi/js";
|
import { mdiCastConnected, mdiCast } from "@mdi/js";
|
||||||
import {
|
import type {
|
||||||
Auth,
|
Auth,
|
||||||
Connection,
|
Connection,
|
||||||
|
getAuthOptions,
|
||||||
|
} from "home-assistant-js-websocket";
|
||||||
|
import {
|
||||||
createConnection,
|
createConnection,
|
||||||
ERR_CANNOT_CONNECT,
|
ERR_CANNOT_CONNECT,
|
||||||
ERR_HASS_HOST_REQUIRED,
|
ERR_HASS_HOST_REQUIRED,
|
||||||
ERR_INVALID_AUTH,
|
ERR_INVALID_AUTH,
|
||||||
ERR_INVALID_HTTPS_TO_HTTP,
|
ERR_INVALID_HTTPS_TO_HTTP,
|
||||||
getAuth,
|
getAuth,
|
||||||
getAuthOptions,
|
|
||||||
} from "home-assistant-js-websocket";
|
} from "home-assistant-js-websocket";
|
||||||
import { css, CSSResultGroup, html, LitElement, TemplateResult } from "lit";
|
import type { CSSResultGroup, TemplateResult } from "lit";
|
||||||
|
import { css, html, LitElement } from "lit";
|
||||||
import { customElement, state } from "lit/decorators";
|
import { customElement, state } from "lit/decorators";
|
||||||
import { CastManager, getCastManager } from "../../../../src/cast/cast_manager";
|
import type { CastManager } from "../../../../src/cast/cast_manager";
|
||||||
|
import { getCastManager } from "../../../../src/cast/cast_manager";
|
||||||
import { castSendShowDemo } from "../../../../src/cast/receiver_messages";
|
import { castSendShowDemo } from "../../../../src/cast/receiver_messages";
|
||||||
import {
|
import {
|
||||||
loadTokens,
|
loadTokens,
|
||||||
|
@@ -1,10 +1,7 @@
|
|||||||
import {
|
import type { Auth, Connection, HassUser } from "home-assistant-js-websocket";
|
||||||
Auth,
|
import { getUser } from "home-assistant-js-websocket";
|
||||||
Connection,
|
import type { CSSResultGroup, TemplateResult } from "lit";
|
||||||
getUser,
|
import { css, html, LitElement } from "lit";
|
||||||
HassUser,
|
|
||||||
} from "home-assistant-js-websocket";
|
|
||||||
import { css, CSSResultGroup, html, LitElement, TemplateResult } from "lit";
|
|
||||||
import { customElement, property } from "lit/decorators";
|
import { customElement, property } from "lit/decorators";
|
||||||
import "../../../../src/components/ha-card";
|
import "../../../../src/components/ha-card";
|
||||||
|
|
||||||
@@ -88,7 +85,7 @@ class HcLayout extends LitElement {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.card-header {
|
.card-header {
|
||||||
color: var(--ha-card-header-color, --primary-text-color);
|
color: var(--ha-card-header-color, var(--primary-text-color));
|
||||||
font-family: var(--ha-card-header-font-family, inherit);
|
font-family: var(--ha-card-header-font-family, inherit);
|
||||||
font-size: var(--ha-card-header-font-size, 24px);
|
font-size: var(--ha-card-header-font-size, 24px);
|
||||||
letter-spacing: -0.012em;
|
letter-spacing: -0.012em;
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
import { convertEntities, Entity } from "../../../../src/fake_data/entity";
|
import type { Entity } from "../../../../src/fake_data/entity";
|
||||||
|
import { convertEntities } from "../../../../src/fake_data/entity";
|
||||||
|
|
||||||
export const castDemoEntities: () => Entity[] = () =>
|
export const castDemoEntities: () => Entity[] = () =>
|
||||||
convertEntities({
|
convertEntities({
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
import { LovelaceCardConfig } from "../../../../src/data/lovelace/config/card";
|
import type { LovelaceCardConfig } from "../../../../src/data/lovelace/config/card";
|
||||||
import { LovelaceConfig } from "../../../../src/data/lovelace/config/types";
|
import type { LovelaceConfig } from "../../../../src/data/lovelace/config/types";
|
||||||
import { castContext } from "../cast_context";
|
import { castContext } from "../cast_context";
|
||||||
|
|
||||||
export const castDemoLovelace: () => LovelaceConfig = () => {
|
export const castDemoLovelace: () => LovelaceConfig = () => {
|
||||||
|
@@ -1,10 +1,10 @@
|
|||||||
import { framework } from "./cast_framework";
|
import { framework } from "./cast_framework";
|
||||||
import { CAST_NS } from "../../../src/cast/const";
|
import { CAST_NS } from "../../../src/cast/const";
|
||||||
import { HassMessage } from "../../../src/cast/receiver_messages";
|
import type { HassMessage } from "../../../src/cast/receiver_messages";
|
||||||
import "../../../src/resources/custom-card-support";
|
import "../../../src/resources/custom-card-support";
|
||||||
import { castContext } from "./cast_context";
|
import { castContext } from "./cast_context";
|
||||||
import { HcMain } from "./layout/hc-main";
|
import { HcMain } from "./layout/hc-main";
|
||||||
import { ReceivedMessage } from "./types";
|
import type { ReceivedMessage } from "./types";
|
||||||
|
|
||||||
const lovelaceController = new HcMain();
|
const lovelaceController = new HcMain();
|
||||||
document.body.append(lovelaceController);
|
document.body.append(lovelaceController);
|
||||||
|
@@ -1,13 +1,11 @@
|
|||||||
import { html, nothing } from "lit";
|
import { html, nothing } from "lit";
|
||||||
import { customElement, property, state } from "lit/decorators";
|
import { customElement, property, state } from "lit/decorators";
|
||||||
import { mockHistory } from "../../../../demo/src/stubs/history";
|
import { mockHistory } from "../../../../demo/src/stubs/history";
|
||||||
import { LovelaceConfig } from "../../../../src/data/lovelace/config/types";
|
import type { LovelaceConfig } from "../../../../src/data/lovelace/config/types";
|
||||||
import {
|
import type { MockHomeAssistant } from "../../../../src/fake_data/provide_hass";
|
||||||
MockHomeAssistant,
|
import { provideHass } from "../../../../src/fake_data/provide_hass";
|
||||||
provideHass,
|
|
||||||
} from "../../../../src/fake_data/provide_hass";
|
|
||||||
import { HassElement } from "../../../../src/state/hass-element";
|
import { HassElement } from "../../../../src/state/hass-element";
|
||||||
import { HomeAssistant } from "../../../../src/types";
|
import type { HomeAssistant } from "../../../../src/types";
|
||||||
import { castDemoEntities } from "../demo/cast-demo-entities";
|
import { castDemoEntities } from "../demo/cast-demo-entities";
|
||||||
import { castDemoLovelace } from "../demo/cast-demo-lovelace";
|
import { castDemoLovelace } from "../demo/cast-demo-lovelace";
|
||||||
import "./hc-lovelace";
|
import "./hc-lovelace";
|
||||||
|
@@ -1,6 +1,7 @@
|
|||||||
import { css, CSSResultGroup, html, LitElement, TemplateResult } from "lit";
|
import type { CSSResultGroup, TemplateResult } from "lit";
|
||||||
|
import { css, html, LitElement } from "lit";
|
||||||
import { customElement, property } from "lit/decorators";
|
import { customElement, property } from "lit/decorators";
|
||||||
import { HomeAssistant } from "../../../../src/types";
|
import type { HomeAssistant } from "../../../../src/types";
|
||||||
|
|
||||||
@customElement("hc-launch-screen")
|
@customElement("hc-launch-screen")
|
||||||
class HcLaunchScreen extends LitElement {
|
class HcLaunchScreen extends LitElement {
|
||||||
|
@@ -1,11 +1,18 @@
|
|||||||
import { css, CSSResultGroup, html, LitElement, TemplateResult } from "lit";
|
import {
|
||||||
import { customElement, property, query } from "lit/decorators";
|
css,
|
||||||
|
type CSSResultGroup,
|
||||||
|
html,
|
||||||
|
LitElement,
|
||||||
|
type TemplateResult,
|
||||||
|
} from "lit";
|
||||||
|
import { customElement, property } from "lit/decorators";
|
||||||
import { fireEvent } from "../../../../src/common/dom/fire_event";
|
import { fireEvent } from "../../../../src/common/dom/fire_event";
|
||||||
import { LovelaceConfig } from "../../../../src/data/lovelace/config/types";
|
import type { LovelaceConfig } from "../../../../src/data/lovelace/config/types";
|
||||||
import { getPanelTitleFromUrlPath } from "../../../../src/data/panel";
|
import { getPanelTitleFromUrlPath } from "../../../../src/data/panel";
|
||||||
import { Lovelace } from "../../../../src/panels/lovelace/types";
|
import type { Lovelace } from "../../../../src/panels/lovelace/types";
|
||||||
import "../../../../src/panels/lovelace/views/hui-view";
|
import "../../../../src/panels/lovelace/views/hui-view";
|
||||||
import { HomeAssistant } from "../../../../src/types";
|
import "../../../../src/panels/lovelace/views/hui-view-container";
|
||||||
|
import type { HomeAssistant } from "../../../../src/types";
|
||||||
import "./hc-launch-screen";
|
import "./hc-launch-screen";
|
||||||
|
|
||||||
(window as any).loadCardHelpers = () =>
|
(window as any).loadCardHelpers = () =>
|
||||||
@@ -22,8 +29,6 @@ class HcLovelace extends LitElement {
|
|||||||
|
|
||||||
@property() public urlPath: string | null = null;
|
@property() public urlPath: string | null = null;
|
||||||
|
|
||||||
@query("hui-view") private _huiView?: HTMLElement;
|
|
||||||
|
|
||||||
protected render(): TemplateResult {
|
protected render(): TemplateResult {
|
||||||
const index = this._viewIndex;
|
const index = this._viewIndex;
|
||||||
if (index === undefined) {
|
if (index === undefined) {
|
||||||
@@ -45,13 +50,24 @@ class HcLovelace extends LitElement {
|
|||||||
saveConfig: async () => undefined,
|
saveConfig: async () => undefined,
|
||||||
deleteConfig: async () => undefined,
|
deleteConfig: async () => undefined,
|
||||||
setEditMode: () => undefined,
|
setEditMode: () => undefined,
|
||||||
|
showToast: () => undefined,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const viewConfig = this.lovelaceConfig.views[index];
|
||||||
|
const background = viewConfig.background || this.lovelaceConfig.background;
|
||||||
|
|
||||||
return html`
|
return html`
|
||||||
<hui-view
|
<hui-view-container
|
||||||
.hass=${this.hass}
|
.hass=${this.hass}
|
||||||
.lovelace=${lovelace}
|
.background=${background}
|
||||||
.index=${index}
|
.theme=${viewConfig.theme}
|
||||||
></hui-view>
|
>
|
||||||
|
<hui-view
|
||||||
|
.hass=${this.hass}
|
||||||
|
.lovelace=${lovelace}
|
||||||
|
.index=${index}
|
||||||
|
></hui-view>
|
||||||
|
</hui-view-container>
|
||||||
`;
|
`;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -81,26 +97,6 @@ class HcLovelace extends LitElement {
|
|||||||
}${viewTitle || ""}`
|
}${viewTitle || ""}`
|
||||||
: undefined,
|
: undefined,
|
||||||
});
|
});
|
||||||
|
|
||||||
const configBackground =
|
|
||||||
this.lovelaceConfig.views[index].background ||
|
|
||||||
this.lovelaceConfig.background;
|
|
||||||
|
|
||||||
const backgroundStyle =
|
|
||||||
typeof configBackground === "string"
|
|
||||||
? configBackground
|
|
||||||
: configBackground?.image
|
|
||||||
? `center / cover no-repeat url('${configBackground.image}')`
|
|
||||||
: undefined;
|
|
||||||
|
|
||||||
if (backgroundStyle) {
|
|
||||||
this._huiView!.style.setProperty(
|
|
||||||
"--lovelace-background",
|
|
||||||
backgroundStyle
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
this._huiView!.style.removeProperty("--lovelace-background");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -124,19 +120,15 @@ class HcLovelace extends LitElement {
|
|||||||
|
|
||||||
static get styles(): CSSResultGroup {
|
static get styles(): CSSResultGroup {
|
||||||
return css`
|
return css`
|
||||||
:host {
|
hui-view-container {
|
||||||
min-height: 100vh;
|
|
||||||
height: 0;
|
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
position: relative;
|
||||||
|
min-height: 100vh;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
background: var(--primary-background-color);
|
|
||||||
}
|
|
||||||
:host > * {
|
|
||||||
flex: 1;
|
|
||||||
}
|
}
|
||||||
hui-view {
|
hui-view {
|
||||||
background: var(--lovelace-background, var(--primary-background-color));
|
flex: 1 1 100%;
|
||||||
|
max-width: 100%;
|
||||||
}
|
}
|
||||||
`;
|
`;
|
||||||
}
|
}
|
||||||
|
@@ -1,35 +1,33 @@
|
|||||||
import {
|
import type { UnsubscribeFunc } from "home-assistant-js-websocket";
|
||||||
createConnection,
|
import { createConnection, getAuth } from "home-assistant-js-websocket";
|
||||||
getAuth,
|
import type { TemplateResult } from "lit";
|
||||||
UnsubscribeFunc,
|
import { html } from "lit";
|
||||||
} from "home-assistant-js-websocket";
|
|
||||||
import { html, TemplateResult } from "lit";
|
|
||||||
import { customElement, state } from "lit/decorators";
|
import { customElement, state } from "lit/decorators";
|
||||||
import { CAST_NS } from "../../../../src/cast/const";
|
import { CAST_NS } from "../../../../src/cast/const";
|
||||||
import {
|
import type {
|
||||||
ConnectMessage,
|
ConnectMessage,
|
||||||
GetStatusMessage,
|
GetStatusMessage,
|
||||||
HassMessage,
|
HassMessage,
|
||||||
ShowDemoMessage,
|
ShowDemoMessage,
|
||||||
ShowLovelaceViewMessage,
|
ShowLovelaceViewMessage,
|
||||||
} from "../../../../src/cast/receiver_messages";
|
} from "../../../../src/cast/receiver_messages";
|
||||||
import {
|
import type {
|
||||||
ReceiverErrorCode,
|
|
||||||
ReceiverErrorMessage,
|
ReceiverErrorMessage,
|
||||||
ReceiverStatusMessage,
|
ReceiverStatusMessage,
|
||||||
} from "../../../../src/cast/sender_messages";
|
} from "../../../../src/cast/sender_messages";
|
||||||
|
import { ReceiverErrorCode } from "../../../../src/cast/sender_messages";
|
||||||
import { atLeastVersion } from "../../../../src/common/config/version";
|
import { atLeastVersion } from "../../../../src/common/config/version";
|
||||||
import { isNavigationClick } from "../../../../src/common/dom/is-navigation-click";
|
import { isNavigationClick } from "../../../../src/common/dom/is-navigation-click";
|
||||||
import {
|
import {
|
||||||
getLegacyLovelaceCollection,
|
getLegacyLovelaceCollection,
|
||||||
getLovelaceCollection,
|
getLovelaceCollection,
|
||||||
} from "../../../../src/data/lovelace";
|
} from "../../../../src/data/lovelace";
|
||||||
import {
|
import type {
|
||||||
isStrategyDashboard,
|
|
||||||
LegacyLovelaceConfig,
|
LegacyLovelaceConfig,
|
||||||
LovelaceConfig,
|
LovelaceConfig,
|
||||||
LovelaceDashboardStrategyConfig,
|
LovelaceDashboardStrategyConfig,
|
||||||
} from "../../../../src/data/lovelace/config/types";
|
} from "../../../../src/data/lovelace/config/types";
|
||||||
|
import { isStrategyDashboard } from "../../../../src/data/lovelace/config/types";
|
||||||
import { fetchResources } from "../../../../src/data/lovelace/resource";
|
import { fetchResources } from "../../../../src/data/lovelace/resource";
|
||||||
import { loadLovelaceResources } from "../../../../src/panels/lovelace/common/load-resources";
|
import { loadLovelaceResources } from "../../../../src/panels/lovelace/common/load-resources";
|
||||||
import { HassElement } from "../../../../src/state/hass-element";
|
import { HassElement } from "../../../../src/state/hass-element";
|
||||||
|
@@ -1,10 +0,0 @@
|
|||||||
import rollup from "../build-scripts/rollup.cjs";
|
|
||||||
import env from "../build-scripts/env.cjs";
|
|
||||||
|
|
||||||
const config = rollup.createDemoConfig({
|
|
||||||
isProdBuild: env.isProdBuild(),
|
|
||||||
latestBuild: true,
|
|
||||||
isStatsBuild: env.isStatsBuild(),
|
|
||||||
});
|
|
||||||
|
|
||||||
export default { ...config.inputOptions, output: config.outputOptions };
|
|
@@ -1,5 +1,5 @@
|
|||||||
import { convertEntities } from "../../../../src/fake_data/entity";
|
import { convertEntities } from "../../../../src/fake_data/entity";
|
||||||
import { DemoConfig } from "../types";
|
import type { DemoConfig } from "../types";
|
||||||
|
|
||||||
export const demoEntitiesArsaboo: DemoConfig["entities"] = (localize) =>
|
export const demoEntitiesArsaboo: DemoConfig["entities"] = (localize) =>
|
||||||
convertEntities({
|
convertEntities({
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
import { DemoConfig } from "../types";
|
import type { DemoConfig } from "../types";
|
||||||
import { demoEntitiesArsaboo } from "./entities";
|
import { demoEntitiesArsaboo } from "./entities";
|
||||||
import { demoLovelaceArsaboo } from "./lovelace";
|
import { demoLovelaceArsaboo } from "./lovelace";
|
||||||
import { demoThemeArsaboo } from "./theme";
|
import { demoThemeArsaboo } from "./theme";
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
import { DemoConfig } from "../types";
|
import type { DemoConfig } from "../types";
|
||||||
|
|
||||||
export const demoLovelaceArsaboo: DemoConfig["lovelace"] = (localize) => ({
|
export const demoLovelaceArsaboo: DemoConfig["lovelace"] = (localize) => ({
|
||||||
title: "Home Assistant",
|
title: "Home Assistant",
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
import { MockHomeAssistant } from "../../../src/fake_data/provide_hass";
|
import type { MockHomeAssistant } from "../../../src/fake_data/provide_hass";
|
||||||
import { Lovelace } from "../../../src/panels/lovelace/types";
|
import type { Lovelace } from "../../../src/panels/lovelace/types";
|
||||||
import { energyEntities } from "../stubs/entities";
|
import { energyEntities } from "../stubs/entities";
|
||||||
import { DemoConfig } from "./types";
|
import type { DemoConfig } from "./types";
|
||||||
|
|
||||||
export const demoConfigs: Array<() => Promise<DemoConfig>> = [
|
export const demoConfigs: Array<() => Promise<DemoConfig>> = [
|
||||||
() => import("./sections").then((mod) => mod.demoSections),
|
() => import("./sections").then((mod) => mod.demoSections),
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
import { convertEntities } from "../../../../src/fake_data/entity";
|
import { convertEntities } from "../../../../src/fake_data/entity";
|
||||||
import { DemoConfig } from "../types";
|
import type { DemoConfig } from "../types";
|
||||||
|
|
||||||
export const demoEntitiesJimpower: DemoConfig["entities"] = () =>
|
export const demoEntitiesJimpower: DemoConfig["entities"] = () =>
|
||||||
convertEntities({
|
convertEntities({
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
import { DemoConfig } from "../types";
|
import type { DemoConfig } from "../types";
|
||||||
import { demoEntitiesJimpower } from "./entities";
|
import { demoEntitiesJimpower } from "./entities";
|
||||||
import { demoLovelaceJimpower } from "./lovelace";
|
import { demoLovelaceJimpower } from "./lovelace";
|
||||||
import { demoThemeJimpower } from "./theme";
|
import { demoThemeJimpower } from "./theme";
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
import "../../custom-cards/card-modder";
|
import "../../custom-cards/card-modder";
|
||||||
import { DemoConfig } from "../types";
|
import type { DemoConfig } from "../types";
|
||||||
|
|
||||||
export const demoLovelaceJimpower: DemoConfig["lovelace"] = () => ({
|
export const demoLovelaceJimpower: DemoConfig["lovelace"] = () => ({
|
||||||
name: "Kingia Castle",
|
name: "Kingia Castle",
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
import { convertEntities } from "../../../../src/fake_data/entity";
|
import { convertEntities } from "../../../../src/fake_data/entity";
|
||||||
import { DemoConfig } from "../types";
|
import type { DemoConfig } from "../types";
|
||||||
|
|
||||||
export const demoEntitiesKernehed: DemoConfig["entities"] = () =>
|
export const demoEntitiesKernehed: DemoConfig["entities"] = () =>
|
||||||
convertEntities({
|
convertEntities({
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
import { DemoConfig } from "../types";
|
import type { DemoConfig } from "../types";
|
||||||
import { demoEntitiesKernehed } from "./entities";
|
import { demoEntitiesKernehed } from "./entities";
|
||||||
import { demoLovelaceKernehed } from "./lovelace";
|
import { demoLovelaceKernehed } from "./lovelace";
|
||||||
import { demoThemeKernehed } from "./theme";
|
import { demoThemeKernehed } from "./theme";
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
import { DemoConfig } from "../types";
|
import type { DemoConfig } from "../types";
|
||||||
|
|
||||||
export const demoLovelaceKernehed: DemoConfig["lovelace"] = () => ({
|
export const demoLovelaceKernehed: DemoConfig["lovelace"] = () => ({
|
||||||
name: "Hem",
|
name: "Hem",
|
||||||
|
@@ -1,16 +0,0 @@
|
|||||||
import { html } from "lit";
|
|
||||||
import { DemoConfig } from "../types";
|
|
||||||
|
|
||||||
export const demoLovelaceDescription: DemoConfig["description"] = (
|
|
||||||
localize
|
|
||||||
) => html`
|
|
||||||
<p>
|
|
||||||
${localize("ui.panel.page-demo.config.sections.description", {
|
|
||||||
blog_post: html`<a
|
|
||||||
href="https://www.home-assistant.io/blog/2024/03/04/dashboard-chapter-1/"
|
|
||||||
target="_blank"
|
|
||||||
>${localize("ui.panel.page-demo.config.sections.description_blog_post")}
|
|
||||||
</a>`,
|
|
||||||
})}
|
|
||||||
</p>
|
|
||||||
`;
|
|
@@ -1,5 +1,5 @@
|
|||||||
import { convertEntities } from "../../../../src/fake_data/entity";
|
import { convertEntities } from "../../../../src/fake_data/entity";
|
||||||
import { DemoConfig } from "../types";
|
import type { DemoConfig } from "../types";
|
||||||
|
|
||||||
export const demoEntitiesSections: DemoConfig["entities"] = (localize) =>
|
export const demoEntitiesSections: DemoConfig["entities"] = (localize) =>
|
||||||
convertEntities({
|
convertEntities({
|
||||||
|
@@ -1,5 +1,4 @@
|
|||||||
import { DemoConfig } from "../types";
|
import type { DemoConfig } from "../types";
|
||||||
import { demoLovelaceDescription } from "./description";
|
|
||||||
import { demoEntitiesSections } from "./entities";
|
import { demoEntitiesSections } from "./entities";
|
||||||
import { demoLovelaceSections } from "./lovelace";
|
import { demoLovelaceSections } from "./lovelace";
|
||||||
|
|
||||||
@@ -7,7 +6,6 @@ export const demoSections: DemoConfig = {
|
|||||||
authorName: "Home Assistant",
|
authorName: "Home Assistant",
|
||||||
authorUrl: "https://github.com/home-assistant/frontend/",
|
authorUrl: "https://github.com/home-assistant/frontend/",
|
||||||
name: "Home Demo",
|
name: "Home Demo",
|
||||||
description: demoLovelaceDescription,
|
|
||||||
lovelace: demoLovelaceSections,
|
lovelace: demoLovelaceSections,
|
||||||
entities: demoEntitiesSections,
|
entities: demoEntitiesSections,
|
||||||
theme: () => ({}),
|
theme: () => ({}),
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
import { isFrontpageEmbed } from "../../util/is_frontpage";
|
import { isFrontpageEmbed } from "../../util/is_frontpage";
|
||||||
import { DemoConfig } from "../types";
|
import type { DemoConfig } from "../types";
|
||||||
|
|
||||||
export const demoLovelaceSections: DemoConfig["lovelace"] = (localize) => ({
|
export const demoLovelaceSections: DemoConfig["lovelace"] = (localize) => ({
|
||||||
title: "Home Assistant Demo",
|
title: "Home Assistant Demo",
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
import { convertEntities } from "../../../../src/fake_data/entity";
|
import { convertEntities } from "../../../../src/fake_data/entity";
|
||||||
import { DemoConfig } from "../types";
|
import type { DemoConfig } from "../types";
|
||||||
|
|
||||||
export const demoEntitiesTeachingbirds: DemoConfig["entities"] = () =>
|
export const demoEntitiesTeachingbirds: DemoConfig["entities"] = () =>
|
||||||
convertEntities({
|
convertEntities({
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
import { DemoConfig } from "../types";
|
import type { DemoConfig } from "../types";
|
||||||
import { demoEntitiesTeachingbirds } from "./entities";
|
import { demoEntitiesTeachingbirds } from "./entities";
|
||||||
import { demoLovelaceTeachingbirds } from "./lovelace";
|
import { demoLovelaceTeachingbirds } from "./lovelace";
|
||||||
import { demoThemeTeachingbirds } from "./theme";
|
import { demoThemeTeachingbirds } from "./theme";
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
import { DemoConfig } from "../types";
|
import type { DemoConfig } from "../types";
|
||||||
|
|
||||||
export const demoLovelaceTeachingbirds: DemoConfig["lovelace"] = () => ({
|
export const demoLovelaceTeachingbirds: DemoConfig["lovelace"] = () => ({
|
||||||
title: "Home",
|
title: "Home",
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
import { TemplateResult } from "lit";
|
import type { TemplateResult } from "lit";
|
||||||
import { LocalizeFunc } from "../../../src/common/translations/localize";
|
import type { LocalizeFunc } from "../../../src/common/translations/localize";
|
||||||
import { LovelaceConfig } from "../../../src/data/lovelace/config/types";
|
import type { LovelaceConfig } from "../../../src/data/lovelace/config/types";
|
||||||
import { Entity } from "../../../src/fake_data/entity";
|
import type { Entity } from "../../../src/fake_data/entity";
|
||||||
|
|
||||||
export interface DemoConfig {
|
export interface DemoConfig {
|
||||||
index?: number;
|
index?: number;
|
||||||
|
@@ -1,14 +1,15 @@
|
|||||||
import { mdiTelevision } from "@mdi/js";
|
import { mdiTelevision } from "@mdi/js";
|
||||||
import { css, CSSResultGroup, html, LitElement, nothing } from "lit";
|
import type { CSSResultGroup } from "lit";
|
||||||
|
import { css, html, LitElement, nothing } from "lit";
|
||||||
import { customElement, state } from "lit/decorators";
|
import { customElement, state } from "lit/decorators";
|
||||||
import { CastManager } from "../../../src/cast/cast_manager";
|
import type { CastManager } from "../../../src/cast/cast_manager";
|
||||||
import { castSendShowDemo } from "../../../src/cast/receiver_messages";
|
import { castSendShowDemo } from "../../../src/cast/receiver_messages";
|
||||||
import "../../../src/components/ha-icon";
|
import "../../../src/components/ha-icon";
|
||||||
import {
|
import type {
|
||||||
CastConfig,
|
CastConfig,
|
||||||
LovelaceRow,
|
LovelaceRow,
|
||||||
} from "../../../src/panels/lovelace/entity-rows/types";
|
} from "../../../src/panels/lovelace/entity-rows/types";
|
||||||
import { HomeAssistant } from "../../../src/types";
|
import type { HomeAssistant } from "../../../src/types";
|
||||||
|
|
||||||
@customElement("cast-demo-row")
|
@customElement("cast-demo-row")
|
||||||
class CastDemoRow extends LitElement implements LovelaceRow {
|
class CastDemoRow extends LitElement implements LovelaceRow {
|
||||||
|
@@ -1,13 +1,17 @@
|
|||||||
import { css, CSSResultGroup, html, LitElement, nothing } from "lit";
|
import type { CSSResultGroup } from "lit";
|
||||||
|
import { css, html, LitElement, nothing } from "lit";
|
||||||
import { customElement, property, state } from "lit/decorators";
|
import { customElement, property, state } from "lit/decorators";
|
||||||
import { until } from "lit/directives/until";
|
import { until } from "lit/directives/until";
|
||||||
import { fireEvent } from "../../../src/common/dom/fire_event";
|
import { fireEvent } from "../../../src/common/dom/fire_event";
|
||||||
import "../../../src/components/ha-card";
|
import "../../../src/components/ha-card";
|
||||||
import "../../../src/components/ha-button";
|
import "../../../src/components/ha-button";
|
||||||
import "../../../src/components/ha-circular-progress";
|
import "../../../src/components/ha-circular-progress";
|
||||||
import { LovelaceCardConfig } from "../../../src/data/lovelace/config/card";
|
import type { LovelaceCardConfig } from "../../../src/data/lovelace/config/card";
|
||||||
import { MockHomeAssistant } from "../../../src/fake_data/provide_hass";
|
import type { MockHomeAssistant } from "../../../src/fake_data/provide_hass";
|
||||||
import { Lovelace, LovelaceCard } from "../../../src/panels/lovelace/types";
|
import type {
|
||||||
|
Lovelace,
|
||||||
|
LovelaceCard,
|
||||||
|
} from "../../../src/panels/lovelace/types";
|
||||||
import {
|
import {
|
||||||
demoConfigs,
|
demoConfigs,
|
||||||
selectedDemoConfig,
|
selectedDemoConfig,
|
||||||
|
@@ -3,12 +3,10 @@ import "../../src/resources/compatibility";
|
|||||||
import { customElement } from "lit/decorators";
|
import { customElement } from "lit/decorators";
|
||||||
import { isNavigationClick } from "../../src/common/dom/is-navigation-click";
|
import { isNavigationClick } from "../../src/common/dom/is-navigation-click";
|
||||||
import { navigate } from "../../src/common/navigate";
|
import { navigate } from "../../src/common/navigate";
|
||||||
import {
|
import type { MockHomeAssistant } from "../../src/fake_data/provide_hass";
|
||||||
MockHomeAssistant,
|
import { provideHass } from "../../src/fake_data/provide_hass";
|
||||||
provideHass,
|
|
||||||
} from "../../src/fake_data/provide_hass";
|
|
||||||
import { HomeAssistantAppEl } from "../../src/layouts/home-assistant";
|
import { HomeAssistantAppEl } from "../../src/layouts/home-assistant";
|
||||||
import { HomeAssistant } from "../../src/types";
|
import type { HomeAssistant } from "../../src/types";
|
||||||
import { selectedDemoConfig } from "./configs/demo-configs";
|
import { selectedDemoConfig } from "./configs/demo-configs";
|
||||||
import { mockAreaRegistry } from "./stubs/area_registry";
|
import { mockAreaRegistry } from "./stubs/area_registry";
|
||||||
import { mockAuth } from "./stubs/auth";
|
import { mockAuth } from "./stubs/auth";
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
import { AreaRegistryEntry } from "../../../src/data/area_registry";
|
import type { AreaRegistryEntry } from "../../../src/data/area_registry";
|
||||||
import type { MockHomeAssistant } from "../../../src/fake_data/provide_hass";
|
import type { MockHomeAssistant } from "../../../src/fake_data/provide_hass";
|
||||||
|
|
||||||
export const mockAreaRegistry = (
|
export const mockAreaRegistry = (
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
import { MockHomeAssistant } from "../../../src/fake_data/provide_hass";
|
import type { MockHomeAssistant } from "../../../src/fake_data/provide_hass";
|
||||||
|
|
||||||
export const mockAuth = (hass: MockHomeAssistant) => {
|
export const mockAuth = (hass: MockHomeAssistant) => {
|
||||||
hass.mockWS("config/auth/list", () => []);
|
hass.mockWS("config/auth/list", () => []);
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
import { MockHomeAssistant } from "../../../src/fake_data/provide_hass";
|
import type { MockHomeAssistant } from "../../../src/fake_data/provide_hass";
|
||||||
|
|
||||||
export const mockConfig = (hass: MockHomeAssistant) => {
|
export const mockConfig = (hass: MockHomeAssistant) => {
|
||||||
hass.mockWS("validate_config", () => ({
|
hass.mockWS("validate_config", () => ({
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
import { MockHomeAssistant } from "../../../src/fake_data/provide_hass";
|
import type { MockHomeAssistant } from "../../../src/fake_data/provide_hass";
|
||||||
|
|
||||||
export const mockConfigEntries = (hass: MockHomeAssistant) => {
|
export const mockConfigEntries = (hass: MockHomeAssistant) => {
|
||||||
hass.mockWS("config_entries/get", () => ({
|
hass.mockWS("config_entries/get", () => ({
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
import { DeviceRegistryEntry } from "../../../src/data/device_registry";
|
import type { DeviceRegistryEntry } from "../../../src/data/device_registry";
|
||||||
import type { MockHomeAssistant } from "../../../src/fake_data/provide_hass";
|
import type { MockHomeAssistant } from "../../../src/fake_data/provide_hass";
|
||||||
|
|
||||||
export const mockDeviceRegistry = (
|
export const mockDeviceRegistry = (
|
||||||
|
@@ -1,11 +1,11 @@
|
|||||||
import { format, startOfToday, startOfTomorrow } from "date-fns";
|
import { format, startOfToday, startOfTomorrow } from "date-fns";
|
||||||
import {
|
import type {
|
||||||
EnergyInfo,
|
EnergyInfo,
|
||||||
EnergyPreferences,
|
EnergyPreferences,
|
||||||
EnergySolarForecasts,
|
EnergySolarForecasts,
|
||||||
FossilEnergyConsumption,
|
FossilEnergyConsumption,
|
||||||
} from "../../../src/data/energy";
|
} from "../../../src/data/energy";
|
||||||
import { MockHomeAssistant } from "../../../src/fake_data/provide_hass";
|
import type { MockHomeAssistant } from "../../../src/fake_data/provide_hass";
|
||||||
|
|
||||||
export const mockEnergy = (hass: MockHomeAssistant) => {
|
export const mockEnergy = (hass: MockHomeAssistant) => {
|
||||||
hass.mockWS(
|
hass.mockWS(
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
import { EntityRegistryEntry } from "../../../src/data/entity_registry";
|
import type { EntityRegistryEntry } from "../../../src/data/entity_registry";
|
||||||
import type { MockHomeAssistant } from "../../../src/fake_data/provide_hass";
|
import type { MockHomeAssistant } from "../../../src/fake_data/provide_hass";
|
||||||
|
|
||||||
export const mockEntityRegistry = (
|
export const mockEntityRegistry = (
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
import { MockHomeAssistant } from "../../../src/fake_data/provide_hass";
|
import type { MockHomeAssistant } from "../../../src/fake_data/provide_hass";
|
||||||
|
|
||||||
export const mockEvents = (hass: MockHomeAssistant) => {
|
export const mockEvents = (hass: MockHomeAssistant) => {
|
||||||
hass.mockAPI("events", () => []);
|
hass.mockAPI("events", () => []);
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
import { FloorRegistryEntry } from "../../../src/data/floor_registry";
|
import type { FloorRegistryEntry } from "../../../src/data/floor_registry";
|
||||||
import type { MockHomeAssistant } from "../../../src/fake_data/provide_hass";
|
import type { MockHomeAssistant } from "../../../src/fake_data/provide_hass";
|
||||||
|
|
||||||
export const mockFloorRegistry = (
|
export const mockFloorRegistry = (
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
import { MockHomeAssistant } from "../../../src/fake_data/provide_hass";
|
import type { MockHomeAssistant } from "../../../src/fake_data/provide_hass";
|
||||||
|
|
||||||
export const mockFrontend = (hass: MockHomeAssistant) => {
|
export const mockFrontend = (hass: MockHomeAssistant) => {
|
||||||
hass.mockWS("frontend/get_user_data", () => ({
|
hass.mockWS("frontend/get_user_data", () => ({
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
import { HassioSupervisorInfo } from "../../../src/data/hassio/supervisor";
|
import type { HassioSupervisorInfo } from "../../../src/data/hassio/supervisor";
|
||||||
import type { MockHomeAssistant } from "../../../src/fake_data/provide_hass";
|
import type { MockHomeAssistant } from "../../../src/fake_data/provide_hass";
|
||||||
|
|
||||||
export const mockHassioSupervisor = (hass: MockHomeAssistant) => {
|
export const mockHassioSupervisor = (hass: MockHomeAssistant) => {
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
import { HassEntity } from "home-assistant-js-websocket";
|
import type { HassEntity } from "home-assistant-js-websocket";
|
||||||
import { HistoryStates } from "../../../src/data/history";
|
import type { HistoryStates } from "../../../src/data/history";
|
||||||
import { MockHomeAssistant } from "../../../src/fake_data/provide_hass";
|
import type { MockHomeAssistant } from "../../../src/fake_data/provide_hass";
|
||||||
|
|
||||||
const generateStateHistory = (
|
const generateStateHistory = (
|
||||||
state: HassEntity,
|
state: HassEntity,
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
import { IconCategory } from "../../../src/data/icons";
|
import type { IconCategory } from "../../../src/data/icons";
|
||||||
import { ENTITY_COMPONENT_ICONS } from "../../../src/fake_data/entity_component_icons";
|
import { ENTITY_COMPONENT_ICONS } from "../../../src/fake_data/entity_component_icons";
|
||||||
import { MockHomeAssistant } from "../../../src/fake_data/provide_hass";
|
import type { MockHomeAssistant } from "../../../src/fake_data/provide_hass";
|
||||||
|
|
||||||
export const mockIcons = (hass: MockHomeAssistant) => {
|
export const mockIcons = (hass: MockHomeAssistant) => {
|
||||||
hass.mockWS(
|
hass.mockWS(
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
import { LabelRegistryEntry } from "../../../src/data/label_registry";
|
import type { LabelRegistryEntry } from "../../../src/data/label_registry";
|
||||||
import type { MockHomeAssistant } from "../../../src/fake_data/provide_hass";
|
import type { MockHomeAssistant } from "../../../src/fake_data/provide_hass";
|
||||||
|
|
||||||
export const mockLabelRegistry = (
|
export const mockLabelRegistry = (
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
import { MockHomeAssistant } from "../../../src/fake_data/provide_hass";
|
import type { MockHomeAssistant } from "../../../src/fake_data/provide_hass";
|
||||||
|
|
||||||
export const mockMediaPlayer = (hass: MockHomeAssistant) => {
|
export const mockMediaPlayer = (hass: MockHomeAssistant) => {
|
||||||
hass.mockWS("media_player_thumbnail", () => Promise.reject());
|
hass.mockWS("media_player_thumbnail", () => Promise.reject());
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
import { PersistentNotificationMessage } from "../../../src/data/persistent_notification";
|
import type { PersistentNotificationMessage } from "../../../src/data/persistent_notification";
|
||||||
import { MockHomeAssistant } from "../../../src/fake_data/provide_hass";
|
import type { MockHomeAssistant } from "../../../src/fake_data/provide_hass";
|
||||||
|
|
||||||
export const mockPersistentNotification = (hass: MockHomeAssistant) => {
|
export const mockPersistentNotification = (hass: MockHomeAssistant) => {
|
||||||
hass.mockWS("persistent_notification/subscribe", (_msg, _hass, onChange) => {
|
hass.mockWS("persistent_notification/subscribe", (_msg, _hass, onChange) => {
|
||||||
|
@@ -5,12 +5,12 @@ import {
|
|||||||
differenceInHours,
|
differenceInHours,
|
||||||
endOfDay,
|
endOfDay,
|
||||||
} from "date-fns";
|
} from "date-fns";
|
||||||
import {
|
import type {
|
||||||
Statistics,
|
Statistics,
|
||||||
StatisticsMetaData,
|
StatisticsMetaData,
|
||||||
StatisticValue,
|
StatisticValue,
|
||||||
} from "../../../src/data/recorder";
|
} from "../../../src/data/recorder";
|
||||||
import { MockHomeAssistant } from "../../../src/fake_data/provide_hass";
|
import type { MockHomeAssistant } from "../../../src/fake_data/provide_hass";
|
||||||
|
|
||||||
const generateMeanStatistics = (
|
const generateMeanStatistics = (
|
||||||
start: Date,
|
start: Date,
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
import { MockHomeAssistant } from "../../../src/fake_data/provide_hass";
|
import type { MockHomeAssistant } from "../../../src/fake_data/provide_hass";
|
||||||
|
|
||||||
export const mockSensor = (hass: MockHomeAssistant) => {
|
export const mockSensor = (hass: MockHomeAssistant) => {
|
||||||
hass.mockWS("sensor/numeric_device_classes", () => [
|
hass.mockWS("sensor/numeric_device_classes", () => [
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
import { MockHomeAssistant } from "../../../src/fake_data/provide_hass";
|
import type { MockHomeAssistant } from "../../../src/fake_data/provide_hass";
|
||||||
|
|
||||||
export const mockSystemLog = (hass: MockHomeAssistant) => {
|
export const mockSystemLog = (hass: MockHomeAssistant) => {
|
||||||
hass.mockAPI("error/all", () => []);
|
hass.mockAPI("error/all", () => []);
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
import { Tag } from "../../../src/data/tag";
|
import type { Tag } from "../../../src/data/tag";
|
||||||
import { MockHomeAssistant } from "../../../src/fake_data/provide_hass";
|
import type { MockHomeAssistant } from "../../../src/fake_data/provide_hass";
|
||||||
|
|
||||||
export const mockTags = (hass: MockHomeAssistant) => {
|
export const mockTags = (hass: MockHomeAssistant) => {
|
||||||
hass.mockWS("tag/list", () => [{ id: "my-tag", name: "My Tag" }] as Tag[]);
|
hass.mockWS("tag/list", () => [{ id: "my-tag", name: "My Tag" }] as Tag[]);
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
import { MockHomeAssistant } from "../../../src/fake_data/provide_hass";
|
import type { MockHomeAssistant } from "../../../src/fake_data/provide_hass";
|
||||||
|
|
||||||
export const mockTemplate = (hass: MockHomeAssistant) => {
|
export const mockTemplate = (hass: MockHomeAssistant) => {
|
||||||
hass.mockAPI("template", () =>
|
hass.mockAPI("template", () =>
|
||||||
|
@@ -1,5 +1,6 @@
|
|||||||
import { TodoItem, TodoItemStatus } from "../../../src/data/todo";
|
import type { TodoItem } from "../../../src/data/todo";
|
||||||
import { MockHomeAssistant } from "../../../src/fake_data/provide_hass";
|
import { TodoItemStatus } from "../../../src/data/todo";
|
||||||
|
import type { MockHomeAssistant } from "../../../src/fake_data/provide_hass";
|
||||||
|
|
||||||
export const mockTodo = (hass: MockHomeAssistant) => {
|
export const mockTodo = (hass: MockHomeAssistant) => {
|
||||||
hass.mockWS("todo/item/list", () => ({
|
hass.mockWS("todo/item/list", () => ({
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
import { MockHomeAssistant } from "../../../src/fake_data/provide_hass";
|
import type { MockHomeAssistant } from "../../../src/fake_data/provide_hass";
|
||||||
|
|
||||||
export const mockTranslations = (hass: MockHomeAssistant) => {
|
export const mockTranslations = (hass: MockHomeAssistant) => {
|
||||||
hass.mockWS(
|
hass.mockWS(
|
||||||
|
@@ -1,10 +0,0 @@
|
|||||||
import rollup from "../build-scripts/rollup.cjs";
|
|
||||||
import env from "../build-scripts/env.cjs";
|
|
||||||
|
|
||||||
const config = rollup.createGalleryConfig({
|
|
||||||
isProdBuild: env.isProdBuild(),
|
|
||||||
latestBuild: true,
|
|
||||||
isStatsBuild: env.isStatsBuild(),
|
|
||||||
});
|
|
||||||
|
|
||||||
export default { ...config.inputOptions, output: config.outputOptions };
|
|
@@ -1,5 +1,7 @@
|
|||||||
import { Button } from "@material/mwc-button";
|
import "@material/mwc-button/mwc-button";
|
||||||
import { html, LitElement, css, TemplateResult, nothing } from "lit";
|
import type { Button } from "@material/mwc-button";
|
||||||
|
import type { TemplateResult } from "lit";
|
||||||
|
import { html, LitElement, css, nothing } from "lit";
|
||||||
import { customElement, property } from "lit/decorators";
|
import { customElement, property } from "lit/decorators";
|
||||||
import { applyThemesOnElement } from "../../../src/common/dom/apply_themes_on_element";
|
import { applyThemesOnElement } from "../../../src/common/dom/apply_themes_on_element";
|
||||||
import { fireEvent } from "../../../src/common/dom/fire_event";
|
import { fireEvent } from "../../../src/common/dom/fire_event";
|
||||||
|
@@ -1,10 +1,11 @@
|
|||||||
import { load } from "js-yaml";
|
import { load } from "js-yaml";
|
||||||
import { LitElement, PropertyValueMap, css, html, nothing } from "lit";
|
import type { PropertyValueMap } from "lit";
|
||||||
|
import { LitElement, css, html, nothing } from "lit";
|
||||||
import { customElement, property, query, state } from "lit/decorators";
|
import { customElement, property, query, state } from "lit/decorators";
|
||||||
import memoizeOne from "memoize-one";
|
import memoizeOne from "memoize-one";
|
||||||
import "../../../src/panels/lovelace/cards/hui-card";
|
import "../../../src/panels/lovelace/cards/hui-card";
|
||||||
import type { HuiCard } from "../../../src/panels/lovelace/cards/hui-card";
|
import type { HuiCard } from "../../../src/panels/lovelace/cards/hui-card";
|
||||||
import { HomeAssistant } from "../../../src/types";
|
import type { HomeAssistant } from "../../../src/types";
|
||||||
|
|
||||||
export interface DemoCardConfig {
|
export interface DemoCardConfig {
|
||||||
heading: string;
|
heading: string;
|
||||||
|
@@ -3,7 +3,7 @@ import { customElement, property, query, state } from "lit/decorators";
|
|||||||
import { applyThemesOnElement } from "../../../src/common/dom/apply_themes_on_element";
|
import { applyThemesOnElement } from "../../../src/common/dom/apply_themes_on_element";
|
||||||
import "../../../src/components/ha-formfield";
|
import "../../../src/components/ha-formfield";
|
||||||
import "../../../src/components/ha-switch";
|
import "../../../src/components/ha-switch";
|
||||||
import { HomeAssistant } from "../../../src/types";
|
import type { HomeAssistant } from "../../../src/types";
|
||||||
import "./demo-card";
|
import "./demo-card";
|
||||||
import type { DemoCardConfig } from "./demo-card";
|
import type { DemoCardConfig } from "./demo-card";
|
||||||
import "../ha-demo-options";
|
import "../ha-demo-options";
|
||||||
|
@@ -4,7 +4,7 @@ import "../../../src/components/ha-card";
|
|||||||
import "../../../src/dialogs/more-info/more-info-content";
|
import "../../../src/dialogs/more-info/more-info-content";
|
||||||
import "../../../src/state-summary/state-card-content";
|
import "../../../src/state-summary/state-card-content";
|
||||||
import "../ha-demo-options";
|
import "../ha-demo-options";
|
||||||
import { HomeAssistant } from "../../../src/types";
|
import type { HomeAssistant } from "../../../src/types";
|
||||||
|
|
||||||
@customElement("demo-more-info")
|
@customElement("demo-more-info")
|
||||||
class DemoMoreInfo extends LitElement {
|
class DemoMoreInfo extends LitElement {
|
||||||
|
@@ -3,7 +3,7 @@ import { customElement, property, state } from "lit/decorators";
|
|||||||
import { applyThemesOnElement } from "../../../src/common/dom/apply_themes_on_element";
|
import { applyThemesOnElement } from "../../../src/common/dom/apply_themes_on_element";
|
||||||
import "../../../src/components/ha-formfield";
|
import "../../../src/components/ha-formfield";
|
||||||
import "../../../src/components/ha-switch";
|
import "../../../src/components/ha-switch";
|
||||||
import { HomeAssistant } from "../../../src/types";
|
import type { HomeAssistant } from "../../../src/types";
|
||||||
import "../ha-demo-options";
|
import "../ha-demo-options";
|
||||||
import "./demo-more-info";
|
import "./demo-more-info";
|
||||||
|
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
import { DemoTrace } from "./types";
|
import type { DemoTrace } from "./types";
|
||||||
|
|
||||||
export const basicTrace: DemoTrace = {
|
export const basicTrace: DemoTrace = {
|
||||||
trace: {
|
trace: {
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
import { LogbookEntry } from "../../../../src/data/logbook";
|
import type { LogbookEntry } from "../../../../src/data/logbook";
|
||||||
import { AutomationTraceExtended } from "../../../../src/data/trace";
|
import type { AutomationTraceExtended } from "../../../../src/data/trace";
|
||||||
import { DemoTrace } from "./types";
|
import type { DemoTrace } from "./types";
|
||||||
|
|
||||||
export const mockDemoTrace = (
|
export const mockDemoTrace = (
|
||||||
tracePartial: Partial<AutomationTraceExtended>,
|
tracePartial: Partial<AutomationTraceExtended>,
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
import { DemoTrace } from "./types";
|
import type { DemoTrace } from "./types";
|
||||||
|
|
||||||
export const motionLightTrace: DemoTrace = {
|
export const motionLightTrace: DemoTrace = {
|
||||||
trace: {
|
trace: {
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
import { AutomationTraceExtended } from "../../../../src/data/trace";
|
import type { AutomationTraceExtended } from "../../../../src/data/trace";
|
||||||
import { LogbookEntry } from "../../../../src/data/logbook";
|
import type { LogbookEntry } from "../../../../src/data/logbook";
|
||||||
|
|
||||||
export interface DemoTrace {
|
export interface DemoTrace {
|
||||||
trace: AutomationTraceExtended;
|
trace: AutomationTraceExtended;
|
||||||
|
@@ -1,7 +1,8 @@
|
|||||||
import "@material/mwc-drawer";
|
import "@material/mwc-drawer";
|
||||||
import "@material/mwc-top-app-bar-fixed";
|
import "@material/mwc-top-app-bar-fixed";
|
||||||
import { mdiMenu } from "@mdi/js";
|
import { mdiMenu } from "@mdi/js";
|
||||||
import { LitElement, PropertyValues, css, html } from "lit";
|
import type { PropertyValues } from "lit";
|
||||||
|
import { LitElement, css, html } from "lit";
|
||||||
import { customElement, query, state } from "lit/decorators";
|
import { customElement, query, state } from "lit/decorators";
|
||||||
import { dynamicElement } from "../../src/common/dom/dynamic-element-directive";
|
import { dynamicElement } from "../../src/common/dom/dynamic-element-directive";
|
||||||
import { HaExpansionPanel } from "../../src/components/ha-expansion-panel";
|
import { HaExpansionPanel } from "../../src/components/ha-expansion-panel";
|
||||||
|
@@ -3,11 +3,11 @@ import { css, html, LitElement, nothing } from "lit";
|
|||||||
import { customElement, property, state } from "lit/decorators";
|
import { customElement, property, state } from "lit/decorators";
|
||||||
import "../../../../src/components/ha-card";
|
import "../../../../src/components/ha-card";
|
||||||
import "../../../../src/components/ha-yaml-editor";
|
import "../../../../src/components/ha-yaml-editor";
|
||||||
import { Action } from "../../../../src/data/script";
|
import type { Action } from "../../../../src/data/script";
|
||||||
import { describeAction } from "../../../../src/data/script_i18n";
|
import { describeAction } from "../../../../src/data/script_i18n";
|
||||||
import { getEntity } from "../../../../src/fake_data/entity";
|
import { getEntity } from "../../../../src/fake_data/entity";
|
||||||
import { provideHass } from "../../../../src/fake_data/provide_hass";
|
import { provideHass } from "../../../../src/fake_data/provide_hass";
|
||||||
import { HomeAssistant } from "../../../../src/types";
|
import type { HomeAssistant } from "../../../../src/types";
|
||||||
|
|
||||||
const ENTITIES = [
|
const ENTITIES = [
|
||||||
getEntity("scene", "kitchen_morning", "scening", {
|
getEntity("scene", "kitchen_morning", "scening", {
|
||||||
@@ -142,7 +142,7 @@ export class DemoAutomationDescribeAction extends LitElement {
|
|||||||
<div class="action">
|
<div class="action">
|
||||||
<span>
|
<span>
|
||||||
${this._action
|
${this._action
|
||||||
? describeAction(this.hass, [], [], this._action)
|
? describeAction(this.hass, [], [], {}, this._action)
|
||||||
: "<invalid YAML>"}
|
: "<invalid YAML>"}
|
||||||
</span>
|
</span>
|
||||||
<ha-yaml-editor
|
<ha-yaml-editor
|
||||||
@@ -155,7 +155,7 @@ export class DemoAutomationDescribeAction extends LitElement {
|
|||||||
${ACTIONS.map(
|
${ACTIONS.map(
|
||||||
(conf) => html`
|
(conf) => html`
|
||||||
<div class="action">
|
<div class="action">
|
||||||
<span>${describeAction(this.hass, [], [], conf as any)}</span>
|
<span>${describeAction(this.hass, [], [], {}, conf as any)}</span>
|
||||||
<pre>${dump(conf)}</pre>
|
<pre>${dump(conf)}</pre>
|
||||||
</div>
|
</div>
|
||||||
`
|
`
|
||||||
|
@@ -3,11 +3,11 @@ import { css, html, LitElement, nothing } from "lit";
|
|||||||
import { customElement, property, state } from "lit/decorators";
|
import { customElement, property, state } from "lit/decorators";
|
||||||
import "../../../../src/components/ha-card";
|
import "../../../../src/components/ha-card";
|
||||||
import "../../../../src/components/ha-yaml-editor";
|
import "../../../../src/components/ha-yaml-editor";
|
||||||
import { Condition } from "../../../../src/data/automation";
|
import type { Condition } from "../../../../src/data/automation";
|
||||||
import { describeCondition } from "../../../../src/data/automation_i18n";
|
import { describeCondition } from "../../../../src/data/automation_i18n";
|
||||||
import { getEntity } from "../../../../src/fake_data/entity";
|
import { getEntity } from "../../../../src/fake_data/entity";
|
||||||
import { provideHass } from "../../../../src/fake_data/provide_hass";
|
import { provideHass } from "../../../../src/fake_data/provide_hass";
|
||||||
import { HomeAssistant } from "../../../../src/types";
|
import type { HomeAssistant } from "../../../../src/types";
|
||||||
|
|
||||||
const ENTITIES = [
|
const ENTITIES = [
|
||||||
getEntity("light", "kitchen", "on", {
|
getEntity("light", "kitchen", "on", {
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user