Skip to content

Commit

Permalink
Convert map card to Lit/TS (#2826)
Browse files Browse the repository at this point in the history
* Convert map card to Lit/TS

* Address comments
  • Loading branch information
balloob committed Feb 25, 2019
1 parent 63e6506 commit 90a1f7e
Show file tree
Hide file tree
Showing 6 changed files with 431 additions and 379 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@
"@gfx/zopfli": "^1.0.9",
"@types/chai": "^4.1.7",
"@types/codemirror": "^0.0.71",
"@types/leaflet": "^1.4.3",
"@types/memoize-one": "^4.1.0",
"@types/mocha": "^5.2.5",
"babel-eslint": "^10",
Expand Down
11 changes: 8 additions & 3 deletions src/common/dom/setup-leaflet-map.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
import { Map } from "leaflet";

// Sets up a Leaflet map on the provided DOM element
export const setupLeafletMap = async (mapElement) => {
export type LeafletModuleType = typeof import("leaflet");

export const setupLeafletMap = async (
mapElement
): Promise<[Map, LeafletModuleType]> => {
// tslint:disable-next-line
const Leaflet = (await import(/* webpackChunkName: "leaflet" */ "leaflet"))
.default;
const Leaflet = (await import(/* webpackChunkName: "leaflet" */ "leaflet")) as LeafletModuleType;
Leaflet.Icon.Default.imagePath = "/static/images/leaflet";

const map = Leaflet.map(mapElement);
Expand Down
369 changes: 0 additions & 369 deletions src/panels/lovelace/cards/hui-map-card.js

This file was deleted.

0 comments on commit 90a1f7e

Please sign in to comment.