mirror of
https://github.com/Polymer/polymer.git
synced 2025-02-25 18:55:30 -06:00
Merge branch 'master' into 5262-kschaaf-legacy-undefined-3.x
This commit is contained in:
@@ -14,7 +14,7 @@ before_script:
|
||||
script:
|
||||
- npm run generate-types
|
||||
- node ./node_modules/.bin/polymer test --npm --module-resolution=node -l chrome
|
||||
- node ./node_modules/.bin/polymer test --npm --module-resolution=node -l firefox
|
||||
- xvfb-run node ./node_modules/.bin/polymer test --npm --module-resolution=node -l firefox
|
||||
- if [ "${TRAVIS_PULL_REQUEST}" = "false" ]; then travis_wait 30 ./util/travis-sauce-test.sh; fi
|
||||
env:
|
||||
global:
|
||||
|
||||
17
gulpfile.js
17
gulpfile.js
@@ -115,16 +115,6 @@ gulp.task('generate-externs', gulp.series('clean', async () => {
|
||||
await fs.writeFile('externs/closure-types.js', `${header}${declarations}`);
|
||||
}));
|
||||
|
||||
gulp.task('generate-typescript', async () => {
|
||||
let genTs = require('@polymer/gen-typescript-declarations').generateDeclarations;
|
||||
await del(['**/*.d.ts', '!interfaces.d.ts', '!node_modules/**']);
|
||||
const config = await fs.readJson(path.join(__dirname, 'gen-tsd.json'));
|
||||
const files = await genTs(__dirname, config);
|
||||
for (const [filePath, contents] of files) {
|
||||
await fs.outputFile(path.join(__dirname, filePath), contents);
|
||||
}
|
||||
});
|
||||
|
||||
const runClosureOnly = ({lintOnly}) => () => {
|
||||
let entry, splitRx, joinRx, addClosureTypes;
|
||||
|
||||
@@ -274,10 +264,9 @@ gulp.task('lint-eslint', function() {
|
||||
gulp.task('lint', gulp.series('lint-eslint'));
|
||||
|
||||
// TODO(timvdlippe): Add back `'generate-externs',` once we can generate externs again
|
||||
gulp.task('generate-types', gulp.series('generate-typescript'));
|
||||
|
||||
gulp.task('update-version', () => {
|
||||
return gulp.src('lib/utils/boot.js')
|
||||
.pipe(replace(/(window.Polymer.version = )'\d+\.\d+\.\d+'/, `$1'${require('./package.json').version}'`))
|
||||
.pipe(gulp.dest('lib/utils'));
|
||||
return gulp.src('lib/mixins/element-mixin.js')
|
||||
.pipe(replace(/(export const version = )'\d+\.\d+\.\d+'/, `$1'${require('./package.json').version}'`))
|
||||
.pipe(gulp.dest('lib/mixins'));
|
||||
});
|
||||
|
||||
@@ -14,12 +14,25 @@ import { strictTemplatePolicy } from '../utils/settings.js';
|
||||
|
||||
let modules = {};
|
||||
let lcModules = {};
|
||||
/**
|
||||
* Sets a dom-module into the global registry by id.
|
||||
*
|
||||
* @param {string} id dom-module id
|
||||
* @param {DomModule} module dom-module instance
|
||||
* @return {void}
|
||||
*/
|
||||
function setModule(id, module) {
|
||||
// store id separate from lowercased id so that
|
||||
// in all cases mixedCase id will stored distinctly
|
||||
// and lowercase version is a fallback
|
||||
modules[id] = lcModules[id.toLowerCase()] = module;
|
||||
}
|
||||
/**
|
||||
* Retrieves a dom-module from the global registry by id.
|
||||
*
|
||||
* @param {string} id dom-module id
|
||||
* @return {DomModule!} dom-module instance
|
||||
*/
|
||||
function findModule(id) {
|
||||
return modules[id] || lcModules[id.toLowerCase()];
|
||||
}
|
||||
@@ -133,7 +146,7 @@ export class DomModule extends HTMLElement {
|
||||
id = id || this.id;
|
||||
if (id) {
|
||||
// Under strictTemplatePolicy, reject and null out any re-registered
|
||||
// dom-module since it is ambiguous whether first-in or last-in is trusted
|
||||
// dom-module since it is ambiguous whether first-in or last-in is trusted
|
||||
if (strictTemplatePolicy && findModule(id) !== undefined) {
|
||||
setModule(id, null);
|
||||
throw new Error(`strictTemplatePolicy: dom-module ${id} re-registered`);
|
||||
|
||||
@@ -18,6 +18,12 @@ import { PropertyEffects } from './property-effects.js';
|
||||
import { PropertiesMixin } from './properties-mixin.js';
|
||||
import { strictTemplatePolicy, allowTemplateFromDomModule } from '../utils/settings.js';
|
||||
|
||||
/**
|
||||
* Current Polymer version in Semver notation.
|
||||
* @type {string} Semver notation of the current version of Polymer.
|
||||
*/
|
||||
export const version = '3.0.5';
|
||||
|
||||
/**
|
||||
* Element class mixin that provides the core API for Polymer's meta-programming
|
||||
* features including template stamping, data-binding, attribute deserialization,
|
||||
@@ -302,6 +308,14 @@ export const ElementMixin = dedupingMixin(base => {
|
||||
*/
|
||||
class PolymerElement extends polymerElementBase {
|
||||
|
||||
/**
|
||||
* Current Polymer version in Semver notation.
|
||||
* @type {string} Semver notation of the current version of Polymer.
|
||||
*/
|
||||
static get polymerElementVersion() {
|
||||
return version;
|
||||
}
|
||||
|
||||
/**
|
||||
* Override of PropertiesMixin _finalizeClass to create observers and
|
||||
* find the template.
|
||||
|
||||
@@ -15,7 +15,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
||||
*
|
||||
* @param {string} prop Property name
|
||||
* @param {?Object} obj Reference object
|
||||
* @return {string} Dereferenced value
|
||||
* @return {string} Potentially renamed property name
|
||||
*/
|
||||
window.JSCompiler_renameProperty = function(prop, obj) {
|
||||
return prop;
|
||||
|
||||
@@ -76,7 +76,7 @@ export class Debouncer {
|
||||
* called once. Add this method to a custom element:
|
||||
*
|
||||
* ```js
|
||||
* import {microtask} from '@polymer/polymer/lib/utils/async.js';
|
||||
* import {microTask} from '@polymer/polymer/lib/utils/async.js';
|
||||
* import {Debouncer} from '@polymer/polymer/lib/utils/debounce.js';
|
||||
* // ...
|
||||
*
|
||||
|
||||
@@ -52,7 +52,7 @@ export const setRootPath = function(path) {
|
||||
*
|
||||
* @type {(function(*,string,string,Node):*)|undefined}
|
||||
*/
|
||||
export let sanitizeDOMValue = undefined;
|
||||
export let sanitizeDOMValue = window.Polymer && window.Polymer.sanitizeDOMValue || undefined;
|
||||
|
||||
/**
|
||||
* Sets the global sanitizeDOMValue available via this module's exported
|
||||
@@ -65,7 +65,6 @@ export const setSanitizeDOMValue = function(newSanitizeDOMValue) {
|
||||
sanitizeDOMValue = newSanitizeDOMValue;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Globally settable property to make Polymer Gestures use passive TouchEvent listeners when recognizing gestures.
|
||||
* When set to `true`, gestures made from touch will not be able to prevent scrolling, allowing for smoother
|
||||
|
||||
@@ -170,6 +170,7 @@ class TemplateInstanceBase extends base {
|
||||
/**
|
||||
* Override point for adding custom or simulated event handling.
|
||||
*
|
||||
* @override
|
||||
* @param {!Node} node Node to add event listener to
|
||||
* @param {string} eventName Name of event
|
||||
* @param {function(!Event):void} handler Listener function to add
|
||||
@@ -247,6 +248,7 @@ class TemplateInstanceBase extends base {
|
||||
* textContent bindings while children are "hidden" and cache in
|
||||
* private storage for later retrieval.
|
||||
*
|
||||
* @override
|
||||
* @param {!Node} node The node to set a property on
|
||||
* @param {string} prop The property to set
|
||||
* @param {*} value The value to set
|
||||
|
||||
4646
package-lock.json
generated
4646
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -9,7 +9,7 @@
|
||||
},
|
||||
"devDependencies": {
|
||||
"@polymer/gen-closure-declarations": "^0.4.0",
|
||||
"@polymer/gen-typescript-declarations": "^1.4.0",
|
||||
"@polymer/gen-typescript-declarations": "^1.5.0",
|
||||
"@polymer/iron-component-page": "^3.0.0-pre.12",
|
||||
"@polymer/test-fixture": "^3.0.0-pre.12",
|
||||
"@webcomponents/webcomponentsjs": "^2.0.3",
|
||||
@@ -41,8 +41,7 @@
|
||||
"test": "npm run lint && polymer test --npm --module-resolution=node",
|
||||
"serve": "polymer serve --npm --module-resolution=node",
|
||||
"lint": "gulp lint",
|
||||
"generate-types": "gulp generate-types && npm run verify-types",
|
||||
"verify-types": "tsc --project verify-types-tsconfig.json",
|
||||
"generate-types": "gen-typescript-declarations --outDir . --deleteExisting --verify",
|
||||
"regen-package-lock": "rm -rf node_modules package-lock.json; npm install",
|
||||
"prepack": "npm run generate-types"
|
||||
},
|
||||
|
||||
@@ -9,6 +9,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
|
||||
*/
|
||||
|
||||
import { ElementMixin } from './lib/mixins/element-mixin.js';
|
||||
export { version } from './lib/mixins/element-mixin.js';
|
||||
export { html } from './lib/utils/html-tag.js';
|
||||
|
||||
/**
|
||||
@@ -27,4 +28,3 @@ export { html } from './lib/utils/html-tag.js';
|
||||
* attribute deserialization, and property change observation
|
||||
*/
|
||||
export const PolymerElement = ElementMixin(HTMLElement);
|
||||
|
||||
|
||||
@@ -417,6 +417,9 @@ suite('class extends Polymer.Element', function() {
|
||||
assert.equal(fixtureEl.getAttribute('prop'), 'propValue');
|
||||
});
|
||||
|
||||
test('version', function() {
|
||||
assert.isOk(el.constructor.polymerElementVersion);
|
||||
});
|
||||
});
|
||||
|
||||
suite('subclass', function() {
|
||||
|
||||
@@ -1,12 +0,0 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"target": "es6",
|
||||
"moduleResolution": "node",
|
||||
"strict": true,
|
||||
"pretty": true,
|
||||
"lib": [
|
||||
"dom",
|
||||
"es2017"
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -10,9 +10,6 @@
|
||||
"headless",
|
||||
"disable-gpu",
|
||||
"no-sandbox"
|
||||
],
|
||||
"firefox": [
|
||||
"-headless"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user