diff --git a/boilerplate-card-editor.js b/boilerplate-card-editor.js new file mode 100644 index 00000000..8b137891 --- /dev/null +++ b/boilerplate-card-editor.js @@ -0,0 +1 @@ + diff --git a/boilerplate-card.js b/boilerplate-card.js index b0c5e2ee..3e58bbff 100644 --- a/boilerplate-card.js +++ b/boilerplate-card.js @@ -1,23 +1,23 @@ -/*! ***************************************************************************** -Copyright (c) Microsoft Corporation. All rights reserved. -Licensed under the Apache License, Version 2.0 (the "License"); you may not use -this file except in compliance with the License. You may obtain a copy of the -License at http://www.apache.org/licenses/LICENSE-2.0 - -THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED -WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, -MERCHANTABLITY OR NON-INFRINGEMENT. - -See the Apache Version 2.0 License for specific language governing permissions -and limitations under the License. -***************************************************************************** */ - -function __decorate(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; +/*! ***************************************************************************** +Copyright (c) Microsoft Corporation. All rights reserved. +Licensed under the Apache License, Version 2.0 (the "License"); you may not use +this file except in compliance with the License. You may obtain a copy of the +License at http://www.apache.org/licenses/LICENSE-2.0 + +THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED +WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, +MERCHANTABLITY OR NON-INFRINGEMENT. + +See the Apache Version 2.0 License for specific language governing permissions +and limitations under the License. +***************************************************************************** */ + +function __decorate(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; } /** @@ -2302,33 +2302,32 @@ LitElement.finalized = true; */ LitElement.render = render$1; -// TODO Name your custom element -let BoilerplateCard = class BoilerplateCard extends LitElement { - setConfig(config) { - // TODO Check for required fields and that they are of the proper format - if (!config || config.show_error) { - throw new Error('Invalid configuration'); - } - this._config = config; - } - render() { - if (!this._config || !this.hass) { - return html ``; - } - // TODO Check for stateObj or other necessary things and render a warning if missing - if (this._config.show_warning) { +// TODO Name your custom element +let BoilerplateCard = class BoilerplateCard extends LitElement { + setConfig(config) { + // TODO Check for required fields and that they are of the proper format + if (!config || config.show_error) { + throw new Error('Invalid configuration'); + } + this._config = config; + } + render() { + if (!this._config || !this.hass) { + return html ``; + } + // TODO Check for stateObj or other necessary things and render a warning if missing + if (this._config.show_warning) { return html `
Show Warning
-
`; - } + + `; + } return html ` - - `; - } - static get styles() { + + `; + } + static get styles() { return css ` .warning { display: block; @@ -2336,15 +2335,15 @@ let BoilerplateCard = class BoilerplateCard extends LitElement { background-color: #fce588; padding: 8px; } - `; - } -}; -__decorate([ - property() -], BoilerplateCard.prototype, "hass", void 0); -__decorate([ - property() -], BoilerplateCard.prototype, "_config", void 0); -BoilerplateCard = __decorate([ - customElement('boilerplate-card') + `; + } +}; +__decorate([ + property() +], BoilerplateCard.prototype, "hass", void 0); +__decorate([ + property() +], BoilerplateCard.prototype, "_config", void 0); +BoilerplateCard = __decorate([ + customElement('boilerplate-card') ], BoilerplateCard); diff --git a/rollup.config.js b/rollup.config.js index 7f9fc1a3..89214aec 100644 --- a/rollup.config.js +++ b/rollup.config.js @@ -1,14 +1,27 @@ import resolve from 'rollup-plugin-node-resolve'; import typescript from 'rollup-plugin-typescript2'; -export default { - input: 'src/index.ts', - output: { - file: 'boilerplate-card.js', - format: 'es' + +const commonPlugins = [ + resolve(), + typescript() +]; + +export default [ + { + input: 'src/index.ts', + output: { + file: 'boilerplate-card.js', + format: 'es' + }, + plugins: [...commonPlugins] }, - plugins: [ - resolve(), - typescript () - ] -}; \ No newline at end of file + { + input: 'src/editor.ts', + output: { + file: 'boilerplate-card-editor.js', + format: 'es' + }, + plugins: [...commonPlugins] + } +] \ No newline at end of file diff --git a/src/editor.ts b/src/editor.ts new file mode 100644 index 00000000..e69de29b