Skip to content

Commit

Permalink
Minify ha-style/Roboto and load asynchronously (#18226)
Browse files Browse the repository at this point in the history
  • Loading branch information
steverep authored Oct 16, 2023
1 parent a08185a commit 3b2f6d7
Show file tree
Hide file tree
Showing 16 changed files with 586 additions and 583 deletions.
4 changes: 2 additions & 2 deletions cast/src/launcher/entrypoint.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import "../../../src/resources/safari-14-attachshadow-patch";
import "../../../src/resources/ha-style";
import "../../../src/resources/roboto";
import "./layout/hc-connect";

import("../../../src/resources/ha-style");
4 changes: 3 additions & 1 deletion cast/src/receiver/layout/hc-main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,9 @@ export class HcMain extends HassElement {

protected firstUpdated(changedProps) {
super.firstUpdated(changedProps);
import("../second-load");
import("./hc-lovelace");
import("../../../../src/resources/ha-style");

window.addEventListener("location-changed", () => {
const panelPath = `/${this._urlPath || "lovelace"}/`;
if (location.pathname.startsWith(panelPath)) {
Expand Down
3 changes: 0 additions & 3 deletions cast/src/receiver/second-load.ts

This file was deleted.

4 changes: 2 additions & 2 deletions demo/src/entrypoint.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import "../../src/resources/ha-style";
import "../../src/resources/roboto";
import "../../src/resources/safari-14-attachshadow-patch";
import "./ha-demo";

import("../../src/resources/ha-style");
4 changes: 2 additions & 2 deletions gallery/src/entrypoint.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import "../../src/resources/ha-style";
import "../../src/resources/roboto";
import "./ha-gallery";

import("../../src/resources/ha-style");

document.body.appendChild(document.createElement("ha-gallery"));
6 changes: 3 additions & 3 deletions hassio/src/entrypoint.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
// Compat needs to be first import
import "../../src/resources/compatibility";
import { setCancelSyntheticClickEvents } from "@polymer/polymer/lib/utils/settings";
import "../../src/resources/roboto";
import "../../src/resources/ha-style";
import "../../src/resources/safari-14-attachshadow-patch";
import "./hassio-main";

import("../../src/resources/ha-style");

setCancelSyntheticClickEvents(false);

const styleEl = document.createElement("style");
styleEl.innerHTML = `
styleEl.textContent = `
body {
font-family: Roboto, sans-serif;
-moz-osx-font-smoothing: grayscale;
Expand Down
4 changes: 2 additions & 2 deletions src/entrypoints/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import {
} from "@polymer/polymer/lib/utils/settings";
import "@webcomponents/scoped-custom-element-registry/scoped-custom-element-registry.min";
import "../layouts/home-assistant";
import "../resources/ha-style";
import "../resources/roboto";

import("../resources/ha-style");

setPassiveTouchGestures(true);
setCancelSyntheticClickEvents(false);
4 changes: 2 additions & 2 deletions src/entrypoints/authorize.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
import "../resources/compatibility";
import { setCancelSyntheticClickEvents } from "@polymer/polymer/lib/utils/settings";
import "../auth/ha-authorize";
import "../resources/ha-style";
import "../resources/roboto";
import "../resources/safari-14-attachshadow-patch";
import "../resources/array.flat.polyfill";

import("../resources/ha-style");

setCancelSyntheticClickEvents(false);
4 changes: 2 additions & 2 deletions src/entrypoints/onboarding.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
import "../resources/compatibility";
import { setCancelSyntheticClickEvents } from "@polymer/polymer/lib/utils/settings";
import "../onboarding/ha-onboarding";
import "../resources/ha-style";
import "../resources/roboto";
import "../resources/safari-14-attachshadow-patch";
import "../resources/array.flat.polyfill";

import("../resources/ha-style");

setCancelSyntheticClickEvents(false);

declare global {
Expand Down
2 changes: 1 addition & 1 deletion src/onboarding/particles.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { tsParticles } from "tsparticles-engine";
import { loadLinksPreset } from "tsparticles-preset-links";
import { DEFAULT_PRIMARY_COLOR } from "../resources/ha-style";
import { DEFAULT_PRIMARY_COLOR } from "../resources/styles-data";

loadLinksPreset(tsParticles).then(() => {
tsParticles.load("particles", {
Expand Down
2 changes: 1 addition & 1 deletion src/panels/config/hardware/ha-config-hardware.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ import { showOptionsFlowDialog } from "../../../dialogs/config-flow/show-dialog-
import { showRestartDialog } from "../../../dialogs/restart/show-dialog-restart";
import "../../../layouts/hass-subpage";
import { SubscribeMixin } from "../../../mixins/subscribe-mixin";
import { DEFAULT_PRIMARY_COLOR } from "../../../resources/ha-style";
import { DEFAULT_PRIMARY_COLOR } from "../../../resources/styles-data";
import { haStyle } from "../../../resources/styles";
import type { HomeAssistant } from "../../../types";
import { hardwareBrandsUrl } from "../../../util/brands-url";
Expand Down
2 changes: 1 addition & 1 deletion src/panels/profile/ha-pick-theme-row.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import "../../components/ha-textfield";
import {
DEFAULT_ACCENT_COLOR,
DEFAULT_PRIMARY_COLOR,
} from "../../resources/ha-style";
} from "../../resources/styles-data";
import { HomeAssistant } from "../../types";
import { documentationUrl } from "../../util/documentation-url";

Expand Down
Loading

0 comments on commit 3b2f6d7

Please sign in to comment.