From 7dc6f792c3c7d783f10aad3f4240a1a0d02b76d3 Mon Sep 17 00:00:00 2001 From: Tobias Nordahl Date: Tue, 24 Nov 2020 18:43:07 +0100 Subject: [PATCH] Adding localize, ts-support, card-info and more --- .eslintrc.json | 24 +- dist/floorplan-card.js | 270 +++++--------------- dist/floorplan-card.js.map | 2 +- package-lock.json | 494 +++++++++++++++++++++++++++++++++++-- package.json | 7 +- rollup.config.js | 15 +- src/floorplan-card.js | 15 ++ 7 files changed, 582 insertions(+), 245 deletions(-) diff --git a/.eslintrc.json b/.eslintrc.json index 67ca3ea..772cc14 100755 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -1,9 +1,21 @@ { - "parserOptions": { - "ecmaVersion": 2020 - }, + "parserOptions": { + "ecmaVersion": 2020, + "sourceType": "module" + }, - "env": { - "es6": true - } + "env": { + "es6": true + }, + "plugins": ["@typescript-eslint"], + "parser": "@typescript-eslint/parser", + "rules": { + "@typescript-eslint/no-explicit-any": "off", + "@typescript-eslint/no-unused-vars": [ + "warn", + { + "argsIgnorePattern": "^_" + } + ] + } } diff --git a/dist/floorplan-card.js b/dist/floorplan-card.js index d7125ff..bd67c82 100644 --- a/dist/floorplan-card.js +++ b/dist/floorplan-card.js @@ -1,212 +1,10 @@ (function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i { - this.floorplan.hassChanged(hass); - }); - } - - loadFloorplan(hass, config) { - this.isFloorplanLoading = true; - - const floorplan = new Floorplan(); - - const options = { - root: this.shadowRoot, - hass: hass, - openMoreInfo: this.openMoreInfo.bind(this), - setIsLoading: this.setIsLoading.bind(this), - config: (config && config.config) || config, - }; - - return floorplan.init(options).then(() => { - this.setIsLoading(false); - this.floorplan = floorplan; - this.isFloorplanLoading = false; - this.isFloorplanLoaded = true; - }); - } - - initCard(config) { - const root = this.shadowRoot; - if (root.lastChild) root.removeChild(root.lastChild); - - const style = document.createElement("style"); - style.textContent = this.getStyle(); - root.appendChild(style); - - const card = document.createElement("ha-card"); - card.header = config.title; - root.appendChild(card); - - const container = document.createElement("div"); - container.id = "container"; - card.appendChild(container); - - const spinner = document.createElement("paper-spinner-lite"); - container.appendChild(spinner); - - const floorplan = document.createElement("div"); - floorplan.id = "floorplan"; - container.appendChild(floorplan); - - const log = document.createElement("div"); - log.id = "log"; - container.appendChild(log); - - const link = document.createElement("a"); - link.setAttribute("href", "#"); - link.text = "Clear log"; - log.appendChild(link); - link.onclick = function () { - $(this).siblings("ul").html("").parent().css("display", "none"); - }; - - const list = document.createElement("ul"); - log.appendChild(list); - - this.log = log; - this.spinner = spinner; - } - - getStyle() { - return ` - #container { - text-align: center; - } - - paper-spinner-lite { - margin-bottom: 50px; - } - - #log { - max-height: 150px; - overflow: auto; - background-color: #eee; - display: none; - padding: 10px; - } - - #log ul { - list-style-type: none; - padding-left: 0px; - text-align: left; - } - - .error { - color: #FF0000; - } - - .warning { - color: #FF851B; - } - - .info { - color: #0000FF; - } - - .debug { - color: #000000; - } - `; - } - - openMoreInfo(entityId) { - this.fire("hass-more-info", { entityId: entityId }); - } - - setIsLoading(isLoading) { - this.isLoading = isLoading; - - if (this.isLoading) { - this.spinner.setAttribute("active", ""); - this.spinner.style.display = "inline-block"; - } else { - this.spinner.removeAttribute("active"); - this.spinner.style.display = "none"; - } - } - - logError(message) { - console.error(message); - - $(this.log).find("ul").prepend(`
  • ${message}
  • `); - $(this.log).css("display", "block"); - } - - fire(type, detail, options) { - options = options || {}; - detail = detail === null || detail === undefined ? {} : detail; - const event = new Event(type, { - bubbles: options.bubbles === undefined ? true : options.bubbles, - cancelable: Boolean(options.cancelable), - composed: options.composed === undefined ? true : options.composed, - }); - event.detail = detail; - const node = options.node || this; - node.dispatchEvent(event); - return event; - } - - loadScript(scriptUrl, useCache) { - return new Promise((resolve, reject) => { - const script = document.createElement("script"); - script.async = true; - script.src = useCache ? scriptUrl : this.cacheBuster(scriptUrl); - script.onload = () => resolve(); - script.onerror = (err) => reject(new URIError(`${err.target.src}`)); - this.appendChild(script); - }); - } - - cacheBuster(url) { - return `${url}${ - url.indexOf("?") >= 0 ? "&" : "?" - }_=${new Date().getTime()}`; - } -} - -customElements.define("floorplan-card", FloorplanCard); +var e={version:"Version",description:"Floorplan for Lovelace"},n={common:e};const o={en:Object.freeze({__proto__:null,common:e,default:n})};global.$=require("jquery");require("yamljs");var t=require("./../package.json");require("jquery.longpress"),require("floorplan"),console.info(`%c LOVELACE-FLOORPLAN CARD \n%c ${function(e,n="",t=""){const i=e.split(".")[0],s=e.split(".")[1],r=(localStorage.getItem("selectedLanguage")||navigator.language.split("-")[0]||"en").replace(/['"]+/g,"").replace("-","_");let l;try{l=o[r][i][s]}catch(e){l=o.en[i][s]}return void 0===l&&(l=o.en[i][s]),""!==n&&""!==t&&(l=l.replace(n,t)),l}("common.version")} ${t.version} `,"color: orange; font-weight: bold; background: black","color: white; font-weight: bold; background: rgb(71, 170, 238)");class i extends HTMLElement{constructor(){super(),this.version="1.1.8",this.isScriptsLoading=!1,this.isFloorplanLoading=!1,this.isFloorplanLoaded=!1,this.attachShadow({mode:"open"})}setConfig(e){this.config=JSON.parse(JSON.stringify(e)),this.initCard(e),this.setIsLoading(!0)}set hass(e){!this.config||this.isScriptsLoading||this.isFloorplanLoading||(this.isFloorplanLoaded?Promise.resolve():this.loadFloorplan(e,this.config)).then((()=>{this.floorplan.hassChanged(e)}))}loadFloorplan(e,n){this.isFloorplanLoading=!0;const o=new Floorplan,t={root:this.shadowRoot,hass:e,openMoreInfo:this.openMoreInfo.bind(this),setIsLoading:this.setIsLoading.bind(this),config:n&&n.config||n};return o.init(t).then((()=>{this.setIsLoading(!1),this.floorplan=o,this.isFloorplanLoading=!1,this.isFloorplanLoaded=!0}))}initCard(e){const n=this.shadowRoot;n.lastChild&&n.removeChild(n.lastChild);const o=document.createElement("style");o.textContent=this.getStyle(),n.appendChild(o);const t=document.createElement("ha-card");t.header=e.title,n.appendChild(t);const i=document.createElement("div");i.id="container",t.appendChild(i);const s=document.createElement("paper-spinner-lite");i.appendChild(s);const r=document.createElement("div");r.id="floorplan",i.appendChild(r);const l=document.createElement("div");l.id="log",i.appendChild(l);const a=document.createElement("a");a.setAttribute("href","#"),a.text="Clear log",l.appendChild(a),a.onclick=function(){$(this).siblings("ul").html("").parent().css("display","none")};const c=document.createElement("ul");l.appendChild(c),this.log=l,this.spinner=s}getStyle(){return"\n #container {\n text-align: center;\n }\n\n paper-spinner-lite {\n margin-bottom: 50px;\n }\n\n #log {\n max-height: 150px;\n overflow: auto;\n background-color: #eee;\n display: none;\n padding: 10px;\n }\n\n #log ul {\n list-style-type: none;\n padding-left: 0px;\n text-align: left;\n }\n\n .error {\n color: #FF0000;\n }\n\n .warning {\n color: #FF851B;\n }\n\n .info {\n color: #0000FF;\n }\n\n .debug {\n color: #000000;\n }\n "}openMoreInfo(e){this.fire("hass-more-info",{entityId:e})}setIsLoading(e){this.isLoading=e,this.isLoading?(this.spinner.setAttribute("active",""),this.spinner.style.display="inline-block"):(this.spinner.removeAttribute("active"),this.spinner.style.display="none")}logError(e){console.error(e),$(this.log).find("ul").prepend(`
  • ${e}
  • `),$(this.log).css("display","block")}fire(e,n,o){o=o||{},n=null==n?{}:n;const t=new Event(e,{bubbles:void 0===o.bubbles||o.bubbles,cancelable:Boolean(o.cancelable),composed:void 0===o.composed||o.composed});t.detail=n;return(o.node||this).dispatchEvent(t),t}loadScript(e,n){return new Promise(((o,t)=>{const i=document.createElement("script");i.async=!0,i.src=n?e:this.cacheBuster(e),i.onload=()=>o(),i.onerror=e=>t(new URIError(`${e.target.src}`)),this.appendChild(i)}))}cacheBuster(e){return`${e}${e.indexOf("?")>=0?"&":"?"}_=${(new Date).getTime()}`}}customElements.define("floorplan-card",i); }).call(this)}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"floorplan":14,"jquery":2,"jquery.longpress":15,"yamljs":13}],2:[function(require,module,exports){ +},{"./../package.json":14,"floorplan":15,"jquery":2,"jquery.longpress":16,"yamljs":13}],2:[function(require,module,exports){ /*! * jQuery JavaScript Library v3.5.1 * https://jquery.com/ @@ -12973,6 +12771,63 @@ if (typeof window === "undefined" || window === null) { module.exports = Yaml; },{"./Dumper":3,"./Parser":9,"./Utils":12}],14:[function(require,module,exports){ +module.exports={ + "name": "lovelace-floorplan", + "version": "1.0.0", + "description": "Floorplan for Lovelace-cards (Home Assistant)", + "main": "floorplan-card.js", + "directories": { + "example": "examples", + "lib": "lib" + }, + "scripts": { + "start": "rollup -c --watch", + "build": "npm run lint && npm run rollup && npm run browserify", + "browserify": "browserify dist/floorplan-card.js -o dist/floorplan-card.js", + "lint": "eslint src/*.js --fix", + "rollup": "rollup -c -m" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/pkozul/lovelace-floorplan.git" + }, + "keywords": [ + "floorplan", + "lovelace", + "homeassistant", + "hacs" + ], + "author": "pkozul, exetico", + "license": "ISC", + "bugs": { + "url": "https://github.com/pkozul/lovelace-floorplan/issues" + }, + "homepage": "https://github.com/pkozul/lovelace-floorplan#readme", + "dependencies": { + "jquery": "^3.5.1", + "yamljs": "^0.3.0" + }, + "devDependencies": { + "@rollup/plugin-json": "^4.1.0", + "@typescript-eslint/eslint-plugin": "^4.8.2", + "@typescript-eslint/parser": "^4.8.2", + "browserify": "^17.0.0", + "eslint": "^7.12.1", + "js": "^0.1.0", + "prettier": "^2.1.2", + "rollup": "^2.33.0", + "rollup-plugin-node-resolve": "^5.2.0", + "rollup-plugin-terser": "^7.0.2", + "rollup-plugin-typescript2": "^0.29.0", + "typescript": "^4.0.5" + }, + "browser": { + "jquery.longpress": "./src/lib/jquery.longpress", + "floorplan": "./src/lib/floorplan" + } +} + +},{}],15:[function(require,module,exports){ (function () { if (typeof window.Floorplan === "function") return; @@ -13440,7 +13295,6 @@ module.exports = Yaml; .addClass("ha-entity"); if (rule && rule.long_click) { - console.log("Hej1113"); $(svgElement).mayTriggerLongClicks().off("longClick"); $(svgElement) .mayTriggerLongClicks() @@ -13775,7 +13629,6 @@ module.exports = Yaml; $svgElement.css("cursor", "pointer"); } if (ruleInfo.rule.long_click) { - console.log("Hej1112"); $svgElement .mayTriggerLongClicks() .off("longClick") @@ -13918,7 +13771,6 @@ module.exports = Yaml; ); $svgElement.css("cursor", "pointer"); if (ruleInfo.rule.long_click) { - console.log("Hej1113"); $svgElement.mayTriggerLongClicks().off("longClick"); $svgElement.mayTriggerLongClicks().on( "longClick", @@ -14879,7 +14731,6 @@ module.exports = Yaml; longClick(e) { var modifiedRule = null; if (this.rule.long_click && this.rule.long_click.service) { - console.log("Hej1114"); modifiedRule = JSON.parse(JSON.stringify(this.rule)); // Create the action-object, if it's not defined (to support longClick without action) @@ -14902,7 +14753,6 @@ module.exports = Yaml; } onEntityLongClick(e) { - console.log("Hej1115"); e.stopPropagation(); e.preventDefault(); setTimeout(this.instance.longClick.bind(this, e), 300); @@ -15438,7 +15288,7 @@ module.exports = Yaml; window.Floorplan = Floorplan; }.call(this)); -},{}],15:[function(require,module,exports){ +},{}],16:[function(require,module,exports){ // $ Longclick Lib // // Details: Function to enable long clicks in floorplan diff --git a/dist/floorplan-card.js.map b/dist/floorplan-card.js.map index 11254f3..ceeeade 100644 --- a/dist/floorplan-card.js.map +++ b/dist/floorplan-card.js.map @@ -1 +1 @@ -{"version":3,"file":"floorplan-card.js","sources":["../src/floorplan-card.js"],"sourcesContent":["global.$ = require(\"jquery\");\nvar YAML = require(\"yamljs\");\n\n// jQuery LongPress Plugin\nrequire(\"jquery.longpress\");\n\n// Main Floorplan lib\nrequire(\"floorplan\");\n\nclass FloorplanCard extends HTMLElement {\n constructor() {\n super();\n\n this.version = \"1.1.8\";\n\n this.isScriptsLoading = false;\n this.isFloorplanLoading = false;\n\n this.isFloorplanLoaded = false;\n\n this.attachShadow({ mode: \"open\" });\n }\n\n setConfig(config) {\n this.config = JSON.parse(JSON.stringify(config));\n\n this.initCard(config);\n this.setIsLoading(true);\n }\n\n set hass(hass) {\n if (!this.config || this.isScriptsLoading || this.isFloorplanLoading)\n return;\n\n (this.isFloorplanLoaded\n ? Promise.resolve()\n : this.loadFloorplan(hass, this.config)\n ).then(() => {\n this.floorplan.hassChanged(hass);\n });\n }\n\n loadFloorplan(hass, config) {\n this.isFloorplanLoading = true;\n\n const floorplan = new Floorplan();\n\n const options = {\n root: this.shadowRoot,\n hass: hass,\n openMoreInfo: this.openMoreInfo.bind(this),\n setIsLoading: this.setIsLoading.bind(this),\n config: (config && config.config) || config,\n };\n\n return floorplan.init(options).then(() => {\n this.setIsLoading(false);\n this.floorplan = floorplan;\n this.isFloorplanLoading = false;\n this.isFloorplanLoaded = true;\n });\n }\n\n initCard(config) {\n const root = this.shadowRoot;\n if (root.lastChild) root.removeChild(root.lastChild);\n\n const style = document.createElement(\"style\");\n style.textContent = this.getStyle();\n root.appendChild(style);\n\n const card = document.createElement(\"ha-card\");\n card.header = config.title;\n root.appendChild(card);\n\n const container = document.createElement(\"div\");\n container.id = \"container\";\n card.appendChild(container);\n\n const spinner = document.createElement(\"paper-spinner-lite\");\n container.appendChild(spinner);\n\n const floorplan = document.createElement(\"div\");\n floorplan.id = \"floorplan\";\n container.appendChild(floorplan);\n\n const log = document.createElement(\"div\");\n log.id = \"log\";\n container.appendChild(log);\n\n const link = document.createElement(\"a\");\n link.setAttribute(\"href\", \"#\");\n link.text = \"Clear log\";\n log.appendChild(link);\n link.onclick = function () {\n $(this).siblings(\"ul\").html(\"\").parent().css(\"display\", \"none\");\n };\n\n const list = document.createElement(\"ul\");\n log.appendChild(list);\n\n this.log = log;\n this.spinner = spinner;\n }\n\n getStyle() {\n return `\n #container {\n text-align: center;\n }\n\n paper-spinner-lite {\n margin-bottom: 50px;\n }\n\n #log {\n max-height: 150px;\n overflow: auto;\n background-color: #eee;\n display: none;\n padding: 10px;\n }\n\n #log ul {\n list-style-type: none;\n padding-left: 0px;\n text-align: left;\n }\n\n .error {\n color: #FF0000;\n }\n\n .warning {\n color: #FF851B;\n }\n\n .info {\n color: #0000FF;\n }\n\n .debug {\n color: #000000;\n }\n `;\n }\n\n openMoreInfo(entityId) {\n this.fire(\"hass-more-info\", { entityId: entityId });\n }\n\n setIsLoading(isLoading) {\n this.isLoading = isLoading;\n\n if (this.isLoading) {\n this.spinner.setAttribute(\"active\", \"\");\n this.spinner.style.display = \"inline-block\";\n } else {\n this.spinner.removeAttribute(\"active\");\n this.spinner.style.display = \"none\";\n }\n }\n\n logError(message) {\n console.error(message);\n\n $(this.log).find(\"ul\").prepend(`
  • ${message}
  • `);\n $(this.log).css(\"display\", \"block\");\n }\n\n fire(type, detail, options) {\n options = options || {};\n detail = detail === null || detail === undefined ? {} : detail;\n const event = new Event(type, {\n bubbles: options.bubbles === undefined ? true : options.bubbles,\n cancelable: Boolean(options.cancelable),\n composed: options.composed === undefined ? true : options.composed,\n });\n event.detail = detail;\n const node = options.node || this;\n node.dispatchEvent(event);\n return event;\n }\n\n loadScript(scriptUrl, useCache) {\n return new Promise((resolve, reject) => {\n const script = document.createElement(\"script\");\n script.async = true;\n script.src = useCache ? scriptUrl : this.cacheBuster(scriptUrl);\n script.onload = () => resolve();\n script.onerror = (err) => reject(new URIError(`${err.target.src}`));\n this.appendChild(script);\n });\n }\n\n cacheBuster(url) {\n return `${url}${\n url.indexOf(\"?\") >= 0 ? \"&\" : \"?\"\n }_=${new Date().getTime()}`;\n }\n}\n\ncustomElements.define(\"floorplan-card\", FloorplanCard);\n"],"names":[],"mappings":"AAAA,MAAM,CAAC,CAAC,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC;AAC7B,IAAI,IAAI,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC;AAC7B;AACA;AACA,OAAO,CAA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AAG,QAAQ,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAC;AACtD,MAAM,MAAM,CAAC,KAAK,GAAG,IAAI,CAAC;AAC1B,MAAM,MAAM,CAAC,GAAG,GAAG,QAAQ,GAAG,SAAS,GAAG,IAAI,CAAC,WAAW,CAAC,SAAS,CAAC,CAAC;AACtE,MAAM,MAAM,CAAC,MAAM,GAAG,MAAM,OAAO,EAAE,CAAC;AACtC,MAAM,MAAM,CAAC,OAAO,GAAG,CAAC,GAAG,KAAK,MAAM,CAAC,IAAI,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;AAC1E,MAAM,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC;AAC/B,KAAK,CAAC,CAAC;AACP,GAAG;AACH;AACA,EAAE,WAAW,CAAC,GAAG,EAAE;AACnB,IAAI,OAAO,CAAC,EAAE,GAAG,CAAC;AAClB,MAAM,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,GAAG,GAAG,GAAG;AACvC,KAAK,EAAE,EAAE,IAAI,IAAI,EAAE,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC;AAChC,GAAG;AACH,CAAC;AACD;AACA,cAAc,CAAC,MAAM,CAAC,gBAAgB,EAAE,aAAa,CAAC"} \ No newline at end of file +{"version":3,"file":"floorplan-card.js","sources":["../src/floorplan-card.js"],"sourcesContent":["global.$ = require(\"jquery\");\nvar YAML = require(\"yamljs\");\n\n// Package Information\nvar packageInfo = require(\"./../package.json\");\n\n// jQuery LongPress Plugin\nrequire(\"jquery.longpress\");\n\n// Main Floorplan lib\nrequire(\"floorplan\");\n\nimport { localize } from \"./localize/localize.ts\";\n\n// Display our Card Version in console\n/* eslint no-console: 0 */\nconsole.info(\n `%c LOVELACE-FLOORPLAN CARD \\n%c ${localize(\"common.version\")} ${\n packageInfo.version\n } `,\n \"color: orange; font-weight: bold; background: black\",\n \"color: white; font-weight: bold; background: rgb(71, 170, 238)\"\n);\n\nclass FloorplanCard extends HTMLElement {\n constructor() {\n super();\n\n this.version = \"1.1.8\";\n\n this.isScriptsLoading = false;\n this.isFloorplanLoading = false;\n\n this.isFloorplanLoaded = false;\n\n this.attachShadow({ mode: \"open\" });\n }\n\n setConfig(config) {\n this.config = JSON.parse(JSON.stringify(config));\n\n this.initCard(config);\n this.setIsLoading(true);\n }\n\n set hass(hass) {\n if (!this.config || this.isScriptsLoading || this.isFloorplanLoading)\n return;\n\n (this.isFloorplanLoaded\n ? Promise.resolve()\n : this.loadFloorplan(hass, this.config)\n ).then(() => {\n this.floorplan.hassChanged(hass);\n });\n }\n\n loadFloorplan(hass, config) {\n this.isFloorplanLoading = true;\n\n const floorplan = new Floorplan();\n\n const options = {\n root: this.shadowRoot,\n hass: hass,\n openMoreInfo: this.openMoreInfo.bind(this),\n setIsLoading: this.setIsLoading.bind(this),\n config: (config && config.config) || config,\n };\n\n return floorplan.init(options).then(() => {\n this.setIsLoading(false);\n this.floorplan = floorplan;\n this.isFloorplanLoading = false;\n this.isFloorplanLoaded = true;\n });\n }\n\n initCard(config) {\n const root = this.shadowRoot;\n if (root.lastChild) root.removeChild(root.lastChild);\n\n const style = document.createElement(\"style\");\n style.textContent = this.getStyle();\n root.appendChild(style);\n\n const card = document.createElement(\"ha-card\");\n card.header = config.title;\n root.appendChild(card);\n\n const container = document.createElement(\"div\");\n container.id = \"container\";\n card.appendChild(container);\n\n const spinner = document.createElement(\"paper-spinner-lite\");\n container.appendChild(spinner);\n\n const floorplan = document.createElement(\"div\");\n floorplan.id = \"floorplan\";\n container.appendChild(floorplan);\n\n const log = document.createElement(\"div\");\n log.id = \"log\";\n container.appendChild(log);\n\n const link = document.createElement(\"a\");\n link.setAttribute(\"href\", \"#\");\n link.text = \"Clear log\";\n log.appendChild(link);\n link.onclick = function () {\n $(this).siblings(\"ul\").html(\"\").parent().css(\"display\", \"none\");\n };\n\n const list = document.createElement(\"ul\");\n log.appendChild(list);\n\n this.log = log;\n this.spinner = spinner;\n }\n\n getStyle() {\n return `\n #container {\n text-align: center;\n }\n\n paper-spinner-lite {\n margin-bottom: 50px;\n }\n\n #log {\n max-height: 150px;\n overflow: auto;\n background-color: #eee;\n display: none;\n padding: 10px;\n }\n\n #log ul {\n list-style-type: none;\n padding-left: 0px;\n text-align: left;\n }\n\n .error {\n color: #FF0000;\n }\n\n .warning {\n color: #FF851B;\n }\n\n .info {\n color: #0000FF;\n }\n\n .debug {\n color: #000000;\n }\n `;\n }\n\n openMoreInfo(entityId) {\n this.fire(\"hass-more-info\", { entityId: entityId });\n }\n\n setIsLoading(isLoading) {\n this.isLoading = isLoading;\n\n if (this.isLoading) {\n this.spinner.setAttribute(\"active\", \"\");\n this.spinner.style.display = \"inline-block\";\n } else {\n this.spinner.removeAttribute(\"active\");\n this.spinner.style.display = \"none\";\n }\n }\n\n logError(message) {\n console.error(message);\n\n $(this.log).find(\"ul\").prepend(`
  • ${message}
  • `);\n $(this.log).css(\"display\", \"block\");\n }\n\n fire(type, detail, options) {\n options = options || {};\n detail = detail === null || detail === undefined ? {} : detail;\n const event = new Event(type, {\n bubbles: options.bubbles === undefined ? true : options.bubbles,\n cancelable: Boolean(options.cancelable),\n composed: options.composed === undefined ? true : options.composed,\n });\n event.detail = detail;\n const node = options.node || this;\n node.dispatchEvent(event);\n return event;\n }\n\n loadScript(scriptUrl, useCache) {\n return new Promise((resolve, reject) => {\n const script = document.createElement(\"script\");\n script.async = true;\n script.src = useCache ? scriptUrl : this.cacheBuster(scriptUrl);\n script.onload = () => resolve();\n script.onerror = (err) => reject(new URIError(`${err.target.src}`));\n this.appendChild(script);\n });\n }\n\n cacheBuster(url) {\n return `${url}${\n url.indexOf(\"?\") >= 0 ? \"&\" : \"?\"\n }_=${new Date().getTime()}`;\n }\n}\n\ncustomElements.define(\"floorplan-card\", FloorplanCard);\n"],"names":["global","$","require","packageInfo","console","info","localize","version","FloorplanCard","HTMLElement","[object Object]","super","this","isScriptsLoading","isFloorplanLoading","isFloorplanLoaded","attachShadow","mode","config","JSON","parse","stringify","initCard","setIsLoading","hass","Promise","resolve","loadFloorplan","then","floorplan","hassChanged","Floorplan","options","root","shadowRoot","openMoreInfo","bind","init","lastChild","removeChild","style","document","createElement","textContent","getStyle","appendChild","card","header","title","container","id","spinner","log","link","setAttribute","text","onclick","siblings","html","parent","css","list","entityId","fire","isLoading","display","removeAttribute","message","error","find","prepend","type","detail","event","Event","bubbles","undefined","cancelable","Boolean","composed","node","dispatchEvent","scriptUrl","useCache","reject","script","async","src","cacheBuster","onload","onerror","err","URIError","target","url","indexOf","Date","getTime","customElements","define"],"mappings":"4IAAAA,OAAOC,EAAIC,QAAQ,UACRA,QAAQ,UAAnB,IAGIC,EAAcD,QAAQ,qBAG1BA,QAAQ,oBAGRA,QAAQ,aAMRE,QAAQC,KACN,wVAAyCC,CAAS,wBAChDH,EAAYI,cAEd,sDACA,kEAGF,MAAMC,UAAsBC,YAC1BC,cACEC,QAEAC,KAAKL,QAAU,QAEfK,KAAKC,kBAAmB,EACxBD,KAAKE,oBAAqB,EAE1BF,KAAKG,mBAAoB,EAEzBH,KAAKI,aAAa,CAAEC,KAAM,SAG5BP,UAAUQ,GACRN,KAAKM,OAASC,KAAKC,MAAMD,KAAKE,UAAUH,IAExCN,KAAKU,SAASJ,GACdN,KAAKW,cAAa,GAGpBC,SAASA,IACFZ,KAAKM,QAAUN,KAAKC,kBAAoBD,KAAKE,qBAGjDF,KAAKG,kBACFU,QAAQC,UACRd,KAAKe,cAAcH,EAAMZ,KAAKM,SAChCU,MAAK,KACLhB,KAAKiB,UAAUC,YAAYN,MAI/Bd,cAAcc,EAAMN,GAClBN,KAAKE,oBAAqB,EAE1B,MAAMe,EAAY,IAAIE,UAEhBC,EAAU,CACdC,KAAMrB,KAAKsB,WACXV,KAAMA,EACNW,aAAcvB,KAAKuB,aAAaC,KAAKxB,MACrCW,aAAcX,KAAKW,aAAaa,KAAKxB,MACrCM,OAASA,G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C,QAAQe,gBAAgB,UAC7BtD,KAAKuC,QAAQX,MAAMyB,QAAU,QAIjCvD,SAASyD,GACP/D,QAAQgE,MAAMD,GAEdlE,EAAEW,KAAKwC,KAAKiB,KAAK,MAAMC,QAAQ,qBAAqBH,UACpDlE,EAAEW,KAAKwC,KAAKQ,IAAI,UAAW,SAG7BlD,KAAK6D,EAAMC,EAAQxC,GACjBA,EAAUA,GAAW,GACrBwC,EAASA,MAAAA,EAA0C,GAAKA,EACxD,MAAMC,EAAQ,IAAIC,MAAMH,EAAM,CAC5BI,aAA6BC,IAApB5C,EAAQ2C,SAA+B3C,EAAQ2C,QACxDE,WAAYC,QAAQ9C,EAAQ6C,YAC5BE,cAA+BH,IAArB5C,EAAQ+C,UAAgC/C,EAAQ+C,WAE5DN,EAAMD,OAASA,EAGf,OAFaxC,EAAQgD,MAAQpE,MACxBqE,cAAcR,GACZA,EAGT/D,WAAWwE,EAAWC,GACpB,OAAO,IAAI1D,SAAQ,CAACC,EAAS0D,KAC3B,MAAMC,EAAS5C,SAASC,cAAc,UACtC2C,EAAOC,OAAQ,EACfD,EAAOE,IAAMJ,EAAWD,EAAYtE,KAAK4E,YAAYN,GACrDG,EAAOI,OAAS,IAAM/D,IACtB2D,EAAOK,QAAWC,GAAQP,EAAO,IAAIQ,SAAS,GAAGD,EAAIE,OAAON,QAC5D3E,KAAKiC,YAAYwC,MAIrB3E,YAAYoF,GACV,MAAO,GAAGA,IACRA,EAAIC,QAAQ,MAAQ,EAAI,IAAM,SAC3B,IAAIC,MAAOC,aAIpBC,eAAeC,OAAO,iBAAkB3F"} \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index 45f329c..dad3dc3 100755 --- a/package-lock.json +++ b/package-lock.json @@ -87,42 +87,190 @@ "fastq": "^1.6.0" } }, + "@rollup/plugin-json": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/@rollup/plugin-json/-/plugin-json-4.1.0.tgz", + "integrity": "sha512-yfLbTdNS6amI/2OpmbiBoW12vngr5NW2jCJVZSBEz+H5KfUJZ2M7sDjk0U6GOOdCWFVScShte29o9NezJ53TPw==", + "dev": true, + "requires": { + "@rollup/pluginutils": "^3.0.8" + } + }, + "@rollup/pluginutils": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/@rollup/pluginutils/-/pluginutils-3.1.0.tgz", + "integrity": "sha512-GksZ6pr6TpIjHm8h9lSQ8pi8BE9VeubNT0OMJ3B5uZJ8pz73NPiqOtCog/x2/QzM1ENChPKxMDhiQuRHsqc+lg==", + "dev": true, + "requires": { + "@types/estree": "0.0.39", + "estree-walker": "^1.0.1", + "picomatch": "^2.2.2" + } + }, + "@types/estree": { + "version": "0.0.39", + "resolved": "https://registry.npmjs.org/@types/estree/-/estree-0.0.39.tgz", + "integrity": "sha512-EYNwp3bU+98cpU4lAWYYL7Zz+2gryWH1qbdDTidVd6hkiR6weksdbMadyXKXNPEkQFhXM+hVO9ZygomHXp+AIw==", + "dev": true + }, + "@types/json-schema": { + "version": "7.0.6", + "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.6.tgz", + "integrity": "sha512-3c+yGKvVP5Y9TYBEibGNR+kLtijnj7mYrXRg+WpFb2X9xm04g/DXYkfg4hmzJQosc9snFNUPkbYIhu+KAm6jJw==", + "dev": true + }, + "@types/node": { + "version": "14.14.9", + "resolved": "https://registry.npmjs.org/@types/node/-/node-14.14.9.tgz", + "integrity": "sha512-JsoLXFppG62tWTklIoO4knA+oDTYsmqWxHRvd4lpmfQRNhX6osheUOWETP2jMoV/2bEHuMra8Pp3Dmo/stBFcw==", + "dev": true + }, + "@types/resolve": { + "version": "0.0.8", + "resolved": "https://registry.npmjs.org/@types/resolve/-/resolve-0.0.8.tgz", + "integrity": "sha512-auApPaJf3NPfe18hSoJkp8EbZzer2ISk7o8mCC3M9he/a04+gbMF97NkpD2S8riMGvm4BMRI59/SZQSaLTKpsQ==", + "dev": true, + "requires": { + "@types/node": "*" + } + }, + "@typescript-eslint/eslint-plugin": { + "version": "4.8.2", + "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-4.8.2.tgz", + "integrity": "sha512-gQ06QLV5l1DtvYtqOyFLXD9PdcILYqlrJj2l+CGDlPtmgLUzc1GpqciJFIRvyfvgLALpnxYINFuw+n9AZhPBKQ==", + "dev": true, + "requires": { + "@typescript-eslint/experimental-utils": "4.8.2", + "@typescript-eslint/scope-manager": "4.8.2", + "debug": "^4.1.1", + "functional-red-black-tree": "^1.0.1", + "regexpp": "^3.0.0", + "semver": "^7.3.2", + "tsutils": "^3.17.1" + }, + "dependencies": { + "@typescript-eslint/scope-manager": { + "version": "4.8.2", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-4.8.2.tgz", + "integrity": "sha512-qHQ8ODi7mMin4Sq2eh/6eu03uVzsf5TX+J43xRmiq8ujng7ViQSHNPLOHGw/Wr5dFEoxq/ubKhzClIIdQy5q3g==", + "dev": true, + "requires": { + "@typescript-eslint/types": "4.8.2", + "@typescript-eslint/visitor-keys": "4.8.2" + } + }, + "@typescript-eslint/types": { + "version": "4.8.2", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-4.8.2.tgz", + "integrity": "sha512-z1/AVcVF8ju5ObaHe2fOpZYEQrwHyZ7PTOlmjd3EoFeX9sv7UekQhfrCmgUO7PruLNfSHrJGQvrW3Q7xQ8EoAw==", + "dev": true + }, + "@typescript-eslint/visitor-keys": { + "version": "4.8.2", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-4.8.2.tgz", + "integrity": "sha512-Vg+/SJTMZJEKKGHW7YC21QxgKJrSbxoYYd3MEUGtW7zuytHuEcksewq0DUmo4eh/CTNrVJGSdIY9AtRb6riWFw==", + "dev": true, + "requires": { + "@typescript-eslint/types": "4.8.2", + "eslint-visitor-keys": "^2.0.0" + } + } + } + }, + "@typescript-eslint/experimental-utils": { + "version": "4.8.2", + "resolved": "https://registry.npmjs.org/@typescript-eslint/experimental-utils/-/experimental-utils-4.8.2.tgz", + "integrity": "sha512-hpTw6o6IhBZEsQsjuw/4RWmceRyESfAiEzAEnXHKG1X7S5DXFaZ4IO1JO7CW1aQ604leQBzjZmuMI9QBCAJX8Q==", + "dev": true, + "requires": { + "@types/json-schema": "^7.0.3", + "@typescript-eslint/scope-manager": "4.8.2", + "@typescript-eslint/types": "4.8.2", + "@typescript-eslint/typescript-estree": "4.8.2", + "eslint-scope": "^5.0.0", + "eslint-utils": "^2.0.0" + }, + "dependencies": { + "@typescript-eslint/scope-manager": { + "version": "4.8.2", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-4.8.2.tgz", + "integrity": "sha512-qHQ8ODi7mMin4Sq2eh/6eu03uVzsf5TX+J43xRmiq8ujng7ViQSHNPLOHGw/Wr5dFEoxq/ubKhzClIIdQy5q3g==", + "dev": true, + "requires": { + "@typescript-eslint/types": "4.8.2", + "@typescript-eslint/visitor-keys": "4.8.2" + } + }, + "@typescript-eslint/types": { + "version": "4.8.2", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-4.8.2.tgz", + "integrity": "sha512-z1/AVcVF8ju5ObaHe2fOpZYEQrwHyZ7PTOlmjd3EoFeX9sv7UekQhfrCmgUO7PruLNfSHrJGQvrW3Q7xQ8EoAw==", + "dev": true + }, + "@typescript-eslint/typescript-estree": { + "version": "4.8.2", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-4.8.2.tgz", + "integrity": "sha512-HToGNwI6fekH0dOw3XEVESUm71Onfam0AKin6f26S2FtUmO7o3cLlWgrIaT1q3vjB3wCTdww3Dx2iGq5wtUOCg==", + "dev": true, + "requires": { + "@typescript-eslint/types": "4.8.2", + "@typescript-eslint/visitor-keys": "4.8.2", + "debug": "^4.1.1", + "globby": "^11.0.1", + "is-glob": "^4.0.1", + "lodash": "^4.17.15", + "semver": "^7.3.2", + "tsutils": "^3.17.1" + } + }, + "@typescript-eslint/visitor-keys": { + "version": "4.8.2", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-4.8.2.tgz", + "integrity": "sha512-Vg+/SJTMZJEKKGHW7YC21QxgKJrSbxoYYd3MEUGtW7zuytHuEcksewq0DUmo4eh/CTNrVJGSdIY9AtRb6riWFw==", + "dev": true, + "requires": { + "@typescript-eslint/types": "4.8.2", + "eslint-visitor-keys": "^2.0.0" + } + } + } + }, "@typescript-eslint/parser": { - "version": "4.6.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-4.6.0.tgz", - "integrity": "sha512-Dj6NJxBhbdbPSZ5DYsQqpR32MwujF772F2H3VojWU6iT4AqL4BKuoNWOPFCoSZvCcADDvQjDpa6OLDAaiZPz2Q==", + "version": "4.8.2", + "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-4.8.2.tgz", + "integrity": "sha512-u0leyJqmclYr3KcXOqd2fmx6SDGBO0MUNHHAjr0JS4Crbb3C3d8dwAdlazy133PLCcPn+aOUFiHn72wcuc5wYw==", "dev": true, "requires": { - "@typescript-eslint/scope-manager": "4.6.0", - "@typescript-eslint/types": "4.6.0", - "@typescript-eslint/typescript-estree": "4.6.0", + "@typescript-eslint/scope-manager": "4.8.2", + "@typescript-eslint/types": "4.8.2", + "@typescript-eslint/typescript-estree": "4.8.2", "debug": "^4.1.1" } }, "@typescript-eslint/scope-manager": { - "version": "4.6.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-4.6.0.tgz", - "integrity": "sha512-uZx5KvStXP/lwrMrfQQwDNvh2ppiXzz5TmyTVHb+5TfZ3sUP7U1onlz3pjoWrK9konRyFe1czyxObWTly27Ang==", + "version": "4.8.2", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-4.8.2.tgz", + "integrity": "sha512-qHQ8ODi7mMin4Sq2eh/6eu03uVzsf5TX+J43xRmiq8ujng7ViQSHNPLOHGw/Wr5dFEoxq/ubKhzClIIdQy5q3g==", "dev": true, "requires": { - "@typescript-eslint/types": "4.6.0", - "@typescript-eslint/visitor-keys": "4.6.0" + "@typescript-eslint/types": "4.8.2", + "@typescript-eslint/visitor-keys": "4.8.2" } }, "@typescript-eslint/types": { - "version": "4.6.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-4.6.0.tgz", - "integrity": "sha512-5FAgjqH68SfFG4UTtIFv+rqYJg0nLjfkjD0iv+5O27a0xEeNZ5rZNDvFGZDizlCD1Ifj7MAbSW2DPMrf0E9zjA==", + "version": "4.8.2", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-4.8.2.tgz", + "integrity": "sha512-z1/AVcVF8ju5ObaHe2fOpZYEQrwHyZ7PTOlmjd3EoFeX9sv7UekQhfrCmgUO7PruLNfSHrJGQvrW3Q7xQ8EoAw==", "dev": true }, "@typescript-eslint/typescript-estree": { - "version": "4.6.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-4.6.0.tgz", - "integrity": "sha512-s4Z9qubMrAo/tw0CbN0IN4AtfwuehGXVZM0CHNMdfYMGBDhPdwTEpBrecwhP7dRJu6d9tT9ECYNaWDHvlFSngA==", + "version": "4.8.2", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-4.8.2.tgz", + "integrity": "sha512-HToGNwI6fekH0dOw3XEVESUm71Onfam0AKin6f26S2FtUmO7o3cLlWgrIaT1q3vjB3wCTdww3Dx2iGq5wtUOCg==", "dev": true, "requires": { - "@typescript-eslint/types": "4.6.0", - "@typescript-eslint/visitor-keys": "4.6.0", + "@typescript-eslint/types": "4.8.2", + "@typescript-eslint/visitor-keys": "4.8.2", "debug": "^4.1.1", "globby": "^11.0.1", "is-glob": "^4.0.1", @@ -132,12 +280,12 @@ } }, "@typescript-eslint/visitor-keys": { - "version": "4.6.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-4.6.0.tgz", - "integrity": "sha512-38Aa9Ztl0XyFPVzmutHXqDMCu15Xx8yKvUo38Gu3GhsuckCh3StPI5t2WIO9LHEsOH7MLmlGfKUisU8eW1Sjhg==", + "version": "4.8.2", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-4.8.2.tgz", + "integrity": "sha512-Vg+/SJTMZJEKKGHW7YC21QxgKJrSbxoYYd3MEUGtW7zuytHuEcksewq0DUmo4eh/CTNrVJGSdIY9AtRb6riWFw==", "dev": true, "requires": { - "@typescript-eslint/types": "4.6.0", + "@typescript-eslint/types": "4.8.2", "eslint-visitor-keys": "^2.0.0" } }, @@ -545,6 +693,12 @@ "integrity": "sha1-JuYe0UIvtw3ULm42cp7VHYVf6Nk=", "dev": true }, + "builtin-modules": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/builtin-modules/-/builtin-modules-3.1.0.tgz", + "integrity": "sha512-k0KL0aWZuBt2lrxrcASWDfwOLMnodeQjodT/1SxEQAXsHANgo6ZC/VEaSEHCXt7aSTZ4/4H5LKa+tBXmW7Vtvw==", + "dev": true + }, "builtin-status-codes": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/builtin-status-codes/-/builtin-status-codes-3.0.0.tgz", @@ -684,6 +838,12 @@ "keypress": "0.1.x" } }, + "commondir": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/commondir/-/commondir-1.0.1.tgz", + "integrity": "sha1-3dgA2gxmEnOTzKWVDqloo6rxJTs=", + "dev": true + }, "concat-map": { "version": "0.0.1", "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", @@ -1132,6 +1292,12 @@ "integrity": "sha512-39nnKffWz8xN1BU/2c79n9nB9HDzo0niYUqx6xyqUnyoAnQyyWpOTdZEeiCch8BBu515t4wp9ZmgVfVhn9EBpw==", "dev": true }, + "estree-walker": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-1.0.1.tgz", + "integrity": "sha512-1fMXF3YP4pZZVozF8j/ZLfvnR8NSIljt56UhbZ5PeeDmmGHpgpdwQt7ITlGvYaQukCvuBRMLEiKiYC+oeIg4cg==", + "dev": true + }, "esutils": { "version": "2.0.3", "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.3.tgz", @@ -1219,6 +1385,27 @@ "to-regex-range": "^5.0.1" } }, + "find-cache-dir": { + "version": "3.3.1", + "resolved": "https://registry.npmjs.org/find-cache-dir/-/find-cache-dir-3.3.1.tgz", + "integrity": "sha512-t2GDMt3oGC/v+BMwzmllWDuJF/xcDtE5j/fCGbqDD7OLuJkj0cfh1YSA5VKPvwMeLFLNDBkwOKZ2X85jGLVftQ==", + "dev": true, + "requires": { + "commondir": "^1.0.1", + "make-dir": "^3.0.2", + "pkg-dir": "^4.1.0" + } + }, + "find-up": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz", + "integrity": "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==", + "dev": true, + "requires": { + "locate-path": "^5.0.0", + "path-exists": "^4.0.0" + } + }, "flat-cache": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-2.0.1.tgz", @@ -1242,6 +1429,17 @@ "integrity": "sha1-C+4AUBiusmDQo6865ljdATbsG5k=", "dev": true }, + "fs-extra": { + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-8.1.0.tgz", + "integrity": "sha512-yhlQgA6mnOJUKOsRUFsgJdQCvkKhcz8tlZG5HBQfReYZy46OwLcY+Zia0mtdHsOo9y/hP+CxMN0TU9QxoOtG4g==", + "dev": true, + "requires": { + "graceful-fs": "^4.2.0", + "jsonfile": "^4.0.0", + "universalify": "^0.1.0" + } + }, "fs.realpath": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", @@ -1336,6 +1534,12 @@ } } }, + "graceful-fs": { + "version": "4.2.4", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.4.tgz", + "integrity": "sha512-WjKPNJF79dtJAVniUlGGWHYGz2jWxT6VhN/4m1NdkbZ2nOsEF+cI1Edgql5zCRhs/VsQYRvrXctxktVXZUkixw==", + "dev": true + }, "has": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", @@ -1557,6 +1761,12 @@ "is-extglob": "^2.1.1" } }, + "is-module": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-module/-/is-module-1.0.0.tgz", + "integrity": "sha1-Mlj7afeMFNW4FdZkM2tM/7ZEFZE=", + "dev": true + }, "is-negative-zero": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/is-negative-zero/-/is-negative-zero-2.0.0.tgz", @@ -1611,6 +1821,34 @@ "integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=", "dev": true }, + "jest-worker": { + "version": "26.6.2", + "resolved": "https://registry.npmjs.org/jest-worker/-/jest-worker-26.6.2.tgz", + "integrity": "sha512-KWYVV1c4i+jbMpaBC+U++4Va0cp8OisU185o73T1vo99hqi7w8tSJfUXYswwqqrjzwxa6KpRK54WhPvwf5w6PQ==", + "dev": true, + "requires": { + "@types/node": "*", + "merge-stream": "^2.0.0", + "supports-color": "^7.0.0" + }, + "dependencies": { + "has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true + }, + "supports-color": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "dev": true, + "requires": { + "has-flag": "^4.0.0" + } + } + } + }, "jquery": { "version": "3.5.1", "resolved": "https://registry.npmjs.org/jquery/-/jquery-3.5.1.tgz", @@ -1653,6 +1891,15 @@ "integrity": "sha1-nbe1lJatPzz+8wp1FC0tkwrXJlE=", "dev": true }, + "jsonfile": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-4.0.0.tgz", + "integrity": "sha1-h3Gq4HmbZAdrdmQPygWPnBDjPss=", + "dev": true, + "requires": { + "graceful-fs": "^4.1.6" + } + }, "jsonparse": { "version": "1.3.1", "resolved": "https://registry.npmjs.org/jsonparse/-/jsonparse-1.3.1.tgz", @@ -1685,6 +1932,15 @@ "type-check": "~0.4.0" } }, + "locate-path": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz", + "integrity": "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==", + "dev": true, + "requires": { + "p-locate": "^4.1.0" + } + }, "lodash": { "version": "4.17.20", "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.20.tgz", @@ -1697,6 +1953,23 @@ "integrity": "sha1-LcvSwofLwKVcxCMovQxzYVDVPj8=", "dev": true }, + "make-dir": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-3.1.0.tgz", + "integrity": "sha512-g3FeP20LNwhALb/6Cz6Dd4F2ngze0jz7tbzrD2wAV+o9FeNHe4rL+yK2md0J/fiSf1sa1ADhXqi5+oVwOM/eGw==", + "dev": true, + "requires": { + "semver": "^6.0.0" + }, + "dependencies": { + "semver": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", + "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", + "dev": true + } + } + }, "md5.js": { "version": "1.3.5", "resolved": "https://registry.npmjs.org/md5.js/-/md5.js-1.3.5.tgz", @@ -1708,6 +1981,12 @@ "safe-buffer": "^5.1.2" } }, + "merge-stream": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/merge-stream/-/merge-stream-2.0.0.tgz", + "integrity": "sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w==", + "dev": true + }, "merge2": { "version": "1.4.1", "resolved": "https://registry.npmjs.org/merge2/-/merge2-1.4.1.tgz", @@ -1876,6 +2155,30 @@ "integrity": "sha1-hUNzx/XCMVkU/Jv8a9gjj92h7Cc=", "dev": true }, + "p-limit": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz", + "integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==", + "dev": true, + "requires": { + "p-try": "^2.0.0" + } + }, + "p-locate": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-4.1.0.tgz", + "integrity": "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==", + "dev": true, + "requires": { + "p-limit": "^2.2.0" + } + }, + "p-try": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz", + "integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==", + "dev": true + }, "pako": { "version": "1.0.11", "resolved": "https://registry.npmjs.org/pako/-/pako-1.0.11.tgz", @@ -1919,6 +2222,12 @@ "integrity": "sha512-b7uo2UCUOYZcnF/3ID0lulOJi/bafxa1xPe7ZPsammBSpjSWQkjNxlt635YGS2MiR9GjvuXCtz2emr3jbsz98g==", "dev": true }, + "path-exists": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", + "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==", + "dev": true + }, "path-is-absolute": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", @@ -1967,6 +2276,15 @@ "integrity": "sha512-q0M/9eZHzmr0AulXyPwNfZjtwZ/RBZlbN3K3CErVrk50T2ASYI7Bye0EvekFY3IP1Nt2DHu0re+V2ZHIpMkuWg==", "dev": true }, + "pkg-dir": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/pkg-dir/-/pkg-dir-4.2.0.tgz", + "integrity": "sha512-HRDzbaKjC+AOWVXxAU/x54COGeIv9eb+6CkDSQoNTt4XyWoIJvuPsXizxu/Fr23EiekbtZwmh1IcIG/l/a10GQ==", + "dev": true, + "requires": { + "find-up": "^4.0.0" + } + }, "prelude-ls": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.2.1.tgz", @@ -2136,6 +2454,78 @@ "fsevents": "~2.1.2" } }, + "rollup-plugin-node-resolve": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/rollup-plugin-node-resolve/-/rollup-plugin-node-resolve-5.2.0.tgz", + "integrity": "sha512-jUlyaDXts7TW2CqQ4GaO5VJ4PwwaV8VUGA7+km3n6k6xtOEacf61u0VXwN80phY/evMcaS+9eIeJ9MOyDxt5Zw==", + "dev": true, + "requires": { + "@types/resolve": "0.0.8", + "builtin-modules": "^3.1.0", + "is-module": "^1.0.0", + "resolve": "^1.11.1", + "rollup-pluginutils": "^2.8.1" + } + }, + "rollup-plugin-terser": { + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/rollup-plugin-terser/-/rollup-plugin-terser-7.0.2.tgz", + "integrity": "sha512-w3iIaU4OxcF52UUXiZNsNeuXIMDvFrr+ZXK6bFZ0Q60qyVfq4uLptoS4bbq3paG3x216eQllFZX7zt6TIImguQ==", + "dev": true, + "requires": { + "@babel/code-frame": "^7.10.4", + "jest-worker": "^26.2.1", + "serialize-javascript": "^4.0.0", + "terser": "^5.0.0" + } + }, + "rollup-plugin-typescript2": { + "version": "0.29.0", + "resolved": "https://registry.npmjs.org/rollup-plugin-typescript2/-/rollup-plugin-typescript2-0.29.0.tgz", + "integrity": "sha512-YytahBSZCIjn/elFugEGQR5qTsVhxhUwGZIsA9TmrSsC88qroGo65O5HZP/TTArH2dm0vUmYWhKchhwi2wL9bw==", + "dev": true, + "requires": { + "@rollup/pluginutils": "^3.1.0", + "find-cache-dir": "^3.3.1", + "fs-extra": "8.1.0", + "resolve": "1.17.0", + "tslib": "2.0.1" + }, + "dependencies": { + "resolve": { + "version": "1.17.0", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.17.0.tgz", + "integrity": "sha512-ic+7JYiV8Vi2yzQGFWOkiZD5Z9z7O2Zhm9XMaTxdJExKasieFCr+yXZ/WmXsckHiKl12ar0y6XiXDx3m4RHn1w==", + "dev": true, + "requires": { + "path-parse": "^1.0.6" + } + }, + "tslib": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.0.1.tgz", + "integrity": "sha512-SgIkNheinmEBgx1IUNirK0TUD4X9yjjBRTqqjggWCU3pUEqIk3/Uwl3yRixYKT6WjQuGiwDv4NomL3wqRCj+CQ==", + "dev": true + } + } + }, + "rollup-pluginutils": { + "version": "2.8.2", + "resolved": "https://registry.npmjs.org/rollup-pluginutils/-/rollup-pluginutils-2.8.2.tgz", + "integrity": "sha512-EEp9NhnUkwY8aif6bxgovPHMoMoNr2FulJziTndpt5H9RdwC47GSGuII9XxpSdzVGM0GWrNPHV6ie1LTNJPaLQ==", + "dev": true, + "requires": { + "estree-walker": "^0.6.1" + }, + "dependencies": { + "estree-walker": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-0.6.1.tgz", + "integrity": "sha512-SqmZANLWS0mnatqbSfRP5g8OXZC12Fgg1IwNtLsyHDzJizORW4khDfjPqJZsemPWBB2uqykUah5YpQ6epsqC/w==", + "dev": true + } + } + }, "run-parallel": { "version": "1.1.10", "resolved": "https://registry.npmjs.org/run-parallel/-/run-parallel-1.1.10.tgz", @@ -2160,6 +2550,15 @@ "integrity": "sha512-OrOb32TeeambH6UrhtShmF7CRDqhL6/5XpPNp2DuRH6+9QLw/orhp72j87v8Qa1ScDkvrrBNpZcDejAirJmfXQ==", "dev": true }, + "serialize-javascript": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/serialize-javascript/-/serialize-javascript-4.0.0.tgz", + "integrity": "sha512-GaNA54380uFefWghODBWEGisLZFj00nS5ACs6yHa9nLqlLpVLO8ChDGeKRjZnV4Nh4n0Qi7nhYZD/9fCPzEqkw==", + "dev": true, + "requires": { + "randombytes": "^2.1.0" + } + }, "sha.js": { "version": "2.4.11", "resolved": "https://registry.npmjs.org/sha.js/-/sha.js-2.4.11.tgz", @@ -2223,6 +2622,30 @@ "is-fullwidth-code-point": "^2.0.0" } }, + "source-map": { + "version": "0.7.3", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.7.3.tgz", + "integrity": "sha512-CkCj6giN3S+n9qrYiBTX5gystlENnRW5jZeNLHpe6aue+SrHcG5VYwujhW9s4dY31mEGsxBDrHR6oI69fTXsaQ==", + "dev": true + }, + "source-map-support": { + "version": "0.5.19", + "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.19.tgz", + "integrity": "sha512-Wonm7zOCIJzBGQdB+thsPar0kYuCIzYvxZwlBa87yi/Mdjv7Tip2cyVbLj5o0cFPN4EVkuTwb3GDDyUx2DGnGw==", + "dev": true, + "requires": { + "buffer-from": "^1.0.0", + "source-map": "^0.6.0" + }, + "dependencies": { + "source-map": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", + "dev": true + } + } + }, "sprintf-js": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", @@ -2451,6 +2874,25 @@ "string-width": "^3.0.0" } }, + "terser": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/terser/-/terser-5.5.0.tgz", + "integrity": "sha512-eopt1Gf7/AQyPhpygdKePTzaet31TvQxXvrf7xYUvD/d8qkCJm4SKPDzu+GHK5ZaYTn8rvttfqaZc3swK21e5g==", + "dev": true, + "requires": { + "commander": "^2.20.0", + "source-map": "~0.7.2", + "source-map-support": "~0.5.19" + }, + "dependencies": { + "commander": { + "version": "2.20.3", + "resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz", + "integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==", + "dev": true + } + } + }, "text-table": { "version": "0.2.0", "resolved": "https://registry.npmjs.org/text-table/-/text-table-0.2.0.tgz", @@ -2558,6 +3000,12 @@ "xtend": "^4.0.1" } }, + "universalify": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/universalify/-/universalify-0.1.2.tgz", + "integrity": "sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg==", + "dev": true + }, "uri-js": { "version": "4.4.0", "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.0.tgz", diff --git a/package.json b/package.json index 9f8a58a..81c6c63 100755 --- a/package.json +++ b/package.json @@ -35,12 +35,17 @@ "yamljs": "^0.3.0" }, "devDependencies": { - "@typescript-eslint/parser": "^4.6.0", + "@rollup/plugin-json": "^4.1.0", + "@typescript-eslint/eslint-plugin": "^4.8.2", + "@typescript-eslint/parser": "^4.8.2", "browserify": "^17.0.0", "eslint": "^7.12.1", "js": "^0.1.0", "prettier": "^2.1.2", "rollup": "^2.33.0", + "rollup-plugin-node-resolve": "^5.2.0", + "rollup-plugin-terser": "^7.0.2", + "rollup-plugin-typescript2": "^0.29.0", "typescript": "^4.0.5" }, "browser": { diff --git a/rollup.config.js b/rollup.config.js index 5271866..6a3ea64 100755 --- a/rollup.config.js +++ b/rollup.config.js @@ -1,11 +1,18 @@ +import typescript from "rollup-plugin-typescript2"; +import nodeResolve from "rollup-plugin-node-resolve"; +import { terser } from "rollup-plugin-terser"; +import json from "@rollup/plugin-json"; + +const plugins = [nodeResolve(), typescript(), json(), terser()]; export default [ { inlineDynamicImports: true, - input: 'src/floorplan-card.js', + input: "src/floorplan-card.js", output: { - dir: 'dist', - format: 'esm', - sourcemap: true + dir: "dist", + format: "esm", + sourcemap: true, }, + plugins: [...plugins], }, ]; diff --git a/src/floorplan-card.js b/src/floorplan-card.js index 2202f4a..fe76a07 100755 --- a/src/floorplan-card.js +++ b/src/floorplan-card.js @@ -1,12 +1,27 @@ global.$ = require("jquery"); var YAML = require("yamljs"); +// Package Information +var packageInfo = require("./../package.json"); + // jQuery LongPress Plugin require("jquery.longpress"); // Main Floorplan lib require("floorplan"); +import { localize } from "./localize/localize.ts"; + +// Display our Card Version in console +/* eslint no-console: 0 */ +console.info( + `%c LOVELACE-FLOORPLAN CARD \n%c ${localize("common.version")} ${ + packageInfo.version + } `, + "color: orange; font-weight: bold; background: black", + "color: white; font-weight: bold; background: rgb(71, 170, 238)" +); + class FloorplanCard extends HTMLElement { constructor() { super();