update components

This commit is contained in:
Luke Pulverenti 2016-01-28 01:38:15 -05:00
parent 8d8b47dd96
commit f1f4193e6e
8 changed files with 1020 additions and 813 deletions

View File

@ -29,14 +29,14 @@
"webcomponentsjs": "webcomponents/webcomponentsjs#^0.7.0" "webcomponentsjs": "webcomponents/webcomponentsjs#^0.7.0"
}, },
"ignore": [], "ignore": [],
"homepage": "https://github.com/PolymerElements/iron-behaviors", "homepage": "https://github.com/polymerelements/iron-behaviors",
"_release": "1.0.12", "_release": "1.0.12",
"_resolution": { "_resolution": {
"type": "version", "type": "version",
"tag": "v1.0.12", "tag": "v1.0.12",
"commit": "657f526a2382a659cdf4e13be87ecc89261588a3" "commit": "657f526a2382a659cdf4e13be87ecc89261588a3"
}, },
"_source": "git://github.com/PolymerElements/iron-behaviors.git", "_source": "git://github.com/polymerelements/iron-behaviors.git",
"_target": "^1.0.0", "_target": "^1.0.0",
"_originalSource": "PolymerElements/iron-behaviors" "_originalSource": "polymerelements/iron-behaviors"
} }

View File

@ -28,14 +28,14 @@
"iron-component-page": "polymerelements/iron-component-page#^1.0.0" "iron-component-page": "polymerelements/iron-component-page#^1.0.0"
}, },
"ignore": [], "ignore": [],
"homepage": "https://github.com/PolymerElements/iron-flex-layout", "homepage": "https://github.com/polymerelements/iron-flex-layout",
"_release": "1.2.2", "_release": "1.2.2",
"_resolution": { "_resolution": {
"type": "version", "type": "version",
"tag": "v1.2.2", "tag": "v1.2.2",
"commit": "41c4f35be1368afb770312b907a258175565dbdf" "commit": "41c4f35be1368afb770312b907a258175565dbdf"
}, },
"_source": "git://github.com/PolymerElements/iron-flex-layout.git", "_source": "git://github.com/polymerelements/iron-flex-layout.git",
"_target": "^1.0.0", "_target": "^1.0.0",
"_originalSource": "PolymerElements/iron-flex-layout" "_originalSource": "polymerelements/iron-flex-layout"
} }

View File

@ -1,8 +1,10 @@
{ {
"name": "polymer", "name": "polymer",
"version": "1.2.3", "version": "1.2.4",
"main": [ "main": [
"polymer.html" "polymer.html",
"polymer-mini.html",
"polymer-micro.html"
], ],
"license": "http://polymer.github.io/LICENSE.txt", "license": "http://polymer.github.io/LICENSE.txt",
"ignore": [ "ignore": [
@ -18,18 +20,18 @@
"url": "https://github.com/Polymer/polymer.git" "url": "https://github.com/Polymer/polymer.git"
}, },
"dependencies": { "dependencies": {
"webcomponentsjs": "^0.7.18" "webcomponentsjs": "^0.7.20"
}, },
"devDependencies": { "devDependencies": {
"web-component-tester": "*" "web-component-tester": "*"
}, },
"private": true, "private": true,
"homepage": "https://github.com/Polymer/polymer", "homepage": "https://github.com/Polymer/polymer",
"_release": "1.2.3", "_release": "1.2.4",
"_resolution": { "_resolution": {
"type": "version", "type": "version",
"tag": "v1.2.3", "tag": "v1.2.4",
"commit": "aa535d1675342007cbf64dc9c66497cf74cbc616" "commit": "284332a905ddd60eab11901a82ac037976175cf8"
}, },
"_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,8 +1,10 @@
{ {
"name": "polymer", "name": "polymer",
"version": "1.2.3", "version": "1.2.4",
"main": [ "main": [
"polymer.html" "polymer.html",
"polymer-mini.html",
"polymer-micro.html"
], ],
"license": "http://polymer.github.io/LICENSE.txt", "license": "http://polymer.github.io/LICENSE.txt",
"ignore": [ "ignore": [
@ -18,7 +20,7 @@
"url": "https://github.com/Polymer/polymer.git" "url": "https://github.com/Polymer/polymer.git"
}, },
"dependencies": { "dependencies": {
"webcomponentsjs": "^0.7.18" "webcomponentsjs": "^0.7.20"
}, },
"devDependencies": { "devDependencies": {
"web-component-tester": "*" "web-component-tester": "*"

View File

@ -6,7 +6,11 @@ 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 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 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 subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
--><script>(function () { -->
<script>(function () {
function resolve() { function resolve() {
document.body.removeAttribute('unresolved'); document.body.removeAttribute('unresolved');
} }
@ -401,6 +405,7 @@ this._marshalBehavior(this);
}); });
Polymer.Base._behaviorProperties = { Polymer.Base._behaviorProperties = {
hostAttributes: true, hostAttributes: true,
beforeRegister: true,
registered: true, registered: true,
properties: true, properties: true,
observers: true, observers: true,
@ -652,31 +657,7 @@ return value != null ? value : undefined;
} }
} }
}); });
Polymer.Base._addFeature({ Polymer.version = '1.2.4';
_setupDebouncers: function () {
this._debouncers = {};
},
debounce: function (jobName, callback, wait) {
return this._debouncers[jobName] = Polymer.Debounce.call(this, this._debouncers[jobName], callback, wait);
},
isDebouncerActive: function (jobName) {
var debouncer = this._debouncers[jobName];
return debouncer && debouncer.finish;
},
flushDebouncer: function (jobName) {
var debouncer = this._debouncers[jobName];
if (debouncer) {
debouncer.complete();
}
},
cancelDebouncer: function (jobName) {
var debouncer = this._debouncers[jobName];
if (debouncer) {
debouncer.stop();
}
}
});
Polymer.version = '1.2.3';
Polymer.Base._addFeature({ Polymer.Base._addFeature({
_registerFeatures: function () { _registerFeatures: function () {
this._prepIs(); this._prepIs();
@ -691,8 +672,6 @@ _marshalBehavior: function (b) {
}, },
_initFeatures: function () { _initFeatures: function () {
this._marshalHostAttributes(); this._marshalHostAttributes();
this._setupDebouncers();
this._marshalBehaviors(); this._marshalBehaviors();
} }
});</script> });</script>

File diff suppressed because it is too large Load Diff

View File

@ -1,13 +1,5 @@
<!-- <!--
@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
@ -16,6 +8,8 @@ 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 subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
--><link rel="import" href="polymer-mini.html"> --><link rel="import" href="polymer-mini.html">
<script>Polymer.nar = []; <script>Polymer.nar = [];
Polymer.Annotations = { Polymer.Annotations = {
parseAnnotations: function (template) { parseAnnotations: function (template) {
@ -27,22 +21,34 @@ return list;
_parseNodeAnnotations: function (node, list, stripWhiteSpace) { _parseNodeAnnotations: function (node, list, stripWhiteSpace) {
return node.nodeType === Node.TEXT_NODE ? this._parseTextNodeAnnotation(node, list) : this._parseElementAnnotations(node, list, stripWhiteSpace); return node.nodeType === Node.TEXT_NODE ? this._parseTextNodeAnnotation(node, list) : this._parseElementAnnotations(node, list, stripWhiteSpace);
}, },
_bindingRegex: /([^{[]*)(\{\{|\[\[)(?!\}\}|\]\])(.+?)(?:\]\]|\}\})/g, _bindingRegex: function () {
var IDENT = '(?:' + '[a-zA-Z_$][\\w.:$-*]*' + ')';
var NUMBER = '(?:' + '[-+]?[0-9]*\\.?[0-9]+(?:[eE][-+]?[0-9]+)?' + ')';
var SQUOTE_STRING = '(?:' + '\'(?:[^\'\\\\]|\\\\.)*\'' + ')';
var DQUOTE_STRING = '(?:' + '"(?:[^"\\\\]|\\\\.)*"' + ')';
var STRING = '(?:' + SQUOTE_STRING + '|' + DQUOTE_STRING + ')';
var ARGUMENT = '(?:' + IDENT + '|' + NUMBER + '|' + STRING + '\\s*' + ')';
var ARGUMENTS = '(?:' + ARGUMENT + '(?:,\\s*' + ARGUMENT + ')*' + ')';
var ARGUMENT_LIST = '(?:' + '\\(\\s*' + '(?:' + ARGUMENTS + '?' + ')' + '\\)\\s*' + ')';
var BINDING = '(' + IDENT + '\\s*' + ARGUMENT_LIST + '?' + ')';
var OPEN_BRACKET = '(\\[\\[|{{)' + '\\s*';
var CLOSE_BRACKET = '(?:]]|}})';
var NEGATE = '(?:(!)\\s*)?';
var EXPRESSION = OPEN_BRACKET + NEGATE + BINDING + CLOSE_BRACKET;
return new RegExp(EXPRESSION, 'g');
}(),
_parseBindings: function (text) { _parseBindings: function (text) {
var re = this._bindingRegex; var re = this._bindingRegex;
var parts = []; var parts = [];
var m, lastIndex; var lastIndex = 0;
var m;
while ((m = re.exec(text)) !== null) { while ((m = re.exec(text)) !== null) {
if (m[1]) { if (m.index > lastIndex) {
parts.push({ literal: m[1] }); parts.push({ literal: text.slice(lastIndex, m.index) });
} }
var mode = m[2][0]; var mode = m[1][0];
var negate = Boolean(m[2]);
var value = m[3].trim(); var value = m[3].trim();
var negate = false;
if (value[0] == '!') {
negate = true;
value = value.substring(1).trim();
}
var customEvent, notifyEvent, colon; var customEvent, notifyEvent, colon;
if (mode == '{' && (colon = value.indexOf('::')) > 0) { if (mode == '{' && (colon = value.indexOf('::')) > 0) {
notifyEvent = value.substring(colon + 2); notifyEvent = value.substring(colon + 2);
@ -191,7 +197,7 @@ var literal = this._literalFromParts(parts);
if (literal && kind == 'attribute') { if (literal && kind == 'attribute') {
node.setAttribute(name, literal); node.setAttribute(name, literal);
} }
if (node.localName == 'input' && name == 'value') { if (node.localName === 'input' && origName === 'value') {
node.setAttribute(origName, ''); node.setAttribute(origName, '');
} }
node.removeAttribute(origName); node.removeAttribute(origName);
@ -207,12 +213,17 @@ isCompound: parts.length !== 1
}; };
} }
}, },
_localSubTree: function (node, host) {
return node === host ? node.childNodes : node._lightChildren || node.childNodes;
},
findAnnotatedNode: function (root, annote) { findAnnotatedNode: function (root, annote) {
var parent = annote.parent && Polymer.Annotations.findAnnotatedNode(root, annote.parent); var parent = annote.parent && Polymer.Annotations.findAnnotatedNode(root, annote.parent);
return !parent ? root : Polymer.Annotations._localSubTree(parent, root)[annote.index]; if (parent) {
for (var n = parent.firstChild, i = 0; n; n = n.nextSibling) {
if (annote.index === i++) {
return n;
}
}
} else {
return root;
}
} }
}; };
(function () { (function () {
@ -287,8 +298,8 @@ if (this._template._content && this._template._content._notes) {
this._notes = this._template._content._notes; this._notes = this._template._content._notes;
} else { } else {
this._notes = Polymer.Annotations.parseAnnotations(this._template); this._notes = Polymer.Annotations.parseAnnotations(this._template);
}
this._processAnnotations(this._notes); this._processAnnotations(this._notes);
}
Polymer.Annotations.prepElement = null; Polymer.Annotations.prepElement = null;
} }
}, },
@ -335,13 +346,18 @@ for (var k = 0, p$ = b.parts, p; k < p$.length && (p = p$[k]); k++) {
if (p.signature) { if (p.signature) {
var args = p.signature.args; var args = p.signature.args;
for (var kk = 0; kk < args.length; kk++) { for (var kk = 0; kk < args.length; kk++) {
pp[args[kk].model] = true; var model = args[kk].model;
if (model) {
pp[model] = true;
}
} }
} else { } else {
if (p.model) {
pp[p.model] = true; pp[p.model] = true;
} }
} }
} }
}
if (n.templateContent) { if (n.templateContent) {
var tpp = n.templateContent._parentProps; var tpp = n.templateContent._parentProps;
Polymer.Base.mixin(pp, tpp); Polymer.Base.mixin(pp, tpp);
@ -637,6 +653,8 @@ document.addEventListener('mouseup', upfn);
function untrackDocument(stateObj) { function untrackDocument(stateObj) {
document.removeEventListener('mousemove', stateObj.movefn); document.removeEventListener('mousemove', stateObj.movefn);
document.removeEventListener('mouseup', stateObj.upfn); document.removeEventListener('mouseup', stateObj.upfn);
stateObj.movefn = null;
stateObj.upfn = null;
} }
var Gestures = { var Gestures = {
gestures: {}, gestures: {},
@ -863,10 +881,8 @@ emits: [
'up' 'up'
], ],
info: { info: {
movefn: function () { movefn: null,
}, upfn: null
upfn: function () {
}
}, },
reset: function () { reset: function () {
untrackDocument(this.info); untrackDocument(this.info);
@ -899,7 +915,6 @@ touchend: function (e) {
this.fire('up', Gestures.findOriginalTarget(e), e.changedTouches[0]); this.fire('up', Gestures.findOriginalTarget(e), e.changedTouches[0]);
}, },
fire: function (type, target, event) { fire: function (type, target, event) {
var self = this;
Gestures.fire(target, type, { Gestures.fire(target, type, {
x: event.clientX, x: event.clientX,
y: event.clientY, y: event.clientY,
@ -942,10 +957,8 @@ this.moves.shift();
} }
this.moves.push(move); this.moves.push(move);
}, },
movefn: function () { movefn: null,
}, upfn: null,
upfn: function () {
},
prevent: false prevent: false
}, },
reset: function () { reset: function () {
@ -1129,6 +1142,9 @@ none: 'none',
all: 'auto' all: 'auto'
}; };
Polymer.Base._addFeature({ Polymer.Base._addFeature({
_setupGestures: function () {
this.__polymerGestures = null;
},
_listen: function (node, eventName, handler) { _listen: function (node, eventName, handler) {
if (Gestures.gestures[eventName]) { if (Gestures.gestures[eventName]) {
Gestures.add(node, eventName, handler); Gestures.add(node, eventName, handler);
@ -1150,99 +1166,6 @@ Gestures.setTouchAction(node, DIRECTION_MAP[direction] || 'auto');
}); });
Polymer.Gestures = Gestures; Polymer.Gestures = Gestures;
}()); }());
Polymer.Async = {
_currVal: 0,
_lastVal: 0,
_callbacks: [],
_twiddleContent: 0,
_twiddle: document.createTextNode(''),
run: function (callback, waitTime) {
if (waitTime > 0) {
return ~setTimeout(callback, waitTime);
} else {
this._twiddle.textContent = this._twiddleContent++;
this._callbacks.push(callback);
return this._currVal++;
}
},
cancel: function (handle) {
if (handle < 0) {
clearTimeout(~handle);
} else {
var idx = handle - this._lastVal;
if (idx >= 0) {
if (!this._callbacks[idx]) {
throw 'invalid async handle: ' + handle;
}
this._callbacks[idx] = null;
}
}
},
_atEndOfMicrotask: function () {
var len = this._callbacks.length;
for (var i = 0; i < len; i++) {
var cb = this._callbacks[i];
if (cb) {
try {
cb();
} catch (e) {
i++;
this._callbacks.splice(0, i);
this._lastVal += i;
this._twiddle.textContent = this._twiddleContent++;
throw e;
}
}
}
this._callbacks.splice(0, len);
this._lastVal += len;
}
};
new window.MutationObserver(function () {
Polymer.Async._atEndOfMicrotask();
}).observe(Polymer.Async._twiddle, { characterData: true });
Polymer.Debounce = function () {
var Async = Polymer.Async;
var Debouncer = function (context) {
this.context = context;
var self = this;
this.boundComplete = function () {
self.complete();
};
};
Debouncer.prototype = {
go: function (callback, wait) {
var h;
this.finish = function () {
Async.cancel(h);
};
h = Async.run(this.boundComplete, wait);
this.callback = callback;
},
stop: function () {
if (this.finish) {
this.finish();
this.finish = null;
}
},
complete: function () {
if (this.finish) {
this.stop();
this.callback.call(this.context);
}
}
};
function debounce(debouncer, callback, wait) {
if (debouncer) {
debouncer.stop();
} else {
debouncer = new Debouncer(this);
}
debouncer.go(callback, wait);
return debouncer;
}
return debounce;
}();
Polymer.Base._addFeature({ Polymer.Base._addFeature({
$$: function (slctr) { $$: function (slctr) {
return Polymer.dom(this.root).querySelector(slctr); return Polymer.dom(this.root).querySelector(slctr);
@ -1382,10 +1305,14 @@ translate3d: function (x, y, z, node) {
node = node || this; node = node || this;
this.transform('translate3d(' + x + ',' + y + ',' + z + ')', node); this.transform('translate3d(' + x + ',' + y + ',' + z + ')', node);
}, },
importHref: function (href, onload, onerror) { importHref: function (href, onload, onerror, optAsync) {
var l = document.createElement('link'); var l = document.createElement('link');
l.rel = 'import'; l.rel = 'import';
l.href = href; l.href = href;
optAsync = Boolean(optAsync);
if (optAsync) {
l.setAttribute('async', '');
}
var self = this; var self = this;
if (onload) { if (onload) {
l.onload = function (e) { l.onload = function (e) {
@ -1753,6 +1680,9 @@ this._addComplexObserverEffect(o);
}, },
_addComplexObserverEffect: function (observer) { _addComplexObserverEffect: function (observer) {
var sig = this._parseMethod(observer); var sig = this._parseMethod(observer);
if (!sig) {
throw new Error('Malformed observer expression \'' + observer + '\'');
}
for (var i = 0, arg; i < sig.args.length && (arg = sig.args[i]); i++) { for (var i = 0, arg; i < sig.args.length && (arg = sig.args[i]); i++) {
this._addPropertyEffect(arg.model, 'complexObserver', { this._addPropertyEffect(arg.model, 'complexObserver', {
method: sig.method, method: sig.method,
@ -1818,7 +1748,7 @@ trigger: trigger
}); });
}, },
_parseMethod: function (expression) { _parseMethod: function (expression) {
var m = expression.match(/([^\s]+)\((.*)\)/); var m = expression.match(/([^\s]+?)\((.*)\)/);
if (m) { if (m) {
var sig = { var sig = {
method: m[1], method: m[1],
@ -1845,10 +1775,7 @@ return sig;
}, },
_parseArg: function (rawArg) { _parseArg: function (rawArg) {
var arg = rawArg.trim().replace(/&comma;/g, ',').replace(/\\(.)/g, '$1'); var arg = rawArg.trim().replace(/&comma;/g, ',').replace(/\\(.)/g, '$1');
var a = { var a = { name: arg };
name: arg,
model: this._modelForPath(arg)
};
var fc = arg[0]; var fc = arg[0];
if (fc === '-') { if (fc === '-') {
fc = arg[1]; fc = arg[1];
@ -1868,6 +1795,7 @@ a.literal = true;
break; break;
} }
if (!a.literal) { if (!a.literal) {
a.model = this._modelForPath(arg);
a.structured = arg.indexOf('.') > 0; a.structured = arg.indexOf('.') > 0;
if (a.structured) { if (a.structured) {
a.wildcard = arg.slice(-2) == '.*'; a.wildcard = arg.slice(-2) == '.*';
@ -1903,7 +1831,7 @@ value = value == undefined ? '' : value;
} }
var pinfo; var pinfo;
if (!node._propertyInfo || !(pinfo = node._propertyInfo[property]) || !pinfo.readOnly) { if (!node._propertyInfo || !(pinfo = node._propertyInfo[property]) || !pinfo.readOnly) {
this.__setProperty(property, value, true, node); this.__setProperty(property, value, false, node);
} }
} }
}, },
@ -1917,6 +1845,7 @@ Polymer.Base._addFeature({
_setupConfigure: function (initialConfig) { _setupConfigure: function (initialConfig) {
this._config = {}; this._config = {};
this._handlers = []; this._handlers = [];
this._aboveConfig = null;
if (initialConfig) { if (initialConfig) {
for (var i in initialConfig) { for (var i in initialConfig) {
if (initialConfig[i] !== undefined) { if (initialConfig[i] !== undefined) {
@ -2034,7 +1963,9 @@ Polymer.Base._addFeature({
notifyPath: function (path, value, fromAbove) { notifyPath: function (path, value, fromAbove) {
var info = {}; var info = {};
this._get(path, this, info); this._get(path, this, info);
if (info.path) {
this._notifyPath(info.path, value, fromAbove); this._notifyPath(info.path, value, fromAbove);
}
}, },
_notifyPath: function (path, value, fromAbove) { _notifyPath: function (path, value, fromAbove) {
var old = this._propertySetter(path, value); var old = this._propertySetter(path, value);
@ -2346,7 +2277,7 @@ return Polymer.ResolveUrl.resolveUrl(url, root);
} }
}); });
Polymer.CssParse = function () { Polymer.CssParse = function () {
var api = { return {
parse: function (text) { parse: function (text) {
text = this._clean(text); text = this._clean(text);
return this._parseCss(this._lex(text), text); return this._parseCss(this._lex(text), text);
@ -2360,7 +2291,7 @@ start: 0,
end: text.length end: text.length
}; };
var n = root; var n = root;
for (var i = 0, s = 0, l = text.length; i < l; i++) { for (var i = 0, l = text.length; i < l; i++) {
switch (text[i]) { switch (text[i]) {
case this.OPEN_BRACE: case this.OPEN_BRACE:
if (!n.rules) { if (!n.rules) {
@ -2477,8 +2408,8 @@ CLOSE_BRACE: '}',
_rx: { _rx: {
comments: /\/\*[^*]*\*+([^\/*][^*]*\*+)*\//gim, comments: /\/\*[^*]*\*+([^\/*][^*]*\*+)*\//gim,
port: /@import[^;]*;/gim, port: /@import[^;]*;/gim,
customProp: /(?:^|[\s;])--[^;{]*?:[^{};]*?(?:[;\n]|$)/gim, customProp: /(?:^[^;\-\s}]+)?--[^;{}]*?:[^{};]*?(?:[;\n]|$)/gim,
mixinProp: /(?:^|[\s;])?--[^;{]*?:[^{;]*?{[^}]*?}(?:[;\n]|$)?/gim, mixinProp: /(?:^[^;\-\s}]+)?--[^;{}]*?:[^{};]*?{[^}]*?}(?:[;\n]|$)?/gim,
mixinApply: /@apply[\s]*\([^)]*?\)[\s]*(?:[;\n]|$)?/gim, mixinApply: /@apply[\s]*\([^)]*?\)[\s]*(?:[;\n]|$)?/gim,
varApply: /[^;:]*?:[^;]*?var\([^;]*\)(?:[;\n]|$)?/gim, varApply: /[^;:]*?:[^;]*?var\([^;]*\)(?:[;\n]|$)?/gim,
keyframesRule: /^@[^\s]*keyframes/, keyframesRule: /^@[^\s]*keyframes/,
@ -2488,7 +2419,6 @@ VAR_START: '--',
MEDIA_START: '@media', MEDIA_START: '@media',
AT_START: '@' AT_START: '@'
}; };
return api;
}(); }();
Polymer.StyleUtil = function () { Polymer.StyleUtil = function () {
return { return {
@ -2516,14 +2446,10 @@ style.__cssRules = this.parser.parse(style.textContent);
} }
return style.__cssRules; return style.__cssRules;
}, },
clearStyleRules: function (style) {
style.__cssRules = null;
},
forEachStyleRule: function (node, callback) { forEachStyleRule: function (node, callback) {
if (!node) { if (!node) {
return; return;
} }
var s = node.parsedSelector;
var skipRules = false; var skipRules = false;
if (node.type === this.ruleTypes.STYLE_RULE) { if (node.type === this.ruleTypes.STYLE_RULE) {
callback(node); callback(node);
@ -2572,7 +2498,7 @@ return m && m._cssText || '';
cssFromElement: function (element) { cssFromElement: function (element) {
var cssText = ''; var cssText = '';
var content = element.content || element; var content = element.content || element;
var e$ = Polymer.DomApi.arrayCopy(content.querySelectorAll(this.MODULE_STYLES_SELECTOR)); var e$ = Polymer.TreeApi.arrayCopy(content.querySelectorAll(this.MODULE_STYLES_SELECTOR));
for (var i = 0, e; i < e$.length; i++) { for (var i = 0, e; i < e$.length; i++) {
e = e$[i]; e = e$[i];
if (e.localName === 'template') { if (e.localName === 'template') {
@ -2638,7 +2564,7 @@ if (c) {
element.setAttribute(CLASS, c.replace(SCOPE_NAME, '').replace(scope, '')); element.setAttribute(CLASS, c.replace(SCOPE_NAME, '').replace(scope, ''));
} }
} else { } else {
element.setAttribute(CLASS, c + (c ? ' ' : '') + SCOPE_NAME + ' ' + scope); element.setAttribute(CLASS, (c ? c + ' ' : '') + SCOPE_NAME + ' ' + scope);
} }
} }
} }
@ -2647,7 +2573,7 @@ element.setAttribute(CLASS, c + (c ? ' ' : '') + SCOPE_NAME + ' ' + scope);
elementStyles: function (element, callback) { elementStyles: function (element, callback) {
var styles = element._styles; var styles = element._styles;
var cssText = ''; var cssText = '';
for (var i = 0, l = styles.length, s, text; i < l && (s = styles[i]); i++) { for (var i = 0, l = styles.length, s; i < l && (s = styles[i]); i++) {
var rules = styleUtil.rulesForStyle(s); var rules = styleUtil.rulesForStyle(s);
cssText += nativeShadow ? styleUtil.toCssText(rules, callback) : this.css(rules, element.is, element.extends, callback, element._scopeCssViaAttr) + '\n\n'; cssText += nativeShadow ? styleUtil.toCssText(rules, callback) : this.css(rules, element.is, element.extends, callback, element._scopeCssViaAttr) + '\n\n';
} }
@ -2768,9 +2694,9 @@ var HOST = ':host';
var ROOT = ':root'; var ROOT = ':root';
var HOST_PAREN = /(\:host)(?:\(((?:\([^)(]*\)|[^)(]*)+?)\))/g; var HOST_PAREN = /(\:host)(?:\(((?:\([^)(]*\)|[^)(]*)+?)\))/g;
var HOST_CONTEXT = ':host-context'; var HOST_CONTEXT = ':host-context';
var HOST_CONTEXT_PAREN = /(.*)(?:\:host-context)(?:\(((?:\([^)(]*\)|[^)(]*)+?)\))(.*)/; var HOST_CONTEXT_PAREN = /(.*)(?::host-context)(?:\(((?:\([^)(]*\)|[^)(]*)+?)\))(.*)/;
var CONTENT = '::content'; var CONTENT = '::content';
var SCOPE_JUMP = /\:\:content|\:\:shadow|\/deep\//; var SCOPE_JUMP = /::content|::shadow|\/deep\//;
var CSS_CLASS_PREFIX = '.'; var CSS_CLASS_PREFIX = '.';
var CSS_ATTR_PREFIX = '[' + SCOPE_NAME + '~='; var CSS_ATTR_PREFIX = '[' + SCOPE_NAME + '~=';
var CSS_ATTR_SUFFIX = ']'; var CSS_ATTR_SUFFIX = ']';
@ -2923,10 +2849,12 @@ return;
var self = this; var self = this;
var scopify = function (node) { var scopify = function (node) {
if (node.nodeType === Node.ELEMENT_NODE) { if (node.nodeType === Node.ELEMENT_NODE) {
node.className = self._scopeElementClass(node, node.className); var className = node.getAttribute('class');
node.setAttribute('class', self._scopeElementClass(node, className));
var n$ = node.querySelectorAll('*'); var n$ = node.querySelectorAll('*');
for (var i = 0, n; i < n$.length && (n = n$[i]); i++) { for (var i = 0, n; i < n$.length && (n = n$[i]); i++) {
n.className = self._scopeElementClass(n, n.className); className = n.getAttribute('class');
n.setAttribute('class', self._scopeElementClass(n, className));
} }
} }
}; };
@ -3064,9 +2992,7 @@ p = pp.join(':');
parts[i] = p && p.lastIndexOf(';') === p.length - 1 ? p.slice(0, -1) : p || ''; parts[i] = p && p.lastIndexOf(';') === p.length - 1 ? p.slice(0, -1) : p || '';
} }
} }
return parts.filter(function (v) { return parts.join(';');
return v;
}).join(';');
}, },
applyProperties: function (rule, props) { applyProperties: function (rule, props) {
var output = ''; var output = '';
@ -3146,13 +3072,13 @@ parts[i] = p.match(hostRx) ? p.replace(hostSelector, hostSelector + scope) : sco
rule.selector = parts.join(','); rule.selector = parts.join(',');
}, },
applyElementScopeSelector: function (element, selector, old, viaAttr) { applyElementScopeSelector: function (element, selector, old, viaAttr) {
var c = viaAttr ? element.getAttribute(styleTransformer.SCOPE_NAME) : element.className; var c = viaAttr ? element.getAttribute(styleTransformer.SCOPE_NAME) : element.getAttribute('class') || '';
var v = old ? c.replace(old, selector) : (c ? c + ' ' : '') + this.XSCOPE_NAME + ' ' + selector; var v = old ? c.replace(old, selector) : (c ? c + ' ' : '') + this.XSCOPE_NAME + ' ' + selector;
if (c !== v) { if (c !== v) {
if (viaAttr) { if (viaAttr) {
element.setAttribute(styleTransformer.SCOPE_NAME, v); element.setAttribute(styleTransformer.SCOPE_NAME, v);
} else { } else {
element.className = v; element.setAttribute('class', v);
} }
} }
}, },
@ -3319,6 +3245,11 @@ return this._styleProperties && this._styleProperties[property] || getComputedSt
}, },
_setupStyleProperties: function () { _setupStyleProperties: function () {
this.customStyle = {}; this.customStyle = {};
this._styleCache = null;
this._styleProperties = null;
this._scopeSelector = null;
this._ownStyleProperties = null;
this._customStyle = null;
}, },
_needsStyleProperties: function () { _needsStyleProperties: function () {
return Boolean(this._ownStylePropertyNames && this._ownStylePropertyNames.length); return Boolean(this._ownStylePropertyNames && this._ownStylePropertyNames.length);
@ -3479,9 +3410,11 @@ this._addComplexObserverEffects(b.observers);
this._addHostAttributes(b.hostAttributes); this._addHostAttributes(b.hostAttributes);
}, },
_initFeatures: function () { _initFeatures: function () {
this._setupGestures();
this._setupConfigure(); this._setupConfigure();
this._setupStyleProperties(); this._setupStyleProperties();
this._setupDebouncers(); this._setupDebouncers();
this._setupShady();
this._registerHost(); this._registerHost();
if (this._template) { if (this._template) {
this._poolContent(); this._poolContent();
@ -3549,9 +3482,9 @@ styleUtil.forEachStyleRule(styleUtil.rulesForStyle(e), function (rule) {
styleTransformer.documentRule(rule); styleTransformer.documentRule(rule);
}); });
var self = this; var self = this;
function fn() { var fn = function fn() {
self._applyCustomProperties(e); self._applyCustomProperties(e);
} };
if (this._pendingApplyProperties) { if (this._pendingApplyProperties) {
cancelAnimationFrame(this._pendingApplyProperties); cancelAnimationFrame(this._pendingApplyProperties);
this._pendingApplyProperties = null; this._pendingApplyProperties = null;
@ -3603,6 +3536,8 @@ archetype._notifyPathUp = this._notifyPathUpImpl;
archetype._scopeElementClass = this._scopeElementClassImpl; archetype._scopeElementClass = this._scopeElementClassImpl;
archetype.listen = this._listenImpl; archetype.listen = this._listenImpl;
archetype._showHideChildren = this._showHideChildrenImpl; archetype._showHideChildren = this._showHideChildrenImpl;
archetype.__setPropertyOrig = this.__setProperty;
archetype.__setProperty = this.__setPropertyImpl;
var _constructor = this._constructorImpl; var _constructor = this._constructorImpl;
var ctor = function TemplateInstance(model, host) { var ctor = function TemplateInstance(model, host) {
_constructor.call(this, model, host); _constructor.call(this, model, host);
@ -3639,6 +3574,12 @@ n.style.display = n.__polymerDisplay__;
n.__hideTemplateChildren__ = hide; n.__hideTemplateChildren__ = hide;
} }
}, },
__setPropertyImpl: function (property, value, fromAbove, node) {
if (node && node.__hideTemplateChildren__ && property == 'textContent') {
property = '__polymerTextContent__';
}
this.__setPropertyOrig(property, value, fromAbove, node);
},
_debounceTemplate: function (fn) { _debounceTemplate: function (fn) {
Polymer.dom.addDebouncer(this.debounce('_debounceTemplate', fn)); Polymer.dom.addDebouncer(this.debounce('_debounceTemplate', fn));
}, },
@ -3876,9 +3817,10 @@ this.pmap[item] = key;
return '#' + key; return '#' + key;
}, },
removeKey: function (key) { removeKey: function (key) {
key = this._parseKey(key); if (key = this._parseKey(key)) {
this._removeFromMap(this.store[key]); this._removeFromMap(this.store[key]);
delete this.store[key]; delete this.store[key];
}
}, },
_removeFromMap: function (item) { _removeFromMap: function (item) {
if (item && typeof item == 'object') { if (item && typeof item == 'object') {
@ -3909,13 +3851,12 @@ return '#' + key;
}); });
}, },
_parseKey: function (key) { _parseKey: function (key) {
if (key[0] == '#') { if (key && key[0] == '#') {
return key.slice(1); return key.slice(1);
} }
throw new Error('unexpected key ' + key);
}, },
setItem: function (key, item) { setItem: function (key, item) {
key = this._parseKey(key); if (key = this._parseKey(key)) {
var old = this.store[key]; var old = this.store[key];
if (old) { if (old) {
this._removeFromMap(old); this._removeFromMap(old);
@ -3926,10 +3867,12 @@ this.omap.set(item, key);
this.pmap[item] = key; this.pmap[item] = key;
} }
this.store[key] = item; this.store[key] = item;
}
}, },
getItem: function (key) { getItem: function (key) {
key = this._parseKey(key); if (key = this._parseKey(key)) {
return this.store[key]; return this.store[key];
}
}, },
getItems: function () { getItems: function () {
var items = [], store = this.store; var items = [], store = this.store;
@ -4005,6 +3948,11 @@ type: String,
observer: '_observeChanged' observer: '_observeChanged'
}, },
delay: Number, delay: Number,
renderedItemCount: {
type: Number,
notify: true,
readOnly: true
},
initialCount: { initialCount: {
type: Number, type: Number,
observer: '_initializeChunking' observer: '_initializeChunking'
@ -4013,7 +3961,10 @@ targetFramerate: {
type: Number, type: Number,
value: 20 value: 20
}, },
_targetFrameTime: { computed: '_computeFrameTime(targetFramerate)' } _targetFrameTime: {
type: Number,
computed: '_computeFrameTime(targetFramerate)'
}
}, },
behaviors: [Polymer.Templatizer], behaviors: [Polymer.Templatizer],
observers: ['_itemsChanged(items.*)'], observers: ['_itemsChanged(items.*)'],
@ -4027,15 +3978,19 @@ self._renderChunk();
}; };
}, },
detached: function () { detached: function () {
this.__isDetached = true;
for (var i = 0; i < this._instances.length; i++) { for (var i = 0; i < this._instances.length; i++) {
this._detachInstance(i); this._detachInstance(i);
} }
}, },
attached: function () { attached: function () {
if (this.__isDetached) {
this.__isDetached = false;
var parent = Polymer.dom(Polymer.dom(this).parentNode); var parent = Polymer.dom(Polymer.dom(this).parentNode);
for (var i = 0; i < this._instances.length; i++) { for (var i = 0; i < this._instances.length; i++) {
this._attachInstance(i, parent); this._attachInstance(i, parent);
} }
}
}, },
ready: function () { ready: function () {
this._instanceProps = { __key__: true }; this._instanceProps = { __key__: true };
@ -4173,6 +4128,7 @@ inst.__setProperty(this.indexAs, i, true);
} }
} }
this._pool.length = 0; this._pool.length = 0;
this._setRenderedItemCount(this._instances.length);
this.fire('dom-change'); this.fire('dom-change');
this._tryRenderChunk(); this._tryRenderChunk();
}, },
@ -4547,7 +4503,9 @@ _queueRender: function () {
this._debounceTemplate(this._render); this._debounceTemplate(this._render);
}, },
detached: function () { detached: function () {
if (!this.parentNode || this.parentNode.nodeType == Node.DOCUMENT_FRAGMENT_NODE && (!Polymer.Settings.hasShadow || !(this.parentNode instanceof ShadowRoot))) {
this._teardownInstance(); this._teardownInstance();
}
}, },
attached: function () { attached: function () {
if (this.if && this.ctor) { if (this.if && this.ctor) {
@ -4576,20 +4534,30 @@ this._lastIf = this.if;
} }
}, },
_ensureInstance: function () { _ensureInstance: function () {
if (!this._instance) {
var parentNode = Polymer.dom(this).parentNode; var parentNode = Polymer.dom(this).parentNode;
if (parentNode) { if (parentNode) {
var parent = Polymer.dom(parentNode); var parent = Polymer.dom(parentNode);
if (!this._instance) {
this._instance = this.stamp(); this._instance = this.stamp();
var root = this._instance.root; var root = this._instance.root;
parent.insertBefore(root, this); parent.insertBefore(root, this);
} else {
var c$ = this._instance._children;
if (c$ && c$.length) {
var lastChild = Polymer.dom(this).previousSibling;
if (lastChild !== c$[c$.length - 1]) {
for (var i = 0, n; i < c$.length && (n = c$[i]); i++) {
parent.insertBefore(n, this);
}
}
}
} }
} }
}, },
_teardownInstance: function () { _teardownInstance: function () {
if (this._instance) { if (this._instance) {
var c$ = this._instance._children; var c$ = this._instance._children;
if (c$) { if (c$ && c$.length) {
var parent = Polymer.dom(Polymer.dom(c$[0]).parentNode); var parent = Polymer.dom(Polymer.dom(c$[0]).parentNode);
for (var i = 0, n; i < c$.length && (n = c$[i]); i++) { for (var i = 0, n; i < c$.length && (n = c$[i]); i++) {
parent.removeChild(n); parent.removeChild(n);
@ -4686,7 +4654,7 @@ this._prepConfigure();
this._prepBindings(); this._prepBindings();
this._prepPropertyInfo(); this._prepPropertyInfo();
Polymer.Base._initFeatures.call(this); Polymer.Base._initFeatures.call(this);
this._children = Polymer.DomApi.arrayCopyChildNodes(this.root); this._children = Polymer.TreeApi.arrayCopyChildNodes(this.root);
} }
this._insertChildren(); this._insertChildren();
this.fire('dom-change'); this.fire('dom-change');

View File

@ -25,6 +25,6 @@
"commit": "ce9c8597696ec4bafc772c2126a3b1c7b0e948c0" "commit": "ce9c8597696ec4bafc772c2126a3b1c7b0e948c0"
}, },
"_source": "git://github.com/Polymer/webcomponentsjs.git", "_source": "git://github.com/Polymer/webcomponentsjs.git",
"_target": "^0.7.18", "_target": "^0.7.20",
"_originalSource": "webcomponentsjs" "_originalSource": "webcomponentsjs"
} }