From e86c0267cab6feefb116fe7fee25666666d30568 Mon Sep 17 00:00:00 2001 From: michael-silva Date: Thu, 7 Dec 2017 13:15:19 -0200 Subject: [PATCH 1/3] prepare ambient to run --- .gitignore | 1 + polymer.json | 7 +++++++ 2 files changed, 8 insertions(+) create mode 100644 .gitignore create mode 100644 polymer.json diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..ab079b0 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +bower_components \ No newline at end of file diff --git a/polymer.json b/polymer.json new file mode 100644 index 0000000..f155c5a --- /dev/null +++ b/polymer.json @@ -0,0 +1,7 @@ +{ + "lint": { + "rules": [ + "polymer-2" + ] + } +} \ No newline at end of file From cf4e2f30994b540b311afa065525af1087ad0ede Mon Sep 17 00:00:00 2001 From: michael-silva Date: Thu, 7 Dec 2017 13:41:17 -0200 Subject: [PATCH 2/3] move color-dialog to external --- l2t-paper-color.html | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/l2t-paper-color.html b/l2t-paper-color.html index 1ef7cc8..e64dd21 100644 --- a/l2t-paper-color.html +++ b/l2t-paper-color.html @@ -49,10 +49,6 @@ - - @@ -140,7 +136,7 @@ */ _dialogHandler(e) { if(e.detail) { - this.value = this.shadowRoot.querySelector('l2t-paper-color-dialog').color; + this.value = this.colorDialog.color; } } /** @@ -150,13 +146,19 @@ if(this.readonly) return - var colorDialog = this.shadowRoot.querySelector('l2t-paper-color-dialog'); - colorDialog.color=this.value||colorDialog.color; - colorDialog.open(); + this.colorDialog.color = this.value||this.colorDialog.color; + this.colorDialog.open(); + } + _createDialog() { + this.colorDialog = document.createElement('l2t-paper-color-dialog'); + this.colorDialog.colors = this.colors; + this.colorDialog.hideAdvanced = this.hideAdvanced; + document.body.appendChild(this.colorDialog); } ready(){ super.ready(); - this.addEventListener("paper-color-dialog-closed", function(e){this._dialogHandler(e)}, false); + this._createDialog(); + this.colorDialog.addEventListener("paper-color-dialog-closed", (e) => this._dialogHandler(e), false); } } From cab578498f4af67c021d9348e7b1652e2673868c Mon Sep 17 00:00:00 2001 From: michael-silva Date: Thu, 7 Dec 2017 16:25:53 -0200 Subject: [PATCH 3/3] add event change --- l2t-paper-color.html | 1 + 1 file changed, 1 insertion(+) diff --git a/l2t-paper-color.html b/l2t-paper-color.html index e64dd21..5393b5f 100644 --- a/l2t-paper-color.html +++ b/l2t-paper-color.html @@ -137,6 +137,7 @@ _dialogHandler(e) { if(e.detail) { this.value = this.colorDialog.color; + this.dispatchEvent(new CustomEvent('change')); } } /**