| OLD | NEW |
| 1 /** | 1 /** |
| 2 * @fileoverview Closure compiler externs for the Polymer library. | 2 * @fileoverview Closure compiler externs for the Polymer library. |
| 3 * | 3 * |
| 4 * @externs | 4 * @externs |
| 5 * @license | 5 * @license |
| 6 * Copyright (c) 2015 The Polymer Project Authors. All rights reserved. | 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 | 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 | 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 | 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 | 10 * contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt. Code |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 */ | 46 */ |
| 47 PolymerElement.prototype.$$ = function(selector) {}; | 47 PolymerElement.prototype.$$ = function(selector) {}; |
| 48 | 48 |
| 49 /** @type {string} The Custom element tag name. */ | 49 /** @type {string} The Custom element tag name. */ |
| 50 PolymerElement.prototype.is; | 50 PolymerElement.prototype.is; |
| 51 | 51 |
| 52 /** @type {string} The native element this element extends. */ | 52 /** @type {string} The native element this element extends. */ |
| 53 PolymerElement.prototype.extends; | 53 PolymerElement.prototype.extends; |
| 54 | 54 |
| 55 /** | 55 /** |
| 56 * An array of objects whose properties get mixed in to this element. | 56 * An array of objects whose properties get added to this element. |
| 57 * | 57 * @see https://www.polymer-project.org/1.0/docs/devguide/behaviors.html |
| 58 * @type {!Array<!Object>|undefined} | 58 * @type {!Array<!Object>|undefined} |
| 59 */ | 59 */ |
| 60 PolymerElement.prototype.mixins; | 60 PolymerElement.prototype.behaviors; |
| 61 | 61 |
| 62 /** | 62 /** |
| 63 * A string-separated list of dependent properties that should result in a | 63 * A string-separated list of dependent properties that should result in a |
| 64 * change function being called. These observers differ from single-property | 64 * change function being called. These observers differ from single-property |
| 65 * observers in that the change handler is called asynchronously. | 65 * observers in that the change handler is called asynchronously. |
| 66 * | 66 * |
| 67 * @type {!Object<string, string>|undefined} | 67 * @type {!Object<string, string>|undefined} |
| 68 */ | 68 */ |
| 69 PolymerElement.prototype.observers; | 69 PolymerElement.prototype.observers; |
| 70 | 70 |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 104 /** @type {!Object<string, *>} */ | 104 /** @type {!Object<string, *>} */ |
| 105 PolymerElement.prototype.hostAttributes; | 105 PolymerElement.prototype.hostAttributes; |
| 106 | 106 |
| 107 /** | 107 /** |
| 108 * An object that maps events to event handler function names. | 108 * An object that maps events to event handler function names. |
| 109 * @type {!Object<string, string>} | 109 * @type {!Object<string, string>} |
| 110 */ | 110 */ |
| 111 PolymerElement.prototype.listeners; | 111 PolymerElement.prototype.listeners; |
| 112 | 112 |
| 113 /** | 113 /** |
| 114 * Return the element whose local dom within which this element is contained. |
| 115 * @type {?Element} |
| 116 */ |
| 117 PolymerElement.prototype.domHost; |
| 118 |
| 119 /** |
| 114 * Notifies the event binding system of a change to a property. | 120 * Notifies the event binding system of a change to a property. |
| 115 * @param {string} path The path to set. | 121 * @param {string} path The path to set. |
| 116 * @param {*} value The value to send in the update notification. | 122 * @param {*} value The value to send in the update notification. |
| 117 */ | 123 */ |
| 118 PolymerElement.prototype.notifyPath = function(path, value) {}; | 124 PolymerElement.prototype.notifyPath = function(path, value) {}; |
| 119 | 125 |
| 120 /** | 126 /** |
| 121 * Shorthand for setting a property, then calling notifyPath. | 127 * Convienence method for setting a value to a path and notifying any |
| 122 * @param {string} path The path to set. | 128 * elements bound to the same path. |
| 123 * @param {*} value The new value. | 129 * |
| 130 * Note, if any part in the path except for the last is undefined, |
| 131 * this method does nothing (this method does not throw when |
| 132 * dereferencing undefined paths). |
| 133 * |
| 134 * @param {(string|Array<(string|number)>)} path Path to the value |
| 135 * to read. The path may be specified as a string (e.g. `foo.bar.baz`) |
| 136 * or an array of path parts (e.g. `['foo.bar', 'baz']`). Note that |
| 137 * bracketed expressions are not supported; string-based path parts |
| 138 * *must* be separated by dots. Note that when dereferencing array |
| 139 * indicies, the index may be used as a dotted part directly |
| 140 * (e.g. `users.12.name` or `['users', 12, 'name']`). |
| 141 * @param {*} value Value to set at the specified path. |
| 142 * @param {Object=} root Root object from which the path is evaluated. |
| 143 */ |
| 144 PolymerElement.prototype.set = function(path, value, root) {}; |
| 145 |
| 146 /** |
| 147 * Convienence method for reading a value from a path. |
| 148 * |
| 149 * Note, if any part in the path is undefined, this method returns |
| 150 * `undefined` (this method does not throw when dereferencing undefined |
| 151 * paths). |
| 152 * |
| 153 * @param {(string|Array<(string|number)>)} path Path to the value |
| 154 * to read. The path may be specified as a string (e.g. `foo.bar.baz`) |
| 155 * or an array of path parts (e.g. `['foo.bar', 'baz']`). Note that |
| 156 * bracketed expressions are not supported; string-based path parts |
| 157 * *must* be separated by dots. Note that when dereferencing array |
| 158 * indicies, the index may be used as a dotted part directly |
| 159 * (e.g. `users.12.name` or `['users', 12, 'name']`). |
| 160 * @param {Object=} root Root object from which the path is evaluated. |
| 161 * @return {*} Value at the path, or `undefined` if any part of the path |
| 162 * is undefined. |
| 124 */ | 163 */ |
| 125 PolymerElement.prototype.setPathValue = function(path, value) {}; | 164 PolymerElement.prototype.get = function(path, root) {}; |
| 126 | 165 |
| 127 /** | 166 /** |
| 128 * Fire an event. | 167 * Fire an event. |
| 129 * | 168 * |
| 130 * @param {string} type An event name. | 169 * @param {string} type An event name. |
| 131 * @param {Object=} detail | 170 * @param {Object=} detail |
| 132 * @param {{ | 171 * @param {{ |
| 133 * bubbles: (boolean|undefined), | 172 * bubbles: (boolean|undefined), |
| 134 * cancelable: (boolean|undefined), | 173 * cancelable: (boolean|undefined), |
| 135 * node: (!HTMLElement|undefined)}=} options | 174 * node: (!HTMLElement|undefined)}=} options |
| (...skipping 24 matching lines...) Expand all Loading... |
| 160 /** | 199 /** |
| 161 * Moves a boolean attribute from oldNode to newNode, unsetting the attribute | 200 * Moves a boolean attribute from oldNode to newNode, unsetting the attribute |
| 162 * (if set) on oldNode and setting it on newNode. | 201 * (if set) on oldNode and setting it on newNode. |
| 163 * @param {string} name | 202 * @param {string} name |
| 164 * @param {!HTMLElement} newNode | 203 * @param {!HTMLElement} newNode |
| 165 * @param {!HTMLElement} oldNode | 204 * @param {!HTMLElement} oldNode |
| 166 */ | 205 */ |
| 167 PolymerElement.prototype.attributeFollows = function(name, newNode, oldNode) {}; | 206 PolymerElement.prototype.attributeFollows = function(name, newNode, oldNode) {}; |
| 168 | 207 |
| 169 /** | 208 /** |
| 209 * Convenience method to add an event listener on a given element, late bound to |
| 210 * a named method on this element. |
| 211 * @param {!Element} node Element to add event listener to. |
| 212 * @param {string} eventName Name of event to listen for. |
| 213 * @param {string} methodName Name of handler method on this to call. |
| 214 */ |
| 215 PolymerElement.prototype.listen = function(node, eventName, methodName) {}; |
| 216 |
| 217 /** |
| 218 * Override scrolling behavior to all direction, one direction, or none. |
| 219 * |
| 220 * Valid scroll directions: |
| 221 * 'all': scroll in any direction |
| 222 * 'x': scroll only in the 'x' direction |
| 223 * 'y': scroll only in the 'y' direction |
| 224 * 'none': disable scrolling for this node |
| 225 * |
| 226 * @param {string=} direction Direction to allow scrolling Defaults to all. |
| 227 * @param {HTMLElement=} node Element to apply scroll direction setting. |
| 228 * Defaults to this. |
| 229 */ |
| 230 PolymerElement.prototype.setScrollDirection = function(direction, node) {}; |
| 231 |
| 232 /** |
| 170 * @param {!Function} method | 233 * @param {!Function} method |
| 171 * @param {number=} wait | 234 * @param {number=} wait |
| 172 * @return {number} A handle which can be used to cancel the job. | 235 * @return {number} A handle which can be used to cancel the job. |
| 173 */ | 236 */ |
| 174 PolymerElement.prototype.async = function(method, wait) {}; | 237 PolymerElement.prototype.async = function(method, wait) {}; |
| 175 | 238 |
| 239 Polymer.Base; |
| 240 |
| 241 /** |
| 242 * Used by the promise-polyfill on its own. |
| 243 * |
| 244 * @param {!Function} method |
| 245 * @param {number=} wait |
| 246 * @return {number} A handle which can be used to cancel the job. |
| 247 */ |
| 248 Polymer.Base.async = function(method, wait) {}; |
| 249 |
| 176 /** | 250 /** |
| 177 * @param {number} handle | 251 * @param {number} handle |
| 178 */ | 252 */ |
| 179 PolymerElement.prototype.cancelAsync = function(handle) {}; | 253 PolymerElement.prototype.cancelAsync = function(handle) {}; |
| 180 | 254 |
| 181 /** | 255 /** |
| 182 * Call debounce to collapse multiple requests for a named task into one | 256 * Call debounce to collapse multiple requests for a named task into one |
| 183 * invocation, which is made after the wait time has elapsed with no new | 257 * invocation, which is made after the wait time has elapsed with no new |
| 184 * request. If no wait time is given, the callback is called at microtask timing | 258 * request. If no wait time is given, the callback is called at microtask timing |
| 185 * (guaranteed to be before paint). | 259 * (guaranteed to be before paint). |
| (...skipping 25 matching lines...) Expand all Loading... |
| 211 /** | 285 /** |
| 212 * Applies a CSS transform to the specified node, or this element if no node is | 286 * Applies a CSS transform to the specified node, or this element if no node is |
| 213 * specified. transform is specified as a string. | 287 * specified. transform is specified as a string. |
| 214 * @param {string} transform | 288 * @param {string} transform |
| 215 * @param {HTMLElement=} node | 289 * @param {HTMLElement=} node |
| 216 */ | 290 */ |
| 217 PolymerElement.prototype.transform = function(transform, node) {}; | 291 PolymerElement.prototype.transform = function(transform, node) {}; |
| 218 | 292 |
| 219 /** | 293 /** |
| 220 * Transforms the specified node, or this element if no node is specified. | 294 * Transforms the specified node, or this element if no node is specified. |
| 221 * @param {string} x | 295 * @param {number|string} x |
| 222 * @param {string} y | 296 * @param {number|string} y |
| 223 * @param {string} z | 297 * @param {number|string} z |
| 224 * @param {HTMLElement=} node | 298 * @param {HTMLElement=} node |
| 225 */ | 299 */ |
| 226 PolymerElement.prototype.translate3d = function(x, y, z, node) {}; | 300 PolymerElement.prototype.translate3d = function(x, y, z, node) {}; |
| 227 | 301 |
| 228 /** | 302 /** |
| 229 * Dynamically imports an HTML document. | 303 * Dynamically imports an HTML document. |
| 230 * @param {string} href | 304 * @param {string} href |
| 231 * @param {Function=} onload | 305 * @param {Function=} onload |
| 232 * @param {Function=} onerror | 306 * @param {Function=} onerror |
| 233 */ | 307 */ |
| 234 PolymerElement.prototype.importHref = function(href, onload, onerror) {}; | 308 PolymerElement.prototype.importHref = function(href, onload, onerror) {}; |
| 235 | 309 |
| 236 /** | 310 /** |
| 237 * Delete an element from an array. | 311 * Delete an element from an array. |
| 238 * @param {!Array} array | 312 * @param {!Array} array |
| 239 * @param {*} item | 313 * @param {*} item |
| 240 */ | 314 */ |
| 241 PolymerElement.prototype.arrayDelete = function(array, item) {}; | 315 PolymerElement.prototype.arrayDelete = function(array, item) {}; |
| 242 | 316 |
| 243 /** | 317 /** |
| 244 * Resolve a url to make it relative to the current doc. | 318 * Resolve a url to make it relative to the current doc. |
| 245 * @param {string} url | 319 * @param {string} url |
| 246 * @return {string} | 320 * @return {string} |
| 247 */ | 321 */ |
| 248 PolymerElement.prototype.resolveUrl = function(url) {}; | 322 PolymerElement.prototype.resolveUrl = function(url) {}; |
| 249 | 323 |
| 324 /** |
| 325 * Logs a message to the console. |
| 326 * |
| 327 * @param {!Array} var_args |
| 328 * @protected |
| 329 */ |
| 330 PolymerElement.prototype._log = function(var_args) {}; |
| 331 |
| 332 /** |
| 333 * Logs a message to the console with a 'warn' level. |
| 334 * |
| 335 * @param {!Array} var_args |
| 336 * @protected |
| 337 */ |
| 338 PolymerElement.prototype._warn = function(var_args) {}; |
| 339 |
| 340 /** |
| 341 * Logs a message to the console with an 'error' level. |
| 342 * |
| 343 * @param {!Array} var_args |
| 344 * @protected |
| 345 */ |
| 346 PolymerElement.prototype._error = function(var_args) {}; |
| 347 |
| 348 /** |
| 349 * Formats string arguments together for a console log. |
| 350 * |
| 351 * @param {...*} var_args |
| 352 * @return {!Array} The formatted array of args to a log function. |
| 353 * @protected |
| 354 */ |
| 355 PolymerElement.prototype._logf = function(var_args) {}; |
| 356 |
| 250 | 357 |
| 251 /** | 358 /** |
| 252 * A Polymer DOM API for manipulating DOM such that local DOM and light DOM | 359 * A Polymer DOM API for manipulating DOM such that local DOM and light DOM |
| 253 * trees are properly maintained. | 360 * trees are properly maintained. |
| 254 * | 361 * |
| 255 * @constructor | 362 * @constructor |
| 256 */ | 363 */ |
| 257 var PolymerDomApi = function() {}; | 364 var PolymerDomApi = function() {}; |
| 258 | 365 |
| 259 /** @param {!Node} node */ | 366 /** @param {!Node} node */ |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 309 * @return {!Array<?HTMLElement>} | 416 * @return {!Array<?HTMLElement>} |
| 310 */ | 417 */ |
| 311 PolymerDomApi.prototype.querySelectorAll = function(selector) {}; | 418 PolymerDomApi.prototype.querySelectorAll = function(selector) {}; |
| 312 | 419 |
| 313 /** @return {!Array<!Node>} */ | 420 /** @return {!Array<!Node>} */ |
| 314 PolymerDomApi.prototype.getDistributedNodes = function() {}; | 421 PolymerDomApi.prototype.getDistributedNodes = function() {}; |
| 315 | 422 |
| 316 /** @return {!Array<!Node>} */ | 423 /** @return {!Array<!Node>} */ |
| 317 PolymerDomApi.prototype.getDestinationInsertionPoints = function() {}; | 424 PolymerDomApi.prototype.getDestinationInsertionPoints = function() {}; |
| 318 | 425 |
| 426 /** @return {?Node} */ |
| 427 PolymerDomApi.prototype.getOwnerRoot = function() {}; |
| 428 |
| 319 /** | 429 /** |
| 320 * @param {string} attribute | 430 * @param {string} attribute |
| 321 * @param {string|number|boolean} value Values are converted to strings with | 431 * @param {string|number|boolean} value Values are converted to strings with |
| 322 * ToString, so we accept number and boolean since both convert easily to | 432 * ToString, so we accept number and boolean since both convert easily to |
| 323 * strings. | 433 * strings. |
| 324 */ | 434 */ |
| 325 PolymerDomApi.prototype.setAttribute = function(attribute, value) {}; | 435 PolymerDomApi.prototype.setAttribute = function(attribute, value) {}; |
| 326 | 436 |
| 327 /** @param {string} attribute */ | 437 /** @param {string} attribute */ |
| 328 PolymerDomApi.prototype.removeAttribute = function(attribute) {}; | 438 PolymerDomApi.prototype.removeAttribute = function(attribute) {}; |
| 329 | 439 |
| 330 /** @type {?DOMTokenList} */ | 440 /** @type {?DOMTokenList} */ |
| 331 PolymerDomApi.prototype.classList; | 441 PolymerDomApi.prototype.classList; |
| 332 | 442 |
| 333 /** | 443 /** |
| 334 * Returns a Polymer-friendly API for manipulating DOM of a specified node. | 444 * A Polymer Event API. |
| 335 * | 445 * |
| 336 * @param {?Node} node | 446 * @constructor |
| 337 * @return {!PolymerDomApi} | |
| 338 */ | 447 */ |
| 339 Polymer.dom = function(node) {}; | 448 var PolymerEventApi = function() {}; |
| 449 |
| 450 /** @type {?EventTarget} */ |
| 451 PolymerEventApi.prototype.rootTarget; |
| 452 |
| 453 /** @type {?EventTarget} */ |
| 454 PolymerEventApi.prototype.localTarget; |
| 455 |
| 456 /** @type {?Array<!Element>|undefined} */ |
| 457 PolymerEventApi.prototype.path; |
| 458 |
| 459 /** |
| 460 * Returns a Polymer-friendly API for manipulating DOM of a specified node or |
| 461 * an event API for a specified event.. |
| 462 * |
| 463 * @param {?Node|?Event} nodeOrEvent |
| 464 * @return {!PolymerDomApi|!PolymerEventApi} |
| 465 */ |
| 466 Polymer.dom = function(nodeOrEvent) {}; |
| 340 | 467 |
| 341 Polymer.dom.flush = function() {}; | 468 Polymer.dom.flush = function() {}; |
| 342 | 469 |
| 470 Polymer.CaseMap; |
| 471 |
| 472 /** |
| 473 * Convert a string from dash to camel-case. |
| 474 * @param {string} dash |
| 475 * @return {string} The string in camel-case. |
| 476 */ |
| 477 Polymer.CaseMap.dashToCamelCase = function(dash) {}; |
| 478 |
| 479 /** |
| 480 * Convert a string from camel-case to dash format. |
| 481 * @param {string} camel |
| 482 * @return {string} The string in dash format. |
| 483 */ |
| 484 Polymer.CaseMap.camelToDashCase = function(camel) {}; |
| 485 |
| 486 |
| 487 /** |
| 488 * An Event type fired when moving while finger/button is down. |
| 489 * state - a string indicating the tracking state: |
| 490 * + start: fired when tracking is first detected (finger/button down and |
| 491 * moved past a pre-set distance threshold) |
| 492 * + track: fired while tracking |
| 493 * + end: fired when tracking ends |
| 494 * x - clientX coordinate for event |
| 495 * y - clientY coordinate for event |
| 496 * dx - change in pixels horizontally since the first track event |
| 497 * dy - change in pixels vertically since the first track event |
| 498 * ddx - change in pixels horizontally since last track event |
| 499 * ddy - change in pixels vertically since last track event |
| 500 * hover() - a function that may be called to determine the element currently |
| 501 * being hovered |
| 502 * |
| 503 * @typedef {{ |
| 504 * state: string, |
| 505 * x: number, |
| 506 * y: number, |
| 507 * dx: number, |
| 508 * dy: number, |
| 509 * ddx: number, |
| 510 * ddy: number, |
| 511 * hover: (function(): Node) |
| 512 * }} |
| 513 */ |
| 514 var PolymerTrackEvent; |
| 515 |
| 516 /** |
| 517 * An Event type fired when a finger does down, up, or taps. |
| 518 * x - clientX coordinate for event |
| 519 * y - clientY coordinate for event |
| 520 * sourceEvent - the original DOM event that caused the down action |
| 521 * |
| 522 * @typedef {{ |
| 523 * x: number, |
| 524 * y: number, |
| 525 * sourceEvent: Event |
| 526 * }} |
| 527 */ |
| 528 var PolymerTouchEvent; |
| OLD | NEW |