- Gas total
+
+ ${this.hass.localize(
+ "ui.panel.lovelace.cards.energy.energy_sources_table.gas_total"
+ )}
+
diff --git a/src/translations/en.json b/src/translations/en.json
index e804716cf5..034810a867 100755
--- a/src/translations/en.json
+++ b/src/translations/en.json
@@ -3145,6 +3145,7 @@
},
"energy_sources_table": {
"grid_total": "Grid total",
+ "gas_total": "Gas total",
"source": "Source",
"energy": "Energy",
"cost": "Cost",
From 9b97faa5e360ae9dceeacb3bb708477ae01f9736 Mon Sep 17 00:00:00 2001
From: Bram Kragten
Date: Sat, 5 Feb 2022 00:46:09 +0100
Subject: [PATCH 006/174] Migrate combobox to mwc (#11546)
---
package.json | 9 +-
.../device/ha-area-devices-picker.ts | 2 +-
src/components/device/ha-device-picker.ts | 66 +----
.../entity/ha-entity-attribute-picker.ts | 2 +-
src/components/entity/ha-entity-picker.ts | 2 +-
src/components/entity/ha-statistic-picker.ts | 90 ++----
src/components/entity/ha-statistics-picker.ts | 14 +-
src/components/ha-addon-picker.ts | 40 +--
src/components/ha-area-picker.ts | 2 +-
src/components/ha-combo-box.ts | 153 +++++++---
src/components/ha-date-input.ts | 2 +-
src/components/ha-icon-picker.ts | 2 +-
.../ha-selector/ha-selector-addon.ts | 8 +-
src/components/ha-service-control.ts | 3 +
src/components/ha-service-picker.ts | 40 +--
.../dialogs/dialog-energy-battery-settings.ts | 3 +
.../dialogs/dialog-energy-device-settings.ts | 11 +-
.../dialogs/dialog-energy-gas-settings.ts | 3 +
.../dialog-energy-grid-flow-settings.ts | 3 +
.../dialogs/dialog-energy-solar-settings.ts | 3 +
.../hui-statistics-graph-card-editor.ts | 11 +-
yarn.lock | 274 +++++++++---------
22 files changed, 354 insertions(+), 389 deletions(-)
diff --git a/package.json b/package.json
index 9eeac473fb..7b3bf4a013 100644
--- a/package.json
+++ b/package.json
@@ -58,7 +58,7 @@
"@material/mwc-formfield": "0.25.3",
"@material/mwc-icon-button": "patch:@material/mwc-icon-button@0.25.3#./.yarn/patches/@material/mwc-icon-button/remove-icon.patch",
"@material/mwc-linear-progress": "0.25.3",
- "@material/mwc-list": "0.25.3",
+ "@material/mwc-list": "^0.25.3",
"@material/mwc-menu": "0.25.3",
"@material/mwc-radio": "0.25.3",
"@material/mwc-ripple": "0.25.3",
@@ -88,8 +88,9 @@
"@polymer/paper-tooltip": "^3.0.1",
"@polymer/polymer": "3.4.1",
"@thomasloven/round-slider": "0.5.4",
- "@vaadin/vaadin-combo-box": "^21.0.2",
- "@vaadin/vaadin-date-picker": "^21.0.2",
+ "@vaadin/combo-box": "^22.0.4",
+ "@vaadin/date-picker": "^22.0.4",
+ "@vaadin/vaadin-themable-mixin": "^22.0.4",
"@vibrant/color": "^3.2.1-alpha.1",
"@vibrant/core": "^3.2.1-alpha.1",
"@vibrant/quantizer-mmcq": "^3.2.1-alpha.1",
@@ -112,7 +113,7 @@
"leaflet": "^1.7.1",
"leaflet-draw": "^1.0.4",
"lit": "^2.1.2",
- "lit-vaadin-helpers": "^0.2.1",
+ "lit-vaadin-helpers": "^0.3.0",
"marked": "^3.0.2",
"memoize-one": "^5.2.1",
"node-vibrant": "3.2.1-alpha.1",
diff --git a/src/components/device/ha-area-devices-picker.ts b/src/components/device/ha-area-devices-picker.ts
index f863bacd45..67e01a131d 100644
--- a/src/components/device/ha-area-devices-picker.ts
+++ b/src/components/device/ha-area-devices-picker.ts
@@ -4,7 +4,7 @@ import "@polymer/paper-input/paper-input";
import "@polymer/paper-item/paper-item";
import "@polymer/paper-item/paper-item-body";
import "@polymer/paper-listbox/paper-listbox";
-import "@vaadin/vaadin-combo-box/theme/material/vaadin-combo-box-light";
+import "@vaadin/combo-box/theme/material/vaadin-combo-box-light";
import { UnsubscribeFunc } from "home-assistant-js-websocket";
import {
css,
diff --git a/src/components/device/ha-device-picker.ts b/src/components/device/ha-device-picker.ts
index 3b13c963e1..1161505eeb 100644
--- a/src/components/device/ha-device-picker.ts
+++ b/src/components/device/ha-device-picker.ts
@@ -1,18 +1,9 @@
-import "@polymer/paper-item/paper-item";
-import "@polymer/paper-item/paper-item-body";
+import "@material/mwc-list/mwc-list-item";
import { UnsubscribeFunc } from "home-assistant-js-websocket";
-import {
- css,
- CSSResultGroup,
- html,
- LitElement,
- PropertyValues,
- TemplateResult,
-} from "lit";
-import { customElement, property, state, query } from "lit/decorators";
-import memoizeOne from "memoize-one";
+import { html, LitElement, PropertyValues, TemplateResult } from "lit";
import { ComboBoxLitRenderer } from "lit-vaadin-helpers";
-import { mdiCheck } from "@mdi/js";
+import { customElement, property, query, state } from "lit/decorators";
+import memoizeOne from "memoize-one";
import { fireEvent } from "../../common/dom/fire_event";
import { computeDomain } from "../../common/entity/compute_domain";
import { stringCompare } from "../../common/string/compare";
@@ -46,36 +37,12 @@ export type HaDevicePickerDeviceFilterFunc = (
device: DeviceRegistryEntry
) => boolean;
-// eslint-disable-next-line lit/prefer-static-styles
-const rowRenderer: ComboBoxLitRenderer = (item) => html`
-
-
-
- ${item.name}
- ${item.area}
-
- `;
+const rowRenderer: ComboBoxLitRenderer = (item) => html`
+ ${item.name}
+ ${item.area}
+ `;
@customElement("ha-device-picker")
export class HaDevicePicker extends SubscribeMixin(LitElement) {
@@ -335,19 +302,6 @@ export class HaDevicePicker extends SubscribeMixin(LitElement) {
fireEvent(this, "change");
}, 0);
}
-
- static get styles(): CSSResultGroup {
- return css`
- paper-input > ha-icon-button {
- --mdc-icon-button-size: 24px;
- padding: 2px;
- color: var(--secondary-text-color);
- }
- [hidden] {
- display: none;
- }
- `;
- }
}
declare global {
diff --git a/src/components/entity/ha-entity-attribute-picker.ts b/src/components/entity/ha-entity-attribute-picker.ts
index d199c4f7b6..51b17fd53d 100644
--- a/src/components/entity/ha-entity-attribute-picker.ts
+++ b/src/components/entity/ha-entity-attribute-picker.ts
@@ -1,7 +1,7 @@
import { mdiCheck, mdiClose, mdiMenuDown, mdiMenuUp } from "@mdi/js";
import "@polymer/paper-input/paper-input";
import "@polymer/paper-item/paper-item";
-import "@vaadin/vaadin-combo-box/theme/material/vaadin-combo-box-light";
+import "@vaadin/combo-box/theme/material/vaadin-combo-box-light";
import { HassEntity } from "home-assistant-js-websocket";
import {
css,
diff --git a/src/components/entity/ha-entity-picker.ts b/src/components/entity/ha-entity-picker.ts
index 016684e6c2..a455bb988a 100644
--- a/src/components/entity/ha-entity-picker.ts
+++ b/src/components/entity/ha-entity-picker.ts
@@ -2,7 +2,7 @@ import { mdiCheck, mdiClose, mdiMenuDown, mdiMenuUp } from "@mdi/js";
import "@polymer/paper-input/paper-input";
import "@polymer/paper-item/paper-icon-item";
import "@polymer/paper-item/paper-item-body";
-import "@vaadin/vaadin-combo-box/theme/material/vaadin-combo-box-light";
+import "@vaadin/combo-box/theme/material/vaadin-combo-box-light";
import { HassEntity } from "home-assistant-js-websocket";
import {
css,
diff --git a/src/components/entity/ha-statistic-picker.ts b/src/components/entity/ha-statistic-picker.ts
index 080a78a252..511b46353a 100644
--- a/src/components/entity/ha-statistic-picker.ts
+++ b/src/components/entity/ha-statistic-picker.ts
@@ -1,17 +1,8 @@
-import { mdiCheck } from "@mdi/js";
import "@polymer/paper-input/paper-input";
import "@polymer/paper-item/paper-icon-item";
import "@polymer/paper-item/paper-item-body";
-import "@vaadin/vaadin-combo-box/theme/material/vaadin-combo-box-light";
import { HassEntity } from "home-assistant-js-websocket";
-import {
- css,
- CSSResultGroup,
- html,
- LitElement,
- PropertyValues,
- TemplateResult,
-} from "lit";
+import { html, LitElement, PropertyValues, TemplateResult } from "lit";
import { ComboBoxLitRenderer } from "lit-vaadin-helpers";
import { customElement, property, query, state } from "lit/decorators";
import memoizeOne from "memoize-one";
@@ -76,54 +67,24 @@ export class HaStatisticPicker extends LitElement {
id: string;
name: string;
state?: HassEntity;
- // eslint-disable-next-line lit/prefer-static-styles
- }> = (item) => html`
-
-
- ${item.state
- ? html` `
- : ""}
-
- ${item.name}
- ${item.id === "" || item.id === "__missing"
- ? html`${this.hass.localize(
- "ui.components.statistic-picker.learn_more"
- )} `
- : item.id}
-
- `;
+ }> = (item) => html`
+ ${item.state
+ ? html` `
+ : ""}
+ ${item.name}
+ ${item.id === "" || item.id === "__missing"
+ ? html`${this.hass.localize(
+ "ui.components.statistic-picker.learn_more"
+ )} `
+ : item.id}
+ `;
private _getStatistics = memoizeOne(
(
@@ -293,19 +254,6 @@ export class HaStatisticPicker extends LitElement {
fireEvent(this, "change");
}, 0);
}
-
- static get styles(): CSSResultGroup {
- return css`
- paper-input > ha-icon-button {
- --mdc-icon-button-size: 24px;
- padding: 2px;
- color: var(--secondary-text-color);
- }
- [hidden] {
- display: none;
- }
- `;
- }
}
declare global {
diff --git a/src/components/entity/ha-statistics-picker.ts b/src/components/entity/ha-statistics-picker.ts
index 46e10060d0..08242a5263 100644
--- a/src/components/entity/ha-statistics-picker.ts
+++ b/src/components/entity/ha-statistics-picker.ts
@@ -1,4 +1,4 @@
-import { html, LitElement, TemplateResult } from "lit";
+import { css, CSSResultGroup, html, LitElement, TemplateResult } from "lit";
import { customElement, property } from "lit/decorators";
import { fireEvent } from "../../common/dom/fire_event";
import type { PolymerChangedEvent } from "../../polymer-types";
@@ -103,6 +103,18 @@ class HaStatisticsPicker extends LitElement {
this._updateStatistics([...currentEntities, toAdd]);
}
+
+ static get styles(): CSSResultGroup {
+ return css`
+ :host {
+ width: 200px;
+ display: block;
+ }
+ ha-statistic-picker {
+ width: 100%;
+ }
+ `;
+ }
}
declare global {
diff --git a/src/components/ha-addon-picker.ts b/src/components/ha-addon-picker.ts
index c40d874c13..a28f188de9 100644
--- a/src/components/ha-addon-picker.ts
+++ b/src/components/ha-addon-picker.ts
@@ -1,4 +1,3 @@
-import { mdiCheck } from "@mdi/js";
import { html, LitElement, TemplateResult } from "lit";
import { ComboBoxLitRenderer } from "lit-vaadin-helpers";
import { customElement, property, query, state } from "lit/decorators";
@@ -12,39 +11,12 @@ import { PolymerChangedEvent } from "../polymer-types";
import { HomeAssistant } from "../types";
import { HaComboBox } from "./ha-combo-box";
-// eslint-disable-next-line lit/prefer-static-styles
-const rowRenderer: ComboBoxLitRenderer = (item) => html`
-
-
-
- ${item.name}
- ${item.slug}
-
- `;
+const rowRenderer: ComboBoxLitRenderer = (
+ item
+) => html`
+ ${item.name}
+ ${item.slug}
+ `;
@customElement("ha-addon-picker")
class HaAddonPicker extends LitElement {
diff --git a/src/components/ha-area-picker.ts b/src/components/ha-area-picker.ts
index ed658188df..b6504f9dc1 100644
--- a/src/components/ha-area-picker.ts
+++ b/src/components/ha-area-picker.ts
@@ -3,7 +3,7 @@ import "@polymer/paper-input/paper-input";
import "@polymer/paper-item/paper-item";
import "@polymer/paper-item/paper-item-body";
import "@polymer/paper-listbox/paper-listbox";
-import "@vaadin/vaadin-combo-box/theme/material/vaadin-combo-box-light";
+import "@vaadin/combo-box/theme/material/vaadin-combo-box-light";
import { UnsubscribeFunc } from "home-assistant-js-websocket";
import {
css,
diff --git a/src/components/ha-combo-box.ts b/src/components/ha-combo-box.ts
index afcd9c8911..dd2b5d0e27 100644
--- a/src/components/ha-combo-box.ts
+++ b/src/components/ha-combo-box.ts
@@ -1,25 +1,59 @@
+import "@material/mwc-list/mwc-list-item";
+import "@material/mwc-textfield/mwc-textfield";
import { mdiClose, mdiMenuDown, mdiMenuUp } from "@mdi/js";
-import "@polymer/paper-input/paper-input";
-import "@polymer/paper-item/paper-item";
-import "@polymer/paper-item/paper-item-body";
-import "@polymer/paper-listbox/paper-listbox";
-import "@vaadin/vaadin-combo-box/theme/material/vaadin-combo-box-light";
+import "@vaadin/combo-box/theme/material/vaadin-combo-box-light";
+import type { ComboBoxLight } from "@vaadin/combo-box/vaadin-combo-box-light";
+import { registerStyles } from "@vaadin/vaadin-themable-mixin/register-styles";
import { css, CSSResultGroup, html, LitElement, TemplateResult } from "lit";
import { ComboBoxLitRenderer, comboBoxRenderer } from "lit-vaadin-helpers";
-import { customElement, property, query, state } from "lit/decorators";
+import { customElement, property, query } from "lit/decorators";
import { fireEvent } from "../common/dom/fire_event";
import { PolymerChangedEvent } from "../polymer-types";
import { HomeAssistant } from "../types";
import "./ha-icon-button";
-// eslint-disable-next-line lit/prefer-static-styles
-const defaultRowRenderer: ComboBoxLitRenderer = (item) => html`
- ${item} `;
+ :host([focused]:not([disabled])) {
+ background-color: rgba(0, 0, 0, 0.12);
+ }
+ :host([selected]:not([disabled])) {
+ background-color: transparent;
+ color: var(--mdc-theme-primary);
+ --mdc-ripple-color: var(--mdc-theme-primary);
+ --mdc-theme-text-primary-on-background: var(--mdc-theme-primary);
+ }
+ :host([selected]:not([disabled])):before {
+ background-color: var(--mdc-theme-primary);
+ opacity: 0.12;
+ content: "";
+ position: absolute;
+ top: 0;
+ left: 0;
+ width: 100%;
+ height: 100%;
+ }
+ :host([selected][focused]:not([disabled])):before {
+ opacity: 0.24;
+ }
+ :host(:hover:not([disabled])) {
+ background-color: transparent;
+ }
+ [part="content"] {
+ width: 100%;
+ }
+ [part="checkmark"] {
+ display: none;
+ }
+ `
+);
+
+const defaultRowRenderer: ComboBoxLitRenderer = (item) =>
+ html`${item} `;
@customElement("ha-combo-box")
export class HaComboBox extends LitElement {
@@ -46,24 +80,25 @@ export class HaComboBox extends LitElement {
@property({ type: Boolean }) public disabled?: boolean;
- @state() private _opened?: boolean;
+ @property({ type: Boolean, reflect: true, attribute: "opened" })
+ private _opened?: boolean;
- @query("vaadin-combo-box-light", true) private _comboBox!: HTMLElement;
+ @query("vaadin-combo-box-light", true) private _comboBox!: ComboBoxLight;
public open() {
this.updateComplete.then(() => {
- (this._comboBox as any)?.open();
+ this._comboBox?.open();
});
}
public focus() {
this.updateComplete.then(() => {
- this.shadowRoot?.querySelector("paper-input")?.focus();
+ this._comboBox?.inputElement?.focus();
});
}
public get selectedItem() {
- return (this._comboBox as any).selectedItem;
+ return this._comboBox.selectedItem;
}
protected render(): TemplateResult {
@@ -72,7 +107,7 @@ export class HaComboBox extends LitElement {
.itemValuePath=${this.itemValuePath}
.itemIdPath=${this.itemIdPath}
.itemLabelPath=${this.itemLabelPath}
- .value=${this.value}
+ .value=${this.value || ""}
.items=${this.items}
.filteredItems=${this.filteredItems}
.allowCustomValue=${this.allowCustomValue}
@@ -81,8 +116,9 @@ export class HaComboBox extends LitElement {
@opened-changed=${this._openedChanged}
@filter-changed=${this._filterChanged}
@value-changed=${this._valueChanged}
+ attr-for-value="value"
>
- `}
>
- ${this.value
- ? html`
-
- `
- : ""}
-
-
-
+
+ ${this.value
+ ? html` `
+ : ""}
+
`;
}
@@ -119,8 +152,20 @@ export class HaComboBox extends LitElement {
fireEvent(this, "value-changed", { value: undefined });
}
+ private _toggleOpen(ev: Event) {
+ if (this._opened) {
+ this._comboBox?.close();
+ ev.stopPropagation();
+ } else {
+ this._comboBox?.inputElement.focus();
+ }
+ }
+
private _openedChanged(ev: PolymerChangedEvent) {
- this._opened = ev.detail.value;
+ // delay this so we can handle click event before setting _opened
+ setTimeout(() => {
+ this._opened = ev.detail.value;
+ }, 0);
// @ts-ignore
fireEvent(this, ev.type, ev.detail);
}
@@ -141,11 +186,39 @@ export class HaComboBox extends LitElement {
static get styles(): CSSResultGroup {
return css`
- paper-input > ha-icon-button {
+ :host {
+ display: block;
+ width: 100%;
+ margin-top: 4px;
+ }
+ vaadin-combo-box-light {
+ position: relative;
+ }
+ mwc-textfield {
+ width: 100%;
+ }
+ mwc-textfield > ha-icon-button {
--mdc-icon-button-size: 24px;
padding: 2px;
color: var(--secondary-text-color);
}
+ ha-svg-icon {
+ color: var(--input-dropdown-icon-color);
+ position: absolute;
+ cursor: pointer;
+ }
+ .toggle-button {
+ right: 12px;
+ top: -10px;
+ }
+ :host([opened]) .toggle-button {
+ color: var(--primary-color);
+ }
+ .clear-button {
+ --mdc-icon-size: 20px;
+ top: -7px;
+ right: 36px;
+ }
`;
}
}
diff --git a/src/components/ha-date-input.ts b/src/components/ha-date-input.ts
index 852e4aa4c7..c83f5742c3 100644
--- a/src/components/ha-date-input.ts
+++ b/src/components/ha-date-input.ts
@@ -1,6 +1,6 @@
import { mdiCalendar } from "@mdi/js";
import "@polymer/paper-input/paper-input";
-import "@vaadin/vaadin-date-picker/theme/material/vaadin-date-picker-light";
+import "@vaadin/date-picker/theme/material/vaadin-date-picker-light";
import { css, CSSResultGroup, html, LitElement, PropertyValues } from "lit";
import { customElement, property, query } from "lit/decorators";
import { fireEvent } from "../common/dom/fire_event";
diff --git a/src/components/ha-icon-picker.ts b/src/components/ha-icon-picker.ts
index 93da7a5d87..972a2f7a61 100644
--- a/src/components/ha-icon-picker.ts
+++ b/src/components/ha-icon-picker.ts
@@ -2,7 +2,7 @@ import { mdiCheck, mdiMenuDown, mdiMenuUp } from "@mdi/js";
import "@polymer/paper-input/paper-input";
import "@polymer/paper-item/paper-icon-item";
import "@polymer/paper-item/paper-item-body";
-import "@vaadin/vaadin-combo-box/theme/material/vaadin-combo-box-light";
+import "@vaadin/combo-box/theme/material/vaadin-combo-box-light";
import { css, html, LitElement, TemplateResult } from "lit";
import { ComboBoxLitRenderer, comboBoxRenderer } from "lit-vaadin-helpers";
import { customElement, property, query, state } from "lit/decorators";
diff --git a/src/components/ha-selector/ha-selector-addon.ts b/src/components/ha-selector/ha-selector-addon.ts
index 30214933f1..47bb9c045b 100644
--- a/src/components/ha-selector/ha-selector-addon.ts
+++ b/src/components/ha-selector/ha-selector-addon.ts
@@ -1,4 +1,4 @@
-import { html, LitElement } from "lit";
+import { css, html, LitElement } from "lit";
import { customElement, property } from "lit/decorators";
import { AddonSelector } from "../../data/selector";
import { HomeAssistant } from "../../types";
@@ -22,6 +22,12 @@ export class HaAddonSelector extends LitElement {
allow-custom-entity
>`;
}
+
+ static styles = css`
+ ha-addon-picker {
+ width: 100%;
+ }
+ `;
}
declare global {
diff --git a/src/components/ha-service-control.ts b/src/components/ha-service-control.ts
index 3469982b77..5b9a8a6506 100644
--- a/src/components/ha-service-control.ts
+++ b/src/components/ha-service-control.ts
@@ -480,6 +480,9 @@ export class HaServiceControl extends LitElement {
display: block;
margin: var(--service-control-padding, 0 16px);
}
+ ha-service-picker {
+ padding-top: 16px;
+ }
ha-yaml-editor {
padding: 16px 0;
}
diff --git a/src/components/ha-service-picker.ts b/src/components/ha-service-picker.ts
index 196d2902c2..dab0015447 100644
--- a/src/components/ha-service-picker.ts
+++ b/src/components/ha-service-picker.ts
@@ -1,4 +1,3 @@
-import { mdiCheck } from "@mdi/js";
import { html, LitElement } from "lit";
import { ComboBoxLitRenderer } from "lit-vaadin-helpers";
import { property, state } from "lit/decorators";
@@ -11,39 +10,12 @@ import "./ha-combo-box";
const rowRenderer: ComboBoxLitRenderer<{ service: string; name: string }> = (
item
- // eslint-disable-next-line lit/prefer-static-styles
-) => html`
-
-
-
- ${item.name}
- ${item.name === item.service ? "" : item.service}
-
- `;
+) => html`
+ ${item.name}
+ ${item.name === item.service ? "" : item.service}
+ `;
class HaServicePicker extends LitElement {
@property({ attribute: false }) public hass!: HomeAssistant;
diff --git a/src/panels/config/energy/dialogs/dialog-energy-battery-settings.ts b/src/panels/config/energy/dialogs/dialog-energy-battery-settings.ts
index 2f7477327b..394fcfcd65 100644
--- a/src/panels/config/energy/dialogs/dialog-energy-battery-settings.ts
+++ b/src/panels/config/energy/dialogs/dialog-energy-battery-settings.ts
@@ -127,6 +127,9 @@ export class DialogEnergyBatterySettings
ha-dialog {
--mdc-dialog-max-width: 430px;
}
+ ha-statistic-picker {
+ width: 100%;
+ }
`,
];
}
diff --git a/src/panels/config/energy/dialogs/dialog-energy-device-settings.ts b/src/panels/config/energy/dialogs/dialog-energy-device-settings.ts
index e0ac123065..6cc3e0bc52 100644
--- a/src/panels/config/energy/dialogs/dialog-energy-device-settings.ts
+++ b/src/panels/config/energy/dialogs/dialog-energy-device-settings.ts
@@ -1,5 +1,5 @@
import { mdiDevices } from "@mdi/js";
-import { CSSResultGroup, html, LitElement, TemplateResult } from "lit";
+import { css, CSSResultGroup, html, LitElement, TemplateResult } from "lit";
import { customElement, property, state } from "lit/decorators";
import { fireEvent } from "../../../../common/dom/fire_event";
import "../../../../components/ha-dialog";
@@ -109,7 +109,14 @@ export class DialogEnergyDeviceSettings
}
static get styles(): CSSResultGroup {
- return haStyleDialog;
+ return [
+ haStyleDialog,
+ css`
+ ha-statistic-picker {
+ width: 100%;
+ }
+ `,
+ ];
}
}
diff --git a/src/panels/config/energy/dialogs/dialog-energy-gas-settings.ts b/src/panels/config/energy/dialogs/dialog-energy-gas-settings.ts
index fa5c9062f7..fea22bc68d 100644
--- a/src/panels/config/energy/dialogs/dialog-energy-gas-settings.ts
+++ b/src/panels/config/energy/dialogs/dialog-energy-gas-settings.ts
@@ -294,6 +294,9 @@ export class DialogEnergyGasSettings
ha-formfield {
display: block;
}
+ ha-statistic-picker {
+ width: 100%;
+ }
.price-options {
display: block;
padding-left: 52px;
diff --git a/src/panels/config/energy/dialogs/dialog-energy-grid-flow-settings.ts b/src/panels/config/energy/dialogs/dialog-energy-grid-flow-settings.ts
index 0bb1ebf34e..4ae094ab52 100644
--- a/src/panels/config/energy/dialogs/dialog-energy-grid-flow-settings.ts
+++ b/src/panels/config/energy/dialogs/dialog-energy-grid-flow-settings.ts
@@ -301,6 +301,9 @@ export class DialogEnergyGridFlowSettings
ha-formfield {
display: block;
}
+ ha-statistic-picker {
+ width: 100%;
+ }
.price-options {
display: block;
padding-left: 52px;
diff --git a/src/panels/config/energy/dialogs/dialog-energy-solar-settings.ts b/src/panels/config/energy/dialogs/dialog-energy-solar-settings.ts
index 25f6073e85..cdd24d513f 100644
--- a/src/panels/config/energy/dialogs/dialog-energy-solar-settings.ts
+++ b/src/panels/config/energy/dialogs/dialog-energy-solar-settings.ts
@@ -248,6 +248,9 @@ export class DialogEnergySolarSettings
ha-formfield {
display: block;
}
+ ha-statistic-picker {
+ width: 100%;
+ }
.forecast-options {
padding-left: 32px;
}
diff --git a/src/panels/lovelace/editor/config-elements/hui-statistics-graph-card-editor.ts b/src/panels/lovelace/editor/config-elements/hui-statistics-graph-card-editor.ts
index 163ea01bd3..89411e668c 100644
--- a/src/panels/lovelace/editor/config-elements/hui-statistics-graph-card-editor.ts
+++ b/src/panels/lovelace/editor/config-elements/hui-statistics-graph-card-editor.ts
@@ -1,5 +1,5 @@
import "@polymer/paper-input/paper-input";
-import { CSSResultGroup, html, LitElement, TemplateResult } from "lit";
+import { css, CSSResultGroup, html, LitElement, TemplateResult } from "lit";
import { customElement, property, state } from "lit/decorators";
import {
array,
@@ -284,7 +284,14 @@ export class HuiStatisticsGraphCardEditor
}
static get styles(): CSSResultGroup {
- return configElementStyle;
+ return [
+ configElementStyle,
+ css`
+ ha-statistics-picker {
+ width: 100%;
+ }
+ `,
+ ];
}
}
diff --git a/yarn.lock b/yarn.lock
index 1a35f14b62..ab7da34845 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -2491,7 +2491,7 @@ __metadata:
languageName: node
linkType: hard
-"@material/mwc-list@npm:0.25.3, @material/mwc-list@npm:^0.25.3":
+"@material/mwc-list@npm:^0.25.3":
version: 0.25.3
resolution: "@material/mwc-list@npm:0.25.3"
dependencies:
@@ -3059,6 +3059,13 @@ __metadata:
languageName: node
linkType: hard
+"@open-wc/dedupe-mixin@npm:^1.3.0":
+ version: 1.3.0
+ resolution: "@open-wc/dedupe-mixin@npm:1.3.0"
+ checksum: 6c957d705a0ee96c46282b95267eab0365265e90109b2da95b51c5384b730c4823fb426f99a0cc10465826250bd6466199af80ad7257a4aacdd9bcb997b4cab3
+ languageName: node
+ linkType: hard
+
"@open-wc/dev-server-hmr@npm:^0.0.2":
version: 0.0.2
resolution: "@open-wc/dev-server-hmr@npm:0.0.2"
@@ -3103,7 +3110,7 @@ __metadata:
languageName: node
linkType: hard
-"@polymer/iron-a11y-keys-behavior@npm:^3.0.0, @polymer/iron-a11y-keys-behavior@npm:^3.0.0-pre.26":
+"@polymer/iron-a11y-keys-behavior@npm:^3.0.0-pre.26":
version: 3.0.1
resolution: "@polymer/iron-a11y-keys-behavior@npm:3.0.1"
dependencies:
@@ -3216,18 +3223,6 @@ __metadata:
languageName: node
linkType: hard
-"@polymer/iron-list@npm:^3.0.0":
- version: 3.0.2
- resolution: "@polymer/iron-list@npm:3.0.2"
- dependencies:
- "@polymer/iron-a11y-keys-behavior": ^3.0.0-pre.26
- "@polymer/iron-resizable-behavior": ^3.0.0-pre.26
- "@polymer/iron-scroll-target-behavior": ^3.0.0-pre.26
- "@polymer/polymer": ^3.0.0
- checksum: 6f3f9db546120776b4efedc3986c4399a4a28d3951cc6a1d5920e1d9b9eab26c6a92e2194dc4bdbb4dd148c727ac8aa20c7323a576a46600e6cd15bb0ad5ccce
- languageName: node
- linkType: hard
-
"@polymer/iron-media-query@npm:^3.0.0, @polymer/iron-media-query@npm:^3.0.0-pre.26":
version: 3.0.1
resolution: "@polymer/iron-media-query@npm:3.0.1"
@@ -4235,67 +4230,120 @@ __metadata:
languageName: node
linkType: hard
-"@vaadin/vaadin-button@npm:^21.0.2":
- version: 21.0.2
- resolution: "@vaadin/vaadin-button@npm:21.0.2"
+"@vaadin/button@npm:^22.0.4":
+ version: 22.0.4
+ resolution: "@vaadin/button@npm:22.0.4"
dependencies:
"@polymer/polymer": ^3.0.0
- "@vaadin/vaadin-control-state-mixin": ^21.0.2
- "@vaadin/vaadin-element-mixin": ^21.0.2
- "@vaadin/vaadin-lumo-styles": ^21.0.2
- "@vaadin/vaadin-material-styles": ^21.0.2
- "@vaadin/vaadin-themable-mixin": ^21.0.2
- checksum: d95a682edc68a2cce6a08272e9cb0340517484ec39b3ced368390b6a171fb8f6ae19308d793af6947dc2525bf70f62c766ad7a50ed82eceff0699171b3b58768
+ "@vaadin/component-base": ^22.0.4
+ "@vaadin/vaadin-lumo-styles": ^22.0.4
+ "@vaadin/vaadin-material-styles": ^22.0.4
+ "@vaadin/vaadin-themable-mixin": ^22.0.4
+ checksum: 70f8eeddd7c8d19eb859f2dd5f848e9b6b83f1f4bc8cb3d1fdc613f0637df9c04f0f91e49d23c4d390ce4ffa8a301ea77c364c29de278e8c32e5e7ccbcaf8f67
languageName: node
linkType: hard
-"@vaadin/vaadin-combo-box@npm:^21.0.2":
- version: 21.0.2
- resolution: "@vaadin/vaadin-combo-box@npm:21.0.2"
+"@vaadin/combo-box@npm:^22.0.4":
+ version: 22.0.4
+ resolution: "@vaadin/combo-box@npm:22.0.4"
dependencies:
- "@polymer/iron-a11y-announcer": ^3.0.0
- "@polymer/iron-list": ^3.0.0
+ "@open-wc/dedupe-mixin": ^1.3.0
"@polymer/iron-resizable-behavior": ^3.0.0
"@polymer/polymer": ^3.0.0
- "@vaadin/vaadin-control-state-mixin": ^21.0.2
- "@vaadin/vaadin-element-mixin": ^21.0.2
- "@vaadin/vaadin-item": ^21.0.2
- "@vaadin/vaadin-lumo-styles": ^21.0.2
- "@vaadin/vaadin-material-styles": ^21.0.2
- "@vaadin/vaadin-overlay": ^21.0.2
- "@vaadin/vaadin-text-field": ^21.0.2
- "@vaadin/vaadin-themable-mixin": ^21.0.2
- checksum: 3c12f3c01d5c9b04efa011c57cee7ac3ec7d7f47d2d59a9ce71537f3a4f12177bcf4e049e03403c1f6693ef9a4717095dd7eb8435a83f4376bcf255a56a1aaa7
+ "@vaadin/component-base": ^22.0.4
+ "@vaadin/field-base": ^22.0.4
+ "@vaadin/input-container": ^22.0.4
+ "@vaadin/item": ^22.0.4
+ "@vaadin/vaadin-lumo-styles": ^22.0.4
+ "@vaadin/vaadin-material-styles": ^22.0.4
+ "@vaadin/vaadin-overlay": ^22.0.4
+ "@vaadin/vaadin-themable-mixin": ^22.0.4
+ checksum: a3cde710d1187bba8e9e7eeb7f6397e6e1158befa3412c3aa684b3b45a1425cdee28d408d5e4dc4f586e1f6881db8850fc51c38f4658c4eb65c51a26a9623c56
languageName: node
linkType: hard
-"@vaadin/vaadin-control-state-mixin@npm:^21.0.2":
- version: 21.0.2
- resolution: "@vaadin/vaadin-control-state-mixin@npm:21.0.2"
+"@vaadin/component-base@npm:^22.0.4":
+ version: 22.0.4
+ resolution: "@vaadin/component-base@npm:22.0.4"
dependencies:
+ "@open-wc/dedupe-mixin": ^1.3.0
"@polymer/polymer": ^3.0.0
- checksum: a6ed433dc8750afdff410c9046637f12ebbcd79f46c8a9d294ab4d3c18c1dd1c9b465b83c63671a804e10319123375f1e3ee55dfd5dd2b60f44f8593af7e2ee6
+ "@vaadin/vaadin-development-mode-detector": ^2.0.0
+ "@vaadin/vaadin-usage-statistics": ^2.1.0
+ lit: ^2.0.0
+ checksum: d18e7cebdd2928e33641ee035927540239e8a65d23521aca2e35d9992a44060d951e877af09088de0ffa88daa11f86a02b86a087cb29b51d9ada574009159509
languageName: node
linkType: hard
-"@vaadin/vaadin-date-picker@npm:^21.0.2":
- version: 21.0.2
- resolution: "@vaadin/vaadin-date-picker@npm:21.0.2"
+"@vaadin/date-picker@npm:^22.0.4":
+ version: 22.0.4
+ resolution: "@vaadin/date-picker@npm:22.0.4"
dependencies:
+ "@open-wc/dedupe-mixin": ^1.3.0
"@polymer/iron-a11y-announcer": ^3.0.0
- "@polymer/iron-a11y-keys-behavior": ^3.0.0
"@polymer/iron-media-query": ^3.0.0
- "@polymer/iron-resizable-behavior": ^3.0.0
"@polymer/polymer": ^3.2.0
- "@vaadin/vaadin-button": ^21.0.2
- "@vaadin/vaadin-control-state-mixin": ^21.0.2
- "@vaadin/vaadin-element-mixin": ^21.0.2
- "@vaadin/vaadin-lumo-styles": ^21.0.2
- "@vaadin/vaadin-material-styles": ^21.0.2
- "@vaadin/vaadin-overlay": ^21.0.2
- "@vaadin/vaadin-text-field": ^21.0.2
- "@vaadin/vaadin-themable-mixin": ^21.0.2
- checksum: 0b1ee406540d59d3cc8bf37b47575adc9c2bc50e15f3e3adb1d95486d58c8b377b153f4f19c76258b27ea814188c024312b704961cf609120a7649943666552e
+ "@vaadin/button": ^22.0.4
+ "@vaadin/component-base": ^22.0.4
+ "@vaadin/field-base": ^22.0.4
+ "@vaadin/input-container": ^22.0.4
+ "@vaadin/vaadin-lumo-styles": ^22.0.4
+ "@vaadin/vaadin-material-styles": ^22.0.4
+ "@vaadin/vaadin-overlay": ^22.0.4
+ "@vaadin/vaadin-themable-mixin": ^22.0.4
+ checksum: bfc0bc3a9bec920d7a0b0d2b3968f6c5ca17cea752f37b7d707e8912b8c35e2780b1a78d4cdca1094519cb70554f95ee5ab69f212c677482935a7a4fc3b42a43
+ languageName: node
+ linkType: hard
+
+"@vaadin/field-base@npm:^22.0.4":
+ version: 22.0.4
+ resolution: "@vaadin/field-base@npm:22.0.4"
+ dependencies:
+ "@open-wc/dedupe-mixin": ^1.3.0
+ "@polymer/polymer": ^3.0.0
+ "@vaadin/component-base": ^22.0.4
+ lit: ^2.0.0
+ checksum: 4ca54ea3efd1bad2cea6ada97484e24f77f7ebb2ab5da7de5b9b7949d624b049d357c7f6f69206f1f10023b1711dc7b8bde9f6dfad774578efec00e1907c4763
+ languageName: node
+ linkType: hard
+
+"@vaadin/icon@npm:^22.0.4":
+ version: 22.0.4
+ resolution: "@vaadin/icon@npm:22.0.4"
+ dependencies:
+ "@polymer/polymer": ^3.0.0
+ "@vaadin/component-base": ^22.0.4
+ "@vaadin/vaadin-lumo-styles": ^22.0.4
+ "@vaadin/vaadin-themable-mixin": ^22.0.4
+ lit: ^2.0.0
+ checksum: 65e5195a8eb6f8ce24471c3f52ffdd7edc49249e39922e945eb8f02fc2b277d8d527a1538241b9660ca568a87663912b1be9c82fa8a841f286e713630d52f3db
+ languageName: node
+ linkType: hard
+
+"@vaadin/input-container@npm:^22.0.4":
+ version: 22.0.4
+ resolution: "@vaadin/input-container@npm:22.0.4"
+ dependencies:
+ "@polymer/polymer": ^3.0.0
+ "@vaadin/component-base": ^22.0.4
+ "@vaadin/vaadin-lumo-styles": ^22.0.4
+ "@vaadin/vaadin-material-styles": ^22.0.4
+ "@vaadin/vaadin-themable-mixin": ^22.0.4
+ checksum: 718cb7d8f715427d9085feee8a0df987440511059c5bbfcaa80d63ecd989a693f8f50af9da0f483555396aece21b75eff280921eda7cf0b6358e67518e53ba85
+ languageName: node
+ linkType: hard
+
+"@vaadin/item@npm:^22.0.4":
+ version: 22.0.4
+ resolution: "@vaadin/item@npm:22.0.4"
+ dependencies:
+ "@open-wc/dedupe-mixin": ^1.3.0
+ "@polymer/polymer": ^3.0.0
+ "@vaadin/component-base": ^22.0.4
+ "@vaadin/vaadin-lumo-styles": ^22.0.4
+ "@vaadin/vaadin-material-styles": ^22.0.4
+ "@vaadin/vaadin-themable-mixin": ^22.0.4
+ checksum: ef8c253668852a129656e083149b3866327dfae8671e30bb1bf78b39f969bd1db74892f090c7632b64fd91c25334f0542ad9dc6848486609de4350da5e5ea44c
languageName: node
linkType: hard
@@ -4306,100 +4354,49 @@ __metadata:
languageName: node
linkType: hard
-"@vaadin/vaadin-element-mixin@npm:^21.0.2":
- version: 21.0.2
- resolution: "@vaadin/vaadin-element-mixin@npm:21.0.2"
- dependencies:
- "@polymer/polymer": ^3.0.0
- "@vaadin/vaadin-development-mode-detector": ^2.0.0
- "@vaadin/vaadin-usage-statistics": ^2.1.0
- checksum: 8d18ff9f1e430ff4ed7461fe948b171f78bf43ba2f263c7f7cc4f4161e0486c7ad8a8d57c8cbb9443883ee6fedfae84bbbb562e2e3bb2161d33625b2adde8ebe
- languageName: node
- linkType: hard
-
-"@vaadin/vaadin-icon@npm:^21.0.2":
- version: 21.0.2
- resolution: "@vaadin/vaadin-icon@npm:21.0.2"
- dependencies:
- "@polymer/polymer": ^3.0.0
- "@vaadin/vaadin-element-mixin": ^21.0.2
- "@vaadin/vaadin-lumo-styles": ^21.0.2
- "@vaadin/vaadin-themable-mixin": ^21.0.2
- lit: ^2.0.0
- checksum: 993cd6d8bb6f52cc7ba0e1958824c77a3d56f3a3537ded361412d971174e3bb080780c039487390f7807faebe19f17b56aa1ffc63ad7672cf575d02664ee5880
- languageName: node
- linkType: hard
-
-"@vaadin/vaadin-item@npm:^21.0.2":
- version: 21.0.2
- resolution: "@vaadin/vaadin-item@npm:21.0.2"
- dependencies:
- "@polymer/polymer": ^3.0.0
- "@vaadin/vaadin-element-mixin": ^21.0.2
- "@vaadin/vaadin-lumo-styles": ^21.0.2
- "@vaadin/vaadin-material-styles": ^21.0.2
- "@vaadin/vaadin-themable-mixin": ^21.0.2
- checksum: b4ff73c0e4f6823f3eb06e3c79df4654e0485740d5928d5bbe95add0b70f4e7cf8abe03cf160c7fe9db2cd474689d0ba5ae3278e85de32bb31d8ab8f90b74e09
- languageName: node
- linkType: hard
-
-"@vaadin/vaadin-lumo-styles@npm:^21.0.2":
- version: 21.0.2
- resolution: "@vaadin/vaadin-lumo-styles@npm:21.0.2"
+"@vaadin/vaadin-lumo-styles@npm:^22.0.4":
+ version: 22.0.4
+ resolution: "@vaadin/vaadin-lumo-styles@npm:22.0.4"
dependencies:
"@polymer/iron-icon": ^3.0.0
"@polymer/iron-iconset-svg": ^3.0.0
"@polymer/polymer": ^3.0.0
- "@vaadin/vaadin-icon": ^21.0.2
- "@vaadin/vaadin-themable-mixin": ^21.0.2
- checksum: 99058edf60d4989a9eeef4651ff4d95fd901dafd91314e9a7ce02656466f1cb304f0225da4259dada2eaf257ff83bffed8c24730444e45a1b21a303a1b9a2a00
+ "@vaadin/icon": ^22.0.4
+ "@vaadin/vaadin-themable-mixin": ^22.0.4
+ checksum: 15e9becd675e0d12024fbdfaecedd03f55841f685932ff5cf8a2143641f895309f21b84f378f1fca3af538c3aba26dad81421f05a28f31ad7bb5550ede8a3aea
languageName: node
linkType: hard
-"@vaadin/vaadin-material-styles@npm:^21.0.2":
- version: 21.0.2
- resolution: "@vaadin/vaadin-material-styles@npm:21.0.2"
+"@vaadin/vaadin-material-styles@npm:^22.0.4":
+ version: 22.0.4
+ resolution: "@vaadin/vaadin-material-styles@npm:22.0.4"
dependencies:
"@polymer/polymer": ^3.0.0
- "@vaadin/vaadin-themable-mixin": ^21.0.2
- checksum: 0d5c5aa82cdaa09bb153333bdbd272ad3d137de6046a0a5e69245cb01394f7fb7a2a98b26a6e1b36d38736d32e3134c05cb00b35e5b39b410b31fc78aa55ff0e
+ "@vaadin/vaadin-themable-mixin": ^22.0.4
+ checksum: 0e341e03eab9641cc317a9cbf6d57e7d026539d7bc77159226625aad63a379f31cd70da5e02f10a3d79e9fe0cba1b058935beb2c5d98f146bfb9dd45d8634ee6
languageName: node
linkType: hard
-"@vaadin/vaadin-overlay@npm:^21.0.2":
- version: 21.0.2
- resolution: "@vaadin/vaadin-overlay@npm:21.0.2"
+"@vaadin/vaadin-overlay@npm:^22.0.4":
+ version: 22.0.4
+ resolution: "@vaadin/vaadin-overlay@npm:22.0.4"
dependencies:
"@polymer/polymer": ^3.0.0
- "@vaadin/vaadin-element-mixin": ^21.0.2
- "@vaadin/vaadin-lumo-styles": ^21.0.2
- "@vaadin/vaadin-material-styles": ^21.0.2
- "@vaadin/vaadin-themable-mixin": ^21.0.2
- checksum: a1d9556de019912bfc135bbf6e0b6062ac479047ed26d1db28a8255011826c94fa8df5c115d210d94e59c0f58bf444775422c92f8ff004bd2659720d4d33c8b3
+ "@vaadin/component-base": ^22.0.4
+ "@vaadin/vaadin-lumo-styles": ^22.0.4
+ "@vaadin/vaadin-material-styles": ^22.0.4
+ "@vaadin/vaadin-themable-mixin": ^22.0.4
+ checksum: 1b012ff0beac7879da498cf50ee0974d4c3e5637ebea7f7834b9bfc45b9f02e80c61267794c0f3f4e1d4853aa2f35113e1d94bc187d9fe072f37a03eb99f3ab6
languageName: node
linkType: hard
-"@vaadin/vaadin-text-field@npm:^21.0.2":
- version: 21.0.2
- resolution: "@vaadin/vaadin-text-field@npm:21.0.2"
+"@vaadin/vaadin-themable-mixin@npm:^22.0.4":
+ version: 22.0.4
+ resolution: "@vaadin/vaadin-themable-mixin@npm:22.0.4"
dependencies:
- "@polymer/polymer": ^3.0.0
- "@vaadin/vaadin-control-state-mixin": ^21.0.2
- "@vaadin/vaadin-element-mixin": ^21.0.2
- "@vaadin/vaadin-lumo-styles": ^21.0.2
- "@vaadin/vaadin-material-styles": ^21.0.2
- "@vaadin/vaadin-themable-mixin": ^21.0.2
- checksum: 8b7e08298e8d04ec9f7fede5c1f92dc5503a41004f421c8dae7e4fe69715225e74328caa232ba50d8164f8d9bf635806056f58af9f897c4b9913a95594d0b117
- languageName: node
- linkType: hard
-
-"@vaadin/vaadin-themable-mixin@npm:^21.0.2":
- version: 21.0.2
- resolution: "@vaadin/vaadin-themable-mixin@npm:21.0.2"
- dependencies:
- "@polymer/polymer": ^3.0.0
+ "@open-wc/dedupe-mixin": ^1.3.0
lit: ^2.0.0
- checksum: 1a3db436b2e08f5c68343380da03ac80e2d42cd108b152065c43e12acff3fc57ed595109b1e5a31efa092be7fc7f8f654342c29b8345e985dc89899154edfa8b
+ checksum: 0b2dce09626c92b85ff2d2ad48c8130239bf41fd95147a5fd4490cab4767f074ba9d1008d732d9e90b9219cb1ac0509f4a5fc8637eb5847d6d33e14b20552186
languageName: node
linkType: hard
@@ -9111,7 +9108,7 @@ fsevents@^1.2.7:
"@material/mwc-formfield": 0.25.3
"@material/mwc-icon-button": "patch:@material/mwc-icon-button@0.25.3#./.yarn/patches/@material/mwc-icon-button/remove-icon.patch"
"@material/mwc-linear-progress": 0.25.3
- "@material/mwc-list": 0.25.3
+ "@material/mwc-list": ^0.25.3
"@material/mwc-menu": 0.25.3
"@material/mwc-radio": 0.25.3
"@material/mwc-ripple": 0.25.3
@@ -9160,8 +9157,9 @@ fsevents@^1.2.7:
"@types/webspeechapi": ^0.0.29
"@typescript-eslint/eslint-plugin": ^4.32.0
"@typescript-eslint/parser": ^4.32.0
- "@vaadin/vaadin-combo-box": ^21.0.2
- "@vaadin/vaadin-date-picker": ^21.0.2
+ "@vaadin/combo-box": ^22.0.4
+ "@vaadin/date-picker": ^22.0.4
+ "@vaadin/vaadin-themable-mixin": ^22.0.4
"@vibrant/color": ^3.2.1-alpha.1
"@vibrant/core": ^3.2.1-alpha.1
"@vibrant/quantizer-mmcq": ^3.2.1-alpha.1
@@ -9214,7 +9212,7 @@ fsevents@^1.2.7:
lint-staged: ^11.1.2
lit: ^2.1.2
lit-analyzer: ^1.2.1
- lit-vaadin-helpers: ^0.2.1
+ lit-vaadin-helpers: ^0.3.0
lodash.template: ^4.5.0
magic-string: ^0.25.7
map-stream: ^0.0.7
@@ -10820,12 +10818,12 @@ fsevents@^1.2.7:
languageName: node
linkType: hard
-"lit-vaadin-helpers@npm:^0.2.1":
- version: 0.2.1
- resolution: "lit-vaadin-helpers@npm:0.2.1"
+"lit-vaadin-helpers@npm:^0.3.0":
+ version: 0.3.0
+ resolution: "lit-vaadin-helpers@npm:0.3.0"
dependencies:
lit: ^2.0.0
- checksum: 140a0e7fbf9cdd8ffe780ffb0ff44227553e4764ae73408a93ed3ef0a6d996d7646e3dbf05a1624ae0ad9ad152d2f43adb4a78cf61cd4f4b6f86cbe4e2252bb4
+ checksum: c96df23272442b3f6c38273721306eb650ea27876fade53ccfbb0158eef838865b1727b9657d35a80f55d94b1418106be63794adb064b79f35dfe3014fb435ff
languageName: node
linkType: hard
From 45e6ec1ee22beb5409d1bc79829ce6433108eadc Mon Sep 17 00:00:00 2001
From: Bram Kragten
Date: Sat, 5 Feb 2022 01:19:36 +0100
Subject: [PATCH 007/174] New date picker (#11555)
---
package.json | 2 +-
src/components/ha-date-input.ts | 157 ++++++------------
src/components/ha-dialog-date-picker.ts | 106 ++++++++++++
.../controls/more-info-input_datetime.ts | 1 +
.../hui-input-datetime-entity-row.ts | 1 +
yarn.lock | 124 +++++++++-----
6 files changed, 245 insertions(+), 146 deletions(-)
create mode 100644 src/components/ha-dialog-date-picker.ts
diff --git a/package.json b/package.json
index 7b3bf4a013..d8d7300978 100644
--- a/package.json
+++ b/package.json
@@ -89,13 +89,13 @@
"@polymer/polymer": "3.4.1",
"@thomasloven/round-slider": "0.5.4",
"@vaadin/combo-box": "^22.0.4",
- "@vaadin/date-picker": "^22.0.4",
"@vaadin/vaadin-themable-mixin": "^22.0.4",
"@vibrant/color": "^3.2.1-alpha.1",
"@vibrant/core": "^3.2.1-alpha.1",
"@vibrant/quantizer-mmcq": "^3.2.1-alpha.1",
"@vue/web-component-wrapper": "^1.2.0",
"@webcomponents/webcomponentsjs": "^2.2.10",
+ "app-datepicker": "^5.0.1",
"chart.js": "^3.3.2",
"comlink": "^4.3.1",
"core-js": "^3.15.2",
diff --git a/src/components/ha-date-input.ts b/src/components/ha-date-input.ts
index c83f5742c3..08c2590126 100644
--- a/src/components/ha-date-input.ts
+++ b/src/components/ha-date-input.ts
@@ -1,135 +1,76 @@
import { mdiCalendar } from "@mdi/js";
import "@polymer/paper-input/paper-input";
-import "@vaadin/date-picker/theme/material/vaadin-date-picker-light";
-import { css, CSSResultGroup, html, LitElement, PropertyValues } from "lit";
-import { customElement, property, query } from "lit/decorators";
+import { css, CSSResultGroup, html, LitElement } from "lit";
+import { customElement, property } from "lit/decorators";
+import { formatDateNumeric } from "../common/datetime/format_date";
import { fireEvent } from "../common/dom/fire_event";
+import { HomeAssistant } from "../types";
import "./ha-svg-icon";
-const i18n = {
- monthNames: [
- "January",
- "February",
- "March",
- "April",
- "May",
- "June",
- "July",
- "August",
- "September",
- "October",
- "November",
- "December",
- ],
- weekdays: [
- "Sunday",
- "Monday",
- "Tuesday",
- "Wednesday",
- "Thursday",
- "Friday",
- "Saturday",
- ],
- weekdaysShort: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"],
- firstDayOfWeek: 0,
- week: "Week",
- calendar: "Calendar",
- clear: "Clear",
- today: "Today",
- cancel: "Cancel",
- formatTitle: (monthName, fullYear) => monthName + " " + fullYear,
- formatDate: (d: { day: number; month: number; year: number }) =>
- [
- ("0000" + String(d.year)).slice(-4),
- ("0" + String(d.month + 1)).slice(-2),
- ("0" + String(d.day)).slice(-2),
- ].join("-"),
- parseDate: (text: string) => {
- const parts = text.split("-");
- const today = new Date();
- let date;
- let month = today.getMonth();
- let year = today.getFullYear();
- if (parts.length === 3) {
- year = parseInt(parts[0]);
- if (parts[0].length < 3 && year >= 0) {
- year += year < 50 ? 2000 : 1900;
- }
- month = parseInt(parts[1]) - 1;
- date = parseInt(parts[2]);
- } else if (parts.length === 2) {
- month = parseInt(parts[0]) - 1;
- date = parseInt(parts[1]);
- } else if (parts.length === 1) {
- date = parseInt(parts[0]);
- }
+const loadDatePickerDialog = () => import("./ha-dialog-date-picker");
- if (date !== undefined) {
- return { day: date, month, year };
- }
- return undefined;
- },
+export interface datePickerDialogParams {
+ value?: string;
+ min?: string;
+ max?: string;
+ locale?: string;
+ onChange: (value: string) => void;
+}
+
+const showDatePickerDialog = (
+ element: HTMLElement,
+ dialogParams: datePickerDialogParams
+): void => {
+ fireEvent(element, "show-dialog", {
+ dialogTag: "ha-dialog-date-picker",
+ dialogImport: loadDatePickerDialog,
+ dialogParams,
+ });
};
@customElement("ha-date-input")
export class HaDateInput extends LitElement {
+ @property({ attribute: false }) public locale!: HomeAssistant["locale"];
+
@property() public value?: string;
@property({ type: Boolean }) public disabled = false;
@property() public label?: string;
- @query("vaadin-date-picker-light", true) private _datePicker;
-
- private _inited = false;
-
- updated(changedProps: PropertyValues) {
- if (changedProps.has("value")) {
- this._datePicker.value = this.value;
- this._inited = true;
- }
- }
-
render() {
- return html`
-
-
-
- `;
+
+ `;
}
- private _valueChanged(ev: CustomEvent) {
- if (
- !this.value ||
- (this._inited && !this._compareStringDates(ev.detail.value, this.value))
- ) {
- this.value = ev.detail.value;
+ private _openDialog() {
+ if (this.disabled) {
+ return;
+ }
+ showDatePickerDialog(this, {
+ min: "1970-01-01",
+ value: this.value,
+ onChange: (value) => this._valueChanged(value),
+ locale: this.locale.language,
+ });
+ }
+
+ private _valueChanged(value: string) {
+ if (this.value !== value) {
+ this.value = value;
fireEvent(this, "change");
- fireEvent(this, "value-changed", { value: ev.detail.value });
+ fireEvent(this, "value-changed", { value });
}
}
- private _compareStringDates(a: string, b: string): boolean {
- const aParts = a.split("-");
- const bParts = b.split("-");
- let i = 0;
- for (const aPart of aParts) {
- if (Number(aPart) !== Number(bParts[i])) {
- return false;
- }
- i++;
- }
- return true;
- }
-
static get styles(): CSSResultGroup {
return css`
paper-input {
diff --git a/src/components/ha-dialog-date-picker.ts b/src/components/ha-dialog-date-picker.ts
new file mode 100644
index 0000000000..2cb229db7b
--- /dev/null
+++ b/src/components/ha-dialog-date-picker.ts
@@ -0,0 +1,106 @@
+import "@material/mwc-button/mwc-button";
+import "app-datepicker";
+import { css, html, LitElement } from "lit";
+import { customElement, property, state } from "lit/decorators";
+import { fireEvent } from "../common/dom/fire_event";
+import { haStyleDialog } from "../resources/styles";
+import { datePickerDialogParams } from "./ha-date-input";
+import "./ha-dialog";
+
+@customElement("ha-dialog-date-picker")
+export class HaDialogDatePicker extends LitElement {
+ @property() public value?: string;
+
+ @property({ type: Boolean }) public disabled = false;
+
+ @property() public label?: string;
+
+ @state() private _params?: datePickerDialogParams;
+
+ @state() private _value?: string;
+
+ public showDialog(params: datePickerDialogParams): void {
+ this._params = params;
+ this._value = params.value;
+ }
+
+ public closeDialog() {
+ this._params = undefined;
+ fireEvent(this, "dialog-closed", { dialog: this.localName });
+ }
+
+ render() {
+ if (!this._params) {
+ return html``;
+ }
+ return html`
+
+ today
+
+ cancel
+
+ ok
+ `;
+ }
+
+ private _valueChanged(ev: CustomEvent) {
+ this._value = ev.detail.value;
+ }
+
+ private _setToday() {
+ this._value = new Date().toISOString().split("T")[0];
+ }
+
+ private _setValue() {
+ this._params?.onChange(this._value!);
+ this.closeDialog();
+ }
+
+ static styles = [
+ haStyleDialog,
+ css`
+ ha-dialog {
+ --dialog-content-padding: 0;
+ --justify-action-buttons: space-between;
+ }
+ app-datepicker {
+ --app-datepicker-accent-color: var(--primary-color);
+ --app-datepicker-bg-color: transparent;
+ --app-datepicker-color: var(--primary-text-color);
+ --app-datepicker-disabled-day-color: var(--disabled-text-color);
+ --app-datepicker-focused-day-color: var(--text-primary-color);
+ --app-datepicker-focused-year-bg-color: var(--primary-color);
+ --app-datepicker-selector-color: var(--secondary-text-color);
+ --app-datepicker-separator-color: var(--divider-color);
+ --app-datepicker-weekday-color: var(--secondary-text-color);
+ }
+ app-datepicker::part(calendar-day):focus {
+ outline: none;
+ }
+ @media all and (min-width: 450px) {
+ ha-dialog {
+ --mdc-dialog-min-width: 300px;
+ }
+ }
+ @media all and (max-width: 450px), all and (max-height: 500px) {
+ app-datepicker {
+ width: 100%;
+ }
+ }
+ `,
+ ];
+}
+
+declare global {
+ interface HTMLElementTagNameMap {
+ "ha-dialog-date-picker": HaDialogDatePicker;
+ }
+}
diff --git a/src/dialogs/more-info/controls/more-info-input_datetime.ts b/src/dialogs/more-info/controls/more-info-input_datetime.ts
index af1e9aa6a1..4d1be5c70b 100644
--- a/src/dialogs/more-info/controls/more-info-input_datetime.ts
+++ b/src/dialogs/more-info/controls/more-info-input_datetime.ts
@@ -23,6 +23,7 @@ class MoreInfoInputDatetime extends LitElement {
this.stateObj.attributes.has_date
? html`
Date: Sat, 5 Feb 2022 04:16:01 +0100
Subject: [PATCH 008/174] Link via device on device page (#11554)
Co-authored-by: Zack Barett
---
.../device-detail/ha-device-info-card.ts | 63 ++++++++++---------
1 file changed, 35 insertions(+), 28 deletions(-)
diff --git a/src/panels/config/devices/device-detail/ha-device-info-card.ts b/src/panels/config/devices/device-detail/ha-device-info-card.ts
index 19176d0fbe..ce8e553b06 100644
--- a/src/panels/config/devices/device-detail/ha-device-info-card.ts
+++ b/src/panels/config/devices/device-detail/ha-device-info-card.ts
@@ -5,6 +5,7 @@ import {
computeDeviceName,
DeviceRegistryEntry,
} from "../../../../data/device_registry";
+import { haStyle } from "../../../../resources/styles";
import { HomeAssistant } from "../../../../types";
import { loadDeviceRegistryDetailDialog } from "../device-registry-detail/show-dialog-device-registry-detail";
@@ -55,10 +56,13 @@ export class HaDeviceCard extends LitElement {
"ui.panel.config.integrations.config_entry.via"
)}
${this._computeDeviceName(
- this.devices,
- this.device.via_device_id
- )} ${this._computeDeviceName(
+ this.devices,
+ this.device.via_device_id
+ )}
`
@@ -112,29 +116,32 @@ export class HaDeviceCard extends LitElement {
}
static get styles(): CSSResultGroup {
- return css`
- :host {
- display: block;
- }
- ha-card {
- flex: 1 0 100%;
- min-width: 0;
- }
- .device {
- width: 30%;
- }
- .area {
- color: var(--primary-text-color);
- }
- .extra-info {
- margin-top: 8px;
- word-wrap: break-word;
- }
- .manuf,
- .model {
- color: var(--secondary-text-color);
- word-wrap: break-word;
- }
- `;
+ return [
+ haStyle,
+ css`
+ :host {
+ display: block;
+ }
+ ha-card {
+ flex: 1 0 100%;
+ min-width: 0;
+ }
+ .device {
+ width: 30%;
+ }
+ .area {
+ color: var(--primary-text-color);
+ }
+ .extra-info {
+ margin-top: 8px;
+ word-wrap: break-word;
+ }
+ .manuf,
+ .model {
+ color: var(--secondary-text-color);
+ word-wrap: break-word;
+ }
+ `,
+ ];
}
}
From 9be5a15c77d752ac6626becdb72acee6a659031d Mon Sep 17 00:00:00 2001
From: "J. Nick Koston"
Date: Sat, 5 Feb 2022 10:44:48 -0600
Subject: [PATCH 009/174] Add integration_discovery to discovery sources
(#11564)
---
src/data/config_flow.ts | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/data/config_flow.ts b/src/data/config_flow.ts
index 92352fafc9..39019393c5 100644
--- a/src/data/config_flow.ts
+++ b/src/data/config_flow.ts
@@ -13,6 +13,7 @@ export const DISCOVERY_SOURCES = [
"ssdp",
"zeroconf",
"discovery",
+ "integration_discovery",
"mqtt",
"hassio",
];
From 04668ad809174dc0286baa2b31e7433dcdc5e891 Mon Sep 17 00:00:00 2001
From: Bram Kragten
Date: Sun, 6 Feb 2022 23:26:42 +0100
Subject: [PATCH 010/174] Remember filter between navigation (#11565)
---
src/components/data-table/ha-data-table.ts | 3 +++
src/layouts/hass-tabs-subpage-data-table.ts | 3 +++
src/panels/config/devices/ha-config-devices-dashboard.ts | 3 ++-
src/panels/config/entities/ha-config-entities.ts | 3 ++-
src/panels/config/integrations/ha-config-integrations.ts | 3 ++-
5 files changed, 12 insertions(+), 3 deletions(-)
diff --git a/src/components/data-table/ha-data-table.ts b/src/components/data-table/ha-data-table.ts
index b2d669105b..af06549c80 100644
--- a/src/components/data-table/ha-data-table.ts
+++ b/src/components/data-table/ha-data-table.ts
@@ -571,6 +571,9 @@ export class HaDataTable extends LitElement {
}
private _handleSearchChange(ev: CustomEvent): void {
+ if (this.filter) {
+ return;
+ }
this._debounceSearch(ev.detail.value);
}
diff --git a/src/layouts/hass-tabs-subpage-data-table.ts b/src/layouts/hass-tabs-subpage-data-table.ts
index b92f35e2e9..c291eab335 100644
--- a/src/layouts/hass-tabs-subpage-data-table.ts
+++ b/src/layouts/hass-tabs-subpage-data-table.ts
@@ -234,6 +234,9 @@ export class HaTabsSubpageDataTable extends LitElement {
}
private _handleSearchChange(ev: CustomEvent) {
+ if (this.filter === ev.detail.value) {
+ return;
+ }
this.filter = ev.detail.value;
fireEvent(this, "search-changed", { value: this.filter });
}
diff --git a/src/panels/config/devices/ha-config-devices-dashboard.ts b/src/panels/config/devices/ha-config-devices-dashboard.ts
index 8b541f711a..76b3c5d87f 100644
--- a/src/panels/config/devices/ha-config-devices-dashboard.ts
+++ b/src/panels/config/devices/ha-config-devices-dashboard.ts
@@ -67,7 +67,7 @@ export class HaConfigDeviceDashboard extends LitElement {
@state() private _showDisabled = false;
- @state() private _filter = "";
+ @state() private _filter: string = history.state?.filter || "";
@state() private _numHiddenDevices = 0;
@@ -490,6 +490,7 @@ export class HaConfigDeviceDashboard extends LitElement {
private _handleSearchChange(ev: CustomEvent) {
this._filter = ev.detail.value;
+ history.replaceState({ filter: this._filter }, "");
}
private _clearFilter() {
diff --git a/src/panels/config/entities/ha-config-entities.ts b/src/panels/config/entities/ha-config-entities.ts
index fb91132d8c..7c03fd89f3 100644
--- a/src/panels/config/entities/ha-config-entities.ts
+++ b/src/panels/config/entities/ha-config-entities.ts
@@ -109,7 +109,7 @@ export class HaConfigEntities extends SubscribeMixin(LitElement) {
@state() private _showReadOnly = true;
- @state() private _filter = "";
+ @state() private _filter: string = history.state?.filter || "";
@state() private _numHiddenEntities = 0;
@@ -711,6 +711,7 @@ export class HaConfigEntities extends SubscribeMixin(LitElement) {
private _handleSearchChange(ev: CustomEvent) {
this._filter = ev.detail.value;
+ history.replaceState({ filter: this._filter }, "");
}
private _handleSelectionChanged(
diff --git a/src/panels/config/integrations/ha-config-integrations.ts b/src/panels/config/integrations/ha-config-integrations.ts
index 686eeaaa60..7aa599d8a2 100644
--- a/src/panels/config/integrations/ha-config-integrations.ts
+++ b/src/panels/config/integrations/ha-config-integrations.ts
@@ -137,7 +137,7 @@ class HaConfigIntegrations extends SubscribeMixin(LitElement) {
window.location.hash.substring(1)
);
- @state() private _filter?: string;
+ @state() private _filter: string = history.state?.filter || "";
@state() private _diagnosticHandlers?: Record;
@@ -613,6 +613,7 @@ class HaConfigIntegrations extends SubscribeMixin(LitElement) {
private _handleSearchChange(ev: CustomEvent) {
this._filter = ev.detail.value;
+ history.replaceState({ filter: this._filter }, "");
}
private async _highlightEntry() {
From 4092f7f75d7dae2f7e0f35d702f98bd8eba2c084 Mon Sep 17 00:00:00 2001
From: Bram Kragten
Date: Sun, 6 Feb 2022 23:29:28 +0100
Subject: [PATCH 011/174] Convert selectors to MWC (#11543)
---
gallery/src/pages/components/ha-selector.ts | 9 +++-
package.json | 1 +
src/components/ha-form/ha-form-integer.ts | 2 +-
.../ha-selector/ha-selector-number.ts | 21 ++++-----
.../ha-selector/ha-selector-select.ts | 47 ++++++++-----------
.../ha-selector/ha-selector-target.ts | 5 --
.../ha-selector/ha-selector-text.ts | 38 +++++++++------
yarn.lock | 15 +++++-
8 files changed, 77 insertions(+), 61 deletions(-)
diff --git a/gallery/src/pages/components/ha-selector.ts b/gallery/src/pages/components/ha-selector.ts
index b25790a299..e2cd0425ec 100644
--- a/gallery/src/pages/components/ha-selector.ts
+++ b/gallery/src/pages/components/ha-selector.ts
@@ -48,10 +48,15 @@ const SCHEMAS: {
boolean: { name: "Boolean", selector: { boolean: {} } },
time: { name: "Time", selector: { time: {} } },
action: { name: "Action", selector: { action: {} } },
- text: { name: "Text", selector: { text: { multiline: false } } },
+ text: {
+ name: "Text",
+ selector: { text: { multiline: false } },
+ },
text_multiline: {
name: "Text multiline",
- selector: { text: { multiline: true } },
+ selector: {
+ text: { multiline: true },
+ },
},
object: { name: "Object", selector: { object: {} } },
select: {
diff --git a/package.json b/package.json
index d8d7300978..6b536e78ff 100644
--- a/package.json
+++ b/package.json
@@ -67,6 +67,7 @@
"@material/mwc-switch": "0.25.3",
"@material/mwc-tab": "0.25.3",
"@material/mwc-tab-bar": "0.25.3",
+ "@material/mwc-textarea": "^0.25.3",
"@material/mwc-textfield": "0.25.3",
"@material/mwc-top-app-bar-fixed": "^0.25.3",
"@material/top-app-bar": "14.0.0-canary.261f2db59.0",
diff --git a/src/components/ha-form/ha-form-integer.ts b/src/components/ha-form/ha-form-integer.ts
index d4d52fec23..3a684a3d40 100644
--- a/src/components/ha-form/ha-form-integer.ts
+++ b/src/components/ha-form/ha-form-integer.ts
@@ -25,7 +25,7 @@ export class HaFormInteger extends LitElement implements HaFormElement {
@property({ type: Boolean }) public disabled = false;
- @query("paper-input ha-slider") private _input?: HTMLElement;
+ @query("mwc-textfield ha-slider") private _input?: HTMLElement;
private _lastValue?: HaFormIntegerData;
diff --git a/src/components/ha-selector/ha-selector-number.ts b/src/components/ha-selector/ha-selector-number.ts
index 244f97e2ce..6b2652b5b9 100644
--- a/src/components/ha-selector/ha-selector-number.ts
+++ b/src/components/ha-selector/ha-selector-number.ts
@@ -1,4 +1,3 @@
-import "@polymer/paper-input/paper-input";
import { css, CSSResultGroup, html, LitElement } from "lit";
import { customElement, property } from "lit/decorators";
import { classMap } from "lit/directives/class-map";
@@ -6,6 +5,7 @@ import { fireEvent } from "../../common/dom/fire_event";
import { NumberSelector } from "../../data/selector";
import { HomeAssistant } from "../../types";
import "../ha-slider";
+import "@material/mwc-textfield/mwc-textfield";
@customElement("ha-selector-number")
export class HaNumberSelector extends LitElement {
@@ -36,27 +36,23 @@ export class HaNumberSelector extends LitElement {
>
`
: ""}
-
- ${this.selector.number.unit_of_measurement
- ? html`
- ${this.selector.number.unit_of_measurement}
-
`
- : ""}
- `;
+ `;
}
private get _value() {
@@ -94,6 +90,9 @@ export class HaNumberSelector extends LitElement {
ha-slider {
flex: 1;
}
+ mwc-textfield {
+ width: 70px;
+ }
.single {
flex: 1;
}
diff --git a/src/components/ha-selector/ha-selector-select.ts b/src/components/ha-selector/ha-selector-select.ts
index 450a6d7e6a..eaaca5a6ea 100644
--- a/src/components/ha-selector/ha-selector-select.ts
+++ b/src/components/ha-selector/ha-selector-select.ts
@@ -1,9 +1,11 @@
import { css, CSSResultGroup, html, LitElement } from "lit";
import { customElement, property } from "lit/decorators";
import { fireEvent } from "../../common/dom/fire_event";
+import { stopPropagation } from "../../common/dom/stop_propagation";
import { SelectSelector } from "../../data/selector";
import { HomeAssistant } from "../../types";
-import "../ha-paper-dropdown-menu";
+import "@material/mwc-select/mwc-select";
+import "@material/mwc-list/mwc-list-item";
@customElement("ha-selector-select")
export class HaSelectSelector extends LitElement {
@@ -18,46 +20,37 @@ export class HaSelectSelector extends LitElement {
@property({ type: Boolean }) public disabled = false;
protected render() {
- return html`
-
- ${this.selector.select.options.map(
- (item: string) => html`
- ${item}
- `
- )}
-
- `;
+ ${this.selector.select.options.map(
+ (item: string) => html`
+ ${item}
+ `
+ )}
+ `;
}
private _valueChanged(ev) {
- if (this.disabled || !ev.detail.value) {
+ ev.stopPropagation();
+ if (this.disabled || !ev.target.value) {
return;
}
fireEvent(this, "value-changed", {
- value: ev.detail.value.itemValue,
+ value: ev.target.value,
});
}
static get styles(): CSSResultGroup {
return css`
- ha-paper-dropdown-menu {
+ mwc-select {
width: 100%;
- min-width: 200px;
- display: block;
- }
- paper-listbox {
- min-width: 200px;
- }
- paper-item {
- cursor: pointer;
}
`;
}
diff --git a/src/components/ha-selector/ha-selector-target.ts b/src/components/ha-selector/ha-selector-target.ts
index 6ed0251665..4d81be67df 100644
--- a/src/components/ha-selector/ha-selector-target.ts
+++ b/src/components/ha-selector/ha-selector-target.ts
@@ -1,8 +1,3 @@
-import "@material/mwc-list/mwc-list";
-import "@material/mwc-list/mwc-list-item";
-import "@material/mwc-tab-bar/mwc-tab-bar";
-import "@material/mwc-tab/mwc-tab";
-import "@polymer/paper-input/paper-input";
import {
HassEntity,
HassServiceTarget,
diff --git a/src/components/ha-selector/ha-selector-text.ts b/src/components/ha-selector/ha-selector-text.ts
index 25cddf58d8..f0a093de79 100644
--- a/src/components/ha-selector/ha-selector-text.ts
+++ b/src/components/ha-selector/ha-selector-text.ts
@@ -1,10 +1,10 @@
-import "@polymer/paper-input/paper-input";
-import "@polymer/paper-input/paper-textarea";
-import { html, LitElement } from "lit";
+import { css, CSSResultGroup, html, LitElement } from "lit";
import { customElement, property } from "lit/decorators";
import { fireEvent } from "../../common/dom/fire_event";
import { StringSelector } from "../../data/selector";
import { HomeAssistant } from "../../types";
+import "@material/mwc-textfield/mwc-textfield";
+import "@material/mwc-textarea/mwc-textarea";
@customElement("ha-selector-text")
export class HaTextSelector extends LitElement {
@@ -22,25 +22,26 @@ export class HaTextSelector extends LitElement {
protected render() {
if (this.selector.text?.multiline) {
- return html` `;
+ required
+ >`;
}
- return html` `;
+ @input=${this._handleChange}
+ .label=${this.label || ""}
+ required
+ >`;
}
private _handleChange(ev) {
@@ -50,6 +51,15 @@ export class HaTextSelector extends LitElement {
}
fireEvent(this, "value-changed", { value });
}
+
+ static get styles(): CSSResultGroup {
+ return css`
+ mwc-textfield,
+ mwc-textarea {
+ width: 100%;
+ }
+ `;
+ }
}
declare global {
diff --git a/yarn.lock b/yarn.lock
index 307a488dc3..8d3c0ef776 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -2665,7 +2665,19 @@ __metadata:
languageName: node
linkType: hard
-"@material/mwc-textfield@npm:0.25.3":
+"@material/mwc-textarea@npm:^0.25.3":
+ version: 0.25.3
+ resolution: "@material/mwc-textarea@npm:0.25.3"
+ dependencies:
+ "@material/mwc-base": ^0.25.3
+ "@material/mwc-textfield": ^0.25.3
+ lit: ^2.0.0
+ tslib: ^2.0.1
+ checksum: 918e28b72f7c687c481cd9ee00f652cd6c212d37cd281197cb02c87f04153792c5a60a86276e82f44684e7c7b4947e0e2e5fceaa08fc075a030ea769c1501d8e
+ languageName: node
+ linkType: hard
+
+"@material/mwc-textfield@npm:0.25.3, @material/mwc-textfield@npm:^0.25.3":
version: 0.25.3
resolution: "@material/mwc-textfield@npm:0.25.3"
dependencies:
@@ -9133,6 +9145,7 @@ fsevents@^1.2.7:
"@material/mwc-switch": 0.25.3
"@material/mwc-tab": 0.25.3
"@material/mwc-tab-bar": 0.25.3
+ "@material/mwc-textarea": ^0.25.3
"@material/mwc-textfield": 0.25.3
"@material/mwc-top-app-bar-fixed": ^0.25.3
"@material/top-app-bar": 14.0.0-canary.261f2db59.0
From d05f807b9df66d69a8a8b3829509459b9b26161f Mon Sep 17 00:00:00 2001
From: Bram Kragten
Date: Sun, 6 Feb 2022 23:31:46 +0100
Subject: [PATCH 012/174] Covert area picker to combo-box (#11562)
---
src/components/ha-area-picker.ts | 154 +++++++++++--------------------
src/components/ha-combo-box.ts | 4 +-
src/translations/en.json | 1 +
3 files changed, 57 insertions(+), 102 deletions(-)
diff --git a/src/components/ha-area-picker.ts b/src/components/ha-area-picker.ts
index b6504f9dc1..bfb39ac3da 100644
--- a/src/components/ha-area-picker.ts
+++ b/src/components/ha-area-picker.ts
@@ -1,19 +1,6 @@
-import { mdiCheck, mdiClose, mdiMenuDown, mdiMenuUp } from "@mdi/js";
-import "@polymer/paper-input/paper-input";
-import "@polymer/paper-item/paper-item";
-import "@polymer/paper-item/paper-item-body";
-import "@polymer/paper-listbox/paper-listbox";
-import "@vaadin/combo-box/theme/material/vaadin-combo-box-light";
import { UnsubscribeFunc } from "home-assistant-js-websocket";
-import {
- css,
- CSSResultGroup,
- html,
- LitElement,
- PropertyValues,
- TemplateResult,
-} from "lit";
-import { ComboBoxLitRenderer, comboBoxRenderer } from "lit-vaadin-helpers";
+import { html, LitElement, PropertyValues, TemplateResult } from "lit";
+import { ComboBoxLitRenderer } from "lit-vaadin-helpers";
import { customElement, property, query, state } from "lit/decorators";
import { classMap } from "lit/directives/class-map";
import memoizeOne from "memoize-one";
@@ -41,38 +28,18 @@ import { SubscribeMixin } from "../mixins/subscribe-mixin";
import { PolymerChangedEvent } from "../polymer-types";
import { HomeAssistant } from "../types";
import type { HaDevicePickerDeviceFilterFunc } from "./device/ha-device-picker";
+import type { HaComboBox } from "./ha-combo-box";
+import "./ha-combo-box";
import "./ha-icon-button";
import "./ha-svg-icon";
const rowRenderer: ComboBoxLitRenderer = (
item
- // eslint-disable-next-line lit/prefer-static-styles
-) => html`
-
-
- ${item.name}
- `;
+) => html`
+ ${item.name}
+ `;
@customElement("ha-area-picker")
export class HaAreaPicker extends SubscribeMixin(LitElement) {
@@ -125,7 +92,9 @@ export class HaAreaPicker extends SubscribeMixin(LitElement) {
@state() private _opened?: boolean;
- @query("vaadin-combo-box-light", true) public comboBox!: HTMLElement;
+ @query("ha-combo-box", true) public comboBox!: HaComboBox;
+
+ private _filter?: string;
private _init = false;
@@ -145,13 +114,13 @@ export class HaAreaPicker extends SubscribeMixin(LitElement) {
public open() {
this.updateComplete.then(() => {
- (this.shadowRoot?.querySelector("vaadin-combo-box-light") as any)?.open();
+ this.comboBox?.open();
});
}
public focus() {
this.updateComplete.then(() => {
- this.shadowRoot?.querySelector("paper-input")?.focus();
+ this.comboBox?.focus();
});
}
@@ -339,52 +308,25 @@ export class HaAreaPicker extends SubscribeMixin(LitElement) {
return html``;
}
return html`
-
-
- ${this.value
- ? html`
-
- `
- : ""}
-
-
-
-
+
`;
}
@@ -392,9 +334,29 @@ export class HaAreaPicker extends SubscribeMixin(LitElement) {
this._areas?.find((area) => area.area_id === areaId)
);
- private _clearValue(ev: Event) {
- ev.stopPropagation();
- this._setValue("");
+ private _filterChanged(ev: CustomEvent): void {
+ this._filter = ev.detail.value;
+ if (!this._filter) {
+ this.comboBox.filteredItems = this.comboBox.items;
+ return;
+ }
+ // @ts-ignore
+ if (!this.noAdd && this.comboBox._comboBox.filteredItems?.length === 0) {
+ this.comboBox.filteredItems = [
+ {
+ area_id: "add_new_suggestion",
+ name: this.hass.localize(
+ "ui.components.area-picker.add_new_sugestion",
+ { name: this._filter }
+ ),
+ picture: null,
+ },
+ ];
+ } else {
+ this.comboBox.filteredItems = this.comboBox.items?.filter((item) =>
+ item.name.toLowerCase().includes(this._filter!.toLowerCase())
+ );
+ }
}
private get _value() {
@@ -406,9 +368,10 @@ export class HaAreaPicker extends SubscribeMixin(LitElement) {
}
private _areaChanged(ev: PolymerChangedEvent) {
+ ev.stopPropagation();
const newValue = ev.detail.value;
- if (newValue !== "add_new") {
+ if (!["add_new_suggestion", "add_new"].includes(newValue)) {
if (newValue !== this._value) {
this._setValue(newValue);
}
@@ -425,6 +388,8 @@ export class HaAreaPicker extends SubscribeMixin(LitElement) {
inputLabel: this.hass.localize(
"ui.components.area-picker.add_dialog.name"
),
+ defaultValue:
+ newValue === "add_new_suggestion" ? this._filter : undefined,
confirm: async (name) => {
if (!name) {
return;
@@ -445,6 +410,8 @@ export class HaAreaPicker extends SubscribeMixin(LitElement) {
this.entityFilter,
this.noAdd
);
+ await this.updateComplete;
+ await this.comboBox.updateComplete;
this._setValue(area.area_id);
} catch (err: any) {
showAlertDialog(this, {
@@ -465,19 +432,6 @@ export class HaAreaPicker extends SubscribeMixin(LitElement) {
fireEvent(this, "change");
}, 0);
}
-
- static get styles(): CSSResultGroup {
- return css`
- paper-input > ha-icon-button {
- --mdc-icon-button-size: 24px;
- padding: 2px;
- color: var(--secondary-text-color);
- }
- [hidden] {
- display: none;
- }
- `;
- }
}
declare global {
diff --git a/src/components/ha-combo-box.ts b/src/components/ha-combo-box.ts
index dd2b5d0e27..c4717b4d33 100644
--- a/src/components/ha-combo-box.ts
+++ b/src/components/ha-combo-box.ts
@@ -63,9 +63,9 @@ export class HaComboBox extends LitElement {
@property() public value?: string;
- @property() public items?: [];
+ @property() public items?: any[];
- @property() public filteredItems?: [];
+ @property() public filteredItems?: any[];
@property({ attribute: "allow-custom-value", type: Boolean })
public allowCustomValue?: boolean;
diff --git a/src/translations/en.json b/src/translations/en.json
index 034810a867..42eb7db2f6 100755
--- a/src/translations/en.json
+++ b/src/translations/en.json
@@ -401,6 +401,7 @@
"clear": "Clear",
"show_areas": "Show areas",
"area": "Area",
+ "add_new_sugestion": "Add new area ''{name}''",
"add_new": "Add new area…",
"no_areas": "You don't have any areas",
"no_match": "No matching areas found",
From 76af6e48cd01de4b0258bac686ad0903f55f5be7 Mon Sep 17 00:00:00 2001
From: Bram Kragten
Date: Mon, 7 Feb 2022 10:59:11 +0100
Subject: [PATCH 013/174] Convert entity picker to ha-combo (#11560)
* Convert entity picker to ha-combo
* Update ha-entity-picker.ts
* Handle empty better
* Clear value when no device/area/entity
---
src/components/device/ha-device-picker.ts | 13 +-
src/components/entity/ha-entity-picker.ts | 174 +++++++------------
src/components/entity/ha-statistic-picker.ts | 2 +-
src/components/ha-area-picker.ts | 10 +-
src/components/ha-selector/ha-selector.ts | 6 +-
src/translations/en.json | 1 +
6 files changed, 77 insertions(+), 129 deletions(-)
diff --git a/src/components/device/ha-device-picker.ts b/src/components/device/ha-device-picker.ts
index 1161505eeb..d1a7d2b55a 100644
--- a/src/components/device/ha-device-picker.ts
+++ b/src/components/device/ha-device-picker.ts
@@ -38,7 +38,7 @@ export type HaDevicePickerDeviceFilterFunc = (
) => boolean;
const rowRenderer: ComboBoxLitRenderer = (item) => html`
${item.name}
${item.area}
@@ -105,7 +105,7 @@ export class HaDevicePicker extends SubscribeMixin(LitElement) {
if (!devices.length) {
return [
{
- id: "",
+ id: "no_devices",
area: "",
name: this.hass.localize("ui.components.device-picker.no_devices"),
},
@@ -201,7 +201,7 @@ export class HaDevicePicker extends SubscribeMixin(LitElement) {
if (!outputDevices.length) {
return [
{
- id: "",
+ id: "no_devices",
area: "",
name: this.hass.localize("ui.components.device-picker.no_match"),
},
@@ -270,7 +270,6 @@ export class HaDevicePicker extends SubscribeMixin(LitElement) {
.renderer=${rowRenderer}
.disabled=${this.disabled}
item-value-path="id"
- item-id-path="id"
item-label-path="name"
@opened-changed=${this._openedChanged}
@value-changed=${this._deviceChanged}
@@ -284,7 +283,11 @@ export class HaDevicePicker extends SubscribeMixin(LitElement) {
private _deviceChanged(ev: PolymerChangedEvent) {
ev.stopPropagation();
- const newValue = ev.detail.value;
+ let newValue = ev.detail.value;
+
+ if (newValue === "no_devices") {
+ newValue = "";
+ }
if (newValue !== this._value) {
this._setValue(newValue);
diff --git a/src/components/entity/ha-entity-picker.ts b/src/components/entity/ha-entity-picker.ts
index a455bb988a..d24f6fbac4 100644
--- a/src/components/entity/ha-entity-picker.ts
+++ b/src/components/entity/ha-entity-picker.ts
@@ -1,25 +1,16 @@
-import { mdiCheck, mdiClose, mdiMenuDown, mdiMenuUp } from "@mdi/js";
-import "@polymer/paper-input/paper-input";
-import "@polymer/paper-item/paper-icon-item";
-import "@polymer/paper-item/paper-item-body";
-import "@vaadin/combo-box/theme/material/vaadin-combo-box-light";
+import "@material/mwc-list/mwc-list-item";
import { HassEntity } from "home-assistant-js-websocket";
-import {
- css,
- CSSResultGroup,
- html,
- LitElement,
- PropertyValues,
- TemplateResult,
-} from "lit";
-import { ComboBoxLitRenderer, comboBoxRenderer } from "lit-vaadin-helpers";
-import { customElement, property, query } from "lit/decorators";
+import { html, LitElement, PropertyValues, TemplateResult } from "lit";
+import { ComboBoxLitRenderer } from "lit-vaadin-helpers";
+import { customElement, property, query, state } from "lit/decorators";
import memoizeOne from "memoize-one";
import { fireEvent } from "../../common/dom/fire_event";
import { computeDomain } from "../../common/entity/compute_domain";
import { computeStateName } from "../../common/entity/compute_state_name";
import { PolymerChangedEvent } from "../../polymer-types";
import { HomeAssistant } from "../../types";
+import "../ha-combo-box";
+import type { HaComboBox } from "../ha-combo-box";
import "../ha-icon-button";
import "../ha-svg-icon";
import "./state-badge";
@@ -27,35 +18,15 @@ import "./state-badge";
export type HaEntityPickerEntityFilterFunc = (entityId: HassEntity) => boolean;
// eslint-disable-next-line lit/prefer-static-styles
-const rowRenderer: ComboBoxLitRenderer = (item) => html`
-
-
-
-
- ${computeStateName(item)}
- ${item.entity_id}
-
- `;
-
+const rowRenderer: ComboBoxLitRenderer =
+ (item) =>
+ html`
+ ${item.state
+ ? html` `
+ : ""}
+ ${item.friendly_name}
+ ${item.entity_id}
+ `;
@customElement("ha-entity-picker")
export class HaEntityPicker extends LitElement {
@property({ attribute: false }) public hass!: HomeAssistant;
@@ -107,19 +78,19 @@ export class HaEntityPicker extends LitElement {
@property({ type: Boolean }) public hideClearIcon = false;
- @property({ type: Boolean }) private _opened = false;
+ @state() private _opened = false;
- @query("vaadin-combo-box-light", true) private comboBox!: HTMLElement;
+ @query("ha-combo-box", true) public comboBox!: HaComboBox;
public open() {
this.updateComplete.then(() => {
- (this.shadowRoot?.querySelector("vaadin-combo-box-light") as any)?.open();
+ this.comboBox?.open();
});
}
public focus() {
this.updateComplete.then(() => {
- this.shadowRoot?.querySelector("paper-input")?.focus();
+ this.comboBox?.focus();
});
}
@@ -144,6 +115,27 @@ export class HaEntityPicker extends LitElement {
}
let entityIds = Object.keys(hass.states);
+ if (!entityIds.length) {
+ return [
+ {
+ entity_id: "",
+ state: "",
+ last_changed: "",
+ last_updated: "",
+ context: { id: "", user_id: null },
+ friendly_name: this.hass!.localize(
+ "ui.components.entity.entity-picker.no_entities"
+ ),
+ attributes: {
+ friendly_name: this.hass!.localize(
+ "ui.components.entity.entity-picker.no_entities"
+ ),
+ icon: "mdi:magnify",
+ },
+ },
+ ];
+ }
+
if (includeDomains) {
entityIds = entityIds.filter((eid) =>
includeDomains.includes(computeDomain(eid))
@@ -156,7 +148,10 @@ export class HaEntityPicker extends LitElement {
);
}
- states = entityIds.sort().map((key) => hass!.states[key]);
+ states = entityIds.sort().map((key) => ({
+ ...hass!.states[key],
+ friendly_name: computeStateName(hass!.states[key]) || key,
+ }));
if (includeDeviceClasses) {
states = states.filter(
@@ -196,6 +191,9 @@ export class HaEntityPicker extends LitElement {
last_changed: "",
last_updated: "",
context: { id: "", user_id: null },
+ friendly_name: this.hass!.localize(
+ "ui.components.entity.entity-picker.no_match"
+ ),
attributes: {
friendly_name: this.hass!.localize(
"ui.components.entity.entity-picker.no_match"
@@ -241,64 +239,25 @@ export class HaEntityPicker extends LitElement {
protected render(): TemplateResult {
return html`
-
-
-
- ${this.value && !this.hideClearIcon
- ? html`
-
- `
- : ""}
-
-
-
-
-
+
`;
}
- private _clearValue(ev: Event) {
- ev.stopPropagation();
- this._setValue("");
- }
-
private get _value() {
return this.value || "";
}
@@ -308,6 +267,7 @@ export class HaEntityPicker extends LitElement {
}
private _valueChanged(ev: PolymerChangedEvent) {
+ ev.stopPropagation();
const newValue = ev.detail.value;
if (newValue !== this._value) {
this._setValue(newValue);
@@ -317,9 +277,9 @@ export class HaEntityPicker extends LitElement {
private _filterChanged(ev: CustomEvent): void {
const filterString = ev.detail.value.toLowerCase();
(this.comboBox as any).filteredItems = this._states.filter(
- (state) =>
- state.entity_id.toLowerCase().includes(filterString) ||
- computeStateName(state).toLowerCase().includes(filterString)
+ (entityState) =>
+ entityState.entity_id.toLowerCase().includes(filterString) ||
+ computeStateName(entityState).toLowerCase().includes(filterString)
);
}
@@ -330,22 +290,6 @@ export class HaEntityPicker extends LitElement {
fireEvent(this, "change");
}, 0);
}
-
- static get styles(): CSSResultGroup {
- return css`
- .suffix {
- display: flex;
- }
- ha-icon-button {
- --mdc-icon-button-size: 24px;
- padding: 0px 2px;
- color: var(--secondary-text-color);
- }
- [hidden] {
- display: none;
- }
- `;
- }
}
declare global {
diff --git a/src/components/entity/ha-statistic-picker.ts b/src/components/entity/ha-statistic-picker.ts
index 511b46353a..6fc0f34a1f 100644
--- a/src/components/entity/ha-statistic-picker.ts
+++ b/src/components/entity/ha-statistic-picker.ts
@@ -67,7 +67,7 @@ export class HaStatisticPicker extends LitElement {
id: string;
name: string;
state?: HassEntity;
- }> = (item) => html`
+ }> = (item) => html`
${item.state
? html` `
: ""}
diff --git a/src/components/ha-area-picker.ts b/src/components/ha-area-picker.ts
index bfb39ac3da..a671893737 100644
--- a/src/components/ha-area-picker.ts
+++ b/src/components/ha-area-picker.ts
@@ -139,7 +139,7 @@ export class HaAreaPicker extends SubscribeMixin(LitElement) {
if (!areas.length) {
return [
{
- area_id: "",
+ area_id: "no_areas",
name: this.hass.localize("ui.components.area-picker.no_areas"),
picture: null,
},
@@ -263,7 +263,7 @@ export class HaAreaPicker extends SubscribeMixin(LitElement) {
if (!outputAreas.length) {
outputAreas = [
{
- area_id: "",
+ area_id: "no_areas",
name: this.hass.localize("ui.components.area-picker.no_match"),
picture: null,
},
@@ -369,7 +369,11 @@ export class HaAreaPicker extends SubscribeMixin(LitElement) {
private _areaChanged(ev: PolymerChangedEvent) {
ev.stopPropagation();
- const newValue = ev.detail.value;
+ let newValue = ev.detail.value;
+
+ if (newValue === "no_areas") {
+ newValue = "";
+ }
if (!["add_new_suggestion", "add_new"].includes(newValue)) {
if (newValue !== this._value) {
diff --git a/src/components/ha-selector/ha-selector.ts b/src/components/ha-selector/ha-selector.ts
index d426ec0b49..e3eda4a3df 100644
--- a/src/components/ha-selector/ha-selector.ts
+++ b/src/components/ha-selector/ha-selector.ts
@@ -31,11 +31,7 @@ export class HaSelector extends LitElement {
@property({ type: Boolean }) public disabled = false;
public focus() {
- const input = this.shadowRoot!.getElementById("selector");
- if (!input) {
- return;
- }
- (input as HTMLElement).focus();
+ this.shadowRoot!.getElementById("selector")?.focus();
}
private get _type() {
diff --git a/src/translations/en.json b/src/translations/en.json
index 42eb7db2f6..ed8ff943bf 100755
--- a/src/translations/en.json
+++ b/src/translations/en.json
@@ -358,6 +358,7 @@
"entity": "Entity",
"edit": "Edit",
"clear": "Clear",
+ "no_entities": "You don't have any entities",
"no_match": "No matching entities found",
"show_entities": "Show entities"
},
From 354ea88984487a39de4c1c476c1cd4e24804bd8a Mon Sep 17 00:00:00 2001
From: Bram Kragten
Date: Mon, 7 Feb 2022 15:08:54 +0100
Subject: [PATCH 014/174] Update links on info page (#11590)
---
src/panels/config/info/ha-config-info.ts | 14 +++++---------
1 file changed, 5 insertions(+), 9 deletions(-)
diff --git a/src/panels/config/info/ha-config-info.ts b/src/panels/config/info/ha-config-info.ts
index 74b10c529f..a2459d1565 100644
--- a/src/panels/config/info/ha-config-info.ts
+++ b/src/panels/config/info/ha-config-info.ts
@@ -89,24 +89,20 @@ class HaConfigInfo extends LitElement {
Python 3 ,
+ Lit ,
+ ${this.hass.localize("ui.panel.config.info.icons_by")}
Polymer , ${this.hass.localize("ui.panel.config.info.icons_by")}
- Google
${this.hass.localize("ui.common.and")}
MaterialDesignIcons.com Material Design Icons.
From ca8d31c6bbcff2ad26dd587ea5686e8f9002435f Mon Sep 17 00:00:00 2001
From: Bram Kragten
Date: Mon, 7 Feb 2022 17:04:37 +0100
Subject: [PATCH 015/174] Migrate (input) select entities to mwc (#11591)
---
.../hui-input-select-entity-row.ts | 70 ++++-----------
.../entity-rows/hui-select-entity-row.ts | 90 ++++++-------------
src/state-summary/state-card-input_select.ts | 62 +++++--------
src/state-summary/state-card-select.ts | 79 ++++++----------
4 files changed, 94 insertions(+), 207 deletions(-)
diff --git a/src/panels/lovelace/entity-rows/hui-input-select-entity-row.ts b/src/panels/lovelace/entity-rows/hui-input-select-entity-row.ts
index 55f384a6c9..30fd573dbe 100644
--- a/src/panels/lovelace/entity-rows/hui-input-select-entity-row.ts
+++ b/src/panels/lovelace/entity-rows/hui-input-select-entity-row.ts
@@ -1,5 +1,5 @@
-import "@polymer/paper-item/paper-item";
-import "@polymer/paper-listbox/paper-listbox";
+import "@material/mwc-list/mwc-list-item";
+import "@material/mwc-select/mwc-select";
import {
css,
CSSResultGroup,
@@ -11,8 +11,6 @@ import {
import { customElement, property, state } from "lit/decorators";
import { stopPropagation } from "../../../common/dom/stop_propagation";
import { computeStateName } from "../../../common/entity/compute_state_name";
-import "../../../components/entity/state-badge";
-import "../../../components/ha-paper-dropdown-menu";
import { UNAVAILABLE_STATES } from "../../../data/entity";
import { forwardHaptic } from "../../../data/haptics";
import {
@@ -67,75 +65,43 @@ class HuiInputSelectEntityRow extends LitElement implements LovelaceRow {
.config=${this._config}
hideName
>
-
-
- ${stateObj.attributes.options
- ? stateObj.attributes.options.map(
- (option) => html` ${option} `
- )
- : ""}
-
-
+ ${stateObj.attributes.options
+ ? stateObj.attributes.options.map(
+ (option) =>
+ html`${option} `
+ )
+ : ""}
+
`;
}
- protected updated(changedProps: PropertyValues) {
- super.updated(changedProps);
-
- if (!this.hass || !this._config) {
- return;
- }
-
- const stateObj = this.hass.states[this._config.entity] as
- | InputSelectEntity
- | undefined;
-
- if (!stateObj) {
- return;
- }
-
- // Update selected after rendering the items or else it won't work in Firefox
- if (stateObj.attributes.options) {
- this.shadowRoot!.querySelector("paper-listbox")!.selected =
- stateObj.attributes.options.indexOf(stateObj.state);
- }
- }
-
static get styles(): CSSResultGroup {
return css`
hui-generic-entity-row {
display: flex;
align-items: center;
}
- ha-paper-dropdown-menu {
- margin-left: 16px;
- flex: 1;
- }
- paper-item {
- cursor: pointer;
- min-width: 200px;
- }
- .pointer {
- cursor: pointer;
- }
- state-badge:focus {
- outline: none;
- background: var(--divider-color);
- border-radius: 100%;
+ mwc-select {
+ width: 100%;
}
`;
}
private _selectedChanged(ev): void {
const stateObj = this.hass!.states[this._config!.entity];
- const option = ev.target.selectedItem.innerText.trim();
+ const option = ev.target.value;
if (option === stateObj.state) {
return;
}
diff --git a/src/panels/lovelace/entity-rows/hui-select-entity-row.ts b/src/panels/lovelace/entity-rows/hui-select-entity-row.ts
index 5aa6f103fd..f6bc9ec867 100644
--- a/src/panels/lovelace/entity-rows/hui-select-entity-row.ts
+++ b/src/panels/lovelace/entity-rows/hui-select-entity-row.ts
@@ -1,5 +1,5 @@
-import "@polymer/paper-item/paper-item";
-import "@polymer/paper-listbox/paper-listbox";
+import "@material/mwc-list/mwc-list-item";
+import "@material/mwc-select/mwc-select";
import {
css,
CSSResultGroup,
@@ -11,8 +11,6 @@ import {
import { customElement, property, state } from "lit/decorators";
import { stopPropagation } from "../../../common/dom/stop_propagation";
import { computeStateName } from "../../../common/entity/compute_state_name";
-import "../../../components/entity/state-badge";
-import "../../../components/ha-paper-dropdown-menu";
import { UNAVAILABLE } from "../../../data/entity";
import { forwardHaptic } from "../../../data/haptics";
import { SelectEntity, setSelectOption } from "../../../data/select";
@@ -64,86 +62,52 @@ class HuiSelectEntityRow extends LitElement implements LovelaceRow {
.config=${this._config}
hideName
>
-
-
- ${stateObj.attributes.options
- ? stateObj.attributes.options.map(
- (option) =>
- html`
- ${(stateObj.attributes.device_class &&
- this.hass!.localize(
- `component.select.state.${stateObj.attributes.device_class}.${option}`
- )) ||
+ ${stateObj.attributes.options
+ ? stateObj.attributes.options.map(
+ (option) =>
+ html`
+ ${(stateObj.attributes.device_class &&
this.hass!.localize(
- `component.select.state._.${option}`
- ) ||
- option}
- `
- )
- : ""}
-
-
+ `component.select.state.${stateObj.attributes.device_class}.${option}`
+ )) ||
+ this.hass!.localize(
+ `component.select.state._.${option}`
+ ) ||
+ option}
+
+ `
+ )
+ : ""}
+
`;
}
- protected updated(changedProps: PropertyValues) {
- super.updated(changedProps);
-
- if (!this.hass || !this._config) {
- return;
- }
-
- const stateObj = this.hass.states[this._config.entity] as
- | SelectEntity
- | undefined;
-
- if (!stateObj) {
- return;
- }
-
- // Update selected after rendering the items or else it won't work in Firefox
- if (stateObj.attributes.options) {
- this.shadowRoot!.querySelector("paper-listbox")!.selected =
- stateObj.attributes.options.indexOf(stateObj.state);
- }
- }
-
static get styles(): CSSResultGroup {
return css`
hui-generic-entity-row {
display: flex;
align-items: center;
}
- ha-paper-dropdown-menu {
- margin-left: 16px;
- flex: 1;
- }
- paper-item {
- cursor: pointer;
- min-width: 200px;
- }
- .pointer {
- cursor: pointer;
- }
- state-badge:focus {
- outline: none;
- background: var(--divider-color);
- border-radius: 100%;
+ mwc-select {
+ width: 100%;
}
`;
}
private _selectedChanged(ev): void {
const stateObj = this.hass!.states[this._config!.entity];
- const option = ev.target.selectedItem.option;
+ const option = ev.target.value;
if (option === stateObj.state) {
return;
}
diff --git a/src/state-summary/state-card-input_select.ts b/src/state-summary/state-card-input_select.ts
index 91b47eede3..c992975a82 100644
--- a/src/state-summary/state-card-input_select.ts
+++ b/src/state-summary/state-card-input_select.ts
@@ -1,21 +1,12 @@
-import "@polymer/paper-dropdown-menu/paper-dropdown-menu-light";
-import "@polymer/paper-item/paper-item";
-import type { PaperItemElement } from "@polymer/paper-item/paper-item";
-import "@polymer/paper-listbox/paper-listbox";
-import {
- css,
- CSSResultGroup,
- html,
- LitElement,
- PropertyValues,
- TemplateResult,
-} from "lit";
+import "@material/mwc-list/mwc-list-item";
+import "@material/mwc-select/mwc-select";
+import { css, CSSResultGroup, html, LitElement, TemplateResult } from "lit";
import { customElement, property } from "lit/decorators";
import { stopPropagation } from "../common/dom/stop_propagation";
import { computeStateName } from "../common/entity/compute_state_name";
import "../components/entity/state-badge";
+import { UNAVAILABLE_STATES } from "../data/entity";
import { InputSelectEntity, setInputSelectOption } from "../data/input_select";
-import type { PolymerIronSelectEvent } from "../polymer-types";
import type { HomeAssistant } from "../types";
@customElement("state-card-input_select")
@@ -27,32 +18,25 @@ class StateCardInputSelect extends LitElement {
protected render(): TemplateResult {
return html`
-
-
- ${this.stateObj.attributes.options.map(
- (option) => html` ${option} `
- )}
-
-
+ ${this.stateObj.attributes.options.map(
+ (option) =>
+ html`${option} `
+ )}
+
`;
}
- protected updated(changedProps: PropertyValues) {
- super.updated(changedProps);
- // Update selected after rendering the items or else it won't work in Firefox
- this.shadowRoot!.querySelector("paper-listbox")!.selected =
- this.stateObj.attributes.options.indexOf(this.stateObj.state);
- }
-
- private async _selectedOptionChanged(
- ev: PolymerIronSelectEvent
- ) {
- const option = ev.detail.item.innerText.trim();
+ private async _selectedOptionChanged(ev) {
+ const option = ev.target.value;
if (option === this.stateObj.state) {
return;
}
@@ -62,7 +46,7 @@ class StateCardInputSelect extends LitElement {
static get styles(): CSSResultGroup {
return css`
:host {
- display: block;
+ display: flex;
}
state-badge {
@@ -70,14 +54,8 @@ class StateCardInputSelect extends LitElement {
margin-top: 10px;
}
- paper-dropdown-menu-light {
- display: block;
- margin-left: 53px;
- }
-
- paper-item {
- cursor: pointer;
- min-width: 200px;
+ mwc-select {
+ width: 100%;
}
`;
}
diff --git a/src/state-summary/state-card-select.ts b/src/state-summary/state-card-select.ts
index 8541cac41b..1aae15ad6c 100644
--- a/src/state-summary/state-card-select.ts
+++ b/src/state-summary/state-card-select.ts
@@ -1,18 +1,11 @@
-import "@polymer/paper-dropdown-menu/paper-dropdown-menu-light";
-import "@polymer/paper-item/paper-item";
-import "@polymer/paper-listbox/paper-listbox";
-import {
- css,
- CSSResultGroup,
- html,
- LitElement,
- PropertyValues,
- TemplateResult,
-} from "lit";
+import "@material/mwc-list/mwc-list-item";
+import "@material/mwc-select/mwc-select";
+import { css, CSSResultGroup, html, LitElement, TemplateResult } from "lit";
import { customElement, property } from "lit/decorators";
import { stopPropagation } from "../common/dom/stop_propagation";
import { computeStateName } from "../common/entity/compute_state_name";
import "../components/entity/state-badge";
+import { UNAVAILABLE } from "../data/entity";
import { SelectEntity, setSelectOption } from "../data/select";
import type { HomeAssistant } from "../types";
@@ -25,42 +18,34 @@ class StateCardSelect extends LitElement {
protected render(): TemplateResult {
return html`
-
-
- ${this.stateObj.attributes.options.map(
- (option) =>
- html`
- ${(this.stateObj.attributes.device_class &&
- this.hass.localize(
- `component.select.state.${this.stateObj.attributes.device_class}.${option}`
- )) ||
- this.hass.localize(`component.select.state._.${option}`) ||
- option}
- `
- )}
-
-
+ ${this.stateObj.attributes.options.map(
+ (option) =>
+ html`
+
+ ${(this.stateObj.attributes.device_class &&
+ this.hass.localize(
+ `component.select.state.${this.stateObj.attributes.device_class}.${option}`
+ )) ||
+ this.hass.localize(`component.select.state._.${option}`) ||
+ option}
+
+ `
+ )}
+
`;
}
- protected updated(changedProps: PropertyValues) {
- super.updated(changedProps);
- if (!changedProps.has("stateObj")) {
- return;
- }
- // Update selected after rendering the items or else it won't work in Firefox
- this.shadowRoot!.querySelector("paper-listbox")!.selected =
- this.stateObj.attributes.options.indexOf(this.stateObj.state);
- }
-
private _selectedOptionChanged(ev) {
- const option = ev.target.selectedItem.option;
+ const option = ev.target.value;
if (option === this.stateObj.state) {
return;
}
@@ -70,7 +55,7 @@ class StateCardSelect extends LitElement {
static get styles(): CSSResultGroup {
return css`
:host {
- display: block;
+ display: flex;
}
state-badge {
@@ -78,14 +63,8 @@ class StateCardSelect extends LitElement {
margin-top: 10px;
}
- paper-dropdown-menu-light {
- display: block;
- margin-left: 53px;
- }
-
- paper-item {
- cursor: pointer;
- min-width: 200px;
+ mwc-select {
+ width: 100%;
}
`;
}
From e72a4e4a209af159ca3b385c808fa6f83e982dad Mon Sep 17 00:00:00 2001
From: Bram Kragten
Date: Mon, 7 Feb 2022 17:06:04 +0100
Subject: [PATCH 016/174] Convert HaFormSchemas to use selectors (#11589)
---
gallery/src/pages/components/ha-selector.ts | 6 ++-
.../registries/dialog-hassio-registries.ts | 9 ++--
.../ha-selector/ha-selector-text.ts | 53 +++++++++++++++----
src/data/selector.ts | 17 +++++-
src/onboarding/onboarding-create-user.ts | 16 ++++--
.../zha/zha-config-dashboard.ts | 2 +-
.../dialog-ha-mfa-module-setup-flow.ts | 2 +-
7 files changed, 82 insertions(+), 23 deletions(-)
diff --git a/gallery/src/pages/components/ha-selector.ts b/gallery/src/pages/components/ha-selector.ts
index e2cd0425ec..ce015a3756 100644
--- a/gallery/src/pages/components/ha-selector.ts
+++ b/gallery/src/pages/components/ha-selector.ts
@@ -50,7 +50,11 @@ const SCHEMAS: {
action: { name: "Action", selector: { action: {} } },
text: {
name: "Text",
- selector: { text: { multiline: false } },
+ selector: { text: {} },
+ },
+ password: {
+ name: "Password",
+ selector: { text: { type: "password" } },
},
text_multiline: {
name: "Text multiline",
diff --git a/hassio/src/dialogs/registries/dialog-hassio-registries.ts b/hassio/src/dialogs/registries/dialog-hassio-registries.ts
index 1eb0072a3f..5f7d1967ae 100644
--- a/hassio/src/dialogs/registries/dialog-hassio-registries.ts
+++ b/hassio/src/dialogs/registries/dialog-hassio-registries.ts
@@ -19,22 +19,21 @@ import { haStyle, haStyleDialog } from "../../../../src/resources/styles";
import type { HomeAssistant } from "../../../../src/types";
import { RegistriesDialogParams } from "./show-dialog-registries";
-const SCHEMA = [
+const SCHEMA: HaFormSchema[] = [
{
- type: "string",
name: "registry",
required: true,
+ selector: { text: {} },
},
{
- type: "string",
name: "username",
required: true,
+ selector: { text: {} },
},
{
- type: "string",
name: "password",
required: true,
- format: "password",
+ selector: { text: { type: "password" } },
},
];
diff --git a/src/components/ha-selector/ha-selector-text.ts b/src/components/ha-selector/ha-selector-text.ts
index f0a093de79..d9a1f87bfc 100644
--- a/src/components/ha-selector/ha-selector-text.ts
+++ b/src/components/ha-selector/ha-selector-text.ts
@@ -1,10 +1,12 @@
+import "@material/mwc-textarea/mwc-textarea";
+import "@material/mwc-textfield/mwc-textfield";
+import { mdiEye, mdiEyeOff } from "@mdi/js";
import { css, CSSResultGroup, html, LitElement } from "lit";
-import { customElement, property } from "lit/decorators";
+import { customElement, property, state } from "lit/decorators";
import { fireEvent } from "../../common/dom/fire_event";
import { StringSelector } from "../../data/selector";
import { HomeAssistant } from "../../types";
-import "@material/mwc-textfield/mwc-textfield";
-import "@material/mwc-textarea/mwc-textarea";
+import "../ha-icon-button";
@customElement("ha-selector-text")
export class HaTextSelector extends LitElement {
@@ -20,6 +22,8 @@ export class HaTextSelector extends LitElement {
@property({ type: Boolean }) public disabled = false;
+ @state() private _unmaskedPassword = false;
+
protected render() {
if (this.selector.text?.multiline) {
return html` `;
}
return html` `;
+ .value=${this.value || ""}
+ .placeholder=${this.placeholder || ""}
+ .disabled=${this.disabled}
+ .type=${this._unmaskedPassword ? "text" : this.selector.text?.type}
+ @input=${this._handleChange}
+ .label=${this.label || ""}
+ .suffix=${this.selector.text?.type === "password"
+ ? // reserve some space for the icon.
+ html`
`
+ : this.selector.text?.suffix}
+ required
+ >
+ ${this.selector.text?.type === "password"
+ ? html` `
+ : ""}`;
+ }
+
+ private _toggleUnmaskedPassword(): void {
+ this._unmaskedPassword = !this._unmaskedPassword;
}
private _handleChange(ev) {
@@ -54,10 +75,22 @@ export class HaTextSelector extends LitElement {
static get styles(): CSSResultGroup {
return css`
+ :host {
+ display: block;
+ position: relative;
+ }
mwc-textfield,
mwc-textarea {
width: 100%;
}
+ ha-icon-button {
+ position: absolute;
+ top: 16px;
+ right: 16px;
+ --mdc-icon-button-size: 24px;
+ --mdc-icon-size: 20px;
+ color: var(--secondary-text-color);
+ }
`;
}
}
diff --git a/src/data/selector.ts b/src/data/selector.ts
index 3bb2999877..2ea7e0c2fe 100644
--- a/src/data/selector.ts
+++ b/src/data/selector.ts
@@ -95,7 +95,22 @@ export interface ActionSelector {
export interface StringSelector {
text: {
- multiline: boolean;
+ multiline?: boolean;
+ type?:
+ | "number"
+ | "text"
+ | "search"
+ | "tel"
+ | "url"
+ | "email"
+ | "password"
+ | "date"
+ | "month"
+ | "week"
+ | "time"
+ | "datetime-local"
+ | "color";
+ suffix?: string;
};
}
diff --git a/src/onboarding/onboarding-create-user.ts b/src/onboarding/onboarding-create-user.ts
index c511d34a46..1855141a60 100644
--- a/src/onboarding/onboarding-create-user.ts
+++ b/src/onboarding/onboarding-create-user.ts
@@ -18,10 +18,18 @@ import { onboardUserStep } from "../data/onboarding";
import { PolymerChangedEvent } from "../polymer-types";
const CREATE_USER_SCHEMA: HaFormSchema[] = [
- { type: "string", name: "name", required: true },
- { type: "string", name: "username", required: true },
- { type: "string", name: "password", required: true },
- { type: "string", name: "password_confirm", required: true },
+ { name: "name", required: true, selector: { text: {} } },
+ { name: "username", required: true, selector: { text: {} } },
+ {
+ name: "password",
+ required: true,
+ selector: { text: { type: "password" } },
+ },
+ {
+ name: "password_confirm",
+ required: true,
+ selector: { text: { type: "password" } },
+ },
];
@customElement("onboarding-create-user")
diff --git a/src/panels/config/integrations/integration-panels/zha/zha-config-dashboard.ts b/src/panels/config/integrations/integration-panels/zha/zha-config-dashboard.ts
index 8983508074..710328c269 100644
--- a/src/panels/config/integrations/integration-panels/zha/zha-config-dashboard.ts
+++ b/src/panels/config/integrations/integration-panels/zha/zha-config-dashboard.ts
@@ -106,7 +106,7 @@ class ZHAConfigDashboard extends LitElement {
${this._configuration
? Object.entries(this._configuration.schemas).map(
- ([section, schema]) => html` html``
: this._step.type === "form"
- ? html`
Date: Mon, 7 Feb 2022 17:17:32 +0100
Subject: [PATCH 017/174] Fix number selector (#11585)
---
src/components/ha-selector/ha-selector-number.ts | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/components/ha-selector/ha-selector-number.ts b/src/components/ha-selector/ha-selector-number.ts
index 6b2652b5b9..9f4d29a765 100644
--- a/src/components/ha-selector/ha-selector-number.ts
+++ b/src/components/ha-selector/ha-selector-number.ts
@@ -62,9 +62,9 @@ export class HaNumberSelector extends LitElement {
private _handleInputChange(ev) {
ev.stopPropagation();
const value =
- ev.detail.value === "" || isNaN(ev.detail.value)
+ ev.target.value === "" || isNaN(ev.target.value)
? undefined
- : Number(ev.detail.value);
+ : Number(ev.target.value);
if (this.value === value) {
return;
}
From 869fa91ae5bc9f7038320587dcdfc8e2d6919eda Mon Sep 17 00:00:00 2001
From: Bram Kragten
Date: Mon, 7 Feb 2022 17:22:08 +0100
Subject: [PATCH 018/174] Convert entity-attribute picker to ha-combo-box
(#11587)
---
.../entity/ha-entity-attribute-picker.ts | 148 +++---------------
src/components/ha-combo-box.ts | 12 +-
.../condition/ha-automation-condition-row.ts | 2 +-
.../trigger/ha-automation-trigger-row.ts | 2 +-
.../config-elements/hui-entity-card-editor.ts | 2 +-
.../hui-weather-forecast-card-editor.ts | 3 +-
src/panels/lovelace/editor/types.ts | 6 +-
7 files changed, 37 insertions(+), 138 deletions(-)
diff --git a/src/components/entity/ha-entity-attribute-picker.ts b/src/components/entity/ha-entity-attribute-picker.ts
index 51b17fd53d..291d30da5e 100644
--- a/src/components/entity/ha-entity-attribute-picker.ts
+++ b/src/components/entity/ha-entity-attribute-picker.ts
@@ -1,54 +1,14 @@
-import { mdiCheck, mdiClose, mdiMenuDown, mdiMenuUp } from "@mdi/js";
-import "@polymer/paper-input/paper-input";
-import "@polymer/paper-item/paper-item";
-import "@vaadin/combo-box/theme/material/vaadin-combo-box-light";
import { HassEntity } from "home-assistant-js-websocket";
-import {
- css,
- CSSResultGroup,
- html,
- LitElement,
- PropertyValues,
- TemplateResult,
-} from "lit";
-import { ComboBoxLitRenderer, comboBoxRenderer } from "lit-vaadin-helpers";
+import { html, LitElement, PropertyValues, TemplateResult } from "lit";
import { customElement, property, query } from "lit/decorators";
-import { fireEvent } from "../../common/dom/fire_event";
import { formatAttributeName } from "../../data/entity_attributes";
import { PolymerChangedEvent } from "../../polymer-types";
import { HomeAssistant } from "../../types";
-import "../ha-icon-button";
-import "../ha-svg-icon";
-import "./state-badge";
+import "../ha-combo-box";
+import type { HaComboBox } from "../ha-combo-box";
export type HaEntityPickerEntityFilterFunc = (entityId: HassEntity) => boolean;
-// eslint-disable-next-line lit/prefer-static-styles
-const rowRenderer: ComboBoxLitRenderer = (item) => html`
-
- ${formatAttributeName(item)} `;
-
@customElement("ha-entity-attribute-picker")
class HaEntityAttributePicker extends LitElement {
@property({ attribute: false }) public hass!: HomeAssistant;
@@ -68,7 +28,7 @@ class HaEntityAttributePicker extends LitElement {
@property({ type: Boolean }) private _opened = false;
- @query("vaadin-combo-box-light", true) private _comboBox!: HTMLElement;
+ @query("ha-combo-box", true) private _comboBox!: HaComboBox;
protected shouldUpdate(changedProps: PropertyValues) {
return !(!changedProps.has("_opened") && this._opened);
@@ -78,7 +38,10 @@ class HaEntityAttributePicker extends LitElement {
if (changedProps.has("_opened") && this._opened) {
const state = this.entityId ? this.hass.states[this.entityId] : undefined;
(this._comboBox as any).items = state
- ? Object.keys(state.attributes)
+ ? Object.keys(state.attributes).map((key) => ({
+ value: key,
+ label: formatAttributeName(key),
+ }))
: [];
}
}
@@ -89,100 +52,31 @@ class HaEntityAttributePicker extends LitElement {
}
return html`
-
-
-
- ${this.value
- ? html`
-
- `
- : ""}
-
-
-
-
-
+
`;
}
- private _clearValue(ev: Event) {
- ev.stopPropagation();
- this._setValue("");
- }
-
- private get _value() {
- return this.value;
- }
-
private _openedChanged(ev: PolymerChangedEvent) {
this._opened = ev.detail.value;
}
private _valueChanged(ev: PolymerChangedEvent) {
- const newValue = ev.detail.value;
- if (newValue !== this._value) {
- this._setValue(newValue);
- }
- }
-
- private _setValue(value: string) {
- this.value = value;
- setTimeout(() => {
- fireEvent(this, "value-changed", { value });
- fireEvent(this, "change");
- }, 0);
- }
-
- static get styles(): CSSResultGroup {
- return css`
- .suffix {
- display: flex;
- }
- ha-icon-button {
- --mdc-icon-button-size: 24px;
- padding: 0px 2px;
- color: var(--secondary-text-color);
- }
- [hidden] {
- display: none;
- }
- `;
+ this.value = ev.detail.value;
}
}
diff --git a/src/components/ha-combo-box.ts b/src/components/ha-combo-box.ts
index c4717b4d33..6a44d33a6f 100644
--- a/src/components/ha-combo-box.ts
+++ b/src/components/ha-combo-box.ts
@@ -52,9 +52,6 @@ registerStyles(
`
);
-const defaultRowRenderer: ComboBoxLitRenderer = (item) =>
- html`${item} `;
-
@customElement("ha-combo-box")
export class HaComboBox extends LitElement {
@property({ attribute: false }) public hass!: HomeAssistant;
@@ -112,7 +109,7 @@ export class HaComboBox extends LitElement {
.filteredItems=${this.filteredItems}
.allowCustomValue=${this.allowCustomValue}
.disabled=${this.disabled}
- ${comboBoxRenderer(this.renderer || defaultRowRenderer)}
+ ${comboBoxRenderer(this.renderer || this._defaultRowRenderer)}
@opened-changed=${this._openedChanged}
@filter-changed=${this._filterChanged}
@value-changed=${this._valueChanged}
@@ -147,6 +144,13 @@ export class HaComboBox extends LitElement {
`;
}
+ private _defaultRowRenderer: ComboBoxLitRenderer<
+ string | Record
+ > = (item) =>
+ html`
+ ${this.itemLabelPath ? item[this.itemLabelPath] : item}
+ `;
+
private _clearValue(ev: Event) {
ev.stopPropagation();
fireEvent(this, "value-changed", { value: undefined });
diff --git a/src/panels/config/automation/condition/ha-automation-condition-row.ts b/src/panels/config/automation/condition/ha-automation-condition-row.ts
index 3e792abd18..b36118b680 100644
--- a/src/panels/config/automation/condition/ha-automation-condition-row.ts
+++ b/src/panels/config/automation/condition/ha-automation-condition-row.ts
@@ -24,7 +24,7 @@ export const handleChangeEvent = (
ev: CustomEvent
) => {
ev.stopPropagation();
- const name = (ev.target as any)?.name;
+ const name = (ev.currentTarget as any)?.name;
if (!name) {
return;
}
diff --git a/src/panels/config/automation/trigger/ha-automation-trigger-row.ts b/src/panels/config/automation/trigger/ha-automation-trigger-row.ts
index 15dbd9779a..f62a33fd7a 100644
--- a/src/panels/config/automation/trigger/ha-automation-trigger-row.ts
+++ b/src/panels/config/automation/trigger/ha-automation-trigger-row.ts
@@ -57,7 +57,7 @@ export interface TriggerElement extends LitElement {
export const handleChangeEvent = (element: TriggerElement, ev: CustomEvent) => {
ev.stopPropagation();
- const name = (ev.target as any)?.name;
+ const name = (ev.currentTarget as any)?.name;
if (!name) {
return;
}
diff --git a/src/panels/lovelace/editor/config-elements/hui-entity-card-editor.ts b/src/panels/lovelace/editor/config-elements/hui-entity-card-editor.ts
index 845743d300..df9cb0e627 100644
--- a/src/panels/lovelace/editor/config-elements/hui-entity-card-editor.ts
+++ b/src/panels/lovelace/editor/config-elements/hui-entity-card-editor.ts
@@ -175,7 +175,7 @@ export class HuiEntityCardEditor
if (!this._config || !this.hass) {
return;
}
- const target = ev.target! as EditorTarget;
+ const target = ev.currentTarget! as EditorTarget;
if (
this[`_${target.configValue}`] === target.value ||
diff --git a/src/panels/lovelace/editor/config-elements/hui-weather-forecast-card-editor.ts b/src/panels/lovelace/editor/config-elements/hui-weather-forecast-card-editor.ts
index 106010c441..cb1a53bede 100644
--- a/src/panels/lovelace/editor/config-elements/hui-weather-forecast-card-editor.ts
+++ b/src/panels/lovelace/editor/config-elements/hui-weather-forecast-card-editor.ts
@@ -199,7 +199,8 @@ export class HuiWeatherForecastCardEditor
if (!this._config || !this.hass) {
return;
}
- const target = ev.target! as EditorTarget;
+ const target = ev.currentTarget! as EditorTarget;
+
if (this[`_${target.configValue}`] === target.value) {
return;
}
diff --git a/src/panels/lovelace/editor/types.ts b/src/panels/lovelace/editor/types.ts
index 73f2b3fe65..821c2dabcb 100644
--- a/src/panels/lovelace/editor/types.ts
+++ b/src/panels/lovelace/editor/types.ts
@@ -38,12 +38,12 @@ export interface ConfigError {
message: string;
}
-export interface EntitiesEditorEvent {
- detail?: {
+export interface EntitiesEditorEvent extends CustomEvent {
+ detail: {
entities?: EntityConfig[];
item?: any;
};
- target?: EventTarget;
+ target: EventTarget | null;
}
export interface EditorTarget extends EventTarget {
From 2cb37820dfc59dce612524718e23b71049b5cce9 Mon Sep 17 00:00:00 2001
From: Bram Kragten
Date: Mon, 7 Feb 2022 17:43:49 +0100
Subject: [PATCH 019/174] Convert icon picker to ha-combobox (#11586)
Co-authored-by: Zack
---
src/components/ha-combo-box.ts | 32 ++++++---
src/components/ha-icon-picker.ts | 108 +++++++++++--------------------
src/components/ha-textfield.ts | 27 +++++++-
3 files changed, 84 insertions(+), 83 deletions(-)
diff --git a/src/components/ha-combo-box.ts b/src/components/ha-combo-box.ts
index 6a44d33a6f..5dd0c0527f 100644
--- a/src/components/ha-combo-box.ts
+++ b/src/components/ha-combo-box.ts
@@ -1,5 +1,4 @@
import "@material/mwc-list/mwc-list-item";
-import "@material/mwc-textfield/mwc-textfield";
import { mdiClose, mdiMenuDown, mdiMenuUp } from "@mdi/js";
import "@vaadin/combo-box/theme/material/vaadin-combo-box-light";
import type { ComboBoxLight } from "@vaadin/combo-box/vaadin-combo-box-light";
@@ -11,6 +10,7 @@ import { fireEvent } from "../common/dom/fire_event";
import { PolymerChangedEvent } from "../polymer-types";
import { HomeAssistant } from "../types";
import "./ha-icon-button";
+import "./ha-textfield";
registerStyles(
"vaadin-combo-box-item",
@@ -54,12 +54,22 @@ registerStyles(
@customElement("ha-combo-box")
export class HaComboBox extends LitElement {
- @property({ attribute: false }) public hass!: HomeAssistant;
+ @property({ attribute: false }) public hass?: HomeAssistant;
@property() public label?: string;
@property() public value?: string;
+ @property() public placeholder?: string;
+
+ @property() public validationMessage?: string;
+
+ @property({ attribute: "error-message" }) public errorMessage?: string;
+
+ @property({ type: Boolean }) public invalid?: boolean;
+
+ @property({ type: Boolean }) public icon?: boolean;
+
@property() public items?: any[];
@property() public filteredItems?: any[];
@@ -115,27 +125,33 @@ export class HaComboBox extends LitElement {
@value-changed=${this._valueChanged}
attr-for-value="value"
>
- `}
+ .icon=${this.icon}
+ .invalid=${this.invalid}
>
-
+
+
${this.value
? html` `
: ""}
ha-icon-button {
+ ha-textfield > ha-icon-button {
--mdc-icon-button-size: 24px;
padding: 2px;
color: var(--secondary-text-color);
diff --git a/src/components/ha-icon-picker.ts b/src/components/ha-icon-picker.ts
index 972a2f7a61..2d7c1002c5 100644
--- a/src/components/ha-icon-picker.ts
+++ b/src/components/ha-icon-picker.ts
@@ -1,16 +1,13 @@
-import { mdiCheck, mdiMenuDown, mdiMenuUp } from "@mdi/js";
-import "@polymer/paper-input/paper-input";
-import "@polymer/paper-item/paper-icon-item";
-import "@polymer/paper-item/paper-item-body";
-import "@vaadin/combo-box/theme/material/vaadin-combo-box-light";
import { css, html, LitElement, TemplateResult } from "lit";
-import { ComboBoxLitRenderer, comboBoxRenderer } from "lit-vaadin-helpers";
+import { ComboBoxLitRenderer } from "lit-vaadin-helpers";
import { customElement, property, query, state } from "lit/decorators";
import { fireEvent } from "../common/dom/fire_event";
import { customIcons } from "../data/custom_icons";
import { PolymerChangedEvent } from "../polymer-types";
+import { HomeAssistant } from "../types";
+import "./ha-combo-box";
+import type { HaComboBox } from "./ha-combo-box";
import "./ha-icon";
-import "./ha-icon-button";
type IconItem = {
icon: string;
@@ -19,35 +16,17 @@ type IconItem = {
let iconItems: IconItem[] = [];
// eslint-disable-next-line lit/prefer-static-styles
-const rowRenderer: ComboBoxLitRenderer = (item) => html`
-
-
-
-
- ${item.icon}
- `;
+const rowRenderer: ComboBoxLitRenderer = (item) => html`
+
+ ${item.icon}
+ `;
@customElement("ha-icon-picker")
export class HaIconPicker extends LitElement {
+ @property() public hass?: HomeAssistant;
+
@property() public value?: string;
@property() public label?: string;
@@ -64,51 +43,40 @@ export class HaIconPicker extends LitElement {
@state() private _opened = false;
- @query("vaadin-combo-box-light", true) private comboBox!: HTMLElement;
+ @query("ha-combo-box", true) private comboBox!: HaComboBox;
protected render(): TemplateResult {
return html`
-
-
- ${this._value || this.placeholder
- ? html`
-
-
- `
- : this.fallbackPath
- ? html` `
- : ""}
-
-
-
+ ${this._value || this.placeholder
+ ? html`
+
+
+ `
+ : this.fallbackPath
+ ? html` `
+ : ""}
+
`;
}
@@ -150,6 +118,7 @@ export class HaIconPicker extends LitElement {
}
private _valueChanged(ev: PolymerChangedEvent) {
+ ev.stopPropagation();
this._setValue(ev.detail.value);
}
@@ -158,7 +127,7 @@ export class HaIconPicker extends LitElement {
fireEvent(
this,
"value-changed",
- { value },
+ { value: this._value },
{
bubbles: false,
composed: false,
@@ -211,11 +180,6 @@ export class HaIconPicker extends LitElement {
*[slot="prefix"] {
margin-right: 8px;
}
- paper-input > ha-icon-button {
- --mdc-icon-button-size: 24px;
- padding: 2px;
- color: var(--secondary-text-color);
- }
`;
}
}
diff --git a/src/components/ha-textfield.ts b/src/components/ha-textfield.ts
index 55daec0349..c5e0e21a90 100644
--- a/src/components/ha-textfield.ts
+++ b/src/components/ha-textfield.ts
@@ -1,10 +1,31 @@
import { TextField } from "@material/mwc-textfield";
-import { TemplateResult, html } from "lit";
-import { customElement } from "lit/decorators";
+import { TemplateResult, html, PropertyValues } from "lit";
+import { customElement, property } from "lit/decorators";
@customElement("ha-textfield")
export class HaTextField extends TextField {
- override renderIcon(_icon: string, isTrailingIcon = false): TemplateResult {
+ @property({ type: Boolean }) public invalid?: boolean;
+
+ @property({ attribute: "error-message" }) public errorMessage?: string;
+
+ override updated(changedProperties: PropertyValues) {
+ super.updated(changedProperties);
+ if (
+ (changedProperties.has("invalid") &&
+ (this.invalid || changedProperties.get("invalid") !== undefined)) ||
+ changedProperties.has("errorMessage")
+ ) {
+ this.setCustomValidity(
+ this.invalid ? this.errorMessage || "Invalid" : ""
+ );
+ this.reportValidity();
+ }
+ }
+
+ protected override renderIcon(
+ _icon: string,
+ isTrailingIcon = false
+ ): TemplateResult {
const type = isTrailingIcon ? "trailing" : "leading";
return html`
From 236fa14ec34b5b4b19a624b1ae4c01418011abec Mon Sep 17 00:00:00 2001
From: Bram Kragten
Date: Mon, 7 Feb 2022 17:52:44 +0100
Subject: [PATCH 020/174] Convert area-devices picker (#11588)
---
.../device/ha-area-devices-picker.ts | 133 +++---------------
1 file changed, 18 insertions(+), 115 deletions(-)
diff --git a/src/components/device/ha-area-devices-picker.ts b/src/components/device/ha-area-devices-picker.ts
index 67e01a131d..6ce007e441 100644
--- a/src/components/device/ha-area-devices-picker.ts
+++ b/src/components/device/ha-area-devices-picker.ts
@@ -1,20 +1,7 @@
import "@material/mwc-button/mwc-button";
-import { mdiCheck, mdiClose, mdiMenuDown, mdiMenuUp } from "@mdi/js";
-import "@polymer/paper-input/paper-input";
-import "@polymer/paper-item/paper-item";
-import "@polymer/paper-item/paper-item-body";
-import "@polymer/paper-listbox/paper-listbox";
-import "@vaadin/combo-box/theme/material/vaadin-combo-box-light";
import { UnsubscribeFunc } from "home-assistant-js-websocket";
-import {
- css,
- CSSResultGroup,
- html,
- LitElement,
- PropertyValues,
- TemplateResult,
-} from "lit";
-import { ComboBoxLitRenderer, comboBoxRenderer } from "lit-vaadin-helpers";
+import { html, LitElement, PropertyValues, TemplateResult } from "lit";
+import { ComboBoxLitRenderer } from "lit-vaadin-helpers";
import { customElement, property, state } from "lit/decorators";
import memoizeOne from "memoize-one";
import { fireEvent } from "../../common/dom/fire_event";
@@ -50,36 +37,12 @@ interface AreaDevices {
devices: string[];
}
-// eslint-disable-next-line lit/prefer-static-styles
-const rowRenderer: ComboBoxLitRenderer = (item) => html`
-
-
-
- ${item.name}
- ${item.devices.length} devices
-
- `;
+const rowRenderer: ComboBoxLitRenderer = (
+ item
+) => html`
+ ${item.name}
+ ${item.devices.length} devices
+ `;
@customElement("ha-area-devices-picker")
export class HaAreaDevicesPicker extends SubscribeMixin(LitElement) {
@@ -117,9 +80,6 @@ export class HaAreaDevicesPicker extends SubscribeMixin(LitElement) {
@property({ type: Array, attribute: "include-device-classes" })
public includeDeviceClasses?: string[];
- @property({ type: Boolean })
- private _opened?: boolean;
-
@state() private _areaPicker = true;
@state() private _devices?: DeviceRegistryEntry[];
@@ -302,71 +262,30 @@ export class HaAreaDevicesPicker extends SubscribeMixin(LitElement) {
`;
}
return html`
-
-
-
- ${this.value
- ? html` `
- : ""}
- ${areas.length > 0
- ? html`
-
- `
- : ""}
-
-
-
- Choose individual devices
+
+
+ Choose individual devices
+
`;
}
- private _clearValue(ev: Event) {
- ev.stopPropagation();
- this._setValue([]);
- }
-
private get _value() {
return this.value || [];
}
- private _openedChanged(ev: PolymerChangedEvent) {
- this._opened = ev.detail.value;
- }
-
private async _switchPicker() {
this._areaPicker = !this._areaPicker;
}
@@ -398,22 +317,6 @@ export class HaAreaDevicesPicker extends SubscribeMixin(LitElement) {
fireEvent(this, "change");
}, 0);
}
-
- static get styles(): CSSResultGroup {
- return css`
- .suffix {
- display: flex;
- }
- ha-icon-button {
- --mdc-icon-button-size: 24px;
- padding: 0px 2px;
- color: var(--secondary-text-color);
- }
- [hidden] {
- display: none;
- }
- `;
- }
}
declare global {
From 09d46dac617d4dd0d3d283be288774374a30743c Mon Sep 17 00:00:00 2001
From: Bram Kragten
Date: Mon, 7 Feb 2022 17:53:23 +0100
Subject: [PATCH 021/174] Convert device automation picker to mwc (#11592)
Co-authored-by: Zack
---
.../device/ha-device-automation-picker.ts | 105 +++++++-----------
1 file changed, 42 insertions(+), 63 deletions(-)
diff --git a/src/components/device/ha-device-automation-picker.ts b/src/components/device/ha-device-automation-picker.ts
index e4cc705dce..007f40e77c 100644
--- a/src/components/device/ha-device-automation-picker.ts
+++ b/src/components/device/ha-device-automation-picker.ts
@@ -1,7 +1,5 @@
-import "@polymer/paper-input/paper-input";
-import "@polymer/paper-item/paper-item";
-import "@polymer/paper-item/paper-item-body";
-import "@polymer/paper-listbox/paper-listbox";
+import "@material/mwc-list/mwc-list-item";
+import "@material/mwc-select/mwc-select";
import { css, CSSResultGroup, html, LitElement, TemplateResult } from "lit";
import { property, state } from "lit/decorators";
import { fireEvent } from "../../common/dom/fire_event";
@@ -10,7 +8,6 @@ import {
deviceAutomationsEqual,
} from "../../data/device_automation";
import { HomeAssistant } from "../../types";
-import "../ha-paper-dropdown-menu";
const NO_AUTOMATION_KEY = "NO_AUTOMATION";
const UNKNOWN_AUTOMATION_KEY = "UNKNOWN_AUTOMATION";
@@ -67,14 +64,12 @@ export abstract class HaDeviceAutomationPicker<
this._createNoAutomation = createNoAutomation;
}
- private get _key() {
- if (
- !this.value ||
- deviceAutomationsEqual(
- this._createNoAutomation(this.deviceId),
- this.value
- )
- ) {
+ private get _value() {
+ if (!this.value) {
+ return "";
+ }
+
+ if (!this._automations.length) {
return NO_AUTOMATION_KEY;
}
@@ -93,42 +88,32 @@ export abstract class HaDeviceAutomationPicker<
if (this._renderEmpty) {
return html``;
}
+ const value = this._value;
return html`
-
-
-
- ${this.NO_AUTOMATION_TEXT}
-
-
- ${this.UNKNOWN_AUTOMATION_TEXT}
-
- ${this._automations.map(
- (automation, idx) => html`
-
- ${this._localizeDeviceAutomation(this.hass, automation)}
-
- `
- )}
-
-
+ ${value === NO_AUTOMATION_KEY
+ ? html`
+ ${this.NO_AUTOMATION_TEXT}
+ `
+ : ""}
+ ${value === UNKNOWN_AUTOMATION_KEY
+ ? html`
+ ${this.UNKNOWN_AUTOMATION_TEXT}
+ `
+ : ""}
+ ${this._automations.map(
+ (automation, idx) => html`
+
+ ${this._localizeDeviceAutomation(this.hass, automation)}
+
+ `
+ )}
+
`;
}
@@ -138,14 +123,6 @@ export abstract class HaDeviceAutomationPicker<
if (changedProps.has("deviceId")) {
this._updateDeviceInfo();
}
-
- // The value has changed, force the listbox to update
- if (changedProps.has("value") || changedProps.has("_renderEmpty")) {
- const listbox = this.shadowRoot!.querySelector("paper-listbox")!;
- if (listbox) {
- listbox._selectSelected(this._key);
- }
- }
}
private async _updateDeviceInfo() {
@@ -168,9 +145,16 @@ export abstract class HaDeviceAutomationPicker<
}
private _automationChanged(ev) {
- if (ev.detail.item.automation) {
- this._setValue(ev.detail.item.automation);
+ const value = ev.target.value;
+ if (!value || [UNKNOWN_AUTOMATION_KEY, NO_AUTOMATION_KEY].includes(value)) {
+ return;
}
+ const [deviceId, idx] = value.split("_");
+ const automation = this._automations[idx];
+ if (automation.device_id !== deviceId) {
+ return;
+ }
+ this._setValue(automation);
}
private _setValue(automation: T) {
@@ -183,14 +167,9 @@ export abstract class HaDeviceAutomationPicker<
static get styles(): CSSResultGroup {
return css`
- ha-paper-dropdown-menu {
+ mwc-select {
width: 100%;
- }
- paper-listbox {
- min-width: 200px;
- }
- paper-item {
- cursor: pointer;
+ margin-top: 4px;
}
`;
}
From e9ec2da91766d10b47be0b7477f9da7db99cb519 Mon Sep 17 00:00:00 2001
From: Bram Kragten
Date: Mon, 7 Feb 2022 18:58:36 +0100
Subject: [PATCH 022/174] Fix clearing device in device action (#11594)
---
.../action/types/ha-automation-action-device_id.ts | 5 +++++
.../condition/types/ha-automation-condition-device.ts | 5 +++++
.../automation/trigger/types/ha-automation-trigger-device.ts | 5 +++++
src/panels/developer-tools/state/developer-tools-state.js | 2 +-
4 files changed, 16 insertions(+), 1 deletion(-)
diff --git a/src/panels/config/automation/action/types/ha-automation-action-device_id.ts b/src/panels/config/automation/action/types/ha-automation-action-device_id.ts
index 1a4565f870..5aa1cecbf2 100644
--- a/src/panels/config/automation/action/types/ha-automation-action-device_id.ts
+++ b/src/panels/config/automation/action/types/ha-automation-action-device_id.ts
@@ -107,6 +107,11 @@ export class HaDeviceAction extends LitElement {
private _devicePicked(ev) {
ev.stopPropagation();
this._deviceId = ev.target.value;
+ if (this._deviceId === undefined) {
+ fireEvent(this, "value-changed", {
+ value: HaDeviceAction.defaultConfig,
+ });
+ }
}
private _deviceActionPicked(ev) {
diff --git a/src/panels/config/automation/condition/types/ha-automation-condition-device.ts b/src/panels/config/automation/condition/types/ha-automation-condition-device.ts
index 74277a4680..b158625876 100644
--- a/src/panels/config/automation/condition/types/ha-automation-condition-device.ts
+++ b/src/panels/config/automation/condition/types/ha-automation-condition-device.ts
@@ -111,6 +111,11 @@ export class HaDeviceCondition extends LitElement {
private _devicePicked(ev) {
ev.stopPropagation();
this._deviceId = ev.target.value;
+ if (this._deviceId === undefined) {
+ fireEvent(this, "value-changed", {
+ value: { ...HaDeviceCondition.defaultConfig, condition: "device" },
+ });
+ }
}
private _deviceConditionPicked(ev) {
diff --git a/src/panels/config/automation/trigger/types/ha-automation-trigger-device.ts b/src/panels/config/automation/trigger/types/ha-automation-trigger-device.ts
index 6dc84a01f2..43ddbeeb14 100644
--- a/src/panels/config/automation/trigger/types/ha-automation-trigger-device.ts
+++ b/src/panels/config/automation/trigger/types/ha-automation-trigger-device.ts
@@ -111,6 +111,11 @@ export class HaDeviceTrigger extends LitElement {
private _devicePicked(ev) {
ev.stopPropagation();
this._deviceId = ev.target.value;
+ if (this._deviceId === undefined) {
+ fireEvent(this, "value-changed", {
+ value: { ...HaDeviceTrigger.defaultConfig, platform: "device" },
+ });
+ }
}
private _deviceTriggerPicked(ev) {
diff --git a/src/panels/developer-tools/state/developer-tools-state.js b/src/panels/developer-tools/state/developer-tools-state.js
index 58a4d9ad58..e90e0365ce 100644
--- a/src/panels/developer-tools/state/developer-tools-state.js
+++ b/src/panels/developer-tools/state/developer-tools-state.js
@@ -400,7 +400,7 @@ class HaPanelDevState extends EventsMixin(LocalizeMixin(PolymerElement)) {
}
entityIdChanged() {
- if (this._entityId === "") {
+ if (!this._entityId) {
this._entity = undefined;
this._state = "";
this._stateAttributes = "";
From 2d33327d882782177fe4a66b4bd9b1742f4a724d Mon Sep 17 00:00:00 2001
From: Bram Kragten
Date: Mon, 7 Feb 2022 21:33:09 +0100
Subject: [PATCH 023/174] dark mode fixes (#11595)
---
src/components/ha-combo-box.ts | 2 +-
src/components/ha-icon-picker.ts | 1 +
2 files changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/components/ha-combo-box.ts b/src/components/ha-combo-box.ts
index 5dd0c0527f..c80a131dca 100644
--- a/src/components/ha-combo-box.ts
+++ b/src/components/ha-combo-box.ts
@@ -19,7 +19,7 @@ registerStyles(
padding: 0;
}
:host([focused]:not([disabled])) {
- background-color: rgba(0, 0, 0, 0.12);
+ background-color: rgba(var(--rgb-primary-text-color, 0, 0, 0), 0.12);
}
:host([selected]:not([disabled])) {
background-color: transparent;
diff --git a/src/components/ha-icon-picker.ts b/src/components/ha-icon-picker.ts
index 2d7c1002c5..57ec368cdc 100644
--- a/src/components/ha-icon-picker.ts
+++ b/src/components/ha-icon-picker.ts
@@ -174,6 +174,7 @@ export class HaIconPicker extends LitElement {
return css`
ha-icon,
ha-svg-icon {
+ color: var(--primary-text-color);
position: relative;
bottom: 2px;
}
From 6a51e2aaad293d65c8b24dee5797d254a98e366e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Joakim=20S=C3=B8rensen?=
Date: Mon, 7 Feb 2022 23:18:52 +0100
Subject: [PATCH 024/174] Only show stable add-ons in the store if not advanced
mode (#11596)
---
hassio/src/addon-store/hassio-addon-repository.ts | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/hassio/src/addon-store/hassio-addon-repository.ts b/hassio/src/addon-store/hassio-addon-repository.ts
index 49da9c3c21..43e9822df2 100644
--- a/hassio/src/addon-store/hassio-addon-repository.ts
+++ b/hassio/src/addon-store/hassio-addon-repository.ts
@@ -42,7 +42,9 @@ class HassioAddonRepositoryEl extends LitElement {
const repo = this.repo;
let _addons = this.addons;
if (!this.hass.userData?.showAdvanced) {
- _addons = _addons.filter((addon) => !addon.advanced);
+ _addons = _addons.filter(
+ (addon) => !addon.advanced && addon.stage === "stable"
+ );
}
const addons = this._getAddons(_addons, this.filter);
From 9eea17b793b2e007ab408f71c3577e222ec1808b Mon Sep 17 00:00:00 2001
From: Zack Barett
Date: Mon, 7 Feb 2022 17:45:16 -0600
Subject: [PATCH 025/174] Convert Automation Action Choose to HA Form (#11597)
* Convert Auatomation Action Choose to HA Form
* remove log
* Remove Import
---
.../action/types/ha-automation-action-choose.ts | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/src/panels/config/automation/action/types/ha-automation-action-choose.ts b/src/panels/config/automation/action/types/ha-automation-action-choose.ts
index f342512745..48ff2b68f7 100644
--- a/src/panels/config/automation/action/types/ha-automation-action-choose.ts
+++ b/src/panels/config/automation/action/types/ha-automation-action-choose.ts
@@ -10,8 +10,8 @@ import { Condition } from "../../../../../data/automation";
import { Action, ChooseAction } from "../../../../../data/script";
import { haStyle } from "../../../../../resources/styles";
import { HomeAssistant } from "../../../../../types";
-import "../ha-automation-action";
import { ActionElement } from "../ha-automation-action-row";
+import "../../../../../components/ha-form/ha-form";
@customElement("ha-automation-action-choose")
export class HaChooseAction extends LitElement implements ActionElement {
@@ -61,12 +61,13 @@ export class HaChooseAction extends LitElement implements ActionElement {
"ui.panel.config.automation.editor.actions.type.choose.sequence"
)}:
-
+ >
`
)}
@@ -107,7 +108,7 @@ export class HaChooseAction extends LitElement implements ActionElement {
private _actionChanged(ev: CustomEvent) {
ev.stopPropagation();
- const value = ev.detail.value as Action[];
+ const value = ev.detail.value.sequence as Action[];
const index = (ev.target as any).idx;
const choose = this.action.choose
? [...ensureArray(this.action.choose)]
From 4ef5f3af89d3a88b80679d497205aaedc0e1fa16 Mon Sep 17 00:00:00 2001
From: Bram Kragten
Date: Wed, 9 Feb 2022 16:50:48 +0100
Subject: [PATCH 026/174] Replace checkboxes in list items with
`check-list-item` (#11610)
Co-authored-by: Paulus Schoutsen
---
src/components/ha-check-list-item.ts | 22 +++
src/components/ha-checkbox.ts | 18 ++-
src/components/ha-dialog.ts | 148 +++++++++---------
src/components/ha-form/ha-form-float.ts | 18 +--
src/components/ha-form/ha-form-integer.ts | 20 +--
.../ha-form/ha-form-multi_select.ts | 83 +++++++---
src/components/ha-form/ha-form-string.ts | 18 +--
src/components/ha-formfield.ts | 34 ++--
src/components/ha-qr-scanner.ts | 16 +-
src/components/ha-radio.ts | 18 ++-
.../ha-selector/ha-selector-number.ts | 14 +-
.../ha-selector/ha-selector-text.ts | 8 +-
src/components/ha-slider.js | 2 +-
src/components/ha-switch.ts | 59 ++++---
src/components/ha-textfield.ts | 16 +-
.../config/cloud/account/cloud-google-pref.ts | 12 +-
.../forgot-password/cloud-forgot-password.ts | 12 +-
src/panels/config/cloud/login/cloud-login.ts | 16 +-
.../config/cloud/register/cloud-register.ts | 16 +-
.../devices/ha-config-devices-dashboard.ts | 12 +-
.../config/entities/ha-config-entities.ts | 30 ++--
.../integrations/ha-config-integrations.ts | 16 +-
.../zwave_js/dialog-zwave_js-add-node.ts | 5 -
23 files changed, 330 insertions(+), 283 deletions(-)
create mode 100644 src/components/ha-check-list-item.ts
diff --git a/src/components/ha-check-list-item.ts b/src/components/ha-check-list-item.ts
new file mode 100644
index 0000000000..5b237208c9
--- /dev/null
+++ b/src/components/ha-check-list-item.ts
@@ -0,0 +1,22 @@
+import { css } from "lit";
+import { CheckListItemBase } from "@material/mwc-list/mwc-check-list-item-base";
+import { styles } from "@material/mwc-list/mwc-control-list-item.css";
+import { customElement } from "lit/decorators";
+
+@customElement("ha-check-list-item")
+export class HaCheckListItem extends CheckListItemBase {
+ static override styles = [
+ styles,
+ css`
+ :host {
+ --mdc-theme-secondary: var(--primary-color);
+ }
+ `,
+ ];
+}
+
+declare global {
+ interface HTMLElementTagNameMap {
+ "ha-check-list-item": HaCheckListItem;
+ }
+}
diff --git a/src/components/ha-checkbox.ts b/src/components/ha-checkbox.ts
index b3f5a1a2f4..0e33ee2a18 100644
--- a/src/components/ha-checkbox.ts
+++ b/src/components/ha-checkbox.ts
@@ -1,12 +1,18 @@
-import { Checkbox } from "@material/mwc-checkbox";
+import { CheckboxBase } from "@material/mwc-checkbox/mwc-checkbox-base";
+import { styles } from "@material/mwc-checkbox/mwc-checkbox.css";
+import { css } from "lit";
import { customElement } from "lit/decorators";
@customElement("ha-checkbox")
-export class HaCheckbox extends Checkbox {
- public firstUpdated() {
- super.firstUpdated();
- this.style.setProperty("--mdc-theme-secondary", "var(--primary-color)");
- }
+export class HaCheckbox extends CheckboxBase {
+ static override styles = [
+ styles,
+ css`
+ :host {
+ --mdc-theme-secondary: var(--primary-color);
+ }
+ `,
+ ];
}
declare global {
diff --git a/src/components/ha-dialog.ts b/src/components/ha-dialog.ts
index 34614bedc6..693bae6367 100644
--- a/src/components/ha-dialog.ts
+++ b/src/components/ha-dialog.ts
@@ -1,6 +1,7 @@
-import { Dialog } from "@material/mwc-dialog";
+import { DialogBase } from "@material/mwc-dialog/mwc-dialog-base";
+import { styles } from "@material/mwc-dialog/mwc-dialog.css";
import { mdiClose } from "@mdi/js";
-import { css, CSSResultGroup, html, TemplateResult } from "lit";
+import { css, html, TemplateResult } from "lit";
import { customElement } from "lit/decorators";
import { computeRTLDirection } from "../common/util/compute_rtl";
import type { HomeAssistant } from "../types";
@@ -21,8 +22,7 @@ export const createCloseHeading = (
`;
@customElement("ha-dialog")
-// @ts-expect-error
-export class HaDialog extends Dialog {
+export class HaDialog extends DialogBase {
public scrollToPos(x: number, y: number) {
this.contentElement?.scrollTo(x, y);
}
@@ -31,77 +31,75 @@ export class HaDialog extends Dialog {
return html` ${super.renderHeading()} `;
}
- protected static get styles(): CSSResultGroup {
- return [
- Dialog.styles,
- css`
- .mdc-dialog {
- --mdc-dialog-scroll-divider-color: var(--divider-color);
- z-index: var(--dialog-z-index, 7);
- -webkit-backdrop-filter: var(--dialog-backdrop-filter, none);
- backdrop-filter: var(--dialog-backdrop-filter, none);
- }
- .mdc-dialog__actions {
- justify-content: var(--justify-action-buttons, flex-end);
- padding-bottom: max(env(safe-area-inset-bottom), 8px);
- }
- .mdc-dialog__actions span:nth-child(1) {
- flex: var(--secondary-action-button-flex, unset);
- }
- .mdc-dialog__actions span:nth-child(2) {
- flex: var(--primary-action-button-flex, unset);
- }
- .mdc-dialog__container {
- align-items: var(--vertial-align-dialog, center);
- }
- .mdc-dialog__title::before {
- display: block;
- height: 20px;
- }
- .mdc-dialog .mdc-dialog__content {
- position: var(--dialog-content-position, relative);
- padding: var(--dialog-content-padding, 20px 24px);
- }
- :host([hideactions]) .mdc-dialog .mdc-dialog__content {
- padding-bottom: max(
- var(--dialog-content-padding, 20px),
- env(safe-area-inset-bottom)
- );
- }
- .mdc-dialog .mdc-dialog__surface {
- position: var(--dialog-surface-position, relative);
- top: var(--dialog-surface-top);
- min-height: var(--mdc-dialog-min-height, auto);
- border-radius: var(
- --ha-dialog-border-radius,
- var(--ha-card-border-radius, 4px)
- );
- }
- :host([flexContent]) .mdc-dialog .mdc-dialog__content {
- display: flex;
- flex-direction: column;
- }
- .header_button {
- position: absolute;
- right: 16px;
- top: 10px;
- text-decoration: none;
- color: inherit;
- }
- .header_title {
- margin-right: 40px;
- }
- [dir="rtl"].header_button {
- right: auto;
- left: 16px;
- }
- [dir="rtl"].header_title {
- margin-left: 40px;
- margin-right: 0px;
- }
- `,
- ];
- }
+ static override styles = [
+ styles,
+ css`
+ .mdc-dialog {
+ --mdc-dialog-scroll-divider-color: var(--divider-color);
+ z-index: var(--dialog-z-index, 7);
+ -webkit-backdrop-filter: var(--dialog-backdrop-filter, none);
+ backdrop-filter: var(--dialog-backdrop-filter, none);
+ }
+ .mdc-dialog__actions {
+ justify-content: var(--justify-action-buttons, flex-end);
+ padding-bottom: max(env(safe-area-inset-bottom), 8px);
+ }
+ .mdc-dialog__actions span:nth-child(1) {
+ flex: var(--secondary-action-button-flex, unset);
+ }
+ .mdc-dialog__actions span:nth-child(2) {
+ flex: var(--primary-action-button-flex, unset);
+ }
+ .mdc-dialog__container {
+ align-items: var(--vertial-align-dialog, center);
+ }
+ .mdc-dialog__title::before {
+ display: block;
+ height: 20px;
+ }
+ .mdc-dialog .mdc-dialog__content {
+ position: var(--dialog-content-position, relative);
+ padding: var(--dialog-content-padding, 20px 24px);
+ }
+ :host([hideactions]) .mdc-dialog .mdc-dialog__content {
+ padding-bottom: max(
+ var(--dialog-content-padding, 20px),
+ env(safe-area-inset-bottom)
+ );
+ }
+ .mdc-dialog .mdc-dialog__surface {
+ position: var(--dialog-surface-position, relative);
+ top: var(--dialog-surface-top);
+ min-height: var(--mdc-dialog-min-height, auto);
+ border-radius: var(
+ --ha-dialog-border-radius,
+ var(--ha-card-border-radius, 4px)
+ );
+ }
+ :host([flexContent]) .mdc-dialog .mdc-dialog__content {
+ display: flex;
+ flex-direction: column;
+ }
+ .header_button {
+ position: absolute;
+ right: 16px;
+ top: 10px;
+ text-decoration: none;
+ color: inherit;
+ }
+ .header_title {
+ margin-right: 40px;
+ }
+ [dir="rtl"].header_button {
+ right: auto;
+ left: 16px;
+ }
+ [dir="rtl"].header_title {
+ margin-left: 40px;
+ margin-right: 0px;
+ }
+ `,
+ ];
}
declare global {
diff --git a/src/components/ha-form/ha-form-float.ts b/src/components/ha-form/ha-form-float.ts
index 7cae936ef7..ce28ee7cae 100644
--- a/src/components/ha-form/ha-form-float.ts
+++ b/src/components/ha-form/ha-form-float.ts
@@ -1,21 +1,21 @@
-import "@material/mwc-textfield";
-import type { TextField } from "@material/mwc-textfield";
import { css, html, LitElement, TemplateResult, PropertyValues } from "lit";
import { customElement, property, query } from "lit/decorators";
import { fireEvent } from "../../common/dom/fire_event";
+import type { HaTextField } from "../ha-textfield";
+import "../ha-textfield";
import { HaFormElement, HaFormFloatData, HaFormFloatSchema } from "./types";
@customElement("ha-form-float")
export class HaFormFloat extends LitElement implements HaFormElement {
- @property() public schema!: HaFormFloatSchema;
+ @property({ attribute: false }) public schema!: HaFormFloatSchema;
- @property() public data!: HaFormFloatData;
+ @property({ attribute: false }) public data!: HaFormFloatData;
@property() public label!: string;
@property({ type: Boolean }) public disabled = false;
- @query("mwc-textfield") private _input?: HTMLElement;
+ @query("ha-textfield") private _input?: HaTextField;
public focus() {
if (this._input) {
@@ -25,7 +25,7 @@ export class HaFormFloat extends LitElement implements HaFormElement {
protected render(): TemplateResult {
return html`
-
+ >
`;
}
@@ -46,7 +46,7 @@ export class HaFormFloat extends LitElement implements HaFormElement {
}
private _valueChanged(ev: Event) {
- const source = ev.target as TextField;
+ const source = ev.target as HaTextField;
const rawValue = source.value.replace(",", ".");
let value: number | undefined;
@@ -81,7 +81,7 @@ export class HaFormFloat extends LitElement implements HaFormElement {
:host([own-margin]) {
margin-bottom: 5px;
}
- mwc-textfield {
+ ha-textfield {
display: block;
}
`;
diff --git a/src/components/ha-form/ha-form-integer.ts b/src/components/ha-form/ha-form-integer.ts
index 3a684a3d40..5873eff158 100644
--- a/src/components/ha-form/ha-form-integer.ts
+++ b/src/components/ha-form/ha-form-integer.ts
@@ -1,6 +1,3 @@
-import "@material/mwc-textfield";
-import type { TextField } from "@material/mwc-textfield";
-import type { Slider } from "@material/mwc-slider";
import {
css,
CSSResultGroup,
@@ -14,18 +11,21 @@ import { fireEvent } from "../../common/dom/fire_event";
import { HaCheckbox } from "../ha-checkbox";
import { HaFormElement, HaFormIntegerData, HaFormIntegerSchema } from "./types";
import "../ha-slider";
+import { HaTextField } from "../ha-textfield";
@customElement("ha-form-integer")
export class HaFormInteger extends LitElement implements HaFormElement {
- @property() public schema!: HaFormIntegerSchema;
+ @property({ attribute: false }) public schema!: HaFormIntegerSchema;
- @property() public data?: HaFormIntegerData;
+ @property({ attribute: false }) public data?: HaFormIntegerData;
@property() public label?: string;
@property({ type: Boolean }) public disabled = false;
- @query("mwc-textfield ha-slider") private _input?: HTMLElement;
+ @query("ha-textfield ha-slider") private _input?:
+ | HaTextField
+ | HTMLInputElement;
private _lastValue?: HaFormIntegerData;
@@ -70,7 +70,7 @@ export class HaFormInteger extends LitElement implements HaFormElement {
}
return html`
-
+ >
`;
}
@@ -138,7 +138,7 @@ export class HaFormInteger extends LitElement implements HaFormElement {
}
private _valueChanged(ev: Event) {
- const source = ev.target as TextField | Slider;
+ const source = ev.target as HaTextField | HTMLInputElement;
const rawValue = source.value;
let value: number | undefined;
@@ -172,7 +172,7 @@ export class HaFormInteger extends LitElement implements HaFormElement {
ha-slider {
flex: 1;
}
- mwc-textfield {
+ ha-textfield {
display: block;
}
`;
diff --git a/src/components/ha-form/ha-form-multi_select.ts b/src/components/ha-form/ha-form-multi_select.ts
index 3023a1a15f..4777eeb76b 100644
--- a/src/components/ha-form/ha-form-multi_select.ts
+++ b/src/components/ha-form/ha-form-multi_select.ts
@@ -1,25 +1,27 @@
+import "@material/mwc-select/mwc-select";
import { mdiMenuDown, mdiMenuUp } from "@mdi/js";
-import "@material/mwc-textfield";
-import "@material/mwc-formfield";
import {
css,
CSSResultGroup,
html,
LitElement,
- TemplateResult,
PropertyValues,
+ TemplateResult,
} from "lit";
import { customElement, property, query, state } from "lit/decorators";
import { fireEvent } from "../../common/dom/fire_event";
import "../ha-button-menu";
+import { HaCheckListItem } from "../ha-check-list-item";
+import "../ha-checkbox";
+import type { HaCheckbox } from "../ha-checkbox";
+import "../ha-formfield";
import "../ha-svg-icon";
+import "../ha-textfield";
import {
HaFormElement,
HaFormMultiSelectData,
HaFormMultiSelectSchema,
} from "./types";
-import "../ha-checkbox";
-import type { HaCheckbox } from "../ha-checkbox";
function optionValue(item: string | string[]): string {
return Array.isArray(item) ? item[0] : item;
@@ -57,23 +59,23 @@ export class HaFormMultiSelect extends LitElement implements HaFormElement {
: Object.entries(this.schema.options);
const data = this.data || [];
- const renderedOptions = options.map((item: string | [string, string]) => {
- const value = optionValue(item);
- return html`
-
-
-
- `;
- });
-
// We will just render all checkboxes.
if (options.length < SHOW_ALL_ENTRIES_LIMIT) {
- return html`${this.label}${renderedOptions}
`;
+ return html`
+ ${this.label}${options.map((item: string | [string, string]) => {
+ const value = optionValue(item);
+ return html`
+
+
+
+ `;
+ })}
+
`;
}
return html`
@@ -83,8 +85,10 @@ export class HaFormMultiSelect extends LitElement implements HaFormElement {
corner="BOTTOM_START"
@opened=${this._handleOpen}
@closed=${this._handleClose}
+ multi
+ activatable
>
-
+ >
- ${renderedOptions}
+ ${options.map((item: string | [string, string]) => {
+ const value = optionValue(item);
+ const selected = data.includes(value);
+ return html`
+ ${optionLabel(item)}
+ `;
+ })}
`;
}
@@ -105,7 +122,7 @@ export class HaFormMultiSelect extends LitElement implements HaFormElement {
protected firstUpdated() {
this.updateComplete.then(() => {
const { formElement, mdcRoot } =
- this.shadowRoot?.querySelector("mwc-textfield") || ({} as any);
+ this.shadowRoot?.querySelector("ha-textfield") || ({} as any);
if (formElement) {
formElement.style.textOverflow = "ellipsis";
}
@@ -125,9 +142,23 @@ export class HaFormMultiSelect extends LitElement implements HaFormElement {
}
}
+ private _selectedChanged(ev: CustomEvent): void {
+ ev.stopPropagation();
+ if (ev.detail.source === "property") {
+ return;
+ }
+ this._handleValueChanged(
+ (ev.target as HaCheckListItem).value,
+ ev.detail.selected
+ );
+ }
+
private _valueChanged(ev: CustomEvent): void {
const { value, checked } = ev.target as HaCheckbox;
+ this._handleValueChanged(value, checked);
+ }
+ private _handleValueChanged(value, checked: boolean): void {
let newValue: string[];
if (checked) {
@@ -171,11 +202,11 @@ export class HaFormMultiSelect extends LitElement implements HaFormElement {
display: block;
cursor: pointer;
}
- mwc-formfield {
+ ha-formfield {
display: block;
padding-right: 16px;
}
- mwc-textfield {
+ ha-textfield {
display: block;
pointer-events: none;
}
diff --git a/src/components/ha-form/ha-form-string.ts b/src/components/ha-form/ha-form-string.ts
index 22085ab2a5..e82a96519e 100644
--- a/src/components/ha-form/ha-form-string.ts
+++ b/src/components/ha-form/ha-form-string.ts
@@ -1,17 +1,17 @@
import { mdiEye, mdiEyeOff } from "@mdi/js";
-import "@material/mwc-textfield";
-import type { TextField } from "@material/mwc-textfield";
import {
css,
CSSResultGroup,
html,
LitElement,
- TemplateResult,
PropertyValues,
+ TemplateResult,
} from "lit";
-import { customElement, property, state, query } from "lit/decorators";
+import { customElement, property, query, state } from "lit/decorators";
import { fireEvent } from "../../common/dom/fire_event";
import "../ha-icon-button";
+import "../ha-textfield";
+import type { HaTextField } from "../ha-textfield";
import type {
HaFormElement,
HaFormStringData,
@@ -32,7 +32,7 @@ export class HaFormString extends LitElement implements HaFormElement {
@state() private _unmaskedPassword = false;
- @query("mwc-textfield") private _input?: HTMLElement;
+ @query("ha-textfield") private _input?: HaTextField;
public focus(): void {
if (this._input) {
@@ -45,7 +45,7 @@ export class HaFormString extends LitElement implements HaFormElement {
this.schema.name.includes(field)
);
return html`
-
+ >
${isPassword
? html`
${this.localize("ui.components.qr-scanner.manual_input")}
-
+ >
${this.localize("ui.common.submit")}
@@ -161,7 +161,7 @@ class HaQrScanner extends LitElement {
private _manualKeyup(ev: KeyboardEvent) {
if (ev.key === "Enter") {
- this._qrCodeScanned((ev.target as TextField).value);
+ this._qrCodeScanned((ev.target as HaTextField).value);
}
}
@@ -199,7 +199,7 @@ class HaQrScanner extends LitElement {
display: flex;
align-items: center;
}
- mwc-textfield {
+ ha-textfield {
flex: 1;
margin-right: 8px;
}
diff --git a/src/components/ha-radio.ts b/src/components/ha-radio.ts
index a2fb2b5929..f551d4fedc 100644
--- a/src/components/ha-radio.ts
+++ b/src/components/ha-radio.ts
@@ -1,12 +1,18 @@
-import { Radio } from "@material/mwc-radio";
+import { RadioBase } from "@material/mwc-radio/mwc-radio-base";
+import { styles } from "@material/mwc-radio/mwc-radio.css";
+import { css } from "lit";
import { customElement } from "lit/decorators";
@customElement("ha-radio")
-export class HaRadio extends Radio {
- public firstUpdated() {
- super.firstUpdated();
- this.style.setProperty("--mdc-theme-secondary", "var(--primary-color)");
- }
+export class HaRadio extends RadioBase {
+ static override styles = [
+ styles,
+ css`
+ :host {
+ --mdc-theme-secondary: var(--primary-color);
+ }
+ `,
+ ];
}
declare global {
diff --git a/src/components/ha-selector/ha-selector-number.ts b/src/components/ha-selector/ha-selector-number.ts
index 9f4d29a765..75d050e03c 100644
--- a/src/components/ha-selector/ha-selector-number.ts
+++ b/src/components/ha-selector/ha-selector-number.ts
@@ -5,7 +5,7 @@ import { fireEvent } from "../../common/dom/fire_event";
import { NumberSelector } from "../../data/selector";
import { HomeAssistant } from "../../types";
import "../ha-slider";
-import "@material/mwc-textfield/mwc-textfield";
+import "../ha-textfield";
@customElement("ha-selector-number")
export class HaNumberSelector extends LitElement {
@@ -36,7 +36,7 @@ export class HaNumberSelector extends LitElement {
>
`
: ""}
-
- `;
+ `;
}
private get _value() {
- return this.value || 0;
+ return this.value ?? 0;
}
private _handleInputChange(ev) {
@@ -90,10 +91,11 @@ export class HaNumberSelector extends LitElement {
ha-slider {
flex: 1;
}
- mwc-textfield {
- width: 70px;
+ ha-textfield {
+ --ha-textfield-input-width: 40px;
}
.single {
+ --ha-textfield-input-width: unset;
flex: 1;
}
`;
diff --git a/src/components/ha-selector/ha-selector-text.ts b/src/components/ha-selector/ha-selector-text.ts
index d9a1f87bfc..7431c05833 100644
--- a/src/components/ha-selector/ha-selector-text.ts
+++ b/src/components/ha-selector/ha-selector-text.ts
@@ -1,5 +1,4 @@
import "@material/mwc-textarea/mwc-textarea";
-import "@material/mwc-textfield/mwc-textfield";
import { mdiEye, mdiEyeOff } from "@mdi/js";
import { css, CSSResultGroup, html, LitElement } from "lit";
import { customElement, property, state } from "lit/decorators";
@@ -7,6 +6,7 @@ import { fireEvent } from "../../common/dom/fire_event";
import { StringSelector } from "../../data/selector";
import { HomeAssistant } from "../../types";
import "../ha-icon-button";
+import "../ha-textfield";
@customElement("ha-selector-text")
export class HaTextSelector extends LitElement {
@@ -38,7 +38,7 @@ export class HaTextSelector extends LitElement {
required
>`;
}
- return html`
`
: this.selector.text?.suffix}
required
- >
+ >
${this.selector.text?.type === "password"
? html` {
if (this.haptic) {
forwardHaptic("light");
@@ -24,29 +20,30 @@ export class HaSwitch extends Switch {
});
}
- static get styles(): CSSResultGroup {
- return [
- Switch.styles,
- css`
- .mdc-switch.mdc-switch--checked .mdc-switch__thumb {
- background-color: var(--switch-checked-button-color);
- border-color: var(--switch-checked-button-color);
- }
- .mdc-switch.mdc-switch--checked .mdc-switch__track {
- background-color: var(--switch-checked-track-color);
- border-color: var(--switch-checked-track-color);
- }
- .mdc-switch:not(.mdc-switch--checked) .mdc-switch__thumb {
- background-color: var(--switch-unchecked-button-color);
- border-color: var(--switch-unchecked-button-color);
- }
- .mdc-switch:not(.mdc-switch--checked) .mdc-switch__track {
- background-color: var(--switch-unchecked-track-color);
- border-color: var(--switch-unchecked-track-color);
- }
- `,
- ];
- }
+ static override styles = [
+ styles,
+ css`
+ :host {
+ --mdc-theme-secondary: var(--switch-checked-color);
+ }
+ .mdc-switch.mdc-switch--checked .mdc-switch__thumb {
+ background-color: var(--switch-checked-button-color);
+ border-color: var(--switch-checked-button-color);
+ }
+ .mdc-switch.mdc-switch--checked .mdc-switch__track {
+ background-color: var(--switch-checked-track-color);
+ border-color: var(--switch-checked-track-color);
+ }
+ .mdc-switch:not(.mdc-switch--checked) .mdc-switch__thumb {
+ background-color: var(--switch-unchecked-button-color);
+ border-color: var(--switch-unchecked-button-color);
+ }
+ .mdc-switch:not(.mdc-switch--checked) .mdc-switch__track {
+ background-color: var(--switch-unchecked-track-color);
+ border-color: var(--switch-unchecked-track-color);
+ }
+ `,
+ ];
}
declare global {
diff --git a/src/components/ha-textfield.ts b/src/components/ha-textfield.ts
index c5e0e21a90..8ca6992f2d 100644
--- a/src/components/ha-textfield.ts
+++ b/src/components/ha-textfield.ts
@@ -1,9 +1,10 @@
-import { TextField } from "@material/mwc-textfield";
-import { TemplateResult, html, PropertyValues } from "lit";
+import { TextFieldBase } from "@material/mwc-textfield/mwc-textfield-base";
+import { styles } from "@material/mwc-textfield/mwc-textfield.css";
+import { TemplateResult, html, PropertyValues, css } from "lit";
import { customElement, property } from "lit/decorators";
@customElement("ha-textfield")
-export class HaTextField extends TextField {
+export class HaTextField extends TextFieldBase {
@property({ type: Boolean }) public invalid?: boolean;
@property({ attribute: "error-message" }) public errorMessage?: string;
@@ -37,6 +38,15 @@ export class HaTextField extends TextField {
`;
}
+
+ static override styles = [
+ styles,
+ css`
+ .mdc-text-field__input {
+ width: var(--ha-textfield-input-width, 100%);
+ }
+ `,
+ ];
}
declare global {
diff --git a/src/panels/config/cloud/account/cloud-google-pref.ts b/src/panels/config/cloud/account/cloud-google-pref.ts
index 7e605d165d..3e7646911d 100644
--- a/src/panels/config/cloud/account/cloud-google-pref.ts
+++ b/src/panels/config/cloud/account/cloud-google-pref.ts
@@ -1,12 +1,12 @@
import "@material/mwc-button";
-import "@material/mwc-textfield/mwc-textfield";
-import type { TextField } from "@material/mwc-textfield/mwc-textfield";
import { css, CSSResultGroup, html, LitElement, TemplateResult } from "lit";
import { property, state } from "lit/decorators";
import { fireEvent } from "../../../../common/dom/fire_event";
import "../../../../components/ha-alert";
import "../../../../components/ha-card";
import type { HaSwitch } from "../../../../components/ha-switch";
+import "../../../../components/ha-textfield";
+import type { HaTextField } from "../../../../components/ha-textfield";
import { CloudStatusLoggedIn, updateCloudPref } from "../../../../data/cloud";
import { syncCloudGoogleEntities } from "../../../../data/google_assistant";
import { showAlertDialog } from "../../../../dialogs/generic/show-dialog-box";
@@ -136,7 +136,7 @@ export class CloudGooglePref extends LitElement {
${this.hass.localize(
"ui.panel.config.cloud.account.google.enter_pin_info"
)}
-
+ >
`}
@@ -229,7 +229,7 @@ export class CloudGooglePref extends LitElement {
}
private async _pinChanged(ev) {
- const input = ev.target as TextField;
+ const input = ev.target as HaTextField;
try {
await updateCloudPref(this.hass, {
[input.id]: input.value || null,
@@ -260,7 +260,7 @@ export class CloudGooglePref extends LitElement {
right: auto;
left: 24px;
}
- mwc-textfield {
+ ha-textfield {
width: 250px;
display: block;
margin-top: 8px;
diff --git a/src/panels/config/cloud/forgot-password/cloud-forgot-password.ts b/src/panels/config/cloud/forgot-password/cloud-forgot-password.ts
index a6b34b9054..003ef7ae66 100644
--- a/src/panels/config/cloud/forgot-password/cloud-forgot-password.ts
+++ b/src/panels/config/cloud/forgot-password/cloud-forgot-password.ts
@@ -1,11 +1,11 @@
-import "@material/mwc-textfield/mwc-textfield";
-import type { TextField } from "@material/mwc-textfield/mwc-textfield";
import { css, html, LitElement, TemplateResult } from "lit";
import { customElement, property, query, state } from "lit/decorators";
import { fireEvent } from "../../../../common/dom/fire_event";
import "../../../../components/buttons/ha-progress-button";
import "../../../../components/ha-alert";
import "../../../../components/ha-card";
+import type { HaTextField } from "../../../../components/ha-textfield";
+import "../../../../components/ha-textfield";
import { cloudForgotPassword } from "../../../../data/cloud";
import "../../../../layouts/hass-subpage";
import { haStyle } from "../../../../resources/styles";
@@ -23,7 +23,7 @@ export class CloudForgotPassword extends LitElement {
@state() private _error?: string;
- @query("#email", true) private _emailField!: TextField;
+ @query("#email", true) private _emailField!: HaTextField;
protected render(): TemplateResult {
return html`
@@ -49,7 +49,7 @@ export class CloudForgotPassword extends LitElement {
${this._error
? html`${this._error} `
: ""}
-
+ >
${this._error}`
: ""}
-
-
+
+ >
${this._error}`
: ""}
-
-
+
+ >
-
-
${this.hass!.localize(
"ui.panel.config.devices.picker.filter.show_disabled"
)}
-
+
`;
diff --git a/src/panels/config/entities/ha-config-entities.ts b/src/panels/config/entities/ha-config-entities.ts
index 7c03fd89f3..8c8bcec0d7 100644
--- a/src/panels/config/entities/ha-config-entities.ts
+++ b/src/panels/config/entities/ha-config-entities.ts
@@ -1,4 +1,3 @@
-import "@material/mwc-list/mwc-list-item";
import type { RequestSelectedDetail } from "@material/mwc-list/mwc-list-item";
import {
mdiAlertCircle,
@@ -35,6 +34,7 @@ import type {
import "../../../components/ha-button-menu";
import "../../../components/ha-icon-button";
import "../../../components/ha-svg-icon";
+import "../../../components/ha-check-list-item";
import {
AreaRegistryEntry,
subscribeAreaRegistry,
@@ -586,45 +586,35 @@ export class HaConfigEntities extends SubscribeMixin(LitElement) {
)}
.path=${mdiFilterVariant}
>
-
-
${this.hass!.localize(
"ui.panel.config.entities.picker.filter.show_disabled"
)}
-
-
+
-
${this.hass!.localize(
"ui.panel.config.entities.picker.filter.show_unavailable"
)}
-
-
+
-
${this.hass!.localize(
"ui.panel.config.entities.picker.filter.show_readonly"
)}
-
+
`}
${includeZHAFab
? html`
diff --git a/src/panels/config/integrations/ha-config-integrations.ts b/src/panels/config/integrations/ha-config-integrations.ts
index 7aa599d8a2..3c1879e1c5 100644
--- a/src/panels/config/integrations/ha-config-integrations.ts
+++ b/src/panels/config/integrations/ha-config-integrations.ts
@@ -1,5 +1,4 @@
import { ActionDetail } from "@material/mwc-list";
-import "@material/mwc-list/mwc-list-item";
import { mdiFilterVariant, mdiPlus } from "@mdi/js";
import Fuse from "fuse.js";
import type { UnsubscribeFunc } from "home-assistant-js-websocket";
@@ -26,6 +25,8 @@ import "../../../components/ha-checkbox";
import "../../../components/ha-fab";
import "../../../components/ha-icon-button";
import "../../../components/ha-svg-icon";
+import "../../../components/ha-check-list-item";
+
import { isComponentLoaded } from "../../../common/config/is_component_loaded";
import { ConfigEntry, getConfigEntries } from "../../../data/config_entries";
import {
@@ -308,21 +309,16 @@ class HaConfigIntegrations extends SubscribeMixin(LitElement) {
.path=${mdiFilterVariant}
>
-
-
+
${this.hass.localize(
"ui.panel.config.integrations.ignore.show_ignored"
)}
-
-
-
+
+
${this.hass.localize(
"ui.panel.config.integrations.disable.show_disabled"
)}
-
+
`;
return html`
diff --git a/src/panels/config/integrations/integration-panels/zwave_js/dialog-zwave_js-add-node.ts b/src/panels/config/integrations/integration-panels/zwave_js/dialog-zwave_js-add-node.ts
index 82a7ebda77..4c9603ba0a 100644
--- a/src/panels/config/integrations/integration-panels/zwave_js/dialog-zwave_js-add-node.ts
+++ b/src/panels/config/integrations/integration-panels/zwave_js/dialog-zwave_js-add-node.ts
@@ -1,5 +1,4 @@
import "@material/mwc-button/mwc-button";
-import "@material/mwc-textfield/mwc-textfield";
import { mdiAlertCircle, mdiCheckCircle, mdiQrcodeScan } from "@mdi/js";
import "@polymer/paper-input/paper-input";
import type { PaperInputElement } from "@polymer/paper-input/paper-input";
@@ -811,10 +810,6 @@ class DialogZWaveJSAddNode extends LitElement {
}
}
- mwc-textfield {
- width: 100%;
- }
-
ha-svg-icon {
width: 68px;
height: 48px;
From 5435218187b5086e13bdb98fcab4c75749dc2e7e Mon Sep 17 00:00:00 2001
From: Bram Kragten
Date: Wed, 9 Feb 2022 17:58:37 +0100
Subject: [PATCH 027/174] Make textarea grow on input (#11618)
---
.../ha-selector/ha-selector-text.ts | 11 ++--
src/components/ha-textarea.ts | 60 +++++++++++++++++++
2 files changed, 66 insertions(+), 5 deletions(-)
create mode 100644 src/components/ha-textarea.ts
diff --git a/src/components/ha-selector/ha-selector-text.ts b/src/components/ha-selector/ha-selector-text.ts
index 7431c05833..565ef8889e 100644
--- a/src/components/ha-selector/ha-selector-text.ts
+++ b/src/components/ha-selector/ha-selector-text.ts
@@ -1,4 +1,3 @@
-import "@material/mwc-textarea/mwc-textarea";
import { mdiEye, mdiEyeOff } from "@mdi/js";
import { css, CSSResultGroup, html, LitElement } from "lit";
import { customElement, property, state } from "lit/decorators";
@@ -6,6 +5,7 @@ import { fireEvent } from "../../common/dom/fire_event";
import { StringSelector } from "../../data/selector";
import { HomeAssistant } from "../../types";
import "../ha-icon-button";
+import "../ha-textarea";
import "../ha-textfield";
@customElement("ha-selector-text")
@@ -26,7 +26,7 @@ export class HaTextSelector extends LitElement {
protected render() {
if (this.selector.text?.multiline) {
- return html` `;
+ autogrow
+ >`;
}
return html`
Date: Wed, 9 Feb 2022 18:20:25 +0100
Subject: [PATCH 028/174] Update lit-virtualizer (#11623)
---
.../patches/@lit-labs/virtualizer/0.7.0.patch | 1536 -----------------
.../virtualizer/event-target-shim.patch | 18 +-
package.json | 2 +-
src/components/data-table/ha-data-table.ts | 187 +-
src/dialogs/quick-bar/ha-quick-bar.ts | 65 +-
src/panels/logbook/ha-logbook.ts | 32 +-
yarn.lock | 22 +-
7 files changed, 166 insertions(+), 1696 deletions(-)
delete mode 100644 .yarn/patches/@lit-labs/virtualizer/0.7.0.patch
diff --git a/.yarn/patches/@lit-labs/virtualizer/0.7.0.patch b/.yarn/patches/@lit-labs/virtualizer/0.7.0.patch
deleted file mode 100644
index d7c1a6d703..0000000000
--- a/.yarn/patches/@lit-labs/virtualizer/0.7.0.patch
+++ /dev/null
@@ -1,1536 +0,0 @@
-diff --git a/CHANGELOG.md b/CHANGELOG.md
-index c5ea17be2de03bbfe82bcc30aa28f7035cc93da0..0a21c3a1d32f5b8a2068c89df83f1b84ce4abbda 100644
---- a/CHANGELOG.md
-+++ b/CHANGELOG.md
-@@ -1,16 +1,24 @@
-+## [0.7.0] - 2021-05-26
-+### Changed
-+- Made significant changes and improvements to TypeScript types (work ongoing)
-+
-+### Fixed
-+- Fixed scrolling issue on iOS ([#54](https://github.com/PolymerLabs/uni-virtualizer/issues/54))
-+
- ## [0.6.0] - 2021-05-01
- - This is a stopgap release to unblock migrations to Lit 2.0
--- In the near future:
-- - Source will move to the Lit monorepo
-- - Subsequent releases will likely be as `@lit-labs/virtualizer`
-+- In the near future, source will move to the Lit monorepo
-
- ### Changed
- - Migrated to Lit 2.x
-
- ## [0.5.0] - 2021-05-01
- ### Changed
-+- Changed npm package to `@lit-labs/virtualizer`
- - Significant refactoring
- - Now emits custom events, access data from `detail` object
-+- `layout` property is now required for both the `lit-virtualizer`
-+ element and the `scroll()` directive
-
- ### Added
- - Support for older browsers (IE11, legacy Edge)
-diff --git a/README.md b/README.md
-index 86e6610be14ed8f375074a628298e8e9c8c50823..0ddf6a9d89e1a73514e0d11e92b8d007f864f887 100644
---- a/README.md
-+++ b/README.md
-@@ -182,7 +182,7 @@ const handleEvent = (e) => {
- }
-
- const example = (contacts) => html`
--
-+
- ${scroll({
- items: contacts,
- renderItem: ({ mediumText }) => html`${mediumText}
`,
-diff --git a/lib/lit-virtualizer.d.ts b/lib/lit-virtualizer.d.ts
-index d6a63bd658542fee62c36f8658fc3561ab61d2e8..4c93ff899f483d4824d24024b0803c8838150d0a 100644
---- a/lib/lit-virtualizer.d.ts
-+++ b/lib/lit-virtualizer.d.ts
-@@ -1,5 +1,5 @@
- import { LitElement, TemplateResult } from 'lit';
--import { Type, Layout, LayoutConfig } from './uni-virtualizer/lib/layouts/Layout.js';
-+import { LayoutSpecifier, Layout, LayoutConstructor } from './uni-virtualizer/lib/layouts/Layout.js';
- /**
- * A LitElement wrapper of the scroll directive.
- *
-@@ -7,19 +7,19 @@ import { Type, Layout, LayoutConfig } from './uni-virtualizer/lib/layouts/Layout
- * Pass an items array, renderItem method, and scroll target as properties
- * to the element.
- */
--export declare class LitVirtualizer- extends LitElement {
-- renderItem: (item: Item, index?: number) => TemplateResult;
-- items: Array
- ;
-+export declare class LitVirtualizer extends LitElement {
-+ renderItem?: ((item: any, index?: number) => TemplateResult);
-+ items: Array
;
- scrollTarget: Element | Window;
-- keyFunction: (item: any) => any;
-+ keyFunction: ((item: unknown) => unknown) | undefined;
- private _layout;
- private _scrollToIndex;
- createRenderRoot(): this;
- /**
- * The method used for rendering each item.
- */
-- set layout(layout: Layout | Type | LayoutConfig);
-- get layout(): Layout | Type | LayoutConfig;
-+ set layout(layout: Layout | LayoutConstructor | LayoutSpecifier | null);
-+ get layout(): Layout | LayoutConstructor | LayoutSpecifier | null;
- /**
- * Scroll to the specified index, placing that item at the given position
- * in the scroll view.
-@@ -29,7 +29,7 @@ export declare class LitVirtualizer- extends LitElement {
- }
- declare global {
- interface HTMLElementTagNameMap {
-- 'lit-virtualizer': LitVirtualizer
;
-+ 'lit-virtualizer': LitVirtualizer;
- }
- }
- //# sourceMappingURL=lit-virtualizer.d.ts.map
-\ No newline at end of file
-diff --git a/lib/lit-virtualizer.d.ts.map b/lib/lit-virtualizer.d.ts.map
-index 65ca47b388981b8454619ef71c1eade0c847b6da..763404320ecd414b07e98aee537f55aeacb223ba 100644
---- a/lib/lit-virtualizer.d.ts.map
-+++ b/lib/lit-virtualizer.d.ts.map
-@@ -1 +1 @@
--{"version":3,"file":"lit-virtualizer.d.ts","sourceRoot":"","sources":["../src/lib/lit-virtualizer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAQ,UAAU,EAAE,cAAc,EAAE,MAAM,KAAK,CAAC;AAKvD,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,yCAAyC,CAAC;AAErF;;;;;;GAMG;AACH,qBACa,cAAc,CAAC,IAAI,CAAE,SAAQ,UAAU;IAEhD,UAAU,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,KAAK,CAAC,EAAE,MAAM,KAAK,cAAc,CAAC;IAG3D,KAAK,EAAE,KAAK,CAAC,IAAI,CAAC,CAAC;IAGnB,YAAY,EAAE,OAAO,GAAG,MAAM,CAAQ;IAGtC,WAAW,EAAE,CAAC,IAAI,EAAC,GAAG,KAAK,GAAG,CAAC;IAE/B,OAAO,CAAC,OAAO,CAAsC;IAErD,OAAO,CAAC,cAAc,CAAoC;IAE1D,gBAAgB;IAahB;;OAEG;IAWH,IACI,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC,GAAG,YAAY,EAItD;IAED,IAAI,MAAM,IANS,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC,GAAG,YAAY,CAQtD;IAGD;;;OAGG;IACG,aAAa,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,GAAE,MAAgB;IAO7D,MAAM,IAAI,cAAc;CAO3B;AAED,OAAO,CAAC,MAAM,CAAC;IACX,UAAU,qBAAqB;QAC3B,iBAAiB,EAAE,cAAc,CAAC,OAAO,CAAC,CAAC;KAC9C;CACJ"}
-\ No newline at end of file
-+{"version":3,"file":"lit-virtualizer.d.ts","sourceRoot":"","sources":["../src/lib/lit-virtualizer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAQ,UAAU,EAAE,cAAc,EAAE,MAAM,KAAK,CAAC;AAKvD,OAAO,EAAE,eAAe,EAAE,MAAM,EAAE,iBAAiB,EAAE,MAAM,yCAAyC,CAAC;AAErG;;;;;;GAMG;AACH,qBACa,cAAe,SAAQ,UAAU;IAE1C,UAAU,CAAC,EAAE,CAAC,CAAC,IAAI,EAAE,GAAG,EAAE,KAAK,CAAC,EAAE,MAAM,KAAK,cAAc,CAAC,CAAC;IAG7D,KAAK,EAAE,KAAK,CAAC,OAAO,CAAC,CAAM;IAG3B,YAAY,EAAE,OAAO,GAAG,MAAM,CAAQ;IAGtC,WAAW,EAAE,CAAC,CAAC,IAAI,EAAC,OAAO,KAAK,OAAO,CAAC,GAAG,SAAS,CAAa;IAEjE,OAAO,CAAC,OAAO,CAA6D;IAE5E,OAAO,CAAC,cAAc,CAAkD;IAExE,gBAAgB;IAahB;;OAEG;IAWH,IACI,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,iBAAiB,GAAG,eAAe,GAAG,IAAI,EAIrE;IAED,IAAI,MAAM,IAAI,MAAM,GAAG,iBAAiB,GAAG,eAAe,GAAG,IAAI,CAEhE;IAGD;;;OAGG;IACG,aAAa,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,GAAE,MAAgB;IAO7D,MAAM,IAAI,cAAc;CAO3B;AAED,OAAO,CAAC,MAAM,CAAC;IACX,UAAU,qBAAqB;QAC3B,iBAAiB,EAAE,cAAc,CAAC;KACrC;CACJ"}
-\ No newline at end of file
-diff --git a/lib/lit-virtualizer.js b/lib/lit-virtualizer.js
-index d7846882e0c98212ee4be144728f26a4c7736fe8..7fb00024c2df2290559fc78db1ad13faf86a2c62 100644
---- a/lib/lit-virtualizer.js
-+++ b/lib/lit-virtualizer.js
-@@ -1,4 +1,9 @@
--import { __decorate } from "tslib";
-+var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
-+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
-+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
-+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
-+ return c > 3 && r && Object.defineProperty(target, key, r), r;
-+};
- import { html, LitElement } from 'lit';
- import { customElement } from 'lit/decorators/custom-element.js';
- import { property } from 'lit/decorators/property.js';
-@@ -14,7 +19,11 @@ import { scrollerRef } from './uni-virtualizer/lib/VirtualScroller.js';
- let LitVirtualizer = class LitVirtualizer extends LitElement {
- constructor() {
- super(...arguments);
-+ this.items = [];
- this.scrollTarget = this;
-+ this.keyFunction = undefined;
-+ this._layout = null;
-+ this._scrollToIndex = null;
- }
- createRenderRoot() {
- return this;
-@@ -83,3 +92,4 @@ LitVirtualizer = __decorate([
- customElement('lit-virtualizer')
- ], LitVirtualizer);
- export { LitVirtualizer };
-+//# sourceMappingURL=lit-virtualizer.js.map
-\ No newline at end of file
-diff --git a/lib/lit-virtualizer.js.map b/lib/lit-virtualizer.js.map
-new file mode 100644
-index 0000000000000000000000000000000000000000..54c885bd148d6bae8f5de85e3417a97a99035d24
---- /dev/null
-+++ b/lib/lit-virtualizer.js.map
-@@ -0,0 +1 @@
-+{"version":3,"file":"lit-virtualizer.js","sourceRoot":"","sources":["../src/lib/lit-virtualizer.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,IAAI,EAAE,UAAU,EAAkB,MAAM,KAAK,CAAC;AACvD,OAAO,EAAE,aAAa,EAAE,MAAM,kCAAkC,CAAC;AACjE,OAAO,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AACtD,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,WAAW,EAAoB,MAAM,0CAA0C,CAAC;AAGzF;;;;;;GAMG;AAEH,IAAa,cAAc,GAA3B,MAAa,cAAe,SAAQ,UAAU;IAA9C;;QAKI,UAAK,GAAmB,EAAE,CAAC;QAG3B,iBAAY,GAAqB,IAAI,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;IADC,QAAQ,EAAE;kDACkD;AAG7D;IADC,QAAQ,CAAC,EAAC,SAAS,EAAE,KAAK,EAAC,CAAC;6CACF;AAG3B;IADC,QAAQ,CAAC,EAAC,SAAS,EAAE,KAAK,EAAC,CAAC;oDACS;AAGtC;IADC,QAAQ,EAAE;mDACsD;AAiCjE;IADC,QAAQ,CAAC,EAAC,SAAS,EAAC,KAAK,EAAC,CAAC;4CAK3B;AAhDQ,cAAc;IAD1B,aAAa,CAAC,iBAAiB,CAAC;GACpB,cAAc,CAyE1B;SAzEY,cAAc","sourcesContent":["import { html, LitElement, TemplateResult } from 'lit';\nimport { customElement } from 'lit/decorators/custom-element.js';\nimport { property } from 'lit/decorators/property.js';\nimport { scroll } from './scroll.js';\nimport { scrollerRef, ContainerElement } from './uni-virtualizer/lib/VirtualScroller.js';\nimport { LayoutSpecifier, Layout, LayoutConstructor } from './uni-virtualizer/lib/layouts/Layout.js';\n\n/**\n * A LitElement wrapper of the scroll directive.\n *\n * Import this module to declare the lit-virtualizer custom element.\n * Pass an items array, renderItem method, and scroll target as properties\n * to the element.\n */\n@customElement('lit-virtualizer')\nexport class LitVirtualizer extends LitElement {\n @property()\n renderItem?: ((item: any, index?: number) => TemplateResult);\n\n @property({attribute: false})\n items: Array = [];\n\n @property({attribute: false})\n scrollTarget: Element | Window = this;\n\n @property()\n keyFunction: ((item:unknown) => unknown) | undefined = undefined;\n\n private _layout: Layout | LayoutConstructor | LayoutSpecifier | null = null;\n\n private _scrollToIndex: {index: number, position: string} | null = null;\n \n createRenderRoot() {\n return this;\n }\n\n // get items() {\n // return this._items;\n // }\n\n // set items(items) {\n // this._items = items;\n // this._scroller.totalItems = items.length;\n // }\n\n /**\n * The method used for rendering each item.\n */\n // get renderItem() {\n // return this._renderItem;\n // }\n // set renderItem(renderItem) {\n // if (renderItem !== this.renderItem) {\n // this._renderItem = renderItem;\n // this.requestUpdate();\n // }\n // }\n\n @property({attribute:false})\n set layout(layout: Layout | LayoutConstructor | LayoutSpecifier | null) {\n // TODO (graynorton): Shouldn't have to set this here\n this._layout = layout;\n this.requestUpdate();\n }\n\n get layout(): Layout | LayoutConstructor | LayoutSpecifier | null {\n return (this as ContainerElement)[scrollerRef]!.layout;\n }\n \n \n /**\n * Scroll to the specified index, placing that item at the given position\n * in the scroll view.\n */\n async scrollToIndex(index: number, position: string = 'start') {\n this._scrollToIndex = {index, position};\n this.requestUpdate();\n await this.updateComplete;\n this._scrollToIndex = null;\n }\n\n render(): TemplateResult {\n const { items, renderItem, keyFunction, scrollTarget } = this;\n const layout = this._layout;\n return html`\n ${scroll({ items, renderItem, layout, keyFunction, scrollTarget, scrollToIndex: this._scrollToIndex })}\n `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'lit-virtualizer': LitVirtualizer;\n }\n}"]}
-\ No newline at end of file
-diff --git a/lib/scroll.d.ts b/lib/scroll.d.ts
-index bca0558061c88063428fcb2e8468a86b31c31157..b75789ee00a5abbdae3a15a2bd2392a5b7a213bb 100644
---- a/lib/scroll.d.ts
-+++ b/lib/scroll.d.ts
-@@ -1,19 +1,19 @@
- import { TemplateResult, ChildPart } from 'lit';
- import { PartInfo } from 'lit/directive.js';
- import { AsyncDirective } from 'lit/async-directive.js';
--import { Type, Layout, LayoutConfig } from './uni-virtualizer/lib/layouts/Layout.js';
--import { VirtualScroller } from './uni-virtualizer/lib/VirtualScroller.js';
-+import { Layout, LayoutConstructor, LayoutSpecifier } from './uni-virtualizer/lib/layouts/Layout.js';
-+import { VirtualScroller, ScrollToIndexValue } from './uni-virtualizer/lib/VirtualScroller.js';
- /**
- * Configuration options for the scroll directive.
- */
--interface ScrollConfig- {
-+interface ScrollConfig {
- /**
- * A function that returns a lit-html TemplateResult. It will be used
- * to generate the DOM for each item in the virtual list.
- */
-- renderItem?: (item: Item, index?: number) => TemplateResult;
-- keyFunction?: (item: any) => any;
-- layout?: Layout | Type
| LayoutConfig;
-+ renderItem?: (item: any, index?: number) => TemplateResult;
-+ keyFunction?: (item: any) => unknown;
-+ layout?: Layout | LayoutConstructor | LayoutSpecifier | null;
- /**
- * An element that receives scroll events for the virtual scroller.
- */
-@@ -21,7 +21,7 @@ interface ScrollConfig- {
- /**
- * The list of items to display via the renderItem function.
- */
-- items?: Array
- ;
-+ items?: Array
;
- /**
- * Limit for the number of items to display. Defaults to the length of the
- * items array.
-@@ -30,24 +30,23 @@ interface ScrollConfig- {
- /**
- * Index and position of the item to scroll to.
- */
-- scrollToIndex?: {
-- index: number;
-- position?: string;
-- };
-+ scrollToIndex?: ScrollToIndexValue;
- }
-+export declare const defaultKeyFunction: (item: any) => any;
-+export declare const defaultRenderItem: (item: any) => TemplateResult<1>;
- declare class ScrollDirective extends AsyncDirective {
-- container: HTMLElement;
-- scroller: VirtualScroller
;
-+ container: HTMLElement | null;
-+ scroller: VirtualScroller | null;
- first: number;
- last: number;
- renderItem: (item: any, index?: number) => TemplateResult;
-- keyFunction: (item: any) => any;
-- items: Array;
-+ keyFunction: (item: any) => unknown;
-+ items: Array;
- constructor(part: PartInfo);
-- render(config?: ScrollConfig): unknown;
-- update(part: ChildPart, [config]: [ScrollConfig]): unknown;
-+ render(config?: ScrollConfig): unknown;
-+ update(part: ChildPart, [config]: [ScrollConfig]): unknown;
- private _initialize;
- }
--export declare const scroll: (config?: ScrollConfig) => import("lit/directive.js").DirectiveResult;
-+export declare const scroll: (config?: ScrollConfig | undefined) => import("lit-html/directive").DirectiveResult;
- export {};
- //# sourceMappingURL=scroll.d.ts.map
-\ No newline at end of file
-diff --git a/lib/scroll.d.ts.map b/lib/scroll.d.ts.map
-index 64ae5c72b0d1342ef2018721bc93362b9ed1c9ff..5278da9ef97db92a43e22caa6a644990a194e313 100644
---- a/lib/scroll.d.ts.map
-+++ b/lib/scroll.d.ts.map
-@@ -1 +1 @@
--{"version":3,"file":"scroll.d.ts","sourceRoot":"","sources":["../src/lib/scroll.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAW,SAAS,EAAE,MAAM,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QAAS,CAAC;AACtD,eAAO,MAAM,iBAAiB,SAAU,GAAG,sBAA2C,CAAC;AAEvF,cAAM,eAAgB,SAAQ,cAAc;IACxC,SAAS,EAAE,WAAW,GAAG,IAAI,CAAO;IACpC,QAAQ,EAAE,eAAe,GAAG,IAAI,CAAO;IACvC,KAAK,SAAI;IACT,IAAI,SAAK;IACT,UAAU,EAAE,CAAC,IAAI,EAAE,GAAG,EAAE,KAAK,CAAC,EAAE,MAAM,KAAK,cAAc,CAAqB;IAC9E,WAAW,EAAE,CAAC,IAAI,EAAE,GAAG,KAAK,OAAO,CAAsB;IACzD,KAAK,EAAE,KAAK,CAAC,OAAO,CAAC,CAAK;gBAEd,IAAI,EAAE,QAAQ;IAO1B,MAAM,CAAC,MAAM,CAAC,EAAE,YAAY;IAc5B,MAAM,CAAC,IAAI,EAAE,SAAS,EAAE,CAAC,MAAM,CAAC,EAAE,CAAC,YAAY,CAAC;IAehD,OAAO,CAAC,WAAW;CAiBtB;AAED,eAAO,MAAM,MAAM,6GAA6B,CAAC"}
-\ No newline at end of file
-diff --git a/lib/scroll.js b/lib/scroll.js
-index 9a0a5b4133c8a00def065e2c611db3d93b7208b0..33fd6bb63b352c8a49b057cce761280af45a57b7 100644
---- a/lib/scroll.js
-+++ b/lib/scroll.js
-@@ -1,22 +1,28 @@
--import { nothing } from 'lit';
-+import { nothing, html } from 'lit';
- import { directive, PartType } from 'lit/directive.js';
- import { AsyncDirective } from 'lit/async-directive.js';
- import { repeat } from 'lit/directives/repeat.js';
- import { VirtualScroller } from './uni-virtualizer/lib/VirtualScroller.js';
--const defaultKeyFunction = item => item;
-+export const defaultKeyFunction = (item) => item;
-+export const defaultRenderItem = (item) => html `${JSON.stringify(item, null, 2)}`;
- class ScrollDirective extends AsyncDirective {
- constructor(part) {
- super(part);
-+ this.container = null;
-+ this.scroller = null;
- this.first = 0;
- this.last = -1;
-+ this.renderItem = defaultRenderItem;
-+ this.keyFunction = defaultKeyFunction;
-+ this.items = [];
- if (part.type !== PartType.CHILD) {
- throw new Error('The scroll directive can only be used in child expressions');
- }
- }
- render(config) {
- if (config) {
-- this.renderItem = config.renderItem;
-- this.keyFunction = config.keyFunction;
-+ this.renderItem = config.renderItem || this.renderItem;
-+ this.keyFunction = config.keyFunction || this.keyFunction;
- }
- const itemsToRender = [];
- if (this.first >= 0 && this.last >= this.first) {
-@@ -30,9 +36,9 @@ class ScrollDirective extends AsyncDirective {
- var _a;
- if (this.scroller || this._initialize(part, config)) {
- const { scroller } = this;
-- this.items = scroller.items = config.items;
-+ this.items = scroller.items = config.items || [];
- scroller.totalItems = config.totalItems || ((_a = config.items) === null || _a === void 0 ? void 0 : _a.length) || 0;
-- scroller.layout = config.layout;
-+ scroller.layout = config.layout || null;
- scroller.scrollTarget = config.scrollTarget || this.container;
- if (config.scrollToIndex) {
- scroller.scrollToIndex = config.scrollToIndex;
-@@ -60,3 +66,4 @@ class ScrollDirective extends AsyncDirective {
- }
- }
- export const scroll = directive(ScrollDirective);
-+//# sourceMappingURL=scroll.js.map
-\ No newline at end of file
-diff --git a/lib/scroll.js.map b/lib/scroll.js.map
-new file mode 100644
-index 0000000000000000000000000000000000000000..4cf7e26beb7d9c52e8af93dc789f96a06756123a
---- /dev/null
-+++ b/lib/scroll.js.map
-@@ -0,0 +1 @@
-+{"version":3,"file":"scroll.js","sourceRoot":"","sources":["../src/lib/scroll.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkB,OAAO,EAAa,IAAI,EAAE,MAAM,KAAK,CAAC;AAC/D,OAAO,EAAE,SAAS,EAAY,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AACjE,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,EAAE,MAAM,EAAE,MAAM,0BAA0B,CAAC;AAElD,OAAO,EAAE,eAAe,EAAsB,MAAM,0CAA0C,CAAC;AAuC/F,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,IAAS,EAAE,EAAE,CAAC,IAAI,CAAC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AAI,CAAC;gBAC3C,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC,CAAC;YACjC,CAAC,CAAC,CAAC;YACH,OAAO,IAAI,CAAC;SACf;QACD,oEAAoE;QACpE,wEAAwE;QACxE,yCAAyC;QACzC,OAAO,CAAC,OAAO,EAAE,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;QAC1D,OAAO,KAAK,CAAC;IACjB,CAAC;CACJ;AAED,MAAM,CAAC,MAAM,MAAM,GAAG,SAAS,CAAC,eAAe,CAAC,CAAC","sourcesContent":["import { TemplateResult, nothing, ChildPart, html } from 'lit';\nimport { directive, PartInfo, PartType } from 'lit/directive.js';\nimport { AsyncDirective } from 'lit/async-directive.js';\nimport { repeat } from 'lit/directives/repeat.js';\nimport { Layout, LayoutConstructor, LayoutSpecifier } from './uni-virtualizer/lib/layouts/Layout.js';\nimport { VirtualScroller, ScrollToIndexValue } from './uni-virtualizer/lib/VirtualScroller.js';\n\n/**\n * Configuration options for the scroll directive.\n */\ninterface ScrollConfig {\n /**\n * A function that returns a lit-html TemplateResult. It will be used\n * to generate the DOM for each item in the virtual list.\n */\n renderItem?: (item: any, index?: number) => TemplateResult;\n\n keyFunction?: (item: any) => unknown;\n \n // TODO (graynorton): Document...\n layout?: Layout | LayoutConstructor | LayoutSpecifier | null;\n \n /**\n * An element that receives scroll events for the virtual scroller.\n */\n scrollTarget?: Element | Window;\n \n /**\n * The list of items to display via the renderItem function.\n */\n items?: Array;\n \n /**\n * Limit for the number of items to display. Defaults to the length of the\n * items array.\n */\n totalItems?: number;\n \n /**\n * Index and position of the item to scroll to.\n */\n scrollToIndex?: ScrollToIndexValue;\n }\n \nexport const defaultKeyFunction = (item: any) => item;\nexport const defaultRenderItem = (item: any) => html`${JSON.stringify(item, null, 2)}`;\n\nclass ScrollDirective extends AsyncDirective {\n container: HTMLElement | null = null\n scroller: VirtualScroller | null = null\n first = 0\n last = -1\n renderItem: (item: any, index?: number) => TemplateResult = defaultRenderItem;\n keyFunction: (item: any) => unknown = defaultKeyFunction;\n items: Array = []\n\n constructor(part: PartInfo) {\n super(part);\n if (part.type !== PartType.CHILD) {\n throw new Error('The scroll directive can only be used in child expressions');\n }\n }\n \n render(config?: ScrollConfig) {\n if (config) {\n this.renderItem = config.renderItem || this.renderItem;\n this.keyFunction = config.keyFunction || this.keyFunction;\n }\n const itemsToRender = [];\n if (this.first >= 0 && this.last >= this.first) {\n for (let i = this.first; i < this.last + 1; i++) {\n itemsToRender.push(this.items[i]);\n } \n }\n return repeat(itemsToRender, this.keyFunction || defaultKeyFunction, this.renderItem);\n }\n\n update(part: ChildPart, [config]: [ScrollConfig]) {\n if (this.scroller || this._initialize(part, config)) {\n const { scroller } = this;\n this.items = scroller!.items = config.items || [];\n scroller!.totalItems = config.totalItems || config.items?.length || 0;\n scroller!.layout = config.layout || null;\n scroller!.scrollTarget = config.scrollTarget || this.container;\n if (config.scrollToIndex) {\n scroller!.scrollToIndex = config.scrollToIndex;\n }\n return this.render(config); \n }\n return nothing;\n }\n\n private _initialize(part: ChildPart, config: ScrollConfig) {\n const container = this.container = part.parentNode as HTMLElement;\n if (container && container.nodeType === 1) {\n this.scroller = new VirtualScroller({ container });\n container.addEventListener('rangeChanged', (e: Event) => {\n this.first = (e as CustomEvent).detail.first;\n this.last = (e as CustomEvent).detail.last;\n this.setValue(this.render());\n });\n return true;\n }\n // TODO (GN): This seems to be needed in the case where the `scroll`\n // directive is used within the `LitVirtualizer` element. Figure out why\n // and see if there's a cleaner solution.\n Promise.resolve().then(() => this.update(part, [config]));\n return false;\n }\n}\n\nexport const scroll = directive(ScrollDirective);"]}
-\ No newline at end of file
-diff --git a/lib/uni-virtualizer/lib/VirtualScroller.d.ts b/lib/uni-virtualizer/lib/VirtualScroller.d.ts
-index 5806fc0ad4e5483f01ad7a1cf2451a31c1f0013a..70fd76efc606d2ff36d5635718ed3a172af6a43b 100644
---- a/lib/uni-virtualizer/lib/VirtualScroller.d.ts
-+++ b/lib/uni-virtualizer/lib/VirtualScroller.d.ts
-@@ -1,18 +1,28 @@
--import { ItemBox, Type, Layout, LayoutConfig } from './layouts/Layout.js';
-+import { ItemBox, Layout, LayoutConstructor, LayoutSpecifier } from './layouts/Layout.js';
- export declare const scrollerRef: unique symbol;
--declare global {
-- interface Window {
-- ShadyDOM?: any;
-- }
--}
- export declare type RangeChangeEvent = {
- first: number;
- last: number;
- firstVisible: number;
- lastVisible: number;
- };
--interface VirtualScrollerConfig {
-- layout?: Layout | Type | LayoutConfig;
-+interface ElementWithOptionalScrollerRef extends Element {
-+ [scrollerRef]?: VirtualScroller;
-+}
-+interface ShadowRootWithOptionalScrollerRef extends ShadowRoot {
-+ [scrollerRef]?: VirtualScroller;
-+}
-+declare type Container = ElementWithOptionalScrollerRef | ShadowRootWithOptionalScrollerRef;
-+export declare type ContainerElement = ElementWithOptionalScrollerRef;
-+declare type ChildMeasurements = {
-+ [key: number]: ItemBox;
-+};
-+export declare type ScrollToIndexValue = {
-+ index: number;
-+ position?: string;
-+} | null;
-+export interface VirtualScrollerConfig {
-+ layout?: Layout | LayoutConstructor | LayoutSpecifier;
- /**
- * An element that receives scroll events for the virtual scroller.
- */
-@@ -30,7 +40,7 @@ interface VirtualScrollerConfig {
- * Extensions of this class must also override VirtualRepeater's DOM
- * manipulation methods.
- */
--export declare class VirtualScroller- {
-+export declare class VirtualScroller {
- private _benchmarkStart;
- /**
- * Whether the layout should receive an updated viewport size on the next
-@@ -70,7 +80,7 @@ export declare class VirtualScroller
- {
- /**
- * Containing element. Set by container.
- */
-- protected _container: Element | ShadowRoot;
-+ protected _container: Container | null;
- /**
- * The parent of all child nodes to be rendered. Set by container.
- */
-@@ -80,11 +90,6 @@ export declare class VirtualScroller
- {
- * restored when container is changed.
- */
- private _containerInlineStyle;
-- /**
-- * Keep track of original container stylesheet, so it can be restored
-- * when container is changed.
-- */
-- private _containerStylesheet;
- /**
- * Size of the container.
- */
-@@ -137,12 +142,10 @@ export declare class VirtualScroller
- {
- * measured, and their dimensions passed to this callback. Use it to layout
- * children as needed.
- */
-- protected _measureCallback: (sizes: {
-- [key: number]: ItemBox;
-- }) => void;
-- protected _measureChildOverride: (element: Element, item: object) => object;
-+ protected _measureCallback: ((sizes: ChildMeasurements) => void) | null;
-+ protected _measureChildOverride: ((element: Element, item: unknown) => ItemBox) | null;
- constructor(config?: VirtualScrollerConfig);
-- set items(items: any);
-+ set items(items: Array
| undefined);
- /**
- * The total number of items, regardless of the range, that can be rendered
- * as child nodes.
-@@ -152,15 +155,15 @@ export declare class VirtualScroller- {
- /**
- * The parent of all child nodes to be rendered.
- */
-- get container(): Element | ShadowRoot;
-- set container(container: Element | ShadowRoot);
-- get layout(): Layout | Type
| LayoutConfig;
-- set layout(layout: Layout | Type | LayoutConfig);
-+ get container(): Container | null;
-+ set container(container: Container | null);
-+ get layout(): Layout | LayoutConstructor | LayoutSpecifier | null;
-+ set layout(layout: Layout | LayoutConstructor | LayoutSpecifier | null);
- startBenchmarking(): void;
- stopBenchmarking(): {
- timeElapsed: number;
- virtualizationTime: number;
-- };
-+ } | null;
- private _measureChildren;
- /**
- * Returns the width, height, and margins of the given child.
-@@ -177,19 +180,15 @@ export declare class VirtualScroller- {
- * Index and position of item to scroll to. The scroller will fix to that point
- * until the user scrolls.
- */
-- set scrollToIndex(newValue: {
-- index: number;
-- position?: string;
-- });
-- protected _schedule(method: any): Promise
;
-+ set scrollToIndex(newValue: ScrollToIndexValue);
-+ protected _schedule(method: Function): Promise;
- _updateDOM(): Promise;
- _updateLayout(): void;
- private _handleScrollEvent;
-- handleEvent(event: any): void;
-+ handleEvent(event: CustomEvent): void;
- private _initResizeObservers;
-- private _applyContainerStyles;
- private _createContainerSizer;
-- get _children(): Array;
-+ get _children(): Array;
- private _updateView;
- /**
- * Styles the _sizer element or the container so that its size reflects the
-diff --git a/lib/uni-virtualizer/lib/VirtualScroller.d.ts.map b/lib/uni-virtualizer/lib/VirtualScroller.d.ts.map
-index fb02bc5f06fb90647f52463f7797a944ec8da8ba..917e1bf68689debf0f5402d5b5409b43302e2955 100644
---- a/lib/uni-virtualizer/lib/VirtualScroller.d.ts.map
-+++ b/lib/uni-virtualizer/lib/VirtualScroller.d.ts.map
-@@ -1 +1 @@
--{"version":3,"file":"VirtualScroller.d.ts","sourceRoot":"","sources":["../../../src/lib/uni-virtualizer/lib/VirtualScroller.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAW,IAAI,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAEnF,eAAO,MAAM,WAAW,eAAwB,CAAC;AAGjD,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,MAAM;QACZ,QAAQ,CAAC,EAAE,GAAG,CAAC;KAClB;CACF;AAsCD,oBAAY,gBAAgB,GAAG;IAC7B,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,YAAY,EAAE,MAAM,CAAC;IACrB,WAAW,EAAE,MAAM,CAAC;CACrB,CAAC;AAGF,UAAU,qBAAqB;IAC7B,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC,GAAG,YAAY,CAAC;IAE9C;;OAEG;IACH,YAAY,CAAC,EAAE,OAAO,GAAG,MAAM,CAAC;IAEhC;;OAEG;IACH,SAAS,EAAE,OAAO,GAAG,UAAU,CAAC;CACjC;AAED;;;;;;;GAOG;AACH,qBAAa,eAAe,CAAC,IAAI,EAAE,KAAK,SAAS,WAAW;IAC1D,OAAO,CAAC,eAAe,CAAQ;IAC/B;;;OAGG;IAGH,OAAO,CAAC,OAAO,CAAgB;IAE/B;;;OAGG;IACH,OAAO,CAAC,aAAa,CAAwB;IAE7C;;;;OAIG;IACH,OAAO,CAAC,MAAM,CAAqB;IAEnC;;;OAGG;IACH,OAAO,CAAC,WAAW,CAA4C;IAE/D;;;OAGG;IACH,OA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AAK,CAAC,KAAK,CAAC,CAW5B;IAED,OAAO,CAAC,WAAW;IAiDnB;;;OAGG;IACH,OAAO,CAAC,cAAc;IAgBtB;;;OAGG;IACH,OAAO,CAAC,iBAAiB;YAqBX,YAAY;IAkB1B,OAAO,CAAC,mBAAmB;IAS3B;;;OAGG;IACH,OAAO,CAAC,YAAY;IAgBpB,OAAO,CAAC,iBAAiB;IAWzB;;;OAGG;IACH,OAAO,CAAC,qBAAqB;YAMf,iBAAiB;IAc/B,OAAO,CAAC,YAAY;IAIpB,OAAO,CAAC,oBAAoB;CAO7B"}
-\ No newline at end of file
-+{"version":3,"file":"VirtualScroller.d.ts","sourceRoot":"","sources":["../../../src/lib/uni-virtualizer/lib/VirtualScroller.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAW,MAAM,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAEnG,eAAO,MAAM,WAAW,eAAwB,CAAC;AAYjD,oBAAY,gBAAgB,GAAG;IAC7B,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,YAAY,EAAE,MAAM,CAAC;IACrB,WAAW,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF,UAAU,8BAA+B,SAAQ,OAAO;IACtD,CAAC,WAAW,CAAC,CAAC,EAAE,eAAe,CAAA;CAChC;AAED,UAAU,iCAAkC,SAAQ,UAAU;IAC5D,CAAC,WAAW,CAAC,CAAC,EAAE,eAAe,CAAA;CAChC;AAED,aAAK,SAAS,GAAG,8BAA8B,GAAG,iCAAiC,CAAC;AACpF,oBAAY,gBAAgB,GAAG,8BAA8B,CAAC;AAM9D,aAAK,iBAAiB,GAAG;IAAC,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;CAAC,CAAC;AAElD,oBAAY,kBAAkB,GAAG;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;CAAC,GAAG,IAAI,CA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IACD,IAAI,YAAY,CAAC,MAAM,EAAE,OAAO,GAAG,MAAM,GAAG,IAAI,EAyB/C;IAED;;;OAGG;IACH,IAAI,aAAa,CAAC,QAAQ,EAAE,kBAAkB,EAG7C;cAEe,SAAS,CAAC,MAAM,EAAE,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC;IASpD,UAAU;IA0BhB,aAAa;IAoBb,OAAO,CAAC,kBAAkB;IAgB1B,WAAW,CAAC,KAAK,EAAE,WAAW;YA4BhB,oBAAoB;IAWlC,OAAO,CAAC,qBAAqB;IAgB7B,IAAI,SAAS,IAAI,KAAK,CAAC,WAAW,CAAC,CAWlC;IAED,OAAO,CAAC,WAAW;IAiDnB;;;OAGG;IACH,OAAO,CAAC,cAAc;IAgBtB;;;OAGG;IACH,OAAO,CAAC,iBAAiB;YAsBX,YAAY;IAkB1B,OAAO,CAAC,mBAAmB;IAS3B;;;OAGG;IACH,OAAO,CAAC,YAAY;IAgBpB,OAAO,CAAC,iBAAiB;IAWzB;;;OAGG;IACH,OAAO,CAAC,qBAAqB;YAMf,iBAAiB;IAc/B,OAAO,CAAC,YAAY;IAIpB,OAAO,CAAC,oBAAoB;CAO7B"}
-\ No newline at end of file
-diff --git a/lib/uni-virtualizer/lib/VirtualScroller.js b/lib/uni-virtualizer/lib/VirtualScroller.js
-index deb122c252aca658b7aeae6edeee9f98de61ee2b..c2cf7431568224fddcd6af51f7352c5a6b116724 100644
---- a/lib/uni-virtualizer/lib/VirtualScroller.js
-+++ b/lib/uni-virtualizer/lib/VirtualScroller.js
-@@ -1,28 +1,5 @@
- import getResizeObserver from './polyfillLoaders/ResizeObserver.js';
- export const scrollerRef = Symbol('scrollerRef');
--let nativeShadowDOM = 'attachShadow' in Element.prototype && (!('ShadyDOM' in window) || !window['ShadyDOM'].inUse);
--const HOST_CLASSNAME = 'uni-virtualizer-host';
--let globalContainerStylesheet = null;
--function containerStyles(hostSel, childSel) {
-- return `
-- ${hostSel} {
-- display: block;
-- position: relative;
-- contain: strict;
-- height: 150px;
-- overflow: auto;
-- }
-- ${childSel} {
-- box-sizing: border-box;
-- }`;
--}
--function attachGlobalContainerStylesheet() {
-- if (!globalContainerStylesheet) {
-- globalContainerStylesheet = document.createElement('style');
-- globalContainerStylesheet.textContent = containerStyles(`.${HOST_CLASSNAME}`, `.${HOST_CLASSNAME} > *`);
-- document.head.appendChild(globalContainerStylesheet);
-- }
--}
- /**
- * Provides virtual scrolling boilerplate.
- *
-@@ -84,11 +61,6 @@ export class VirtualScroller {
- * restored when container is changed.
- */
- this._containerInlineStyle = null;
-- /**
-- * Keep track of original container stylesheet, so it can be restored
-- * when container is changed.
-- */
-- this._containerStylesheet = null;
- /**
- * Size of the container.
- */
-@@ -128,6 +100,14 @@ export class VirtualScroller {
- * Index of the last child in the range.
- */
- this._last = 0;
-+ /**
-+ * Index of the first item intersecting the container element.
-+ */
-+ this._firstVisible = 0;
-+ /**
-+ * Index of the last item intersecting the container element.
-+ */
-+ this._lastVisible = 0;
- this._scheduled = new WeakSet();
- /**
- * Invoked at the end of each render cycle: children in the range are
-@@ -143,7 +123,7 @@ export class VirtualScroller {
- }
- }
- set items(items) {
-- if (items !== this._items) {
-+ if (Array.isArray(items) && items !== this._items) {
- this._itemsChanged = true;
- this._items = items;
- this._schedule(this._updateLayout);
-@@ -218,7 +198,16 @@ export class VirtualScroller {
- this._containerElement = newEl;
- if (newEl) {
- this._containerInlineStyle = newEl.getAttribute('style') || null;
-- this._applyContainerStyles();
-+ // https://github.com/PolymerLabs/uni-virtualizer/issues/104
-+ // Would rather set these CSS properties on the host using Shadow Root
-+ // style scoping (and fall back to a global stylesheet where native
-+ // Shadow DOM is not available), but this Mobile Safari bug is preventing
-+ // that from working: https://bugs.webkit.org/show_bug.cgi?id=226195
-+ const style = newEl.style;
-+ style.display = style.display || 'block';
-+ style.position = style.position || 'relative';
-+ style.overflow = style.overflow || 'auto';
-+ style.contain = style.contain || 'strict';
- if (newEl === this._scrollTarget) {
- this._sizer = this._sizer || this._createContainerSizer();
- this._container.insertBefore(this._sizer, this._container.firstChild);
-@@ -242,11 +231,12 @@ export class VirtualScroller {
- if (this._layout === layout) {
- return;
- }
-- let _layout, _config;
-+ let _layout = null;
-+ let _config = {};
- if (typeof layout === 'object') {
- if (layout.type !== undefined) {
- _layout = layout.type;
-- delete layout.type;
-+ // delete (layout as LayoutSpecifier).type;
- }
- _config = layout;
- }
-@@ -325,7 +315,7 @@ export class VirtualScroller {
- const child = children[i];
- const idx = this._first + i;
- if (this._itemsChanged || this._toBeMeasured.has(child)) {
-- mm[idx] = fn.call(this, child, this._items[idx]);
-+ mm[idx] = fn.call(this, child, this._items[idx] /*as unknown as object*/);
- }
- }
- this._childMeasurements = mm;
-@@ -438,7 +428,9 @@ export class VirtualScroller {
- try {
- window.performance.measure('uv-virtualizing', 'uv-start', 'uv-end');
- }
-- catch (e) { }
-+ catch (e) {
-+ console.warn('Error measuring performance data: ', e);
-+ }
- window.performance.mark('uv-start');
- }
- this._schedule(this._updateLayout);
-@@ -479,26 +471,6 @@ export class VirtualScroller {
- this._mutationObserver = new MutationObserver(this._observeMutations.bind(this));
- }
- }
-- _applyContainerStyles() {
-- if (nativeShadowDOM) {
-- if (this._containerStylesheet === null) {
-- const sheet = (this._containerStylesheet = document.createElement('style'));
-- sheet.textContent = containerStyles(':host', '::slotted(*)');
-- }
-- const root = this._containerElement.shadowRoot || this._containerElement.attachShadow({ mode: 'open' });
-- const slot = root.querySelector('slot:not([name])');
-- root.appendChild(this._containerStylesheet);
-- if (!slot) {
-- root.appendChild(document.createElement('slot'));
-- }
-- }
-- else {
-- attachGlobalContainerStylesheet();
-- if (this._containerElement) {
-- this._containerElement.classList.add(HOST_CLASSNAME);
-- }
-- }
-- }
- _createContainerSizer() {
- const sizer = document.createElement('div');
- // When the scrollHeight is large, the height of this element might be
-@@ -600,6 +572,7 @@ export class VirtualScroller {
- if (child) {
- const { top, left, width, height } = pos[key];
- child.style.position = 'absolute';
-+ child.style.boxSizing = 'border-box';
- child.style.transform = `translate(${left}px, ${top}px)`;
- if (width !== undefined) {
- child.style.width = width + 'px';
-@@ -683,7 +656,7 @@ export class VirtualScroller {
- // this.requestRemeasure();
- }
- _childrenSizeChanged(changes) {
-- for (let change of changes) {
-+ for (const change of changes) {
- this._toBeMeasured.set(change.target, change.contentRect);
- }
- this._measureChildren();
-@@ -703,3 +676,4 @@ function getMarginValue(value) {
- const float = value ? parseFloat(value) : NaN;
- return Number.isNaN(float) ? 0 : float;
- }
-+//# sourceMappingURL=VirtualScroller.js.map
-\ No newline at end of file
-diff --git a/lib/uni-virtualizer/lib/VirtualScroller.js.map b/lib/uni-virtualizer/lib/VirtualScroller.js.map
-new file mode 100644
-index 0000000000000000000000000000000000000000..693e4099af0f40c1ce2589fec061afe13ae23bc2
---- /dev/null
-+++ b/lib/uni-virtualizer/lib/VirtualScroller.js.map
-@@ -0,0 +1 @@
-+{"version":3,"file":"VirtualScroller.js","sourceRoot":"","sources":["../../../src/lib/uni-virtualizer/lib/VirtualScroller.ts"],"names":[],"mappings":"AAAA,OAAO,iBAAiB,MAAM,qCAAqC,CAAC;AAGpE,MAAM,CAAC,MAAM,WAAW,GAAG,MAAM,CAAC,aAAa,CAAC,CAAC;AAoDjD;;;;;;;GAOG;AACH,MAAM,OAAO,eAAe;IA0I1B,YAAY,MAA8B;QAzIlC,oBAAe,GAAkB,IAAI,CAAC;QAC9C;;;WAGG;QACH,6CAA6C;QAErC,YAAO,GAAkB,IAAI,CAAC;QAEtC;;;WAGG;QACK,kBAAa,GAAmB,IAAI,CAAC;QAE7C;;;;WAIG;QACK,WAAM,GAAuB,IAAI,CAAC;QAE1C;;;WAGG;QACK,gBAAW,GAAsB,IAAI,CAAC;QAE9C;;;WAGG;QACK,eAAU,GAAuC,IAAI,CAAC;QAE9D;;WAEG;QACK,iBAAY,GAA8C,IAAI,CAAC;QAEvE,2BAA2B;QACnB,uBAAkB,GAA6B,IAAI,CAAC;QAEpD,kBAAa,GAA8B,IAAI,GAAG,EA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CAAC,MAAM,CAAC,MAAqB,EAAE,MAAM,CAAC,WAAW,CAAC,CAAC;SAC1E;QACD,IAAI,CAAC,gBAAgB,EAAE,CAAC;QACxB,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;IACrC,CAAC;CACF;AAED,SAAS,UAAU,CAAC,EAAW;IAC7B,MAAM,KAAK,GAAG,MAAM,CAAC,gBAAgB,CAAC,EAAE,CAAC,CAAC;IAC1C,OAAO;QACL,SAAS,EAAE,cAAc,CAAC,KAAK,CAAC,SAAS,CAAC;QAC1C,WAAW,EAAE,cAAc,CAAC,KAAK,CAAC,WAAW,CAAC;QAC9C,YAAY,EAAE,cAAc,CAAC,KAAK,CAAC,YAAY,CAAC;QAChD,UAAU,EAAE,cAAc,CAAC,KAAK,CAAC,UAAU,CAAC;KAC7C,CAAC;AACJ,CAAC;AAED,SAAS,cAAc,CAAC,KAAa;IACnC,MAAM,KAAK,GAAG,KAAK,CAAC,CAAC,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC;IAC9C,OAAO,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC;AACzC,CAAC","sourcesContent":["import getResizeObserver from './polyfillLoaders/ResizeObserver.js';\nimport { ItemBox, Margins, Layout, LayoutConstructor, LayoutSpecifier } from './layouts/Layout.js';\n\nexport const scrollerRef = Symbol('scrollerRef');\n\ninterface Range {\n first: number;\n last: number;\n num: number;\n remeasure: boolean;\n stable: boolean;\n firstVisible: number;\n lastVisible: number;\n}\n\nexport type RangeChangeEvent = {\n first: number;\n last: number;\n firstVisible: number;\n lastVisible: number;\n};\n\ninterface ElementWithOptionalScrollerRef extends Element {\n [scrollerRef]?: VirtualScroller\n}\n\ninterface ShadowRootWithOptionalScrollerRef extends ShadowRoot {\n [scrollerRef]?: VirtualScroller\n}\n\ntype Container = ElementWithOptionalScrollerRef | ShadowRootWithOptionalScrollerRef;\nexport type ContainerElement = ElementWithOptionalScrollerRef;\n\ntype VerticalScrollSize = {height: number};\ntype HorizontalScrollSize = {width: number};\ntype ScrollSize = VerticalScrollSize | HorizontalScrollSize;\n\ntype ChildMeasurements = {[key: number]: ItemBox};\n\nexport type ScrollToIndexValue = {index: number, position?: string} | null;\n\nexport interface VirtualScrollerConfig {\n layout?: Layout | LayoutConstructor | LayoutSpecifier;\n\n /**\n * An element that receives scroll events for the virtual scroller.\n */\n scrollTarget?: Element | Window;\n\n /**\n * The parent of all child nodes to be rendered.\n */\n container: Element | ShadowRoot;\n}\n\n/**\n * Provides virtual scrolling boilerplate.\n *\n * Extensions of this class must set container, layout, and scrollTarget.\n *\n * Extensions of this class must also override VirtualRepeater's DOM\n * manipulation methods.\n */\nexport class VirtualScroller {\n private _benchmarkStart: number | null = null;\n /**\n * Whether the layout should receive an updated viewport size on the next\n * render.\n */\n // private _needsUpdateView: boolean = false;\n\n private _layout: Layout | null = null;\n\n /**\n * The element that generates scroll events and defines the container\n * viewport. Set by scrollTarget.\n */\n private _scrollTarget: Element | null = null;\n\n /**\n * A sentinel element that sizes the container when it is a scrolling\n * element. This ensures the scroll bar accurately reflects the total\n * size of the list.\n */\n private _sizer: HTMLElement | null = null;\n\n /**\n * Layout provides these values, we set them on _render().\n * TODO @straversi: Can we find an XOR type, usable for the key here?\n */\n private _scrollSize: ScrollSize | null = null;\n\n /**\n * Difference between scroll target's current and required scroll offsets.\n * Provided by layout.\n */\n private _scrollErr: {left: number, top: number} | null = null;\n\n /**\n * A list of the positions (top, left) of the children in the current range.\n */\n private _childrenPos: Array<{top: number, left: number}> | null = null;\n\n // TODO: (graynorton): type\n private _childMeasurements: ChildMeasurements | null = null;\n\n private _toBeMeasured: Map = new Map();\n\n private _rangeChanged = true;\n\n private _itemsChanged = true;\n\n private _visibilityChanged = true;\n\n /**\n * Containing element. Set by container.\n */\n protected _container: Container | null = null;\n\n /**\n * The parent of all child nodes to be rendered. Set by container.\n */\n private _containerElement: ContainerElement | null = null;\n\n /**\n * Keep track of original inline style of the container, so it can be\n * restored when container is changed.\n */\n private _containerInlineStyle: string | null = null;\n\n /**\n * Size of the container.\n */\n private _containerSize: {width: number, height: number} | null = null;\n\n /**\n * Resize observer attached to container.\n */\n private _containerRO: ResizeObserver | null = null;\n\n /**\n * Resize observer attached to children.\n */\n private _childrenRO: ResizeObserver | null = null;\n\n private _mutationObserver: MutationObserver | null = null;\n private _mutationPromise: Promise | null = null;\n private _mutationPromiseResolver: Function | null = null;\n private _mutationsObserved = false;\n\n // TODO (graynorton): Rethink, per longer comment below\n\n private _loadListener = this._childLoaded.bind(this);\n\n /**\n * Index and position of item to scroll to.\n */\n private _scrollToIndex: ScrollToIndexValue = null;\n\n /**\n * Items to render. Set by items.\n */\n private _items: Array = [];\n\n /**\n * Total number of items to render. Set by totalItems.\n */\n private _totalItems: number | null = null;\n\n /**\n * Index of the first child in the range, not necessarily the first visible child.\n * TODO @straversi: Consider renaming these.\n */\n protected _first = 0;\n\n /**\n * Index of the last child in the range.\n */\n protected _last = 0;\n\n /**\n * Index of the first item intersecting the container element.\n */\n private _firstVisible = 0;\n\n /**\n * Index of the last item intersecting the container element.\n */\n private _lastVisible = 0;\n\n protected _scheduled = new WeakSet();\n\n /**\n * Invoked at the end of each render cycle: children in the range are\n * measured, and their dimensions passed to this callback. Use it to layout\n * children as needed.\n */\n protected _measureCallback: ((sizes: ChildMeasurements) => void) | null = null;\n\n protected _measureChildOverride: ((element: Element, item: unknown) => ItemBox) | null = null;\n\n constructor(config?: VirtualScrollerConfig) {\n this._first = -1;\n this._last = -1;\n\n if (config) {\n Object.assign(this, config);\n }\n }\n\n set items(items: Array | undefined) {\n if (Array.isArray(items) && items !== this._items) {\n this._itemsChanged = true;\n this._items = items;\n this._schedule(this._updateLayout);\n }\n }\n\n /**\n * The total number of items, regardless of the range, that can be rendered\n * as child nodes.\n */\n get totalItems(): number {\n return (this._totalItems === null ? this._items.length : this._totalItems);\n }\n\n set totalItems(num: number) {\n if (typeof num !== 'number' && num !== null) {\n throw new Error('New value must be a number.');\n }\n\n // TODO(valdrin) should we check if it is a finite number?\n // Technically, Infinity would break Layout, not VirtualRepeater.\n if (num !== this._totalItems) {\n this._totalItems = num;\n this._schedule(this._updateLayout);\n }\n }\n\n /**\n * The parent of all child nodes to be rendered.\n */\n get container(): Container | null {\n return this._container;\n }\n\n set container(container: Container | null) {\n if (container === this._container) {\n return;\n }\n\n if (this._container) {\n // Remove children from old container.\n // TODO (graynorton): Decide whether we'd rather fire an event to clear\n // the range and let the renderer take care of removing the DOM children\n this._children.forEach(child => child.parentNode!.removeChild(child));\n }\n\n this._container = container;\n\n this._schedule(this._updateLayout);\n\n this._initResizeObservers().then(() => {\n const oldEl = this._containerElement as HTMLElement;\n // Consider document fragments as shadowRoots.\n const newEl =\n (container && container.nodeType === Node.DOCUMENT_FRAGMENT_NODE) ?\n (container as ShadowRoot).host as HTMLElement :\n container as HTMLElement;\n if (oldEl === newEl) {\n return;\n }\n \n this._containerRO!.disconnect();\n this._containerSize = null;\n \n if (oldEl) {\n if (this._containerInlineStyle) {\n oldEl.setAttribute('style', this._containerInlineStyle!);\n } else {\n oldEl.removeAttribute('style');\n }\n this._containerInlineStyle = null;\n if (oldEl === this._scrollTarget) {\n oldEl.removeEventListener('scroll', this, {passive: true} as EventListenerOptions);\n this._sizer && this._sizer.remove();\n }\n oldEl.removeEventListener('load', this._loadListener, true);\n\n this._mutationObserver!.disconnect();\n } else {\n // First time container was setup, add listeners only now.\n addEventListener('scroll', this, {passive: true});\n }\n \n this._containerElement = newEl;\n \n if (newEl) {\n this._containerInlineStyle = newEl.getAttribute('style') || null;\n // https://github.com/PolymerLabs/uni-virtualizer/issues/104\n // Would rather set these CSS properties on the host using Shadow Root\n // style scoping (and fall back to a global stylesheet where native\n // Shadow DOM is not available), but this Mobile Safari bug is preventing\n // that from working: https://bugs.webkit.org/show_bug.cgi?id=226195\n const style = newEl.style as CSSStyleDeclaration & { contain: string };\n style.display = style.display || 'block';\n style.position = style.position || 'relative';\n style.overflow = style.overflow || 'auto';\n style.contain = style.contain || 'strict';\n if (newEl === this._scrollTarget) {\n this._sizer = this._sizer || this._createContainerSizer();\n this._container!.insertBefore(this._sizer, this._container!.firstChild);\n }\n this._schedule(this._updateLayout);\n this._containerRO!.observe(newEl);\n this._mutationObserver!.observe(newEl, { childList: true });\n this._mutationPromise = new Promise(resolve => this._mutationPromiseResolver = resolve);\n \n if (this._layout && this._layout.listenForChildLoadEvents) {\n newEl.addEventListener('load', this._loadListener, true);\n }\n }\n }); \n }\n\n // This will always actually return a layout instance,\n // but TypeScript wants the getter and setter types to be the same\n get layout(): Layout | LayoutConstructor | LayoutSpecifier | null {\n return this._layout;\n }\n\n set layout(layout: Layout | LayoutConstructor | LayoutSpecifier | null) {\n if (this._layout === layout) {\n return;\n }\n\n let _layout: LayoutConstructor | Layout | null = null;\n let _config: object = {};\n\n if (typeof layout === 'object') {\n if ((layout as LayoutSpecifier).type !== undefined) {\n _layout = (layout as LayoutSpecifier).type;\n // delete (layout as LayoutSpecifier).type;\n }\n _config = layout as object;\n }\n else {\n _layout = layout;\n }\n\n if (typeof _layout === 'function') {\n if (this._layout instanceof _layout) {\n if (_config) {\n this._layout!.config = _config;\n }\n return;\n }\n else {\n _layout = new _layout(_config);\n }\n }\n\n if (this._layout) {\n this._measureCallback = null;\n this._measureChildOverride = null;\n this._layout.removeEventListener('scrollsizechange', this);\n this._layout.removeEventListener('scrollerrorchange', this);\n this._layout.removeEventListener('itempositionchange', this);\n this._layout.removeEventListener('rangechange', this);\n delete this.container![scrollerRef];\n this.container!.removeEventListener('load', this._loadListener, true);\n // Reset container size so layout can get correct viewport size.\n if (this._containerElement) {\n this._sizeContainer(undefined);\n }\n }\n\n this._layout = _layout as Layout | null;\n\n if (this._layout) {\n if (this._layout.measureChildren && typeof this._layout.updateItemSizes === 'function') {\n if (typeof this._layout.measureChildren === 'function') {\n this._measureChildOverride = this._layout.measureChildren;\n }\n this._measureCallback = this._layout.updateItemSizes.bind(this._layout);\n }\n this._layout.addEventListener('scrollsizechange', this);\n this._layout.addEventListener('scrollerrorchange', this);\n this._layout.addEventListener('itempositionchange', this);\n this._layout.addEventListener('rangechange', this);\n this._container![scrollerRef] = this;\n if (this._layout.listenForChildLoadEvents) {\n this._container!.addEventListener('load', this._loadListener, true);\n }\n this._schedule(this._updateLayout);\n }\n }\n\n // TODO (graynorton): Rework benchmarking so that it has no API and\n // instead is always on except in production builds\n startBenchmarking() {\n if (this._benchmarkStart === null) {\n this._benchmarkStart = window.performance.now();\n }\n }\n\n stopBenchmarking() {\n if (this._benchmarkStart !== null) {\n const now = window.performance.now();\n const timeElapsed = now - this._benchmarkStart;\n const entries = performance.getEntriesByName('uv-virtualizing', 'measure');\n const virtualizationTime = entries\n .filter(e => e.startTime >= this._benchmarkStart! && e.startTime < now)\n .reduce((t, m) => t + m.duration, 0);\n this._benchmarkStart = null;\n return { timeElapsed, virtualizationTime };\n }\n return null;\n }\n\n private _measureChildren(): void {\n const mm: ChildMeasurements = {};\n const children = this._children;\n const fn = this._measureChildOverride || this._measureChild;\n for (let i = 0; i < children.length; i++) {\n const child = children[i];\n const idx = this._first + i;\n if (this._itemsChanged || this._toBeMeasured.has(child)) {\n mm[idx] = fn.call(this, child, this._items[idx] /*as unknown as object*/);\n }\n }\n this._childMeasurements = mm;\n this._schedule(this._updateLayout);\n this._toBeMeasured.clear();\n }\n\n /**\n * Returns the width, height, and margins of the given child.\n */\n _measureChild(element: Element): ItemBox {\n // offsetWidth doesn't take transforms in consideration, so we use\n // getBoundingClientRect which does.\n const {width, height} = element.getBoundingClientRect();\n return Object.assign({width, height}, getMargins(element));\n }\n\n\n /**\n * The element that generates scroll events and defines the container\n * viewport. The value `null` (default) corresponds to `window` as scroll\n * target.\n */\n get scrollTarget(): Element | Window | null {\n return this._scrollTarget;\n }\n set scrollTarget(target: Element | Window | null) {\n // Consider window as null.\n if (target === window) {\n target = null;\n }\n if (this._scrollTarget === target) {\n return;\n }\n this._sizeContainer(undefined);\n if (this._scrollTarget) {\n this._scrollTarget.removeEventListener('scroll', this, {passive: true} as EventListenerOptions);\n if (this._sizer && this._scrollTarget === this._containerElement) {\n this._sizer.remove();\n }\n }\n\n this._scrollTarget = target as (Element | null);\n\n if (target) {\n target.addEventListener('scroll', this, {passive: true});\n if (target === this._containerElement) {\n this._sizer = this._sizer || this._createContainerSizer();\n this._container!.insertBefore(this._sizer, this._container!.firstChild);\n }\n }\n }\n\n /**\n * Index and position of item to scroll to. The scroller will fix to that point\n * until the user scrolls.\n */\n set scrollToIndex(newValue: ScrollToIndexValue) {\n this._scrollToIndex = newValue;\n this._schedule(this._updateLayout);\n }\n\n protected async _schedule(method: Function): Promise {\n if (!this._scheduled.has(method)) {\n this._scheduled.add(method);\n await Promise.resolve();\n this._scheduled.delete(method);\n method.call(this);\n }\n }\n\n async _updateDOM() {\n const {_rangeChanged, _itemsChanged} = this;\n if (this._visibilityChanged) {\n this._notifyVisibility();\n this._visibilityChanged = false;\n }\n if (_rangeChanged || _itemsChanged) {\n this._notifyRange();\n this._rangeChanged = false;\n this._itemsChanged = false;\n await this._mutationPromise;\n }\n if (this._layout!.measureChildren) {\n this._children.forEach((child) => this._childrenRO!.observe(child));\n }\n this._positionChildren(this._childrenPos!);\n this._sizeContainer(this._scrollSize);\n if (this._scrollErr) {\n this._correctScrollError(this._scrollErr);\n this._scrollErr = null;\n }\n if (this._benchmarkStart && 'mark' in window.performance) {\n window.performance.mark('uv-end');\n }\n }\n\n _updateLayout() {\n this._layout!.totalItems = this._totalItems!;\n if (this._scrollToIndex !== null) {\n this._layout!.scrollToIndex(this._scrollToIndex.index, this._scrollToIndex!.position!);\n this._scrollToIndex = null;\n }\n this._updateView();\n if (this._childMeasurements !== null) {\n // If the layout has been changed, we may have measurements but no callback\n if (this._measureCallback) {\n this._measureCallback(this._childMeasurements);\n }\n this._childMeasurements = null;\n }\n this._layout!.reflowIfNeeded(this._itemsChanged);\n if (this._benchmarkStart && 'mark' in window.performance) {\n window.performance.mark('uv-end');\n }\n }\n\n private _handleScrollEvent() {\n if (this._benchmarkStart && 'mark' in window.performance) {\n try {\n window.performance.measure(\n 'uv-virtualizing',\n 'uv-start',\n 'uv-end'\n );\n } catch(e) {\n console.warn('Error measuring performance data: ', e);\n }\n window.performance.mark('uv-start');\n }\n this._schedule(this._updateLayout);\n }\n\n handleEvent(event: CustomEvent) {\n switch (event.type) {\n case 'scroll':\n if (!this._scrollTarget || event.target === this._scrollTarget) {\n this._handleScrollEvent();\n }\n break;\n case 'scrollsizechange':\n this._scrollSize = event.detail;\n this._schedule(this._updateDOM);\n break;\n case 'scrollerrorchange':\n this._scrollErr = event.detail;\n this._schedule(this._updateDOM);\n break;\n case 'itempositionchange':\n this._childrenPos = event.detail;\n this._schedule(this._updateDOM);\n break;\n case 'rangechange':\n this._adjustRange(event.detail);\n this._schedule(this._updateDOM);\n break;\n default:\n console.warn('event not handled', event);\n }\n }\n\n private async _initResizeObservers() {\n if (this._containerRO === null) {\n const ResizeObserver = await getResizeObserver();\n this._containerRO = new ResizeObserver(\n (entries: ResizeObserverEntry[]) => this._containerSizeChanged(entries[0].contentRect));\n this._childrenRO =\n new ResizeObserver(this._childrenSizeChanged.bind(this));\n this._mutationObserver = new MutationObserver(this._observeMutations.bind(this));\n }\n }\n\n private _createContainerSizer(): HTMLDivElement {\n const sizer = document.createElement('div');\n // When the scrollHeight is large, the height of this element might be\n // ignored. Setting content and font-size ensures the element has a size.\n Object.assign(sizer.style, {\n position: 'absolute',\n margin: '-2px 0 0 0',\n padding: 0,\n visibility: 'hidden',\n fontSize: '2px',\n });\n sizer.innerHTML = ' ';\n sizer.id = 'uni-virtualizer-spacer';\n return sizer;\n }\n\n get _children(): Array {\n const arr = [];\n let next = this.container!.firstElementChild as HTMLElement;\n while (next) {\n // Skip our spacer. TODO (graynorton): Feels a bit hacky. Anything better?\n if (next.id !== 'uni-virtualizer-spacer') {\n arr.push(next);\n }\n next = next.nextElementSibling as HTMLElement;\n }\n return arr;\n }\n\n private _updateView() {\n if (!this.container || !this._containerElement || !this._layout) {\n return;\n }\n let width, height, top, left;\n if (this._scrollTarget === this._containerElement && this._containerSize !== null) {\n width = this._containerSize.width;\n height = this._containerSize.height;\n left = this._containerElement.scrollLeft;\n top = this._containerElement.scrollTop;\n } else {\n const containerBounds = this._containerElement.getBoundingClientRect();\n const scrollBounds = this._scrollTarget ?\n this._scrollTarget.getBoundingClientRect() :\n {\n top: containerBounds.top + window.pageYOffset,\n left: containerBounds.left + window.pageXOffset,\n width: innerWidth,\n height: innerHeight\n };\n const scrollerWidth = scrollBounds.width;\n const scrollerHeight = scrollBounds.height;\n const xMin = Math.max(\n 0, Math.min(scrollerWidth, containerBounds.left - scrollBounds.left));\n const yMin = Math.max(\n 0, Math.min(scrollerHeight, containerBounds.top - scrollBounds.top));\n // TODO (graynorton): Direction is intended to be a layout-level concept, not a scroller-level concept,\n // so this feels like a factoring problem\n const xMax = this._layout.direction === 'vertical' ?\n Math.max(\n 0,\n Math.min(\n scrollerWidth, containerBounds.right - scrollBounds.left)) :\n scrollerWidth;\n const yMax = this._layout.direction === 'vertical' ?\n scrollerHeight :\n Math.max(\n 0,\n Math.min(\n scrollerHeight, containerBounds.bottom - scrollBounds.top));\n width = xMax - xMin;\n height = yMax - yMin;\n left = Math.max(0, -(containerBounds.left - scrollBounds.left));\n top = Math.max(0, -(containerBounds.top - scrollBounds.top));\n }\n this._layout.viewportSize = {width, height};\n this._layout.viewportScroll = {top, left};\n }\n\n /**\n * Styles the _sizer element or the container so that its size reflects the\n * total size of all items.\n */\n private _sizeContainer(size?: ScrollSize | null) {\n if (this._scrollTarget === this._containerElement) {\n const left = size && (size as HorizontalScrollSize).width ? (size as HorizontalScrollSize).width - 1 : 0;\n const top = size && (size as VerticalScrollSize).height ? (size as VerticalScrollSize).height - 1 : 0;\n if (this._sizer) {\n this._sizer.style.transform = `translate(${left}px, ${top}px)`;\n }\n } else {\n if (this._containerElement) {\n const style = (this._containerElement as HTMLElement).style;\n (style.minWidth as string | null) = size && (size as HorizontalScrollSize).width ? (size as HorizontalScrollSize).width + 'px' : null;\n (style.minHeight as string | null) = size && (size as VerticalScrollSize).height ? (size as VerticalScrollSize).height + 'px' : null; \n }\n }\n }\n\n /**\n * Sets the top and left transform style of the children from the values in\n * pos.\n */\n private _positionChildren(pos: Array<{top: number, left: number, width?: number, height?: number}>) {\n if (pos) {\n const children = this._children;\n Object.keys(pos).forEach((key) => {\n const idx = (key as unknown as number) - this._first;\n const child = children[idx];\n if (child) {\n const {top, left, width, height} = pos[key as unknown as number];\n child.style.position = 'absolute';\n child.style.boxSizing = 'border-box';\n child.style.transform = `translate(${left}px, ${top}px)`;\n if (width !== undefined) {\n child.style.width = width + 'px';\n }\n if (height !== undefined) {\n child.style.height = height + 'px';\n }\n }\n }); \n }\n }\n\n private async _adjustRange(range: Range) {\n const {_first, _last, _firstVisible, _lastVisible} = this;\n this._first = range.first;\n this._last = range.last;\n this._firstVisible = range.firstVisible;\n this._lastVisible = range.lastVisible;\n this._rangeChanged = (\n this._rangeChanged ||\n this._first !== _first ||\n this._last !== _last\n );\n this._visibilityChanged = (\n this._visibilityChanged ||\n this._firstVisible !== _firstVisible ||\n this._lastVisible !== _lastVisible\n );\n }\n\n private _correctScrollError(err: {top: number, left: number}) {\n if (this._scrollTarget) {\n this._scrollTarget.scrollTop -= err.top;\n this._scrollTarget.scrollLeft -= err.left;\n } else {\n window.scroll(window.pageXOffset - err.left, window.pageYOffset - err.top);\n }\n }\n\n /**\n * Emits a rangechange event with the current first, last, firstVisible, and\n * lastVisible.\n */\n private _notifyRange() {\n // TODO (graynorton): Including visibility here for backward compat, but \n // may decide to remove at some point. The rationale for separating is that\n // range change events are mainly intended for \"internal\" consumption by the\n // renderer, whereas visibility change events are mainly intended for \"external\"\n // consumption by application code.\n this._container!.dispatchEvent(\n new CustomEvent('rangeChanged', {detail:{\n first: this._first,\n last: this._last,\n firstVisible: this._firstVisible,\n lastVisible: this._lastVisible,\n }})\n );\n }\n\n private _notifyVisibility() {\n this._container!.dispatchEvent(\n new CustomEvent('visibilityChanged', {detail:{\n first: this._first,\n last: this._last,\n firstVisible: this._firstVisible,\n lastVisible: this._lastVisible,\n }})\n );\n }\n\n /**\n * Render and update the view at the next opportunity with the given\n * container size.\n */\n private _containerSizeChanged(size: {width: number, height: number}) {\n const {width, height} = size;\n this._containerSize = {width, height};\n this._schedule(this._updateLayout);\n }\n\n private async _observeMutations() {\n if (!this._mutationsObserved) {\n this._mutationsObserved = true;\n this._mutationPromiseResolver!();\n this._mutationPromise = new Promise(resolve => this._mutationPromiseResolver = resolve);\n this._mutationsObserved = false;\n }\n }\n\n // TODO (graynorton): Rethink how this works. Probably child loading is too specific\n // to have dedicated support for; might want some more generic lifecycle hooks for\n // layouts to use. Possibly handle measurement this way, too, or maybe that remains\n // a first-class feature?\n\n private _childLoaded() {\n // this.requestRemeasure();\n }\n\n private _childrenSizeChanged(changes: ResizeObserverEntry[]) {\n for (const change of changes) {\n this._toBeMeasured.set(change.target as HTMLElement, change.contentRect);\n }\n this._measureChildren();\n this._schedule(this._updateLayout);\n }\n}\n\nfunction getMargins(el: Element): Margins {\n const style = window.getComputedStyle(el);\n return {\n marginTop: getMarginValue(style.marginTop),\n marginRight: getMarginValue(style.marginRight),\n marginBottom: getMarginValue(style.marginBottom),\n marginLeft: getMarginValue(style.marginLeft),\n };\n}\n\nfunction getMarginValue(value: string): number {\n const float = value ? parseFloat(value) : NaN;\n return Number.isNaN(float) ? 0 : float;\n}"]}
-\ No newline at end of file
-diff --git a/lib/uni-virtualizer/lib/layouts/Layout.d.ts b/lib/uni-virtualizer/lib/layouts/Layout.d.ts
-index 42d282ba7ee5d75b7ba85afcf985c8ea47112ea4..425e2d89301a051c6eecb4e00b4dbdeec7032b2b 100644
---- a/lib/uni-virtualizer/lib/layouts/Layout.d.ts
-+++ b/lib/uni-virtualizer/lib/layouts/Layout.d.ts
-@@ -8,7 +8,7 @@ export declare type Margins = {
- marginBottom: number;
- marginLeft: number;
- };
--export declare type ItemBox = Size | Size & Margins;
-+export declare type ItemBox = Size | (Size & Margins);
- export declare type position = 'left' | 'top';
- export declare type Positions = {
- left: number;
-@@ -16,29 +16,28 @@ export declare type Positions = {
- width?: number;
- height?: number;
- };
--export interface Type extends Function {
-- new (...args: any[]): T;
--}
--export interface LayoutConfig {
-- type?: Type;
-+export declare type LayoutConstructor = new (config?: object) => Layout;
-+export interface LayoutSpecifier {
-+ type: LayoutConstructor;
- }
-+export declare type LayoutSpecifierFactory = (config?: object) => LayoutSpecifier;
- export declare type ScrollDirection = 'vertical' | 'horizontal';
- /**
- * Interface for layouts consumed by VirtualScroller or VirtualRepeater.
- */
- export interface Layout {
-- config: LayoutConfig;
-+ config?: object;
- totalItems: number;
- direction: ScrollDirection;
- viewportSize: Size;
- viewportScroll: Positions;
-- readonly measureChildren?: boolean | ((e: Element, i: object) => object);
-+ readonly measureChildren?: boolean | ((e: Element, i: unknown) => ItemBox);
- readonly listenForChildLoadEvents?: boolean;
- updateItemSizes?: (sizes: {
- [key: number]: ItemBox;
- }) => void;
-- addEventListener: any;
-- removeEventListener: any;
-+ addEventListener: Function;
-+ removeEventListener: Function;
- scrollToIndex: (index: number, position: string) => void;
- /**
- * Called by a VirtualRepeater or VirtualScroller when an update that
-diff --git a/lib/uni-virtualizer/lib/layouts/Layout.d.ts.map b/lib/uni-virtualizer/lib/layouts/Layout.d.ts.map
-index 470e5b26be4db353e4a9bafb815d41bcf208832f..13497a406bb9144e3f8b5c729bca351916c831bb 100644
---- a/lib/uni-virtualizer/lib/layouts/Layout.d.ts.map
-+++ b/lib/uni-virtualizer/lib/layouts/Layout.d.ts.map
-@@ -1 +1 @@
--{"version":3,"file":"Layout.d.ts","sourceRoot":"","sources":["../../../../src/lib/uni-virtualizer/lib/layouts/Layout.ts"],"names":[],"mappings":"AAAA,oBAAY,SAAS,GAAG,QAAQ,GAAG,OAAO,CAAC;AAC3C,oBAAY,I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EG;AACF,MAAM,WAAW,MAAM;IACtB,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB,UAAU,EAAE,MAAM,CAAC;IAEnB,SAAS,EAAE,eAAe,CAAC;IAE3B,YAAY,EAAE,IAAI,CAAC;IAEnB,cAAc,EAAE,SAAS,CAAC;IAE1B,QAAQ,CAAC,eAAe,CAAC,EAAE,OAAO,GAAG,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,OAAO,KAAK,OAAO,CAAC,CAAC;IAE3E,QAAQ,CAAC,wBAAwB,CAAC,EAAE,OAAO,CAAC;IAE5C,eAAe,CAAC,EAAE,CAAC,KAAK,EAAE;QACxB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;KACvB,KAAK,IAAI,CAAC;IAEX,gBAAgB,EAAE,QAAQ,CAAC;IAE3B,mBAAmB,EAAE,QAAQ,CAAC;IAE9B,aAAa,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAC;IAEzD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA6CG;IACH,cAAc,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,CAAC;CAC1C"}
-\ No newline at end of file
-diff --git a/lib/uni-virtualizer/lib/layouts/Layout.js b/lib/uni-virtualizer/lib/layouts/Layout.js
-index cb0ff5c3b541f646105198ee23ac0fc3d805023e..215b2c9498b60901b4bf2dd7c4a18803a4e4562c 100644
---- a/lib/uni-virtualizer/lib/layouts/Layout.js
-+++ b/lib/uni-virtualizer/lib/layouts/Layout.js
-@@ -1 +1,2 @@
- export {};
-+//# sourceMappingURL=Layout.js.map
-\ No newline at end of file
-diff --git a/lib/uni-virtualizer/lib/layouts/Layout.js.map b/lib/uni-virtualizer/lib/layouts/Layout.js.map
-new file mode 100644
-index 0000000000000000000000000000000000000000..a95ae35dbf53896f9eba8ccbeeea0b06f9c8d3c0
---- /dev/null
-+++ b/lib/uni-virtualizer/lib/layouts/Layout.js.map
-@@ -0,0 +1 @@
-+{"version":3,"file":"Layout.js","sourceRoot":"","sources":["../../../../src/lib/uni-virtualizer/lib/layouts/Layout.ts"],"names":[],"mappings":"","sourcesContent":["export type dimension = 'height' | 'width';\nexport type Size = {\n [key in dimension]: number\n};\n\nexport type Margins = {\n marginTop: number,\n marginRight: number,\n marginBottom: number,\n marginLeft: number\n};\n\nexport type ItemBox = Size | (Size & Margins);\n\nexport type position = 'left' | 'top';\nexport type Positions = {\n left: number,\n top: number,\n width?: number,\n height?: number\n};\n\n\nexport type LayoutConstructor = new(config?: object) => Layout;\n\nexport interface LayoutSpecifier {\n type: LayoutConstructor\n}\n\nexport type LayoutSpecifierFactory = (config?: object) => LayoutSpecifier;\n\n\nexport type ScrollDirection = 'vertical' | 'horizontal';\n\n/**\n * Interface for layouts consumed by VirtualScroller or VirtualRepeater.\n */\n export interface Layout {\n config?: object;\n \n totalItems: number;\n\n direction: ScrollDirection;\n\n viewportSize: Size;\n\n viewportScroll: Positions;\n\n readonly measureChildren?: boolean | ((e: Element, i: unknown) => ItemBox);\n\n readonly listenForChildLoadEvents?: boolean;\n\n updateItemSizes?: (sizes: {\n [key: number]: ItemBox\n }) => void;\n\n addEventListener: Function;\n\n removeEventListener: Function;\n\n scrollToIndex: (index: number, position: string) => void;\n\n /**\n * Called by a VirtualRepeater or VirtualScroller when an update that\n * potentially affects layout has occurred. For example, a viewport size\n * change.\n *\n * The layout is in turn responsible for dispatching events, as necessary,\n * to the VirtualRepeater or VirtualScroller. Each of the following events\n * represents an update that should be determined during a reflow. Dispatch\n * each event at maximum once during a single reflow.\n *\n * Events that should be dispatched:\n * - scrollsizechange\n * Dispatch when the total length of all items in the scrolling direction,\n * including spacing, changes.\n * detail: {\n * 'height' | 'width': number\n * }\n * - rangechange\n * Dispatch when the range of children that should be displayed changes\n * (based on layout calculations and the size of the container) or when\n * the first or last item to intersect the container changes.\n * detail: {\n * first: number,\n * last: number,\n * num: number,\n * stable: boolean,\n * remeasure: boolean,\n * firstVisible: number,\n * lastVisible: number,\n * }\n * - itempositionchange\n * Dispatch when the child positions change, for example due to a range\n * change.\n * detail {\n * [number]: {\n * left: number,\n * top: number\n * }\n * }\n * - scrollerrorchange\n * Dispatch when the set viewportScroll offset is not what it should be.\n * detail {\n * height: number,\n * width: number,\n * }\n */\n reflowIfNeeded: (force: boolean) => void;\n}"]}
-\ No newline at end of file
-diff --git a/lib/uni-virtualizer/lib/layouts/Layout1d.d.ts b/lib/uni-virtualizer/lib/layouts/Layout1d.d.ts
-index 843bab970bceb48331dbc28b30ec11c56f9940f2..cafaca7a6b9f0d7789eb17d2c753149dc5c99e60 100644
---- a/lib/uni-virtualizer/lib/layouts/Layout1d.d.ts
-+++ b/lib/uni-virtualizer/lib/layouts/Layout1d.d.ts
-@@ -1,10 +1,19 @@
--import { Layout1dBase } from './Layout1dBase.js';
-+import { Layout1dBase, Layout1dBaseConfig } from './Layout1dBase.js';
- import { ItemBox, Positions, Size } from './Layout.js';
- declare type ItemBounds = {
- pos: number;
- size: number;
- };
--export declare class Layout1d extends Layout1dBase {
-+declare type Layout1dConstructor = {
-+ prototype: Layout1d;
-+ new (config?: Layout1dBaseConfig): Layout1d;
-+};
-+declare type Layout1dSpecifier = Layout1dBaseConfig & {
-+ type: Layout1dConstructor;
-+};
-+declare type Layout1dSpecifierFactory = (config?: Layout1dBaseConfig) => Layout1dSpecifier;
-+export declare const layout1d: Layout1dSpecifierFactory;
-+export declare class Layout1d extends Layout1dBase {
- /**
- * Indices of children mapped to their (position and length) in the scrolling
- * direction. Used to keep track of children that are in range.
-@@ -24,11 +33,11 @@ export declare class Layout1d extends Layout1dBase {
- * jumping to any point of the scroll size. We choose it once and stick with
- * it until stable. _first and _last are deduced around it.
- */
-- _anchorIdx: number;
-+ _anchorIdx: number | null;
- /**
- * Position in the scrolling direction of the anchor child.
- */
-- _anchorPos: number;
-+ _anchorPos: number | null;
- /**
- * Whether all children in range were in range during the previous reflow.
- */
-@@ -47,7 +56,6 @@ export declare class Layout1d extends Layout1dBase {
- private _tMeasured;
- private _measureChildren;
- _estimate: boolean;
-- constructor(config: any);
- get measureChildren(): boolean;
- /**
- * Determine the average size of all children represented in the sizes
-@@ -62,13 +70,13 @@ export declare class Layout1d extends Layout1dBase {
- */
- _updateItemSize(): void;
- _getMetrics(idx: number): ItemBox;
-- _getPhysicalItem(idx: number): ItemBounds;
-+ _getPhysicalItem(idx: number): ItemBounds | undefined;
- _getSize(idx: number): number | undefined;
- /**
- * Returns the position in the scrolling direction of the item at idx.
- * Estimates it if the item at idx is not in the DOM.
- */
-- _getPosition(idx: any): number;
-+ _getPosition(idx: number): number;
- _calculateAnchor(lower: number, upper: number): number;
- _getAnchor(lower: number, upper: number): number;
- /**
-diff --git a/lib/uni-virtualizer/lib/layouts/Layout1d.d.ts.map b/lib/uni-virtualizer/lib/layouts/Layout1d.d.ts.map
-index 511045deb4569007c11e36a74ffdd4ca0dbb4931..16037434e706663ab3bc9fadb9e5c19090b5342f 100644
---- a/lib/uni-virtualizer/lib/layouts/Layout1d.d.ts.map
-+++ b/lib/uni-virtualizer/lib/layouts/Layout1d.d.ts.map
-@@ -1 +1 @@
--{"version":3,"file":"Layout1d.d.ts","sourceRoot":"","sources":["../../../../src/lib/uni-virtualizer/lib/layouts/Layout1d.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,YAAY,EAAC,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAC,OAAO,EAAE,SAAS,EAAE,IAAI,EAAC,MAAM,aAAa,CAAC;AAErD,aAAK,UAAU,GAAG;IAChB,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAA;CACb,CAAC;AAEF,qBAAa,QAAS,SAAQ,YAAY;IACxC;;;OAGG;IACH,cAAc,EAAE,GAAG,CAAC,MAAM,EAAE,UAAU,CAAC,CAAa;IAEpD;;;OAGG;IACH,iBAAiB,EAAE,GAAG,CAAC,MAAM,EAAE,UAAU,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U,CAAK;IAEvB,OAAO,CAAC,gBAAgB,CAAQ;IAEhC,SAAS,UAAQ;IAUjB,IAAI,eAAe,YAElB;IAED;;;OAGG;IACH,eAAe,CAAC,KAAK,EAAE;QAAC,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;KAAC;IAmC/C;;;OAGG;IACH,eAAe;IAMf,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO;IASjC,gBAAgB,CAAC,GAAG,EAAE,MAAM,GAAG,UAAU,GAAG,SAAS;IAIrD,QAAQ,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS;IAKzC;;;OAGG;IACH,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM;IAKjC,gBAAgB,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM;IActD,UAAU,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM;IAqDhD;;;OAGG;IACH,eAAe;IAQf;;OAEG;IACH,WAAW;IAeX,SAAS;IA+GT,eAAe,IAAI,MAAM;IAezB,iBAAiB;IAQjB,OAAO;IA0BP,iBAAiB;IAMjB;;OAEG;IACH,gBAAgB,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS;IAOxC;;OAEG;IACH,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI;IAO/B,gBAAgB;IAKhB,UAAU;CAMX"}
-\ No newline at end of file
-diff --git a/lib/uni-virtualizer/lib/layouts/Layout1d.js b/lib/uni-virtualizer/lib/layouts/Layout1d.js
-index 24e296295ce03663bdb90b19925ccb70e3586ddb..7a261b8b7d3a3bce975eef81a6558dc5ad561e66 100644
---- a/lib/uni-virtualizer/lib/layouts/Layout1d.js
-+++ b/lib/uni-virtualizer/lib/layouts/Layout1d.js
-@@ -1,7 +1,10 @@
- import { Layout1dBase } from './Layout1dBase.js';
-+export const layout1d = (config) => Object.assign({
-+ type: Layout1d
-+}, config);
- export class Layout1d extends Layout1dBase {
-- constructor(config) {
-- super(config);
-+ constructor() {
-+ super(...arguments);
- /**
- * Indices of children mapped to their (position and length) in the scrolling
- * direction. Used to keep track of children that are in range.
-@@ -45,6 +48,11 @@ export class Layout1d extends Layout1dBase {
- this._measureChildren = true;
- this._estimate = true;
- }
-+ // protected _defaultConfig: Layout1dBaseConfig = Object.assign({}, super._defaultConfig, {
-+ // })
-+ // constructor(config: Layout1dConfig) {
-+ // super(config);
-+ // }
- get measureChildren() {
- return this._measureChildren;
- }
-@@ -54,7 +62,7 @@ export class Layout1d extends Layout1dBase {
- */
- updateItemSizes(sizes) {
- Object.keys(sizes).forEach((key) => {
-- const metrics = sizes[key], mi = this._getMetrics(Number(key)), prevSize = mi[this._sizeDim];
-+ const metrics = sizes[Number(key)], mi = this._getMetrics(Number(key)), prevSize = mi[this._sizeDim];
- // TODO(valdrin) Handle margin collapsing.
- // https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Box_Model/Mastering_margin_collapsing
- mi.width = metrics.width + (metrics.marginLeft || 0) +
-@@ -64,10 +72,10 @@ export class Layout1d extends Layout1dBase {
- const size = mi[this._sizeDim];
- const item = this._getPhysicalItem(Number(key));
- if (item) {
-- let delta;
-+ let delta = 0;
- if (size !== undefined) {
- item.size = size;
-- if (prevSize === undefined) {
-+ if (prevSize === -1) {
- delta = size;
- this._nMeasured++;
- }
-@@ -93,7 +101,12 @@ export class Layout1d extends Layout1dBase {
- Math.round(this._tMeasured / this._nMeasured);
- }
- _getMetrics(idx) {
-- return (this._metrics[idx] = this._metrics[idx] || {});
-+ let metrics = this._metrics.get(idx);
-+ if (metrics === undefined) {
-+ metrics = { height: -1, width: -1 };
-+ this._metrics.set(idx, metrics);
-+ }
-+ return metrics;
- }
- _getPhysicalItem(idx) {
- return this._newPhysicalItems.get(idx) || this._physicalItems.get(idx);
-@@ -365,3 +378,4 @@ export class Layout1d extends Layout1dBase {
- super._emitRange({ remeasure, stable });
- }
- }
-+//# sourceMappingURL=Layout1d.js.map
-\ No newline at end of file
-diff --git a/lib/uni-virtualizer/lib/layouts/Layout1d.js.map b/lib/uni-virtualizer/lib/layouts/Layout1d.js.map
-new file mode 100644
-index 0000000000000000000000000000000000000000..53e2375c71a8f5e1aa116c5d3152e392569607ef
---- /dev/null
-+++ b/lib/uni-virtualizer/lib/layouts/Layout1d.js.map
-@@ -0,0 +1 @@
-+{"version":3,"file":"Layout1d.js","sourceRoot":"","sources":["../../../../src/lib/uni-virtualizer/lib/layouts/Layout1d.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,YAAY,EAAqB,MAAM,mBAAmB,CAAC;AAmBnE,MAAM,CAAC,MAAM,QAAQ,GAA6B,CAAC,MAA2B,EAAE,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC;IAC/F,IAAI,EAAE,QAAQ;CACf,EAAE,MAAM,CAAC,CAAC;AAGX,MAAM,OAAO,QAAS,SAAQ,YAAgC;IAA9D;;QACE;;;WAGG;QACH,mBAAc,GAA4B,IAAI,GAAG,EAAE,CAAC;QAEpD;;;WAGG;QACH,sBAAiB,GAA4B,IAAI,GAAG,EAAE,CAAC;QAEvD;;WAEG;QACH,aAAQ,GAAsB,IAAI,GAAG,EAAE,CAAC;QAExC;;;;WAIG;QACH,eAAU,GAAkB,IAAI,CAAC;QAEjC;;WAEG;QACH,eAAU,GAAkB,IAAI,CAAC;QAEjC;;WAEG;QACH,YAAO,GAAG,IAAI,CAAC;QAEf;;WAEG;QACH,oBAAe,GAAG,KAAK,CAAC;QAExB;;WAEG;QACK,eAAU,GAAG,CAAC,CAAC;QAEvB;;WAEG;QACK,eAAU,GAAG,CAAC,CAAC;QAEf,qBAAgB,GAAG,IAAI,CAAC;QAEhC,cAAS,GAAG,IAAI,CAAC;IAgYnB,CAAC;IA9XC,2FAA2F;IAE3F,KAAK;IAEL,wCAAwC;IACxC,mBAAmB;IACnB,IAAI;IAEJ,IAAI,eAAe;QACjB,OAAO,IAAI,CAAC,gBAAgB,CAAC;IAC/B,C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AAS,GAAG,IAAI,CAAC,eAAe,CAAC;QACvC,MAAM,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC;QAC5B,IAAI,CAAC,eAAe,GAAG,KAAK,CAAC;QAC7B,KAAK,CAAC,UAAU,CAAC,EAAC,SAAS,EAAE,MAAM,EAAC,CAAC,CAAC;IACxC,CAAC;CACF","sourcesContent":["import {Layout1dBase, Layout1dBaseConfig} from './Layout1dBase.js';\nimport {ItemBox, Positions, Size, Margins} from './Layout.js';\n\ntype ItemBounds = {\n pos: number,\n size: number\n};\n\ntype Layout1dConstructor = {\n prototype: Layout1d,\n new(config?: Layout1dBaseConfig): Layout1d\n}\n\ntype Layout1dSpecifier = Layout1dBaseConfig & {\n type: Layout1dConstructor\n}\n\ntype Layout1dSpecifierFactory = (config?: Layout1dBaseConfig) => Layout1dSpecifier;\n\nexport const layout1d: Layout1dSpecifierFactory = (config?: Layout1dBaseConfig) => Object.assign({\n type: Layout1d\n}, config);\n\n\nexport class Layout1d extends Layout1dBase {\n /**\n * Indices of children mapped to their (position and length) in the scrolling\n * direction. Used to keep track of children that are in range.\n */\n _physicalItems: Map = new Map();\n\n /**\n * Used in tandem with _physicalItems to track children in range across\n * reflows.\n */\n _newPhysicalItems: Map = new Map();\n\n /**\n * Width and height of children by their index.\n */\n _metrics: Map = new Map();\n\n /**\n * anchorIdx is the anchor around which we reflow. It is designed to allow\n * jumping to any point of the scroll size. We choose it once and stick with\n * it until stable. _first and _last are deduced around it.\n */\n _anchorIdx: number | null = null;\n\n /**\n * Position in the scrolling direction of the anchor child.\n */\n _anchorPos: number | null = null;\n\n /**\n * Whether all children in range were in range during the previous reflow.\n */\n _stable = true;\n\n /**\n * Whether to remeasure children during the next reflow.\n */\n _needsRemeasure = false;\n\n /**\n * Number of children to lay out.\n */\n private _nMeasured = 0;\n\n /**\n * Total length in the scrolling direction of the laid out children.\n */\n private _tMeasured = 0;\n\n private _measureChildren = true;\n\n _estimate = true;\n\n // protected _defaultConfig: Layout1dBaseConfig = Object.assign({}, super._defaultConfig, {\n\n // })\n\n // constructor(config: Layout1dConfig) {\n // super(config);\n // }\n\n get measureChildren() {\n return this._measureChildren;\n }\n\n /**\n * Determine the average size of all children represented in the sizes\n * argument.\n */\n updateItemSizes(sizes: {[key: number]: ItemBox}) {\n Object.keys(sizes).forEach((key) => {\n const metrics = sizes[Number(key)], mi = this._getMetrics(Number(key)),\n prevSize = mi[this._sizeDim];\n\n // TODO(valdrin) Handle margin collapsing.\n // https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Box_Model/Mastering_margin_collapsing\n mi.width = metrics.width + ((metrics as Margins).marginLeft || 0) +\n ((metrics as Margins).marginRight || 0);\n mi.height = metrics.height + ((metrics as Margins).marginTop || 0) +\n ((metrics as Margins).marginBottom || 0);\n\n const size = mi[this._sizeDim];\n const item = this._getPhysicalItem(Number(key));\n if (item) {\n let delta = 0;\n\n if (size !== undefined) {\n item.size = size;\n if (prevSize === -1) {\n delta = size;\n this._nMeasured++;\n } else {\n delta = size - prevSize;\n }\n }\n this._tMeasured = this._tMeasured + delta;\n }\n });\n if (this._nMeasured) {\n this._updateItemSize();\n this._scheduleReflow();\n }\n }\n\n /**\n * Set the average item size based on the total length and number of children\n * in range.\n */\n _updateItemSize() {\n // Keep integer values.\n this._itemSize[this._sizeDim] =\n Math.round(this._tMeasured / this._nMeasured);\n }\n\n _getMetrics(idx: number): ItemBox {\n let metrics = this._metrics.get(idx);\n if (metrics === undefined) {\n metrics = {height: -1, width: -1};\n this._metrics.set(idx, metrics);\n }\n return metrics;\n }\n\n _getPhysicalItem(idx: number): ItemBounds | undefined {\n return this._newPhysicalItems.get(idx) || this._physicalItems.get(idx);\n }\n\n _getSize(idx: number): number | undefined {\n const item = this._getPhysicalItem(idx);\n return item && item.size;\n }\n\n /**\n * Returns the position in the scrolling direction of the item at idx.\n * Estimates it if the item at idx is not in the DOM.\n */\n _getPosition(idx: number): number {\n const item = this._getPhysicalItem(idx);\n return item ? item.pos : (idx * (this._delta)) + this._spacing;\n }\n\n _calculateAnchor(lower: number, upper: number): number {\n if (lower === 0) {\n return 0;\n }\n if (upper > this._scrollSize - this._viewDim1) {\n return this._totalItems - 1;\n }\n return Math.max(\n 0,\n Math.min(\n this._totalItems - 1,\n Math.floor(((lower + upper) / 2) / this._delta)));\n }\n\n _getAnchor(lower: number, upper: number): number {\n if (this._physicalItems.size === 0) {\n return this._calculateAnchor(lower, upper);\n }\n if (this._first < 0) {\n console.error('_getAnchor: negative _first');\n return this._calculateAnchor(lower, upper);\n }\n if (this._last < 0) {\n console.error('_getAnchor: negative _last');\n return this._calculateAnchor(lower, upper);\n }\n\n const firstItem = this._getPhysicalItem(this._first),\n lastItem = this._getPhysicalItem(this._last),\n firstMin = firstItem!.pos, firstMax = firstMin + firstItem!.size,\n lastMin = lastItem!.pos, lastMax = lastMin + lastItem!.size;\n\n if (lastMax < lower) {\n // Window is entirely past physical items, calculate new anchor\n return this._calculateAnchor(lower, upper);\n }\n if (firstMin > upper) {\n // Window is entirely before physical items, calculate new anchor\n return this._calculateAnchor(lower, upper);\n }\n if (firstMin >= lower || firstMax >= lower) {\n // First physical item overlaps window, choose it\n return this._first;\n }\n if (lastMax <= upper || lastMin <= upper) {\n // Last physical overlaps window, choose it\n return this._last;\n }\n // Window contains a physical item, but not the first or last\n let maxIdx = this._last, minIdx = this._first;\n\n while (true) {\n const candidateIdx = Math.round((maxIdx + minIdx) / 2),\n candidate = this._physicalItems.get(candidateIdx),\n cMin = candidate!.pos, cMax = cMin + candidate!.size;\n\n if ((cMin >= lower && cMin <= upper) ||\n (cMax >= lower && cMax <= upper)) {\n return candidateIdx;\n } else if (cMax < lower) {\n minIdx = candidateIdx + 1;\n } else if (cMin > upper) {\n maxIdx = candidateIdx - 1;\n }\n }\n }\n\n /**\n * Updates _first and _last based on items that should be in the current\n * viewed range.\n */\n _getActiveItems() {\n if (this._viewDim1 === 0 || this._totalItems === 0) {\n this._clearItems();\n } else {\n this._getItems();\n }\n }\n\n /**\n * Sets the range to empty.\n */\n _clearItems() {\n this._first = -1;\n this._last = -1;\n this._physicalMin = 0;\n this._physicalMax = 0;\n const items = this._newPhysicalItems;\n this._newPhysicalItems = this._physicalItems;\n this._newPhysicalItems.clear();\n this._physicalItems = items;\n this._stable = true;\n }\n\n /*\n * Updates _first and _last based on items that should be in the given range.\n */\n _getItems() {\n const items = this._newPhysicalItems;\n let lower, upper;\n\n // The anchorIdx is the anchor around which we reflow. It is designed to\n // allow jumping to any point of the scroll size. We choose it once and\n // stick with it until stable. first and last are deduced around it.\n\n if (this._scrollToIndex >= 0) {\n // If we have a scrollToIndex, we anchor on the given\n // index and set the scroll position accordingly\n this._anchorIdx = this._scrollToIndex;\n this._anchorPos = this._getPosition(this._anchorIdx);\n this._scrollIfNeeded();\n lower = Math.max(0, this._scrollPosition - this._overhang);\n upper = Math.min(this._scrollSize, this._scrollPosition + this._viewDim1 + this._overhang);\n }\n else {\n // Otherwise, we find an appropriate index to anchor on\n // given the current scroll position\n upper = Math.min(\n this._scrollSize,\n this._scrollPosition + this._viewDim1 + this._overhang\n );\n lower = Math.max(0, upper - this._viewDim1 - (2 * this._overhang));\n\n if (this._anchorIdx === null || this._anchorPos === null) {\n this._anchorIdx = this._getAnchor(lower, upper);\n this._anchorPos = this._getPosition(this._anchorIdx); \n }\n }\n\n let anchorSize = this._getSize(this._anchorIdx);\n if (anchorSize === undefined) {\n anchorSize = this._itemDim1;\n }\n\n // Anchor might be outside bounds, so prefer correcting the error and keep\n // that anchorIdx.\n let anchorErr = 0;\n\n if (this._anchorPos + anchorSize + this._spacing < lower) {\n anchorErr = lower - (this._anchorPos + anchorSize + this._spacing);\n }\n\n if (this._anchorPos > upper) {\n anchorErr = upper - this._anchorPos;\n }\n\n if (anchorErr) {\n this._scrollPosition -= anchorErr;\n lower -= anchorErr;\n upper -= anchorErr;\n this._scrollError += anchorErr;\n }\n\n // TODO @straversi: If size is always itemDim1, then why keep track of it?\n items.set(this._anchorIdx, {pos: this._anchorPos, size: anchorSize});\n\n this._first = (this._last = this._anchorIdx);\n this._physicalMin = (this._physicalMax = this._anchorPos);\n\n this._stable = true;\n\n while (this._physicalMin > lower && this._first > 0) {\n let size = this._getSize(--this._first);\n if (size === undefined) {\n this._stable = false;\n size = this._itemDim1;\n }\n const pos = (this._physicalMin -= size + this._spacing);\n items.set(this._first, {pos, size});\n if (this._stable === false && this._estimate === false) {\n break;\n }\n }\n\n while (this._physicalMax < upper && this._last < this._totalItems) {\n let size = this._getSize(this._last);\n if (size === undefined) {\n this._stable = false;\n size = this._itemDim1;\n }\n items.set(this._last++, {pos: this._physicalMax, size});\n if (this._stable === false && this._estimate === false) {\n break;\n } else {\n this._physicalMax += size + this._spacing;\n }\n }\n\n this._last--;\n\n // This handles the cases where we were relying on estimated sizes.\n const extentErr = this._calculateError();\n if (extentErr) {\n this._physicalMin -= extentErr;\n this._physicalMax -= extentErr;\n this._anchorPos -= extentErr;\n this._scrollPosition -= extentErr;\n items.forEach((item) => item.pos -= extentErr);\n this._scrollError += extentErr;\n }\n\n if (this._stable) {\n this._newPhysicalItems = this._physicalItems;\n this._newPhysicalItems.clear();\n this._physicalItems = items;\n }\n }\n\n _calculateError(): number {\n if (this._first === 0) {\n return this._physicalMin;\n } else if (this._physicalMin <= 0) {\n return this._physicalMin - (this._first * this._delta);\n } else if (this._last === this._totalItems - 1) {\n return this._physicalMax - this._scrollSize;\n } else if (this._physicalMax >= this._scrollSize) {\n return (\n (this._physicalMax - this._scrollSize) +\n ((this._totalItems - 1 - this._last) * this._delta));\n }\n return 0;\n }\n\n _updateScrollSize() {\n // Reuse previously calculated physical max, as it might be higher than the\n // estimated size.\n super._updateScrollSize();\n this._scrollSize = Math.max(this._physicalMax, this._scrollSize);\n }\n\n // TODO: Can this be made to inherit from base, with proper hooks?\n _reflow() {\n const {_first, _last, _scrollSize} = this;\n\n this._updateScrollSize();\n this._getActiveItems();\n\n if (this._scrollSize !== _scrollSize) {\n this._emitScrollSize();\n }\n\n this._updateVisibleIndices();\n this._emitRange();\n if (this._first === -1 && this._last === -1) {\n this._resetReflowState();\n } else if (\n this._first !== _first || this._last !== _last ||\n this._needsRemeasure) {\n this._emitChildPositions();\n this._emitScrollError();\n } else {\n this._emitChildPositions();\n this._emitScrollError();\n this._resetReflowState();\n }\n }\n\n _resetReflowState() {\n this._anchorIdx = null;\n this._anchorPos = null;\n this._stable = true;\n }\n\n /**\n * Returns the top and left positioning of the item at idx.\n */\n _getItemPosition(idx: number): Positions {\n return {\n [this._positionDim]: this._getPosition(idx),\n [this._secondaryPositionDim]: 0,\n } as Positions;\n }\n\n /**\n * Returns the height and width of the item at idx.\n */\n _getItemSize(idx: number): Size {\n return {\n [this._sizeDim]: this._getSize(idx) || this._itemDim1,\n [this._secondarySizeDim]: this._itemDim2,\n } as Size;\n }\n\n _viewDim2Changed() {\n this._needsRemeasure = true;\n this._scheduleReflow();\n }\n\n _emitRange() {\n const remeasure = this._needsRemeasure;\n const stable = this._stable;\n this._needsRemeasure = false;\n super._emitRange({remeasure, stable});\n }\n}\n"]}
-\ No newline at end of file
-diff --git a/lib/uni-virtualizer/lib/layouts/Layout1dBase.d.ts b/lib/uni-virtualizer/lib/layouts/Layout1dBase.d.ts
-index 1ec5e4adbfbaa9ea3e158dd0ee59cdecf46b943c..35db11a215e139c4527c726fa219dc3fae044ddc 100644
---- a/lib/uni-virtualizer/lib/layouts/Layout1dBase.d.ts
-+++ b/lib/uni-virtualizer/lib/layouts/Layout1dBase.d.ts
-@@ -1,5 +1,12 @@
--import { Layout, Positions, ScrollDirection, Size, dimension, position, LayoutConfig } from './Layout.js';
--export declare abstract class Layout1dBase implements Layout {
-+import { Layout, Positions, ScrollDirection, Size, dimension, position } from './Layout.js';
-+declare type UpdateVisibleIndicesOptions = {
-+ emit?: boolean;
-+};
-+export interface Layout1dBaseConfig {
-+ direction?: ScrollDirection;
-+ totalItems?: number;
-+}
-+export declare abstract class Layout1dBase implements Layout {
- /**
- * The last set viewport scroll position.
- */
-@@ -100,11 +107,11 @@ export declare abstract class Layout1dBase implements Layout {
- */
- protected _overhang: number;
- private _eventTarget;
-- protected _spacingChanged: any;
-- protected static _defaultConfig: LayoutConfig;
-- constructor(config: any);
-- set config(config: LayoutConfig);
-- get config(): LayoutConfig;
-+ protected _spacingChanged: boolean;
-+ protected _defaultConfig: C;
-+ constructor(config?: C);
-+ set config(config: C);
-+ get config(): C;
- /**
- * Maximum index of children + 1, to help estimate total height of the scroll
- * space.
-@@ -139,15 +146,15 @@ export declare abstract class Layout1dBase implements Layout {
- /**
- * Perform a reflow if one has been scheduled.
- */
-- reflowIfNeeded(force: any): void;
-+ reflowIfNeeded(force: boolean): void;
- /**
- * Scroll to the child at the given index, and the given position within that
- * child.
- */
-- scrollToIndex(index: any, position?: string): void;
-- dispatchEvent(...args: any[]): Promise;
-- addEventListener(...args: any[]): Promise;
-- removeEventListener(...args: any[]): Promise;
-+ scrollToIndex(index: number, position?: string): void;
-+ dispatchEvent(evt: Event): Promise;
-+ addEventListener(type: string, listener: EventListener | EventListenerObject | null, options?: boolean | AddEventListenerOptions | undefined): Promise;
-+ removeEventListener(type: string, callback: EventListener | EventListenerObject | null, options?: boolean | EventListenerOptions | undefined): Promise;
- /**
- * Get the top and left positioning of the item at idx.
- */
-@@ -156,7 +163,7 @@ export declare abstract class Layout1dBase implements Layout {
- * Update _first and _last based on items that should be in the current
- * range.
- */
-- abstract _getActiveItems(): any;
-+ abstract _getActiveItems(): void;
- protected _itemDim2Changed(): void;
- protected _viewDim2Changed(): void;
- protected _updateLayout(): void;
-@@ -189,7 +196,7 @@ export declare abstract class Layout1dBase implements Layout {
- */
- protected _updateScrollSize(): void;
- protected _scrollIfNeeded(): void;
-- protected _emitRange(inProps?: any): void;
-+ protected _emitRange(inProps?: unknown): void;
- protected _emitScrollSize(): void;
- protected _emitScrollError(): void;
- /**
-@@ -206,7 +213,8 @@ export declare abstract class Layout1dBase implements Layout {
- * Find the indices of the first and last items to intersect the viewport.
- * Emit a visibleindiceschange event when either index changes.
- */
-- protected _updateVisibleIndices(options?: any): void;
-+ protected _updateVisibleIndices(options?: UpdateVisibleIndicesOptions): void;
- private _scrollPositionChanged;
- }
-+export {};
- //# sourceMappingURL=Layout1dBase.d.ts.map
-\ No newline at end of file
-diff --git a/lib/uni-virtualizer/lib/layouts/Layout1dBase.d.ts.map b/lib/uni-virtualizer/lib/layouts/Layout1dBase.d.ts.map
-index 29480cad4fb2479f471e00315614dcfacb36b07b..96c99bef00039d9fb14dc10e76bef00b227b912a 100644
---- a/lib/uni-virtualizer/lib/layouts/Layout1dBase.d.ts.map
-+++ b/lib/uni-virtualizer/lib/layouts/Layout1dBase.d.ts.map
-@@ -1 +1 @@
--{"version":3,"file":"Layout1dBase.d.ts","sourceRoot":"","sources":["../../../../src/lib/uni-virtualizer/lib/layouts/Layout1dBase.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,MAAM,EAAE,SAAS,EAAE,eAAe,EAAE,IAAI,EAAE,SAAS,EAAE,QAAQ,EAAE,YAAY,EAAC,MAAM,aAAa,CAAC;AAExG,8BAAsB,YAAa,YAAW,MAAM;IAClD;;OAEG;IACH,OAAO,CAAC,aAAa,CAAgC;IAErD;;OAEG;IACH,OAAO,CAAC,UAAU,CAA+B;IAEjD;;OAEG;IACH,OAAO,CAAC,aAAa,CAA+B;IAEpD;;OAEG;IACH,OAAO,CAAC,cAAc,CAAkB;IAExC,OAAO,CAAC,oBAAoB,CAAkB;IAE9C;;;OAGG;IACH,SAAS,CAAC,cAAc,EAAE,MAAM,CAAM;IAEtC;;;OAGG;IACH,OAAO,CAAC,eAAe,CAAa;IAEpC;;OAEG;IACH,OAAO,CAAC,aAAa,CAAS;IAE9B;;OAEG;IACH,OAAO,CAAC,YAAY,CAAS;IAE7B,OAAO,CAAC,mBAAmB,CAEvB;IAEJ;;OAEG;IACH,SAAS,CAAC,YAAY,EAAE,MAAM,CAAK;IAEnC;;OAEG;IACH,SAAS,CAAC,YAAY,EAAE,MAAM,CAAK;IAEnC;;O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Y;IAcxC,SAAS,CAAC,eAAe;IAOzB,SAAS,CAAC,gBAAgB;IAW1B;;;OAGG;IACH,SAAS,CAAC,mBAAmB;IAQ7B;;OAEG;IACH,OAAO,KAAK,IAAI,GAKf;IAED,OAAO,CAAC,gBAAgB;IAcxB;;;OAGG;IACH,SAAS,CAAC,qBAAqB,CAAC,OAAO,CAAC,KAAA;IAiCxC,OAAO,CAAC,sBAAsB;CAQ/B"}
-\ No newline at end of file
-+{"version":3,"file":"Layout1dBase.d.ts","sourceRoot":"","sources":["../../../../src/lib/uni-virtualizer/lib/layouts/Layout1dBase.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,MAAM,EAAE,SAAS,EAAE,eAAe,EAAE,IAAI,EAAE,SAAS,EAAE,QAAQ,EAAC,MAAM,aAAa,CAAC;AAE1F,aAAK,2BAA2B,GAAG;IACjC,IAAI,CAAC,EAAE,OAAO,CAAA;CACf,CAAA;AAED,MAAM,WAAW,kBAAkB;IACjC,SAAS,CAAC,EAAE,eAAe,CAAC;IAC5B,UAAU,CAAC,EAAE,MAAM,CAAA;CACpB;AAED,8BAAsB,YAAY,CAAC,CAAC,SAAS,kBAAkB,CAAE,YAAW,MAAM;IAChF;;OAEG;IACH,OAAO,CAAC,aAAa,CAAgC;IAErD;;OAEG;IACH,OAAO,CAAC,UAAU,CAA+B;IAEjD;;OAEG;IACH,OAAO,CAAC,aAAa,CAA+B;IAEpD;;OAEG;IACH,OAAO,CAAC,cAAc,CAAS;IAE/B,OAAO,CAAC,oBAAoB,CAAS;IAErC;;;OAGG;IACH,SAAS,CAAC,cAAc,SAAM;IAE9B;;;OAGG;IACH,OAAO,CAAC,eAAe,CAAK;IAE5B;;OAEG;IACH,OAAO,CAAC,aAAa,CAAK;IAE1B;;OAEG;IACH,OAAO,CAAC,YAAY,CAAK;IAEzB,OAAO,CAAC,mBAAmB,CAEvB;IAEJ;;OAEG;IACH,SAAS,CAAC,YAAY,SAAK;IAE3B;;OAEG;IACH,SAAS,CAAC,Y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e;IAIzB,SAAS,CAAC,qBAAqB;IAK/B,SAAS,CAAC,OAAO;IA6BjB;;OAEG;IACH,SAAS,CAAC,iBAAiB;IAM3B,SAAS,CAAC,eAAe;IAmBzB,SAAS,CAAC,UAAU,CAAC,OAAO,GAAE,OAAmB;IAcjD,SAAS,CAAC,eAAe;IAOzB,SAAS,CAAC,gBAAgB;IAW1B;;;OAGG;IACH,SAAS,CAAC,mBAAmB;IAQ7B;;OAEG;IACH,OAAO,KAAK,IAAI,GAKf;IAED,OAAO,CAAC,gBAAgB;IAcxB;;;OAGG;IACF,SAAS,CAAC,qBAAqB,CAAC,OAAO,CAAC,EAAE,2BAA2B;IAiCtE,OAAO,CAAC,sBAAsB;CAQ/B"}
-\ No newline at end of file
-diff --git a/lib/uni-virtualizer/lib/layouts/Layout1dBase.js b/lib/uni-virtualizer/lib/layouts/Layout1dBase.js
-index 94efc6df12444102eb08c9ed14dda66c8a1d7d72..995c860ad93bf52395ebef55532a9f7ae43e73fb 100644
---- a/lib/uni-virtualizer/lib/layouts/Layout1dBase.js
-+++ b/lib/uni-virtualizer/lib/layouts/Layout1dBase.js
-@@ -28,6 +28,14 @@ export class Layout1dBase {
- * top of the viewport. Value is a proportion of the item size.
- */
- this._scrollToAnchor = 0;
-+ /**
-+ * The index of the first item intersecting the viewport.
-+ */
-+ this._firstVisible = 0;
-+ /**
-+ * The index of the last item intersecting the viewport.
-+ */
-+ this._lastVisible = 0;
- this._eventTargetPromise = (EventTarget().then((Ctor) => {
- this._eventTarget = new Ctor();
- }));
-@@ -96,19 +104,20 @@ export class Layout1dBase {
- // TODO (graynorton): Probably want to make this something we calculate based
- // on viewport size, item size, other factors, possibly still with a dial of some kind
- this._overhang = 1000;
-- if (config) {
-- this.config = config;
-- }
-+ this._eventTarget = null;
-+ this._spacingChanged = false;
-+ this._defaultConfig = {
-+ direction: 'vertical'
-+ };
-+ this.config = config || this._defaultConfig;
- }
- set config(config) {
-- Object.assign(this, Object.assign({}, this.constructor._defaultConfig, config));
-+ Object.assign(this, Object.assign({}, this._defaultConfig, config));
- }
- get config() {
-- const config = {};
-- for (let key in this.constructor._defaultConfig) {
-- config[key] = this[key];
-- }
-- return config;
-+ return {
-+ direction: this.direction
-+ };
- }
- /**
- * Maximum index of children + 1, to help estimate total height of the scroll
-@@ -241,17 +250,17 @@ export class Layout1dBase {
- }
- this._scheduleReflow();
- }
-- async dispatchEvent(...args) {
-+ async dispatchEvent(evt) {
- await this._eventTargetPromise;
-- this._eventTarget.dispatchEvent(...args);
-+ this._eventTarget.dispatchEvent(evt);
- }
-- async addEventListener(...args) {
-+ async addEventListener(type, listener, options) {
- await this._eventTargetPromise;
-- this._eventTarget.addEventListener(...args);
-+ this._eventTarget.addEventListener(type, listener, options);
- }
-- async removeEventListener(...args) {
-+ async removeEventListener(type, callback, options) {
- await this._eventTargetPromise;
-- this._eventTarget.removeEventListener(...args);
-+ this._eventTarget.removeEventListener(type, callback, options);
- }
- _itemDim2Changed() {
- // Override
-@@ -449,4 +458,4 @@ export class Layout1dBase {
- }
- }
- }
--Layout1dBase._defaultConfig = {};
-+//# sourceMappingURL=Layout1dBase.js.map
-\ No newline at end of file
-diff --git a/lib/uni-virtualizer/lib/layouts/Layout1dBase.js.map b/lib/uni-virtualizer/lib/layouts/Layout1dBase.js.map
-new file mode 100644
-index 0000000000000000000000000000000000000000..be6a74593fea802779d275aef73f85858458c307
---- /dev/null
-+++ b/lib/uni-virtualizer/lib/layouts/Layout1dBase.js.map
-@@ -0,0 +1 @@
-+{"version":3,"file":"Layout1dBase.js","sourceRoot":"","sources":["../../../../src/lib/uni-virtualizer/lib/layouts/Layout1dBase.ts"],"names":[],"mappings":"AAAA,OAAO,WAAW,MAAM,mCAAmC,CAAC;AAY5D,MAAM,OAAgB,YAAY;IAwIhC,YAAY,MAAU;QAvItB;;WAEG;QACK,kBAAa,GAAc,EAAC,IAAI,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,EAAC,CAAC;QAErD;;WAEG;QACK,eAA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IAAI,CAAC,UAAU,EAAE,CAAC;aACnB;SACF;IACH,CAAC;IAEO,sBAAsB,CAAC,MAAc,EAAE,MAAc;QAC3D,qEAAqE;QACrE,mDAAmD;QACnD,MAAM,MAAM,GAAG,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,SAAS,CAAC;QACjD,IAAI,MAAM,GAAG,MAAM,IAAI,MAAM,GAAG,MAAM,EAAE;YACtC,IAAI,CAAC,cAAc,GAAG,CAAC,CAAC,CAAC;SAC1B;IACH,CAAC;CACF","sourcesContent":["import EventTarget from '../polyfillLoaders/EventTarget.js';\nimport {Layout, Positions, ScrollDirection, Size, dimension, position} from './Layout.js';\n\ntype UpdateVisibleIndicesOptions = {\n emit?: boolean\n}\n\nexport interface Layout1dBaseConfig {\n direction?: ScrollDirection,\n totalItems?: number\n}\n\nexport abstract class Layout1dBase implements Layout {\n /**\n * The last set viewport scroll position.\n */\n private _latestCoords: Positions = {left: 0, top: 0};\n\n /**\n * Scrolling direction.\n */\n private _direction: ScrollDirection = 'vertical';\n\n /**\n * Dimensions of the viewport.\n */\n private _viewportSize: Size = {width: 0, height: 0};\n\n /**\n * Flag for debouncing asynchnronous reflow requests.\n */\n private _pendingReflow = false;\n\n private _pendingLayoutUpdate = false;\n\n /**\n * Index of the item that has been scrolled to via the public API. When the\n * container is otherwise scrolled, this value is set back to -1.\n */\n protected _scrollToIndex = -1;\n\n /**\n * When a child is scrolled to, the offset from the top of the child and the\n * top of the viewport. Value is a proportion of the item size.\n */\n private _scrollToAnchor = 0;\n\n /**\n * The index of the first item intersecting the viewport.\n */\n private _firstVisible = 0;\n\n /**\n * The index of the last item intersecting the viewport.\n */\n private _lastVisible = 0;\n\n private _eventTargetPromise: Promise = (EventTarget().then((Ctor) => {\n this._eventTarget = new Ctor();\n }));\n\n /**\n * Pixel offset in the scroll direction of the first child.\n */\n protected _physicalMin = 0;\n\n /**\n * Pixel offset in the scroll direction of the last child.\n */\n protected _physicalMax = 0;\n\n /**\n * Index of the first child.\n */\n protected _first = -1;\n\n /**\n * Index of the last child.\n */\n protected _last = -1;\n\n /**\n * The _estimated_ size of a child.\n */\n protected _itemSize: Size = {width: 100, height: 100};\n\n /**\n * Space in pixels between children.\n */\n protected _spacing = 0;\n\n /**\n * Length in the scrolling direction.\n */\n protected _sizeDim: dimension = 'height';\n\n /**\n * Length in the non-scrolling direction.\n */\n protected _secondarySizeDim: dimension = 'width';\n\n /**\n * Position in the scrolling direction.\n */\n protected _positionDim: position = 'top';\n\n /**\n * Position in the non-scrolling direction.\n */\n protected _secondaryPositionDim: position = 'left';\n\n /**\n * Current scroll offset in pixels.\n */\n protected _scrollPosition = 0;\n\n /**\n * Difference between current scroll offset and scroll offset calculated due\n * to a reflow.\n */\n protected _scrollError = 0;\n\n /**\n * Total number of items that could possibly be displayed. Used to help\n * calculate the scroll size.\n */\n protected _totalItems = 0;\n\n /**\n * The total (estimated) length of all items in the scrolling direction.\n */\n protected _scrollSize = 1;\n\n /**\n * Number of pixels beyond the visible size of the container to still include\n * in the active range of items.\n */\n // TODO (graynorton): Probably want to make this something we calculate based\n // on viewport size, item size, other factors, possibly still with a dial of some kind\n protected _overhang = 1000;\n\n private _eventTarget: EventTarget | null = null;\n protected _spacingChanged = false;\n\n protected _defaultConfig: C = {\n direction: 'vertical'\n } as C\n\n constructor(config?: C) {\n this.config = config || this._defaultConfig;\n }\n\n set config(config: C) {\n Object.assign(this, Object.assign({}, this._defaultConfig, config));\n }\n\n get config(): C {\n return {\n direction: this.direction\n } as C;\n }\n\n /**\n * Maximum index of children + 1, to help estimate total height of the scroll\n * space.\n */\n get totalItems(): number {\n return this._totalItems;\n }\n set totalItems(num) {\n const _num = Number(num);\n if (_num !== this._totalItems) {\n this._totalItems = _num;\n this._scheduleReflow();\n }\n }\n\n /**\n * Primary scrolling direction.\n */\n get direction(): ScrollDirection {\n return this._direction;\n }\n set direction(dir) {\n // Force it to be either horizontal or vertical.\n dir = (dir === 'horizontal') ? dir : 'vertical';\n if (dir !== this._direction) {\n this._direction = dir;\n this._sizeDim = (dir === 'horizontal') ? 'width' : 'height';\n this._secondarySizeDim = (dir === 'horizontal') ? 'height' : 'width';\n this._positionDim = (dir === 'horizontal') ? 'left' : 'top';\n this._secondaryPositionDim = (dir === 'horizontal') ? 'top' : 'left';\n this._scheduleLayoutUpdate();\n }\n }\n\n /**\n * Estimate of the dimensions of a single child.\n */\n get itemSize(): Size {\n return this._itemSize;\n }\n set itemSize(dims) {\n const {_itemDim1, _itemDim2} = this;\n Object.assign(this._itemSize, dims);\n if (_itemDim1 !== this._itemDim1 || _itemDim2 !== this._itemDim2) {\n if (_itemDim2 !== this._itemDim2) {\n this._itemDim2Changed();\n } else {\n this._scheduleLayoutUpdate();\n }\n }\n }\n\n /**\n * Amount of space in between items.\n */\n get spacing(): number {\n return this._spacing;\n }\n set spacing(px) {\n const _px = Number(px);\n if (_px !== this._spacing) {\n this._spacing = _px;\n this._scheduleLayoutUpdate();\n }\n }\n\n /**\n * Height and width of the viewport.\n */\n get viewportSize(): Size {\n return this._viewportSize;\n }\n set viewportSize(dims) {\n const {_viewDim1, _viewDim2} = this;\n Object.assign(this._viewportSize, dims);\n if (_viewDim2 !== this._viewDim2) {\n this._viewDim2Changed();\n } else if (_viewDim1 !== this._viewDim1) {\n this._checkThresholds();\n }\n }\n\n /**\n * Scroll offset of the viewport.\n */\n get viewportScroll(): Positions {\n return this._latestCoords;\n }\n set viewportScroll(coords) {\n Object.assign(this._latestCoords, coords);\n const oldPos = this._scrollPosition;\n this._scrollPosition = this._latestCoords[this._positionDim];\n if (oldPos !== this._scrollPosition) {\n this._scrollPositionChanged(oldPos, this._scrollPosition);\n this._updateVisibleIndices({emit: true});\n }\n this._checkThresholds();\n }\n\n /**\n * Perform a reflow if one has been scheduled.\n */\n reflowIfNeeded(force: boolean) {\n if (force || this._pendingReflow) {\n this._pendingReflow = false;\n this._reflow();\n }\n }\n\n /**\n * Scroll to the child at the given index, and the given position within that\n * child.\n */\n scrollToIndex(index: number, position = 'start') {\n if (!Number.isFinite(index))\n return;\n index = Math.min(this.totalItems, Math.max(0, index));\n this._scrollToIndex = index;\n if (position === 'nearest') {\n position = index > this._first + this._num / 2 ? 'end' : 'start';\n }\n switch (position) {\n case 'start':\n this._scrollToAnchor = 0;\n break;\n case 'center':\n this._scrollToAnchor = 0.5;\n break;\n case 'end':\n this._scrollToAnchor = 1;\n break;\n default:\n throw new TypeError(\n 'position must be one of: start, center, end, nearest');\n }\n this._scheduleReflow();\n }\n\n async dispatchEvent(evt: Event) {\n await this._eventTargetPromise;\n this._eventTarget!.dispatchEvent(evt);\n }\n\n async addEventListener(type: string, listener: EventListener | EventListenerObject | null, options?: boolean | AddEventListenerOptions | undefined) {\n await this._eventTargetPromise;\n this._eventTarget!.addEventListener(type, listener, options);\n }\n\n async removeEventListener(type: string, callback: EventListener | EventListenerObject | null, options?: boolean | EventListenerOptions | undefined) {\n await this._eventTargetPromise;\n this._eventTarget!.removeEventListener(type, callback, options);\n }\n\n /**\n * Get the top and left positioning of the item at idx.\n */\n abstract _getItemPosition(idx: number): Positions;\n\n /**\n * Update _first and _last based on items that should be in the current\n * range.\n */\n abstract _getActiveItems(): void;\n\n protected _itemDim2Changed() {\n // Override\n }\n\n protected _viewDim2Changed() {\n // Override\n }\n\n protected _updateLayout() {\n // Override\n }\n\n protected _getItemSize(_idx: number): Size {\n return {\n [this._sizeDim]: this._itemDim1,\n [this._secondarySizeDim]: this._itemDim2,\n } as unknown as Size;\n }\n\n /**\n * The size of an item in the scrolling direction + space between items.\n */\n protected get _delta(): number {\n return this._itemDim1 + this._spacing;\n }\n\n /**\n * The height or width of an item, whichever corresponds to the scrolling direction.\n */\n protected get _itemDim1(): number {\n return this._itemSize[this._sizeDim];\n }\n\n /**\n * The height or width of an item, whichever does NOT correspond to the scrolling direction.\n */\n protected get _itemDim2(): number {\n return this._itemSize[this._secondarySizeDim];\n }\n\n /**\n * The height or width of the viewport, whichever corresponds to the scrolling direction.\n */\n protected get _viewDim1(): number {\n return this._viewportSize[this._sizeDim];\n }\n\n /**\n * The height or width of the viewport, whichever does NOT correspond to the scrolling direction.\n */\n protected get _viewDim2(): number {\n return this._viewportSize[this._secondarySizeDim];\n }\n\n protected _scheduleReflow() {\n this._pendingReflow = true;\n }\n\n protected _scheduleLayoutUpdate() {\n this._pendingLayoutUpdate = true;\n this._scheduleReflow();\n }\n\n protected _reflow() {\n const {_first, _last, _scrollSize} = this;\n\n if (this._pendingLayoutUpdate) {\n this._updateLayout();\n this._pendingLayoutUpdate = false;\n }\n this._updateScrollSize();\n this._getActiveItems();\n this._scrollIfNeeded();\n this._updateVisibleIndices();\n\n if (this._scrollSize !== _scrollSize) {\n this._emitScrollSize();\n }\n\n if (this._first === -1 && this._last === -1) {\n // TODO: have default empty object for emitRange instead\n this._emitRange();\n } else if (\n this._first !== _first || this._last !== _last ||\n this._spacingChanged) {\n // TODO: have default empty object for emitRange instead\n this._emitRange();\n this._emitChildPositions();\n }\n this._emitScrollError();\n }\n\n /**\n * Estimates the total length of all items in the scrolling direction, including spacing.\n */\n protected _updateScrollSize() {\n // Ensure we have at least 1px - this allows getting at least 1 item to be\n // rendered.\n this._scrollSize = Math.max(1, this._totalItems * this._delta);\n }\n\n protected _scrollIfNeeded() {\n if (this._scrollToIndex === -1) {\n return;\n }\n const index = this._scrollToIndex;\n const anchor = this._scrollToAnchor;\n const pos = this._getItemPosition(index)[this._positionDim];\n const size = this._getItemSize(index)[this._sizeDim];\n\n const curAnchorPos = this._scrollPosition + this._viewDim1 * anchor;\n const newAnchorPos = pos + size * anchor;\n // Ensure scroll position is an integer within scroll bounds.\n const scrollPosition = Math.floor(Math.min(\n this._scrollSize - this._viewDim1,\n Math.max(0, this._scrollPosition - curAnchorPos + newAnchorPos)));\n this._scrollError += this._scrollPosition - scrollPosition;\n this._scrollPosition = scrollPosition;\n }\n\n protected _emitRange(inProps: unknown = undefined) {\n const detail = Object.assign(\n {\n first: this._first,\n last: this._last,\n num: this._num,\n stable: true,\n firstVisible: this._firstVisible,\n lastVisible: this._lastVisible,\n },\n inProps);\n this.dispatchEvent(new CustomEvent('rangechange', {detail}));\n }\n\n protected _emitScrollSize() {\n const detail = {\n [this._sizeDim]: this._scrollSize,\n };\n this.dispatchEvent(new CustomEvent('scrollsizechange', {detail}));\n }\n\n protected _emitScrollError() {\n if (this._scrollError) {\n const detail = {\n [this._positionDim]: this._scrollError,\n [this._secondaryPositionDim]: 0,\n };\n this.dispatchEvent(new CustomEvent('scrollerrorchange', {detail}));\n this._scrollError = 0;\n }\n }\n\n /**\n * Get or estimate the top and left positions of items in the current range.\n * Emit an itempositionchange event with these positions.\n */\n protected _emitChildPositions() {\n const detail: {[key: number]: Positions} = {};\n for (let idx = this._first; idx <= this._last; idx++) {\n detail[idx] = this._getItemPosition(idx);\n }\n this.dispatchEvent(new CustomEvent('itempositionchange', {detail}));\n }\n\n /**\n * Number of items to display.\n */\n private get _num(): number {\n if (this._first === -1 || this._last === -1) {\n return 0;\n }\n return this._last - this._first + 1;\n }\n\n private _checkThresholds() {\n if (this._viewDim1 === 0 && this._num > 0) {\n this._scheduleReflow();\n } else {\n const min = Math.max(0, this._scrollPosition - this._overhang);\n const max = Math.min(\n this._scrollSize,\n this._scrollPosition + this._viewDim1 + this._overhang);\n if (this._physicalMin > min || this._physicalMax < max) {\n this._scheduleReflow();\n }\n }\n }\n\n /**\n * Find the indices of the first and last items to intersect the viewport.\n * Emit a visibleindiceschange event when either index changes.\n */\n protected _updateVisibleIndices(options?: UpdateVisibleIndicesOptions) {\n if (this._first === -1 || this._last === -1) return;\n\n let firstVisible = this._first;\n while (\n Math.round(\n this._getItemPosition(firstVisible)[this._positionDim] +\n this._getItemSize(firstVisible)[this._sizeDim]\n )\n <=\n Math.round (this._scrollPosition)\n ) {\n firstVisible++;\n }\n\n let lastVisible = this._last;\n while (\n Math.round(this._getItemPosition(lastVisible)[this._positionDim])\n >=\n Math.round(this._scrollPosition + this._viewDim1)\n ) {\n lastVisible--;\n }\n\n if (firstVisible !== this._firstVisible || lastVisible !== this._lastVisible) {\n this._firstVisible = firstVisible;\n this._lastVisible = lastVisible;\n if (options && options.emit) {\n this._emitRange();\n }\n }\n }\n\n private _scrollPositionChanged(oldPos: number, newPos: number) {\n // When both values are bigger than the max scroll position, keep the\n // current _scrollToIndex, otherwise invalidate it.\n const maxPos = this._scrollSize - this._viewDim1;\n if (oldPos < maxPos || newPos < maxPos) {\n this._scrollToIndex = -1;\n }\n }\n}\n"]}
-\ No newline at end of file
-diff --git a/lib/uni-virtualizer/lib/layouts/Layout1dFlex.d.ts b/lib/uni-virtualizer/lib/layouts/Layout1dFlex.d.ts
-index b4f6e54f539aef2a2ecd0399237e3d59a57a8a1f..e6aadd4b26ce97a862ca1051c6ecb08467347162 100644
---- a/lib/uni-virtualizer/lib/layouts/Layout1dFlex.d.ts
-+++ b/lib/uni-virtualizer/lib/layouts/Layout1dFlex.d.ts
-@@ -1,11 +1,14 @@
--import { Layout1dBase } from './Layout1dBase';
--import { ItemBox, Positions, Size, LayoutConfig, Type } from './Layout';
--export interface Layout1dFlexConfig extends LayoutConfig {
-- type?: Type;
-- direction?: "horizontal" | "vertical";
-+import { Layout1dBase, Layout1dBaseConfig } from './Layout1dBase';
-+import { ItemBox, Positions, Size } from './Layout';
-+interface Layout1dFlexConfig extends Layout1dBaseConfig {
- spacing?: number;
- idealSize?: number;
- }
-+declare type Layout1dFlexSpecifier = Layout1dFlexConfig & {
-+ type: new (config?: Layout1dFlexConfig) => Layout1dFlex;
-+};
-+declare type Layout1dFlexSpecifierFactory = (config?: Layout1dFlexConfig) => Layout1dFlexSpecifier;
-+export declare const layout1dFlex: Layout1dFlexSpecifierFactory;
- interface Rolumn {
- _startIdx: number;
- _endIdx: number;
-@@ -21,35 +24,33 @@ interface Chunk {
- /**
- * TODO @straversi: document and test this Layout.
- */
--export declare class Layout1dFlex extends Layout1dBase {
-+export declare class Layout1dFlex extends Layout1dBase {
- private _itemSizes;
- private _chunkSize;
- private _chunks;
- private _aspectRatios;
- private _numberOfAspectRatiosMeasured;
-- protected _idealSize: number;
-+ protected _idealSize: number | null;
- protected _config: Layout1dFlexConfig;
-- protected static _defaultConfig: Layout1dFlexConfig;
-+ protected _defaultConfig: Layout1dFlexConfig;
- listenForChildLoadEvents: boolean;
-- measureChildren: ((e: Element, i: object) => object);
-- set idealSize(px: number);
-- get idealSize(): number;
-+ /**
-+ * TODO graynorton@ Don't hard-code Flickr - probably need a config option
-+ */
-+ measureChildren: ((e: Element, i: unknown) => (ItemBox));
-+ set idealSize(px: number | null);
-+ get idealSize(): number | null;
- updateItemSizes(sizes: {
- [key: number]: ItemBox;
- }): void;
- _newChunk(): {
-- _rolumns: any[];
-- _itemPositions: any[];
-+ _rolumns: never[];
-+ _itemPositions: never[];
- _size: number;
- _dirty: boolean;
- };
-- _getChunk(idx: number | string): {
-- _rolumns: any[];
-- _itemPositions: any[];
-- _size: number;
-- _dirty: boolean;
-- };
-- _recordAspectRatio(dims: any): void;
-+ _getChunk(idx: number | string): Chunk;
-+ _recordAspectRatio(dims: ItemBox): void;
- _getRandomAspectRatio(): Size;
- _viewDim2Changed(): void;
- _getActiveItems(): void;
-diff --git a/lib/uni-virtualizer/lib/layouts/Layout1dFlex.d.ts.map b/lib/uni-virtualizer/lib/layouts/Layout1dFlex.d.ts.map
-index a899016165645dce6a8326b41733b024ed5d4e3d..de4bacef32254ea5dd92cfff32da4d1c83d31950 100644
---- a/lib/uni-virtualizer/lib/layouts/Layout1dFlex.d.ts.map
-+++ b/lib/uni-virtualizer/lib/layouts/Layout1dFlex.d.ts.map
-@@ -1 +1 @@
--{"version":3,"file":"Layout1dFlex.d.ts","sourceRoot":"","sources":["../../../../src/lib/uni-virtualizer/lib/layouts/Layout1dFlex.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,YAAY,EAAC,MAAM,gBAAgB,CAAC;AAC5C,OAAO,EAAC,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,YAAY,EAAE,IAAI,EAAC,MAAM,UAAU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;;;;;IAI9B,kBAAkB,CAAC,IAAI,KAAA;IAavB,qBAAqB,IAAI,IAAI;IAa7B,gBAAgB;IAIhB,eAAe;IA2Bf,gBAAgB,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS;IAKxC,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI;IAM/B,mBAAmB,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI;IAStC,YAAY,CAAC,QAAQ,EAAE,MAAM;IA+D7B,aAAa,IAAI,IAAI;IAYrB,iBAAiB;CAOlB"}
-\ No newline at end of file
-+{"version":3,"file":"Layout1dFlex.d.ts","sourceRoot":"","sources":["../../../../src/lib/uni-virtualizer/lib/layouts/Layout1dFlex.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,YAAY,EAAE,kBAAkB,EAAC,MAAM,gBAAgB,CAAC;AAChE,OAAO,EAAC,OAAO,EAAE,SAAS,EAAE,IAAI,EAAC,MAAM,UAAU,CAAC;AAElD,UAAU,kBAAmB,SAAQ,kBAAkB;IACrD,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB;AAED,aAAK,qBAAqB,GAAG,kBAAkB,GAAG;IAChD,IAAI,EAAE,KAAI,MAAM,CAAC,EAAE,kBAAkB,KAAK,YAAY,CAAA;CACvD,CAAA;AAED,aAAK,4BAA4B,GAAG,CAAC,MAAM,CAAC,EAAE,kBAAkB,KAAK,qBAAqB,CAAC;AAE3F,eAAO,MAAM,YAAY,EAAE,4BAEjB,CAAC;AAEX,UAAU,MAAM;IACd,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,MAAM,CAAA;CACd;AAED,UAAU,KAAK;IACb,cAAc,EAAE,KAAK,CAAC,SAAS,CAAC,CAAC;IACjC,QAAQ,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IACxB,KAAK,EAAE,MAAM,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150f6ca99fb12..00b54b50b3e4977d706846e4f139a6e91f15c615 100644
---- a/lib/uni-virtualizer/lib/layouts/Layout1dFlex.js
-+++ b/lib/uni-virtualizer/lib/layouts/Layout1dFlex.js
-@@ -1,4 +1,7 @@
- import { Layout1dBase } from './Layout1dBase';
-+export const layout1dFlex = (config) => Object.assign({
-+ type: Layout1dFlex
-+}, config);
- /**
- * TODO @straversi: document and test this Layout.
- */
-@@ -6,16 +9,33 @@ export class Layout1dFlex extends Layout1dBase {
- constructor() {
- super(...arguments);
- this._itemSizes = [];
-+ // private _itemPositions: Array = [];
-+ // private _rolumnStartIdx: Array = [];
-+ // private _rolumnStartPos: Array = [];
-+ this._chunkSize = null;
- this._chunks = [];
- this._aspectRatios = {};
- this._numberOfAspectRatiosMeasured = 0;
-+ this._idealSize = null;
- this._config = {};
-+ this._defaultConfig = Object.assign({}, super._defaultConfig, {
-+ spacing: 0,
-+ idealSize: 200
-+ });
- this.listenForChildLoadEvents = true;
-+ /**
-+ * TODO graynorton@ Don't hard-code Flickr - probably need a config option
-+ */
- this.measureChildren = function (e, i) {
-- return {
-- width: i['o_width'] || e.naturalWidth || undefined,
-- height: i['o_height'] || e.naturalHeight || undefined
-- };
-+ const { naturalWidth, naturalHeight } = e;
-+ if (naturalWidth !== undefined && naturalHeight != undefined) {
-+ return { width: naturalWidth, height: naturalHeight };
-+ }
-+ const { o_width, o_height } = i;
-+ if (o_width !== undefined && o_height !== undefined) {
-+ return { width: o_width, height: o_height };
-+ }
-+ return { width: -1, height: -1 };
- };
- }
- set idealSize(px) {
-@@ -31,15 +51,16 @@ export class Layout1dFlex extends Layout1dBase {
- updateItemSizes(sizes) {
- let dirty;
- Object.keys(sizes).forEach((key) => {
-- const chunk = this._getChunk(key);
-- const dims = sizes[key];
-- const prevDims = this._itemSizes[key];
-+ const n = Number(key);
-+ const chunk = this._getChunk(n);
-+ const dims = sizes[n];
-+ const prevDims = this._itemSizes[n];
- if (dims.width && dims.height) {
- if (!prevDims || prevDims.width !== dims.width || prevDims.height !== dims.height) {
- chunk._dirty = true;
- dirty = true;
-- this._itemSizes[Number(key)] = sizes[key];
-- this._recordAspectRatio(sizes[key]);
-+ this._itemSizes[n] = sizes[n];
-+ this._recordAspectRatio(sizes[n]);
- }
- }
- });
-@@ -121,7 +142,7 @@ export class Layout1dFlex extends Layout1dBase {
- }
- _getNaturalItemDims(idx) {
- let itemDims = this._itemSizes[idx];
-- if (itemDims === undefined || itemDims.width === undefined || itemDims.height === undefined) {
-+ if (itemDims === undefined || itemDims.width === -1 || itemDims.height === -1) {
- itemDims = this._getRandomAspectRatio();
- }
- return itemDims;
-@@ -208,8 +229,4 @@ export class Layout1dFlex extends Layout1dBase {
- // (this._spacing * 2);
- }
- }
--Layout1dFlex._defaultConfig = {
-- direction: 'vertical',
-- spacing: 0,
-- idealSize: 200
--};
-+//# sourceMappingURL=Layout1dFlex.js.map
-\ No newline at end of file
-diff --git a/lib/uni-virtualizer/lib/layouts/Layout1dFlex.js.map b/lib/uni-virtualizer/lib/layouts/Layout1dFlex.js.map
-new file mode 100644
-index 0000000000000000000000000000000000000000..1d93aa6da4cc4a62ce585a3d6261549773c8d855
---- /dev/null
-+++ b/lib/uni-virtualizer/lib/layouts/Layout1dFlex.js.map
-@@ -0,0 +1 @@
-+{"version":3,"file":"Layout1dFlex.js","sourceRoot":"","sources":["../../../../src/lib/uni-virtualizer/lib/layouts/Layout1dFlex.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,YAAY,EAAqB,MAAM,gBAAgB,CAAC;AAchE,MAAM,CAAC,MAAM,YAAY,GAAiC,CAAC,MAA2B,EAAE,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC;IACvG,IAAI,EAAE,YAAY;CACnB,EAAE,MAAM,CAAC,CAAC;AA6BX;;GAEG;AACH,MAAM,OAAO,YAAa,SAAQ,YAAgC;IAAlE;;QACU,eAAU,GAAgB,EAAE,CAAC;QACrC,iDAAiD;QACjD,+CAA+C;QAC/C,+CAA+C;QACv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AAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,GAAG,CAAC,CAAC,GAAG,IAAI,CAAC,QAAQ,CAAC,CAAC;QAC7F,wDAAwD;QACxD,mEAAmE;QACnE,uBAAuB;IAC7B,CAAC;CACF","sourcesContent":["import {Layout1dBase, Layout1dBaseConfig} from './Layout1dBase';\nimport {ItemBox, Positions, Size} from './Layout';\n\ninterface Layout1dFlexConfig extends Layout1dBaseConfig {\n spacing?: number,\n idealSize?: number\n}\n\ntype Layout1dFlexSpecifier = Layout1dFlexConfig & {\n type: new(config?: Layout1dFlexConfig) => Layout1dFlex\n}\n\ntype Layout1dFlexSpecifierFactory = (config?: Layout1dFlexConfig) => Layout1dFlexSpecifier;\n\nexport const layout1dFlex: Layout1dFlexSpecifierFactory = (config?: Layout1dFlexConfig) => Object.assign({\n type: Layout1dFlex\n}, config);\n\ninterface Rolumn {\n _startIdx: number,\n _endIdx: number,\n _startPos: number,\n _size: number\n}\n\ninterface Chunk {\n _itemPositions: Array,\n _rolumns: Array,\n _size: number,\n _dirty: boolean\n}\n\ninterface AspectRatios {\n // conceptually, key is a number, but strictly speaking it's a string\n [key: string]: number\n}\n\n/**\n * TODO graynorton@ Don't hard-code Flickr - probably need a config option\n */\n interface FlickrImageData {\n o_width: number,\n o_height: number\n}\n\n/**\n * TODO @straversi: document and test this Layout.\n */\nexport class Layout1dFlex extends Layout1dBase {\n private _itemSizes: Array = [];\n // private _itemPositions: Array = [];\n // private _rolumnStartIdx: Array = [];\n // private _rolumnStartPos: Array = [];\n private _chunkSize: number | null = null;\n private _chunks: Array = [];\n private _aspectRatios: AspectRatios = {};\n private _numberOfAspectRatiosMeasured: number = 0;\n protected _idealSize: number | null = null;\n protected _config: Layout1dFlexConfig = {};\n protected _defaultConfig: Layout1dFlexConfig = Object.assign({}, super._defaultConfig, {\n spacing: 0,\n idealSize: 200\n });\n\n listenForChildLoadEvents = true;\n\n/**\n * TODO graynorton@ Don't hard-code Flickr - probably need a config option\n */\n measureChildren: ((e: Element, i: unknown) => (ItemBox)) = function (e, i) {\n const { naturalWidth, naturalHeight } = e as HTMLImageElement;\n if (naturalWidth !== undefined && naturalHeight != undefined) {\n return { width: naturalWidth, height: naturalHeight };\n }\n const { o_width, o_height } = i as FlickrImageData;\n if (o_width !== undefined && o_height !== undefined) {\n return { width: o_width, height: o_height };\n }\n return { width: -1, height: -1 };\n }\n\n set idealSize(px) {\n const _px = Number(px);\n if (_px !== this._idealSize) {\n this._idealSize = _px;\n this._scheduleLayoutUpdate();\n }\n }\n\n get idealSize() {\n return this._idealSize;\n }\n\n updateItemSizes(sizes: {[key: number]: ItemBox}) {\n let dirty;\n Object.keys(sizes).forEach((key) => {\n const n = Number(key);\n const chunk = this._getChunk(n);\n const dims = sizes[n];\n const prevDims = this._itemSizes[n];\n if (dims.width && dims.height) {\n if (!prevDims || prevDims.width !== dims.width || prevDims.height !== dims.height) {\n chunk._dirty = true;\n dirty = true;\n this._itemSizes[n] = sizes[n];\n this._recordAspectRatio(sizes[n]);\n }\n }\n });\n if (dirty) {\n this._scheduleLayoutUpdate();\n }\n }\n\n _newChunk() {\n return {\n ['_rolumns']: [],\n _itemPositions: [],\n _size: 0,\n _dirty: false \n }\n }\n\n _getChunk(idx: number | string) {\n return this._chunks[Math.floor(Number(idx) / this._chunkSize!)] || this._newChunk();\n }\n\n _recordAspectRatio(dims: ItemBox) {\n if (dims.width && dims.height) {\n const bucket = Math.round(dims.width / dims.height * 10) / 10;\n if (this._aspectRatios[bucket]) {\n this._aspectRatios[bucket]++;\n }\n else {\n this._aspectRatios[bucket] = 1;\n }\n this._numberOfAspectRatiosMeasured++; \n }\n }\n\n _getRandomAspectRatio(): Size {\n if (this._numberOfAspectRatiosMeasured === 0) {\n return {width: 1, height: 1};\n }\n const n = Math.random() * this._numberOfAspectRatiosMeasured;\n const buckets = Object.keys(this._aspectRatios);\n let i = -1, m = 0;\n while (m < n && i < buckets.length) {\n m += this._aspectRatios[buckets[++i]];\n }\n return {width: Number(buckets[i]), height: 1};\n}\n\n _viewDim2Changed() {\n this._scheduleLayoutUpdate();\n }\n\n _getActiveItems() {\n const chunk = this._getChunk(0);\n if (chunk._rolumns.length === 0) return;\n const scrollPos = Math.max(0, Math.min(this._scrollPosition, this._scrollSize - this._viewDim1));\n const min = Math.max(0, scrollPos - this._overhang);\n const max = Math.min(\n this._scrollSize,\n scrollPos + this._viewDim1 + this._overhang);\n const mid = (min + max) / 2;\n const estMidRolumn = Math.round((mid / this._scrollSize) * chunk._rolumns.length);\n let idx = estMidRolumn;\n while (chunk._rolumns[idx]._startPos < min) {\n idx++;\n }\n while (chunk._rolumns[idx]._startPos > min) {\n idx--;\n }\n this._first = chunk._rolumns[idx]._startIdx;\n this._physicalMin = chunk._rolumns[idx]._startPos;\n let rolumnMax;\n while ((rolumnMax = chunk._rolumns[idx]._startPos + chunk._rolumns[idx]._size + (this._spacing * 2)) < max) {\n idx++;\n }\n this._last = chunk._rolumns[idx]._endIdx;\n this._physicalMax = rolumnMax;\n }\n\n _getItemPosition(idx: number): Positions {\n const chunk = this._getChunk(0);\n return chunk._itemPositions[idx];\n }\n\n _getItemSize(idx: number): Size {\n const chunk = this._getChunk(0);\n const {width, height} = chunk._itemPositions[idx];\n return {width, height} as Size;\n }\n\n _getNaturalItemDims(idx: number): Size {\n let itemDims = this._itemSizes[idx];\n if (itemDims === undefined || itemDims.width === -1 || itemDims.height === -1) {\n itemDims = this._getRandomAspectRatio();\n }\n return itemDims;\n }\n\n\n _layOutChunk(startIdx: number) {\n const chunk: Chunk = this._newChunk();\n let startPos = this._spacing;\n let idx = 0;\n let rolumnSize2 = 0;\n let lastRatio = Infinity;\n const finishRolumn = (lastIdx: number) => {\n const rolumn = {\n _startIdx: startIdx,\n _endIdx: lastIdx,\n _startPos: startPos - this._spacing,\n _size: 0\n }\n chunk._rolumns.push(rolumn);\n let itemStartPos = this._spacing;\n for (let i = startIdx; i <= lastIdx; i++) {\n const pos = chunk._itemPositions[i];\n pos.width = pos.width! * lastRatio;\n pos.height = pos.height! * lastRatio;\n pos.left = this._positionDim === 'left' ? startPos : itemStartPos;\n pos.top = this._positionDim === 'top' ? startPos : itemStartPos;\n itemStartPos += pos[this._secondarySizeDim]! + this._spacing;\n }\n rolumn._size = chunk._itemPositions[lastIdx][this._sizeDim]!;\n }\n while (idx < this._chunkSize!) {\n const itemDims = this._getNaturalItemDims(idx);\n const availableSpace = this._viewDim2 - (this._spacing * (idx - startIdx + 2));\n const itemSize = itemDims[this._sizeDim];\n const itemSize2 = itemDims[this._secondarySizeDim];\n const idealScaleFactor = this._idealSize! / itemSize;\n const adjItemSize = idealScaleFactor * itemSize;\n const adjItemSize2 = idealScaleFactor * itemSize2;\n chunk._itemPositions[idx] = {\n left: 0,\n top: 0,\n width: (this._sizeDim === 'width' ? adjItemSize : adjItemSize2),\n height: (this._sizeDim === 'height' ? adjItemSize : adjItemSize2)\n };\n const ratio = availableSpace / (rolumnSize2 + adjItemSize2);\n if (Math.abs(1 - ratio) > Math.abs(1 - lastRatio)) {\n // rolumn is better without adding this item\n finishRolumn(idx - 1);\n startIdx = idx;\n startPos += (this._idealSize! * lastRatio) + this._spacing;\n lastRatio = (this._viewDim2 - (2 * this._spacing)) / adjItemSize2;\n rolumnSize2 = adjItemSize2;\n }\n else {\n // add this item and continue\n rolumnSize2 += adjItemSize2;\n lastRatio = ratio;\n }\n if (idx === this._chunkSize! - 1) {\n finishRolumn(idx);\n }\n idx++;\n }\n const lastRolumn = chunk._rolumns[chunk._rolumns.length - 1];\n chunk._size = lastRolumn._startPos + lastRolumn._size;\n return chunk; \n }\n\n _updateLayout(): void {\n if (/*this._rolumnStartIdx === undefined ||*/ this._viewDim2 === 0) return;\n this._chunkSize = Math.ceil(2 * (this._viewDim1 * this._viewDim2) / (this._idealSize! * this._idealSize!));\n console.log('chunkSize', this._chunkSize);\n // TODO: An odd place to do this, need to think through the logistics of getting size info to the layout\n // in all cases\n // this._itemSizes.length = 100;//this._totalItems;\n this._chunks[0] = this._layOutChunk(0);\n // TODO (graynorton): This is a hack to force reflow\n this._spacingChanged = true;\n}\n\n _updateScrollSize() {\n const chunk = this._chunks[0];\n this._scrollSize = !chunk || chunk._rolumns.length === 0 ? 1 : chunk._size + (2 * this._spacing);\n // chunk._rolumns[chunk._rolumns.length - 1]._startPos +\n // chunk._itemPositions[chunk._rolumns.length - 1][this._sizeDim] +\n // (this._spacing * 2);\n }\n}"]}
-\ No newline at end of file
-diff --git a/lib/uni-virtualizer/lib/layouts/Layout1dGrid.d.ts b/lib/uni-virtualizer/lib/layouts/Layout1dGrid.d.ts
-index c8f7a5c894287d49c6855481a653259422131db1..39633e64c311e105edf9bd9c8ed63e8ab73d26f5 100644
---- a/lib/uni-virtualizer/lib/layouts/Layout1dGrid.d.ts
-+++ b/lib/uni-virtualizer/lib/layouts/Layout1dGrid.d.ts
-@@ -2,9 +2,8 @@ import { Layout1dBase } from './Layout1dBase.js';
- /**
- * TODO @straversi: document and test this Layout.
- */
--export declare abstract class Layout1dGrid extends Layout1dBase {
-- protected _rolumns: any;
-- constructor(config: any);
-+export declare abstract class Layout1dGrid extends Layout1dBase {
-+ protected _rolumns: number;
- _viewDim2Changed(): void;
- _itemDim2Changed(): void;
- _getActiveItems(): void;
-diff --git a/lib/uni-virtualizer/lib/layouts/Layout1dGrid.d.ts.map b/lib/uni-virtualizer/lib/layouts/Layout1dGrid.d.ts.map
-index 748cb292f3329dbbcebac625ab7955a6b8683e66..ed14c15459b9a49e0a8b7d28c09fde366ed3d32b 100644
---- a/lib/uni-virtualizer/lib/layouts/Layout1dGrid.d.ts.map
-+++ b/lib/uni-virtualizer/lib/layouts/Layout1dGrid.d.ts.map
-@@ -1 +1 @@
--{"version":3,"file":"Layout1dGrid.d.ts","sourceRoot":"","sources":["../../../../src/lib/uni-virtualizer/lib/layouts/Layout1dGrid.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,YAAY,EAAC,MAAM,mBAAmB,CAAC;AAE/C;;GAEG;AACH,8BAAsB,YAAa,SAAQ,YAAY;IACrD,SAAS,CAAC,QAAQ,MAAC;gBAEP,MAAM,KAAA;IAKlB,gBAAgB;IAIhB,gBAAgB;IAIhB,eAAe;IAef,gBAAgB,CAAC,GAAG,EAAE,MAAM,GAAG;QAAC,GAAG,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAC;IAQ1D,iBAAiB;CAIlB"}
-\ No newline at end of file
-+{"version":3,"file":"Layout1dGrid.d.ts","sourceRoot":"","sources":["../../../../src/lib/uni-virtualizer/lib/layouts/Layout1dGrid.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,YAAY,EAAC,MAAM,mBAAmB,CAAC;AAE/C;;GAEG;AACH,8BAAsB,YAAY,CAAC,MAAM,CAAE,SAAQ,YAAY,CAAC,MAAM,CAAC;IACrE,SAAS,CAAC,QAAQ,EAAE,MAAM,CAAK;IAO/B,gBAAgB;IAIhB,gBAAgB;IAIhB,eAAe;IAef,gBAAgB,CAAC,GAAG,EAAE,MAAM,GAAG;QAAC,GAAG,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAC;IAQ1D,iBAAiB;CAIlB"}
-\ No newline at end of file
-diff --git a/lib/uni-virtualizer/lib/layouts/Layout1dGrid.js b/lib/uni-virtualizer/lib/layouts/Layout1dGrid.js
-index 24db275ef90173740b73488f8816fbf3344dff78..f9fdf72e948f74f384cb655887b12862afde5547 100644
---- a/lib/uni-virtualizer/lib/layouts/Layout1dGrid.js
-+++ b/lib/uni-virtualizer/lib/layouts/Layout1dGrid.js
-@@ -3,10 +3,14 @@ import { Layout1dBase } from './Layout1dBase.js';
- * TODO @straversi: document and test this Layout.
- */
- export class Layout1dGrid extends Layout1dBase {
-- constructor(config) {
-- super(config);
-+ constructor() {
-+ super(...arguments);
- this._rolumns = 1;
- }
-+ // constructor(config) {
-+ // super(config);
-+ // this._rolumns = 1;
-+ // }
- _viewDim2Changed() {
- this._scheduleLayoutUpdate();
- }
-@@ -36,3 +40,4 @@ export class Layout1dGrid extends Layout1dBase {
- Math.max(1, Math.ceil(this._totalItems / this._rolumns) * this._delta + this._spacing);
- }
- }
-+//# sourceMappingURL=Layout1dGrid.js.map
-\ No newline at end of file
-diff --git a/lib/uni-virtualizer/lib/layouts/Layout1dGrid.js.map b/lib/uni-virtualizer/lib/layouts/Layout1dGrid.js.map
-new file mode 100644
-index 0000000000000000000000000000000000000000..d5b5318d4d7ba2efa45ae788e5ef20563707af2d
---- /dev/null
-+++ b/lib/uni-virtualizer/lib/layouts/Layout1dGrid.js.map
-@@ -0,0 +1 @@
-+{"version":3,"file":"Layout1dGrid.js","sourceRoot":"","sources":["../../../../src/lib/uni-virtualizer/lib/layouts/Layout1dGrid.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,YAAY,EAAC,MAAM,mBAAmB,CAAC;AAE/C;;GAEG;AACH,MAAM,OAAgB,YAAqB,SAAQ,YAAoB;IAAvE;;QACY,aAAQ,GAAW,CAAC,CAAC;IA0CjC,CAAC;IAxCC,wBAAwB;IACxB,mBAAmB;IACnB,uBAAuB;IACvB,IAAI;IAEJ,gBAAgB;QACd,IAAI,CAAC,qBAAqB,EAAE,CAAC;IAC/B,CAAC;IAED,gBAAgB;QACd,IAAI,CAAC,qBAAqB,EAAE,CAAC;IAC/B,CAAC;IAED,eAAe;QACb,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,eAAe,GAAG,IAAI,CAAC,SAAS,CAAC,CAAC;QAC/D,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,CAChB,IAAI,CAAC,WAAW,EAChB,IAAI,CAAC,eAAe,GAAG,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,SAAS,CAAC,CAAC;QAC5D,MAAM,QAAQ,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,GAAG,IAAI,CAAC,MAAM,CAAC,CAAC;QAC/C,MAAM,OAAO,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,GAAG,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;QAEjD,IAAI,CAAC,MAAM,GAAG,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC;QACvC,IAAI,CAAC,KAAK;YACN,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,OAAO,GAAG,CAAC,CAAC,GAAG,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,IAAI,CAAC,WAAW,GAAG,CAAC,CAAC,CAAC;QACxE,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC,MAAM,GAAG,QAAQ,CAAC;QAC3C,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC,MAAM,GAAG,CAAC,OAAO,GAAG,CAAC,CAAC,CAAC;IAClD,CAAC;IAED,gBAAgB,CAAC,GAAW;QAC1B,OAAO;YACL,CAAC,IAAI,CAAC,YAAY,CAAC,EAAE,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,GAAG,IAAI,CAAC,QAAQ,CAAC,GAAG,IAAI,CAAC,MAAM;YAC9E,CAAC,IAAI,CAAC,qBAAqB,CAAC,EAAE,IAAI,CAAC,QAAQ;gBAC3C,CAAC,CAAC,GAAG,GAAG,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,SAAS,CAAC,CAAC;SACrB,CAAC;IAC9C,CAAC;IAED,iBAAiB;QACf,IAAI,CAAC,WAAW;YACZ,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,QAAQ,CAAC,GAAG,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,QAAQ,CAAC,CAAC;IAC7F,CAAC;CACF","sourcesContent":["import {Layout1dBase} from './Layout1dBase.js';\n\n/**\n * TODO @straversi: document and test this Layout.\n */\nexport abstract class Layout1dGrid extends Layout1dBase {\n protected _rolumns: number = 1;\n\n // constructor(config) {\n // super(config);\n // this._rolumns = 1;\n // }\n\n _viewDim2Changed() {\n this._scheduleLayoutUpdate();\n }\n\n _itemDim2Changed() {\n this._scheduleLayoutUpdate();\n }\n\n _getActiveItems() {\n const min = Math.max(0, this._scrollPosition - this._overhang);\n const max = Math.min(\n this._scrollSize,\n this._scrollPosition + this._viewDim1 + this._overhang);\n const firstCow = Math.floor(min / this._delta);\n const lastCow = Math.ceil(max / this._delta) - 1;\n\n this._first = firstCow * this._rolumns;\n this._last =\n Math.min(((lastCow + 1) * this._rolumns) - 1, this._totalItems - 1);\n this._physicalMin = this._delta * firstCow;\n this._physicalMax = this._delta * (lastCow + 1);\n }\n\n _getItemPosition(idx: number): {top: number, left: number} {\n return {\n [this._positionDim]: this._spacing + Math.floor(idx / this._rolumns) * this._delta,\n [this._secondaryPositionDim]: this._spacing +\n ((idx % this._rolumns) * (this._spacing + this._itemDim2))\n } as unknown as {top: number, left: number};\n }\n\n _updateScrollSize() {\n this._scrollSize =\n Math.max(1, Math.ceil(this._totalItems / this._rolumns) * this._delta + this._spacing);\n }\n}\n"]}
-\ No newline at end of file
-diff --git a/lib/uni-virtualizer/lib/layouts/Layout1dNaturalSizeGrid.d.ts b/lib/uni-virtualizer/lib/layouts/Layout1dNaturalSizeGrid.d.ts
-index aeb4125400544350993c7c2b5c934b5931b9d163..4e5324c76353f7af1f7f4d8f1981ff2684b258ab 100644
---- a/lib/uni-virtualizer/lib/layouts/Layout1dNaturalSizeGrid.d.ts
-+++ b/lib/uni-virtualizer/lib/layouts/Layout1dNaturalSizeGrid.d.ts
-@@ -1,6 +1,7 @@
- import { Layout1dGrid } from './Layout1dGrid.js';
-+import { Layout1dBaseConfig } from './Layout1dBase.js';
- import { ItemBox } from './Layout';
--export declare class Layout1dNaturalSizeGrid extends Layout1dGrid {
-+export declare class Layout1dNaturalSizeGrid extends Layout1dGrid {
- updateItemSizes(sizes: {
- [key: number]: ItemBox;
- }): void;
-diff --git a/lib/uni-virtualizer/lib/layouts/Layout1dNaturalSizeGrid.d.ts.map b/lib/uni-virtualizer/lib/layouts/Layout1dNaturalSizeGrid.d.ts.map
-index 602b691726e6fb10dd3c8e430253267e8f0bafcf..5b45aac00d294a71c6a6a6ba4a6fb75ff4530a98 100644
---- a/lib/uni-virtualizer/lib/layouts/Layout1dNaturalSizeGrid.d.ts.map
-+++ b/lib/uni-virtualizer/lib/layouts/Layout1dNaturalSizeGrid.d.ts.map
-@@ -1 +1 @@
--{"version":3,"file":"Layout1dNaturalSizeGrid.d.ts","sourceRoot":"","sources":["../../../../src/lib/uni-virtualizer/lib/layouts/Layout1dNaturalSizeGrid.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,YAAY,EAAC,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAC,OAAO,EAAC,MAAM,UAAU,CAAC;AAEjC,qBAAa,uBAAwB,SAAQ,YAAY;IACrD,eAAe,CAAC,KAAK,EAAE;QAAC,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;KAAC;IAQ7C,aAAa;CAYlB"}
-\ No newline at end of file
-+{"version":3,"file":"Layout1dNaturalSizeGrid.d.ts","sourceRoot":"","sources":["../../../../src/lib/uni-virtualizer/lib/layouts/Layout1dNaturalSizeGrid.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,YAAY,EAAC,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAC,kBAAkB,EAAC,MAAM,mBAAmB,CAAC;AACrD,OAAO,EAAC,OAAO,EAAC,MAAM,UAAU,CAAC;AAEjC,qBAAa,uBAAwB,SAAQ,YAAY,CAAC,kBAAkB,CAAC;IACzE,eAAe,CAAC,KAAK,EAAE;QAAC,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;KAAC;IAQ7C,aAAa;CAYlB"}
-\ No newline at end of file
-diff --git a/lib/uni-virtualizer/lib/layouts/Layout1dNaturalSizeGrid.js b/lib/uni-virtualizer/lib/layouts/Layout1dNaturalSizeGrid.js
-index 7ba0132588ff7979f3b004188241fa8334abaead..b188b16d0fe9a2889e18fa40f2a18377682632a4 100644
---- a/lib/uni-virtualizer/lib/layouts/Layout1dNaturalSizeGrid.js
-+++ b/lib/uni-virtualizer/lib/layouts/Layout1dNaturalSizeGrid.js
-@@ -20,3 +20,4 @@ export class Layout1dNaturalSizeGrid extends Layout1dGrid {
- this._spacingChanged = !(_spacing === this._spacing);
- }
- }
-+//# sourceMappingURL=Layout1dNaturalSizeGrid.js.map
-\ No newline at end of file
-diff --git a/lib/uni-virtualizer/lib/layouts/Layout1dNaturalSizeGrid.js.map b/lib/uni-virtualizer/lib/layouts/Layout1dNaturalSizeGrid.js.map
-new file mode 100644
-index 0000000000000000000000000000000000000000..cf506e8d0dcce673437abc94de413141f2cf4df8
---- /dev/null
-+++ b/lib/uni-virtualizer/lib/layouts/Layout1dNaturalSizeGrid.js.map
-@@ -0,0 +1 @@
-+{"version":3,"file":"Layout1dNaturalSizeGrid.js","sourceRoot":"","sources":["../../../../src/lib/uni-virtualizer/lib/layouts/Layout1dNaturalSizeGrid.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,YAAY,EAAC,MAAM,mBAAmB,CAAC;AAI/C,MAAM,OAAO,uBAAwB,SAAQ,YAAgC;IACzE,eAAe,CAAC,KAA+B;QAC3C,uCAAuC;QACvC,MAAM,IAAI,GAAG,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;QACrC,IAAI,IAAI,EAAE;YACR,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC;SACtB;IACH,CAAC;IAED,aAAa;QACX,MAAM,EAAC,QAAQ,EAAC,GAAG,IAAI,CAAC;QACxB,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC;QACzE,IAAI,IAAI,CAAC,QAAQ,GAAG,CAAC,EAAE;YACrB,IAAI,CAAC,QAAQ,GAAG,CAAC,IAAI,CAAC,SAAS,GAAG,CAAC,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,SAAS,CAAC,CAAC;gBAC/D,CAAC,IAAI,CAAC,QAAQ,GAAG,CAAC,CAAC,CAAC;SACzB;aACI;YACH,IAAI,CAAC,QAAQ,GAAG,CAAC,CAAC;SACnB;QACD,IAAI,CAAC,eAAe,GAAG,CAAC,CAAC,QAAQ,KAAK,IAAI,CAAC,QAAQ,CAAC,CAAC;IACvD,CAAC;CACN","sourcesContent":["import {Layout1dGrid} from './Layout1dGrid.js';\nimport {Layout1dBaseConfig} from './Layout1dBase.js';\nimport {ItemBox} from './Layout';\n\nexport class Layout1dNaturalSizeGrid extends Layout1dGrid {\n updateItemSizes(sizes: {[key: number]: ItemBox}) {\n // Assume all items have the same size.\n const size = Object.values(sizes)[0];\n if (size) {\n this.itemSize = size;\n }\n }\n \n _updateLayout() {\n const {_spacing} = this;\n this._rolumns = Math.max(1, Math.floor(this._viewDim2 / this._itemDim2));\n if (this._rolumns > 1) {\n this._spacing = (this._viewDim2 % (this._rolumns * this._itemDim2)) /\n (this._rolumns + 1);\n }\n else {\n this._spacing = 0;\n }\n this._spacingChanged = !(_spacing === this._spacing);\n } \n}"]}
-\ No newline at end of file
-diff --git a/lib/uni-virtualizer/lib/layouts/Layout1dSquareGrid.d.ts b/lib/uni-virtualizer/lib/layouts/Layout1dSquareGrid.d.ts
-index 6aea3ca7ab177d3750be3c5e0179cff8930dbf0b..f7d46726678162fc91735c45111fce60687c1dca 100644
---- a/lib/uni-virtualizer/lib/layouts/Layout1dSquareGrid.d.ts
-+++ b/lib/uni-virtualizer/lib/layouts/Layout1dSquareGrid.d.ts
-@@ -1,10 +1,20 @@
-+import { Layout1dBaseConfig } from './Layout1dBase.js';
- import { Layout1dGrid } from './Layout1dGrid.js';
- import { Positions } from './Layout.js';
--export declare class Layout1dSquareGrid extends Layout1dGrid {
-+interface Layout1dSquareGridConfig extends Layout1dBaseConfig {
-+ spacing?: number;
-+ idealSize?: number;
-+}
-+declare type Layout1dSquareGridSpecifier = Layout1dSquareGridConfig & {
-+ type: new (config?: Layout1dSquareGridConfig) => Layout1dSquareGrid;
-+};
-+declare type Layout1dSquareGridSpecifierFactory = (config?: Layout1dSquareGridConfig) => Layout1dSquareGridSpecifier;
-+export declare const layout1dSquareGrid: Layout1dSquareGridSpecifierFactory;
-+export declare class Layout1dSquareGrid extends Layout1dGrid {
- protected _idealSize: number;
-- constructor(config: any);
-- set idealSize(px: any);
-+ set idealSize(px: number);
- _getItemPosition(idx: number): Positions;
- _updateLayout(): void;
- }
-+export {};
- //# sourceMappingURL=Layout1dSquareGrid.d.ts.map
-\ No newline at end of file
-diff --git a/lib/uni-virtualizer/lib/layouts/Layout1dSquareGrid.d.ts.map b/lib/uni-virtualizer/lib/layouts/Layout1dSquareGrid.d.ts.map
-index a283b0668bda6eac853d0d53ad7d675f770ecfad..9fcaf8aa40d8116114cd4785986408c7ff0b0feb 100644
---- a/lib/uni-virtualizer/lib/layouts/Layout1dSquareGrid.d.ts.map
-+++ b/lib/uni-virtualizer/lib/layouts/Layout1dSquareGrid.d.ts.map
-@@ -1 +1 @@
--{"version":3,"file":"Layout1dSquareGrid.d.ts","sourceRoot":"","sources":["../../../../src/lib/uni-virtualizer/lib/layouts/Layout1dSquareGrid.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,YAAY,EAAC,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAC,SAAS,EAAC,MAAM,aAAa,CAAC;AAEtC,qBAAa,kBAAmB,SAAQ,YAAY;IAClD,SAAS,CAAC,UAAU,EAAE,MAAM,CAAC;gBAEjB,MAAM,KAAA;IAOlB,IAAI,SAAS,CAAC,EAAE,KAAA,EAKf;IAED,gBAAgB,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS;IAIxC,aAAa;CASd"}
-\ No newline at end of file
-+{"version":3,"file":"Layout1dSquareGrid.d.ts","sourceRoot":"","sources":["../../../../src/lib/uni-virtualizer/lib/layouts/Layout1dSquareGrid.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,kBAAkB,EAAC,MAAM,mBAAmB,CAAC;AACrD,OAAO,EAAC,YAAY,EAAC,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAC,SAAS,EAAC,MAAM,aAAa,CAAC;AAEtC,UAAU,wBAAyB,SAAQ,kBAAkB;IAC3D,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB;AAED,aAAK,2BAA2B,GAAG,wBAAwB,GAAG;IAC5D,IAAI,EAAE,KAAI,MAAM,CAAC,EAAE,wBAAwB,KAAK,kBAAkB,CAAA;CACnE,CAAA;AAED,aAAK,kCAAkC,GAAG,CAAC,MAAM,CAAC,EAAE,wBAAwB,KAAK,2BAA2B,CAAC;AAE7G,eAAO,MAAM,kBAAkB,EAAE,kCAEvB,CAAC;AAEX,qBAAa,kBAAmB,SAAQ,YAAY,CAAC,wBAAwB,CAAC;IAC5E,SAAS,CAAC,UAAU,EAAE,MAAM,CAAO;IASnC,IAAI,SAAS,CAAC,EAAE,EAAE,MAAM,EAKvB;IAED,gBAAgB,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS;IAIxC,aAAa;CASd"}
-\ No newline at end of file
-diff --git a/lib/uni-virtualizer/lib/layouts/Layout1dSquareGrid.js b/lib/uni-virtualizer/lib/layouts/Layout1dSquareGrid.js
-index 27636003a5baa3d56b60693222ed0e84561ff796..ce7b984d5b60e2ae09942df097049732d949390f 100644
---- a/lib/uni-virtualizer/lib/layouts/Layout1dSquareGrid.js
-+++ b/lib/uni-virtualizer/lib/layouts/Layout1dSquareGrid.js
-@@ -1,11 +1,18 @@
- import { Layout1dGrid } from './Layout1dGrid.js';
-+export const layout1dSquareGrid = (config) => Object.assign({
-+ type: Layout1dSquareGrid
-+}, config);
- export class Layout1dSquareGrid extends Layout1dGrid {
-- constructor(config) {
-- super(config);
-- if (config.idealSize === undefined) {
-- this._idealSize = 200;
-- }
-+ constructor() {
-+ super(...arguments);
-+ this._idealSize = 200;
- }
-+ // constructor(config) {
-+ // super(config);
-+ // if (config.idealSize === undefined) {
-+ // this._idealSize = 200;
-+ // }
-+ // }
- set idealSize(px) {
- if (px !== this._idealSize) {
- this._idealSize = px;
-@@ -25,3 +32,4 @@ export class Layout1dSquareGrid extends Layout1dGrid {
- }
- }
- }
-+//# sourceMappingURL=Layout1dSquareGrid.js.map
-\ No newline at end of file
-diff --git a/lib/uni-virtualizer/lib/layouts/Layout1dSquareGrid.js.map b/lib/uni-virtualizer/lib/layouts/Layout1dSquareGrid.js.map
-new file mode 100644
-index 0000000000000000000000000000000000000000..701d12281865e1459666458e9418a96696813f3b
---- /dev/null
-+++ b/lib/uni-virtualizer/lib/layouts/Layout1dSquareGrid.js.map
-@@ -0,0 +1 @@
-+{"version":3,"file":"Layout1dSquareGrid.js","sourceRoot":"","sources":["../../../../src/lib/uni-virtualizer/lib/layouts/Layout1dSquareGrid.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,YAAY,EAAC,MAAM,mBAAmB,CAAC;AAc/C,MAAM,CAAC,MAAM,kBAAkB,GAAuC,CAAC,MAAiC,EAAE,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC;IACzH,IAAI,EAAE,kBAAkB;CACzB,EAAE,MAAM,CAAC,CAAC;AAEX,MAAM,OAAO,kBAAmB,SAAQ,YAAsC;IAA9E;;QACY,eAAU,GAAW,GAAG,CAAC;IA6BrC,CAAC;IA3BC,wBAAwB;IACxB,mBAAmB;IACnB,0CAA0C;IAC1C,+BAA+B;IAC/B,MAAM;IACN,IAAI;IAEJ,IAAI,SAAS,CAAC,EAAU;QACtB,IAAI,EAAE,KAAK,IAAI,CAAC,UAAU,EAAE;YAC1B,IAAI,CAAC,UAAU,GAAG,EAAE,CAAC;YACrB,IAAI,CAAC,qBAAqB,EAAE,CAAC;SAC9B;IACH,CAAC;IAED,gBAAgB,CAAC,GAAW;QAC1B,OAAO,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,gBAAgB,CAAC,GAAG,CAAC,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC;IACpE,CAAC;IAED,aAAa;QACX,MAAM,QAAQ,GAAG,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,UAAU,CAAC;QAClD,IAAI,CAAC,QAAQ,GAAG,QAAQ,GAAG,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QAChF,MAAM,OAAO,GAAG,CAAC,IAAI,CAAC,SAAS,GAAG,CAAC,CAAC,IAAI,CAAC,QAAQ,GAAG,CAAC,CAAC,GAAG,IAAI,CAAC,QAAQ,CAAC,CAAC,GAAG,IAAI,CAAC,QAAQ,CAAC;QACzF,IAAI,OAAO,KAAK,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE;YACpC,IAAI,CAAC,SAAS,GAAG,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC;YACrD,IAAI,CAAC,eAAe,GAAG,IAAI,CAAC;SAC7B;IACH,CAAC;CACF","sourcesContent":["import {Layout1dBaseConfig} from './Layout1dBase.js';\nimport {Layout1dGrid} from './Layout1dGrid.js';\nimport {Positions} from './Layout.js';\n\ninterface Layout1dSquareGridConfig extends Layout1dBaseConfig {\n spacing?: number,\n idealSize?: number\n}\n\ntype Layout1dSquareGridSpecifier = Layout1dSquareGridConfig & {\n type: new(config?: Layout1dSquareGridConfig) => Layout1dSquareGrid\n}\n\ntype Layout1dSquareGridSpecifierFactory = (config?: Layout1dSquareGridConfig) => Layout1dSquareGridSpecifier;\n\nexport const layout1dSquareGrid: Layout1dSquareGridSpecifierFactory = (config?: Layout1dSquareGridConfig) => Object.assign({\n type: Layout1dSquareGrid\n}, config);\n\nexport class Layout1dSquareGrid extends Layout1dGrid {\n protected _idealSize: number = 200;\n\n // constructor(config) {\n // super(config);\n // if (config.idealSize === undefined) {\n // this._idealSize = 200;\n // }\n // }\n\n set idealSize(px: number) {\n if (px !== this._idealSize) {\n this._idealSize = px;\n this._scheduleLayoutUpdate();\n }\n }\n\n _getItemPosition(idx: number): Positions {\n return Object.assign(super._getItemPosition(idx), this._itemSize);\n }\n\n _updateLayout() {\n const frolumns = this._viewDim2 / this._idealSize;\n this._rolumns = frolumns % 1 < 0.5 ? Math.floor(frolumns) : Math.ceil(frolumns);\n const adjSize = (this._viewDim2 - ((this._rolumns + 1) * this._spacing)) / this._rolumns;\n if (adjSize !== this._itemSize.width) {\n this._itemSize = { width: adjSize, height: adjSize };\n this._spacingChanged = true;\n }\n } \n}"]}
-\ No newline at end of file
-diff --git a/lib/uni-virtualizer/lib/polyfillLoaders/EventTarget.d.ts b/lib/uni-virtualizer/lib/polyfillLoaders/EventTarget.d.ts
-index d9f205869ab7ecc5e93b11c8310941611bbc18fa..da9f9dc7cdee3c8af63f235aec6913cde5362f1d 100644
---- a/lib/uni-virtualizer/lib/polyfillLoaders/EventTarget.d.ts
-+++ b/lib/uni-virtualizer/lib/polyfillLoaders/EventTarget.d.ts
-@@ -1,2 +1,6 @@
--export default function EventTarget(): Promise;
-+interface EventTargetConstructor {
-+ new (): EventTarget;
-+}
-+export default function EventTarget(): Promise;
-+export {};
- //# sourceMappingURL=EventTarget.d.ts.map
-\ No newline at end of file
-diff --git a/lib/uni-virtualizer/lib/polyfillLoaders/EventTarget.d.ts.map b/lib/uni-virtualizer/lib/polyfillLoaders/EventTarget.d.ts.map
-index ff50f3f8186e7b5ffc8ccf6c656dd39a0d56d9f3..7e5f49dc04b97a08ca30dc564ae41bacf8baa143 100644
---- a/lib/uni-virtualizer/lib/polyfillLoaders/EventTarget.d.ts.map
-+++ b/lib/uni-virtualizer/lib/polyfillLoaders/EventTarget.d.ts.map
-@@ -1 +1 @@
--{"version":3,"file":"EventTarget.d.ts","sourceRoot":"","sources":["../../../../src/lib/uni-virtualizer/lib/polyfillLoaders/EventTarget.ts"],"names":[],"mappings":"AAEA,wBAA8B,WAAW,iBAExC"}
-\ No newline at end of file
-+{"version":3,"file":"EventTarget.d.ts","sourceRoot":"","sources":["../../../../src/lib/uni-virtualizer/lib/polyfillLoaders/EventTarget.ts"],"names":[],"mappings":"AAEA,UAAU,sBAAsB;IAC5B,QAAO,WAAW,CAAA;CACrB;AAKD,wBAA8B,WAAW,oCAExC"}
-\ No newline at end of file
-diff --git a/lib/uni-virtualizer/lib/polyfillLoaders/EventTarget.js b/lib/uni-virtualizer/lib/polyfillLoaders/EventTarget.js
-index d92179f7fd5315203f870a6963e871dc8ddf6c0c..362e284121b97e0fba0925225777aebc32e26b8d 100644
---- a/lib/uni-virtualizer/lib/polyfillLoaders/EventTarget.js
-+++ b/lib/uni-virtualizer/lib/polyfillLoaders/EventTarget.js
-@@ -1,14 +1,15 @@
--let _ET, ET;
-+let _ET;
-+let ET;
- export default async function EventTarget() {
-- return ET || init();
-+ return ET || init();
- }
- async function init() {
-- _ET = window.EventTarget;
-- try {
-- new _ET();
-- }
-- catch (_a) {
-- _ET = (await import('event-target-shim')).EventTarget;
-- }
-- return (ET = _ET);
-+ _ET = window.EventTarget;
-+ try {
-+ new _ET();
-+ } catch (_a) {
-+ _ET = (await import("event-target-shim")).default.EventTarget;
-+ }
-+ return (ET = _ET);
- }
-+//# sourceMappingURL=EventTarget.js.map
-diff --git a/lib/uni-virtualizer/lib/polyfillLoaders/EventTarget.js.map b/lib/uni-virtualizer/lib/polyfillLoaders/EventTarget.js.map
-new file mode 100644
-index 0000000000000000000000000000000000000000..4ce7a8b18f1f07910bae2b2fd08b8b9cddf2d9ca
---- /dev/null
-+++ b/lib/uni-virtualizer/lib/polyfillLoaders/EventTarget.js.map
-@@ -0,0 +1 @@
-+{"version":3,"file":"EventTarget.js","sourceRoot":"","sources":["../../../../src/lib/uni-virtualizer/lib/polyfillLoaders/EventTarget.ts"],"names":[],"mappings":"AAMA,IAAI,GAA+C,CAAC;AACpD,IAAI,EAA0B,CAAC;AAE/B,MAAM,CAAC,OAAO,CAAC,KAAK,UAAU,WAAW;IACrC,OAAO,EAAE,IAAI,IAAI,EAAE,CAAC;AACxB,CAAC;AAED,KAAK,UAAU,IAAI;IACf,GAAG,GAAG,MAAM,CAAC,WAAW,CAAC;IACzB,IAAI;QACA,IAAI,GAAG,EAAE,CAAC;KACb;IACD,WAAM;QACF,GAAG,GAAG,CAAC,MAAM,MAAM,CAAC,mBAAmB,CAAC,CAAC,CAAC,WAAW,CAAC;KACzD;IACD,OAAO,CAAC,EAAE,GAAG,GAAG,CAAC,CAAC;AACtB,CAAC","sourcesContent":["type EventTargetModule = typeof import('event-target-shim');\n\ninterface EventTargetConstructor {\n new(): EventTarget\n}\n\nlet _ET: EventTargetModule | EventTargetConstructor;\nlet ET: EventTargetConstructor;\n\nexport default async function EventTarget() {\n return ET || init();\n}\n\nasync function init() {\n _ET = window.EventTarget;\n try {\n new _ET();\n }\n catch {\n _ET = (await import('event-target-shim')).EventTarget;\n }\n return (ET = _ET);\n}"]}
-\ No newline at end of file
-diff --git a/lib/uni-virtualizer/uni-virtualizer.d.ts b/lib/uni-virtualizer/uni-virtualizer.d.ts
-index 60838ab88dbfc1aa5889ba3a24729ac7f7a668e3..4137a2752ade8a4a41893635ed94ea0ad572a2e7 100644
---- a/lib/uni-virtualizer/uni-virtualizer.d.ts
-+++ b/lib/uni-virtualizer/uni-virtualizer.d.ts
-@@ -1,4 +1,4 @@
- export { VirtualScroller, RangeChangeEvent, scrollerRef } from './lib/VirtualScroller.js';
--export { Layout1d } from './lib/layouts/Layout1d.js';
-+export { Layout1d, layout1d } from './lib/layouts/Layout1d.js';
- export { Layout1dGrid } from './lib/layouts/Layout1dGrid.js';
- //# sourceMappingURL=uni-virtualizer.d.ts.map
-\ No newline at end of file
-diff --git a/lib/uni-virtualizer/uni-virtualizer.d.ts.map b/lib/uni-virtualizer/uni-virtualizer.d.ts.map
-index d045b7d96beda8cc80bc3a3b82e22ff23131a44f..38e1246ce67e788109d6c9310210a601693b6f95 100644
---- a/lib/uni-virtualizer/uni-virtualizer.d.ts.map
-+++ b/lib/uni-virtualizer/uni-virtualizer.d.ts.map
-@@ -1 +1 @@
--{"version":3,"file":"uni-virtualizer.d.ts","sourceRoot":"","sources":["../../src/lib/uni-virtualizer/uni-virtualizer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAE1F,OAAO,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AACrD,OAAO,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC"}
-\ No newline at end of file
-+{"version":3,"file":"uni-virtualizer.d.ts","sourceRoot":"","sources":["../../src/lib/uni-virtualizer/uni-virtualizer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAE1F,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AAC/D,OAAO,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC"}
-\ No newline at end of file
-diff --git a/lib/uni-virtualizer/uni-virtualizer.js b/lib/uni-virtualizer/uni-virtualizer.js
-index abbfd723d9d0013a5afa3641ace55bd4b89be275..ed6b82aedaa51d4c38de726c0db6e21d01759f5f 100644
---- a/lib/uni-virtualizer/uni-virtualizer.js
-+++ b/lib/uni-virtualizer/uni-virtualizer.js
-@@ -1,3 +1,4 @@
- export { VirtualScroller, scrollerRef } from './lib/VirtualScroller.js';
--export { Layout1d } from './lib/layouts/Layout1d.js';
-+export { Layout1d, layout1d } from './lib/layouts/Layout1d.js';
- export { Layout1dGrid } from './lib/layouts/Layout1dGrid.js';
-+//# sourceMappingURL=uni-virtualizer.js.map
-\ No newline at end of file
-diff --git a/lib/uni-virtualizer/uni-virtualizer.js.map b/lib/uni-virtualizer/uni-virtualizer.js.map
-new file mode 100644
-index 0000000000000000000000000000000000000000..326d70cd4eedd257fb6fbb0078255e2882c49724
---- /dev/null
-+++ b/lib/uni-virtualizer/uni-virtualizer.js.map
-@@ -0,0 +1 @@
-+{"version":3,"file":"uni-virtualizer.js","sourceRoot":"","sources":["../../src/lib/uni-virtualizer/uni-virtualizer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAoB,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAE1F,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AAC/D,OAAO,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC","sourcesContent":["export { VirtualScroller, RangeChangeEvent, scrollerRef } from './lib/VirtualScroller.js';\n\nexport { Layout1d, layout1d } from './lib/layouts/Layout1d.js';\nexport { Layout1dGrid } from './lib/layouts/Layout1dGrid.js';\n"]}
-\ No newline at end of file
-diff --git a/lit-virtualizer.d.ts b/lit-virtualizer.d.ts
-index 1c857d4bc1aeb43b56a7923b990ddcd094b09be2..58204903e4356b38a34df0ba29fec6390d435078 100644
---- a/lit-virtualizer.d.ts
-+++ b/lit-virtualizer.d.ts
-@@ -1,4 +1,4 @@
- export { scroll } from './lib/scroll.js';
--export { Layout1d, Layout1dGrid, RangeChangeEvent, scrollerRef } from './lib/uni-virtualizer/uni-virtualizer.js';
-+export { Layout1d, layout1d, Layout1dGrid, RangeChangeEvent, scrollerRef } from './lib/uni-virtualizer/uni-virtualizer.js';
- export { LitVirtualizer } from './lib/lit-virtualizer.js';
- //# sourceMappingURL=lit-virtualizer.d.ts.map
-\ No newline at end of file
-diff --git a/lit-virtualizer.d.ts.map b/lit-virtualizer.d.ts.map
-index 3a1ccb65e6cefe6192415cdbb5e6dfa1f273233c..08ad361b84e378b6052924266a57fca5a48177b0 100644
---- a/lit-virtualizer.d.ts.map
-+++ b/lit-virtualizer.d.ts.map
-@@ -1 +1 @@
--{"version":3,"file":"lit-virtualizer.d.ts","sourceRoot":"","sources":["src/lit-virtualizer.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AACzC,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,0CAA0C,CAAC;AACjH,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC"}
-\ No newline at end of file
-+{"version":3,"file":"lit-virtualizer.d.ts","sourceRoot":"","sources":["src/lit-virtualizer.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AACzC,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,YAAY,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,0CAA0C,CAAC;AAC3H,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC"}
-\ No newline at end of file
-diff --git a/lit-virtualizer.js b/lit-virtualizer.js
-index 1774c8a7f63ab390fd6bb96ce2f58dccef32c211..ef3497547e82647ab7282927e83a32ed39456b4c 100644
---- a/lit-virtualizer.js
-+++ b/lit-virtualizer.js
-@@ -1,4 +1,5 @@
- // export { repeat } from './lib/repeat.js';
- export { scroll } from './lib/scroll.js';
--export { Layout1d, Layout1dGrid, scrollerRef } from './lib/uni-virtualizer/uni-virtualizer.js';
-+export { Layout1d, layout1d, Layout1dGrid, scrollerRef } from './lib/uni-virtualizer/uni-virtualizer.js';
- export { LitVirtualizer } from './lib/lit-virtualizer.js';
-+//# sourceMappingURL=lit-virtualizer.js.map
-\ No newline at end of file
-diff --git a/lit-virtualizer.js.map b/lit-virtualizer.js.map
-new file mode 100644
-index 0000000000000000000000000000000000000000..c0c3a0f6bb2af1571380e7f79e81a6affa787f18
---- /dev/null
-+++ b/lit-virtualizer.js.map
-@@ -0,0 +1 @@
-+{"version":3,"file":"lit-virtualizer.js","sourceRoot":"","sources":["src/lit-virtualizer.ts"],"names":[],"mappings":"AAAA,4CAA4C;AAC5C,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AACzC,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,YAAY,EAAoB,WAAW,EAAE,MAAM,0CAA0C,CAAC;AAC3H,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC","sourcesContent":["// export { repeat } from './lib/repeat.js';\nexport { scroll } from './lib/scroll.js';\nexport { Layout1d, layout1d, Layout1dGrid, RangeChangeEvent, scrollerRef } from './lib/uni-virtualizer/uni-virtualizer.js';\nexport { LitVirtualizer } from './lib/lit-virtualizer.js';\n"]}
-\ No newline at end of file
-diff --git a/package.json b/package.json
-index b9854ae5453193acdc822d0b06e02674733844a1..f1194c01e74606efba3403df51f2adbadd5b0da6 100644
---- a/package.json
-+++ b/package.json
-@@ -45,8 +45,7 @@
- "rollup-plugin-node-resolve": "^4.2.3",
- "rollup-plugin-terser": "^5.0.0",
- "tachometer": "^0.4.7",
-- "tslint": "^5.18.0",
-- "typescript": "^4.0.2"
-+ "typescript": "^4.1.3"
- },
- "dependencies": {
- "event-target-shim": "^5.0.1",
diff --git a/.yarn/patches/@lit-labs/virtualizer/event-target-shim.patch b/.yarn/patches/@lit-labs/virtualizer/event-target-shim.patch
index dfb0a686fe..b5b2421b48 100644
--- a/.yarn/patches/@lit-labs/virtualizer/event-target-shim.patch
+++ b/.yarn/patches/@lit-labs/virtualizer/event-target-shim.patch
@@ -1,11 +1,10 @@
-diff --git a/lib/uni-virtualizer/lib/polyfillLoaders/EventTarget.js b/lib/uni-virtualizer/lib/polyfillLoaders/EventTarget.js
-index d92179f7fd5315203f870a6963e871dc8ddf6c0c..362e284121b97e0fba0925225777aebc32e26b8d 100644
---- a/lib/uni-virtualizer/lib/polyfillLoaders/EventTarget.js
-+++ b/lib/uni-virtualizer/lib/polyfillLoaders/EventTarget.js
-@@ -1,14 +1,15 @@
--let _ET, ET;
-+let _ET;
-+let ET;
+diff --git a/polyfillLoaders/EventTarget.js b/polyfillLoaders/EventTarget.js
+index 4e18ade7ba485849f17f28c94c42f0e0e01ac387..8f34f4f646c7f7becc208fb5a546c96034fc74dc 100644
+--- a/polyfillLoaders/EventTarget.js
++++ b/polyfillLoaders/EventTarget.js
+@@ -6,16 +6,15 @@
+ let _ET;
+ let ET;
export default async function EventTarget() {
- return ET || init();
+ return ET || init();
@@ -26,4 +25,5 @@ index d92179f7fd5315203f870a6963e871dc8ddf6c0c..362e284121b97e0fba0925225777aebc
+ _ET = (await import("event-target-shim")).default.EventTarget;
+ }
+ return (ET = _ET);
- }
\ No newline at end of file
+ }
+ //# sourceMappingURL=EventTarget.js.map
\ No newline at end of file
diff --git a/package.json b/package.json
index 6b536e78ff..63c5df94ca 100644
--- a/package.json
+++ b/package.json
@@ -46,7 +46,7 @@
"@fullcalendar/daygrid": "5.9.0",
"@fullcalendar/interaction": "5.9.0",
"@fullcalendar/list": "5.9.0",
- "@lit-labs/virtualizer": "patch:@lit-labs/virtualizer@0.6.0#./.yarn/patches/@lit-labs/virtualizer/0.7.0.patch",
+ "@lit-labs/virtualizer": "patch:@lit-labs/virtualizer@0.7.0-pre.2#./.yarn/patches/@lit-labs/virtualizer/event-target-shim.patch",
"@material/chips": "14.0.0-canary.261f2db59.0",
"@material/data-table": "14.0.0-canary.261f2db59.0",
"@material/mwc-button": "0.25.3",
diff --git a/src/components/data-table/ha-data-table.ts b/src/components/data-table/ha-data-table.ts
index af06549c80..c05c968b4f 100644
--- a/src/components/data-table/ha-data-table.ts
+++ b/src/components/data-table/ha-data-table.ts
@@ -1,4 +1,3 @@
-import { Layout1d, scroll } from "@lit-labs/virtualizer";
import { mdiArrowDown, mdiArrowUp } from "@mdi/js";
import deepClone from "deep-clone-simple";
import {
@@ -31,6 +30,7 @@ import type { HaCheckbox } from "../ha-checkbox";
import "../ha-svg-icon";
import { filterData, sortData } from "./sort-filter";
import { HomeAssistant } from "../../types";
+import "@lit-labs/virtualizer";
declare global {
// for fire event
@@ -337,111 +337,99 @@ export class HaDataTable extends LitElement {
`
: html`
-
- ${scroll({
- items: this._items,
- layout: Layout1d,
- renderItem: (row: DataTableRowData, index) => {
- // not sure how this happens...
- if (!row) {
- return html``;
- }
- if (row.append) {
- return html`
-
${row.content}
- `;
- }
- if (row.empty) {
- return html`
`;
- }
- return html`
-
- ${this.selectable
- ? html`
-
-
-
-
- `
- : ""}
- ${Object.entries(this.columns).map(
- ([key, column]) => {
- if (column.hidden) {
- return "";
- }
- return html`
-
- ${column.template
- ? column.template(row[key], row)
- : row[key]}
-
- `;
- }
- )}
-
- `;
- },
- })}
-
+ .items=${this._items}
+ .renderItem=${this._renderRow}
+ >
`}
`;
}
+ private _renderRow = (
+ row: DataTableRowData,
+ index: number
+ ): TemplateResult => {
+ // not sure how this happens...
+ if (!row) {
+ return html``;
+ }
+ if (row.append) {
+ return html` ${row.content}
`;
+ }
+ if (row.empty) {
+ return html`
`;
+ }
+ return html`
+
+ ${this.selectable
+ ? html`
+
+
+
+
+ `
+ : ""}
+ ${Object.entries(this.columns).map(([key, column]) => {
+ if (column.hidden) {
+ return "";
+ }
+ return html`
+
+ ${column.template ? column.template(row[key], row) : row[key]}
+
+ `;
+ })}
+
+ `;
+ };
+
private async _sortFilterData() {
const startTime = new Date().getTime();
this.curRequest++;
@@ -970,6 +958,9 @@ export class HaDataTable extends LitElement {
.clickable {
cursor: pointer;
}
+ lit-virtualizer {
+ contain: size layout !important;
+ }
`,
];
}
diff --git a/src/dialogs/quick-bar/ha-quick-bar.ts b/src/dialogs/quick-bar/ha-quick-bar.ts
index 77e1ccd8df..c166918cc9 100644
--- a/src/dialogs/quick-bar/ha-quick-bar.ts
+++ b/src/dialogs/quick-bar/ha-quick-bar.ts
@@ -1,5 +1,4 @@
-import "../../components/ha-textfield";
-import { Layout1d, scroll } from "@lit-labs/virtualizer";
+import "@lit-labs/virtualizer";
import "@material/mwc-list/mwc-list";
import type { List } from "@material/mwc-list/mwc-list";
import { SingleSelectedEvent } from "@material/mwc-list/mwc-list-foundation";
@@ -13,7 +12,7 @@ import {
mdiReload,
mdiServerNetwork,
} from "@mdi/js";
-import { css, html, LitElement } from "lit";
+import { css, html, LitElement, TemplateResult } from "lit";
import { customElement, property, query, state } from "lit/decorators";
import { ifDefined } from "lit/directives/if-defined";
import { styleMap } from "lit/directives/style-map";
@@ -36,11 +35,12 @@ import "../../components/ha-chip";
import "../../components/ha-circular-progress";
import "../../components/ha-header-bar";
import "../../components/ha-icon-button";
+import "../../components/ha-textfield";
import { domainToName } from "../../data/integration";
import { getPanelNameTranslationKey } from "../../data/panel";
import { PageNavigation } from "../../layouts/hass-tabs-subpage";
import { configSections } from "../../panels/config/ha-panel-config";
-import { haStyleDialog } from "../../resources/styles";
+import { haStyleDialog, haStyleScrollbar } from "../../resources/styles";
import { HomeAssistant } from "../../types";
import {
ConfirmationDialogParams,
@@ -210,25 +210,24 @@ export class QuickBar extends LitElement {
`
: html`
-
- ${scroll({
- items,
- layout: Layout1d,
- renderItem: (item: QuickBarItem, index) =>
- this._renderItem(item, index),
- })}
+
+
+
`}
${this._hint ? html`${this._hint}
` : ""}
@@ -261,14 +260,14 @@ export class QuickBar extends LitElement {
}
}
- private _renderItem(item: QuickBarItem, index?: number) {
+ private _renderItem = (item: QuickBarItem, index: number): TemplateResult => {
if (!item) {
return html``;
}
return isCommandItem(item)
? this._renderCommandItem(item, index)
: this._renderEntityItem(item as EntityItem, index);
- }
+ };
private _renderEntityItem(item: EntityItem, index?: number) {
return html`
@@ -431,16 +430,21 @@ export class QuickBar extends LitElement {
private _handleListItemKeyDown(ev: KeyboardEvent) {
const isSingleCharacter = ev.key.length === 1;
- const isFirstListItem =
- (ev.target as HTMLElement).getAttribute("index") === "0";
+ const index = (ev.target as HTMLElement).getAttribute("index");
+ const isFirstListItem = index === "0";
this._focusListElement = ev.target as ListItem;
+ if (ev.key === "ArrowDown") {
+ this._getItemAtIndex(Number(index) + 1)?.focus();
+ }
if (ev.key === "ArrowUp") {
if (isFirstListItem) {
this._filterInputField?.focus();
+ } else {
+ this._getItemAtIndex(Number(index) - 1)?.focus();
}
}
if (ev.key === "Backspace" || isSingleCharacter) {
- (ev.currentTarget as List).scrollTop = 0;
+ (ev.currentTarget as HTMLElement).scrollTop = 0;
this._filterInputField?.focus();
}
}
@@ -683,6 +687,7 @@ export class QuickBar extends LitElement {
static get styles() {
return [
+ haStyleScrollbar,
haStyleDialog,
css`
.heading {
@@ -780,6 +785,10 @@ export class QuickBar extends LitElement {
display: flex;
align-items: center;
}
+
+ lit-virtualizer {
+ contain: size layout !important;
+ }
`,
];
}
diff --git a/src/panels/logbook/ha-logbook.ts b/src/panels/logbook/ha-logbook.ts
index bafff2cd9c..5c59dfa783 100644
--- a/src/panels/logbook/ha-logbook.ts
+++ b/src/panels/logbook/ha-logbook.ts
@@ -1,4 +1,4 @@
-import { Layout1d, scroll } from "@lit-labs/virtualizer";
+import "@lit-labs/virtualizer";
import {
css,
CSSResultGroup,
@@ -97,12 +97,13 @@ class HaLogbook extends LitElement {
@scroll=${this._saveScrollPos}
>
${this.virtualize
- ? scroll({
- items: this.entries,
- layout: Layout1d,
- renderItem: (item: LogbookEntry, index) =>
- this._renderLogbookItem(item, index),
- })
+ ? html`
+ `
: this.entries.map((item, index) =>
this._renderLogbookItem(item, index)
)}
@@ -110,11 +111,11 @@ class HaLogbook extends LitElement {
`;
}
- private _renderLogbookItem(
+ private _renderLogbookItem = (
item: LogbookEntry,
- index?: number
- ): TemplateResult {
- if (index === undefined) {
+ index: number
+ ): TemplateResult => {
+ if (!item || index === undefined) {
return html``;
}
@@ -239,7 +240,7 @@ class HaLogbook extends LitElement {
`;
- }
+ };
@eventOptions({ passive: true })
private _saveScrollPos(e: Event) {
@@ -362,10 +363,15 @@ class HaLogbook extends LitElement {
max-height: var(--logbook-max-height);
}
- :host([virtualize]) .container {
+ .container,
+ lit-virtualizer {
height: 100%;
}
+ lit-virtualizer {
+ contain: size layout !important;
+ }
+
.narrow .entry {
line-height: 1.5;
padding: 8px;
diff --git a/yarn.lock b/yarn.lock
index 8d3c0ef776..b4a106053a 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -1960,25 +1960,25 @@ __metadata:
languageName: node
linkType: hard
-"@lit-labs/virtualizer@0.6.0":
- version: 0.6.0
- resolution: "@lit-labs/virtualizer@npm:0.6.0"
+"@lit-labs/virtualizer@0.7.0-pre.2":
+ version: 0.7.0-pre.2
+ resolution: "@lit-labs/virtualizer@npm:0.7.0-pre.2"
dependencies:
event-target-shim: ^5.0.1
- lit: ^2.0.0-rc.1
+ lit: ^2.0.0
tslib: ^1.10.0
- checksum: c18a49c331a66f82a896a8de7d856277cc48dc4c9ca90df9513c1a73c887a36d1363178233a902d8d0fe5e1aa88f71302d68ac7a0cb1dc6ccbe593282d1cee72
+ checksum: 88d5fffe73213c305160257e4e3a63a93087a90e63ca6640a81d156faacb68a8f84a82b94153b9364aeab3f5de45484acad1f8dcc2673e8464e394672358a3cc
languageName: node
linkType: hard
-"@lit-labs/virtualizer@patch:@lit-labs/virtualizer@0.6.0#./.yarn/patches/@lit-labs/virtualizer/0.7.0.patch::locator=home-assistant-frontend%40workspace%3A.":
- version: 0.6.0
- resolution: "@lit-labs/virtualizer@patch:@lit-labs/virtualizer@npm%3A0.6.0#./.yarn/patches/@lit-labs/virtualizer/0.7.0.patch::version=0.6.0&hash=0c4ec6&locator=home-assistant-frontend%40workspace%3A."
+"@lit-labs/virtualizer@patch:@lit-labs/virtualizer@0.7.0-pre.2#./.yarn/patches/@lit-labs/virtualizer/event-target-shim.patch::locator=home-assistant-frontend%40workspace%3A.":
+ version: 0.7.0-pre.2
+ resolution: "@lit-labs/virtualizer@patch:@lit-labs/virtualizer@npm%3A0.7.0-pre.2#./.yarn/patches/@lit-labs/virtualizer/event-target-shim.patch::version=0.7.0-pre.2&hash=cef165&locator=home-assistant-frontend%40workspace%3A."
dependencies:
event-target-shim: ^5.0.1
- lit: ^2.0.0-rc.1
+ lit: ^2.0.0
tslib: ^1.10.0
- checksum: 66bed3149dce8a0099e567ec3f1d249fb1855bf0df41e644453d044debe5f686c8c1b2078d45b4de5c488e821119eae1734b040a2145862efec54c442b83ff0f
+ checksum: ea8bdd610530fc9b50dd327cc3b8c70d4e45300636d731969af7b9475047c91066fe7973e04ac91f80111c116c80a989f1507da7fbfc526f7c0dff3a54719a4d
languageName: node
linkType: hard
@@ -9124,7 +9124,7 @@ fsevents@^1.2.7:
"@fullcalendar/interaction": 5.9.0
"@fullcalendar/list": 5.9.0
"@koa/cors": ^3.1.0
- "@lit-labs/virtualizer": "patch:@lit-labs/virtualizer@0.6.0#./.yarn/patches/@lit-labs/virtualizer/0.7.0.patch"
+ "@lit-labs/virtualizer": "patch:@lit-labs/virtualizer@0.7.0-pre.2#./.yarn/patches/@lit-labs/virtualizer/event-target-shim.patch"
"@material/chips": 14.0.0-canary.261f2db59.0
"@material/data-table": 14.0.0-canary.261f2db59.0
"@material/mwc-button": 0.25.3
From ed001fb10ba3cab6381c261ab6cf01bf5d059010 Mon Sep 17 00:00:00 2001
From: Bram Kragten
Date: Wed, 9 Feb 2022 18:20:56 +0100
Subject: [PATCH 029/174] Convert time inputs to Lit + mwc (#11609)
---
src/common/datetime/create_duration_data.ts | 7 +-
src/components/ha-base-time-input.ts | 308 +++++++++++
src/components/ha-duration-input.ts | 112 ++--
.../ha-selector/ha-selector-time.ts | 1 -
src/components/ha-textfield.ts | 23 +
src/components/ha-time-input.ts | 46 +-
src/components/paper-time-input.js | 497 ------------------
.../controls/more-info-input_datetime.ts | 1 -
.../hui-input-datetime-entity-row.ts | 1 -
9 files changed, 396 insertions(+), 600 deletions(-)
create mode 100644 src/components/ha-base-time-input.ts
delete mode 100644 src/components/paper-time-input.js
diff --git a/src/common/datetime/create_duration_data.ts b/src/common/datetime/create_duration_data.ts
index 92b3d01021..b198b5dbcb 100644
--- a/src/common/datetime/create_duration_data.ts
+++ b/src/common/datetime/create_duration_data.ts
@@ -1,5 +1,5 @@
-import { HaDurationData } from "../../components/ha-duration-input";
-import { ForDict } from "../../data/automation";
+import type { HaDurationData } from "../../components/ha-duration-input";
+import type { ForDict } from "../../data/automation";
export const createDurationData = (
duration: string | number | ForDict | undefined
@@ -19,6 +19,9 @@ export const createDurationData = (
}
return { seconds: duration };
}
+ if (!("days" in duration)) {
+ return duration;
+ }
const { days, minutes, seconds, milliseconds } = duration;
let hours = duration.hours || 0;
hours = (hours || 0) + (days || 0) * 24;
diff --git a/src/components/ha-base-time-input.ts b/src/components/ha-base-time-input.ts
new file mode 100644
index 0000000000..e8ede0a78b
--- /dev/null
+++ b/src/components/ha-base-time-input.ts
@@ -0,0 +1,308 @@
+import { LitElement, html, TemplateResult, css } from "lit";
+import { customElement, property } from "lit/decorators";
+import "@material/mwc-select/mwc-select";
+import "@material/mwc-list/mwc-list-item";
+import "./ha-textfield";
+import { fireEvent } from "../common/dom/fire_event";
+import { stopPropagation } from "../common/dom/stop_propagation";
+
+export interface TimeChangedEvent {
+ hours: number;
+ minutes: number;
+ seconds: number;
+ milliseconds: number;
+ amPm?: "AM" | "PM";
+}
+
+@customElement("ha-base-time-input")
+export class HaBaseTimeInput extends LitElement {
+ /**
+ * Label for the input
+ */
+ @property() label?: string;
+
+ /**
+ * auto validate time inputs
+ */
+ @property({ type: Boolean }) autoValidate = false;
+
+ /**
+ * 12 or 24 hr format
+ */
+ @property({ type: Number }) format: 12 | 24 = 12;
+
+ /**
+ * disables the inputs
+ */
+ @property({ type: Boolean }) disabled = false;
+
+ /**
+ * hour
+ */
+ @property({ type: Number }) hours = 0;
+
+ /**
+ * minute
+ */
+ @property({ type: Number }) minutes = 0;
+
+ /**
+ * second
+ */
+ @property({ type: Number }) seconds = 0;
+
+ /**
+ * milli second
+ */
+ @property({ type: Number }) milliseconds = 0;
+
+ /**
+ * Label for the hour input
+ */
+ @property() hourLabel = "";
+
+ /**
+ * Label for the min input
+ */
+ @property() minLabel = "";
+
+ /**
+ * Label for the sec input
+ */
+ @property() secLabel = "";
+
+ /**
+ * Label for the milli sec input
+ */
+ @property() millisecLabel = "";
+
+ /**
+ * show the sec field
+ */
+ @property({ type: Boolean }) enableSecond = false;
+
+ /**
+ * show the milli sec field
+ */
+ @property({ type: Boolean }) enableMillisecond = false;
+
+ /**
+ * limit hours input
+ */
+ @property({ type: Boolean }) noHoursLimit = false;
+
+ /**
+ * AM or PM
+ */
+ @property() amPm: "AM" | "PM" = "AM";
+
+ /**
+ * Formatted time string
+ */
+ @property() value?: string;
+
+ protected render(): TemplateResult {
+ return html`
+ ${this.label ? html`${this.label} ` : ""}
+
+
+
+
+
+ ${this.enableSecond
+ ? html`
+ `
+ : ""}
+ ${this.enableMillisecond
+ ? html`
+ `
+ : ""}
+ ${this.format === 24
+ ? ""
+ : html`
+ AM
+ PM
+ `}
+
+ `;
+ }
+
+ private _valueChanged(ev) {
+ this[ev.target.name] =
+ ev.target.name === "amPm" ? ev.target.value : Number(ev.target.value);
+ const value: TimeChangedEvent = {
+ hours: this.hours,
+ minutes: this.minutes,
+ seconds: this.seconds,
+ milliseconds: this.milliseconds,
+ };
+ if (this.format === 12) {
+ value.amPm = this.amPm;
+ }
+ fireEvent(this, "value-changed", {
+ value,
+ });
+ }
+
+ private _onFocus(ev) {
+ ev.target.select();
+ }
+
+ /**
+ * Format time fragments
+ */
+ private _formatValue(value: number, padding = 2) {
+ return value.toString().padStart(padding, "0");
+ }
+
+ /**
+ * 24 hour format has a max hr of 23
+ */
+ private get _hourMax() {
+ if (this.noHoursLimit) {
+ return null;
+ }
+ if (this.format === 12) {
+ return 12;
+ }
+ return 23;
+ }
+
+ static styles = css`
+ :host {
+ display: block;
+ }
+ .time-input-wrap {
+ display: flex;
+ border-radius: var(--mdc-shape-small, 4px) var(--mdc-shape-small, 4px) 0 0;
+ overflow: hidden;
+ position: relative;
+ }
+ ha-textfield {
+ width: 40px;
+ text-align: center;
+ --mdc-shape-small: 0;
+ --text-field-appearance: none;
+ --text-field-padding: 0 4px;
+ --text-field-suffix-padding-left: 2px;
+ --text-field-suffix-padding-right: 0;
+ --text-field-text-align: center;
+ }
+ ha-textfield.hasSuffix {
+ --text-field-padding: 0 0 0 4px;
+ }
+ ha-textfield:first-child {
+ --text-field-border-top-left-radius: var(--mdc-shape-medium);
+ }
+ ha-textfield:last-child {
+ --text-field-border-top-right-radius: var(--mdc-shape-medium);
+ }
+ mwc-select {
+ --mdc-shape-small: 0;
+ width: 85px;
+ }
+ label {
+ -moz-osx-font-smoothing: grayscale;
+ -webkit-font-smoothing: antialiased;
+ font-family: var(
+ --mdc-typography-body2-font-family,
+ var(--mdc-typography-font-family, Roboto, sans-serif)
+ );
+ font-size: var(--mdc-typography-body2-font-size, 0.875rem);
+ line-height: var(--mdc-typography-body2-line-height, 1.25rem);
+ font-weight: var(--mdc-typography-body2-font-weight, 400);
+ letter-spacing: var(
+ --mdc-typography-body2-letter-spacing,
+ 0.0178571429em
+ );
+ text-decoration: var(--mdc-typography-body2-text-decoration, inherit);
+ text-transform: var(--mdc-typography-body2-text-transform, inherit);
+ color: var(--mdc-theme-text-primary-on-background, rgba(0, 0, 0, 0.87));
+ padding-left: 4px;
+ }
+ `;
+}
+
+declare global {
+ interface HTMLElementTagNameMap {
+ "ha-base-time-input": HaBaseTimeInput;
+ }
+}
diff --git a/src/components/ha-duration-input.ts b/src/components/ha-duration-input.ts
index 3de83b1fd3..9ac4e72e2f 100644
--- a/src/components/ha-duration-input.ts
+++ b/src/components/ha-duration-input.ts
@@ -1,7 +1,8 @@
import { html, LitElement, TemplateResult } from "lit";
import { customElement, property, query } from "lit/decorators";
import { fireEvent } from "../common/dom/fire_event";
-import "./paper-time-input";
+import "./ha-base-time-input";
+import type { TimeChangedEvent } from "./ha-base-time-input";
export interface HaDurationData {
hours?: number;
@@ -32,110 +33,69 @@ class HaDurationInput extends LitElement {
protected render(): TemplateResult {
return html`
-
+ .hours=${this._hours}
+ .minutes=${this._minutes}
+ .seconds=${this._seconds}
+ .milliseconds=${this._milliseconds}
+ @value-changed=${this._durationChanged}
+ noHoursLimit
+ hourLabel="hh"
+ minLabel="mm"
+ secLabel="ss"
+ millisecLabel="ms"
+ >
`;
}
private get _hours() {
- return this.data && this.data.hours ? Number(this.data.hours) : 0;
+ return this.data?.hours ? Number(this.data.hours) : 0;
}
private get _minutes() {
- return this.data && this.data.minutes ? Number(this.data.minutes) : 0;
+ return this.data?.minutes ? Number(this.data.minutes) : 0;
}
private get _seconds() {
- return this.data && this.data.seconds ? Number(this.data.seconds) : 0;
+ return this.data?.seconds ? Number(this.data.seconds) : 0;
}
private get _milliseconds() {
- return this.data && this.data.milliseconds
- ? Number(this.data.milliseconds)
- : 0;
+ return this.data?.milliseconds ? Number(this.data.milliseconds) : 0;
}
- private _parseDuration(value) {
- return value.toString().padStart(2, "0");
- }
+ private _durationChanged(ev: CustomEvent<{ value: TimeChangedEvent }>) {
+ ev.stopPropagation();
+ const value = { ...ev.detail.value };
- private _parseDurationMillisec(value) {
- return value.toString().padStart(3, "0");
- }
-
- private _hourChanged(ev) {
- this._durationChanged(ev, "hours");
- }
-
- private _minChanged(ev) {
- this._durationChanged(ev, "minutes");
- }
-
- private _secChanged(ev) {
- this._durationChanged(ev, "seconds");
- }
-
- private _millisecChanged(ev) {
- this._durationChanged(ev, "milliseconds");
- }
-
- private _durationChanged(ev, unit) {
- let value = Number(ev.detail.value);
-
- if (value === this[`_${unit}`]) {
- return;
+ if (!this.enableMillisecond && !value.milliseconds) {
+ // @ts-ignore
+ delete value.milliseconds;
+ } else if (value.milliseconds > 999) {
+ value.seconds += Math.floor(value.milliseconds / 1000);
+ value.milliseconds %= 1000;
}
- let hours = this._hours;
- let minutes = this._minutes;
-
- if (unit === "seconds" && value > 59) {
- minutes += Math.floor(value / 60);
- value %= 60;
+ if (value.seconds > 59) {
+ value.minutes += Math.floor(value.seconds / 60);
+ value.seconds %= 60;
}
- if (unit === "minutes" && value > 59) {
- hours += Math.floor(value / 60);
- value %= 60;
+ if (value.minutes > 59) {
+ value.hours += Math.floor(value.minutes / 60);
+ value.minutes %= 60;
}
- const newValue: HaDurationData = {
- hours,
- minutes,
- seconds: this._seconds,
- };
-
- if (this.enableMillisecond || this._milliseconds) {
- newValue.milliseconds = this._milliseconds;
- }
-
- newValue[unit] = value;
-
fireEvent(this, "value-changed", {
- value: newValue,
+ value,
});
}
}
diff --git a/src/components/ha-selector/ha-selector-time.ts b/src/components/ha-selector/ha-selector-time.ts
index f1a116d371..fb3b4e2b8d 100644
--- a/src/components/ha-selector/ha-selector-time.ts
+++ b/src/components/ha-selector/ha-selector-time.ts
@@ -22,7 +22,6 @@ export class HaTimeSelector extends LitElement {
.value=${this.value}
.locale=${this.hass.locale}
.disabled=${this.disabled}
- hide-label
enable-second
>
`;
diff --git a/src/components/ha-textfield.ts b/src/components/ha-textfield.ts
index 8ca6992f2d..7aae676aa7 100644
--- a/src/components/ha-textfield.ts
+++ b/src/components/ha-textfield.ts
@@ -45,6 +45,29 @@ export class HaTextField extends TextFieldBase {
.mdc-text-field__input {
width: var(--ha-textfield-input-width, 100%);
}
+ .mdc-text-field:not(.mdc-text-field--with-leading-icon) {
+ padding: var(--text-field-padding, 0px 16px);
+ }
+ .mdc-text-field__affix--suffix {
+ padding-left: var(--text-field-suffix-padding-left, 12px);
+ padding-right: var(--text-field-suffix-padding-right, 0px);
+ }
+
+ input {
+ text-align: var(--text-field-text-align);
+ }
+
+ /* Chrome, Safari, Edge, Opera */
+ :host([no-spinner]) input::-webkit-outer-spin-button,
+ :host([no-spinner]) input::-webkit-inner-spin-button {
+ -webkit-appearance: none;
+ margin: 0;
+ }
+
+ /* Firefox */
+ :host([no-spinner]) input[type="number"] {
+ -moz-appearance: textfield;
+ }
`,
];
}
diff --git a/src/components/ha-time-input.ts b/src/components/ha-time-input.ts
index 1b14f40579..5efd5a13f3 100644
--- a/src/components/ha-time-input.ts
+++ b/src/components/ha-time-input.ts
@@ -2,12 +2,13 @@ import { html, LitElement } from "lit";
import { customElement, property } from "lit/decorators";
import { useAmPm } from "../common/datetime/use_am_pm";
import { fireEvent } from "../common/dom/fire_event";
-import "./paper-time-input";
+import "./ha-base-time-input";
import { FrontendLocaleData } from "../data/translation";
+import type { TimeChangedEvent } from "./ha-base-time-input";
@customElement("ha-time-input")
export class HaTimeInput extends LitElement {
- @property() public locale!: FrontendLocaleData;
+ @property({ attribute: false }) public locale!: FrontendLocaleData;
@property() public value?: string;
@@ -15,9 +16,6 @@ export class HaTimeInput extends LitElement {
@property({ type: Boolean }) public disabled = false;
- @property({ type: Boolean, attribute: "hide-label" }) public hideLabel =
- false;
-
@property({ type: Boolean, attribute: "enable-second" })
public enableSecond = false;
@@ -35,40 +33,44 @@ export class HaTimeInput extends LitElement {
}
return html`
- = 12 ? "PM" : "AM")}
.disabled=${this.disabled}
- @change=${this._timeChanged}
- @am-pm-changed=${this._timeChanged}
- .hideLabel=${this.hideLabel}
+ @value-changed=${this._timeChanged}
.enableSecond=${this.enableSecond}
- >
+ >
`;
}
- private _timeChanged(ev) {
- let value = ev.target.value;
+ private _timeChanged(ev: CustomEvent<{ value: TimeChangedEvent }>) {
+ ev.stopPropagation();
+ const eventValue = ev.detail.value;
+
const useAMPM = useAmPm(this.locale);
- let hours = Number(ev.target.hour || 0);
- if (value && useAMPM) {
- if (ev.target.amPm === "PM" && hours < 12) {
+ let hours = eventValue.hours || 0;
+ if (eventValue && useAMPM) {
+ if (eventValue.amPm === "PM" && hours < 12) {
hours += 12;
}
- if (ev.target.amPm === "AM" && hours === 12) {
+ if (eventValue.amPm === "AM" && hours === 12) {
hours = 0;
}
- value = `${hours.toString().padStart(2, "0")}:${ev.target.min || "00"}:${
- ev.target.sec || "00"
- }`;
}
+ const value = `${hours.toString().padStart(2, "0")}:${
+ eventValue.minutes ? eventValue.minutes.toString().padStart(2, "0") : "00"
+ }:${
+ eventValue.seconds ? eventValue.seconds.toString().padStart(2, "0") : "00"
+ }`;
+
if (value === this.value) {
return;
}
+
this.value = value;
fireEvent(this, "change");
fireEvent(this, "value-changed", {
diff --git a/src/components/paper-time-input.js b/src/components/paper-time-input.js
deleted file mode 100644
index 99e9c8de8f..0000000000
--- a/src/components/paper-time-input.js
+++ /dev/null
@@ -1,497 +0,0 @@
-/**
-Adapted from paper-time-input from
-https://github.com/ryanburns23/paper-time-input
-MIT Licensed. Copyright (c) 2017 Ryan Burns
-
-`` Polymer element to accept a time with paper-input & paper-dropdown-menu
-Inspired by the time input in google forms
-
-### Styling
-
-`` provides the following custom properties and mixins for styling:
-
-Custom property | Description | Default
-----------------|-------------|----------
-`--paper-time-input-dropdown-ripple-color` | dropdown ripple color | `--primary-color`
-`--paper-time-input-cotnainer` | Mixin applied to the inputs | `{}`
-`--paper-time-dropdown-input-cotnainer` | Mixin applied to the dropdown input | `{}`
-*/
-import "@polymer/paper-dropdown-menu/paper-dropdown-menu";
-import "@polymer/paper-input/paper-input";
-import "@polymer/paper-item/paper-item";
-import "@polymer/paper-listbox/paper-listbox";
-import { html } from "@polymer/polymer/lib/utils/html-tag";
-/* eslint-plugin-disable lit */
-import { PolymerElement } from "@polymer/polymer/polymer-element";
-
-export class PaperTimeInput extends PolymerElement {
- static get template() {
- return html`
-
-
- [[label]]
-
- `;
- }
-
- static get properties() {
- return {
- /**
- * Label for the input
- */
- label: {
- type: String,
- value: "Time",
- },
- /**
- * auto validate time inputs
- */
- autoValidate: {
- type: Boolean,
- value: true,
- },
- /**
- * hides the label
- */
- hideLabel: {
- type: Boolean,
- value: false,
- },
- /**
- * float the input labels
- */
- floatInputLabels: {
- type: Boolean,
- value: false,
- },
- /**
- * always float the input labels
- */
- alwaysFloatInputLabels: {
- type: Boolean,
- value: false,
- },
- /**
- * 12 or 24 hr format
- */
- format: {
- type: Number,
- value: 12,
- },
- /**
- * disables the inputs
- */
- disabled: {
- type: Boolean,
- value: false,
- },
- /**
- * hour
- */
- hour: {
- type: String,
- notify: true,
- },
- /**
- * minute
- */
- min: {
- type: String,
- notify: true,
- },
- /**
- * second
- */
- sec: {
- type: String,
- notify: true,
- },
- /**
- * milli second
- */
- millisec: {
- type: String,
- notify: true,
- },
- /**
- * Label for the hour input
- */
- hourLabel: {
- type: String,
- value: "",
- },
- /**
- * Label for the min input
- */
- minLabel: {
- type: String,
- value: "",
- },
- /**
- * Label for the sec input
- */
- secLabel: {
- type: String,
- value: "",
- },
- /**
- * Label for the milli sec input
- */
- millisecLabel: {
- type: String,
- value: "",
- },
- /**
- * show the sec field
- */
- enableSecond: {
- type: Boolean,
- value: false,
- },
- /**
- * show the milli sec field
- */
- enableMillisecond: {
- type: Boolean,
- value: false,
- },
- /**
- * limit hours input
- */
- noHoursLimit: {
- type: Boolean,
- value: false,
- },
- /**
- * AM or PM
- */
- amPm: {
- type: String,
- notify: true,
- value: "AM",
- },
- /**
- * Formatted time string
- */
- value: {
- type: String,
- notify: true,
- readOnly: true,
- computed: "_computeTime(min, hour, sec, millisec, amPm)",
- },
- };
- }
-
- /**
- * Validate the inputs
- * @return {boolean}
- */
- validate() {
- let valid = true;
- // Validate hour & min fields
- if (!this.$.hour.validate() || !this.$.min.validate()) {
- valid = false;
- }
- // Validate second field
- if (this.enableSecond && !this.$.sec.validate()) {
- valid = false;
- }
- // Validate milli second field
- if (this.enableMillisecond && !this.$.millisec.validate()) {
- valid = false;
- }
- // Validate AM PM if 12 hour time
- if (this.format === 12 && !this.$.dropdown.validate()) {
- valid = false;
- }
- return valid;
- }
-
- /**
- * Create time string
- */
- _computeTime(min, hour, sec, millisec, amPm) {
- let str;
- if (
- hour ||
- min ||
- (sec && this.enableSecond) ||
- (millisec && this.enableMillisecond)
- ) {
- hour = hour || "00";
- min = min || "00";
- sec = sec || "00";
- millisec = millisec || "000";
- str = hour + ":" + min;
- // add sec field
- if (this.enableSecond && sec) {
- str = str + ":" + sec;
- }
- // add milli sec field
- if (this.enableMillisecond && millisec) {
- str = str + ":" + millisec;
- }
- // No ampm on 24 hr time
- if (this.format === 12) {
- str = str + " " + amPm;
- }
- }
-
- return str;
- }
-
- _onFocus(ev) {
- ev.target.inputElement.inputElement.select();
- }
-
- /**
- * Format milli sec
- */
- _formatMillisec() {
- if (this.millisec.toString().length === 1) {
- this.millisec = this.millisec.toString().padStart(3, "0");
- }
- }
-
- /**
- * Format sec
- */
- _formatSec() {
- if (this.sec.toString().length === 1) {
- this.sec = this.sec.toString().padStart(2, "0");
- }
- }
-
- /**
- * Format min
- */
- _formatMin() {
- if (this.min.toString().length === 1) {
- this.min = this.min.toString().padStart(2, "0");
- }
- }
-
- /**
- * Format hour
- */
- _shouldFormatHour() {
- if (this.format === 24 && this.hour.toString().length === 1) {
- this.hour = this.hour.toString().padStart(2, "0");
- }
- }
-
- /**
- * 24 hour format has a max hr of 23
- */
- _computeHourMax(format) {
- if (this.noHoursLimit) {
- return null;
- }
- if (format === 12) {
- return format;
- }
- return 23;
- }
-
- _equal(n1, n2) {
- return n1 === n2;
- }
-
- _computeClassNames(hasSuffix) {
- return hasSuffix ? " " : "no-suffix";
- }
-}
-
-customElements.define("paper-time-input", PaperTimeInput);
diff --git a/src/dialogs/more-info/controls/more-info-input_datetime.ts b/src/dialogs/more-info/controls/more-info-input_datetime.ts
index 4d1be5c70b..a0f11eb726 100644
--- a/src/dialogs/more-info/controls/more-info-input_datetime.ts
+++ b/src/dialogs/more-info/controls/more-info-input_datetime.ts
@@ -43,7 +43,6 @@ class MoreInfoInputDatetime extends LitElement {
: this.stateObj.state}
.locale=${this.hass.locale}
.disabled=${UNAVAILABLE_STATES.includes(this.stateObj.state)}
- hide-label
@value-changed=${this._timeChanged}
@click=${this._stopEventPropagation}
>
diff --git a/src/panels/lovelace/entity-rows/hui-input-datetime-entity-row.ts b/src/panels/lovelace/entity-rows/hui-input-datetime-entity-row.ts
index 21a8ada291..a727d2f67d 100644
--- a/src/panels/lovelace/entity-rows/hui-input-datetime-entity-row.ts
+++ b/src/panels/lovelace/entity-rows/hui-input-datetime-entity-row.ts
@@ -72,7 +72,6 @@ class HuiInputDatetimeEntityRow extends LitElement implements LovelaceRow {
: stateObj.state}
.locale=${this.hass.locale}
.disabled=${UNAVAILABLE_STATES.includes(stateObj.state)}
- hide-label
@value-changed=${this._timeChanged}
@click=${this._stopEventPropagation}
>
From 4db943c5ffbc8e5cf949a086a8ecd7d54a90ac04 Mon Sep 17 00:00:00 2001
From: Steve Repsher
Date: Wed, 9 Feb 2022 13:02:03 -0500
Subject: [PATCH 030/174] Set initial focus for device, area, and entity
dialogs (#11622)
---
src/dialogs/more-info/ha-more-info-dialog.ts | 3 ++-
src/panels/config/areas/dialog-area-registry-detail.ts | 1 +
.../device-registry-detail/dialog-device-registry-detail.ts | 1 +
src/panels/config/entities/dialog-entity-editor.ts | 1 +
4 files changed, 5 insertions(+), 1 deletion(-)
diff --git a/src/dialogs/more-info/ha-more-info-dialog.ts b/src/dialogs/more-info/ha-more-info-dialog.ts
index 64082db266..dd33958584 100644
--- a/src/dialogs/more-info/ha-more-info-dialog.ts
+++ b/src/dialogs/more-info/ha-more-info-dialog.ts
@@ -164,6 +164,7 @@ export class MoreInfoDialog extends LitElement {
.label=${this.hass.localize(
"ui.dialogs.more_info_control.details"
)}
+ dialogInitialFocus
>
-
+
${cache(
this._currTabIndex === 0
? html`
diff --git a/src/panels/config/areas/dialog-area-registry-detail.ts b/src/panels/config/areas/dialog-area-registry-detail.ts
index 9bbb35de18..3fadb0ea58 100644
--- a/src/panels/config/areas/dialog-area-registry-detail.ts
+++ b/src/panels/config/areas/dialog-area-registry-detail.ts
@@ -92,6 +92,7 @@ class DialogAreaDetail extends LitElement {
"ui.panel.config.areas.editor.name_required"
)}
.invalid=${nameInvalid}
+ dialogInitialFocus
>
${Object.entries(this._extraTabs).map(
From d37d99223d1f9a08236343358727bd66bc61b662 Mon Sep 17 00:00:00 2001
From: Patrick ZAJDA
Date: Wed, 9 Feb 2022 19:10:41 +0100
Subject: [PATCH 031/174] Add aria-label to table headers with no title
(#11503)
---
src/components/data-table/ha-data-table.ts | 2 ++
.../config/automation/ha-automation-picker.ts | 9 ++++++
.../devices/ha-config-devices-dashboard.ts | 3 ++
.../config/entities/ha-config-entities.ts | 3 ++
.../config/helpers/ha-config-helpers.ts | 6 ++++
.../ha-config-lovelace-dashboards.ts | 6 ++++
src/panels/config/scene/ha-scene-dashboard.ts | 8 +++++
src/panels/config/script/ha-script-picker.ts | 7 +++++
src/panels/config/tags/ha-config-tags.ts | 2 ++
src/panels/config/users/ha-config-users.ts | 3 ++
.../card-editor/hui-entity-picker-table.ts | 3 ++
src/translations/en.json | 29 +++++++++++++++----
12 files changed, 75 insertions(+), 6 deletions(-)
diff --git a/src/components/data-table/ha-data-table.ts b/src/components/data-table/ha-data-table.ts
index c05c968b4f..18d4d4a5a1 100644
--- a/src/components/data-table/ha-data-table.ts
+++ b/src/components/data-table/ha-data-table.ts
@@ -70,6 +70,7 @@ export interface DataTableSortColumnData {
export interface DataTableColumnData extends DataTableSortColumnData {
title: TemplateResult | string;
+ label?: TemplateResult | string;
type?: "numeric" | "icon" | "icon-button" | "overflow-menu";
template?: (data: any, row: T) => TemplateResult | string;
width?: string;
@@ -294,6 +295,7 @@ export class HaDataTable extends LitElement {
};
return html`
-