mirror of
https://github.com/jlengrand/webcomponentsjs.git
synced 2026-03-10 08:51:22 +00:00
Merge pull request #690 from webcomponents/split-shadycss
fix ShadyCSS entrypoint, load ScopingShim
This commit is contained in:
@@ -17,10 +17,5 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
||||
import '../bower_components/html-imports/src/html-imports.js'
|
||||
import '../bower_components/custom-elements/custom-elements.min.js'
|
||||
|
||||
// TODO(notwaldorf): Remove after this is addressed:
|
||||
// https://github.com/webcomponents/shadycss/issues/46
|
||||
import '../bower_components/shadycss/src/ShadyCSS.js'
|
||||
import '../bower_components/shadycss/src/custom-style-element.js'
|
||||
|
||||
import '../src/post-polyfill.js'
|
||||
import '../src/unresolved.js'
|
||||
|
||||
@@ -16,10 +16,5 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
||||
|
||||
import '../bower_components/html-imports/src/html-imports.js'
|
||||
|
||||
// TODO(notwaldorf): Remove after this is addressed:
|
||||
// https://github.com/webcomponents/shadycss/issues/46
|
||||
import '../bower_components/shadycss/src/ShadyCSS.js'
|
||||
import '../bower_components/shadycss/src/custom-style-element.js'
|
||||
|
||||
import '../src/post-polyfill.js'
|
||||
import '../src/unresolved.js'
|
||||
|
||||
@@ -17,7 +17,6 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
||||
import '../bower_components/html-imports/src/html-imports.js'
|
||||
import '../bower_components/shadydom/shadydom.min.js'
|
||||
import '../bower_components/custom-elements/custom-elements.min.js'
|
||||
import '../bower_components/shadycss/src/ShadyCSS.js'
|
||||
import '../bower_components/shadycss/src/custom-style-element.js'
|
||||
import '../bower_components/shadycss/entrypoints/scoping-shim.js'
|
||||
import '../src/post-polyfill.js'
|
||||
import '../src/unresolved.js'
|
||||
|
||||
@@ -22,7 +22,6 @@ import '../bower_components/html-imports/src/html-imports.js'
|
||||
import '../src/pre-polyfill.js'
|
||||
import '../bower_components/shadydom/shadydom.min.js'
|
||||
import '../bower_components/custom-elements/custom-elements.min.js'
|
||||
import '../bower_components/shadycss/src/ShadyCSS.js'
|
||||
import '../bower_components/shadycss/src/custom-style-element.js'
|
||||
import '../bower_components/shadycss/entrypoints/scoping-shim.js'
|
||||
import '../src/post-polyfill.js'
|
||||
import '../src/unresolved.js'
|
||||
|
||||
@@ -1,22 +0,0 @@
|
||||
/**
|
||||
@license
|
||||
Copyright (c) 2017 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
|
||||
*/
|
||||
'use strict';
|
||||
|
||||
/*
|
||||
* Polyfills loaded: None
|
||||
* Used in: Chrome
|
||||
*/
|
||||
|
||||
// TODO: This needs to not exist at all.
|
||||
|
||||
// TODO(notwaldorf): Remove after this is addressed:
|
||||
// https://github.com/webcomponents/shadycss/issues/46
|
||||
import '../bower_components/shadycss/src/ShadyCSS.js'
|
||||
import '../bower_components/shadycss/src/custom-style-element.js'
|
||||
@@ -16,5 +16,4 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
||||
|
||||
import '../bower_components/shadydom/shadydom.min.js'
|
||||
import '../bower_components/custom-elements/custom-elements.min.js'
|
||||
import '../bower_components/shadycss/src/ShadyCSS.js'
|
||||
import '../bower_components/shadycss/src/custom-style-element.js'
|
||||
import '../bower_components/shadycss/entrypoints/scoping-shim.js'
|
||||
|
||||
@@ -63,10 +63,6 @@ function minify(sourceName, fileName, needsContext) {
|
||||
.pipe(gulp.dest('./'))
|
||||
}
|
||||
|
||||
gulp.task('minify-none', () => {
|
||||
return minify('webcomponents-none')
|
||||
});
|
||||
|
||||
gulp.task('minify-hi', () => {
|
||||
return minify('webcomponents-hi')
|
||||
});
|
||||
@@ -100,4 +96,4 @@ gulp.task('default', (cb) => {
|
||||
runseq('refresh-bower', 'build', cb);
|
||||
});
|
||||
|
||||
gulp.task('build', ['minify-none', 'minify-hi', 'minify-hi-ce', 'minify-hi-sd-ce', 'minify-hi-sd-ce-pf', 'minify-sd-ce']);
|
||||
gulp.task('build', ['minify-hi', 'minify-hi-ce', 'minify-hi-sd-ce', 'minify-hi-sd-ce-pf', 'minify-sd-ce']);
|
||||
|
||||
@@ -18,14 +18,18 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
||||
<slot id="slot"></slot>
|
||||
`;
|
||||
if (template) {
|
||||
window.ShadyCSS.prepareTemplate(template, 'simple-element');
|
||||
if (window.ShadyCSS) {
|
||||
window.ShadyCSS.prepareTemplate(template, 'simple-element');
|
||||
}
|
||||
}
|
||||
|
||||
class SimpleElement extends HTMLElement {
|
||||
constructor() {
|
||||
super();
|
||||
this.bestName = 'batman';
|
||||
window.ShadyCSS.applyStyle(this);
|
||||
if (window.ShadyCSS) {
|
||||
window.ShadyCSS.styleElement(this);
|
||||
}
|
||||
|
||||
if (template && !this.shadowRoot) {
|
||||
this.attachShadow({mode: 'open'});
|
||||
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -24,12 +24,7 @@
|
||||
polyfills.push('pf');
|
||||
}
|
||||
|
||||
// TODO(notwaldorf): This is a temporary hack because Chrome still needs to
|
||||
// load some things for now. Addressing this is blocked on
|
||||
// https://github.com/webcomponents/shadycss/issues/46.
|
||||
if (!polyfills.length) {
|
||||
polyfills.push('none');
|
||||
} else if (polyfills.length === 4) { // hi-ce-sd-pf is actually called lite.
|
||||
if (polyfills.length === 4) { // hi-ce-sd-pf is actually called lite.
|
||||
polyfills = ['lite'];
|
||||
}
|
||||
|
||||
@@ -41,14 +36,10 @@
|
||||
'webcomponents-loader.js', `webcomponents-${polyfills.join('-')}.js`);
|
||||
newScript.src = url;
|
||||
document.head.appendChild(newScript);
|
||||
}
|
||||
// Ensure `WebComponentsReady` is fired also when there are no polyfills loaded.
|
||||
// TODO(valdrin): only check for `!polyfills.length` once 'none' bundle
|
||||
// is removed. Addressing this is blocked on
|
||||
// https://github.com/webcomponents/shadycss/issues/46.
|
||||
if (polyfills[0] === 'none') {
|
||||
} else {
|
||||
// Ensure `WebComponentsReady` is fired also when there are no polyfills loaded.
|
||||
requestAnimationFrame(function() {
|
||||
window.dispatchEvent(new CustomEvent('WebComponentsReady'));
|
||||
});
|
||||
}
|
||||
})();
|
||||
})();
|
||||
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user