diff --git a/polymer/polymer-tests.ts b/polymer/polymer-tests.ts index a606692fd..f594b4f22 100644 --- a/polymer/polymer-tests.ts +++ b/polymer/polymer-tests.ts @@ -10,6 +10,31 @@ class AbstractPolymerElement implements PolymerElement { asyncFire(eventName: string, details?: any, targetNode?: any, bubbles?: boolean, cancelable?: boolean): void { } cancelUnbindAll(): void { } + + /** + * User must call from attached callback + */ + resizableAttachedHandler(): void {} + + /** + * User must call from detached callback + */ + resizableDetachedHandler(): void {} + + /** + * User must call from attached callback + */ + resizerAttachedHandler(): void {} + + /** + * User must call from detached callback + */ + resizerDetachedHandler(): void {} + + /** + * User should call when resizing or un-hiding children + */ + notifyResize(): void {} } class AbstractWebComponent extends AbstractPolymerElement { diff --git a/polymer/polymer.app-router.d.ts b/polymer/polymer.app-router.d.ts index 633479ba2..adf2f8d3b 100644 --- a/polymer/polymer.app-router.d.ts +++ b/polymer/polymer.app-router.d.ts @@ -3,9 +3,11 @@ // Definitions by: Louis Grignon // Definitions: https://github.com/borisyankov/DefinitelyTyped +/// + declare module PolymerComponents { module App { - export interface Router extends HTMLElement { + export interface Router extends PolymerElement, HTMLElement { init(): void; go(path: string, options?: { replace?: boolean }): void; } diff --git a/polymer/polymer.core-drawer-panel.d.ts b/polymer/polymer.core-drawer-panel.d.ts index 2bad7b633..f219b4d0b 100644 --- a/polymer/polymer.core-drawer-panel.d.ts +++ b/polymer/polymer.core-drawer-panel.d.ts @@ -3,9 +3,11 @@ // Definitions by: Louis Grignon // Definitions: https://github.com/borisyankov/DefinitelyTyped +/// + declare module PolymerComponents { export module Core { - export interface DrawerPanel extends HTMLElement { + export interface DrawerPanel extends PolymerElement, HTMLElement { /** * Width of the drawer panel. default: '256px' */ diff --git a/polymer/polymer.core-overlay.d.ts b/polymer/polymer.core-overlay.d.ts new file mode 100644 index 000000000..706dee899 --- /dev/null +++ b/polymer/polymer.core-overlay.d.ts @@ -0,0 +1,92 @@ +// Type definitions for polymer's paper-toast +// Project: https://github.com/Polymer/core-selector +// Definitions by: Louis Grignon +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// + +declare module PolymerComponents { + export module Core { + export interface Overlay extends PolymerElement, HTMLElement { + /** + * The target element that will be shown when the overlay is opened. If unspecified, the core-overlay itself is the target. + * default: the overlay element + */ + target: Object; + + /** + * A core-overlay's size is guaranteed to be constrained to the window size. To achieve this, the sizingElement is sized with a max-height/width. By default this element is the target element, but it can be specifically set to a specific element inside the target if that is more appropriate. This is useful, for example, when a region inside the overlay should scroll if needed. + * default: the target element + */ + sizingTarget: Object; + + /** + * Set opened to true to show an overlay and to false to hide it. A core-overlay may be made initially opened by setting its opened attribute. + * default: false + */ + opened: boolean; + + /** + * If true, the overlay has a backdrop darkening the rest of the screen. The backdrop element is attached to the document body and may be styled with the class core-overlay-backdrop. When opened the core-opened class is applied. + * default: false + */ + backdrop: boolean; + + /** + * If true, the overlay is guaranteed to display above page content. + * default: false + */ + layered: boolean; + + /** + * By default an overlay will close automatically if the user taps outside it or presses the escape key. Disable this behavior by setting the autoCloseDisabled property to true. + * default: false + */ + autoCloseDisabled: boolean; + + /** + * By default an overlay will focus its target or an element inside it with the autoFocus attribute. Disable this behavior by setting the autoFocusDisabled property to true. + * default: false + */ + autoFocusDisabled: boolean; + + /** + * This property specifies an attribute on elements that should close the overlay on tap. Should not set closeSelector if this is set. + * default: "core-overlay-toggle" + */ + closeAttribute: string; + + /** + * This property specifies a selector matching elements that should close the overlay on tap. Should not set closeAttribute if this is set. + * default: '' + */ + closeSelector: string; + + /** + * The transition property specifies a string which identifies a core-transition element that will be used to help the overlay open and close. The default core-transition-fade will cause the overlay to fade in and out. + * default: 'core-transition-fade' + */ + transition: string; + + /** + * Toggle the opened state of the overlay. + */ + toggle(): void; + + /** + * Open the overlay. This is equivalent to setting the opened property to true. + */ + open(): void; + + /** + * Close the overlay. This is equivalent to setting the opened property to false. + */ + close(): void; + + /** + * Extensions of core-overlay should implement the resizeHandler method to adjust the size and position of the overlay when the browser window resizes. + */ + resizeHandler(): void; + } + } +} \ No newline at end of file diff --git a/polymer/polymer.core-selector.d.ts b/polymer/polymer.core-selector.d.ts new file mode 100644 index 000000000..c7941cdde --- /dev/null +++ b/polymer/polymer.core-selector.d.ts @@ -0,0 +1,20 @@ +// Type definitions for polymer's paper-toast +// Project: https://github.com/Polymer/core-selector +// Definitions by: Louis Grignon +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// + +declare module PolymerComponents { + export module Core { + export interface Selector extends PolymerElement, HTMLElement { + } + + export interface SelectorOnSelectEvent extends Event { + detail: { + item: HTMLElement; + isSelected: boolean; + }; + } + } +} \ No newline at end of file diff --git a/polymer/polymer.d.ts b/polymer/polymer.d.ts index dfb812f8c..ed084a448 100644 --- a/polymer/polymer.d.ts +++ b/polymer/polymer.d.ts @@ -18,6 +18,31 @@ interface PolymerElement { domReady? (): void; detached? (): void; attributeChanged? (attrName: string, oldVal: any, newVal: any): void; + + /** + * User must call from attached callback + */ + resizableAttachedHandler(): void; + + /** + * User must call from detached callback + */ + resizableDetachedHandler(): void; + + /** + * User must call from attached callback + */ + resizerAttachedHandler(): void; + + /** + * User must call from detached callback + */ + resizerDetachedHandler(): void; + + /** + * User should call when resizing or un-hiding children + */ + notifyResize(): void; } interface Polymer { @@ -34,9 +59,6 @@ interface Polymer { (tagName: string, prototype: any): void; (prototype: PolymerElement): void; (): void; - // hacks for mixins - CoreResizer: any; - CoreResizable: any; } declare var Polymer: Polymer; diff --git a/polymer/polymer.paper-dialog.d.ts b/polymer/polymer.paper-dialog.d.ts new file mode 100644 index 000000000..51758e42c --- /dev/null +++ b/polymer/polymer.paper-dialog.d.ts @@ -0,0 +1,30 @@ +// Type definitions for polymer's paper-dialog +// Project: https://github.com/Polymer/paper-dialog +// Definitions by: Louis Grignon +// Definitions: https://github.com/borisyankov/DefinitelyTyped + +/// +/// + +declare module PolymerComponents { + export module Paper { + export interface Dialog extends PolymerComponents.Core.Overlay, HTMLElement { + /** + * The title of the dialog. + * default: '' + */ + heading: string; + + /** + * See paper-dialog-transition + * default: '' + */ + transition: string; + + /** + * default: true + */ + layered: boolean; + } + } +} \ No newline at end of file diff --git a/polymer/polymer.paper-toast.d.ts b/polymer/polymer.paper-toast.d.ts index fbf8cd7a6..6e29c1c8b 100644 --- a/polymer/polymer.paper-toast.d.ts +++ b/polymer/polymer.paper-toast.d.ts @@ -3,9 +3,11 @@ // Definitions by: Louis Grignon // Definitions: https://github.com/borisyankov/DefinitelyTyped +/// + declare module PolymerComponents { export module Paper { - export interface Toast extends HTMLElement { + export interface Toast extends PolymerElement, HTMLElement { /** * The text shows in a toast. * default: ''