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 * Returns the first node in this element’s local DOM that matches selector. | |
45 * @param {string} selector | |
46 */ | |
47 PolymerElement.prototype.$$ = function(selector) {}; | |
48 | |
49 /** @type {string} The Custom element tag name. */ | |
50 PolymerElement.prototype.is; | |
51 | |
52 /** @type {string} The native element this element extends. */ | |
53 PolymerElement.prototype.extends; | |
54 | |
55 /** | |
56 * An array of objects whose properties get mixed in to this element. | |
57 * | |
58 * @type {!Array<!Object>|undefined} | |
59 */ | |
60 PolymerElement.prototype.mixins; | |
61 | |
62 /** | |
63 * A string-separated list of dependent properties that should result in a | |
64 * change function being called. These observers differ from single-property | |
65 * observers in that the change handler is called asynchronously. | |
66 * | |
67 * @type {!Object<string, string>|undefined} | |
68 */ | |
69 PolymerElement.prototype.observers; | |
70 | |
71 /** On create callback. */ | |
72 PolymerElement.prototype.created = function() {}; | |
73 /** On ready callback. */ | |
74 PolymerElement.prototype.ready = function() {}; | |
75 /** On attached to the DOM callback. */ | |
76 PolymerElement.prototype.attached = function() {}; | |
77 /** On detached from the DOM callback. */ | |
78 PolymerElement.prototype.detached = function() {}; | |
79 | |
80 /** | |
81 * Callback fired when an attribute on the element has been changed. | |
82 * | |
83 * @param {string} name The name of the attribute that changed. | |
84 */ | |
85 PolymerElement.prototype.attributeChanged = function(name) {}; | |
86 | |
87 /** @typedef {!{ | |
88 * type: !Function, | |
89 * reflectToAttribute: (boolean|undefined), | |
90 * readOnly: (boolean|undefined), | |
91 * notify: (boolean|undefined), | |
92 * value: *, | |
93 * computed: (string|undefined), | |
94 * observer: (string|undefined) | |
95 * }} */ | |
96 PolymerElement.PropertyConfig; | |
97 | |
98 /** @typedef {!Object<string, (!Function|!PolymerElement.PropertyConfig)>} */ | |
99 PolymerElement.Properties; | |
100 | |
101 /** @type {!PolymerElement.Properties} */ | |
102 PolymerElement.prototype.properties; | |
103 | |
104 /** @type {!Object<string, *>} */ | |
105 PolymerElement.prototype.hostAttributes; | |
106 | |
107 /** | |
108 * An object that maps events to event handler function names. | |
109 * @type {!Object<string, string>} | |
110 */ | |
111 PolymerElement.prototype.listeners; | |
112 | |
113 /** | |
114 * Notifies the event binding system of a change to a property. | |
115 * @param {string} path The path to set. | |
116 * @param {*} value The value to send in the update notification. | |
117 */ | |
118 PolymerElement.prototype.notifyPath = function(path, value) {}; | |
119 | |
120 /** | |
121 * Shorthand for setting a property, then calling notifyPath. | |
122 * @param {string} path The path to set. | |
123 * @param {*} value The new value. | |
124 */ | |
125 PolymerElement.prototype.setPathValue = function(path, value) {}; | |
126 | |
127 /** | |
128 * Fire an event. | |
129 * | |
130 * @param {string} type An event name. | |
131 * @param {Object=} detail | |
132 * @param {{ | |
133 * bubbles: (boolean|undefined), | |
134 * cancelable: (boolean|undefined), | |
135 * node: (!HTMLElement|undefined)}=} options | |
136 * @return {Object} event | |
137 */ | |
138 PolymerElement.prototype.fire = function(type, detail, options) {}; | |
139 | |
140 /** | |
141 * Toggles the named boolean class on the host element, adding the class if | |
142 * bool is truthy and removing it if bool is falsey. If node is specified, sets | |
143 * the class on node instead of the host element. | |
144 * @param {string} name | |
145 * @param {boolean} bool | |
146 * @param {HTMLElement=} node | |
147 */ | |
148 PolymerElement.prototype.toggleClass = function(name, bool, node) {}; | |
149 | |
150 /** | |
151 * Toggles the named boolean attribute on the host element, adding the attribute | |
152 * if bool is truthy and removing it if bool is falsey. If node is specified, | |
153 * sets the attribute on node instead of the host element. | |
154 * @param {string} name | |
155 * @param {boolean} bool | |
156 * @param {HTMLElement=} node | |
157 */ | |
158 PolymerElement.prototype.toggleAttribute = function(name, bool, node) {}; | |
159 | |
160 /** | |
161 * Moves a boolean attribute from oldNode to newNode, unsetting the attribute | |
162 * (if set) on oldNode and setting it on newNode. | |
163 * @param {string} name | |
164 * @param {!HTMLElement} newNode | |
165 * @param {!HTMLElement} oldNode | |
166 */ | |
167 PolymerElement.prototype.attributeFollows = function(name, newNode, oldNode) {}; | |
168 | |
169 /** | |
170 * @param {!Function} method | |
171 * @param {number=} wait | |
172 * @return {number} A handle which can be used to cancel the job. | |
173 */ | |
174 PolymerElement.prototype.async = function(method, wait) {}; | |
175 | |
176 /** | |
177 * @param {number} handle | |
178 */ | |
179 PolymerElement.prototype.cancelAsync = function(handle) {}; | |
180 | |
181 /** | |
182 * 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 | |
184 * request. If no wait time is given, the callback is called at microtask timing | |
185 * (guaranteed to be before paint). | |
186 * @param {string} jobName | |
187 * @param {!Function} callback | |
188 * @param {number=} wait | |
189 */ | |
190 PolymerElement.prototype.debounce = function(jobName, callback, wait) {}; | |
191 | |
192 /** | |
193 * Cancels an active debouncer without calling the callback. | |
194 * @param {string} jobName | |
195 */ | |
196 PolymerElement.prototype.cancelDebouncer = function(jobName) {}; | |
197 | |
198 /** | |
199 * Calls the debounced callback immediately and cancels the debouncer. | |
200 * @param {string} jobName | |
201 */ | |
202 PolymerElement.prototype.flushDebouncer = function(jobName) {}; | |
203 | |
204 /** | |
205 * @param {string} jobName | |
206 * @return {boolean} True if the named debounce task is waiting to run. | |
207 */ | |
208 PolymerElement.prototype.isDebouncerActive = function(jobName) {}; | |
209 | |
210 | |
211 /** | |
212 * Applies a CSS transform to the specified node, or this element if no node is | |
213 * specified. transform is specified as a string. | |
214 * @param {string} transform | |
215 * @param {HTMLElement=} node | |
216 */ | |
217 PolymerElement.prototype.transform = function(transform, node) {}; | |
218 | |
219 /** | |
220 * Transforms the specified node, or this element if no node is specified. | |
221 * @param {string} x | |
222 * @param {string} y | |
223 * @param {string} z | |
224 * @param {HTMLElement=} node | |
225 */ | |
226 PolymerElement.prototype.translate3d = function(x, y, z, node) {}; | |
227 | |
228 /** | |
229 * Dynamically imports an HTML document. | |
230 * @param {string} href | |
231 * @param {Function=} onload | |
232 * @param {Function=} onerror | |
233 */ | |
234 PolymerElement.prototype.importHref = function(href, onload, onerror) {}; | |
235 | |
236 /** | |
237 * Delete an element from an array. | |
238 * @param {!Array} array | |
239 * @param {*} item | |
240 */ | |
241 PolymerElement.prototype.arrayDelete = function(array, item) {}; | |
242 | |
243 /** | |
244 * Resolve a url to make it relative to the current doc. | |
245 * @param {string} url | |
246 * @return {string} | |
247 */ | |
248 PolymerElement.prototype.resolveUrl = function(url) {}; | |
249 | |
250 | |
251 /** | |
252 * A Polymer DOM API for manipulating DOM such that local DOM and light DOM | |
253 * trees are properly maintained. | |
254 * | |
255 * @constructor | |
256 */ | |
257 var PolymerDomApi = function() {}; | |
258 | |
259 /** @param {!Node} node */ | |
260 PolymerDomApi.prototype.appendChild = function(node) {}; | |
261 | |
262 /** | |
263 * @param {!Node} node | |
264 * @param {!Node} beforeNode | |
265 */ | |
266 PolymerDomApi.prototype.insertBefore = function(node, beforeNode) {}; | |
267 | |
268 /** @param {!Node} node */ | |
269 PolymerDomApi.prototype.removeChild = function(node) {}; | |
270 | |
271 /** @type {!Array<!Node>} */ | |
272 PolymerDomApi.prototype.childNodes; | |
273 | |
274 /** @type {?Node} */ | |
275 PolymerDomApi.prototype.parentNode; | |
276 | |
277 /** @type {?Node} */ | |
278 PolymerDomApi.prototype.firstChild; | |
279 | |
280 /** @type {?Node} */ | |
281 PolymerDomApi.prototype.lastChild; | |
282 | |
283 /** @type {?HTMLElement} */ | |
284 PolymerDomApi.prototype.firstElementChild; | |
285 | |
286 /** @type {?HTMLElement} */ | |
287 PolymerDomApi.prototype.lastElementChild; | |
288 | |
289 /** @type {?Node} */ | |
290 PolymerDomApi.prototype.previousSibling; | |
291 | |
292 /** @type {?Node} */ | |
293 PolymerDomApi.prototype.nextSibling; | |
294 | |
295 /** @type {string} */ | |
296 PolymerDomApi.prototype.textContent; | |
297 | |
298 /** @type {string} */ | |
299 PolymerDomApi.prototype.innerHTML; | |
300 | |
301 /** | |
302 * @param {string} selector | |
303 * @return {?HTMLElement} | |
304 */ | |
305 PolymerDomApi.prototype.querySelector = function(selector) {}; | |
306 | |
307 /** | |
308 * @param {string} selector | |
309 * @return {!Array<?HTMLElement>} | |
310 */ | |
311 PolymerDomApi.prototype.querySelectorAll = function(selector) {}; | |
312 | |
313 /** @return {!Array<!Node>} */ | |
314 PolymerDomApi.prototype.getDistributedNodes = function() {}; | |
315 | |
316 /** @return {!Array<!Node>} */ | |
317 PolymerDomApi.prototype.getDestinationInsertionPoints = function() {}; | |
318 | |
319 /** | |
320 * @param {string} attribute | |
321 * @param {string|number|boolean} value Values are converted to strings with | |
322 * ToString, so we accept number and boolean since both convert easily to | |
323 * strings. | |
324 */ | |
325 PolymerDomApi.prototype.setAttribute = function(attribute, value) {}; | |
326 | |
327 /** @param {string} attribute */ | |
328 PolymerDomApi.prototype.removeAttribute = function(attribute) {}; | |
329 | |
330 /** @type {?DOMTokenList} */ | |
331 PolymerDomApi.prototype.classList; | |
332 | |
333 /** | |
334 * Returns a Polymer-friendly API for manipulating DOM of a specified node. | |
335 * | |
336 * @param {?Node} node | |
337 * @return {!PolymerDomApi} | |
338 */ | |
339 Polymer.dom = function(node) {}; | |
340 | |
341 Polymer.dom.flush = function() {}; | |
342 | |
OLD | NEW |