UNPKG

5.87 kBJavaScriptView Raw
1/**
2 * @fileoverview Internal shared types for Polymer
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 no-unused-vars, strict, valid-jsdoc */
15
16/**
17 * @constructor
18 * @extends {DocumentFragment}
19 */
20function StampedTemplate() { }
21/** @type {boolean} */
22StampedTemplate.prototype.__noInsertionPoint;
23/** @type {!Array<!Node>} */
24StampedTemplate.prototype.nodeList;
25/** @type {!Object<string, !Element>} */
26StampedTemplate.prototype.$;
27/** @type {!TemplateInfo | undefined} */
28StampedTemplate.prototype.templateInfo;
29
30/** @interface */
31function NodeInfo() { }
32/** @type {string} */
33NodeInfo.prototype.id;
34/** @type {!Array<{name: string, value: string}>}*/
35NodeInfo.prototype.events;
36/** @type {boolean} */
37NodeInfo.prototype.hasInsertionPoint;
38/** @type {!TemplateInfo} */
39NodeInfo.prototype.templateInfo;
40/** @type {!NodeInfo} */
41NodeInfo.prototype.parentInfo;
42/** @type {number} */
43NodeInfo.prototype.parentIndex;
44/** @type {number} */
45NodeInfo.prototype.infoIndex;
46/** @type {!Array<!Binding>} */
47NodeInfo.prototype.bindings;
48
49/** @interface */
50function TemplateInfo() { }
51/** @type {!Array<!NodeInfo>} */
52TemplateInfo.prototype.nodeInfoList;
53/** @type {!Array<!Node>} */
54TemplateInfo.prototype.nodeList;
55/** @type {boolean} */
56TemplateInfo.prototype.stripWhitespace;
57/** @type {boolean | undefined} */
58TemplateInfo.prototype.hasInsertionPoint;
59/** @type {!Object} */
60TemplateInfo.prototype.hostProps;
61/** @type {!Object} */
62TemplateInfo.prototype.propertyEffects;
63/** @type {TemplateInfo | undefined} */
64TemplateInfo.prototype.nextSibling;
65/** @type {TemplateInfo | undefined} */
66TemplateInfo.prototype.previousSibling;
67/** @type {TemplateInfo | undefined} */
68TemplateInfo.prototype.firstChild;
69/** @type {TemplateInfo | undefined} */
70TemplateInfo.prototype.parent;
71/** @type {!Array<!Node>} */
72TemplateInfo.prototype.childNodes;
73/** @type {boolean} */
74TemplateInfo.prototype.wasPreBound;
75
76/**
77 * type for HTMLTemplateElement with `_templateInfo`
78 *
79 * @constructor
80 * @extends {HTMLTemplateElement}
81 */
82function HTMLTemplateElementWithInfo() { }
83/** @type {TemplateInfo} */
84HTMLTemplateElementWithInfo.prototype._templateInfo;
85
86/**
87 * @typedef {{
88 * literal: string,
89 * compoundIndex: (number | undefined)
90 * }}
91 */
92let LiteralBindingPart;
93
94/**
95 * @typedef {{
96 * literal: boolean,
97 * name: string,
98 * value: (string | number),
99 * rootProperty: (string | undefined),
100 * structured: (boolean | undefined),
101 * wildcard: (boolean | undefined)
102 * }}
103 */
104let MethodArg;
105
106/**
107 * @typedef {{
108 * methodName: string,
109 * static: boolean,
110 * args: !Array<!MethodArg>,
111 * dynamicFn: (boolean | undefined),
112 * }}
113 */
114let MethodSignature;
115
116/**
117 * @typedef {{
118 * mode: string,
119 * negate: boolean,
120 * source: string,
121 * dependencies: !Array<(!MethodArg|string)>,
122 * customEvent: boolean,
123 * signature: Object,
124 * event: string
125 * }}
126 */
127let ExpressionBindingPart;
128
129/**
130 * @typedef {LiteralBindingPart | ExpressionBindingPart}
131 */
132let BindingPart;
133
134/**
135 * @typedef {{
136 * kind: string,
137 * target: string,
138 * parts: Array<!BindingPart>,
139 * literal: (string | undefined),
140 * isCompound: boolean,
141 * listenerEvent: (string | undefined),
142 * listenerNegate: (boolean | undefined)
143 * }}
144 */
145let Binding;
146
147/**
148 * @typedef {{
149 * path: string
150 * }}
151 */
152let PathInfo;
153
154/**
155 * @typedef {{
156 * forwardHostProp: (function(string, *) | undefined),
157 * instanceProps: (Object | undefined),
158 * mutableData: (boolean | undefined),
159 * notifyInstanceProp: (function(*, string, *) | undefined),
160 * parentModel: (boolean | undefined)
161 * }}
162 */
163let TemplatizeOptions;
164
165/** @record */
166function AsyncInterface(){}
167/** @type {function(!Function, number=): number} */
168AsyncInterface.prototype.run;
169/** @type {function(number): void} */
170AsyncInterface.prototype.cancel;
171
172/** @record */
173let GestureInfo = function(){};
174/** @type {string|undefined} */
175GestureInfo.prototype.state;
176/** @type {boolean|undefined} */
177GestureInfo.prototype.started;
178/** @type {!Array<?>|undefined} */
179GestureInfo.prototype.moves;
180/** @type {number|undefined} */
181GestureInfo.prototype.x;
182/** @type {number|undefined} */
183GestureInfo.prototype.y;
184/** @type {boolean|undefined} */
185GestureInfo.prototype.prevent;
186/** @type {function(?): void|undefined} */
187GestureInfo.prototype.addMove;
188/** @type {null|undefined} */
189GestureInfo.prototype.movefn;
190/** @type {null|undefined} */
191GestureInfo.prototype.upFn;
192
193/** @record */
194let GestureRecognizer = function(){};
195/** @type {string} */
196GestureRecognizer.prototype.name;
197/** @type {!Array<string>} */
198GestureRecognizer.prototype.deps;
199/** @type {function(): void} */
200GestureRecognizer.prototype.reset;
201/** @type {function(MouseEvent): void | undefined} */
202GestureRecognizer.prototype.mousedown;
203/** @type {(function(MouseEvent): void | undefined)} */
204GestureRecognizer.prototype.mousemove;
205/** @type {(function(MouseEvent): void | undefined)} */
206GestureRecognizer.prototype.mouseup;
207/** @type {(function(TouchEvent): void | undefined)} */
208GestureRecognizer.prototype.touchstart;
209/** @type {(function(TouchEvent): void | undefined)} */
210GestureRecognizer.prototype.touchmove;
211/** @type {(function(TouchEvent): void | undefined)} */
212GestureRecognizer.prototype.touchend;
213/** @type {(function(MouseEvent): void | undefined)} */
214GestureRecognizer.prototype.click;
215/** @type {!GestureInfo} */
216GestureRecognizer.prototype.info;
217/** @type {!Array<string>} */
218GestureRecognizer.prototype.emits;