Down to 30ish warnings, need PolymerPass v2

This commit is contained in:
Daniel Freedman
2017-06-06 11:35:38 -07:00
parent 872e1c277f
commit de87c5850c
17 changed files with 1824 additions and 1041 deletions

View File

@@ -1,569 +1,141 @@
gulp-google-closure-compiler: externs/closure-types.js:780: WARNING - property connectedCallback not defined on any supertype of Polymer_ElementMixin gulp-google-closure-compiler: externs/closure-types.js:1053: WARNING - property connectedCallback not defined on any supertype of Polymer_ElementMixin
Polymer_ElementMixin.prototype.connectedCallback = function(){}; Polymer_ElementMixin.prototype.connectedCallback = function(){};
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
externs/closure-types.js:784: WARNING - property disconnectedCallback not defined on any supertype of Polymer_ElementMixin externs/closure-types.js:1057: WARNING - property disconnectedCallback not defined on any supertype of Polymer_ElementMixin
Polymer_ElementMixin.prototype.disconnectedCallback = function(){}; Polymer_ElementMixin.prototype.disconnectedCallback = function(){};
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
externs/closure-types.js:1435: WARNING - property mutableData on interface Polymer_OptionalMutableData is not implemented by type OptionalMutableData externs/closure-types.js:2036: WARNING - property mutableData on interface Polymer_OptionalMutableData is not implemented by type OptionalMutableData
Polymer_OptionalMutableData.prototype.mutableData; Polymer_OptionalMutableData.prototype.mutableData;
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
externs/closure-types.js:1449: WARNING - property items on interface Polymer_ArraySelectorMixin is not implemented by type ArraySelectorMixin externs/closure-types.js:2051: WARNING - property items on interface Polymer_ArraySelectorMixin is not implemented by type ArraySelectorMixin
Polymer_ArraySelectorMixin.prototype.items; Polymer_ArraySelectorMixin.prototype.items;
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
externs/closure-types.js:1452: WARNING - property multi on interface Polymer_ArraySelectorMixin is not implemented by type ArraySelectorMixin externs/closure-types.js:2054: WARNING - property multi on interface Polymer_ArraySelectorMixin is not implemented by type ArraySelectorMixin
Polymer_ArraySelectorMixin.prototype.multi; Polymer_ArraySelectorMixin.prototype.multi;
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
externs/closure-types.js:1455: WARNING - property selected on interface Polymer_ArraySelectorMixin is not implemented by type ArraySelectorMixin externs/closure-types.js:2063: WARNING - property toggle on interface Polymer_ArraySelectorMixin is not implemented by type ArraySelectorMixin
Polymer_ArraySelectorMixin.prototype.selected;
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
externs/closure-types.js:1458: WARNING - property selectedItem on interface Polymer_ArraySelectorMixin is not implemented by type ArraySelectorMixin
Polymer_ArraySelectorMixin.prototype.selectedItem;
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
externs/closure-types.js:1461: WARNING - property toggle on interface Polymer_ArraySelectorMixin is not implemented by type ArraySelectorMixin
Polymer_ArraySelectorMixin.prototype.toggle; Polymer_ArraySelectorMixin.prototype.toggle;
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
polymer.html_script_10.js:195: WARNING - Property __notifyEffects never defined on inst of type Element
let fxs = inst.__notifyEffects;
^^^^^^^^^^^^^^^^^^^^
polymer.html_script_10.js:227: WARNING - Missing return statement. Function expected to return boolean.
function notifyPath(inst, path, props) {
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
polymer.html_script_10.js:354: WARNING - Property __computeEffects never defined on inst of type Element
let computeEffects = inst.__computeEffects;
^^^^^^^^^^^^^^^^^^^^^
polymer.html_script_10.js:398: WARNING - Property __dataLinkedPaths never defined on inst of type Element
let links = inst.__dataLinkedPaths;
^^^^^^^^^^^^^^^^^^^^^^
polymer.html_script_10.js:1097: WARNING - Property __readOnly never defined on this of type PropertyEffects
let readOnly = this.__readOnly;
^^^^^^^^^^^^^^^
polymer.html_script_10.js:1257: WARNING - Invalid type for parameter 1 of function computeLinkedPaths.
Expected : Element|null
Found : PropertyEffects{__dataHasPaths:true}
computeLinkedPaths(this, path, value);
^^^^
polymer.html_script_10.js:1257: WARNING - Invalid type for parameter 2 of function computeLinkedPaths.
Expected : string
Found : Array<number|string>|string
More details:
The found type is a union that includes an unexpected type: Array<number|string>
computeLinkedPaths(this, path, value);
^^^^
polymer.html_script_10.js:1534: WARNING - Invalid type for parameter 1 of function runComputedEffects.
Expected : Element|null
Found : PropertyEffects{__dataHasPaths:false}
runComputedEffects(this, changedProps, oldProps, hasPaths);
^^^^
polymer.html_script_10.js:1534: WARNING - Invalid type for parameter 2 of function runComputedEffects.
Expected : Object
Found : *
runComputedEffects(this, changedProps, oldProps, hasPaths);
^^^^^^^^^^^^
polymer.html_script_10.js:1534: WARNING - Invalid type for parameter 3 of function runComputedEffects.
Expected : Object
Found : *
runComputedEffects(this, changedProps, oldProps, hasPaths);
^^^^^^^^
polymer.html_script_10.js:1540: WARNING - Invalid type for parameter 1 of function this._propagatePropertyChanges.
Expected : Object|null
Found : *
this._propagatePropertyChanges(changedProps, oldProps, hasPaths);
^^^^^^^^^^^^
polymer.html_script_10.js:1540: WARNING - Invalid type for parameter 2 of function this._propagatePropertyChanges.
Expected : Object|null
Found : *
this._propagatePropertyChanges(changedProps, oldProps, hasPaths);
^^^^^^^^
polymer.html_script_10.js:1544: WARNING - Property __reflectEffects never defined on this of type PropertyEffects{__dataHasPaths:false, __dataToNotify:null}
runEffects(this, this.__reflectEffects, changedProps, oldProps, hasPaths);
^^^^^^^^^^^^^^^^^^^^^
polymer.html_script_10.js:1544: WARNING - Invalid type for parameter 3 of function runEffects.
Expected : Object|null
Found : *
runEffects(this, this.__reflectEffects, changedProps, oldProps, hasPaths);
^^^^^^^^^^^^
polymer.html_script_10.js:1544: WARNING - Invalid type for parameter 4 of function runEffects.
Expected : Object|null|undefined
Found : *
runEffects(this, this.__reflectEffects, changedProps, oldProps, hasPaths);
^^^^^^^^
polymer.html_script_10.js:1546: WARNING - Property __observeEffects never defined on this of type PropertyEffects{__dataHasPaths:false, __dataToNotify:null}
runEffects(this, this.__observeEffects, changedProps, oldProps, hasPaths);
^^^^^^^^^^^^^^^^^^^^^
polymer.html_script_10.js:1546: WARNING - Invalid type for parameter 3 of function runEffects.
Expected : Object|null
Found : *
runEffects(this, this.__observeEffects, changedProps, oldProps, hasPaths);
^^^^^^^^^^^^
polymer.html_script_10.js:1546: WARNING - Invalid type for parameter 4 of function runEffects.
Expected : Object|null|undefined
Found : *
runEffects(this, this.__observeEffects, changedProps, oldProps, hasPaths);
^^^^^^^^
polymer.html_script_10.js:1549: WARNING - Invalid type for parameter 1 of function runNotifyEffects.
Expected : Element|null
Found : PropertyEffects{__dataHasPaths:false, __dataToNotify:null}
runNotifyEffects(this, notifyProps, changedProps, oldProps, hasPaths);
^^^^
polymer.html_script_10.js:1549: WARNING - Invalid type for parameter 3 of function runNotifyEffects.
Expected : Object|null
Found : *
runNotifyEffects(this, notifyProps, changedProps, oldProps, hasPaths);
^^^^^^^^^^^^
polymer.html_script_10.js:1549: WARNING - Invalid type for parameter 4 of function runNotifyEffects.
Expected : Object|null
Found : *
runNotifyEffects(this, notifyProps, changedProps, oldProps, hasPaths);
^^^^^^^^
polymer.html_script_10.js:1552: WARNING - Property __dataCounter never defined on this of type PropertyEffects{__dataHasPaths:false, __dataToNotify:null}
if (this.__dataCounter == 1) {
^^^^^^^^^^^^^^^^^^
polymer.html_script_10.js:1644: WARNING - Invalid type for parameter 1 of function notifySplices.
Expected : Element|null
Found : PropertyEffects
notifySplices(this, array, info.path, splices);
^^^^
polymer.html_script_10.js:1644: WARNING - Property path never defined on info of type Object{}
notifySplices(this, array, info.path, splices);
^^^^^^^^^
polymer.html_script_10.js:1722: WARNING - Invalid type for parameter 1 of function notifySplice.
Expected : Element|null
Found : PropertyEffects
notifySplice(this, array, info.path, len, items.length, []);
^^^^
polymer.html_script_10.js:1722: WARNING - Property path never defined on info of type Object{}
notifySplice(this, array, info.path, len, items.length, []);
^^^^^^^^^
polymer.html_script_10.js:1746: WARNING - Invalid type for parameter 1 of function notifySplice.
Expected : Element|null
Found : PropertyEffects
notifySplice(this, array, info.path, array.length, 0, [ret]);
^^^^
polymer.html_script_10.js:1746: WARNING - Property path never defined on info of type Object{}
notifySplice(this, array, info.path, array.length, 0, [ret]);
^^^^^^^^^
polymer.html_script_10.js:1782: WARNING - Invalid type for parameter 1 of function notifySplice.
Expected : Element|null
Found : PropertyEffects
notifySplice(this, array, info.path, start, items.length, ret);
^^^^
polymer.html_script_10.js:1782: WARNING - Property path never defined on info of type Object{}
notifySplice(this, array, info.path, start, items.length, ret);
^^^^^^^^^
polymer.html_script_10.js:1806: WARNING - Invalid type for parameter 1 of function notifySplice.
Expected : Element|null
Found : PropertyEffects
notifySplice(this, array, info.path, 0, 0, [ret]);
^^^^
polymer.html_script_10.js:1806: WARNING - Property path never defined on info of type Object{}
notifySplice(this, array, info.path, 0, 0, [ret]);
^^^^^^^^^
polymer.html_script_10.js:1830: WARNING - Invalid type for parameter 1 of function notifySplice.
Expected : Element|null
Found : PropertyEffects
notifySplice(this, array, info.path, 0, items.length, []);
^^^^
polymer.html_script_10.js:1830: WARNING - Property path never defined on info of type Object{}
notifySplice(this, array, info.path, 0, items.length, []);
^^^^^^^^^
polymer.html_script_10.js:1854: WARNING - Property path never defined on info of type Object{}
propPath = info.path;
^^^^^^^^^
polymer.html_script_10.js:2226: WARNING - Property nodeList never defined on dom of type DocumentFragment
templateInfo.nodeList = dom.nodeList;
^^^^^^^^^^^^
polymer.html_script_10.js:2255: WARNING - Property templateInfo never defined on dom of type DocumentFragment
let templateInfo = dom.templateInfo;
^^^^^^^^^^^^^^^^
polymer.html_script_10.js:2293: WARNING - Property _parseTemplateNode never defined on propertyEffectsBase of type propertyEffectsBase<|function(new:propertyEffectsBase):?|>
let noted = super._parseTemplateNode(node, templateInfo, nodeInfo);
^^^^^^^^^^^^^^^^^^^^^^^^
polymer.html_script_10.js:2301: WARNING - Function addBinding: called with 6 argument(s). Function requires at least 7 argument(s) and at most 7.
addBinding(this, templateInfo, nodeInfo, 'text', 'textContent', parts);
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
polymer.html_script_10.js:2358: WARNING - Property _parseTemplateNodeAttribute never defined on propertyEffectsBase of type propertyEffectsBase<|function(new:propertyEffectsBase):?|>
return super._parseTemplateNodeAttribute(node, templateInfo, nodeInfo, name, value);
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
polymer.html_script_10.js:2376: WARNING - Property _parseTemplateNestedTemplate never defined on propertyEffectsBase of type propertyEffectsBase<|function(new:propertyEffectsBase):?|>
let noted = super._parseTemplateNestedTemplate(node, templateInfo, nodeInfo);
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
polymer.html_script_10.js:2382: WARNING - Function addBinding: called with 6 argument(s). Function requires at least 7 argument(s) and at most 7.
addBinding(this, templateInfo, nodeInfo, 'property', '_host_' + source, parts);
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
polymer.html_script_10.js:2420: WARNING - Missing return statement. Function expected to return Array<Object|null>|null.
static _parseBindings(text, templateInfo) {
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
polymer.html_script_11.js:181: WARNING - Property prototype never defined on klass of type HTMLElement{__classProperties:Object|null}
let superCtor = Object.getPrototypeOf(klass.prototype).constructor;
^^^^^^^^^^^^^^^
polymer.html_script_11.js:636: WARNING - Property $ never defined on this.root of type DocumentFragment
this.$ = this.root.$;
^^^^^^^^^^^
polymer.html_script_11.js:766: WARNING - Property _parseTemplateContent never defined on polymerElementBase of type polymerElementBase<|function(new:polymerElementBase):?|>
return super._parseTemplateContent(template, templateInfo, nodeInfo);
^^^^^^^^^^^^^^^^^^^^^^^^^^^
polymer.html_script_22.js:853: WARNING - Function this.splice: called with 3 argument(s). Function requires at least 4 argument(s) and at most 4.
return this.splice(arrayOrPath, index, 1);
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
polymer.html_script_23.js:141: WARNING - Property is never defined on this of type PolymerGenerated
Polymer.DomModule.import(this.is, 'template') ||
^^^^^^^
polymer.html_script_23.js:146: WARNING - Property prototype never defined on this of type PolymerGenerated
this.prototype._template;
^^^^^^^^^^^^^^
polymer.html_script_23.js:177: WARNING - Property _addMethodEventListenerToNode never defined on this of type PolymerGenerated
this._addMethodEventListenerToNode(this, l, info.listeners[l]);
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
polymer.html_script_23.js:188: WARNING - Property _ensureAttribute never defined on this of type PolymerGenerated
this._ensureAttribute(a, info.hostAttributes[a]);
^^^^^^^^^^^^^^^^^^^^^
polymer.html_script_23.js:304: WARNING - Type annotation references non-existent type Polymer.LegacyElement.
* @return {Polymer.LegacyElement} Generated class
^^^^^^^^^^^^^^^^^^^^^
polymer.html_script_23.js:313: WARNING - Invalid type for parameter 2 of function mixinBehaviors.
Expected : HTMLElement|null
Found : HTMLElement<|function(new:HTMLElement):?|>
mixinBehaviors(info.behaviors, HTMLElement) :
^^^^^^^^^^^
polymer.html_script_24.js:19: WARNING - Type annotation references non-existent type Polymer.LegacyElement.
* @return {Polymer.LegacyElement} Generated class
^^^^^^^^^^^^^^^^^^^^^
polymer.html_script_24.js:21: WARNING - Found two declarations for property _polymerFn on window.Polymer.
window.Polymer._polymerFn = function(info) {
^^^^^^^^^^^^^^^^^^^^^^^^^
polymer.html_script_25.js:173: WARNING - Property mutableData never defined on this of type OptionalMutableData polymer.html_script_25.js:173: WARNING - Property mutableData never defined on this of type OptionalMutableData
return mutablePropertyChange(this, property, value, old, this.mutableData); return mutablePropertyChange(this, property, value, old, this.mutableData);
^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^
polymer.html_script_26.js:118: WARNING - Property __dataHost never defined on this.__dataHost of type DataTemplate polymer.html_script_30.js:319: WARNING - Property as never defined on this of type DomRepeat{template:Element|null}
let templateHost = this.__dataHost.__dataHost;
^^^^^^^^^^^^^^^^^^^^^^^^^^
polymer.html_script_26.js:190: WARNING - Property __dataHost never defined on model.__dataHost of type DataTemplate
model = model.__dataHost.__dataHost;
^^^^^^^^^^^^^^^^^^^^^^^^^^^
polymer.html_script_26.js:435: WARNING - Returned type does not match declared return type.
Expected : TemplateInstanceBase|null
Found : polymer_html_script_26$classdecl$var2<|function(new:polymer_html_script_26$classdecl$var2,...?):undefined|>{prototype:polymer_html_script_26$classdecl$var2.prototype}
return klass;
^^^^^^^^^^^^^
polymer.html_script_28.js:49: WARNING - Cannot add property mutableData to a struct instance after it is constructed.
this.mutableData = true;
^^^^^^^^^^^^^^^^
polymer.html_script_28.js:86: WARNING - Function $jscomp$this.render: called with 1 argument(s). Function requires at least 0 argument(s) and at most 0.
this.render(template);
^^^^^^^^^^^^^^^^^^^^^
polymer.html_script_28.js:94: WARNING - Property _stampTemplate never defined on this of type DomBind
this.root = this._stampTemplate(template);
^^^^^^^^^^^^^^^^^^^
polymer.html_script_28.js:100: WARNING - Property _enableProperties never defined on this of type DomBind{__children:Array<?>, root:{$:?, firstChild:?} (loose)}
this._enableProperties();
^^^^^^^^^^^^^^^^^^^^^^
polymer.html_script_30.js:279: WARNING - Cannot add property __isDetached to a struct instance after it is constructed.
this.__isDetached = true;
^^^^^^^^^^^^^^^^^
polymer.html_script_30.js:302: WARNING - Cannot add property template to a struct instance after it is constructed.
let template = this.template = this.querySelector('template');
^^^^^^^^^^^^^
polymer.html_script_30.js:318: WARNING - Property as never defined on this of type DomRepeat
instanceProps[this.as] = true; instanceProps[this.as] = true;
^^^^^^^ ^^^^^^^
polymer.html_script_30.js:319: WARNING - Property indexAs never defined on this of type DomRepeat polymer.html_script_30.js:320: WARNING - Property indexAs never defined on this of type DomRepeat{template:Element|null}
instanceProps[this.indexAs] = true; instanceProps[this.indexAs] = true;
^^^^^^^^^^^^ ^^^^^^^^^^^^
polymer.html_script_30.js:320: WARNING - Property itemsIndexAs never defined on this of type DomRepeat polymer.html_script_30.js:321: WARNING - Property itemsIndexAs never defined on this of type DomRepeat{template:Element|null}
instanceProps[this.itemsIndexAs] = true; instanceProps[this.itemsIndexAs] = true;
^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^
polymer.html_script_30.js:322: WARNING - Property mutableData never defined on this of type DomRepeat polymer.html_script_30.js:364: WARNING - Property __dataHost never defined on this of type DomRepeat
mutableData: this.mutableData,
^^^^^^^^^^^^^^^^
polymer.html_script_30.js:363: WARNING - Property __dataHost never defined on this of type DomRepeat
return this.__dataHost._methodHost || this.__dataHost; return this.__dataHost._methodHost || this.__dataHost;
^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^
polymer.html_script_30.js:415: WARNING - Property _targetFrameTime never defined on this of type DomRepeat polymer.html_script_30.js:416: WARNING - Property _targetFrameTime never defined on this of type DomRepeat
let ratio = this._targetFrameTime / (currChunkTime - this.__lastChunkTime); let ratio = this._targetFrameTime / (currChunkTime - this.__lastChunkTime);
^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^
polymer.html_script_30.js:449: WARNING - Property delay never defined on this of type DomRepeat{__needFullRefresh:true, __observePaths:truthy} polymer.html_script_30.js:450: WARNING - Property delay never defined on this of type DomRepeat{__needFullRefresh:true, __observePaths:truthy}
this.__debounceRender(this.__render, this.delay); this.__debounceRender(this.__render, this.delay);
^^^^^^^^^^ ^^^^^^^^^^
polymer.html_script_30.js:463: WARNING - Invalid type for parameter 1 of function Polymer.Async.timeOut.after. polymer.html_script_30.js:496: WARNING - Property _setRenderedItemCount never defined on this of type DomRepeat{__pool:{length:number} (loose)}
Expected : number
Found : number|undefined
More details:
The found type is a union that includes an unexpected type: undefined
, delay > 0 ? Polymer.Async.timeOut.after(delay) : Polymer.Async.microTask
^^^^^
polymer.html_script_30.js:495: WARNING - Property _setRenderedItemCount never defined on this of type DomRepeat{__pool:{length:number} (loose)}
this._setRenderedItemCount(this.__instances.length); this._setRenderedItemCount(this.__instances.length);
^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^
polymer.html_script_30.js:531: WARNING - Property as never defined on this of type DomRepeat{__instances:Object, __itemsIdxToInstIdx:Object{}, __limit:number, items:?=} polymer.html_script_30.js:532: WARNING - Property as never defined on this of type DomRepeat{__instances:Object, __itemsIdxToInstIdx:Object{}, __limit:number, items:?=}
inst._setPendingProperty(this.as, item); inst._setPendingProperty(this.as, item);
^^^^^^^ ^^^^^^^
polymer.html_script_30.js:532: WARNING - Property indexAs never defined on this of type DomRepeat{__instances:Object, __itemsIdxToInstIdx:Object{}, __limit:number, items:?=} polymer.html_script_30.js:533: WARNING - Property indexAs never defined on this of type DomRepeat{__instances:Object, __itemsIdxToInstIdx:Object{}, __limit:number, items:?=}
inst._setPendingProperty(this.indexAs, instIdx); inst._setPendingProperty(this.indexAs, instIdx);
^^^^^^^^^^^^ ^^^^^^^^^^^^
polymer.html_script_30.js:533: WARNING - Property itemsIndexAs never defined on this of type DomRepeat{__instances:Object, __itemsIdxToInstIdx:Object{}, __limit:number, items:?=} polymer.html_script_30.js:534: WARNING - Property itemsIndexAs never defined on this of type DomRepeat{__instances:Object, __itemsIdxToInstIdx:Object{}, __limit:number, items:?=}
inst._setPendingProperty(this.itemsIndexAs, itemIdx); inst._setPendingProperty(this.itemsIndexAs, itemIdx);
^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^
polymer.html_script_30.js:569: WARNING - Property as never defined on this of type DomRepeat polymer.html_script_30.js:570: WARNING - Property as never defined on this of type DomRepeat
model[this.as] = item; model[this.as] = item;
^^^^^^^ ^^^^^^^
polymer.html_script_30.js:570: WARNING - Property indexAs never defined on this of type DomRepeat polymer.html_script_30.js:571: WARNING - Property indexAs never defined on this of type DomRepeat
model[this.indexAs] = instIdx; model[this.indexAs] = instIdx;
^^^^^^^^^^^^ ^^^^^^^^^^^^
polymer.html_script_30.js:571: WARNING - Property itemsIndexAs never defined on this of type DomRepeat polymer.html_script_30.js:572: WARNING - Property itemsIndexAs never defined on this of type DomRepeat
model[this.itemsIndexAs] = itemIdx; model[this.itemsIndexAs] = itemIdx;
^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^
polymer.html_script_30.js:580: WARNING - Property as never defined on this of type DomRepeat{__pool:{pop:LOOSE_TOP_FUNCTION} (loose)} polymer.html_script_30.js:581: WARNING - Property as never defined on this of type DomRepeat{__pool:{pop:LOOSE_TOP_FUNCTION} (loose)}
inst._setPendingProperty(this.as, item); inst._setPendingProperty(this.as, item);
^^^^^^^ ^^^^^^^
polymer.html_script_30.js:581: WARNING - Property indexAs never defined on this of type DomRepeat{__pool:{pop:LOOSE_TOP_FUNCTION} (loose)} polymer.html_script_30.js:582: WARNING - Property indexAs never defined on this of type DomRepeat{__pool:{pop:LOOSE_TOP_FUNCTION} (loose)}
inst._setPendingProperty(this.indexAs, instIdx); inst._setPendingProperty(this.indexAs, instIdx);
^^^^^^^^^^^^ ^^^^^^^^^^^^
polymer.html_script_30.js:582: WARNING - Property itemsIndexAs never defined on this of type DomRepeat{__pool:{pop:LOOSE_TOP_FUNCTION} (loose)} polymer.html_script_30.js:583: WARNING - Property itemsIndexAs never defined on this of type DomRepeat{__pool:{pop:LOOSE_TOP_FUNCTION} (loose)}
inst._setPendingProperty(this.itemsIndexAs, itemIdx); inst._setPendingProperty(this.itemsIndexAs, itemIdx);
^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^
polymer.html_script_30.js:616: WARNING - Property as never defined on this of type DomRepeat{__instances:Object, __itemsIdxToInstIdx:Object} polymer.html_script_30.js:617: WARNING - Property as never defined on this of type DomRepeat{__instances:Object, __itemsIdxToInstIdx:Object}
let itemPath = this.as + (itemSubPath ? '.' + itemSubPath : ''); let itemPath = this.as + (itemSubPath ? '.' + itemSubPath : '');
^^^^^^^ ^^^^^^^
polymer.html_script_30.js:640: WARNING - Property as never defined on this of type DomRepeat polymer.html_script_30.js:641: WARNING - Property as never defined on this of type DomRepeat
return instance && instance[this.as]; return instance && instance[this.as];
^^^^^^^ ^^^^^^^
polymer.html_script_30.js:654: WARNING - Property indexAs never defined on this of type DomRepeat polymer.html_script_30.js:655: WARNING - Property indexAs never defined on this of type DomRepeat
return instance && instance[this.indexAs]; return instance && instance[this.indexAs];
^^^^^^^^^^^^ ^^^^^^^^^^^^
polymer.html_script_30.js:675: WARNING - Property template never defined on this of type DomRepeat polymer.html_script_31.js:221: WARNING - Property __dataHost never defined on this of type DomIf{__instance:{_setPendingProperty:LOOSE_TOP_FUNCTION} (loose)}
return Polymer.Templatize.modelForElement(this.template, el);
^^^^^^^^^^^^^
polymer.html_script_31.js:142: WARNING - Property _lastIf never defined on this of type DomIf{__instance:?, if:?=, restamp:?=}
if (this.if != this._lastIf) {
^^^^^^^^^^^^
polymer.html_script_31.js:147: WARNING - Cannot add property _lastIf to a struct instance after it is constructed.
this._lastIf = this.if;
^^^^^^^^^^^^
polymer.html_script_31.js:170: WARNING - Cannot add property __ctor to a struct instance after it is constructed.
this.__ctor = Polymer.Templatize.templatize(template, this, {
^^^^^^^^^^^
polymer.html_script_31.js:219: WARNING - Property __dataHost never defined on this of type DomIf{__instance:{_setPendingProperty:LOOSE_TOP_FUNCTION} (loose)}
this.__instance._setPendingProperty(prop, this.__dataHost[prop]); this.__instance._setPendingProperty(prop, this.__dataHost[prop]);
^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^
polymer.html_script_31.js:242: WARNING - Property if never defined on this of type DomIf polymer.html_script_31.js:244: WARNING - Property if never defined on this of type DomIf
let hidden = this.__hideTemplateChildren__ || !this.if; let hidden = this.__hideTemplateChildren__ || !this.if;
^^^^^^^ ^^^^^^^
polymer.html_script_32.js:143: WARNING - Property items never defined on this of type ArraySelectorMixin polymer.html_script_32.js:154: WARNING - Property items never defined on this of type ArraySelectorMixin
if (selected.has(this.items[idx])) { if (selected.has(this.items[idx])) {
^^^^^^^^^^ ^^^^^^^^^^
polymer.html_script_32.js:144: WARNING - Property items never defined on this of type ArraySelectorMixin polymer.html_script_32.js:155: WARNING - Property items never defined on this of type ArraySelectorMixin
selected.set(this.items[idx], idx); selected.set(this.items[idx], idx);
^^^^^^^^^^ ^^^^^^^^^^
polymer.html_script_32.js:155: WARNING - Property splice never defined on $jscomp$this of type ArraySelectorMixin{multi:truthy} polymer.html_script_32.js:228: WARNING - Property items never defined on this of type ArraySelectorMixin
this.splice('selected', sidx, 1);
^^^^^^^^^^^
polymer.html_script_32.js:157: WARNING - Cannot add property selected to a struct instance after it is constructed.
this.selected = this.selectedItem = null;
^^^^^^^^^^^^^
polymer.html_script_32.js:157: WARNING - Cannot add property selectedItem to a struct instance after it is constructed.
this.selected = this.selectedItem = null;
^^^^^^^^^^^^^^^^^
polymer.html_script_32.js:167: WARNING - Cannot add property __dataLinkedPaths to a struct instance after it is constructed.
this.__dataLinkedPaths = {};
^^^^^^^^^^^^^^^^^^^^^^
polymer.html_script_32.js:172: WARNING - Property linkPaths never defined on $jscomp$this of type ArraySelectorMixin
this.linkPaths('items.' + idx, 'selected.' + sidx++);
^^^^^^^^^^^^^^
polymer.html_script_32.js:177: WARNING - Property linkPaths never defined on $jscomp$this of type ArraySelectorMixin
this.linkPaths('selected', 'items.' + idx);
^^^^^^^^^^^^^^
polymer.html_script_32.js:178: WARNING - Property linkPaths never defined on $jscomp$this of type ArraySelectorMixin
this.linkPaths('selectedItem', 'items.' + idx);
^^^^^^^^^^^^^^
polymer.html_script_32.js:189: WARNING - Cannot add property __dataLinkedPaths to a struct instance after it is constructed.
this.__dataLinkedPaths = {};
^^^^^^^^^^^^^^^^^^^^^^
polymer.html_script_32.js:196: WARNING - Cannot add property selected to a struct instance after it is constructed.
this.selected = this.multi ? [] : null
^^^^^^^^^^^^^
polymer.html_script_32.js:197: WARNING - Cannot add property selectedItem to a struct instance after it is constructed.
this.selectedItem = null;
^^^^^^^^^^^^^^^^^
polymer.html_script_32.js:217: WARNING - Property items never defined on this of type ArraySelectorMixin
return this.isSelected(this.items[idx]); return this.isSelected(this.items[idx]);
^^^^^^^^^^ ^^^^^^^^^^
polymer.html_script_32.js:233: WARNING - Property __dataLinkedPaths never defined on this of type ArraySelectorMixin polymer.html_script_32.js:278: WARNING - Property items never defined on this of type ArraySelectorMixin
let selected = this.__dataLinkedPaths['items.' + idx];
^^^^^^^^^^^^^^^^^^^^^^
polymer.html_script_32.js:254: WARNING - Property splice never defined on this
this.splice('selected', sidx, 1);
^^^^^^^^^^^
polymer.html_script_32.js:256: WARNING - Cannot add property selected to a struct instance after it is constructed.
this.selected = this.selectedItem = null;
^^^^^^^^^^^^^
polymer.html_script_32.js:256: WARNING - Cannot add property selectedItem to a struct instance after it is constructed.
this.selected = this.selectedItem = null;
^^^^^^^^^^^^^^^^^
polymer.html_script_32.js:267: WARNING - Property items never defined on this of type ArraySelectorMixin
this.deselect(this.items[idx]); this.deselect(this.items[idx]);
^^^^^^^^^^ ^^^^^^^^^^
polymer.html_script_32.js:277: WARNING - Property items never defined on this of type ArraySelectorMixin polymer.html_script_32.js:288: WARNING - Property items never defined on this of type ArraySelectorMixin
this.selectIndex(this.items.indexOf(item)); this.selectIndex(this.items.indexOf(item));
^^^^^^^^^^ ^^^^^^^^^^
polymer.html_script_32.js:287: WARNING - Property items never defined on this of type ArraySelectorMixin polymer.html_script_32.js:298: WARNING - Property items never defined on this of type ArraySelectorMixin
let item = this.items[idx]; let item = this.items[idx];
^^^^^^^^^^ ^^^^^^^^^^
polymer.html_script_32.js:295: WARNING - Property push never defined on this of type ArraySelectorMixin{__selectedMap:{set:LOOSE_TOP_FUNCTION} (loose), multi:truthy=}
this.push('selected', item);
^^^^^^^^^
polymer.html_script_32.js:297: WARNING - Cannot add property selected to a struct instance after it is constructed.
this.selected = this.selectedItem = item;
^^^^^^^^^^^^^
polymer.html_script_32.js:297: WARNING - Cannot add property selectedItem to a struct instance after it is constructed.
this.selected = this.selectedItem = item;
^^^^^^^^^^^^^^^^^
polymer.html_script_34.js:5: WARNING - Property _mutablePropertyChange never defined on Polymer.MutableData of type function(?):? polymer.html_script_34.js:5: WARNING - Property _mutablePropertyChange never defined on Polymer.MutableData of type function(?):?
let mutablePropertyChange = Polymer.MutableData._mutablePropertyChange; let mutablePropertyChange = Polymer.MutableData._mutablePropertyChange;
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
0 error(s), 124 warning(s), 75.3% typed 0 error(s), 35 warning(s), 75.8% typed

File diff suppressed because it is too large Load Diff

View File

@@ -3,8 +3,48 @@
* @externs * @externs
*/ */
/* eslint-disable */
/** /**
* @param {!{is: string}} init * @typedef Object<string, {
* value: *,
* type: (Function | undefined),
* readOnly: (boolean | undefined),
* computed: (string | undefined),
* reflectToAttribute: (boolean | undefined),
* notify: (boolean | undefined),
* observer: (string | undefined)
* }>)
*/
let PolymerElementProperties;
/**
* @typedef {{
* is: string,
* extends: (string | undefined),
* properties: (!PolymerElementProperties | undefined),
* observers: (!Array<string> | undefined),
* template: (!HTMLTemplateElement | string | undefined),
* hostAttributes: (!Object<string, *> | undefined),
* listeners: (!Object<string, string> | undefined)
* }}
*/
let PolymerInit;
let PolymerElementConstructor = function () { };
/** @type {(string | undefined)} */
PolymerElementConstructor.is;
/** @type {(string | undefined)} */
PolymerElementConstructor.extends;
/** @type {(!PolymerElementProperties | undefined)} */
PolymerElementConstructor.properties;
/** @type {(!Array<string> | undefined)} */
PolymerElementConstructor.observers;
/** @type {(!HTMLTemplateElement | string | undefined)} */
PolymerElementConstructor.template;
/**
* @param {!PolymerInit} init
* @return {!HTMLElement} * @return {!HTMLElement}
*/ */
function Polymer(init){} function Polymer(init){}
@@ -32,4 +72,42 @@ PolymerTelemetry.prototype._regLog;
/** @type {function(HTMLElement)} */ /** @type {function(HTMLElement)} */
PolymerTelemetry.prototype.register; PolymerTelemetry.prototype.register;
/** @type {function(HTMLElement)} */ /** @type {function(HTMLElement)} */
PolymerTelemetry.prototype.dumpRegistrations; PolymerTelemetry.prototype.dumpRegistrations;
/**
* @typedef {{
* name: (string | undefined),
* structured: (boolean | undefined),
* wildcard: (boolean | undefined)
* }}
*/
var DataTrigger;
/**
* @typedef {{
* info: ?,
* trigger: (!DataTrigger | undefined),
* fn: (!Function | undefined)
* }}
*/
var DataEffect;
/**
* @record
* @extends {Polymer_PropertyEffects}
*/
function PropertyEffectsInstance(){}
/** @type {Object<string, !Array<!DataEffect>>} */
PropertyEffectsInstance.prototype.__computeEffects;
/** @type {Object<string, !Array<!DataEffect>>} */
PropertyEffectsInstance.prototype.__reflectEffects;
/** @type {Object<string, !Array<!DataEffect>>} */
PropertyEffectsInstance.prototype.__notifyEffects;
/** @type {Object<string, !Array<!DataEffect>>} */
PropertyEffectsInstance.prototype.__propagateEffects;
/** @type {Object<string, !Array<!DataEffect>>} */
PropertyEffectsInstance.prototype.__observeEffects;
/** @type {Object<string, !Array<!DataEffect>>} */
PropertyEffectsInstance.prototype.__readOnly;
/** @type {Object} */
PropertyEffectsInstance.prototype.__data;

View File

@@ -146,13 +146,11 @@ gulp.task('closure', ['clean'], () => {
rewrite_polyfills: false, rewrite_polyfills: false,
new_type_inf: true, new_type_inf: true,
checks_only: CLOSURE_LINT_ONLY, checks_only: CLOSURE_LINT_ONLY,
jscomp_warning: 'newCheckTypes',
jscomp_off: 'newCheckTypesExtraChecks',
externs: [ externs: [
'bower_components/shadycss/externs/shadycss-externs.js', 'bower_components/shadycss/externs/shadycss-externs.js',
'externs/webcomponents-externs.js', 'externs/webcomponents-externs.js',
'externs/polymer-externs.js',
'externs/closure-types.js', 'externs/closure-types.js',
'externs/polymer-externs.js',
], ],
extra_annotation_name: [ extra_annotation_name: [
'polymerMixin', 'polymerMixin',

View File

@@ -8,16 +8,17 @@ Code distributed by Google as part of the polymer project is also
subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
--> -->
<link rel="import" href="../../polymer-element.html"> <link rel="import" href="../mixins/property-effects.html">
<link rel="import" href="../utils/mixin.html"> <link rel="import" href="../utils/mixin.html">
<link rel="import" href="../utils/array-splice.html"> <link rel="import" href="../utils/array-splice.html">
<link rel="import" href="../../polymer-element.html">
<script> <script>
(function() { (function() {
'use strict'; 'use strict';
/** /**
* Element mixin for recording dynamic associations between item paths in a * Element mixin for recording dynamic associations between item paths in a
* master `items` array and a `selected` array such that path changes to the * master `items` array and a `selected` array such that path changes to the
* master array (at the host) element or elsewhere via data-binding) are * master array (at the host) element or elsewhere via data-binding) are
* correctly propagated to items in the selected array and vice-versa. * correctly propagated to items in the selected array and vice-versa.
@@ -31,15 +32,26 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
* is an array of multiply selected items. * is an array of multiply selected items.
* *
* @polymerMixin * @polymerMixin
* @mixes Polymer.PropertyEffects
* @memberof Polymer * @memberof Polymer
* @summary Element mixin for recording dynamic associations between item paths in a
* master `items` array and a `selected` array
*/ */
let ArraySelectorMixin = Polymer.dedupingMixin(superClass => { let ArraySelectorMixin = Polymer.dedupingMixin(superClass => {
/**
* @constructor
* @extends {superClass}
* @implements {Polymer_PropertyEffects}
*/
let propertyEffectsBase = Polymer.PropertyEffects(superClass);
/** /**
* @polymerMixinClass * @polymerMixinClass
* @implements {Polymer_ArraySelectorMixin} * @implements {Polymer_ArraySelectorMixin}
* @unrestricted
*/ */
class ArraySelectorMixin extends superClass { class ArraySelectorMixin extends propertyEffectsBase {
static get properties() { static get properties() {
@@ -391,7 +403,6 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
* ``` * ```
* *
* @polymerElement * @polymerElement
* @extends Polymer.Element
* @mixes Polymer.ArraySelectorMixin * @mixes Polymer.ArraySelectorMixin
* @memberof Polymer * @memberof Polymer
* @summary Custom element that links paths between an input `items` array and * @summary Custom element that links paths between an input `items` array and

View File

@@ -20,10 +20,10 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
/** /**
* @constructor * @constructor
* @extends {HTMLElement}
* @implements {Polymer_PropertyEffects} * @implements {Polymer_PropertyEffects}
* @implements {Polymer_OptionalMutableData} * @implements {Polymer_OptionalMutableData}
* @implements {Polymer_GestureEventListeners} * @implements {Polymer_GestureEventListeners}
* @extends {HTMLElement}
*/ */
const domBindBase = const domBindBase =
Polymer.GestureEventListeners( Polymer.GestureEventListeners(
@@ -43,7 +43,6 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
* @mixes Polymer.PropertyEffects * @mixes Polymer.PropertyEffects
* @mixes Polymer.OptionalMutableData * @mixes Polymer.OptionalMutableData
* @mixes Polymer.GestureEventListeners * @mixes Polymer.GestureEventListeners
* @extends HTMLElement
* @memberof Polymer * @memberof Polymer
* @summary Custom element to allow using Polymer's template features (data * @summary Custom element to allow using Polymer's template features (data
* binding, declarative event listeners, etc.) in the main document. * binding, declarative event listeners, etc.) in the main document.
@@ -87,18 +86,19 @@ 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 * Forces the element to render its content. This is typically only
* necessary to call if HTMLImports with the async attribute are used. * necessary to call if HTMLImports with the async attribute are used.
* @suppress {missingProperties}
*/ */
render() { render() {
let template; let template;
if (!this.__children) { if (!this.__children) {
template = template || this.querySelector('template'); template = /** @type {HTMLTemplateElement} */(template || this.querySelector('template'));
if (!template) { if (!template) {
// Wait until childList changes and template should be there by then // Wait until childList changes and template should be there by then
let observer = new MutationObserver(() => { let observer = new MutationObserver(() => {
template = this.querySelector('template'); template = /** @type {HTMLTemplateElement} */(this.querySelector('template'));
if (template) { if (template) {
observer.disconnect(); observer.disconnect();
this.render(template); this.render();
} else { } else {
throw new Error('dom-bind requires a <template> child'); throw new Error('dom-bind requires a <template> child');
} }

View File

@@ -88,6 +88,8 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
this.__renderDebouncer = null; this.__renderDebouncer = null;
this.__invalidProps = null; this.__invalidProps = null;
this.__instance = null; this.__instance = null;
this._lastIf = false;
this.__ctor = null;
} }
__debounceRender() { __debounceRender() {

View File

@@ -116,7 +116,6 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
* *
* @polymerElement * @polymerElement
* @memberof Polymer * @memberof Polymer
* @extends Polymer.Element
* @mixes Polymer.MutableData * @mixes Polymer.MutableData
* @summary Custom element for stamping instance of a template bound to * @summary Custom element for stamping instance of a template bound to
* items in an array. * items in an array.
@@ -288,6 +287,8 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
this.__filterFn = null; this.__filterFn = null;
this.__observePaths = null; this.__observePaths = null;
this.__ctor = null; this.__ctor = null;
this.__isDetached = true;
this.template = null;
} }
disconnectedCallback() { disconnectedCallback() {
@@ -470,10 +471,10 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
} }
/** /**
* @param {function()} fn Function to debounce. * @param {function(this:DomRepeat)} fn Function to debounce.
* @param {number=} delay Delay in ms to debounce by. * @param {number=} delay Delay in ms to debounce by.
*/ */
__debounceRender(fn, delay) { __debounceRender(fn, delay = 0) {
this.__renderDebouncer = Polymer.Debouncer.debounce( this.__renderDebouncer = Polymer.Debouncer.debounce(
this.__renderDebouncer this.__renderDebouncer
, delay > 0 ? Polymer.Async.timeOut.after(delay) : Polymer.Async.microTask , delay > 0 ? Polymer.Async.timeOut.after(delay) : Polymer.Async.microTask

View File

@@ -14,8 +14,6 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
'use strict'; 'use strict';
let LegacyElementMixin = Polymer.LegacyElementMixin;
let metaProps = { let metaProps = {
attached: true, attached: true,
detached: true, detached: true,
@@ -36,19 +34,20 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
* the underlying element. * the underlying element.
* *
* @param {!(Object|Array)} behaviors Behavior object or array of behaviors. * @param {!(Object|Array)} behaviors Behavior object or array of behaviors.
* @param {HTMLElement} klass Element class. * @param {!HTMLElement|function(new:HTMLElement)} klass Element class.
* @return {HTMLElement} Returns a new Element class extended by the * @return {!HTMLElement} Returns a new Element class extended by the
* passed in `behaviors` and also by `Polymer.LegacyElementMixin`. * passed in `behaviors` and also by `Polymer.LegacyElementMixin`.
* @memberof Polymer * @memberof Polymer
* @suppress {invalidCasts, checkTypes}
*/ */
function mixinBehaviors(behaviors, klass) { function mixinBehaviors(behaviors, klass) {
if (!behaviors) { if (!behaviors) {
return klass; return /** @type {HTMLElement} */(klass);
} }
// NOTE: ensure the bahevior is extending a class with // NOTE: ensure the bahevior is extending a class with
// legacy element api. This is necessary since behaviors expect to be able // legacy element api. This is necessary since behaviors expect to be able
// to access 1.x legacy api. // to access 1.x legacy api.
klass = LegacyElementMixin(klass); klass = Polymer.LegacyElementMixin(klass);
if (!Array.isArray(behaviors)) { if (!Array.isArray(behaviors)) {
behaviors = [behaviors]; behaviors = [behaviors];
} }
@@ -62,7 +61,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
} }
// Set behaviors on prototype for BC... // Set behaviors on prototype for BC...
klass.prototype.behaviors = behaviors; klass.prototype.behaviors = behaviors;
return klass; return /** @type {!HTMLElement} */(klass);
} }
// NOTE: // NOTE:
@@ -132,6 +131,13 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
return list; return list;
} }
/**
* @param {!PolymerInit} info Polymer info object
* @param {!HTMLElement} Base base class to extend with info object
* @return {!HTMLElement} Generated class
* @suppress {missingProperties, checkTypes}
* @private
*/
function GenerateClassFromInfo(info, Base) { function GenerateClassFromInfo(info, Base) {
class PolymerGenerated extends Base { class PolymerGenerated extends Base {
@@ -144,6 +150,10 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
return info.observers; return info.observers;
} }
/**
* @suppress {missingProperties}
* @return {HTMLTemplateElement} template for this class
*/
static get template() { static get template() {
// get template first from any imperative set in `info._template` // get template first from any imperative set in `info._template`
return info._template || return info._template ||
@@ -153,7 +163,8 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
// to ensure correct `this.is`) // to ensure correct `this.is`)
Base.template || Base.template ||
// finally fall back to `_template` in element's protoype. // finally fall back to `_template` in element's protoype.
this.prototype._template; this.prototype._template ||
null;
} }
created() { created() {
@@ -230,7 +241,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
} }
} }
PolymerGenerated.generatedFrom = info PolymerGenerated.generatedFrom = info
for (let p in info) { for (let p in info) {
// NOTE: cannot copy `metaProps` methods onto prototype at least because // NOTE: cannot copy `metaProps` methods onto prototype at least because
@@ -309,9 +320,9 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
* this element have been propagated to its template and all observers * this element have been propagated to its template and all observers
* have run * have run
* *
* @param {Object} info Object containing Polymer metadata and functions * @param {!PolymerInit} info Object containing Polymer metadata and functions
* to become class methods. * to become class methods.
* @return {Polymer.LegacyElement} Generated class * @return {!HTMLElement} Generated class
* @memberof Polymer * @memberof Polymer
*/ */
Polymer.Class = function(info) { Polymer.Class = function(info) {
@@ -321,7 +332,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
let klass = GenerateClassFromInfo(info, info.behaviors ? let klass = GenerateClassFromInfo(info, info.behaviors ?
// note: mixinBehaviors ensures `LegacyElementMixin`. // note: mixinBehaviors ensures `LegacyElementMixin`.
mixinBehaviors(info.behaviors, HTMLElement) : mixinBehaviors(info.behaviors, HTMLElement) :
LegacyElementMixin(HTMLElement)); Polymer.LegacyElementMixin(HTMLElement));
// decorate klass with registration info // decorate klass with registration info
klass.is = info.is; klass.is = info.is;
return klass; return klass;

View File

@@ -42,9 +42,9 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
/** /**
* @constructor * @constructor
* @extends {base}
* @implements {Polymer_ElementMixin} * @implements {Polymer_ElementMixin}
* @implements {Polymer_GestureEventListeners} * @implements {Polymer_GestureEventListeners}
* @extends {base}
*/ */
const legacyElementBase = Polymer.GestureEventListeners(Polymer.ElementMixin(base)); const legacyElementBase = Polymer.GestureEventListeners(Polymer.ElementMixin(base));
@@ -572,11 +572,12 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
* `<content>`. Defaults to `content`. * `<content>`. Defaults to `content`.
* @return {Array<HTMLElement>} List of distributed nodes for the * @return {Array<HTMLElement>} List of distributed nodes for the
* `<slot>`. * `<slot>`.
* @suppress {invalidCasts}
*/ */
getContentChildren(slctr) { getContentChildren(slctr) {
return this.getContentChildNodes(slctr).filter(function(n) { return /** @type {Array<HTMLElement>} */(this.getContentChildNodes(slctr).filter(function(n) {
return (n.nodeType === Node.ELEMENT_NODE); return (n.nodeType === Node.ELEMENT_NODE);
}); }));
} }
/** /**

View File

@@ -26,9 +26,10 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
* *
* @override * @override
* @function Polymer * @function Polymer
* @param {Object} info Object containing Polymer metadata and functions * @param {!PolymerInit} info Object containing Polymer metadata and functions
* to become class methods. * to become class methods.
* @return {Polymer.LegacyElement} Generated class * @return {!HTMLElement} Generated class
* @suppress {duplicate, invalidCasts, checkTypes}
*/ */
window.Polymer._polymerFn = function(info) { window.Polymer._polymerFn = function(info) {
// if input is a `class` (aka a function with a prototype), use the prototype // if input is a `class` (aka a function with a prototype), use the prototype
@@ -39,7 +40,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
} else { } else {
klass = Polymer.Class(info); klass = Polymer.Class(info);
} }
customElements.define(klass.is, klass); customElements.define(klass.is, /** @type {!HTMLElement} */(klass));
return klass; return klass;
}; };

View File

@@ -19,30 +19,6 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
<script> <script>
(function() { (function() {
'use strict'; 'use strict';
/**
* @typedef Object<string, {
* value: *,
* type: (Function | undefined),
* readOnly: (boolean | undefined),
* computed: (string | undefined),
* reflectToAttribute: (boolean | undefined),
* notify: (boolean | undefined),
* observer: (string | undefined)
* }>)
*/
let PolymerElementProperties; // eslint-disable-line no-unused-vars
let PolymerElementConstructor = function(){}; // eslint-disable-line no-unused-vars
/** @type {(string | undefined)} */
PolymerElementConstructor.is;
/** @type {(string | undefined)} */
PolymerElementConstructor.extends;
/** @type {(!PolymerElementProperties | undefined)} */
PolymerElementConstructor.properties;
/** @type {(!Array<string> | undefined)} */
PolymerElementConstructor.observers;
/** @type {(!HTMLTemplateElement | string | undefined)} */
PolymerElementConstructor.template;
/** /**
* Element class mixin that provides the core API for Polymer's meta-programming * Element class mixin that provides the core API for Polymer's meta-programming
@@ -189,6 +165,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
* *
* @param {PolymerElementConstructor} klass Element class * @param {PolymerElementConstructor} klass Element class
* @return {PolymerElementProperties} Flattened properties for this class * @return {PolymerElementProperties} Flattened properties for this class
* @suppress {missingProperties}
* @private * @private
*/ */
function propertiesForClass(klass) { function propertiesForClass(klass) {
@@ -647,6 +624,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
* Stamps the element template. * Stamps the element template.
* *
* @override * @override
* @suppress {missingProperties}
*/ */
ready() { ready() {
if (this._template) { if (this._template) {
@@ -778,6 +756,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
* created for them. * created for them.
* *
* @override * @override
* @suppress {missingProperties}
*/ */
static _parseTemplateContent(template, templateInfo, nodeInfo) { static _parseTemplateContent(template, templateInfo, nodeInfo) {
templateInfo.dynamicFns = templateInfo.dynamicFns || propertiesForClass(this); templateInfo.dynamicFns = templateInfo.dynamicFns || propertiesForClass(this);

View File

@@ -551,10 +551,10 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
* Callback called when any properties with accessors created via * Callback called when any properties with accessors created via
* `_createPropertyAccessor` have been set. * `_createPropertyAccessor` have been set.
* *
* @param {Object} currentProps Bag of all current accessor values * @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` * 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` * in `changedProps`
* @protected * @protected
*/ */

View File

@@ -31,7 +31,10 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
// from multiple properties in the same turn // from multiple properties in the same turn
let dedupeId = 0; let dedupeId = 0;
// Property effect types; effects are stored on the prototype using these keys /**
* Property effect types; effects are stored on the prototype using these keys
* @enum {string}
*/
const TYPES = { const TYPES = {
COMPUTE: '__computeEffects', COMPUTE: '__computeEffects',
REFLECT: '__reflectEffects', REFLECT: '__reflectEffects',
@@ -86,7 +89,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
* Runs all effects of a given type for the given set of property changes * Runs all effects of a given type for the given set of property changes
* on an instance. * on an instance.
* *
* @param {Object} inst The instance with effects to run * @param {PropertyEffectsInstance | Polymer_PropertyEffects} inst The instance with effects to run
* @param {Object} effects Object map of property-to-Array of effects * @param {Object} effects Object map of property-to-Array of effects
* @param {Object} props Bag of current property changes * @param {Object} props Bag of current property changes
* @param {Object=} oldProps Bag of previous values for changed properties * @param {Object=} oldProps Bag of previous values for changed properties
@@ -112,7 +115,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
/** /**
* Runs a list of effects for a given property. * Runs a list of effects for a given property.
* *
* @param {Object} inst The instance with effects to run * @param {PropertyEffectsInstance | Polymer_PropertyEffects} inst The instance with effects to run
* @param {Object} effects Object map of property-to-Array of effects * @param {Object} effects Object map of property-to-Array of effects
* @param {number} dedupeId Counter used for de-duping effects * @param {number} dedupeId Counter used for de-duping effects
* @param {string} prop Name of changed property * @param {string} prop Name of changed property
@@ -157,7 +160,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
* If no trigger is given, the path is deemed to match. * If no trigger is given, the path is deemed to match.
* *
* @param {string} path Path or property that changed * @param {string} path Path or property that changed
* @param {Object} trigger Descriptor * @param {DataTrigger} trigger Descriptor
* @return {boolean} Whether the path matched the trigger * @return {boolean} Whether the path matched the trigger
*/ */
function pathMatchesTrigger(path, trigger) { function pathMatchesTrigger(path, trigger) {
@@ -177,11 +180,12 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
* Calls the method with `info.methodName` on the instance, passing the * Calls the method with `info.methodName` on the instance, passing the
* new and old values. * new and old values.
* *
* @param {Object} inst The instance the effect will be run on * @param {PropertyEffectsInstance | Polymer_PropertyEffects} inst The instance the effect will be run on
* @param {string} property Name of property * @param {string} property Name of property
* @param {Object} props Bag of current property changes * @param {Object} props Bag of current property changes
* @param {Object} oldProps Bag of previous values for changed properties * @param {Object} oldProps Bag of previous values for changed properties
* @param {Object} info Effect metadata * @param {?} info Effect metadata
* @suppress {missingProperties}
* @private * @private
*/ */
function runObserverEffect(inst, property, props, oldProps, info) { function runObserverEffect(inst, property, props, oldProps, info) {
@@ -204,11 +208,12 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
* `notify: true` to ensure object sub-property notifications were * `notify: true` to ensure object sub-property notifications were
* sent. * sent.
* *
* @param {Element} inst The instance with effects to run * @param {PropertyEffectsInstance | Polymer_PropertyEffects} inst The instance with effects to run
* @param {Object} notifyProps Bag of properties to notify * @param {Object} notifyProps Bag of properties to notify
* @param {Object} props Bag of current property changes * @param {Object} props Bag of current property changes
* @param {Object} oldProps Bag of previous values for changed properties * @param {Object} oldProps Bag of previous values for changed properties
* @param {boolean} hasPaths True with `props` contains one or more paths * @param {boolean} hasPaths True with `props` contains one or more paths
* @suppress {missingProperties}
* @private * @private
*/ */
function runNotifyEffects(inst, notifyProps, props, oldProps, hasPaths) { function runNotifyEffects(inst, notifyProps, props, oldProps, hasPaths) {
@@ -239,7 +244,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
* Dispatches {property}-changed events with path information in the detail * Dispatches {property}-changed events with path information in the detail
* object to indicate a sub-path of the property was changed. * object to indicate a sub-path of the property was changed.
* *
* @param {Element} inst The element from which to fire the event * @param {PropertyEffectsInstance | Polymer_PropertyEffects} inst The element from which to fire the event
* @param {string} path The path that was changed * @param {string} path The path that was changed
* @param {Object} props Bag of current property changes * @param {Object} props Bag of current property changes
* @return {boolean} Returns true if the path was notified * @return {boolean} Returns true if the path was notified
@@ -252,18 +257,20 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
dispatchNotifyEvent(inst, eventName, props[path], path); dispatchNotifyEvent(inst, eventName, props[path], path);
return true; return true;
} }
return false;
} }
/** /**
* Dispatches {property}-changed events to indicate a property (or path) * Dispatches {property}-changed events to indicate a property (or path)
* changed. * changed.
* *
* @param {Element} inst The element from which to fire the event * @param {PropertyEffectsInstance | Polymer_PropertyEffects} inst The element from which to fire the event
* @param {string} eventName The name of the event to send ('{property}-changed') * @param {string} eventName The name of the event to send ('{property}-changed')
* @param {*} value The value of the changed property * @param {*} value The value of the changed property
* @param {string | null | undefined} path If a sub-path of this property changed, the path * @param {string | null | undefined} path If a sub-path of this property changed, the path
* that changed (optional). * that changed (optional).
* @private * @private
* @suppress {invalidCasts}
*/ */
function dispatchNotifyEvent(inst, eventName, value, path) { function dispatchNotifyEvent(inst, eventName, value, path) {
let detail = { let detail = {
@@ -273,7 +280,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
if (path) { if (path) {
detail.path = path; detail.path = path;
} }
inst.dispatchEvent(new CustomEvent(eventName, { detail })); /** @type {!HTMLElement} */(inst).dispatchEvent(new CustomEvent(eventName, { detail }));
} }
/** /**
@@ -282,12 +289,13 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
* Dispatches a non-bubbling event named `info.eventName` on the instance * Dispatches a non-bubbling event named `info.eventName` on the instance
* with a detail object containing the new `value`. * with a detail object containing the new `value`.
* *
* @param {Element} inst The instance the effect will be run on * @param {PropertyEffectsInstance | Polymer_PropertyEffects} inst The instance the effect will be run on
* @param {string} property Name of property * @param {string} property Name of property
* @param {Object} props Bag of current property changes * @param {Object} props Bag of current property changes
* @param {Object} oldProps Bag of previous values for changed properties * @param {Object} oldProps Bag of previous values for changed properties
* @param {Object} info Effect metadata * @param {?} info Effect metadata
* @param {boolean} hasPaths True with `props` contains one or more paths * @param {boolean} hasPaths True with `props` contains one or more paths
* @suppress {missingProperties}
* @private * @private
*/ */
function runNotifyEffect(inst, property, props, oldProps, info, hasPaths) { function runNotifyEffect(inst, property, props, oldProps, info, hasPaths) {
@@ -310,7 +318,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
* scope's name for that path first. * scope's name for that path first.
* *
* @param {CustomEvent} event Notification event (e.g. '<property>-changed') * @param {CustomEvent} event Notification event (e.g. '<property>-changed')
* @param {Object} inst Host element instance handling the notification event * @param {PropertyEffectsInstance | Polymer_PropertyEffects} inst Host element instance handling the notification event
* @param {string} fromProp Child element property that was bound * @param {string} fromProp Child element property that was bound
* @param {string} toPath Host property/path that was bound * @param {string} toPath Host property/path that was bound
* @param {boolean} negate Whether the binding was negated * @param {boolean} negate Whether the binding was negated
@@ -340,11 +348,12 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
* *
* Sets the attribute named `info.attrName` to the given property value. * Sets the attribute named `info.attrName` to the given property value.
* *
* @param {Object} inst The instance the effect will be run on * @param {PropertyEffectsInstance | Polymer_PropertyEffects} inst The instance the effect will be run on
* @param {string} property Name of property * @param {string} property Name of property
* @param {Object} props Bag of current property changes * @param {Object} props Bag of current property changes
* @param {Object} oldProps Bag of previous values for changed properties * @param {Object} oldProps Bag of previous values for changed properties
* @param {Object} info Effect metadata * @param {?} info Effect metadata
* @suppress {missingProperties}
* @private * @private
*/ */
function runReflectEffect(inst, property, props, oldProps, info) { function runReflectEffect(inst, property, props, oldProps, info) {
@@ -365,11 +374,12 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
* computed before other effects (binding propagation, observers, and notify) * computed before other effects (binding propagation, observers, and notify)
* run. * run.
* *
* @param {Element} inst The instance the effect will be run on * @param {PropertyEffectsInstance | Polymer_PropertyEffects} inst The instance the effect will be run on
* @param {!Object} changedProps Bag of changed properties * @param {!Object} changedProps Bag of changed properties
* @param {!Object} oldProps Bag of previous values for changed properties * @param {!Object} oldProps Bag of previous values for changed properties
* @param {boolean} hasPaths True with `props` contains one or more paths * @param {boolean} hasPaths True with `props` contains one or more paths
* @private * @private
* @suppress {missingProperties}
*/ */
function runComputedEffects(inst, changedProps, oldProps, hasPaths) { function runComputedEffects(inst, changedProps, oldProps, hasPaths) {
let computeEffects = inst.__computeEffects; let computeEffects = inst.__computeEffects;
@@ -389,11 +399,11 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
* values of the arguments specified in the `info` object and setting the * values of the arguments specified in the `info` object and setting the
* return value to the computed property specified. * return value to the computed property specified.
* *
* @param {Object} inst The instance the effect will be run on * @param {PropertyEffectsInstance | Polymer_PropertyEffects} inst The instance the effect will be run on
* @param {string} property Name of property * @param {string} property Name of property
* @param {Object} props Bag of current property changes * @param {Object} props Bag of current property changes
* @param {Object} oldProps Bag of previous values for changed properties * @param {Object} oldProps Bag of previous values for changed properties
* @param {Object} info Effect metadata * @param {?} info Effect metadata
* @private * @private
*/ */
function runComputedEffect(inst, property, props, oldProps, info) { function runComputedEffect(inst, property, props, oldProps, info) {
@@ -410,10 +420,11 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
* Computes path changes based on path links set up using the `linkPaths` * Computes path changes based on path links set up using the `linkPaths`
* API. * API.
* *
* @param {Element} inst The instance whose props are changing * @param {PropertyEffectsInstance | Polymer_PropertyEffects} inst The instance whose props are changing
* @param {string} path Path that has changed * @param {string | !Array<(string|number)>} path Path that has changed
* @param {*} value Value of changed path * @param {*} value Value of changed path
* @private * @private
* @suppress {missingProperties}
*/ */
function computeLinkedPaths(inst, path, value) { function computeLinkedPaths(inst, path, value) {
let links = inst.__dataLinkedPaths; let links = inst.__dataLinkedPaths;
@@ -445,10 +456,11 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
* @param {string} kind Binding kind, either 'property', 'attribute', or 'text' * @param {string} kind Binding kind, either 'property', 'attribute', or 'text'
* @param {string} target Target property name * @param {string} target Target property name
* @param {Array<Object>} parts Array of binding part metadata * @param {Array<Object>} parts Array of binding part metadata
* @param {string} literal Literal text surrounding binding parts (specified * @param {string=} literal Literal text surrounding binding parts (specified
* only for 'property' bindings, since these must be initialized as part * only for 'property' bindings, since these must be initialized as part
* of boot-up) * of boot-up)
* @private * @private
* @suppress {missingProperties}
*/ */
function addBinding(constructor, templateInfo, nodeInfo, kind, target, parts, literal) { function addBinding(constructor, templateInfo, nodeInfo, kind, target, parts, literal) {
// Create binding metadata and add to nodeInfo // Create binding metadata and add to nodeInfo
@@ -480,6 +492,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
* @param {Object} binding Binding metadata * @param {Object} binding Binding metadata
* @param {Object} part Binding part metadata * @param {Object} part Binding part metadata
* @param {number} index Index into `nodeInfoList` for this node * @param {number} index Index into `nodeInfoList` for this node
* @suppress {missingProperties}
*/ */
function addEffectForBindingPart(constructor, templateInfo, binding, part, index) { function addEffectForBindingPart(constructor, templateInfo, binding, part, index) {
if (!part.literal) { if (!part.literal) {
@@ -513,11 +526,11 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
* there is no support for _path_ bindings via custom binding parts, * there is no support for _path_ bindings via custom binding parts,
* as this is specific to Polymer's path binding syntax. * as this is specific to Polymer's path binding syntax.
* *
* @param {Element} inst The instance the effect will be run on * @param {PropertyEffectsInstance | Polymer_PropertyEffects} inst The instance the effect will be run on
* @param {string} path Name of property * @param {string} path Name of property
* @param {Object} props Bag of current property changes * @param {Object} props Bag of current property changes
* @param {Object} oldProps Bag of previous values for changed properties * @param {Object} oldProps Bag of previous values for changed properties
* @param {Object} info Effect metadata * @param {?} info Effect metadata
* @param {boolean} hasPaths True with `props` contains one or more paths * @param {boolean} hasPaths True with `props` contains one or more paths
* @param {Array} nodeList List of nodes associated with `nodeInfoList` template * @param {Array} nodeList List of nodes associated with `nodeInfoList` template
* metadata * metadata
@@ -548,11 +561,12 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
* Sets the value for an "binding" (binding) effect to a node, * Sets the value for an "binding" (binding) effect to a node,
* either as a property or attribute. * either as a property or attribute.
* *
* @param {Object} inst The instance owning the binding effect * @param {PropertyEffectsInstance | Polymer_PropertyEffects} inst The instance owning the binding effect
* @param {Node} node Target node for binding * @param {Node} node Target node for binding
* @param {Object} binding Binding metadata * @param {Object} binding Binding metadata
* @param {Object} part Binding part metadata * @param {Object} part Binding part metadata
* @param {*} value Value to set * @param {*} value Value to set
* @suppress {missingProperties}
* @private * @private
*/ */
function applyBindingValue(inst, node, binding, part, value) { function applyBindingValue(inst, node, binding, part, value) {
@@ -562,7 +576,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
} }
if (binding.kind == 'attribute') { if (binding.kind == 'attribute') {
// Attribute binding // Attribute binding
inst._valueToNodeAttribute(node, value, binding.target); inst._valueToNodeAttribute(/** @type {Element} */(node), value, binding.target);
} else { } else {
// Property binding // Property binding
let prop = binding.target; let prop = binding.target;
@@ -588,6 +602,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
* @param {Object} part Binding part metadata * @param {Object} part Binding part metadata
* @return {*} Transformed value to set * @return {*} Transformed value to set
* @private * @private
* @suppress {missingProperties}
*/ */
function computeBindingValue(node, value, binding, part) { function computeBindingValue(node, value, binding, part) {
if (binding.isCompound) { if (binding.isCompound) {
@@ -630,9 +645,10 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
* Setup compound binding storage structures, notify listeners, and dataHost * Setup compound binding storage structures, notify listeners, and dataHost
* references onto the bound nodeList. * references onto the bound nodeList.
* *
* @param {Object} inst Instance that bas been previously bound * @param {PropertyEffectsInstance | Polymer_PropertyEffects} inst Instance that bas been previously bound
* @param {Object} templateInfo Template metadata * @param {Object} templateInfo Template metadata
* @private * @private
* @suppress {missingProperties}
*/ */
function setupBindings(inst, templateInfo) { function setupBindings(inst, templateInfo) {
// Setup compound storage, dataHost, and notify listeners // Setup compound storage, dataHost, and notify listeners
@@ -691,7 +707,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
* Adds a 2-way binding notification event listener to the node specified * Adds a 2-way binding notification event listener to the node specified
* *
* @param {Object} node Child element to add listener to * @param {Object} node Child element to add listener to
* @param {Object} inst Host element instance to handle notification event * @param {PropertyEffectsInstance | Polymer_PropertyEffects} inst Host element instance to handle notification event
* @param {Object} binding Binding metadata * @param {Object} binding Binding metadata
* @private * @private
*/ */
@@ -721,6 +737,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
* method names should be included as a dependency to the effect. Note, * method names should be included as a dependency to the effect. Note,
* defaults to true if the signature is static (sig.static is true). * defaults to true if the signature is static (sig.static is true).
* @private * @private
* @suppress {missingProperties}
*/ */
function createMethodEffect(model, sig, type, effectFn, methodInfo, dynamicFn) { function createMethodEffect(model, sig, type, effectFn, methodInfo, dynamicFn) {
dynamicFn = sig.static || (dynamicFn && dynamicFn = sig.static || (dynamicFn &&
@@ -753,11 +770,11 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
* functions call this function to invoke the method, then use the return * functions call this function to invoke the method, then use the return
* value accordingly. * value accordingly.
* *
* @param {Object} inst The instance the effect will be run on * @param {PropertyEffectsInstance | Polymer_PropertyEffects} inst The instance the effect will be run on
* @param {string} property Name of property * @param {string} property Name of property
* @param {Object} props Bag of current property changes * @param {Object} props Bag of current property changes
* @param {Object} oldProps Bag of previous values for changed properties * @param {Object} oldProps Bag of previous values for changed properties
* @param {Object} info Effect metadata * @param {?} info Effect metadata
* @return {*} Returns the return value from the method invocation * @return {*} Returns the return value from the method invocation
* @private * @private
*/ */
@@ -809,7 +826,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
* arguments are literals), and an array of `args` * arguments are literals), and an array of `args`
* *
* @param {string} expression The expression to parse * @param {string} expression The expression to parse
* @return {?Object} The method metadata object if a method expression was * @return {Object} The method metadata object if a method expression was
* found, otherwise `undefined` * found, otherwise `undefined`
* @private * @private
*/ */
@@ -929,6 +946,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} props Bag of current property changes
* @return {Array<*>} Array of argument values * @return {Array<*>} Array of argument values
* @private * @private
* @suppress {missingProperties}
*/ */
function marshalArgs(data, args, path, props) { function marshalArgs(data, args, path, props) {
let values = []; let values = [];
@@ -973,11 +991,12 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
* *
* Note: this implementation only accepts normalized paths * Note: this implementation only accepts normalized paths
* *
* @param {Element} inst Instance to send notifications to * @param {PropertyEffectsInstance | Polymer_PropertyEffects} inst Instance to send notifications to
* @param {Array} array The array the mutations occurred on * @param {Array} array The array the mutations occurred on
* @param {string} path The path to the array that was mutated * @param {string} path The path to the array that was mutated
* @param {Array} splices Array of splice records * @param {Array} splices Array of splice records
* @private * @private
* @suppress {missingProperties}
*/ */
function notifySplices(inst, array, path, splices) { function notifySplices(inst, array, path, splices) {
let splicesPath = path + '.splices'; let splicesPath = path + '.splices';
@@ -993,7 +1012,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
* *
* Note: this implementation only accepts normalized paths * Note: this implementation only accepts normalized paths
* *
* @param {Element} inst Instance to send notifications to * @param {PropertyEffectsInstance | Polymer_PropertyEffects} inst Instance to send notifications to
* @param {Array} array The array the mutations occurred on * @param {Array} array The array the mutations occurred on
* @param {string} path The path to the array that was mutated * @param {string} path The path to the array that was mutated
* @param {number} index Index at which the array mutation occurred * @param {number} index Index at which the array mutation occurred
@@ -1064,13 +1083,14 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
* @extends {superClass} * @extends {superClass}
* @implements {Polymer_PropertyAccessors} * @implements {Polymer_PropertyAccessors}
* @implements {Polymer_TemplateStamp} * @implements {Polymer_TemplateStamp}
* @unrestricted
*/ */
const propertyEffectsBase = Polymer.TemplateStamp(Polymer.PropertyAccessors(superClass)); const propertyEffectsBase = Polymer.TemplateStamp(Polymer.PropertyAccessors(superClass));
/** /**
* @polymerMixinClass * @polymerMixinClass
* @unrestricted
* @implements {Polymer_PropertyEffects} * @implements {Polymer_PropertyEffects}
* @unrestricted
*/ */
class PropertyEffects extends propertyEffectsBase { class PropertyEffects extends propertyEffectsBase {
@@ -1113,6 +1133,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
* *
* @override * @override
* @param {Object} props Properties to initialize on the instance * @param {Object} props Properties to initialize on the instance
* @suppress {missingProperties}
*/ */
_initializeInstanceProperties(props) { _initializeInstanceProperties(props) {
let readOnly = this.__readOnly; let readOnly = this.__readOnly;
@@ -1542,6 +1563,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
* a specific order (compute, propagate, reflect, observe, notify). * a specific order (compute, propagate, reflect, observe, notify).
* *
* @override * @override
* @suppress {missingProperties}
*/ */
_propertiesChanged(currentProps, changedProps, oldProps) { _propertiesChanged(currentProps, changedProps, oldProps) {
// ---------------------------- // ----------------------------
@@ -1658,6 +1680,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
* reported in index order (raw results from `Object.observe` are not * reported in index order (raw results from `Object.observe` are not
* ordered and must be normalized/merged before notifying). * ordered and must be normalized/merged before notifying).
* @public * @public
* @suppress {missingProperties}
*/ */
notifySplices(path, splices) { notifySplices(path, splices) {
let info = {}; let info = {};
@@ -1733,6 +1756,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
* @param {...*} items Items to push onto array * @param {...*} items Items to push onto array
* @return {number} New length of the array. * @return {number} New length of the array.
* @public * @public
* @suppress {missingProperties}
*/ */
push(path, ...items) { push(path, ...items) {
let info = {}; let info = {};
@@ -1757,6 +1781,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
* @param {string} path Path to array. * @param {string} path Path to array.
* @return {*} Item that was removed. * @return {*} Item that was removed.
* @public * @public
* @suppress {missingProperties}
*/ */
pop(path) { pop(path) {
let info = {}; let info = {};
@@ -1785,6 +1810,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
* @param {...*} items Items to insert into array. * @param {...*} items Items to insert into array.
* @return {Array} Array of removed items. * @return {Array} Array of removed items.
* @public * @public
* @suppress {missingProperties}
*/ */
splice(path, start, deleteCount, ...items) { splice(path, start, deleteCount, ...items) {
let info = {}; let info = {};
@@ -1817,6 +1843,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
* @param {string} path Path to array. * @param {string} path Path to array.
* @return {*} Item that was removed. * @return {*} Item that was removed.
* @public * @public
* @suppress {missingProperties}
*/ */
shift(path) { shift(path) {
let info = {}; let info = {};
@@ -1842,6 +1869,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
* @param {...*} items Items to insert info array * @param {...*} items Items to insert info array
* @return {number} New length of the array. * @return {number} New length of the array.
* @public * @public
* @suppress {missingProperties}
*/ */
unshift(path, ...items) { unshift(path, ...items) {
let info = {}; let info = {};
@@ -1864,6 +1892,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
* @param {string} path Path that should be notified. * @param {string} path Path that should be notified.
* @param {*=} value Value at the path (optional). * @param {*=} value Value at the path (optional).
* @public * @public
* @suppress {missingProperties}
*/ */
notifyPath(path, value) { notifyPath(path, value) {
/** @type {string} */ /** @type {string} */
@@ -1915,7 +1944,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
* @protected * @protected
*/ */
_createPropertyObserver(property, methodName, dynamicFn) { _createPropertyObserver(property, methodName, dynamicFn) {
let info = { property, methodName, dynamicFn }; let info = { property, methodName, dynamicFn: Boolean(dynamicFn) };
this._addPropertyEffect(property, TYPES.OBSERVE, { this._addPropertyEffect(property, TYPES.OBSERVE, {
fn: runObserverEffect, info, trigger: {name: property} fn: runObserverEffect, info, trigger: {name: property}
}); });
@@ -2234,6 +2263,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
* *
* @param {HTMLTemplateElement} template Template to stamp * @param {HTMLTemplateElement} template Template to stamp
* @return {DocumentFragment} Cloned template content * @return {DocumentFragment} Cloned template content
* @suppress {missingProperties}
* @protected * @protected
*/ */
_stampTemplate(template) { _stampTemplate(template) {
@@ -2269,6 +2299,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
* *
* @param {DocumentFragment} dom DocumentFragment previously returned * @param {DocumentFragment} dom DocumentFragment previously returned
* from `_stampTemplate` associated with the nodes to be removed * from `_stampTemplate` associated with the nodes to be removed
* @suppress {missingProperties}
* @protected * @protected
*/ */
_removeBoundDom(dom) { _removeBoundDom(dom) {
@@ -2309,6 +2340,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
* @return {boolean} `true` if the visited node added node-specific * @return {boolean} `true` if the visited node added node-specific
* metadata to `nodeInfo` * metadata to `nodeInfo`
* @protected * @protected
* @suppress {missingProperties}
*/ */
static _parseTemplateNode(node, templateInfo, nodeInfo) { static _parseTemplateNode(node, templateInfo, nodeInfo) {
let noted = super._parseTemplateNode(node, templateInfo, nodeInfo); let noted = super._parseTemplateNode(node, templateInfo, nodeInfo);
@@ -2335,12 +2367,13 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
* binding. * binding.
* *
* @override * @override
* @param {Node} node Node to parse * @param {Element} node Node to parse
* @param {Object} templateInfo Template metadata for current template * @param {Object} templateInfo Template metadata for current template
* @param {Object} nodeInfo Node metadata for current template node * @param {Object} nodeInfo Node metadata for current template node
* @return {boolean} `true` if the visited node added node-specific * @return {boolean} `true` if the visited node added node-specific
* metadata to `nodeInfo` * metadata to `nodeInfo`
* @protected * @protected
* @suppress {missingProperties}
*/ */
static _parseTemplateNodeAttribute(node, templateInfo, nodeInfo, name, value) { static _parseTemplateNodeAttribute(node, templateInfo, nodeInfo, name, value) {
let parts = this._parseBindings(value, templateInfo); let parts = this._parseBindings(value, templateInfo);
@@ -2392,6 +2425,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
* @return {boolean} `true` if the visited node added node-specific * @return {boolean} `true` if the visited node added node-specific
* metadata to `nodeInfo` * metadata to `nodeInfo`
* @protected * @protected
* @suppress {missingProperties}
*/ */
static _parseTemplateNestedTemplate(node, templateInfo, nodeInfo) { static _parseTemplateNestedTemplate(node, templateInfo, nodeInfo) {
let noted = super._parseTemplateNestedTemplate(node, templateInfo, nodeInfo); let noted = super._parseTemplateNestedTemplate(node, templateInfo, nodeInfo);
@@ -2437,6 +2471,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
* @param {Object} templateInfo Current template metadata * @param {Object} templateInfo Current template metadata
* @return {Array<Object>} Array of binding part metadata * @return {Array<Object>} Array of binding part metadata
* @protected * @protected
* @suppress {missingProperties}
*/ */
static _parseBindings(text, templateInfo) { static _parseBindings(text, templateInfo) {
let parts = []; let parts = [];
@@ -2500,6 +2535,8 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
} }
if (parts.length) { if (parts.length) {
return parts; return parts;
} else {
return null;
} }
} }
@@ -2507,7 +2544,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
* Called to evaluate a previously parsed binding part based on a set of * Called to evaluate a previously parsed binding part based on a set of
* one or more changed dependencies. * one or more changed dependencies.
* *
* @param {HTMLElement} inst Element that should be used as scope for * @param {PropertyEffectsInstance | Polymer_PropertyEffects} inst Element that should be used as scope for
* binding dependencies * binding dependencies
* @param {Object} part Binding part metadata * @param {Object} part Binding part metadata
* @param {string} path Property/path that triggered this effect * @param {string} path Property/path that triggered this effect
@@ -2516,6 +2553,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 {boolean} hasPaths True with `props` contains one or more paths
* @return {*} Value the binding part evaluated to * @return {*} Value the binding part evaluated to
* @protected * @protected
* @suppress {missingProperties}
*/ */
static _evaluateBinding(inst, part, path, props, oldProps, hasPaths) { static _evaluateBinding(inst, part, path, props, oldProps, hasPaths) {
let value; let value;

View File

@@ -18,11 +18,11 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
* @summary Polymer is a lightweight library built on top of the web * @summary Polymer is a lightweight library built on top of the web
* standards-based Web Components API's, and makes it easy to build your * standards-based Web Components API's, and makes it easy to build your
* own custom HTML elements. * own custom HTML elements.
* @param {Object} info Prototype for the custom element. It must contain * @param {!PolymerInit} info Prototype for the custom element. It must contain
* an `is` property to specify the element name. Other properties populate * an `is` property to specify the element name. Other properties populate
* the element prototype. The `properties`, `observers`, `hostAttributes`, * the element prototype. The `properties`, `observers`, `hostAttributes`,
* and `listeners` properties are processed to create element features. * and `listeners` properties are processed to create element features.
* @return {Object} Returns a custom element class for the given provided * @return {!Object} Returns a custom element class for the given provided
* prototype `info` object. The name of the element if given by `info.is`. * prototype `info` object. The name of the element if given by `info.is`.
*/ */
window.Polymer = function(info) { window.Polymer = function(info) {
@@ -37,11 +37,11 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
// To be plugged by legacy implementation if loaded // To be plugged by legacy implementation if loaded
/* eslint-disable valid-jsdoc */ /* eslint-disable valid-jsdoc */
/** /**
* @param {Object} info Prototype for the custom element. It must contain * @param {!PolymerInit} info Prototype for the custom element. It must contain
* an `is` property to specify the element name. Other properties populate * an `is` property to specify the element name. Other properties populate
* the element prototype. The `properties`, `observers`, `hostAttributes`, * the element prototype. The `properties`, `observers`, `hostAttributes`,
* and `listeners` properties are processed to create element features. * and `listeners` properties are processed to create element features.
* @return {Object} Returns a custom element class for the given provided * @return {!Object} Returns a custom element class for the given provided
* prototype `info` object. The name of the element if given by `info.is`. * prototype `info` object. The name of the element if given by `info.is`.
*/ */
window.Polymer._polymerFn = function(info) { // eslint-disable-line no-unused-vars window.Polymer._polymerFn = function(info) { // eslint-disable-line no-unused-vars

View File

@@ -117,6 +117,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
} }
/** /**
* @override * @override
* @suppress {missingProperties}
*/ */
_addEventListenerToNode(node, eventName, handler) { _addEventListenerToNode(node, eventName, handler) {
if (this._methodHost && this.__templatizeOptions.parentModel) { if (this._methodHost && this.__templatizeOptions.parentModel) {
@@ -192,6 +193,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
* or else the host element. * or else the host element.
* *
* @return {Polymer_PropertyEffects} The parent model of this instance * @return {Polymer_PropertyEffects} The parent model of this instance
* @suppress {missingProperties}
*/ */
get parentModel() { get parentModel() {
let model = this.__parentModel; let model = this.__parentModel;
@@ -236,11 +238,14 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
return templateHost && templateHost._methodHost || templateHost; return templateHost && templateHost._methodHost || templateHost;
} }
/**
* @suppress {missingProperties}
*/
function createTemplatizerClass(template, templateInfo, options) { function createTemplatizerClass(template, templateInfo, options) {
// Anonymous class created by the templatize // Anonymous class created by the templatize
/** @unrestricted */
let base = options.mutableData ? let base = options.mutableData ?
MutableTemplateInstanceBase : TemplateInstanceBase; MutableTemplateInstanceBase : TemplateInstanceBase;
/** @unrestricted */
let klass = class extends base { } let klass = class extends base { }
klass.prototype.__templatizeOptions = options; klass.prototype.__templatizeOptions = options;
klass.prototype._bindTemplate(template); klass.prototype._bindTemplate(template);
@@ -248,6 +253,10 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
return klass; return klass;
} }
/* eslint-disable valid-jsdoc */
/**
* @suppress {missingProperties}
*/
function addPropagateEffects(template, templateInfo, options) { function addPropagateEffects(template, templateInfo, options) {
let userForwardHostProp = options.forwardHostProp; let userForwardHostProp = options.forwardHostProp;
if (userForwardHostProp) { if (userForwardHostProp) {
@@ -282,6 +291,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
template._enableProperties(); template._enableProperties();
} }
} }
/* eslint-enable valid-jsdoc */
function createForwardHostPropEffect(hostProp, userForwardHostProp) { function createForwardHostPropEffect(hostProp, userForwardHostProp) {
return function forwardHostProp(template, prop, props) { return function forwardHostProp(template, prop, props) {
@@ -417,12 +427,13 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
* should be stored on the `owner` such that they can be retrieved via `this`. * should be stored on the `owner` such that they can be retrieved via `this`.
* *
* @memberof Polymer.Templatize * @memberof Polymer.Templatize
* @param {HTMLTemplateElement} template Template to templatize * @param {!HTMLTemplateElement} template Template to templatize
* @param {Polymer_PropertyEffects} owner Owner of the template instances; * @param {!Polymer_PropertyEffects} owner Owner of the template instances;
* any optional callbacks will be bound to this owner. * any optional callbacks will be bound to this owner.
* @param {Object=} options Options dictionary (see summary for details) * @param {Object=} options Options dictionary (see summary for details)
* @return {TemplateInstanceBase} Generated class bound to the template * @return {!TemplateInstanceBase} Generated class bound to the template
* provided * provided
* @suppress {invalidCasts}
*/ */
templatize(template, owner, options) { templatize(template, owner, options) {
options = options || {}; options = options || {};
@@ -446,7 +457,7 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
klass.prototype.__dataHost = template; klass.prototype.__dataHost = template;
klass.prototype.__templatizeOwner = owner; klass.prototype.__templatizeOwner = owner;
klass.prototype.__hostProps = templateInfo.hostProps; klass.prototype.__hostProps = templateInfo.hostProps;
return klass; return /** @type {!TemplateInstanceBase} */(klass);
}, },
/** /**

View File

@@ -8,7 +8,7 @@
"test": "test" "test": "test"
}, },
"devDependencies": { "devDependencies": {
"@polymer/gen-closure-declarations": "0.0.4", "@polymer/gen-closure-declarations": "0.0.5",
"@webcomponents/shadycss": "^1.0.0", "@webcomponents/shadycss": "^1.0.0",
"@webcomponents/webcomponentsjs": "^1.0.0", "@webcomponents/webcomponentsjs": "^1.0.0",
"babel-preset-babili": "0.1.2", "babel-preset-babili": "0.1.2",