polymer-rails 1.1.5 → 1.2.0
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/LICENSE.txt +27 -0
- data/app/assets/javascripts/polymer/bower.json +27 -0
- data/app/assets/javascripts/polymer/build.log +27 -0
- data/app/assets/javascripts/polymer/polymer-micro.html +598 -597
- data/app/assets/javascripts/polymer/polymer-mini.html +1859 -1527
- data/app/assets/javascripts/polymer/polymer.html +4467 -4284
- data/app/assets/javascripts/webcomponentsjs/CustomElements.js +1041 -0
- data/app/assets/javascripts/webcomponentsjs/CustomElements.min.js +11 -0
- data/app/assets/javascripts/webcomponentsjs/HTMLImports.js +1155 -0
- data/app/assets/javascripts/webcomponentsjs/HTMLImports.min.js +11 -0
- data/app/assets/javascripts/webcomponentsjs/MutationObserver.js +350 -0
- data/app/assets/javascripts/webcomponentsjs/MutationObserver.min.js +11 -0
- data/app/assets/javascripts/webcomponentsjs/README.md +125 -0
- data/app/assets/javascripts/webcomponentsjs/ShadowDOM.js +4452 -0
- data/app/assets/javascripts/webcomponentsjs/ShadowDOM.min.js +13 -0
- data/app/assets/javascripts/webcomponentsjs/bower.json +21 -0
- data/app/assets/javascripts/webcomponentsjs/build.log +398 -0
- data/app/assets/javascripts/webcomponentsjs/package.json +28 -0
- data/app/assets/javascripts/webcomponentsjs/webcomponents-lite.js +169 -151
- data/app/assets/javascripts/webcomponentsjs/webcomponents-lite.min.js +12 -0
- data/app/assets/javascripts/webcomponentsjs/webcomponents.js +108 -70
- data/app/assets/javascripts/webcomponentsjs/webcomponents.min.js +14 -0
- data/lib/polymer-rails/version.rb +1 -1
- metadata +22 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e8c38623243414f29f89f584c13700ba8adc2fc7
|
4
|
+
data.tar.gz: eba0c1f853de2027d17d9e49ab03d1e440b6783c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 15fe59bdd479ab33e02c5c355efce981a17eaec6dbea7d4e892757def9fc88980e7929b0609366deddbb6150824229d989e1203e9cf82741c86710d100f7382d
|
7
|
+
data.tar.gz: 1d589c9a4cb9d657989d5aecea564623f7ebeb309d0bede6510e2b56d9c436cb3ce884eb6e237c49d3d64b6b5de6faa874e4fd87e51b22f5d8c79bc336f05b34
|
@@ -0,0 +1,27 @@
|
|
1
|
+
// Copyright (c) 2014 The Polymer Authors. All rights reserved.
|
2
|
+
//
|
3
|
+
// Redistribution and use in source and binary forms, with or without
|
4
|
+
// modification, are permitted provided that the following conditions are
|
5
|
+
// met:
|
6
|
+
//
|
7
|
+
// * Redistributions of source code must retain the above copyright
|
8
|
+
// notice, this list of conditions and the following disclaimer.
|
9
|
+
// * Redistributions in binary form must reproduce the above
|
10
|
+
// copyright notice, this list of conditions and the following disclaimer
|
11
|
+
// in the documentation and/or other materials provided with the
|
12
|
+
// distribution.
|
13
|
+
// * Neither the name of Google Inc. nor the names of its
|
14
|
+
// contributors may be used to endorse or promote products derived from
|
15
|
+
// this software without specific prior written permission.
|
16
|
+
//
|
17
|
+
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
18
|
+
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
19
|
+
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
20
|
+
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
21
|
+
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
22
|
+
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
23
|
+
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
24
|
+
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
25
|
+
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
26
|
+
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
27
|
+
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
@@ -0,0 +1,27 @@
|
|
1
|
+
{
|
2
|
+
"name": "polymer",
|
3
|
+
"version": "1.2.0",
|
4
|
+
"main": [
|
5
|
+
"polymer.html"
|
6
|
+
],
|
7
|
+
"license": "http://polymer.github.io/LICENSE.txt",
|
8
|
+
"ignore": [
|
9
|
+
"/.*",
|
10
|
+
"/test/",
|
11
|
+
"gen-changelog.sh"
|
12
|
+
],
|
13
|
+
"authors": [
|
14
|
+
"The Polymer Authors (http://polymer.github.io/AUTHORS.txt)"
|
15
|
+
],
|
16
|
+
"repository": {
|
17
|
+
"type": "git",
|
18
|
+
"url": "https://github.com/Polymer/polymer.git"
|
19
|
+
},
|
20
|
+
"dependencies": {
|
21
|
+
"webcomponentsjs": "^0.7.2"
|
22
|
+
},
|
23
|
+
"devDependencies": {
|
24
|
+
"web-component-tester": "*"
|
25
|
+
},
|
26
|
+
"private": true
|
27
|
+
}
|
@@ -0,0 +1,27 @@
|
|
1
|
+
BUILD LOG
|
2
|
+
---------
|
3
|
+
Build Time: 2015-10-22T17:41:58-0700
|
4
|
+
|
5
|
+
NODEJS INFORMATION
|
6
|
+
==================
|
7
|
+
nodejs: v4.2.1
|
8
|
+
gulp: 3.9.0
|
9
|
+
gulp-audit: 1.0.0
|
10
|
+
gulp-rename: 1.2.2
|
11
|
+
gulp-vulcanize: 6.0.1
|
12
|
+
polyclean: 1.2.0
|
13
|
+
lazypipe: 0.2.4
|
14
|
+
run-sequence: 1.1.4
|
15
|
+
web-component-tester: 3.3.29
|
16
|
+
del: 1.2.1
|
17
|
+
gulp-replace: 0.5.4
|
18
|
+
|
19
|
+
REPO REVISIONS
|
20
|
+
==============
|
21
|
+
polymer: ec6b18f3e4ff414e6f3692b6641c7506c910546c
|
22
|
+
|
23
|
+
BUILD HASHES
|
24
|
+
============
|
25
|
+
polymer-mini.html: d807c77658cac260deb34187c1351be45b414679
|
26
|
+
polymer-micro.html: fe27c039dcd2aef07d2b9065ac30a5fd9448d887
|
27
|
+
polymer.html: cecea00d47a8682ec01d486a3ac0d45da51eaf24
|
@@ -1,597 +1,598 @@
|
|
1
|
-
<!--
|
2
|
-
@license
|
3
|
-
Copyright (c) 2014 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
|
-
--><script>(function () {
|
10
|
-
function resolve() {
|
11
|
-
document.body.removeAttribute('unresolved');
|
12
|
-
}
|
13
|
-
if (window.WebComponents) {
|
14
|
-
addEventListener('WebComponentsReady', resolve);
|
15
|
-
} else {
|
16
|
-
if (document.readyState === 'interactive' || document.readyState === 'complete') {
|
17
|
-
resolve();
|
18
|
-
} else {
|
19
|
-
addEventListener('DOMContentLoaded', resolve);
|
20
|
-
}
|
21
|
-
}
|
22
|
-
}());
|
23
|
-
window.Polymer = {
|
24
|
-
Settings: function () {
|
25
|
-
var user = window.Polymer || {};
|
26
|
-
location.search.slice(1).split('&').forEach(function (o) {
|
27
|
-
o = o.split('=');
|
28
|
-
o[0] && (user[o[0]] = o[1] || true);
|
29
|
-
});
|
30
|
-
var wantShadow = user.dom === 'shadow';
|
31
|
-
var hasShadow = Boolean(Element.prototype.createShadowRoot);
|
32
|
-
var nativeShadow = hasShadow && !window.ShadowDOMPolyfill;
|
33
|
-
var useShadow = wantShadow && hasShadow;
|
34
|
-
var hasNativeImports = Boolean('import' in document.createElement('link'));
|
35
|
-
var useNativeImports = hasNativeImports;
|
36
|
-
var useNativeCustomElements = !window.CustomElements || window.CustomElements.useNative;
|
37
|
-
return {
|
38
|
-
wantShadow: wantShadow,
|
39
|
-
hasShadow: hasShadow,
|
40
|
-
nativeShadow: nativeShadow,
|
41
|
-
useShadow: useShadow,
|
42
|
-
useNativeShadow: useShadow && nativeShadow,
|
43
|
-
useNativeImports: useNativeImports,
|
44
|
-
useNativeCustomElements: useNativeCustomElements
|
45
|
-
};
|
46
|
-
}()
|
47
|
-
};
|
48
|
-
(function () {
|
49
|
-
var userPolymer = window.Polymer;
|
50
|
-
window.Polymer = function (prototype) {
|
51
|
-
if (typeof prototype === 'function') {
|
52
|
-
prototype = prototype.prototype;
|
53
|
-
}
|
54
|
-
if (!prototype) {
|
55
|
-
prototype = {};
|
56
|
-
}
|
57
|
-
var factory = desugar(prototype);
|
58
|
-
prototype = factory.prototype;
|
59
|
-
var options = { prototype: prototype };
|
60
|
-
if (prototype.extends) {
|
61
|
-
options.extends = prototype.extends;
|
62
|
-
}
|
63
|
-
Polymer.telemetry._registrate(prototype);
|
64
|
-
document.registerElement(prototype.is, options);
|
65
|
-
return factory;
|
66
|
-
};
|
67
|
-
var desugar = function (prototype) {
|
68
|
-
var base = Polymer.Base;
|
69
|
-
if (prototype.extends) {
|
70
|
-
base = Polymer.Base._getExtendedPrototype(prototype.extends);
|
71
|
-
}
|
72
|
-
prototype = Polymer.Base.chainObject(prototype, base);
|
73
|
-
prototype.registerCallback();
|
74
|
-
return prototype.constructor;
|
75
|
-
};
|
76
|
-
window.Polymer = Polymer;
|
77
|
-
if (userPolymer) {
|
78
|
-
for (var i in userPolymer) {
|
79
|
-
Polymer[i] = userPolymer[i];
|
80
|
-
}
|
81
|
-
}
|
82
|
-
Polymer.Class = desugar;
|
83
|
-
}());
|
84
|
-
Polymer.telemetry = {
|
85
|
-
registrations: [],
|
86
|
-
_regLog: function (prototype) {
|
87
|
-
console.log('[' + prototype.is + ']: registered');
|
88
|
-
},
|
89
|
-
_registrate: function (prototype) {
|
90
|
-
this.registrations.push(prototype);
|
91
|
-
Polymer.log && this._regLog(prototype);
|
92
|
-
},
|
93
|
-
dumpRegistrations: function () {
|
94
|
-
this.registrations.forEach(this._regLog);
|
95
|
-
}
|
96
|
-
};
|
97
|
-
Object.defineProperty(window, 'currentImport', {
|
98
|
-
enumerable: true,
|
99
|
-
configurable: true,
|
100
|
-
get: function () {
|
101
|
-
return (document._currentScript || document.currentScript).ownerDocument;
|
102
|
-
}
|
103
|
-
});
|
104
|
-
Polymer.RenderStatus = {
|
105
|
-
_ready: false,
|
106
|
-
_callbacks: [],
|
107
|
-
whenReady: function (cb) {
|
108
|
-
if (this._ready) {
|
109
|
-
cb();
|
110
|
-
} else {
|
111
|
-
this._callbacks.push(cb);
|
112
|
-
}
|
113
|
-
},
|
114
|
-
_makeReady: function () {
|
115
|
-
this._ready = true;
|
116
|
-
this._callbacks.forEach(function (cb) {
|
117
|
-
cb();
|
118
|
-
});
|
119
|
-
this._callbacks = [];
|
120
|
-
},
|
121
|
-
_catchFirstRender: function () {
|
122
|
-
requestAnimationFrame(function () {
|
123
|
-
Polymer.RenderStatus._makeReady();
|
124
|
-
});
|
125
|
-
}
|
126
|
-
};
|
127
|
-
if (window.HTMLImports) {
|
128
|
-
HTMLImports.whenReady(function () {
|
129
|
-
Polymer.RenderStatus._catchFirstRender();
|
130
|
-
});
|
131
|
-
} else {
|
132
|
-
Polymer.RenderStatus._catchFirstRender();
|
133
|
-
}
|
134
|
-
Polymer.ImportStatus = Polymer.RenderStatus;
|
135
|
-
Polymer.ImportStatus.whenLoaded = Polymer.ImportStatus.whenReady;
|
136
|
-
Polymer.Base = {
|
137
|
-
__isPolymerInstance__: true,
|
138
|
-
_addFeature: function (feature) {
|
139
|
-
this.extend(this, feature);
|
140
|
-
},
|
141
|
-
registerCallback: function () {
|
142
|
-
this._desugarBehaviors();
|
143
|
-
this._doBehavior('beforeRegister');
|
144
|
-
this._registerFeatures();
|
145
|
-
this._doBehavior('registered');
|
146
|
-
},
|
147
|
-
createdCallback: function () {
|
148
|
-
Polymer.telemetry.instanceCount++;
|
149
|
-
this.root = this;
|
150
|
-
this._doBehavior('created');
|
151
|
-
this._initFeatures();
|
152
|
-
},
|
153
|
-
attachedCallback: function () {
|
154
|
-
Polymer.RenderStatus.whenReady(function () {
|
155
|
-
this.isAttached = true;
|
156
|
-
this._doBehavior('attached');
|
157
|
-
}.bind(this));
|
158
|
-
},
|
159
|
-
detachedCallback: function () {
|
160
|
-
this.isAttached = false;
|
161
|
-
this._doBehavior('detached');
|
162
|
-
},
|
163
|
-
attributeChangedCallback: function (name) {
|
164
|
-
this._attributeChangedImpl(name);
|
165
|
-
this._doBehavior('attributeChanged', arguments);
|
166
|
-
},
|
167
|
-
_attributeChangedImpl: function (name) {
|
168
|
-
this._setAttributeToProperty(this, name);
|
169
|
-
},
|
170
|
-
extend: function (prototype, api) {
|
171
|
-
if (prototype && api) {
|
172
|
-
Object.getOwnPropertyNames(api).forEach(function (n) {
|
173
|
-
this.copyOwnProperty(n, api, prototype);
|
174
|
-
}, this);
|
175
|
-
}
|
176
|
-
return prototype || api;
|
177
|
-
},
|
178
|
-
mixin: function (target, source) {
|
179
|
-
for (var i in source) {
|
180
|
-
target[i] = source[i];
|
181
|
-
}
|
182
|
-
return target;
|
183
|
-
},
|
184
|
-
copyOwnProperty: function (name, source, target) {
|
185
|
-
var pd = Object.getOwnPropertyDescriptor(source, name);
|
186
|
-
if (pd) {
|
187
|
-
Object.defineProperty(target, name, pd);
|
188
|
-
}
|
189
|
-
},
|
190
|
-
_log: console.log.apply.bind(console.log, console),
|
191
|
-
_warn: console.warn.apply.bind(console.warn, console),
|
192
|
-
_error: console.error.apply.bind(console.error, console),
|
193
|
-
_logf: function () {
|
194
|
-
return this._logPrefix.concat([this.is]).concat(Array.prototype.slice.call(arguments, 0));
|
195
|
-
}
|
196
|
-
};
|
197
|
-
Polymer.Base._logPrefix = function () {
|
198
|
-
var color = window.chrome || /firefox/i.test(navigator.userAgent);
|
199
|
-
return color ? [
|
200
|
-
'%c[%s::%s]:',
|
201
|
-
'font-weight: bold; background-color:#EEEE00;'
|
202
|
-
] : ['[%s::%s]:'];
|
203
|
-
}();
|
204
|
-
Polymer.Base.chainObject = function (object, inherited) {
|
205
|
-
if (object && inherited && object !== inherited) {
|
206
|
-
if (!Object.__proto__) {
|
207
|
-
object = Polymer.Base.extend(Object.create(inherited), object);
|
208
|
-
}
|
209
|
-
object.__proto__ = inherited;
|
210
|
-
}
|
211
|
-
return object;
|
212
|
-
};
|
213
|
-
Polymer.Base = Polymer.Base.chainObject(Polymer.Base, HTMLElement.prototype);
|
214
|
-
if (window.CustomElements) {
|
215
|
-
Polymer.instanceof = CustomElements.instanceof;
|
216
|
-
} else {
|
217
|
-
Polymer.instanceof = function (obj, ctor) {
|
218
|
-
return obj instanceof ctor;
|
219
|
-
};
|
220
|
-
}
|
221
|
-
Polymer.isInstance = function (obj) {
|
222
|
-
return Boolean(obj && obj.__isPolymerInstance__);
|
223
|
-
};
|
224
|
-
Polymer.telemetry.instanceCount = 0;
|
225
|
-
(function () {
|
226
|
-
var modules = {};
|
227
|
-
var lcModules = {};
|
228
|
-
var findModule = function (id) {
|
229
|
-
return modules[id] || lcModules[id.toLowerCase()];
|
230
|
-
};
|
231
|
-
var DomModule = function () {
|
232
|
-
return document.createElement('dom-module');
|
233
|
-
};
|
234
|
-
DomModule.prototype = Object.create(HTMLElement.prototype);
|
235
|
-
Polymer.Base.extend(DomModule.prototype, {
|
236
|
-
constructor: DomModule,
|
237
|
-
createdCallback: function () {
|
238
|
-
this.register();
|
239
|
-
},
|
240
|
-
register: function (id) {
|
241
|
-
var id = id || this.id || this.getAttribute('name') || this.getAttribute('is');
|
242
|
-
if (id) {
|
243
|
-
this.id = id;
|
244
|
-
modules[id] = this;
|
245
|
-
lcModules[id.toLowerCase()] = this;
|
246
|
-
}
|
247
|
-
},
|
248
|
-
import: function (id, selector) {
|
249
|
-
if (id) {
|
250
|
-
var m = findModule(id);
|
251
|
-
if (!m) {
|
252
|
-
forceDocumentUpgrade();
|
253
|
-
m = findModule(id);
|
254
|
-
}
|
255
|
-
if (m && selector) {
|
256
|
-
m = m.querySelector(selector);
|
257
|
-
}
|
258
|
-
return m;
|
259
|
-
}
|
260
|
-
}
|
261
|
-
});
|
262
|
-
var cePolyfill = window.CustomElements && !CustomElements.useNative;
|
263
|
-
document.registerElement('dom-module', DomModule);
|
264
|
-
function forceDocumentUpgrade() {
|
265
|
-
if (cePolyfill) {
|
266
|
-
var script = document._currentScript || document.currentScript;
|
267
|
-
var doc = script && script.ownerDocument;
|
268
|
-
if (doc) {
|
269
|
-
CustomElements.upgradeAll(doc);
|
270
|
-
}
|
271
|
-
}
|
272
|
-
}
|
273
|
-
}());
|
274
|
-
Polymer.Base._addFeature({
|
275
|
-
_prepIs: function () {
|
276
|
-
if (!this.is) {
|
277
|
-
var module = (document._currentScript || document.currentScript).parentNode;
|
278
|
-
if (module.localName === 'dom-module') {
|
279
|
-
var id = module.id || module.getAttribute('name') || module.getAttribute('is');
|
280
|
-
this.is = id;
|
281
|
-
}
|
282
|
-
}
|
283
|
-
if (this.is) {
|
284
|
-
this.is = this.is.toLowerCase();
|
285
|
-
}
|
286
|
-
}
|
287
|
-
});
|
288
|
-
Polymer.Base._addFeature({
|
289
|
-
behaviors: [],
|
290
|
-
_desugarBehaviors: function () {
|
291
|
-
if (this.behaviors.length) {
|
292
|
-
this.behaviors = this._desugarSomeBehaviors(this.behaviors);
|
293
|
-
}
|
294
|
-
},
|
295
|
-
_desugarSomeBehaviors: function (behaviors) {
|
296
|
-
behaviors = this._flattenBehaviorsList(behaviors);
|
297
|
-
for (var i = behaviors.length - 1; i >= 0; i--) {
|
298
|
-
this._mixinBehavior(behaviors[i]);
|
299
|
-
}
|
300
|
-
return behaviors;
|
301
|
-
},
|
302
|
-
_flattenBehaviorsList: function (behaviors) {
|
303
|
-
var flat = [];
|
304
|
-
behaviors.forEach(function (b) {
|
305
|
-
if (b instanceof Array) {
|
306
|
-
flat = flat.concat(this._flattenBehaviorsList(b));
|
307
|
-
} else if (b) {
|
308
|
-
flat.push(b);
|
309
|
-
} else {
|
310
|
-
this._warn(this._logf('_flattenBehaviorsList', 'behavior is null, check for missing or 404 import'));
|
311
|
-
}
|
312
|
-
}, this);
|
313
|
-
return flat;
|
314
|
-
},
|
315
|
-
_mixinBehavior: function (b) {
|
316
|
-
Object.getOwnPropertyNames(b).forEach(function (n) {
|
317
|
-
switch (n) {
|
318
|
-
case 'hostAttributes':
|
319
|
-
case 'registered':
|
320
|
-
case 'properties':
|
321
|
-
case 'observers':
|
322
|
-
case 'listeners':
|
323
|
-
case 'created':
|
324
|
-
case 'attached':
|
325
|
-
case 'detached':
|
326
|
-
case 'attributeChanged':
|
327
|
-
case 'configure':
|
328
|
-
case 'ready':
|
329
|
-
break;
|
330
|
-
default:
|
331
|
-
if (!this.hasOwnProperty(n)) {
|
332
|
-
this.copyOwnProperty(n, b, this);
|
333
|
-
}
|
334
|
-
break;
|
335
|
-
}
|
336
|
-
}, this);
|
337
|
-
},
|
338
|
-
_prepBehaviors: function () {
|
339
|
-
this._prepFlattenedBehaviors(this.behaviors);
|
340
|
-
},
|
341
|
-
_prepFlattenedBehaviors: function (behaviors) {
|
342
|
-
for (var i = 0, l = behaviors.length; i < l; i++) {
|
343
|
-
this._prepBehavior(behaviors[i]);
|
344
|
-
}
|
345
|
-
this._prepBehavior(this);
|
346
|
-
},
|
347
|
-
_doBehavior: function (name, args) {
|
348
|
-
this.behaviors.forEach(function (b) {
|
349
|
-
this._invokeBehavior(b, name, args);
|
350
|
-
}, this);
|
351
|
-
this._invokeBehavior(this, name, args);
|
352
|
-
},
|
353
|
-
_invokeBehavior: function (b, name, args) {
|
354
|
-
var fn = b[name];
|
355
|
-
if (fn) {
|
356
|
-
fn.apply(this, args || Polymer.nar);
|
357
|
-
}
|
358
|
-
},
|
359
|
-
_marshalBehaviors: function () {
|
360
|
-
this.behaviors.forEach(function (b) {
|
361
|
-
this._marshalBehavior(b);
|
362
|
-
}, this);
|
363
|
-
this._marshalBehavior(this);
|
364
|
-
}
|
365
|
-
});
|
366
|
-
Polymer.Base._addFeature({
|
367
|
-
_getExtendedPrototype: function (tag) {
|
368
|
-
return this._getExtendedNativePrototype(tag);
|
369
|
-
},
|
370
|
-
_nativePrototypes: {},
|
371
|
-
_getExtendedNativePrototype: function (tag) {
|
372
|
-
var p = this._nativePrototypes[tag];
|
373
|
-
if (!p) {
|
374
|
-
var np = this.getNativePrototype(tag);
|
375
|
-
p = this.extend(Object.create(np), Polymer.Base);
|
376
|
-
this._nativePrototypes[tag] = p;
|
377
|
-
}
|
378
|
-
return p;
|
379
|
-
},
|
380
|
-
getNativePrototype: function (tag) {
|
381
|
-
return Object.getPrototypeOf(document.createElement(tag));
|
382
|
-
}
|
383
|
-
});
|
384
|
-
Polymer.Base._addFeature({
|
385
|
-
_prepConstructor: function () {
|
386
|
-
this._factoryArgs = this.extends ? [
|
387
|
-
this.extends,
|
388
|
-
this.is
|
389
|
-
] : [this.is];
|
390
|
-
var ctor = function () {
|
391
|
-
return this._factory(arguments);
|
392
|
-
};
|
393
|
-
if (this.hasOwnProperty('extends')) {
|
394
|
-
ctor.extends = this.extends;
|
395
|
-
}
|
396
|
-
Object.defineProperty(this, 'constructor', {
|
397
|
-
value: ctor,
|
398
|
-
writable: true,
|
399
|
-
configurable: true
|
400
|
-
});
|
401
|
-
ctor.prototype = this;
|
402
|
-
},
|
403
|
-
_factory: function (args) {
|
404
|
-
var elt = document.createElement.apply(document, this._factoryArgs);
|
405
|
-
if (this.factoryImpl) {
|
406
|
-
this.factoryImpl.apply(elt, args);
|
407
|
-
}
|
408
|
-
return elt;
|
409
|
-
}
|
410
|
-
});
|
411
|
-
Polymer.nob = Object.create(null);
|
412
|
-
Polymer.Base._addFeature({
|
413
|
-
properties: {},
|
414
|
-
getPropertyInfo: function (property) {
|
415
|
-
var info = this._getPropertyInfo(property, this.properties);
|
416
|
-
if (!info) {
|
417
|
-
this.behaviors.some(function (b) {
|
418
|
-
return info = this._getPropertyInfo(property, b.properties);
|
419
|
-
}, this);
|
420
|
-
}
|
421
|
-
return info || Polymer.nob;
|
422
|
-
},
|
423
|
-
_getPropertyInfo: function (property, properties) {
|
424
|
-
var p = properties && properties[property];
|
425
|
-
if (typeof p === 'function') {
|
426
|
-
p = properties[property] = { type: p };
|
427
|
-
}
|
428
|
-
if (p) {
|
429
|
-
p.defined = true;
|
430
|
-
}
|
431
|
-
return p;
|
432
|
-
}
|
433
|
-
});
|
434
|
-
Polymer.CaseMap = {
|
435
|
-
_caseMap: {},
|
436
|
-
dashToCamelCase: function (dash) {
|
437
|
-
var mapped = Polymer.CaseMap._caseMap[dash];
|
438
|
-
if (mapped) {
|
439
|
-
return mapped;
|
440
|
-
}
|
441
|
-
if (dash.indexOf('-') < 0) {
|
442
|
-
return Polymer.CaseMap._caseMap[dash] = dash;
|
443
|
-
}
|
444
|
-
return Polymer.CaseMap._caseMap[dash] = dash.replace(/-([a-z])/g, function (m) {
|
445
|
-
return m[1].toUpperCase();
|
446
|
-
});
|
447
|
-
},
|
448
|
-
camelToDashCase: function (camel) {
|
449
|
-
var mapped = Polymer.CaseMap._caseMap[camel];
|
450
|
-
if (mapped) {
|
451
|
-
return mapped;
|
452
|
-
}
|
453
|
-
return Polymer.CaseMap._caseMap[camel] = camel.replace(/([a-z][A-Z])/g, function (g) {
|
454
|
-
return g[0] + '-' + g[1].toLowerCase();
|
455
|
-
});
|
456
|
-
}
|
457
|
-
};
|
458
|
-
Polymer.Base._addFeature({
|
459
|
-
_prepAttributes: function () {
|
460
|
-
this._aggregatedAttributes = {};
|
461
|
-
},
|
462
|
-
_addHostAttributes: function (attributes) {
|
463
|
-
if (attributes) {
|
464
|
-
this.mixin(this._aggregatedAttributes, attributes);
|
465
|
-
}
|
466
|
-
},
|
467
|
-
_marshalHostAttributes: function () {
|
468
|
-
this._applyAttributes(this, this._aggregatedAttributes);
|
469
|
-
},
|
470
|
-
_applyAttributes: function (node, attr$) {
|
471
|
-
for (var n in attr$) {
|
472
|
-
if (!this.hasAttribute(n) && n !== 'class') {
|
473
|
-
this.serializeValueToAttribute(attr$[n], n, this);
|
474
|
-
}
|
475
|
-
}
|
476
|
-
},
|
477
|
-
_marshalAttributes: function () {
|
478
|
-
this._takeAttributesToModel(this);
|
479
|
-
},
|
480
|
-
_takeAttributesToModel: function (model) {
|
481
|
-
for (var i = 0, l = this.attributes.length; i < l; i++) {
|
482
|
-
this._setAttributeToProperty(model, this.attributes[i].name);
|
483
|
-
}
|
484
|
-
},
|
485
|
-
_setAttributeToProperty: function (model, attrName) {
|
486
|
-
if (!this._serializing) {
|
487
|
-
var propName = Polymer.CaseMap.dashToCamelCase(attrName);
|
488
|
-
var info = this.getPropertyInfo(propName);
|
489
|
-
if (info.defined || this._propertyEffects && this._propertyEffects[propName]) {
|
490
|
-
var val = this.getAttribute(attrName);
|
491
|
-
model[propName] = this.deserialize(val, info.type);
|
492
|
-
}
|
493
|
-
}
|
494
|
-
},
|
495
|
-
_serializing: false,
|
496
|
-
reflectPropertyToAttribute: function (name) {
|
497
|
-
this._serializing = true;
|
498
|
-
this.serializeValueToAttribute(this[name], Polymer.CaseMap.camelToDashCase(name));
|
499
|
-
this._serializing = false;
|
500
|
-
},
|
501
|
-
serializeValueToAttribute: function (value, attribute, node) {
|
502
|
-
var str = this.serialize(value);
|
503
|
-
(node || this)[str === undefined ? 'removeAttribute' : 'setAttribute'](attribute, str);
|
504
|
-
},
|
505
|
-
deserialize: function (value, type) {
|
506
|
-
switch (type) {
|
507
|
-
case Number:
|
508
|
-
value = Number(value);
|
509
|
-
break;
|
510
|
-
case Boolean:
|
511
|
-
value = value !== null;
|
512
|
-
break;
|
513
|
-
case Object:
|
514
|
-
try {
|
515
|
-
value = JSON.parse(value);
|
516
|
-
} catch (x) {
|
517
|
-
}
|
518
|
-
break;
|
519
|
-
case Array:
|
520
|
-
try {
|
521
|
-
value = JSON.parse(value);
|
522
|
-
} catch (x) {
|
523
|
-
value = null;
|
524
|
-
console.warn('Polymer::Attributes: couldn`t decode Array as JSON');
|
525
|
-
}
|
526
|
-
break;
|
527
|
-
case Date:
|
528
|
-
value = new Date(value);
|
529
|
-
break;
|
530
|
-
case String:
|
531
|
-
default:
|
532
|
-
break;
|
533
|
-
}
|
534
|
-
return value;
|
535
|
-
},
|
536
|
-
serialize: function (value) {
|
537
|
-
switch (typeof value) {
|
538
|
-
case 'boolean':
|
539
|
-
return value ? '' : undefined;
|
540
|
-
case 'object':
|
541
|
-
if (value instanceof Date) {
|
542
|
-
return value;
|
543
|
-
} else if (value) {
|
544
|
-
try {
|
545
|
-
return JSON.stringify(value);
|
546
|
-
} catch (x) {
|
547
|
-
return '';
|
548
|
-
}
|
549
|
-
}
|
550
|
-
default:
|
551
|
-
return value != null ? value : undefined;
|
552
|
-
}
|
553
|
-
}
|
554
|
-
});
|
555
|
-
Polymer.Base._addFeature({
|
556
|
-
_setupDebouncers: function () {
|
557
|
-
this._debouncers = {};
|
558
|
-
},
|
559
|
-
debounce: function (jobName, callback, wait) {
|
560
|
-
return this._debouncers[jobName] = Polymer.Debounce.call(this, this._debouncers[jobName], callback, wait);
|
561
|
-
},
|
562
|
-
isDebouncerActive: function (jobName) {
|
563
|
-
var debouncer = this._debouncers[jobName];
|
564
|
-
return debouncer && debouncer.finish;
|
565
|
-
},
|
566
|
-
flushDebouncer: function (jobName) {
|
567
|
-
var debouncer = this._debouncers[jobName];
|
568
|
-
if (debouncer) {
|
569
|
-
debouncer.complete();
|
570
|
-
}
|
571
|
-
},
|
572
|
-
cancelDebouncer: function (jobName) {
|
573
|
-
var debouncer = this._debouncers[jobName];
|
574
|
-
if (debouncer) {
|
575
|
-
debouncer.stop();
|
576
|
-
}
|
577
|
-
}
|
578
|
-
});
|
579
|
-
Polymer.version = '1.
|
580
|
-
Polymer.Base._addFeature({
|
581
|
-
_registerFeatures: function () {
|
582
|
-
this._prepIs();
|
583
|
-
this._prepAttributes();
|
584
|
-
this._prepBehaviors();
|
585
|
-
this._prepConstructor();
|
586
|
-
},
|
587
|
-
_prepBehavior: function (b) {
|
588
|
-
this._addHostAttributes(b.hostAttributes);
|
589
|
-
},
|
590
|
-
_marshalBehavior: function (b) {
|
591
|
-
},
|
592
|
-
_initFeatures: function () {
|
593
|
-
this._marshalHostAttributes();
|
594
|
-
this._setupDebouncers();
|
595
|
-
this._marshalBehaviors();
|
596
|
-
}
|
597
|
-
});</script>
|
1
|
+
<!--
|
2
|
+
@license
|
3
|
+
Copyright (c) 2014 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
|
+
--><script>(function () {
|
10
|
+
function resolve() {
|
11
|
+
document.body.removeAttribute('unresolved');
|
12
|
+
}
|
13
|
+
if (window.WebComponents) {
|
14
|
+
addEventListener('WebComponentsReady', resolve);
|
15
|
+
} else {
|
16
|
+
if (document.readyState === 'interactive' || document.readyState === 'complete') {
|
17
|
+
resolve();
|
18
|
+
} else {
|
19
|
+
addEventListener('DOMContentLoaded', resolve);
|
20
|
+
}
|
21
|
+
}
|
22
|
+
}());
|
23
|
+
window.Polymer = {
|
24
|
+
Settings: function () {
|
25
|
+
var user = window.Polymer || {};
|
26
|
+
location.search.slice(1).split('&').forEach(function (o) {
|
27
|
+
o = o.split('=');
|
28
|
+
o[0] && (user[o[0]] = o[1] || true);
|
29
|
+
});
|
30
|
+
var wantShadow = user.dom === 'shadow';
|
31
|
+
var hasShadow = Boolean(Element.prototype.createShadowRoot);
|
32
|
+
var nativeShadow = hasShadow && !window.ShadowDOMPolyfill;
|
33
|
+
var useShadow = wantShadow && hasShadow;
|
34
|
+
var hasNativeImports = Boolean('import' in document.createElement('link'));
|
35
|
+
var useNativeImports = hasNativeImports;
|
36
|
+
var useNativeCustomElements = !window.CustomElements || window.CustomElements.useNative;
|
37
|
+
return {
|
38
|
+
wantShadow: wantShadow,
|
39
|
+
hasShadow: hasShadow,
|
40
|
+
nativeShadow: nativeShadow,
|
41
|
+
useShadow: useShadow,
|
42
|
+
useNativeShadow: useShadow && nativeShadow,
|
43
|
+
useNativeImports: useNativeImports,
|
44
|
+
useNativeCustomElements: useNativeCustomElements
|
45
|
+
};
|
46
|
+
}()
|
47
|
+
};
|
48
|
+
(function () {
|
49
|
+
var userPolymer = window.Polymer;
|
50
|
+
window.Polymer = function (prototype) {
|
51
|
+
if (typeof prototype === 'function') {
|
52
|
+
prototype = prototype.prototype;
|
53
|
+
}
|
54
|
+
if (!prototype) {
|
55
|
+
prototype = {};
|
56
|
+
}
|
57
|
+
var factory = desugar(prototype);
|
58
|
+
prototype = factory.prototype;
|
59
|
+
var options = { prototype: prototype };
|
60
|
+
if (prototype.extends) {
|
61
|
+
options.extends = prototype.extends;
|
62
|
+
}
|
63
|
+
Polymer.telemetry._registrate(prototype);
|
64
|
+
document.registerElement(prototype.is, options);
|
65
|
+
return factory;
|
66
|
+
};
|
67
|
+
var desugar = function (prototype) {
|
68
|
+
var base = Polymer.Base;
|
69
|
+
if (prototype.extends) {
|
70
|
+
base = Polymer.Base._getExtendedPrototype(prototype.extends);
|
71
|
+
}
|
72
|
+
prototype = Polymer.Base.chainObject(prototype, base);
|
73
|
+
prototype.registerCallback();
|
74
|
+
return prototype.constructor;
|
75
|
+
};
|
76
|
+
window.Polymer = Polymer;
|
77
|
+
if (userPolymer) {
|
78
|
+
for (var i in userPolymer) {
|
79
|
+
Polymer[i] = userPolymer[i];
|
80
|
+
}
|
81
|
+
}
|
82
|
+
Polymer.Class = desugar;
|
83
|
+
}());
|
84
|
+
Polymer.telemetry = {
|
85
|
+
registrations: [],
|
86
|
+
_regLog: function (prototype) {
|
87
|
+
console.log('[' + prototype.is + ']: registered');
|
88
|
+
},
|
89
|
+
_registrate: function (prototype) {
|
90
|
+
this.registrations.push(prototype);
|
91
|
+
Polymer.log && this._regLog(prototype);
|
92
|
+
},
|
93
|
+
dumpRegistrations: function () {
|
94
|
+
this.registrations.forEach(this._regLog);
|
95
|
+
}
|
96
|
+
};
|
97
|
+
Object.defineProperty(window, 'currentImport', {
|
98
|
+
enumerable: true,
|
99
|
+
configurable: true,
|
100
|
+
get: function () {
|
101
|
+
return (document._currentScript || document.currentScript).ownerDocument;
|
102
|
+
}
|
103
|
+
});
|
104
|
+
Polymer.RenderStatus = {
|
105
|
+
_ready: false,
|
106
|
+
_callbacks: [],
|
107
|
+
whenReady: function (cb) {
|
108
|
+
if (this._ready) {
|
109
|
+
cb();
|
110
|
+
} else {
|
111
|
+
this._callbacks.push(cb);
|
112
|
+
}
|
113
|
+
},
|
114
|
+
_makeReady: function () {
|
115
|
+
this._ready = true;
|
116
|
+
this._callbacks.forEach(function (cb) {
|
117
|
+
cb();
|
118
|
+
});
|
119
|
+
this._callbacks = [];
|
120
|
+
},
|
121
|
+
_catchFirstRender: function () {
|
122
|
+
requestAnimationFrame(function () {
|
123
|
+
Polymer.RenderStatus._makeReady();
|
124
|
+
});
|
125
|
+
}
|
126
|
+
};
|
127
|
+
if (window.HTMLImports) {
|
128
|
+
HTMLImports.whenReady(function () {
|
129
|
+
Polymer.RenderStatus._catchFirstRender();
|
130
|
+
});
|
131
|
+
} else {
|
132
|
+
Polymer.RenderStatus._catchFirstRender();
|
133
|
+
}
|
134
|
+
Polymer.ImportStatus = Polymer.RenderStatus;
|
135
|
+
Polymer.ImportStatus.whenLoaded = Polymer.ImportStatus.whenReady;
|
136
|
+
Polymer.Base = {
|
137
|
+
__isPolymerInstance__: true,
|
138
|
+
_addFeature: function (feature) {
|
139
|
+
this.extend(this, feature);
|
140
|
+
},
|
141
|
+
registerCallback: function () {
|
142
|
+
this._desugarBehaviors();
|
143
|
+
this._doBehavior('beforeRegister');
|
144
|
+
this._registerFeatures();
|
145
|
+
this._doBehavior('registered');
|
146
|
+
},
|
147
|
+
createdCallback: function () {
|
148
|
+
Polymer.telemetry.instanceCount++;
|
149
|
+
this.root = this;
|
150
|
+
this._doBehavior('created');
|
151
|
+
this._initFeatures();
|
152
|
+
},
|
153
|
+
attachedCallback: function () {
|
154
|
+
Polymer.RenderStatus.whenReady(function () {
|
155
|
+
this.isAttached = true;
|
156
|
+
this._doBehavior('attached');
|
157
|
+
}.bind(this));
|
158
|
+
},
|
159
|
+
detachedCallback: function () {
|
160
|
+
this.isAttached = false;
|
161
|
+
this._doBehavior('detached');
|
162
|
+
},
|
163
|
+
attributeChangedCallback: function (name) {
|
164
|
+
this._attributeChangedImpl(name);
|
165
|
+
this._doBehavior('attributeChanged', arguments);
|
166
|
+
},
|
167
|
+
_attributeChangedImpl: function (name) {
|
168
|
+
this._setAttributeToProperty(this, name);
|
169
|
+
},
|
170
|
+
extend: function (prototype, api) {
|
171
|
+
if (prototype && api) {
|
172
|
+
Object.getOwnPropertyNames(api).forEach(function (n) {
|
173
|
+
this.copyOwnProperty(n, api, prototype);
|
174
|
+
}, this);
|
175
|
+
}
|
176
|
+
return prototype || api;
|
177
|
+
},
|
178
|
+
mixin: function (target, source) {
|
179
|
+
for (var i in source) {
|
180
|
+
target[i] = source[i];
|
181
|
+
}
|
182
|
+
return target;
|
183
|
+
},
|
184
|
+
copyOwnProperty: function (name, source, target) {
|
185
|
+
var pd = Object.getOwnPropertyDescriptor(source, name);
|
186
|
+
if (pd) {
|
187
|
+
Object.defineProperty(target, name, pd);
|
188
|
+
}
|
189
|
+
},
|
190
|
+
_log: console.log.apply.bind(console.log, console),
|
191
|
+
_warn: console.warn.apply.bind(console.warn, console),
|
192
|
+
_error: console.error.apply.bind(console.error, console),
|
193
|
+
_logf: function () {
|
194
|
+
return this._logPrefix.concat([this.is]).concat(Array.prototype.slice.call(arguments, 0));
|
195
|
+
}
|
196
|
+
};
|
197
|
+
Polymer.Base._logPrefix = function () {
|
198
|
+
var color = window.chrome || /firefox/i.test(navigator.userAgent);
|
199
|
+
return color ? [
|
200
|
+
'%c[%s::%s]:',
|
201
|
+
'font-weight: bold; background-color:#EEEE00;'
|
202
|
+
] : ['[%s::%s]:'];
|
203
|
+
}();
|
204
|
+
Polymer.Base.chainObject = function (object, inherited) {
|
205
|
+
if (object && inherited && object !== inherited) {
|
206
|
+
if (!Object.__proto__) {
|
207
|
+
object = Polymer.Base.extend(Object.create(inherited), object);
|
208
|
+
}
|
209
|
+
object.__proto__ = inherited;
|
210
|
+
}
|
211
|
+
return object;
|
212
|
+
};
|
213
|
+
Polymer.Base = Polymer.Base.chainObject(Polymer.Base, HTMLElement.prototype);
|
214
|
+
if (window.CustomElements) {
|
215
|
+
Polymer.instanceof = CustomElements.instanceof;
|
216
|
+
} else {
|
217
|
+
Polymer.instanceof = function (obj, ctor) {
|
218
|
+
return obj instanceof ctor;
|
219
|
+
};
|
220
|
+
}
|
221
|
+
Polymer.isInstance = function (obj) {
|
222
|
+
return Boolean(obj && obj.__isPolymerInstance__);
|
223
|
+
};
|
224
|
+
Polymer.telemetry.instanceCount = 0;
|
225
|
+
(function () {
|
226
|
+
var modules = {};
|
227
|
+
var lcModules = {};
|
228
|
+
var findModule = function (id) {
|
229
|
+
return modules[id] || lcModules[id.toLowerCase()];
|
230
|
+
};
|
231
|
+
var DomModule = function () {
|
232
|
+
return document.createElement('dom-module');
|
233
|
+
};
|
234
|
+
DomModule.prototype = Object.create(HTMLElement.prototype);
|
235
|
+
Polymer.Base.extend(DomModule.prototype, {
|
236
|
+
constructor: DomModule,
|
237
|
+
createdCallback: function () {
|
238
|
+
this.register();
|
239
|
+
},
|
240
|
+
register: function (id) {
|
241
|
+
var id = id || this.id || this.getAttribute('name') || this.getAttribute('is');
|
242
|
+
if (id) {
|
243
|
+
this.id = id;
|
244
|
+
modules[id] = this;
|
245
|
+
lcModules[id.toLowerCase()] = this;
|
246
|
+
}
|
247
|
+
},
|
248
|
+
import: function (id, selector) {
|
249
|
+
if (id) {
|
250
|
+
var m = findModule(id);
|
251
|
+
if (!m) {
|
252
|
+
forceDocumentUpgrade();
|
253
|
+
m = findModule(id);
|
254
|
+
}
|
255
|
+
if (m && selector) {
|
256
|
+
m = m.querySelector(selector);
|
257
|
+
}
|
258
|
+
return m;
|
259
|
+
}
|
260
|
+
}
|
261
|
+
});
|
262
|
+
var cePolyfill = window.CustomElements && !CustomElements.useNative;
|
263
|
+
document.registerElement('dom-module', DomModule);
|
264
|
+
function forceDocumentUpgrade() {
|
265
|
+
if (cePolyfill) {
|
266
|
+
var script = document._currentScript || document.currentScript;
|
267
|
+
var doc = script && script.ownerDocument || document;
|
268
|
+
if (doc) {
|
269
|
+
CustomElements.upgradeAll(doc);
|
270
|
+
}
|
271
|
+
}
|
272
|
+
}
|
273
|
+
}());
|
274
|
+
Polymer.Base._addFeature({
|
275
|
+
_prepIs: function () {
|
276
|
+
if (!this.is) {
|
277
|
+
var module = (document._currentScript || document.currentScript).parentNode;
|
278
|
+
if (module.localName === 'dom-module') {
|
279
|
+
var id = module.id || module.getAttribute('name') || module.getAttribute('is');
|
280
|
+
this.is = id;
|
281
|
+
}
|
282
|
+
}
|
283
|
+
if (this.is) {
|
284
|
+
this.is = this.is.toLowerCase();
|
285
|
+
}
|
286
|
+
}
|
287
|
+
});
|
288
|
+
Polymer.Base._addFeature({
|
289
|
+
behaviors: [],
|
290
|
+
_desugarBehaviors: function () {
|
291
|
+
if (this.behaviors.length) {
|
292
|
+
this.behaviors = this._desugarSomeBehaviors(this.behaviors);
|
293
|
+
}
|
294
|
+
},
|
295
|
+
_desugarSomeBehaviors: function (behaviors) {
|
296
|
+
behaviors = this._flattenBehaviorsList(behaviors);
|
297
|
+
for (var i = behaviors.length - 1; i >= 0; i--) {
|
298
|
+
this._mixinBehavior(behaviors[i]);
|
299
|
+
}
|
300
|
+
return behaviors;
|
301
|
+
},
|
302
|
+
_flattenBehaviorsList: function (behaviors) {
|
303
|
+
var flat = [];
|
304
|
+
behaviors.forEach(function (b) {
|
305
|
+
if (b instanceof Array) {
|
306
|
+
flat = flat.concat(this._flattenBehaviorsList(b));
|
307
|
+
} else if (b) {
|
308
|
+
flat.push(b);
|
309
|
+
} else {
|
310
|
+
this._warn(this._logf('_flattenBehaviorsList', 'behavior is null, check for missing or 404 import'));
|
311
|
+
}
|
312
|
+
}, this);
|
313
|
+
return flat;
|
314
|
+
},
|
315
|
+
_mixinBehavior: function (b) {
|
316
|
+
Object.getOwnPropertyNames(b).forEach(function (n) {
|
317
|
+
switch (n) {
|
318
|
+
case 'hostAttributes':
|
319
|
+
case 'registered':
|
320
|
+
case 'properties':
|
321
|
+
case 'observers':
|
322
|
+
case 'listeners':
|
323
|
+
case 'created':
|
324
|
+
case 'attached':
|
325
|
+
case 'detached':
|
326
|
+
case 'attributeChanged':
|
327
|
+
case 'configure':
|
328
|
+
case 'ready':
|
329
|
+
break;
|
330
|
+
default:
|
331
|
+
if (!this.hasOwnProperty(n)) {
|
332
|
+
this.copyOwnProperty(n, b, this);
|
333
|
+
}
|
334
|
+
break;
|
335
|
+
}
|
336
|
+
}, this);
|
337
|
+
},
|
338
|
+
_prepBehaviors: function () {
|
339
|
+
this._prepFlattenedBehaviors(this.behaviors);
|
340
|
+
},
|
341
|
+
_prepFlattenedBehaviors: function (behaviors) {
|
342
|
+
for (var i = 0, l = behaviors.length; i < l; i++) {
|
343
|
+
this._prepBehavior(behaviors[i]);
|
344
|
+
}
|
345
|
+
this._prepBehavior(this);
|
346
|
+
},
|
347
|
+
_doBehavior: function (name, args) {
|
348
|
+
this.behaviors.forEach(function (b) {
|
349
|
+
this._invokeBehavior(b, name, args);
|
350
|
+
}, this);
|
351
|
+
this._invokeBehavior(this, name, args);
|
352
|
+
},
|
353
|
+
_invokeBehavior: function (b, name, args) {
|
354
|
+
var fn = b[name];
|
355
|
+
if (fn) {
|
356
|
+
fn.apply(this, args || Polymer.nar);
|
357
|
+
}
|
358
|
+
},
|
359
|
+
_marshalBehaviors: function () {
|
360
|
+
this.behaviors.forEach(function (b) {
|
361
|
+
this._marshalBehavior(b);
|
362
|
+
}, this);
|
363
|
+
this._marshalBehavior(this);
|
364
|
+
}
|
365
|
+
});
|
366
|
+
Polymer.Base._addFeature({
|
367
|
+
_getExtendedPrototype: function (tag) {
|
368
|
+
return this._getExtendedNativePrototype(tag);
|
369
|
+
},
|
370
|
+
_nativePrototypes: {},
|
371
|
+
_getExtendedNativePrototype: function (tag) {
|
372
|
+
var p = this._nativePrototypes[tag];
|
373
|
+
if (!p) {
|
374
|
+
var np = this.getNativePrototype(tag);
|
375
|
+
p = this.extend(Object.create(np), Polymer.Base);
|
376
|
+
this._nativePrototypes[tag] = p;
|
377
|
+
}
|
378
|
+
return p;
|
379
|
+
},
|
380
|
+
getNativePrototype: function (tag) {
|
381
|
+
return Object.getPrototypeOf(document.createElement(tag));
|
382
|
+
}
|
383
|
+
});
|
384
|
+
Polymer.Base._addFeature({
|
385
|
+
_prepConstructor: function () {
|
386
|
+
this._factoryArgs = this.extends ? [
|
387
|
+
this.extends,
|
388
|
+
this.is
|
389
|
+
] : [this.is];
|
390
|
+
var ctor = function () {
|
391
|
+
return this._factory(arguments);
|
392
|
+
};
|
393
|
+
if (this.hasOwnProperty('extends')) {
|
394
|
+
ctor.extends = this.extends;
|
395
|
+
}
|
396
|
+
Object.defineProperty(this, 'constructor', {
|
397
|
+
value: ctor,
|
398
|
+
writable: true,
|
399
|
+
configurable: true
|
400
|
+
});
|
401
|
+
ctor.prototype = this;
|
402
|
+
},
|
403
|
+
_factory: function (args) {
|
404
|
+
var elt = document.createElement.apply(document, this._factoryArgs);
|
405
|
+
if (this.factoryImpl) {
|
406
|
+
this.factoryImpl.apply(elt, args);
|
407
|
+
}
|
408
|
+
return elt;
|
409
|
+
}
|
410
|
+
});
|
411
|
+
Polymer.nob = Object.create(null);
|
412
|
+
Polymer.Base._addFeature({
|
413
|
+
properties: {},
|
414
|
+
getPropertyInfo: function (property) {
|
415
|
+
var info = this._getPropertyInfo(property, this.properties);
|
416
|
+
if (!info) {
|
417
|
+
this.behaviors.some(function (b) {
|
418
|
+
return info = this._getPropertyInfo(property, b.properties);
|
419
|
+
}, this);
|
420
|
+
}
|
421
|
+
return info || Polymer.nob;
|
422
|
+
},
|
423
|
+
_getPropertyInfo: function (property, properties) {
|
424
|
+
var p = properties && properties[property];
|
425
|
+
if (typeof p === 'function') {
|
426
|
+
p = properties[property] = { type: p };
|
427
|
+
}
|
428
|
+
if (p) {
|
429
|
+
p.defined = true;
|
430
|
+
}
|
431
|
+
return p;
|
432
|
+
}
|
433
|
+
});
|
434
|
+
Polymer.CaseMap = {
|
435
|
+
_caseMap: {},
|
436
|
+
dashToCamelCase: function (dash) {
|
437
|
+
var mapped = Polymer.CaseMap._caseMap[dash];
|
438
|
+
if (mapped) {
|
439
|
+
return mapped;
|
440
|
+
}
|
441
|
+
if (dash.indexOf('-') < 0) {
|
442
|
+
return Polymer.CaseMap._caseMap[dash] = dash;
|
443
|
+
}
|
444
|
+
return Polymer.CaseMap._caseMap[dash] = dash.replace(/-([a-z])/g, function (m) {
|
445
|
+
return m[1].toUpperCase();
|
446
|
+
});
|
447
|
+
},
|
448
|
+
camelToDashCase: function (camel) {
|
449
|
+
var mapped = Polymer.CaseMap._caseMap[camel];
|
450
|
+
if (mapped) {
|
451
|
+
return mapped;
|
452
|
+
}
|
453
|
+
return Polymer.CaseMap._caseMap[camel] = camel.replace(/([a-z][A-Z])/g, function (g) {
|
454
|
+
return g[0] + '-' + g[1].toLowerCase();
|
455
|
+
});
|
456
|
+
}
|
457
|
+
};
|
458
|
+
Polymer.Base._addFeature({
|
459
|
+
_prepAttributes: function () {
|
460
|
+
this._aggregatedAttributes = {};
|
461
|
+
},
|
462
|
+
_addHostAttributes: function (attributes) {
|
463
|
+
if (attributes) {
|
464
|
+
this.mixin(this._aggregatedAttributes, attributes);
|
465
|
+
}
|
466
|
+
},
|
467
|
+
_marshalHostAttributes: function () {
|
468
|
+
this._applyAttributes(this, this._aggregatedAttributes);
|
469
|
+
},
|
470
|
+
_applyAttributes: function (node, attr$) {
|
471
|
+
for (var n in attr$) {
|
472
|
+
if (!this.hasAttribute(n) && n !== 'class') {
|
473
|
+
this.serializeValueToAttribute(attr$[n], n, this);
|
474
|
+
}
|
475
|
+
}
|
476
|
+
},
|
477
|
+
_marshalAttributes: function () {
|
478
|
+
this._takeAttributesToModel(this);
|
479
|
+
},
|
480
|
+
_takeAttributesToModel: function (model) {
|
481
|
+
for (var i = 0, l = this.attributes.length; i < l; i++) {
|
482
|
+
this._setAttributeToProperty(model, this.attributes[i].name);
|
483
|
+
}
|
484
|
+
},
|
485
|
+
_setAttributeToProperty: function (model, attrName) {
|
486
|
+
if (!this._serializing) {
|
487
|
+
var propName = Polymer.CaseMap.dashToCamelCase(attrName);
|
488
|
+
var info = this.getPropertyInfo(propName);
|
489
|
+
if (info.defined || this._propertyEffects && this._propertyEffects[propName]) {
|
490
|
+
var val = this.getAttribute(attrName);
|
491
|
+
model[propName] = this.deserialize(val, info.type);
|
492
|
+
}
|
493
|
+
}
|
494
|
+
},
|
495
|
+
_serializing: false,
|
496
|
+
reflectPropertyToAttribute: function (name) {
|
497
|
+
this._serializing = true;
|
498
|
+
this.serializeValueToAttribute(this[name], Polymer.CaseMap.camelToDashCase(name));
|
499
|
+
this._serializing = false;
|
500
|
+
},
|
501
|
+
serializeValueToAttribute: function (value, attribute, node) {
|
502
|
+
var str = this.serialize(value);
|
503
|
+
(node || this)[str === undefined ? 'removeAttribute' : 'setAttribute'](attribute, str);
|
504
|
+
},
|
505
|
+
deserialize: function (value, type) {
|
506
|
+
switch (type) {
|
507
|
+
case Number:
|
508
|
+
value = Number(value);
|
509
|
+
break;
|
510
|
+
case Boolean:
|
511
|
+
value = value !== null;
|
512
|
+
break;
|
513
|
+
case Object:
|
514
|
+
try {
|
515
|
+
value = JSON.parse(value);
|
516
|
+
} catch (x) {
|
517
|
+
}
|
518
|
+
break;
|
519
|
+
case Array:
|
520
|
+
try {
|
521
|
+
value = JSON.parse(value);
|
522
|
+
} catch (x) {
|
523
|
+
value = null;
|
524
|
+
console.warn('Polymer::Attributes: couldn`t decode Array as JSON');
|
525
|
+
}
|
526
|
+
break;
|
527
|
+
case Date:
|
528
|
+
value = new Date(value);
|
529
|
+
break;
|
530
|
+
case String:
|
531
|
+
default:
|
532
|
+
break;
|
533
|
+
}
|
534
|
+
return value;
|
535
|
+
},
|
536
|
+
serialize: function (value) {
|
537
|
+
switch (typeof value) {
|
538
|
+
case 'boolean':
|
539
|
+
return value ? '' : undefined;
|
540
|
+
case 'object':
|
541
|
+
if (value instanceof Date) {
|
542
|
+
return value;
|
543
|
+
} else if (value) {
|
544
|
+
try {
|
545
|
+
return JSON.stringify(value);
|
546
|
+
} catch (x) {
|
547
|
+
return '';
|
548
|
+
}
|
549
|
+
}
|
550
|
+
default:
|
551
|
+
return value != null ? value : undefined;
|
552
|
+
}
|
553
|
+
}
|
554
|
+
});
|
555
|
+
Polymer.Base._addFeature({
|
556
|
+
_setupDebouncers: function () {
|
557
|
+
this._debouncers = {};
|
558
|
+
},
|
559
|
+
debounce: function (jobName, callback, wait) {
|
560
|
+
return this._debouncers[jobName] = Polymer.Debounce.call(this, this._debouncers[jobName], callback, wait);
|
561
|
+
},
|
562
|
+
isDebouncerActive: function (jobName) {
|
563
|
+
var debouncer = this._debouncers[jobName];
|
564
|
+
return debouncer && debouncer.finish;
|
565
|
+
},
|
566
|
+
flushDebouncer: function (jobName) {
|
567
|
+
var debouncer = this._debouncers[jobName];
|
568
|
+
if (debouncer) {
|
569
|
+
debouncer.complete();
|
570
|
+
}
|
571
|
+
},
|
572
|
+
cancelDebouncer: function (jobName) {
|
573
|
+
var debouncer = this._debouncers[jobName];
|
574
|
+
if (debouncer) {
|
575
|
+
debouncer.stop();
|
576
|
+
}
|
577
|
+
}
|
578
|
+
});
|
579
|
+
Polymer.version = '1.2.0';
|
580
|
+
Polymer.Base._addFeature({
|
581
|
+
_registerFeatures: function () {
|
582
|
+
this._prepIs();
|
583
|
+
this._prepAttributes();
|
584
|
+
this._prepBehaviors();
|
585
|
+
this._prepConstructor();
|
586
|
+
},
|
587
|
+
_prepBehavior: function (b) {
|
588
|
+
this._addHostAttributes(b.hostAttributes);
|
589
|
+
},
|
590
|
+
_marshalBehavior: function (b) {
|
591
|
+
},
|
592
|
+
_initFeatures: function () {
|
593
|
+
this._marshalHostAttributes();
|
594
|
+
this._setupDebouncers();
|
595
|
+
this._marshalBehaviors();
|
596
|
+
}
|
597
|
+
});</script>
|
598
|
+
|