mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
update polymer
This commit is contained in:
parent
f8c98e4641
commit
eae6b7d91d
5 changed files with 717 additions and 381 deletions
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "polymer",
|
"name": "polymer",
|
||||||
"version": "1.2.1",
|
"version": "1.2.2",
|
||||||
"main": [
|
"main": [
|
||||||
"polymer.html"
|
"polymer.html"
|
||||||
],
|
],
|
||||||
|
@ -25,11 +25,11 @@
|
||||||
},
|
},
|
||||||
"private": true,
|
"private": true,
|
||||||
"homepage": "https://github.com/Polymer/polymer",
|
"homepage": "https://github.com/Polymer/polymer",
|
||||||
"_release": "1.2.1",
|
"_release": "1.2.2",
|
||||||
"_resolution": {
|
"_resolution": {
|
||||||
"type": "version",
|
"type": "version",
|
||||||
"tag": "v1.2.1",
|
"tag": "v1.2.2",
|
||||||
"commit": "be2d57a329244735ca7aac34ac56c96b6270ae79"
|
"commit": "f7b07058659d691b4331c24e4f2134ed84892229"
|
||||||
},
|
},
|
||||||
"_source": "git://github.com/Polymer/polymer.git",
|
"_source": "git://github.com/Polymer/polymer.git",
|
||||||
"_target": "^1.0.0",
|
"_target": "^1.0.0",
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "polymer",
|
"name": "polymer",
|
||||||
"version": "1.2.1",
|
"version": "1.2.2",
|
||||||
"main": [
|
"main": [
|
||||||
"polymer.html"
|
"polymer.html"
|
||||||
],
|
],
|
||||||
|
|
|
@ -23,10 +23,11 @@ addEventListener('DOMContentLoaded', resolve);
|
||||||
window.Polymer = {
|
window.Polymer = {
|
||||||
Settings: function () {
|
Settings: function () {
|
||||||
var user = window.Polymer || {};
|
var user = window.Polymer || {};
|
||||||
location.search.slice(1).split('&').forEach(function (o) {
|
var parts = location.search.slice(1).split('&');
|
||||||
|
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] && (user[o[0]] = o[1] || true);
|
||||||
});
|
}
|
||||||
var wantShadow = user.dom === 'shadow';
|
var wantShadow = user.dom === 'shadow';
|
||||||
var hasShadow = Boolean(Element.prototype.createShadowRoot);
|
var hasShadow = Boolean(Element.prototype.createShadowRoot);
|
||||||
var nativeShadow = hasShadow && !window.ShadowDOMPolyfill;
|
var nativeShadow = hasShadow && !window.ShadowDOMPolyfill;
|
||||||
|
@ -113,15 +114,43 @@ this._callbacks.push(cb);
|
||||||
},
|
},
|
||||||
_makeReady: function () {
|
_makeReady: function () {
|
||||||
this._ready = true;
|
this._ready = true;
|
||||||
this._callbacks.forEach(function (cb) {
|
for (var i = 0; i < this._callbacks.length; i++) {
|
||||||
cb();
|
this._callbacks[i]();
|
||||||
});
|
}
|
||||||
this._callbacks = [];
|
this._callbacks = [];
|
||||||
},
|
},
|
||||||
_catchFirstRender: function () {
|
_catchFirstRender: function () {
|
||||||
requestAnimationFrame(function () {
|
requestAnimationFrame(function () {
|
||||||
Polymer.RenderStatus._makeReady();
|
Polymer.RenderStatus._makeReady();
|
||||||
});
|
});
|
||||||
|
},
|
||||||
|
_afterNextRenderQueue: [],
|
||||||
|
_waitingNextRender: false,
|
||||||
|
afterNextRender: function (element, fn, args) {
|
||||||
|
if (!this._waitingNextRender) {
|
||||||
|
this._waitingNextRender = true;
|
||||||
|
this.whenReady(this._flushAfterNextRender);
|
||||||
|
}
|
||||||
|
this._afterNextRenderQueue.push([
|
||||||
|
element,
|
||||||
|
fn,
|
||||||
|
args
|
||||||
|
]);
|
||||||
|
},
|
||||||
|
_flushAfterNextRender: function () {
|
||||||
|
requestAnimationFrame(function () {
|
||||||
|
setTimeout(Polymer.RenderStatus.__flushAfterNextRender);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
__flushAfterNextRender: function () {
|
||||||
|
var self = Polymer.RenderStatus;
|
||||||
|
self._waitingNextRender = false;
|
||||||
|
for (var i = 0, h; i < self._afterNextRenderQueue.length; i++) {
|
||||||
|
h = self._afterNextRenderQueue[i];
|
||||||
|
h[1].apply(h[0], h[2] || Polymer.nar);
|
||||||
|
}
|
||||||
|
;
|
||||||
|
self._afterNextRenderQueue = [];
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
if (window.HTMLImports) {
|
if (window.HTMLImports) {
|
||||||
|
@ -151,27 +180,33 @@ this._doBehavior('created');
|
||||||
this._initFeatures();
|
this._initFeatures();
|
||||||
},
|
},
|
||||||
attachedCallback: function () {
|
attachedCallback: function () {
|
||||||
|
var self = this;
|
||||||
Polymer.RenderStatus.whenReady(function () {
|
Polymer.RenderStatus.whenReady(function () {
|
||||||
this.isAttached = true;
|
self.isAttached = true;
|
||||||
this._doBehavior('attached');
|
self._doBehavior('attached');
|
||||||
}.bind(this));
|
});
|
||||||
},
|
},
|
||||||
detachedCallback: function () {
|
detachedCallback: function () {
|
||||||
this.isAttached = false;
|
this.isAttached = false;
|
||||||
this._doBehavior('detached');
|
this._doBehavior('detached');
|
||||||
},
|
},
|
||||||
attributeChangedCallback: function (name) {
|
attributeChangedCallback: function (name, oldValue, newValue) {
|
||||||
this._attributeChangedImpl(name);
|
this._attributeChangedImpl(name);
|
||||||
this._doBehavior('attributeChanged', arguments);
|
this._doBehavior('attributeChanged', [
|
||||||
|
name,
|
||||||
|
oldValue,
|
||||||
|
newValue
|
||||||
|
]);
|
||||||
},
|
},
|
||||||
_attributeChangedImpl: function (name) {
|
_attributeChangedImpl: function (name) {
|
||||||
this._setAttributeToProperty(this, name);
|
this._setAttributeToProperty(this, name);
|
||||||
},
|
},
|
||||||
extend: function (prototype, api) {
|
extend: function (prototype, api) {
|
||||||
if (prototype && api) {
|
if (prototype && api) {
|
||||||
Object.getOwnPropertyNames(api).forEach(function (n) {
|
var n$ = Object.getOwnPropertyNames(api);
|
||||||
|
for (var i = 0, n; i < n$.length && (n = n$[i]); i++) {
|
||||||
this.copyOwnProperty(n, api, prototype);
|
this.copyOwnProperty(n, api, prototype);
|
||||||
}, this);
|
}
|
||||||
}
|
}
|
||||||
return prototype || api;
|
return prototype || api;
|
||||||
},
|
},
|
||||||
|
@ -301,7 +336,8 @@ return behaviors;
|
||||||
},
|
},
|
||||||
_flattenBehaviorsList: function (behaviors) {
|
_flattenBehaviorsList: function (behaviors) {
|
||||||
var flat = [];
|
var flat = [];
|
||||||
behaviors.forEach(function (b) {
|
for (var i = 0; i < behaviors.length; i++) {
|
||||||
|
var b = behaviors[i];
|
||||||
if (b instanceof Array) {
|
if (b instanceof Array) {
|
||||||
flat = flat.concat(this._flattenBehaviorsList(b));
|
flat = flat.concat(this._flattenBehaviorsList(b));
|
||||||
} else if (b) {
|
} else if (b) {
|
||||||
|
@ -309,31 +345,16 @@ flat.push(b);
|
||||||
} else {
|
} else {
|
||||||
this._warn(this._logf('_flattenBehaviorsList', 'behavior is null, check for missing or 404 import'));
|
this._warn(this._logf('_flattenBehaviorsList', 'behavior is null, check for missing or 404 import'));
|
||||||
}
|
}
|
||||||
}, this);
|
}
|
||||||
return flat;
|
return flat;
|
||||||
},
|
},
|
||||||
_mixinBehavior: function (b) {
|
_mixinBehavior: function (b) {
|
||||||
Object.getOwnPropertyNames(b).forEach(function (n) {
|
var n$ = Object.getOwnPropertyNames(b);
|
||||||
switch (n) {
|
for (var i = 0, n; i < n$.length && (n = n$[i]); i++) {
|
||||||
case 'hostAttributes':
|
if (!Polymer.Base._behaviorProperties[n] && !this.hasOwnProperty(n)) {
|
||||||
case 'registered':
|
|
||||||
case 'properties':
|
|
||||||
case 'observers':
|
|
||||||
case 'listeners':
|
|
||||||
case 'created':
|
|
||||||
case 'attached':
|
|
||||||
case 'detached':
|
|
||||||
case 'attributeChanged':
|
|
||||||
case 'configure':
|
|
||||||
case 'ready':
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
if (!this.hasOwnProperty(n)) {
|
|
||||||
this.copyOwnProperty(n, b, this);
|
this.copyOwnProperty(n, b, this);
|
||||||
}
|
}
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}, this);
|
|
||||||
},
|
},
|
||||||
_prepBehaviors: function () {
|
_prepBehaviors: function () {
|
||||||
this._prepFlattenedBehaviors(this.behaviors);
|
this._prepFlattenedBehaviors(this.behaviors);
|
||||||
|
@ -345,9 +366,9 @@ this._prepBehavior(behaviors[i]);
|
||||||
this._prepBehavior(this);
|
this._prepBehavior(this);
|
||||||
},
|
},
|
||||||
_doBehavior: function (name, args) {
|
_doBehavior: function (name, args) {
|
||||||
this.behaviors.forEach(function (b) {
|
for (var i = 0; i < this.behaviors.length; i++) {
|
||||||
this._invokeBehavior(b, name, args);
|
this._invokeBehavior(this.behaviors[i], name, args);
|
||||||
}, this);
|
}
|
||||||
this._invokeBehavior(this, name, args);
|
this._invokeBehavior(this, name, args);
|
||||||
},
|
},
|
||||||
_invokeBehavior: function (b, name, args) {
|
_invokeBehavior: function (b, name, args) {
|
||||||
|
@ -357,12 +378,24 @@ fn.apply(this, args || Polymer.nar);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
_marshalBehaviors: function () {
|
_marshalBehaviors: function () {
|
||||||
this.behaviors.forEach(function (b) {
|
for (var i = 0; i < this.behaviors.length; i++) {
|
||||||
this._marshalBehavior(b);
|
this._marshalBehavior(this.behaviors[i]);
|
||||||
}, this);
|
}
|
||||||
this._marshalBehavior(this);
|
this._marshalBehavior(this);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
Polymer.Base._behaviorProperties = {
|
||||||
|
hostAttributes: true,
|
||||||
|
registered: true,
|
||||||
|
properties: true,
|
||||||
|
observers: true,
|
||||||
|
listeners: true,
|
||||||
|
created: true,
|
||||||
|
attached: true,
|
||||||
|
detached: true,
|
||||||
|
attributeChanged: true,
|
||||||
|
ready: true
|
||||||
|
};
|
||||||
Polymer.Base._addFeature({
|
Polymer.Base._addFeature({
|
||||||
_getExtendedPrototype: function (tag) {
|
_getExtendedPrototype: function (tag) {
|
||||||
return this._getExtendedNativePrototype(tag);
|
return this._getExtendedNativePrototype(tag);
|
||||||
|
@ -414,9 +447,13 @@ properties: {},
|
||||||
getPropertyInfo: function (property) {
|
getPropertyInfo: function (property) {
|
||||||
var info = this._getPropertyInfo(property, this.properties);
|
var info = this._getPropertyInfo(property, this.properties);
|
||||||
if (!info) {
|
if (!info) {
|
||||||
this.behaviors.some(function (b) {
|
for (var i = 0; i < this.behaviors.length; i++) {
|
||||||
return info = this._getPropertyInfo(property, b.properties);
|
info = this._getPropertyInfo(property, this.behaviors[i].properties);
|
||||||
}, this);
|
if (info) {
|
||||||
|
return info;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
;
|
||||||
}
|
}
|
||||||
return info || Polymer.nob;
|
return info || Polymer.nob;
|
||||||
},
|
},
|
||||||
|
@ -429,6 +466,40 @@ if (p) {
|
||||||
p.defined = true;
|
p.defined = true;
|
||||||
}
|
}
|
||||||
return p;
|
return p;
|
||||||
|
},
|
||||||
|
_prepPropertyInfo: function () {
|
||||||
|
this._propertyInfo = {};
|
||||||
|
for (var i = 0, p; i < this.behaviors.length; i++) {
|
||||||
|
this._addPropertyInfo(this._propertyInfo, this.behaviors[i].properties);
|
||||||
|
}
|
||||||
|
this._addPropertyInfo(this._propertyInfo, this.properties);
|
||||||
|
this._addPropertyInfo(this._propertyInfo, this._propertyEffects);
|
||||||
|
},
|
||||||
|
_addPropertyInfo: function (target, source) {
|
||||||
|
if (source) {
|
||||||
|
var t, s;
|
||||||
|
for (var i in source) {
|
||||||
|
t = target[i];
|
||||||
|
s = source[i];
|
||||||
|
if (i[0] === '_' && !s.readOnly) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (!target[i]) {
|
||||||
|
target[i] = {
|
||||||
|
type: typeof s === 'function' ? s : s.type,
|
||||||
|
readOnly: s.readOnly,
|
||||||
|
attribute: Polymer.CaseMap.camelToDashCase(i)
|
||||||
|
};
|
||||||
|
} else {
|
||||||
|
if (!t.type) {
|
||||||
|
t.type = s.type;
|
||||||
|
}
|
||||||
|
if (!t.readOnly) {
|
||||||
|
t.readOnly = s.readOnly;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
Polymer.CaseMap = {
|
Polymer.CaseMap = {
|
||||||
|
@ -456,21 +527,24 @@ return g[0] + '-' + g[1].toLowerCase();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
Polymer.Base._addFeature({
|
Polymer.Base._addFeature({
|
||||||
_prepAttributes: function () {
|
|
||||||
this._aggregatedAttributes = {};
|
|
||||||
},
|
|
||||||
_addHostAttributes: function (attributes) {
|
_addHostAttributes: function (attributes) {
|
||||||
|
if (!this._aggregatedAttributes) {
|
||||||
|
this._aggregatedAttributes = {};
|
||||||
|
}
|
||||||
if (attributes) {
|
if (attributes) {
|
||||||
this.mixin(this._aggregatedAttributes, attributes);
|
this.mixin(this._aggregatedAttributes, attributes);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
_marshalHostAttributes: function () {
|
_marshalHostAttributes: function () {
|
||||||
|
if (this._aggregatedAttributes) {
|
||||||
this._applyAttributes(this, this._aggregatedAttributes);
|
this._applyAttributes(this, this._aggregatedAttributes);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
_applyAttributes: function (node, attr$) {
|
_applyAttributes: function (node, attr$) {
|
||||||
for (var n in attr$) {
|
for (var n in attr$) {
|
||||||
if (!this.hasAttribute(n) && n !== 'class') {
|
if (!this.hasAttribute(n) && n !== 'class') {
|
||||||
this.serializeValueToAttribute(attr$[n], n, this);
|
var v = attr$[n];
|
||||||
|
this.serializeValueToAttribute(v, n, this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -478,29 +552,40 @@ _marshalAttributes: function () {
|
||||||
this._takeAttributesToModel(this);
|
this._takeAttributesToModel(this);
|
||||||
},
|
},
|
||||||
_takeAttributesToModel: function (model) {
|
_takeAttributesToModel: function (model) {
|
||||||
for (var i = 0, l = this.attributes.length; i < l; i++) {
|
if (this.hasAttributes()) {
|
||||||
this._setAttributeToProperty(model, this.attributes[i].name);
|
for (var i in this._propertyInfo) {
|
||||||
|
var info = this._propertyInfo[i];
|
||||||
|
if (this.hasAttribute(info.attribute)) {
|
||||||
|
this._setAttributeToProperty(model, info.attribute, i, info);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
_setAttributeToProperty: function (model, attrName) {
|
_setAttributeToProperty: function (model, attribute, property, info) {
|
||||||
if (!this._serializing) {
|
if (!this._serializing) {
|
||||||
var propName = Polymer.CaseMap.dashToCamelCase(attrName);
|
var property = property || Polymer.CaseMap.dashToCamelCase(attribute);
|
||||||
var info = this.getPropertyInfo(propName);
|
info = info || this._propertyInfo && this._propertyInfo[property];
|
||||||
if (info.defined || this._propertyEffects && this._propertyEffects[propName]) {
|
if (info && !info.readOnly) {
|
||||||
var val = this.getAttribute(attrName);
|
var v = this.getAttribute(attribute);
|
||||||
model[propName] = this.deserialize(val, info.type);
|
model[property] = this.deserialize(v, info.type);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
_serializing: false,
|
_serializing: false,
|
||||||
reflectPropertyToAttribute: function (name) {
|
reflectPropertyToAttribute: function (property, attribute, value) {
|
||||||
this._serializing = true;
|
this._serializing = true;
|
||||||
this.serializeValueToAttribute(this[name], Polymer.CaseMap.camelToDashCase(name));
|
value = value === undefined ? this[property] : value;
|
||||||
|
this.serializeValueToAttribute(value, attribute || Polymer.CaseMap.camelToDashCase(property));
|
||||||
this._serializing = false;
|
this._serializing = false;
|
||||||
},
|
},
|
||||||
serializeValueToAttribute: function (value, attribute, node) {
|
serializeValueToAttribute: function (value, attribute, node) {
|
||||||
var str = this.serialize(value);
|
var str = this.serialize(value);
|
||||||
(node || this)[str === undefined ? 'removeAttribute' : 'setAttribute'](attribute, str);
|
node = node || this;
|
||||||
|
if (str === undefined) {
|
||||||
|
node.removeAttribute(attribute);
|
||||||
|
} else {
|
||||||
|
node.setAttribute(attribute, str);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
deserialize: function (value, type) {
|
deserialize: function (value, type) {
|
||||||
switch (type) {
|
switch (type) {
|
||||||
|
@ -576,13 +661,13 @@ debouncer.stop();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
Polymer.version = '1.2.1';
|
Polymer.version = '1.2.2';
|
||||||
Polymer.Base._addFeature({
|
Polymer.Base._addFeature({
|
||||||
_registerFeatures: function () {
|
_registerFeatures: function () {
|
||||||
this._prepIs();
|
this._prepIs();
|
||||||
this._prepAttributes();
|
|
||||||
this._prepBehaviors();
|
this._prepBehaviors();
|
||||||
this._prepConstructor();
|
this._prepConstructor();
|
||||||
|
this._prepPropertyInfo();
|
||||||
},
|
},
|
||||||
_prepBehavior: function (b) {
|
_prepBehavior: function (b) {
|
||||||
this._addHostAttributes(b.hostAttributes);
|
this._addHostAttributes(b.hostAttributes);
|
||||||
|
|
|
@ -10,7 +10,9 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
||||||
|
|
||||||
<script>Polymer.Base._addFeature({
|
<script>Polymer.Base._addFeature({
|
||||||
_prepTemplate: function () {
|
_prepTemplate: function () {
|
||||||
this._template = this._template || Polymer.DomModule.import(this.is, 'template');
|
if (this._template === undefined) {
|
||||||
|
this._template = Polymer.DomModule.import(this.is, 'template');
|
||||||
|
}
|
||||||
if (this._template && this._template.hasAttribute('is')) {
|
if (this._template && this._template.hasAttribute('is')) {
|
||||||
this._warn(this._logf('_prepTemplate', 'top-level Polymer template ' + 'must not be a type-extension, found', this._template, 'Move inside simple <template>.'));
|
this._warn(this._logf('_prepTemplate', 'top-level Polymer template ' + 'must not be a type-extension, found', this._template, 'Move inside simple <template>.'));
|
||||||
}
|
}
|
||||||
|
@ -35,20 +37,19 @@ Polymer.Base._addFeature({
|
||||||
_hostStack: [],
|
_hostStack: [],
|
||||||
ready: function () {
|
ready: function () {
|
||||||
},
|
},
|
||||||
_pushHost: function (host) {
|
_registerHost: function (host) {
|
||||||
this.dataHost = host = host || Polymer.Base._hostStack[Polymer.Base._hostStack.length - 1];
|
this.dataHost = host = host || Polymer.Base._hostStack[Polymer.Base._hostStack.length - 1];
|
||||||
if (host && host._clients) {
|
if (host && host._clients) {
|
||||||
host._clients.push(this);
|
host._clients.push(this);
|
||||||
}
|
}
|
||||||
this._beginHost();
|
|
||||||
},
|
},
|
||||||
_beginHost: function () {
|
_beginHosting: function () {
|
||||||
Polymer.Base._hostStack.push(this);
|
Polymer.Base._hostStack.push(this);
|
||||||
if (!this._clients) {
|
if (!this._clients) {
|
||||||
this._clients = [];
|
this._clients = [];
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
_popHost: function () {
|
_endHosting: function () {
|
||||||
Polymer.Base._hostStack.pop();
|
Polymer.Base._hostStack.pop();
|
||||||
},
|
},
|
||||||
_tryReady: function () {
|
_tryReady: function () {
|
||||||
|
@ -61,20 +62,24 @@ return !this.dataHost || this.dataHost._clientsReadied;
|
||||||
},
|
},
|
||||||
_ready: function () {
|
_ready: function () {
|
||||||
this._beforeClientsReady();
|
this._beforeClientsReady();
|
||||||
|
if (this._template) {
|
||||||
this._setupRoot();
|
this._setupRoot();
|
||||||
this._readyClients();
|
this._readyClients();
|
||||||
|
}
|
||||||
|
this._clientsReadied = true;
|
||||||
|
this._clients = null;
|
||||||
this._afterClientsReady();
|
this._afterClientsReady();
|
||||||
this._readySelf();
|
this._readySelf();
|
||||||
},
|
},
|
||||||
_readyClients: function () {
|
_readyClients: function () {
|
||||||
this._beginDistribute();
|
this._beginDistribute();
|
||||||
var c$ = this._clients;
|
var c$ = this._clients;
|
||||||
|
if (c$) {
|
||||||
for (var i = 0, l = c$.length, c; i < l && (c = c$[i]); i++) {
|
for (var i = 0, l = c$.length, c; i < l && (c = c$[i]); i++) {
|
||||||
c._ready();
|
c._ready();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
this._finishDistribute();
|
this._finishDistribute();
|
||||||
this._clientsReadied = true;
|
|
||||||
this._clients = null;
|
|
||||||
},
|
},
|
||||||
_readySelf: function () {
|
_readySelf: function () {
|
||||||
this._doBehavior('ready');
|
this._doBehavior('ready');
|
||||||
|
@ -377,20 +382,16 @@ var nativeRemoveChild = Element.prototype.removeChild;
|
||||||
var nativeAppendChild = Element.prototype.appendChild;
|
var nativeAppendChild = Element.prototype.appendChild;
|
||||||
var nativeCloneNode = Element.prototype.cloneNode;
|
var nativeCloneNode = Element.prototype.cloneNode;
|
||||||
var nativeImportNode = Document.prototype.importNode;
|
var nativeImportNode = Document.prototype.importNode;
|
||||||
|
var needsToWrap = Settings.hasShadow && !Settings.nativeShadow;
|
||||||
|
var wrap = window.wrap ? window.wrap : function (node) {
|
||||||
|
return node;
|
||||||
|
};
|
||||||
var DomApi = function (node) {
|
var DomApi = function (node) {
|
||||||
this.node = node;
|
this.node = needsToWrap ? wrap(node) : node;
|
||||||
if (this.patch) {
|
if (this.patch) {
|
||||||
this.patch();
|
this.patch();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
if (window.wrap && Settings.useShadow && !Settings.useNativeShadow) {
|
|
||||||
DomApi = function (node) {
|
|
||||||
this.node = wrap(node);
|
|
||||||
if (this.patch) {
|
|
||||||
this.patch();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
DomApi.prototype = {
|
DomApi.prototype = {
|
||||||
flush: function () {
|
flush: function () {
|
||||||
Polymer.dom.flush();
|
Polymer.dom.flush();
|
||||||
|
@ -625,7 +626,7 @@ _addLogicalInfo: function (node, container, index) {
|
||||||
var children = factory(container).childNodes;
|
var children = factory(container).childNodes;
|
||||||
index = index === undefined ? children.length : index;
|
index = index === undefined ? children.length : index;
|
||||||
if (node.nodeType === Node.DOCUMENT_FRAGMENT_NODE) {
|
if (node.nodeType === Node.DOCUMENT_FRAGMENT_NODE) {
|
||||||
var c$ = Array.prototype.slice.call(node.childNodes);
|
var c$ = arrayCopyChildNodes(node);
|
||||||
for (var i = 0, n; i < c$.length && (n = c$[i]); i++) {
|
for (var i = 0, n; i < c$.length && (n = c$[i]); i++) {
|
||||||
children.splice(index++, 0, n);
|
children.splice(index++, 0, n);
|
||||||
n._lightParent = container;
|
n._lightParent = container;
|
||||||
|
@ -787,7 +788,7 @@ Object.defineProperties(DomApi.prototype, {
|
||||||
childNodes: {
|
childNodes: {
|
||||||
get: function () {
|
get: function () {
|
||||||
var c$ = getLightChildren(this.node);
|
var c$ = getLightChildren(this.node);
|
||||||
return Array.isArray(c$) ? c$ : Array.prototype.slice.call(c$);
|
return Array.isArray(c$) ? c$ : arrayCopyChildNodes(this.node);
|
||||||
},
|
},
|
||||||
configurable: true
|
configurable: true
|
||||||
},
|
},
|
||||||
|
@ -910,7 +911,7 @@ if (nt !== Node.TEXT_NODE || nt !== Node.COMMENT_NODE) {
|
||||||
this._clear();
|
this._clear();
|
||||||
var d = document.createElement('div');
|
var d = document.createElement('div');
|
||||||
d.innerHTML = text;
|
d.innerHTML = text;
|
||||||
var c$ = Array.prototype.slice.call(d.childNodes);
|
var c$ = arrayCopyChildNodes(d);
|
||||||
for (var i = 0; i < c$.length; i++) {
|
for (var i = 0; i < c$.length; i++) {
|
||||||
this.appendChild(c$[i]);
|
this.appendChild(c$[i]);
|
||||||
}
|
}
|
||||||
|
@ -923,20 +924,25 @@ DomApi.prototype._getComposedInnerHTML = function () {
|
||||||
return getInnerHTML(this.node, true);
|
return getInnerHTML(this.node, true);
|
||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
var forwardMethods = [
|
var forwardMethods = function (m$) {
|
||||||
|
for (var i = 0; i < m$.length; i++) {
|
||||||
|
forwardMethod(m$[i]);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
var forwardMethod = function (method) {
|
||||||
|
DomApi.prototype[method] = function () {
|
||||||
|
return this.node[method].apply(this.node, arguments);
|
||||||
|
};
|
||||||
|
};
|
||||||
|
forwardMethods([
|
||||||
'cloneNode',
|
'cloneNode',
|
||||||
'appendChild',
|
'appendChild',
|
||||||
'insertBefore',
|
'insertBefore',
|
||||||
'removeChild',
|
'removeChild',
|
||||||
'replaceChild'
|
'replaceChild'
|
||||||
];
|
]);
|
||||||
forwardMethods.forEach(function (name) {
|
|
||||||
DomApi.prototype[name] = function () {
|
|
||||||
return this.node[name].apply(this.node, arguments);
|
|
||||||
};
|
|
||||||
});
|
|
||||||
DomApi.prototype.querySelectorAll = function (selector) {
|
DomApi.prototype.querySelectorAll = function (selector) {
|
||||||
return Array.prototype.slice.call(this.node.querySelectorAll(selector));
|
return arrayCopy(this.node.querySelectorAll(selector));
|
||||||
};
|
};
|
||||||
DomApi.prototype.getOwnerRoot = function () {
|
DomApi.prototype.getOwnerRoot = function () {
|
||||||
var n = this.node;
|
var n = this.node;
|
||||||
|
@ -953,35 +959,24 @@ return doc.importNode(externalNode, deep);
|
||||||
};
|
};
|
||||||
DomApi.prototype.getDestinationInsertionPoints = function () {
|
DomApi.prototype.getDestinationInsertionPoints = function () {
|
||||||
var n$ = this.node.getDestinationInsertionPoints && this.node.getDestinationInsertionPoints();
|
var n$ = this.node.getDestinationInsertionPoints && this.node.getDestinationInsertionPoints();
|
||||||
return n$ ? Array.prototype.slice.call(n$) : [];
|
return n$ ? arrayCopy(n$) : [];
|
||||||
};
|
};
|
||||||
DomApi.prototype.getDistributedNodes = function () {
|
DomApi.prototype.getDistributedNodes = function () {
|
||||||
var n$ = this.node.getDistributedNodes && this.node.getDistributedNodes();
|
var n$ = this.node.getDistributedNodes && this.node.getDistributedNodes();
|
||||||
return n$ ? Array.prototype.slice.call(n$) : [];
|
return n$ ? arrayCopy(n$) : [];
|
||||||
};
|
};
|
||||||
DomApi.prototype._distributeParent = function () {
|
DomApi.prototype._distributeParent = function () {
|
||||||
};
|
};
|
||||||
var nativeForwards = [
|
|
||||||
'appendChild',
|
|
||||||
'insertBefore',
|
|
||||||
'removeChild',
|
|
||||||
'replaceChild'
|
|
||||||
];
|
|
||||||
nativeForwards.forEach(function (forward) {
|
|
||||||
DomApi.prototype[forward] = function () {
|
|
||||||
return this.node[forward].apply(this.node, arguments);
|
|
||||||
};
|
|
||||||
});
|
|
||||||
Object.defineProperties(DomApi.prototype, {
|
Object.defineProperties(DomApi.prototype, {
|
||||||
childNodes: {
|
childNodes: {
|
||||||
get: function () {
|
get: function () {
|
||||||
return Array.prototype.slice.call(this.node.childNodes);
|
return arrayCopyChildNodes(this.node);
|
||||||
},
|
},
|
||||||
configurable: true
|
configurable: true
|
||||||
},
|
},
|
||||||
children: {
|
children: {
|
||||||
get: function () {
|
get: function () {
|
||||||
return Array.prototype.slice.call(this.node.children);
|
return arrayCopyChildren(this.node);
|
||||||
},
|
},
|
||||||
configurable: true
|
configurable: true
|
||||||
},
|
},
|
||||||
|
@ -1004,7 +999,20 @@ return this.node.innerHTML = value;
|
||||||
configurable: true
|
configurable: true
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
var forwardProperties = [
|
var forwardProperties = function (f$) {
|
||||||
|
for (var i = 0; i < f$.length; i++) {
|
||||||
|
forwardProperty(f$[i]);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
var forwardProperty = function (name) {
|
||||||
|
Object.defineProperty(DomApi.prototype, name, {
|
||||||
|
get: function () {
|
||||||
|
return this.node[name];
|
||||||
|
},
|
||||||
|
configurable: true
|
||||||
|
});
|
||||||
|
};
|
||||||
|
forwardProperties([
|
||||||
'parentNode',
|
'parentNode',
|
||||||
'firstChild',
|
'firstChild',
|
||||||
'lastChild',
|
'lastChild',
|
||||||
|
@ -1014,15 +1022,7 @@ var forwardProperties = [
|
||||||
'lastElementChild',
|
'lastElementChild',
|
||||||
'nextElementSibling',
|
'nextElementSibling',
|
||||||
'previousElementSibling'
|
'previousElementSibling'
|
||||||
];
|
]);
|
||||||
forwardProperties.forEach(function (name) {
|
|
||||||
Object.defineProperty(DomApi.prototype, name, {
|
|
||||||
get: function () {
|
|
||||||
return this.node[name];
|
|
||||||
},
|
|
||||||
configurable: true
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
var CONTENT = 'content';
|
var CONTENT = 'content';
|
||||||
function factory(node, patch) {
|
function factory(node, patch) {
|
||||||
|
@ -1036,6 +1036,7 @@ return node.__domApi;
|
||||||
function hasDomApi(node) {
|
function hasDomApi(node) {
|
||||||
return Boolean(node.__domApi);
|
return Boolean(node.__domApi);
|
||||||
}
|
}
|
||||||
|
;
|
||||||
Polymer.dom = function (obj, patch) {
|
Polymer.dom = function (obj, patch) {
|
||||||
if (obj instanceof Event) {
|
if (obj instanceof Event) {
|
||||||
return Polymer.EventApi.factory(obj);
|
return Polymer.EventApi.factory(obj);
|
||||||
|
@ -1049,7 +1050,7 @@ return children ? children : node.childNodes;
|
||||||
}
|
}
|
||||||
function getComposedChildren(node) {
|
function getComposedChildren(node) {
|
||||||
if (!node._composedChildren) {
|
if (!node._composedChildren) {
|
||||||
node._composedChildren = Array.prototype.slice.call(node.childNodes);
|
node._composedChildren = arrayCopyChildNodes(node);
|
||||||
}
|
}
|
||||||
return node._composedChildren;
|
return node._composedChildren;
|
||||||
}
|
}
|
||||||
|
@ -1085,13 +1086,35 @@ children.splice(i, 1);
|
||||||
}
|
}
|
||||||
function saveLightChildrenIfNeeded(node) {
|
function saveLightChildrenIfNeeded(node) {
|
||||||
if (!node._lightChildren) {
|
if (!node._lightChildren) {
|
||||||
var c$ = Array.prototype.slice.call(node.childNodes);
|
var c$ = arrayCopyChildNodes(node);
|
||||||
for (var i = 0, l = c$.length, child; i < l && (child = c$[i]); i++) {
|
for (var i = 0, l = c$.length, child; i < l && (child = c$[i]); i++) {
|
||||||
child._lightParent = child._lightParent || node;
|
child._lightParent = child._lightParent || node;
|
||||||
}
|
}
|
||||||
node._lightChildren = c$;
|
node._lightChildren = c$;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
function arrayCopyChildNodes(parent) {
|
||||||
|
var copy = [], i = 0;
|
||||||
|
for (var n = parent.firstChild; n; n = n.nextSibling) {
|
||||||
|
copy[i++] = n;
|
||||||
|
}
|
||||||
|
return copy;
|
||||||
|
}
|
||||||
|
function arrayCopyChildren(parent) {
|
||||||
|
var copy = [], i = 0;
|
||||||
|
for (var n = parent.firstElementChild; n; n = n.nextElementSibling) {
|
||||||
|
copy[i++] = n;
|
||||||
|
}
|
||||||
|
return copy;
|
||||||
|
}
|
||||||
|
function arrayCopy(a$) {
|
||||||
|
var l = a$.length;
|
||||||
|
var copy = new Array(l);
|
||||||
|
for (var i = 0; i < l; i++) {
|
||||||
|
copy[i] = a$[i];
|
||||||
|
}
|
||||||
|
return copy;
|
||||||
|
}
|
||||||
function hasInsertionPoint(root) {
|
function hasInsertionPoint(root) {
|
||||||
return Boolean(root && root._insertionPoints.length);
|
return Boolean(root && root._insertionPoints.length);
|
||||||
}
|
}
|
||||||
|
@ -1107,7 +1130,11 @@ matchesSelector: matchesSelector,
|
||||||
hasInsertionPoint: hasInsertionPoint,
|
hasInsertionPoint: hasInsertionPoint,
|
||||||
ctor: DomApi,
|
ctor: DomApi,
|
||||||
factory: factory,
|
factory: factory,
|
||||||
hasDomApi: hasDomApi
|
hasDomApi: hasDomApi,
|
||||||
|
arrayCopy: arrayCopy,
|
||||||
|
arrayCopyChildNodes: arrayCopyChildNodes,
|
||||||
|
arrayCopyChildren: arrayCopyChildren,
|
||||||
|
wrap: wrap
|
||||||
};
|
};
|
||||||
}();
|
}();
|
||||||
Polymer.Base.extend(Polymer.dom, {
|
Polymer.Base.extend(Polymer.dom, {
|
||||||
|
@ -1328,7 +1355,10 @@ n.__observeNodesMap.set(this, this._observeContent(n));
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
_observeContent: function (content) {
|
_observeContent: function (content) {
|
||||||
var h = Polymer.dom(content).observeNodes(this._scheduleNotify.bind(this));
|
var self = this;
|
||||||
|
var h = Polymer.dom(content).observeNodes(function () {
|
||||||
|
self._scheduleNotify();
|
||||||
|
});
|
||||||
h._avoidChangeCalculation = true;
|
h._avoidChangeCalculation = true;
|
||||||
return h;
|
return h;
|
||||||
},
|
},
|
||||||
|
@ -1405,7 +1435,9 @@ self._scheduleNotify();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
this._observer = new MutationObserver(this._mutationHandler);
|
this._observer = new MutationObserver(this._mutationHandler);
|
||||||
this._boundFlush = this._flush.bind(this);
|
this._boundFlush = function () {
|
||||||
|
self._flush();
|
||||||
|
};
|
||||||
Polymer.dom.addStaticFlush(this._boundFlush);
|
Polymer.dom.addStaticFlush(this._boundFlush);
|
||||||
this._observer.observe(this.node, { childList: true });
|
this._observer.observe(this.node, { childList: true });
|
||||||
}
|
}
|
||||||
|
@ -1474,7 +1506,10 @@ if (!this._observer) {
|
||||||
var root = this.domApi.getOwnerRoot();
|
var root = this.domApi.getOwnerRoot();
|
||||||
var host = root && root.host;
|
var host = root && root.host;
|
||||||
if (host) {
|
if (host) {
|
||||||
this._observer = Polymer.dom(host).observeNodes(this._scheduleNotify.bind(this));
|
var self = this;
|
||||||
|
this._observer = Polymer.dom(host).observeNodes(function () {
|
||||||
|
self._scheduleNotify();
|
||||||
|
});
|
||||||
this._observer._isContentListener = true;
|
this._observer._isContentListener = true;
|
||||||
if (this._hasAttrSelect()) {
|
if (this._hasAttrSelect()) {
|
||||||
Polymer.dom(host).observer.enableShadowAttributeTracking();
|
Polymer.dom(host).observer.enableShadowAttributeTracking();
|
||||||
|
@ -1519,6 +1554,7 @@ upgradeLightChildren(this._lightChildren);
|
||||||
_createLocalRoot: function () {
|
_createLocalRoot: function () {
|
||||||
this.shadyRoot = this.root;
|
this.shadyRoot = this.root;
|
||||||
this.shadyRoot._distributionClean = false;
|
this.shadyRoot._distributionClean = false;
|
||||||
|
this.shadyRoot._hasDistributed = false;
|
||||||
this.shadyRoot._isShadyRoot = true;
|
this.shadyRoot._isShadyRoot = true;
|
||||||
this.shadyRoot._dirtyRoots = [];
|
this.shadyRoot._dirtyRoots = [];
|
||||||
var i$ = this.shadyRoot._insertionPoints = !this._notes || this._notes._hasContent ? this.shadyRoot.querySelectorAll('content') : [];
|
var i$ = this.shadyRoot._insertionPoints = !this._notes || this._notes._hasContent ? this.shadyRoot.querySelectorAll('content') : [];
|
||||||
|
@ -1845,20 +1881,23 @@ Polymer.DomModule = document.createElement('dom-module');
|
||||||
Polymer.Base._addFeature({
|
Polymer.Base._addFeature({
|
||||||
_registerFeatures: function () {
|
_registerFeatures: function () {
|
||||||
this._prepIs();
|
this._prepIs();
|
||||||
this._prepAttributes();
|
|
||||||
this._prepBehaviors();
|
this._prepBehaviors();
|
||||||
this._prepConstructor();
|
this._prepConstructor();
|
||||||
this._prepTemplate();
|
this._prepTemplate();
|
||||||
this._prepShady();
|
this._prepShady();
|
||||||
|
this._prepPropertyInfo();
|
||||||
},
|
},
|
||||||
_prepBehavior: function (b) {
|
_prepBehavior: function (b) {
|
||||||
this._addHostAttributes(b.hostAttributes);
|
this._addHostAttributes(b.hostAttributes);
|
||||||
},
|
},
|
||||||
_initFeatures: function () {
|
_initFeatures: function () {
|
||||||
|
this._registerHost();
|
||||||
|
if (this._template) {
|
||||||
this._poolContent();
|
this._poolContent();
|
||||||
this._pushHost();
|
this._beginHosting();
|
||||||
this._stampTemplate();
|
this._stampTemplate();
|
||||||
this._popHost();
|
this._endHosting();
|
||||||
|
}
|
||||||
this._marshalHostAttributes();
|
this._marshalHostAttributes();
|
||||||
this._setupDebouncers();
|
this._setupDebouncers();
|
||||||
this._marshalBehaviors();
|
this._marshalBehaviors();
|
||||||
|
|
726
dashboard-ui/bower_components/polymer/polymer.html
vendored
726
dashboard-ui/bower_components/polymer/polymer.html
vendored
File diff suppressed because it is too large
Load diff
Loading…
Add table
Add a link
Reference in a new issue