mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-07-04 01:00:05 +00:00
Merge branch 'master' of github.com:czechboy0/DefinitelyTyped
This commit is contained in:
13
auth0.lock/auth0.lock-tests.ts
Normal file
13
auth0.lock/auth0.lock-tests.ts
Normal file
@@ -0,0 +1,13 @@
|
||||
/// <reference path="../auth0/auth0.d.ts" />
|
||||
/// <reference path="auth0.lock.d.ts" />
|
||||
|
||||
var lock: Auth0LockStatic = new Auth0Lock("dsa7d77dsa7d7", "mine.auth0.com");
|
||||
|
||||
lock.showSignin({
|
||||
connections: ["facebook", "google-oauth2", "twitter", "Username-Password-Authentication"],
|
||||
icon: "https://contoso.com/logo-32.png",
|
||||
socialBigButtons: true
|
||||
},
|
||||
() => {
|
||||
// The Auth0 Widget is now loaded.
|
||||
});
|
||||
80
auth0.lock/auth0.lock.d.ts
vendored
Normal file
80
auth0.lock/auth0.lock.d.ts
vendored
Normal file
@@ -0,0 +1,80 @@
|
||||
// Type definitions for Auth0Widget.js
|
||||
// Project: http://auth0.com
|
||||
// Definitions by: Robert McLaws <https://github.com/advancedrei>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/// <reference path="../auth0/auth0.d.ts" />
|
||||
|
||||
interface Auth0LockPopupOptions {
|
||||
width: number;
|
||||
height: number;
|
||||
left: number;
|
||||
top: number;
|
||||
}
|
||||
|
||||
interface Auth0LockOptions {
|
||||
authParams?: any;
|
||||
callbackURL?: string;
|
||||
connections?: string[];
|
||||
container?: string;
|
||||
closable?: boolean;
|
||||
dict?: any;
|
||||
defaultUserPasswordConnection?: string;
|
||||
defaultADUsernameFromEmailPrefix?: boolean;
|
||||
disableResetAction?: boolean;
|
||||
disableSignupAction?: boolean;
|
||||
focusInput?: boolean;
|
||||
forceJSONP?: boolean;
|
||||
gravatar?: boolean;
|
||||
integratedWindowsLogin?: boolean;
|
||||
loginAfterSignup?: boolean;
|
||||
popup?: boolean;
|
||||
popupOptions?: Auth0LockPopupOptions;
|
||||
rememberLastLogin?: boolean;
|
||||
resetLink?: string;
|
||||
responseType?: string;
|
||||
signupLink?: string;
|
||||
socialBigButtons?: boolean;
|
||||
sso?: boolean;
|
||||
theme?: string;
|
||||
usernameStyle?: any;
|
||||
}
|
||||
|
||||
interface Auth0LockConstructorOptions {
|
||||
cdn?: string;
|
||||
assetsUrl?: string;
|
||||
useCordovaSocialPlugins?: boolean;
|
||||
}
|
||||
|
||||
interface Auth0LockStatic {
|
||||
new (clientId: string, domain: string, options?: Auth0LockConstructorOptions): Auth0LockStatic;
|
||||
|
||||
show(): void;
|
||||
show(options: Auth0LockOptions): void;
|
||||
show(callback: (error?: Auth0Error, profile?: Auth0UserProfile, token?: string) => void) : void;
|
||||
show(options: Auth0LockOptions, callback: (error?: Auth0Error, profile?: Auth0UserProfile, token?: string) => void) : void;
|
||||
|
||||
showSignin(): void;
|
||||
showSignin(options: Auth0LockOptions): void;
|
||||
showSignin(callback: (error?: Auth0Error, profile?: Auth0UserProfile, token?: string) => void) : void;
|
||||
showSignin(options: Auth0LockOptions, callback: (error?: Auth0Error, profile?: Auth0UserProfile, token?: string) => void) : void;
|
||||
|
||||
showSignup(): void;
|
||||
showSignup(options: Auth0LockOptions): void;
|
||||
showSignup(callback: (error?: Auth0Error) => void) : void;
|
||||
showSignup(options: Auth0LockOptions, callback: (error?: Auth0Error) => void) : void;
|
||||
|
||||
showReset(): void;
|
||||
showReset(options: Auth0LockOptions): void;
|
||||
showReset(callback: (error?: Auth0Error) => void) : void;
|
||||
showReset(options: Auth0LockOptions, callback: (error?: Auth0Error) => void) : void;
|
||||
|
||||
hide(callback: () => void): void;
|
||||
logout(callback: () => void): void;
|
||||
}
|
||||
|
||||
declare var Auth0Lock: Auth0LockStatic;
|
||||
|
||||
declare module "Auth0Lock" {
|
||||
export = Auth0Lock;
|
||||
}
|
||||
6
cordova-ionic/cordova-ionic.d.ts
vendored
6
cordova-ionic/cordova-ionic.d.ts
vendored
@@ -5,10 +5,6 @@
|
||||
|
||||
/// <reference path="./plugins/keyboard.d.ts" />
|
||||
|
||||
interface Cordova {
|
||||
plugins:Plugins;
|
||||
}
|
||||
|
||||
interface Plugins {
|
||||
interface CordovaPlugins {
|
||||
Keyboard:Ionic.Keyboard;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
/// <reference path="../cordova/cordova.d.ts" />
|
||||
/// <reference path="./cordova-plugin-email-composer.d.ts" />
|
||||
|
||||
cordova.plugins.email.isAvailable((isAvailable) => {}, {});
|
||||
cordova.plugins.email.open({
|
||||
to: ['foo@bar.com'],
|
||||
body: 'foo bar'
|
||||
});
|
||||
cordova.plugins.email.open();
|
||||
cordova.plugins.email.open({}, () => {});
|
||||
cordova.plugins.email.open({}, () => {}, {});
|
||||
|
||||
cordova.plugins.email.openDraft({
|
||||
to: ['foo@bar.com'],
|
||||
body: 'foo bar'
|
||||
});
|
||||
cordova.plugins.email.openDraft();
|
||||
cordova.plugins.email.openDraft({}, () => {});
|
||||
cordova.plugins.email.openDraft({}, () => {}, {});
|
||||
33
cordova-plugin-email-composer/cordova-plugin-email-composer.d.ts
vendored
Normal file
33
cordova-plugin-email-composer/cordova-plugin-email-composer.d.ts
vendored
Normal file
@@ -0,0 +1,33 @@
|
||||
// Type definitions for Apache Cordova Email Composer plugin
|
||||
// Project: https://github.com/katzer/cordova-plugin-email-composer
|
||||
// Definitions by: Dave Taylor <http://davetayls.me>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/**
|
||||
* The plugin provides access to the standard interface that manages the
|
||||
* editing and sending an email message
|
||||
*/
|
||||
interface CordovaPluginEmailComposer {
|
||||
/** Determine if the device is capable to send emails */
|
||||
isAvailable(callback:(isAvailable:boolean) => void, scope?:any):void;
|
||||
/** Open a pre-filled email draft */
|
||||
open(options?:ICordovaPluginEmailComposerOpenOptions, callback?:() => void, scope?:any):void;
|
||||
openDraft(options?:ICordovaPluginEmailComposerOpenOptions, callback?:() => void, scope?:any):void;
|
||||
}
|
||||
|
||||
interface ICordovaPluginEmailComposerOpenOptions {
|
||||
/** An configured email account is required to send emails */
|
||||
to?:string[];
|
||||
body?:string;
|
||||
cc?:string[];
|
||||
bcc?:string[];
|
||||
/** Attachments can be either base64 encoded datas, files from the the device storage or assets from within the www folder */
|
||||
attachments?:any[];
|
||||
subject?:string;
|
||||
/** The default value for isHTML is true */
|
||||
isHtml?:boolean;
|
||||
}
|
||||
|
||||
interface CordovaPlugins {
|
||||
email:CordovaPluginEmailComposer;
|
||||
}
|
||||
4
cordova/cordova.d.ts
vendored
4
cordova/cordova.d.ts
vendored
@@ -43,8 +43,12 @@ interface Cordova {
|
||||
define(moduleName: string, factory: (require: any, exports: any, module: any) => any): void;
|
||||
/** Access a Cordova module by name. */
|
||||
require(moduleName: string): any;
|
||||
/** Namespace for Cordova plugin functionality */
|
||||
plugins:CordovaPlugins;
|
||||
}
|
||||
|
||||
interface CordovaPlugins {}
|
||||
|
||||
interface Document {
|
||||
addEventListener(type: "deviceready", listener: (ev: Event) => any, useCapture?: boolean): void;
|
||||
addEventListener(type: "pause", listener: (ev: Event) => any, useCapture?: boolean): void;
|
||||
|
||||
@@ -476,7 +476,7 @@ function callenderView() {
|
||||
.style("text-anchor", "middle")
|
||||
.text(function (d) { return d; });
|
||||
|
||||
var rect = svg.selectAll(".day")
|
||||
var rect: D3.UpdateSelection = svg.selectAll(".day")
|
||||
.data(function (d) { return d3.time.days(new Date(d, 0, 1), new Date(d + 1, 0, 1)); })
|
||||
.enter().append("rect")
|
||||
.attr("class", "day")
|
||||
@@ -960,7 +960,7 @@ function forcedBasedLabelPlacemant() {
|
||||
|
||||
var anchorLink = vis.selectAll("line.anchorLink").data(labelAnchorLinks)//.enter().append("svg:line").attr("class", "anchorLink").style("stroke", "#999");
|
||||
|
||||
var anchorNode = vis.selectAll("g.anchorNode").data(force2.nodes()).enter().append("svg:g").attr("class", "anchorNode");
|
||||
var anchorNode: D3.Selection = vis.selectAll("g.anchorNode").data(force2.nodes()).enter().append("svg:g").attr("class", "anchorNode");
|
||||
anchorNode.append("svg:circle").attr("r", 0).style("fill", "#FFF");
|
||||
anchorNode.append("svg:text").text(function (d, i) {
|
||||
return i % 2 == 0 ? "" : d.node.label
|
||||
@@ -1404,7 +1404,7 @@ function quadtree() {
|
||||
.attr("width", function (d) { return d.width; } )
|
||||
.attr("height", function (d) { return d.height; } );
|
||||
|
||||
var point = svg.selectAll(".point")
|
||||
var point: D3.Selection = svg.selectAll(".point")
|
||||
.data(data)
|
||||
.enter().append("circle")
|
||||
.attr("class", "point")
|
||||
|
||||
124
d3/d3.d.ts
vendored
124
d3/d3.d.ts
vendored
@@ -12,19 +12,19 @@ declare module D3 {
|
||||
/**
|
||||
* Returns the empty selection
|
||||
*/
|
||||
(): Selection;
|
||||
(): _Selection<any>;
|
||||
/**
|
||||
* Selects the first element that matches the specified selector string
|
||||
*
|
||||
* @param selector Selection String to match
|
||||
*/
|
||||
(selector: string): Selection;
|
||||
(selector: string): _Selection<any>;
|
||||
/**
|
||||
* Selects the specified node
|
||||
*
|
||||
* @param element Node element to select
|
||||
*/
|
||||
(element: EventTarget): Selection;
|
||||
(element: EventTarget): _Selection<any>;
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -36,13 +36,13 @@ declare module D3 {
|
||||
*
|
||||
* @param selector Selection String to match
|
||||
*/
|
||||
(selector: string): Selection;
|
||||
(selector: string): _Selection<any>;
|
||||
/**
|
||||
* Selects the specified array of elements
|
||||
*
|
||||
* @param elements Array of node elements to select
|
||||
*/
|
||||
(elements: EventTarget[]): Selection;
|
||||
(elements: EventTarget[]): _Selection<any>;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -458,7 +458,7 @@ declare module D3 {
|
||||
/**
|
||||
* Returns the root selection
|
||||
*/
|
||||
selection(): Selection;
|
||||
selection(): _Selection<any>;
|
||||
ns: {
|
||||
/**
|
||||
* The map of registered namespace prefixes
|
||||
@@ -726,56 +726,56 @@ declare module D3 {
|
||||
format(rows: any[]): string;
|
||||
}
|
||||
|
||||
export interface Selection extends Selectors, Array<any> {
|
||||
export interface _Selection<T> extends Selectors, Array<any> {
|
||||
attr: {
|
||||
(name: string): string;
|
||||
(name: string, value: any): Selection;
|
||||
(name: string, valueFunction: (data: any, index: number) => any): Selection;
|
||||
(attrValueMap : Object): Selection;
|
||||
(name: string, value: any): _Selection<T>;
|
||||
(name: string, valueFunction: (data: T, index: number) => any): _Selection<T>;
|
||||
(attrValueMap: Object): _Selection<T>;
|
||||
};
|
||||
|
||||
classed: {
|
||||
(name: string): boolean;
|
||||
(name: string, value: any): Selection;
|
||||
(name: string, valueFunction: (data: any, index: number) => any): Selection;
|
||||
(classValueMap: Object): Selection;
|
||||
(name: string, value: any): _Selection<T>;
|
||||
(name: string, valueFunction: (data: T, index: number) => any): _Selection<T>;
|
||||
(classValueMap: Object): _Selection<T>;
|
||||
};
|
||||
|
||||
style: {
|
||||
(name: string): string;
|
||||
(name: string, value: any, priority?: string): Selection;
|
||||
(name: string, valueFunction: (data: any, index: number) => any, priority?: string): Selection;
|
||||
(styleValueMap : Object): Selection;
|
||||
(name: string, value: any, priority?: string): _Selection<T>;
|
||||
(name: string, valueFunction: (data: T, index: number) => any, priority?: string): _Selection<T>;
|
||||
(styleValueMap: Object): _Selection<T>;
|
||||
};
|
||||
|
||||
property: {
|
||||
(name: string): void;
|
||||
(name: string, value: any): Selection;
|
||||
(name: string, valueFunction: (data: any, index: number) => any): Selection;
|
||||
(propertyValueMap : Object): Selection;
|
||||
(name: string, value: any): _Selection<T>;
|
||||
(name: string, valueFunction: (data: T, index: number) => any): _Selection<T>;
|
||||
(propertyValueMap: Object): _Selection<T>;
|
||||
};
|
||||
|
||||
text: {
|
||||
(): string;
|
||||
(value: any): Selection;
|
||||
(valueFunction: (data: any, index: number) => any): Selection;
|
||||
(value: any): _Selection<T>;
|
||||
(valueFunction: (data: T, index: number) => any): _Selection<T>;
|
||||
};
|
||||
|
||||
html: {
|
||||
(): string;
|
||||
(value: any): Selection;
|
||||
(valueFunction: (data: any, index: number) => any): Selection;
|
||||
(value: any): _Selection<T>;
|
||||
(valueFunction: (data: T, index: number) => any): _Selection<T>;
|
||||
};
|
||||
|
||||
append: (name: string) => Selection;
|
||||
insert: (name: string, before: string) => Selection;
|
||||
remove: () => Selection;
|
||||
append: (name: string) => _Selection<T>;
|
||||
insert: (name: string, before: string) => _Selection<T>;
|
||||
remove: () => _Selection<T>;
|
||||
empty: () => boolean;
|
||||
|
||||
data: {
|
||||
(values: (data: any, index?: number) => any[], key?: (data: any, index?: number) => any): UpdateSelection;
|
||||
(values: any[], key?: (data: any, index?: number) => any): UpdateSelection;
|
||||
(): any[];
|
||||
<U>(values: (data: T, index?: number) => U[], key?: (data: U, index?: number) => any): _UpdateSelection<U>;
|
||||
<U>(values: U[], key?: (data: U, index?: number) => any): _UpdateSelection<U>;
|
||||
(): T[];
|
||||
};
|
||||
|
||||
datum: {
|
||||
@@ -789,36 +789,31 @@ declare module D3 {
|
||||
* element. The function is then used to set each element's data. A null value will
|
||||
* delete the bound data. This operator has no effect on the index.
|
||||
*/
|
||||
(values: (data: any, index: number) => any): UpdateSelection;
|
||||
<U>(values: (data: U, index: number) => any): _UpdateSelection<U>;
|
||||
/**
|
||||
* Sets the element's bound data to the specified value on all selected elements.
|
||||
* Unlike the D3.Selection.data method, this method does not compute a join (and thus
|
||||
* does not compute enter and exit selections).
|
||||
* @param values The same data to be given to all elements.
|
||||
*/
|
||||
(values: any): UpdateSelection;
|
||||
<U>(values: U): _UpdateSelection<U>;
|
||||
/**
|
||||
* Returns the bound datum for the first non-null element in the selection.
|
||||
* This is generally useful only if you know the selection contains exactly one element.
|
||||
*/
|
||||
(): any;
|
||||
/**
|
||||
* Returns the bound datum for the first non-null element in the selection.
|
||||
* This is generally useful only if you know the selection contains exactly one element.
|
||||
*/
|
||||
<T>(): T;
|
||||
(): T;
|
||||
};
|
||||
|
||||
filter: {
|
||||
(filter: (data: any, index: number) => boolean, thisArg?: any): UpdateSelection;
|
||||
(filter: string): UpdateSelection;
|
||||
(filter: (data: T, index: number) => boolean, thisArg?: any): _UpdateSelection<T>;
|
||||
(filter: string): _UpdateSelection<T>;
|
||||
};
|
||||
|
||||
call(callback: (selection: Selection, ...args: any[]) => void, ...args: any[]): Selection;
|
||||
each(eachFunction: (data: any, index: number) => any): Selection;
|
||||
call(callback: (selection: _Selection<T>, ...args: any[]) => void, ...args: any[]): _Selection<T>;
|
||||
each(eachFunction: (data: T, index: number) => any): _Selection<T>;
|
||||
on: {
|
||||
(type: string): (data: any, index: number) => any;
|
||||
(type: string, listener: (data: any, index: number) => any, capture?: boolean): Selection;
|
||||
(type: string, listener: (data: any, index: number) => any, capture?: boolean): _Selection<T>;
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -840,38 +835,44 @@ declare module D3 {
|
||||
* to compare, and should return either a negative, positive, or zero value to indicate
|
||||
* their relative order.
|
||||
*/
|
||||
sort<T>(comparator?: (a: T, b: T) => number): Selection;
|
||||
sort(comparator?: (a: T, b: T) => number): _Selection<T>;
|
||||
|
||||
/**
|
||||
* Re-inserts elements into the document such that the document order matches the selection
|
||||
* order. This is equivalent to calling sort() if the data is already sorted, but much
|
||||
* faster.
|
||||
*/
|
||||
order: () => Selection;
|
||||
order: () => _Selection<T>;
|
||||
|
||||
/**
|
||||
* Returns the first non-null element in the current selection. If the selection is empty,
|
||||
* returns null.
|
||||
*/
|
||||
node: <T extends Element>() => T;
|
||||
node: <E extends Element>() => E;
|
||||
}
|
||||
|
||||
export interface EnterSelection {
|
||||
append: (name: string) => Selection;
|
||||
insert: (name: string, before?: string) => Selection;
|
||||
select: (selector: string) => Selection;
|
||||
export interface Selection extends _Selection<any> { }
|
||||
|
||||
export interface _EnterSelection<T> {
|
||||
append: (name: string) => _Selection<T>;
|
||||
insert: (name: string, before?: string) => _Selection<T>;
|
||||
select: (selector: string) => _Selection<T>;
|
||||
empty: () => boolean;
|
||||
node: () => Element;
|
||||
call: (callback: (selection: EnterSelection) => void) => EnterSelection;
|
||||
call: (callback: (selection: _EnterSelection<T>) => void) => _EnterSelection<T>;
|
||||
size: () => number;
|
||||
}
|
||||
|
||||
export interface UpdateSelection extends Selection {
|
||||
enter: () => EnterSelection;
|
||||
update: () => Selection;
|
||||
exit: () => Selection;
|
||||
export interface EnterSelection extends _EnterSelection<any> { }
|
||||
|
||||
export interface _UpdateSelection<T> extends _Selection<T> {
|
||||
enter: () => _EnterSelection<T>;
|
||||
update: () => _Selection<T>;
|
||||
exit: () => _Selection<T>;
|
||||
}
|
||||
|
||||
export interface UpdateSelection extends _UpdateSelection<any> { }
|
||||
|
||||
export interface NestKeyValue {
|
||||
key: string;
|
||||
values: any;
|
||||
@@ -1279,6 +1280,13 @@ declare module D3 {
|
||||
(angle: (d : any) => number): PieLayout
|
||||
(angle: (d : any, i: number) => number): PieLayout;
|
||||
};
|
||||
padAngle: {
|
||||
(): number;
|
||||
(angle: number): PieLayout;
|
||||
(angle: () => number): PieLayout;
|
||||
(angle: (d : any) => number): PieLayout
|
||||
(angle: (d : any, i: number) => number): PieLayout;
|
||||
};
|
||||
}
|
||||
|
||||
export interface ArcDescriptor {
|
||||
@@ -1727,14 +1735,14 @@ declare module D3 {
|
||||
export interface Symbol {
|
||||
type: (symbolType: string | ((datum: any, index: number) => string)) => Symbol;
|
||||
size: (size: number | ((datum: any, index: number) => number)) => Symbol;
|
||||
(datum:any, index:number): string;
|
||||
(datum?: any, index?: number): string;
|
||||
}
|
||||
|
||||
export interface Brush {
|
||||
/**
|
||||
* Draws or redraws this brush into the specified selection of elements
|
||||
*/
|
||||
(selection: Selection): void;
|
||||
(selection: _Selection<any>): void;
|
||||
/**
|
||||
* Gets or sets the x-scale associated with the brush
|
||||
*/
|
||||
@@ -1802,7 +1810,7 @@ declare module D3 {
|
||||
}
|
||||
|
||||
export interface Axis {
|
||||
(selection: Selection): void;
|
||||
(selection: _Selection<any>): void;
|
||||
(transition: Transition.Transition): void;
|
||||
|
||||
scale: {
|
||||
@@ -2775,7 +2783,7 @@ declare module D3 {
|
||||
* registering the necessary event listeners to support
|
||||
* panning and zooming.
|
||||
*/
|
||||
(selection: Selection): void;
|
||||
(selection: _Selection<any>): void;
|
||||
|
||||
/**
|
||||
* Registers a listener to receive events
|
||||
|
||||
4
errorhandler/errorhandler.d.ts
vendored
4
errorhandler/errorhandler.d.ts
vendored
@@ -7,6 +7,6 @@
|
||||
|
||||
declare module "errorhandler" {
|
||||
import express = require('express');
|
||||
function e(): express.ErrorRequestHandler;
|
||||
function e(options?: {log?: any}): express.ErrorRequestHandler;
|
||||
export = e;
|
||||
}
|
||||
}
|
||||
|
||||
2
formidable/formidable.d.ts
vendored
2
formidable/formidable.d.ts
vendored
@@ -25,7 +25,7 @@ declare module "formidable" {
|
||||
onPart: (part: Part) => void;
|
||||
|
||||
handlePart(part: Part): void;
|
||||
parse(req: http.ServerRequest, callback?: (err: any, fields: Fields, files: Files) => any): void;
|
||||
parse(req: http.IncomingMessage, callback?: (err: any, fields: Fields, files: Files) => any): void;
|
||||
}
|
||||
|
||||
export interface Fields {
|
||||
|
||||
103
imgur-rest-api/imgur-rest-api-tests.ts
Normal file
103
imgur-rest-api/imgur-rest-api-tests.ts
Normal file
@@ -0,0 +1,103 @@
|
||||
/// <reference path="imgur-rest-api.d.ts" />
|
||||
|
||||
function testAccount(account: ImgurRestApi.Account) : ImgurRestApi.Account {
|
||||
return account;
|
||||
}
|
||||
|
||||
function testAccountSettings(accountSettings: ImgurRestApi.AccountSettings) : ImgurRestApi.AccountSettings {
|
||||
return accountSettings;
|
||||
}
|
||||
|
||||
function testAlbum(album: ImgurRestApi.Album) : ImgurRestApi.Album {
|
||||
return album;
|
||||
}
|
||||
|
||||
function testAlbumImages(album: ImgurRestApi.Album) : ImgurRestApi.Image {
|
||||
return album.images[0];
|
||||
}
|
||||
|
||||
function testComment(comment: ImgurRestApi.Comment) : ImgurRestApi.Comment {
|
||||
return comment;
|
||||
}
|
||||
|
||||
function testConversation(conversation: ImgurRestApi.Conversation) : ImgurRestApi.Conversation {
|
||||
return conversation;
|
||||
}
|
||||
|
||||
function testCustomGallery(customGallery: ImgurRestApi.CustomGallery) : ImgurRestApi.CustomGallery {
|
||||
return customGallery;
|
||||
}
|
||||
|
||||
function testGalleryItem(galleryItem: ImgurRestApi.GalleryItem) : ImgurRestApi.GalleryItem {
|
||||
return galleryItem;
|
||||
}
|
||||
|
||||
function testGalleryAlbum(galleryItem: ImgurRestApi.GalleryItem) : ImgurRestApi.GalleryAlbum {
|
||||
if(galleryItem.is_album) {
|
||||
var galleryAlbum = <ImgurRestApi.GalleryAlbum> galleryItem;
|
||||
return galleryAlbum;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
function testGalleryImage(galleryItem: ImgurRestApi.GalleryItem) : ImgurRestApi.GalleryImage {
|
||||
if(!galleryItem.is_album) {
|
||||
var galleryImage = <ImgurRestApi.GalleryImage> galleryItem;
|
||||
return galleryImage;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
function testGalleryProfile(galleryProfile: ImgurRestApi.GalleryProfile) : ImgurRestApi.GalleryProfile {
|
||||
return galleryProfile;
|
||||
}
|
||||
|
||||
function testImage(image: ImgurRestApi.Image) : ImgurRestApi.Image {
|
||||
return image;
|
||||
}
|
||||
|
||||
function testMemeMeta(meta: ImgurRestApi.MemeMetadata) : ImgurRestApi.MemeMetadata {
|
||||
return meta;
|
||||
}
|
||||
|
||||
function testMessage(message: ImgurRestApi.Message) : ImgurRestApi.Message {
|
||||
return message;
|
||||
}
|
||||
|
||||
function testAccountNotificationsReply(accountNotif: ImgurRestApi.AccountNotifications) : ImgurRestApi.Notification<ImgurRestApi.Comment> {
|
||||
return accountNotif.replies[0];
|
||||
}
|
||||
|
||||
function testAccountNotificationsMessage(accountNotif: ImgurRestApi.AccountNotifications) : ImgurRestApi.Notification<ImgurRestApi.Conversation> {
|
||||
return accountNotif.messages[0];
|
||||
}
|
||||
|
||||
function testTag(tag: ImgurRestApi.Tag) : ImgurRestApi.Tag {
|
||||
return tag;
|
||||
}
|
||||
|
||||
function testTagVote(tagVote: ImgurRestApi.TagVote) : ImgurRestApi.TagVote {
|
||||
return tagVote;
|
||||
}
|
||||
|
||||
function testTopic(topic: ImgurRestApi.Topic) : ImgurRestApi.Topic {
|
||||
return topic;
|
||||
}
|
||||
|
||||
function testVote(vote: ImgurRestApi.Vote) : ImgurRestApi.Vote {
|
||||
return vote;
|
||||
}
|
||||
|
||||
function testResponseWithError(response: ImgurRestApi.Response<ImgurRestApi.GalleryProfile>) : ImgurRestApi.Error {
|
||||
if(response.success === false) {
|
||||
return <ImgurRestApi.Error> response.data;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
function testResponseWithValue(response: ImgurRestApi.Response<ImgurRestApi.GalleryProfile>) : ImgurRestApi.GalleryProfile {
|
||||
if(response.success === true) {
|
||||
return <ImgurRestApi.GalleryProfile> response.data;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
252
imgur-rest-api/imgur-rest-api.d.ts
vendored
Normal file
252
imgur-rest-api/imgur-rest-api.d.ts
vendored
Normal file
@@ -0,0 +1,252 @@
|
||||
// Type definitions for Imgur REST API v3
|
||||
// Project: https://api.imgur.com/
|
||||
// Definitions by: Luke William Westby <http://github.com/lukewestby>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
declare module ImgurRestApi {
|
||||
|
||||
interface Response<T> {
|
||||
data: any; //T|Error;
|
||||
status: number;
|
||||
success: boolean;
|
||||
}
|
||||
|
||||
interface Account {
|
||||
id: number;
|
||||
url: string;
|
||||
bio: string;
|
||||
reputation: number;
|
||||
created: number;
|
||||
pro_expiration: any; //number|boolean;
|
||||
}
|
||||
|
||||
interface AccountSettings {
|
||||
email: string;
|
||||
high_quality: boolean;
|
||||
public_images: boolean;
|
||||
album_privacy: string;
|
||||
pro_expiration: any; //number|boolean;
|
||||
accepted_gallery_terms: boolean;
|
||||
active_emails: Array<string>;
|
||||
messaging_enabled: boolean;
|
||||
blocked_users: Array<BlockedUser>;
|
||||
}
|
||||
|
||||
interface Album {
|
||||
id: string;
|
||||
title: string;
|
||||
description: string;
|
||||
datetime: number;
|
||||
cover: string;
|
||||
cover_width: number;
|
||||
cover_height: number;
|
||||
account_url?: string;
|
||||
account_id?: number;
|
||||
privacy: string;
|
||||
layout: string;
|
||||
views: number;
|
||||
link: string;
|
||||
favorite: boolean;
|
||||
nsfw?: boolean;
|
||||
section: string;
|
||||
order: number;
|
||||
deletehash?: string;
|
||||
images_count: number;
|
||||
images: Array<Image>;
|
||||
}
|
||||
|
||||
interface BlockedUser {
|
||||
blocked_id: number;
|
||||
blocked_url: string;
|
||||
}
|
||||
|
||||
interface Comment {
|
||||
id: number;
|
||||
image_id: string;
|
||||
comment: string;
|
||||
author: string;
|
||||
author_id: number;
|
||||
on_album: boolean;
|
||||
album_cover: string;
|
||||
ups: number;
|
||||
downs: number;
|
||||
points: number;
|
||||
datetime: number;
|
||||
parent_id: number;
|
||||
deleted: boolean;
|
||||
vote?: string;
|
||||
children: Array<Comment>
|
||||
}
|
||||
|
||||
interface Conversation {
|
||||
id: number;
|
||||
last_message_preview: string;
|
||||
datetime: number;
|
||||
with_account_id: number;
|
||||
with_account: string;
|
||||
message_count: number;
|
||||
messages?: Array<Message>;
|
||||
done?: boolean;
|
||||
page?: number;
|
||||
}
|
||||
|
||||
interface CustomGallery {
|
||||
account_url: string;
|
||||
link: string;
|
||||
tags: Array<string>
|
||||
item_count: number;
|
||||
items: Array<GalleryItem>;
|
||||
}
|
||||
|
||||
interface GalleryItem {
|
||||
id: string;
|
||||
title: string;
|
||||
description: string;
|
||||
datetime: number;
|
||||
account_url?: string;
|
||||
account_id?: number;
|
||||
ups: number;
|
||||
downs: number;
|
||||
score: number;
|
||||
is_album: boolean;
|
||||
views: number;
|
||||
link: string;
|
||||
vote?: string;
|
||||
favorite: boolean;
|
||||
nsfw?: boolean;
|
||||
comment_count: number;
|
||||
topic: string;
|
||||
topic_id: number;
|
||||
}
|
||||
|
||||
interface GalleryAlbum extends GalleryItem {
|
||||
cover: string;
|
||||
cover_width: number;
|
||||
cover_height: number;
|
||||
privacy: string;
|
||||
layout: string;
|
||||
images_count: number;
|
||||
images: Array<Image>;
|
||||
}
|
||||
|
||||
interface GalleryImage extends GalleryItem {
|
||||
type: string;
|
||||
animated: boolean;
|
||||
width: number;
|
||||
height: number;
|
||||
size: number;
|
||||
bandwidth: number;
|
||||
deletehash?: string;
|
||||
gifv?: string;
|
||||
mp4?: string;
|
||||
webm?: string;
|
||||
looping?: boolean;
|
||||
section: string;
|
||||
}
|
||||
|
||||
interface GalleryProfile {
|
||||
total_gallery_comments: number;
|
||||
total_gallery_favorites: number;
|
||||
total_gallery_submissions: number;
|
||||
trophies: Array<Trophy>;
|
||||
}
|
||||
|
||||
interface Trophy {
|
||||
id: number;
|
||||
name: string;
|
||||
name_clean: string;
|
||||
description: string;
|
||||
data: string;
|
||||
data_link: string;
|
||||
datetime: number;
|
||||
image: string;
|
||||
}
|
||||
|
||||
interface Image {
|
||||
id: string;
|
||||
title: string;
|
||||
description: string;
|
||||
datetime: number;
|
||||
type: string;
|
||||
animated: boolean;
|
||||
width: number;
|
||||
height: number;
|
||||
size: number;
|
||||
views: number;
|
||||
bandwidth: number;
|
||||
deletehash?: string;
|
||||
name?: string;
|
||||
section: string;
|
||||
link: string;
|
||||
gifv?: string;
|
||||
mp4?: string;
|
||||
webm?: string;
|
||||
looping?: boolean;
|
||||
vote?: string;
|
||||
favorite: boolean;
|
||||
nsfw?: boolean;
|
||||
account_url?: string;
|
||||
account_id?: number;
|
||||
}
|
||||
|
||||
interface MemeMetadata {
|
||||
meme_name: string;
|
||||
top_text: string;
|
||||
bottom_text: string;
|
||||
bg_image: string;
|
||||
}
|
||||
|
||||
interface Message {
|
||||
id: number;
|
||||
from: string;
|
||||
account_id: number;
|
||||
sender_id: number;
|
||||
body: string;
|
||||
conversation_id: number;
|
||||
datetime: number;
|
||||
}
|
||||
|
||||
interface Notification<T> {
|
||||
id: number;
|
||||
account_id: number;
|
||||
viewed: boolean;
|
||||
content: T;
|
||||
}
|
||||
|
||||
interface AccountNotifications {
|
||||
replies: Array<Notification<Comment>>;
|
||||
messages: Array<Notification<Conversation>>;
|
||||
}
|
||||
|
||||
interface Tag {
|
||||
name: string;
|
||||
followers: number;
|
||||
total_items: number;
|
||||
following?: boolean;
|
||||
items: Array<GalleryItem>
|
||||
}
|
||||
|
||||
interface TagVote {
|
||||
ups: number;
|
||||
downs: number;
|
||||
name: string;
|
||||
author: string;
|
||||
}
|
||||
|
||||
interface Topic {
|
||||
id: number;
|
||||
name: string;
|
||||
description: string;
|
||||
}
|
||||
|
||||
interface Vote {
|
||||
ups: number;
|
||||
downs: number;
|
||||
}
|
||||
|
||||
interface Error {
|
||||
error: string;
|
||||
request: string;
|
||||
method: string;
|
||||
}
|
||||
}
|
||||
36
jquery-fullscreen/jquery-fullscreen-tests.ts
Normal file
36
jquery-fullscreen/jquery-fullscreen-tests.ts
Normal file
@@ -0,0 +1,36 @@
|
||||
/// <reference path="jquery-fullscreen.d.ts"/>
|
||||
|
||||
//
|
||||
// Examples from https://github.com/kayahr/jquery-fullscreen-plugin
|
||||
//
|
||||
|
||||
function enteringFullScreen() {
|
||||
|
||||
$(document).fullScreen(true);
|
||||
$('#myVideo').fullScreen(true);
|
||||
}
|
||||
|
||||
function exitingFullScreen() {
|
||||
|
||||
$(document).fullScreen(false);
|
||||
$('#myVideo').fullScreen(false);
|
||||
}
|
||||
|
||||
|
||||
function queryingFullScreenMode() {
|
||||
|
||||
//The method returns the current fullscreen element (or true if browser doesn't support this) when fullscreen mode is active,
|
||||
// false if not active or null when the browser does not support fullscreen mode at all
|
||||
var isFullScreen = $(document).fullScreen() != null;
|
||||
}
|
||||
|
||||
function fullScreenNotifications() {
|
||||
|
||||
$(document).bind("fullscreenchange", () => {
|
||||
console.log("Fullscreen " + ($(document).fullScreen() ? "on" : "off"));
|
||||
});
|
||||
|
||||
$(document).bind("fullscreenerror", () => {
|
||||
alert("Browser rejected fullscreen change");
|
||||
});
|
||||
}
|
||||
28
jquery-fullscreen/jquery-fullscreen.d.ts
vendored
Normal file
28
jquery-fullscreen/jquery-fullscreen.d.ts
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
// Type definitions for jquery-fullscreen 1.1.5
|
||||
// Project: https://github.com/kayahr/jquery-fullscreen-plugin
|
||||
// Definitions by: Bruno Grieder <https://github.com/bgrieder>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/// <reference path="../jquery/jquery.d.ts"/>
|
||||
|
||||
interface JQuery {
|
||||
|
||||
/**
|
||||
* You can either switch the whole page or a single HTML element to fullscreen mode
|
||||
* This only works when the code was triggered by a user interaction (For example a onclick event on a button). Browsers don't allow entering fullscreen mode without user interaction.
|
||||
* Fullscreen mode is always exited via the document but this plugin allows it also via any HTML element. The owner document of the selected HTML element is used
|
||||
*/
|
||||
fullScreen(fullScreen: boolean): JQuery | boolean;
|
||||
|
||||
/**
|
||||
* The method returns the current fullscreen element (or true if browser doesn't support this) when fullscreen mode is active,
|
||||
* false if not active or null when the browser does not support fullscreen mode at all
|
||||
*/
|
||||
fullScreen(): boolean;
|
||||
|
||||
/**
|
||||
* The plugin provides another method for simple fullscreen mode toggling
|
||||
*/
|
||||
toggleFullScreen(): JQuery | boolean;
|
||||
}
|
||||
|
||||
10
knex/knex.d.ts
vendored
10
knex/knex.d.ts
vendored
@@ -307,13 +307,13 @@ declare module "knex" {
|
||||
}
|
||||
|
||||
interface SchemaBuilder {
|
||||
createTable(tableName: string, callback: (tableBuilder: CreateTableBuilder) => any): void;
|
||||
renameTable(oldTableName: string, newTableName: string): void;
|
||||
dropTable(tableName: string): void;
|
||||
createTable(tableName: string, callback: (tableBuilder: CreateTableBuilder) => any): Promise<void>;
|
||||
renameTable(oldTableName: string, newTableName: string): Promise<void>;
|
||||
dropTable(tableName: string): Promise<void>;
|
||||
hasTable(tableName: string): Promise<boolean>;
|
||||
hasColumn(tableName: string, columnName: string): Promise<boolean>;
|
||||
table(tableName: string, callback: (tableBuilder: AlterTableBuilder) => any): void;
|
||||
dropTableIfExists(tableName: string): void;
|
||||
table(tableName: string, callback: (tableBuilder: AlterTableBuilder) => any): Promise<void>;
|
||||
dropTableIfExists(tableName: string): Promise<void>;
|
||||
raw(statement: string): SchemaBuilder;
|
||||
}
|
||||
|
||||
|
||||
@@ -26,3 +26,39 @@ sourceItems.push(9);
|
||||
|
||||
sourceItems.push(10);
|
||||
// evenSquares now contains [36, 16, 4, 100]
|
||||
|
||||
// Testing mapping options
|
||||
|
||||
interface IComplexItem {
|
||||
value: string;
|
||||
dispose(): void;
|
||||
}
|
||||
|
||||
var complexItems = sourceItems.map({
|
||||
mapping: x => {
|
||||
var item: IComplexItem = {
|
||||
value: (x * x).toString(),
|
||||
dispose: () => { }
|
||||
};
|
||||
|
||||
return item;
|
||||
},
|
||||
disposeItem: (item: IComplexItem) => item.dispose()
|
||||
});
|
||||
|
||||
var complexItems2 = sourceItems.map({
|
||||
mappingWithDisposeCallback: x => {
|
||||
return {
|
||||
mappedValue: (x * x).toString(),
|
||||
dispose: () => { }
|
||||
};
|
||||
}
|
||||
});
|
||||
|
||||
// Test disposal
|
||||
|
||||
evenSquares.dispose();
|
||||
|
||||
complexItems.dispose();
|
||||
|
||||
complexItems2.dispose();
|
||||
|
||||
21
knockout.projections/knockout.projections.d.ts
vendored
21
knockout.projections/knockout.projections.d.ts
vendored
@@ -5,8 +5,21 @@
|
||||
|
||||
/// <reference path="../knockout/knockout.d.ts" />
|
||||
|
||||
interface KnockoutObservableArrayFunctions<T> {
|
||||
|
||||
map<TResult>(mapping: (value: T) => TResult): KnockoutObservableArray<TResult>;
|
||||
filter(predicate: (value: T) => boolean): KnockoutObservableArray<T>;
|
||||
interface KnockoutMappedObservableArray<T> extends KnockoutObservableArray<T>, KnockoutSubscription {
|
||||
}
|
||||
|
||||
interface KnockoutObservableArrayFunctions<T> {
|
||||
map<TResult>(mappingOptions: {
|
||||
mappingWithDisposeCallback: (value: T) => {
|
||||
mappedValue: TResult;
|
||||
dispose: () => void;
|
||||
};
|
||||
}): KnockoutMappedObservableArray<TResult>;
|
||||
map<TResult>(mappingOptions: {
|
||||
mapping: (value: T) => TResult;
|
||||
disposeItem?: (mappedItem: TResult) => void;
|
||||
}): KnockoutMappedObservableArray<TResult>;
|
||||
map<TResult>(mappingOptions: (value: T) => TResult): KnockoutMappedObservableArray<TResult>;
|
||||
|
||||
filter(predicate: (value: T) => boolean): KnockoutMappedObservableArray<T>;
|
||||
}
|
||||
|
||||
@@ -565,6 +565,8 @@ result = <number>_.sample([1, 2, 3, 4]);
|
||||
result = <number[]>_.sample([1, 2, 3, 4], 2);
|
||||
|
||||
result = <number[]>_.shuffle([1, 2, 3, 4, 5, 6]);
|
||||
result = <_.LoDashArrayWrapper<number>>_([1, 2, 3]).shuffle();
|
||||
result = <_.LoDashArrayWrapper<_.Dictionary<string>>>_(<{ [index: string]: string; }>{ 'key1': 'test1', 'key2': 'test2' }).shuffle();
|
||||
|
||||
result = <number>_.size([1, 2]);
|
||||
result = <number>_.size({ 'one': 1, 'two': 2, 'three': 3 });
|
||||
|
||||
14
lodash/lodash.d.ts
vendored
14
lodash/lodash.d.ts
vendored
@@ -4398,6 +4398,20 @@ declare module _ {
|
||||
shuffle<T>(collection: Dictionary<T>): T[];
|
||||
}
|
||||
|
||||
interface LoDashArrayWrapper<T> {
|
||||
/**
|
||||
* @see _.shuffle
|
||||
**/
|
||||
shuffle(): LoDashArrayWrapper<T>;
|
||||
}
|
||||
|
||||
interface LoDashObjectWrapper<T> {
|
||||
/**
|
||||
* @see _.shuffle
|
||||
**/
|
||||
shuffle(): LoDashArrayWrapper<T>;
|
||||
}
|
||||
|
||||
//_.size
|
||||
interface LoDashStatic {
|
||||
/**
|
||||
|
||||
53
node/node.d.ts
vendored
53
node/node.d.ts
vendored
@@ -282,15 +282,10 @@ declare module "http" {
|
||||
address(): { port: number; family: string; address: string; };
|
||||
maxHeadersCount: number;
|
||||
}
|
||||
export interface ServerRequest extends events.EventEmitter, stream.Readable {
|
||||
method: string;
|
||||
url: string;
|
||||
headers: any;
|
||||
trailers: string;
|
||||
httpVersion: string;
|
||||
setEncoding(encoding?: string): void;
|
||||
pause(): void;
|
||||
resume(): void;
|
||||
/**
|
||||
* @deprecated Use IncomingMessage
|
||||
*/
|
||||
export interface ServerRequest extends IncomingMessage {
|
||||
connection: net.Socket;
|
||||
}
|
||||
export interface ServerResponse extends events.EventEmitter, stream.Writable {
|
||||
@@ -340,15 +335,35 @@ declare module "http" {
|
||||
end(str: string, encoding?: string, cb?: Function): void;
|
||||
end(data?: any, encoding?: string): void;
|
||||
}
|
||||
export interface ClientResponse extends events.EventEmitter, stream.Readable {
|
||||
statusCode: number;
|
||||
export interface IncomingMessage extends events.EventEmitter, stream.Readable {
|
||||
httpVersion: string;
|
||||
headers: any;
|
||||
rawHeaders: string[];
|
||||
trailers: any;
|
||||
setEncoding(encoding?: string): void;
|
||||
pause(): void;
|
||||
resume(): void;
|
||||
rawTrailers: any;
|
||||
setTimeout(msecs: number, callback: Function): NodeJS.Timer;
|
||||
/**
|
||||
* Only valid for request obtained from http.Server.
|
||||
*/
|
||||
method?: string;
|
||||
/**
|
||||
* Only valid for request obtained from http.Server.
|
||||
*/
|
||||
url?: string;
|
||||
/**
|
||||
* Only valid for response obtained from http.ClientRequest.
|
||||
*/
|
||||
statusCode?: number;
|
||||
/**
|
||||
* Only valid for response obtained from http.ClientRequest.
|
||||
*/
|
||||
statusMessage?: string;
|
||||
socket: net.Socket;
|
||||
}
|
||||
/**
|
||||
* @deprecated Use IncomingMessage
|
||||
*/
|
||||
export interface ClientResponse extends IncomingMessage { }
|
||||
|
||||
export interface AgentOptions {
|
||||
/**
|
||||
@@ -390,10 +405,10 @@ declare module "http" {
|
||||
[errorCode: number]: string;
|
||||
[errorCode: string]: string;
|
||||
};
|
||||
export function createServer(requestListener?: (request: ServerRequest, response: ServerResponse) =>void ): Server;
|
||||
export function createServer(requestListener?: (request: IncomingMessage, response: ServerResponse) =>void ): Server;
|
||||
export function createClient(port?: number, host?: string): any;
|
||||
export function request(options: any, callback?: Function): ClientRequest;
|
||||
export function get(options: any, callback?: Function): ClientRequest;
|
||||
export function request(options: any, callback?: (res: IncomingMessage) => void): ClientRequest;
|
||||
export function get(options: any, callback?: (res: IncomingMessage) => void): ClientRequest;
|
||||
export var globalAgent: Agent;
|
||||
}
|
||||
|
||||
@@ -563,8 +578,8 @@ declare module "https" {
|
||||
};
|
||||
export interface Server extends tls.Server { }
|
||||
export function createServer(options: ServerOptions, requestListener?: Function): Server;
|
||||
export function request(options: RequestOptions, callback?: (res: http.ClientResponse) =>void ): http.ClientRequest;
|
||||
export function get(options: RequestOptions, callback?: (res: http.ClientResponse) =>void ): http.ClientRequest;
|
||||
export function request(options: RequestOptions, callback?: (res: http.IncomingMessage) =>void ): http.ClientRequest;
|
||||
export function get(options: RequestOptions, callback?: (res: http.IncomingMessage) =>void ): http.ClientRequest;
|
||||
export var globalAgent: Agent;
|
||||
}
|
||||
|
||||
|
||||
209
photoswipe/photoswipe-tests.ts
Normal file
209
photoswipe/photoswipe-tests.ts
Normal file
@@ -0,0 +1,209 @@
|
||||
/// <reference path="photoswipe.d.ts" />
|
||||
|
||||
function test_defaultUI() {
|
||||
var items: PhotoSwipeUI_Default.Item[] = [
|
||||
{
|
||||
src: "path/to/image.jpg",
|
||||
w: 100,
|
||||
h: 200,
|
||||
specialProperty: true
|
||||
},
|
||||
{
|
||||
src: "path/to/image2.jpg",
|
||||
w: 1000,
|
||||
h: 2000,
|
||||
specialProperty: false
|
||||
}
|
||||
];
|
||||
|
||||
var options: PhotoSwipe.Options = {
|
||||
index: 3,
|
||||
getThumbBoundsFn: function(index) {
|
||||
return {x: 100, y: 100, w: 100};
|
||||
},
|
||||
showAnimationDuration: 333,
|
||||
hideAnimationDuration: 333,
|
||||
showHideOpacity: false,
|
||||
bgOpacity: 1,
|
||||
spacing: 0.12,
|
||||
allowNoPanText: true,
|
||||
maxSpreadZoom: 2,
|
||||
getDoubleTapZoom: function(isMouseClick, item) {
|
||||
if (isMouseClick) {
|
||||
return 1;
|
||||
} else {
|
||||
return item.initialZoomLevel < 0.7 ? 1 : 1.5;
|
||||
}
|
||||
},
|
||||
loop: true,
|
||||
pinchToClose: true,
|
||||
closeOnScroll: true,
|
||||
closeOnVerticalDrag: true,
|
||||
mouseUsed: false,
|
||||
escKey: true,
|
||||
arrowKeys: true,
|
||||
history: true,
|
||||
galleryUID: 3,
|
||||
errorMsg: '<div class="pswp__error-msg"><a href="%url%" target="_blank">The image</a> could not be loaded.</div>',
|
||||
preload: [1, 1],
|
||||
mainClass: "",
|
||||
getNumItemsFn: () => { return 2; },
|
||||
focus: true,
|
||||
isClickableElement: function(el) {
|
||||
return el.tagName === 'A';
|
||||
},
|
||||
mainScrollEndFriction: 0.35,
|
||||
panEndFriction: 0.35
|
||||
};
|
||||
|
||||
var photoSwipe: PhotoSwipe<PhotoSwipeUI_Default.Options>;
|
||||
var uiOptions: PhotoSwipeUI_Default.Options = {
|
||||
barsSize: {top: 44, bottom: 'auto'},
|
||||
timeToIdle: 4000,
|
||||
timeToIdleOutside: 1000,
|
||||
loadingIndicatorDelay: 1000,
|
||||
addCaptionHTMLFn: function(item, captionEl, isFake) {
|
||||
if (!item.title) {
|
||||
(<HTMLElement> captionEl.children[0]).innerHTML = '';
|
||||
return false;
|
||||
}
|
||||
(<HTMLElement> captionEl.children[0]).innerHTML = item.title;
|
||||
return true;
|
||||
},
|
||||
closeEl: true,
|
||||
captionEl: true,
|
||||
fullscreenEl: true,
|
||||
zoomEl: true,
|
||||
shareEl: true,
|
||||
counterEl: true,
|
||||
arrowEl: true,
|
||||
preloaderEl: true,
|
||||
tapToClose: false,
|
||||
tapToToggleControls: true,
|
||||
clickToCloseNonZoomable: true,
|
||||
closeElClasses: ['item', 'caption', 'zoom-wrap', 'ui', 'top-bar'],
|
||||
indexIndicatorSep: ' / ',
|
||||
shareButtons: [
|
||||
{id: 'facebook', label: 'Share on Facebook', url: 'https://www.facebook.com/sharer/sharer.php?u='},
|
||||
{id: 'twitter', label: 'Tweet', url: 'https://twitter.com/intent/tweet?text=&url='},
|
||||
{id: 'pinterest', label: 'Pin it', url: 'http://www.pinterest.com/pin/create/button/?url=&media=&description='},
|
||||
{id: 'download', label: 'Download image', url: '', download: true}
|
||||
],
|
||||
getImageURLForShare: function( shareButtonData ) {
|
||||
// `shareButtonData` - object from shareButtons array
|
||||
//
|
||||
// `pswp` is the gallery instance object,
|
||||
// you should define it by yourself
|
||||
//
|
||||
return photoSwipe.currItem.src || '';
|
||||
},
|
||||
getPageURLForShare: function( shareButtonData ) {
|
||||
return window.location.href;
|
||||
},
|
||||
getTextForShare: function( shareButtonData ) {
|
||||
return (<PhotoSwipeUI_Default.Item> photoSwipe.currItem).title || '';
|
||||
},
|
||||
parseShareButtonOut: function(shareButtonData, shareButtonOut) {
|
||||
return shareButtonOut;
|
||||
}
|
||||
};
|
||||
|
||||
var pswpElement = document.getElementById("gallery");
|
||||
photoSwipe = new PhotoSwipe<PhotoSwipeUI_Default.Options>(pswpElement, PhotoSwipeUI_Default, items, uiOptions);
|
||||
|
||||
}
|
||||
|
||||
function test_photoSwipeMethods() {
|
||||
var photoSwipe: PhotoSwipe<PhotoSwipeUI_Default.Options>;
|
||||
|
||||
photoSwipe.init();
|
||||
|
||||
alert(photoSwipe.currItem.src);
|
||||
alert(photoSwipe.viewportSize.x);
|
||||
photoSwipe.ui.init();
|
||||
photoSwipe.bg.style.borderStyle = "1px solid red";
|
||||
photoSwipe.container.style.borderStyle = "1px solid red";
|
||||
photoSwipe.options.timeToIdle = 2000;
|
||||
alert(photoSwipe.getCurrentIndex() === 3);
|
||||
alert(photoSwipe.getZoomLevel() === 1);
|
||||
alert(photoSwipe.isDragging());
|
||||
|
||||
photoSwipe.goTo(9);
|
||||
photoSwipe.next();
|
||||
photoSwipe.prev();
|
||||
|
||||
photoSwipe.updateSize(true);
|
||||
|
||||
photoSwipe.close();
|
||||
photoSwipe.zoomTo(2,
|
||||
{ x: 250, y: 250 },
|
||||
2000,
|
||||
(x) => { return x*x*(3-2*x); },
|
||||
(zoomValue) => { console.log("zoom value is now" + zoomValue); });
|
||||
photoSwipe.applyZoomPan(1, 0, 0);
|
||||
|
||||
photoSwipe.items[photoSwipe.getCurrentIndex()].src = "new/path/to/image.jpg";
|
||||
photoSwipe.invalidateCurrItems();
|
||||
}
|
||||
|
||||
function test_photoSwipeEvents() {
|
||||
var photoSwipe: PhotoSwipe<PhotoSwipeUI_Default.Options>;
|
||||
|
||||
photoSwipe.listen('beforeChange', () => {});
|
||||
photoSwipe.listen('afterChange', () => {});
|
||||
photoSwipe.listen('beforeChange', () => {});
|
||||
photoSwipe.listen('imageLoadComplete', (idx: number, item: PhotoSwipeUI_Default.Item) => {
|
||||
item.w *= 2;
|
||||
});
|
||||
photoSwipe.listen('resize', () => {});
|
||||
photoSwipe.listen('gettingData', (idx: number, item: PhotoSwipeUI_Default.Item) => {
|
||||
item.title = "abc";
|
||||
});
|
||||
photoSwipe.listen('mouseUsed', () => {});
|
||||
photoSwipe.listen('initialZoomIn', () => {});
|
||||
photoSwipe.listen('initialZoomInEnd', () => {});
|
||||
photoSwipe.listen('initialZoomOut', () => {});
|
||||
photoSwipe.listen('initialZoomOutEnd', () => {});
|
||||
photoSwipe.listen('parseVerticalMargin', (item: PhotoSwipeUI_Default.Item) => {
|
||||
item.vGap.top = 20;
|
||||
item.vGap.bottom = 40;
|
||||
});
|
||||
photoSwipe.listen('close', () => {});
|
||||
photoSwipe.listen('unbindEvents', () => {});
|
||||
photoSwipe.listen('destroy', () => {});
|
||||
photoSwipe.listen('preventDragEvent', (e: MouseEvent, isDown: boolean, preventObj: {prevent: boolean}) => {
|
||||
if (e.x > 50 && isDown) {
|
||||
preventObj.prevent = true;
|
||||
}
|
||||
});
|
||||
|
||||
photoSwipe.listen('foo', (a, b, c) => {
|
||||
alert(a + b + c);
|
||||
});
|
||||
photoSwipe.shout('foo', 1, 2, 3);
|
||||
}
|
||||
|
||||
function test_customUI() {
|
||||
var pswpElement = document.getElementById("gallery2");
|
||||
var myPhotoSwipe = new PhotoSwipe<MyUIOptions>(pswpElement, MyUI, [], {
|
||||
bgOpacity: 0,
|
||||
index: 3,
|
||||
foo: 123,
|
||||
bar: "abc"
|
||||
});
|
||||
}
|
||||
|
||||
interface MyUIOptions extends PhotoSwipe.Options {
|
||||
foo: number;
|
||||
bar: string;
|
||||
}
|
||||
|
||||
class MyUI implements PhotoSwipe.UI<MyUIOptions> {
|
||||
constructor(pswp: PhotoSwipe<MyUIOptions>, framework: PhotoSwipe.UIFramework) {
|
||||
// dummy
|
||||
}
|
||||
|
||||
init() {
|
||||
// dummy
|
||||
}
|
||||
}
|
||||
898
photoswipe/photoswipe.d.ts
vendored
Normal file
898
photoswipe/photoswipe.d.ts
vendored
Normal file
@@ -0,0 +1,898 @@
|
||||
// Type definitions for PhotoSwipe 4.0.7
|
||||
// Project: http://photoswipe.com/
|
||||
// Definitions by: Xiaohan Zhang <https://github.com/hellochar>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
declare module PhotoSwipe {
|
||||
/**
|
||||
* A specific slide in the PhotoSwipe gallery. The terms "item", "slide", and "slide object" are used interchangeably.
|
||||
*/
|
||||
interface Item {
|
||||
/**
|
||||
* The url of this image.
|
||||
*/
|
||||
src: string;
|
||||
/**
|
||||
* The width of this image.
|
||||
*/
|
||||
w: number;
|
||||
/**
|
||||
* The height of this image.
|
||||
*/
|
||||
h: number;
|
||||
|
||||
/**
|
||||
* Internal property added by PhotoSwipe.
|
||||
*/
|
||||
loadError?: boolean;
|
||||
|
||||
/**
|
||||
* Internal property added by PhotoSwipe.
|
||||
*/
|
||||
vGap?: {top: number; bottom: number};
|
||||
|
||||
/**
|
||||
* Internal property added by PhotoSwipe.
|
||||
* This number is computed to be this item's smaller dimension divided by the larger dimension.
|
||||
*/
|
||||
fitRatio?: number;
|
||||
|
||||
/**
|
||||
* Internal property added by PhotoSwipe.
|
||||
*/
|
||||
initialZoomLevel?: number;
|
||||
|
||||
/**
|
||||
* Internal property added by PhotoSwipe.
|
||||
*/
|
||||
bounds?: any;
|
||||
|
||||
/**
|
||||
* Internal property added by PhotoSwipe.
|
||||
*/
|
||||
initialPosition?: any;
|
||||
}
|
||||
|
||||
/**
|
||||
* Options for the base PhotoSwipe class. Derived from http://photoswipe.com/documentation/options.html
|
||||
*/
|
||||
interface Options {
|
||||
/**
|
||||
* Start slide index. 0 is the first slide. Must be integer, not a string.
|
||||
*
|
||||
* Default 0.
|
||||
*/
|
||||
index?: number;
|
||||
|
||||
/**
|
||||
* Function should return an object with coordinates from which initial zoom-in animation will start (or zoom-out animation will end).
|
||||
* Object should contain three properties: x (X position, relative to document), y (Y position, relative to document), w (width of the element).
|
||||
* Height will be calculated automatically based on size of large image.
|
||||
* For example if you return {x:0,y:0,w:50} zoom animation will start in top left corner of your page.
|
||||
* Function has one argument - index of the item that is opening or closing.
|
||||
*
|
||||
* Default undefined.
|
||||
*/
|
||||
getThumbBoundsFn?: (index: number) => { x: number; y: number; w: number };
|
||||
|
||||
/**
|
||||
* Initial zoom-in transition duration in milliseconds. Set to 0 to disable. Besides this JS option, you need also to change transition duration in PhotoSwipe CSS file:
|
||||
* .pswp--animate_opacity,
|
||||
* .pswp__bg,
|
||||
* .pswp__caption,
|
||||
* .pswp__top-bar,
|
||||
* .pswp--has_mouse .pswp__button--arrow--left,
|
||||
* .pswp--has_mouse .pswp__button--arrow--right{
|
||||
* -webkit-transition: opacity 333ms cubic-bezier(.4,0,.22,1);
|
||||
* transition: opacity 333ms cubic-bezier(.4,0,.22,1);
|
||||
* }
|
||||
*
|
||||
* Default 333.
|
||||
*/
|
||||
showAnimationDuration?: number;
|
||||
|
||||
/**
|
||||
* The same as the previous option, just for closing (zoom-out) transition.
|
||||
* After PhotoSwipe is opened pswp--open class will be added to the root element, you may use it to apply different transition duration in CSS.
|
||||
*
|
||||
* Default 333.
|
||||
*/
|
||||
hideAnimationDuration?: number;
|
||||
|
||||
/**
|
||||
* If set to false background opacity and image scale will be animated (image opacity is always 1).
|
||||
* If set to true root PhotoSwipe element opacity and image scale will be animated.
|
||||
* Enable it when dimensions of your small thumbnail don't match dimensions of large image.
|
||||
*
|
||||
* Default false.
|
||||
*/
|
||||
showHideOpacity?: boolean;
|
||||
|
||||
/**
|
||||
* Background (.pswp__bg) opacity.
|
||||
* Should be a number from 0 to 1, e.g. 0.7.
|
||||
* This style is defined via JS, not via CSS, as this value is used for a few gesture-based transitions.
|
||||
*
|
||||
* Default 1.
|
||||
*/
|
||||
bgOpacity?: number;
|
||||
|
||||
/**
|
||||
* Spacing ratio between slides. For example, 0.12 will render as a 12% of sliding viewport width (rounded).
|
||||
*
|
||||
* Default 0.12.
|
||||
*/
|
||||
spacing?: number;
|
||||
|
||||
/**
|
||||
* Allow swipe navigation to next/prev item when current item is zoomed.
|
||||
* Option is always false on devices that don't have hardware touch support.
|
||||
*
|
||||
* Default true.
|
||||
*/
|
||||
allowNoPanText?: boolean;
|
||||
|
||||
/**
|
||||
* Maximum zoom level when performing spread (zoom) gesture. 2 means that image can be zoomed 2x from original size.
|
||||
* Try to avoid huge values here, as too big image may cause memory issues on mobile (especially on iOS).
|
||||
*
|
||||
* Default 2.
|
||||
*/
|
||||
maxSpreadZoom?: number;
|
||||
|
||||
/**
|
||||
* Function should return zoom level to which image will be zoomed after double-tap gesture, or when user clicks on zoom icon, or mouse-click on image itself.
|
||||
* If you return 1 image will be zoomed to its original size.
|
||||
* Function is called each time zoom-in animation is initiated. So feel free to return different values for different images based on their size or screen DPI.
|
||||
*
|
||||
* Default is:
|
||||
*
|
||||
* function(isMouseClick, item) {
|
||||
*
|
||||
* // isMouseClick - true if mouse, false if double-tap
|
||||
* // item - slide object that is zoomed, usually current
|
||||
* // item.initialZoomLevel - initial scale ratio of image
|
||||
* // e.g. if viewport is 700px and image is 1400px,
|
||||
* // initialZoomLevel will be 0.5
|
||||
*
|
||||
* if(isMouseClick) {
|
||||
*
|
||||
* // is mouse click on image or zoom icon
|
||||
*
|
||||
* // zoom to original
|
||||
* return 1;
|
||||
*
|
||||
* // e.g. for 1400px image:
|
||||
* // 0.5 - zooms to 700px
|
||||
* // 2 - zooms to 2800px
|
||||
*
|
||||
* } else {
|
||||
*
|
||||
* // is double-tap
|
||||
*
|
||||
* // zoom to original if initial zoom is less than 0.7x,
|
||||
* // otherwise to 1.5x, to make sure that double-tap gesture always zooms image
|
||||
* return item.initialZoomLevel < 0.7 ? 1 : 1.5;
|
||||
* }
|
||||
* }
|
||||
*/
|
||||
getDoubleTapZoom?: (isMouseClick: boolean, item: Item) => number;
|
||||
|
||||
/**
|
||||
* Loop slides when using swipe gesture.If set to true you'll be able to swipe from last to first image.
|
||||
* Option is always false when there are less than 3 slides.
|
||||
* This option has no relation to arrows navigation. Arrows loop is turned on permanently. You can modify this behavior by making custom UI.
|
||||
*
|
||||
* Default true.
|
||||
*/
|
||||
loop?: boolean;
|
||||
|
||||
/**
|
||||
* Pinch to close gallery gesture. The gallery’s background will gradually fade out as the user zooms out. When the gesture is complete, the gallery will close.
|
||||
*
|
||||
* Default true.
|
||||
*/
|
||||
pinchToClose?: boolean;
|
||||
|
||||
/**
|
||||
* Close gallery on page scroll. Option works just for devices without hardware touch support.
|
||||
*
|
||||
* Default true.
|
||||
*/
|
||||
closeOnScroll?: boolean;
|
||||
|
||||
/**
|
||||
* Close gallery when dragging vertically and when image is not zoomed. Always false when mouse is used.
|
||||
*
|
||||
* Default true.
|
||||
*/
|
||||
closeOnVerticalDrag?: boolean;
|
||||
|
||||
/**
|
||||
* Option allows you to predefine if mouse was used or not.
|
||||
* Some PhotoSwipe feature depend on it, for example default UI left/right arrows will be displayed only after mouse is used.
|
||||
* If set to false, PhotoSwipe will start detecting when mouse is used by itself, mouseUsed event triggers when mouse is found.
|
||||
*
|
||||
* default false.
|
||||
*/
|
||||
mouseUsed?: boolean;
|
||||
|
||||
/**
|
||||
* esc keyboard key to close PhotoSwipe. Option can be changed dynamically (yourPhotoSwipeInstance.options.escKey = false;).
|
||||
*
|
||||
* Default true.
|
||||
*/
|
||||
escKey?: boolean;
|
||||
|
||||
/**
|
||||
* Keyboard left or right arrow key navigation. Option can be changed dynamically (yourPhotoSwipeInstance.options.arrowKeys = false;).
|
||||
*
|
||||
* Default true.
|
||||
*/
|
||||
arrowKeys?: boolean;
|
||||
|
||||
/**
|
||||
* If set to false disables history module (back button to close gallery, unique URL for each slide). You can also just exclude history.js module from your build.
|
||||
*
|
||||
* Default true.
|
||||
*/
|
||||
history?: boolean;
|
||||
|
||||
/**
|
||||
* Gallery unique ID. Used by History module when forming URL. For example, second picture of gallery with UID 1 will have URL: http://example.com/#&gid=1&pid=2.
|
||||
*
|
||||
* Default 1.
|
||||
*/
|
||||
galleryUID?: number;
|
||||
|
||||
/**
|
||||
* Error message when image was not loaded. %url% will be replaced by URL of image.
|
||||
*
|
||||
* Default is:
|
||||
*
|
||||
* <div class="pswp__error-msg"><a href="%url%" target="_blank">The image</a> could not be loaded.</div>
|
||||
*/
|
||||
errorMsg?: string;
|
||||
|
||||
/**
|
||||
* Lazy loading of nearby slides based on direction of movement.
|
||||
* Should be an array with two integers, first one - number of items to preload before current image, second one - after the current image.
|
||||
* E.g. if you set it to [1,3], it'll load 1 image before the current, and 3 images after current. Values can not be less than 1.
|
||||
*
|
||||
* Default [1, 1].
|
||||
*/
|
||||
preload?: number[];
|
||||
|
||||
/**
|
||||
* String with name of class that will be added to root element of PhotoSwipe (.pswp). Can contain multiple classes separated by space.
|
||||
*/
|
||||
mainClass?: string;
|
||||
|
||||
/**
|
||||
* Function that should return total number of items in gallery. Don't put very complex code here, function is executed very often.
|
||||
*
|
||||
* By default it returns length of slides array.
|
||||
*/
|
||||
getNumItemsFn?: () => number;
|
||||
|
||||
/**
|
||||
* Will set focus on PhotoSwipe element after it's open.
|
||||
*
|
||||
* Default true.
|
||||
*/
|
||||
focus?: boolean;
|
||||
|
||||
/**
|
||||
* Function should check if the element (el) is clickable.
|
||||
* If it is – PhotoSwipe will not call preventDefault and click event will pass through.
|
||||
* Function should be as light is possible, as it's executed multiple times on drag start and drag release.
|
||||
*
|
||||
* Default is:
|
||||
*
|
||||
* function(el) {
|
||||
* return el.tagName === 'A';
|
||||
* }
|
||||
*/
|
||||
isClickableElement?: (el: HTMLElement) => boolean;
|
||||
}
|
||||
|
||||
interface UIFramework {
|
||||
[name: string]: any;
|
||||
}
|
||||
|
||||
/**
|
||||
* Base type for PhotoSwipe user interfaces.
|
||||
* T is the type of options that this PhotoSwipe.UI uses.
|
||||
*
|
||||
* To build your own PhotoSwipe.UI class:
|
||||
*
|
||||
* (1) Write an interface for the custom UI's Options that extends PhotoSwipe.Options.
|
||||
* (2) Write your custom class, implementing the PhotoSwipe.UI interface.
|
||||
* (3) Pass in your custom interface to the type parameter T of the PhotoSwipe.UI interface.
|
||||
*
|
||||
* Example:
|
||||
*
|
||||
* // (1)
|
||||
* interface MyUIOptions extends PhotoSwipe.Options {
|
||||
* foo: number;
|
||||
* bar: string;
|
||||
* }
|
||||
*
|
||||
* // (2) and (3)
|
||||
* class MyUI implements PhotoSwipe.UI<MyUIOptions> {
|
||||
* constructor(pswp: PhotoSwipe<MyUIOptions>, framework: PhotoSwipe.UIFramework) {
|
||||
* }
|
||||
* }
|
||||
*
|
||||
* var pswpWithMyUI = new PhotoSwipe<MyUIOptions>(element, MyUI, items, {foo: 1, bar: "abc"});
|
||||
*/
|
||||
interface UI<T extends Options> {
|
||||
/**
|
||||
* Called by PhotoSwipe after it constructs the UI.
|
||||
*/
|
||||
init: () => void;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Base PhotoSwipe class. Derived from http://photoswipe.com/documentation/api.html
|
||||
*/
|
||||
declare class PhotoSwipe<T extends PhotoSwipe.Options> {
|
||||
/**
|
||||
* Constructs a PhotoSwipe.
|
||||
*
|
||||
* Note: By default Typescript will not correctly typecheck the options parameter. Make sure to
|
||||
* explicitly annotate the type of options being passed into the constructor like so:
|
||||
*
|
||||
* new PhotoSwipe<PhotoSwipeUI_Default.Options>( element, PhotoSwipeUI_Default, items, options );
|
||||
*
|
||||
* It accepts 4 arguments:
|
||||
*
|
||||
* (1) PhotoSwipe element (it must be added to DOM).
|
||||
* (2) PhotoSwipe UI class. If you included default photoswipe-ui-default.js, class will be PhotoSwipeUI_Default. Can be "false".
|
||||
* (3) Array with objects (slides).
|
||||
* (4) Options.
|
||||
*/
|
||||
constructor(pswpElement: HTMLElement,
|
||||
uiConstructor: (new (pswp: PhotoSwipe<T>, framework: PhotoSwipe.UIFramework) => PhotoSwipe.UI<T>) | boolean,
|
||||
items: PhotoSwipe.Item[],
|
||||
options: T);
|
||||
|
||||
/**
|
||||
* Current slide object.
|
||||
*/
|
||||
currItem: PhotoSwipe.Item;
|
||||
|
||||
/**
|
||||
* Items in this gallery. PhotoSwipe will (almost) dynamically respond to changes in this array.
|
||||
* To add, edit, or remove slides after PhotoSwipe is opened, you just need to modify the items array.
|
||||
*
|
||||
* For example, you can push new slide objects into the items array:
|
||||
*
|
||||
* pswp.items.push({
|
||||
* src: "path/to/image.jpg",
|
||||
* w:1200,
|
||||
* h:500
|
||||
* });
|
||||
*
|
||||
* If you changed slide that is CURRENT, NEXT or PREVIOUS (which you should try to avoid) – you need to call method that will update their content:
|
||||
*
|
||||
* // sets a flag that slides should be updated
|
||||
* pswp.invalidateCurrItems();
|
||||
* // updates the content of slides
|
||||
* pswp.updateSize(true);
|
||||
*
|
||||
* If you're using the DefaultUI, call pswp.ui.update() to update that as well. Also note:
|
||||
*
|
||||
* (1) You can't reassign whole array, you can only modify it (e.g. use splice to remove elements).
|
||||
* (2) If you're going to remove current slide – call goTo method before.
|
||||
* (3) There must be at least one slide.
|
||||
* (4) This technique is used to serve responsive images.
|
||||
*/
|
||||
items: PhotoSwipe.Item[];
|
||||
|
||||
/**
|
||||
* Size of the current viewport.
|
||||
*/
|
||||
viewportSize: {
|
||||
x: number;
|
||||
y: number;
|
||||
};
|
||||
|
||||
/**
|
||||
* The Framework. Holds utility methods.
|
||||
*/
|
||||
framework: PhotoSwipe.UIFramework;
|
||||
|
||||
/**
|
||||
* The ui instance constructed by PhotoSwipe.
|
||||
*/
|
||||
ui: PhotoSwipe.UI<T>;
|
||||
|
||||
/**
|
||||
* The background element (with class .pswp__bg).
|
||||
*/
|
||||
bg: HTMLElement;
|
||||
|
||||
/**
|
||||
* The container element (with class .pswp__container).
|
||||
*/
|
||||
container: HTMLElement;
|
||||
|
||||
/**
|
||||
* Options for this PhotoSwipe. This object is a copy of the options parameter passed into the constructor.
|
||||
* Some properties in options are dynamically modifiable.
|
||||
*/
|
||||
options: T;
|
||||
|
||||
/**
|
||||
* Current item index.
|
||||
*/
|
||||
getCurrentIndex(): number;
|
||||
|
||||
/**
|
||||
* Current zoom level.
|
||||
*/
|
||||
getZoomLevel(): number;
|
||||
|
||||
/**
|
||||
* Whether one (or more) pointer is used.
|
||||
*/
|
||||
isDragging(): boolean;
|
||||
|
||||
/**
|
||||
* Whether two (or more) pointers are used.
|
||||
*/
|
||||
isZooming(): boolean;
|
||||
|
||||
/**
|
||||
* true wehn transition between is running (after swipe).
|
||||
*/
|
||||
isMainScrollAnimating(): boolean;
|
||||
|
||||
/**
|
||||
* Initialize and open gallery (you can bind events before this method).
|
||||
*/
|
||||
init(): void;
|
||||
|
||||
/**
|
||||
* Go to slide by index.
|
||||
*/
|
||||
goTo(index: number): void;
|
||||
|
||||
/**
|
||||
* Go to the next slide.
|
||||
*/
|
||||
next(): void;
|
||||
|
||||
/**
|
||||
* Go to the previous slide.
|
||||
*/
|
||||
prev(): void;
|
||||
|
||||
/**
|
||||
* Update gallery size
|
||||
* @param {boolean} `force` If you set it to `true`, size of the gallery will be updated even if viewport size hasn't changed.
|
||||
*/
|
||||
updateSize(force: boolean): void;
|
||||
|
||||
/**
|
||||
* Close gallery. Calls destroy() after closing.
|
||||
*/
|
||||
close(): void;
|
||||
|
||||
/**
|
||||
* Destroy gallery (unbind listeners, free memory). Automatically called after close().
|
||||
*/
|
||||
destroy(): void;
|
||||
|
||||
/**
|
||||
* Zoom in/out the current slide to a specified zoom level, optionally with animation.
|
||||
*
|
||||
* @param {number} `destZoomLevel` Destination scale number. Set to 1 for unzoomed.
|
||||
* Use `pswp.currItem.fitRatio - image` to zoom the image to perfectly fit into the viewport.
|
||||
* @param {object} `centerPoint` The center of the zoom, relative to viewport.
|
||||
* @param {number} `speed` Animation duration in milliseconds. Can be 0.
|
||||
* @param {function} `easingFn` Easing function (optional). Set to false to use default easing.
|
||||
* This method is passed in the percentage that the animation is finished (from 0 to 1) and should return an eased value (which should be 0 at the start and 1 at the end).
|
||||
* @param {function} `updateFn` Function will be called on each update frame (optional).
|
||||
* This method is passed the eased zoom level.
|
||||
*
|
||||
* Example below will 2x zoom to center of slide:
|
||||
*
|
||||
* pswp.zoomTo(2, {x:pswp.viewportSize.x/2,y:pswp.viewportSize.y/2}, 2000, false, function(now) {});
|
||||
*
|
||||
*/
|
||||
zoomTo(destZoomLevel: number,
|
||||
centerPoint: {x: number; y: number},
|
||||
speed: number,
|
||||
easingFn?: (k: number) => number,
|
||||
updateFn?: (now: number) => void): void;
|
||||
|
||||
/**
|
||||
* Apply zoom and pan to the current slide
|
||||
*
|
||||
* @param {number} `zoomLevel`
|
||||
* @param {int} `panX`
|
||||
* @param {int} `panY`
|
||||
*
|
||||
* For example: `pswp.applyZoomPan(1, 0, 0)`
|
||||
* will zoom current image to the original size
|
||||
* and will place it on top left corner.
|
||||
*
|
||||
*/
|
||||
applyZoomPan(zoomLevel: number, panX: number, panY: number): void;
|
||||
|
||||
/**
|
||||
* Call this method after dynamically modifying the current, next, or previous slide in the items array.
|
||||
*/
|
||||
invalidateCurrItems(): void;
|
||||
|
||||
/**
|
||||
* PhotoSwipe uses very simple Event/Messaging system.
|
||||
* It has two methods shout (triggers event) and listen (handles event).
|
||||
* For now there is no method to unbind listener, but all of them are cleared when PhotoSwipe is closed.
|
||||
*/
|
||||
listen(eventName: string, callback: (...args: any[]) => void): void;
|
||||
|
||||
/**
|
||||
* Called before slides change (before the content is changed ,but after navigation). Update UI here.
|
||||
*/
|
||||
listen(eventName: 'beforeChange', callback: () => void): void;
|
||||
/**
|
||||
* Called after slides change (after content has changed).
|
||||
*/
|
||||
listen(eventName: 'afterChange', callback: () => void): void;
|
||||
/**
|
||||
* Called when an image is loaded.
|
||||
*/
|
||||
listen(eventName: 'imageLoadComplete', callback: (index: number, item: PhotoSwipe.Item) => void): void;
|
||||
/**
|
||||
* Called when the viewport size changes.
|
||||
*/
|
||||
listen(eventName: 'resize', callback: () => void): void;
|
||||
/**
|
||||
* Triggers when PhotoSwipe reads slide object data, which happens before content is set, or before lazy-loading is initiated.
|
||||
* Use it to dynamically change properties of the slide object.
|
||||
*/
|
||||
listen(eventName: 'gettingData', callback: (index: number, item: PhotoSwipe.Item) => void): void;
|
||||
/**
|
||||
* Called when mouse is first used (triggers only once).
|
||||
*/
|
||||
listen(eventName: 'mouseUsed', callback: () => void): void;
|
||||
/**
|
||||
* Called when opening zoom in animation starting.
|
||||
*/
|
||||
listen(eventName: 'initialZoomIn', callback: () => void): void;
|
||||
/**
|
||||
* Called when opening zoom in animation finished.
|
||||
*/
|
||||
listen(eventName: 'initialZoomInEnd', callback: () => void): void;
|
||||
/**
|
||||
* Called when closing zoom out animation started.
|
||||
*/
|
||||
listen(eventName: 'initialZoomOut', callback: () => void): void;
|
||||
/**
|
||||
* Called when closing zoom out animation finished.
|
||||
*/
|
||||
listen(eventName: 'initialZoomOutEnd', callback: () => void): void;
|
||||
/**
|
||||
* Allows overriding vertical margin for individual items.
|
||||
*
|
||||
* Example:
|
||||
*
|
||||
* pswp.listen('parseVerticalMargin', function(item) {
|
||||
* var gap = item.vGap;
|
||||
*
|
||||
* gap.top = 50; // There will be 50px gap from top of viewport
|
||||
* gap.bottom = 100; // and 100px gap from the bottom
|
||||
* });
|
||||
*/
|
||||
listen(eventName: 'parseVerticalMargin', callback: (item: PhotoSwipe.Item) => void): void;
|
||||
/**
|
||||
* Called when the gallery starts closing.
|
||||
*/
|
||||
listen(eventName: 'close', callback: () => void): void;
|
||||
/**
|
||||
* Gallery unbinds events (triggers before closing animation).
|
||||
*/
|
||||
listen(eventName: 'unbindEvents', callback: () => void): void;
|
||||
/**
|
||||
* Called after the gallery is closed and the closing animation finishes.
|
||||
* Clean up your stuff here.
|
||||
*/
|
||||
listen(eventName: 'destroy', callback: () => void): void;
|
||||
/**
|
||||
* Allow to call preventDefault on down and up events.
|
||||
*/
|
||||
listen(eventName: 'preventDragEvent', callback: (e: MouseEvent, isDown: boolean, preventObj: {prevent: boolean}) => void): void;
|
||||
|
||||
/**
|
||||
* Triggers eventName event with args passed through to listeners.
|
||||
*/
|
||||
shout(eventName: string, ...args: any[]): void;
|
||||
}
|
||||
|
||||
/**
|
||||
* Default UI class for PhotoSwipe. This class is largely undocumented and doesn't seem to have a public facing API.
|
||||
*/
|
||||
declare class PhotoSwipeUI_Default implements PhotoSwipe.UI<PhotoSwipeUI_Default.Options> {
|
||||
constructor(pswp: PhotoSwipe<PhotoSwipeUI_Default.Options>, framework: PhotoSwipe.UIFramework);
|
||||
init(): void;
|
||||
|
||||
/**
|
||||
* Call this method to update the UI after the items array has been modified in the original PhotoSwipe element.
|
||||
*/
|
||||
update(): void;
|
||||
}
|
||||
|
||||
declare module PhotoSwipeUI_Default {
|
||||
/**
|
||||
* Options for the PhotoSwipe Default UI. Derived from http://photoswipe.com/documentation/options.html
|
||||
*/
|
||||
interface Options extends PhotoSwipe.Options {
|
||||
/**
|
||||
* Size of top & bottom bars in pixels. "bottom" parameter can be 'auto' (will calculate height of caption).
|
||||
* Option applies only when mouse is used, or when width of screen is more than 1200px.
|
||||
* Also look at `parseVerticalMargin` event.
|
||||
*
|
||||
* Default {top: 44, bottom: "auto"}.
|
||||
*/
|
||||
barsSize?: { top: number; bottom: number | string };
|
||||
|
||||
/**
|
||||
* Adds class pswp__ui--idle to pswp__ui element when mouse isn't moving for timeToIdle milliseconds.
|
||||
*
|
||||
* Default 4000.
|
||||
*/
|
||||
timeToIdle?: number;
|
||||
|
||||
/**
|
||||
* Adds class pswp__ui--idle to pswp__ui element when mouse leaves the window for timeToIdleOutside milliseconds.
|
||||
*
|
||||
* Default 1000.
|
||||
*/
|
||||
timeToIdleOutside?: number;
|
||||
|
||||
/**
|
||||
* Delay in milliseconds until loading indicator is displayed.
|
||||
*
|
||||
* Default 1000.
|
||||
*/
|
||||
loadingIndicatorDelay?: number;
|
||||
|
||||
/**
|
||||
* Function to build caption markup. The function takes three parameters:
|
||||
*
|
||||
* item - slide object
|
||||
* captionEl - caption DOM element
|
||||
* isFake - true when content is added to fake caption container
|
||||
* (used to get size of next or previous caption)
|
||||
*
|
||||
* Return whether to show the caption or not.
|
||||
*
|
||||
* Default is:
|
||||
*
|
||||
* function(item, captionEl, isFake) {
|
||||
* if(!item.title) {
|
||||
* captionEl.children[0].innerHTML = '';
|
||||
* return false;
|
||||
* }
|
||||
* captionEl.children[0].innerHTML = item.title;
|
||||
* return true;
|
||||
* }
|
||||
*
|
||||
*/
|
||||
addCaptionHTMLFn?: (item: Item, captionEl: HTMLElement, isFake: boolean) => boolean;
|
||||
|
||||
/**
|
||||
* Whether to show the close button.
|
||||
*
|
||||
* Default true.
|
||||
*/
|
||||
closeEl?: boolean;
|
||||
|
||||
/**
|
||||
* Whether to show the caption.
|
||||
*
|
||||
* Default true.
|
||||
*/
|
||||
captionEl?: boolean;
|
||||
|
||||
/**
|
||||
* Whether to show the fullscreen button.
|
||||
*
|
||||
* Default true.
|
||||
*/
|
||||
fullscreenEl?: boolean;
|
||||
|
||||
/**
|
||||
* Whether to show the zoom button.
|
||||
*
|
||||
* Default true.
|
||||
*/
|
||||
zoomEl?: boolean;
|
||||
|
||||
/**
|
||||
* Whether to show the share button.
|
||||
*
|
||||
* Default true.
|
||||
*/
|
||||
shareEl?: boolean;
|
||||
|
||||
/**
|
||||
* Whether to show the current image's index in the gallery (located in top-left corner by default).
|
||||
*
|
||||
* Default true.
|
||||
*/
|
||||
counterEl?: boolean;
|
||||
|
||||
/**
|
||||
* Whether to show the left/right directional arrows.
|
||||
*
|
||||
* Default true.
|
||||
*/
|
||||
arrowEl?: boolean;
|
||||
|
||||
/**
|
||||
* Whether to show the preloader element.
|
||||
*
|
||||
* Default true.
|
||||
*/
|
||||
preloaderEl?: boolean;
|
||||
|
||||
/**
|
||||
* Tap on sliding area should close gallery.
|
||||
*
|
||||
* Default false.
|
||||
*/
|
||||
tapToClose?: boolean;
|
||||
|
||||
/**
|
||||
* Tap should toggle visibility of controls.
|
||||
*
|
||||
* Default true.
|
||||
*/
|
||||
tapToToggleControls?: boolean;
|
||||
|
||||
/**
|
||||
* Mouse click on image should close the gallery, only when image is smaller than size of the viewport.
|
||||
*
|
||||
* Default true.
|
||||
*/
|
||||
clickToCloseNonZoomable?: boolean;
|
||||
|
||||
/**
|
||||
* Element classes that should close PhotoSwipe when clicked on.
|
||||
* In HTML markup, class should always start with "pswp__", e.g.: "pswp__item", "pswp__caption".
|
||||
*
|
||||
* "pswp__ui--over-close" class will be added to root element of UI when mouse is over one of these elements
|
||||
* By default it's used to highlight the close button.
|
||||
*
|
||||
* Default ['item', 'caption', 'zoom-wrap', 'ui', 'top-bar'].
|
||||
*/
|
||||
closeElClasses?: string[];
|
||||
|
||||
/**
|
||||
* Separator for "1 of X" counter.
|
||||
*
|
||||
* Default ' / '.
|
||||
*/
|
||||
indexIndicatorSep?: string;
|
||||
|
||||
/**
|
||||
* The entries that show up when you click the Share button.
|
||||
*
|
||||
* Default is:
|
||||
*
|
||||
* [
|
||||
* {id:'facebook', label:'Share on Facebook', url:'https://www.facebook.com/sharer/sharer.php?u='},
|
||||
* {id:'twitter', label:'Tweet', url:'https://twitter.com/intent/tweet?text=&url='},
|
||||
* {id:'pinterest', label:'Pin it', url:'http://www.pinterest.com/pin/create/button/?url=&media=&description='},
|
||||
* {id:'download', label:'Download image', url:'', download:true}
|
||||
* ]
|
||||
*
|
||||
*/
|
||||
shareButtons?: ShareButtonData[];
|
||||
|
||||
/**
|
||||
* A callback that should return the URL for the currently selected image. The callback is passed
|
||||
* the shareButtonData entry that was clicked on.
|
||||
*
|
||||
* Default is:
|
||||
*
|
||||
* function( shareButtonData ) {
|
||||
* // `shareButtonData` - object from shareButtons array
|
||||
* //
|
||||
* // `pswp` is the gallery instance object,
|
||||
* // you should define it by yourself
|
||||
* //
|
||||
* return pswp.currItem.src || '';
|
||||
* }
|
||||
*
|
||||
*/
|
||||
getImageURLForShare?: (shareButtonData: ShareButtonData) => string;
|
||||
|
||||
/**
|
||||
* A callback that should return the "Page" associated with the selected image. (e.g. on Facebook, the shared
|
||||
* content will be associated with the returned page). The callback is passed the shareButtonData entry that
|
||||
* was clicked on.
|
||||
*
|
||||
* Default is:
|
||||
*
|
||||
* function( shareButtonData ) {
|
||||
* return window.location.href;
|
||||
* }
|
||||
*
|
||||
*/
|
||||
getPageURLForShare?: (shareButtonData: ShareButtonData) => string;
|
||||
|
||||
/**
|
||||
* A callback that should return the Text associated with the selected image. The callback is passed
|
||||
* the shareButtonData entry that was clicked on.
|
||||
*
|
||||
* Default is:
|
||||
*
|
||||
* function( shareButtonData ) {
|
||||
* return pswp.currItem.title || '';
|
||||
* }
|
||||
*
|
||||
*/
|
||||
getTextForShare?: (shareButtonData: ShareButtonData) => string;
|
||||
|
||||
/**
|
||||
* A final output callback that you can use to further modify the share button's HTML. The callback is passed
|
||||
* (1) the shareButtonData entry being generated, and (2) the default HTML generated by PhotoSwipUI_Default.
|
||||
*
|
||||
* Default is:
|
||||
*
|
||||
* function(shareButtonData, shareButtonOut) {
|
||||
* return shareButtonOut;
|
||||
* }
|
||||
*
|
||||
*/
|
||||
parseShareButtonOut?: (shareButtonData: ShareButtonData, shareButtonOut: string) => string;
|
||||
}
|
||||
|
||||
interface ShareButtonData {
|
||||
/**
|
||||
* An id for this share button entry. The share element associated with this entry will be classed with
|
||||
* 'pswp__share--' + id
|
||||
*/
|
||||
id: string;
|
||||
|
||||
/**
|
||||
* The user-visible text to display for this entry.
|
||||
*/
|
||||
label: string;
|
||||
|
||||
/**
|
||||
* The full sharing endpoint URL for this social media site (e.g. Facebook's is facebook.com/sharer/sharer.php), with URL parameters.
|
||||
* PhotoSwipUI_Default treats the URL specially. In the url string, any of the following text is treated specially:
|
||||
* '{{url}}', '{{image_url}}, '{{raw_image_url}}, '{{text}}'. PhotoSwipeUI_Default will replace each of them with the following value:
|
||||
*
|
||||
* {{url}} becomes the (URIEncoded) url to the current "Page" (as returned by getPageURLForShare).
|
||||
* {{image_url}} becomes the (URIEncoded) url of the selected image (as returned by getImageURLForShare).
|
||||
* {{raw_image_url}} becomes the raw url of the selected image (as returned by getImageURLForShare).
|
||||
* {{text}} becomes the (URIEncoded) share text of the selected image (as returned by getTextForShare).
|
||||
*/
|
||||
url: string;
|
||||
|
||||
/**
|
||||
* Whether this link is a direct download button or not.
|
||||
*
|
||||
* Default false.
|
||||
*/
|
||||
download?: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* Extra properties that the Default UI accepts.
|
||||
*/
|
||||
interface Item extends PhotoSwipe.Item {
|
||||
/**
|
||||
* The caption for this item.
|
||||
*/
|
||||
title?: string;
|
||||
}
|
||||
}
|
||||
@@ -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 {
|
||||
|
||||
4
polymer/polymer.app-router.d.ts
vendored
4
polymer/polymer.app-router.d.ts
vendored
@@ -3,9 +3,11 @@
|
||||
// Definitions by: Louis Grignon <https://github.com/lgrignon>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
///<reference path="polymer.d.ts"/>
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
4
polymer/polymer.core-drawer-panel.d.ts
vendored
4
polymer/polymer.core-drawer-panel.d.ts
vendored
@@ -3,9 +3,11 @@
|
||||
// Definitions by: Louis Grignon <https://github.com/lgrignon>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
///<reference path="polymer.d.ts"/>
|
||||
|
||||
declare module PolymerComponents {
|
||||
export module Core {
|
||||
export interface DrawerPanel extends HTMLElement {
|
||||
export interface DrawerPanel extends PolymerElement, HTMLElement {
|
||||
/**
|
||||
* Width of the drawer panel. default: '256px'
|
||||
*/
|
||||
|
||||
92
polymer/polymer.core-overlay.d.ts
vendored
Normal file
92
polymer/polymer.core-overlay.d.ts
vendored
Normal file
@@ -0,0 +1,92 @@
|
||||
// Type definitions for polymer's paper-toast
|
||||
// Project: https://github.com/Polymer/core-selector
|
||||
// Definitions by: Louis Grignon <https://github.com/lgrignon>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
///<reference path="polymer.d.ts"/>
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
20
polymer/polymer.core-selector.d.ts
vendored
Normal file
20
polymer/polymer.core-selector.d.ts
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
// Type definitions for polymer's paper-toast
|
||||
// Project: https://github.com/Polymer/core-selector
|
||||
// Definitions by: Louis Grignon <https://github.com/lgrignon>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
///<reference path="polymer.d.ts"/>
|
||||
|
||||
declare module PolymerComponents {
|
||||
export module Core {
|
||||
export interface Selector extends PolymerElement, HTMLElement {
|
||||
}
|
||||
|
||||
export interface SelectorOnSelectEvent extends Event {
|
||||
detail: {
|
||||
item: HTMLElement;
|
||||
isSelected: boolean;
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
28
polymer/polymer.d.ts
vendored
28
polymer/polymer.d.ts
vendored
@@ -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;
|
||||
|
||||
30
polymer/polymer.paper-dialog.d.ts
vendored
Normal file
30
polymer/polymer.paper-dialog.d.ts
vendored
Normal file
@@ -0,0 +1,30 @@
|
||||
// Type definitions for polymer's paper-dialog
|
||||
// Project: https://github.com/Polymer/paper-dialog
|
||||
// Definitions by: Louis Grignon <https://github.com/lgrignon>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
///<reference path="polymer.d.ts"/>
|
||||
///<reference path="polymer.core-overlay.d.ts"/>
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
4
polymer/polymer.paper-toast.d.ts
vendored
4
polymer/polymer.paper-toast.d.ts
vendored
@@ -3,9 +3,11 @@
|
||||
// Definitions by: Louis Grignon <https://github.com/lgrignon>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
///<reference path="polymer.d.ts"/>
|
||||
|
||||
declare module PolymerComponents {
|
||||
export module Paper {
|
||||
export interface Toast extends HTMLElement {
|
||||
export interface Toast extends PolymerElement, HTMLElement {
|
||||
/**
|
||||
* The text shows in a toast.
|
||||
* default: ''
|
||||
|
||||
8
slickgrid/slick.autotooltips-tests.ts
Normal file
8
slickgrid/slick.autotooltips-tests.ts
Normal file
@@ -0,0 +1,8 @@
|
||||
/// <reference path="./slick.autotooltips.d.ts" />
|
||||
|
||||
var grid = new Slick.Grid("#myGrid", [], [], {});
|
||||
grid.registerPlugin(new Slick.AutoTooltips({
|
||||
enableForCells: true,
|
||||
enableForHeaderCells: true,
|
||||
maxToolTipLength: 100
|
||||
}));
|
||||
35
slickgrid/slick.autotooltips.d.ts
vendored
Normal file
35
slickgrid/slick.autotooltips.d.ts
vendored
Normal file
@@ -0,0 +1,35 @@
|
||||
// Type definitions for SlickGrid AutoToolTips Plugin 2.1.0
|
||||
// Project: https://github.com/mleibman/SlickGrid
|
||||
// Definitions by: Ryo Iwamoto <https://github.com/ryiwamoto>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/// <reference path="SlickGrid.d.ts" />
|
||||
|
||||
declare module Slick {
|
||||
export interface SlickGridAutoTooltipsOption extends PluginOptions {
|
||||
/**
|
||||
* Enable tooltip for grid cells
|
||||
* @default true
|
||||
*/
|
||||
enableForCells?: boolean;
|
||||
|
||||
/**
|
||||
* Enable tooltip for header cells
|
||||
* @default false
|
||||
*/
|
||||
enableForHeaderCells?: boolean;
|
||||
|
||||
/**
|
||||
* The maximum length for a tooltip
|
||||
* @default null
|
||||
*/
|
||||
maxToolTipLength?: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* AutoTooltips plugin to show/hide tooltips when columns are too narrow to fit content.
|
||||
*/
|
||||
export class AutoTooltips extends Plugin<Slick.SlickData> {
|
||||
constructor(option?: SlickGridAutoTooltipsOption);
|
||||
}
|
||||
}
|
||||
37
squirejs/squirejs-tests.ts
Normal file
37
squirejs/squirejs-tests.ts
Normal file
@@ -0,0 +1,37 @@
|
||||
/// <reference path="squirejs.d.ts" />
|
||||
|
||||
import Squire = require('Squire');
|
||||
|
||||
// Default Configuration
|
||||
var injector = new Squire();
|
||||
|
||||
// Different Context
|
||||
injector = new Squire('other-requirejs-context');
|
||||
|
||||
// require(Array dependencies, Function callback, Function errback)
|
||||
injector.require(['a'], function(A: any) {}, function(err: any) {});
|
||||
|
||||
// mock(String name | Object(name: mock), Object mock)
|
||||
injector.mock("a", {});
|
||||
injector.mock({a: {}});
|
||||
|
||||
// store(String name | Array names)
|
||||
injector.store('a');
|
||||
injector.store(['a', 'b']);
|
||||
|
||||
// clean(Optional (String name | Array names))
|
||||
injector.clean('a');
|
||||
injector.clean(['a', 'b']);
|
||||
injector.clean();
|
||||
|
||||
// remove()
|
||||
injector.remove();
|
||||
|
||||
// run()
|
||||
injector.run(['a'], function test(a: any) {})(function done() {});
|
||||
|
||||
// Squire.Helpers.returns(Any what)
|
||||
Squire.Helpers.returns({});
|
||||
|
||||
// Squire.Helpers.constructs(Any what)
|
||||
Squire.Helpers.constructs({});
|
||||
28
squirejs/squirejs.d.ts
vendored
Normal file
28
squirejs/squirejs.d.ts
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
// Type definitions for Squire 0.2.1
|
||||
// Project: https://github.com/iammerrick/Squire.js
|
||||
// Definitions by: Bradley Ayers <https://github.com/bradleyayers>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
declare module 'Squire' {
|
||||
class Squire {
|
||||
constructor();
|
||||
constructor(context: string);
|
||||
mock(name: string, mock: any): Squire;
|
||||
mock(mocks: {[name: string]: any}): Squire;
|
||||
require(dependencies: string[], callback: Function, errback: Function): Squire;
|
||||
store(name: string | string[]): Squire;
|
||||
clean(): Squire;
|
||||
clean(name: string | string[]): Squire;
|
||||
remove(): String;
|
||||
run(dependencies: string[], test: Function): (done: Function) => void;
|
||||
}
|
||||
|
||||
module Squire {
|
||||
module Helpers {
|
||||
export function returns<T>(what: T): () => T;
|
||||
export function constructs<T>(what: T): () => (() => T);
|
||||
}
|
||||
}
|
||||
|
||||
export = Squire;
|
||||
}
|
||||
71
switchery/switchery-tests.ts
Normal file
71
switchery/switchery-tests.ts
Normal file
@@ -0,0 +1,71 @@
|
||||
/// <reference path="switchery.d.ts"/>
|
||||
|
||||
//
|
||||
// Examples from https://github.com/abpetkov/switchery
|
||||
//
|
||||
|
||||
function multipleSwitches() {
|
||||
|
||||
var elems = Array.prototype.slice.call( document.querySelectorAll( '.js-switch' ) );
|
||||
|
||||
elems.forEach( (html: Element) => {
|
||||
var switchery = new Switchery( html );
|
||||
} );
|
||||
}
|
||||
|
||||
|
||||
function disabledSwitch() {
|
||||
|
||||
var elem = document.querySelector( '.js-switch' )
|
||||
|
||||
//inactive switch
|
||||
var switchery = new Switchery( elem, {disabled: true} );
|
||||
|
||||
//Customize the default opacity of the disabled switch, using the disabledOpacity option.
|
||||
switchery = new Switchery( elem, {disabled: true, disabledOpacity: 0.75} );
|
||||
}
|
||||
|
||||
|
||||
function coloredSwitch() {
|
||||
|
||||
var elem = document.querySelector( '.js-switch' )
|
||||
|
||||
//You can change the primary color of the switch to fit your design perfectly:
|
||||
var switchery = new Switchery( elem, {color: '#41b7f1'} );
|
||||
|
||||
//Or the secondary color, which will change the switch background color and border color:
|
||||
switchery = new Switchery( elem, {secondaryColor: '#bbf0f0'} );
|
||||
|
||||
//Since version 0.6.3, you're even allowed to change the jack color from JS, as follows:
|
||||
switchery = new Switchery( elem, {jackColor: '#fffc00'} );
|
||||
}
|
||||
|
||||
function switchSizes() {
|
||||
|
||||
var elem = document.querySelector( '.js-switch' )
|
||||
|
||||
var switchery = new Switchery( elem, {size: 'small'} );
|
||||
switchery = new Switchery( elem, {size: 'large'} );
|
||||
}
|
||||
|
||||
function checkingState() {
|
||||
|
||||
var elem = document.querySelector( '.js-switch' )
|
||||
|
||||
//On click:
|
||||
|
||||
var clickCheckbox = <HTMLInputElement> document.querySelector( '.js-check-click' )
|
||||
var clickButton = <HTMLInputElement> document.querySelector( '.js-check-click-button' );
|
||||
|
||||
clickButton.addEventListener( 'click', () => {
|
||||
alert( clickCheckbox.checked );
|
||||
} );
|
||||
|
||||
//On change:
|
||||
|
||||
var changeCheckbox = <HTMLInputElement> document.querySelector( '.js-check-change' );
|
||||
|
||||
changeCheckbox.onchange = function () {
|
||||
alert( changeCheckbox.checked );
|
||||
};
|
||||
}
|
||||
64
switchery/switchery.d.ts
vendored
Normal file
64
switchery/switchery.d.ts
vendored
Normal file
@@ -0,0 +1,64 @@
|
||||
// Type definitions for switchery 0.7.0
|
||||
// Project: https://github.com/abpetkov/switchery
|
||||
// Definitions by: Bruno Grieder <https://github.com/bgrieder>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
declare module Switchery {
|
||||
|
||||
export interface Options {
|
||||
|
||||
/**
|
||||
* color of the switch element (HEX or RGB value)
|
||||
* @default '#64bd63'
|
||||
*/
|
||||
color? : string;
|
||||
/**
|
||||
* secondary color for background color and border, when the switch is off
|
||||
* @default '#dfdfdf'
|
||||
*/
|
||||
secondaryColor? : string;
|
||||
/**
|
||||
* color of the jack/handle element
|
||||
* @default '#fff'
|
||||
*/
|
||||
jackColor? : string;
|
||||
/**
|
||||
* class name for the switch element (by default styled in switchery.css)
|
||||
* @default 'switchery'
|
||||
*/
|
||||
className? : string;
|
||||
/**
|
||||
* enable or disable click events and changing the state of the switch (boolean value)
|
||||
* @default false
|
||||
*/
|
||||
disabled? : boolean;
|
||||
/**
|
||||
* opacity of the switch when it's disabled (0 to 1)
|
||||
* @default 0.5
|
||||
*/
|
||||
disabledOpacity? : number;
|
||||
/**
|
||||
* length of time that the transition will take, ex. '0.4s', '1s', '2.2s' (Note: transition speed of the handle is twice shorter)
|
||||
* @default '0.4s'
|
||||
*/
|
||||
speed? : string;
|
||||
/**
|
||||
* size of the switch element (small or large)
|
||||
* @default 'default'
|
||||
*/
|
||||
size? : string;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
declare class Switchery {
|
||||
|
||||
constructor(node: Node, options?: Switchery.Options);
|
||||
|
||||
}
|
||||
|
||||
declare module "switchery" {
|
||||
|
||||
export = Switchery
|
||||
}
|
||||
@@ -26,7 +26,7 @@ function test_window() {
|
||||
}
|
||||
|
||||
function test_tableview() {
|
||||
var data = [];
|
||||
var data : Ti.UI.View[] = [];
|
||||
for (var i = 0; i < 10; i++) {
|
||||
var row = Ti.UI.createTableViewRow();
|
||||
var label = Ti.UI.createLabel({
|
||||
@@ -73,12 +73,12 @@ function test_network() {
|
||||
var url = "http://www.appcelerator.com";
|
||||
var client = Ti.Network.createHTTPClient({
|
||||
// function called when the response data is available
|
||||
onload : function(e) {
|
||||
onload : function(e: SuccessResponse) {
|
||||
alert(this.responseText);
|
||||
},
|
||||
// function called when an error occurs, including a timeout
|
||||
onerror : function(e) {
|
||||
alert(e.rror);
|
||||
onerror : function(e: FailureResponse) {
|
||||
alert(e.error);
|
||||
},
|
||||
timeout : 5000 // in milliseconds
|
||||
});
|
||||
|
||||
2729
titanium/titanium.d.ts
vendored
2729
titanium/titanium.d.ts
vendored
File diff suppressed because it is too large
Load Diff
45
vex-js/vex-js.d.ts
vendored
Normal file
45
vex-js/vex-js.d.ts
vendored
Normal file
@@ -0,0 +1,45 @@
|
||||
// Type definitions for Vex v2.3.2
|
||||
// Project: https://github.com/HubSpot/vex
|
||||
// Definitions by: Greg Cohan <https://github.com/gdcohan>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
///<reference path="../jquery/jquery.d.ts" />
|
||||
|
||||
declare module vex {
|
||||
|
||||
interface ICSSAttributes {
|
||||
[property: string]: string | number;
|
||||
}
|
||||
|
||||
interface IVexOptions {
|
||||
afterClose?: (() => void);
|
||||
afterOpen?: ((vexContent: JQuery) => void);
|
||||
content?: string;
|
||||
showCloseButton?: boolean;
|
||||
escapeButtonCloses?: boolean;
|
||||
overlayClosesOnClick?: boolean;
|
||||
appendLocation?: HTMLElement | JQuery | string;
|
||||
className?: string;
|
||||
css?: ICSSAttributes;
|
||||
overlayClassName?: string;
|
||||
overlayCSS?: ICSSAttributes;
|
||||
contentClassName?: string;
|
||||
contentCSS?: ICSSAttributes;
|
||||
closeClassName?: string;
|
||||
closeCSS?: ICSSAttributes;
|
||||
}
|
||||
|
||||
interface Vex {
|
||||
open(options: IVexOptions): JQuery;
|
||||
close(id?: number): boolean;
|
||||
closeAll(): boolean;
|
||||
closeByID(id: number): boolean;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
declare module "vex" {
|
||||
export = vex;
|
||||
}
|
||||
|
||||
declare var vex: vex.Vex;
|
||||
26
vex-js/vex-tests.ts
Normal file
26
vex-js/vex-tests.ts
Normal file
@@ -0,0 +1,26 @@
|
||||
///<reference path="../jquery/jquery.d.ts" />
|
||||
///<reference path="vex-js.d.ts" />
|
||||
|
||||
var vexContent = vex.open({
|
||||
afterClose: (() => null),
|
||||
afterOpen: ((vexContent: JQuery) => null),
|
||||
content: "<div><p>Modal</p></div>",
|
||||
showCloseButton: false,
|
||||
escapeButtonCloses: true,
|
||||
overlayClosesOnClick: false,
|
||||
appendLocation: "body",
|
||||
className: "vex-dialog",
|
||||
css: {background: "blue"},
|
||||
overlayClassName: "vex-overlay",
|
||||
overlayCSS: {border: 0},
|
||||
contentClassName: "vex-content",
|
||||
contentCSS: {margin: "0 auto"},
|
||||
closeClassName: "vex-close",
|
||||
closeCSS: {margin: 0}
|
||||
});
|
||||
|
||||
var id = vexContent.data().vex.id;
|
||||
|
||||
vex.close(id);
|
||||
vex.closeByID(id);
|
||||
vex.closeAll();
|
||||
13
yamljs/yamljs-tests.ts
Normal file
13
yamljs/yamljs-tests.ts
Normal file
@@ -0,0 +1,13 @@
|
||||
/// <reference path="yamljs.d.ts" />
|
||||
|
||||
import yamljs = require('yamljs');
|
||||
|
||||
yamljs.load('yaml-testfile.yml');
|
||||
|
||||
yamljs.parse('this_is_no_ymlstring');
|
||||
|
||||
yamljs.stringify({ a : 'val', b : { ba : 123, bb : 'nothing' }});
|
||||
|
||||
yamljs.stringify({ a : 'val', b : { ba : 123, bb : 'nothing' }}, 1);
|
||||
|
||||
yamljs.stringify({ a : 'val', b : { ba : 123, bb : 'nothing' }}, 1, 2);
|
||||
14
yamljs/yamljs.d.ts
vendored
Normal file
14
yamljs/yamljs.d.ts
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
// Type definitions for yamljs 0.2.1
|
||||
// Project: https://github.com/jeremyfa/yaml.js
|
||||
// Definitions by: Tim Jonischkat <http://www.tim-jonischkat.de>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
declare module "yamljs" {
|
||||
|
||||
export function load(path : string) : any;
|
||||
|
||||
export function stringify(nativeObject : any, inline? : number, spaces? : number) : string;
|
||||
|
||||
export function parse(yamlString : string) : any;
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user