From e4ff04e164e36ee9a9de52268be208f4a162c36e Mon Sep 17 00:00:00 2001 From: lgrignon Date: Mon, 14 Sep 2015 10:56:09 +0200 Subject: [PATCH] added polymer ts definition --- polymer-ts/polymer-ts.d.ts | 127 +++++++++++++++++++++++++++++++++++++ 1 file changed, 127 insertions(+) create mode 100644 polymer-ts/polymer-ts.d.ts diff --git a/polymer-ts/polymer-ts.d.ts b/polymer-ts/polymer-ts.d.ts new file mode 100644 index 0000000000..4f44de6d28 --- /dev/null +++ b/polymer-ts/polymer-ts.d.ts @@ -0,0 +1,127 @@ +declare module polymer { + class PolymerBase extends HTMLElement { + $: any; + $$: any; + root: HTMLElement; + shadyRoot: HTMLElement; + style: CSSStyleDeclaration; + customStyle: { + [property: string]: string; + }; + arrayDelete(path: string, item: string | any): any; + async(callback: Function, waitTime?: number): any; + attachedCallback(): void; + attributeFollows(name: string, toElement: HTMLElement, fromElement: HTMLElement): void; + cancelAsync(handle: number): void; + cancelDebouncer(jobName: string): void; + classFollows(name: string, toElement: HTMLElement, fromElement: HTMLElement): void; + create(tag: string, props: Object): any; + debounce(jobName: string, callback: Function, wait?: number): void; + deserialize(value: string, type: any): any; + distributeContent(): void; + domHost(): void; + elementMatches(selector: string, node: Element): any; + fire(type: string, detail?: Object, options?: FireOptions): any; + flushDebouncer(jobName: string): void; + get(path: string | Array): any; + getContentChildNodes(slctr: string): any; + getContentChildren(slctr: string): any; + getNativePrototype(tag: string): any; + getPropertyInfo(property: string): any; + importHref(href: string, onload?: Function, onerror?: Function): any; + instanceTemplate(template: any): any; + isDebouncerActive(jobName: string): any; + linkPaths(to: string, from: string): void; + listen(node: Element, eventName: string, methodName: string): void; + mixin(target: Object, source: Object): void; + notifyPath(path: string, value: any, fromAbove?: any): void; + pop(path: string): any; + push(path: string, value: any): any; + reflectPropertyToAttribute(name: string): void; + resolveUrl(url: string): any; + scopeSubtree(container: Element, shouldObserve: boolean): void; + serialize(value: string): any; + serializeValueToAttribute(value: any, attribute: string, node: Element): void; + set(path: string, value: any, root?: Object): any; + setScrollDirection(direction: string, node: HTMLElement): void; + shift(path: string, value: any): any; + splice(path: string, start: number, deleteCount: number): any; + toggleAttribute(name: string, bool: boolean, node?: HTMLElement): void; + toggleClass(name: string, bool: boolean, node?: HTMLElement): void; + transform(transform: string, node?: HTMLElement): void; + translate3d(x: any, y: any, z: any, node?: HTMLElement): void; + unlinkPaths(path: string): void; + unshift(path: string, value: any): any; + updateStyles(): void; + } + interface dom { + (node: HTMLElement): HTMLElement; + (node: polymer.Base): HTMLElement; + flush(): any; + } + interface FireOptions { + node?: HTMLElement | polymer.Base; + bubbles?: boolean; + cancelable?: boolean; + } + interface Element { + properties?: Object; + listeners?: Object; + behaviors?: Object[]; + observers?: String[]; + factoryImpl?(...args: any[]): void; + ready?(): void; + created?(): void; + attached?(): void; + detached?(): void; + attributeChanged?(attrName: string, oldVal: any, newVal: any): void; + prototype?: Object; + } + interface PolymerTSElement { + $custom_cons?: FunctionConstructor; + $custom_cons_args?: any[]; + template?: string; + style?: string; + } + interface Property { + name?: string; + type?: any; + value?: any; + reflectToAttribute?: boolean; + readonly?: boolean; + notify?: boolean; + computed?: string; + observer?: string; + } + class Base extends polymer.PolymerBase implements polymer.Element { + static create(...args: any[]): T; + static register(): void; + is: string; + } + function createEs6PolymerBase(): void; + function prepareForRegistration(elementClass: Function): polymer.Element; + function createDomModule(definition: polymer.Element): void; + function createElement(element: new (...args: any[]) => T): new (...args: any[]) => T; + function createClass(element: new (...args: any[]) => T): new (...args: any[]) => T; + function isRegistered(element: polymer.Element): boolean; +} +declare var Polymer: { + (prototype: polymer.Element): FunctionConstructor; + Class(prototype: polymer.Element): Function; + dom: polymer.dom; + appendChild(node: HTMLElement): HTMLElement; + insertBefore(node: HTMLElement, beforeNode: HTMLElement): HTMLElement; + removeChild(node: HTMLElement): HTMLElement; + updateStyles(): void; + Base: any; +}; +declare function component(tagname: string, extendsTag?: string): (target: Function) => void; +declare function extend(tagname: string): (target: Function) => void; +declare function template(templateString: string): (target: Function) => void; +declare function style(styleString: string): (target: Function) => void; +declare function hostAttributes(attributes: Object): (target: Function) => void; +declare function property(ob?: polymer.Property): (target: polymer.Element, propertyKey: string) => void; +declare function computed(ob?: polymer.Property): (target: polymer.Element, computedFuncName: string) => void; +declare function listen(eventName: string): (target: polymer.Element, propertyKey: string) => void; +declare function behavior(behaviorObject: any): any; +declare function observe(observedProps: string): (target: polymer.Element, observerFuncName: string) => void;