mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
update components
This commit is contained in:
parent
c4dadd58bd
commit
cee4794cd3
64 changed files with 1378 additions and 297 deletions
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "polymer",
|
||||
"version": "1.0.4",
|
||||
"version": "1.0.5",
|
||||
"main": [
|
||||
"polymer.html"
|
||||
],
|
||||
|
@ -24,11 +24,11 @@
|
|||
},
|
||||
"private": true,
|
||||
"homepage": "https://github.com/Polymer/polymer",
|
||||
"_release": "1.0.4",
|
||||
"_release": "1.0.5",
|
||||
"_resolution": {
|
||||
"type": "version",
|
||||
"tag": "v1.0.4",
|
||||
"commit": "cdabb91ad8ddf9bbefa308a25c5633d768501e7d"
|
||||
"tag": "v1.0.5",
|
||||
"commit": "b93f076d7b2606733d7166f311b77550deb98a39"
|
||||
},
|
||||
"_source": "git://github.com/Polymer/polymer.git",
|
||||
"_target": "^1.0.0",
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "polymer",
|
||||
"version": "1.0.4",
|
||||
"version": "1.0.5",
|
||||
"main": [
|
||||
"polymer.html"
|
||||
],
|
||||
|
|
|
@ -125,6 +125,12 @@ this.copyOwnProperty(n, api, prototype);
|
|||
}
|
||||
return prototype || api;
|
||||
},
|
||||
mixin: function (target, source) {
|
||||
for (var i in source) {
|
||||
target[i] = source[i];
|
||||
}
|
||||
return target;
|
||||
},
|
||||
copyOwnProperty: function (name, source, target) {
|
||||
var pd = Object.getOwnPropertyDescriptor(source, name);
|
||||
if (pd) {
|
||||
|
@ -500,7 +506,7 @@ debouncer.stop();
|
|||
}
|
||||
}
|
||||
});
|
||||
Polymer.version = '1.0.4';
|
||||
Polymer.version = '1.0.5';
|
||||
Polymer.Base._addFeature({
|
||||
_registerFeatures: function () {
|
||||
this._prepIs();
|
||||
|
|
|
@ -535,8 +535,8 @@ node._ownerShadyRoot = root;
|
|||
return node._ownerShadyRoot;
|
||||
},
|
||||
_maybeDistribute: function (node, parent) {
|
||||
var fragContent = node.nodeType === Node.DOCUMENT_FRAGMENT_NODE && node.querySelector(CONTENT);
|
||||
var wrappedContent = fragContent && fragContent.parentNode.nodeType !== Node.DOCUMENT_FRAGMENT_NODE;
|
||||
var fragContent = node.nodeType === Node.DOCUMENT_FRAGMENT_NODE && !node.__noContent && Polymer.dom(node).querySelector(CONTENT);
|
||||
var wrappedContent = fragContent && Polymer.dom(fragContent).parentNode.nodeType !== Node.DOCUMENT_FRAGMENT_NODE;
|
||||
var hasContent = fragContent || node.localName === CONTENT;
|
||||
if (hasContent) {
|
||||
var root = this._ownerShadyRootForNode(parent);
|
||||
|
@ -598,7 +598,7 @@ if (this._contains(container, content)) {
|
|||
var dc$ = factory(content).getDistributedNodes();
|
||||
for (var j = 0; j < dc$.length; j++) {
|
||||
hostNeedsDist = true;
|
||||
var node = dc$[i];
|
||||
var node = dc$[j];
|
||||
var parent = node.parentNode;
|
||||
if (parent) {
|
||||
removeFromComposedParent(parent, node);
|
||||
|
@ -764,6 +764,9 @@ this.domApi._distributeParent();
|
|||
toggle: function () {
|
||||
this.node.classList.toggle.apply(this.node.classList, arguments);
|
||||
this.domApi._distributeParent();
|
||||
},
|
||||
contains: function () {
|
||||
return this.node.classList.contains.apply(this.node.classList, arguments);
|
||||
}
|
||||
};
|
||||
if (!Settings.useShadow) {
|
||||
|
@ -1050,9 +1053,6 @@ factory: factory
|
|||
Polymer.Base._addFeature({
|
||||
_prepShady: function () {
|
||||
this._useContent = this._useContent || Boolean(this._template);
|
||||
if (this._useContent) {
|
||||
this._template._hasInsertionPoint = this._template.content.querySelector('content');
|
||||
}
|
||||
},
|
||||
_poolContent: function () {
|
||||
if (this._useContent) {
|
||||
|
@ -1072,7 +1072,7 @@ this.shadyRoot = this.root;
|
|||
this.shadyRoot._distributionClean = false;
|
||||
this.shadyRoot._isShadyRoot = true;
|
||||
this.shadyRoot._dirtyRoots = [];
|
||||
this.shadyRoot._insertionPoints = this._template._hasInsertionPoint ? this.shadyRoot.querySelectorAll('content') : [];
|
||||
this.shadyRoot._insertionPoints = !this._notes || this._notes._hasContent ? this.shadyRoot.querySelectorAll('content') : [];
|
||||
saveLightChildrenIfNeeded(this.shadyRoot);
|
||||
this.shadyRoot.host = this;
|
||||
},
|
||||
|
|
345
dashboard-ui/bower_components/polymer/polymer.html
vendored
345
dashboard-ui/bower_components/polymer/polymer.html
vendored
|
@ -54,6 +54,9 @@ var annote = {
|
|||
bindings: [],
|
||||
events: []
|
||||
};
|
||||
if (element.localName === 'content') {
|
||||
list._hasContent = true;
|
||||
}
|
||||
this._parseChildNodesAnnotations(element, annote, list);
|
||||
if (element.attributes) {
|
||||
this._parseNodeAttributeAnnotations(element, annote, list);
|
||||
|
@ -555,8 +558,7 @@ prevent = dy > dx;
|
|||
prevent = dx > dy;
|
||||
}
|
||||
if (prevent) {
|
||||
//This breaks scrolling in safari
|
||||
//ev.preventDefault();
|
||||
ev.preventDefault();
|
||||
}
|
||||
}
|
||||
},
|
||||
|
@ -890,50 +892,55 @@ Gestures.setTouchAction(node, DIRECTION_MAP[direction] || 'auto');
|
|||
});
|
||||
Polymer.Gestures = Gestures;
|
||||
}());
|
||||
Polymer.Async = function () {
|
||||
var currVal = 0;
|
||||
var lastVal = 0;
|
||||
var callbacks = [];
|
||||
var twiddle = document.createTextNode('');
|
||||
function runAsync(callback, waitTime) {
|
||||
Polymer.Async = {
|
||||
_currVal: 0,
|
||||
_lastVal: 0,
|
||||
_callbacks: [],
|
||||
_twiddleContent: 0,
|
||||
_twiddle: document.createTextNode(''),
|
||||
run: function (callback, waitTime) {
|
||||
if (waitTime > 0) {
|
||||
return ~setTimeout(callback, waitTime);
|
||||
} else {
|
||||
twiddle.textContent = currVal++;
|
||||
callbacks.push(callback);
|
||||
return currVal - 1;
|
||||
this._twiddle.textContent = this._twiddleContent++;
|
||||
this._callbacks.push(callback);
|
||||
return this._currVal++;
|
||||
}
|
||||
}
|
||||
function cancelAsync(handle) {
|
||||
},
|
||||
cancel: function (handle) {
|
||||
if (handle < 0) {
|
||||
clearTimeout(~handle);
|
||||
} else {
|
||||
var idx = handle - lastVal;
|
||||
var idx = handle - this._lastVal;
|
||||
if (idx >= 0) {
|
||||
if (!callbacks[idx]) {
|
||||
if (!this._callbacks[idx]) {
|
||||
throw 'invalid async handle: ' + handle;
|
||||
}
|
||||
callbacks[idx] = null;
|
||||
this._callbacks[idx] = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
function atEndOfMicrotask() {
|
||||
var len = callbacks.length;
|
||||
},
|
||||
_atEndOfMicrotask: function () {
|
||||
var len = this._callbacks.length;
|
||||
for (var i = 0; i < len; i++) {
|
||||
var cb = callbacks[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;
|
||||
}
|
||||
}
|
||||
callbacks.splice(0, len);
|
||||
lastVal += len;
|
||||
}
|
||||
new (window.MutationObserver || JsMutationObserver)(atEndOfMicrotask).observe(twiddle, { characterData: true });
|
||||
return {
|
||||
run: runAsync,
|
||||
cancel: cancelAsync
|
||||
this._callbacks.splice(0, len);
|
||||
this._lastVal += len;
|
||||
}
|
||||
};
|
||||
}();
|
||||
new (window.MutationObserver || JsMutationObserver)(Polymer.Async._atEndOfMicrotask.bind(Polymer.Async)).observe(Polymer.Async._twiddle, { characterData: true });
|
||||
Polymer.Debounce = function () {
|
||||
var Async = Polymer.Async;
|
||||
var Debouncer = function (context) {
|
||||
|
@ -1088,11 +1095,6 @@ elt[n] = props[n];
|
|||
}
|
||||
}
|
||||
return elt;
|
||||
},
|
||||
mixin: function (target, source) {
|
||||
for (var i in source) {
|
||||
target[i] = source[i];
|
||||
}
|
||||
}
|
||||
});
|
||||
Polymer.Bind = {
|
||||
|
@ -1109,7 +1111,7 @@ _notifyChange: function (property) {
|
|||
var eventName = Polymer.CaseMap.camelToDashCase(property) + '-changed';
|
||||
this.fire(eventName, { value: this[property] }, { bubbles: false });
|
||||
},
|
||||
_propertySet: function (property, value, effects) {
|
||||
_propertySetter: function (property, value, effects, fromAbove) {
|
||||
var old = this.__data__[property];
|
||||
if (old !== value && (old === old || value === value)) {
|
||||
this.__data__[property] = value;
|
||||
|
@ -1120,16 +1122,25 @@ if (this._propertyChanged) {
|
|||
this._propertyChanged(property, value, old);
|
||||
}
|
||||
if (effects) {
|
||||
this._effectEffects(property, value, effects, old);
|
||||
this._effectEffects(property, value, effects, old, fromAbove);
|
||||
}
|
||||
}
|
||||
return old;
|
||||
},
|
||||
_effectEffects: function (property, value, effects, old) {
|
||||
__setProperty: function (property, value, quiet, node) {
|
||||
node = node || this;
|
||||
var effects = node._propertyEffects && node._propertyEffects[property];
|
||||
if (effects) {
|
||||
node._propertySetter(property, value, effects, quiet);
|
||||
} else {
|
||||
node[property] = value;
|
||||
}
|
||||
},
|
||||
_effectEffects: function (property, value, effects, old, fromAbove) {
|
||||
effects.forEach(function (fx) {
|
||||
var fn = Polymer.Bind['_' + fx.kind + 'Effect'];
|
||||
if (fn) {
|
||||
fn.call(this, property, value, fx.effect, old);
|
||||
fn.call(this, property, value, fx.effect, old, fromAbove);
|
||||
}
|
||||
}, this);
|
||||
},
|
||||
|
@ -1187,7 +1198,7 @@ return this.__data__[property];
|
|||
}
|
||||
};
|
||||
var setter = function (value) {
|
||||
this._propertySet(property, value, effects);
|
||||
this._propertySetter(property, value, effects);
|
||||
};
|
||||
if (model.getPropertyInfo && model.getPropertyInfo(property).readOnly) {
|
||||
model['_set' + this.upper(property)] = setter;
|
||||
|
@ -1261,11 +1272,13 @@ return this._applyEffectValue(calc, effect);
|
|||
_reflectEffect: function (source) {
|
||||
this.reflectPropertyToAttribute(source);
|
||||
},
|
||||
_notifyEffect: function (source) {
|
||||
_notifyEffect: function (source, value, effect, old, fromAbove) {
|
||||
if (!fromAbove) {
|
||||
this._notifyChange(source);
|
||||
}
|
||||
},
|
||||
_functionEffect: function (source, value, fn, old) {
|
||||
fn.call(this, source, value, old);
|
||||
_functionEffect: function (source, value, fn, old, fromAbove) {
|
||||
fn.call(this, source, value, old, fromAbove);
|
||||
},
|
||||
_observerEffect: function (source, value, effect, old) {
|
||||
var fn = this[effect.method];
|
||||
|
@ -1291,7 +1304,7 @@ var args = Polymer.Bind._marshalArgs(this.__data__, effect, source, value);
|
|||
if (args) {
|
||||
var fn = this[effect.method];
|
||||
if (fn) {
|
||||
this[effect.property] = fn.apply(this, args);
|
||||
this.__setProperty(effect.property, fn.apply(this, args));
|
||||
} else {
|
||||
this._warn(this._logf('_computeEffect', 'compute method `' + effect.method + '` not defined'));
|
||||
}
|
||||
|
@ -1364,6 +1377,7 @@ if (prop.observer) {
|
|||
this._addObserverEffect(p, prop.observer);
|
||||
}
|
||||
if (prop.computed) {
|
||||
prop.readOnly = true;
|
||||
this._addComputedEffect(p, prop.computed);
|
||||
}
|
||||
if (prop.notify) {
|
||||
|
@ -1554,12 +1568,13 @@ this._configure();
|
|||
},
|
||||
_configure: function () {
|
||||
this._configureAnnotationReferences();
|
||||
this._aboveConfig = this.mixin({}, this._config);
|
||||
var config = {};
|
||||
this.behaviors.forEach(function (b) {
|
||||
this._configureProperties(b.properties, config);
|
||||
}, this);
|
||||
this._configureProperties(this.properties, config);
|
||||
this._mixinConfigure(config, this._config);
|
||||
this._mixinConfigure(config, this._aboveConfig);
|
||||
this._config = config;
|
||||
this._distributeConfig(this._config);
|
||||
},
|
||||
|
@ -1603,18 +1618,13 @@ node._configValue(x.effect.name, value);
|
|||
},
|
||||
_afterClientsReady: function () {
|
||||
this._executeStaticEffects();
|
||||
this._applyConfig(this._config);
|
||||
this._applyConfig(this._config, this._aboveConfig);
|
||||
this._flushHandlers();
|
||||
},
|
||||
_applyConfig: function (config) {
|
||||
_applyConfig: function (config, aboveConfig) {
|
||||
for (var n in config) {
|
||||
if (this[n] === undefined) {
|
||||
var effects = this._propertyEffects[n];
|
||||
if (effects) {
|
||||
this._propertySet(n, config[n], effects);
|
||||
} else {
|
||||
this[n] = config[n];
|
||||
}
|
||||
this.__setProperty(n, config[n], n in aboveConfig);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
@ -1643,7 +1653,7 @@ h[0].call(this, h[1], h[2]);
|
|||
'use strict';
|
||||
Polymer.Base._addFeature({
|
||||
notifyPath: function (path, value, fromAbove) {
|
||||
var old = this._propertySet(path, value);
|
||||
var old = this._propertySetter(path, value);
|
||||
if (old !== value && (old === old || value === value)) {
|
||||
this._pathEffector(path, value);
|
||||
if (!fromAbove) {
|
||||
|
@ -1681,6 +1691,15 @@ return;
|
|||
}
|
||||
array = Array.isArray(prop) ? prop : null;
|
||||
}
|
||||
if (array) {
|
||||
var coll = Polymer.Collection.get(array);
|
||||
var old = prop[last];
|
||||
var key = coll.getKey(old);
|
||||
if (key) {
|
||||
parts[i] = key;
|
||||
coll.setItem(key, value);
|
||||
}
|
||||
}
|
||||
prop[last] = value;
|
||||
if (!root) {
|
||||
this.notifyPath(parts.join('.'), value);
|
||||
|
@ -1834,9 +1853,8 @@ return ret;
|
|||
splice: function (path, start, deleteCount) {
|
||||
var array = this.get(path);
|
||||
var args = Array.prototype.slice.call(arguments, 1);
|
||||
var rem = array.slice(start, start + deleteCount);
|
||||
var ret = array.splice.apply(array, args);
|
||||
this._notifySplice(array, path, start, args.length - 2, rem);
|
||||
this._notifySplice(array, path, start, args.length - 2, ret);
|
||||
return ret;
|
||||
},
|
||||
shift: function (path) {
|
||||
|
@ -1984,10 +2002,10 @@ var AT_START = '@';
|
|||
var rx = {
|
||||
comments: /\/\*[^*]*\*+([^/*][^*]*\*+)*\//gim,
|
||||
port: /@import[^;]*;/gim,
|
||||
customProp: /(?:^|[\s;])--[^;{]*?:[^{};]*?;/gim,
|
||||
mixinProp: /(?:^|[\s;])--[^;{]*?:[^{;]*?{[^}]*?};?/gim,
|
||||
mixinApply: /@apply[\s]*\([^)]*?\)[\s]*;/gim,
|
||||
varApply: /[^;:]*?:[^;]*var[^;]*;/gim,
|
||||
customProp: /(?:^|[\s;])--[^;{]*?:[^{};]*?(?:[;\n]|$)/gim,
|
||||
mixinProp: /(?:^|[\s;])--[^;{]*?:[^{;]*?{[^}]*?}(?:[;\n]|$)?/gim,
|
||||
mixinApply: /@apply[\s]*\([^)]*?\)[\s]*(?:[;\n]|$)?/gim,
|
||||
varApply: /[^;:]*?:[^;]*var[^;]*(?:[;\n]|$)?/gim,
|
||||
keyframesRule: /^@[^\s]*keyframes/
|
||||
};
|
||||
return api;
|
||||
|
@ -2163,25 +2181,33 @@ rule.selector = p$.join(COMPLEX_SELECTOR_SEP);
|
|||
},
|
||||
_transformComplexSelector: function (selector, scope, hostScope) {
|
||||
var stop = false;
|
||||
var hostContext = false;
|
||||
var self = this;
|
||||
selector = selector.replace(SIMPLE_SELECTOR_SEP, function (m, c, s) {
|
||||
if (!stop) {
|
||||
var o = self._transformCompoundSelector(s, c, scope, hostScope);
|
||||
if (o.stop) {
|
||||
stop = true;
|
||||
}
|
||||
c = o.combinator;
|
||||
s = o.value;
|
||||
var info = self._transformCompoundSelector(s, c, scope, hostScope);
|
||||
stop = stop || info.stop;
|
||||
hostContext = hostContext || info.hostContext;
|
||||
c = info.combinator;
|
||||
s = info.value;
|
||||
} else {
|
||||
s = s.replace(SCOPE_JUMP, ' ');
|
||||
}
|
||||
return c + s;
|
||||
});
|
||||
if (hostContext) {
|
||||
selector = selector.replace(HOST_CONTEXT_PAREN, function (m, pre, paren, post) {
|
||||
return pre + paren + ' ' + hostScope + post + COMPLEX_SELECTOR_SEP + ' ' + pre + hostScope + paren + post;
|
||||
});
|
||||
}
|
||||
return selector;
|
||||
},
|
||||
_transformCompoundSelector: function (selector, combinator, scope, hostScope) {
|
||||
var jumpIndex = selector.search(SCOPE_JUMP);
|
||||
if (selector.indexOf(HOST) >= 0) {
|
||||
var hostContext = false;
|
||||
if (selector.indexOf(HOST_CONTEXT) >= 0) {
|
||||
hostContext = true;
|
||||
} else if (selector.indexOf(HOST) >= 0) {
|
||||
selector = selector.replace(HOST_PAREN, function (m, host, paren) {
|
||||
return hostScope + paren;
|
||||
});
|
||||
|
@ -2200,7 +2226,8 @@ stop = true;
|
|||
return {
|
||||
value: selector,
|
||||
combinator: combinator,
|
||||
stop: stop
|
||||
stop: stop,
|
||||
hostContext: hostContext
|
||||
};
|
||||
},
|
||||
_transformSimpleSelector: function (selector, scope) {
|
||||
|
@ -2232,6 +2259,8 @@ var SIMPLE_SELECTOR_SEP = /(^|[\s>+~]+)([^\s>+~]+)/g;
|
|||
var HOST = ':host';
|
||||
var ROOT = ':root';
|
||||
var HOST_PAREN = /(\:host)(?:\(((?:\([^)(]*\)|[^)(]*)+?)\))/g;
|
||||
var HOST_CONTEXT = ':host-context';
|
||||
var HOST_CONTEXT_PAREN = /(.*)(?:\:host-context)(?:\(((?:\([^)(]*\)|[^)(]*)+?)\))(.*)/;
|
||||
var CONTENT = '::content';
|
||||
var SCOPE_JUMP = /\:\:content|\:\:shadow|\/deep\//;
|
||||
var CSS_CLASS_PREFIX = '.';
|
||||
|
@ -2612,7 +2641,7 @@ var cssText = style ? style.textContent || '' : this.transformStyles(element, pr
|
|||
var s = element._customStyle;
|
||||
if (s && !nativeShadow && s !== style) {
|
||||
s._useCount--;
|
||||
if (s._useCount <= 0) {
|
||||
if (s._useCount <= 0 && s.parentNode) {
|
||||
s.parentNode.removeChild(s);
|
||||
}
|
||||
}
|
||||
|
@ -2633,14 +2662,23 @@ element._customStyle = style;
|
|||
}
|
||||
return style;
|
||||
},
|
||||
mixinCustomStyle: function (props, customStyle) {
|
||||
var v;
|
||||
for (var i in customStyle) {
|
||||
v = customStyle[i];
|
||||
if (v || v === 0) {
|
||||
props[i] = v;
|
||||
}
|
||||
}
|
||||
},
|
||||
rx: {
|
||||
VAR_ASSIGN: /(?:^|;\s*)(--[^\:;]*?):\s*?(?:([^;{]*?)|{([^}]*)})(?=;)/gim,
|
||||
MIXIN_MATCH: /(?:^|\W+)@apply[\s]*\(([^)]*)\);?/im,
|
||||
VAR_ASSIGN: /(?:^|[;\n]\s*)(--[\w-]*?):\s*?(?:([^;{]*?)|{([^}]*)})(?:(?=[;\n])|$)/gim,
|
||||
MIXIN_MATCH: /(?:^|\W+)@apply[\s]*\(([^)]*)\)/im,
|
||||
VAR_MATCH: /(^|\W+)var\([\s]*([^,)]*)[\s]*,?[\s]*((?:[^,)]*)|(?:[^;]*\([^;)]*\)))[\s]*?\)/gim,
|
||||
VAR_CAPTURE: /\([\s]*(--[^,\s)]*)(?:,[\s]*(--[^,\s)]*))?(?:\)|,)/gim,
|
||||
IS_VAR: /^--/,
|
||||
BRACKETED: /\{[^}]*\}/g,
|
||||
HOST_PREFIX: '(?:^|[^.])',
|
||||
HOST_PREFIX: '(?:^|[^.#[:])',
|
||||
HOST_SUFFIX: '($|[.:[\\s>+~])'
|
||||
},
|
||||
HOST_SELECTORS: [':host'],
|
||||
|
@ -2653,41 +2691,6 @@ var v = 1 << n % 32;
|
|||
bits[o] = (bits[o] || 0) | v;
|
||||
}
|
||||
}();
|
||||
Polymer.StyleDefaults = function () {
|
||||
var styleProperties = Polymer.StyleProperties;
|
||||
var styleUtil = Polymer.StyleUtil;
|
||||
var api = {
|
||||
_styles: [],
|
||||
_properties: null,
|
||||
addStyle: function (style) {
|
||||
this._styles.push(style);
|
||||
this._properties = null;
|
||||
},
|
||||
get _styleProperties() {
|
||||
if (!this._properties) {
|
||||
styleProperties.decorateStyles(this._styles);
|
||||
this._styles._scopeStyleProperties = null;
|
||||
this._properties = styleProperties.scopePropertiesFromStyles(this._styles);
|
||||
styleProperties.reify(this._properties);
|
||||
}
|
||||
return this._properties;
|
||||
},
|
||||
_needsStyleProperties: function () {
|
||||
},
|
||||
_computeStyleProperties: function () {
|
||||
return this._styleProperties;
|
||||
},
|
||||
updateStyles: function () {
|
||||
this._styleCache.clear();
|
||||
for (var i = 0, s; i < this._styles.length; i++) {
|
||||
s = this._styles[i];
|
||||
s = s.__importElement || s;
|
||||
s._apply();
|
||||
}
|
||||
}
|
||||
};
|
||||
return api;
|
||||
}();
|
||||
(function () {
|
||||
Polymer.StyleCache = function () {
|
||||
this.cache = {};
|
||||
|
@ -2718,8 +2721,10 @@ clear: function () {
|
|||
this.cache = {};
|
||||
},
|
||||
_objectsEqual: function (target, source) {
|
||||
var t, s;
|
||||
for (var i in target) {
|
||||
if (target[i] !== source[i]) {
|
||||
t = target[i], s = source[i];
|
||||
if (!(typeof t === 'object' && t ? this._objectsStrictlyEqual(t, s) : t === s)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -2727,9 +2732,55 @@ if (Array.isArray(target)) {
|
|||
return target.length === source.length;
|
||||
}
|
||||
return true;
|
||||
},
|
||||
_objectsStrictlyEqual: function (target, source) {
|
||||
return this._objectsEqual(target, source) && this._objectsEqual(source, target);
|
||||
}
|
||||
};
|
||||
}());
|
||||
Polymer.StyleDefaults = function () {
|
||||
var styleProperties = Polymer.StyleProperties;
|
||||
var styleUtil = Polymer.StyleUtil;
|
||||
var StyleCache = Polymer.StyleCache;
|
||||
var api = {
|
||||
_styles: [],
|
||||
_properties: null,
|
||||
customStyle: {},
|
||||
_styleCache: new StyleCache(),
|
||||
addStyle: function (style) {
|
||||
this._styles.push(style);
|
||||
this._properties = null;
|
||||
},
|
||||
get _styleProperties() {
|
||||
if (!this._properties) {
|
||||
styleProperties.decorateStyles(this._styles);
|
||||
this._styles._scopeStyleProperties = null;
|
||||
this._properties = styleProperties.scopePropertiesFromStyles(this._styles);
|
||||
styleProperties.mixinCustomStyle(this._properties, this.customStyle);
|
||||
styleProperties.reify(this._properties);
|
||||
}
|
||||
return this._properties;
|
||||
},
|
||||
_needsStyleProperties: function () {
|
||||
},
|
||||
_computeStyleProperties: function () {
|
||||
return this._styleProperties;
|
||||
},
|
||||
updateStyles: function (properties) {
|
||||
this._properties = null;
|
||||
if (properties) {
|
||||
Polymer.Base.mixin(this.customStyle, properties);
|
||||
}
|
||||
this._styleCache.clear();
|
||||
for (var i = 0, s; i < this._styles.length; i++) {
|
||||
s = this._styles[i];
|
||||
s = s.__importElement || s;
|
||||
s._apply();
|
||||
}
|
||||
}
|
||||
};
|
||||
return api;
|
||||
}();
|
||||
(function () {
|
||||
'use strict';
|
||||
var serializeValueToAttribute = Polymer.Base.serializeValueToAttribute;
|
||||
|
@ -2759,6 +2810,7 @@ if (!scope._styleCache) {
|
|||
scope._styleCache = new Polymer.StyleCache();
|
||||
}
|
||||
var scopeData = propertyUtils.propertyDataFromStyles(scope._styles, this);
|
||||
scopeData.key.customStyle = this.customStyle;
|
||||
info = scope._styleCache.retrieve(this.is, scopeData.key, this._styles);
|
||||
var scopeCached = Boolean(info);
|
||||
if (scopeCached) {
|
||||
|
@ -2773,15 +2825,14 @@ info = styleCache.retrieve(this.is, this._ownStyleProperties, this._styles);
|
|||
var globalCached = Boolean(info) && !scopeCached;
|
||||
var style = this._applyStyleProperties(info);
|
||||
if (!scopeCached) {
|
||||
var cacheableStyle = style;
|
||||
if (nativeShadow) {
|
||||
cacheableStyle = style.cloneNode ? style.cloneNode(true) : Object.create(style || null);
|
||||
}
|
||||
style = style && nativeShadow ? style.cloneNode(true) : style;
|
||||
info = {
|
||||
style: cacheableStyle,
|
||||
style: style,
|
||||
_scopeSelector: this._scopeSelector,
|
||||
_styleProperties: this._styleProperties
|
||||
};
|
||||
scopeData.key.customStyle = {};
|
||||
this.mixin(scopeData.key.customStyle, this.customStyle);
|
||||
scope._styleCache.store(this.is, info, scopeData.key, this._styles);
|
||||
if (!globalCached) {
|
||||
styleCache.store(this.is, Object.create(info), this._ownStyleProperties, this._styles);
|
||||
|
@ -2798,7 +2849,7 @@ this.mixin(props, propertyUtils.hostPropertiesFromStyles(this._styles));
|
|||
scopeProps = scopeProps || propertyUtils.propertyDataFromStyles(scope._styles, this).properties;
|
||||
this.mixin(props, scopeProps);
|
||||
this.mixin(props, propertyUtils.scopePropertiesFromStyles(this._styles));
|
||||
this.mixin(props, this.customStyle);
|
||||
propertyUtils.mixinCustomStyle(props, this.customStyle);
|
||||
propertyUtils.reify(props);
|
||||
this._styleProperties = props;
|
||||
},
|
||||
|
@ -2815,10 +2866,10 @@ _applyStyleProperties: function (info) {
|
|||
var oldScopeSelector = this._scopeSelector;
|
||||
this._scopeSelector = info ? info._scopeSelector : this.is + '-' + this.__proto__._scopeCount++;
|
||||
var style = propertyUtils.applyElementStyle(this, this._styleProperties, this._scopeSelector, info && info.style);
|
||||
if ((style || oldScopeSelector) && !nativeShadow) {
|
||||
if (!nativeShadow) {
|
||||
propertyUtils.applyElementScopeSelector(this, this._scopeSelector, oldScopeSelector, this._scopeCssViaAttr);
|
||||
}
|
||||
return style || {};
|
||||
return style;
|
||||
},
|
||||
serializeValueToAttribute: function (value, attribute, node) {
|
||||
node = node || this;
|
||||
|
@ -2837,8 +2888,11 @@ selector += (selector ? ' ' : '') + SCOPE_NAME + ' ' + this.is + (element._scope
|
|||
}
|
||||
return selector;
|
||||
},
|
||||
updateStyles: function () {
|
||||
updateStyles: function (properties) {
|
||||
if (this.isAttached) {
|
||||
if (properties) {
|
||||
this.mixin(this.customStyle, properties);
|
||||
}
|
||||
if (this._needsStyleProperties()) {
|
||||
this._updateStyleProperties();
|
||||
} else {
|
||||
|
@ -2862,8 +2916,8 @@ c.updateStyles();
|
|||
}
|
||||
}
|
||||
});
|
||||
Polymer.updateStyles = function () {
|
||||
styleDefaults.updateStyles();
|
||||
Polymer.updateStyles = function (properties) {
|
||||
styleDefaults.updateStyles(properties);
|
||||
Polymer.Base._updateRootStyles(document);
|
||||
};
|
||||
var styleCache = new Polymer.StyleCache();
|
||||
|
@ -3024,6 +3078,9 @@ var parentProps = archetype._parentProps;
|
|||
for (var prop in parentProps) {
|
||||
archetype._addPropertyEffect(prop, 'function', this._createHostPropEffector(prop));
|
||||
}
|
||||
for (var prop in this._instanceProps) {
|
||||
archetype._addPropertyEffect(prop, 'function', this._createInstancePropEffector(prop));
|
||||
}
|
||||
},
|
||||
_customPrepAnnotations: function (archetype, template) {
|
||||
archetype._template = template;
|
||||
|
@ -3082,18 +3139,27 @@ return function (source, value) {
|
|||
this.dataHost['_parent_' + prop] = value;
|
||||
};
|
||||
},
|
||||
_createInstancePropEffector: function (prop) {
|
||||
return function (source, value, old, fromAbove) {
|
||||
if (!fromAbove) {
|
||||
this.dataHost._forwardInstanceProp(this, prop, value);
|
||||
}
|
||||
};
|
||||
},
|
||||
_extendTemplate: function (template, proto) {
|
||||
Object.getOwnPropertyNames(proto).forEach(function (n) {
|
||||
var val = template[n];
|
||||
var pd = Object.getOwnPropertyDescriptor(proto, n);
|
||||
Object.defineProperty(template, n, pd);
|
||||
if (val !== undefined) {
|
||||
template._propertySet(n, val);
|
||||
template._propertySetter(n, val);
|
||||
}
|
||||
});
|
||||
},
|
||||
_forwardInstancePath: function (inst, path, value) {
|
||||
},
|
||||
_forwardInstanceProp: function (inst, prop, value) {
|
||||
},
|
||||
_notifyPathImpl: function (path, value) {
|
||||
var dataHost = this.dataHost;
|
||||
var dot = path.indexOf('.');
|
||||
|
@ -3116,6 +3182,7 @@ this._rootDataHost = host._getRootDataHost();
|
|||
this._setupConfigure(model);
|
||||
this._pushHost(host);
|
||||
this.root = this.instanceTemplate(this._template);
|
||||
this.root.__noContent = !this._notes._hasContent;
|
||||
this.root.__styleScoped = true;
|
||||
this._popHost();
|
||||
this._marshalAnnotatedNodes();
|
||||
|
@ -3220,8 +3287,17 @@ return this.pmap[item];
|
|||
getKeys: function () {
|
||||
return Object.keys(this.store);
|
||||
},
|
||||
setItem: function (key, value) {
|
||||
this.store[key] = value;
|
||||
setItem: function (key, item) {
|
||||
var old = this.store[key];
|
||||
if (old) {
|
||||
this._removeFromMap(old);
|
||||
}
|
||||
if (item && typeof item == 'object') {
|
||||
this.omap.set(item, key);
|
||||
} else {
|
||||
this.pmap[item] = key;
|
||||
}
|
||||
this.store[key] = item;
|
||||
},
|
||||
getItem: function (key) {
|
||||
return this.store[key];
|
||||
|
@ -3383,7 +3459,7 @@ return;
|
|||
},
|
||||
render: function () {
|
||||
this._fullRefresh = true;
|
||||
this.debounce('render', this._render);
|
||||
this._debounceTemplate(this._render);
|
||||
this._flushTemplates();
|
||||
},
|
||||
_render: function () {
|
||||
|
@ -3415,9 +3491,9 @@ rowForKey[key] = i;
|
|||
if (!row) {
|
||||
this.rows.push(row = this._insertRow(i, null, item));
|
||||
}
|
||||
row[this.as] = item;
|
||||
row.__key__ = key;
|
||||
row[this.indexAs] = i;
|
||||
row.__setProperty(this.as, item, true);
|
||||
row.__setProperty('__key__', key, true);
|
||||
row.__setProperty(this.indexAs, i, true);
|
||||
}
|
||||
for (; i < this.rows.length; i++) {
|
||||
this._detachRow(i);
|
||||
|
@ -3582,16 +3658,26 @@ c._hideTemplateChildren = hidden;
|
|||
}
|
||||
}
|
||||
},
|
||||
_forwardInstanceProp: function (row, prop, value) {
|
||||
if (prop == this.as) {
|
||||
var idx;
|
||||
if (this._sortFn || this._filterFn) {
|
||||
idx = this.items.indexOf(this.collection.getItem(row.__key__));
|
||||
} else {
|
||||
idx = row[this.indexAs];
|
||||
}
|
||||
this.set('items.' + idx, value);
|
||||
}
|
||||
},
|
||||
_forwardInstancePath: function (row, path, value) {
|
||||
if (path.indexOf(this.as + '.') === 0) {
|
||||
this.notifyPath('items.' + row.__key__ + '.' + path.slice(this.as.length + 1), value);
|
||||
return true;
|
||||
}
|
||||
},
|
||||
_forwardParentProp: function (prop, value) {
|
||||
if (this.rows) {
|
||||
this.rows.forEach(function (row) {
|
||||
row[prop] = value;
|
||||
row.__setProperty(prop, value, true);
|
||||
}, this);
|
||||
}
|
||||
},
|
||||
|
@ -3613,7 +3699,7 @@ if (dot >= 0) {
|
|||
path = this.as + '.' + path.substring(dot + 1);
|
||||
row.notifyPath(path, value, true);
|
||||
} else {
|
||||
row[this.as] = value;
|
||||
row.__setProperty(this.as, value, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -3721,15 +3807,16 @@ extends: 'template',
|
|||
properties: {
|
||||
'if': {
|
||||
type: Boolean,
|
||||
value: false
|
||||
value: false,
|
||||
observer: '_queueRender'
|
||||
},
|
||||
restamp: {
|
||||
type: Boolean,
|
||||
value: false
|
||||
value: false,
|
||||
observer: '_queueRender'
|
||||
}
|
||||
},
|
||||
behaviors: [Polymer.Templatizer],
|
||||
observers: ['_queueRender(if, restamp)'],
|
||||
_queueRender: function () {
|
||||
this._debounceTemplate(this._render);
|
||||
},
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue