mirror of
https://github.com/home-assistant/frontend.git
synced 2025-04-24 13:27:22 +00:00
Lazy load our elements once again (#5124)
This commit is contained in:
parent
1c75fe3bb8
commit
906f417436
@ -3,18 +3,9 @@ import "../badges/hui-state-label-badge";
|
||||
import { LovelaceBadgeConfig } from "../../../data/lovelace";
|
||||
import { createLovelaceElement } from "./create-element-base";
|
||||
|
||||
// lazy load imports
|
||||
import "../badges/hui-entity-filter-badge";
|
||||
|
||||
const ALWAYS_LOADED_TYPES = new Set([
|
||||
"error",
|
||||
"state-label",
|
||||
|
||||
// lazy load types
|
||||
"entity-filter",
|
||||
]);
|
||||
const ALWAYS_LOADED_TYPES = new Set(["error", "state-label"]);
|
||||
const LAZY_LOAD_TYPES = {
|
||||
// "entity-filter": () => import("../badges/hui-entity-filter-badge"),
|
||||
"entity-filter": () => import("../badges/hui-entity-filter-badge"),
|
||||
};
|
||||
|
||||
export const createBadgeElement = (config: LovelaceBadgeConfig) =>
|
||||
|
@ -16,23 +16,6 @@ import {
|
||||
getLovelaceElementClass,
|
||||
} from "./create-element-base";
|
||||
|
||||
// lazy load imports
|
||||
import "../cards/hui-alarm-panel-card";
|
||||
import "../cards/hui-empty-state-card";
|
||||
import "../cards/hui-entity-filter-card";
|
||||
import "../cards/hui-picture-elements-card";
|
||||
import "../cards/hui-picture-entity-card";
|
||||
import "../cards/hui-picture-glance-card";
|
||||
import "../cards/hui-plant-status-card";
|
||||
import "../cards/hui-safe-mode-card";
|
||||
import "../cards/hui-shopping-list-card";
|
||||
import "../cards/hui-conditional-card";
|
||||
import "../cards/hui-gauge-card";
|
||||
import "../cards/hui-iframe-card";
|
||||
import "../cards/hui-map-card";
|
||||
import "../cards/hui-markdown-card";
|
||||
import "../cards/hui-picture-card";
|
||||
|
||||
const ALWAYS_LOADED_TYPES = new Set([
|
||||
"entities",
|
||||
"button",
|
||||
@ -47,41 +30,24 @@ const ALWAYS_LOADED_TYPES = new Set([
|
||||
"thermostat",
|
||||
"vertical-stack",
|
||||
"weather-forecast",
|
||||
|
||||
// Lazy load types
|
||||
"alarm-panel",
|
||||
"empty-state",
|
||||
"entity-filter",
|
||||
"picture-elements",
|
||||
"picture-entity",
|
||||
"picture-glance",
|
||||
"plant-status",
|
||||
"safe-mode",
|
||||
"shopping-list",
|
||||
"conditional",
|
||||
"gauge",
|
||||
"iframe",
|
||||
"map",
|
||||
"markdown",
|
||||
"picture",
|
||||
]);
|
||||
|
||||
const LAZY_LOAD_TYPES = {
|
||||
// "alarm-panel": () => import("../cards/hui-alarm-panel-card"),
|
||||
// "empty-state": () => import("../cards/hui-empty-state-card"),
|
||||
// "entity-filter": () => import("../cards/hui-entity-filter-card"),
|
||||
// "picture-elements": () => import("../cards/hui-picture-elements-card"),
|
||||
// "picture-entity": () => import("../cards/hui-picture-entity-card"),
|
||||
// "picture-glance": () => import("../cards/hui-picture-glance-card"),
|
||||
// "plant-status": () => import("../cards/hui-plant-status-card"),
|
||||
// "safe-mode": () => import("../cards/hui-safe-mode-card"),
|
||||
// "shopping-list": () => import("../cards/hui-shopping-list-card"),
|
||||
// conditional: () => import("../cards/hui-conditional-card"),
|
||||
// gauge: () => import("../cards/hui-gauge-card"),
|
||||
// iframe: () => import("../cards/hui-iframe-card"),
|
||||
// map: () => import("../cards/hui-map-card"),
|
||||
// markdown: () => import("../cards/hui-markdown-card"),
|
||||
// picture: () => import("../cards/hui-picture-card"),
|
||||
"alarm-panel": () => import("../cards/hui-alarm-panel-card"),
|
||||
"empty-state": () => import("../cards/hui-empty-state-card"),
|
||||
"entity-filter": () => import("../cards/hui-entity-filter-card"),
|
||||
"picture-elements": () => import("../cards/hui-picture-elements-card"),
|
||||
"picture-entity": () => import("../cards/hui-picture-entity-card"),
|
||||
"picture-glance": () => import("../cards/hui-picture-glance-card"),
|
||||
"plant-status": () => import("../cards/hui-plant-status-card"),
|
||||
"safe-mode": () => import("../cards/hui-safe-mode-card"),
|
||||
"shopping-list": () => import("../cards/hui-shopping-list-card"),
|
||||
conditional: () => import("../cards/hui-conditional-card"),
|
||||
gauge: () => import("../cards/hui-gauge-card"),
|
||||
iframe: () => import("../cards/hui-iframe-card"),
|
||||
map: () => import("../cards/hui-map-card"),
|
||||
markdown: () => import("../cards/hui-markdown-card"),
|
||||
picture: () => import("../cards/hui-picture-card"),
|
||||
};
|
||||
|
||||
export const createCardElement = (config: LovelaceCardConfig) =>
|
||||
|
@ -1,25 +1,16 @@
|
||||
import { LovelaceHeaderFooterConfig } from "../header-footer/types";
|
||||
import { createLovelaceElement } from "./create-element-base";
|
||||
|
||||
// lazy load imports
|
||||
import "../header-footer/hui-picture-header-footer";
|
||||
import "../header-footer/hui-buttons-header-footer";
|
||||
|
||||
const ALWAYS_LOADED_TYPES = new Set([
|
||||
// lazy load types
|
||||
"picture",
|
||||
"buttons",
|
||||
]);
|
||||
const LAZY_LOAD_TYPES = {
|
||||
// picture: () => import("../header-footer/hui-picture-header-footer"),
|
||||
// buttons: () => import("../header-footer/hui-buttons-header-footer"),
|
||||
picture: () => import("../header-footer/hui-picture-header-footer"),
|
||||
buttons: () => import("../header-footer/hui-buttons-header-footer"),
|
||||
};
|
||||
|
||||
export const createHeaderFooterElement = (config: LovelaceHeaderFooterConfig) =>
|
||||
createLovelaceElement(
|
||||
"header-footer",
|
||||
config,
|
||||
ALWAYS_LOADED_TYPES, // replace with undefined when empty
|
||||
undefined,
|
||||
LAZY_LOAD_TYPES,
|
||||
undefined,
|
||||
undefined
|
||||
|
@ -8,23 +8,6 @@ import "../special-rows/hui-call-service-row";
|
||||
import { EntityConfig } from "../entity-rows/types";
|
||||
import { createLovelaceElement } from "./create-element-base";
|
||||
|
||||
// lazy load imports
|
||||
import "../entity-rows/hui-climate-entity-row";
|
||||
import "../entity-rows/hui-cover-entity-row";
|
||||
import "../entity-rows/hui-group-entity-row";
|
||||
import "../entity-rows/hui-input-datetime-entity-row";
|
||||
import "../entity-rows/hui-input-number-entity-row";
|
||||
import "../entity-rows/hui-input-select-entity-row";
|
||||
import "../entity-rows/hui-input-text-entity-row";
|
||||
import "../entity-rows/hui-lock-entity-row";
|
||||
import "../entity-rows/hui-timer-entity-row";
|
||||
import "../special-rows/hui-conditional-row";
|
||||
import "../special-rows/hui-divider-row";
|
||||
import "../special-rows/hui-section-row";
|
||||
import "../special-rows/hui-weblink-row";
|
||||
import "../special-rows/hui-cast-row";
|
||||
import "../special-rows/hui-buttons-row";
|
||||
|
||||
const ALWAYS_LOADED_TYPES = new Set([
|
||||
"media-player-entity",
|
||||
"scene-entity",
|
||||
@ -33,43 +16,26 @@ const ALWAYS_LOADED_TYPES = new Set([
|
||||
"text-entity",
|
||||
"toggle-entity",
|
||||
"call-service",
|
||||
|
||||
// lazy load types
|
||||
"climate-entity",
|
||||
"cover-entity",
|
||||
"group-entity",
|
||||
"input-datetime-entity",
|
||||
"input-number-entity",
|
||||
"input-select-entity",
|
||||
"input-text-entity",
|
||||
"lock-entity",
|
||||
"timer-entity",
|
||||
"conditional",
|
||||
"divider",
|
||||
"section",
|
||||
"weblink",
|
||||
"cast",
|
||||
"buttons",
|
||||
]);
|
||||
const LAZY_LOAD_TYPES = {
|
||||
// "climate-entity": () => import("../entity-rows/hui-climate-entity-row"),
|
||||
// "cover-entity": () => import("../entity-rows/hui-cover-entity-row"),
|
||||
// "group-entity": () => import("../entity-rows/hui-group-entity-row"),
|
||||
// "input-datetime-entity": () =>
|
||||
// import("../entity-rows/hui-input-datetime-entity-row"),
|
||||
// "input-number-entity": () =>
|
||||
// import("../entity-rows/hui-input-number-entity-row"),
|
||||
// "input-select-entity": () =>
|
||||
// import("../entity-rows/hui-input-select-entity-row"),
|
||||
// "input-text-entity": () => import("../entity-rows/hui-input-text-entity-row"),
|
||||
// "lock-entity": () => import("../entity-rows/hui-lock-entity-row"),
|
||||
// "timer-entity": () => import("../entity-rows/hui-timer-entity-row"),
|
||||
// conditional: () => import("../special-rows/hui-conditional-row"),
|
||||
// divider: () => import("../special-rows/hui-divider-row"),
|
||||
// section: () => import("../special-rows/hui-section-row"),
|
||||
// weblink: () => import("../special-rows/hui-weblink-row"),
|
||||
// cast: () => import("../special-rows/hui-cast-row"),
|
||||
// buttons: () => import("../special-rows/hui-buttons-row"),
|
||||
"climate-entity": () => import("../entity-rows/hui-climate-entity-row"),
|
||||
"cover-entity": () => import("../entity-rows/hui-cover-entity-row"),
|
||||
"group-entity": () => import("../entity-rows/hui-group-entity-row"),
|
||||
"input-datetime-entity": () =>
|
||||
import("../entity-rows/hui-input-datetime-entity-row"),
|
||||
"input-number-entity": () =>
|
||||
import("../entity-rows/hui-input-number-entity-row"),
|
||||
"input-select-entity": () =>
|
||||
import("../entity-rows/hui-input-select-entity-row"),
|
||||
"input-text-entity": () => import("../entity-rows/hui-input-text-entity-row"),
|
||||
"lock-entity": () => import("../entity-rows/hui-lock-entity-row"),
|
||||
"timer-entity": () => import("../entity-rows/hui-timer-entity-row"),
|
||||
conditional: () => import("../special-rows/hui-conditional-row"),
|
||||
divider: () => import("../special-rows/hui-divider-row"),
|
||||
section: () => import("../special-rows/hui-section-row"),
|
||||
weblink: () => import("../special-rows/hui-weblink-row"),
|
||||
cast: () => import("../special-rows/hui-cast-row"),
|
||||
buttons: () => import("../special-rows/hui-buttons-row"),
|
||||
};
|
||||
const DOMAIN_TO_ELEMENT_TYPE = {
|
||||
_domain_not_found: "text",
|
||||
|
Loading…
x
Reference in New Issue
Block a user