Skip to content

Commit

Permalink
refactor: remove custom card helpers (#540)
Browse files Browse the repository at this point in the history
* refactor: add HomeAssistant type

* refactor: use local HomeAssistant type

* refactor: add computeRTL

* chore: remove custom card helpers

* chore: add handle actions

* chore: move some helper to ha folder

* chore: move action directive to ha folder

* chore: move action struct to ha folder

* chore: move validate condition to ha folder

* chore: move some function to ha folder

* refactor: add export index

* chore: migrate alarm card

* chore: migrate chips card

* chore: migrate cover card

* chore: migrate entity card

* chore: migrate fan card

* chore: migrate humidifier card

* chore: migrate light card

* chore: migrate lock card

* chore: migrate media-player card

* chore: migrate person card

* chore: migrate template card

* chore: migrate title card

* chore: migrate update card

* chore: migrate vacuum card

* chore: migrate shared folder

* chore: migrate utils folder

* chore: migrate some functions

* fix: remove custom element definition
  • Loading branch information
piitaya committed Jun 4, 2022
1 parent ee7450f commit 2917677
Show file tree
Hide file tree
Showing 148 changed files with 2,023 additions and 724 deletions.
188 changes: 7 additions & 181 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
"@material/mwc-select": "^0.25.3",
"@material/mwc-textfield": "^0.25.3",
"color": "^4.2.3",
"custom-card-helpers": "^1.9.0",
"hammerjs": "^2.0.8",
"home-assistant-js-websocket": "^7.0.3",
"lit": "^2.2.3",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { LovelaceCardConfig } from "custom-card-helpers";
import { array, assign, boolean, object, optional } from "superstruct";
import { actionsSharedConfigStruct, ActionsSharedConfig } from "../../shared/config/actions-config";
import { layoutSharedConfigStruct, LayoutSharedConfig } from "../../shared/config/layout-config";
import { entitySharedConfigStruct, EntitySharedConfig } from "../../shared/config/entity-config";
import { LovelaceCardConfig } from "../../ha";
import { ActionsSharedConfig, actionsSharedConfigStruct } from "../../shared/config/actions-config";
import { EntitySharedConfig, entitySharedConfigStruct } from "../../shared/config/entity-config";
import { LayoutSharedConfig, layoutSharedConfigStruct } from "../../shared/config/layout-config";
import { lovelaceCardConfigStruct } from "../../shared/config/lovelace-card-config";

export type AlarmControlPanelCardConfig = LovelaceCardConfig &
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { fireEvent, LocalizeFunc, LovelaceCardEditor } from "custom-card-helpers";
import { html, TemplateResult } from "lit";
import { customElement, state } from "lit/decorators.js";
import memoizeOne from "memoize-one";
import { assert } from "superstruct";
import { fireEvent, LocalizeFunc, LovelaceCardEditor } from "../../ha";
import setupCustomlocalize from "../../localize";
import { MushroomBaseElement } from "../../utils/base-element";
import { Action } from "../../utils/form/custom/ha-selector-mushroom-action";
Expand Down
16 changes: 8 additions & 8 deletions src/cards/alarm-control-panel-card/alarm-control-panel-card.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
import { css, CSSResultGroup, html, PropertyValues, TemplateResult } from "lit";
import { customElement, query, state } from "lit/decorators.js";
import { classMap } from "lit/directives/class-map.js";
import { styleMap } from "lit/directives/style-map.js";
import {
actionHandler,
ActionHandlerEvent,
computeRTL,
computeStateDisplay,
handleAction,
hasAction,
HomeAssistant,
isAvailable,
LovelaceCard,
LovelaceCardEditor,
} from "custom-card-helpers";
import { css, CSSResultGroup, html, PropertyValues, TemplateResult } from "lit";
import { customElement, query, state } from "lit/decorators.js";
import { classMap } from "lit/directives/class-map.js";
import { styleMap } from "lit/directives/style-map.js";
import { computeStateDisplay } from "../../ha/common/entity/compute-state-display";
import { isAvailable } from "../../ha/data/entity";
} from "../../ha";
import "../../shared/badge-icon";
import "../../shared/button";
import "../../shared/button-group";
Expand All @@ -23,7 +24,6 @@ import "../../shared/state-item";
import { MushroomBaseElement } from "../../utils/base-element";
import { cardStyle } from "../../utils/card-styles";
import { registerCustomCard } from "../../utils/custom-cards";
import { actionHandler } from "../../utils/directives/action-handler-directive";
import { alarmPanelIconAction } from "../../utils/icons/alarm-panel-icon";
import { stateIcon } from "../../utils/icons/state-icon";
import { getLayoutFromConfig } from "../../utils/layout";
Expand Down
2 changes: 1 addition & 1 deletion src/cards/alarm-control-panel-card/utils.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { HassEntity } from "home-assistant-js-websocket";
import { UNAVAILABLE } from "../../ha/data/entity";
import { UNAVAILABLE } from "../../ha";
import {
ALARM_CONTROL_PANEL_CARD_DEFAULT_STATE_COLOR,
ALARM_CONTROL_PANEL_CARD_STATE_COLOR,
Expand Down
9 changes: 4 additions & 5 deletions src/cards/chips-card/chips-card-chips-editor.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
import { fireEvent, HomeAssistant } from "custom-card-helpers";
import { css, CSSResultGroup, html, LitElement, PropertyValues, TemplateResult } from "lit";
import { css, CSSResultGroup, html, PropertyValues, TemplateResult } from "lit";
import { customElement, property, state } from "lit/decorators.js";
import { guard } from "lit/directives/guard.js";
import type { SortableEvent } from "sortablejs";
import { fireEvent, sortableStyles } from "../../ha";
import setupCustomlocalize from "../../localize";
import "../../shared/form/mushroom-select";
import { MushroomBaseElement } from "../../utils/base-element";
import { getChipElementClass } from "../../utils/lovelace/chip-element-editor";
import { CHIP_LIST, LovelaceChipConfig } from "../../utils/lovelace/chip/types";
import { EditorTarget } from "../../utils/lovelace/editor/types";
import { sortableStyles } from "../../utils/sortable-styles";
import "../../shared/form/mushroom-select";
import { MushroomBaseElement } from "../../utils/base-element";

let Sortable;

Expand Down
Loading

0 comments on commit 2917677

Please sign in to comment.