OLD | NEW |
| (Empty) |
1 /** | |
2 * @fileoverview Closure compiler externs for the Polymer library. | |
3 * | |
4 * @externs | |
5 * @license | |
6 * Copyright (c) 2015 The Polymer Project Authors. All rights reserved. | |
7 * This code may only be used under the BSD style license found at | |
8 * http://polymer.github.io/LICENSE.txt. The complete set of authors may be | |
9 * found at http://polymer.github.io/AUTHORS.txt. The complete set of | |
10 * contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt. Code | |
11 * distributed by Google as part of the polymer project is also subject to an | |
12 * additional IP rights grant found at http://polymer.github.io/PATENTS.txt. | |
13 */ | |
14 | |
15 /** | |
16 * @param {!{is: string}} descriptor The Polymer descriptor of the element. | |
17 * @see https://github.com/Polymer/polymer/blob/0.8-preview/PRIMER.md#custom-ele
ment-registration | |
18 */ | |
19 var Polymer = function(descriptor) {}; | |
20 | |
21 | |
22 /** @constructor @extends {HTMLElement} */ | |
23 var PolymerElement = function() {}; | |
24 | |
25 /** | |
26 * A mapping from ID to element in this Polymer Element's local DOM. | |
27 * @type {!Object} | |
28 */ | |
29 PolymerElement.prototype.$; | |
30 | |
31 /** | |
32 * True if the element has been attached to the DOM. | |
33 * @type {boolean} | |
34 */ | |
35 PolymerElement.prototype.isAttached; | |
36 | |
37 /** | |
38 * The root node of the element. | |
39 * @type {!Node} | |
40 */ | |
41 PolymerElement.prototype.root; | |
42 | |
43 /** | |
44 * The root node for the element. | |
45 * Only exists if running under Shady Dom. | |
46 * You usually want to use `this.root`. | |
47 * | |
48 * @type {?Node|undefined} | |
49 */ | |
50 PolymerElement.prototype.shadyRoot; | |
51 | |
52 /** | |
53 * Returns the first node in this element’s local DOM that matches selector. | |
54 * @param {string} selector | |
55 * @return {Element} Element found by the selector, or null if not found. | |
56 */ | |
57 PolymerElement.prototype.$$ = function(selector) {}; | |
58 | |
59 /** @type {string} The Custom element tag name. */ | |
60 PolymerElement.prototype.is; | |
61 | |
62 /** @type {string} The native element this element extends. */ | |
63 PolymerElement.prototype.extends; | |
64 | |
65 /** | |
66 * An array of objects whose properties get added to this element. | |
67 * @see https://www.polymer-project.org/1.0/docs/devguide/behaviors.html | |
68 * @type {!Array<!Object>|undefined} | |
69 */ | |
70 PolymerElement.prototype.behaviors; | |
71 | |
72 /** | |
73 * A string-separated list of dependent properties that should result in a | |
74 * change function being called. These observers differ from single-property | |
75 * observers in that the change handler is called asynchronously. | |
76 * | |
77 * @type {!Object<string, string>|undefined} | |
78 */ | |
79 PolymerElement.prototype.observers; | |
80 | |
81 /** On create callback. */ | |
82 PolymerElement.prototype.created = function() {}; | |
83 /** On ready callback. */ | |
84 PolymerElement.prototype.ready = function() {}; | |
85 /** On registered callback. */ | |
86 PolymerElement.prototype.registered = function() {}; | |
87 /** On attached to the DOM callback. */ | |
88 PolymerElement.prototype.attached = function() {}; | |
89 /** On detached from the DOM callback. */ | |
90 PolymerElement.prototype.detached = function() {}; | |
91 | |
92 /** | |
93 * Callback fired when an attribute on the element has been changed. | |
94 * | |
95 * @param {string} name The name of the attribute that changed. | |
96 */ | |
97 PolymerElement.prototype.attributeChanged = function(name) {}; | |
98 | |
99 /** @typedef {!{ | |
100 * type: !Function, | |
101 * reflectToAttribute: (boolean|undefined), | |
102 * readOnly: (boolean|undefined), | |
103 * notify: (boolean|undefined), | |
104 * value: *, | |
105 * computed: (string|undefined), | |
106 * observer: (string|undefined) | |
107 * }} */ | |
108 PolymerElement.PropertyConfig; | |
109 | |
110 /** @typedef {!Object<string, (!Function|!PolymerElement.PropertyConfig)>} */ | |
111 PolymerElement.Properties; | |
112 | |
113 /** @type {!PolymerElement.Properties} */ | |
114 PolymerElement.prototype.properties; | |
115 | |
116 /** @type {!Object<string, *>} */ | |
117 PolymerElement.prototype.hostAttributes; | |
118 | |
119 /** | |
120 * An object that maps events to event handler function names. | |
121 * @type {!Object<string, string>} | |
122 */ | |
123 PolymerElement.prototype.listeners; | |
124 | |
125 /** | |
126 * Return the element whose local dom within which this element is contained. | |
127 * @type {?Element} | |
128 */ | |
129 PolymerElement.prototype.domHost; | |
130 | |
131 /** | |
132 * Notifies the event binding system of a change to a property. | |
133 * @param {string} path The path to set. | |
134 * @param {*} value The value to send in the update notification. | |
135 * @param {boolean=} fromAbove When true, specifies that the change came from | |
136 * above this element and thus upward notification is not necessary. | |
137 * @return {boolean} True if notification actually took place, based on a dirty | |
138 * check of whether the new value was already known. | |
139 */ | |
140 PolymerElement.prototype.notifyPath = function(path, value, fromAbove) {}; | |
141 | |
142 /** | |
143 * @param {string} path Path that should be notified. | |
144 * @param {!Array<!PolymerSplice>} splices Array of splice records indicating | |
145 * ordered changes that occurred to the array. | |
146 */ | |
147 PolymerElement.prototype.notifySplices = function(path, splices) {}; | |
148 | |
149 /** | |
150 * Convienence method for setting a value to a path and notifying any | |
151 * elements bound to the same path. | |
152 * | |
153 * Note, if any part in the path except for the last is undefined, | |
154 * this method does nothing (this method does not throw when | |
155 * dereferencing undefined paths). | |
156 * | |
157 * @param {(string|Array<(string|number)>)} path Path to the value | |
158 * to read. The path may be specified as a string (e.g. `foo.bar.baz`) | |
159 * or an array of path parts (e.g. `['foo.bar', 'baz']`). Note that | |
160 * bracketed expressions are not supported; string-based path parts | |
161 * *must* be separated by dots. Note that when dereferencing array | |
162 * indicies, the index may be used as a dotted part directly | |
163 * (e.g. `users.12.name` or `['users', 12, 'name']`). | |
164 * @param {*} value Value to set at the specified path. | |
165 * @param {Object=} root Root object from which the path is evaluated. | |
166 */ | |
167 PolymerElement.prototype.set = function(path, value, root) {}; | |
168 | |
169 /** | |
170 * Convienence method for reading a value from a path. | |
171 * | |
172 * Note, if any part in the path is undefined, this method returns | |
173 * `undefined` (this method does not throw when dereferencing undefined | |
174 * paths). | |
175 * | |
176 * @param {(string|Array<(string|number)>)} path Path to the value | |
177 * to read. The path may be specified as a string (e.g. `foo.bar.baz`) | |
178 * or an array of path parts (e.g. `['foo.bar', 'baz']`). Note that | |
179 * bracketed expressions are not supported; string-based path parts | |
180 * *must* be separated by dots. Note that when dereferencing array | |
181 * indicies, the index may be used as a dotted part directly | |
182 * (e.g. `users.12.name` or `['users', 12, 'name']`). | |
183 * @param {Object=} root Root object from which the path is evaluated. | |
184 * @return {*} Value at the path, or `undefined` if any part of the path | |
185 * is undefined. | |
186 */ | |
187 PolymerElement.prototype.get = function(path, root) {}; | |
188 | |
189 /** | |
190 * Adds items onto the end of the array at the path specified. | |
191 * | |
192 * The arguments after `path` and return value match that of | |
193 * `Array.prototype.push`. | |
194 * | |
195 * This method notifies other paths to the same array that a | |
196 * splice occurred to the array. | |
197 * | |
198 * @param {string} path Path to array. | |
199 * @param {...*} var_args Items to push onto array | |
200 * @return {number} New length of the array. | |
201 */ | |
202 PolymerElement.prototype.push = function(path, var_args) {}; | |
203 | |
204 /** | |
205 * Removes an item from the end of array at the path specified. | |
206 * | |
207 * The arguments after `path` and return value match that of | |
208 * `Array.prototype.pop`. | |
209 * | |
210 * This method notifies other paths to the same array that a | |
211 * splice occurred to the array. | |
212 * | |
213 * @param {string} path Path to array. | |
214 * @return {*} Item that was removed. | |
215 */ | |
216 PolymerElement.prototype.pop = function(path) {}; | |
217 | |
218 /** | |
219 * Starting from the start index specified, removes 0 or more items | |
220 * from the array and inserts 0 or more new itms in their place. | |
221 * | |
222 * The arguments after `path` and return value match that of | |
223 * `Array.prototype.splice`. | |
224 * | |
225 * This method notifies other paths to the same array that a | |
226 * splice occurred to the array. | |
227 * | |
228 * @param {string} path Path to array. | |
229 * @param {number} start Index from which to start removing/inserting. | |
230 * @param {number} deleteCount Number of items to remove. | |
231 * @param {...*} var_args Items to insert into array. | |
232 * @return {!Array} Array of removed items. | |
233 */ | |
234 PolymerElement.prototype.splice = function(path, start, deleteCount, var_args) {
}; | |
235 | |
236 /** | |
237 * Removes an item from the beginning of array at the path specified. | |
238 * | |
239 * The arguments after `path` and return value match that of | |
240 * `Array.prototype.pop`. | |
241 * | |
242 * This method notifies other paths to the same array that a | |
243 * splice occurred to the array. | |
244 * | |
245 * @param {string} path Path to array. | |
246 * @return {*} Item that was removed. | |
247 */ | |
248 PolymerElement.prototype.shift = function(path) {}; | |
249 | |
250 /** | |
251 * Adds items onto the beginning of the array at the path specified. | |
252 * | |
253 * The arguments after `path` and return value match that of | |
254 * `Array.prototype.push`. | |
255 * | |
256 * This method notifies other paths to the same array that a | |
257 * splice occurred to the array. | |
258 * | |
259 * @param {string} path Path to array. | |
260 * @param {...*} var_args Items to insert info array | |
261 * @return {number} New length of the array. | |
262 */ | |
263 PolymerElement.prototype.unshift = function(path, var_args) {}; | |
264 | |
265 /** | |
266 * Returns a list of element children distributed to this element's | |
267 * `<content>`. | |
268 * | |
269 * If this element contans more than one `<content>` in its | |
270 * local DOM, an optional selector may be passed to choose the desired | |
271 * content. This method differs from `getContentChildNodes` in that only | |
272 * elements are returned. | |
273 * | |
274 * @param {string=} slctr CSS selector to choose the desired | |
275 * `<content>`. Defaults to `content`. | |
276 * @return {!Array<!HTMLElement>} List of distributed nodes for the | |
277 * `<content>`. | |
278 */ | |
279 PolymerElement.prototype.getContentChildren = function(slctr) {}; | |
280 | |
281 /** | |
282 * Returns a list of nodes that are the effective childNodes. The effective | |
283 * childNodes list is the same as the element's childNodes except that | |
284 * any `<content>` elements are replaced with the list of nodes distributed | |
285 * to the `<content>`, the result of its `getDistributedNodes` method. | |
286 * | |
287 * @return {!Array<!Node>} List of effective child nodes. | |
288 */ | |
289 PolymerElement.prototype.getEffectiveChildNodes = function() {}; | |
290 | |
291 /** | |
292 * Returns a list of elements that are the effective children. The effective | |
293 * children list is the same as the element's children except that | |
294 * any `<content>` elements are replaced with the list of elements | |
295 * distributed to the `<content>`. | |
296 * | |
297 * @return {!Array<!Node>} List of effective children. | |
298 */ | |
299 PolymerElement.prototype.getEffectiveChildren = function() {}; | |
300 | |
301 /** | |
302 * Returns a string of text content that is the concatenation of the | |
303 * text content's of the element's effective childNodes (the elements | |
304 * returned by <a href="#getEffectiveChildNodes>getEffectiveChildNodes</a>. | |
305 * | |
306 * @return {string} A concatenated string of all effective childNode text | |
307 * content. | |
308 */ | |
309 PolymerElement.prototype.getEffectiveTextContent = function() {}; | |
310 | |
311 /** | |
312 * @param {string} selector | |
313 * @return {?HTMLElement} | |
314 */ | |
315 PolymerElement.prototype.queryEffectiveChildren = function(selector) {}; | |
316 | |
317 /** | |
318 * Fire an event. | |
319 * | |
320 * @param {string} type An event name. | |
321 * @param {*=} detail | |
322 * @param {{ | |
323 * bubbles: (boolean|undefined), | |
324 * cancelable: (boolean|undefined), | |
325 * node: (!EventTarget|undefined)}=} options | |
326 * @return {Object} event | |
327 */ | |
328 PolymerElement.prototype.fire = function(type, detail, options) {}; | |
329 | |
330 /** | |
331 * Toggles the named boolean class on the host element, adding the class if | |
332 * bool is truthy and removing it if bool is falsey. If node is specified, sets | |
333 * the class on node instead of the host element. | |
334 * @param {string} name | |
335 * @param {boolean=} bool | |
336 * @param {HTMLElement=} node | |
337 */ | |
338 PolymerElement.prototype.toggleClass = function(name, bool, node) {}; | |
339 | |
340 /** | |
341 * Toggles the named boolean attribute on the host element, adding the attribute | |
342 * if bool is truthy and removing it if bool is falsey. If node is specified, | |
343 * sets the attribute on node instead of the host element. | |
344 * @param {string} name | |
345 * @param {boolean} bool | |
346 * @param {HTMLElement=} node | |
347 */ | |
348 PolymerElement.prototype.toggleAttribute = function(name, bool, node) {}; | |
349 | |
350 /** | |
351 * Moves a boolean attribute from oldNode to newNode, unsetting the attribute | |
352 * (if set) on oldNode and setting it on newNode. | |
353 * @param {string} name | |
354 * @param {!HTMLElement} newNode | |
355 * @param {!HTMLElement} oldNode | |
356 */ | |
357 PolymerElement.prototype.attributeFollows = function(name, newNode, oldNode) {}; | |
358 | |
359 /** | |
360 * Convenience method to add an event listener on a given element, late bound to | |
361 * a named method on this element. | |
362 * @param {!EventTarget} node Element to add event listener to. | |
363 * @param {string} eventName Name of event to listen for. | |
364 * @param {string} methodName Name of handler method on this to call. | |
365 */ | |
366 PolymerElement.prototype.listen = function(node, eventName, methodName) {}; | |
367 | |
368 /** | |
369 * Convenience method to remove an event listener from a given element. | |
370 * @param {?EventTarget} node Element to remove event listener from. | |
371 * @param {string} eventName Name of event to stop listening for. | |
372 * @param {string} methodName Name of handler method on this to remove. | |
373 */ | |
374 PolymerElement.prototype.unlisten = function(node, eventName, methodName) {}; | |
375 | |
376 /** | |
377 * Override scrolling behavior to all direction, one direction, or none. | |
378 * | |
379 * Valid scroll directions: | |
380 * 'all': scroll in any direction | |
381 * 'x': scroll only in the 'x' direction | |
382 * 'y': scroll only in the 'y' direction | |
383 * 'none': disable scrolling for this node | |
384 * | |
385 * @param {string=} direction Direction to allow scrolling Defaults to all. | |
386 * @param {HTMLElement=} node Element to apply scroll direction setting. | |
387 * Defaults to this. | |
388 */ | |
389 PolymerElement.prototype.setScrollDirection = function(direction, node) {}; | |
390 | |
391 /** | |
392 * @param {!Function} method | |
393 * @param {number=} wait | |
394 * @return {number} A handle which can be used to cancel the job. | |
395 */ | |
396 PolymerElement.prototype.async = function(method, wait) {}; | |
397 | |
398 /** | |
399 * @param {...*} var_args | |
400 */ | |
401 PolymerElement.prototype.factoryImpl = function(var_args) {}; | |
402 | |
403 /** | |
404 * Apply style scoping to the specified container and all its descendants. | |
405 * @param {!Element} container Element to scope. | |
406 * @param {boolean} shouldObserve When true, monitors the container for changes | |
407 * and re-applies scoping for any future changes. | |
408 */ | |
409 PolymerElement.prototype.scopeSubtree = function(container, shouldObserve) {}; | |
410 | |
411 /** | |
412 * Aliases one data path as another, such that path notifications from one | |
413 * are routed to the other. | |
414 * | |
415 * @param {string} to Target path to link. | |
416 * @param {string} from Source path to link. | |
417 */ | |
418 PolymerElement.prototype.linkPaths = function(to, from) {} | |
419 | |
420 /** | |
421 * Removes a data path alias previously established with `linkPaths`. | |
422 * | |
423 * Note, the path to unlink should be the target (`to`) used when | |
424 * linking the paths. | |
425 * | |
426 * @param {string} path Target path to unlink. | |
427 */ | |
428 PolymerElement.prototype.unlinkPaths = function(path) {} | |
429 | |
430 Polymer.Base; | |
431 | |
432 /** | |
433 * Used by the promise-polyfill on its own. | |
434 * | |
435 * @param {!Function} method | |
436 * @param {number=} wait | |
437 * @return {number} A handle which can be used to cancel the job. | |
438 */ | |
439 Polymer.Base.async = function(method, wait) {}; | |
440 | |
441 /** | |
442 * Returns a property descriptor object for the property specified. | |
443 * | |
444 * This method allows introspecting the configuration of a Polymer element's | |
445 * properties as configured in its `properties` object. Note, this method | |
446 * normalizes shorthand forms of the `properties` object into longhand form. | |
447 * | |
448 * @param {string} property Name of property to introspect. | |
449 * @return {Object} Property descriptor for specified property. | |
450 */ | |
451 Polymer.Base.getPropertyInfo = function(property) {}; | |
452 | |
453 Polymer.Gestures; | |
454 | |
455 /** | |
456 * Gets the original target of the given event. | |
457 * | |
458 * Cheaper than Polymer.dom(ev).path[0]; | |
459 * See https://github.com/Polymer/polymer/blob/master/src/standard/gestures.html
#L191 | |
460 * | |
461 * @param {Event} ev . | |
462 * @return {Element} The original target of the event. | |
463 */ | |
464 Polymer.Gestures.findOriginalTarget = function(ev) {}; | |
465 | |
466 | |
467 /** | |
468 * @param {number} handle | |
469 */ | |
470 PolymerElement.prototype.cancelAsync = function(handle) {}; | |
471 | |
472 /** | |
473 * Call debounce to collapse multiple requests for a named task into one | |
474 * invocation, which is made after the wait time has elapsed with no new | |
475 * request. If no wait time is given, the callback is called at microtask timing | |
476 * (guaranteed to be before paint). | |
477 * @param {string} jobName | |
478 * @param {!Function} callback | |
479 * @param {number=} wait | |
480 */ | |
481 PolymerElement.prototype.debounce = function(jobName, callback, wait) {}; | |
482 | |
483 /** | |
484 * Cancels an active debouncer without calling the callback. | |
485 * @param {string} jobName | |
486 */ | |
487 PolymerElement.prototype.cancelDebouncer = function(jobName) {}; | |
488 | |
489 /** | |
490 * Calls the debounced callback immediately and cancels the debouncer. | |
491 * @param {string} jobName | |
492 */ | |
493 PolymerElement.prototype.flushDebouncer = function(jobName) {}; | |
494 | |
495 /** | |
496 * @param {string} jobName | |
497 * @return {boolean} True if the named debounce task is waiting to run. | |
498 */ | |
499 PolymerElement.prototype.isDebouncerActive = function(jobName) {}; | |
500 | |
501 | |
502 /** | |
503 * Applies a CSS transform to the specified node, or this element if no node is | |
504 * specified. transform is specified as a string. | |
505 * @param {string} transform | |
506 * @param {HTMLElement=} node | |
507 */ | |
508 PolymerElement.prototype.transform = function(transform, node) {}; | |
509 | |
510 /** | |
511 * Transforms the specified node, or this element if no node is specified. | |
512 * @param {number|string} x | |
513 * @param {number|string} y | |
514 * @param {number|string} z | |
515 * @param {HTMLElement=} node | |
516 */ | |
517 PolymerElement.prototype.translate3d = function(x, y, z, node) {}; | |
518 | |
519 /** | |
520 * Dynamically imports an HTML document. | |
521 * @param {string} href | |
522 * @param {Function=} onload | |
523 * @param {Function=} onerror | |
524 */ | |
525 PolymerElement.prototype.importHref = function(href, onload, onerror) {}; | |
526 | |
527 /** | |
528 * Checks whether an element is in this element's light DOM tree. | |
529 * @param {?Node} node The element to be checked. | |
530 * @return {boolean} true if node is in this element's light DOM tree. | |
531 */ | |
532 PolymerElement.prototype.isLightDescendant = function(node) {}; | |
533 | |
534 /** | |
535 * Delete an element from an array. | |
536 * @param {!Array|string} array Path to array from which to remove the item (or | |
537 * the array itself). | |
538 * @param {*} item Item to remove | |
539 * @return {!Array} The array with the item removed. | |
540 */ | |
541 PolymerElement.prototype.arrayDelete = function(array, item) {}; | |
542 | |
543 /** | |
544 * Resolve a url to make it relative to the current doc. | |
545 * @param {string} url | |
546 * @return {string} | |
547 */ | |
548 PolymerElement.prototype.resolveUrl = function(url) {}; | |
549 | |
550 /** | |
551 * Re-evaluates and applies custom CSS properties based on dynamic | |
552 * changes to this element's scope, such as adding or removing classes | |
553 * in this element's local DOM. | |
554 * | |
555 * For performance reasons, Polymer's custom CSS property shim relies | |
556 * on this explicit signal from the user to indicate when changes have | |
557 * been made that affect the values of custom properties. | |
558 * | |
559 * @param {Object=} properties Properties object which, if provided is mixed | |
560 * into the element's `customStyle` property. This argument provides a | |
561 * shortcut for setting `customStyle` and then calling `updateStyles`. | |
562 */ | |
563 PolymerElement.prototype.updateStyles = function(properties) {}; | |
564 | |
565 /** | |
566 * @type {!Object<string, string|undefined>} | |
567 */ | |
568 PolymerElement.prototype.customStyle; | |
569 | |
570 /** | |
571 * Returns the computed style value for the given property. | |
572 * @param {string} property | |
573 * @return {string} the computed value | |
574 */ | |
575 PolymerElement.prototype.getComputedStyleValue = function(property) {}; | |
576 | |
577 /** | |
578 * Logs a message to the console. | |
579 * | |
580 * @param {!Array} var_args | |
581 * @protected | |
582 */ | |
583 PolymerElement.prototype._log = function(var_args) {}; | |
584 | |
585 /** | |
586 * Logs a message to the console with a 'warn' level. | |
587 * | |
588 * @param {!Array} var_args | |
589 * @protected | |
590 */ | |
591 PolymerElement.prototype._warn = function(var_args) {}; | |
592 | |
593 /** | |
594 * Logs a message to the console with an 'error' level. | |
595 * | |
596 * @param {!Array} var_args | |
597 * @protected | |
598 */ | |
599 PolymerElement.prototype._error = function(var_args) {}; | |
600 | |
601 /** | |
602 * Formats string arguments together for a console log. | |
603 * | |
604 * @param {...*} var_args | |
605 * @return {!Array} The formatted array of args to a log function. | |
606 * @protected | |
607 */ | |
608 PolymerElement.prototype._logf = function(var_args) {}; | |
609 | |
610 | |
611 /** | |
612 * A Polymer DOM API for manipulating DOM such that local DOM and light DOM | |
613 * trees are properly maintained. | |
614 * | |
615 * @constructor | |
616 */ | |
617 var PolymerDomApi = function() {}; | |
618 | |
619 /** | |
620 * @param {?Node} node | |
621 * @return {boolean} | |
622 */ | |
623 PolymerDomApi.prototype.deepContains = function(node) {}; | |
624 | |
625 /** @param {!Node} node */ | |
626 PolymerDomApi.prototype.appendChild = function(node) {}; | |
627 | |
628 /** | |
629 * @param {!Node} oldNode | |
630 * @param {!Node} newNode | |
631 */ | |
632 PolymerDomApi.prototype.replaceChild = function(oldNode, newNode) {}; | |
633 | |
634 /** | |
635 * @param {!Node} node | |
636 * @param {!Node} beforeNode | |
637 */ | |
638 PolymerDomApi.prototype.insertBefore = function(node, beforeNode) {}; | |
639 | |
640 /** @param {!Node} node */ | |
641 PolymerDomApi.prototype.removeChild = function(node) {}; | |
642 | |
643 /** @type {!Array<!HTMLElement>} */ | |
644 PolymerDomApi.prototype.children; | |
645 | |
646 /** @type {!Array<!Node>} */ | |
647 PolymerDomApi.prototype.childNodes; | |
648 | |
649 /** @type {?Node} */ | |
650 PolymerDomApi.prototype.parentNode; | |
651 | |
652 /** @type {?Node} */ | |
653 PolymerDomApi.prototype.firstChild; | |
654 | |
655 /** @type {?Node} */ | |
656 PolymerDomApi.prototype.lastChild; | |
657 | |
658 /** @type {?HTMLElement} */ | |
659 PolymerDomApi.prototype.firstElementChild; | |
660 | |
661 /** @type {?HTMLElement} */ | |
662 PolymerDomApi.prototype.lastElementChild; | |
663 | |
664 /** @type {?Node} */ | |
665 PolymerDomApi.prototype.previousSibling; | |
666 | |
667 /** @type {?Node} */ | |
668 PolymerDomApi.prototype.nextSibling; | |
669 | |
670 /** @type {string} */ | |
671 PolymerDomApi.prototype.textContent; | |
672 | |
673 /** @type {string} */ | |
674 PolymerDomApi.prototype.innerHTML; | |
675 | |
676 /** @type {?HTMLElement} */ | |
677 PolymerDomApi.prototype.activeElement; | |
678 | |
679 /** | |
680 * @param {string} selector | |
681 * @return {?HTMLElement} | |
682 */ | |
683 PolymerDomApi.prototype.querySelector = function(selector) {}; | |
684 | |
685 /** | |
686 * @param {string} selector | |
687 * @return {!Array<!HTMLElement>} | |
688 */ | |
689 PolymerDomApi.prototype.querySelectorAll = function(selector) {}; | |
690 | |
691 /** @return {!Array<!Node>} */ | |
692 PolymerDomApi.prototype.getDistributedNodes = function() {}; | |
693 | |
694 /** @return {!Array<!Node>} */ | |
695 PolymerDomApi.prototype.getDestinationInsertionPoints = function() {}; | |
696 | |
697 /** @return {?Node} */ | |
698 PolymerDomApi.prototype.getOwnerRoot = function() {}; | |
699 | |
700 /** | |
701 * @param {string} attribute | |
702 * @param {string|number|boolean} value Values are converted to strings with | |
703 * ToString, so we accept number and boolean since both convert easily to | |
704 * strings. | |
705 */ | |
706 PolymerDomApi.prototype.setAttribute = function(attribute, value) {}; | |
707 | |
708 /** @param {string} attribute */ | |
709 PolymerDomApi.prototype.removeAttribute = function(attribute) {}; | |
710 | |
711 /** | |
712 * @typedef {function({ | |
713 * target: !Node, | |
714 * addedNodes: !Array<!Node>, | |
715 * removedNodes: !Array<!Node> | |
716 * })} | |
717 */ | |
718 PolymerDomApi.ObserveCallback; | |
719 | |
720 /** | |
721 * A virtual type for observer callback handles. | |
722 * | |
723 * @private @constructor | |
724 */ | |
725 PolymerDomApi.ObserveHandle = function() {}; | |
726 | |
727 /** | |
728 * Notifies callers about changes to the element's effective child nodes, | |
729 * the same list as returned by `getEffectiveChildNodes`. | |
730 * | |
731 * @param {!PolymerDomApi.ObserveCallback} callback The supplied callback | |
732 * is called with an `info` argument which is an object that provides | |
733 * the `target` on which the changes occurred, a list of any nodes | |
734 * added in the `addedNodes` array, and nodes removed in the | |
735 * `removedNodes` array. | |
736 * | |
737 * @return {!PolymerDomApi.ObserveHandle} Handle which is the argument to | |
738 * `unobserveNodes`. | |
739 */ | |
740 PolymerDomApi.prototype.observeNodes = function(callback) {}; | |
741 | |
742 /** | |
743 * Stops observing changes to the element's effective child nodes. | |
744 * | |
745 * @param {!PolymerDomApi.ObserveHandle} handle The handle for the | |
746 * callback that should no longer receive notifications. This | |
747 * handle is returned from `observeNodes`. | |
748 */ | |
749 PolymerDomApi.prototype.unobserveNodes = function(handle) {}; | |
750 | |
751 /** @type {?DOMTokenList} */ | |
752 PolymerDomApi.prototype.classList; | |
753 | |
754 /** | |
755 * @param {string} selector | |
756 * @return {!Array<!HTMLElement>} | |
757 */ | |
758 PolymerDomApi.prototype.queryDistributedElements = function(selector) {}; | |
759 | |
760 /** | |
761 * A Polymer Event API. | |
762 * | |
763 * @constructor | |
764 */ | |
765 var PolymerEventApi = function() {}; | |
766 | |
767 /** @type {?EventTarget} */ | |
768 PolymerEventApi.prototype.rootTarget; | |
769 | |
770 /** @type {?EventTarget} */ | |
771 PolymerEventApi.prototype.localTarget; | |
772 | |
773 /** @type {?Array<!Element>|undefined} */ | |
774 PolymerEventApi.prototype.path; | |
775 | |
776 | |
777 Polymer.Async; | |
778 | |
779 /** | |
780 * polymer-onerror experiment relies on this private API, so expose it only | |
781 * to let the compilation work. Do not use in user code. | |
782 */ | |
783 Polymer.Async._atEndOfMicrotask = function() {}; | |
784 | |
785 | |
786 /** | |
787 * Returns a Polymer-friendly API for manipulating DOM of a specified node or | |
788 * an event API for a specified event.. | |
789 * | |
790 * @param {?Node|?Event} nodeOrEvent | |
791 * @return {!PolymerDomApi|!PolymerEventApi} | |
792 */ | |
793 Polymer.dom = function(nodeOrEvent) {}; | |
794 | |
795 Polymer.dom.flush = function() {}; | |
796 | |
797 /** @constructor */ | |
798 Polymer.Debouncer = function() {}; | |
799 | |
800 Polymer.Debouncer.prototype = { | |
801 /** | |
802 * @param {function()} callback | |
803 * @param {number} wait | |
804 */ | |
805 go: function(callback, wait) {}, | |
806 | |
807 stop: function() {}, | |
808 | |
809 complete: function() {} | |
810 }; | |
811 | |
812 /** @param {!Polymer.Debouncer} debouncer */ | |
813 Polymer.dom.addDebouncer = function(debouncer) {}; | |
814 | |
815 Polymer.CaseMap; | |
816 | |
817 /** | |
818 * Convert a string from dash to camel-case. | |
819 * @param {string} dash | |
820 * @return {string} The string in camel-case. | |
821 */ | |
822 Polymer.CaseMap.dashToCamelCase = function(dash) {}; | |
823 | |
824 /** | |
825 * Convert a string from camel-case to dash format. | |
826 * @param {string} camel | |
827 * @return {string} The string in dash format. | |
828 */ | |
829 Polymer.CaseMap.camelToDashCase = function(camel) {}; | |
830 | |
831 | |
832 /** | |
833 * A Polymer data structure abstraction. | |
834 * | |
835 * @param {?Array} userArray | |
836 * @constructor | |
837 */ | |
838 Polymer.Collection = function(userArray) {}; | |
839 | |
840 Polymer.Collection.prototype.initMap = function() {}; | |
841 | |
842 /** | |
843 * @param {*} item | |
844 */ | |
845 Polymer.Collection.prototype.add = function(item) {}; | |
846 | |
847 /** | |
848 * @param {number|string} key | |
849 */ | |
850 Polymer.Collection.prototype.removeKey = function(key) {}; | |
851 | |
852 /** | |
853 * @param {*} item | |
854 * @return {number|string} The key of the item removed. | |
855 */ | |
856 Polymer.Collection.prototype.remove = function(item) {}; | |
857 | |
858 /** | |
859 * @param {*} item | |
860 * @return {number|string} The key of the item. | |
861 */ | |
862 Polymer.Collection.prototype.getKey = function(item) {}; | |
863 | |
864 /** | |
865 * @return {!Array<number|string>} The key of the item removed. | |
866 */ | |
867 Polymer.Collection.prototype.getKeys = function() {}; | |
868 | |
869 /** | |
870 * @param {number|string} key | |
871 * @param {*} item | |
872 */ | |
873 Polymer.Collection.prototype.setItem = function(key, item) {}; | |
874 | |
875 /** | |
876 * @param {number|string} key | |
877 * @return {*} The item for the given key if present. | |
878 */ | |
879 Polymer.Collection.prototype.getItem = function(key) {}; | |
880 | |
881 /** | |
882 * @return {!Array} The items in the collection | |
883 */ | |
884 Polymer.Collection.prototype.getItems = function() {}; | |
885 | |
886 /** | |
887 * @param {!Array} userArray | |
888 * @return {!Polymer.Collection} A new Collection wrapping the given array. | |
889 */ | |
890 Polymer.Collection.get = function(userArray) {}; | |
891 | |
892 /** | |
893 * @param {!Array} userArray | |
894 * @param {!Array<!PolymerSplice>} splices | |
895 * @return {!Array<!PolymerKeySplice>} KeySplices with added and removed keys | |
896 */ | |
897 Polymer.Collection.applySplices = function(userArray, splices) {}; | |
898 | |
899 /** | |
900 * Settings pulled from | |
901 * https://github.com/Polymer/polymer/blob/master/src/lib/settings.html | |
902 */ | |
903 Polymer.Settings; | |
904 | |
905 /** @type {boolean} */ | |
906 Polymer.Settings.wantShadow; | |
907 | |
908 /** @type {boolean} */ | |
909 Polymer.Settings.hasShadow; | |
910 | |
911 /** @type {boolean} */ | |
912 Polymer.Settings.nativeShadow; | |
913 | |
914 /** @type {boolean} */ | |
915 Polymer.Settings.useShadow; | |
916 | |
917 /** @type {boolean} */ | |
918 Polymer.Settings.useNativeShadow; | |
919 | |
920 /** @type {boolean} */ | |
921 Polymer.Settings.useNativeImports; | |
922 | |
923 /** @type {boolean} */ | |
924 Polymer.Settings.useNativeCustomElements; | |
925 | |
926 | |
927 /** | |
928 * @see https://github.com/Polymer/polymer/blob/master/src/lib/template/templati
zer.html | |
929 * @polymerBehavior | |
930 */ | |
931 Polymer.Templatizer = { | |
932 ctor: function() {}, | |
933 | |
934 /** | |
935 * @param {?Object} model | |
936 * @return {?Element} | |
937 */ | |
938 stamp: function(model) {}, | |
939 | |
940 /** | |
941 * @param {?Element} template | |
942 */ | |
943 templatize: function(template) {}, | |
944 | |
945 /** | |
946 * Returns the template "model" associated with a given element, which | |
947 * serves as the binding scope for the template instance the element is | |
948 * contained in. A template model is an instance of `Polymer.Base`, and | |
949 * should be used to manipulate data associated with this template instance. | |
950 * | |
951 * Example: | |
952 * | |
953 * var model = modelForElement(el); | |
954 * if (model.index < 10) { | |
955 * model.set('item.checked', true); | |
956 * } | |
957 * | |
958 * @param {?HTMLElement} el Element for which to return a template model. | |
959 * @return {(!PolymerElement)|undefined} Model representing the binding scope
for | |
960 * the element. | |
961 */ | |
962 modelForElement: function(el) {}, | |
963 | |
964 /** | |
965 * @param {function()} fn | |
966 * @protected | |
967 */ | |
968 _debounceTemplate: function(fn) {} | |
969 }; | |
970 | |
971 | |
972 | |
973 /** | |
974 * A node produced by Templatizer which has a templateInstance property. | |
975 * | |
976 * @constructor | |
977 * @extends {HTMLElement} | |
978 */ | |
979 var TemplatizerNode = function() {}; | |
980 | |
981 | |
982 /** @type {?PolymerElement} */ | |
983 TemplatizerNode.prototype._templateInstance; | |
984 | |
985 | |
986 | |
987 /** | |
988 * @see https://github.com/Polymer/polymer/blob/master/src/lib/template/dom-repe
at.html | |
989 * @extends {PolymerElement} | |
990 * @constructor | |
991 */ | |
992 var DomRepeatElement = function() {}; | |
993 | |
994 | |
995 /** | |
996 * Forces the element to render its content. Normally rendering is | |
997 * asynchronous to a provoking change. This is done for efficiency so | |
998 * that multiple changes trigger only a single render. The render method | |
999 * should be called if, for example, template rendering is required to | |
1000 * validate application state. | |
1001 */ | |
1002 DomRepeatElement.prototype.render = function() {}; | |
1003 | |
1004 | |
1005 /** | |
1006 * Returns the item associated with a given element stamped by | |
1007 * this `dom-repeat`. | |
1008 * | |
1009 * @param {!HTMLElement} el Element for which to return the item. | |
1010 * @return {*} Item associated with the element. | |
1011 */ | |
1012 DomRepeatElement.prototype.itemForElement = function(el) {}; | |
1013 | |
1014 | |
1015 /** | |
1016 * Returns the `Polymer.Collection` key associated with a given | |
1017 * element stamped by this `dom-repeat`. | |
1018 * | |
1019 * @param {!HTMLElement} el Element for which to return the key. | |
1020 * @return {*} Key associated with the element. | |
1021 */ | |
1022 DomRepeatElement.prototype.keyForElement = function(el) {}; | |
1023 | |
1024 | |
1025 /** | |
1026 * Returns the inst index for a given element stamped by this `dom-repeat`. | |
1027 * If `sort` is provided, the index will reflect the sorted order (rather | |
1028 * than the original array order). | |
1029 * | |
1030 * @param {!HTMLElement} el Element for which to return the index. | |
1031 * @return {*} Row index associated with the element (note this may | |
1032 * not correspond to the array index if a user `sort` is applied). | |
1033 */ | |
1034 DomRepeatElement.prototype.indexForElement = function(el) {}; | |
1035 | |
1036 | |
1037 | |
1038 /** | |
1039 * @see https://github.com/Polymer/polymer/blob/master/src/lib/template/array-se
lector.html | |
1040 * @extends {PolymerElement} | |
1041 * @constructor | |
1042 */ | |
1043 var ArraySelectorElement = function() {}; | |
1044 | |
1045 | |
1046 /** | |
1047 * Returns whether the item is currently selected. | |
1048 * | |
1049 * @param {*} item Item from `items` array to test | |
1050 * @return {boolean} Whether the item is selected | |
1051 */ | |
1052 ArraySelectorElement.prototype.isSelected = function(item) {}; | |
1053 | |
1054 | |
1055 /** | |
1056 * Clears the selection state. | |
1057 */ | |
1058 ArraySelectorElement.prototype.clearSelection = function() {}; | |
1059 | |
1060 | |
1061 /** | |
1062 * Deselects the given item if it is already selected. | |
1063 * | |
1064 * @param {*} item Item from `items` array to deselect | |
1065 */ | |
1066 ArraySelectorElement.prototype.deselect = function(item) {}; | |
1067 | |
1068 | |
1069 /** | |
1070 * Selects the given item. When `toggle` is true, this will automatically | |
1071 * deselect the item if already selected. | |
1072 * | |
1073 * @param {*} item Item from `items` array to select | |
1074 */ | |
1075 ArraySelectorElement.prototype.select = function(item) {}; | |
1076 | |
1077 | |
1078 /** | |
1079 * An Event type fired when moving while finger/button is down. | |
1080 * state - a string indicating the tracking state: | |
1081 * + start: fired when tracking is first detected (finger/button down and | |
1082 * moved past a pre-set distance threshold) | |
1083 * + track: fired while tracking | |
1084 * + end: fired when tracking ends | |
1085 * x - clientX coordinate for event | |
1086 * y - clientY coordinate for event | |
1087 * dx - change in pixels horizontally since the first track event | |
1088 * dy - change in pixels vertically since the first track event | |
1089 * ddx - change in pixels horizontally since last track event | |
1090 * ddy - change in pixels vertically since last track event | |
1091 * hover() - a function that may be called to determine the element currently | |
1092 * being hovered | |
1093 * | |
1094 * @typedef {{ | |
1095 * state: string, | |
1096 * x: number, | |
1097 * y: number, | |
1098 * dx: number, | |
1099 * dy: number, | |
1100 * ddx: number, | |
1101 * ddy: number, | |
1102 * hover: (function(): Node) | |
1103 * }} | |
1104 */ | |
1105 var PolymerTrackEvent; | |
1106 | |
1107 /** | |
1108 * An Event type fired when a finger does down, up, or taps. | |
1109 * x - clientX coordinate for event | |
1110 * y - clientY coordinate for event | |
1111 * sourceEvent - the original DOM event that caused the down action | |
1112 * | |
1113 * @typedef {{ | |
1114 * x: number, | |
1115 * y: number, | |
1116 * sourceEvent: Event | |
1117 * }} | |
1118 */ | |
1119 var PolymerTouchEvent; | |
1120 | |
1121 /** | |
1122 * @typedef {{ | |
1123 * index: number, | |
1124 * removed: !Array, | |
1125 * addedCount: number, | |
1126 * object: !Array, | |
1127 * type: string, | |
1128 * }} | |
1129 */ | |
1130 var PolymerSplice; | |
1131 | |
1132 /** | |
1133 * @typedef {{ | |
1134 * added: !Array<string|number>, | |
1135 * removed: !Array<string|number> | |
1136 * }} | |
1137 */ | |
1138 var PolymerKeySplice; | |
1139 | |
1140 /** | |
1141 * @typedef {{ | |
1142 * indexSplices: ?Array<!PolymerSplice>, | |
1143 * keySplices: ?Array<!PolymerKeySplice> | |
1144 * }} | |
1145 */ | |
1146 var PolymerSpliceChange; | |
1147 | |
1148 /** | |
1149 * The interface that iconsets should obey. Iconsets are registered by setting | |
1150 * their name in the IronMeta 'iconset' db, and a value of type Polymer.Iconset. | |
1151 * | |
1152 * Used by iron-icon but needs to live here since iron-icon, iron-iconset, etc d
on't | |
1153 * depend on each other at all and talk only through iron-meta. | |
1154 * | |
1155 * @interface | |
1156 */ | |
1157 Polymer.Iconset = function() {}; | |
1158 | |
1159 /** | |
1160 * Applies an icon to the given element as a css background image. This | |
1161 * method does not size the element, and it's usually necessary to set | |
1162 * the element's height and width so that the background image is visible. | |
1163 * | |
1164 * @param {Element} element The element to which the icon is applied. | |
1165 * @param {string} icon The name of the icon to apply. | |
1166 * @param {string=} theme (optional) The name or index of the icon to apply. | |
1167 * @param {number=} scale (optional, defaults to 1) Icon scaling factor. | |
1168 */ | |
1169 Polymer.Iconset.prototype.applyIcon = function( | |
1170 element, icon, theme, scale) {}; | |
1171 | |
1172 Polymer.ResolveUrl = {}; | |
1173 | |
1174 /** | |
1175 * @param {string} cssText Some CSS text taken from ownerDocument. | |
1176 * @param {!Document} ownerDocument The source of the css. | |
1177 * @return {string} The given CSS text with its URLs rewritten to be based on | |
1178 * the primary document of this window rather than the given ownerDocument. | |
1179 */ | |
1180 Polymer.ResolveUrl.resolveCss = function(cssText, ownerDocument) {} | |
1181 /** | |
1182 * @param {!Element} element An element whose URL attributes need to be renormed
. | |
1183 * @param {!Document} ownerDocument The document whose URL is the base of the | |
1184 * element's current attributes. | |
1185 */ | |
1186 Polymer.ResolveUrl.resolveAttrs = function(element, ownerDocument) {} | |
1187 /** | |
1188 * @param {string} url A url that needs to be renormed. | |
1189 * @param {?string} baseURI The current base of URL for the URL. | |
1190 * @return {string} The given url rewritten to be based on | |
1191 * the primary document of this window rather than the given url. | |
1192 */ | |
1193 Polymer.ResolveUrl.resolveUrl = function(url, baseURI) {} | |
1194 | |
1195 Polymer.RenderStatus; | |
1196 | |
1197 /** | |
1198 * Makes callback when first render occurs or immediately if render has occured. | |
1199 * @param {!function()} cb Callback function to be invoked. | |
1200 */ | |
1201 Polymer.RenderStatus.whenReady = function(cb) {} | |
1202 | |
1203 /** | |
1204 * Queue up function call on next render. | |
1205 * @param {!Element} element The element on which the function call is made. | |
1206 * @param {!function()} fn The function called on next render. | |
1207 * @param {...*} args The function arguments. | |
1208 */ | |
1209 Polymer.RenderStatus.afterNextRender = function(element, fn, args) {} | |
1210 | |
1211 Polymer.AppLayout; | |
1212 | |
1213 /** @constructor */ | |
1214 Polymer.AppLayout.LocalDomWithBackground = function(){}; | |
1215 /** @type {!HTMLElement} */ | |
1216 Polymer.AppLayout.LocalDomWithBackground.prototype.backgroundFrontLayer; | |
1217 /** @type {!HTMLElement} */ | |
1218 Polymer.AppLayout.LocalDomWithBackground.prototype.backgroundRearLayer; | |
1219 /** @type {!HTMLElement} */ | |
1220 Polymer.AppLayout.LocalDomWithBackground.prototype.background; | |
1221 | |
1222 /** | |
1223 * @constructor | |
1224 * @extends {PolymerElement} | |
1225 */ | |
1226 Polymer.AppLayout.ElementWithBackground = function(){}; | |
1227 | |
1228 // TODO(garlicnation): Follow up with app-layout team and remove private api fro
m this prototype | |
1229 Polymer.AppLayout.ElementWithBackground.prototype = { | |
1230 /** @type {!Polymer.AppLayout.LocalDomWithBackground} */ | |
1231 $: null, | |
1232 /** @return {boolean} True if there's content below the current element */ | |
1233 isContentBelow: function(){}, | |
1234 /** Updates the elements scroll state */ | |
1235 _updateScrollState: function(){}, | |
1236 /** @return {boolean} true if the element is on screen */ | |
1237 isOnScreen: function(){}, | |
1238 /** @type {number} Internal bookkeeping to track screen position */ | |
1239 _deltaHeight: 0, | |
1240 } | |
OLD | NEW |