Merge branch 'master' into gulp-cached

This commit is contained in:
Thomas Corbière
2015-08-15 11:18:46 +02:00
13 changed files with 13989 additions and 31 deletions
+1
View File
@@ -122,6 +122,7 @@ declare module angular.material {
theme(theme: string): T;
hideDelay(delay: number): T;
position(position: string): T;
parent(parent?: string|Element|JQuery): T; // default: root node
}
interface ISimpleToastPreset extends IToastPreset<ISimpleToastPreset> {
+25
View File
@@ -341,6 +341,31 @@ function(data: any) {
error.reject();
});
// Timeout:
var formData2 = $.serialize($('form')[0]);
fetch('../controllers/php-post.php', {
method: 'post',
headers: {
"Content-type": "application/x-www-form-urlencoded; charset=UTF-8"
},
body: formData,
// Set timeout:
timeout: 10000
})
.then($.json)
.then(function <postData>(data: any): any {
if (data.email_check == "valid") {
$("#message_ajax").html("<div class='successMessage'>" + data.email + " is a valid e-mail address. Thank you, " + data.name + ".</div>");
$("#message_ajax").append('<p>' + data.msg + '</p>');
} else {
$("#message_ajax").html("<div class='errorMessage'>Sorry " + data.name + ", " + data.email + " is NOT a valid e-mail address. Try again.</div>");
}
})
// Catch timeout:
.catch(function(error) {
console.log(error);
});
// $.jsonp:
$.jsonp('https://api.github.com/users/rbiggs/repos?name=chipper', {timeout: 10000})
.then($.json)
+10 -9
View File
@@ -1,4 +1,4 @@
// Type definitions for chocolatechip v4.0.0
// Type definitions for chocolatechip v4.0.1
// Project: https://github.com/chocolatechipui/ChocolateChipJS
// Definitions by: Robert Biggs <http://chocolatechip-ui.com>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
@@ -1280,7 +1280,7 @@ declare type OpenEndedDictionary = Object;
* Interface for fetch API.
*
* @param input A string representing a valid url.
* @param init An object literal of key value pairs to set method, headers, body, credentials or cache.
* @param init An object literal of key value pairs to set method, headers, body, credentials, cache or timeout.
* @return Promise.
*/
@@ -1301,13 +1301,14 @@ interface fetch {
include: string;
};
cache?: {
default: string;
"no-store": string;
reload: string;
"no-cache": string;
"force-cache": string;
"only-if-cached": string;
}
default: string;
"no-store": string;
reload: string;
"no-cache": string;
"force-cache": string;
"only-if-cached": string;
};
timeout?: number;
}): Promise<any>;
}
+5
View File
@@ -26,6 +26,11 @@ var tsProject = typescript.createProject({
noExternalResolve: true
});
var mainTscProject = typescript.createProject("tsconfig.json", {
target: "es6"
});
gulp.task('scripts', function() {
var tsResult = gulp.src('lib/*.ts')
.pipe(typescript(tsProject));
+1
View File
@@ -10,6 +10,7 @@ declare module "gulp-typescript" {
module GulpTypescript {
export function createProject(params: Params): Params;
export function createProject(file: string, params: Params): Params;
export function filter(filters: FilterSettings): CompilationStream;
interface Params {
declarationFiles?: boolean;
+90
View File
@@ -0,0 +1,90 @@
/// <reference path="imagesLoaded.d.ts" />
function test_ctor() {
// element
imagesLoaded(document.querySelector('#container'), function(instance) {
console.log('all images are loaded');
});
// selector string
imagesLoaded('#container', function() { console.log('all images are loaded'); });
// multiple elements
var posts = document.querySelectorAll('.post');
imagesLoaded(posts, function() { console.log('all images are loaded'); });
}
function test_events_basic() {
var elem = document.querySelector('body');
var imgLoad = imagesLoaded(elem);
function onAlways(instance: ImagesLoaded.ImagesLoaded) {
console.log('all images are loaded');
}
// bind with .on()
imgLoad.on('always', onAlways);
// unbind with .off()
imgLoad.off('always', onAlways);
}
function test_events_full() {
var elem = document.querySelector('body');
var imgLoad = imagesLoaded(elem);
// always
imgLoad.on('always', function(instance) {
console.log('ALWAYS - all images have been loaded');
});
// done
imgLoad.on('done', function(instance) {
console.log('DONE - all images have been successfully loaded');
});
// fail
imgLoad.on('fail', function(instance) {
console.log('FAIL - all images loaded, at least one is broken');
});
// progress
imgLoad.on('progress', function(instance, image) {
var result = image.isLoaded ? 'loaded' : 'broken';
console.log('image is ' + result + ' for ' + image.img.src);
});
}
function test_always_images() {
var imgLoad = imagesLoaded('#container');
imgLoad.on('always', function() {
console.log(imgLoad.images.length + ' images loaded');
// detect which image is broken
for (var i = 0, len = imgLoad.images.length; i < len; i++) {
var image = imgLoad.images[i];
var result = image.isLoaded ? 'loaded' : 'broken';
console.log('image is ' + result + ' for ' + image.img.src);
}
});
}
function test_jquery() {
$('#container').imagesLoaded(function() {
console.log('images have loaded');
});
}
function test_jquery_deferred() {
$('#container').imagesLoaded()
.always(function(instance) {
console.log('all images loaded');
})
.done(function(instance) {
console.log('all images successfully loaded');
})
.fail(function() {
console.log('all images loaded, at least one is broken');
})
.progress(function(instance, image) {
var result = image.isLoaded ? 'loaded' : 'broken';
console.log('image is ' + result + ' for ' + image.img.src);
});
}
+53
View File
@@ -0,0 +1,53 @@
// Type definitions for imagesLoaded 3.1.8+
// Project: https://github.com/desandro/imagesloaded
// Definitions by: Chris Charabaruk <http://github.com/coldacid>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
///<reference path="../jquery/jquery.d.ts" />
declare module ImagesLoaded {
type ElementSelector = Element | NodeList | Array<Element> | string;
/** interface for an image currently loading or completed */
interface LoadingImage {
img: HTMLImageElement;
isLoaded: boolean;
}
interface ImagesLoadedCallback {
(instance?: ImagesLoaded): void;
}
interface ImagesLoadedListener {
(instance: ImagesLoaded, image?: LoadingImage): void;
}
interface ImagesLoaded {
new (elem: ElementSelector, callback: ImagesLoadedCallback): ImagesLoaded;
images: Array<LoadingImage>;
// event listeners
on(event: string, listener: ImagesLoadedListener): void;
off(event: string, listener: ImagesLoadedListener): void;
}
interface ImagesLoadedConstructor {
/**
* Creates a new ImagesLoaded object with the provided callback
* @param elem Element, NodeList, Element array, or selector string for images to watch
* @param callback function triggered after all images have been loaded
*/
(elem: ElementSelector, callback?: ImagesLoadedCallback): ImagesLoaded;
}
}
declare var imagesLoaded: ImagesLoaded.ImagesLoadedConstructor;
declare module 'imagesloaded' {
export = imagesLoaded;
}
interface JQuery {
imagesLoaded(callback?: ImagesLoaded.ImagesLoadedCallback): JQueryDeferred<ImagesLoaded.ImagesLoaded>;
}
+27 -2
View File
@@ -1071,6 +1071,10 @@ result = <boolean>_({}).isMatch({});
result = <boolean>_({}).isMatch({}, testIsMatchCustiomizerFn);
result = <boolean>_({}).isMatch({}, testIsMatchCustiomizerFn, {});
// _.isNative
result = <boolean>_.isNative(Array.prototype.push);
result = <boolean>_(Array.prototype.push).isNative();
// _.lt
result = <boolean>_.lt(1, 2);
result = <boolean>_(1).lt(2);
@@ -1456,8 +1460,6 @@ _.mixin({
var lodash = <typeof _>_.noConflict();
result = <number>_.parseInt('08');
result = <number>_.random(0, 5);
result = <number>_.random(5);
result = <number>_.random(5, true);
@@ -1552,15 +1554,38 @@ result = <string>_.padLeft('abc', 6, '_-');
result = <string>_.padRight('abc', 6);
result = <string>_.padRight('abc', 6, '_-');
result = <string>_.repeat('*', 3);
// _.parseInt
result = <number>_.parseInt('08');
result = <number>_.parseInt('08', 10);
result = <number>_('08').parseInt();
result = <number>_('08').parseInt(10);
result = <string>_.snakeCase('Foo Bar');
result = <string>_.startCase('--foo-bar');
result = <boolean>_.startsWith('abc', 'a');
// _.trim
result = <string>_.trim();
result = <string>_.trim(' abc ');
result = <string>_.trim('-_-abc-_-', '_-');
result = <string>_('-_-abc-_-').trim();
result = <string>_('-_-abc-_-').trim('_-');
// _.trimLeft
result = <string>_.trimLeft();
result = <string>_.trimLeft(' abc ');
result = <string>_.trimLeft('-_-abc-_-', '_-');
result = <string>_('-_-abc-_-').trimLeft();
result = <string>_('-_-abc-_-').trimLeft('_-');
// _.trimRight
result = <string>_.trimRight();
result = <string>_.trimRight(' abc ');
result = <string>_.trimRight('-_-abc-_-', '_-');
result = <string>_('-_-abc-_-').trimRight();
result = <string>_('-_-abc-_-').trimRight('_-');
result = <string>_.trunc('hi-diddly-ho there, neighborino');
result = <string>_.trunc('hi-diddly-ho there, neighborino', 24);
result = <string>_.trunc('hi-diddly-ho there, neighborino', { 'length': 24, 'separator': ' ' });
+99 -20
View File
@@ -5888,6 +5888,23 @@ declare module _ {
isMatch(source: Object, customizer?: isMatchCustomizer, thisArg?: any): boolean;
}
//_.isNative
interface LoDashStatic {
/**
* Checks if value is a native function.
* @param value The value to check.
* @retrun Returns true if value is a native function, else false.
*/
isNative(value: any): boolean;
}
interface LoDashWrapperBase<T, TWrapper> {
/**
* see _.isNative
*/
isNative(): boolean;
}
//_.lt
interface LoDashStatic {
/**
@@ -7171,31 +7188,93 @@ declare module _ {
pad(str?: string, length?: number, chars?: string): string;
padLeft(str?: string, length?: number, chars?: string): string;
padRight(str?: string, length?: number, chars?: string): string;
repeat(str?: string, n?: number): string;
snakeCase(str?: string): string;
startCase(str?: string): string;
startsWith(str?: string, target?: string, position?: number): boolean;
trim(str?: string, chars?: string): string;
trimLeft(str?: string, chars?: string): string;
trimRight(str?: string, chars?: string): string;
trunc(str?: string, len?: number): string;
trunc(str?: string, options?: { length?: number; omission?: string; separator?: string|RegExp }): string;
words(str?: string, pattern?: string|RegExp): string[];
}
//_.parseInt
interface LoDashStatic {
/**
* Converts the given value into an integer of the specified radix. If radix is undefined or 0 a
* radix of 10 is used unless the value is a hexadecimal, in which case a radix of 16 is used.
*
* Note: This method avoids differences in native ES3 and ES5 parseInt implementations. See
* http://es5.github.io/#E.
* @param value The value to parse.
* @param radix The radix used to interpret the value to parse.
* @return The new integer value.
**/
parseInt(value?: string, radix?: number): number;
* Converts string to an integer of the specified radix. If radix is undefined or 0, a radix of 10 is used
* unless value is a hexadecimal, in which case a radix of 16 is used.
* Note: This method aligns with the ES5 implementation of parseInt.
* @param string The string to convert.
* @param radix The radix to interpret value by.
* @return Returns the converted integer.
*/
parseInt(string: string, radix?: number): number;
}
interface LoDashWrapper<T> {
/**
* @see _.parseInt
*/
parseInt(radix?: number): number;
}
interface LoDashStatic {
repeat(str?: string, n?: number): string;
snakeCase(str?: string): string;
startCase(str?: string): string;
startsWith(str?: string, target?: string, position?: number): boolean;
}
//_.trim
interface LoDashStatic {
/**
* Removes leading and trailing whitespace or specified characters from string.
* @param string The string to trim.
* @param chars The characters to trim.
* @return Returns the trimmed string.
*/
trim(string?: string, chars?: string): string;
}
interface LoDashWrapper<T> {
/**
* @see _.trim
*/
trim(chars?: string): string;
}
//_.trimLeft
interface LoDashStatic {
/**
* Removes leading whitespace or specified characters from string.
* @param string The string to trim.
* @param chars The characters to trim.
* @return Returns the trimmed string.
*/
trimLeft(string?: string, chars?: string): string;
}
interface LoDashWrapper<T> {
/**
* @see _.trimLeft
*/
trimLeft(chars?: string): string;
}
//_.trimRight
interface LoDashStatic {
/**
* Removes trailing whitespace or specified characters from string.
* @param string The string to trim.
* @param chars The characters to trim.
* @return Returns the trimmed string.
*/
trimRight(string?: string, chars?: string): string;
}
interface LoDashWrapper<T> {
/**
* @see _.trimRight
*/
trimRight(chars?: string): string;
}
interface LoDashStatic {
trunc(str?: string, len?: number): string;
trunc(str?: string, options?: { length?: number; omission?: string; separator?: string|RegExp }): string;
words(str?: string, pattern?: string|RegExp): string[];
}
/*************
+16
View File
@@ -0,0 +1,16 @@
///<reference path="tether-shepherd.d.ts" />
var tour = new Shepherd.Tour({
defaults: {
classes: 'shepherd-theme-default'
}
});
tour.addStep('test-step', {
text: 'This is a test step being added to the test tour',
title: 'Test Step Title',
attachTo: {
element: '#button',
on: 'right'
}
});
+170
View File
@@ -0,0 +1,170 @@
// Type definitions for Tether-Shepherd v1.1.2
// Project: http://github.hubspot.com/shepherd/
// Definitions by: Matt Gibbs <https://github.com/mtgibbs>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
declare module TetherShepherd {
interface ShepherdStatic {
on(eventName: string, handler: Function, context?: any): any;
off(eventName: string, handler?: Function): any;
once(eventName: string, handler: Function, context?: any): any;
activeTour: IShepherdTour;
Tour: IShepherdTour;
}
interface IShepherdTourOptions {
steps?: IShepherdTourStep[];
defaults?: IShepherdTourStepOptions;
}
interface IShepherdTour {
new (options?: IShepherdTourOptions): IShepherdTour
/**
* Creates a new Step object with options, and returns the Tour object for convenient chaining when creating multiple steps. If you'd like you can also just pass an options hash which includes id as a key. If the options hash doesn't include an id, one will be generated. You can also pass an existing Step instance rather than options, but note that Shepherd does not support a Step being attached to multiple Tours.
*/
addStep(id: string, options: IShepherdTourStepOptions): IShepherdTour;
addStep(id: string, options: IShepherdTourStep): IShepherdTour;
/**
* Return a step with a specific id
*/
getById(id: string): IShepherdTourStep;
/**
* Advance to the next step, in the order they were added
*/
next(): void;
/**
* Show the previous step, in the order they were added
*/
back(): void;
/**
* Trigger cancel on the current step, hiding it without advancing
*/
cancel(): void;
/**
* Hide the current step
*/
hide(): void;
/**
* Show the step specified by id (if it's a string), or index (if it's a number) provided. Defaults to the first step.
*/
show(): void;
show(id: number): void;
show(id: string): void;
/**
* Show the first step and begin the tour
*/
start(): void;
/**
* Returns the currently shown step
*/
getCurrentStep(): IShepherdTourStep;
/**
* Bind an event
*/
on(eventName: string, handler: Function, context?: any): any;
/**
* Unbind an event
*/
off(eventName: string, handler?: Function): any;
/**
* Bind just the next instance of an event
*/
once(eventName: string, handler: Function, context?: any): any;
}
interface IShepherdTourStep {
/**
* Show this step
*/
show(): void;
/**
* Hide this step
*/
hide(): void;
/**
* Hide this step and trigger the cancel event
*/
cancel(): void;
/**
* Hide this step and trigger the complete event
*/
complete(): void;
/**
* Scroll to this step's element
*/
scrollTo(): void;
/**
* Returns true if the step is currently shown
*/
isOpen(): boolean;
/**
* Remove the element
*/
destroy(): void;
/**
* Bind an event
*/
on(eventName: string, handler: Function, context?: any): any;
/**
* Unbind an event
*/
off(eventName: string, handler?: Function): any;
/**
* Bind just the next instance of an event
*/
once(eventName: string, handler: Function, context?: any): any;
}
interface IShepherdTourStepOptions {
text?: any;
title?: string;
attachTo?: any;
beforeShowPromise?: any;
classes?: any;
buttons?: IShepherdTourButton[];
advanceOn?: any;
showCancelLink?: boolean;
scrollTo?: boolean;
when?: any;
// TODO: Tie this in with the tether.d.ts
tetherOptions?: any;
}
interface IShepherdTourButton {
text: string;
classes: string[];
action?: any;
events?: any;
}
interface IShepherdTourAttachProperties {
element: string;
on: string;
}
}
declare var Shepherd: TetherShepherd.ShepherdStatic;
+56
View File
@@ -0,0 +1,56 @@
// After adding a new API, initialize it and its corresponding Q wrapper in the [initializations] section.
// Then, add the new instance of the standard api to the apis array, and the instance of the q wrapper to the qapis array in the [arrays] section.
// Verify that the new user agent names are printed when running this file.
// This just verifies that the WebApi is instantiating the APIs correctly... up to you to test that they actually work.
/// <reference path="vso-node-api.d.ts" />
import webapim = require('vso-node-api/WebApi');
import basem = require('vso-node-api/ClientApiBases');
import buildm = require('vso-node-api/BuildApi');
import corem = require('vso-node-api/CoreApi');
import filecontainerm = require('vso-node-api/FileContainerApi');
import gallerym = require('vso-node-api/GalleryApi');
import gitm = require('vso-node-api/GitApi');
import taskagentm = require('vso-node-api/TaskAgentApi');
import taskm = require('vso-node-api/TaskApi');
import testm = require('vso-node-api/TestApi');
import tfvcm = require('vso-node-api/TfvcApi');
import workitemtrackingm = require('vso-node-api/WorkItemTrackingApi');
test_apis();
function test_apis() {
var webapi: webapim.WebApi = new webapim.WebApi('http://serverfoobar.com', webapim.getBasicHandler('fooser', 'barssword'));
var buildapi: buildm.IBuildApi = webapi.getBuildApi();
var qbuildapi: buildm.IQBuildApi = webapi.getQBuildApi();
var coreapi: corem.ICoreApi = webapi.getCoreApi();
var qcoreapi: corem.IQCoreApi = webapi.getQCoreApi();
var filecontainerapi: filecontainerm.IFileContainerApi = webapi.getFileContainerApi();
var qfilecontainerapi: filecontainerm.IQFileContainerApi = webapi.getQFileContainerApi();
var galleryapi: gallerym.IGalleryApi = webapi.getGalleryApi();
var qgalleryapi: gallerym.IQGalleryApi = webapi.getQGalleryApi();
var gitapi: gitm.IGitApi = webapi.getGitApi();
var qgitapi: gitm.IQGitApi = webapi.getQGitApi();
var taskapi: taskm.ITaskApi = webapi.getTaskApi();
var qtaskapi: taskm.IQTaskApi = webapi.getQTaskApi();
var agentapi: taskagentm.ITaskAgentApi = webapi.getTaskAgentApi();
var qagentapi: taskagentm.IQTaskAgentApi = webapi.getQTaskAgentApi();
var testapi: testm.ITestApi = webapi.getTestApi();
var qtestapi: testm.IQTestApi = webapi.getQTestApi();
var tfvcapi: tfvcm.ITfvcApi = webapi.getTfvcApi();
var qtfvcapi: tfvcm.IQTfvcApi = webapi.getQTfvcApi();
var witapi: workitemtrackingm.IWorkItemTrackingApi = webapi.getWorkItemTrackingApi();
var qwitapi: workitemtrackingm.IQWorkItemTrackingApi = webapi.getQWorkItemTrackingApi();
var apis: basem.ClientApiBase[] = [buildapi, coreapi, filecontainerapi, galleryapi, gitapi, taskapi, agentapi, testapi, tfvcapi, witapi];
var qapis: basem.QClientApiBase[] = [qbuildapi, qcoreapi, qfilecontainerapi, qgalleryapi, qgitapi, qtaskapi, qagentapi, qtestapi, qtfvcapi, qwitapi];
for(var api in apis) {
console.log('API user agent name: ' + api.userAgent);
}
for(var qapi in qapis) {
console.log('Q API user agent name: ' + qapi.api.userAgent);
}
}
+13436
View File
File diff suppressed because it is too large Load Diff