polymer-rails 1.0.8 → 1.1.0
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 +4 -4
- data/app/assets/javascripts/polymer/polymer-micro.html +49 -12
- data/app/assets/javascripts/polymer/polymer-mini.html +50 -11
- data/app/assets/javascripts/polymer/polymer.html +282 -125
- data/app/assets/javascripts/webcomponentsjs/webcomponents-lite.js +77 -23
- data/app/assets/javascripts/webcomponentsjs/webcomponents.js +30 -52
- data/lib/polymer-rails.rb +11 -1
- data/lib/polymer-rails/processors/components_processor.rb +1 -9
- data/lib/polymer-rails/processors/components_processor_v2.rb +16 -0
- data/lib/polymer-rails/processors/components_processor_v3.rb +33 -0
- data/lib/polymer-rails/railtie.rb +19 -2
- data/lib/polymer-rails/version.rb +1 -1
- metadata +4 -16
@@ -7,7 +7,7 @@
|
|
7
7
|
* Code distributed by Google as part of the polymer project is also
|
8
8
|
* subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
|
9
9
|
*/
|
10
|
-
// @version 0.7.
|
10
|
+
// @version 0.7.11
|
11
11
|
window.WebComponents = window.WebComponents || {};
|
12
12
|
|
13
13
|
(function(scope) {
|
@@ -1265,7 +1265,7 @@ window.HTMLImports.addModule(function(scope) {
|
|
1265
1265
|
var IMPORT_SELECTOR = "link[rel=" + IMPORT_LINK_TYPE + "]";
|
1266
1266
|
var importParser = {
|
1267
1267
|
documentSelectors: IMPORT_SELECTOR,
|
1268
|
-
importsSelectors: [ IMPORT_SELECTOR, "link[rel=stylesheet]", "style", "script:not([type])", 'script[type="application/javascript"]', 'script[type="text/javascript"]' ].join(","),
|
1268
|
+
importsSelectors: [ IMPORT_SELECTOR, "link[rel=stylesheet]:not([type])", "style:not([type])", "script:not([type])", 'script[type="application/javascript"]', 'script[type="text/javascript"]' ].join(","),
|
1269
1269
|
map: {
|
1270
1270
|
link: "parseLink",
|
1271
1271
|
script: "parseScript",
|
@@ -1316,6 +1316,7 @@ window.HTMLImports.addModule(function(scope) {
|
|
1316
1316
|
}
|
1317
1317
|
},
|
1318
1318
|
parseImport: function(elt) {
|
1319
|
+
elt.import = elt.__doc;
|
1319
1320
|
if (window.HTMLImports.__importsParsingHook) {
|
1320
1321
|
window.HTMLImports.__importsParsingHook(elt);
|
1321
1322
|
}
|
@@ -1378,6 +1379,8 @@ window.HTMLImports.addModule(function(scope) {
|
|
1378
1379
|
trackElement: function(elt, callback) {
|
1379
1380
|
var self = this;
|
1380
1381
|
var done = function(e) {
|
1382
|
+
elt.removeEventListener("load", done);
|
1383
|
+
elt.removeEventListener("error", done);
|
1381
1384
|
if (callback) {
|
1382
1385
|
callback(e);
|
1383
1386
|
}
|
@@ -1433,7 +1436,7 @@ window.HTMLImports.addModule(function(scope) {
|
|
1433
1436
|
for (var i = 0, l = nodes.length, p = 0, n; i < l && (n = nodes[i]); i++) {
|
1434
1437
|
if (!this.isParsed(n)) {
|
1435
1438
|
if (this.hasResource(n)) {
|
1436
|
-
return nodeIsImport(n) ? this.nextToParseInDoc(n.
|
1439
|
+
return nodeIsImport(n) ? this.nextToParseInDoc(n.__doc, n) : n;
|
1437
1440
|
} else {
|
1438
1441
|
return;
|
1439
1442
|
}
|
@@ -1456,7 +1459,7 @@ window.HTMLImports.addModule(function(scope) {
|
|
1456
1459
|
return this.dynamicElements.indexOf(elt) >= 0;
|
1457
1460
|
},
|
1458
1461
|
hasResource: function(node) {
|
1459
|
-
if (nodeIsImport(node) && node.
|
1462
|
+
if (nodeIsImport(node) && node.__doc === undefined) {
|
1460
1463
|
return false;
|
1461
1464
|
}
|
1462
1465
|
return true;
|
@@ -1530,7 +1533,7 @@ window.HTMLImports.addModule(function(scope) {
|
|
1530
1533
|
}
|
1531
1534
|
this.documents[url] = doc;
|
1532
1535
|
}
|
1533
|
-
elt.
|
1536
|
+
elt.__doc = doc;
|
1534
1537
|
}
|
1535
1538
|
parser.parseNext();
|
1536
1539
|
},
|
@@ -1912,6 +1915,7 @@ window.CustomElements.addModule(function(scope) {
|
|
1912
1915
|
}
|
1913
1916
|
scope.watchShadow = watchShadow;
|
1914
1917
|
scope.upgradeDocumentTree = upgradeDocumentTree;
|
1918
|
+
scope.upgradeDocument = upgradeDocument;
|
1915
1919
|
scope.upgradeSubtree = addedSubtree;
|
1916
1920
|
scope.upgradeAll = addedNode;
|
1917
1921
|
scope.attached = attached;
|
@@ -1923,11 +1927,9 @@ window.CustomElements.addModule(function(scope) {
|
|
1923
1927
|
function upgrade(node, isAttached) {
|
1924
1928
|
if (!node.__upgraded__ && node.nodeType === Node.ELEMENT_NODE) {
|
1925
1929
|
var is = node.getAttribute("is");
|
1926
|
-
var definition = scope.getRegisteredDefinition(
|
1930
|
+
var definition = scope.getRegisteredDefinition(node.localName) || scope.getRegisteredDefinition(is);
|
1927
1931
|
if (definition) {
|
1928
|
-
if (is && definition.tag == node.localName) {
|
1929
|
-
return upgradeWithDefinition(node, definition, isAttached);
|
1930
|
-
} else if (!is && !definition.extends) {
|
1932
|
+
if (is && definition.tag == node.localName || !is && !definition.extends) {
|
1931
1933
|
return upgradeWithDefinition(node, definition, isAttached);
|
1932
1934
|
}
|
1933
1935
|
}
|
@@ -2221,6 +2223,7 @@ window.CustomElements.addModule(function(scope) {
|
|
2221
2223
|
initializeModules();
|
2222
2224
|
}
|
2223
2225
|
var upgradeDocumentTree = scope.upgradeDocumentTree;
|
2226
|
+
var upgradeDocument = scope.upgradeDocument;
|
2224
2227
|
if (!window.wrap) {
|
2225
2228
|
if (window.ShadowDOMPolyfill) {
|
2226
2229
|
window.wrap = window.ShadowDOMPolyfill.wrapIfNeeded;
|
@@ -2231,22 +2234,26 @@ window.CustomElements.addModule(function(scope) {
|
|
2231
2234
|
};
|
2232
2235
|
}
|
2233
2236
|
}
|
2237
|
+
if (window.HTMLImports) {
|
2238
|
+
window.HTMLImports.__importsParsingHook = function(elt) {
|
2239
|
+
if (elt.import) {
|
2240
|
+
upgradeDocument(wrap(elt.import));
|
2241
|
+
}
|
2242
|
+
};
|
2243
|
+
}
|
2234
2244
|
function bootstrap() {
|
2235
2245
|
upgradeDocumentTree(window.wrap(document));
|
2236
|
-
if (window.HTMLImports) {
|
2237
|
-
window.HTMLImports.__importsParsingHook = function(elt) {
|
2238
|
-
upgradeDocumentTree(window.wrap(elt.import));
|
2239
|
-
};
|
2240
|
-
}
|
2241
2246
|
window.CustomElements.ready = true;
|
2242
|
-
|
2243
|
-
|
2244
|
-
|
2245
|
-
|
2246
|
-
|
2247
|
-
|
2248
|
-
|
2249
|
-
|
2247
|
+
requestAnimationFrame(function() {
|
2248
|
+
setTimeout(function() {
|
2249
|
+
window.CustomElements.readyTime = Date.now();
|
2250
|
+
if (window.HTMLImports) {
|
2251
|
+
window.CustomElements.elapsed = window.CustomElements.readyTime - window.HTMLImports.readyTime;
|
2252
|
+
}
|
2253
|
+
document.dispatchEvent(new CustomEvent("WebComponentsReady", {
|
2254
|
+
bubbles: true
|
2255
|
+
}));
|
2256
|
+
});
|
2250
2257
|
});
|
2251
2258
|
}
|
2252
2259
|
if (isIE11OrOlder && typeof window.CustomEvent !== "function") {
|
@@ -2279,16 +2286,44 @@ window.CustomElements.addModule(function(scope) {
|
|
2279
2286
|
if (typeof HTMLTemplateElement === "undefined") {
|
2280
2287
|
(function() {
|
2281
2288
|
var TEMPLATE_TAG = "template";
|
2289
|
+
var contentDoc = document.implementation.createHTMLDocument("template");
|
2290
|
+
var canDecorate = true;
|
2282
2291
|
HTMLTemplateElement = function() {};
|
2283
2292
|
HTMLTemplateElement.prototype = Object.create(HTMLElement.prototype);
|
2284
2293
|
HTMLTemplateElement.decorate = function(template) {
|
2285
2294
|
if (!template.content) {
|
2286
|
-
template.content =
|
2295
|
+
template.content = contentDoc.createDocumentFragment();
|
2287
2296
|
}
|
2288
2297
|
var child;
|
2289
2298
|
while (child = template.firstChild) {
|
2290
2299
|
template.content.appendChild(child);
|
2291
2300
|
}
|
2301
|
+
if (canDecorate) {
|
2302
|
+
try {
|
2303
|
+
Object.defineProperty(template, "innerHTML", {
|
2304
|
+
get: function() {
|
2305
|
+
var o = "";
|
2306
|
+
for (var e = this.content.firstChild; e; e = e.nextSibling) {
|
2307
|
+
o += e.outerHTML || escapeData(e.data);
|
2308
|
+
}
|
2309
|
+
return o;
|
2310
|
+
},
|
2311
|
+
set: function(text) {
|
2312
|
+
contentDoc.body.innerHTML = text;
|
2313
|
+
HTMLTemplateElement.bootstrap(contentDoc);
|
2314
|
+
while (this.content.firstChild) {
|
2315
|
+
this.content.removeChild(this.content.firstChild);
|
2316
|
+
}
|
2317
|
+
while (contentDoc.body.firstChild) {
|
2318
|
+
this.content.appendChild(contentDoc.body.firstChild);
|
2319
|
+
}
|
2320
|
+
},
|
2321
|
+
configurable: true
|
2322
|
+
});
|
2323
|
+
} catch (err) {
|
2324
|
+
canDecorate = false;
|
2325
|
+
}
|
2326
|
+
}
|
2292
2327
|
};
|
2293
2328
|
HTMLTemplateElement.bootstrap = function(doc) {
|
2294
2329
|
var templates = doc.querySelectorAll(TEMPLATE_TAG);
|
@@ -2308,6 +2343,25 @@ if (typeof HTMLTemplateElement === "undefined") {
|
|
2308
2343
|
}
|
2309
2344
|
return el;
|
2310
2345
|
};
|
2346
|
+
var escapeDataRegExp = /[&\u00A0<>]/g;
|
2347
|
+
function escapeReplace(c) {
|
2348
|
+
switch (c) {
|
2349
|
+
case "&":
|
2350
|
+
return "&";
|
2351
|
+
|
2352
|
+
case "<":
|
2353
|
+
return "<";
|
2354
|
+
|
2355
|
+
case ">":
|
2356
|
+
return ">";
|
2357
|
+
|
2358
|
+
case " ":
|
2359
|
+
return " ";
|
2360
|
+
}
|
2361
|
+
}
|
2362
|
+
function escapeData(s) {
|
2363
|
+
return s.replace(escapeDataRegExp, escapeReplace);
|
2364
|
+
}
|
2311
2365
|
})();
|
2312
2366
|
}
|
2313
2367
|
|
@@ -7,7 +7,7 @@
|
|
7
7
|
* Code distributed by Google as part of the polymer project is also
|
8
8
|
* subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
|
9
9
|
*/
|
10
|
-
// @version 0.7.
|
10
|
+
// @version 0.7.11
|
11
11
|
window.WebComponents = window.WebComponents || {};
|
12
12
|
|
13
13
|
(function(scope) {
|
@@ -4694,7 +4694,7 @@ if (WebComponents.flags.shadow) {
|
|
4694
4694
|
}
|
4695
4695
|
}
|
4696
4696
|
};
|
4697
|
-
var selectorRe = /([^{]*)({[\s\S]*?})/gim, cssCommentRe = /\/\*[^*]*\*+([
|
4697
|
+
var selectorRe = /([^{]*)({[\s\S]*?})/gim, cssCommentRe = /\/\*[^*]*\*+([^/*][^*]*\*+)*\//gim, cssCommentNextSelectorRe = /\/\*\s*@polyfill ([^*]*\*+([^/*][^*]*\*+)*\/)([^{]*?){/gim, cssContentNextSelectorRe = /polyfill-next-selector[^}]*content\:[\s]*?['"](.*?)['"][;\s]*}([^{]*?){/gim, cssCommentRuleRe = /\/\*\s@polyfill-rule([^*]*\*+([^/*][^*]*\*+)*)\//gim, cssContentRuleRe = /(polyfill-rule)[^}]*(content\:[\s]*['"](.*?)['"])[;\s]*[^}]*}/gim, cssCommentUnscopedRuleRe = /\/\*\s@polyfill-unscoped-rule([^*]*\*+([^/*][^*]*\*+)*)\//gim, cssContentUnscopedRuleRe = /(polyfill-unscoped-rule)[^}]*(content\:[\s]*['"](.*?)['"])[;\s]*[^}]*}/gim, cssPseudoRe = /::(x-[^\s{,(]*)/gim, cssPartRe = /::part\(([^)]*)\)/gim, polyfillHost = "-shadowcsshost", polyfillHostContext = "-shadowcsscontext", parenSuffix = ")(?:\\((" + "(?:\\([^)(]*\\)|[^)(]*)+?" + ")\\))?([^,{]*)";
|
4698
4698
|
var cssColonHostRe = new RegExp("(" + polyfillHost + parenSuffix, "gim"), cssColonHostContextRe = new RegExp("(" + polyfillHostContext + parenSuffix, "gim"), selectorReSuffix = "([>\\s~+[.,{:][\\s\\S]*)?$", colonHostRe = /\:host/gim, colonHostContextRe = /\:host-context/gim, polyfillHostNoCombinator = polyfillHost + "-no-combinator", polyfillHostRe = new RegExp(polyfillHost, "gim"), polyfillHostContextRe = new RegExp(polyfillHostContext, "gim"), shadowDOMSelectorsRe = [ />>>/g, /::shadow/g, /::content/g, /\/deep\//g, /\/shadow\//g, /\/shadow-deep\//g, /\^\^/g, /\^/g ];
|
4699
4699
|
function stylesToCssText(styles, preserveComments) {
|
4700
4700
|
var cssText = "";
|
@@ -6034,7 +6034,7 @@ window.HTMLImports.addModule(function(scope) {
|
|
6034
6034
|
var IMPORT_SELECTOR = "link[rel=" + IMPORT_LINK_TYPE + "]";
|
6035
6035
|
var importParser = {
|
6036
6036
|
documentSelectors: IMPORT_SELECTOR,
|
6037
|
-
importsSelectors: [ IMPORT_SELECTOR, "link[rel=stylesheet]", "style", "script:not([type])", 'script[type="application/javascript"]', 'script[type="text/javascript"]' ].join(","),
|
6037
|
+
importsSelectors: [ IMPORT_SELECTOR, "link[rel=stylesheet]:not([type])", "style:not([type])", "script:not([type])", 'script[type="application/javascript"]', 'script[type="text/javascript"]' ].join(","),
|
6038
6038
|
map: {
|
6039
6039
|
link: "parseLink",
|
6040
6040
|
script: "parseScript",
|
@@ -6085,6 +6085,7 @@ window.HTMLImports.addModule(function(scope) {
|
|
6085
6085
|
}
|
6086
6086
|
},
|
6087
6087
|
parseImport: function(elt) {
|
6088
|
+
elt.import = elt.__doc;
|
6088
6089
|
if (window.HTMLImports.__importsParsingHook) {
|
6089
6090
|
window.HTMLImports.__importsParsingHook(elt);
|
6090
6091
|
}
|
@@ -6147,6 +6148,8 @@ window.HTMLImports.addModule(function(scope) {
|
|
6147
6148
|
trackElement: function(elt, callback) {
|
6148
6149
|
var self = this;
|
6149
6150
|
var done = function(e) {
|
6151
|
+
elt.removeEventListener("load", done);
|
6152
|
+
elt.removeEventListener("error", done);
|
6150
6153
|
if (callback) {
|
6151
6154
|
callback(e);
|
6152
6155
|
}
|
@@ -6202,7 +6205,7 @@ window.HTMLImports.addModule(function(scope) {
|
|
6202
6205
|
for (var i = 0, l = nodes.length, p = 0, n; i < l && (n = nodes[i]); i++) {
|
6203
6206
|
if (!this.isParsed(n)) {
|
6204
6207
|
if (this.hasResource(n)) {
|
6205
|
-
return nodeIsImport(n) ? this.nextToParseInDoc(n.
|
6208
|
+
return nodeIsImport(n) ? this.nextToParseInDoc(n.__doc, n) : n;
|
6206
6209
|
} else {
|
6207
6210
|
return;
|
6208
6211
|
}
|
@@ -6225,7 +6228,7 @@ window.HTMLImports.addModule(function(scope) {
|
|
6225
6228
|
return this.dynamicElements.indexOf(elt) >= 0;
|
6226
6229
|
},
|
6227
6230
|
hasResource: function(node) {
|
6228
|
-
if (nodeIsImport(node) && node.
|
6231
|
+
if (nodeIsImport(node) && node.__doc === undefined) {
|
6229
6232
|
return false;
|
6230
6233
|
}
|
6231
6234
|
return true;
|
@@ -6299,7 +6302,7 @@ window.HTMLImports.addModule(function(scope) {
|
|
6299
6302
|
}
|
6300
6303
|
this.documents[url] = doc;
|
6301
6304
|
}
|
6302
|
-
elt.
|
6305
|
+
elt.__doc = doc;
|
6303
6306
|
}
|
6304
6307
|
parser.parseNext();
|
6305
6308
|
},
|
@@ -6681,6 +6684,7 @@ window.CustomElements.addModule(function(scope) {
|
|
6681
6684
|
}
|
6682
6685
|
scope.watchShadow = watchShadow;
|
6683
6686
|
scope.upgradeDocumentTree = upgradeDocumentTree;
|
6687
|
+
scope.upgradeDocument = upgradeDocument;
|
6684
6688
|
scope.upgradeSubtree = addedSubtree;
|
6685
6689
|
scope.upgradeAll = addedNode;
|
6686
6690
|
scope.attached = attached;
|
@@ -6692,11 +6696,9 @@ window.CustomElements.addModule(function(scope) {
|
|
6692
6696
|
function upgrade(node, isAttached) {
|
6693
6697
|
if (!node.__upgraded__ && node.nodeType === Node.ELEMENT_NODE) {
|
6694
6698
|
var is = node.getAttribute("is");
|
6695
|
-
var definition = scope.getRegisteredDefinition(
|
6699
|
+
var definition = scope.getRegisteredDefinition(node.localName) || scope.getRegisteredDefinition(is);
|
6696
6700
|
if (definition) {
|
6697
|
-
if (is && definition.tag == node.localName) {
|
6698
|
-
return upgradeWithDefinition(node, definition, isAttached);
|
6699
|
-
} else if (!is && !definition.extends) {
|
6701
|
+
if (is && definition.tag == node.localName || !is && !definition.extends) {
|
6700
6702
|
return upgradeWithDefinition(node, definition, isAttached);
|
6701
6703
|
}
|
6702
6704
|
}
|
@@ -6990,6 +6992,7 @@ window.CustomElements.addModule(function(scope) {
|
|
6990
6992
|
initializeModules();
|
6991
6993
|
}
|
6992
6994
|
var upgradeDocumentTree = scope.upgradeDocumentTree;
|
6995
|
+
var upgradeDocument = scope.upgradeDocument;
|
6993
6996
|
if (!window.wrap) {
|
6994
6997
|
if (window.ShadowDOMPolyfill) {
|
6995
6998
|
window.wrap = window.ShadowDOMPolyfill.wrapIfNeeded;
|
@@ -7000,22 +7003,26 @@ window.CustomElements.addModule(function(scope) {
|
|
7000
7003
|
};
|
7001
7004
|
}
|
7002
7005
|
}
|
7006
|
+
if (window.HTMLImports) {
|
7007
|
+
window.HTMLImports.__importsParsingHook = function(elt) {
|
7008
|
+
if (elt.import) {
|
7009
|
+
upgradeDocument(wrap(elt.import));
|
7010
|
+
}
|
7011
|
+
};
|
7012
|
+
}
|
7003
7013
|
function bootstrap() {
|
7004
7014
|
upgradeDocumentTree(window.wrap(document));
|
7005
|
-
if (window.HTMLImports) {
|
7006
|
-
window.HTMLImports.__importsParsingHook = function(elt) {
|
7007
|
-
upgradeDocumentTree(window.wrap(elt.import));
|
7008
|
-
};
|
7009
|
-
}
|
7010
7015
|
window.CustomElements.ready = true;
|
7011
|
-
|
7012
|
-
|
7013
|
-
|
7014
|
-
|
7015
|
-
|
7016
|
-
|
7017
|
-
|
7018
|
-
|
7016
|
+
requestAnimationFrame(function() {
|
7017
|
+
setTimeout(function() {
|
7018
|
+
window.CustomElements.readyTime = Date.now();
|
7019
|
+
if (window.HTMLImports) {
|
7020
|
+
window.CustomElements.elapsed = window.CustomElements.readyTime - window.HTMLImports.readyTime;
|
7021
|
+
}
|
7022
|
+
document.dispatchEvent(new CustomEvent("WebComponentsReady", {
|
7023
|
+
bubbles: true
|
7024
|
+
}));
|
7025
|
+
});
|
7019
7026
|
});
|
7020
7027
|
}
|
7021
7028
|
if (isIE11OrOlder && typeof window.CustomEvent !== "function") {
|
@@ -7088,35 +7095,6 @@ window.CustomElements.addModule(function(scope) {
|
|
7088
7095
|
};
|
7089
7096
|
}();
|
7090
7097
|
}
|
7091
|
-
var elementDeclarations = [];
|
7092
|
-
var polymerStub = function(name, dictionary) {
|
7093
|
-
if (typeof name !== "string" && arguments.length === 1) {
|
7094
|
-
Array.prototype.push.call(arguments, document._currentScript);
|
7095
|
-
}
|
7096
|
-
elementDeclarations.push(arguments);
|
7097
|
-
};
|
7098
|
-
window.Polymer = polymerStub;
|
7099
|
-
scope.consumeDeclarations = function(callback) {
|
7100
|
-
scope.consumeDeclarations = function() {
|
7101
|
-
throw "Possible attempt to load Polymer twice";
|
7102
|
-
};
|
7103
|
-
if (callback) {
|
7104
|
-
callback(elementDeclarations);
|
7105
|
-
}
|
7106
|
-
elementDeclarations = null;
|
7107
|
-
};
|
7108
|
-
function installPolymerWarning() {
|
7109
|
-
if (window.Polymer === polymerStub) {
|
7110
|
-
window.Polymer = function() {
|
7111
|
-
throw new Error("You tried to use polymer without loading it first. To " + 'load polymer, <link rel="import" href="' + 'components/polymer/polymer.html">');
|
7112
|
-
};
|
7113
|
-
}
|
7114
|
-
}
|
7115
|
-
if (HTMLImports.useNative) {
|
7116
|
-
installPolymerWarning();
|
7117
|
-
} else {
|
7118
|
-
window.addEventListener("DOMContentLoaded", installPolymerWarning);
|
7119
|
-
}
|
7120
7098
|
})(window.WebComponents);
|
7121
7099
|
|
7122
7100
|
(function(scope) {
|
data/lib/polymer-rails.rb
CHANGED
@@ -1,7 +1,17 @@
|
|
1
|
+
module Polymer
|
2
|
+
module Rails
|
3
|
+
LEGACY_SPROCKETS = Gem::Version.new(Sprockets::VERSION) < Gem::Version.new('3.0.0')
|
4
|
+
end
|
5
|
+
end
|
6
|
+
|
1
7
|
require "sprockets"
|
2
8
|
require "polymer-rails/version"
|
3
9
|
require "polymer-rails/processors/directive_processor"
|
4
|
-
|
10
|
+
if Polymer::Rails::LEGACY_SPROCKETS
|
11
|
+
require "polymer-rails/processors/components_processor_v2"
|
12
|
+
else
|
13
|
+
require "polymer-rails/processors/components_processor_v3"
|
14
|
+
end
|
5
15
|
require "polymer-rails/helpers/asset_tag_helper"
|
6
16
|
require "polymer-rails/engine" if defined?(::Rails)
|
7
17
|
require "polymer-rails/railtie" if defined?(::Rails)
|
@@ -1,13 +1,6 @@
|
|
1
|
-
require 'polymer-rails/component'
|
2
|
-
|
3
1
|
module Polymer
|
4
2
|
module Rails
|
5
|
-
|
6
|
-
|
7
|
-
def initialize(context, data)
|
8
|
-
@context = context
|
9
|
-
@component = Component.new(data)
|
10
|
-
end
|
3
|
+
module ComponentsProcessor
|
11
4
|
|
12
5
|
def process
|
13
6
|
inline_styles
|
@@ -61,7 +54,6 @@ module Polymer
|
|
61
54
|
def find_asset(asset_path)
|
62
55
|
::Rails.application.assets.find_asset(asset_path)
|
63
56
|
end
|
64
|
-
|
65
57
|
end
|
66
58
|
end
|
67
59
|
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
require 'polymer-rails/component'
|
2
|
+
require 'polymer-rails/processors/components_processor'
|
3
|
+
|
4
|
+
module Polymer
|
5
|
+
module Rails
|
6
|
+
class ComponentsProcessorV2 < Sprockets::Processor
|
7
|
+
include ::Polymer::Rails::ComponentsProcessor
|
8
|
+
|
9
|
+
def initialize(context, data)
|
10
|
+
@context = context
|
11
|
+
@component = Component.new(data)
|
12
|
+
end
|
13
|
+
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
require 'polymer-rails/component'
|
2
|
+
require 'polymer-rails/processors/components_processor'
|
3
|
+
|
4
|
+
module Polymer
|
5
|
+
module Rails
|
6
|
+
class ComponentsProcessorV3
|
7
|
+
include ::Polymer::Rails::ComponentsProcessor
|
8
|
+
|
9
|
+
def self.instance
|
10
|
+
@instance ||= new
|
11
|
+
end
|
12
|
+
|
13
|
+
def self.call(input)
|
14
|
+
instance.call(input)
|
15
|
+
end
|
16
|
+
|
17
|
+
def call(input)
|
18
|
+
prepare(input)
|
19
|
+
data = process
|
20
|
+
|
21
|
+
@context.metadata.merge(data: data)
|
22
|
+
end
|
23
|
+
|
24
|
+
private
|
25
|
+
|
26
|
+
def prepare(input)
|
27
|
+
@context = input[:environment].context_class.new(input)
|
28
|
+
@component = Component.new(input[:data])
|
29
|
+
end
|
30
|
+
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|