polymer-rails 1.2.3 → 1.2.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/assets/javascripts/polymer/bower.json +5 -3
- data/app/assets/javascripts/polymer/build.log +299 -266
- data/app/assets/javascripts/polymer/polymer-micro.html +8 -29
- data/app/assets/javascripts/polymer/polymer-mini.html +720 -464
- data/app/assets/javascripts/polymer/polymer.html +134 -166
- data/lib/polymer-rails/version.rb +1 -1
- metadata +1 -1
@@ -1,13 +1,5 @@
|
|
1
1
|
<!--
|
2
2
|
@license
|
3
|
-
Copyright (c) 2015 The Polymer Project Authors. All rights reserved.
|
4
|
-
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
|
5
|
-
The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
|
6
|
-
The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
|
7
|
-
Code distributed by Google as part of the polymer project is also
|
8
|
-
subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
|
9
|
-
--><!--
|
10
|
-
@license
|
11
3
|
Copyright (c) 2014 The Polymer Project Authors. All rights reserved.
|
12
4
|
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
|
13
5
|
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
|
|
16
8
|
subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
|
17
9
|
--><link rel="import" href="polymer-mini.html">
|
18
10
|
|
11
|
+
|
12
|
+
|
19
13
|
<script>Polymer.nar = [];
|
20
14
|
Polymer.Annotations = {
|
21
15
|
parseAnnotations: function (template) {
|
@@ -27,22 +21,34 @@ return list;
|
|
27
21
|
_parseNodeAnnotations: function (node, list, stripWhiteSpace) {
|
28
22
|
return node.nodeType === Node.TEXT_NODE ? this._parseTextNodeAnnotation(node, list) : this._parseElementAnnotations(node, list, stripWhiteSpace);
|
29
23
|
},
|
30
|
-
_bindingRegex:
|
24
|
+
_bindingRegex: function () {
|
25
|
+
var IDENT = '(?:' + '[a-zA-Z_$][\\w.:$-*]*' + ')';
|
26
|
+
var NUMBER = '(?:' + '[-+]?[0-9]*\\.?[0-9]+(?:[eE][-+]?[0-9]+)?' + ')';
|
27
|
+
var SQUOTE_STRING = '(?:' + '\'(?:[^\'\\\\]|\\\\.)*\'' + ')';
|
28
|
+
var DQUOTE_STRING = '(?:' + '"(?:[^"\\\\]|\\\\.)*"' + ')';
|
29
|
+
var STRING = '(?:' + SQUOTE_STRING + '|' + DQUOTE_STRING + ')';
|
30
|
+
var ARGUMENT = '(?:' + IDENT + '|' + NUMBER + '|' + STRING + '\\s*' + ')';
|
31
|
+
var ARGUMENTS = '(?:' + ARGUMENT + '(?:,\\s*' + ARGUMENT + ')*' + ')';
|
32
|
+
var ARGUMENT_LIST = '(?:' + '\\(\\s*' + '(?:' + ARGUMENTS + '?' + ')' + '\\)\\s*' + ')';
|
33
|
+
var BINDING = '(' + IDENT + '\\s*' + ARGUMENT_LIST + '?' + ')';
|
34
|
+
var OPEN_BRACKET = '(\\[\\[|{{)' + '\\s*';
|
35
|
+
var CLOSE_BRACKET = '(?:]]|}})';
|
36
|
+
var NEGATE = '(?:(!)\\s*)?';
|
37
|
+
var EXPRESSION = OPEN_BRACKET + NEGATE + BINDING + CLOSE_BRACKET;
|
38
|
+
return new RegExp(EXPRESSION, 'g');
|
39
|
+
}(),
|
31
40
|
_parseBindings: function (text) {
|
32
41
|
var re = this._bindingRegex;
|
33
42
|
var parts = [];
|
34
|
-
var
|
43
|
+
var lastIndex = 0;
|
44
|
+
var m;
|
35
45
|
while ((m = re.exec(text)) !== null) {
|
36
|
-
if (m
|
37
|
-
parts.push({ literal: m
|
46
|
+
if (m.index > lastIndex) {
|
47
|
+
parts.push({ literal: text.slice(lastIndex, m.index) });
|
38
48
|
}
|
39
|
-
var mode = m[
|
49
|
+
var mode = m[1][0];
|
50
|
+
var negate = Boolean(m[2]);
|
40
51
|
var value = m[3].trim();
|
41
|
-
var negate = false;
|
42
|
-
if (value[0] == '!') {
|
43
|
-
negate = true;
|
44
|
-
value = value.substring(1).trim();
|
45
|
-
}
|
46
52
|
var customEvent, notifyEvent, colon;
|
47
53
|
if (mode == '{' && (colon = value.indexOf('::')) > 0) {
|
48
54
|
notifyEvent = value.substring(colon + 2);
|
@@ -191,7 +197,7 @@ var literal = this._literalFromParts(parts);
|
|
191
197
|
if (literal && kind == 'attribute') {
|
192
198
|
node.setAttribute(name, literal);
|
193
199
|
}
|
194
|
-
if (node.localName
|
200
|
+
if (node.localName === 'input' && origName === 'value') {
|
195
201
|
node.setAttribute(origName, '');
|
196
202
|
}
|
197
203
|
node.removeAttribute(origName);
|
@@ -207,12 +213,17 @@ isCompound: parts.length !== 1
|
|
207
213
|
};
|
208
214
|
}
|
209
215
|
},
|
210
|
-
_localSubTree: function (node, host) {
|
211
|
-
return node === host ? node.childNodes : node._lightChildren || node.childNodes;
|
212
|
-
},
|
213
216
|
findAnnotatedNode: function (root, annote) {
|
214
217
|
var parent = annote.parent && Polymer.Annotations.findAnnotatedNode(root, annote.parent);
|
215
|
-
|
218
|
+
if (parent) {
|
219
|
+
for (var n = parent.firstChild, i = 0; n; n = n.nextSibling) {
|
220
|
+
if (annote.index === i++) {
|
221
|
+
return n;
|
222
|
+
}
|
223
|
+
}
|
224
|
+
} else {
|
225
|
+
return root;
|
226
|
+
}
|
216
227
|
}
|
217
228
|
};
|
218
229
|
(function () {
|
@@ -287,8 +298,8 @@ if (this._template._content && this._template._content._notes) {
|
|
287
298
|
this._notes = this._template._content._notes;
|
288
299
|
} else {
|
289
300
|
this._notes = Polymer.Annotations.parseAnnotations(this._template);
|
290
|
-
}
|
291
301
|
this._processAnnotations(this._notes);
|
302
|
+
}
|
292
303
|
Polymer.Annotations.prepElement = null;
|
293
304
|
}
|
294
305
|
},
|
@@ -335,13 +346,18 @@ for (var k = 0, p$ = b.parts, p; k < p$.length && (p = p$[k]); k++) {
|
|
335
346
|
if (p.signature) {
|
336
347
|
var args = p.signature.args;
|
337
348
|
for (var kk = 0; kk < args.length; kk++) {
|
338
|
-
|
349
|
+
var model = args[kk].model;
|
350
|
+
if (model) {
|
351
|
+
pp[model] = true;
|
352
|
+
}
|
339
353
|
}
|
340
354
|
} else {
|
355
|
+
if (p.model) {
|
341
356
|
pp[p.model] = true;
|
342
357
|
}
|
343
358
|
}
|
344
359
|
}
|
360
|
+
}
|
345
361
|
if (n.templateContent) {
|
346
362
|
var tpp = n.templateContent._parentProps;
|
347
363
|
Polymer.Base.mixin(pp, tpp);
|
@@ -637,6 +653,8 @@ document.addEventListener('mouseup', upfn);
|
|
637
653
|
function untrackDocument(stateObj) {
|
638
654
|
document.removeEventListener('mousemove', stateObj.movefn);
|
639
655
|
document.removeEventListener('mouseup', stateObj.upfn);
|
656
|
+
stateObj.movefn = null;
|
657
|
+
stateObj.upfn = null;
|
640
658
|
}
|
641
659
|
var Gestures = {
|
642
660
|
gestures: {},
|
@@ -863,10 +881,8 @@ emits: [
|
|
863
881
|
'up'
|
864
882
|
],
|
865
883
|
info: {
|
866
|
-
movefn:
|
867
|
-
|
868
|
-
upfn: function () {
|
869
|
-
}
|
884
|
+
movefn: null,
|
885
|
+
upfn: null
|
870
886
|
},
|
871
887
|
reset: function () {
|
872
888
|
untrackDocument(this.info);
|
@@ -899,7 +915,6 @@ touchend: function (e) {
|
|
899
915
|
this.fire('up', Gestures.findOriginalTarget(e), e.changedTouches[0]);
|
900
916
|
},
|
901
917
|
fire: function (type, target, event) {
|
902
|
-
var self = this;
|
903
918
|
Gestures.fire(target, type, {
|
904
919
|
x: event.clientX,
|
905
920
|
y: event.clientY,
|
@@ -942,10 +957,8 @@ this.moves.shift();
|
|
942
957
|
}
|
943
958
|
this.moves.push(move);
|
944
959
|
},
|
945
|
-
movefn:
|
946
|
-
|
947
|
-
upfn: function () {
|
948
|
-
},
|
960
|
+
movefn: null,
|
961
|
+
upfn: null,
|
949
962
|
prevent: false
|
950
963
|
},
|
951
964
|
reset: function () {
|
@@ -1129,6 +1142,9 @@ none: 'none',
|
|
1129
1142
|
all: 'auto'
|
1130
1143
|
};
|
1131
1144
|
Polymer.Base._addFeature({
|
1145
|
+
_setupGestures: function () {
|
1146
|
+
this.__polymerGestures = null;
|
1147
|
+
},
|
1132
1148
|
_listen: function (node, eventName, handler) {
|
1133
1149
|
if (Gestures.gestures[eventName]) {
|
1134
1150
|
Gestures.add(node, eventName, handler);
|
@@ -1150,99 +1166,6 @@ Gestures.setTouchAction(node, DIRECTION_MAP[direction] || 'auto');
|
|
1150
1166
|
});
|
1151
1167
|
Polymer.Gestures = Gestures;
|
1152
1168
|
}());
|
1153
|
-
Polymer.Async = {
|
1154
|
-
_currVal: 0,
|
1155
|
-
_lastVal: 0,
|
1156
|
-
_callbacks: [],
|
1157
|
-
_twiddleContent: 0,
|
1158
|
-
_twiddle: document.createTextNode(''),
|
1159
|
-
run: function (callback, waitTime) {
|
1160
|
-
if (waitTime > 0) {
|
1161
|
-
return ~setTimeout(callback, waitTime);
|
1162
|
-
} else {
|
1163
|
-
this._twiddle.textContent = this._twiddleContent++;
|
1164
|
-
this._callbacks.push(callback);
|
1165
|
-
return this._currVal++;
|
1166
|
-
}
|
1167
|
-
},
|
1168
|
-
cancel: function (handle) {
|
1169
|
-
if (handle < 0) {
|
1170
|
-
clearTimeout(~handle);
|
1171
|
-
} else {
|
1172
|
-
var idx = handle - this._lastVal;
|
1173
|
-
if (idx >= 0) {
|
1174
|
-
if (!this._callbacks[idx]) {
|
1175
|
-
throw 'invalid async handle: ' + handle;
|
1176
|
-
}
|
1177
|
-
this._callbacks[idx] = null;
|
1178
|
-
}
|
1179
|
-
}
|
1180
|
-
},
|
1181
|
-
_atEndOfMicrotask: function () {
|
1182
|
-
var len = this._callbacks.length;
|
1183
|
-
for (var i = 0; i < len; i++) {
|
1184
|
-
var cb = this._callbacks[i];
|
1185
|
-
if (cb) {
|
1186
|
-
try {
|
1187
|
-
cb();
|
1188
|
-
} catch (e) {
|
1189
|
-
i++;
|
1190
|
-
this._callbacks.splice(0, i);
|
1191
|
-
this._lastVal += i;
|
1192
|
-
this._twiddle.textContent = this._twiddleContent++;
|
1193
|
-
throw e;
|
1194
|
-
}
|
1195
|
-
}
|
1196
|
-
}
|
1197
|
-
this._callbacks.splice(0, len);
|
1198
|
-
this._lastVal += len;
|
1199
|
-
}
|
1200
|
-
};
|
1201
|
-
new window.MutationObserver(function () {
|
1202
|
-
Polymer.Async._atEndOfMicrotask();
|
1203
|
-
}).observe(Polymer.Async._twiddle, { characterData: true });
|
1204
|
-
Polymer.Debounce = function () {
|
1205
|
-
var Async = Polymer.Async;
|
1206
|
-
var Debouncer = function (context) {
|
1207
|
-
this.context = context;
|
1208
|
-
var self = this;
|
1209
|
-
this.boundComplete = function () {
|
1210
|
-
self.complete();
|
1211
|
-
};
|
1212
|
-
};
|
1213
|
-
Debouncer.prototype = {
|
1214
|
-
go: function (callback, wait) {
|
1215
|
-
var h;
|
1216
|
-
this.finish = function () {
|
1217
|
-
Async.cancel(h);
|
1218
|
-
};
|
1219
|
-
h = Async.run(this.boundComplete, wait);
|
1220
|
-
this.callback = callback;
|
1221
|
-
},
|
1222
|
-
stop: function () {
|
1223
|
-
if (this.finish) {
|
1224
|
-
this.finish();
|
1225
|
-
this.finish = null;
|
1226
|
-
}
|
1227
|
-
},
|
1228
|
-
complete: function () {
|
1229
|
-
if (this.finish) {
|
1230
|
-
this.stop();
|
1231
|
-
this.callback.call(this.context);
|
1232
|
-
}
|
1233
|
-
}
|
1234
|
-
};
|
1235
|
-
function debounce(debouncer, callback, wait) {
|
1236
|
-
if (debouncer) {
|
1237
|
-
debouncer.stop();
|
1238
|
-
} else {
|
1239
|
-
debouncer = new Debouncer(this);
|
1240
|
-
}
|
1241
|
-
debouncer.go(callback, wait);
|
1242
|
-
return debouncer;
|
1243
|
-
}
|
1244
|
-
return debounce;
|
1245
|
-
}();
|
1246
1169
|
Polymer.Base._addFeature({
|
1247
1170
|
$$: function (slctr) {
|
1248
1171
|
return Polymer.dom(this.root).querySelector(slctr);
|
@@ -1382,10 +1305,14 @@ translate3d: function (x, y, z, node) {
|
|
1382
1305
|
node = node || this;
|
1383
1306
|
this.transform('translate3d(' + x + ',' + y + ',' + z + ')', node);
|
1384
1307
|
},
|
1385
|
-
importHref: function (href, onload, onerror) {
|
1308
|
+
importHref: function (href, onload, onerror, optAsync) {
|
1386
1309
|
var l = document.createElement('link');
|
1387
1310
|
l.rel = 'import';
|
1388
1311
|
l.href = href;
|
1312
|
+
optAsync = Boolean(optAsync);
|
1313
|
+
if (optAsync) {
|
1314
|
+
l.setAttribute('async', '');
|
1315
|
+
}
|
1389
1316
|
var self = this;
|
1390
1317
|
if (onload) {
|
1391
1318
|
l.onload = function (e) {
|
@@ -1753,6 +1680,9 @@ this._addComplexObserverEffect(o);
|
|
1753
1680
|
},
|
1754
1681
|
_addComplexObserverEffect: function (observer) {
|
1755
1682
|
var sig = this._parseMethod(observer);
|
1683
|
+
if (!sig) {
|
1684
|
+
throw new Error('Malformed observer expression \'' + observer + '\'');
|
1685
|
+
}
|
1756
1686
|
for (var i = 0, arg; i < sig.args.length && (arg = sig.args[i]); i++) {
|
1757
1687
|
this._addPropertyEffect(arg.model, 'complexObserver', {
|
1758
1688
|
method: sig.method,
|
@@ -1818,7 +1748,7 @@ trigger: trigger
|
|
1818
1748
|
});
|
1819
1749
|
},
|
1820
1750
|
_parseMethod: function (expression) {
|
1821
|
-
var m = expression.match(/([^\s]
|
1751
|
+
var m = expression.match(/([^\s]+?)\((.*)\)/);
|
1822
1752
|
if (m) {
|
1823
1753
|
var sig = {
|
1824
1754
|
method: m[1],
|
@@ -1845,10 +1775,7 @@ return sig;
|
|
1845
1775
|
},
|
1846
1776
|
_parseArg: function (rawArg) {
|
1847
1777
|
var arg = rawArg.trim().replace(/,/g, ',').replace(/\\(.)/g, '$1');
|
1848
|
-
var a = {
|
1849
|
-
name: arg,
|
1850
|
-
model: this._modelForPath(arg)
|
1851
|
-
};
|
1778
|
+
var a = { name: arg };
|
1852
1779
|
var fc = arg[0];
|
1853
1780
|
if (fc === '-') {
|
1854
1781
|
fc = arg[1];
|
@@ -1868,6 +1795,7 @@ a.literal = true;
|
|
1868
1795
|
break;
|
1869
1796
|
}
|
1870
1797
|
if (!a.literal) {
|
1798
|
+
a.model = this._modelForPath(arg);
|
1871
1799
|
a.structured = arg.indexOf('.') > 0;
|
1872
1800
|
if (a.structured) {
|
1873
1801
|
a.wildcard = arg.slice(-2) == '.*';
|
@@ -1903,7 +1831,7 @@ value = value == undefined ? '' : value;
|
|
1903
1831
|
}
|
1904
1832
|
var pinfo;
|
1905
1833
|
if (!node._propertyInfo || !(pinfo = node._propertyInfo[property]) || !pinfo.readOnly) {
|
1906
|
-
this.__setProperty(property, value,
|
1834
|
+
this.__setProperty(property, value, false, node);
|
1907
1835
|
}
|
1908
1836
|
}
|
1909
1837
|
},
|
@@ -1917,6 +1845,7 @@ Polymer.Base._addFeature({
|
|
1917
1845
|
_setupConfigure: function (initialConfig) {
|
1918
1846
|
this._config = {};
|
1919
1847
|
this._handlers = [];
|
1848
|
+
this._aboveConfig = null;
|
1920
1849
|
if (initialConfig) {
|
1921
1850
|
for (var i in initialConfig) {
|
1922
1851
|
if (initialConfig[i] !== undefined) {
|
@@ -2034,7 +1963,9 @@ Polymer.Base._addFeature({
|
|
2034
1963
|
notifyPath: function (path, value, fromAbove) {
|
2035
1964
|
var info = {};
|
2036
1965
|
this._get(path, this, info);
|
1966
|
+
if (info.path) {
|
2037
1967
|
this._notifyPath(info.path, value, fromAbove);
|
1968
|
+
}
|
2038
1969
|
},
|
2039
1970
|
_notifyPath: function (path, value, fromAbove) {
|
2040
1971
|
var old = this._propertySetter(path, value);
|
@@ -2346,7 +2277,7 @@ return Polymer.ResolveUrl.resolveUrl(url, root);
|
|
2346
2277
|
}
|
2347
2278
|
});
|
2348
2279
|
Polymer.CssParse = function () {
|
2349
|
-
|
2280
|
+
return {
|
2350
2281
|
parse: function (text) {
|
2351
2282
|
text = this._clean(text);
|
2352
2283
|
return this._parseCss(this._lex(text), text);
|
@@ -2360,7 +2291,7 @@ start: 0,
|
|
2360
2291
|
end: text.length
|
2361
2292
|
};
|
2362
2293
|
var n = root;
|
2363
|
-
for (var i = 0,
|
2294
|
+
for (var i = 0, l = text.length; i < l; i++) {
|
2364
2295
|
switch (text[i]) {
|
2365
2296
|
case this.OPEN_BRACE:
|
2366
2297
|
if (!n.rules) {
|
@@ -2477,8 +2408,8 @@ CLOSE_BRACE: '}',
|
|
2477
2408
|
_rx: {
|
2478
2409
|
comments: /\/\*[^*]*\*+([^\/*][^*]*\*+)*\//gim,
|
2479
2410
|
port: /@import[^;]*;/gim,
|
2480
|
-
customProp: /(
|
2481
|
-
mixinProp: /(
|
2411
|
+
customProp: /(?:^[^;\-\s}]+)?--[^;{}]*?:[^{};]*?(?:[;\n]|$)/gim,
|
2412
|
+
mixinProp: /(?:^[^;\-\s}]+)?--[^;{}]*?:[^{};]*?{[^}]*?}(?:[;\n]|$)?/gim,
|
2482
2413
|
mixinApply: /@apply[\s]*\([^)]*?\)[\s]*(?:[;\n]|$)?/gim,
|
2483
2414
|
varApply: /[^;:]*?:[^;]*?var\([^;]*\)(?:[;\n]|$)?/gim,
|
2484
2415
|
keyframesRule: /^@[^\s]*keyframes/,
|
@@ -2488,7 +2419,6 @@ VAR_START: '--',
|
|
2488
2419
|
MEDIA_START: '@media',
|
2489
2420
|
AT_START: '@'
|
2490
2421
|
};
|
2491
|
-
return api;
|
2492
2422
|
}();
|
2493
2423
|
Polymer.StyleUtil = function () {
|
2494
2424
|
return {
|
@@ -2516,14 +2446,10 @@ style.__cssRules = this.parser.parse(style.textContent);
|
|
2516
2446
|
}
|
2517
2447
|
return style.__cssRules;
|
2518
2448
|
},
|
2519
|
-
clearStyleRules: function (style) {
|
2520
|
-
style.__cssRules = null;
|
2521
|
-
},
|
2522
2449
|
forEachStyleRule: function (node, callback) {
|
2523
2450
|
if (!node) {
|
2524
2451
|
return;
|
2525
2452
|
}
|
2526
|
-
var s = node.parsedSelector;
|
2527
2453
|
var skipRules = false;
|
2528
2454
|
if (node.type === this.ruleTypes.STYLE_RULE) {
|
2529
2455
|
callback(node);
|
@@ -2572,7 +2498,7 @@ return m && m._cssText || '';
|
|
2572
2498
|
cssFromElement: function (element) {
|
2573
2499
|
var cssText = '';
|
2574
2500
|
var content = element.content || element;
|
2575
|
-
var e$ = Polymer.
|
2501
|
+
var e$ = Polymer.TreeApi.arrayCopy(content.querySelectorAll(this.MODULE_STYLES_SELECTOR));
|
2576
2502
|
for (var i = 0, e; i < e$.length; i++) {
|
2577
2503
|
e = e$[i];
|
2578
2504
|
if (e.localName === 'template') {
|
@@ -2638,7 +2564,7 @@ if (c) {
|
|
2638
2564
|
element.setAttribute(CLASS, c.replace(SCOPE_NAME, '').replace(scope, ''));
|
2639
2565
|
}
|
2640
2566
|
} else {
|
2641
|
-
element.setAttribute(CLASS, c
|
2567
|
+
element.setAttribute(CLASS, (c ? c + ' ' : '') + SCOPE_NAME + ' ' + scope);
|
2642
2568
|
}
|
2643
2569
|
}
|
2644
2570
|
}
|
@@ -2647,7 +2573,7 @@ element.setAttribute(CLASS, c + (c ? ' ' : '') + SCOPE_NAME + ' ' + scope);
|
|
2647
2573
|
elementStyles: function (element, callback) {
|
2648
2574
|
var styles = element._styles;
|
2649
2575
|
var cssText = '';
|
2650
|
-
for (var i = 0, l = styles.length, s
|
2576
|
+
for (var i = 0, l = styles.length, s; i < l && (s = styles[i]); i++) {
|
2651
2577
|
var rules = styleUtil.rulesForStyle(s);
|
2652
2578
|
cssText += nativeShadow ? styleUtil.toCssText(rules, callback) : this.css(rules, element.is, element.extends, callback, element._scopeCssViaAttr) + '\n\n';
|
2653
2579
|
}
|
@@ -2768,9 +2694,9 @@ var HOST = ':host';
|
|
2768
2694
|
var ROOT = ':root';
|
2769
2695
|
var HOST_PAREN = /(\:host)(?:\(((?:\([^)(]*\)|[^)(]*)+?)\))/g;
|
2770
2696
|
var HOST_CONTEXT = ':host-context';
|
2771
|
-
var HOST_CONTEXT_PAREN = /(.*)(
|
2697
|
+
var HOST_CONTEXT_PAREN = /(.*)(?::host-context)(?:\(((?:\([^)(]*\)|[^)(]*)+?)\))(.*)/;
|
2772
2698
|
var CONTENT = '::content';
|
2773
|
-
var SCOPE_JUMP =
|
2699
|
+
var SCOPE_JUMP = /::content|::shadow|\/deep\//;
|
2774
2700
|
var CSS_CLASS_PREFIX = '.';
|
2775
2701
|
var CSS_ATTR_PREFIX = '[' + SCOPE_NAME + '~=';
|
2776
2702
|
var CSS_ATTR_SUFFIX = ']';
|
@@ -2923,10 +2849,12 @@ return;
|
|
2923
2849
|
var self = this;
|
2924
2850
|
var scopify = function (node) {
|
2925
2851
|
if (node.nodeType === Node.ELEMENT_NODE) {
|
2926
|
-
|
2852
|
+
var className = node.getAttribute('class');
|
2853
|
+
node.setAttribute('class', self._scopeElementClass(node, className));
|
2927
2854
|
var n$ = node.querySelectorAll('*');
|
2928
2855
|
for (var i = 0, n; i < n$.length && (n = n$[i]); i++) {
|
2929
|
-
|
2856
|
+
className = n.getAttribute('class');
|
2857
|
+
n.setAttribute('class', self._scopeElementClass(n, className));
|
2930
2858
|
}
|
2931
2859
|
}
|
2932
2860
|
};
|
@@ -3064,9 +2992,7 @@ p = pp.join(':');
|
|
3064
2992
|
parts[i] = p && p.lastIndexOf(';') === p.length - 1 ? p.slice(0, -1) : p || '';
|
3065
2993
|
}
|
3066
2994
|
}
|
3067
|
-
return parts.
|
3068
|
-
return v;
|
3069
|
-
}).join(';');
|
2995
|
+
return parts.join(';');
|
3070
2996
|
},
|
3071
2997
|
applyProperties: function (rule, props) {
|
3072
2998
|
var output = '';
|
@@ -3146,13 +3072,13 @@ parts[i] = p.match(hostRx) ? p.replace(hostSelector, hostSelector + scope) : sco
|
|
3146
3072
|
rule.selector = parts.join(',');
|
3147
3073
|
},
|
3148
3074
|
applyElementScopeSelector: function (element, selector, old, viaAttr) {
|
3149
|
-
var c = viaAttr ? element.getAttribute(styleTransformer.SCOPE_NAME) : element.
|
3075
|
+
var c = viaAttr ? element.getAttribute(styleTransformer.SCOPE_NAME) : element.getAttribute('class') || '';
|
3150
3076
|
var v = old ? c.replace(old, selector) : (c ? c + ' ' : '') + this.XSCOPE_NAME + ' ' + selector;
|
3151
3077
|
if (c !== v) {
|
3152
3078
|
if (viaAttr) {
|
3153
3079
|
element.setAttribute(styleTransformer.SCOPE_NAME, v);
|
3154
3080
|
} else {
|
3155
|
-
element.
|
3081
|
+
element.setAttribute('class', v);
|
3156
3082
|
}
|
3157
3083
|
}
|
3158
3084
|
},
|
@@ -3319,6 +3245,11 @@ return this._styleProperties && this._styleProperties[property] || getComputedSt
|
|
3319
3245
|
},
|
3320
3246
|
_setupStyleProperties: function () {
|
3321
3247
|
this.customStyle = {};
|
3248
|
+
this._styleCache = null;
|
3249
|
+
this._styleProperties = null;
|
3250
|
+
this._scopeSelector = null;
|
3251
|
+
this._ownStyleProperties = null;
|
3252
|
+
this._customStyle = null;
|
3322
3253
|
},
|
3323
3254
|
_needsStyleProperties: function () {
|
3324
3255
|
return Boolean(this._ownStylePropertyNames && this._ownStylePropertyNames.length);
|
@@ -3479,9 +3410,11 @@ this._addComplexObserverEffects(b.observers);
|
|
3479
3410
|
this._addHostAttributes(b.hostAttributes);
|
3480
3411
|
},
|
3481
3412
|
_initFeatures: function () {
|
3413
|
+
this._setupGestures();
|
3482
3414
|
this._setupConfigure();
|
3483
3415
|
this._setupStyleProperties();
|
3484
3416
|
this._setupDebouncers();
|
3417
|
+
this._setupShady();
|
3485
3418
|
this._registerHost();
|
3486
3419
|
if (this._template) {
|
3487
3420
|
this._poolContent();
|
@@ -3549,9 +3482,9 @@ styleUtil.forEachStyleRule(styleUtil.rulesForStyle(e), function (rule) {
|
|
3549
3482
|
styleTransformer.documentRule(rule);
|
3550
3483
|
});
|
3551
3484
|
var self = this;
|
3552
|
-
function fn() {
|
3485
|
+
var fn = function fn() {
|
3553
3486
|
self._applyCustomProperties(e);
|
3554
|
-
}
|
3487
|
+
};
|
3555
3488
|
if (this._pendingApplyProperties) {
|
3556
3489
|
cancelAnimationFrame(this._pendingApplyProperties);
|
3557
3490
|
this._pendingApplyProperties = null;
|
@@ -3603,6 +3536,8 @@ archetype._notifyPathUp = this._notifyPathUpImpl;
|
|
3603
3536
|
archetype._scopeElementClass = this._scopeElementClassImpl;
|
3604
3537
|
archetype.listen = this._listenImpl;
|
3605
3538
|
archetype._showHideChildren = this._showHideChildrenImpl;
|
3539
|
+
archetype.__setPropertyOrig = this.__setProperty;
|
3540
|
+
archetype.__setProperty = this.__setPropertyImpl;
|
3606
3541
|
var _constructor = this._constructorImpl;
|
3607
3542
|
var ctor = function TemplateInstance(model, host) {
|
3608
3543
|
_constructor.call(this, model, host);
|
@@ -3639,6 +3574,12 @@ n.style.display = n.__polymerDisplay__;
|
|
3639
3574
|
n.__hideTemplateChildren__ = hide;
|
3640
3575
|
}
|
3641
3576
|
},
|
3577
|
+
__setPropertyImpl: function (property, value, fromAbove, node) {
|
3578
|
+
if (node && node.__hideTemplateChildren__ && property == 'textContent') {
|
3579
|
+
property = '__polymerTextContent__';
|
3580
|
+
}
|
3581
|
+
this.__setPropertyOrig(property, value, fromAbove, node);
|
3582
|
+
},
|
3642
3583
|
_debounceTemplate: function (fn) {
|
3643
3584
|
Polymer.dom.addDebouncer(this.debounce('_debounceTemplate', fn));
|
3644
3585
|
},
|
@@ -3876,9 +3817,10 @@ this.pmap[item] = key;
|
|
3876
3817
|
return '#' + key;
|
3877
3818
|
},
|
3878
3819
|
removeKey: function (key) {
|
3879
|
-
key = this._parseKey(key)
|
3820
|
+
if (key = this._parseKey(key)) {
|
3880
3821
|
this._removeFromMap(this.store[key]);
|
3881
3822
|
delete this.store[key];
|
3823
|
+
}
|
3882
3824
|
},
|
3883
3825
|
_removeFromMap: function (item) {
|
3884
3826
|
if (item && typeof item == 'object') {
|
@@ -3909,13 +3851,12 @@ return '#' + key;
|
|
3909
3851
|
});
|
3910
3852
|
},
|
3911
3853
|
_parseKey: function (key) {
|
3912
|
-
if (key[0] == '#') {
|
3854
|
+
if (key && key[0] == '#') {
|
3913
3855
|
return key.slice(1);
|
3914
3856
|
}
|
3915
|
-
throw new Error('unexpected key ' + key);
|
3916
3857
|
},
|
3917
3858
|
setItem: function (key, item) {
|
3918
|
-
key = this._parseKey(key)
|
3859
|
+
if (key = this._parseKey(key)) {
|
3919
3860
|
var old = this.store[key];
|
3920
3861
|
if (old) {
|
3921
3862
|
this._removeFromMap(old);
|
@@ -3926,10 +3867,12 @@ this.omap.set(item, key);
|
|
3926
3867
|
this.pmap[item] = key;
|
3927
3868
|
}
|
3928
3869
|
this.store[key] = item;
|
3870
|
+
}
|
3929
3871
|
},
|
3930
3872
|
getItem: function (key) {
|
3931
|
-
key = this._parseKey(key)
|
3873
|
+
if (key = this._parseKey(key)) {
|
3932
3874
|
return this.store[key];
|
3875
|
+
}
|
3933
3876
|
},
|
3934
3877
|
getItems: function () {
|
3935
3878
|
var items = [], store = this.store;
|
@@ -4005,6 +3948,11 @@ type: String,
|
|
4005
3948
|
observer: '_observeChanged'
|
4006
3949
|
},
|
4007
3950
|
delay: Number,
|
3951
|
+
renderedItemCount: {
|
3952
|
+
type: Number,
|
3953
|
+
notify: true,
|
3954
|
+
readOnly: true
|
3955
|
+
},
|
4008
3956
|
initialCount: {
|
4009
3957
|
type: Number,
|
4010
3958
|
observer: '_initializeChunking'
|
@@ -4013,7 +3961,10 @@ targetFramerate: {
|
|
4013
3961
|
type: Number,
|
4014
3962
|
value: 20
|
4015
3963
|
},
|
4016
|
-
_targetFrameTime: {
|
3964
|
+
_targetFrameTime: {
|
3965
|
+
type: Number,
|
3966
|
+
computed: '_computeFrameTime(targetFramerate)'
|
3967
|
+
}
|
4017
3968
|
},
|
4018
3969
|
behaviors: [Polymer.Templatizer],
|
4019
3970
|
observers: ['_itemsChanged(items.*)'],
|
@@ -4027,15 +3978,19 @@ self._renderChunk();
|
|
4027
3978
|
};
|
4028
3979
|
},
|
4029
3980
|
detached: function () {
|
3981
|
+
this.__isDetached = true;
|
4030
3982
|
for (var i = 0; i < this._instances.length; i++) {
|
4031
3983
|
this._detachInstance(i);
|
4032
3984
|
}
|
4033
3985
|
},
|
4034
3986
|
attached: function () {
|
3987
|
+
if (this.__isDetached) {
|
3988
|
+
this.__isDetached = false;
|
4035
3989
|
var parent = Polymer.dom(Polymer.dom(this).parentNode);
|
4036
3990
|
for (var i = 0; i < this._instances.length; i++) {
|
4037
3991
|
this._attachInstance(i, parent);
|
4038
3992
|
}
|
3993
|
+
}
|
4039
3994
|
},
|
4040
3995
|
ready: function () {
|
4041
3996
|
this._instanceProps = { __key__: true };
|
@@ -4173,6 +4128,7 @@ inst.__setProperty(this.indexAs, i, true);
|
|
4173
4128
|
}
|
4174
4129
|
}
|
4175
4130
|
this._pool.length = 0;
|
4131
|
+
this._setRenderedItemCount(this._instances.length);
|
4176
4132
|
this.fire('dom-change');
|
4177
4133
|
this._tryRenderChunk();
|
4178
4134
|
},
|
@@ -4547,7 +4503,9 @@ _queueRender: function () {
|
|
4547
4503
|
this._debounceTemplate(this._render);
|
4548
4504
|
},
|
4549
4505
|
detached: function () {
|
4506
|
+
if (!this.parentNode || this.parentNode.nodeType == Node.DOCUMENT_FRAGMENT_NODE && (!Polymer.Settings.hasShadow || !(this.parentNode instanceof ShadowRoot))) {
|
4550
4507
|
this._teardownInstance();
|
4508
|
+
}
|
4551
4509
|
},
|
4552
4510
|
attached: function () {
|
4553
4511
|
if (this.if && this.ctor) {
|
@@ -4576,20 +4534,30 @@ this._lastIf = this.if;
|
|
4576
4534
|
}
|
4577
4535
|
},
|
4578
4536
|
_ensureInstance: function () {
|
4579
|
-
if (!this._instance) {
|
4580
4537
|
var parentNode = Polymer.dom(this).parentNode;
|
4581
4538
|
if (parentNode) {
|
4582
4539
|
var parent = Polymer.dom(parentNode);
|
4540
|
+
if (!this._instance) {
|
4583
4541
|
this._instance = this.stamp();
|
4584
4542
|
var root = this._instance.root;
|
4585
4543
|
parent.insertBefore(root, this);
|
4544
|
+
} else {
|
4545
|
+
var c$ = this._instance._children;
|
4546
|
+
if (c$ && c$.length) {
|
4547
|
+
var lastChild = Polymer.dom(this).previousSibling;
|
4548
|
+
if (lastChild !== c$[c$.length - 1]) {
|
4549
|
+
for (var i = 0, n; i < c$.length && (n = c$[i]); i++) {
|
4550
|
+
parent.insertBefore(n, this);
|
4551
|
+
}
|
4552
|
+
}
|
4553
|
+
}
|
4586
4554
|
}
|
4587
4555
|
}
|
4588
4556
|
},
|
4589
4557
|
_teardownInstance: function () {
|
4590
4558
|
if (this._instance) {
|
4591
4559
|
var c$ = this._instance._children;
|
4592
|
-
if (c$) {
|
4560
|
+
if (c$ && c$.length) {
|
4593
4561
|
var parent = Polymer.dom(Polymer.dom(c$[0]).parentNode);
|
4594
4562
|
for (var i = 0, n; i < c$.length && (n = c$[i]); i++) {
|
4595
4563
|
parent.removeChild(n);
|
@@ -4686,7 +4654,7 @@ this._prepConfigure();
|
|
4686
4654
|
this._prepBindings();
|
4687
4655
|
this._prepPropertyInfo();
|
4688
4656
|
Polymer.Base._initFeatures.call(this);
|
4689
|
-
this._children = Polymer.
|
4657
|
+
this._children = Polymer.TreeApi.arrayCopyChildNodes(this.root);
|
4690
4658
|
}
|
4691
4659
|
this._insertChildren();
|
4692
4660
|
this.fire('dom-change');
|