UNPKG

6.28 kBJavaScriptView Raw
1/**
2 * @fileoverview Externs for Polymer Pass and external Polymer API
3 * @externs
4 *
5 * @license
6 * Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
7 * This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
8 * The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
9 * The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
10 * Code distributed by Google as part of the polymer project is also
11 * subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
12 */
13
14/* eslint-disable */
15
16/**
17 * @typedef {{
18 * type: !Function,
19 * value: (* | undefined),
20 * readOnly: (boolean | undefined),
21 * computed: (string | undefined),
22 * reflectToAttribute: (boolean | undefined),
23 * notify: (boolean | undefined),
24 * observer: (string | function(this:?, ?, ?) | undefined)
25 * }}
26 */
27let PolymerElementPropertiesMeta;
28
29/**
30 * @typedef {Object<string, !Function|!PolymerElementPropertiesMeta>}
31 */
32let PolymerElementProperties;
33
34/** @record */
35let PolymerInit = function() {};
36/** @type {string} */
37PolymerInit.prototype.is;
38/** @type {(string | undefined)} */
39PolymerInit.prototype.extends;
40/** @type {(!PolymerElementProperties | undefined)} */
41PolymerInit.prototype.properties;
42/** @type {(!Array<string> | undefined)} */
43PolymerInit.prototype.observers;
44/** @type {(!HTMLTemplateElement | string | undefined | null)} */
45PolymerInit.prototype.template;
46/** @type {(!Object<string, *> | undefined)} */
47PolymerInit.prototype.hostAttributes;
48/** @type {(!Object<string, string> | undefined)} */
49PolymerInit.prototype.listeners;
50/** @type {(!Object| !Array<!Object> | undefined)} */
51PolymerInit.prototype.behaviors;
52
53/** @record */
54let PolymerElementConstructor = function () {};
55/** @type {(string | undefined)} */
56PolymerElementConstructor.is;
57/** @type {(string | undefined)} */
58PolymerElementConstructor.extends;
59/** @type {(!PolymerElementProperties | undefined)} */
60PolymerElementConstructor.properties;
61/** @type {(!Array<string> | undefined)} */
62PolymerElementConstructor.observers;
63/** @type {(!HTMLTemplateElement | string | undefined | null)} */
64PolymerElementConstructor.template;
65
66/** @interface */
67let PropertiesMixinConstructor = function () {};
68/** @type {(!PolymerElementProperties | undefined)} */
69PropertiesMixinConstructor.prototype.properties;
70/** @return {void} */
71PropertiesMixinConstructor.prototype.finalize = function() {};
72
73/**
74 * @param {!PolymerInit} init
75 * @return {!function(new:HTMLElement)}
76 */
77function Polymer(init){}
78
79/**
80 * @type {(function(*,string,string,Node):*)|undefined}
81 */
82Polymer.sanitizeDOMValue;
83
84/**
85 * @type {boolean}
86 */
87Polymer.passiveTouchGestures;
88
89/**
90 * @type {boolean}
91 */
92Polymer.strictTemplatePolicy;
93
94/**
95 * @type {boolean}
96 */
97Polymer.allowTemplateFromDomModule;
98
99/**
100 * @type {string}
101 */
102Polymer.rootPath;
103
104/**
105 * @param {string} string
106 * @param {Object} obj
107 * @return {string}
108 */
109function JSCompiler_renameProperty(string, obj) {}
110
111/** @record */
112function PolymerTelemetry() {}
113/** @type {number} */
114PolymerTelemetry.instanceCount;
115/** @type {function():void} */
116PolymerTelemetry.incrementInstanceCount;
117/** @type {Array<HTMLElement>} */
118PolymerTelemetry.registrations;
119/** @type {function(HTMLElement)} */
120PolymerTelemetry._regLog;
121/** @type {function(HTMLElement)} */
122PolymerTelemetry.register;
123/** @type {function(HTMLElement)} */
124PolymerTelemetry.dumpRegistrations;
125
126/** @type {PolymerTelemetry} */
127Polymer.telemetry;
128
129/** @type {string} */
130Polymer.version;
131
132/** @type {boolean} */
133Polymer.legacyOptimizations;
134
135/** @type {boolean} */
136Polymer.syncInitialRender;
137
138/** @type {boolean} */
139Polymer.legacyUndefined;
140
141/** @type {boolean} */
142Polymer.legacyWarnings;
143
144/** @type {boolean} */
145Polymer.orderedComputed;
146
147/** @type {boolean} */
148Polymer.fastDomIf;
149
150/** @type {boolean} */
151Polymer.removeNestedTemplates;
152
153/** @type {boolean} */
154Polymer.suppressTemplateNotifications;
155
156// nb. This is explicitly 'var', as Closure Compiler checks that this is the case.
157/**
158 * @constructor
159 * @extends {HTMLElement}
160 * @implements {Polymer_LegacyElementMixin}
161 */
162var PolymerElement = function() {};
163
164/**
165 * The tag name of the cutom element type.
166 * @type {string|undefined}
167 */
168PolymerElement.is;
169/**
170 * The template to stamp when creating this element type.
171 * @type {!HTMLTemplateElement|undefined|null}
172 */
173PolymerElement.template;
174/**
175 * The properties of the cutom element type.
176 * @type {!PolymerElementProperties|undefined}
177 */
178PolymerElement.properties;
179/**
180 * The observers of this custom element type.
181 * @type {!Array<string>|undefined}
182 */
183PolymerElement.observers;
184/** @type {!PolymerInit|undefined} */
185PolymerElement.generatedFrom;
186
187/**
188 * On create callback.
189 * @override
190 */
191PolymerElement.prototype.created = function() {};
192/**
193 * On ready callback.
194 * @override
195 */
196PolymerElement.prototype.ready = function() {};
197/** On before register callback. */
198PolymerElement.prototype.beforeRegister = function() {};
199/** On registered callback. */
200PolymerElement.prototype.registered = function() {};
201/**
202 * On attached to the DOM callback.
203 * @override
204 */
205PolymerElement.prototype.attached = function() {};
206/**
207 * On detached from the DOM callback.
208 * @override
209 */
210PolymerElement.prototype.detached = function() {};
211
212/**
213 * @typedef {{
214 * index: number,
215 * removed: !Array,
216 * addedCount: number,
217 * object: !Array,
218 * type: string,
219 * }}
220 */
221var PolymerSplice;
222/**
223 * @typedef {{
224 * indexSplices: ?Array<!PolymerSplice>,
225 * }}
226 */
227var PolymerSpliceChange;
228
229/**
230 * The type of the object received by an observer function when deep
231 * sub-property observation is enabled. See:
232 * https://www.polymer-project.org/2.0/docs/devguide/observers#deep-observation
233 *
234 * @typedef {{
235 * path: string,
236 * value: (?Object|undefined),
237 * base: (?Object|undefined)
238 * }}
239 */
240var PolymerDeepPropertyChange;
241
242/**
243 * Event object for events dispatched by children of a dom-repeat template.
244 * @see https://www.polymer-project.org/2.0/docs/devguide/templates#handling-events
245 * @extends {Event}
246 * @constructor
247 * @template T
248 */
249var DomRepeatEvent = function() {};
250
251/**
252 * @type {{
253 * index: number,
254 * item: T
255 * }}
256 */
257DomRepeatEvent.prototype.model;