1/** 2 * This file contains the types that are required for compilation of the 3 * Polymer generated type declarations, but which could not themselves be 4 * automatically generated. 5 */ 6 7// Types from "externs/polymer-externs.js" 8 9interface PolymerElementPropertiesMeta { 10 type?: Function; 11 value?: any; 12 readOnly?: boolean; 13 computed?: string; 14 reflectToAttribute?: boolean; 15 notify?: boolean; 16 observer?: string|((val: any, old: any) => void); 17} 18 19type PolymerElementProperties = { 20 [key: string]: PolymerElementPropertiesMeta 21}; 22 23// TODO Document these properties. 24interface PolymerInit { 25 is: string; 26 extends?: string; 27 properties?: PolymerElementProperties; 28 observers?: string[]; 29 template?: HTMLTemplateElement|string; 30 hostAttributes?: {[key: string]: any}; 31 listeners?: {[key: string]: string}; 32} 33 34// Types from "externs/polymer-internal-shared-types.js" 35 36interface StampedTemplate extends DocumentFragment { 37 __noInsertionPoint: boolean; 38 nodeList: Node[]; 39 $: {[key: string]: Node}; 40 templateInfo?: TemplateInfo; 41} 42 43interface NodeInfo { 44 id: string; 45 events: {name: string, value: string}[]; 46 hasInsertionPoint: boolean; 47 templateInfo: TemplateInfo; 48 parentInfo: NodeInfo; 49 parentIndex: number; 50 infoIndex: number; 51 bindings: Binding[]; 52} 53 54interface TemplateInfo { 55 nodeInfoList: NodeInfo[]; 56 nodeList: Node[]; 57 stripWhitespace: boolean; 58 hasInsertionPoint?: boolean; 59 hostProps: Object; 60 propertyEffects: Object; 61 nextTemplateInfo?: TemplateInfo; 62 previousTemplateInfo?: TemplateInfo; 63 childNodes: Node[]; 64 wasPreBound: boolean; 65} 66 67interface LiteralBindingPart { 68 literal: string; 69 compoundIndex?: number; 70} 71 72interface MethodArg { 73 literal: boolean; 74 name: string; 75 value: string|number; 76 rootProperty?: string; 77 structured?: boolean; 78 wildcard?: boolean; 79} 80 81interface MethodSignature { 82 methodName: string; 83 static: boolean; 84 args: MethodArg[]; 85 dynamicFn?: boolean; 86} 87 88interface ExpressionBindingPart { 89 mode: string; 90 negate: boolean; 91 source: string; 92 dependencies: Array<MethodArg|string>; 93 customEvent: boolean; 94 signature: Object|null; 95 event: string; 96} 97 98type BindingPart = LiteralBindingPart|ExpressionBindingPart; 99 100interface Binding { 101 kind: string; 102 target: string; 103 parts: BindingPart[]; 104 literal?: string; 105 isCompound: boolean; 106 listenerEvent?: string; 107 listenerNegate?: boolean; 108} 109 110interface AsyncInterface { 111 run: (fn: Function, delay?: number) => number; 112 cancel: (handle: number) => void; 113} 114 115// Types from "lib/utils/gestures.html" 116 117interface GestureRecognizer { 118 reset: () => void; 119 mousedown?: (e: MouseEvent) => void; 120 mousemove?: (e: MouseEvent) => void; 121 mouseup?: (e: MouseEvent) => void; 122 touchstart?: (e: TouchEvent) => void; 123 touchmove?: (e: TouchEvent) => void; 124 touchend?: (e: TouchEvent) => void; 125 click?: (e: MouseEvent) => void; 126} 127 128/** 129 * Not defined in the TypeScript DOM library. 130 * See https://developer.mozilla.org/en-US/docs/Web/API/IdleDeadline 131 */ 132interface IdleDeadline { 133 didTimeout: boolean; 134 timeRemaining(): number; 135} 136 137/** 138 * Polymer defines its own `Element` class, shadowing the standard global 139 * `Element` class. This means that references to `Element` within the `Polymer` 140 * namespace inadvertently reference `Polymer.Element`. Here we define an alias 141 * of the global `Element`, so that we can reference it from declarations within 142 * the `Polymer` namespace. 143 * 144 * See https://github.com/Microsoft/TypeScript/issues/983 for general discussion 145 * of this shadowing problem in TypeScript. 146 */ 147type _Element = Element; 148