polymer-1.0.js 51 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771
  1. // SSSSSSSSSSSSSSS TTTTTTTTTTTTTTTTTTTTTTT OOOOOOOOO PPPPPPPPPPPPPPPPP
  2. // SS:::::::::::::::ST:::::::::::::::::::::T OO:::::::::OO P::::::::::::::::P
  3. // S:::::SSSSSS::::::ST:::::::::::::::::::::T OO:::::::::::::OO P::::::PPPPPP:::::P
  4. // S:::::S SSSSSSST:::::TT:::::::TT:::::TO:::::::OOO:::::::OPP:::::P P:::::P
  5. // S:::::S TTTTTT T:::::T TTTTTTO::::::O O::::::O P::::P P:::::P
  6. // S:::::S T:::::T O:::::O O:::::O P::::P P:::::P
  7. // S::::SSSS P::::PPPPPP:::::P
  8. // SS::::::SSSSS This file is generated. To update it, P:::::::::::::PP
  9. // SSS::::::::SS run roll_closure_compiler. P::::PPPPPPPPP
  10. // SSSSSS::::S P::::P
  11. // S:::::S T:::::T O:::::O O:::::O P::::P
  12. // S:::::S T:::::T O::::::O O::::::O P::::P
  13. // SSSSSSS S:::::S TT:::::::TT O:::::::OOO:::::::OPP::::::PP
  14. // S::::::SSSSSS:::::S T:::::::::T OO:::::::::::::OO P::::::::P
  15. // S:::::::::::::::SS T:::::::::T OO:::::::::OO P::::::::P
  16. // SSSSSSSSSSSSSSS TTTTTTTTTTT OOOOOOOOO PPPPPPPPPP
  17. /*
  18. * Copyright 2016 The Closure Compiler Authors.
  19. *
  20. * Licensed under the Apache License, Version 2.0 (the "License");
  21. * you may not use this file except in compliance with the License.
  22. * You may obtain a copy of the License at
  23. *
  24. * http://www.apache.org/licenses/LICENSE-2.0
  25. *
  26. * Unless required by applicable law or agreed to in writing, software
  27. * distributed under the License is distributed on an "AS IS" BASIS,
  28. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  29. * See the License for the specific language governing permissions and
  30. * limitations under the License.
  31. */
  32. /**
  33. * @fileoverview Closure compiler externs for the Polymer library.
  34. * Originally part of the Polymer Project. Original license below.
  35. *
  36. * @externs
  37. * @suppress {strictMissingProperties}
  38. * @license
  39. * Copyright (c) 2015 The Polymer Project Authors. All rights reserved.
  40. * This code may only be used under the BSD style license found at
  41. * http://polymer.github.io/LICENSE.txt. The complete set of authors may be
  42. * found at http://polymer.github.io/AUTHORS.txt. The complete set of
  43. * contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt. Code
  44. * distributed by Google as part of the polymer project is also subject to an
  45. * additional IP rights grant found at http://polymer.github.io/PATENTS.txt.
  46. */
  47. if (Math.random() < 1) {
  48. throw "polymer externs should not be executed";
  49. }
  50. /**
  51. * @param {!{is: string}} descriptor The Polymer descriptor of the element.
  52. * @see https://github.com/Polymer/polymer/blob/0.8-preview/PRIMER.md#custom-element-registration
  53. */
  54. var Polymer = function(descriptor) {};
  55. /**
  56. * Re-evaluates and applies custom CSS properties based on dynamic
  57. * changes to this element's scope, such as adding or removing classes.
  58. *
  59. * For performance reasons, Polymer's custom CSS property shim relies
  60. * on this explicit signal from the user to indicate when changes have
  61. * been made that affect the values of custom properties.
  62. *
  63. * @param {Object=} properties Properties object which is mixed into
  64. * the document root `customStyle` property. This argument provides a
  65. * shortcut for setting `customStyle` and then calling `updateStyles`.
  66. *
  67. * @see http://polymer.github.io/polymer/
  68. */
  69. Polymer.updateStyles = function(properties) {};
  70. /** @constructor @extends {HTMLElement} */
  71. var PolymerElement = function() {};
  72. /**
  73. * A mapping from ID to element in this Polymer Element's local DOM.
  74. * @type {!Object}
  75. */
  76. PolymerElement.prototype.$;
  77. /**
  78. * True if the element has been attached to the DOM.
  79. * @type {boolean}
  80. */
  81. PolymerElement.prototype.isAttached;
  82. /**
  83. * The root node of the element.
  84. * @type {!Node}
  85. */
  86. PolymerElement.prototype.root;
  87. /**
  88. * The root node for the element.
  89. * Only exists if running under Shady Dom.
  90. * You usually want to use `this.root`.
  91. *
  92. * @type {?Node|undefined}
  93. */
  94. PolymerElement.prototype.shadyRoot;
  95. /**
  96. * Returns the first node in this element’s local DOM that matches selector.
  97. * @param {string} selector
  98. * @return {Element} Element found by the selector, or null if not found.
  99. */
  100. PolymerElement.prototype.$$ = function(selector) {};
  101. /** @type {string} The custom element tag name. */
  102. PolymerElement.prototype.is;
  103. /** @type {null|!HTMLTemplateElement} The element's template. */
  104. PolymerElement.prototype._template;
  105. /** @type {string} The native element this element extends. */
  106. PolymerElement.prototype.extends;
  107. /**
  108. * An array of objects whose properties get added to this element.
  109. * @see https://www.polymer-project.org/1.0/docs/devguide/behaviors.html
  110. * @type {!Array<!Object>|undefined}
  111. */
  112. PolymerElement.prototype.behaviors;
  113. /**
  114. * A string-separated list of dependent properties that should result in a
  115. * change function being called. These observers differ from single-property
  116. * observers in that the change handler is called asynchronously.
  117. *
  118. * @type {!Object<string, string>|undefined}
  119. */
  120. PolymerElement.prototype.observers;
  121. /** On create callback. */
  122. PolymerElement.prototype.created = function() {};
  123. /** On ready callback. */
  124. PolymerElement.prototype.ready = function() {};
  125. /** On before register callback. */
  126. PolymerElement.prototype.beforeRegister = function() {};
  127. /** On registered callback. */
  128. PolymerElement.prototype.registered = function() {};
  129. /** On attached to the DOM callback. */
  130. PolymerElement.prototype.attached = function() {};
  131. /** On detached from the DOM callback. */
  132. PolymerElement.prototype.detached = function() {};
  133. /**
  134. * Callback fired when an attribute on the element has been changed.
  135. *
  136. * @param {string} name The name of the attribute that changed.
  137. */
  138. PolymerElement.prototype.attributeChanged = function(name) {};
  139. /** @typedef {!{
  140. * type: !Function,
  141. * reflectToAttribute: (boolean|undefined),
  142. * readOnly: (boolean|undefined),
  143. * notify: (boolean|undefined),
  144. * value: *,
  145. * computed: (string|undefined),
  146. * observer: (string|undefined)
  147. * }} */
  148. PolymerElement.PropertyConfig;
  149. /** @typedef {!Object<string, (!Function|!PolymerElement.PropertyConfig)>} */
  150. PolymerElement.Properties;
  151. /** @type {!PolymerElement.Properties} */
  152. PolymerElement.prototype.properties;
  153. /** @type {!Object<string, *>} */
  154. PolymerElement.prototype.hostAttributes;
  155. /**
  156. * An object that maps events to event handler function names.
  157. * @type {!Object<string, string>}
  158. */
  159. PolymerElement.prototype.listeners;
  160. /**
  161. * Force this element to distribute its children to its local dom.
  162. * A user should call `distributeContent` if distribution has been
  163. * invalidated due to changes to selectors on child elements that
  164. * effect distribution that were not made via `Polymer.dom`.
  165. * For example, if an element contains an insertion point with
  166. * `<content select=".foo">` and a `foo` class is added to a child,
  167. * then `distributeContent` must be called to update
  168. * local dom distribution.
  169. * @param {boolean} updateInsertionPoints Shady DOM does not detect
  170. * <content> insertion that is nested in a sub-tree being appended.
  171. * Set to true to distribute to newly added nested <content>'s.
  172. */
  173. PolymerElement.prototype.distributeContent = function(updateInsertionPoints) {};
  174. /**
  175. * Return the element whose local dom within which this element is contained.
  176. * @type {?Element}
  177. */
  178. PolymerElement.prototype.domHost;
  179. /**
  180. * Notifies the event binding system of a change to a property.
  181. * @param {string} path The path to set.
  182. * @param {*=} value The value to send in the update notification.
  183. * @param {boolean=} fromAbove When true, specifies that the change came from
  184. * above this element and thus upward notification is not necessary.
  185. * @return {boolean} True if notification actually took place, based on a dirty
  186. * check of whether the new value was already known.
  187. */
  188. PolymerElement.prototype.notifyPath = function(path, value, fromAbove) {};
  189. /**
  190. * @param {string} path Path that should be notified.
  191. * @param {!Array<!PolymerSplice>} splices Array of splice records indicating
  192. * ordered changes that occurred to the array.
  193. */
  194. PolymerElement.prototype.notifySplices = function(path, splices) {};
  195. /**
  196. * Convienence method for setting a value to a path and notifying any
  197. * elements bound to the same path.
  198. *
  199. * Note, if any part in the path except for the last is undefined,
  200. * this method does nothing (this method does not throw when
  201. * dereferencing undefined paths).
  202. *
  203. * @param {(string|Array<(string|number)>)} path Path to the value
  204. * to read. The path may be specified as a string (e.g. `foo.bar.baz`)
  205. * or an array of path parts (e.g. `['foo.bar', 'baz']`). Note that
  206. * bracketed expressions are not supported; string-based path parts
  207. * *must* be separated by dots. Note that when dereferencing array
  208. * indices, the index may be used as a dotted part directly
  209. * (e.g. `users.12.name` or `['users', 12, 'name']`).
  210. * @param {*} value Value to set at the specified path.
  211. * @param {Object=} root Root object from which the path is evaluated.
  212. */
  213. PolymerElement.prototype.set = function(path, value, root) {};
  214. /**
  215. * Convienence method for reading a value from a path.
  216. *
  217. * Note, if any part in the path is undefined, this method returns
  218. * `undefined` (this method does not throw when dereferencing undefined
  219. * paths).
  220. *
  221. * @param {(string|Array<(string|number)>)} path Path to the value
  222. * to read. The path may be specified as a string (e.g. `foo.bar.baz`)
  223. * or an array of path parts (e.g. `['foo.bar', 'baz']`). Note that
  224. * bracketed expressions are not supported; string-based path parts
  225. * *must* be separated by dots. Note that when dereferencing array
  226. * indices, the index may be used as a dotted part directly
  227. * (e.g. `users.12.name` or `['users', 12, 'name']`).
  228. * @param {Object=} root Root object from which the path is evaluated.
  229. * @return {*} Value at the path, or `undefined` if any part of the path
  230. * is undefined.
  231. */
  232. PolymerElement.prototype.get = function(path, root) {};
  233. /**
  234. * Adds items onto the end of the array at the path specified.
  235. *
  236. * The arguments after `path` and return value match that of
  237. * `Array.prototype.push`.
  238. *
  239. * This method notifies other paths to the same array that a
  240. * splice occurred to the array.
  241. *
  242. * @param {string} path Path to array.
  243. * @param {...*} var_args Items to push onto array
  244. * @return {number} New length of the array.
  245. */
  246. PolymerElement.prototype.push = function(path, var_args) {};
  247. /**
  248. * Removes an item from the end of array at the path specified.
  249. *
  250. * The arguments after `path` and return value match that of
  251. * `Array.prototype.pop`.
  252. *
  253. * This method notifies other paths to the same array that a
  254. * splice occurred to the array.
  255. *
  256. * @param {string} path Path to array.
  257. * @return {*} Item that was removed.
  258. */
  259. PolymerElement.prototype.pop = function(path) {};
  260. /**
  261. * Starting from the start index specified, removes 0 or more items
  262. * from the array and inserts 0 or more new itms in their place.
  263. *
  264. * The arguments after `path` and return value match that of
  265. * `Array.prototype.splice`.
  266. *
  267. * This method notifies other paths to the same array that a
  268. * splice occurred to the array.
  269. *
  270. * @param {string} path Path to array.
  271. * @param {number} start Index from which to start removing/inserting.
  272. * @param {number} deleteCount Number of items to remove.
  273. * @param {...*} var_args Items to insert into array.
  274. * @return {!Array} Array of removed items.
  275. */
  276. PolymerElement.prototype.splice = function(path, start, deleteCount, var_args) {};
  277. /**
  278. * Removes an item from the beginning of array at the path specified.
  279. *
  280. * The arguments after `path` and return value match that of
  281. * `Array.prototype.pop`.
  282. *
  283. * This method notifies other paths to the same array that a
  284. * splice occurred to the array.
  285. *
  286. * @param {string} path Path to array.
  287. * @return {*} Item that was removed.
  288. */
  289. PolymerElement.prototype.shift = function(path) {};
  290. /**
  291. * Adds items onto the beginning of the array at the path specified.
  292. *
  293. * The arguments after `path` and return value match that of
  294. * `Array.prototype.push`.
  295. *
  296. * This method notifies other paths to the same array that a
  297. * splice occurred to the array.
  298. *
  299. * @param {string} path Path to array.
  300. * @param {...*} var_args Items to insert info array
  301. * @return {number} New length of the array.
  302. */
  303. PolymerElement.prototype.unshift = function(path, var_args) {};
  304. /**
  305. * Returns a list of element children distributed to this element's
  306. * `<content>`.
  307. *
  308. * If this element contans more than one `<content>` in its
  309. * local DOM, an optional selector may be passed to choose the desired
  310. * content. This method differs from `getContentChildNodes` in that only
  311. * elements are returned.
  312. *
  313. * @param {string=} slctr CSS selector to choose the desired
  314. * `<content>`. Defaults to `content`.
  315. * @return {!Array<!HTMLElement>} List of distributed nodes for the
  316. * `<content>`.
  317. */
  318. PolymerElement.prototype.getContentChildren = function(slctr) {};
  319. /**
  320. * Returns a list of nodes that are the effective childNodes. The effective
  321. * childNodes list is the same as the element's childNodes except that
  322. * any `<content>` elements are replaced with the list of nodes distributed
  323. * to the `<content>`, the result of its `getDistributedNodes` method.
  324. *
  325. * @return {!Array<!Node>} List of effective child nodes.
  326. */
  327. PolymerElement.prototype.getEffectiveChildNodes = function() {};
  328. /**
  329. * Returns a list of elements that are the effective children. The effective
  330. * children list is the same as the element's children except that
  331. * any `<content>` elements are replaced with the list of elements
  332. * distributed to the `<content>`.
  333. *
  334. * @return {!Array<!Node>} List of effective children.
  335. */
  336. PolymerElement.prototype.getEffectiveChildren = function() {};
  337. /**
  338. * Returns a string of text content that is the concatenation of the
  339. * text content's of the element's effective childNodes (the elements
  340. * returned by <a href="#getEffectiveChildNodes>getEffectiveChildNodes</a>.
  341. *
  342. * @return {string} A concatenated string of all effective childNode text
  343. * content.
  344. */
  345. PolymerElement.prototype.getEffectiveTextContent = function() {};
  346. /**
  347. * Returns the first effective child that match selector.
  348. *
  349. * @param {string} selector
  350. * @return {?HTMLElement}
  351. */
  352. PolymerElement.prototype.queryEffectiveChildren = function(selector) {};
  353. /**
  354. * Returns a list of effective children that match selector.
  355. *
  356. * @param {string} selector
  357. * @return {!Array<!HTMLElement>}
  358. */
  359. PolymerElement.prototype.queryAllEffectiveChildren = function(selector) {};
  360. /**
  361. * Fire an event.
  362. *
  363. * @param {string} type An event name.
  364. * @param {*=} detail
  365. * @param {{
  366. * bubbles: (boolean|undefined),
  367. * cancelable: (boolean|undefined),
  368. * node: (!EventTarget|undefined)}=} options
  369. * @return {Object} event
  370. */
  371. PolymerElement.prototype.fire = function(type, detail, options) {};
  372. /**
  373. * Toggles the named boolean class on the host element, adding the class if
  374. * bool is truthy and removing it if bool is falsey. If node is specified, sets
  375. * the class on node instead of the host element.
  376. * @param {string} name
  377. * @param {boolean=} bool
  378. * @param {HTMLElement=} node
  379. */
  380. PolymerElement.prototype.toggleClass = function(name, bool, node) {};
  381. /**
  382. * Toggles the named boolean attribute on the host element, adding the attribute
  383. * if bool is truthy and removing it if bool is falsey. If node is specified,
  384. * sets the attribute on node instead of the host element.
  385. * @param {string} name
  386. * @param {boolean=} bool
  387. * @param {HTMLElement=} node
  388. */
  389. PolymerElement.prototype.toggleAttribute = function(name, bool, node) {};
  390. /**
  391. * Moves a boolean attribute from oldNode to newNode, unsetting the attribute
  392. * (if set) on oldNode and setting it on newNode.
  393. * @param {string} name
  394. * @param {!HTMLElement} newNode
  395. * @param {!HTMLElement} oldNode
  396. */
  397. PolymerElement.prototype.attributeFollows = function(name, newNode, oldNode) {};
  398. /**
  399. * Convenience method to add an event listener on a given element, late bound to
  400. * a named method on this element.
  401. * @param {!EventTarget} node Element to add event listener to.
  402. * @param {string} eventName Name of event to listen for.
  403. * @param {string} methodName Name of handler method on this to call.
  404. */
  405. PolymerElement.prototype.listen = function(node, eventName, methodName) {};
  406. /**
  407. * Convenience method to remove an event listener from a given element.
  408. * @param {?EventTarget} node Element to remove event listener from.
  409. * @param {string} eventName Name of event to stop listening for.
  410. * @param {string} methodName Name of handler method on this to remove.
  411. */
  412. PolymerElement.prototype.unlisten = function(node, eventName, methodName) {};
  413. /**
  414. * Override scrolling behavior to all direction, one direction, or none.
  415. *
  416. * Valid scroll directions:
  417. * 'all': scroll in any direction
  418. * 'x': scroll only in the 'x' direction
  419. * 'y': scroll only in the 'y' direction
  420. * 'none': disable scrolling for this node
  421. *
  422. * @param {string=} direction Direction to allow scrolling Defaults to all.
  423. * @param {HTMLElement=} node Element to apply scroll direction setting.
  424. * Defaults to this.
  425. */
  426. PolymerElement.prototype.setScrollDirection = function(direction, node) {};
  427. /**
  428. * @param {!Function} method
  429. * @param {number=} wait
  430. * @return {number} A handle which can be used to cancel the job.
  431. */
  432. PolymerElement.prototype.async = function(method, wait) {};
  433. /**
  434. * @param {...*} var_args
  435. */
  436. PolymerElement.prototype.factoryImpl = function(var_args) {};
  437. /**
  438. * Apply style scoping to the specified container and all its descendants.
  439. * @param {!Element} container Element to scope.
  440. * @param {boolean} shouldObserve When true, monitors the container for changes
  441. * and re-applies scoping for any future changes.
  442. */
  443. PolymerElement.prototype.scopeSubtree = function(container, shouldObserve) {};
  444. /**
  445. * Aliases one data path as another, such that path notifications from one
  446. * are routed to the other.
  447. *
  448. * @param {string} to Target path to link.
  449. * @param {string} from Source path to link.
  450. */
  451. PolymerElement.prototype.linkPaths = function(to, from) {}
  452. /**
  453. * Removes a data path alias previously established with `linkPaths`.
  454. *
  455. * Note, the path to unlink should be the target (`to`) used when
  456. * linking the paths.
  457. *
  458. * @param {string} path Target path to unlink.
  459. */
  460. PolymerElement.prototype.unlinkPaths = function(path) {}
  461. /**
  462. * Copies own properties (including accessor descriptors) from a source
  463. * object to a target object.
  464. *
  465. * @param {?Object} target Target object to copy properties to.
  466. * @param {?Object} source Source object to copy properties from.
  467. * @return {?Object} Target object that was passed as first argument or source
  468. * object if the target was null.
  469. */
  470. PolymerElement.prototype.extend = function(target, source) {};
  471. /** @const */
  472. Polymer.Base = {};
  473. /**
  474. * Used by the promise-polyfill on its own.
  475. *
  476. * @param {!Function} method
  477. * @param {number=} wait
  478. * @return {number} A handle which can be used to cancel the job.
  479. */
  480. Polymer.Base.async = function(method, wait) {};
  481. /**
  482. * @param {string} tag
  483. * @param {!Object=} props
  484. * @return {!Element}
  485. */
  486. Polymer.Base.create = function(tag, props) {};
  487. /**
  488. * Copies own properties (including accessor descriptors) from a source
  489. * object to a target object.
  490. *
  491. * @param {?Object} target Target object to copy properties to.
  492. * @param {?Object} source Source object to copy properties from.
  493. * @return {?Object} Target object that was passed as first argument or source
  494. * object if the target was null.
  495. */
  496. Polymer.Base.extend = function(target, source) {};
  497. /**
  498. * Returns a property descriptor object for the property specified.
  499. *
  500. * This method allows introspecting the configuration of a Polymer element's
  501. * properties as configured in its `properties` object. Note, this method
  502. * normalizes shorthand forms of the `properties` object into longhand form.
  503. *
  504. * @param {string} property Name of property to introspect.
  505. * @return {Object} Property descriptor for specified property.
  506. */
  507. Polymer.Base.getPropertyInfo = function(property) {};
  508. /**
  509. * Dynamically imports an HTML document.
  510. * @param {string} href
  511. * @param {Function=} onload
  512. * @param {Function=} onerror
  513. * @param {boolean=} async
  514. */
  515. Polymer.Base.importHref = function(href, onload, onerror, async) {};
  516. /**
  517. * Copies props from a source object to a target object.
  518. *
  519. * Note, this method uses a simple `for...in` strategy for enumerating
  520. * properties. To ensure only `ownProperties` are copied from source
  521. * to target and that accessor implementations are copied, use `extend`.
  522. *
  523. * @param {!Object} target Target object to copy properties to.
  524. * @param {?Object} source Source object to copy properties from.
  525. * @return {!Object} Target object that was passed as first argument.
  526. */
  527. Polymer.Base.mixin = function(target, source) {};
  528. /**
  529. * @param {string|!Array<string|number>} path
  530. * @param {!Object=} root
  531. * @return {*}
  532. */
  533. Polymer.Base.get = function(path, root) {};
  534. /**
  535. * @param {string} type
  536. * @param {*=} detail
  537. * @param {!Object=} options
  538. * @return {!CustomEvent}
  539. */
  540. Polymer.Base.fire = function(type, detail, options) {};
  541. /**
  542. * For Polymer internal use only, except for
  543. * github.com/Polymer/polymer/issues/4138
  544. * @type {!function (!Node, ?string, *, ?Object)}
  545. */
  546. Polymer.Base._computeFinalAnnotationValue;
  547. /**
  548. * @param {...*} var_args
  549. * For Polymer-internal use only.
  550. */
  551. Polymer.Base._warn = function(var_args) {};
  552. /**
  553. * @param {...*} var_args
  554. * For Polymer-internal use only.
  555. */
  556. Polymer.Base._error = function(var_args) {};
  557. /** @const */
  558. Polymer.Gestures = {};
  559. /**
  560. * @param {!Node} node
  561. * @param {string} evType
  562. * @param {?Function} handler
  563. * @return {boolean}
  564. * @deprecated Use addListener.
  565. */
  566. Polymer.Gestures.add = function(node, evType, handler) {};
  567. /**
  568. * @param {!Node} node
  569. * @param {string} evType
  570. * @param {?Function} handler
  571. * @return {boolean}
  572. */
  573. Polymer.Gestures.addListener = function(node, evType, handler) {};
  574. /**
  575. * Gets the original target of the given event.
  576. *
  577. * Cheaper than Polymer.dom(ev).path[0];
  578. * See https://github.com/Polymer/polymer/blob/master/src/standard/gestures.html#L191
  579. *
  580. * @param {Event} ev .
  581. * @return {Element} The original target of the event.
  582. */
  583. Polymer.Gestures.findOriginalTarget = function(ev) {};
  584. /**
  585. * @type {!Object}
  586. */
  587. Polymer.Gestures.gestures = {};
  588. /**
  589. * @param {Node} node
  590. * @param {string} value
  591. */
  592. Polymer.Gestures.setTouchAction = function(node, value) {};
  593. /**
  594. * @type {!Object}
  595. */
  596. Polymer.Gestures.gestures.tap = {};
  597. /**
  598. * Reset the tap gesture's state manually
  599. * @type {function()}
  600. */
  601. Polymer.Gestures.gestures.tap.reset = function() {};
  602. /**
  603. * @param {number} handle
  604. */
  605. PolymerElement.prototype.cancelAsync = function(handle) {};
  606. /**
  607. * Call debounce to collapse multiple requests for a named task into one
  608. * invocation, which is made after the wait time has elapsed with no new
  609. * request. If no wait time is given, the callback is called at microtask timing
  610. * (guaranteed to be before paint).
  611. * @param {string} jobName
  612. * @param {!Function} callback
  613. * @param {number=} wait
  614. */
  615. PolymerElement.prototype.debounce = function(jobName, callback, wait) {};
  616. /**
  617. * Cancels an active debouncer without calling the callback.
  618. * @param {string} jobName
  619. */
  620. PolymerElement.prototype.cancelDebouncer = function(jobName) {};
  621. /**
  622. * Calls the debounced callback immediately and cancels the debouncer.
  623. * @param {string} jobName
  624. */
  625. PolymerElement.prototype.flushDebouncer = function(jobName) {};
  626. /**
  627. * @param {string} jobName
  628. * @return {boolean} True if the named debounce task is waiting to run.
  629. */
  630. PolymerElement.prototype.isDebouncerActive = function(jobName) {};
  631. /**
  632. * Applies a CSS transform to the specified node, or this element if no node is
  633. * specified. transform is specified as a string.
  634. * @param {string} transform
  635. * @param {HTMLElement=} node
  636. */
  637. PolymerElement.prototype.transform = function(transform, node) {};
  638. /**
  639. * Transforms the specified node, or this element if no node is specified.
  640. * @param {number|string} x
  641. * @param {number|string} y
  642. * @param {number|string} z
  643. * @param {HTMLElement=} node
  644. */
  645. PolymerElement.prototype.translate3d = function(x, y, z, node) {};
  646. /**
  647. * Dynamically imports an HTML document.
  648. * @param {string} href
  649. * @param {Function=} onload
  650. * @param {Function=} onerror
  651. * @param {boolean=} async
  652. */
  653. PolymerElement.prototype.importHref = function(href, onload, onerror, async) {};
  654. /**
  655. * Checks whether an element is in this element's light DOM tree.
  656. * @param {?Node} node The element to be checked.
  657. * @return {boolean} true if node is in this element's light DOM tree.
  658. */
  659. PolymerElement.prototype.isLightDescendant = function(node) {};
  660. /**
  661. * Checks whether an element is in this element's local DOM tree.
  662. * @param {?Node} node The element to be checked.
  663. * @return {boolean} true if node is in this element's local DOM tree.
  664. */
  665. PolymerElement.prototype.isLocalDescendant = function(node) {};
  666. /**
  667. * Delete an element from an array.
  668. * @param {!Array|string} array Path to array from which to remove the item (or
  669. * the array itself).
  670. * @param {*} item Item to remove
  671. * @return {!Array} The array with the item removed.
  672. */
  673. PolymerElement.prototype.arrayDelete = function(array, item) {};
  674. /**
  675. * Resolve a url to make it relative to the current doc.
  676. * @param {string} url
  677. * @return {string}
  678. */
  679. PolymerElement.prototype.resolveUrl = function(url) {};
  680. /**
  681. * Re-evaluates and applies custom CSS properties based on dynamic
  682. * changes to this element's scope, such as adding or removing classes
  683. * in this element's local DOM.
  684. *
  685. * For performance reasons, Polymer's custom CSS property shim relies
  686. * on this explicit signal from the user to indicate when changes have
  687. * been made that affect the values of custom properties.
  688. *
  689. * @param {Object=} properties Properties object which, if provided is mixed
  690. * into the element's `customStyle` property. This argument provides a
  691. * shortcut for setting `customStyle` and then calling `updateStyles`.
  692. */
  693. PolymerElement.prototype.updateStyles = function(properties) {};
  694. /**
  695. * @type {!Object<string, string|undefined>}
  696. */
  697. PolymerElement.prototype.customStyle;
  698. /**
  699. * Convenience method for creating an element and configuring it.
  700. * @param {string} tagName HTML tag name
  701. * @param {IObject<string, *>=} properties Object of properties to configure on the instance
  702. * @return {!Element}
  703. */
  704. PolymerElement.prototype.create = function(tagName, properties) {};
  705. /**
  706. * Returns the computed style value for the given property.
  707. * @param {string} property
  708. * @return {string} the computed value
  709. */
  710. PolymerElement.prototype.getComputedStyleValue = function(property) {};
  711. /**
  712. * Logs a message to the console.
  713. *
  714. * @param {...*} var_args
  715. * @protected
  716. */
  717. PolymerElement.prototype._log = function(var_args) {};
  718. /**
  719. * Logs a message to the console with a 'warn' level.
  720. *
  721. * @param {...*} var_args
  722. * @protected
  723. */
  724. PolymerElement.prototype._warn = function(var_args) {};
  725. /**
  726. * Logs a message to the console with an 'error' level.
  727. *
  728. * @param {...*} var_args
  729. * @protected
  730. */
  731. PolymerElement.prototype._error = function(var_args) {};
  732. /**
  733. * Formats string arguments together for a console log.
  734. *
  735. * @param {...*} var_args
  736. * @return {!Array} The formatted array of args to a log function.
  737. * @protected
  738. */
  739. PolymerElement.prototype._logf = function(var_args) {};
  740. /** @type {boolean} True after this.ready() has run */
  741. PolymerElement.prototype._readied;
  742. /**
  743. * Do not call this function.
  744. *
  745. * @param {string} path .
  746. * @param {*} value .
  747. */
  748. PolymerElement.prototype._notifyPathUp = function(path, value) {};
  749. /**
  750. * Do not call this function.
  751. *
  752. * @param {string} path .
  753. * @param {*} value .
  754. */
  755. PolymerElement.prototype._pathEffector = function(path, value) {};
  756. /**
  757. * Do not call this function.
  758. *
  759. * @param {string} path .
  760. * @param {*} value .
  761. */
  762. PolymerElement.prototype._propertySetter = function(path, value) {};
  763. /**
  764. * Do not call this function.
  765. *
  766. * @param {string} path .
  767. */
  768. PolymerElement.prototype._notifyChange = function(path) {};
  769. /**
  770. * A Polymer DOM API for manipulating DOM such that local DOM and light DOM
  771. * trees are properly maintained.
  772. *
  773. * @constructor
  774. */
  775. var PolymerDomApi = function() {};
  776. /**
  777. * @param {?Node} node
  778. * @return {boolean}
  779. */
  780. PolymerDomApi.prototype.deepContains = function(node) {};
  781. /** @param {!Node} node */
  782. PolymerDomApi.prototype.appendChild = function(node) {};
  783. /**
  784. * @param {!Node} oldNode
  785. * @param {!Node} newNode
  786. */
  787. PolymerDomApi.prototype.replaceChild = function(oldNode, newNode) {};
  788. /**
  789. * @param {!Node} node
  790. * @param {?Node} beforeNode
  791. */
  792. PolymerDomApi.prototype.insertBefore = function(node, beforeNode) {};
  793. /** @param {!Node} node */
  794. PolymerDomApi.prototype.removeChild = function(node) {};
  795. /** @type {!Array<!HTMLElement>} */
  796. PolymerDomApi.prototype.children;
  797. /** @type {!Array<!Node>} */
  798. PolymerDomApi.prototype.childNodes;
  799. /** @type {?Node} */
  800. PolymerDomApi.prototype.parentNode;
  801. /** @type {?Node} */
  802. PolymerDomApi.prototype.firstChild;
  803. /** @type {?Node} */
  804. PolymerDomApi.prototype.lastChild;
  805. /** @type {?HTMLElement} */
  806. PolymerDomApi.prototype.firstElementChild;
  807. /** @type {?HTMLElement} */
  808. PolymerDomApi.prototype.lastElementChild;
  809. /** @type {?Node} */
  810. PolymerDomApi.prototype.previousSibling;
  811. /** @type {?Node} */
  812. PolymerDomApi.prototype.nextSibling;
  813. /** @type {?HTMLElement} */
  814. PolymerDomApi.prototype.previousElementSibling;
  815. /** @type {?HTMLElement} */
  816. PolymerDomApi.prototype.nextElementSibling;
  817. /** @type {string} */
  818. PolymerDomApi.prototype.textContent;
  819. /** @type {string} */
  820. PolymerDomApi.prototype.innerHTML;
  821. /** @type {?HTMLElement} */
  822. PolymerDomApi.prototype.activeElement;
  823. /**
  824. * @param {string} selector
  825. * @return {?HTMLElement}
  826. */
  827. PolymerDomApi.prototype.querySelector = function(selector) {};
  828. /**
  829. * @param {string} selector
  830. * @return {!Array<!HTMLElement>}
  831. */
  832. PolymerDomApi.prototype.querySelectorAll = function(selector) {};
  833. /** @return {!Array<!Node>} */
  834. PolymerDomApi.prototype.getDistributedNodes = function() {};
  835. /** @return {!Array<!Node>} */
  836. PolymerDomApi.prototype.getDestinationInsertionPoints = function() {};
  837. /** @return {?Node} */
  838. PolymerDomApi.prototype.getOwnerRoot = function() {};
  839. /**
  840. * @param {string} attribute
  841. * @param {string|number|boolean} value Values are converted to strings with
  842. * ToString, so we accept number and boolean since both convert easily to
  843. * strings.
  844. */
  845. PolymerDomApi.prototype.setAttribute = function(attribute, value) {};
  846. /** @param {string} attribute */
  847. PolymerDomApi.prototype.removeAttribute = function(attribute) {};
  848. /**
  849. * @typedef {function(!PolymerDomApi.ObserveInfo)}
  850. */
  851. PolymerDomApi.ObserveCallback;
  852. /**
  853. * @typedef {{
  854. * target: !Node,
  855. * addedNodes: !Array<!Node>,
  856. * removedNodes: !Array<!Node>
  857. * }}
  858. */
  859. PolymerDomApi.ObserveInfo;
  860. /**
  861. * A virtual type for observer callback handles.
  862. *
  863. * @private @constructor
  864. */
  865. PolymerDomApi.ObserveHandle = function() {};
  866. /**
  867. * Notifies callers about changes to the element's effective child nodes,
  868. * the same list as returned by `getEffectiveChildNodes`.
  869. *
  870. * @param {!PolymerDomApi.ObserveCallback} callback The supplied callback
  871. * is called with an `info` argument which is an object that provides
  872. * the `target` on which the changes occurred, a list of any nodes
  873. * added in the `addedNodes` array, and nodes removed in the
  874. * `removedNodes` array.
  875. *
  876. * @return {!PolymerDomApi.ObserveHandle} Handle which is the argument to
  877. * `unobserveNodes`.
  878. */
  879. PolymerDomApi.prototype.observeNodes = function(callback) {};
  880. /**
  881. * Stops observing changes to the element's effective child nodes.
  882. *
  883. * @param {!PolymerDomApi.ObserveHandle} handle The handle for the
  884. * callback that should no longer receive notifications. This
  885. * handle is returned from `observeNodes`.
  886. */
  887. PolymerDomApi.prototype.unobserveNodes = function(handle) {};
  888. /** @type {?DOMTokenList} */
  889. PolymerDomApi.prototype.classList;
  890. /**
  891. * @param {string} selector
  892. * @return {!Array<!HTMLElement>}
  893. */
  894. PolymerDomApi.prototype.queryDistributedElements = function(selector) {};
  895. /**
  896. * Returns a list of effective child nodes for this element.
  897. *
  898. * @return {!Array<!HTMLElement>}
  899. */
  900. PolymerDomApi.prototype.getEffectiveChildNodes = function() {};
  901. /**
  902. * A Polymer Event API.
  903. *
  904. * @constructor
  905. */
  906. var PolymerEventApi = function() {};
  907. /** @type {?EventTarget} */
  908. PolymerEventApi.prototype.rootTarget;
  909. /** @type {?EventTarget} */
  910. PolymerEventApi.prototype.localTarget;
  911. /** @type {?Array<!Element>|undefined} */
  912. PolymerEventApi.prototype.path;
  913. /** @type {Event} */
  914. PolymerEventApi.prototype.event;
  915. /** @const */
  916. Polymer.Async = {};
  917. /**
  918. * @param {function()} callback
  919. * @param {number=} waitTime
  920. * @return {number}
  921. */
  922. Polymer.Async.run = function (callback, waitTime) {};
  923. /**
  924. * @param {number} handle
  925. */
  926. Polymer.Async.cancel = function(handle) {};
  927. /**
  928. * polymer-onerror experiment relies on this private API, so expose it only
  929. * to let the compilation work. Do not use in user code.
  930. */
  931. Polymer.Async._atEndOfMicrotask = function() {};
  932. /**
  933. * Returns a Polymer-friendly API for manipulating DOM of a specified node or
  934. * an event API for a specified event..
  935. *
  936. * @param {?Node|?Event} nodeOrEvent
  937. * @return {!PolymerDomApi|!PolymerEventApi}
  938. */
  939. Polymer.dom = function(nodeOrEvent) {};
  940. Polymer.dom.flush = function() {};
  941. /** @constructor */
  942. Polymer.Debouncer = function() {};
  943. Polymer.Debouncer.prototype = {
  944. /**
  945. * @param {function()} callback
  946. * @param {number} wait
  947. */
  948. go: function(callback, wait) {},
  949. stop: function() {},
  950. complete: function() {}
  951. };
  952. /** @param {!Polymer.Debouncer} debouncer */
  953. Polymer.dom.addDebouncer = function(debouncer) {};
  954. /**
  955. * Returns whether the given object is an instance of a Polymer element.
  956. * @param {*} object
  957. * @return {boolean}
  958. */
  959. Polymer.isInstance = function(object) {};
  960. /** @const */
  961. Polymer.CaseMap = {};
  962. /**
  963. * Convert a string from dash to camel-case.
  964. * @param {string} dash
  965. * @return {string} The string in camel-case.
  966. */
  967. Polymer.CaseMap.dashToCamelCase = function(dash) {};
  968. /**
  969. * Convert a string from camel-case to dash format.
  970. * @param {string} camel
  971. * @return {string} The string in dash format.
  972. */
  973. Polymer.CaseMap.camelToDashCase = function(camel) {};
  974. /**
  975. * A Polymer data structure abstraction.
  976. *
  977. * @param {?Array} userArray
  978. * @constructor
  979. */
  980. Polymer.Collection = function(userArray) {};
  981. Polymer.Collection.prototype.initMap = function() {};
  982. /**
  983. * @param {*} item
  984. */
  985. Polymer.Collection.prototype.add = function(item) {};
  986. /**
  987. * @param {number|string} key
  988. */
  989. Polymer.Collection.prototype.removeKey = function(key) {};
  990. /**
  991. * @param {*} item
  992. * @return {number|string} The key of the item removed.
  993. */
  994. Polymer.Collection.prototype.remove = function(item) {};
  995. /**
  996. * @param {*} item
  997. * @return {number|string} The key of the item.
  998. */
  999. Polymer.Collection.prototype.getKey = function(item) {};
  1000. /**
  1001. * @return {!Array<number|string>} The key of the item removed.
  1002. */
  1003. Polymer.Collection.prototype.getKeys = function() {};
  1004. /**
  1005. * @param {number|string} key
  1006. * @param {*} item
  1007. */
  1008. Polymer.Collection.prototype.setItem = function(key, item) {};
  1009. /**
  1010. * @param {number|string} key
  1011. * @return {*} The item for the given key if present.
  1012. */
  1013. Polymer.Collection.prototype.getItem = function(key) {};
  1014. /**
  1015. * @return {!Array} The items in the collection
  1016. */
  1017. Polymer.Collection.prototype.getItems = function() {};
  1018. /**
  1019. * @param {!Array} userArray
  1020. * @return {!Polymer.Collection} A new Collection wrapping the given array.
  1021. */
  1022. Polymer.Collection.get = function(userArray) {};
  1023. /**
  1024. * @param {!Array} userArray
  1025. * @param {!Array<!PolymerSplice>} splices
  1026. * @return {!Array<!PolymerKeySplice>} KeySplices with added and removed keys
  1027. */
  1028. Polymer.Collection.applySplices = function(userArray, splices) {};
  1029. /**
  1030. * Settings pulled from
  1031. * https://github.com/Polymer/polymer/blob/master/lib/utils/settings.html
  1032. * @const
  1033. */
  1034. Polymer.Settings = {};
  1035. /** @type {string} */
  1036. Polymer.Settings.dom;
  1037. /** @type {boolean} */
  1038. Polymer.Settings.wantShadow;
  1039. /** @type {boolean} */
  1040. Polymer.Settings.hasShadow;
  1041. /** @type {boolean} */
  1042. Polymer.Settings.nativeShadow;
  1043. /** @type {boolean} */
  1044. Polymer.Settings.useShadow;
  1045. /** @type {boolean} */
  1046. Polymer.Settings.useNativeShadow;
  1047. /** @type {boolean} */
  1048. Polymer.Settings.useNativeImports;
  1049. /** @type {boolean} */
  1050. Polymer.Settings.useNativeCustomElements;
  1051. /** @type {boolean} */
  1052. Polymer.Settings.useNativeCSSProperties;
  1053. /**
  1054. * @see https://github.com/Polymer/polymer/blob/master/src/lib/template/templatizer.html
  1055. * @polymerBehavior
  1056. */
  1057. Polymer.Templatizer = {
  1058. ctor: function() {},
  1059. /**
  1060. * @param {?Object=} model
  1061. * @return {?Element}
  1062. */
  1063. stamp: function(model) {},
  1064. /**
  1065. * @param {?Element} template
  1066. * @param {boolean=} mutableData In Polymer 1.x, passing this argument is a
  1067. * no-op.
  1068. */
  1069. templatize: function(template, mutableData) {},
  1070. /**
  1071. * Returns the template "model" associated with a given element, which
  1072. * serves as the binding scope for the template instance the element is
  1073. * contained in. A template model is an instance of `Polymer.Base`, and
  1074. * should be used to manipulate data associated with this template instance.
  1075. *
  1076. * Example:
  1077. *
  1078. * var model = modelForElement(el);
  1079. * if (model.index < 10) {
  1080. * model.set('item.checked', true);
  1081. * }
  1082. *
  1083. * @param {?HTMLElement} el Element for which to return a template model.
  1084. * @return {(!PolymerElement)|undefined} Model representing the binding scope for
  1085. * the element.
  1086. */
  1087. modelForElement: function(el) {},
  1088. /**
  1089. * @param {function()} fn
  1090. * @protected
  1091. */
  1092. _debounceTemplate: function(fn) {}
  1093. };
  1094. /**
  1095. * A node produced by Templatizer which has a templateInstance property.
  1096. *
  1097. * @constructor
  1098. * @extends {HTMLElement}
  1099. */
  1100. var TemplatizerNode = function() {};
  1101. /** @type {?PolymerElement} */
  1102. TemplatizerNode.prototype._templateInstance;
  1103. /**
  1104. * @see https://github.com/Polymer/polymer/blob/1.x/src/lib/template/dom-if.html
  1105. * @extends {PolymerElement}
  1106. * @constructor
  1107. */
  1108. var DomIf = function() {};
  1109. /**
  1110. * Forces the element to render its content. Normally rendering is
  1111. * asynchronous to a provoking change. This is done for efficiency so
  1112. * that multiple changes trigger only a single render. The render method
  1113. * should be called if, for example, template rendering is required to
  1114. * validate application state.
  1115. */
  1116. DomIf.prototype.render = function() {};
  1117. /**
  1118. * @see https://github.com/Polymer/polymer/blob/master/src/lib/template/dom-repeat.html
  1119. * @extends {PolymerElement}
  1120. * @constructor
  1121. */
  1122. var DomRepeatElement = function() {};
  1123. /**
  1124. * Forces the element to render its content. Normally rendering is
  1125. * asynchronous to a provoking change. This is done for efficiency so
  1126. * that multiple changes trigger only a single render. The render method
  1127. * should be called if, for example, template rendering is required to
  1128. * validate application state.
  1129. */
  1130. DomRepeatElement.prototype.render = function() {};
  1131. /**
  1132. * Returns the item associated with a given element stamped by
  1133. * this `dom-repeat`.
  1134. *
  1135. * @param {!HTMLElement} el Element for which to return the item.
  1136. * @return {*} Item associated with the element.
  1137. */
  1138. DomRepeatElement.prototype.itemForElement = function(el) {};
  1139. /**
  1140. * Returns the `Polymer.Collection` key associated with a given
  1141. * element stamped by this `dom-repeat`.
  1142. *
  1143. * @param {!HTMLElement} el Element for which to return the key.
  1144. * @return {*} Key associated with the element.
  1145. */
  1146. DomRepeatElement.prototype.keyForElement = function(el) {};
  1147. /**
  1148. * Returns the inst index for a given element stamped by this `dom-repeat`.
  1149. * If `sort` is provided, the index will reflect the sorted order (rather
  1150. * than the original array order).
  1151. *
  1152. * @param {!HTMLElement} el Element for which to return the index.
  1153. * @return {*} Row index associated with the element (note this may
  1154. * not correspond to the array index if a user `sort` is applied).
  1155. */
  1156. DomRepeatElement.prototype.indexForElement = function(el) {};
  1157. /**
  1158. * Count of currently rendered items after `filter` (if any) has been applied.
  1159. * If "chunking mode" is enabled, `renderedItemCount` is updated each time a
  1160. * set of template instances is rendered.
  1161. *
  1162. * @type {number}
  1163. */
  1164. DomRepeatElement.prototype.renderedItemCount;
  1165. /**
  1166. * Event object for an event handler on a child of a dom-repeat template.
  1167. * @see https://www.polymer-project.org/1.0/docs/devguide/templates#handling-events
  1168. * @extends {CustomEvent}
  1169. * @constructor
  1170. * @template T
  1171. */
  1172. var DomRepeatEvent = function() {};
  1173. /**
  1174. * @type {{
  1175. * index: number,
  1176. * item: T
  1177. * }}
  1178. */
  1179. DomRepeatEvent.prototype.model;
  1180. /**
  1181. * @see https://github.com/Polymer/polymer/blob/master/src/lib/template/array-selector.html
  1182. * @extends {PolymerElement}
  1183. * @constructor
  1184. */
  1185. var ArraySelectorElement = function() {};
  1186. /**
  1187. * Returns whether the item is currently selected.
  1188. *
  1189. * @param {*} item Item from `items` array to test
  1190. * @return {boolean} Whether the item is selected
  1191. */
  1192. ArraySelectorElement.prototype.isSelected = function(item) {};
  1193. /**
  1194. * Clears the selection state.
  1195. */
  1196. ArraySelectorElement.prototype.clearSelection = function() {};
  1197. /**
  1198. * Deselects the given item if it is already selected.
  1199. *
  1200. * @param {*} item Item from `items` array to deselect
  1201. */
  1202. ArraySelectorElement.prototype.deselect = function(item) {};
  1203. /**
  1204. * Selects the given item. When `toggle` is true, this will automatically
  1205. * deselect the item if already selected.
  1206. *
  1207. * @param {*} item Item from `items` array to select
  1208. */
  1209. ArraySelectorElement.prototype.select = function(item) {};
  1210. /**
  1211. * An Event type fired when moving while finger/button is down.
  1212. * state - a string indicating the tracking state:
  1213. * + start: fired when tracking is first detected (finger/button down and
  1214. * moved past a pre-set distance threshold)
  1215. * + track: fired while tracking
  1216. * + end: fired when tracking ends
  1217. * x - clientX coordinate for event
  1218. * y - clientY coordinate for event
  1219. * dx - change in pixels horizontally since the first track event
  1220. * dy - change in pixels vertically since the first track event
  1221. * ddx - change in pixels horizontally since last track event
  1222. * ddy - change in pixels vertically since last track event
  1223. * hover() - a function that may be called to determine the element currently
  1224. * being hovered
  1225. *
  1226. * @typedef {{
  1227. * state: string,
  1228. * x: number,
  1229. * y: number,
  1230. * dx: number,
  1231. * dy: number,
  1232. * ddx: number,
  1233. * ddy: number,
  1234. * hover: (function(): Node)
  1235. * }}
  1236. */
  1237. var PolymerTrackEvent;
  1238. /**
  1239. * An Event type fired when a finger does down, up, or taps.
  1240. * x - clientX coordinate for event
  1241. * y - clientY coordinate for event
  1242. * sourceEvent - the original DOM event that caused the down action
  1243. *
  1244. * @typedef {{
  1245. * x: number,
  1246. * y: number,
  1247. * sourceEvent: Event
  1248. * }}
  1249. */
  1250. var PolymerTouchEvent;
  1251. /**
  1252. * @typedef {{
  1253. * index: number,
  1254. * removed: !Array,
  1255. * addedCount: number,
  1256. * object: !Array,
  1257. * type: string,
  1258. * }}
  1259. */
  1260. var PolymerSplice;
  1261. /**
  1262. * @typedef {{
  1263. * added: !Array<string|number>,
  1264. * removed: !Array<string|number>
  1265. * }}
  1266. */
  1267. var PolymerKeySplice;
  1268. /**
  1269. * @typedef {{
  1270. * indexSplices: ?Array<!PolymerSplice>,
  1271. * keySplices: ?Array<!PolymerKeySplice>
  1272. * }}
  1273. */
  1274. var PolymerSpliceChange;
  1275. /**
  1276. * The type of the object received by an observer function when deep
  1277. * sub-property observation is enabled. See:
  1278. * https://www.polymer-project.org/1.0/docs/devguide/properties.html#deep-observation
  1279. *
  1280. * @typedef {{
  1281. * path: string,
  1282. * value: (?Object|undefined),
  1283. * base: (?Object|undefined)
  1284. * }}
  1285. */
  1286. var PolymerDeepPropertyChange;
  1287. /**
  1288. * The interface that iconsets should obey. Iconsets are registered by setting
  1289. * their name in the IronMeta 'iconset' db, and a value of type Polymer.Iconset.
  1290. *
  1291. * Used by iron-icon but needs to live here since iron-icon, iron-iconset, etc don't
  1292. * depend on each other at all and talk only through iron-meta.
  1293. *
  1294. * @interface
  1295. */
  1296. Polymer.Iconset = function() {};
  1297. /**
  1298. * Applies an icon to the given element as a css background image. This
  1299. * method does not size the element, and it's usually necessary to set
  1300. * the element's height and width so that the background image is visible.
  1301. *
  1302. * @param {Element} element The element to which the icon is applied.
  1303. * @param {string} icon The name of the icon to apply.
  1304. * @param {string=} theme (optional) The name or index of the icon to apply.
  1305. * @param {number=} scale (optional, defaults to 1) Icon scaling factor.
  1306. */
  1307. Polymer.Iconset.prototype.applyIcon = function(
  1308. element, icon, theme, scale) {};
  1309. /**
  1310. * Remove an icon from the given element by undoing the changes effected
  1311. * by `applyIcon`.
  1312. *
  1313. * @param {Element} element The element from which the icon is removed.
  1314. */
  1315. Polymer.Iconset.prototype.removeIcon = function(element) {};
  1316. Polymer.ResolveUrl = {};
  1317. /**
  1318. * @param {string} cssText Some CSS text taken from ownerDocument.
  1319. * @param {!Document} ownerDocument The source of the css.
  1320. * @return {string} The given CSS text with its URLs rewritten to be based on
  1321. * the primary document of this window rather than the given ownerDocument.
  1322. */
  1323. Polymer.ResolveUrl.resolveCss = function(cssText, ownerDocument) {}
  1324. /**
  1325. * @param {!Element} element An element whose URL attributes need to be renormed.
  1326. * @param {!Document} ownerDocument The document whose URL is the base of the
  1327. * element's current attributes.
  1328. */
  1329. Polymer.ResolveUrl.resolveAttrs = function(element, ownerDocument) {}
  1330. /**
  1331. * @param {string} url A url that needs to be renormed.
  1332. * @param {?string} baseURI The current base of URL for the URL.
  1333. * @return {string} The given url rewritten to be based on
  1334. * the primary document of this window rather than the given url.
  1335. */
  1336. Polymer.ResolveUrl.resolveUrl = function(url, baseURI) {}
  1337. /** @const */
  1338. Polymer.RenderStatus = {};
  1339. /**
  1340. * Makes callback when first render occurs or immediately if render has
  1341. * occurred.
  1342. * @param {!function()} cb Callback function to be invoked.
  1343. */
  1344. Polymer.RenderStatus.whenReady = function(cb) {}
  1345. /**
  1346. * Queue up function call on next render.
  1347. * @param {!Element} element The element on which the function call is made.
  1348. * @param {!function()} fn The function called on next render.
  1349. * @param {...*} args The function arguments.
  1350. */
  1351. Polymer.RenderStatus.afterNextRender = function(element, fn, args) {}
  1352. /**
  1353. * Static analysis for Polymer.
  1354. * @const
  1355. */
  1356. var hydrolysis = {};
  1357. /**
  1358. * A database of Polymer metadata defined in HTML
  1359. * @param {boolean} attachAST If true, attach a parse5 compliant AST
  1360. * @param {Object=} opt_loader An optional FileLoader used to load
  1361. * external resources
  1362. */
  1363. hydrolysis.Analyzer = function(attachAST, opt_loader) {};
  1364. /**
  1365. * Shorthand for transitively loading and processing all imports
  1366. * beginning at href.
  1367. * @param {string} href The root import to begin loading from.
  1368. * @param {Object=} opt_options Any additional options for the load.
  1369. */
  1370. hydrolysis.Analyzer.analyze = function(href, opt_options) {};
  1371. /**
  1372. * Contains information useful for debugging. Should not be used in production
  1373. * code and the API may change on short notice.
  1374. * @const
  1375. */
  1376. Polymer.telemetry = {};
  1377. /**
  1378. * Number of elements instantiated so far.
  1379. * @type {number}
  1380. */
  1381. Polymer.telemetry.instanceCount;
  1382. /**
  1383. * Array of all registered element prototypes. Being prototypes, not all runtime
  1384. * properties will be available, but eg. `is` is always there.
  1385. * @type {!Array<!PolymerElement>}
  1386. */
  1387. Polymer.telemetry.registrations;
  1388. /** @const */
  1389. Polymer.AppLayout = {};
  1390. /** @constructor */
  1391. Polymer.AppLayout.LocalDomWithBackground = function(){};
  1392. /** @type {!HTMLElement} */
  1393. Polymer.AppLayout.LocalDomWithBackground.prototype.backgroundFrontLayer;
  1394. /** @type {!HTMLElement} */
  1395. Polymer.AppLayout.LocalDomWithBackground.prototype.backgroundRearLayer;
  1396. /** @type {!HTMLElement} */
  1397. Polymer.AppLayout.LocalDomWithBackground.prototype.background;
  1398. /**
  1399. * @constructor
  1400. * @extends {PolymerElement}
  1401. */
  1402. Polymer.AppLayout.ElementWithBackground = function(){};
  1403. // TODO(ajo): Follow up with app-layout team and remove private api from this prototype
  1404. Polymer.AppLayout.ElementWithBackground.prototype = {
  1405. /** @type {!Polymer.AppLayout.LocalDomWithBackground} */
  1406. $: null,
  1407. /** @return {boolean} True if there's content below the current element */
  1408. isContentBelow: function(){},
  1409. /** Updates the elements scroll state */
  1410. _updateScrollState: function(){},
  1411. /** @return {boolean} true if the element is on screen */
  1412. isOnScreen: function(){},
  1413. /** @type {number} Internal bookkeeping to track screen position */
  1414. _deltaHeight: 0,
  1415. /** @return {?Element} Element in local dom by id. */
  1416. _getDOMRef: function(title){}
  1417. }
  1418. /** @const */
  1419. Polymer.ArraySplice = {};
  1420. /**
  1421. * Returns an array of splice records indicating the minimum edits required
  1422. * to transform the `previous` array into the `current` array.
  1423. *
  1424. * Splice records are ordered by index and contain the following fields:
  1425. * - `index`: index where edit started
  1426. * - `removed`: array of removed items from this index
  1427. * - `addedCount`: number of items added at this index
  1428. *
  1429. * This function is based on the Levenshtein "minimum edit distance"
  1430. * algorithm. Note that updates are treated as removal followed by addition.
  1431. *
  1432. * The worst-case time complexity of this algorithm is `O(l * p)`
  1433. * l: The length of the current array
  1434. * p: The length of the previous array
  1435. *
  1436. * However, the worst-case complexity is reduced by an `O(n)` optimization
  1437. * to detect any shared prefix & suffix between the two arrays and only
  1438. * perform the more expensive minimum edit distance calculation over the
  1439. * non-shared portions of the arrays.
  1440. *
  1441. * @param {!Array} current The "changed" array for which splices will be
  1442. * calculated.
  1443. * @param {!Array} previous The "unchanged" original array to compare
  1444. * `current` against to determine the splices.
  1445. * @return {!Array} Returns an array of splice record objects. Each of these
  1446. * contains: `index` the location where the splice occurred; `removed`
  1447. * the array of removed items from this location; `addedCount` the number
  1448. * of items added at this location.
  1449. */
  1450. Polymer.ArraySplice.calculateSplices = function(current, previous) {};
  1451. /**
  1452. * @constructor @extends {PolymerElement}
  1453. */
  1454. Polymer.DomModule = function() {};
  1455. /**
  1456. * Retrieves the dom specified by `selector` in the module specified by
  1457. * `id`. For example, this.import('foo', 'img');
  1458. * @param {string} id
  1459. * @param {string=} opt_selector
  1460. * @return {?HTMLElement} Returns the dom which matches `selector` in the module
  1461. * at the specified `id`.
  1462. */
  1463. Polymer.DomModule.import = function(id, opt_selector) {};
  1464. /** @const */
  1465. Polymer.Path = {
  1466. /**
  1467. * @param {string=} base
  1468. * @param {string=} newBase
  1469. * @param {string=} path
  1470. * @return {string}
  1471. */
  1472. translate: function(base, newBase, path) {},
  1473. /**
  1474. * @param {string=} base
  1475. * @param {string=} wildcard
  1476. * @param {string=} path
  1477. * @return {boolean}
  1478. */
  1479. matches: function(base, wildcard, path) {}
  1480. };
  1481. /**
  1482. * For compatibility with both Polymer 1.0 and 2.0, code may check for certain
  1483. * objects and properties which don't exist in Polymer 1.0.
  1484. *
  1485. * We give those objects and properties the `undefined` type here, because
  1486. * the dependency tree will either contain these externs and Polymer 1.0 or
  1487. * it will contain Polymer 2.0 which defines the full types.
  1488. */
  1489. /** @type {undefined} */
  1490. var ShadyDOM;
  1491. Polymer.flush;
  1492. Polymer.enqueueDebouncer;
  1493. Polymer.Async.animationFrame;
  1494. Polymer.Async.idlePeriod;
  1495. Polymer.Async.microTask;
  1496. Polymer.Debouncer.debounce;
  1497. Polymer.Templatizer.mutableData;
  1498. Polymer.Templatizer.parentModel;
  1499. Polymer.Templatizer.forwardHostProp;
  1500. Polymer.Templatizer.notifyInstanceProp;
  1501. Polymer.Templatizer._setPendingPropertyOrPath;
  1502. Polymer.Templatizer._setPendingProperty;
  1503. Polymer.Templatizer._instanceProps;
  1504. /**
  1505. * @param {number} index
  1506. * @return {boolean}
  1507. */
  1508. ArraySelectorElement.prototype.isIndexSelected = function(index) {};