Socket
Socket
Sign inDemoInstall

@polymer/polymer

Package Overview
Dependencies
1
Maintainers
7
Versions
49
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 3.0.2 to 3.0.3

externs/.gitignore

20

externs/closure-types.js

@@ -108,3 +108,3 @@ /**

* @param {?string} value New attribute value
* @param {?string} namespace Attribute namespace.
* @param {?string} namespace Namespace of the attribute
* @return {void}

@@ -250,3 +250,3 @@ */

/**
* @param {Node} node Node to remove event listener from
* @param {!Node} node Node to remove event listener from
* @param {string} eventName Name of event

@@ -265,5 +265,5 @@ * @param {function (!Event): void} handler Listener function to remove

/**
* @param {*} template
* @param {*} templateInfo
* @param {*} nodeInfo
* @param {*} template
* @param {*} templateInfo
* @param {*} nodeInfo
*/

@@ -766,3 +766,3 @@ Polymer_TemplateStamp._parseTemplateContent = function(template, templateInfo, nodeInfo){};

/**
* @param {this} inst Element that should be used as scope for
* @param {Element} inst Element that should be used as scope for
binding dependencies

@@ -980,3 +980,3 @@ * @param {BindingPart} part Binding part metadata

* @param {?string} value Current value of attribute.
* @param {?string} namespace Attribute namespace.
* @param {?string} namespace Namespace of the attribute
* @return {void}

@@ -1182,3 +1182,3 @@ */

context) when the wait time elapses.
* @param {number} wait Optional wait time in milliseconds (ms) after the
* @param {number=} wait Optional wait time in milliseconds (ms) after the
last signal that must elapse before invoking `callback`

@@ -1413,3 +1413,3 @@ * @return {!Object}

*/
Polymer_DisableUpgradeMixin.prototype.attributeChangedCallback = function(name, old, value, namespace){};
Polymer_DisableUpgradeMixin.prototype.attributeChangedCallback = function(name, old, value){};
/**

@@ -1422,2 +1422,2 @@ * @override

*/
Polymer_DisableUpgradeMixin.prototype.disconnectedCallback = function(){};
Polymer_DisableUpgradeMixin.prototype.disconnectedCallback = function(){};

@@ -18,9 +18,9 @@ /**

* @typedef {{
* type: !Function,
* value: *,
* readOnly: (boolean | undefined),
* computed: (string | undefined),
* reflectToAttribute: (boolean | undefined),
* notify: (boolean | undefined),
* observer: (string | function(*,*) | undefined)
* type: !Function,
* value: (* | undefined),
* readOnly: (boolean | undefined),
* computed: (string | undefined),
* reflectToAttribute: (boolean | undefined),
* notify: (boolean | undefined),
* observer: (string | function(this:?, ?, ?) | undefined)
* }}

@@ -31,6 +31,7 @@ */

/**
* @typedef {Object<string, !PolymerElementPropertiesMeta>}
* @typedef {Object<string, !Function|!PolymerElementPropertiesMeta>}
*/
let PolymerElementProperties;
/** @record */
let PolymerInit = function(){};

@@ -64,5 +65,8 @@ /** @type {string} */

/** @interface */
let PropertiesMixinConstructor = function (){};
/** @type {(!PolymerElementProperties | undefined)} */
PropertiesMixinConstructor.properties;
PropertiesMixinConstructor.prototype.properties;
/** @return {void} */
PropertiesMixinConstructor.prototype.finalize = function() {};

@@ -75,5 +79,2 @@ /**

/** @type {PolymerElementProperties} */
Polymer.ElementProperties;
/**

@@ -102,3 +103,3 @@ * @type {(function(*,string,string,Node):*)|undefined}

/** @type {function(HTMLElement)} */
PolymerTelemetry.dumpRegistrations;;
PolymerTelemetry.dumpRegistrations;

@@ -117,2 +118,55 @@ /** @type {PolymerTelemetry} */

*/
var PolymerElement = Polymer.LegacyElementMixin();
var PolymerElement = function() {};
/**
* On create callback.
* @override
*/
PolymerElement.prototype.created = function() {};
/**
* On ready callback.
* @override
*/
PolymerElement.prototype.ready = function() {};
/** On registered callback. */
PolymerElement.prototype.registered = function() {};
/**
* On attached to the DOM callback.
* @override
*/
PolymerElement.prototype.attached = function() {};
/**
* On detached from the DOM callback.
* @override
*/
PolymerElement.prototype.detached = function() {};
/**
* @typedef {{
* index: number,
* removed: !Array,
* addedCount: number,
* object: !Array,
* type: string,
* }}
*/
var PolymerSplice;
/**
* @typedef {{
* indexSplices: ?Array<!PolymerSplice>,
* }}
*/
var PolymerSpliceChange;
/**
* The type of the object received by an observer function when deep
* sub-property observation is enabled. See:
* https://www.polymer-project.org/2.0/docs/devguide/observers#deep-observation
*
* @typedef {{
* path: string,
* value: (?Object|undefined),
* base: (?Object|undefined)
* }}
*/
var PolymerDeepPropertyChange;
/**
* @fileoverview Internal shared types for Polymer
* @externs
*

@@ -4,0 +5,0 @@ * @license

@@ -42,2 +42,3 @@ /**

* @implements {Polymer_ElementMixin}
* @private
*/

@@ -347,2 +348,3 @@ let elementBase = ElementMixin(superClass);

* @implements {Polymer_ArraySelectorMixin}
* @private
*/

@@ -349,0 +351,0 @@ let baseArraySelector = ArraySelectorMixin(PolymerElement);

@@ -22,2 +22,3 @@ /**

* @implements {Polymer_GestureEventListeners}
* @private
*/

@@ -24,0 +25,0 @@ const domBindBase =

@@ -81,2 +81,3 @@ /**

* @return {void}
* @override
*/

@@ -83,0 +84,0 @@ attributeChangedCallback(name, old, value, namespace) {

@@ -12,3 +12,3 @@ /**

import { TemplateInstanceBase as TemplateInstanceBase$0, templatize, modelForElement as modelForElement$0 } from '../utils/templatize.js';
import { TemplateInstanceBase, templatize, modelForElement as modelForElement$0 } from '../utils/templatize.js'; // eslint-disable-line no-unused-vars
import { Debouncer } from '../utils/debounce.js';

@@ -20,4 +20,2 @@ import { enqueueDebouncer, flush } from '../utils/flush.js';

let TemplateInstanceBase = TemplateInstanceBase$0; // eslint-disable-line
/**

@@ -27,2 +25,3 @@ * @constructor

* @extends {PolymerElement}
* @private
*/

@@ -29,0 +28,0 @@ const domRepeatBase = OptionalMutableData(PolymerElement);

@@ -142,2 +142,3 @@ /**

/** @private */
class PolymerGenerated extends Base {

@@ -144,0 +145,0 @@

@@ -34,4 +34,4 @@ /**

* @polymer
* @appliesMixin Polymer.ElementMixin
* @appliesMixin Polymer.GestureEventListeners
* @appliesMixin ElementMixin
* @appliesMixin GestureEventListeners
* @property isAttached {boolean} Set to `true` in this element's

@@ -49,2 +49,3 @@ * `connectedCallback` and `false` in `disconnectedCallback`

* @implements {Polymer_DirMixin}
* @private
*/

@@ -471,3 +472,3 @@ const legacyElementBase = DirMixin(GestureEventListeners(ElementMixin(base)));

setScrollDirection(direction, node) {
setTouchAction( (node || this), DIRECTION_MAP[direction] || 'auto');
setTouchAction(/** @type {Element} */ (node || this), DIRECTION_MAP[direction] || 'auto');
}

@@ -521,3 +522,3 @@ /* **** End Events **** */

const thisEl = /** @type {Element} */ (this);
const domApi = /** @type {Polymer.DomApi} */(dom$0(thisEl));
const domApi = /** @type {DomApi} */(dom$0(thisEl));
return domApi.getEffectiveChildNodes();

@@ -536,3 +537,3 @@ }

const thisEl = /** @type {Element} */ (this);
const domApi = /** @type {Polymer.DomApi} */(dom$0(thisEl));
const domApi = /** @type {DomApi} */(dom$0(thisEl));
return domApi.queryDistributedElements(selector);

@@ -609,3 +610,3 @@ }

let content = this.root.querySelector(slctr || 'slot');
return content ? /** @type {Polymer.DomApi} */(dom$0(content)).getDistributedNodes() : [];
return content ? /** @type {DomApi} */(dom$0(content)).getDistributedNodes() : [];
}

@@ -612,0 +613,0 @@

@@ -56,3 +56,3 @@ /**

* of this element changes
* @return {!Polymer.FlattenedNodesObserver} Observer instance
* @return {!FlattenedNodesObserver} Observer instance
*/

@@ -66,3 +66,3 @@ observeNodes(callback) {

*
* @param {!Polymer.FlattenedNodesObserver} observerHandle Observer instance
* @param {!FlattenedNodesObserver} observerHandle Observer instance
* to disconnect.

@@ -105,3 +105,3 @@ * @return {void}

/**
* Returns the root node of this node. Equivalent to `getRoodNode()`.
* Returns the root node of this node. Equivalent to `getRootNode()`.
*

@@ -237,20 +237,3 @@ * @return {Node} Top most element in the dom tree in which the node

forwardMethods(DomApi.prototype, [
'cloneNode', 'appendChild', 'insertBefore', 'removeChild',
'replaceChild', 'setAttribute', 'removeAttribute',
'querySelector', 'querySelectorAll'
]);
forwardReadOnlyProperties(DomApi.prototype, [
'parentNode', 'firstChild', 'lastChild',
'nextSibling', 'previousSibling', 'firstElementChild',
'lastElementChild', 'nextElementSibling', 'previousElementSibling',
'childNodes', 'children', 'classList'
]);
forwardProperties(DomApi.prototype, [
'textContent', 'innerHTML'
]);
/**

@@ -350,2 +333,49 @@ * Event API wrapper class returned from `Polymer.dom.(target)` when

/** @type {?Node} */
DomApi.prototype.parentNode;
/** @type {?Node} */
DomApi.prototype.firstChild;
/** @type {?Node} */
DomApi.prototype.lastChild;
/** @type {?Node} */
DomApi.prototype.nextSibling;
/** @type {?Node} */
DomApi.prototype.previousSibling;
/** @type {?HTMLElement} */
DomApi.prototype.firstElementChild;
/** @type {?HTMLElement} */
DomApi.prototype.lastElementChild;
/** @type {?HTMLElement} */
DomApi.prototype.nextElementSibling;
/** @type {?HTMLElement} */
DomApi.prototype.previousElementSibling;
/** @type {!Array<!Node>} */
DomApi.prototype.childNodes;
/** @type {!Array<!HTMLElement>} */
DomApi.prototype.children;
/** @type {?DOMTokenList} */
DomApi.prototype.classList;
/** @type {string} */
DomApi.prototype.textContent;
/** @type {string} */
DomApi.prototype.innerHTML;
forwardMethods(DomApi.prototype, [
'cloneNode', 'appendChild', 'insertBefore', 'removeChild',
'replaceChild', 'setAttribute', 'removeAttribute',
'querySelector', 'querySelectorAll'
]);
forwardReadOnlyProperties(DomApi.prototype, [
'parentNode', 'firstChild', 'lastChild',
'nextSibling', 'previousSibling', 'firstElementChild',
'lastElementChild', 'nextElementSibling', 'previousElementSibling',
'childNodes', 'children', 'classList'
]);
forwardProperties(DomApi.prototype, [
'textContent', 'innerHTML'
]);
/**

@@ -352,0 +382,0 @@ * Legacy DOM and Event manipulation API wrapper factory used to abstract

@@ -10,6 +10,4 @@ /**

*/
import { TemplateInstanceBase as TemplateInstanceBase$0, templatize as templatize$0, modelForElement as modelForElement$0 } from '../utils/templatize.js';
import { TemplateInstanceBase, templatize as templatize$0, modelForElement as modelForElement$0 } from '../utils/templatize.js'; // eslint-disable-line no-unused-vars
let TemplateInstanceBase = TemplateInstanceBase$0; // eslint-disable-line
/**

@@ -16,0 +14,0 @@ * @typedef {{

@@ -93,2 +93,3 @@ /**

* @implements {Polymer_PropertyAccessors}
* @private
*/

@@ -95,0 +96,0 @@ const elementBase = PropertyAccessors(base);

@@ -46,4 +46,6 @@ /**

* @implements {Polymer_ElementMixin}
* @private
*/
const superClass = ElementMixin(base);
/**

@@ -50,0 +52,0 @@ * @polymer

@@ -35,4 +35,3 @@ /**

* opposed to via `dom-module`) by implementing a static `template` getter.
* The getter may return an `HTMLTemplateElement` or a string, which will
* automatically be parsed into a template.
* The getter must return an `HTMLTemplateElement`.
*

@@ -97,2 +96,3 @@ * - `static get properties()`: Should return an object describing

* @implements {Polymer_PropertiesMixin}
* @private
*/

@@ -355,4 +355,3 @@ const polymerElementBase = PropertiesMixin(PropertyEffects(base));

* (in which case the `is` getter is unnecessary). The template returned
* may be either an `HTMLTemplateElement` or a string that will be
* automatically parsed into a template.
* must be an `HTMLTemplateElement`.
*

@@ -359,0 +358,0 @@ * Note that when subclassing, if the super class overrode the default

@@ -32,43 +32,47 @@ /**

*/
export const GestureEventListeners = dedupingMixin(superClass => {
/**
* @polymer
* @mixinClass
* @implements {Polymer_GestureEventListeners}
*/
class GestureEventListeners extends superClass {
export const GestureEventListeners = dedupingMixin(
/**
* Add the event listener to the node if it is a gestures event.
*
* @param {!Node} node Node to add event listener to
* @param {string} eventName Name of event
* @param {function(!Event):void} handler Listener function to add
* @return {void}
* @template T
* @param {function(new:T)} superClass Class to apply mixin to.
* @return {function(new:T)} superClass with mixin applied.
*/
_addEventListenerToNode(node, eventName, handler) {
if (!gestures.addListener(node, eventName, handler)) {
super._addEventListenerToNode(node, eventName, handler);
}
}
(superClass) => {
/**
* @polymer
* @mixinClass
* @implements {Polymer_GestureEventListeners}
*/
class GestureEventListeners extends superClass {
/**
* Add the event listener to the node if it is a gestures event.
*
* @param {!Node} node Node to add event listener to
* @param {string} eventName Name of event
* @param {function(!Event):void} handler Listener function to add
* @return {void}
* @override
*/
_addEventListenerToNode(node, eventName, handler) {
if (!gestures.addListener(node, eventName, handler)) {
super._addEventListenerToNode(node, eventName, handler);
}
}
/**
* Remove the event listener to the node if it is a gestures event.
*
* @param {!Node} node Node to remove event listener from
* @param {string} eventName Name of event
* @param {function(!Event):void} handler Listener function to remove
* @return {void}
*/
_removeEventListenerFromNode(node, eventName, handler) {
if (!gestures.removeListener(node, eventName, handler)) {
super._removeEventListenerFromNode(node, eventName, handler);
/**
* Remove the event listener to the node if it is a gestures event.
*
* @param {!Node} node Node to remove event listener from
* @param {string} eventName Name of event
* @param {function(!Event):void} handler Listener function to remove
* @return {void}
* @override
*/
_removeEventListenerFromNode(node, eventName, handler) {
if (!gestures.removeListener(node, eventName, handler)) {
super._removeEventListenerFromNode(node, eventName, handler);
}
}
}
}
}
return GestureEventListeners;
});
return GestureEventListeners;
});

@@ -36,3 +36,9 @@ /**

*/
export const PropertiesChanged = dedupingMixin(superClass => {
export const PropertiesChanged = dedupingMixin(
/**
* @template T
* @param {function(new:T)} superClass Class to apply mixin to.
* @return {function(new:T)} superClass with mixin applied.
*/
(superClass) => {

@@ -42,3 +48,2 @@ /**

* @mixinClass
* @extends {superClass}
* @implements {Polymer_PropertiesChanged}

@@ -102,2 +107,3 @@ * @unrestricted

* @protected
* @override
*/

@@ -121,2 +127,3 @@ _createPropertyAccessor(property, readOnly) {

* @param {string} property Name of the property
* @override
*/

@@ -138,2 +145,3 @@ _addPropertyToAttributeMap(property) {

* @return {void}
* @override
*/

@@ -181,2 +189,3 @@ _definePropertyAccessor(property, readOnly) {

* @public
* @override
*/

@@ -196,2 +205,3 @@ ready() {

* @protected
* @override
*/

@@ -223,2 +233,3 @@ _initializeProperties() {

* @protected
* @override
*/

@@ -237,2 +248,3 @@ _initializeInstanceProperties(props) {

* @protected
* @override
*/

@@ -250,2 +262,3 @@ _setProperty(property, value) {

* @protected
* @override
*/

@@ -268,2 +281,3 @@ _getProperty(property) {

* @protected
* @override
*/

@@ -295,2 +309,3 @@ _setPendingProperty(property, value, ext) {

* @protected
* @override
*/

@@ -319,2 +334,3 @@ _invalidateProperties() {

* @protected
* @override
*/

@@ -340,2 +356,3 @@ _enableProperties() {

* @protected
* @override
*/

@@ -359,7 +376,8 @@ _flushProperties() {

* @param {!Object} currentProps Bag of all current accessor values
* @param {!Object} changedProps Bag of properties changed since the last
* @param {?Object} changedProps Bag of properties changed since the last
* call to `_propertiesChanged`
* @param {!Object} oldProps Bag of previous values for each property
* @param {?Object} oldProps Bag of previous values for each property
* in `changedProps`
* @return {boolean} true if changedProps is truthy
* @override
*/

@@ -375,8 +393,9 @@ _shouldPropertiesChange(currentProps, changedProps, oldProps) { // eslint-disable-line no-unused-vars

* @param {!Object} currentProps Bag of all current accessor values
* @param {!Object} changedProps Bag of properties changed since the last
* @param {?Object} changedProps Bag of properties changed since the last
* call to `_propertiesChanged`
* @param {!Object} oldProps Bag of previous values for each property
* @param {?Object} oldProps Bag of previous values for each property
* in `changedProps`
* @return {void}
* @protected
* @override
*/

@@ -403,2 +422,3 @@ _propertiesChanged(currentProps, changedProps, oldProps) { // eslint-disable-line no-unused-vars

* @protected
* @override
*/

@@ -424,2 +444,3 @@ _shouldPropertyChange(property, value, old) {

* @suppress {missingProperties} Super may or may not implement the callback
* @override
*/

@@ -446,2 +467,3 @@ attributeChangedCallback(name, old, value, namespace) {

* @return {void}
* @override
*/

@@ -466,2 +488,3 @@ _attributeToProperty(attribute, value, type) {

* @return {void}
* @override
*/

@@ -488,2 +511,3 @@ _propertyToAttribute(property, attribute, value) {

* @return {void}
* @override
*/

@@ -509,2 +533,3 @@ _valueToNodeAttribute(node, value, attribute) {

* property value.
* @override
*/

@@ -531,2 +556,3 @@ _serializeValue(value) {

* @return {*} Typed value deserialized from the provided string.
* @override
*/

@@ -533,0 +559,0 @@ _deserializeValue(value, type) {

@@ -54,4 +54,4 @@ /**

* @constructor
* @extends {superClass}
* @implements {Polymer_PropertiesChanged}
* @private
*/

@@ -65,3 +65,3 @@ const base = PropertiesChanged(superClass);

* @param {!PropertiesMixinConstructor} constructor PropertiesMixin constructor
* @return {PropertiesMixinConstructor} Super class constructor
* @return {?PropertiesMixinConstructor} Super class constructor
*/

@@ -76,3 +76,3 @@ function superPropertiesClass(constructor) {

return (superCtor.prototype instanceof PropertiesMixin) ?
/** @type {PropertiesMixinConstructor} */ (superCtor) : null;
/** @type {!PropertiesMixinConstructor} */ (superCtor) : null;
}

@@ -129,3 +129,3 @@

if (!this.hasOwnProperty(JSCompiler_renameProperty('__finalized', this))) {
const superCtor = superPropertiesClass(/** @type {PropertiesMixinConstructor} */(this));
const superCtor = superPropertiesClass(/** @type {!PropertiesMixinConstructor} */(this));
if (superCtor) {

@@ -147,3 +147,3 @@ superCtor.finalize();

static _finalizeClass() {
const props = ownProperties(/** @type {PropertiesMixinConstructor} */(this));
const props = ownProperties(/** @type {!PropertiesMixinConstructor} */(this));
if (props) {

@@ -165,3 +165,3 @@ this.createProperties(props);

JSCompiler_renameProperty('__properties', this))) {
const superCtor = superPropertiesClass(/** @type {PropertiesMixinConstructor} */(this));
const superCtor = superPropertiesClass(/** @type {!PropertiesMixinConstructor} */(this));
this.__properties = Object.assign({},

@@ -204,2 +204,3 @@ superCtor && superCtor._properties,

* @return {void}
* @override
*/

@@ -217,2 +218,3 @@ connectedCallback() {

* @return {void}
* @override
*/

@@ -219,0 +221,0 @@ disconnectedCallback() {

@@ -102,2 +102,3 @@ /**

* @unrestricted
* @private
*/

@@ -104,0 +105,0 @@ const base = PropertiesChanged(superClass);

@@ -125,2 +125,3 @@ /**

* @implements {Polymer_PropertyEffects}
* @private
*/

@@ -127,0 +128,0 @@ const elementBase = PropertyEffects(base);

@@ -108,3 +108,9 @@ /**

*/
export const TemplateStamp = dedupingMixin(superClass => {
export const TemplateStamp = dedupingMixin(
/**
* @template T
* @param {function(new:T)} superClass Class to apply mixin to.
* @return {function(new:T)} superClass with mixin applied.
*/
(superClass) => {

@@ -410,2 +416,3 @@ /**

* @return {!StampedTemplate} Cloned template content
* @override
*/

@@ -448,2 +455,3 @@ _stampTemplate(template) {

* @return {Function} Generated handler function
* @override
*/

@@ -464,2 +472,3 @@ _addMethodEventListenerToNode(node, eventName, methodName, context) {

* @return {void}
* @override
*/

@@ -473,6 +482,7 @@ _addEventListenerToNode(node, eventName, handler) {

*
* @param {Node} node Node to remove event listener from
* @param {!Node} node Node to remove event listener from
* @param {string} eventName Name of event
* @param {function(!Event):void} handler Listener function to remove
* @return {void}
* @override
*/

@@ -479,0 +489,0 @@ _removeEventListenerFromNode(node, eventName, handler) {

@@ -17,11 +17,5 @@ /**

/**
* Module with utilities for converting between "dash-case" and "camelCase"
* identifiers.
*
* @summary Module that provides utilities for converting between "dash-case"
* and "camelCase".
* @fileoverview Module with utilities for converting between "dash-case" and
* "camelCase" identifiers.
*/
`TODO(modulizer): A namespace named Polymer.CaseMap was
declared here. The surrounding comments should be reviewed,
and this string can then be deleted`;

@@ -28,0 +22,0 @@ /**

@@ -79,3 +79,3 @@ /**

* ```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';

@@ -82,0 +82,0 @@ * // ...

@@ -10,2 +10,16 @@ /**

*/
/**
* @fileoverview
*
* Module for adding listeners to a node for the following normalized
* cross-platform "gesture" events:
* - `down` - mouse or touch went down
* - `up` - mouse or touch went up
* - `tap` - mouse click or finger tap
* - `track` - mouse drag or touch move
*
* @summary Module for adding cross-platform gesture event listeners.
*/
import './boot.js';

@@ -82,3 +96,25 @@

let GestureRecognizer = function(){}; // eslint-disable-line no-unused-vars
/** @record */
const GestureInfo = function(){}; // eslint-disable-line no-unused-vars
/** @type {string|undefined} */
GestureInfo.prototype.state;
/** @type {boolean|undefined} */
GestureInfo.prototype.started;
/** @type {!Array<?>|undefined} */
GestureInfo.prototype.moves;
/** @type {number|undefined} */
GestureInfo.prototype.x;
/** @type {number|undefined} */
GestureInfo.prototype.y;
/** @type {boolean|undefined} */
GestureInfo.prototype.prevent;
/** @type {function(?): void|undefined} */
GestureInfo.prototype.addMove;
/** @type {null|undefined} */
GestureInfo.prototype.movefn;
/** @type {null|undefined} */
GestureInfo.prototype.upFn;
/** @record */
const GestureRecognizer = function(){}; // eslint-disable-line no-unused-vars
/** @type {function(): void} */

@@ -100,2 +136,6 @@ GestureRecognizer.prototype.reset;

GestureRecognizer.prototype.click;
/** @type {!GestureInfo} */
GestureRecognizer.prototype.info;
/** @type {!Array<string>} */
GestureRecognizer.prototype.emits;

@@ -118,2 +158,16 @@ // keep track of any labels hit by the mouseCanceller

// Defined at https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#enabling-and-disabling-form-controls:-the-disabled-attribute
/** @type {!Object<boolean>} */
const canBeDisabled = {
'button': true,
'command': true,
'fieldset': true,
'input': true,
'keygen': true,
'optgroup': true,
'option': true,
'select': true,
'textarea': true
};
/**

@@ -331,16 +385,2 @@ * @param {HTMLElement} el Element to check labelling status

/**
* Module for adding listeners to a node for the following normalized
* cross-platform "gesture" events:
* - `down` - mouse or touch went down
* - `up` - mouse or touch went up
* - `tap` - mouse click or finger tap
* - `track` - mouse drag or touch move
*
* @summary Module for adding cross-platform gesture event listeners.
*/
`TODO(modulizer): A namespace named Polymer.Gestures was
declared here. The surrounding comments should be reviewed,
and this string can then be deleted`;
export const gestures = {};

@@ -385,3 +425,3 @@ export const recognizers = [];

* @private
* @param {Event} ev Event.
* @param {Event|Touch} ev Event.
* @return {EventTarget} Returns the event target.

@@ -480,3 +520,3 @@ */

let ta = firstTouchAction(ev);
let prevent = false;
let shouldPrevent = false;
let dx = Math.abs(POINTERSTATE.touch.x - t.clientX);

@@ -487,9 +527,9 @@ let dy = Math.abs(POINTERSTATE.touch.y - t.clientY);

} else if (ta === 'none') {
prevent = true;
shouldPrevent = true;
} else if (ta === 'pan-x') {
prevent = dy > dx;
shouldPrevent = dy > dx;
} else if (ta === 'pan-y') {
prevent = dx > dy;
shouldPrevent = dx > dy;
}
if (prevent) {
if (shouldPrevent) {
ev.preventDefault();

@@ -509,3 +549,2 @@ } else {

* @return {boolean} Returns true if a gesture event listener was added.
* @this {Gestures}
*/

@@ -528,3 +567,2 @@ export function addListener(node, evType, handler) {

* @return {boolean} Returns true if a gesture event listener was removed.
* @this {Gestures}
*/

@@ -543,7 +581,6 @@ export function removeListener(node, evType, handler) {

* @private
* @param {!HTMLElement} node Node on which to add the event.
* @param {!Node} 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}
*/

@@ -584,7 +621,6 @@ function _add(node, evType, handler) {

* @private
* @param {!HTMLElement} node Node on which to remove the event.
* @param {!Node} node Node on which to remove the event.
* @param {string} evType Event type to remove.
* @param {function(Event?)} handler Event handler function.
* @param {function(!Event): void} handler Event handler function.
* @return {void}
* @this {Gestures}
*/

@@ -618,3 +654,2 @@ function _remove(node, evType, handler) {

* @return {void}
* @this {Gestures}
*/

@@ -632,3 +667,2 @@ export function register(recog) {

* @return {Object} Returns the gesture for the given event name.
* @this {Gestures}
*/

@@ -654,3 +688,3 @@ function _findRecognizerByEvent(evName) {

*
* @param {!Element} node Node to set touch action setting on
* @param {!Node} node Node to set touch action setting on
* @param {string} value Touch action value

@@ -699,3 +733,2 @@ * @return {void}

* @return {void}
* @this {Gestures}
*/

@@ -761,3 +794,3 @@ export function prevent(evName) {

if (!hasLeftMouseButton(e)) {
self._fire('up', t, e);
downupFire('up', t, e);
untrackDocument(self.info);

@@ -768,3 +801,3 @@ }

if (hasLeftMouseButton(e)) {
self._fire('up', t, e);
downupFire('up', t, e);
}

@@ -774,3 +807,3 @@ untrackDocument(self.info);

trackDocument(this.info, movefn, upfn);
this._fire('down', t, e);
downupFire('down', t, e);
},

@@ -783,3 +816,3 @@ /**

touchstart: function(e) {
this._fire('down', _findOriginalTarget(e), e.changedTouches[0], e);
downupFire('down', _findOriginalTarget(e), e.changedTouches[0], e);
},

@@ -792,24 +825,28 @@ /**

touchend: function(e) {
this._fire('up', _findOriginalTarget(e), e.changedTouches[0], e);
},
/**
* @param {string} type
* @param {!EventTarget} target
* @param {Event} event
* @param {Function} preventer
* @return {void}
*/
_fire: function(type, target, event, preventer) {
_fire(target, type, {
x: event.clientX,
y: event.clientY,
sourceEvent: event,
preventer: preventer,
prevent: function(e) {
return prevent(e);
}
});
downupFire('up', _findOriginalTarget(e), e.changedTouches[0], e);
}
});
/**
* @param {string} type
* @param {EventTarget} target
* @param {Event|Touch} event
* @param {Event=} preventer
* @return {void}
*/
function downupFire(type, target, event, preventer) {
if (!target) {
return;
}
_fire(target, type, {
x: event.clientX,
y: event.clientY,
sourceEvent: event,
preventer: preventer,
prevent: function(e) {
return prevent(e);
}
});
}
register({

@@ -831,3 +868,3 @@ name: 'track',

moves: [],
/** @this {GestureRecognizer} */
/** @this {GestureInfo} */
addMove: function(move) {

@@ -860,19 +897,2 @@ if (this.moves.length > TRACK_LENGTH) {

* @this {GestureRecognizer}
* @param {number} x
* @param {number} y
* @return {boolean}
*/
hasMovedEnough: function(x, y) {
if (this.info.prevent) {
return false;
}
if (this.info.started) {
return true;
}
let dx = Math.abs(this.info.x - x);
let dy = Math.abs(this.info.y - y);
return (dx >= TRACK_DISTANCE || dy >= TRACK_DISTANCE);
},
/**
* @this {GestureRecognizer}
* @param {MouseEvent} e

@@ -889,3 +909,3 @@ * @return {void}

let x = e.clientX, y = e.clientY;
if (self.hasMovedEnough(x, y)) {
if (trackHasMovedEnough(self.info, x, y)) {
// first move is 'start', subsequent moves are 'move', mouseup is 'end'

@@ -899,7 +919,9 @@ self.info.state = self.info.started ? (e.type === 'mouseup' ? 'end' : 'track') : 'start';

if (!hasLeftMouseButton(e)) {
// always _fire "end"
// always fire "end"
self.info.state = 'end';
untrackDocument(self.info);
}
self._fire(t, e);
if (t) {
trackFire(self.info, t, e);
}
self.info.started = true;

@@ -940,3 +962,3 @@ }

let x = ct.clientX, y = ct.clientY;
if (this.hasMovedEnough(x, y)) {
if (trackHasMovedEnough(this.info, x, y)) {
if (this.info.state === 'start') {

@@ -947,3 +969,3 @@ // if and only if tracking, always prevent tap

this.info.addMove({x: x, y: y});
this._fire(t, ct);
trackFire(this.info, t, ct);
this.info.state = 'track';

@@ -966,38 +988,58 @@ this.info.started = true;

this.info.addMove({x: ct.clientX, y: ct.clientY});
this._fire(t, ct, e);
trackFire(this.info, t, ct);
}
},
}
});
/**
* @this {GestureRecognizer}
* @param {!EventTarget} target
* @param {Touch} touch
* @return {void}
*/
_fire: function(target, touch) {
let secondlast = this.info.moves[this.info.moves.length - 2];
let lastmove = this.info.moves[this.info.moves.length - 1];
let dx = lastmove.x - this.info.x;
let dy = lastmove.y - this.info.y;
let ddx, ddy = 0;
if (secondlast) {
ddx = lastmove.x - secondlast.x;
ddy = lastmove.y - secondlast.y;
}
_fire(target, 'track', {
state: this.info.state,
x: touch.clientX,
y: touch.clientY,
dx: dx,
dy: dy,
ddx: ddx,
ddy: ddy,
sourceEvent: touch,
hover: function() {
return deepTargetFind(touch.clientX, touch.clientY);
}
});
/**
* @param {!GestureInfo} info
* @param {number} x
* @param {number} y
* @return {boolean}
*/
function trackHasMovedEnough(info, x, y) {
if (info.prevent) {
return false;
}
if (info.started) {
return true;
}
let dx = Math.abs(info.x - x);
let dy = Math.abs(info.y - y);
return (dx >= TRACK_DISTANCE || dy >= TRACK_DISTANCE);
}
});
/**
* @param {!GestureInfo} info
* @param {?EventTarget} target
* @param {Touch} touch
* @return {void}
*/
function trackFire(info, target, touch) {
if (!target) {
return;
}
let secondlast = info.moves[info.moves.length - 2];
let lastmove = info.moves[info.moves.length - 1];
let dx = lastmove.x - info.x;
let dy = lastmove.y - info.y;
let ddx, ddy = 0;
if (secondlast) {
ddx = lastmove.x - secondlast.x;
ddy = lastmove.y - secondlast.y;
}
_fire(target, 'track', {
state: info.state,
x: touch.clientX,
y: touch.clientY,
dx: dx,
dy: dy,
ddx: ddx,
ddy: ddy,
sourceEvent: touch,
hover: function() {
return deepTargetFind(touch.clientX, touch.clientY);
}
});
}

@@ -1031,14 +1073,6 @@ register({

*/
save: function(e) {
this.info.x = e.clientX;
this.info.y = e.clientY;
},
/**
* @this {GestureRecognizer}
* @param {MouseEvent} e
* @return {void}
*/
mousedown: function(e) {
if (hasLeftMouseButton(e)) {
this.save(e);
this.info.x = e.clientX;
this.info.y = e.clientY;
}

@@ -1053,3 +1087,3 @@ },

if (hasLeftMouseButton(e)) {
this.forward(e);
trackForward(this.info, e);
}

@@ -1063,3 +1097,5 @@ },

touchstart: function(e) {
this.save(e.changedTouches[0], e);
const touch = e.changedTouches[0];
this.info.x = touch.clientX;
this.info.y = touch.clientY;
},

@@ -1072,33 +1108,34 @@ /**

touchend: function(e) {
this.forward(e.changedTouches[0], e);
},
/**
* @this {GestureRecognizer}
* @param {Event | Touch} e
* @param {Event=} preventer
* @return {void}
*/
forward: function(e, preventer) {
let dx = Math.abs(e.clientX - this.info.x);
let dy = Math.abs(e.clientY - this.info.y);
// find original target from `preventer` for TouchEvents, or `e` for MouseEvents
let t = _findOriginalTarget((preventer || e));
if (!t || t.disabled) {
return;
}
// dx,dy can be NaN if `click` has been simulated and there was no `down` for `start`
if (isNaN(dx) || isNaN(dy) || (dx <= TAP_DISTANCE && dy <= TAP_DISTANCE) || isSyntheticClick(e)) {
// prevent taps from being generated if an event has canceled them
if (!this.info.prevent) {
_fire(t, 'tap', {
x: e.clientX,
y: e.clientY,
sourceEvent: e,
preventer: preventer
});
}
}
trackForward(this.info, e.changedTouches[0], e);
}
});
/**
* @param {!GestureInfo} info
* @param {Event | Touch} e
* @param {Event=} preventer
* @return {void}
*/
function trackForward(info, e, preventer) {
let dx = Math.abs(e.clientX - info.x);
let dy = Math.abs(e.clientY - info.y);
// find original target from `preventer` for TouchEvents, or `e` for MouseEvents
let t = _findOriginalTarget((preventer || e));
if (!t || (canBeDisabled[/** @type {!HTMLElement} */(t).localName] && t.hasAttribute('disabled'))) {
return;
}
// dx,dy can be NaN if `click` has been simulated and there was no `down` for `start`
if (isNaN(dx) || isNaN(dy) || (dx <= TAP_DISTANCE && dy <= TAP_DISTANCE) || isSyntheticClick(e)) {
// prevent taps from being generated if an event has canceled them
if (!info.prevent) {
_fire(t, 'tap', {
x: e.clientX,
y: e.clientY,
sourceEvent: e,
preventer: preventer
});
}
}
}
/* eslint-enable valid-jsdoc */

@@ -1105,0 +1142,0 @@

@@ -24,2 +24,3 @@ /**

* @return {string} LiteralString string value
* @override
*/

@@ -26,0 +27,0 @@ toString() {

@@ -18,2 +18,3 @@ /**

* @extends {Function}
* @private
*/

@@ -65,4 +66,4 @@ function MixinFunction(){}

return /** @type {T} */ (dedupingMixin);
return dedupingMixin;
};
/* eslint-enable valid-jsdoc */

@@ -20,5 +20,7 @@ /**

let newInstance = null;
/**
* @constructor
* @extends {HTMLTemplateElement}
* @private
*/

@@ -32,2 +34,3 @@ function HTMLTemplateElementExtension() { return newInstance; }

});
/**

@@ -37,4 +40,6 @@ * @constructor

* @extends {HTMLTemplateElementExtension}
* @private
*/
const DataTemplate = PropertyEffects(HTMLTemplateElementExtension);
/**

@@ -44,2 +49,3 @@ * @constructor

* @extends {DataTemplate}
* @private
*/

@@ -56,6 +62,7 @@ const MutableDataTemplate = MutableData(DataTemplate);

// Base class for TemplateInstance's
/**
* Base class for TemplateInstance.
* @constructor
* @implements {Polymer_PropertyEffects}
* @private
*/

@@ -272,2 +279,3 @@ const base = PropertyEffects(class {});

* @implements {Polymer_MutableData}
* @private
*/

@@ -316,2 +324,3 @@ const MutableTemplateInstanceBase = MutableData(TemplateInstanceBase);

let base = options.mutableData ? MutableDataTemplate : DataTemplate;
/** @private */
klass = templateInfo.templatizeTemplateClass =

@@ -318,0 +327,0 @@ class TemplatizedTemplate extends base {};

{
"name": "@polymer/polymer",
"version": "3.0.2",
"version": "3.0.3",
"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",

@@ -12,3 +12,3 @@ "main": "polymer-element.js",

"@polymer/gen-closure-declarations": "^0.4.0",
"@polymer/gen-typescript-declarations": "^1.2.0",
"@polymer/gen-typescript-declarations": "^1.4.0",
"@polymer/iron-component-page": "^3.0.0-pre.12",

@@ -34,6 +34,6 @@ "@polymer/test-fixture": "^3.0.0-pre.12",

"parse5": "^4.0.0",
"polymer-build": "^2.1.1",
"polymer-build": "^3.0.4",
"polymer-cli": "^1.7.0",
"run-sequence": "^2.2.0",
"through2": "^2.0.0",
"typescript": "^2.9.2",
"wct-browser-legacy": "^1.0.0"

@@ -46,3 +46,6 @@ },

"lint": "gulp lint",
"update-types": "gulp update-types"
"generate-types": "gulp generate-types && npm run verify-types",
"verify-types": "tsc --project verify-types-tsconfig.json",
"regen-package-lock": "rm -rf node_modules package-lock.json; npm install",
"prepack": "npm run generate-types"
},

@@ -70,3 +73,11 @@ "repository": {

"@webcomponents/shadycss": "^1.2.0"
}
},
"files": [
"externs",
"lib",
"types/**/*.d.ts",
"index.html",
"polymer-*.js",
"manifest.json"
]
}
# Polymer
[![Build Status](https://travis-ci.org/Polymer/polymer.svg?branch=master)](https://travis-ci.org/Polymer/polymer)
[![Published on npm](https://img.shields.io/npm/v/@polymer/polymer.svg)](https://www.npmjs.com/package/@polymer/polymer)
[![Published on webcomponents.org](https://img.shields.io/badge/webcomponents.org-published-blue.svg)](https://www.webcomponents.org/element/@polymer/polymer)
> ℹ️ Note: This is the current stable version of the Polymer library. At Google I/O 2018 we announced a new Web Component base class, [`LitElement`](https://github.com/PolymerLabs/lit-element), as a successor to the `PolymerElement` base class in this library.
> ℹ️ Note: This is the current stable version of the Polymer library. At Google I/O 2018 we announced a new Web Component base class, [`LitElement`](https://github.com/Polymer/lit-element), as a successor to the `PolymerElement` base class in this library.
>

@@ -11,3 +13,3 @@ > If you're starting a new project, we recommend that you consider using LitElement instead.

Polymer lets you build encapsulated, reusable [Web Components](https://www.webcomponents.org/introduction) that work just like standard HTML elements, to use in building web applications. Using a Web Commponent built with Polymer is as simple as importing its definition then using it like any other HTML element:
Polymer lets you build encapsulated, reusable [Web Components](https://www.webcomponents.org/introduction) that work just like standard HTML elements, to use in building web applications. Using a Web Component built with Polymer is as simple as importing its definition then using it like any other HTML element:

@@ -36,3 +38,3 @@ ```html

* When you're ready to use Polymer in a project, install it via [npm](https://www.npmjs.com/). To run the project in the browser,
a module-compatible toolchain is required. We recommend installing the [Polymer CLI](https://github.com/Polymer/polymer-cli) to and using its development server as follows.
a module-compatible toolchain is required. We recommend installing the [Polymer CLI](https://github.com/Polymer/tools/tree/master/packages/cli) to and using its development server as follows.

@@ -47,7 +49,7 @@ 1. Add Polymer to your project:

```npm i -g polymer-cli@next```
```npm i -g polymer-cli```
1. Run the development server and open a browser pointing to its URL:
```polymer serve```
```polymer serve --npm```

@@ -54,0 +56,0 @@ > Polymer 3.0 is published on [npm](https://www.npmjs.com/package/@polymer/polymer) using JavaScript Modules.

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc