73bcce88
luigser
COMPONENTS
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
<!--
@license
Copyright (c) 2014 The Polymer Project Authors. All rights reserved.
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
Code distributed by Google as part of the polymer project is also
subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
--><script>(function () {
function resolve() {
document.body.removeAttribute('unresolved');
}
if (window.WebComponents) {
addEventListener('WebComponentsReady', resolve);
} else {
if (document.readyState === 'interactive' || document.readyState === 'complete') {
resolve();
} else {
addEventListener('DOMContentLoaded', resolve);
}
}
}());
window.Polymer = {
Settings: function () {
var user = window.Polymer || {};
|
c5169e0e
Renato De Donato
a new hope
|
26
|
location.search.slice(1).split('&').forEach(function (o) {
|
73bcce88
luigser
COMPONENTS
|
27
28
|
o = o.split('=');
o[0] && (user[o[0]] = o[1] || true);
|
c5169e0e
Renato De Donato
a new hope
|
29
|
});
|
73bcce88
luigser
COMPONENTS
|
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
|
var wantShadow = user.dom === 'shadow';
var hasShadow = Boolean(Element.prototype.createShadowRoot);
var nativeShadow = hasShadow && !window.ShadowDOMPolyfill;
var useShadow = wantShadow && hasShadow;
var hasNativeImports = Boolean('import' in document.createElement('link'));
var useNativeImports = hasNativeImports;
var useNativeCustomElements = !window.CustomElements || window.CustomElements.useNative;
return {
wantShadow: wantShadow,
hasShadow: hasShadow,
nativeShadow: nativeShadow,
useShadow: useShadow,
useNativeShadow: useShadow && nativeShadow,
useNativeImports: useNativeImports,
useNativeCustomElements: useNativeCustomElements
};
}()
};
(function () {
var userPolymer = window.Polymer;
window.Polymer = function (prototype) {
if (typeof prototype === 'function') {
prototype = prototype.prototype;
}
if (!prototype) {
prototype = {};
}
var factory = desugar(prototype);
prototype = factory.prototype;
|
e619a3b0
Luigi Serra
Controllet cross ...
|
59
60
61
62
|
var options = { prototype: prototype };
if (prototype.extends) {
options.extends = prototype.extends;
}
|
73bcce88
luigser
COMPONENTS
|
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
|
Polymer.telemetry._registrate(prototype);
document.registerElement(prototype.is, options);
return factory;
};
var desugar = function (prototype) {
var base = Polymer.Base;
if (prototype.extends) {
base = Polymer.Base._getExtendedPrototype(prototype.extends);
}
prototype = Polymer.Base.chainObject(prototype, base);
prototype.registerCallback();
return prototype.constructor;
};
window.Polymer = Polymer;
if (userPolymer) {
for (var i in userPolymer) {
Polymer[i] = userPolymer[i];
}
}
Polymer.Class = desugar;
}());
Polymer.telemetry = {
registrations: [],
_regLog: function (prototype) {
console.log('[' + prototype.is + ']: registered');
},
_registrate: function (prototype) {
this.registrations.push(prototype);
Polymer.log && this._regLog(prototype);
},
dumpRegistrations: function () {
this.registrations.forEach(this._regLog);
}
};
Object.defineProperty(window, 'currentImport', {
enumerable: true,
configurable: true,
get: function () {
return (document._currentScript || document.currentScript).ownerDocument;
}
});
Polymer.RenderStatus = {
_ready: false,
_callbacks: [],
whenReady: function (cb) {
if (this._ready) {
cb();
} else {
this._callbacks.push(cb);
}
},
_makeReady: function () {
this._ready = true;
|
c5169e0e
Renato De Donato
a new hope
|
116
117
118
|
this._callbacks.forEach(function (cb) {
cb();
});
|
73bcce88
luigser
COMPONENTS
|
119
120
121
122
123
124
|
this._callbacks = [];
},
_catchFirstRender: function () {
requestAnimationFrame(function () {
Polymer.RenderStatus._makeReady();
});
|
73bcce88
luigser
COMPONENTS
|
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
|
}
};
if (window.HTMLImports) {
HTMLImports.whenReady(function () {
Polymer.RenderStatus._catchFirstRender();
});
} else {
Polymer.RenderStatus._catchFirstRender();
}
Polymer.ImportStatus = Polymer.RenderStatus;
Polymer.ImportStatus.whenLoaded = Polymer.ImportStatus.whenReady;
Polymer.Base = {
__isPolymerInstance__: true,
_addFeature: function (feature) {
this.extend(this, feature);
},
registerCallback: function () {
this._desugarBehaviors();
this._doBehavior('beforeRegister');
this._registerFeatures();
this._doBehavior('registered');
},
createdCallback: function () {
Polymer.telemetry.instanceCount++;
this.root = this;
this._doBehavior('created');
this._initFeatures();
},
attachedCallback: function () {
|
73bcce88
luigser
COMPONENTS
|
154
|
Polymer.RenderStatus.whenReady(function () {
|
c5169e0e
Renato De Donato
a new hope
|
155
156
157
|
this.isAttached = true;
this._doBehavior('attached');
}.bind(this));
|
73bcce88
luigser
COMPONENTS
|
158
159
160
161
162
|
},
detachedCallback: function () {
this.isAttached = false;
this._doBehavior('detached');
},
|
c5169e0e
Renato De Donato
a new hope
|
163
|
attributeChangedCallback: function (name) {
|
73bcce88
luigser
COMPONENTS
|
164
|
this._attributeChangedImpl(name);
|
c5169e0e
Renato De Donato
a new hope
|
165
|
this._doBehavior('attributeChanged', arguments);
|
73bcce88
luigser
COMPONENTS
|
166
167
168
169
170
171
|
},
_attributeChangedImpl: function (name) {
this._setAttributeToProperty(this, name);
},
extend: function (prototype, api) {
if (prototype && api) {
|
c5169e0e
Renato De Donato
a new hope
|
172
|
Object.getOwnPropertyNames(api).forEach(function (n) {
|
73bcce88
luigser
COMPONENTS
|
173
|
this.copyOwnProperty(n, api, prototype);
|
c5169e0e
Renato De Donato
a new hope
|
174
|
}, this);
|
73bcce88
luigser
COMPONENTS
|
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
|
}
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) {
Object.defineProperty(target, name, pd);
}
},
_log: console.log.apply.bind(console.log, console),
_warn: console.warn.apply.bind(console.warn, console),
_error: console.error.apply.bind(console.error, console),
_logf: function () {
return this._logPrefix.concat([this.is]).concat(Array.prototype.slice.call(arguments, 0));
}
};
Polymer.Base._logPrefix = function () {
var color = window.chrome || /firefox/i.test(navigator.userAgent);
return color ? [
'%c[%s::%s]:',
'font-weight: bold; background-color:#EEEE00;'
] : ['[%s::%s]:'];
}();
Polymer.Base.chainObject = function (object, inherited) {
if (object && inherited && object !== inherited) {
if (!Object.__proto__) {
object = Polymer.Base.extend(Object.create(inherited), object);
}
object.__proto__ = inherited;
}
return object;
};
Polymer.Base = Polymer.Base.chainObject(Polymer.Base, HTMLElement.prototype);
if (window.CustomElements) {
Polymer.instanceof = CustomElements.instanceof;
} else {
Polymer.instanceof = function (obj, ctor) {
return obj instanceof ctor;
};
}
Polymer.isInstance = function (obj) {
return Boolean(obj && obj.__isPolymerInstance__);
};
Polymer.telemetry.instanceCount = 0;
(function () {
var modules = {};
var lcModules = {};
var findModule = function (id) {
return modules[id] || lcModules[id.toLowerCase()];
};
var DomModule = function () {
return document.createElement('dom-module');
};
DomModule.prototype = Object.create(HTMLElement.prototype);
Polymer.Base.extend(DomModule.prototype, {
constructor: DomModule,
createdCallback: function () {
this.register();
},
register: function (id) {
var id = id || this.id || this.getAttribute('name') || this.getAttribute('is');
if (id) {
this.id = id;
modules[id] = this;
lcModules[id.toLowerCase()] = this;
}
},
import: function (id, selector) {
if (id) {
var m = findModule(id);
if (!m) {
|
c5169e0e
Renato De Donato
a new hope
|
252
|
forceDocumentUpgrade();
|
73bcce88
luigser
COMPONENTS
|
253
254
255
256
257
258
259
260
261
262
263
|
m = findModule(id);
}
if (m && selector) {
m = m.querySelector(selector);
}
return m;
}
}
});
var cePolyfill = window.CustomElements && !CustomElements.useNative;
document.registerElement('dom-module', DomModule);
|
c5169e0e
Renato De Donato
a new hope
|
264
|
function forceDocumentUpgrade() {
|
73bcce88
luigser
COMPONENTS
|
265
266
|
if (cePolyfill) {
var script = document._currentScript || document.currentScript;
|
f748e9cf
Luigi Serra
new controllet an...
|
267
|
var doc = script && script.ownerDocument || document;
|
c5169e0e
Renato De Donato
a new hope
|
268
269
|
if (doc) {
CustomElements.upgradeAll(doc);
|
73bcce88
luigser
COMPONENTS
|
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
|
}
}
}
}());
Polymer.Base._addFeature({
_prepIs: function () {
if (!this.is) {
var module = (document._currentScript || document.currentScript).parentNode;
if (module.localName === 'dom-module') {
var id = module.id || module.getAttribute('name') || module.getAttribute('is');
this.is = id;
}
}
if (this.is) {
this.is = this.is.toLowerCase();
}
}
});
Polymer.Base._addFeature({
behaviors: [],
_desugarBehaviors: function () {
if (this.behaviors.length) {
this.behaviors = this._desugarSomeBehaviors(this.behaviors);
}
},
_desugarSomeBehaviors: function (behaviors) {
behaviors = this._flattenBehaviorsList(behaviors);
for (var i = behaviors.length - 1; i >= 0; i--) {
this._mixinBehavior(behaviors[i]);
}
return behaviors;
},
_flattenBehaviorsList: function (behaviors) {
var flat = [];
|
c5169e0e
Renato De Donato
a new hope
|
304
|
behaviors.forEach(function (b) {
|
73bcce88
luigser
COMPONENTS
|
305
306
307
308
309
310
311
|
if (b instanceof Array) {
flat = flat.concat(this._flattenBehaviorsList(b));
} else if (b) {
flat.push(b);
} else {
this._warn(this._logf('_flattenBehaviorsList', 'behavior is null, check for missing or 404 import'));
}
|
c5169e0e
Renato De Donato
a new hope
|
312
|
}, this);
|
73bcce88
luigser
COMPONENTS
|
313
314
315
|
return flat;
},
_mixinBehavior: function (b) {
|
c5169e0e
Renato De Donato
a new hope
|
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
|
Object.getOwnPropertyNames(b).forEach(function (n) {
switch (n) {
case 'hostAttributes':
case 'registered':
case 'properties':
case 'observers':
case 'listeners':
case 'created':
case 'attached':
case 'detached':
case 'attributeChanged':
case 'configure':
case 'ready':
break;
default:
if (!this.hasOwnProperty(n)) {
|
73bcce88
luigser
COMPONENTS
|
332
333
|
this.copyOwnProperty(n, b, this);
}
|
c5169e0e
Renato De Donato
a new hope
|
334
|
break;
|
73bcce88
luigser
COMPONENTS
|
335
|
}
|
c5169e0e
Renato De Donato
a new hope
|
336
|
}, this);
|
73bcce88
luigser
COMPONENTS
|
337
338
339
340
341
342
343
344
345
346
347
|
},
_prepBehaviors: function () {
this._prepFlattenedBehaviors(this.behaviors);
},
_prepFlattenedBehaviors: function (behaviors) {
for (var i = 0, l = behaviors.length; i < l; i++) {
this._prepBehavior(behaviors[i]);
}
this._prepBehavior(this);
},
_doBehavior: function (name, args) {
|
c5169e0e
Renato De Donato
a new hope
|
348
349
350
|
this.behaviors.forEach(function (b) {
this._invokeBehavior(b, name, args);
}, this);
|
73bcce88
luigser
COMPONENTS
|
351
352
353
354
355
356
357
358
359
|
this._invokeBehavior(this, name, args);
},
_invokeBehavior: function (b, name, args) {
var fn = b[name];
if (fn) {
fn.apply(this, args || Polymer.nar);
}
},
_marshalBehaviors: function () {
|
c5169e0e
Renato De Donato
a new hope
|
360
361
362
|
this.behaviors.forEach(function (b) {
this._marshalBehavior(b);
}, this);
|
73bcce88
luigser
COMPONENTS
|
363
364
365
|
this._marshalBehavior(this);
}
});
|
73bcce88
luigser
COMPONENTS
|
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
|
Polymer.Base._addFeature({
_getExtendedPrototype: function (tag) {
return this._getExtendedNativePrototype(tag);
},
_nativePrototypes: {},
_getExtendedNativePrototype: function (tag) {
var p = this._nativePrototypes[tag];
if (!p) {
var np = this.getNativePrototype(tag);
p = this.extend(Object.create(np), Polymer.Base);
this._nativePrototypes[tag] = p;
}
return p;
},
getNativePrototype: function (tag) {
return Object.getPrototypeOf(document.createElement(tag));
}
});
Polymer.Base._addFeature({
_prepConstructor: function () {
this._factoryArgs = this.extends ? [
this.extends,
this.is
] : [this.is];
var ctor = function () {
return this._factory(arguments);
};
if (this.hasOwnProperty('extends')) {
ctor.extends = this.extends;
}
Object.defineProperty(this, 'constructor', {
value: ctor,
writable: true,
configurable: true
});
ctor.prototype = this;
},
_factory: function (args) {
var elt = document.createElement.apply(document, this._factoryArgs);
if (this.factoryImpl) {
this.factoryImpl.apply(elt, args);
}
return elt;
}
});
Polymer.nob = Object.create(null);
Polymer.Base._addFeature({
properties: {},
getPropertyInfo: function (property) {
var info = this._getPropertyInfo(property, this.properties);
if (!info) {
|
c5169e0e
Renato De Donato
a new hope
|
417
418
419
|
this.behaviors.some(function (b) {
return info = this._getPropertyInfo(property, b.properties);
}, this);
|
73bcce88
luigser
COMPONENTS
|
420
421
422
423
424
425
426
427
428
429
430
431
|
}
return info || Polymer.nob;
},
_getPropertyInfo: function (property, properties) {
var p = properties && properties[property];
if (typeof p === 'function') {
p = properties[property] = { type: p };
}
if (p) {
p.defined = true;
}
return p;
|
73bcce88
luigser
COMPONENTS
|
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
|
}
});
Polymer.CaseMap = {
_caseMap: {},
dashToCamelCase: function (dash) {
var mapped = Polymer.CaseMap._caseMap[dash];
if (mapped) {
return mapped;
}
if (dash.indexOf('-') < 0) {
return Polymer.CaseMap._caseMap[dash] = dash;
}
return Polymer.CaseMap._caseMap[dash] = dash.replace(/-([a-z])/g, function (m) {
return m[1].toUpperCase();
});
},
camelToDashCase: function (camel) {
var mapped = Polymer.CaseMap._caseMap[camel];
if (mapped) {
return mapped;
}
return Polymer.CaseMap._caseMap[camel] = camel.replace(/([a-z][A-Z])/g, function (g) {
return g[0] + '-' + g[1].toLowerCase();
});
}
};
Polymer.Base._addFeature({
|
c5169e0e
Renato De Donato
a new hope
|
459
|
_prepAttributes: function () {
|
a1a3bc73
Luigi Serra
graphs updates
|
460
|
this._aggregatedAttributes = {};
|
c5169e0e
Renato De Donato
a new hope
|
461
462
|
},
_addHostAttributes: function (attributes) {
|
73bcce88
luigser
COMPONENTS
|
463
464
465
466
467
|
if (attributes) {
this.mixin(this._aggregatedAttributes, attributes);
}
},
_marshalHostAttributes: function () {
|
73bcce88
luigser
COMPONENTS
|
468
|
this._applyAttributes(this, this._aggregatedAttributes);
|
73bcce88
luigser
COMPONENTS
|
469
470
471
472
|
},
_applyAttributes: function (node, attr$) {
for (var n in attr$) {
if (!this.hasAttribute(n) && n !== 'class') {
|
c5169e0e
Renato De Donato
a new hope
|
473
|
this.serializeValueToAttribute(attr$[n], n, this);
|
73bcce88
luigser
COMPONENTS
|
474
475
476
477
478
479
480
|
}
}
},
_marshalAttributes: function () {
this._takeAttributesToModel(this);
},
_takeAttributesToModel: function (model) {
|
c5169e0e
Renato De Donato
a new hope
|
481
482
|
for (var i = 0, l = this.attributes.length; i < l; i++) {
this._setAttributeToProperty(model, this.attributes[i].name);
|
73bcce88
luigser
COMPONENTS
|
483
484
|
}
},
|
c5169e0e
Renato De Donato
a new hope
|
485
|
_setAttributeToProperty: function (model, attrName) {
|
73bcce88
luigser
COMPONENTS
|
486
|
if (!this._serializing) {
|
c5169e0e
Renato De Donato
a new hope
|
487
488
489
490
491
|
var propName = Polymer.CaseMap.dashToCamelCase(attrName);
var info = this.getPropertyInfo(propName);
if (info.defined || this._propertyEffects && this._propertyEffects[propName]) {
var val = this.getAttribute(attrName);
model[propName] = this.deserialize(val, info.type);
|
73bcce88
luigser
COMPONENTS
|
492
493
494
495
|
}
}
},
_serializing: false,
|
c5169e0e
Renato De Donato
a new hope
|
496
|
reflectPropertyToAttribute: function (name) {
|
73bcce88
luigser
COMPONENTS
|
497
|
this._serializing = true;
|
c5169e0e
Renato De Donato
a new hope
|
498
|
this.serializeValueToAttribute(this[name], Polymer.CaseMap.camelToDashCase(name));
|
73bcce88
luigser
COMPONENTS
|
499
500
501
502
|
this._serializing = false;
},
serializeValueToAttribute: function (value, attribute, node) {
var str = this.serialize(value);
|
c5169e0e
Renato De Donato
a new hope
|
503
|
(node || this)[str === undefined ? 'removeAttribute' : 'setAttribute'](attribute, str);
|
73bcce88
luigser
COMPONENTS
|
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
|
},
deserialize: function (value, type) {
switch (type) {
case Number:
value = Number(value);
break;
case Boolean:
value = value !== null;
break;
case Object:
try {
value = JSON.parse(value);
} catch (x) {
}
break;
case Array:
try {
value = JSON.parse(value);
} catch (x) {
value = null;
console.warn('Polymer::Attributes: couldn`t decode Array as JSON');
}
break;
case Date:
value = new Date(value);
break;
case String:
default:
break;
}
return value;
},
serialize: function (value) {
switch (typeof value) {
case 'boolean':
return value ? '' : undefined;
case 'object':
if (value instanceof Date) {
return value;
} else if (value) {
try {
return JSON.stringify(value);
} catch (x) {
return '';
}
}
default:
return value != null ? value : undefined;
}
}
});
Polymer.Base._addFeature({
_setupDebouncers: function () {
this._debouncers = {};
},
debounce: function (jobName, callback, wait) {
return this._debouncers[jobName] = Polymer.Debounce.call(this, this._debouncers[jobName], callback, wait);
},
isDebouncerActive: function (jobName) {
var debouncer = this._debouncers[jobName];
return debouncer && debouncer.finish;
},
flushDebouncer: function (jobName) {
var debouncer = this._debouncers[jobName];
if (debouncer) {
debouncer.complete();
}
},
cancelDebouncer: function (jobName) {
var debouncer = this._debouncers[jobName];
if (debouncer) {
debouncer.stop();
}
}
});
|
c5169e0e
Renato De Donato
a new hope
|
579
|
Polymer.version = '1.2.0';
|
73bcce88
luigser
COMPONENTS
|
580
581
582
|
Polymer.Base._addFeature({
_registerFeatures: function () {
this._prepIs();
|
c5169e0e
Renato De Donato
a new hope
|
583
|
this._prepAttributes();
|
73bcce88
luigser
COMPONENTS
|
584
585
|
this._prepBehaviors();
this._prepConstructor();
|
73bcce88
luigser
COMPONENTS
|
586
587
588
589
590
591
592
593
594
595
596
597
|
},
_prepBehavior: function (b) {
this._addHostAttributes(b.hostAttributes);
},
_marshalBehavior: function (b) {
},
_initFeatures: function () {
this._marshalHostAttributes();
this._setupDebouncers();
this._marshalBehaviors();
}
});</script>
|