mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-26 02:36:37 +00:00
20241030.0 (#22599)
This commit is contained in:
commit
79e223cf8e
@ -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.0
|
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.0
|
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
|
||||||
|
22
.github/workflows/ci.yaml
vendored
22
.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.0
|
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.0.2
|
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.0
|
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.0
|
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
|
||||||
@ -89,7 +89,7 @@ jobs:
|
|||||||
env:
|
env:
|
||||||
IS_TEST: "true"
|
IS_TEST: "true"
|
||||||
- name: Upload bundle stats
|
- name: Upload bundle stats
|
||||||
uses: actions/upload-artifact@v4.4.0
|
uses: actions/upload-artifact@v4.4.3
|
||||||
with:
|
with:
|
||||||
name: frontend-bundle-stats
|
name: frontend-bundle-stats
|
||||||
path: build/stats/*.json
|
path: build/stats/*.json
|
||||||
@ -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.0
|
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
|
||||||
@ -113,7 +113,7 @@ jobs:
|
|||||||
env:
|
env:
|
||||||
IS_TEST: "true"
|
IS_TEST: "true"
|
||||||
- name: Upload bundle stats
|
- name: Upload bundle stats
|
||||||
uses: actions/upload-artifact@v4.4.0
|
uses: actions/upload-artifact@v4.4.3
|
||||||
with:
|
with:
|
||||||
name: supervisor-bundle-stats
|
name: supervisor-bundle-stats
|
||||||
path: build/stats/*.json
|
path: build/stats/*.json
|
||||||
|
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.0
|
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.0
|
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.0
|
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.0
|
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.0
|
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
|
||||||
|
8
.github/workflows/nightly.yaml
vendored
8
.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.0
|
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
|
||||||
@ -57,14 +57,14 @@ jobs:
|
|||||||
run: tar -czvf translations.tar.gz translations
|
run: tar -czvf translations.tar.gz translations
|
||||||
|
|
||||||
- name: Upload build artifacts
|
- name: Upload build artifacts
|
||||||
uses: actions/upload-artifact@v4.4.0
|
uses: actions/upload-artifact@v4.4.3
|
||||||
with:
|
with:
|
||||||
name: wheels
|
name: wheels
|
||||||
path: dist/home_assistant_frontend*.whl
|
path: dist/home_assistant_frontend*.whl
|
||||||
if-no-files-found: error
|
if-no-files-found: error
|
||||||
|
|
||||||
- name: Upload translations
|
- name: Upload translations
|
||||||
uses: actions/upload-artifact@v4.4.0
|
uses: actions/upload-artifact@v4.4.3
|
||||||
with:
|
with:
|
||||||
name: translations
|
name: translations
|
||||||
path: translations.tar.gz
|
path: translations.tar.gz
|
||||||
|
4
.github/workflows/release.yaml
vendored
4
.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.0
|
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
|
||||||
|
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.0
|
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
|
||||||
|
@ -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) {
|
||||||
|
@ -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,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-container
|
||||||
|
.hass=${this.hass}
|
||||||
|
.background=${background}
|
||||||
|
.theme=${viewConfig.theme}
|
||||||
|
>
|
||||||
<hui-view
|
<hui-view
|
||||||
.hass=${this.hass}
|
.hass=${this.hass}
|
||||||
.lovelace=${lovelace}
|
.lovelace=${lovelace}
|
||||||
.index=${index}
|
.index=${index}
|
||||||
></hui-view>
|
></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,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,5 +1,5 @@
|
|||||||
import { html } from "lit";
|
import { html } from "lit";
|
||||||
import { DemoConfig } from "../types";
|
import type { DemoConfig } from "../types";
|
||||||
|
|
||||||
export const demoLovelaceDescription: DemoConfig["description"] = (
|
export const demoLovelaceDescription: DemoConfig["description"] = (
|
||||||
localize
|
localize
|
||||||
|
@ -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,4 +1,4 @@
|
|||||||
import { DemoConfig } from "../types";
|
import type { DemoConfig } from "../types";
|
||||||
import { demoLovelaceDescription } from "./description";
|
import { demoLovelaceDescription } from "./description";
|
||||||
import { demoEntitiesSections } from "./entities";
|
import { demoEntitiesSections } from "./entities";
|
||||||
import { demoLovelaceSections } from "./lovelace";
|
import { demoLovelaceSections } from "./lovelace";
|
||||||
|
@ -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,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", {
|
||||||
|
@ -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 { Trigger } from "../../../../src/data/automation";
|
import type { Trigger } from "../../../../src/data/automation";
|
||||||
import { describeTrigger } from "../../../../src/data/automation_i18n";
|
import { describeTrigger } 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", {
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
/* eslint-disable lit/no-template-arrow */
|
/* eslint-disable lit/no-template-arrow */
|
||||||
import { LitElement, TemplateResult, html, css } from "lit";
|
import type { TemplateResult } from "lit";
|
||||||
|
import { LitElement, html, css } from "lit";
|
||||||
import { customElement, state } from "lit/decorators";
|
import { customElement, state } from "lit/decorators";
|
||||||
import { provideHass } from "../../../../src/fake_data/provide_hass";
|
import { provideHass } from "../../../../src/fake_data/provide_hass";
|
||||||
import type { HomeAssistant } from "../../../../src/types";
|
import type { HomeAssistant } from "../../../../src/types";
|
||||||
@ -18,7 +19,7 @@ import { HaSceneAction } from "../../../../src/panels/config/automation/action/t
|
|||||||
import { HaServiceAction } from "../../../../src/panels/config/automation/action/types/ha-automation-action-service";
|
import { HaServiceAction } from "../../../../src/panels/config/automation/action/types/ha-automation-action-service";
|
||||||
import { HaWaitForTriggerAction } from "../../../../src/panels/config/automation/action/types/ha-automation-action-wait_for_trigger";
|
import { HaWaitForTriggerAction } from "../../../../src/panels/config/automation/action/types/ha-automation-action-wait_for_trigger";
|
||||||
import { HaWaitAction } from "../../../../src/panels/config/automation/action/types/ha-automation-action-wait_template";
|
import { HaWaitAction } from "../../../../src/panels/config/automation/action/types/ha-automation-action-wait_template";
|
||||||
import { Action } from "../../../../src/data/script";
|
import type { Action } from "../../../../src/data/script";
|
||||||
import { HaConditionAction } from "../../../../src/panels/config/automation/action/types/ha-automation-action-condition";
|
import { HaConditionAction } from "../../../../src/panels/config/automation/action/types/ha-automation-action-condition";
|
||||||
import { HaSequenceAction } from "../../../../src/panels/config/automation/action/types/ha-automation-action-sequence";
|
import { HaSequenceAction } from "../../../../src/panels/config/automation/action/types/ha-automation-action-sequence";
|
||||||
import { HaParallelAction } from "../../../../src/panels/config/automation/action/types/ha-automation-action-parallel";
|
import { HaParallelAction } from "../../../../src/panels/config/automation/action/types/ha-automation-action-parallel";
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
/* eslint-disable lit/no-template-arrow */
|
/* eslint-disable lit/no-template-arrow */
|
||||||
import { LitElement, TemplateResult, html, css } from "lit";
|
import type { TemplateResult } from "lit";
|
||||||
|
import { LitElement, html, css } from "lit";
|
||||||
import { customElement, state } from "lit/decorators";
|
import { customElement, state } from "lit/decorators";
|
||||||
import { provideHass } from "../../../../src/fake_data/provide_hass";
|
import { provideHass } from "../../../../src/fake_data/provide_hass";
|
||||||
import type { HomeAssistant } from "../../../../src/types";
|
import type { HomeAssistant } from "../../../../src/types";
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
/* eslint-disable lit/no-template-arrow */
|
/* eslint-disable lit/no-template-arrow */
|
||||||
import { LitElement, TemplateResult, html, css } from "lit";
|
import type { TemplateResult } from "lit";
|
||||||
|
import { LitElement, html, css } from "lit";
|
||||||
import { customElement, state } from "lit/decorators";
|
import { customElement, state } from "lit/decorators";
|
||||||
import { provideHass } from "../../../../src/fake_data/provide_hass";
|
import { provideHass } from "../../../../src/fake_data/provide_hass";
|
||||||
import type { HomeAssistant } from "../../../../src/types";
|
import type { HomeAssistant } from "../../../../src/types";
|
||||||
|
@ -5,9 +5,9 @@ import { customElement, property } from "lit/decorators";
|
|||||||
import "../../../../src/components/ha-card";
|
import "../../../../src/components/ha-card";
|
||||||
import "../../../../src/components/trace/hat-trace-timeline";
|
import "../../../../src/components/trace/hat-trace-timeline";
|
||||||
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";
|
||||||
import { mockDemoTrace } from "../../data/traces/mock-demo-trace";
|
import { mockDemoTrace } from "../../data/traces/mock-demo-trace";
|
||||||
import { DemoTrace } from "../../data/traces/types";
|
import type { DemoTrace } from "../../data/traces/types";
|
||||||
|
|
||||||
const traces: DemoTrace[] = [
|
const traces: DemoTrace[] = [
|
||||||
mockDemoTrace({ state: "running" }),
|
mockDemoTrace({ state: "running" }),
|
||||||
|
@ -6,10 +6,10 @@ import "../../../../src/components/ha-card";
|
|||||||
import "../../../../src/components/trace/hat-script-graph";
|
import "../../../../src/components/trace/hat-script-graph";
|
||||||
import "../../../../src/components/trace/hat-trace-timeline";
|
import "../../../../src/components/trace/hat-trace-timeline";
|
||||||
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";
|
||||||
import { basicTrace } from "../../data/traces/basic_trace";
|
import { basicTrace } from "../../data/traces/basic_trace";
|
||||||
import { motionLightTrace } from "../../data/traces/motion-light-trace";
|
import { motionLightTrace } from "../../data/traces/motion-light-trace";
|
||||||
import { DemoTrace } from "../../data/traces/types";
|
import type { DemoTrace } from "../../data/traces/types";
|
||||||
|
|
||||||
const traces: DemoTrace[] = [basicTrace, motionLightTrace];
|
const traces: DemoTrace[] = [basicTrace, motionLightTrace];
|
||||||
|
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
import "@material/mwc-button/mwc-button";
|
import "@material/mwc-button/mwc-button";
|
||||||
import { css, html, LitElement, TemplateResult } from "lit";
|
import type { TemplateResult } from "lit";
|
||||||
|
import { css, html, LitElement } from "lit";
|
||||||
import { customElement } from "lit/decorators";
|
import { customElement } 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-alert";
|
import "../../../../src/components/ha-alert";
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
import { html, css, LitElement, TemplateResult } from "lit";
|
import type { TemplateResult } from "lit";
|
||||||
|
import { html, css, LitElement } from "lit";
|
||||||
import { customElement } from "lit/decorators";
|
import { customElement } from "lit/decorators";
|
||||||
import { classMap } from "lit/directives/class-map";
|
import { classMap } from "lit/directives/class-map";
|
||||||
import "../../../../src/components/ha-bar";
|
import "../../../../src/components/ha-bar";
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
import { css, html, LitElement, TemplateResult, nothing } from "lit";
|
import type { TemplateResult } from "lit";
|
||||||
|
import { css, html, LitElement, nothing } from "lit";
|
||||||
import { customElement } from "lit/decorators";
|
import { customElement } from "lit/decorators";
|
||||||
import "../../../../src/components/ha-card";
|
import "../../../../src/components/ha-card";
|
||||||
import "../../../../src/components/chips/ha-chip-set";
|
import "../../../../src/components/chips/ha-chip-set";
|
||||||
|
@ -1,10 +1,11 @@
|
|||||||
import { html, css, LitElement, TemplateResult } from "lit";
|
import type { TemplateResult } from "lit";
|
||||||
|
import { html, css, LitElement } from "lit";
|
||||||
import { customElement, property } from "lit/decorators";
|
import { customElement, property } from "lit/decorators";
|
||||||
import "../../../../src/components/ha-bar";
|
import "../../../../src/components/ha-bar";
|
||||||
import "../../../../src/components/ha-card";
|
import "../../../../src/components/ha-card";
|
||||||
import "../../../../src/components/ha-circular-progress";
|
import "../../../../src/components/ha-circular-progress";
|
||||||
import "@material/web/progress/circular-progress";
|
import "@material/web/progress/circular-progress";
|
||||||
import { HomeAssistant } from "../../../../src/types";
|
import type { HomeAssistant } from "../../../../src/types";
|
||||||
|
|
||||||
@customElement("demo-components-ha-circular-progress")
|
@customElement("demo-components-ha-circular-progress")
|
||||||
export class DemoHaCircularProgress extends LitElement {
|
export class DemoHaCircularProgress extends LitElement {
|
||||||
|
@ -4,7 +4,8 @@ import {
|
|||||||
mdiFanSpeed3,
|
mdiFanSpeed3,
|
||||||
mdiLightbulb,
|
mdiLightbulb,
|
||||||
} from "@mdi/js";
|
} from "@mdi/js";
|
||||||
import { css, html, LitElement, TemplateResult } from "lit";
|
import type { TemplateResult } from "lit";
|
||||||
|
import { css, html, LitElement } from "lit";
|
||||||
import { customElement } from "lit/decorators";
|
import { customElement } from "lit/decorators";
|
||||||
import { ifDefined } from "lit/directives/if-defined";
|
import { ifDefined } from "lit/directives/if-defined";
|
||||||
import { repeat } from "lit/directives/repeat";
|
import { repeat } from "lit/directives/repeat";
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
import { css, html, LitElement, TemplateResult } from "lit";
|
import type { TemplateResult } from "lit";
|
||||||
|
import { css, html, LitElement } from "lit";
|
||||||
import { customElement, state } from "lit/decorators";
|
import { customElement, state } from "lit/decorators";
|
||||||
import "../../../../src/components/ha-card";
|
import "../../../../src/components/ha-card";
|
||||||
import "../../../../src/components/ha-control-circular-slider";
|
import "../../../../src/components/ha-control-circular-slider";
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
import { LitElement, TemplateResult, css, html } from "lit";
|
import type { TemplateResult } from "lit";
|
||||||
|
import { LitElement, css, html } from "lit";
|
||||||
import { customElement, state } from "lit/decorators";
|
import { customElement, state } from "lit/decorators";
|
||||||
import "../../../../src/components/ha-card";
|
import "../../../../src/components/ha-card";
|
||||||
import "../../../../src/components/ha-control-number-buttons";
|
import "../../../../src/components/ha-control-number-buttons";
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
import { mdiFan, mdiFanSpeed1, mdiFanSpeed2, mdiFanSpeed3 } from "@mdi/js";
|
import { mdiFan, mdiFanSpeed1, mdiFanSpeed2, mdiFanSpeed3 } from "@mdi/js";
|
||||||
import { LitElement, TemplateResult, css, html, nothing } from "lit";
|
import type { TemplateResult } from "lit";
|
||||||
|
import { LitElement, css, html, nothing } from "lit";
|
||||||
import { customElement } from "lit/decorators";
|
import { customElement } from "lit/decorators";
|
||||||
import { repeat } from "lit/directives/repeat";
|
import { repeat } from "lit/directives/repeat";
|
||||||
import "../../../../src/components/ha-card";
|
import "../../../../src/components/ha-card";
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
import { mdiFanOff, mdiFanSpeed1, mdiFanSpeed2, mdiFanSpeed3 } from "@mdi/js";
|
import { mdiFanOff, mdiFanSpeed1, mdiFanSpeed2, mdiFanSpeed3 } from "@mdi/js";
|
||||||
import { css, html, LitElement, TemplateResult } from "lit";
|
import type { TemplateResult } from "lit";
|
||||||
|
import { css, html, LitElement } from "lit";
|
||||||
import { customElement, state } from "lit/decorators";
|
import { customElement, state } from "lit/decorators";
|
||||||
import { ifDefined } from "lit/directives/if-defined";
|
import { ifDefined } from "lit/directives/if-defined";
|
||||||
import { repeat } from "lit/directives/repeat";
|
import { repeat } from "lit/directives/repeat";
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
import { css, html, LitElement, TemplateResult } from "lit";
|
import type { TemplateResult } from "lit";
|
||||||
|
import { css, html, LitElement } from "lit";
|
||||||
import { customElement, state } from "lit/decorators";
|
import { customElement, state } from "lit/decorators";
|
||||||
import { ifDefined } from "lit/directives/if-defined";
|
import { ifDefined } from "lit/directives/if-defined";
|
||||||
import { repeat } from "lit/directives/repeat";
|
import { repeat } from "lit/directives/repeat";
|
||||||
|
@ -4,7 +4,8 @@ import {
|
|||||||
mdiLightbulb,
|
mdiLightbulb,
|
||||||
mdiLightbulbOff,
|
mdiLightbulbOff,
|
||||||
} from "@mdi/js";
|
} from "@mdi/js";
|
||||||
import { css, html, LitElement, TemplateResult } from "lit";
|
import type { TemplateResult } from "lit";
|
||||||
|
import { css, html, LitElement } from "lit";
|
||||||
import { customElement, state } from "lit/decorators";
|
import { customElement, state } from "lit/decorators";
|
||||||
import { ifDefined } from "lit/directives/if-defined";
|
import { ifDefined } from "lit/directives/if-defined";
|
||||||
import { repeat } from "lit/directives/repeat";
|
import { repeat } from "lit/directives/repeat";
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
import { mdiPacMan } from "@mdi/js";
|
import { mdiPacMan } from "@mdi/js";
|
||||||
import { css, html, LitElement, TemplateResult } from "lit";
|
import type { TemplateResult } from "lit";
|
||||||
|
import { css, html, LitElement } from "lit";
|
||||||
import { customElement } from "lit/decorators";
|
import { customElement } from "lit/decorators";
|
||||||
import "../../../../src/components/ha-card";
|
import "../../../../src/components/ha-card";
|
||||||
import "../../../../src/components/ha-expansion-panel";
|
import "../../../../src/components/ha-expansion-panel";
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
import { css, html, LitElement, TemplateResult } from "lit";
|
import type { TemplateResult } from "lit";
|
||||||
|
import { css, html, LitElement } from "lit";
|
||||||
import { customElement } from "lit/decorators";
|
import { customElement } from "lit/decorators";
|
||||||
import "../../../../src/components/ha-card";
|
import "../../../../src/components/ha-card";
|
||||||
import "../../../../src/components/ha-faded";
|
import "../../../../src/components/ha-faded";
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
/* eslint-disable lit/no-template-arrow */
|
/* eslint-disable lit/no-template-arrow */
|
||||||
import "@material/mwc-button";
|
import "@material/mwc-button";
|
||||||
import { html, LitElement, TemplateResult } from "lit";
|
import type { TemplateResult } from "lit";
|
||||||
|
import { html, LitElement } from "lit";
|
||||||
import { customElement, state } from "lit/decorators";
|
import { customElement, state } from "lit/decorators";
|
||||||
import { mockAreaRegistry } from "../../../../demo/src/stubs/area_registry";
|
import { mockAreaRegistry } from "../../../../demo/src/stubs/area_registry";
|
||||||
import { mockConfigEntries } from "../../../../demo/src/stubs/config_entries";
|
import { mockConfigEntries } from "../../../../demo/src/stubs/config_entries";
|
||||||
@ -13,9 +14,9 @@ import type { HaFormSchema } from "../../../../src/components/ha-form/types";
|
|||||||
import type { AreaRegistryEntry } from "../../../../src/data/area_registry";
|
import type { AreaRegistryEntry } from "../../../../src/data/area_registry";
|
||||||
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";
|
||||||
import "../../components/demo-black-white-row";
|
import "../../components/demo-black-white-row";
|
||||||
import { DeviceRegistryEntry } from "../../../../src/data/device_registry";
|
import type { DeviceRegistryEntry } from "../../../../src/data/device_registry";
|
||||||
|
|
||||||
const ENTITIES = [
|
const ENTITIES = [
|
||||||
getEntity("alarm_control_panel", "alarm", "disarmed", {
|
getEntity("alarm_control_panel", "alarm", "disarmed", {
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user