diff --git a/.gitignore b/.gitignore
index e43b0f98..91dfed8d 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1 +1,2 @@
.DS_Store
+node_modules
\ No newline at end of file
diff --git a/android-tv-card-editor.js b/android-tv-card-editor.js
deleted file mode 100644
index 5ff29f77..00000000
--- a/android-tv-card-editor.js
+++ /dev/null
@@ -1,186 +0,0 @@
-if (!customElements.get('paper-input')) {
- console.log('imported', 'paper-input')
- import('https://unpkg.com/@polymer/paper-input/paper-input.js?module')
-}
-
-const fireEvent = (node, 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
- node.dispatchEvent(event)
- return event
-}
-
-const LitElement = Object.getPrototypeOf(
- customElements.get('ha-panel-lovelace')
-)
-const html = LitElement.prototype.html
-
-export class TVCardEditor extends LitElement {
- setConfig(config) {
- this._config = config
- }
-
- static get properties() {
- return { hass: {}, _config: {} }
- }
-
- get _name() {
- return this._config.name || ''
- }
-
- get _entity() {
- return this._config.entity || ''
- }
-
- get _remote() {
- return this._config.remote || ''
- }
-
- get _theme() {
- return this._config.theme
- }
-
- get _tv() {
- return this._config.tv || false
- }
-
- render() {
- if (!this.hass) {
- return html``
- }
-
- const themes = ['Backend-selected', 'default'].concat(
- Object.keys(this.hass.themes.themes).sort()
- )
-
- const entities = Object.keys(this.hass.states).filter(
- (eid) => eid.substr(0, eid.indexOf('.')) === 'media_player'
- )
- const remotes = [''].concat(
- Object.keys(this.hass.states).filter(
- (eid) => eid.substr(0, eid.indexOf('.')) === 'remote'
- )
- )
-
- return html`
- ${this.renderStyle()}
-
-
-
-
-
- ${entities.map((entity) => {
- return html`
- ${entity}
- `
- })}
-
-
-
-
-
-
- ${remotes.map((remote) => {
- return html`
- ${remote}
- `
- })}
-
-
-
-
-
- ${themes.map((theme) => {
- return html` ${theme} `
- })}
-
-
-
Roku TV?
-
-
- Use the YAML editor if you need to specify custom services
-
-
- `
- }
-
- renderStyle() {
- return html`
-
- `
- }
-
- _valueChanged(ev) {
- if (!this._config || !this.hass) {
- return
- }
- const target = ev.target
- if (this[`_${target.configValue}`] === target.value) {
- return
- }
- if (target.configValue) {
- if (target.value === '') {
- delete this._config[target.configValue]
- } else {
- this._config = {
- ...this._config,
- [target.configValue]:
- target.checked !== undefined
- ? target.checked
- : target.value,
- }
- }
- }
- fireEvent(this, 'config-changed', { config: this._config })
- }
-}
-
-customElements.define('android-tv-card-editor', TVCardEditor)
diff --git a/package.json b/package.json
new file mode 100644
index 00000000..39331dd3
--- /dev/null
+++ b/package.json
@@ -0,0 +1,29 @@
+{
+ "name": "android-tv-card",
+ "version": "1.3.3",
+ "description": "Android TV Remote Card",
+ "main": "./src/android-tv-card.js",
+ "scripts": {
+ "test": "echo \"Error: no test specified\" && exit 1"
+ },
+ "repository": {
+ "type": "git",
+ "url": "git+https://github.com/Nerwyn/android-tv-card.git"
+ },
+ "keywords": [
+ "androidtv",
+ "android",
+ "googletv",
+ "google",
+ "tvcard",
+ "remote",
+ "tv",
+ "television"
+ ],
+ "author": "Nerwyn",
+ "license": "Apache-2.0",
+ "bugs": {
+ "url": "https://github.com/Nerwyn/android-tv-card/issues"
+ },
+ "homepage": "https://github.com/Nerwyn/android-tv-card#readme"
+}
diff --git a/package.yaml b/package.yaml
deleted file mode 100644
index 9bc4b5ec..00000000
--- a/package.yaml
+++ /dev/null
@@ -1,25 +0,0 @@
-name: Android TV Card
-description: 📺 Android TV Remote Card
-version: 1.3.3
-type: lovelace
-keywords:
- - androidtv
- - android
- - googletv
- - google
- - tvcard
- - remote
- - tv
- - television
-author:
- name: Nerwyn
-license: Apache License, Version 2.0
-files:
- - android-tv-card.js
- - android-tv-card-editor.js
-bugs:
- url: https://github.com/Nerwyn/android-tv-card/issues
-homepage: https://github.com/Nerwyn/android-tv-card#readme
-repository:
- type: git
- url: git+https://github.com/Nerwyn/android-tv-card.git
diff --git a/android-tv-card.js b/src/android-tv-card.js
similarity index 100%
rename from android-tv-card.js
rename to src/android-tv-card.js
diff --git a/src/models/defaultKeys.js b/src/models/defaultKeys.js
new file mode 100644
index 00000000..e69de29b
diff --git a/src/models/defaultSources.js b/src/models/defaultSources.js
new file mode 100644
index 00000000..e69de29b
diff --git a/src/models/index.js b/src/models/index.js
new file mode 100644
index 00000000..e69de29b