@polymer/iron-iconset-svg
Advanced tools
Comparing version
import '../iron-iconset-svg.js'; | ||
const $_documentContainer = document.createElement('div'); | ||
const $_documentContainer = document.createElement('template'); | ||
$_documentContainer.setAttribute('style', 'display: none;'); | ||
@@ -62,3 +62,3 @@ | ||
document.head.appendChild($_documentContainer); | ||
document.head.appendChild($_documentContainer.content); | ||
@@ -74,2 +74,7 @@ /** | ||
*/ | ||
/* | ||
FIXME(polymer-modulizer): the above comments were extracted | ||
from HTML and may be out of place here. Review them and | ||
then delete this comment! | ||
*/ | ||
; |
@@ -1,6 +0,16 @@ | ||
import '@polymer/polymer/polymer-legacy.js'; | ||
import { IronMeta } from '@polymer/iron-meta/iron-meta.js'; | ||
import { Polymer } from '@polymer/polymer/lib/legacy/polymer-fn.js'; | ||
import { dom } from '@polymer/polymer/lib/legacy/polymer.dom.js'; | ||
/** | ||
@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 | ||
The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt | ||
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 | ||
*/ | ||
import '../polymer/polymer-legacy.js'; | ||
import { IronMeta } from '../iron-meta/iron-meta.js'; | ||
import { Polymer } from '../polymer/lib/legacy/polymer-fn.js'; | ||
import { dom } from '../polymer/lib/legacy/polymer.dom.js'; | ||
/** | ||
* The `iron-iconset-svg` element allows users to define their own icon sets | ||
@@ -40,11 +50,2 @@ * that contain svg icons. The svg icon elements should be children of the | ||
*/ | ||
/** | ||
@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 | ||
The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt | ||
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 | ||
*/ | ||
Polymer({ | ||
@@ -58,6 +59,3 @@ is: 'iron-iconset-svg', | ||
*/ | ||
name: { | ||
type: String, | ||
observer: '_nameChanged' | ||
}, | ||
name: {type: String, observer: '_nameChanged'}, | ||
@@ -67,6 +65,3 @@ /** | ||
*/ | ||
size: { | ||
type: Number, | ||
value: 24 | ||
}, | ||
size: {type: Number, value: 24}, | ||
@@ -82,6 +77,3 @@ /** | ||
*/ | ||
rtlMirroring: { | ||
type: Boolean, | ||
value: false | ||
}, | ||
rtlMirroring: {type: Boolean, value: false}, | ||
@@ -93,10 +85,8 @@ /** | ||
*/ | ||
useGlobalRtlAttribute: { | ||
type: Boolean, | ||
value: false | ||
} | ||
useGlobalRtlAttribute: {type: Boolean, value: false} | ||
}, | ||
created: function() { | ||
this._meta = new IronMeta({type: 'iconset', key: null, value: null}); | ||
this._meta = | ||
new IronMeta({type: 'iconset', key: null, value: null}); | ||
}, | ||
@@ -141,4 +131,4 @@ | ||
// install new svg element | ||
var svg = this._cloneIcon(iconName, | ||
this.rtlMirroring && this._targetIsRTL(element)); | ||
var svg = this._cloneIcon( | ||
iconName, this.rtlMirroring && this._targetIsRTL(element)); | ||
if (svg) { | ||
@@ -176,5 +166,5 @@ // insert svg element into shadow root, if it exists | ||
var globalElement = | ||
(document.body && document.body.hasAttribute('dir')) | ||
? document.body | ||
: document.documentElement; | ||
(document.body && document.body.hasAttribute('dir')) ? | ||
document.body : | ||
document.documentElement; | ||
@@ -187,4 +177,4 @@ this.__targetIsRTL = globalElement.getAttribute('dir') === 'rtl'; | ||
this.__targetIsRTL = target && | ||
window.getComputedStyle(target)['direction'] === 'rtl'; | ||
this.__targetIsRTL = | ||
target && window.getComputedStyle(target)['direction'] === 'rtl'; | ||
} | ||
@@ -221,6 +211,5 @@ } | ||
var icons = Object.create(null); | ||
dom(this).querySelectorAll('[id]') | ||
.forEach(function(icon) { | ||
icons[icon.id] = icon; | ||
}); | ||
dom(this).querySelectorAll('[id]').forEach(function(icon) { | ||
icons[icon.id] = icon; | ||
}); | ||
return icons; | ||
@@ -253,7 +242,10 @@ }, | ||
svg = document.createElementNS('http://www.w3.org/2000/svg', 'svg'), | ||
viewBox = content.getAttribute('viewBox') || '0 0 ' + size + ' ' + size, | ||
cssText = 'pointer-events: none; display: block; width: 100%; height: 100%;'; | ||
viewBox = | ||
content.getAttribute('viewBox') || '0 0 ' + size + ' ' + size, | ||
cssText = | ||
'pointer-events: none; display: block; width: 100%; height: 100%;'; | ||
if (mirrorAllowed && content.hasAttribute('mirror-in-rtl')) { | ||
cssText += '-webkit-transform:scale(-1,1);transform:scale(-1,1);transform-origin:center;'; | ||
cssText += | ||
'-webkit-transform:scale(-1,1);transform:scale(-1,1);transform-origin:center;'; | ||
} | ||
@@ -264,4 +256,6 @@ | ||
svg.setAttribute('focusable', 'false'); | ||
// TODO(dfreedm): `pointer-events: none` works around https://crbug.com/370136 | ||
// TODO(sjmiles): inline style may not be ideal, but avoids requiring a shadow-root | ||
// TODO(dfreedm): `pointer-events: none` works around | ||
// https://crbug.com/370136 | ||
// TODO(sjmiles): inline style may not be ideal, but avoids requiring a | ||
// shadow-root | ||
svg.style.cssText = cssText; | ||
@@ -268,0 +262,0 @@ svg.appendChild(content).removeAttribute('id'); |
@@ -17,13 +17,15 @@ { | ||
"bower": "^1.8.0", | ||
"@polymer/iron-component-page": "3.0.0-pre.12", | ||
"@polymer/iron-demo-helpers": "3.0.0-pre.12", | ||
"@polymer/iron-icon": "3.0.0-pre.12", | ||
"@polymer/promise-polyfill": "3.0.0-pre.12", | ||
"@webcomponents/webcomponentsjs": "^1.0.0", | ||
"wct-browser-legacy": "0.0.1-pre.11" | ||
"webmat": "^0.2.0", | ||
"@polymer/iron-component-page": "^3.0.0-pre.13", | ||
"@polymer/iron-demo-helpers": "^3.0.0-pre.13", | ||
"@polymer/iron-icon": "^3.0.0-pre.13", | ||
"@polymer/promise-polyfill": "^3.0.0-pre.13", | ||
"@webcomponents/webcomponentsjs": "^2.0.0-0", | ||
"wct-browser-legacy": "^0.0.1-pre.11" | ||
}, | ||
"scripts": { | ||
"update-types": "bower install && gen-typescript-declarations --deleteExisting --outDir ." | ||
"update-types": "bower install && gen-typescript-declarations --deleteExisting --outDir .", | ||
"format": "webmat && npm run update-types" | ||
}, | ||
"version": "3.0.0-pre.12", | ||
"version": "3.0.0-pre.13", | ||
"resolutions": { | ||
@@ -38,5 +40,5 @@ "inherits": "2.0.3", | ||
"dependencies": { | ||
"@polymer/polymer": "3.0.0-pre.12", | ||
"@polymer/iron-meta": "3.0.0-pre.12" | ||
"@polymer/polymer": "^3.0.0-pre.13", | ||
"@polymer/iron-meta": "^3.0.0-pre.13" | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
37893
1.34%9
12.5%333
-0.6%+ Added
+ Added
- Removed
- Removed
- Removed