Merge commit '2772dfeec9cdb1744f6c010babef9e40b6770dd7' into plan-of-destroy-implicitAny

This commit is contained in:
vvakame
2013-10-18 12:41:53 +09:00
40 changed files with 11925 additions and 112 deletions
+7
View File
@@ -29,6 +29,7 @@ List of Definitions
* [Ace Cloud9 Editor](http://ace.ajax.org/) (by [Diullei Gomes](https://github.com/Diullei))
* [AmCharts](http://www.amcharts.com/) (by [Covobonomo](https://github.com/covobonomo/))
* [AngularJS](http://angularjs.org) (by [Diego Vilar](https://github.com/diegovilar)) ([wiki](https://github.com/borisyankov/DefinitelyTyped/wiki/AngularJS-Definitions-Usage-Notes))
* [AppFramework](http://app-framework-software.intel.com/) (by [Kyo Ago](https://github.com/kyo-ago))
* [Arbiter](http://arbiterjs.com/) (by [Arash Shakery](https://github.com/arash16))
* [async](https://github.com/caolan/async) (by [Boris Yankov](https://github.com/borisyankov))
* [Backbone.js](http://backbonejs.org/) (by [Boris Yankov](https://github.com/borisyankov))
@@ -44,9 +45,12 @@ List of Definitions
* [Cheerio](https://github.com/MatthewMueller/cheerio) (by [Bret Little](https://github.com/blittle))
* [Chosen](http://harvesthq.github.com/chosen/) (by [Boris Yankov](https://github.com/borisyankov))
* [Chrome](http://developer.chrome.com/extensions/) (by [Matthew Kimber](https://github.com/matthewkimber))
* [Chrome App](http://developer.chrome.com/apps/) (by [Adam Lay](https://github.com/AdamLay))
* [CodeMirror](http://codemirror.net) (by [François de Campredon](https://github.com/fdecampredon))
* [Commander](http://github.com/visionmedia/commander.js) (by [Marcelo Dezem](https://github.com/mdezem))
* [d3.js](http://d3js.org/) (from TypeScript samples)
* [dhtmlxGantt](http://dhtmlx.com/docs/products/dhtmlxGantt) (by [Maksim Kozhukh](http://github.com/mkozhukh))
* [dhtmlxScheduler](http://dhtmlx.com/docs/products/dhtmlxScheduler) (by [Maksim Kozhukh](http://github.com/mkozhukh))
* [docCookies](https://developer.mozilla.org/en-US/docs/Web/API/document.cookie) (by [Jon Egerton](https://github.com/jonegerton))
* [domo](http://domo-js.com/) (by [Steve Fenton](https://github.com/Steve-Fenton))
* [dust](http://linkedin.github.com/dustjs) (by [Marcelo Dezem](https://github.com/mdezem))
@@ -68,6 +72,7 @@ List of Definitions
* [FPSMeter](http://darsa.in/fpsmeter/) (by [Aaron Lampros](https://github.com/alampros))
* [FullCalendar](http://arshaw.com/fullcalendar/) (by [Neil Stalker](https://github.com/nestalk))
* [Gamepad](http://www.w3.org/TR/gamepad/) (by [Kon](http://phyzkit.net/))
* [Giraffe](https://github.com/barc/backbone.giraffe) (by [Matt McCray](https://github.com/darthapo))
* [glDatePicker](http://glad.github.com/glDatePicker/) (by [Dániel Tar](https://github.com/qcz))
* [GoJS](http://gojs.net/) (by [Barbara Duckworth](https://github.com/barbara42))
* [GreenSock Animation Platform (GSAP)](http://www.greensock.com/get-started-js/) (by [Robert S.](https://github.com/codeBelt))
@@ -137,6 +142,7 @@ List of Definitions
* [Knockout.js](http://knockoutjs.com/) (by [Boris Yankov](https://github.com/borisyankov))
* [Knockout.DeferredUpdates](https://github.com/mbest/knockout-deferred-updates) (by [Sebastián Galiano](https://github.com/sgaliano))
* [Knockout.ES5](https://github.com/SteveSanderson/knockout-es5) (by [Sebastián Galiano](https://github.com/sgaliano))
* [Knockout.Mapper](https://github.com/LucasLorentz/knockout.mapper) (by [Brandon Meyer](https://github.com/BMeyerKC))
* [Knockout.Mapping](https://github.com/SteveSanderson/knockout.mapping) (by [Boris Yankov](https://github.com/borisyankov))
* [Knockout.Postbox](https://github.com/rniemeyer/knockout-postbox) (by [Judah Gabriel](https://github.com/JudahGabriel))
* [Knockout.Validation](https://github.com/ericmbarnard/Knockout-Validation) (by [Dan Ludwig](https://github.com/danludwig))
@@ -151,6 +157,7 @@ List of Definitions
* [Livestamp.js](https://github.com/mattbradley/livestampjs) (by [Vincent Bortone](https://github.com/vbortone))
* [Logg](https://github.com/dpup/node-logg) (by [Bret Little](https://github.com/blittle))
* [Marked](https://github.com/chjj/marked) (by [William Orr](https://github.com/worr))
* [mCustomScrollbar](https://github.com/malihu/malihu-custom-scrollbar-plugin) (by [Sarah Williams] (https://github.com/flurg))
* [Meteor](https://www.meteor.com) (by [Dave Allen](https://github.com/fullflavedave))
* [Modernizr](http://modernizr.com/) (by [Boris Yankov](https://github.com/borisyankov) and [Theodore Brown](https://github.com/theodorejb/))
* [Moment.js](https://github.com/timrwood/moment) (by [Michael Lakerveld](https://github.com/Lakerfield))
+3 -6
View File
@@ -150,14 +150,11 @@ declare module ng {
interface INgModelController {
$render(): void;
$setValidity(validationErrorKey: string, isValid: boolean): void;
$setViewValue(value: string): void;
// XXX Not sure about the types here. Documentation states it's a string, but
// I've seen it receiving other types throughout the code.
// Falling back to any for now.
// Documentation states viewValue and modelValue to be a string but other
// types do work and it's common to use them.
$setViewValue(value: any): void;
$viewValue: any;
// XXX Same as avove
$modelValue: any;
$parsers: IModelParser[];
+630
View File
@@ -0,0 +1,630 @@
/// <reference path="appframework.d.ts" />
af(($: appFrameworkStatic) => {});
((): appFrameworkCollection => {
return $('div'); //=> all DIV elements on the page
})();
((): appFrameworkCollection => {
return $("<p />", {}); // context
})();
((): appFrameworkCollection => {
return $($('')); // appFrameworkCollection
})();
((): appFrameworkCollection => {
return $(document.createElement('div')); // HTMLElement
})();
((): appFrameworkCollection => {
return $({}); // Object(any)
})();
((): boolean => {
return $.is$($(''));
})();
((): boolean[] => {
return $.map([], (item: any, index: number): boolean => {
return true;
});
})();
$.each([], (index: number, item: any) => { });
$.each({}, (key: string, value: any) => { });
((): Object => {
return $.extend({ one: 'patridge' }, { two: 'turtle doves' });
})();
((): boolean => {
return $.isArray({});
})();
((): boolean => {
return $.isFunction({});
})();
((): boolean => {
return $.isObject({});
})();
((): Object => {
return $.fn;
})();
((): Object => {
return $.ajaxSettings;
})();
$.jsonP({});
((): XMLHttpRequest => {
return $.ajax({});
})();
((): XMLHttpRequest => {
return $.get('', (data: any, status?: string, xhr?: XMLHttpRequest) => {});
})();
((): XMLHttpRequest => {
return $.post('', (data: any, status?: string, xhr?: XMLHttpRequest) => {});
})();
((): XMLHttpRequest => {
return $.post('', {}, (data: any, status?: string, xhr?: XMLHttpRequest) => {});
})();
((): XMLHttpRequest => {
return $.getJSON('', (data: any, status?: string, xhr?: XMLHttpRequest) => {});
})();
((): XMLHttpRequest => {
return $.getJSON('', {}, (data: any, status?: string, xhr?: XMLHttpRequest) => {});
})();
((): string => {
return $.param({});
})();
((): string => {
return $.param({}, '');
})();
((): Object => {
return $.parseJSON('');
})();
((): Object => {
return $.parseXML('');
})();
((): string => {
return $.uuid();
})();
((): Object => {
return $.getCssMatrix(document.createElement('div'));
})();
((): Object => {
return $.getCssMatrix($(''));
})();
((): appFrameworkCollection => {
return $.create('');
})();
((): appFrameworkCollection => {
return $.create('', {});
})();
((): appFrameworkCollection => {
return $.query('');
})();
((): appFrameworkCollection => {
return $.query('', {});
})();
((): Object => {
return $.Event('', {});
})();
((): void => {
return $.bind({}, '', () => {});
})();
((): void => {
return $.trigger({}, '');
})();
((): void => {
return $.trigger({}, '', []);
})();
((): void => {
return $.unbind({}, '', () => {});
})();
((): void => {
return $.proxy(() => {}, {});
})();
((): void => {
return $.cleanUpContent(document.createElement('div'), false, false);
})();
((): void => {
return $.asap(() => {});
})();
((): void => {
return $.asap(() => {}, {});
})();
((): void => {
return $.asap(() => {}, {}, []);
})();
((): void => {
return $.parseJS('');
})();
((): void => {
return $.parseJS(document.createElement('div'));
})();
$.os.webkit;
$.os.android;
$.os.androidICS;
$.os.ipad;
$.os.iphone;
$.os.ios7;
$.os.webos;
$.os.touchpad;
$.os.ios;
$.os.playbook;
$.os.blackberry;
$.os.blackberry10;
$.os.chrome;
$.os.opera;
$.os.fennec;
$.os.ie;
$.os.ieTouch;
$.os.supportsTouch;
$.feat.nativeTouchScroll;
$.feat.cssPrefix;
$.feat.cssTransformStart;
$.feat.cssTransformEnd;
((): appFrameworkCollection => {
return $('').reduce((hoge) => { return hoge; });
})();
((): number => {
return $('').push($(''));
})();
((): number => {
return $('').indexOf($(''));
})();
((): appFrameworkCollection[] => {
return $('').concat($(''));
})();
((): appFrameworkCollection[] => {
return $('').slice(0);
})();
((): number => {
return $('').length;
})();
((): appFrameworkCollection => {
return $('').map(() => {});
})();
((): appFrameworkCollection => {
return $('').each(() => {});
})();
((): void => {
return $('').forEach(() => {});
})();
((): appFrameworkStatic => {
return $('').ready(() => {});
})();
((): appFrameworkCollection => {
return $('').find('');
})();
((): string => {
return $('').html();
})();
((): appFrameworkCollection => {
return $('').html('');
})();
((): appFrameworkCollection => {
return $('').html('', false);
})();
((): string => {
return $('').text();
})();
((): appFrameworkCollection => {
return $('').text('');
})();
(() => {
return $('').css('');
})();
((): appFrameworkCollection => {
return $('').css('', '');
})();
((): appFrameworkCollection => {
return $('').css({});
})();
((): appFrameworkCollection => {
return $('').vendorCss('');
})();
((): appFrameworkCollection => {
return $('').computedStyle('');
})();
((): appFrameworkCollection => {
return $('').empty();
})();
((): appFrameworkCollection => {
return $('').hide();
})();
((): appFrameworkCollection => {
return $('').show();
})();
((): appFrameworkCollection => {
return $('').toggle();
})();
((): string => {
return $('').val();
})();
((): appFrameworkCollection => {
return $('').val('');
})();
((): string => {
return $('').attr('');
})();
((): appFrameworkCollection => {
return $('').attr({});
})();
((): appFrameworkCollection => {
return $('').attr('', '');
})();
((): appFrameworkCollection => {
return $('').attr('', {});
})();
((): appFrameworkCollection => {
return $('').removeAttr('');
})();
((): string => {
return $('').prop('');
})();
((): appFrameworkCollection => {
return $('').prop({});
})();
((): appFrameworkCollection => {
return $('').prop('', '');
})();
((): appFrameworkCollection => {
return $('').prop('', {});
})();
((): appFrameworkCollection => {
return $('').removeProp('');
})();
((): appFrameworkCollection => {
return $('').remove();
})();
((): appFrameworkCollection => {
return $('').remove('');
})();
((): appFrameworkCollection => {
return $('').remove(document.createElement('div'));
})();
((): appFrameworkCollection => {
return $('').remove($(''));
})();
((): appFrameworkCollection => {
return $('').addClass('');
})();
((): appFrameworkCollection => {
return $('').removeClass('');
})();
((): appFrameworkCollection => {
return $('').toggleClass('');
})();
((): appFrameworkCollection => {
return $('').replaceClass('', '');
})();
((): boolean => {
return $('').hasClass('', document.createElement('div'));
})();
((): appFrameworkCollection => {
return $('').append('');
})();
((): appFrameworkCollection => {
return $('').appendTo('');
})();
((): appFrameworkCollection => {
return $('').prependTo('');
})();
((): appFrameworkCollection => {
return $('').prepend('');
})();
((): appFrameworkCollection => {
return $('').insertBefore('');
})();
((): void => {
return $('').insertAfter('');
})();
((): HTMLElement[] => {
return $('').get();
})();
((): HTMLElement => {
return $('').get(0);
})();
((): {
left: number;
top: number;
right: number;
bottom: number;
width: number;
height: number;
} => {
return $('').offset();
})();
((): string => {
return $('').height();
})();
((): string => {
return $('').width();
})();
((): appFrameworkCollection => {
return $('').parent();
})();
((): appFrameworkCollection => {
return $('').parents();
})();
((): appFrameworkCollection => {
return $('').children();
})();
((): appFrameworkCollection => {
return $('').siblings();
})();
((): appFrameworkCollection => {
return $('').closest();
})();
((): appFrameworkCollection => {
return $('').filter();
})();
((): appFrameworkCollection => {
return $('').not();
})();
((): any => {
return $('').data('');
})();
((): appFrameworkCollection => {
return $('').data('', '');
})();
((): appFrameworkCollection => {
return $('').data('', {});
})();
((): appFrameworkCollection => {
return $('').end();
})();
((): appFrameworkCollection => {
return $('').clone();
})();
((): number => {
return $('').size();
})();
((): string => {
return $('').serialize();
})();
((): appFrameworkCollection => {
return $('').eq(0);
})();
((): number => {
return $('').index();
})();
((): number => {
return $('').index('');
})();
((): number => {
return $('').is('');
})();
((): appFrameworkCollection => {
return $('').bind({});
})();
((): appFrameworkCollection => {
return $('').bind('', () => {});
})();
((): appFrameworkCollection => {
return $('').unbind({});
})();
((): appFrameworkCollection => {
return $('').unbind();
})();
((): appFrameworkCollection => {
return $('').unbind('', () => {});
})();
((): appFrameworkCollection => {
return $('').one({});
})();
((): appFrameworkCollection => {
return $('').one('', () => {});
})();
((): appFrameworkCollection => {
return $('').delegate('', {});
})();
((): appFrameworkCollection => {
return $('').delegate('', '', () => {});
})();
((): appFrameworkCollection => {
return $('').undelegate('', {});
})();
((): appFrameworkCollection => {
return $('').undelegate('', '', () => {});
})();
((): appFrameworkCollection => {
return $('').on({});
})();
((): appFrameworkCollection => {
return $('').on('', () => {});
})();
((): appFrameworkCollection => {
return $('').on('', '', () => {});
})();
((): appFrameworkCollection => {
return $('').off({});
})();
((): appFrameworkCollection => {
return $('').off('', () => {});
})();
((): appFrameworkCollection => {
return $('').off('', '', () => {});
})();
((): appFrameworkCollection => {
return $('').trigger('');
})();
((): appFrameworkCollection => {
return $('').trigger({});
})();
((): appFrameworkCollection => {
return $('').click();
})();
((): appFrameworkCollection => {
return $('').click(() => {});
})();
((): appFrameworkCollection => {
return $('').keydown();
})();
((): appFrameworkCollection => {
return $('').keydown(() => {});
})();
((): appFrameworkCollection => {
return $('').keyup();
})();
((): appFrameworkCollection => {
return $('').keyup(() => {});
})();
((): appFrameworkCollection => {
return $('').keypress();
})();
((): appFrameworkCollection => {
return $('').keypress(() => {});
})();
((): appFrameworkCollection => {
return $('').submit();
})();
((): appFrameworkCollection => {
return $('').submit(() => {});
})();
((): appFrameworkCollection => {
return $('').load();
})();
((): appFrameworkCollection => {
return $('').load(() => {});
})();
((): appFrameworkCollection => {
return $('').resize();
})();
((): appFrameworkCollection => {
return $('').resize(() => {});
})();
((): appFrameworkCollection => {
return $('').change();
})();
((): appFrameworkCollection => {
return $('').change(() => {});
})();
((): appFrameworkCollection => {
return $('').select();
})();
((): appFrameworkCollection => {
return $('').select(() => {});
})();
((): appFrameworkCollection => {
return $('').error();
})();
((): appFrameworkCollection => {
return $('').error(() => {});
})();
((): appFrameworkCollection => {
return $('').focus();
})();
((): appFrameworkCollection => {
return $('').focus(() => {});
})();
((): appFrameworkCollection => {
return $('').blur();
})();
((): appFrameworkCollection => {
return $('').blur(() => {});
})();
+1318
View File
File diff suppressed because it is too large Load Diff
+27
View File
@@ -0,0 +1,27 @@
/// <reference path="chrome-app.d.ts" />
import runtime = chrome.app.runtime;
import cwindow = chrome.app.window;
var createOptions: cwindow.CreateOptions = {
id: "My Window",
bounds: {
left: 0,
top: 0,
width: 640,
height: 480
},
resizable: true
};
//Create new window on app launch
chrome.app.runtime.onLaunched.addListener(function (launchData: runtime.LaunchData) {
chrome.app.window.create('app/url', createOptions, function (created_window: cwindow.AppWindow) {
return;
});
});
chrome.app.runtime.onRestarted.addListener(function () { return; });
// Get Current Window
var currentWindow: cwindow.AppWindow = chrome.app.window.current();
+95
View File
@@ -0,0 +1,95 @@
// Type definitions for Chrome packaged application development.
// Project: http://developer.chrome.com/apps/
// Definitions by: Adam Lay <https://github.com/AdamLay>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
////////////////////
// App Runtime
////////////////////
declare module chrome.app.runtime {
interface LaunchData {
id?: string;
items?: LaunchDataItem[];
url?: string;
referrerUrl?: string;
isKioskSession?: boolean;
}
interface LaunchDataItem {
entry: File;
type: string;
}
interface LaunchedEvent {
addListener(callback: (launchData: LaunchData) => void);
}
interface RestartedEvent {
addListener(callback: () => void);
}
var onLaunched: LaunchedEvent;
var onRestarted: RestartedEvent;
}
////////////////////
// App Window
////////////////////
declare module chrome.app.window {
interface Bounds {
left?: number;
top?: number;
width?: number;
height?: number;
}
interface AppWindow {
focus: () => void;
fullscreen: () => void;
isFullscreen: () => boolean;
minimize: () => void;
isMinimized: () => boolean;
maximize: () => void;
isMaximized: () => boolean;
restore: () => void;
moveTo: (left: number, top: number) => void;
resizeTo: (width: number, height: number) => void;
drawAttention: () => void;
clearAttention: () => void;
close: () => void;
show: () => void;
hide: () => void;
getBounds: () => Bounds;
setBounds: (bounds: Bounds) => void;
contentWindow: Window;
}
interface CreateOptions {
id?: string;
minWidth?: number;
minHeight?: number;
maxWidth?: number;
maxHeight?: number;
frame?: string; // "none", "chrome"
bounds?: Bounds;
transparentBackground?: boolean;
state?: string; // "normal", "fullscreen", "maximized", "minimized"
hidden?: boolean;
resizable?: boolean;
singleton?: boolean;
}
export function create(url: string, options?: CreateOptions, callback?: (created_window: AppWindow) => void): void;
export function current(): AppWindow;
interface WindowEvent {
addListener(callback: () => void): void;
}
var onBoundsChanged: WindowEvent;
var onClosed: WindowEvent;
var onFullscreened: WindowEvent;
var onMaximized: WindowEvent;
var onMinimized: WindowEvent;
var onRestored: WindowEvent;
}
+19 -3
View File
@@ -1,4 +1,4 @@
// Type definitions for Chrome extension development.
// Type definitions for Chrome extension development.
// Project: http://developer.chrome.com/extensions/
// Definitions by: Matthew Kimber <https://github.com/matthewkimber>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
@@ -114,7 +114,7 @@ declare module chrome.bookmarks {
export function getSubTree(id: string, callback: (results: BookmarkTreeNode[]) => void): void;
export function removeTree(id: string, callback?: Function): void;
var onRemoved: chrome.alarms.AlarmEvent;
var onRemoved: BookmarkRemovedEvent;
var onImportEnded: BookmarkImportEndedEvent;
var onImportBegan: BookmarkImportBeganEvent;
var onChanged: BookmarkChangedEvent;
@@ -1056,6 +1056,15 @@ declare module chrome.history {
var onVisitRemoved: HistoryVisitRemovedEvent;
}
////////////////////
// Identity
////////////////////
declare module chrome.identity {
var getAuthToken: (options:any, cb:(token:{})=>void)=>void;
}
////////////////////
// Internationalization
////////////////////
@@ -1341,7 +1350,7 @@ declare module chrome.pageCapture {
tabId: number;
}
export function saveAsMHTML(details: SaveDetails, callback: (mhtmlData?: any) => void): void;
export function saveAsMHTML(details: SaveDetails, callback: (mhtmlData: any) => void): void;
}
////////////////////
@@ -1472,6 +1481,9 @@ declare module chrome.runtime {
interface RuntimeSuspendCanceledEvent extends chrome.events.Event {
addListener(callback: Function): void;
}
interface RuntimeMessageEvent extends chrome.events.Event {
addListener(callback: Function): void;
}
export function getBackgroundPage(callback: (backgroundPage?: Window) => void): void;
export function getManifest(): Object;
@@ -1481,6 +1493,10 @@ declare module chrome.runtime {
var onStartup: RuntimeStartupEvent;
var onInstalled: RuntimeInstalledEvent;
var onSuspendCanceled: RuntimeSuspendCanceledEvent;
var onMessage: RuntimeMessageEvent;
var onMessageExternal: RuntimeMessageEvent;
var sendMessage:(req:any, cb:(resp:any)=>void)=>void;
}
////////////////////
+28
View File
@@ -0,0 +1,28 @@
// Type definitions for CometD 2.5.1
// Project: http://cometd.org
// Definitions: https://github.com/borisyankov/DefinitelyTyped
declare module CometD {
var onListenerException: (exception: any, subscriptionHandle: any, isListener: boolean, message: string) => void;
function init(options: ConfigurationOptions): void;
function addListener(channel: string, listener: (message: any) => void): void;
function removeListener(listener: (message: any) => void): void;
function publish(channel: string, message: any): void;
interface ConfigurationOptions {
url: string;
logLevel?: string;
maxConnections?: number;
backoffIncrement?: number;
maxBackoff?: number;
reverseIncomingExtensions?: boolean;
maxNetworkDelay?: number;
requestHeaders?: any;
appendMessageTypeToURL?: boolean;
autoBatch?: boolean;
}
}
Vendored
+1
View File
@@ -719,6 +719,7 @@ declare module D3 {
datum: {
(values: (data: any, index: number) => any): UpdateSelection;
(values: any): UpdateSelection;
() : any;
};
filter: {
+33
View File
@@ -0,0 +1,33 @@
/// <reference path="dhtmlxgantt.d.ts" />
//date operations
var start: Date = gantt.date.week_start(new Date());
var next: Date = gantt.date.add(new Date(), 1, "week");
//hotkeys
gantt.keys.edit_cancel = 13;
//config options
gantt.config.details_on_create = true;
gantt.config.scale_height = 40;
gantt.config.xml_date = "%m-%d-%Y";
//templates
gantt.templates.task_class = function (start: Date, end: Date, task: any) {
if (task.some)
return "classA";
else
return "classB";
}
//locale
gantt.locale.labels.new_task = "New task";
//API
gantt.init("scheduler_here", start);
gantt.load("/data/events");
//events
gantt.attachEvent("onBeforeLightbox", function (id: string) {
gantt.showTask(id);
});
+989
View File
@@ -0,0 +1,989 @@
// Type definitions for dhtmlxGantt 2.0
// Project: http://dhtmlx.com/docs/products/dhtmlxGantt
// Definitions by: Maksim Kozhukh <http://github.com/mkozhukh>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
interface GanttTemplates{
/**
* specifies the format of dates that are set by means of API methods. Used to parse incoming dates
* @param date the date which needs formatting
*/
api_date(date: Date): string;
/**
* specifies the format of dates in the "Start time" column
* @param date the date which needs formatting
*/
date_grid(date: Date): string;
/**
* specifies the date format of the time scale (X-Axis)
* @param date the date which needs formatting
*/
date_scale(date: Date): string;
/**
* specifies the text of tooltips that are displayed when the user creates a new dependency link
* @param from the id of the source task
* @param from_start <i>true</i>, if the link is being dragged from the start of the source task, <i>false</i> - if <br> from the end of the task
* @param to the id of the target task( 'null' or 'undefined', if the target task isn't specified yet)
* @param to_start <i>true</i>, if the link is being dragged to the start of the target task, <i>false</i> - if <br> to the end of the task
*/
drag_link(from: any, from_start: boolean, to: any, to_start: boolean): string;
/**
* specifies the CSS class that will be applied to the link receiver (pop-up circle near the task bar)
* @param from the id of the source task
* @param from_start <i>true</i>, if the link is being dragged from the start of the source task, <i>false</i> - if <br> from the end of the task
* @param to the id of the target task( 'null' or 'undefined', if the target task isn't specified yet)
* @param to_start <i>true</i>, if the link is being dragged to the start of the target task, <i>false</i> - if <br> to the end of the task
*/
drag_link_class(from: any, from_start: boolean, to: any, to_start: boolean): string;
/**
* specifies the custom content inserted before the labels of child items in the tree column
* @param task the task object
*/
grid_blank(task: any): string;
/**
* specifies the icon of child items in the tree column
* @param task the task object
*/
grid_file(task: any): string;
/**
* specifies the icon of parent items in the tree column
* @param task the task object
*/
grid_folder(task: any): string;
/**
* specifies the CSS class that will be applied to the headers of the table's columns
* @param column the column's configuration object
* @param config the column's id ('name' attribute)
*/
grid_header_class(column: any, config: string): string;
/**
* specifies the indent of the child items in a branch (in the tree column)
* @param task the task object
*/
grid_indent(task: any): string;
/**
* specifies the icon of the open/close sign in the tree column
* @param task the task object
*/
grid_open(task: any): string;
/**
* specifies the CSS class that will be applied to a grid row
* @param start the date when a task is scheduled to begin
* @param end the date when a task is scheduled to be completed
* @param task the task object
*/
grid_row_class(start: Date, end: Date, task: any): string;
/**
* specifies the CSS class that will be applied to a link
* @param link the link object
*/
link_class(link: any): string;
/**
* specifies the text in the header of the link's "delete" confirm window
* @param link the link object
*/
link_description(link: any): string;
/**
* specifies the text in the completed part of the task bar
* @param start the date when a task is scheduled to begin
* @param end the date when a task is scheduled to be completed
* @param task the task object
*/
progress_text(start: Date, end: Date, task: any): string;
/**
* specifies the content of the pop-up edit form
* @param start the date when a task is scheduled to begin
* @param end the date when a task is scheduled to be completed
* @param task the task object
*/
quick_info_content(start: Date, end: Date, task: any): string;
/**
* specifies the date of the pop-up edit form
* @param start the date when a task is scheduled to begin
* @param end the date when a task is scheduled to be completed
* @param task the task object
*/
quick_info_date(start: Date, end: Date, task: any): string;
/**
* specifies the title of the pop-up edit form
* @param start the date when a task is scheduled to begin
* @param end the date when a task is scheduled to be completed
* @param task the task object
*/
quick_info_title(start: Date, end: Date, task: any): string;
/**
* specifies the CSS class that will be applied to the time scale of the timeline area
* @param date the date of a cell
*/
scale_cell_class(date: Date): string;
/**
* specifies the CSS class that will be applied to the cells of the timeline area
* @param item the task object assigned to the row
* @param date the date of a cell
*/
task_cell_class(item: Date, date: Date): string;
/**
* specifies the CSS class that will be applied to task bars
* @param start the date when a task is scheduled to begin
* @param end the date when a task is scheduled to be completed
* @param task the task object
*/
task_class(start: Date, end: Date, task: any): string;
/**
* specifies the date format of the label in the 'Time period' section of the lightbox
* @param date the date which needs formatting
*/
task_date(date: Date): string;
/**
* specifies the CSS class that will be applied to the row of the timeline area
* @param start the date when a task is scheduled to begin
* @param end the date when a task is scheduled to be completed
* @param task the task object
*/
task_row_class(start: Date, end: Date, task: any): string;
/**
* specifies the text in the task bars and the header of the lightbox
* @param start the date when a task is scheduled to begin
* @param end the date when a task is scheduled to be completed
* @param task the task object
*/
task_text(start: Date, end: Date, task: any): string;
/**
* specifies the date period in the header of the lightbox
* @param start the date when a task is scheduled to begin
* @param end the date when a task is scheduled to be completed
* @param task the task object
*/
task_time(start: Date, end: Date, task: any): string;
/**
* specifies the format of the drop-down time selector in the lightbox
* @param date the date which needs formatting
*/
time_picker(date: Date): string;
/**
* specifies the format of start and end dates displayed in the tooltip
* @param date the date which needs formatting
*/
tooltip_date_format(date: Date): string;
/**
* specifies the text of tooltips
* @param start the date when a task is scheduled to begin
* @param end the date when a task is scheduled to be completed
* @param task the task object
*/
tooltip_text(start: Date, end: Date, task: any): string;
/**
* a string from an XML file is converted into a date object in conformity with this template
* @param date the date which needs formatting
*/
xml_date(date: Date): string;
/**
* a date object is converted into a string in conformity with this template. Used to send data back to the server
* @param date the date which needs formatting
*/
xml_format(date: Date): string;
/**
* specifies the text assigned to tasks bars on the right side
* @param start the date when a task is scheduled to begin
* @param end the date when a task is scheduled to be completed
* @param task the task object
*/
rightside_text(start: Date, end: Date, task: any): string;
/**
* specifies the text assigned to tasks bars on the left side
* @param start the date when a task is scheduled to begin
* @param end the date when a task is scheduled to be completed
* @param task the task object
*/
leftside_text(start: Date, end: Date, task: any): string;
}
interface GanttConfigOptions{
/**
* sets the date format that will be used by the addTask() method to
parse the start_date, end_date properties in case they are specified as strings
*/
api_date: string;
/**
* enables automatic adjusting of the grid's columns to the grid's width
*/
autofit: boolean;
/**
* stores a collection of buttons resided in the left bottom corner of the lightbox
*/
buttons_left: any;
/**
* stores a collection of buttons resided in the right bottom corner of the lightbox
*/
buttons_right: any;
/**
* configures the columns of the table
*/
columns: any;
/**
* sets the format of dates in the "Start time" column of the table
*/
date_grid: string;
/**
* sets the format of the time scale (X-Axis)
*/
date_scale: string;
/**
* 'says' to open the lightbox while creating new events by clicking on the '+' button
*/
details_on_create: boolean;
/**
* 'says' to open the lightbox after double clicking on a task
*/
details_on_dblclick: boolean;
/**
* enables the possibility to drag the lightbox by the header
*/
drag_lightbox: boolean;
/**
* enables creating dependency links by drag-and-drop
*/
drag_links: boolean;
/**
* stores the types of available drag-and-drop modes
*/
drag_mode: any;
/**
* enables the possibility to move tasks by drag-and-drop
*/
drag_move: boolean;
/**
* enables the possibility to change the task progress by dragging the progress knob
*/
drag_progress: boolean;
/**
* enables the possibility to resize tasks by drag-and-drop
*/
drag_resize: boolean;
/**
* sets the number of 'gantt.config.duration_unit' units that will correspond to one unit of the 'duration' data property.
*/
duration_step: number;
/**
* sets the duration unit in milliseconds
*/
duration_unit: number;
/**
* sets the end value of the time scale (XAxis)
*/
end_date: Date;
/**
* 'says' the Gantt chart to re-render the scale each time a task doesn't fit into the existing scale interval
*/
fit_tasks: boolean;
/**
* sets the maximum width of the grid
*/
grid_width: number;
/**
* sets whether the timeline area will be initially scrolled to display the earliest task
*/
initial_scroll: boolean;
/**
* specifies the lightbox object
*/
lightbox: any;
/**
* increases the height of the lightbox
*/
lightbox_additional_height: number;
/**
* sets the size of the link arrow
*/
link_arrow_size: number;
/**
* sets the name of the attribute that will specify the id of the link's HTML element
*/
link_attribute: string;
/**
* sets the width of dependency links in the timeline area
*/
link_line_width: number;
/**
* sets the width of the area (over the link) sensitive to clicks
*/
link_wrapper_width: number;
/**
* stores the types of links dependencies
*/
links: any;
/**
* sets the minimum width for a column
*/
min_column_width: number;
/**
* sets the minimum step (in milliseconds) for task's time values
*/
min_duration: number;
/**
* activates the 'branch' mode that allows dragging tasks only within the parent branch
*/
order_branch: boolean;
/**
* defines whether the task form will appear from the left/right side of the screen or near the selected task
*/
quick_info_detached: boolean;
/**
* stores a collection of buttons resided in the pop-up edit form
*/
quickinfo_buttons: any;
/**
* activates the read-only mode for the Gantt chart
*/
readonly: boolean;
/**
* enables rounding the task's start and end dates to the nearest scale marks
*/
round_dnd_dates: boolean;
/**
* sets the default height for rows of the table
*/
row_height: number;
/**
* sets the height of the time scale and the header of the grid
*/
scale_height: number;
/**
* sets the unit of the time scale (X-Axis)
*/
scale_unit: string;
/**
* enables selection of tasks in the Gantt chart
*/
select_task: boolean;
/**
* enables converting server-side dates from UTC to a local time zone (and backward) while sending data to the server
*/
server_utc: boolean;
/**
* enables showing a progress/spinner while data is loading
*/
show_progress: boolean;
/**
* enables sorting in the table
*/
sort: boolean;
/**
* sets the start value of the time scale (XAxis)
*/
start_date: Date;
/**
* sets the start day of weeks
*/
start_on_monday: boolean;
/**
* sets the step of the time scale (X-Axis)
*/
step: number;
/**
* specifies the second time scale(s)
*/
subscales: any;
/**
* sets the name of the attribute that will specify the id of the task's HTML element
*/
task_attribute: string;
/**
* sets the format of the date label in the 'Time period' section of the lightbox
*/
task_date: string;
/**
* sets the height of task bars in the timeline area
*/
task_height: number;
/**
* sets the offset (in pixels) of the nearest task from the left border in the timeline
*/
task_scroll_offset: number;
/**
* sets the format of the time drop-down selector in the lightbox
*/
time_picker: string;
/**
* sets the minimum step (in minutes) for the task's time values
*/
time_step: number;
/**
* sets the timeout in milliseconds before the tooltip is displayed for a task
*/
tooltip_timeout: number;
/**
* enables/disables the touch support for the Gantt chart
*/
touch: any;
/**
* defines the time period in milliseconds that is used to differ the long touch gesture from the scroll gesture
*/
touch_drag: any;
/**
* sets the date format that is used to parse data from the data set
*/
xml_date: string;
}
interface GanttDateHelpers{
add(origin: Date, count: number, unit: string): Date;
copy(origin: Date): Date;
date_part(origin: Date): Date;
time_part(origin: Date): Date;
day_start(origin: Date): Date;
month_start(origin: Date): Date;
week_start(origin: Date): Date;
year_start(origin: Date): Date;
getISOWeek(origin: Date): number;
getUTCISOWeek(origin: Date): number;
date_to_str(format: string): any;
str_to_date(format: string): any;
convert_to_utc(origin: Date): Date;
to_fixed(value: number): string;
}
interface GanttHotkeys{
edit_save: number;
edit_cancel: number;
}
//Gantt.locale
interface GanttLocaleDate{
month_full: string[];
month_short: string[];
day_full: string[];
day_short: string[];
}
interface GanttLocaleLabels{
new_task: string;
icon_save: string;
icon_cancel: string;
icon_details: string;
icon_edit: string;
icon_delete: string;
confirm_closing: string;
confirm_deleting: string;
section_description: string;
section_time: string;
confirm_link_deleting: string;
link_from: string;
link_to: string;
link_start: string;
link_end: string;
minutes: string;
hours: string;
days: string;
weeks: string;
months: string;
years: string;
}
interface GanttLocale{
date: GanttLocaleDate;
labels: GanttLocaleLabels;
}
interface GanttStatic{
templates: GanttTemplates;
config: GanttConfigOptions;
date: GanttDateHelpers;
keys: GanttHotkeys;
skin: String;
version: String;
locale: GanttLocale;
$click: any;
/**
* adds a new dependency link
* @param link the link object
*/
addLink(link: any): any;
/**
* adds a new task
* @param task the task object
* @param parent the parent's id
*/
addTask(task: any, parent: string): any;
/**
* attaches the handler to an inner event of dhtmlxGantt
* @param name the event's name, case-insensitive
* @param handler the handler function
*/
attachEvent(name: string, handler: (...args: any[])=>any): any;
/**
* calls an inner event
* @param name the event's name, case-insensitive
* @param params an array of the event-related data
*/
callEvent(name: string, params: any): boolean;
/**
* changes the link's id
* @param id the current link's id
* @param new_id the new link's id
*/
changeLinkId(id: any, new_id: any);
/**
* changes the task's id
* @param id the current task's id
* @param new_id the new task's id
*/
changeTaskId(id: any, new_id: any);
/**
* checks whether an event has some handler(s) specified
* @param name the event's name
*/
checkEvent(name: string): boolean;
/**
* removes all tasks from the Gantt chart
*/
clearAll();
/**
* closes the branch with the specified id
* @param id the branch id
*/
close(id : any);
/**
* deletes the specified dependency link
* @param id the dependency link's id
*/
deleteLink(id: any);
/**
* deletes the specified task
* @param id the task's id
*/
deleteTask(id: string);
/**
* detaches all handlers from events (which were attached before by the attachEvent() method)
*/
detachAllEvents();
/**
* detaches a handler from an event (which was attached before by the attachEvent() method)
* @param id the event's id
*/
detachEvent(id: string);
/**
* iterates over specified tasks of the Gantt chart
* @param code a function that will iterate over tasks. Takes a task object as a parameter
* @param parent the parent id. If specified, the function will iterate over childs of the <br> specified parent
* @param master the object, that 'this' will refer to
*/
eachTask(code : (...args: any[])=>any, parent?: any, master?: any);
/**
* returns the 1st-level child tasks of the specified parent branch
* @param id the parent branch's id
*/
getChildren(id: any): any;
/**
* get the index of a task in the tree
* @param id the task id
*/
getGlobalTaskIndex(id: any);
/**
* gets the label of a select control in the lightbox
* @param property the name of a data property that the control is mapped to
* @param key the option's id. This parameter is compared with the task's data property to <br> assign the select's option to the task
*/
getLabel(property: string, key: any);
/**
* gets the lightbox's HTML object element
*/
getLightbox(): HTMLElement;
/**
* returns the object of the lightbox's section
* @param name the name of the section
*/
getLightboxSection(name: string): any;
/**
* returns values of the lightbox's sections
*/
getLightboxValues(): any;
/**
* returns the dependency link object by the specified id
* @param id the link id
*/
getLink(id: any): any;
/**
* returns the HTML element of the specified dependency link
* @param id the link id
*/
getLinkNode(id: any): HTMLElement;
/**
* returns the id of the next item (no matter what the level of nesting is: the same or different)
* @param id the task id
*/
getNext(id: any): any;
/**
* returns the id of the previous item (no matter what the level of nesting is: the same or different)
* @param id the task id
*/
getPrev(id: any): any;
/**
* returns the scroll position
*/
getScrollState(): any;
/**
* returns the id of the selected task
*/
getSelectedId(): any;
/**
* gets the current state of the Gantt chart
*/
getState(): any;
/**
* returns the task object
* @param id the task id
*/
getTask(id: any): any;
/**
* returns a collection of tasks which occur during the specified period
* @param from the start date of the period
* @param to the end date of the period
*/
getTaskByTime(from?: Date, to?: Date): any;
/**
* get the index of a task in the branch
* @param id the task id
*/
getTaskIndex(id: any): number;
/**
* returns the HTML element of the task bar
* @param id the task id
*/
getTaskNode(id: any): HTMLElement;
/**
* returns the HTML element of the task row in the table
* @param id the task id
*/
getTaskRowNode(id: any): HTMLElement;
/**
* checks whether the specified item has child tasks
* @param id the task id
*/
hasChild(id: any): boolean;
/**
* hides the lightbox modal overlay that blocks interactions with the remaining screen
* @param box an element to hide
*/
hideCover(box?: HTMLElement);
/**
* closes the lightbox if it's currently active
*/
hideLightbox();
/**
* hides the pop-up task form (if it's currently active)
*/
hideQuickInfo();
/**
* constructor. Initializes a dhtmlxGantt object
* @param container an HTML container ( or its id) where a dhtmlxGantt object will be initialized
* @param from the start value of the time scale (X&ndash;Axis)
* @param to the end value of the time scale (X&ndash;Axis)
*/
init(container: any, from?: Date, to?: Date);
/**
* checks whether the specified link is correct
* @param link the link object
*/
isLinkAllowed(link: any): boolean;
/**
* checks whether the specified link exists
* @param id the link id
*/
isLinkExists(id: any): boolean;
/**
* checks whether the specified task exists
* @param id the task id
*/
isTaskExists(id: any): boolean;
/**
* checks whether the specifies task is currently rendered in the Gantt chart
* @param id the task's id
*/
isTaskVisible(id: any): boolean;
/**
* loads data to the gantt from an external data source
* @param url the server-side url (may be a static file or a server side script that outputs data)
* @param type <i>('json', 'xml', 'oldxml')</i> the data type. The default value - <i>'json'</i>
* @param callback the callback function
*/
load(url: string, type?: string, callback?: (...args: any[])=>any);
/**
* gets the id of a task from the specified HTML event
* @param e a native event
*/
locate(e: Event): string;
/**
* moves a task to a new position
* @param sid the id of the task to move
* @param tindex the index of the position that the task will be moved to <br> (the index in the whole tree)
* @param parent the parent id. If specified, the <b>tindex</b> will refer to the index in the <br> <b>'parent'</b> branch
*/
moveTask(sid: any, tindex: number, parent?: any);
/**
* opens the branch with the specified id
* @param id the branch id
*/
open(id: any);
/**
* loads data from a client-side resource
* @param url a string or object which represents data
* @param type ( <i>'json', 'xml'</i> ) the data type. The default value - <i>'json'</i>
*/
parse(url: any, type?: string);
/**
* refreshes data in the Gantt chart
*/
refreshData();
/**
* refreshes the specifies link
* @param id the link id
*/
refreshLink(id: any);
/**
* refreshes the task and its related links
* @param id the task id
*/
refreshTask(id: any);
/**
* renders the whole Gantt chart
*/
render();
/**
* removes the current lightbox's HTML object element
*/
resetLightbox();
/**
* forces the lightbox to resize
*/
resizeLightbox();
/**
* scrolls the Gantt container to the specified position
* @param x the value of the horizontal scroll
* @param y the value of the vertical scroll
*/
scrollTo(x: number, y: number);
/**
* selects the specified task
* @param id the task id
*/
selectTask(id: any): any;
/**
* serializes the data into JSON or XML format.
* @param type the format that the data will be serialized into. <br> Possible values: 'json' (<i>default</i> ), 'xml'.
*/
serialize(type?: string);
/**
* returns a list of options
* @param list_name the name of a list
* @param options an array of options
*/
serverList(list_name: string, options?: any);
/**
* resizes the Gantt chart
*/
setSizes();
/**
* shows the lightbox modal overlay that blocks interactions with the remaining screen
* @param box an element to hide
*/
showCover(box?: HTMLElement);
/**
* opens the lightbox for the specified task
* @param id the task id
*/
showLightbox(id : any);
/**
* displays the pop-up task form for the specified task
* @param id the task id
*/
showQuickInfo(id: any);
/**
* makes the specified task visible on the screen
* @param id the task id
*/
showTask(id: any);
/**
* sorts the tasks in the grid
* @param field the name of the column that the grid will be sorted by or a custom <br> sorting function
* @param desc specifies the sorting direction: <i>true</i> - descending sort and <i>false</i> - ascending<br> sort. By default, <i>false</i>
* @param parent the id of the parent task. Specify the parameter if you want to sort tasks only in <br> the branch of the specified parent.
*/
sort(field: any, desc?: boolean, parent?: any);
/**
* removes selection from the selected task
*/
unselectTask();
/**
* updates the specified dependency link
* @param id the task id
*/
updateLink(id: string);
/**
* updates the specified task
* @param id the task id
*/
updateTask(id: string);
}
declare var gantt: GanttStatic;
+33
View File
@@ -0,0 +1,33 @@
/// <reference path="dhtmlxscheduler.d.ts" />
//date operations
var start: Date = scheduler.date.week_start(new Date());
var next: Date = scheduler.date.add(new Date(), 1, "week");
//hotkeys
scheduler.keys.edit_cancel = 13;
//config options
scheduler.config.details_on_create = true;
scheduler.config.xml_date = "%m-%d-%Y";
scheduler.xy.bar_height = 40;
//templates
scheduler.templates.event_class = function (start: Date, end: Date, event: any) {
if (event.some)
return "classA";
else
return "classB";
}
//locale
scheduler.locale.labels.week_tab = "7 days";
//API
scheduler.init("scheduler_here", start);
scheduler.load("/data/events");
//events
scheduler.attachEvent("onEmptyClick", function (ev: Event) {
var date: Date = scheduler.getActionData(ev).date;
});
File diff suppressed because it is too large Load Diff
+1 -1
View File
@@ -960,7 +960,7 @@ declare module 'plugins/dialog' {
* @param {object} obj The object whose dialog should be closed.
* @param {object} result* The results to return back to the dialog caller after closing.
*/
export function close(obj: any): void;
export function close(obj: any, ...result: any[]): void;
/**
* Shows a dialog.
+2 -1
View File
@@ -596,11 +596,12 @@ declare module createjs {
autoClear: boolean;
canvas: HTMLCanvasElement;
mouseInBounds: boolean;
mouseMoveOutside: boolean;
mouseX: number;
mouseY: number;
snapToPixelEnabled: boolean;
tickOnUpdate: boolean;
new (): Stage;
new (canvas: HTMLElement): Stage;
+37
View File
@@ -0,0 +1,37 @@
/// <reference path="giraffe.d.ts" />
class User extends Giraffe.Model {
}
class MainView extends Giraffe.View {
constructor(options?) {
this.appEvents = {
'startup': 'app_onStartup'
}
super(options)
}
app_onStartup() {
}
}
class MyApp extends Giraffe.App {
constructor() {
this.routes= {
'': 'home'
}
super()
}
home() {
this.attach( new MainView )
}
}
var app= new MyApp();
app.start();
+186
View File
@@ -0,0 +1,186 @@
// Type definitions for Giraffe
// Project: https://github.com/barc/backbone.giraffe
// Definitions by: Matt McCray <https://github.com/darthapo>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
/// <reference path="../backbone/backbone.d.ts" />
declare module Giraffe {
interface GiraffeObject {
app: App;
appEvents?: StringMap;
dataEvents?: StringMap;
defaultOptions?: DefaultOptions;
initialize?();
beforeInitialize?();
afterInitialize?();
dispose?();
beforeDispose?();
afterDispose?();
}
interface AttachmentOptions {
method?: string;
forceRender?: boolean;
suppressRender?: boolean;
}
interface DefaultOptions {
disposeOnDetach?: boolean;
alwaysRender?: boolean;
saveScrollPosition?: boolean;
documentTitle?: string;
}
interface AppMap {
[ cid:string ]: App;
}
interface ViewMap {
[ cid:string ]: View;
}
interface StringMap {
[ def:string ]: string;
}
var app: App;
var apps: AppMap;
var defaultOptions: DefaultOptions;
var version: string;
var views: ViewMap;
function bindAppEvents( instance:GiraffeObject ): GiraffeObject;
function bindDataEvents( instance:GiraffeObject ): GiraffeObject;
function bindEvent( context:Backbone.Events, target:Backbone.Events, event:any, callback:Function );
function unbindEvent( context:Backbone.Events, target:Backbone.Events, event:any, callback:Function );
function bindEventMap( context:Backbone.Events, target:Backbone.Events, eventMap:any );
function unbindEventMap( context:Backbone.Events, target:Backbone.Events, eventMap:any );
function configure( instance:any, options?:any );
function dispose( instance:GiraffeObject, ...args:any[] ): GiraffeObject;
function disposeThis( ...args:any[] ): GiraffeObject;
function wrapFn( obj:any, name:string, before:Function, after:Function);
class Collection extends Backbone.Collection implements GiraffeObject {
app: App;
model: Model;
}
class Model extends Backbone.Model implements GiraffeObject {
app: App;
}
class Router extends Backbone.Router implements GiraffeObject {
app: App;
namespace: string;
triggers: StringMap;
cause( appEvent:string, ...args:any[] );
isCaused( appEvent:string, ...args:any[] ): boolean;
getRoute( appEvent:string, ...args:any[] ): string;
reload( url:string );
}
class View extends Backbone.View implements GiraffeObject {
app: App;
appEvents: StringMap;
children: View[];
dataEvents: StringMap;
defaultOptions: DefaultOptions;
documentTitle: string;
parent: View;
template: any;
ui: StringMap;
attachTo( el:any, options?:AttachmentOptions ): View;
attach( view:View, options?:AttachmentOptions ): View;
isAttached( el:any ): boolean;
render( options?:any ): View;
beforeRender();
afterRender();
templateStrategy(): string;
serialize(): any;
setParent( parent:View ): View;
addChild( child:View ): View;
addChildren( children:View[] ): View;
removeChild( child:View, preserve?:boolean ): View;
removeChildren( preserve?:boolean ): View;
detach( preserve?:boolean ): View;
detachChildren( preserve?:boolean ): View;
invoke( method:string, ...args:any[] );
dispose(): View;
beforeDispose(): View;
afterDispose(): View;
static detachByElement( el:any, preserve?:boolean ): View;
static getClosestView( el:any ): View;
static getByCid( cid:string ): View;
static to$El( el:any, parent?:any, allowParentMatch?:boolean ): JQuery;
static setDocumentEvents( events:string[], prefix?:string ): string[];
static removeDocumentEvents( prefix?:string );
static setDocumentEventPrefix( prefix?:string );
static setTemplateStrategy( strategy:any, instance?:any );
}
class App extends View {
routes: StringMap;
addInitializer( initializer:( options?:any, callback?:()=>void )=>void ): App;
start( options?:any ): App;
}
module Contrib {
class Controller extends Backbone.Events implements GiraffeObject {
app: App;
}
class CollectionView extends View {
collection: Collection;
modelView: View;
modelViewArgs: any[];
modelViewEl: any;
renderOnChange: boolean;
findByModel( model:Model ): View;
addOne( model:Model ): View;
removeOne( model:Model ): View;
static getDefaults( ctx:any ): any;
}
class FastCollectionView extends View {
collection: Collection;
modelTemplate: any;
modelTemplateStrategy: string;
modelEl: any;
renderOnChange: boolean;
modelSerialize(): any;
addAll(): View;
addOne( model:Model ): View;
removeOne( model:Model ): View;
removeByIndex( index:number ): View;
findElByModel( model:Model ): JQuery;
findElByIndex( index:number ): JQuery;
findModelByEl( el:any ): Model;
static getDefaults( ctx:any ): any;
}
}
}
+1 -1
View File
@@ -866,7 +866,7 @@ declare module google.maps {
export interface ImageMapTypeOptions {
alt?: string;
getTileUrl: (Point: number) => string;
getTileUrl: (tileCoord: Point, zoom: number) => string;
maxZoom?: number;
minZoom?: number;
name?: string;
+19 -8
View File
@@ -6,17 +6,28 @@
declare module Handlebars {
function registerHelper(name: string, fn: Function, inverse?: boolean): void;
function registerPartial(name: string, str): void;
function K();
function createFrame(object);
function registerPartial(name: string, str: any): void;
function K(): void;
function createFrame(object: any): any;
function Exception(message: string): void;
class SafeString {
constructor(str: string);
static toString(): string;
}
function parse(string: string);
function print(ast);
var logger;
function log(level, str): void;
function compile(environment, options?, context?, asObject?);
function parse(input: string): boolean;
var logger: Logger;
function log(level: number, obj: any): void;
function compile(input: any, options?: any): (context: any, options?: any) => string;
interface Logger {
DEBUG: number;
INFO: number;
WARN: number;
ERROR: number;
level: number;
methodMap: { [level: number]: string };
log(level: number, obj: string): void;
}
}
+14 -2
View File
@@ -39,7 +39,8 @@ $('.datepicker').pickadate({
// Escape any "rule" characters with an exclamation mark (!).
format: 'You selecte!d: dddd, dd mmm, yyyy',
formatSubmit: 'yyyy/mm/dd',
hiddenSuffix: '--submit'
hiddenPrefix: 'prefix__',
hiddenSuffix: '__suffix'
});
$('.datepicker').pickadate({
@@ -88,6 +89,13 @@ $('.datepicker').pickadate({
]
});
$('.datepicker').pickadate({
disable: [
new Date(2013, 3, 13),
new Date(2013, 3, 29)
]
});
$('.datepicker').pickadate({
disable: [
true,
@@ -140,7 +148,8 @@ $('.timepicker').pickatime({
format: 'T!ime selected: h:i a',
formatLabel: '<b>h</b>:i <!i>a</!i>',
formatSubmit: 'HH:i',
hiddenSuffix: '--submit'
hiddenPrefix: 'prefix__',
hiddenSuffix: '__suffix'
});
$('.timepicker').pickatime({
@@ -266,6 +275,9 @@ picker.get('disable');
picker.set('clear');
// reset disabled dates
picker.set('disable', undefined);
// Using arrays formatted as [YEAR,MONTH,DATE].
picker.set('select', [2013, 3, 20]);
+4 -2
View File
@@ -1,4 +1,4 @@
// Type definitions for pickadate.js 3.2.0
// Type definitions for pickadate.js 3.3.0
// Project: https://github.com/amsul/pickadate.js
// Definitions by: Theodore Brown <https://github.com/theodorejb/>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
@@ -37,6 +37,7 @@ interface pickadateOptions extends pickerOptions {
// Formats
format?: string; // default 'd mmmm, yyyy'
formatSubmit?: string; // e.g. 'yyyy/mm/dd'
hiddenPrefix?: string; // default undefined
hiddenSuffix?: string; // default '_submit'
// Dropdown selectors
@@ -51,7 +52,7 @@ interface pickadateOptions extends pickerOptions {
max?: any;
// Disable dates
disable?: any[]; // arrays formatted as [YEAR,MONTH,DATE] or integers representing days of the week (from 1 to 7). Switch to whitelist by setting first item in collection to `true`.
disable?: any[]; // Date objects, arrays formatted as [YEAR,MONTH,DATE], or integers representing days of the week (from 1 to 7). Switch to whitelist by setting first item in collection to `true`.
// Classes
klass?: {
@@ -119,6 +120,7 @@ interface pickatimeOptions extends pickerOptions {
format?: string; // default 'h:i A'
formatLabel?: any;
formatSubmit?: string;
hiddenPrefix?: string; // default undefined
hiddenSuffix?: string; // default '_submit'
// Time intervals
@@ -190,6 +190,12 @@ function test_methods() {
var validator = $("#myform").validate();
validator.resetForm();
validator.showErrors({ "firstname": "I know that your firstname is Pete, Pete!" });
validator.hideErrors();
var isValid: boolean = validator.valid();
var size: number = validator.size();
var errorMap: Object = validator.errorMap;
var errorList: ErrorListItem[] = validator.errorList;
$("#summary").text(validator.numberOfInvalids() + " field(s) are invalid");
jQuery.validator.setDefaults({
debug: true
+12
View File
@@ -36,6 +36,12 @@ interface ValidationOptions
wrapper?: string;
}
interface ErrorListItem
{
message: string;
element: HTMLElement;
}
interface Validator
{
addClassRules(name: string, rules: any): void;
@@ -49,6 +55,12 @@ interface Validator
setDefaults(defaults: ValidationOptions): void;
settings: ValidationOptions;
showErrors(errors: any): void;
hideErrors(): void;
valid(): boolean;
size(): number;
errorMap: Object;
errorList: ErrorListItem[];
}
interface JQuery
+1 -1
View File
@@ -156,7 +156,7 @@ interface BaseJQueryEventObject extends Event {
pageX: number;
pageY: number;
which: number;
metaKey: any;
metaKey: boolean;
}
interface JQueryInputEventObject extends BaseJQueryEventObject {
+15
View File
@@ -0,0 +1,15 @@
// Type definitions for Knockout.Mapper
// Project: https://github.com/LucasLorentz/knockout.mapper
// Definitions by: Brandon Meyer <https://github.com/BMeyerKC>
// Definitions https://github.com/borisyankov/DefinitelyTyped
/// <reference path="../knockout/knockout.d.ts" />
interface KnockoutMapper {
fromJS(value: any, options?: any, target?: any, wrap?: boolean): any;
toJS(value: any, options?: any): any;
}
interface KnockoutStatic {
mapper: KnockoutMapper;
}
+14
View File
@@ -242,22 +242,36 @@ interface KnockoutUtils {
fieldsIncludedWithJsonPost: any[];
arrayForEach<T>(array: T[], action: (item: T) => void): void;
arrayForEach(array: any[], action: (any) => void ): void;
arrayIndexOf(array: any[], item: any): number;
arrayFirst<T>(array: T[], predicate: (item: T) => boolean, predicateOwner?: any): T;
arrayFirst(array: any[], predicate: (item) => boolean, predicateOwner?: any): any;
arrayRemoveItem(array: any[], itemToRemove: any): void;
arrayGetDistinctValues<T>(array: T[]): T[];
arrayGetDistinctValues(array: any[]): any[];
arrayMap<T, U>(array: T[], mapping: (item: T) => U): U[];
arrayMap(array: any[], mapping: (item) => any): any[];
arrayFilter<T>(array: T[], predicate: (item: T) => boolean): T[];
arrayFilter(array: any[], predicate: (item) => boolean): any[];
arrayPushAll<T>(array: T[], valuesToPush: T[]): T[];
arrayPushAll(array: any[], valuesToPush: any[]): any[];
arrayPushAll<T>(array: KnockoutObservableArray<T>, valuesToPush: T[]): T[];
arrayPushAll(array: KnockoutObservableArray<any>, valuesToPush: any[]): any[];
extend(target, source);
+10 -13
View File
@@ -1581,7 +1581,7 @@ declare module L {
* used in GeoJSON for points. If reverse is set to true, the numbers will be interpreted
* as (longitude, latitude).
*/
static coordsToLatlng(coords: Array, reverse?: boolean): LatLng;
static coordsToLatlng(coords: number[], reverse?: boolean): LatLng;
/**
* Creates a multidimensional array of LatLng objects from a GeoJSON coordinates
@@ -1589,7 +1589,7 @@ declare module L {
* 1 for an array of arrays of points, etc., 0 by default). If reverse is set to
* true, the numbers will be interpreted as (longitude, latitude).
*/
static coordsToLatlngs(coords: Array, levelsDeep?: number, reverse?: boolean): Array;
static coordsToLatlngs(coords: number[], levelsDeep?: number, reverse?: boolean): LatLng[];
}
@@ -1903,20 +1903,17 @@ declare module L {
* Creates an icon instance with the given options.
*/
constructor(options: IconOptions);
/**
* Default properties for newly constructed icons.
*/
public static Default : IconDefault;
}
export class IconDefault extends Icon {
/**
* Creates an icon instance with default options.
*/
constructor();
export module Icon {
export class Default extends Icon {
/**
* Creates an icon instance with default options.
*/
constructor();
imagePath: string;
static imagePath: string;
}
}
export interface DivIconOptions {
+150
View File
@@ -0,0 +1,150 @@
/// <reference path="../jquery/jquery.d.ts" />
/// <reference path="mCustomScrollbar.d.ts" />
class SimpleTest {
element: JQuery;
constructor() {
this.element = $(".content");
this.element.mCustomScrollbar({
scrollButtons: {
enable: true
}
});
}
}
class SimpleTestAllParams {
element: JQuery;
constructor() {
this.element = $(".content");
this.element.mCustomScrollbar({
set_width: false,
set_height: false,
horizontalScroll: false,
scrollInertia: 950,
mouseWheel: true,
mouseWheelPixels: "auto",
autoDraggerLength: true,
autoHideScrollbar: false,
scrollButtons: {
enable: false,
scrollType: "continuous",
scrollSpeed: "auto",
scrollAmount: 40
},
advanced: {
updateOnBrowserResize: true,
updateOnContentResize: false,
autoExpandHorizontalScroll: false,
autoScrollOnFocus: true,
normalizeMouseWheelDelta: false
},
contentTouchScroll: true,
callbacks: {
onScrollStart: () => { },
onScroll: () => { },
onTotalScroll: () => { },
onTotalScrollBack: () => { },
onTotalScrollOffset: 0,
onTotalScrollBackOffset: 0,
whileScrolling: () => { }
},
theme: "light"
});
}
}
class CallbacksTest {
element: JQuery;
constructor() {
this.element = $(".content");
this.element.mCustomScrollbar({
scrollButtons: {
enable: true
},
callbacks: {
onScrollStart: () => {
this.OnScrollStart();
},
onScroll: () => {
this.OnScroll();
},
onTotalScroll: () => {
this.OnTotalScroll();
},
onTotalScrollBack: () => {
this.OnTotalScrollBack();
},
onTotalScrollOffset: 40,
onTotalScrollBackOffset: 20,
whileScrolling: () => {
this.WhileScrolling();
}
}
});
}
OnScrollStart() {
$(".output .onScrollStart").stop(true, true).css("display", "inline-block").delay(500).fadeOut(500);
}
OnScroll() {
$(".output .onScroll").stop(true, true).css("display", "inline-block").delay(500).fadeOut(500);
}
OnTotalScroll() {
$(".output .onTotalScroll").stop(true, true).css("display", "inline-block").delay(500).fadeOut(500);
}
OnTotalScrollBack() {
$(".output .onTotalScrollBack").stop(true, true).css("display", "inline-block").delay(500).fadeOut(500);
}
WhileScrolling() {
$(".output .whileScrolling").stop(true, true).css("display", "inline-block").fadeOut(500);
}
}
class DisableDestroyTest {
element: JQuery;
constructor() {
this.element = $(".content");
this.element.mCustomScrollbar({
scrollButtons: {
enable: true
}
});
$("#disable-scrollbar").click((e) => {
e.preventDefault();
this.element.mCustomScrollbar("disable", true);
});
$("#disable-scrollbar-no-reset").click((e) => {
e.preventDefault();
this.element.mCustomScrollbar("disable");
});
$("#enable-scrollbar").click((e) => {
e.preventDefault();
this.element.mCustomScrollbar("update");
});
$("#destroy-scrollbar").click((e) => {
e.preventDefault();
this.element.mCustomScrollbar("destroy");
});
$("#rebuild-scrollbar").click((e) => {
this.element.mCustomScrollbar({
scrollButtons: {
enable: true
}
});
});
}
}
+152
View File
@@ -0,0 +1,152 @@
// Type definitions for mCustomScrollbar 2.8.2
// Project: https://github.com/malihu/malihu-custom-scrollbar-plugin
// Definitions by: Sarah Williams <https://github.com/flurg>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
/// <reference path="../jquery/jquery.d.ts" />
declare module MCustomScrollbar {
interface CustomScrollbarOptions {
/**
* Set the width of your content (overwrites CSS width), value in pixels (integer) or percentage (string)
*/
set_width?: any;
/**
* Set the height of your content (overwirtes CSS height), value in pixels (integer) or percentage (string)
*/
set_height?: any;
/**
* Add horizontal scrollbar (default is vertical), value: true, false
*/
horizontalScroll?: boolean;
/**
* Scrolling inertia (easing), value in milliseconds (0 for no scrolling inertia)
*/
scrollInertia?: number;
/**
* Mouse wheel support, value: true, false
*/
mouseWheel?: boolean;
/**
* Mouse wheel scrolling pixels amount, value in pixels (integer) or "auto" (script calculates and sets pixels amount according to content length)
*/
mouseWheelPixels?: any;
/**
* Auto-adjust scrollbar height/width according to content, values: true, false
*/
autoDraggerLength?: boolean;
/**
* Automatically hide the scrollbar when idle or mouse is not over the content
*/
autoHideScrollbar?: boolean;
scrollButtons?: {
/**
* Scroll buttons scroll type, values: "continuous" (scroll continuously while pressing the button), "pixels" (scrolls by a fixed number of pixels on each click")
*/
scrollType?: string;
/**
* Scroll buttons continuous scrolling speed, integer value or "auto" (script calculates and sets the speed according to content length)
*/
scrollSpeed?: any;
/**
* Scroll buttons pixels scrolling amount, value in pixels
*/
scrollAmount?: number;
}
advanced?: {
/**
* Update scrollbars on browser resize (for fluid content blocks and layouts based on percentages), values: true, false. Set to false only when you content has fixed dimensions
*/
updateOnBrowserResize?: boolean;
/**
* Auto-update scrollbars on content resize (useful when adding/changing content progrmatically), value: true, false. Setting this to true makes the script check for content
* length changes (every few milliseconds) and automatically call plugin's update method to adjust the scrollbar accordingly
*/
updateOnContentResize?: boolean;
/**
* Auto-expanding content's width on horizontal scrollbars, values: true, false. Set to true if you have horizontal scrollbr on content that change on-the-fly. Demo contains
* blocks with images and horizontal scrollbars that use this option parameter
*/
autoExpandHorizontalScroll?: boolean;
/**
* Auto-scrolling on elements that have focus (e.g. scrollbar automatically scrolls to form text fields when the TAB key is pressed), values: true, false
*/
autoScrollOnFocus?: boolean;
/**
* Normalize mouse wheel delta (-1/1), values: true, false
*/
normalizeMouseWheelDelta?: boolean;
}
/**
* Additional scrolling method by touch-swipe content (for touch enabled devices), value: true, false
*/
contentTouchScroll?: boolean;
/**
* All of the following callbacks option have examples in the callback demo - http://manos.malihu.gr/tuts/custom-scrollbar-plugin/callbacks_example.html
*/
callbacks?: {
/**
* User defined callback function, triggered on scroll start event. You can call your own function(s) each time a scroll event begins
*/
onScrollStart?: () => void;
/**
* User defined callback function, triggered on scroll event. Call your own function(s) each time a scroll event completes
*/
onScroll?: () => void;
/**
* User defined callback function, triggered when scroll end-limit is reached
*/
onTotalScrollBack?: () => void;
/**
* Scroll end-limit offset, value in pixels
*/
onTotalScrollOffset?: number;
/**
* User defined callback function, triggered while scrolling
*/
whileScrolling?: () => void;
}
/**
* Set a scrollbar ready-to-use theme. See themes demo for all themes - http://manos.malihu.gr/tuts/custom-scrollbar-plugin/scrollbar_themes_demo.html
*/
theme?: string;
}
interface ScrollToParameterOptions {
/**
* Scroll-to animation speed, value in milliseconds
*/
scrollInertia?: number;
/**
* Scroll scrollbar dragger (instead of content) to a number of pixels, values: true, false
*/
moveDragger?: boolean;
/**
* Trigger user defined callback after scroll-to completes, value: true, false
*/
callbacks?: boolean;
}
}
interface JQuery {
/**
* Creates a new mCustomScrollbar with the specified or default options
*
* @param options Override default options
*/
mCustomScrollbar(options?: MCustomScrollbar.CustomScrollbarOptions): JQuery;
/**
* Calls specified methods on the scrollbar "update", "stop", "disable", "destroy"
*
* @param method Method name to call on scrollbar e.g. "update", "stop"
*/
mCustomScrollbar(method: string): JQuery;
/**
* Calls the scrollTo method on the scrollbar
*
* @param scrollTo Method name as a string "scrollTo"
* @param parameter String or pixel integer value to specify where to scroll to e.g. "bottom", "top" or 20
* @param options Override default options
*/
mCustomScrollbar(scrollTo: string, parameter: any, options?: MCustomScrollbar.ScrollToParameterOptions): JQuery;
}
+12 -12
View File
@@ -129,35 +129,35 @@ interface Moment {
isBefore(b: string): boolean;
isBefore(b: Number): boolean;
isBefore(b: Date): boolean;
isBefore(b: Array): boolean;
isBefore(b: number[]): boolean;
isBefore(b: Moment, granularity: string): boolean;
isBefore(b: String, granularity: string): boolean;
isBefore(b: Number, granularity: string): boolean;
isBefore(b: Date, granularity: string): boolean;
isBefore(b: Array, granularity: string): boolean;
isBefore(b: number[], granularity: string): boolean;
isAfter(): boolean;
isAfter(b: Moment): boolean;
isAfter(b: string): boolean;
isAfter(b: Number): boolean;
isAfter(b: Date): boolean;
isAfter(b: Array): boolean;
isAfter(b: number[]): boolean;
isAfter(b: Moment, granularity: string): boolean;
isAfter(b: String, granularity: string): boolean;
isAfter(b: Number, granularity: string): boolean;
isAfter(b: Date, granularity: string): boolean;
isAfter(b: Array, granularity: string): boolean;
isAfter(b: number[], granularity: string): boolean;
isSame(b: Moment): boolean;
isSame(b: string): boolean;
isSame(b: Number): boolean;
isSame(b: Date): boolean;
isSame(b: Array): boolean;
isSame(b: number[]): boolean;
isSame(b: Moment, granularity: string): boolean;
isSame(b: String, granularity: string): boolean;
isSame(b: Number, granularity: string): boolean;
isSame(b: Date, granularity: string): boolean;
isSame(b: Array, granularity: string): boolean;
isSame(b: number[], granularity: string): boolean;
lang(language: string): void;
lang(reset: boolean): void;
@@ -268,34 +268,34 @@ interface MomentStatic {
isBefore(b: string): boolean;
isBefore(b: Number): boolean;
isBefore(b: Date): boolean;
isBefore(b: Array): boolean;
isBefore(b: number[]): boolean;
isBefore(b: Moment, granularity: string): boolean;
isBefore(b: String, granularity: string): boolean;
isBefore(b: Number, granularity: string): boolean;
isBefore(b: Date, granularity: string): boolean;
isBefore(b: Array, granularity: string): boolean;
isBefore(b: number[], granularity: string): boolean;
isAfter(b: Moment): boolean;
isAfter(b: string): boolean;
isAfter(b: Number): boolean;
isAfter(b: Date): boolean;
isAfter(b: Array): boolean;
isAfter(b: number[]): boolean;
isAfter(b: Moment, granularity: string): boolean;
isAfter(b: String, granularity: string): boolean;
isAfter(b: Number, granularity: string): boolean;
isAfter(b: Date, granularity: string): boolean;
isAfter(b: Array, granularity: string): boolean;
isAfter(b: number[], granularity: string): boolean;
isSame(b: Moment): boolean;
isSame(b: string): boolean;
isSame(b: Number): boolean;
isSame(b: Date): boolean;
isSame(b: Array): boolean;
isSame(b: number[]): boolean;
isSame(b: Moment, granularity: string): boolean;
isSame(b: String, granularity: string): boolean;
isSame(b: Number, granularity: string): boolean;
isSame(b: Date, granularity: string): boolean;
isSame(b: Array, granularity: string): boolean;
isSame(b: number[], granularity: string): boolean;
}
declare var moment: MomentStatic;
+6
View File
@@ -655,6 +655,12 @@ function test_notification() {
onConfirm,
'Game Over',
'Restart,Exit'
);
navigator.notification.confirm(
'You are the winner!',
onConfirm,
'Game Over',
['Restart','Exit']
);
navigator.notification.beep(2);
navigator.notification.vibrate(2500);
+1
View File
@@ -478,6 +478,7 @@ declare var Media: {
interface Notification {
alert(message: string, alertCallback: Function, title?: string, buttonName?: string): void;
confirm(message: string, confirmCallback: Function, title?: string, buttonLabels?: string): void;
confirm(message: string, confirmCallback: Function, title?: string, buttonLabels?: string[]): void;
beep(times: number): void;
vibrate(milliseconds: number): void;
}
Vendored
+16 -15
View File
@@ -8,10 +8,10 @@ declare function Q<T>(promise: Q.IPromise<T>): Q.Promise<T>;
declare module Q {
interface IPromise<T> {
then<U>(onFulfill: (value: T) => U, onReject?: (reason) => U): IPromise<U>;
then<U>(onFulfill: (value: T) => IPromise<U>, onReject?: (reason) => IPromise<U>): IPromise<U>;
then<U>(onFulfill: (value: T) => IPromise<U>, onReject?: (reason) => U): IPromise<U>;
then<U>(onFulfill: (value: T) => U, onReject?: (reason) => IPromise<U>): IPromise<U>;
then<U>(onFulfill: (value: T) => IPromise<U>, onReject?: (reason) => IPromise<U>): IPromise<U>;
then<U>(onFulfill: (value: T) => U, onReject?: (reason) => U): IPromise<U>;
}
interface Deferred<T> {
@@ -26,10 +26,10 @@ declare module Q {
fin(finallyCallback: () => any): Promise<T>;
finally(finallyCallback: () => any): Promise<T>;
then<U>(onFulfill: (value: T) => U, onReject?: (reason) => U, onProgress?: Function): Promise<U>;
then<U>(onFulfill: (value: T) => IPromise<U>, onReject?: (reason) => IPromise<U>, onProgress?: Function): Promise<U>;
then<U>(onFulfill: (value: T) => IPromise<U>, onReject?: (reason) => U, onProgress?: Function): Promise<U>;
then<U>(onFulfill: (value: T) => U, onReject?: (reason) => IPromise<U>, onProgress?: Function): Promise<U>;
then<U>(onFulfill: (value: T) => IPromise<U>, onReject?: (reason) => IPromise<U>, onProgress?: Function): Promise<U>;
then<U>(onFulfill: (value: T) => U, onReject?: (reason) => U, onProgress?: Function): Promise<U>;
spread<U>(onFulfilled: Function, onRejected?: Function): Promise<U>;
@@ -71,22 +71,22 @@ declare module Q {
}
// if no fulfill, reject, or progress provided, returned promise will be of same type
export function when<T>(value: T): Promise<T>;
export function when<T>(value: IPromise<T>): Promise<T>;
export function when<T>(value: T): Promise<T>;
// If a non-promise value is provided, it will not reject or progress
export function when<T, U>(value: T, onFulfilled: (val: T) => U): Promise<U>;
export function when<T, U>(value: T, onFulfilled: (val: T) => IPromise<U>): Promise<U>;
export function when<T, U>(value: T, onFulfilled: (val: T) => U): Promise<U>;
export function when<T, U>(value: IPromise<T>, onFulfilled: (val: T) => U, onRejected?: (reason) => U, onProgress?: (progress) => any): Promise<U>;
export function when<T, U>(value: IPromise<T>, onFulfilled: (val: T) => IPromise<U>, onRejected?: (reason) => IPromise<U>, onProgress?: (progress) => any): Promise<U>;
export function when<T, U>(value: IPromise<T>, onFulfilled: (val: T) => IPromise<U>, onRejected?: (reason) => U, onProgress?: (progress) => any): Promise<U>;
export function when<T, U>(value: IPromise<T>, onFulfilled: (val: T) => U, onRejected?: (reason) => IPromise<U>, onProgress?: (progress) => any): Promise<U>;
export function when<T, U>(value: IPromise<T>, onFulfilled: (val: T) => IPromise<U>, onRejected?: (reason) => IPromise<U>, onProgress?: (progress) => any): Promise<U>;
export function when<T, U>(value: IPromise<T>, onFulfilled: (val: T) => U, onRejected?: (reason) => U, onProgress?: (progress) => any): Promise<U>;
//export function try(method: Function, ...args: any[]): Promise<any>; // <- This is broken currently - not sure how to fix.
export function fbind<T>(method: (...args: any[]) => T, ...args: any[]): (...args: any[]) => Promise<T>;
export function fbind<T>(method: (...args: any[]) => IPromise<T>, ...args: any[]): (...args: any[]) => Promise<T>;
export function fbind<T>(method: (...args: any[]) => T, ...args: any[]): (...args: any[]) => Promise<T>;
export function fcall<T>(method: (...args) => T, ...args: any[]): Promise<T>;
@@ -110,14 +110,15 @@ declare module Q {
export function allResolved<T>(promises: any[]): Promise<Promise<T>[]>;
export function allResolved<T>(promises: IPromise<T>[]): Promise<Promise<T>[]>;
export function spread<U>(promises: any[], onFulfilled: (...args: any[]) => U, onRejected: (reason) => U): Promise<U>;
export function spread<U>(promises: any[], onFulfilled: (...args: any[]) => IPromise<U>, onRejected: (reason) => IPromise<U>): Promise<U>;
export function spread<U>(promises: any[], onFulfilled: (...args: any[]) => IPromise<U>, onRejected: (reason) => U): Promise<U>;
export function spread<U>(promises: any[], onFulfilled: (...args: any[]) => U, onRejected: (reason) => IPromise<U>): Promise<U>;
export function spread<U>(promises: any[], onFulfilled: (...args: any[]) => IPromise<U>, onRejected: (reason) => IPromise<U>): Promise<U>;
export function spread<T, U>(promises: IPromise<T>[], onFulfilled: (...args: T[]) => U, onRejected: (reason) => U): Promise<U>;
export function spread<U>(promises: any[], onFulfilled: (...args: any[]) => U, onRejected: (reason) => U): Promise<U>;
export function spread<T, U>(promises: IPromise<T>[], onFulfilled: (...args: T[]) => IPromise<U>, onRejected: (reason) => IPromise<U>): Promise<U>;
export function spread<T, U>(promises: IPromise<T>[], onFulfilled: (...args: T[]) => IPromise<U>, onRejected: (reason) => U): Promise<U>;
export function spread<T, U>(promises: IPromise<T>[], onFulfilled: (...args: T[]) => U, onRejected: (reason) => IPromise<U>): Promise<U>;
export function spread<T, U>(promises: IPromise<T>[], onFulfilled: (...args: T[]) => IPromise<U>, onRejected: (reason) => IPromise<U>): Promise<U>;
export function spread<T, U>(promises: IPromise<T>[], onFulfilled: (...args: T[]) => U, onRejected: (reason) => U): Promise<U>;
export function timeout<T>(promise: Promise<T>, ms: number, message?: string): Promise<T>;
@@ -132,8 +133,8 @@ declare module Q {
export function reject(reason?): Promise<any>;
export function promise<T>(resolver: (resolve: (val: T) => void , reject: (reason) => void , notify: (progress) => void ) => void ): Promise<T>;
export function promise<T>(resolver: (resolve: (val: IPromise<T>) => void , reject: (reason) => void , notify: (progress) => void ) => void ): Promise<T>;
export function promise<T>(resolver: (resolve: (val: T) => void , reject: (reason) => void , notify: (progress) => void ) => void ): Promise<T>;
export function promised<T>(callback: (...any) => T): (...any) => Promise<T>;
@@ -147,8 +148,8 @@ declare module Q {
export var oneerror: () => void;
export var longStackSupport: boolean;
export function resolve<T>(object: T): Promise<T>;
export function resolve<T>(object: IPromise<T>): Promise<T>;
export function resolve<T>(object: T): Promise<T>;
}
declare module "q" {
+8 -1
View File
@@ -72,7 +72,7 @@ interface RequireConfig {
// Path mappings for module names not found directly under
// baseUrl.
paths?: { [key: string]: string; };
paths?: { [key: string]: any; };
// Dictionary of Shim's.
// does not cover case of key->string[]
@@ -222,6 +222,13 @@ interface Require {
* Configure require.js
**/
config(config: RequireConfig): Require;
/**
* CommonJS require call
* @param module Module to load
* @return The loaded module
*/
(module: string): any;
/**
* Start the main app logic.
+24 -24
View File
@@ -4,23 +4,23 @@ SlickGrid-2.1.d.ts may be freely distributed under the MIT license.
Copyright (c) 2013 Josh Baldwin https://github.com/jbaldwin/SlickGrid.d.ts
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the "Software"), to deal in the Software without
restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the
obtaining a copy of this software and associated documentation
files (the "Software"), to deal in the Software without
restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.
*/
@@ -499,7 +499,7 @@ declare module Slick {
}
export interface EditorFactory {
getEditor(column): Editors.Editor;
getEditor<T>(column: Column<T>): Editors.Editor<T>;
}
export interface FormatterFactory<T extends Slick.SlickData> {
@@ -726,22 +726,22 @@ declare module Slick {
constructor(
container: string,
data: T[],
columns: Column[],
columns: Column<T>[],
options: GridOptions<T>);
constructor(
container: HTMLElement,
data: T[],
columns: Column[],
columns: Column<T>[],
options: GridOptions<T>);
constructor(
container: string,
data: DataProvider,
columns: Column[],
columns: Column<T>[],
options: GridOptions<T>);
constructor(
container: HTMLElement,
data: DataProvider,
columns: Column[],
columns: Column<T>[],
options: GridOptions<T>);
// #region Core
@@ -841,13 +841,13 @@ declare module Slick {
* Returns an array of column definitions, containing the option settings for each individual column.
* @return
**/
public getColumns(): Column[];
public getColumns(): Column<T>[];
/**
* Sets grid columns. Column headers will be recreated and all rendered rows will be removed. To rerender the grid (if necessary), call render().
* @param columnDefinitions An array of column definitions.
**/
public setColumns(columnDefinitions: Column[]): void;
public setColumns(columnDefinitions: Column<T>[]): void;
/**
* Accepts a columnId string and an ascending boolean. Applies a sort glyph in either ascending or descending form to the header of the column. Note that this does not actually sort the column. It only adds the sort glyph to the header.
@@ -866,7 +866,7 @@ declare module Slick {
* todo: no docs or comments available
* @return
**/
public getSortColumns(): Column[];
public getSortColumns(): Column<T>[];
/**
* Updates an existing column definition and a corresponding header DOM element with the new title and tooltip.
@@ -874,7 +874,7 @@ declare module Slick {
* @param title New column name.
* @param toolTip New column tooltip.
**/
public updateColumnHeader(columnId: string, title: string, toolTip?: string): void;
public updateColumnHeader(columnId: string, title?: string, toolTip?: string): void;
// #endregion Columns
@@ -1328,7 +1328,7 @@ declare module Slick {
export interface OnSortEventData<T extends SlickData> {
multiColumnSort: boolean;
sortCol?: Column<T>;
sortCols: Column[];
sortCols: Column<T>[];
sortAsc?: boolean;
}
@@ -1526,7 +1526,7 @@ declare module Slick {
* the 'high' setGrouping.
*/
public expandGroup(...varArgs: string[]): void;
public getGroups(): Group[];
public getGroups(): Group<T, any>[];
public getIdxById(): string;
public getRowById(): T;
public getItemById(): T;
+121
View File
@@ -0,0 +1,121 @@
/// <reference path="titanium.d.ts" />
function test_window() {
var window: Ti.UI.Window = Ti.UI.createWindow({
title: 'Test',
backgroundColor: 'white',
borderRadius: 10
});
window.setBackgroundColor('blue');
window.opacity = 0.92;
var matrix = Ti.UI.create2DMatrix().scale(1.1, 1);
window.transform = matrix;
var label: Ti.UI.Label;
label = Ti.UI.createLabel({
color: '#900',
text: 'Simple label'
});
label.textAlign = Ti.UI.TEXT_ALIGNMENT_LEFT;
label.setWidth(Ti.UI.SIZE);
label.setHeight(Ti.UI.SIZE);
window.add(label);
window.open();
}
function test_tableview() {
var data = [];
for (var i = 0; i < 10; i++) {
var row = Ti.UI.createTableViewRow();
var label = Ti.UI.createLabel({
left: 10,
text: 'Row ' + (i + 1)
});
var image = Ti.UI.createImageView({
url: 'KS_nav_ui.png'
});
var button = Ti.UI.createButton({
right: 10,
height: 30,
width: 80,
title: 'Button example'
});
row.add(label);
row.add(image);
row.add(button);
data.push(row);
}
var table = Ti.UI.createTableView({
data: data,
style: Ti.UI.iPhone.TableViewStyle.PLAIN
});
}
function test_fs() {
var imageDir = Ti.Filesystem.getFile(Ti.Filesystem.applicationDataDirectory + 'downloaded_images');
if (!imageDir.exists()) {
imageDir.createDirectory();
}
var data: Ti.Blob;
var imageFile = Ti.Filesystem.getFile(imageDir.resolve() + 'image.jpg');
if (!imageFile.write(data)) {
Ti.UI.createAlertDialog({
message: 'IO Error'
}).show();
}
imageFile = null;
imageDir = null;
}
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) {
alert(this.responseText);
},
// function called when an error occurs, including a timeout
onerror : function(e) {
alert(e.rror);
},
timeout : 5000 // in milliseconds
});
// Prepare the connection.
client.open('GET', url);
// Send the request.
client.send();
}
function test_map() {
var win = Ti.UI.createWindow();
var mountainView = Ti.Map.createAnnotation({
animate: true,
leftButton: '../images/appcelerator_small.png',
myid: 1
});
mountainView.setLatitude(37.390749);
mountainView.setLongitude(-122.081651);
mountainView.setTitle('Appcelerator');
mountainView.setSubtitle('Mountain View, CA');
mountainView.setPincolor(Ti.Map.ANNOTATION_RED);
var mapview = Ti.Map.createView({
mapType: Ti.Map.STANDARD_TYPE,
region: {
latitude:37.390749, longitude:-122.081651,
latitudeDelta:0.01, longitudeDelta:0.01},
animate:true,
});
mapview.regionFit = true;
mapview.userLocation = true;
mapview.annotations = [mountainView];
mapview.addEventListener('click', function(evt) {
if (evt.clicksource === 'leftButton' || evt.clicksource === 'leftPane') {
alert(evt.title + ' left button clicked');
}
});
win.add(mapview);
win.open();
}
+6240
View File
File diff suppressed because it is too large Load Diff
+5 -5
View File
@@ -382,7 +382,7 @@ declare module _ {
**/
export function pluck<T extends {}>(
list: Collection<T>,
propertyName: string): T[];
propertyName: string): any[];
/**
* Returns the maximum value in list.
@@ -839,7 +839,7 @@ declare module _ {
start: number,
stop: number,
step?: number): number[];
/**
* @see _.range
* @param stop Stop here.
@@ -861,7 +861,7 @@ declare module _ {
* @return `fn` with `this` bound to `object`.
**/
export function bind(
func: (...as: any[]) => any,
func: Function,
context: any,
...arguments: any[]): () => any;
@@ -900,7 +900,7 @@ declare module _ {
**/
export function memoize(
fn: Function,
hashFn?: (n: any) => string): Function;
hashFn?: (...args: any[]) => string): Function;
/**
* Much like setTimeout, invokes function after wait milliseconds. If you pass the optional arguments,
@@ -1624,7 +1624,7 @@ declare class _<T> {
* @see _.shuffle
**/
shuffle(): T[];
/**
* Wrapped type `any[]`.
* @see _.sample
+64
View File
@@ -0,0 +1,64 @@
// Type definitions for When 2.4.0
// Project: https://github.com/cujojs/when
// Definitions: https://github.com/borisyankov/DefinitelyTyped
declare module When {
/**
* Return a promise that will resolve only once all the supplied promisesOrValues
* have resolved. The resolution value of the returned promise will be an array
* containing the resolution values of each of the promisesOrValues.
* @memberOf when
*
* @param promisesOrValues array of anything, may contain a mix
* of {@link Promise}s and values
*/
function all<T>(promisesOrValues: any[]): Promise<T>;
/**
* Creates a {promise, resolver} pair, either or both of which
* may be given out safely to consumers.
* The resolver has resolve, reject, and progress. The promise
* has then plus extended promise API.
*/
function defer<T>(): Deferred<T>;
/**
* Joins multiple promises into a single returned promise.
* @return a promise that will fulfill when *all* the input promises
* have fulfilled, or will reject when *any one* of the input promises rejects.
*/
function join<T>(...promises: Promise<T>[]): Promise<T[]>;
/**
* Joins multiple promises into a single returned promise.
* @return a promise that will fulfill when *all* the input promises
* have fulfilled, or will reject when *any one* of the input promises rejects.
*/
function join<T>(...promises: any[]): Promise<T[]>;
/**
* Returns a resolved promise. The returned promise will be
* - fulfilled with promiseOrValue if it is a value, or
* - if promiseOrValue is a promise
* - fulfilled with promiseOrValue's value after it is fulfilled
* - rejected with promiseOrValue's reason after it is rejected
*/
function resolve<T>(promise: Promise<T>): Promise<T>;
function resolve<T>(value?: T): Promise<T>;
interface Deferred<T> {
notify(update: any): void;
promise: Promise<T>;
reject(reason: any): void;
resolve(value?: T): void;
}
interface Promise<T> {
ensure(onFulfilledOrRejected: Function): Promise<T>;
then<U>(onFulfilled: (value: T) => Promise<U>, onRejected?: (reason: any) => Promise<U>, onProgress?: (update: any) => void): Promise<U>;
then<U>(onFulfilled: (value: T) => Promise<U>, onRejected?: (reason: any) => U, onProgress?: (update: any) => void): Promise<U>;
then<U>(onFulfilled: (value: T) => U, onRejected?: (reason: any) => Promise<U>, onProgress?: (update: any) => void): Promise<U>;
then<U>(onFulfilled: (value: T) => U, onRejected?: (reason: any) => U, onProgress?: (update: any) => void): Promise<U>;
}
}
+17 -17
View File
@@ -6,31 +6,31 @@
declare class ZeroClipboard {
constructor(elements?: any, options?: ZeroClipboardOptions);
setCurrent(element: any);
setText(newText: string);
setTitle(newTitle: string);
setSize(width: number, height: number);
setHandCursor(enabled: boolean);
setCurrent(element: any): void;
setText(newText: string): void;
setTitle(newTitle: string): void;
setSize(width: number, height: number): void;
setHandCursor(enabled: boolean): void;
version: string;
moviePath: string;
trustedDomains: any;
text: string;
hoverClass: string;
activeClass: string;
resetBridge();
resetBridge(): void;
ready: boolean;
reposition();
on(eventName, func);
addEventListener(eventName: string, func);
off(eventName: string, func);
removeEventListener(eventName: string, func);
receiveEvent(eventName: string, args);
glue(elements: any);
unglue(elements: any);
static setDefaults(options: ZeroClipboardOptions);
static destroy();
reposition(): void; // returns false in some scenarios, but never returns true
on(eventName: string, func: Function): void;
addEventListener(eventName: string, func: Function): void;
off(eventName: string, func: Function): void;
removeEventListener(eventName: string, func: Function): void;
receiveEvent(eventName: string, args: any): void;
glue(elements: any): void;
unglue(elements: any): void;
static setDefaults(options: ZeroClipboardOptions): void;
static destroy(): void;
static detectFlashSupport(): boolean;
static dispatch(eventName: string, func);
static dispatch(eventName: string, args: any): void;
}
interface ZeroClipboardOptions {