mirror of
https://github.com/wassname/DefinitelyTyped.git
synced 2026-09-10 11:40:16 +08:00
Merge remote-tracking branch 'upstream/master'
This commit is contained in:
@@ -92,6 +92,7 @@ List of Definitions
|
||||
* [jake](https://github.com/mde/jake) (by [Kon](http://phyzkit.net/))
|
||||
* [Jasmine](http://pivotal.github.com/jasmine/) (by [Boris Yankov](https://github.com/borisyankov))
|
||||
* [Jasmine-jQuery](https://github.com/velesin/jasmine-jquery) (by [Gregor Stamac](https://github.com/gstamac))
|
||||
* [JointJS](http://www.jointjs.com/) (by [Aidan Reel](http://github.com/areel))
|
||||
* [jQRangeSlider](http://ghusse.github.com/jQRangeSlider) (by [Dániel Tar](https://github.com/qcz))
|
||||
* [jQuery](http://jquery.com/) (from TypeScript samples)
|
||||
* [jQuery Mobile](http://jquerymobile.com) (by [Boris Yankov](https://github.com/borisyankov))
|
||||
@@ -200,6 +201,8 @@ List of Definitions
|
||||
* [Viewporter](https://github.com/zynga/viewporter) (by [Boris Yankov](https://github.com/borisyankov))
|
||||
* [Vimeo](http://developer.vimeo.com/player/js-api) (by [Daz Wilkin](https://github.com/DazWilkin/))
|
||||
* [WebRTC](http://dev.w3.org/2011/webrtc/editor/webrtc.html) (by [Ken Smith](https://github.com/smithkl42))
|
||||
* [WinJS](http://msdn.microsoft.com/en-us/library/windows/apps/br229773.aspx) (from TypeScript samples)
|
||||
* [WinRT](http://msdn.microsoft.com/en-us/library/windows/apps/br211377.aspx) (from TypeScript samples)
|
||||
* [YouTube](https://developers.google.com/youtube/) (by [Daz Wilkin](https://github.com/DazWilkin/))
|
||||
* [YouTube Analytics API](https://developers.google.com/youtube/analytics/) (by [Frank M](https://github.com/sgtfrankieboy))
|
||||
* [YouTube Data API](https://developers.google.com/youtube/v3/) (by [Frank M](https://github.com/sgtfrankieboy/))
|
||||
|
||||
Vendored
+3
-3
@@ -539,7 +539,7 @@ declare module ng {
|
||||
}
|
||||
|
||||
interface IHttpPromiseCallback<T> {
|
||||
(data: T, status: number, headers: (headerName: string) => string, config: IRequestConfig): any;
|
||||
(data: T, status: number, headers: (headerName: string) => string, config: IRequestConfig): void;
|
||||
}
|
||||
|
||||
interface IHttpPromiseCallbackArg<T> {
|
||||
@@ -550,8 +550,8 @@ declare module ng {
|
||||
}
|
||||
|
||||
interface IHttpPromise<T> extends IPromise<T> {
|
||||
success(callback: IHttpPromiseCallback<T>): IHttpPromise<any>;
|
||||
error(callback: IHttpPromiseCallback<T>): IHttpPromise<any>;
|
||||
success(callback: IHttpPromiseCallback<T>): IHttpPromise<T>;
|
||||
error(callback: IHttpPromiseCallback<T>): IHttpPromise<T>;
|
||||
then(successCallback: (response: IHttpPromiseCallbackArg<T>) => any, errorCallback?: (response: IHttpPromiseCallbackArg<T>) => any): IPromise<any>;
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
# JointJS Definitions Usage Notes
|
||||
|
||||
TypeScript definitions for the JointJS framework available at http://www.jointjs.com
|
||||
|
||||
Current version 0.6
|
||||
|
||||
## Referencing JointJS definition files in your code
|
||||
|
||||
Add `/// <reference path="jointjs.d.ts" />` at the top of your code.
|
||||
Vendored
+115
@@ -0,0 +1,115 @@
|
||||
// Type definitions for Joint JS 0.6
|
||||
// Project: http://www.jointjs.com/
|
||||
// Definitions by: Aidan Reel <http://github.com/areel> with help from David Durman <http://github.com/DavidDurman>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/// <reference path="../backbone/backbone.d.ts" />
|
||||
|
||||
|
||||
declare module joint {
|
||||
|
||||
module dia {
|
||||
|
||||
interface IElementSize {
|
||||
width: number;
|
||||
height: number;
|
||||
}
|
||||
|
||||
class Graph extends Backbone.Model {
|
||||
initialize();
|
||||
fromJSON(json: any);
|
||||
clear();
|
||||
addCell(cell: Cell);
|
||||
addCells(cells: Cell[]);
|
||||
getConnectedLinks(cell: Cell, opt?: any): Link[];
|
||||
disconnectLinks(cell: Cell);
|
||||
removeLinks(cell: Cell);
|
||||
}
|
||||
|
||||
class Cell extends Backbone.Model {
|
||||
toJSON();
|
||||
remove(options?: any);
|
||||
toFront();
|
||||
toBack();
|
||||
embed(cell: Cell);
|
||||
unembed(cell: Cell);
|
||||
getEmbeddedCells(): Cell[];
|
||||
clone<T>(opt?: any): T; // @todo: return can either be Cell or Cell[].
|
||||
attr(attrs: any): Cell;
|
||||
}
|
||||
|
||||
|
||||
|
||||
class Element extends Cell {
|
||||
position(x: number, y: number): Element;
|
||||
translate(tx: number, ty?: number): Element;
|
||||
resize(width: number, height: number): Element;
|
||||
rotate(angle: number, absolute): Element;
|
||||
}
|
||||
interface IDefaults {
|
||||
type: string;
|
||||
}
|
||||
|
||||
class Link extends Cell {
|
||||
defaults: IDefaults;
|
||||
disconnect(): Link;
|
||||
label(idx?: number, value?: any): any; // @todo: returns either a label under idx or Link if both idx and value were passed
|
||||
}
|
||||
|
||||
interface IOptions {
|
||||
width: number;
|
||||
height: number;
|
||||
gridSize: number;
|
||||
perpendicularLinks: boolean;
|
||||
elementView: ElementView;
|
||||
linkView: LinkView;
|
||||
}
|
||||
|
||||
class Paper extends Backbone.View {
|
||||
options: IOptions;
|
||||
setDimensions(width: number, height: number);
|
||||
scale(sx: number, sy?: number, ox?: number, oy?: number): Paper;
|
||||
rotate(deg: number, ox?: number, oy?: number): Paper; // @todo not released yet though it's in the source code already
|
||||
findView(el: any): CellView;
|
||||
findViewByModel(modelOrId: any): CellView;
|
||||
findViewsFromPoint(p: { x: number; y: number; }): CellView[];
|
||||
findViewsInArea(r: { x: number; y: number; width: number; height: number; }): CellView[];
|
||||
snapToGrid(p): { x: number; y: number; };
|
||||
}
|
||||
|
||||
class ElementView {
|
||||
scale(sx: number, sy: number);
|
||||
}
|
||||
class CellView extends Backbone.View {
|
||||
getBBox(): { x: number; y: number; width: number; height: number; };
|
||||
highlight(el?: any);
|
||||
unhighlight(el?: any);
|
||||
findMagnet(el: any);
|
||||
getSelector(el: any);
|
||||
}
|
||||
|
||||
class LinkView extends CellView {
|
||||
getConnectionLength(): number;
|
||||
getPointAtLength(length: number): { x: number; y: number; };
|
||||
}
|
||||
|
||||
}
|
||||
module ui { }
|
||||
module shapes {
|
||||
module basic {
|
||||
class Generic extends joint.dia.Element { }
|
||||
class Rect extends Generic { }
|
||||
class Text extends Generic { }
|
||||
class Circle extends Generic { }
|
||||
class Image extends Generic { }
|
||||
}
|
||||
}
|
||||
module util {
|
||||
function uuid(): string;
|
||||
function guid(obj: any): string;
|
||||
function mixin(objects: any[]): any;
|
||||
function supplement(objects: any[]): any;
|
||||
function deepMixin(objects: any[]): any;
|
||||
function deepSupplement(objects: any[]): any;
|
||||
}
|
||||
}
|
||||
Vendored
+1
-1
@@ -118,7 +118,7 @@ declare module createjs {
|
||||
getVolume(): number;
|
||||
mute(isMuted: boolean): boolean;
|
||||
pause(): boolean;
|
||||
play(interrupt: string, delay: number, offset: number, loop: number, volume: number, pan: number): void;
|
||||
play(interrupt?: string, delay?: number, offset?: number, loop?: number, volume?: number, pan?: number): void;
|
||||
resume(): boolean;
|
||||
setPan(value: number): number;
|
||||
setPosition(value: number): void;
|
||||
|
||||
@@ -0,0 +1,131 @@
|
||||
/// <reference path='../underscore/underscore.d.ts' />
|
||||
/// <reference path='underscore.string.d.ts' />
|
||||
|
||||
_ = _.string;
|
||||
|
||||
_.numberFormat(1000, 2);
|
||||
_.numberFormat(123456789.123, 5, '.', ',');
|
||||
|
||||
_.levenshtein('kitten', 'kittah');
|
||||
|
||||
_.capitalize('foo Bar');
|
||||
|
||||
_.chop('whitespace', 3);
|
||||
|
||||
_.clean(' foo bar ');
|
||||
|
||||
_.chars('Hello');
|
||||
|
||||
_.swapCase('hELLO');
|
||||
|
||||
_.str.include('foobar', 'ob');
|
||||
|
||||
_.count('Hello world', 'l');
|
||||
|
||||
_.escapeHTML('<div>Blah blah blah</div>');
|
||||
|
||||
_.unescapeHTML('<div>Blah blah blah</div>');
|
||||
|
||||
_.insert('Hello ', 6, 'world');
|
||||
|
||||
_.isBlank('');
|
||||
_.isBlank('\n');
|
||||
_.isBlank(' ');
|
||||
_.isBlank('a');
|
||||
|
||||
_.join(' ', 'foo', 'bar');
|
||||
|
||||
_.lines('Hello\nWorld');
|
||||
|
||||
_.str.reverse('foobar');
|
||||
|
||||
_.splice('https://edtsech@bitbucket.org/edtsech/underscore.strings', 30, 7, 'epeli');
|
||||
|
||||
_.startsWith('image.gif', 'image');
|
||||
|
||||
_.endsWith('image.gif', 'gif');
|
||||
|
||||
_.succ('a');
|
||||
_.succ('A');
|
||||
|
||||
_.titleize('my name is epeli');
|
||||
|
||||
_.camelize('-moz-transform');
|
||||
|
||||
_.classify('some_class_name');
|
||||
|
||||
_.underscored('MozTransform');
|
||||
|
||||
_.dasherize('MozTransform');
|
||||
|
||||
_.humanize(' capitalize dash-CamelCase_underscore trim ');
|
||||
|
||||
_.trim(' foobar ');
|
||||
_.trim('_-foobar-_', '_-');
|
||||
|
||||
_.truncate('Hello world', 5);
|
||||
_.truncate('Hello', 10);
|
||||
|
||||
_.prune('Hello, world', 5);
|
||||
_.prune('Hello, world', 8);
|
||||
_.prune('Hello, world', 5, ' (read a lot more)');
|
||||
_.prune('Hello, cruel world', 15);
|
||||
_.prune('Hello', 10);
|
||||
|
||||
_.words(' I love you ');
|
||||
_.words('I_love_you', '_');
|
||||
_.words('I-love-you', /-/);
|
||||
_.words(' ');
|
||||
|
||||
_.sprintf('%.1f', 1.17);
|
||||
|
||||
_.pad('1', 8);
|
||||
_.pad('1', 8, '0');
|
||||
_.pad('1', 8, '0', 'right');
|
||||
_.pad('1', 8, '0', 'both');
|
||||
_.pad('1', 8, 'bleepblorp', 'both');
|
||||
|
||||
_.lpad('1', 8, '0');
|
||||
|
||||
_.rpad('1', 8, '0');
|
||||
|
||||
_.toNumber('2.556');
|
||||
_.toNumber('2.556', 1);
|
||||
|
||||
_.strRight('This_is_a_test_string', '_');
|
||||
|
||||
_.strRightBack('This_is_a_test_string', '_');
|
||||
|
||||
_.strLeft('This_is_a_test_string', '_');
|
||||
|
||||
_.strLeftBack('This_is_a_test_string', '_');
|
||||
|
||||
_.stripTags('a <a href="#">link</a>');
|
||||
_.stripTags('a <a href="#">link</a><script>alert("hello world!")</script>');
|
||||
|
||||
_.toSentence(['jQuery', 'Mootools', 'Prototype']);
|
||||
_.toSentence(['jQuery', 'Mootools', 'Prototype'], ', ', ' unt ');
|
||||
|
||||
_.toSentenceSerial(['jQuery', 'Mootools']);
|
||||
_.toSentenceSerial(['jQuery', 'Mootools', 'Prototype']);
|
||||
_.toSentenceSerial(['jQuery', 'Mootools', 'Prototype'], ', ', ' unt ');
|
||||
|
||||
_.repeat('foo', 3);
|
||||
_.repeat('foo', 3, 'bar');
|
||||
|
||||
_.surround('foo', 'ab');
|
||||
|
||||
_.quote('foo');
|
||||
|
||||
_.unquote('"foo"');
|
||||
_.unquote("'foo'", "'");
|
||||
|
||||
_.slugify("Un éléphant à l'orée du bois");
|
||||
|
||||
['foo20', 'foo5'].sort(_.naturalCmp);
|
||||
|
||||
_.toBoolean('true');
|
||||
_.toBoolean('FALSE');
|
||||
_.toBoolean('random');
|
||||
_.toBoolean('truthy', ['truthy'], ['falsy']);
|
||||
_.toBoolean('true only at start', [/^true/]);
|
||||
+528
@@ -0,0 +1,528 @@
|
||||
// Type definitions for underscore.string
|
||||
// Project: https://github.com/epeli/underscore.string
|
||||
// Definitions by: Ry Racherbaumer <http://github.com/rygine>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
declare module 'underscore.string' {
|
||||
|
||||
/**
|
||||
* Determine if a string is 'blank.'
|
||||
* @param str
|
||||
*/
|
||||
function isBlank(str: string): boolean;
|
||||
|
||||
/**
|
||||
* Removes all html tags from string.
|
||||
* @param str
|
||||
*/
|
||||
function stripTags(str: string): string;
|
||||
|
||||
/**
|
||||
* Converts first letter of the string to uppercase.
|
||||
* ('foo Bar') => 'Foo Bar'
|
||||
* @param str
|
||||
*/
|
||||
function capitalize(str: string): string;
|
||||
|
||||
/**
|
||||
* Chop a string into pieces.
|
||||
* ('whitespace', 3) => ['whi','tes','pac','e']
|
||||
* @param str String to chop
|
||||
* @param step Size of the pieces
|
||||
*/
|
||||
function chop(str: string, step: number): Array;
|
||||
|
||||
/**
|
||||
* Compress some whitespaces to one.
|
||||
* (' foo bar ') => 'foo bar'
|
||||
* @param str
|
||||
*/
|
||||
function clean(str: string): string;
|
||||
|
||||
/**
|
||||
* Count occurences of a sub string.
|
||||
* ('Hello world', 'l') => 3
|
||||
* @param str
|
||||
* @param substr
|
||||
*/
|
||||
function count(str: string, substr: string): number;
|
||||
|
||||
/**
|
||||
* Convert string to an array of characters.
|
||||
* ('Hello') => ['H','e','l','l','o']
|
||||
* @param str
|
||||
*/
|
||||
function chars(str: string): Array;
|
||||
|
||||
/**
|
||||
* Returns a copy of the string in which all the case-based characters have had their case swapped.
|
||||
* ('hELLO') => 'Hello'
|
||||
* @param str
|
||||
*/
|
||||
function swapCase(str: string): string;
|
||||
|
||||
/**
|
||||
* Converts HTML special characters to their entity equivalents.
|
||||
* ('<div>Blah blah blah</div>') => '<div>Blah blah blah</div>'
|
||||
* @param str
|
||||
*/
|
||||
function escapeHTML(str: string): string;
|
||||
|
||||
/**
|
||||
* Converts entity characters to HTML equivalents.
|
||||
* ('<div>Blah blah blah</div>') => '<div>Blah blah blah</div>'
|
||||
* @param str
|
||||
*/
|
||||
function unescapeHTML(str: string): string;
|
||||
|
||||
/**
|
||||
* Escape a string for use in a regular expression.
|
||||
* @param str
|
||||
*/
|
||||
function escapeRegExp(str: string): string;
|
||||
|
||||
/**
|
||||
* Splice a string like an array.
|
||||
* @param str
|
||||
* @param i
|
||||
* @param howmany
|
||||
* @param substr
|
||||
*/
|
||||
function splice(str: string, i: number, howmany: number, substr?: string): string;
|
||||
|
||||
/**
|
||||
* Insert a string at index.
|
||||
* @param str
|
||||
* @param i
|
||||
* @param substr
|
||||
*/
|
||||
function insert(str: string, i: number, substr: string): string;
|
||||
|
||||
/**
|
||||
* Tests if string contains a substring.
|
||||
* ('foobar', 'ob') => true
|
||||
* @param str
|
||||
* @param needle
|
||||
*/
|
||||
function include(str: string, needle: string): boolean;
|
||||
|
||||
/**
|
||||
* Tests if string contains a substring.
|
||||
* ('foobar', 'ob') => true
|
||||
* @param str
|
||||
* @param needle
|
||||
*/
|
||||
function contains(str: string, needle: string): boolean;
|
||||
|
||||
/**
|
||||
* Joins strings together with given separator.
|
||||
* (' ', 'foo', 'bar') => 'foo bar'
|
||||
* @param separator
|
||||
* @param args
|
||||
*/
|
||||
function join(separator: string, ...args: string[]): string;
|
||||
|
||||
/**
|
||||
* Split string by newlines character.
|
||||
* ('Hello\nWorld') => ['Hello', 'World']
|
||||
* @param str
|
||||
*/
|
||||
function lines(str: string): Array;
|
||||
|
||||
/**
|
||||
* Return reversed string.
|
||||
* ('foobar') => 'raboof'
|
||||
* @param str
|
||||
*/
|
||||
function reverse(str: string): string;
|
||||
|
||||
/**
|
||||
* Checks if string starts with another string.
|
||||
* ('image.gif', 'image') => true
|
||||
* @param str
|
||||
* @param starts
|
||||
*/
|
||||
function startsWith(str: string, starts: string): boolean;
|
||||
|
||||
/**
|
||||
* Checks if string ends with another string.
|
||||
* ('image.gif', 'gif') => true
|
||||
* @param value
|
||||
* @param starts
|
||||
*/
|
||||
function endsWith(value: string, starts: string): boolean;
|
||||
|
||||
/**
|
||||
* Returns the successor to passed string.
|
||||
* ('a') => 'b'
|
||||
* @param str
|
||||
*/
|
||||
function succ(str: string): string;
|
||||
|
||||
/**
|
||||
* Capitalize first letter of every word in the string.
|
||||
* ('my name is epeli') => 'My Name Is Epeli'
|
||||
* @param str
|
||||
*/
|
||||
function titleize(str: string): string;
|
||||
|
||||
/**
|
||||
* Converts underscored or dasherized string to a camelized one.
|
||||
* ('-moz-transform') => 'MozTransform'
|
||||
* @param str
|
||||
*/
|
||||
function camelize(str: string): string;
|
||||
|
||||
/**
|
||||
* Converts a camelized or dasherized string into an underscored one.
|
||||
* ('MozTransform') => 'moz_transform'
|
||||
* @param str
|
||||
*/
|
||||
function underscored(str: string): string;
|
||||
|
||||
/**
|
||||
* Converts a underscored or camelized string into an dasherized one.
|
||||
* ('MozTransform') => '-moz-transform'
|
||||
* @param str
|
||||
*/
|
||||
function dasherize(str: string): string;
|
||||
|
||||
/**
|
||||
* Converts string to camelized class name.
|
||||
* ('some_class_name') => 'SomeClassName'
|
||||
* @param str
|
||||
*/
|
||||
function classify(str: string): string;
|
||||
|
||||
/**
|
||||
* Converts an underscored, camelized, or dasherized string into a humanized one.
|
||||
* Also removes beginning and ending whitespace, and removes the postfix '_id'.
|
||||
* (' capitalize dash-CamelCase_underscore trim ') => 'Capitalize dash camel case underscore trim'
|
||||
* @param str
|
||||
*/
|
||||
function humanize(str: string): string;
|
||||
|
||||
/**
|
||||
* Trims defined characters from begining and ending of the string.
|
||||
* Defaults to whitespace characters.
|
||||
* (' foobar ') => 'foobar'
|
||||
* ('_-foobar-_', '_-') => 'foobar'
|
||||
* @param str
|
||||
* @param characters
|
||||
*/
|
||||
function trim(str: string, characters?: string): string;
|
||||
|
||||
/**
|
||||
* Trims defined characters from begining and ending of the string.
|
||||
* Defaults to whitespace characters.
|
||||
* (' foobar ') => 'foobar'
|
||||
* ('_-foobar-_', '_-') => 'foobar'
|
||||
* @param str
|
||||
* @param characters
|
||||
*/
|
||||
function strip(str: string, characters?: string): string;
|
||||
|
||||
/**
|
||||
* Left trim. Similar to trim, but only for left side.
|
||||
* @param str
|
||||
* @param characters
|
||||
*/
|
||||
function ltrim(str: string, characters?: string): string;
|
||||
|
||||
/**
|
||||
* Left trim. Similar to trim, but only for left side.
|
||||
* @param str
|
||||
* @param characters
|
||||
*/
|
||||
function lstrip(str: string, characters?: string): string;
|
||||
|
||||
/**
|
||||
* Right trim. Similar to trim, but only for right side.
|
||||
* @param str
|
||||
* @param characters
|
||||
*/
|
||||
function rtrim(str: string, characters?: string): string;
|
||||
|
||||
/**
|
||||
* Right trim. Similar to trim, but only for right side.
|
||||
* @param str
|
||||
* @param characters
|
||||
*/
|
||||
function rstrip(str: string, characters?: string): string;
|
||||
|
||||
/**
|
||||
* Truncate string to specified length.
|
||||
* ('Hello world').truncate(5) => 'Hello...'
|
||||
* ('Hello').truncate(10) => 'Hello'
|
||||
* @param str
|
||||
* @param length
|
||||
* @param truncateStr
|
||||
*/
|
||||
function truncate(str: string, length: number, truncateStr?: string): string;
|
||||
|
||||
/**
|
||||
* Elegant version of truncate.
|
||||
* Makes sure the pruned string does not exceed the original length.
|
||||
* Avoid half-chopped words when truncating.
|
||||
* ('Hello, cruel world', 15) => 'Hello, cruel...'
|
||||
* @param str
|
||||
* @param length
|
||||
* @param pruneStr
|
||||
*/
|
||||
function prune(str: string, length: number, pruneStr?: string): string;
|
||||
|
||||
/**
|
||||
* Split string by delimiter (String or RegExp).
|
||||
* /\s+/ by default.
|
||||
* (' I love you ') => ['I','love','you']
|
||||
* ('I_love_you', '_') => ['I','love','you']
|
||||
* @param str
|
||||
* @param delimiter
|
||||
*/
|
||||
function words(str: string, delimiter?: string): Array;
|
||||
|
||||
/**
|
||||
* Pads a string with characters until the total string length is equal to the passed length parameter.
|
||||
* By default, pads on the left with the space char (' ').
|
||||
* padStr is truncated to a single character if necessary.
|
||||
* ('1', 8) => ' 1'
|
||||
* ('1', 8, '0') => '00000001'
|
||||
* ('1', 8, '0', 'right') => '10000000'
|
||||
* ('1', 8, '0', 'both') => '00001000'
|
||||
* ('1', 8, 'bleepblorp', 'both') => 'bbbb1bbb'
|
||||
* @param str
|
||||
* @param length
|
||||
* @param padStr
|
||||
* @param type
|
||||
*/
|
||||
function pad(str: string, length: number, padStr:string, type?: string): string;
|
||||
|
||||
/**
|
||||
* Left-pad a string.
|
||||
* Alias for pad(str, length, padStr, 'left')
|
||||
* ('1', 8, '0') => '00000001'
|
||||
* @param str
|
||||
* @param length
|
||||
* @param padStr
|
||||
*/
|
||||
function lpad(str: string, length: number, padStr?: string): string;
|
||||
|
||||
/**
|
||||
* Left-pad a string.
|
||||
* Alias for pad(str, length, padStr, 'left')
|
||||
* ('1', 8, '0') => '00000001'
|
||||
* @param str
|
||||
* @param length
|
||||
* @param padStr
|
||||
*/
|
||||
function rjust(str: string, length: number, padStr?: string): string;
|
||||
|
||||
/**
|
||||
* Right-pad a string.
|
||||
* Alias for pad(str, length, padStr, 'right')
|
||||
* ('1', 8, '0') => '10000000'
|
||||
* @param str
|
||||
* @param length
|
||||
* @param padStr
|
||||
*/
|
||||
function rpad(str: string, length: number, padStr?: string): string;
|
||||
|
||||
/**
|
||||
* Right-pad a string.
|
||||
* Alias for pad(str, length, padStr, 'right')
|
||||
* ('1', 8, '0') => '10000000'
|
||||
* @param str
|
||||
* @param length
|
||||
* @param padStr
|
||||
*/
|
||||
function ljust(str: string, length: number, padStr?: string): string;
|
||||
|
||||
/**
|
||||
* Left/right-pad a string.
|
||||
* Alias for pad(str, length, padStr, 'both')
|
||||
* ('1', 8, '0') => '00001000'
|
||||
* @param str
|
||||
* @param length
|
||||
* @param padStr
|
||||
*/
|
||||
function lrpad(str: string, length: number, padStr?: string): string;
|
||||
|
||||
/**
|
||||
* Left/right-pad a string.
|
||||
* Alias for pad(str, length, padStr, 'both')
|
||||
* ('1', 8, '0') => '00001000'
|
||||
* @param str
|
||||
* @param length
|
||||
* @param padStr
|
||||
*/
|
||||
function center(str: string, length: number, padStr?: string): string;
|
||||
|
||||
/**
|
||||
* C like string formatting.
|
||||
* _.sprintf('%.1f', 1.17) => '1.2'
|
||||
* @param format
|
||||
* @param args
|
||||
*/
|
||||
function sprintf(format: string, ...args: any[]): string;
|
||||
|
||||
/**
|
||||
* Parse string to number.
|
||||
* Returns NaN if string can't be parsed to number.
|
||||
* ('2.556').toNumber() => 3
|
||||
* ('2.556').toNumber(1) => 2.6
|
||||
* @param str
|
||||
* @param decimals
|
||||
*/
|
||||
function toNumber(str: string, decimals?: number): number;
|
||||
|
||||
/**
|
||||
* Formats the numbers.
|
||||
* (1000, 2) => '1,000.00'
|
||||
* (123456789.123, 5, '.', ',') => '123,456,789.12300'
|
||||
* @param number
|
||||
* @param dec
|
||||
* @param dsep
|
||||
* @param tsep
|
||||
*/
|
||||
function numberFormat(number: number, dec?: number, dsep?: string, tsep?: string): string;
|
||||
|
||||
/**
|
||||
* Searches a string from left to right for a pattern.
|
||||
* Returns a substring consisting of the characters in the string that are to the right of the pattern.
|
||||
* If no match found, returns entire string.
|
||||
* ('This_is_a_test_string').strRight('_') => 'is_a_test_string'
|
||||
* @param str
|
||||
* @param sep
|
||||
*/
|
||||
function strRight(str: string, sep: string): string;
|
||||
|
||||
/**
|
||||
* Searches a string from right to left for a pattern.
|
||||
* Returns a substring consisting of the characters in the string that are to the right of the pattern.
|
||||
* If no match found, returns entire string.
|
||||
* ('This_is_a_test_string').strRightBack('_') => 'string'
|
||||
* @param str
|
||||
* @param sep
|
||||
*/
|
||||
function strRightBack(str: string, sep: string): string;
|
||||
|
||||
/**
|
||||
* Searches a string from left to right for a pattern.
|
||||
* Returns a substring consisting of the characters in the string that are to the left of the pattern.
|
||||
* If no match found, returns entire string.
|
||||
* ('This_is_a_test_string').strLeft('_') => 'This'
|
||||
* @param str
|
||||
* @param sep
|
||||
*/
|
||||
function strLeft(str: string, sep: string): string;
|
||||
|
||||
/**
|
||||
* Searches a string from right to left for a pattern.
|
||||
* Returns a substring consisting of the characters in the string that are to the left of the pattern.
|
||||
* If no match found, returns entire string.
|
||||
* ('This_is_a_test_string').strLeftBack('_') => 'This_is_a_test'
|
||||
* @param str
|
||||
* @param sep
|
||||
*/
|
||||
function strLeftBack(str: string, sep: string): string;
|
||||
|
||||
/**
|
||||
* Join an array into a human readable sentence.
|
||||
* (['jQuery', 'Mootools', 'Prototype']) => 'jQuery, Mootools and Prototype'
|
||||
* (['jQuery', 'Mootools', 'Prototype'], ', ', ' unt ') => 'jQuery, Mootools unt Prototype'
|
||||
* @param array
|
||||
* @param separator
|
||||
* @param lastSeparator
|
||||
* @param serial
|
||||
*/
|
||||
function toSentence(array: Array, separator?: string, lastSeparator?: string, serial?: boolean): string;
|
||||
|
||||
/**
|
||||
* The same as toSentence, but uses ', ' as default for lastSeparator.
|
||||
* @param array
|
||||
* @param separator
|
||||
* @param lastSeparator
|
||||
*/
|
||||
function toSentenceSerial(array: Array, separator?: string, lastSeparator?: string): string;
|
||||
|
||||
/**
|
||||
* Transform text into a URL slug. Replaces whitespaces, accentuated, and special characters with a dash.
|
||||
* ('Un éléphant à l'orée du bois') => 'un-elephant-a-loree-du-bois'
|
||||
* @param str
|
||||
*/
|
||||
function slugify(str: string): string;
|
||||
|
||||
/**
|
||||
* Surround a string with another string.
|
||||
* ('foo', 'ab') => 'abfooab'
|
||||
* @param str
|
||||
* @param wrapper
|
||||
*/
|
||||
function surround(str: string, wrapper: string): string;
|
||||
|
||||
/**
|
||||
* Quotes a string.
|
||||
* quoteChar defaults to "
|
||||
* ('foo') => '"foo"'
|
||||
* @param str
|
||||
*/
|
||||
function quote(str: string, quoteChar?: string): string;
|
||||
|
||||
/**
|
||||
* Quotes a string.
|
||||
* quoteChar defaults to "
|
||||
* ('foo') => '"foo"'
|
||||
* @param str
|
||||
*/
|
||||
function q(str: string, quoteChar?: string): string;
|
||||
|
||||
/**
|
||||
* Unquotes a string.
|
||||
* quoteChar defaults to "
|
||||
* ('"foo"') => 'foo'
|
||||
* ("'foo'", "'") => 'foo'
|
||||
* @param str
|
||||
*/
|
||||
function unquote(str: string, quoteChar?: string): string;
|
||||
|
||||
/**
|
||||
* Repeat a string with an optional separator.
|
||||
* ('foo', 3) => 'foofoofoo'
|
||||
* ('foo', 3, 'bar') => 'foobarfoobarfoo'
|
||||
* @param value
|
||||
* @param count
|
||||
* @param separator
|
||||
*/
|
||||
function repeat(value: string, count: number, separator?:string): string;
|
||||
|
||||
/**
|
||||
* Naturally sort strings like humans would do.
|
||||
* Caution: this function is charset dependent.
|
||||
* @param str1
|
||||
* @param str2
|
||||
*/
|
||||
function naturalCmp(str1: string, str2: string): number;
|
||||
|
||||
/**
|
||||
* Calculates Levenshtein distance between two strings.
|
||||
* ('kitten', 'kittah') => 2
|
||||
* @param str1
|
||||
* @param str2
|
||||
*/
|
||||
function levenshtein(str1: string, str2: string): number;
|
||||
|
||||
/**
|
||||
* Turn strings that can be commonly considered as booleans to real booleans.
|
||||
* Such as "true", "false", "1" and "0". This function is case insensitive.
|
||||
* ('true') => true
|
||||
* ('FALSE') => false
|
||||
* ('random') => undefined
|
||||
* ('truthy', ['truthy'], ['falsy']) => true
|
||||
* ('true only at start', [/^true/]) => true
|
||||
* @param str
|
||||
* @param trueValues
|
||||
* @param falseValues
|
||||
*/
|
||||
function toBoolean(str: string, trueValues?: Array, falseValues?: Array): boolean;
|
||||
|
||||
}
|
||||
Vendored
+208
@@ -0,0 +1,208 @@
|
||||
/* *****************************************************************************
|
||||
Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
|
||||
this file except in compliance with the License. You may obtain a copy of the
|
||||
License at http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
|
||||
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
|
||||
MERCHANTABLITY OR NON-INFRINGEMENT.
|
||||
|
||||
See the Apache Version 2.0 License for specific language governing permissions
|
||||
and limitations under the License.
|
||||
***************************************************************************** */
|
||||
|
||||
declare module WinJS {
|
||||
function strictProcessing(): void;
|
||||
module Binding {
|
||||
function as(data: any): any;
|
||||
class List {
|
||||
constructor(data: any[]);
|
||||
public push(item: any): any;
|
||||
public indexOf(item: any): number;
|
||||
public splice(index: number, count: number, newelems: any[]): any[];
|
||||
public splice(index: number, count: number): any[];
|
||||
public splice(index: number): any[];
|
||||
public createFiltered(predicate: (x: any) => boolean): List;
|
||||
public createGrouped(keySelector: (x: any) => any, dataSelector: (x:any) => any): List;
|
||||
public groups: any;
|
||||
public dataSource: any;
|
||||
public getAt: any;
|
||||
}
|
||||
}
|
||||
module Namespace {
|
||||
var define: any;
|
||||
var defineWithParent: any;
|
||||
}
|
||||
module Class {
|
||||
function define(constructor: any, instanceMembers: any): any;
|
||||
function derive(baseClass: any, constructor: any, instanceMembers: any): any;
|
||||
function mix(constructor: any, mixin: any): any;
|
||||
}
|
||||
function xhr(options: { type?: string; url?: string; user?: string; password?: string; headers?: any; data?: any; responseType?: string; }): WinJS.Promise<XMLHttpRequest>;
|
||||
module Application {
|
||||
interface IOHelper {
|
||||
exists(filename: string): boolean;
|
||||
readText(fileName: string, def: string): WinJS.Promise<string>;
|
||||
readText(fileName: string): WinJS.Promise<string>;
|
||||
writeText(fileName: string, text: string): WinJS.Promise<void>;
|
||||
remove(fileName: string): WinJS.Promise<void>;
|
||||
}
|
||||
var local: IOHelper;
|
||||
var roaming: IOHelper;
|
||||
var onactivated: EventListener;
|
||||
var sessionState: any;
|
||||
interface ApplicationActivationEvent extends Event {
|
||||
detail: any;
|
||||
setPromise(p: Promise<any>): any;
|
||||
}
|
||||
function addEventListener(type: string, listener: EventListener, capture?: boolean): void;
|
||||
var oncheckpoint: EventListener;
|
||||
function start(): void;
|
||||
function stop(): void;
|
||||
}
|
||||
class Promise<T> {
|
||||
constructor(init: (c: any, e: any, p: any) => void);
|
||||
then<U>(success?: (value: T) => Promise<U>, error?: (error: any) => Promise<U>, progress?: (progress: any) => void ): Promise<U>;
|
||||
then<U>(success?: (value: T) => Promise<U>, error?: (error: any) => U, progress?: (progress: any) => void ): Promise<U>;
|
||||
then<U>(success?: (value: T) => U, error?: (error: any) => Promise<U>, progress?: (progress: any) => void ): Promise<U>;
|
||||
then<U>(success?: (value: T) => U, error?: (error: any) => U, progress?: (progress: any) => void ): Promise<U>;
|
||||
done<U>(success?: (value: T) => any, error?: (error: any) => any, progress?: (progress: any) => void ): void;
|
||||
static join: any;
|
||||
static timeout: any;
|
||||
}
|
||||
module Navigation {
|
||||
var history: any;
|
||||
var canGoBack: boolean;
|
||||
var canGoForward: boolean;
|
||||
var location: string;
|
||||
var state: any;
|
||||
function addEventListener(type: string, listener: EventListener, capture: boolean): void;
|
||||
function back(): void;
|
||||
function forward(): void;
|
||||
function navigate(location: any, initialState: any);
|
||||
function navigate(location: any);
|
||||
function removeEventListener(type: string, listener: EventListener, capture: boolean): void;
|
||||
var onbeforenavigate: CustomEvent;
|
||||
var onnavigated: CustomEvent;
|
||||
var onnavigating: CustomEvent;
|
||||
}
|
||||
module Utilities {
|
||||
function markSupportedForProcessing(obj: any): void;
|
||||
enum Key {
|
||||
backspace,
|
||||
tab,
|
||||
enter,
|
||||
shift,
|
||||
ctrl,
|
||||
alt,
|
||||
pause,
|
||||
capsLock,
|
||||
escape,
|
||||
space,
|
||||
pageUp,
|
||||
pageDown,
|
||||
end,
|
||||
home,
|
||||
leftArrow,
|
||||
upArrow,
|
||||
rightArrow,
|
||||
downArrow,
|
||||
insert,
|
||||
deleteKey,
|
||||
num0,
|
||||
num1,
|
||||
num2,
|
||||
num3,
|
||||
num4,
|
||||
num5,
|
||||
num6,
|
||||
num7,
|
||||
num8,
|
||||
num9,
|
||||
a,
|
||||
b,
|
||||
c,
|
||||
d,
|
||||
e,
|
||||
f,
|
||||
g,
|
||||
h,
|
||||
i,
|
||||
j,
|
||||
k,
|
||||
l,
|
||||
m,
|
||||
n,
|
||||
o,
|
||||
p,
|
||||
q,
|
||||
r,
|
||||
s,
|
||||
t,
|
||||
u,
|
||||
v,
|
||||
w,
|
||||
x,
|
||||
y,
|
||||
z,
|
||||
leftWindows,
|
||||
rightWindows,
|
||||
numPad0,
|
||||
numPad1,
|
||||
numPad2,
|
||||
numPad3,
|
||||
numPad4,
|
||||
numPad5,
|
||||
numPad6,
|
||||
numPad7,
|
||||
numPad8,
|
||||
numPad9,
|
||||
multiply,
|
||||
add,
|
||||
subtract,
|
||||
decimalPoint,
|
||||
divide,
|
||||
f1,
|
||||
f2,
|
||||
f3,
|
||||
f4,
|
||||
f5,
|
||||
f6,
|
||||
f7,
|
||||
f8,
|
||||
f9,
|
||||
f10,
|
||||
f11,
|
||||
f12,
|
||||
numLock,
|
||||
scrollLock,
|
||||
semicolon,
|
||||
equal,
|
||||
comma,
|
||||
dash,
|
||||
period,
|
||||
forwardSlash,
|
||||
graveAccent,
|
||||
openBracket,
|
||||
backSlash,
|
||||
closeBracket,
|
||||
singleQuote
|
||||
}
|
||||
}
|
||||
module UI {
|
||||
var process: any;
|
||||
var processAll: any;
|
||||
var ListLayout: any;
|
||||
var GridLayout: any;
|
||||
var Pages: any;
|
||||
var Menu: any;
|
||||
var setOptions: any;
|
||||
}
|
||||
}
|
||||
|
||||
interface Element {
|
||||
winControl: any; // TODO: This should be control?
|
||||
}
|
||||
|
||||
Vendored
+14644
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user