Index: third_party/polymer/v0_8/components/iron-icon/iron-icon.html |
diff --git a/third_party/polymer/v0_8/components/iron-icon/iron-icon.html b/third_party/polymer/v0_8/components/iron-icon/iron-icon.html |
index d719791d59a1ff7a83b279bd2041739095a92e21..ea9778ada32f355c64467314b8d44f9e4615ea8e 100644 |
--- a/third_party/polymer/v0_8/components/iron-icon/iron-icon.html |
+++ b/third_party/polymer/v0_8/components/iron-icon/iron-icon.html |
@@ -1,4 +1,5 @@ |
<!-- |
+@license |
Copyright (c) 2015 The Polymer Project Authors. All rights reserved. |
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt |
The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt |
@@ -6,6 +7,11 @@ The complete set of contributors may be found at http://polymer.github.io/CONTRI |
Code distributed by Google as part of the polymer project is also |
subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt |
--> |
+ |
+<link rel="import" href="../polymer/polymer.html"> |
+<link rel="import" href="../iron-meta/iron-meta.html"> |
+<link rel="import" href="../iron-flex-layout/iron-flex-layout.html"> |
+ |
<!-- |
The `iron-icon` element displays an icon. By default an icon renders as a 24px square. |
@@ -52,18 +58,27 @@ how to create a custom iconset. |
See [iron-icons](http://www.polymer-project.org/components/iron-icons/demo.html) for the default set of icons. |
-@group Polymer Core Elements |
+ |
+### Styling |
+ |
+The following custom properties are available for styling: |
+ |
+Custom property | Description | Default |
+----------------|-------------|---------- |
+`--iron-icon-width` | Width of the icon | `24px` |
+`--iron-icon-height` | Height of the icon | `24px` |
+ |
+@group Iron Elements |
@element iron-icon |
+@demo demo/index.html |
+@hero hero.svg |
@homepage polymer.github.io |
--> |
-<link rel="import" href="../polymer/polymer.html"> |
-<link rel="import" href="../iron-meta/iron-meta.html"> |
-<link rel="import" href="../iron-flex-layout/iron-flex-layout.html"> |
- |
-<style is="x-style"> |
- * { |
- --iron-icon-size: 24px; |
+<style is="custom-style"> |
+ :root { |
+ --iron-icon-width: 24px; |
+ --iron-icon-height: 24px; |
} |
</style> |
@@ -71,15 +86,16 @@ See [iron-icons](http://www.polymer-project.org/components/iron-icons/demo.html) |
<style> |
:host { |
- mixin(--layout-inline --layout-center-center); |
+ @apply(--layout-inline); |
+ @apply(--layout-center-center); |
position: relative; |
vertical-align: middle; |
fill: currentcolor; |
- width: var(--iron-icon-size); |
- height: var(--iron-icon-size); |
+ width: var(--iron-icon-width); |
+ height: var(--iron-icon-height); |
} |
</style> |
@@ -87,72 +103,85 @@ See [iron-icons](http://www.polymer-project.org/components/iron-icons/demo.html) |
<iron-meta id="meta" type="iconset"></iron-meta> |
</template> |
-</dom-module> |
- |
-<script> |
- |
- Polymer({ |
- |
- is: 'iron-icon', |
- |
- enableCustomStyleProperties: true, |
+ <script> |
+ |
+ Polymer({ |
+ |
+ is: 'iron-icon', |
+ |
+ properties: { |
+ |
+ /** |
+ * The name of the icon to use. The name should be of the form: |
+ * `iconset_name:icon_name`. |
+ */ |
+ icon: { |
+ type: String, |
+ observer: '_iconChanged' |
+ }, |
+ |
+ /** |
+ * The name of the theme to used, if one is specified by the |
+ * iconset. |
+ */ |
+ theme: { |
+ type: String, |
+ observer: '_updateIcon' |
+ }, |
+ |
+ /** |
+ * If using iron-icon without an iconset, you can set the src to be |
+ * the URL of an individual icon image file. Note that this will take |
+ * precedence over a given icon attribute. |
+ */ |
+ src: { |
+ type: String, |
+ observer: '_srcChanged' |
+ } |
+ }, |
- properties: { |
+ _DEFAULT_ICONSET: 'icons', |
- icon: { |
- type: String, |
- observer: '_iconChanged' |
+ _iconChanged: function(icon) { |
+ var parts = (icon || '').split(':'); |
+ this._iconName = parts.pop(); |
+ this._iconsetName = parts.pop() || this._DEFAULT_ICONSET; |
+ this._updateIcon(); |
}, |
- theme: { |
- type: String, |
- observer: '_updateIcon' |
+ _srcChanged: function(src) { |
+ this._updateIcon(); |
}, |
- src: { |
- type: String, |
- observer: '_srcChanged' |
- } |
- |
- }, |
- |
- _DEFAULT_ICONSET: 'icons', |
- |
- _iconChanged: function(icon) { |
- var parts = (icon || '').split(':'); |
- this._iconName = parts.pop(); |
- this._iconsetName = parts.pop() || this._DEFAULT_ICONSET; |
- this._updateIcon(); |
- }, |
- |
- _srcChanged: function(src) { |
- this._updateIcon(); |
- }, |
- |
- _usesIconset: function() { |
- return this.icon || !this.src; |
- }, |
+ _usesIconset: function() { |
+ return this.icon || !this.src; |
+ }, |
- _updateIcon: function() { |
- if (this._usesIconset()) { |
- this._iconset = this.$.meta.byKey(this._iconsetName); |
- if (this._iconset) { |
- this._iconset.applyIcon(this, this._iconName, this.theme); |
+ _updateIcon: function() { |
+ if (this._usesIconset()) { |
+ if (this._iconsetName) { |
+ this._iconset = this.$.meta.byKey(this._iconsetName); |
+ if (this._iconset) { |
+ this._iconset.applyIcon(this, this._iconName, this.theme); |
+ } else { |
+ this._warn(this._logf('_updateIcon', 'could not find iconset `' |
+ + this._iconsetName + '`, did you import the iconset?')); |
+ } |
+ } |
} else { |
- console.warn('iron-icon: could not find iconset `' |
- + this._iconsetName + '`, did you import the iconset?'); |
- } |
- } else { |
- if (!this._img) { |
- this._img = document.createElement('img'); |
- this._img.style.width = '100%'; |
- this._img.style.height = '100%'; |
+ if (!this._img) { |
+ this._img = document.createElement('img'); |
+ this._img.style.width = '100%'; |
+ this._img.style.height = '100%'; |
+ } |
+ this._img.src = this.src; |
+ Polymer.dom(this.root).appendChild(this._img); |
} |
- this._img.src = this.src; |
- Polymer.dom(this.root).appendChild(this._img); |
} |
- } |
- }); |
+ }); |
+ |
+ </script> |
+ |
+</dom-module> |
-</script> |