update components

This commit is contained in:
Luke Pulverenti 2016-03-18 21:40:03 -04:00
parent 4f69bbfb13
commit 36d7dc70f3
7 changed files with 98 additions and 51 deletions

View file

@ -32,14 +32,14 @@
"web-component-tester": "^4.0.0", "web-component-tester": "^4.0.0",
"webcomponentsjs": "webcomponents/webcomponentsjs#^0.7.0" "webcomponentsjs": "webcomponents/webcomponentsjs#^0.7.0"
}, },
"homepage": "https://github.com/polymerelements/iron-icon", "homepage": "https://github.com/PolymerElements/iron-icon",
"_release": "1.0.8", "_release": "1.0.8",
"_resolution": { "_resolution": {
"type": "version", "type": "version",
"tag": "v1.0.8", "tag": "v1.0.8",
"commit": "f36b38928849ef3853db727faa8c9ef104d611eb" "commit": "f36b38928849ef3853db727faa8c9ef104d611eb"
}, },
"_source": "git://github.com/polymerelements/iron-icon.git", "_source": "git://github.com/PolymerElements/iron-icon.git",
"_target": "^1.0.0", "_target": "^1.0.0",
"_originalSource": "polymerelements/iron-icon" "_originalSource": "PolymerElements/iron-icon"
} }

View file

@ -36,7 +36,7 @@
"tag": "v1.3.0", "tag": "v1.3.0",
"commit": "1662093611cda3fd29125cdab94a61d3d88093da" "commit": "1662093611cda3fd29125cdab94a61d3d88093da"
}, },
"_source": "git://github.com/polymerelements/iron-selector.git", "_source": "git://github.com/PolymerElements/iron-selector.git",
"_target": "^1.0.0", "_target": "^1.0.0",
"_originalSource": "polymerelements/iron-selector" "_originalSource": "PolymerElements/iron-selector"
} }

View file

@ -1,6 +1,6 @@
{ {
"name": "polymer", "name": "polymer",
"version": "1.3.1", "version": "1.4.0",
"main": [ "main": [
"polymer.html", "polymer.html",
"polymer-mini.html", "polymer-mini.html",
@ -27,11 +27,11 @@
}, },
"private": true, "private": true,
"homepage": "https://github.com/Polymer/polymer", "homepage": "https://github.com/Polymer/polymer",
"_release": "1.3.1", "_release": "1.4.0",
"_resolution": { "_resolution": {
"type": "version", "type": "version",
"tag": "v1.3.1", "tag": "v1.4.0",
"commit": "61fac558012d9ef56ea78ed5435de0c418a4afbb" "commit": "11c987b2eb3c73b388a79fc8aaea8ca01624f514"
}, },
"_source": "git://github.com/Polymer/polymer.git", "_source": "git://github.com/Polymer/polymer.git",
"_target": "^1.0.0", "_target": "^1.0.0",

View file

@ -1,6 +1,6 @@
{ {
"name": "polymer", "name": "polymer",
"version": "1.3.1", "version": "1.4.0",
"main": [ "main": [
"polymer.html", "polymer.html",
"polymer-mini.html", "polymer-mini.html",

View file

@ -26,30 +26,22 @@ addEventListener('DOMContentLoaded', resolve);
}()); }());
window.Polymer = { window.Polymer = {
Settings: function () { Settings: function () {
var user = window.Polymer || {}; var settings = window.Polymer || {};
var parts = location.search.slice(1).split('&'); var parts = location.search.slice(1).split('&');
for (var i = 0, o; i < parts.length && (o = parts[i]); i++) { for (var i = 0, o; i < parts.length && (o = parts[i]); i++) {
o = o.split('='); o = o.split('=');
o[0] && (user[o[0]] = o[1] || true); o[0] && (settings[o[0]] = o[1] || true);
} }
var wantShadow = user.dom === 'shadow'; settings.wantShadow = settings.dom === 'shadow';
var hasShadow = Boolean(Element.prototype.createShadowRoot); settings.hasShadow = Boolean(Element.prototype.createShadowRoot);
var nativeShadow = hasShadow && !window.ShadowDOMPolyfill; settings.nativeShadow = settings.hasShadow && !window.ShadowDOMPolyfill;
var useShadow = wantShadow && hasShadow; settings.useShadow = settings.wantShadow && settings.hasShadow;
var hasNativeImports = Boolean('import' in document.createElement('link')); settings.hasNativeImports = Boolean('import' in document.createElement('link'));
var useNativeImports = hasNativeImports; settings.useNativeImports = settings.hasNativeImports;
var useNativeCustomElements = !window.CustomElements || window.CustomElements.useNative; settings.useNativeCustomElements = !window.CustomElements || window.CustomElements.useNative;
var usePolyfillProto = !useNativeCustomElements && !Object.__proto__; settings.useNativeShadow = settings.useShadow && settings.nativeShadow;
return { settings.usePolyfillProto = !settings.useNativeCustomElements && !Object.__proto__;
wantShadow: wantShadow, return settings;
hasShadow: hasShadow,
nativeShadow: nativeShadow,
useShadow: useShadow,
useNativeShadow: useShadow && nativeShadow,
useNativeImports: useNativeImports,
useNativeCustomElements: useNativeCustomElements,
usePolyfillProto: usePolyfillProto
};
}() }()
}; };
(function () { (function () {
@ -176,6 +168,9 @@ Polymer.RenderStatus._catchFirstRender();
} }
Polymer.ImportStatus = Polymer.RenderStatus; Polymer.ImportStatus = Polymer.RenderStatus;
Polymer.ImportStatus.whenLoaded = Polymer.ImportStatus.whenReady; Polymer.ImportStatus.whenLoaded = Polymer.ImportStatus.whenReady;
(function () {
'use strict';
var settings = Polymer.Settings;
Polymer.Base = { Polymer.Base = {
__isPolymerInstance__: true, __isPolymerInstance__: true,
_addFeature: function (feature) { _addFeature: function (feature) {
@ -185,14 +180,31 @@ registerCallback: function () {
this._desugarBehaviors(); this._desugarBehaviors();
this._doBehavior('beforeRegister'); this._doBehavior('beforeRegister');
this._registerFeatures(); this._registerFeatures();
this._doBehavior('registered'); if (!settings.lazyRegister) {
this.ensureRegisterFinished();
}
}, },
createdCallback: function () { createdCallback: function () {
if (!this.__hasRegisterFinished) {
this._ensureRegisterFinished(this.__proto__);
}
Polymer.telemetry.instanceCount++; Polymer.telemetry.instanceCount++;
this.root = this; this.root = this;
this._doBehavior('created'); this._doBehavior('created');
this._initFeatures(); this._initFeatures();
}, },
ensureRegisterFinished: function () {
this._ensureRegisterFinished(this);
},
_ensureRegisterFinished: function (proto) {
if (proto.__hasRegisterFinished !== proto.is) {
proto.__hasRegisterFinished = proto.is;
if (proto._finishRegisterFeatures) {
proto._finishRegisterFeatures();
}
proto._doBehavior('registered');
}
},
attachedCallback: function () { attachedCallback: function () {
var self = this; var self = this;
Polymer.RenderStatus.whenReady(function () { Polymer.RenderStatus.whenReady(function () {
@ -271,6 +283,7 @@ Polymer.isInstance = function (obj) {
return Boolean(obj && obj.__isPolymerInstance__); return Boolean(obj && obj.__isPolymerInstance__);
}; };
Polymer.telemetry.instanceCount = 0; Polymer.telemetry.instanceCount = 0;
}());
(function () { (function () {
var modules = {}; var modules = {};
var lcModules = {}; var lcModules = {};
@ -652,7 +665,7 @@ return value != null ? value : undefined;
} }
} }
}); });
Polymer.version = '1.3.1'; Polymer.version = '1.4.0';
Polymer.Base._addFeature({ Polymer.Base._addFeature({
_registerFeatures: function () { _registerFeatures: function () {
this._prepIs(); this._prepIs();

View file

@ -1345,7 +1345,11 @@ get localTarget() {
return this.event.target; return this.event.target;
}, },
get path() { get path() {
return this.event.path; var path = this.event.path;
if (!Array.isArray(path)) {
path = Array.prototype.slice.call(path);
}
return path;
} }
}; };
} else { } else {

View file

@ -1,5 +1,13 @@
<!-- <!--
@license @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
--><!--
@license
Copyright (c) 2014 The Polymer Project Authors. All rights reserved. Copyright (c) 2014 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 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 authors may be found at http://polymer.github.io/AUTHORS.txt
@ -1659,7 +1667,12 @@ if (prop.notify) {
this._addPropertyEffect(p, 'notify', { event: Polymer.CaseMap.camelToDashCase(p) + '-changed' }); this._addPropertyEffect(p, 'notify', { event: Polymer.CaseMap.camelToDashCase(p) + '-changed' });
} }
if (prop.reflectToAttribute) { if (prop.reflectToAttribute) {
this._addPropertyEffect(p, 'reflect', { attribute: Polymer.CaseMap.camelToDashCase(p) }); var attr = Polymer.CaseMap.camelToDashCase(p);
if (attr[0] === '-') {
this._warn(this._logf('_addPropertyEffects', 'Property ' + p + ' cannot be reflected to attribute ' + attr + ' because "-" is not a valid starting attribute name. Use a lowercase first letter for the property instead.'));
} else {
this._addPropertyEffect(p, 'reflect', { attribute: attr });
}
} }
if (prop.readOnly) { if (prop.readOnly) {
Polymer.Bind.ensurePropertyEffects(this, p); Polymer.Bind.ensurePropertyEffects(this, p);
@ -1742,6 +1755,9 @@ var part = note.parts[i];
if (part.signature) { if (part.signature) {
this._addAnnotatedComputationEffect(note, part, index); this._addAnnotatedComputationEffect(note, part, index);
} else if (!part.literal) { } else if (!part.literal) {
if (note.kind === 'attribute' && note.name[0] === '-') {
this._warn(this._logf('_addAnnotationEffect', 'Cannot set attribute ' + note.name + ' because "-" is not a valid attribute starting character'));
} else {
this._addPropertyEffect(part.model, 'annotation', { this._addPropertyEffect(part.model, 'annotation', {
kind: note.kind, kind: note.kind,
index: index, index: index,
@ -1756,6 +1772,7 @@ negate: part.negate
}); });
} }
} }
}
}, },
_addAnnotatedComputationEffect: function (note, part, index) { _addAnnotatedComputationEffect: function (note, part, index) {
var sig = part.signature; var sig = part.signature;
@ -2525,20 +2542,30 @@ this.forEachRule(r, styleRuleCallback, keyframesRuleCallback);
} }
} }
}, },
applyCss: function (cssText, moniker, target, afterNode) { applyCss: function (cssText, moniker, target, contextNode) {
var style = this.createScopeStyle(cssText, moniker);
target = target || document.head;
var after = contextNode && contextNode.nextSibling || target.firstChild;
this.__lastHeadApplyNode = style;
return target.insertBefore(style, after);
},
createScopeStyle: function (cssText, moniker) {
var style = document.createElement('style'); var style = document.createElement('style');
if (moniker) { if (moniker) {
style.setAttribute('scope', moniker); style.setAttribute('scope', moniker);
} }
style.textContent = cssText; style.textContent = cssText;
target = target || document.head;
if (!afterNode) {
var n$ = target.querySelectorAll('style[scope]');
afterNode = n$[n$.length - 1];
}
target.insertBefore(style, afterNode && afterNode.nextSibling || target.firstChild);
return style; return style;
}, },
__lastHeadApplyNode: null,
applyStylePlaceHolder: function (moniker) {
var placeHolder = document.createComment(' Shady DOM styles for ' + moniker + ' ');
var after = this.__lastHeadApplyNode ? this.__lastHeadApplyNode.nextSibling : null;
var scope = document.head;
scope.insertBefore(placeHolder, after || scope.firstChild);
this.__lastHeadApplyNode = placeHolder;
return placeHolder;
},
cssFromModules: function (moduleIds, warnIfNotFound) { cssFromModules: function (moduleIds, warnIfNotFound) {
var modules = moduleIds.trim().split(' '); var modules = moduleIds.trim().split(' ');
var cssText = ''; var cssText = '';
@ -2855,20 +2882,20 @@ styleTransformer.element(element, this.is, this._scopeCssViaAttr);
prepElement.call(this, element); prepElement.call(this, element);
}, },
_prepStyles: function () { _prepStyles: function () {
if (this._encapsulateStyle === undefined) { if (!nativeShadow) {
this._encapsulateStyle = !nativeShadow && Boolean(this._template); this._scopeStyle = styleUtil.applyStylePlaceHolder(this.is);
} }
},
_prepShimStyles: function () {
if (this._template) { if (this._template) {
if (this._encapsulateStyle === undefined) {
this._encapsulateStyle = !nativeShadow;
}
this._styles = this._collectStyles(); this._styles = this._collectStyles();
var cssText = styleTransformer.elementStyles(this); var cssText = styleTransformer.elementStyles(this);
this._prepStyleProperties(); this._prepStyleProperties();
var needsStatic = this._styles.length && !this._needsStyleProperties(); if (!this._needsStyleProperties() && this._styles.length) {
if (needsStatic || !nativeShadow) { styleUtil.applyCss(cssText, this.is, nativeShadow ? this._template.content : null, this._scopeStyle);
cssText = needsStatic ? cssText : ' ';
var style = styleUtil.applyCss(cssText, this.is, nativeShadow ? this._template.content : null);
if (!nativeShadow) {
this._scopeStyle = style;
}
} }
} else { } else {
this._styles = []; this._styles = [];
@ -3511,8 +3538,11 @@ Polymer.Base._addFeature({
_registerFeatures: function () { _registerFeatures: function () {
this._prepIs(); this._prepIs();
this._prepConstructor(); this._prepConstructor();
this._prepTemplate();
this._prepStyles(); this._prepStyles();
},
_finishRegisterFeatures: function () {
this._prepTemplate();
this._prepShimStyles();
this._prepAnnotations(); this._prepAnnotations();
this._prepEffects(); this._prepEffects();
this._prepBehaviors(); this._prepBehaviors();