Index: third_party/polymer/components-chromium/paper-button/paper-button-extracted.js |
diff --git a/third_party/polymer/components-chromium/paper-button/paper-button-extracted.js b/third_party/polymer/components-chromium/paper-button/paper-button-extracted.js |
new file mode 100644 |
index 0000000000000000000000000000000000000000..23490b5266f8e7ed45b424a04160323765b3fbf0 |
--- /dev/null |
+++ b/third_party/polymer/components-chromium/paper-button/paper-button-extracted.js |
@@ -0,0 +1,127 @@ |
+ |
+ Polymer('paper-button', { |
+ |
+ publish: { |
+ |
+ /** |
+ * The label of the button. |
+ * |
+ * @attribute label |
+ * @type string |
+ * @default '' |
+ */ |
+ label: '', |
+ |
+ /** |
+ * If true, the button will be styled as a "raised" button. |
+ * |
+ * @attribute raisedButton |
+ * @type boolean |
+ * @default false |
+ */ |
+ raisedButton: {value: false, reflect: true}, |
+ |
+ /** |
+ * (optional) The URL of an image for an icon to use in the button. |
+ * Should not use `icon` property if you are using this property. |
+ * |
+ * @attribute iconSrc |
+ * @type string |
+ * @default '' |
+ */ |
+ iconSrc: '', |
+ |
+ /** |
+ * (optional) Specifies the icon name or index in the set of icons |
+ * available in the icon set. If using this property, load the icon |
+ * set separately where the icon is used. Should not use `src` |
+ * if you are using this property. |
+ * |
+ * @attribute icon |
+ * @type string |
+ * @default '' |
+ */ |
+ icon: '' |
+ |
+ }, |
+ |
+ z: 1, |
+ |
+ attached: function() { |
+ if (this.textContent && !this.textContent.match(/\s+/)) { |
+ console.warn('Using textContent to label the button is deprecated. Use the "label" property instead'); |
+ this.label = this.textContent; |
+ } |
+ }, |
+ |
+ activeChanged: function() { |
+ this.super(); |
+ |
+ if (this.active) { |
+ // FIXME: remove when paper-ripple can have a default 'down' state. |
+ if (!this.lastEvent) { |
+ var rect = this.getBoundingClientRect(); |
+ this.lastEvent = { |
+ x: rect.left + rect.width / 2, |
+ y: rect.top + rect.height / 2 |
+ } |
+ } |
+ this.$.ripple.downAction(this.lastEvent); |
+ } else { |
+ this.$.ripple.upAction(); |
+ } |
+ this.adjustZ(); |
+ }, |
+ |
+ focusedChanged: function() { |
+ this.super(); |
+ this.adjustZ(); |
+ }, |
+ |
+ disabledChanged: function() { |
+ this.super(); |
+ this.adjustZ(); |
+ }, |
+ |
+ // waitForSpillCompleted: function(callback) { |
+ // this.async(callback, null, (this.$.ink.spillCompleted ? 0 : this.duration)); |
+ // }, |
+ |
+ // resetInk: function() { |
+ // this.active = false; |
+ // this.$.ink.reset(); |
+ // }, |
+ |
+ insideButton: function(x, y) { |
+ var rect = this.getBoundingClientRect(); |
+ return (rect.left <= x) && (x <= rect.right) && (rect.top <= y) && (y <= rect.bottom); |
+ }, |
+ |
+ adjustZ: function() { |
+ if (this.focused) { |
+ this.classList.add('paper-shadow-animate-z-1-z-2'); |
+ } else { |
+ this.classList.remove('paper-shadow-animate-z-1-z-2'); |
+ |
+ if (this.active) { |
+ this.z = 2; |
+ } else if (this.disabled) { |
+ this.z = 0; |
+ } else { |
+ this.z = 1; |
+ } |
+ |
+ } |
+ }, |
+ |
+ downAction: function(e) { |
+ this.super(e); |
+ this.lastEvent = e; |
+ }, |
+ |
+ labelChanged: function() { |
+ this.setAttribute('aria-label', this.label); |
+ } |
+ |
+ }); |
+ |