polymer-platinum-rails 1.0.0.pre.rc.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/README.md +39 -0
- data/Rakefile +1 -0
- data/app/assets/components/platinum-elements/LICENSE +202 -0
- data/app/assets/components/platinum-elements/README.md +2 -0
- data/app/assets/components/platinum-elements/bower.json +19 -0
- data/app/assets/components/platinum-push-messaging/README.md +4 -0
- data/app/assets/components/platinum-push-messaging/bower.json +37 -0
- data/app/assets/components/platinum-push-messaging/demo/index.html +130 -0
- data/app/assets/components/platinum-push-messaging/demo/manifest.json +4 -0
- data/app/assets/components/platinum-push-messaging/index.html +22 -0
- data/app/assets/components/platinum-push-messaging/platinum-push-messaging.html +427 -0
- data/app/assets/components/platinum-push-messaging/service-worker.js +151 -0
- data/app/assets/components/platinum-sw/README.md +43 -0
- data/app/assets/components/platinum-sw/bootstrap/sw-toolbox-setup.js +38 -0
- data/app/assets/components/platinum-sw/bower.json +37 -0
- data/app/assets/components/platinum-sw/demo/index.html +91 -0
- data/app/assets/components/platinum-sw/demo/sw-import.js +1 -0
- data/app/assets/components/platinum-sw/index.html +22 -0
- data/app/assets/components/platinum-sw/platinum-sw-cache.html +116 -0
- data/app/assets/components/platinum-sw/platinum-sw-elements.html +14 -0
- data/app/assets/components/platinum-sw/platinum-sw-fetch.html +130 -0
- data/app/assets/components/platinum-sw/platinum-sw-import-script.html +57 -0
- data/app/assets/components/platinum-sw/platinum-sw-register.html +342 -0
- data/app/assets/components/platinum-sw/service-worker.js +52 -0
- data/app/assets/components/polymer/LICENSE.txt +27 -0
- data/app/assets/components/polymer/bower.json +26 -0
- data/app/assets/components/polymer/build.log +27 -0
- data/app/assets/components/polymer/polymer-micro.html +523 -0
- data/app/assets/components/polymer/polymer-mini.html +1368 -0
- data/app/assets/components/polymer/polymer.html +3768 -0
- data/app/assets/components/sw-toolbox/CONTRIBUTING.md +30 -0
- data/app/assets/components/sw-toolbox/LICENSE +201 -0
- data/app/assets/components/sw-toolbox/README.md +156 -0
- data/app/assets/components/sw-toolbox/bower.json +14 -0
- data/app/assets/components/sw-toolbox/companion.js +23 -0
- data/app/assets/components/sw-toolbox/package.json +21 -0
- data/app/assets/components/sw-toolbox/sw-toolbox.js +148 -0
- data/app/assets/components/sw-toolbox/sw-toolbox.map.json +1 -0
- data/app/assets/components/webcomponentsjs/CustomElements.js +956 -0
- data/app/assets/components/webcomponentsjs/CustomElements.min.js +11 -0
- data/app/assets/components/webcomponentsjs/HTMLImports.js +1078 -0
- data/app/assets/components/webcomponentsjs/HTMLImports.min.js +11 -0
- data/app/assets/components/webcomponentsjs/MutationObserver.js +344 -0
- data/app/assets/components/webcomponentsjs/MutationObserver.min.js +11 -0
- data/app/assets/components/webcomponentsjs/README.md +125 -0
- data/app/assets/components/webcomponentsjs/ShadowDOM.js +4414 -0
- data/app/assets/components/webcomponentsjs/ShadowDOM.min.js +15 -0
- data/app/assets/components/webcomponentsjs/bower.json +14 -0
- data/app/assets/components/webcomponentsjs/build.log +33 -0
- data/app/assets/components/webcomponentsjs/package.json +31 -0
- data/app/assets/components/webcomponentsjs/webcomponents-lite.js +2300 -0
- data/app/assets/components/webcomponentsjs/webcomponents-lite.min.js +13 -0
- data/app/assets/components/webcomponentsjs/webcomponents.js +7112 -0
- data/app/assets/components/webcomponentsjs/webcomponents.min.js +15 -0
- data/lib/polymer-platinum-rails.rb +2 -0
- data/lib/polymer-platinum-rails/engine.rb +4 -0
- data/lib/polymer-platinum-rails/version.rb +3 -0
- metadata +149 -0
@@ -0,0 +1,52 @@
|
|
1
|
+
/**
|
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
|
+
|
11
|
+
var VERSION = '1.0';
|
12
|
+
|
13
|
+
function deserializeUrlParams(queryString) {
|
14
|
+
return new Map(queryString.split('&').map(function(keyValuePair) {
|
15
|
+
var splits = keyValuePair.split('=');
|
16
|
+
var key = decodeURIComponent(splits[0]);
|
17
|
+
var value = decodeURIComponent(splits[1]);
|
18
|
+
if (value.indexOf(',') >= 0) {
|
19
|
+
value = value.split(',');
|
20
|
+
}
|
21
|
+
|
22
|
+
return [key, value];
|
23
|
+
}));
|
24
|
+
}
|
25
|
+
|
26
|
+
self.params = deserializeUrlParams(location.search.substring(1));
|
27
|
+
|
28
|
+
if (params.get('version') !== VERSION) {
|
29
|
+
throw 'The registered script is version ' + VERSION +
|
30
|
+
' and cannot be used with <platinum-sw-register> version ' + params.get('version');
|
31
|
+
}
|
32
|
+
|
33
|
+
if (params.has('importscript')) {
|
34
|
+
var scripts = params.get('importscript');
|
35
|
+
if (Array.isArray(scripts)) {
|
36
|
+
importScripts.apply(null, scripts);
|
37
|
+
} else {
|
38
|
+
importScripts(scripts);
|
39
|
+
}
|
40
|
+
}
|
41
|
+
|
42
|
+
if (params.get('skipWaiting') === 'true' && self.skipWaiting) {
|
43
|
+
self.addEventListener('install', function(e) {
|
44
|
+
e.waitUntil(self.skipWaiting());
|
45
|
+
});
|
46
|
+
}
|
47
|
+
|
48
|
+
if (params.get('clientsClaim') === 'true' && self.clients && self.clients.claim) {
|
49
|
+
self.addEventListener('activate', function(e) {
|
50
|
+
e.waitUntil(self.clients.claim());
|
51
|
+
});
|
52
|
+
}
|
@@ -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,26 @@
|
|
1
|
+
{
|
2
|
+
"name": "polymer",
|
3
|
+
"version": "1.0.3",
|
4
|
+
"main": [
|
5
|
+
"polymer.html"
|
6
|
+
],
|
7
|
+
"license": "http://polymer.github.io/LICENSE.txt",
|
8
|
+
"ignore": [
|
9
|
+
"/.*",
|
10
|
+
"/test/"
|
11
|
+
],
|
12
|
+
"authors": [
|
13
|
+
"The Polymer Authors (http://polymer.github.io/AUTHORS.txt)"
|
14
|
+
],
|
15
|
+
"repository": {
|
16
|
+
"type": "git",
|
17
|
+
"url": "https://github.com/Polymer/polymer.git"
|
18
|
+
},
|
19
|
+
"dependencies": {
|
20
|
+
"webcomponentsjs": "^0.7.2"
|
21
|
+
},
|
22
|
+
"devDependencies": {
|
23
|
+
"web-component-tester": "*"
|
24
|
+
},
|
25
|
+
"private": true
|
26
|
+
}
|
@@ -0,0 +1,27 @@
|
|
1
|
+
BUILD LOG
|
2
|
+
---------
|
3
|
+
Build Time: 2015-06-04T20:19:11-0700
|
4
|
+
|
5
|
+
NODEJS INFORMATION
|
6
|
+
==================
|
7
|
+
nodejs: v2.0.2
|
8
|
+
gulp: 3.9.0
|
9
|
+
gulp-audit: 1.0.0
|
10
|
+
gulp-rename: 1.2.2
|
11
|
+
gulp-vulcanize: 6.0.0
|
12
|
+
lazypipe: 0.2.3
|
13
|
+
polyclean: 1.2.0
|
14
|
+
run-sequence: 1.1.0
|
15
|
+
del: 1.2.0
|
16
|
+
gulp-replace: 0.5.3
|
17
|
+
vulcanize: 1.8.1
|
18
|
+
|
19
|
+
REPO REVISIONS
|
20
|
+
==============
|
21
|
+
polymer: 0c73fc226b6b5ca308a851b334b1bdeda289195d
|
22
|
+
|
23
|
+
BUILD HASHES
|
24
|
+
============
|
25
|
+
polymer-mini.html: 8173d099edaed570f4db95cd54317f49dc3183ae
|
26
|
+
polymer-micro.html: afd2d239fc08ec69fa912a0fc7e73e8ce58e3f91
|
27
|
+
polymer.html: 2094f18d71f5aec3321b1364575579e960b37cbc
|
@@ -0,0 +1,523 @@
|
|
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
|
+
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
|
+
var ctor = desugar(prototype);
|
52
|
+
prototype = ctor.prototype;
|
53
|
+
var options = { prototype: prototype };
|
54
|
+
if (prototype.extends) {
|
55
|
+
options.extends = prototype.extends;
|
56
|
+
}
|
57
|
+
Polymer.telemetry._registrate(prototype);
|
58
|
+
document.registerElement(prototype.is, options);
|
59
|
+
return ctor;
|
60
|
+
};
|
61
|
+
var desugar = function (prototype) {
|
62
|
+
prototype = Polymer.Base.chainObject(prototype, Polymer.Base);
|
63
|
+
prototype.registerCallback();
|
64
|
+
return prototype.constructor;
|
65
|
+
};
|
66
|
+
window.Polymer = Polymer;
|
67
|
+
if (userPolymer) {
|
68
|
+
for (var i in userPolymer) {
|
69
|
+
Polymer[i] = userPolymer[i];
|
70
|
+
}
|
71
|
+
}
|
72
|
+
Polymer.Class = desugar;
|
73
|
+
}());
|
74
|
+
Polymer.telemetry = {
|
75
|
+
registrations: [],
|
76
|
+
_regLog: function (prototype) {
|
77
|
+
console.log('[' + prototype.is + ']: registered');
|
78
|
+
},
|
79
|
+
_registrate: function (prototype) {
|
80
|
+
this.registrations.push(prototype);
|
81
|
+
Polymer.log && this._regLog(prototype);
|
82
|
+
},
|
83
|
+
dumpRegistrations: function () {
|
84
|
+
this.registrations.forEach(this._regLog);
|
85
|
+
}
|
86
|
+
};
|
87
|
+
Object.defineProperty(window, 'currentImport', {
|
88
|
+
enumerable: true,
|
89
|
+
configurable: true,
|
90
|
+
get: function () {
|
91
|
+
return (document._currentScript || document.currentScript).ownerDocument;
|
92
|
+
}
|
93
|
+
});
|
94
|
+
Polymer.Base = {
|
95
|
+
_addFeature: function (feature) {
|
96
|
+
this.extend(this, feature);
|
97
|
+
},
|
98
|
+
registerCallback: function () {
|
99
|
+
this._registerFeatures();
|
100
|
+
this._doBehavior('registered');
|
101
|
+
},
|
102
|
+
createdCallback: function () {
|
103
|
+
Polymer.telemetry.instanceCount++;
|
104
|
+
this.root = this;
|
105
|
+
this._doBehavior('created');
|
106
|
+
this._initFeatures();
|
107
|
+
},
|
108
|
+
attachedCallback: function () {
|
109
|
+
this.isAttached = true;
|
110
|
+
this._doBehavior('attached');
|
111
|
+
},
|
112
|
+
detachedCallback: function () {
|
113
|
+
this.isAttached = false;
|
114
|
+
this._doBehavior('detached');
|
115
|
+
},
|
116
|
+
attributeChangedCallback: function (name) {
|
117
|
+
this._setAttributeToProperty(this, name);
|
118
|
+
this._doBehavior('attributeChanged', arguments);
|
119
|
+
},
|
120
|
+
extend: function (prototype, api) {
|
121
|
+
if (prototype && api) {
|
122
|
+
Object.getOwnPropertyNames(api).forEach(function (n) {
|
123
|
+
this.copyOwnProperty(n, api, prototype);
|
124
|
+
}, this);
|
125
|
+
}
|
126
|
+
return prototype || api;
|
127
|
+
},
|
128
|
+
copyOwnProperty: function (name, source, target) {
|
129
|
+
var pd = Object.getOwnPropertyDescriptor(source, name);
|
130
|
+
if (pd) {
|
131
|
+
Object.defineProperty(target, name, pd);
|
132
|
+
}
|
133
|
+
},
|
134
|
+
_log: console.log.apply.bind(console.log, console),
|
135
|
+
_warn: console.warn.apply.bind(console.warn, console),
|
136
|
+
_error: console.error.apply.bind(console.error, console),
|
137
|
+
_logf: function () {
|
138
|
+
return this._logPrefix.concat([this.is]).concat(Array.prototype.slice.call(arguments, 0));
|
139
|
+
}
|
140
|
+
};
|
141
|
+
Polymer.Base._logPrefix = function () {
|
142
|
+
var color = window.chrome || /firefox/i.test(navigator.userAgent);
|
143
|
+
return color ? [
|
144
|
+
'%c[%s::%s]:',
|
145
|
+
'font-weight: bold; background-color:#EEEE00;'
|
146
|
+
] : ['[%s::%s]:'];
|
147
|
+
}();
|
148
|
+
Polymer.Base.chainObject = function (object, inherited) {
|
149
|
+
if (object && inherited && object !== inherited) {
|
150
|
+
if (!Object.__proto__) {
|
151
|
+
object = Polymer.Base.extend(Object.create(inherited), object);
|
152
|
+
}
|
153
|
+
object.__proto__ = inherited;
|
154
|
+
}
|
155
|
+
return object;
|
156
|
+
};
|
157
|
+
Polymer.Base = Polymer.Base.chainObject(Polymer.Base, HTMLElement.prototype);
|
158
|
+
Polymer.telemetry.instanceCount = 0;
|
159
|
+
(function () {
|
160
|
+
var modules = {};
|
161
|
+
var DomModule = function () {
|
162
|
+
return document.createElement('dom-module');
|
163
|
+
};
|
164
|
+
DomModule.prototype = Object.create(HTMLElement.prototype);
|
165
|
+
DomModule.prototype.constructor = DomModule;
|
166
|
+
DomModule.prototype.createdCallback = function () {
|
167
|
+
var id = this.id || this.getAttribute('name') || this.getAttribute('is');
|
168
|
+
if (id) {
|
169
|
+
this.id = id;
|
170
|
+
modules[id] = this;
|
171
|
+
}
|
172
|
+
};
|
173
|
+
DomModule.prototype.import = function (id, slctr) {
|
174
|
+
var m = modules[id];
|
175
|
+
if (!m) {
|
176
|
+
forceDocumentUpgrade();
|
177
|
+
m = modules[id];
|
178
|
+
}
|
179
|
+
if (m && slctr) {
|
180
|
+
m = m.querySelector(slctr);
|
181
|
+
}
|
182
|
+
return m;
|
183
|
+
};
|
184
|
+
var cePolyfill = window.CustomElements && !CustomElements.useNative;
|
185
|
+
if (cePolyfill) {
|
186
|
+
var ready = CustomElements.ready;
|
187
|
+
CustomElements.ready = true;
|
188
|
+
}
|
189
|
+
document.registerElement('dom-module', DomModule);
|
190
|
+
if (cePolyfill) {
|
191
|
+
CustomElements.ready = ready;
|
192
|
+
}
|
193
|
+
function forceDocumentUpgrade() {
|
194
|
+
if (cePolyfill) {
|
195
|
+
var script = document._currentScript || document.currentScript;
|
196
|
+
if (script) {
|
197
|
+
CustomElements.upgradeAll(script.ownerDocument);
|
198
|
+
}
|
199
|
+
}
|
200
|
+
}
|
201
|
+
}());
|
202
|
+
Polymer.Base._addFeature({
|
203
|
+
_prepIs: function () {
|
204
|
+
if (!this.is) {
|
205
|
+
var module = (document._currentScript || document.currentScript).parentNode;
|
206
|
+
if (module.localName === 'dom-module') {
|
207
|
+
var id = module.id || module.getAttribute('name') || module.getAttribute('is');
|
208
|
+
this.is = id;
|
209
|
+
}
|
210
|
+
}
|
211
|
+
}
|
212
|
+
});
|
213
|
+
Polymer.Base._addFeature({
|
214
|
+
behaviors: [],
|
215
|
+
_prepBehaviors: function () {
|
216
|
+
if (this.behaviors.length) {
|
217
|
+
this.behaviors = this._flattenBehaviorsList(this.behaviors);
|
218
|
+
}
|
219
|
+
this._prepAllBehaviors(this.behaviors);
|
220
|
+
},
|
221
|
+
_flattenBehaviorsList: function (behaviors) {
|
222
|
+
var flat = [];
|
223
|
+
behaviors.forEach(function (b) {
|
224
|
+
if (b instanceof Array) {
|
225
|
+
flat = flat.concat(this._flattenBehaviorsList(b));
|
226
|
+
} else if (b) {
|
227
|
+
flat.push(b);
|
228
|
+
} else {
|
229
|
+
this._warn(this._logf('_flattenBehaviorsList', 'behavior is null, check for missing or 404 import'));
|
230
|
+
}
|
231
|
+
}, this);
|
232
|
+
return flat;
|
233
|
+
},
|
234
|
+
_prepAllBehaviors: function (behaviors) {
|
235
|
+
for (var i = behaviors.length - 1; i >= 0; i--) {
|
236
|
+
this._mixinBehavior(behaviors[i]);
|
237
|
+
}
|
238
|
+
for (var i = 0, l = behaviors.length; i < l; i++) {
|
239
|
+
this._prepBehavior(behaviors[i]);
|
240
|
+
}
|
241
|
+
this._prepBehavior(this);
|
242
|
+
},
|
243
|
+
_mixinBehavior: function (b) {
|
244
|
+
Object.getOwnPropertyNames(b).forEach(function (n) {
|
245
|
+
switch (n) {
|
246
|
+
case 'hostAttributes':
|
247
|
+
case 'registered':
|
248
|
+
case 'properties':
|
249
|
+
case 'observers':
|
250
|
+
case 'listeners':
|
251
|
+
case 'created':
|
252
|
+
case 'attached':
|
253
|
+
case 'detached':
|
254
|
+
case 'attributeChanged':
|
255
|
+
case 'configure':
|
256
|
+
case 'ready':
|
257
|
+
break;
|
258
|
+
default:
|
259
|
+
if (!this.hasOwnProperty(n)) {
|
260
|
+
this.copyOwnProperty(n, b, this);
|
261
|
+
}
|
262
|
+
break;
|
263
|
+
}
|
264
|
+
}, this);
|
265
|
+
},
|
266
|
+
_doBehavior: function (name, args) {
|
267
|
+
this.behaviors.forEach(function (b) {
|
268
|
+
this._invokeBehavior(b, name, args);
|
269
|
+
}, this);
|
270
|
+
this._invokeBehavior(this, name, args);
|
271
|
+
},
|
272
|
+
_invokeBehavior: function (b, name, args) {
|
273
|
+
var fn = b[name];
|
274
|
+
if (fn) {
|
275
|
+
fn.apply(this, args || Polymer.nar);
|
276
|
+
}
|
277
|
+
},
|
278
|
+
_marshalBehaviors: function () {
|
279
|
+
this.behaviors.forEach(function (b) {
|
280
|
+
this._marshalBehavior(b);
|
281
|
+
}, this);
|
282
|
+
this._marshalBehavior(this);
|
283
|
+
}
|
284
|
+
});
|
285
|
+
Polymer.Base._addFeature({
|
286
|
+
_prepExtends: function () {
|
287
|
+
if (this.extends) {
|
288
|
+
this.__proto__ = this._getExtendedPrototype(this.extends);
|
289
|
+
}
|
290
|
+
},
|
291
|
+
_getExtendedPrototype: function (tag) {
|
292
|
+
return this._getExtendedNativePrototype(tag);
|
293
|
+
},
|
294
|
+
_nativePrototypes: {},
|
295
|
+
_getExtendedNativePrototype: function (tag) {
|
296
|
+
var p = this._nativePrototypes[tag];
|
297
|
+
if (!p) {
|
298
|
+
var np = this.getNativePrototype(tag);
|
299
|
+
p = this.extend(Object.create(np), Polymer.Base);
|
300
|
+
this._nativePrototypes[tag] = p;
|
301
|
+
}
|
302
|
+
return p;
|
303
|
+
},
|
304
|
+
getNativePrototype: function (tag) {
|
305
|
+
return Object.getPrototypeOf(document.createElement(tag));
|
306
|
+
}
|
307
|
+
});
|
308
|
+
Polymer.Base._addFeature({
|
309
|
+
_prepConstructor: function () {
|
310
|
+
this._factoryArgs = this.extends ? [
|
311
|
+
this.extends,
|
312
|
+
this.is
|
313
|
+
] : [this.is];
|
314
|
+
var ctor = function () {
|
315
|
+
return this._factory(arguments);
|
316
|
+
};
|
317
|
+
if (this.hasOwnProperty('extends')) {
|
318
|
+
ctor.extends = this.extends;
|
319
|
+
}
|
320
|
+
Object.defineProperty(this, 'constructor', {
|
321
|
+
value: ctor,
|
322
|
+
writable: true,
|
323
|
+
configurable: true
|
324
|
+
});
|
325
|
+
ctor.prototype = this;
|
326
|
+
},
|
327
|
+
_factory: function (args) {
|
328
|
+
var elt = document.createElement.apply(document, this._factoryArgs);
|
329
|
+
if (this.factoryImpl) {
|
330
|
+
this.factoryImpl.apply(elt, args);
|
331
|
+
}
|
332
|
+
return elt;
|
333
|
+
}
|
334
|
+
});
|
335
|
+
Polymer.nob = Object.create(null);
|
336
|
+
Polymer.Base._addFeature({
|
337
|
+
properties: {},
|
338
|
+
getPropertyInfo: function (property) {
|
339
|
+
var info = this._getPropertyInfo(property, this.properties);
|
340
|
+
if (!info) {
|
341
|
+
this.behaviors.some(function (b) {
|
342
|
+
return info = this._getPropertyInfo(property, b.properties);
|
343
|
+
}, this);
|
344
|
+
}
|
345
|
+
return info || Polymer.nob;
|
346
|
+
},
|
347
|
+
_getPropertyInfo: function (property, properties) {
|
348
|
+
var p = properties && properties[property];
|
349
|
+
if (typeof p === 'function') {
|
350
|
+
p = properties[property] = { type: p };
|
351
|
+
}
|
352
|
+
if (p) {
|
353
|
+
p.defined = true;
|
354
|
+
}
|
355
|
+
return p;
|
356
|
+
}
|
357
|
+
});
|
358
|
+
Polymer.CaseMap = {
|
359
|
+
_caseMap: {},
|
360
|
+
dashToCamelCase: function (dash) {
|
361
|
+
var mapped = Polymer.CaseMap._caseMap[dash];
|
362
|
+
if (mapped) {
|
363
|
+
return mapped;
|
364
|
+
}
|
365
|
+
if (dash.indexOf('-') < 0) {
|
366
|
+
return Polymer.CaseMap._caseMap[dash] = dash;
|
367
|
+
}
|
368
|
+
return Polymer.CaseMap._caseMap[dash] = dash.replace(/-([a-z])/g, function (m) {
|
369
|
+
return m[1].toUpperCase();
|
370
|
+
});
|
371
|
+
},
|
372
|
+
camelToDashCase: function (camel) {
|
373
|
+
var mapped = Polymer.CaseMap._caseMap[camel];
|
374
|
+
if (mapped) {
|
375
|
+
return mapped;
|
376
|
+
}
|
377
|
+
return Polymer.CaseMap._caseMap[camel] = camel.replace(/([a-z][A-Z])/g, function (g) {
|
378
|
+
return g[0] + '-' + g[1].toLowerCase();
|
379
|
+
});
|
380
|
+
}
|
381
|
+
};
|
382
|
+
Polymer.Base._addFeature({
|
383
|
+
_prepAttributes: function () {
|
384
|
+
this._aggregatedAttributes = {};
|
385
|
+
},
|
386
|
+
_addHostAttributes: function (attributes) {
|
387
|
+
if (attributes) {
|
388
|
+
this.mixin(this._aggregatedAttributes, attributes);
|
389
|
+
}
|
390
|
+
},
|
391
|
+
_marshalHostAttributes: function () {
|
392
|
+
this._applyAttributes(this, this._aggregatedAttributes);
|
393
|
+
},
|
394
|
+
_applyAttributes: function (node, attr$) {
|
395
|
+
for (var n in attr$) {
|
396
|
+
if (!this.hasAttribute(n) && n !== 'class') {
|
397
|
+
this.serializeValueToAttribute(attr$[n], n, this);
|
398
|
+
}
|
399
|
+
}
|
400
|
+
},
|
401
|
+
_marshalAttributes: function () {
|
402
|
+
this._takeAttributesToModel(this);
|
403
|
+
},
|
404
|
+
_takeAttributesToModel: function (model) {
|
405
|
+
for (var i = 0, l = this.attributes.length; i < l; i++) {
|
406
|
+
this._setAttributeToProperty(model, this.attributes[i].name);
|
407
|
+
}
|
408
|
+
},
|
409
|
+
_setAttributeToProperty: function (model, attrName) {
|
410
|
+
if (!this._serializing) {
|
411
|
+
var propName = Polymer.CaseMap.dashToCamelCase(attrName);
|
412
|
+
var info = this.getPropertyInfo(propName);
|
413
|
+
if (info.defined || this._propertyEffects && this._propertyEffects[propName]) {
|
414
|
+
var val = this.getAttribute(attrName);
|
415
|
+
model[propName] = this.deserialize(val, info.type);
|
416
|
+
}
|
417
|
+
}
|
418
|
+
},
|
419
|
+
_serializing: false,
|
420
|
+
reflectPropertyToAttribute: function (name) {
|
421
|
+
this._serializing = true;
|
422
|
+
this.serializeValueToAttribute(this[name], Polymer.CaseMap.camelToDashCase(name));
|
423
|
+
this._serializing = false;
|
424
|
+
},
|
425
|
+
serializeValueToAttribute: function (value, attribute, node) {
|
426
|
+
var str = this.serialize(value);
|
427
|
+
(node || this)[str === undefined ? 'removeAttribute' : 'setAttribute'](attribute, str);
|
428
|
+
},
|
429
|
+
deserialize: function (value, type) {
|
430
|
+
switch (type) {
|
431
|
+
case Number:
|
432
|
+
value = Number(value);
|
433
|
+
break;
|
434
|
+
case Boolean:
|
435
|
+
value = value !== null;
|
436
|
+
break;
|
437
|
+
case Object:
|
438
|
+
try {
|
439
|
+
value = JSON.parse(value);
|
440
|
+
} catch (x) {
|
441
|
+
}
|
442
|
+
break;
|
443
|
+
case Array:
|
444
|
+
try {
|
445
|
+
value = JSON.parse(value);
|
446
|
+
} catch (x) {
|
447
|
+
value = null;
|
448
|
+
console.warn('Polymer::Attributes: couldn`t decode Array as JSON');
|
449
|
+
}
|
450
|
+
break;
|
451
|
+
case Date:
|
452
|
+
value = new Date(value);
|
453
|
+
break;
|
454
|
+
case String:
|
455
|
+
default:
|
456
|
+
break;
|
457
|
+
}
|
458
|
+
return value;
|
459
|
+
},
|
460
|
+
serialize: function (value) {
|
461
|
+
switch (typeof value) {
|
462
|
+
case 'boolean':
|
463
|
+
return value ? '' : undefined;
|
464
|
+
case 'object':
|
465
|
+
if (value instanceof Date) {
|
466
|
+
return value;
|
467
|
+
} else if (value) {
|
468
|
+
try {
|
469
|
+
return JSON.stringify(value);
|
470
|
+
} catch (x) {
|
471
|
+
return '';
|
472
|
+
}
|
473
|
+
}
|
474
|
+
default:
|
475
|
+
return value != null ? value : undefined;
|
476
|
+
}
|
477
|
+
}
|
478
|
+
});
|
479
|
+
Polymer.Base._addFeature({
|
480
|
+
_setupDebouncers: function () {
|
481
|
+
this._debouncers = {};
|
482
|
+
},
|
483
|
+
debounce: function (jobName, callback, wait) {
|
484
|
+
this._debouncers[jobName] = Polymer.Debounce.call(this, this._debouncers[jobName], callback, wait);
|
485
|
+
},
|
486
|
+
isDebouncerActive: function (jobName) {
|
487
|
+
var debouncer = this._debouncers[jobName];
|
488
|
+
return debouncer && debouncer.finish;
|
489
|
+
},
|
490
|
+
flushDebouncer: function (jobName) {
|
491
|
+
var debouncer = this._debouncers[jobName];
|
492
|
+
if (debouncer) {
|
493
|
+
debouncer.complete();
|
494
|
+
}
|
495
|
+
},
|
496
|
+
cancelDebouncer: function (jobName) {
|
497
|
+
var debouncer = this._debouncers[jobName];
|
498
|
+
if (debouncer) {
|
499
|
+
debouncer.stop();
|
500
|
+
}
|
501
|
+
}
|
502
|
+
});
|
503
|
+
Polymer.version = '1.0.3';
|
504
|
+
Polymer.Base._addFeature({
|
505
|
+
_registerFeatures: function () {
|
506
|
+
this._prepIs();
|
507
|
+
this._prepAttributes();
|
508
|
+
this._prepBehaviors();
|
509
|
+
this._prepExtends();
|
510
|
+
this._prepConstructor();
|
511
|
+
},
|
512
|
+
_prepBehavior: function (b) {
|
513
|
+
this._addHostAttributes(b.hostAttributes);
|
514
|
+
},
|
515
|
+
_marshalBehavior: function (b) {
|
516
|
+
},
|
517
|
+
_initFeatures: function () {
|
518
|
+
this._marshalHostAttributes();
|
519
|
+
this._setupDebouncers();
|
520
|
+
this._marshalBehaviors();
|
521
|
+
}
|
522
|
+
});</script>
|
523
|
+
|