Merge with master

This commit is contained in:
Kevin Schaaf
2017-12-05 15:49:07 -08:00
parent ad539fe725
commit b158e082d0
32 changed files with 1714 additions and 826 deletions
+4 -2
View File
@@ -19,9 +19,11 @@
"Boolean": "boolean",
"Number": "number",
"String": "string",
"object": "Object"
"object": "Object",
"array": "Array"
}
}]
}],
"no-useless-escape": "off"
},
"env": {
"browser": true,
+96
View File
@@ -1,5 +1,101 @@
# Change Log
## [v2.3.0](https://github.com/Polymer/polymer/tree/v2.3.0) (2017-12-05)
- [ci skip] update changelog ([commit](https://github.com/Polymer/polymer/commit/c727d35d))
## [v2.2.1](https://github.com/Polymer/polymer/tree/v2.2.1) (2017-12-05)
- [ci skip] commit new version in lib/utils/boot.html when using npm version ([commit](https://github.com/Polymer/polymer/commit/71fbf6ef))
- change PolymerElement extern to var ([commit](https://github.com/Polymer/polymer/commit/5c3d58aa))
- update node devDependencies ([commit](https://github.com/Polymer/polymer/commit/a39f3f41))
- fix lint error ([commit](https://github.com/Polymer/polymer/commit/f242e197))
- Fix :dir selectors with nested custom elements ([commit](https://github.com/Polymer/polymer/commit/3b76e86f))
- Update test to be more descriptive ([commit](https://github.com/Polymer/polymer/commit/86a64b6c))
- Annotate Polymer function with @global. (#4967) ([commit](https://github.com/Polymer/polymer/commit/b124b707))
- make PASSIVE_TOUCH take an argument ([commit](https://github.com/Polymer/polymer/commit/c5407a8b))
- Do not set touchend listeners to passive ([commit](https://github.com/Polymer/polymer/commit/84fa3bf3))
- Add some @function annotations to APIs that are defined by assignment. ([commit](https://github.com/Polymer/polymer/commit/29f2a0e7))
- add return jsdoc to void functions ([commit](https://github.com/Polymer/polymer/commit/a8105e55))
- Update CONTRIBUTING.md ([commit](https://github.com/Polymer/polymer/commit/14fd53c3))
- Fix typo. ([commit](https://github.com/Polymer/polymer/commit/581483f2))
- Comment reworded based on feedback. ([commit](https://github.com/Polymer/polymer/commit/80a7f1e5))
- Semantic issue (proposal) plus minor fixes ([commit](https://github.com/Polymer/polymer/commit/42ec14bf))
- Depend on webcomponents and shadycss with shady-unscoped support ([commit](https://github.com/Polymer/polymer/commit/8241b887))
- Also clarify `delay` units. Fixes #4707 ([commit](https://github.com/Polymer/polymer/commit/348ed92c))
- Ensure re-sort/filter always happens after array item set. Fixes #3626 ([commit](https://github.com/Polymer/polymer/commit/f6d4771c))
- Clarify docs on target-framerate. Fixes #4897 ([commit](https://github.com/Polymer/polymer/commit/c18a5349))
- move test after ([commit](https://github.com/Polymer/polymer/commit/45598302))
- test more permutations ([commit](https://github.com/Polymer/polymer/commit/f03e8d1b))
- Fix missing comma in `Path.translate` JSDoc ([commit](https://github.com/Polymer/polymer/commit/41616c6f))
- fix(bower): standardized version tagging (#4921) ([commit](https://github.com/Polymer/polymer/commit/6e3ae2e5))
- Minor fixes (update URLs) ([commit](https://github.com/Polymer/polymer/commit/8e7024e6))
- add license headers ([commit](https://github.com/Polymer/polymer/commit/518b4699))
- Prep for processing of `shady-unscoped` moving to ShadyCSS ([commit](https://github.com/Polymer/polymer/commit/08c3a02e))
- Implement type change in Polymer.ElementMixin ([commit](https://github.com/Polymer/polymer/commit/cda62d5f))
- instance.$.foo should only give Elements ([commit](https://github.com/Polymer/polymer/commit/4837e4a8))
- Annotate DomApi with @memberof Polymer ([commit](https://github.com/Polymer/polymer/commit/7308d8b6))
- Clarify all elements between changes must apply mixing. Fixes #4914 ([commit](https://github.com/Polymer/polymer/commit/7360f42a))
- add safari 11 to sauce testing ([commit](https://github.com/Polymer/polymer/commit/428ad8c2))
- Fix tests on Firefox. ([commit](https://github.com/Polymer/polymer/commit/9a468335))
- Update externs again. ([commit](https://github.com/Polymer/polymer/commit/1c5b731f))
- Update externs. ([commit](https://github.com/Polymer/polymer/commit/8683b27c))
- Lint fixes ([commit](https://github.com/Polymer/polymer/commit/092b210f))
- Allow style elements to be separate in the element template. ([commit](https://github.com/Polymer/polymer/commit/819652eb))
- Lint fix. ([commit](https://github.com/Polymer/polymer/commit/982d28c6))
- Add support for styles with a `shady-unscoped` attribute ([commit](https://github.com/Polymer/polymer/commit/d77e073e))
- [ci skip] Update CHANGELOG ([commit](https://github.com/Polymer/polymer/commit/314bada5))
- [ci skip] version script did not work as expected ([commit](https://github.com/Polymer/polymer/commit/4265cba1))
- adding test case for 4696 4706 ([commit](https://github.com/Polymer/polymer/commit/939ce63c))
- Support property observers which are direct function references in addition to strings. Provides better static analysis and refactoring support in multiple tools. Alleviates the need for property reflection with Closure-compiler renaming. ([commit](https://github.com/Polymer/polymer/commit/4bae2b62))
- removing package-lock.json from PR ([commit](https://github.com/Polymer/polymer/commit/0da00a1d))
- implementing the code review suggestions ([commit](https://github.com/Polymer/polymer/commit/1b51f601))
- Updating deserialize function (use of ternary operation). Fixes #4696 ([commit](https://github.com/Polymer/polymer/commit/ca139ed0))
- Updating deserialize function. Fixes #4696 ([commit](https://github.com/Polymer/polymer/commit/277ca89a))
## [v2.2.0](https://github.com/Polymer/polymer/tree/v2.2.0) (2017-10-18)
- [ci skip] Autoupdate version when releasing ([commit](https://github.com/Polymer/polymer/commit/d893d6ae))
+2 -1
View File
@@ -96,9 +96,10 @@ PolymerTelemetry.dumpRegistrations;;
/** @type {PolymerTelemetry} */
Polymer.telemetry;
// nb. This is explicitly 'var', as Closure Compiler checks that this is the case.
/**
* @constructor
* @extends {HTMLElement}
* @implements {Polymer_LegacyElementMixin}
*/
let PolymerElement = Polymer.LegacyElementMixin();
var PolymerElement = Polymer.LegacyElementMixin();
+4
View File
@@ -269,6 +269,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
* Deselects the given item if it is already selected.
*
* @param {*} item Item from `items` array to deselect
* @return {void}
*/
deselect(item) {
let idx = this.__selectedMap.get(item);
@@ -291,6 +292,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
* Deselects the given index if it is already selected.
*
* @param {number} idx Index from `items` array to deselect
* @return {void}
*/
deselectIndex(idx) {
this.deselect(this.items[idx]);
@@ -301,6 +303,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
* deselect the item if already selected.
*
* @param {*} item Item from `items` array to select
* @return {void}
*/
select(item) {
this.selectIndex(this.items.indexOf(item));
@@ -311,6 +314,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
* deselect the item if already selected.
*
* @param {number} idx Index from `items` array to select
* @return {void}
*/
selectIndex(idx) {
let item = this.items[idx];
+1
View File
@@ -90,6 +90,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
/**
* Forces the element to render its content. This is typically only
* necessary to call if HTMLImports with the async attribute are used.
* @return {void}
*/
render() {
let template;
+1
View File
@@ -140,6 +140,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
* that multiple changes trigger only a single render. The render method
* should be called if, for example, template rendering is required to
* validate application state.
* @return {void}
*/
render() {
Polymer.flush();
+1
View File
@@ -110,6 +110,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
* when a dom-module is imperatively created. For
* example, `document.createElement('dom-module').register('foo')`.
* @param {string=} id The id at which to register the dom-module.
* @return {void}
*/
register(id) {
id = id || this.id;
+1
View File
@@ -496,6 +496,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
* that multiple changes trigger only a single render. The render method
* should be called if, for example, template rendering is required to
* validate application state.
* @return {void}
*/
render() {
// Queue this repeater, then flush all in order
+11
View File
@@ -250,6 +250,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
* @param {string} property Property name to reflect.
* @param {string=} attribute Attribute name to reflect.
* @param {*=} value Property value to reflect.
* @return {void}
*/
reflectPropertyToAttribute(property, attribute, value) {
this._propertyToAttribute(property, attribute, value);
@@ -264,6 +265,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
* @param {*} value Value to serialize.
* @param {string} attribute Attribute name to serialize to.
* @param {Element} node Element to set attribute to.
* @return {void}
*/
serializeValueToAttribute(value, attribute, node) {
this._valueToNodeAttribute(/** @type {Element} */ (node || this), value, attribute);
@@ -382,6 +384,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
* @param {Element} node Element to add event listener to.
* @param {string} eventName Name of event to listen for.
* @param {string} methodName Name of handler method on `this` to call.
* @return {void}
*/
listen(node, eventName, methodName) {
node = /** @type {!Element} */ (node || this);
@@ -407,6 +410,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
* @param {string} eventName Name of event to stop listening to.
* @param {string} methodName Name of handler method on `this` to not call
anymore.
* @return {void}
*/
unlisten(node, eventName, methodName) {
node = /** @type {!Element} */ (node || this);
@@ -432,6 +436,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
* Defaults to `all`.
* @param {Element=} node Element to apply scroll direction setting.
* Defaults to `this`.
* @return {void}
*/
setScrollDirection(direction, node) {
Polymer.Gestures.setTouchAction(/** @type {Element} */ (node || this), DIRECTION_MAP[direction] || 'auto');
@@ -465,6 +470,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
* Force this element to distribute its children to its local dom.
* This should not be necessary as of Polymer 2.0.2 and is provided only
* for backwards compatibility.
* @return {void}
*/
distributeContent() {
if (window.ShadyDOM && this.shadowRoot) {
@@ -677,6 +683,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
* Immediately calls the debouncer `callback` and inactivates it.
*
* @param {string} jobName The name of the debouncer started with `debounce`
* @return {void}
*/
flushDebouncer(jobName) {
this._debouncers = this._debouncers || {};
@@ -690,6 +697,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
* Cancels an active debouncer. The `callback` will not be called.
*
* @param {string} jobName The name of the debouncer started with `debounce`
* @return {void}
*/
cancelDebouncer(jobName) {
this._debouncers = this._debouncers || {};
@@ -721,6 +729,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
*
* @param {number} handle Handle returned from original `async` call to
* cancel.
* @return {void}
*/
cancelAsync(handle) {
handle < 0 ? Polymer.Async.microTask.cancel(~handle) :
@@ -833,6 +842,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
* @param {string} transformText Transform setting.
* @param {Element=} node Element to apply the transform to.
* Defaults to `this`
* @return {void}
*/
transform(transformText, node) {
node = /** @type {Element} */ (node || this);
@@ -849,6 +859,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
* @param {number} z Z offset.
* @param {Element=} node Element to apply the transform to.
* Defaults to `this`.
* @return {void}
*/
translate3d(x, y, z, node) {
node = /** @type {Element} */ (node || this);
+1
View File
@@ -24,6 +24,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
*
* See `Polymer.Class` for details on valid legacy metadata format for `info`.
*
* @global
* @override
* @function Polymer
* @param {!PolymerInit} info Object containing Polymer metadata and functions
+4
View File
@@ -68,6 +68,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
*
* @param {Polymer.FlattenedNodesObserver} observerHandle Observer instance
* to disconnect.
* @return {void}
*/
unobserveNodes(observerHandle) {
observerHandle.disconnect();
@@ -75,6 +76,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
/**
* Provided as a backwards-compatible API only. This method does nothing.
* @return {void}
*/
notifyObserver() {}
@@ -196,9 +198,11 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
function forwardMethods(proto, methods) {
for (let i=0; i < methods.length; i++) {
let method = methods[i];
/* eslint-disable valid-jsdoc */
proto[method] = /** @this {DomApi} */ function() {
return this.node[method].apply(this.node, arguments);
};
/* eslint-enable */
}
}
+1
View File
@@ -100,6 +100,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
* @param {boolean=} mutableData When `true`, the generated class will skip
* strict dirty-checking for objects and arrays (always consider them to
* be "dirty"). Defaults to false.
* @return {void}
* @this {TemplatizerUser}
*/
templatize(template, mutableData) {
+1 -1
View File
@@ -16,7 +16,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
const HOST_DIR = /:host\(:dir\((ltr|rtl)\)\)/g;
const HOST_DIR_REPLACMENT = ':host([dir="$1"])';
const EL_DIR = /([\s\w#\.\[\]\*]*):dir\((ltr|rtl)\)/g;
const EL_DIR = /([\s\w-#\.\[\]\*]*):dir\((ltr|rtl)\)/g;
const EL_DIR_REPLACMENT = ':host([dir="$2"]) $1';
/**
+5
View File
@@ -198,6 +198,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
* Supported keys:
* @param {Object} allProps Flattened map of all properties defined in this
* element (including inherited properties)
* @return {void}
* @private
*/
function createPropertyFromConfig(proto, name, info, allProps) {
@@ -311,6 +312,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
* @param {Object} dynamicFns Object containing keys for any properties
* that are functions and should trigger the effect when the function
* reference is changed
* @return {void}
* @protected
*/
static createObservers(observers, dynamicFns) {
@@ -470,6 +472,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
* style scoping.
*
* @param {string} is Tag name (or type extension name) for this element
* @return {void}
* @protected
*/
static _finalizeTemplate(is) {
@@ -580,6 +583,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
*
* @param {Object=} properties Bag of custom property key/values to
* apply to this element.
* @return {void}
* @suppress {invalidCasts}
*/
updateStyles(properties) {
@@ -687,6 +691,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
*
* @param {Object=} props Bag of custom property key/values to
* apply to the document.
* @return {void}
*/
Polymer.updateStyles = function(props) {
if (window.ShadyCSS) {
+7
View File
@@ -44,6 +44,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
*
* @param {Object} model Prototype or instance
* @param {string} property Name of property
* @return {void}
* @private
*/
function saveAccessorValue(model, property) {
@@ -117,6 +118,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
* Attribute names are mapped to property names using the `dash-case` to
* `camelCase` convention
*
* @return {void}
*/
static createPropertiesForAttributes() {
let a$ = this.observedAttributes;
@@ -142,6 +144,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
* accessors created for values that already existed on the element
* prototype.
*
* @return {void}
* @protected
*/
_initializeProperties() {
@@ -162,6 +165,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
*
* @param {Object} props Bag of property values that were overwritten
* when creating property accessors.
* @return {void}
* @protected
*/
_initializeProtoProperties(props) {
@@ -178,6 +182,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
*
* @param {string} attribute Name of attribute to ensure is set.
* @param {string} value of the attribute.
* @return {void}
*/
_ensureAttribute(attribute, value) {
const el = /** @type {!HTMLElement} */(this);
@@ -248,6 +253,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
}
break;
case Date:
value = isNaN(value) ? String(value) : Number(value);
outValue = new Date(value);
break;
default:
@@ -271,6 +277,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
* and the user should call `_invalidateProperties` or `_flushProperties`
* for the values to take effect.
* @protected
* @return {void}
*/
_definePropertyAccessor(property, readOnly) {
saveAccessorValue(this, property);
+60 -10
View File
@@ -204,15 +204,16 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
* @param {Object} props Bag of current property changes
* @param {Object} oldProps Bag of previous values for changed properties
* @param {?} info Effect metadata
* @return {void}
* @private
*/
function runObserverEffect(inst, property, props, oldProps, info) {
let fn = inst[info.methodName];
let fn = typeof info.method === "string" ? inst[info.method] : info.method;
let changedProp = info.property;
if (fn) {
fn.call(inst, inst.__data[changedProp], oldProps[changedProp]);
} else if (!info.dynamicFn) {
console.warn('observer method `' + info.methodName + '` not defined');
console.warn('observer method `' + info.method + '` not defined');
}
}
@@ -231,6 +232,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
* @param {Object} props Bag of current property changes
* @param {Object} oldProps Bag of previous values for changed properties
* @param {boolean} hasPaths True with `props` contains one or more paths
* @return {void}
* @private
*/
function runNotifyEffects(inst, notifyProps, props, oldProps, hasPaths) {
@@ -286,6 +288,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
* @param {*} value The value of the changed property
* @param {string | null | undefined} path If a sub-path of this property changed, the path
* that changed (optional).
* @return {void}
* @private
* @suppress {invalidCasts}
*/
@@ -312,6 +315,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
* @param {Object} oldProps Bag of previous values for changed properties
* @param {?} info Effect metadata
* @param {boolean} hasPaths True with `props` contains one or more paths
* @return {void}
* @private
*/
function runNotifyEffect(inst, property, props, oldProps, info, hasPaths) {
@@ -338,6 +342,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
* @param {string} fromProp Child element property that was bound
* @param {string} toPath Host property/path that was bound
* @param {boolean} negate Whether the binding was negated
* @return {void}
* @private
*/
function handleNotification(event, inst, fromProp, toPath, negate) {
@@ -369,6 +374,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
* @param {Object} props Bag of current property changes
* @param {Object} oldProps Bag of previous values for changed properties
* @param {?} info Effect metadata
* @return {void}
* @private
*/
function runReflectEffect(inst, property, props, oldProps, info) {
@@ -393,6 +399,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
* @param {!Object} changedProps Bag of changed properties
* @param {!Object} oldProps Bag of previous values for changed properties
* @param {boolean} hasPaths True with `props` contains one or more paths
* @return {void}
* @private
*/
function runComputedEffects(inst, changedProps, oldProps, hasPaths) {
@@ -418,6 +425,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
* @param {Object} props Bag of current property changes
* @param {Object} oldProps Bag of previous values for changed properties
* @param {?} info Effect metadata
* @return {void}
* @private
*/
function runComputedEffect(inst, property, props, oldProps, info) {
@@ -437,6 +445,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
* @param {!PropertyEffectsType} inst The instance whose props are changing
* @param {string | !Array<(string|number)>} path Path that has changed
* @param {*} value Value of changed path
* @return {void}
* @private
*/
function computeLinkedPaths(inst, path, value) {
@@ -472,6 +481,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
* @param {string=} literal Literal text surrounding binding parts (specified
* only for 'property' bindings, since these must be initialized as part
* of boot-up)
* @return {void}
* @private
*/
function addBinding(constructor, templateInfo, nodeInfo, kind, target, parts, literal) {
@@ -504,6 +514,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
* @param {!Binding} binding Binding metadata
* @param {!BindingPart} part Binding part metadata
* @param {number} index Index into `nodeInfoList` for this node
* @return {void}
*/
function addEffectForBindingPart(constructor, templateInfo, binding, part, index) {
if (!part.literal) {
@@ -545,6 +556,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
* @param {boolean} hasPaths True with `props` contains one or more paths
* @param {Array} nodeList List of nodes associated with `nodeInfoList` template
* metadata
* @return {void}
* @private
*/
function runBindingEffect(inst, path, props, oldProps, info, hasPaths, nodeList) {
@@ -577,6 +589,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
* @param {!Binding} binding Binding metadata
* @param {!BindingPart} part Binding part metadata
* @param {*} value Value to set
* @return {void}
* @private
*/
function applyBindingValue(inst, node, binding, part, value) {
@@ -657,6 +670,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
*
* @param {!PropertyEffectsType} inst Instance that bas been previously bound
* @param {TemplateInfo} templateInfo Template metadata
* @return {void}
* @private
*/
function setupBindings(inst, templateInfo) {
@@ -690,6 +704,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
*
* @param {Node} node Bound node to initialize
* @param {Binding} binding Binding metadata
* @return {void}
* @private
*/
function setupCompoundStorage(node, binding) {
@@ -718,6 +733,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
* @param {Object} node Child element to add listener to
* @param {!PropertyEffectsType} inst Host element instance to handle notification event
* @param {Binding} binding Binding metadata
* @return {void}
* @private
*/
function addNotifyListener(node, inst, binding) {
@@ -745,6 +761,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
* @param {boolean|Object=} dynamicFn Boolean or object map indicating whether
* method names should be included as a dependency to the effect. Note,
* defaults to true if the signature is static (sig.static is true).
* @return {void}
* @private
*/
function createMethodEffect(model, sig, type, effectFn, methodInfo, dynamicFn) {
@@ -1009,6 +1026,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
* @param {Array} array The array the mutations occurred on
* @param {string} path The path to the array that was mutated
* @param {Array} splices Array of splice records
* @return {void}
* @private
*/
function notifySplices(inst, array, path, splices) {
@@ -1031,6 +1049,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
* @param {number} index Index at which the array mutation occurred
* @param {number} addedCount Number of added items
* @param {Array} removed Array of removed items
* @return {void}
* @private
*/
function notifySplice(inst, array, path, index, addedCount, removed) {
@@ -1218,6 +1237,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
* @param {string} property Property that should trigger the effect
* @param {string} type Effect type, from this.PROPERTY_EFFECT_TYPES
* @param {Object=} effect Effect metadata object
* @return {void}
* @protected
*/
_addPropertyEffect(property, type, effect) {
@@ -1236,6 +1256,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
* @param {string} property Property the effect was associated with
* @param {string} type Effect type, from this.PROPERTY_EFFECT_TYPES
* @param {Object=} effect Effect metadata object to remove
* @return {void}
*/
_removePropertyEffect(property, type, effect) {
let effects = ensureOwnEffectMap(this, type)[property];
@@ -1389,6 +1410,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
* @param {Node} node The node to set a property on
* @param {string} prop The property to set
* @param {*} value The value to set
* @return {void}
* @protected
*/
_setUnmanagedPropertyToNode(node, prop, value) {
@@ -1499,6 +1521,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
* `_flushClients`.
*
* @param {Object} client PropertyEffects client to enqueue
* @return {void}
* @protected
*/
_enqueueClient(client) {
@@ -1523,6 +1546,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
* Flushes any clients previously enqueued via `_enqueueClient`, causing
* their `_flushProperties` method to run.
*
* @return {void}
* @protected
*/
_flushClients() {
@@ -1570,6 +1594,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
* `_flushProperties` call on client dom and before any element
* observers are called.
*
* @return {void}
* @protected
*/
_readyClients() {
@@ -1588,6 +1613,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
* @param {boolean=} setReadOnly When true, any private values set in
* `props` will be set. By default, `setProperties` will not set
* `readOnly: true` root properties.
* @return {void}
* @public
*/
setProperties(props, setReadOnly) {
@@ -1679,6 +1705,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
* @param {Object} changedProps Bag of changed properties
* @param {Object} oldProps Bag of previous values for changed properties
* @param {boolean} hasPaths True with `props` contains one or more paths
* @return {void}
* @protected
*/
_propagatePropertyChanges(changedProps, oldProps, hasPaths) {
@@ -1699,6 +1726,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
*
* @param {string | !Array<string|number>} to Target path to link.
* @param {string | !Array<string|number>} from Source path to link.
* @return {void}
* @public
*/
linkPaths(to, from) {
@@ -1715,6 +1743,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
* linking the paths.
*
* @param {string | !Array<string|number>} path Target path to unlink.
* @return {void}
* @public
*/
unlinkPaths(path) {
@@ -1751,6 +1780,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
* Note that splice records _must_ be normalized such that they are
* reported in index order (raw results from `Object.observe` are not
* ordered and must be normalized/merged before notifying).
* @return {void}
* @public
*/
notifySplices(path, splices) {
@@ -1800,6 +1830,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
* @param {*} value Value to set at the specified path.
* @param {Object=} root Root object from which the path is evaluated.
* When specified, no notification will occur.
* @return {void}
* @public
*/
set(path, value, root) {
@@ -1957,6 +1988,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
*
* @param {string} path Path that should be notified.
* @param {*=} value Value at the path (optional).
* @return {void}
* @public
*/
notifyPath(path, value) {
@@ -1986,6 +2018,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
* @param {string} property Property name
* @param {boolean=} protectedSetter Creates a custom protected setter
* when `true`.
* @return {void}
* @protected
*/
_createReadOnlyProperty(property, protectedSetter) {
@@ -2003,19 +2036,20 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
* full API docs.
*
* @param {string} property Property name
* @param {string} methodName Name of observer method to call
* @param {string|function(*,*)} method Function or name of observer method to call
* @param {boolean=} dynamicFn Whether the method name should be included as
* a dependency to the effect.
* @return {void}
* @protected
*/
_createPropertyObserver(property, methodName, dynamicFn) {
let info = { property, methodName, dynamicFn: Boolean(dynamicFn) };
_createPropertyObserver(property, method, dynamicFn) {
let info = { property, method, dynamicFn: Boolean(dynamicFn) };
this._addPropertyEffect(property, TYPES.OBSERVE, {
fn: runObserverEffect, info, trigger: {name: property}
});
if (dynamicFn) {
this._addPropertyEffect(methodName, TYPES.OBSERVE, {
fn: runObserverEffect, info, trigger: {name: methodName}
this._addPropertyEffect(method, TYPES.OBSERVE, {
fn: runObserverEffect, info, trigger: {name: method}
});
}
}
@@ -2028,6 +2062,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
* @param {string} expression Method expression
* @param {boolean|Object=} dynamicFn Boolean or object map indicating
* whether method names should be included as a dependency to the effect.
* @return {void}
* @protected
*/
_createMethodObserver(expression, dynamicFn) {
@@ -2044,6 +2079,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
* full API docs.
*
* @param {string} property Property name
* @return {void}
* @protected
*/
_createNotifyingProperty(property) {
@@ -2062,6 +2098,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
* full API docs.
*
* @param {string} property Property name
* @return {void}
* @protected
*/
_createReflectedProperty(property) {
@@ -2088,6 +2125,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
* @param {string} expression Method expression
* @param {boolean|Object=} dynamicFn Boolean or object map indicating
* whether method names should be included as a dependency to the effect.
* @return {void}
* @protected
*/
_createComputedProperty(property, expression, dynamicFn) {
@@ -2133,6 +2171,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
* @param {string} property Property that should trigger the effect
* @param {string} type Effect type, from this.PROPERTY_EFFECT_TYPES
* @param {Object=} effect Effect metadata object
* @return {void}
* @protected
*/
static addPropertyEffect(property, type, effect) {
@@ -2143,13 +2182,14 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
* Creates a single-property observer for the given property.
*
* @param {string} property Property name
* @param {string} methodName Name of observer method to call
* @param {string|function(*,*)} method Function or name of observer method to call
* @param {boolean=} dynamicFn Whether the method name should be included as
* a dependency to the effect.
* @return {void}
* @protected
*/
static createPropertyObserver(property, methodName, dynamicFn) {
this.prototype._createPropertyObserver(property, methodName, dynamicFn);
static createPropertyObserver(property, method, dynamicFn) {
this.prototype._createPropertyObserver(property, method, dynamicFn);
}
/**
@@ -2161,6 +2201,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
*
* @param {string} expression Method expression
* @param {boolean|Object=} dynamicFn Boolean or object map indicating
* @return {void}
* whether method names should be included as a dependency to the effect.
* @protected
*/
@@ -2173,6 +2214,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
* events to notify of changes to the property.
*
* @param {string} property Property name
* @return {void}
* @protected
*/
static createNotifyingProperty(property) {
@@ -2192,6 +2234,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
* @param {string} property Property name
* @param {boolean=} protectedSetter Creates a custom protected setter
* when `true`.
* @return {void}
* @protected
*/
static createReadOnlyProperty(property, protectedSetter) {
@@ -2203,6 +2246,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
* to a (dash-cased) attribute of the same name.
*
* @param {string} property Property name
* @return {void}
* @protected
*/
static createReflectedProperty(property) {
@@ -2220,6 +2264,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
* @param {string} expression Method expression
* @param {boolean|Object=} dynamicFn Boolean or object map indicating whether
* method names should be included as a dependency to the effect.
* @return {void}
* @protected
*/
static createComputedProperty(property, expression, dynamicFn) {
@@ -2301,6 +2346,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
* @param {Object} templateInfo Template metadata to add effect to
* @param {string} prop Property that should trigger the effect
* @param {Object=} effect Effect metadata object
* @return {void}
* @protected
*/
static _addTemplatePropertyEffect(templateInfo, prop, effect) {
@@ -2364,6 +2410,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
*
* @param {!StampedTemplate} dom DocumentFragment previously returned
* from `_stampTemplate` associated with the nodes to be removed
* @return {void}
* @protected
*/
_removeBoundDom(dom) {
@@ -2675,6 +2722,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
/**
* @param {*} inst Instance to add to hostStack
* @return {void}
* @this {hostStack}
*/
registerHost(inst) {
@@ -2686,6 +2734,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
/**
* @param {*} inst Instance to begin hosting
* @return {void}
* @this {hostStack}
*/
beginHosting(inst) {
@@ -2694,6 +2743,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
/**
* @param {*} inst Instance to end hosting
* @return {void}
* @this {hostStack}
*/
endHosting(inst) {
+3
View File
@@ -254,6 +254,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
* @param {Node} root Root node whose `childNodes` will be parsed
* @param {!TemplateInfo} templateInfo Template metadata for current template
* @param {!NodeInfo} nodeInfo Node metadata for current template.
* @return {void}
*/
static _parseTemplateChildNodes(root, templateInfo, nodeInfo) {
if (root.localName === 'script' || root.localName === 'style') {
@@ -462,6 +463,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
* @param {Node} node Node to add event listener to
* @param {string} eventName Name of event
* @param {Function} handler Listener function to add
* @return {void}
*/
_addEventListenerToNode(node, eventName, handler) {
node.addEventListener(eventName, handler);
@@ -473,6 +475,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
* @param {Node} node Node to remove event listener from
* @param {string} eventName Name of event
* @param {Function} handler Listener function to remove
* @return {void}
*/
_removeEventListenerFromNode(node, eventName, handler) {
node.removeEventListener(eventName, handler);
+4
View File
@@ -93,6 +93,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
* @function
* @memberof Polymer.Async.timeOut
* @param {number} handle Handle returned from `run` of callback to cancel
* @return {void}
*/
cancel(handle) {
window.clearTimeout(handle);
@@ -124,6 +125,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
* @function
* @memberof Polymer.Async.timeOut
* @param {number} handle Handle returned from `run` of callback to cancel
* @return {void}
*/
cancel(handle) {
window.cancelAnimationFrame(handle);
@@ -156,6 +158,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
*
* @memberof Polymer.Async.idlePeriod
* @param {number} handle Handle returned from `run` of callback to cancel
* @return {void}
*/
cancel(handle) {
window.cancelIdleCallback ?
@@ -198,6 +201,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
*
* @memberof Polymer.Async.microTask
* @param {number} handle Handle returned from `run` of callback to cancel
* @return {void}
*/
cancel(handle) {
const idx = handle - microtaskLastHandle;
+1 -1
View File
@@ -49,7 +49,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
};
/* eslint-enable */
window.Polymer.version = '2.2.0';
window.Polymer.version = '2.3.0';
/* eslint-disable no-unused-vars */
/*
+35 -30
View File
@@ -35,6 +35,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
*
* @param {!AsyncModule} asyncModule Object with Async interface.
* @param {function()} callback Callback to run.
* @return {void}
*/
setConfig(asyncModule, callback) {
this._asyncModule = asyncModule;
@@ -46,6 +47,8 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
}
/**
* Cancels an active debouncer and returns a reference to itself.
*
* @return {void}
*/
cancel() {
if (this.isActive()) {
@@ -55,6 +58,8 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
}
/**
* Flushes an active debouncer and returns a reference to itself.
*
* @return {void}
*/
flush() {
if (this.isActive()) {
@@ -70,36 +75,36 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
isActive() {
return this._timer != null;
}
/**
* Creates a debouncer if no debouncer is passed as a parameter
* or it cancels an active debouncer otherwise. The following
* example shows how a debouncer can be called multiple times within a
* microtask and "debounced" such that the provided callback function is
* called once. Add this method to a custom element:
*
* _debounceWork() {
* this._debounceJob = Polymer.Debouncer.debounce(this._debounceJob,
* Polymer.Async.microTask, () => {
* this._doWork();
* });
* }
*
* If the `_debounceWork` method is called multiple times within the same
* microtask, the `_doWork` function will be called only once at the next
* microtask checkpoint.
*
* Note: In testing it is often convenient to avoid asynchrony. To accomplish
* this with a debouncer, you can use `Polymer.enqueueDebouncer` and
* `Polymer.flush`. For example, extend the above example by adding
* `Polymer.enqueueDebouncer(this._debounceJob)` at the end of the
* `_debounceWork` method. Then in a test, call `Polymer.flush` to ensure
* the debouncer has completed.
*
* @param {Debouncer?} debouncer Debouncer object.
* @param {!AsyncModule} asyncModule Object with Async interface
* @param {function()} callback Callback to run.
* @return {!Debouncer} Returns a debouncer object.
*/
/**
* Creates a debouncer if no debouncer is passed as a parameter
* or it cancels an active debouncer otherwise. The following
* example shows how a debouncer can be called multiple times within a
* microtask and "debounced" such that the provided callback function is
* called once. Add this method to a custom element:
*
* _debounceWork() {
* this._debounceJob = Polymer.Debouncer.debounce(this._debounceJob,
* Polymer.Async.microTask, () => {
* this._doWork();
* });
* }
*
* If the `_debounceWork` method is called multiple times within the same
* microtask, the `_doWork` function will be called only once at the next
* microtask checkpoint.
*
* Note: In testing it is often convenient to avoid asynchrony. To accomplish
* this with a debouncer, you can use `Polymer.enqueueDebouncer` and
* `Polymer.flush`. For example, extend the above example by adding
* `Polymer.enqueueDebouncer(this._debounceJob)` at the end of the
* `_debounceWork` method. Then in a test, call `Polymer.flush` to ensure
* the debouncer has completed.
*
* @param {Debouncer?} debouncer Debouncer object.
* @param {!AsyncModule} asyncModule Object with Async interface
* @param {function()} callback Callback to run.
* @return {!Debouncer} Returns a debouncer object.
*/
static debounce(debouncer, asyncModule, callback) {
if (debouncer instanceof Debouncer) {
debouncer.cancel();
+4
View File
@@ -106,6 +106,8 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
* Activates an observer. This method is automatically called when
* a `FlattenedNodesObserver` is created. It should only be called to
* re-activate an observer that has been deactivated via the `disconnect` method.
*
* @return {void}
*/
connect() {
if (isSlot(this._target)) {
@@ -133,6 +135,8 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
* the observer callback will not be called when changes to flattened nodes
* occur. The `connect` method may be subsequently called to reactivate
* the observer.
*
* @return {void}
*/
disconnect() {
if (isSlot(this._target)) {
+2
View File
@@ -19,6 +19,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
*
* @memberof Polymer
* @param {Polymer.Debouncer} debouncer Debouncer to enqueue
* @return {void}
*/
Polymer.enqueueDebouncer = function(debouncer) {
debouncerQueue.push(debouncer);
@@ -44,6 +45,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
* - ShadyDOM distribution
*
* @memberof Polymer
* @return {void}
*/
Polymer.flush = function() {
let shadyDOM, debouncers;
+48 -9
View File
@@ -62,9 +62,13 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
/**
* Generate settings for event listeners, dependant on `Polymer.passiveTouchGestures`
*
* @param {string} eventName Event name to determine if `{passive}` option is needed
* @return {{passive: boolean} | undefined} Options to use for addEventListener and removeEventListener
*/
function PASSIVE_TOUCH() {
function PASSIVE_TOUCH(eventName) {
if (isMouseEvent(eventName) || eventName === 'touchend') {
return;
}
if (HAS_NATIVE_TA && SUPPORTS_PASSIVE && Polymer.passiveTouchGestures) {
return {passive: true};
} else {
@@ -126,6 +130,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
/**
* @param {boolean=} setup True to add, false to remove.
* @return {void}
*/
function setupTeardownMouseCanceller(setup) {
let events = IS_TOUCH_ONLY ? ['click'] : MOUSE_EVENTS;
@@ -321,6 +326,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
/**
* @private
* @param {Event} ev Event.
* @return {void}
*/
_handleNative: function(ev) {
let handled;
@@ -382,6 +388,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
/**
* @private
* @param {TouchEvent} ev Event.
* @return {void}
*/
_handleTouchAction: function(ev) {
let t = ev.changedTouches[0];
@@ -460,6 +467,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
* @param {HTMLElement} node Node on which to add the event.
* @param {string} evType Event type to add.
* @param {function(Event?)} handler Event handler function.
* @return {void}
* @this {Gestures}
*/
_add: function(node, evType, handler) {
@@ -481,8 +489,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
gobj[dep] = gd = {_count: 0};
}
if (gd._count === 0) {
let options = !isMouseEvent(dep) && PASSIVE_TOUCH();
node.addEventListener(dep, this._handleNative, options);
node.addEventListener(dep, this._handleNative, PASSIVE_TOUCH(dep));
}
gd[name] = (gd[name] || 0) + 1;
gd._count = (gd._count || 0) + 1;
@@ -500,6 +507,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
* @param {HTMLElement} node Node on which to remove the event.
* @param {string} evType Event type to remove.
* @param {function(Event?)} handler Event handler function.
* @return {void}
* @this {Gestures}
*/
_remove: function(node, evType, handler) {
@@ -515,8 +523,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
gd[name] = (gd[name] || 1) - 1;
gd._count = (gd._count || 1) - 1;
if (gd._count === 0) {
let options = !isMouseEvent(dep) && PASSIVE_TOUCH();
node.removeEventListener(dep, this._handleNative, options);
node.removeEventListener(dep, this._handleNative, PASSIVE_TOUCH(dep));
}
}
}
@@ -530,6 +537,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
*
* @memberof Polymer.Gestures
* @param {GestureRecognizer} recog Gesture recognizer descriptor
* @return {void}
* @this {Gestures}
*/
register: function(recog) {
@@ -567,6 +575,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
* @memberof Polymer.Gestures
* @param {Element} node Node to set touch action setting on
* @param {string} value Touch action value
* @return {void}
*/
setTouchAction: function(node, value) {
if (HAS_NATIVE_TA) {
@@ -582,6 +591,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
* @param {EventTarget} target The element on which to fire an event.
* @param {string} type The type of event to fire.
* @param {Object=} detail The detail object to populate on the event.
* @return {void}
*/
_fire: function(target, type, detail) {
let ev = new Event(type, { bubbles: true, cancelable: true, composed: true });
@@ -601,6 +611,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
*
* @memberof Polymer.Gestures
* @param {string} evName Event name.
* @return {void}
* @this {Gestures}
*/
prevent: function(evName) {
@@ -618,6 +629,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
* Calling this method in production may cause duplicate taps or other Gestures.
*
* @memberof Polymer.Gestures
* @return {void}
*/
resetMouseCanceller: function() {
if (POINTERSTATE.mouse.mouseIgnoreJob) {
@@ -642,7 +654,10 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
upfn: null
},
/** @this {GestureRecognizer} */
/**
* @this {GestureRecognizer}
* @return {void}
*/
reset: function() {
untrackDocument(this.info);
},
@@ -650,6 +665,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
/**
* @this {GestureRecognizer}
* @param {MouseEvent} e
* @return {void}
*/
mousedown: function(e) {
if (!hasLeftMouseButton(e)) {
@@ -675,6 +691,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
/**
* @this {GestureRecognizer}
* @param {TouchEvent} e
* @return {void}
*/
touchstart: function(e) {
this._fire('down', Gestures._findOriginalTarget(e), e.changedTouches[0], e);
@@ -682,6 +699,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
/**
* @this {GestureRecognizer}
* @param {TouchEvent} e
* @return {void}
*/
touchend: function(e) {
this._fire('up', Gestures._findOriginalTarget(e), e.changedTouches[0], e);
@@ -691,6 +709,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
* @param {EventTarget} target
* @param {Event} event
* @param {Function} preventer
* @return {void}
*/
_fire: function(type, target, event, preventer) {
Gestures._fire(target, type, {
@@ -733,7 +752,10 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
prevent: false
},
/** @this {GestureRecognizer} */
/**
* @this {GestureRecognizer}
* @return {void}
*/
reset: function() {
this.info.state = 'start';
this.info.started = false;
@@ -764,6 +786,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
/**
* @this {GestureRecognizer}
* @param {MouseEvent} e
* @return {void}
*/
mousedown: function(e) {
if (!hasLeftMouseButton(e)) {
@@ -806,6 +829,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
/**
* @this {GestureRecognizer}
* @param {TouchEvent} e
* @return {void}
*/
touchstart: function(e) {
let ct = e.changedTouches[0];
@@ -815,6 +839,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
/**
* @this {GestureRecognizer}
* @param {TouchEvent} e
* @return {void}
*/
touchmove: function(e) {
let t = Gestures._findOriginalTarget(e);
@@ -834,6 +859,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
/**
* @this {GestureRecognizer}
* @param {TouchEvent} e
* @return {void}
*/
touchend: function(e) {
let t = Gestures._findOriginalTarget(e);
@@ -851,6 +877,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
* @this {GestureRecognizer}
* @param {EventTarget} target
* @param {Touch} touch
* @return {void}
*/
_fire: function(target, touch) {
let secondlast = this.info.moves[this.info.moves.length - 2];
@@ -892,13 +919,20 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
y: NaN,
prevent: false
},
/** @this {GestureRecognizer} */
/**
* @this {GestureRecognizer}
* @return {void}
*/
reset: function() {
this.info.x = NaN;
this.info.y = NaN;
this.info.prevent = false;
},
/** @this {GestureRecognizer} */
/**
* @this {GestureRecognizer}
* @param {MouseEvent} e
* @return {void}
*/
save: function(e) {
this.info.x = e.clientX;
this.info.y = e.clientY;
@@ -906,6 +940,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
/**
* @this {GestureRecognizer}
* @param {MouseEvent} e
* @return {void}
*/
mousedown: function(e) {
if (hasLeftMouseButton(e)) {
@@ -915,6 +950,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
/**
* @this {GestureRecognizer}
* @param {MouseEvent} e
* @return {void}
*/
click: function(e) {
if (hasLeftMouseButton(e)) {
@@ -924,6 +960,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
/**
* @this {GestureRecognizer}
* @param {TouchEvent} e
* @return {void}
*/
touchstart: function(e) {
this.save(e.changedTouches[0], e);
@@ -931,6 +968,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
/**
* @this {GestureRecognizer}
* @param {TouchEvent} e
* @return {void}
*/
touchend: function(e) {
this.forward(e.changedTouches[0], e);
@@ -939,6 +977,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
* @this {GestureRecognizer}
* @param {Event | Touch} e
* @param {Event=} preventer
* @return {void}
*/
forward: function(e, preventer) {
let dx = Math.abs(e.clientX - this.info.x);
+3
View File
@@ -87,6 +87,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
* @param {*} context Context object the callback function will be bound to
* @param {function()} callback Callback function
* @param {Array} args An array of arguments to call the callback function with
* @return {void}
*/
beforeNextRender: function(context, callback, args) {
if (!scheduled) {
@@ -108,6 +109,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
* @param {*} context Context object the callback function will be bound to
* @param {function()} callback Callback function
* @param {Array} args An array of arguments to call the callback function with
* @return {void}
*/
afterNextRender: function(context, callback, args) {
if (!scheduled) {
@@ -121,6 +123,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
* tasks.
*
* @memberof Polymer.RenderStatus
* @return {void}
*/
flush: flush
+3
View File
@@ -57,6 +57,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
*
* @memberof Polymer
* @param {string} path The new root path
* @return {void}
*/
Polymer.setRootPath = function(path) {
Polymer.rootPath = path;
@@ -89,6 +90,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
*
* @memberof Polymer
* @param {(function(*,string,string,Node):*)|undefined} newSanitizeDOMValue the global sanitizeDOMValue callback
* @return {void}
*/
Polymer.setSanitizeDOMValue = function(newSanitizeDOMValue) {
Polymer.sanitizeDOMValue = newSanitizeDOMValue;
@@ -111,6 +113,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
*
* @memberof Polymer
* @param {boolean} usePassive enable or disable passive touch gestures globally
* @return {void}
*/
Polymer.setPassiveTouchGestures = function(usePassive) {
Polymer.passiveTouchGestures = usePassive;
+3
View File
@@ -92,6 +92,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
* sets any properties stored in `__hostProps`.
* @private
* @param {Object} props Object of property name-value pairs to set.
* @return {void}
*/
_configureProperties(props) {
let options = this.__templatizeOptions;
@@ -115,6 +116,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
*
* @param {string} prop Property or path name
* @param {*} value Value of the property to forward
* @return {void}
*/
forwardHostProp(prop, value) {
if (this._setPendingPropertyOrPath(prop, value, false, true)) {
@@ -147,6 +149,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
* "shown."
* @param {boolean} hide Set to true to hide the children;
* set to false to show them.
* @return {void}
* @protected
*/
_showHideChildren(hide) {
+1310 -759
View File
File diff suppressed because it is too large Load Diff
+10 -10
View File
@@ -1,6 +1,6 @@
{
"name": "@polymer/polymer",
"version": "2.2.0",
"version": "2.3.0",
"description": "The Polymer library makes it easy to create your own web components. Give your element some markup and properties, and then use it on a site. Polymer provides features like dynamic templates and data binding to reduce the amount of boilerplate you need to write",
"main": "polymer.html",
"directories": {
@@ -9,33 +9,33 @@
},
"devDependencies": {
"@polymer/gen-closure-declarations": "^0.4.0",
"@webcomponents/shadycss": "^1.0.6",
"@webcomponents/webcomponentsjs": "^1.0.14",
"@webcomponents/shadycss": "^1.1.0",
"@webcomponents/webcomponentsjs": "^1.0.20",
"babel-preset-minify": "^0.2.0",
"del": "^3.0.0",
"dom5": "^2.3.0",
"eslint-plugin-html": "^2.0.1",
"google-closure-compiler": "^20170910.0.0",
"eslint-plugin-html": "^4.0.1",
"google-closure-compiler": "^20171112.0.0",
"gulp": "^3.9.1",
"gulp-babel": "^6.1.2",
"gulp-eslint": "^3.0.1",
"gulp-eslint": "^4.0.0",
"gulp-if": "^2.0.1",
"gulp-replace": "^0.6.1",
"gulp-size": "^2.1.0",
"gulp-vulcanize": "^6.0.1",
"lazypipe": "^1.0.1",
"merge-stream": "^1.0.1",
"parse5": "^3.0.2",
"polymer-build": "^2.1.0",
"parse5": "^3.0.3",
"polymer-build": "^2.1.1",
"run-sequence": "^2.2.0",
"through2": "^2.0.0",
"web-component-tester": "^6.3.0"
"web-component-tester": "^6.4.1"
},
"scripts": {
"build": "gulp",
"test": "npm run lint && wct",
"lint": "gulp lint",
"version": "gulp update-version"
"version": "gulp update-version && git add lib/utils/boot.html"
},
"repository": {
"type": "git",
+8 -2
View File
@@ -40,11 +40,17 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
is: 'x-passive',
listeners: {
'down': 'prevent',
'move': 'prevent'
'move': 'prevent',
'up': 'prevent',
'tap': 'allowed',
'click': 'allowed'
},
prevent(e) {
e.preventDefault();
console.log('prevented!');
console.log('prevented?: ' + e.type + ' ' + e.defaultPrevented);
},
allowed(e) {
console.log(e.type + ' allowed');
}
});
</script>
+56
View File
@@ -131,6 +131,54 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
</template>
</test-fixture>
<script>
addEventListener('WebComponentsReady', () => {
class OtherElement extends Polymer.Element {}
customElements.define('other-element', OtherElement);
});
</script>
<dom-module id="x-complicated">
<template>
<style>
#direct:dir(rtl) {
border: 10px solid black;
}
:dir(rtl) #indirect {
border: 9px solid black;
}
other-element:dir(rtl) {
border: 8px solid black;
}
#container:dir(rtl) ::slotted(*) {
border: 7px solid black;
}
</style>
<div id="direct"></div>
<div id="indirect"></div>
<other-element id="other"></other-element>
<div id="container">
<slot></slot>
</div>
</template>
<script>
addEventListener('WebComponentsReady', () => {
class XComplicated extends Polymer.DirMixin(Polymer.Element) {
static get is() {return 'x-complicated';}
}
customElements.define(XComplicated.is, XComplicated);
});
</script>
</dom-module>
<test-fixture id="complicated">
<template>
<x-complicated>
<div></div>
</x-complicated>
</template>
</test-fixture>
<script>
function assertComputed(node, expected, property = 'border-top-width') {
let actual = getComputedStyle(node).getPropertyValue(property).trim();
@@ -195,6 +243,14 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
let el = fixture('legacy');
assertComputed(el, '2px');
});
test('complicated setup', function() {
let el = fixture('complicated');
assertComputed(el.$.direct, '10px');
assertComputed(el.$.indirect, '9px');
assertComputed(el.$.other, '8px');
assertComputed(el.firstElementChild, '7px');
});
});
</script>
</body>
+23
View File
@@ -113,6 +113,29 @@ suite('property-accessors', function() {
});
});
suite('testing for deserialization of date', function() {
let date;
setup(function() {
date = new Date();
});
test('can handle string timestamp', function() {
const deserializedDate = window.XFoo.prototype._deserializeValue(String(date.getTime()), Date);
assert.equal(deserializedDate.getTime(), date.getTime());
});
test('can handle number timestamp', function() {
const deserializedDate = window.XFoo.prototype._deserializeValue(date.getTime(), Date);
assert.equal(deserializedDate.getTime(), date.getTime());
});
test('can handle full date', function() {
const deserializedDate = window.XFoo.prototype._deserializeValue(date.toString(), Date);
assert.equal(deserializedDate.toString(), date.toString());
});
});
});
</script>
+1 -1
View File
@@ -509,7 +509,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
},
prop2: {
value: 'default',
observer: 'prop2Changed'
observer: function(newProp, oldProp) { return this.prop2Changed(newProp, oldProp); }
}
},
created: function() {