Merge branch 'master' of github.com:borisyankov/DefinitelyTyped

Conflicts:
	d3/d3.d.ts
This commit is contained in:
Alex Ford
2015-04-13 15:36:29 -04:00
50 changed files with 9157 additions and 1916 deletions
+8 -6
View File
@@ -5,6 +5,7 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam
* [:link:](acc-wizard/acc-wizard.d.ts) [acc-wizard](https://github.com/sathomas/acc-wizard) by [Cyril Schumacher](https://github.com/cyrilschumacher)
* [:link:](accounting/accounting.d.ts) [accounting.js](http://josscrowcroft.github.io/accounting.js) by [Sergey Gerasimov](https://github.com/gerich-home)
* [:link:](ace/ace.d.ts) [Ace Ajax.org Cloud9 Editor](http://ace.ajax.org) by [Diullei Gomes](https://github.com/Diullei)
* [:link:](acorn/acorn.d.ts) [Acorn](https://github.com/marijnh/acorn) by [RReverser](https://github.com/RReverser)
* [:link:](add2home/add2home.d.ts) [add2home](http://cubiq.org/add-to-home-screen) by [James Wilkins](http://www.codeplex.com/site/users/view/jamesnw)
* [:link:](adm-zip/adm-zip.d.ts) [adm-zip](https://github.com/cthackers/adm-zip) by [John Vilk](https://github.com/jvilk)
* [:link:](alertify/alertify.d.ts) [alertify](http://fabien-d.github.io/alertify.js) by [John Jeffery](http://github.com/jjeffery)
@@ -195,7 +196,8 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam
* [:link:](errorhandler/errorhandler.d.ts) [errorhandler](https://github.com/expressjs/errorhandler) by [Santi Albo](https://github.com/santialbo)
* [:link:](es6-promise/es6-promise.d.ts) [es6-promise](https://github.com/jakearchibald/ES6-Promise) by [François de Campredon](https://github.com/fdecampredon), [vvakame](https://github.com/vvakame)
* [:link:](escape-latex/escape-latex.d.ts) [escape-latex](https://github.com/dangmai/escape-latex) by [Oliver Schneider](https://github.com/olsio)
* [:link:](esprima/esprima.d.ts) [Esprima](http://esprima.org) by [teppeis](https://github.com/teppeis)
* [:link:](esprima/esprima.d.ts) [Esprima](http://esprima.org) by [teppeis](https://github.com/teppeis), [RReverser](https://github.com/RReverser)
* [:link:](estree/estree.d.ts) [ESTree AST specification](https://github.com/estree/estree) by [RReverser](https://github.com/RReverser)
* [:link:](event-loop-lag/event-loop-lag.d.ts) [event-loop-lag](https://github.com/pebble/event-loop-lag) by [Rogier Schouten](https://github.com/rogierschouten)
* [:link:](eventemitter2/eventemitter2.d.ts) [EventEmitter2](https://github.com/asyncly/EventEmitter2) by [ryiwamoto](https://github.com/ryiwamoto)
* [:link:](eventemitter3/eventemitter3.d.ts) [EventEmitter3](https://github.com/primus/eventemitter3) by [Yuichi Murata](https://github.com/mrk21)
@@ -277,9 +279,9 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam
* [:link:](greensock/greensock.d.ts) [GreenSock Animation Platform](http://www.greensock.com/get-started-js) by [Robert S](https://github.com/codebelt)
* [:link:](gridfs-stream/gridfs-stream.d.ts) [gridfs-stream](https://github.com/aheckmann/gridfs-stream) by [Lior Mualem](https://github.com/liorm)
* [:link:](gruntjs/gruntjs.d.ts) [Grunt 0.4.x](http://gruntjs.com) by [Jeff May](https://github.com/jeffmay), [Basarat Ali Syed](https://github.com/basarat)
* [:link:](gsap/Core.d.ts) [GSAP](http://greensock.com) by [VILIC VANE](https://vilic.github.io)
* [:link:](gsap/TweenLite.d.ts) [GSAP](http://greensock.com) by [VILIC VANE](https://vilic.github.io)
* [:link:](gsap/Ease.d.ts) [GSAP](http://greensock.com) by [VILIC VANE](https://vilic.github.io)
* [:link:](gsap/Core.d.ts) [GSAP](http://greensock.com) by [VILIC VANE](https://vilic.github.io)
* [:link:](gulp/gulp.d.ts) [Gulp v3.8.x](http://gulpjs.com) by [Drew Noakes](https://drewnoakes.com)
* [:link:](gulp-autoprefixer/gulp-autoprefixer.d.ts) [gulp-autoprefixer](https://github.com/sindresorhus/gulp-autoprefixer) by [Asana](https://asana.com)
* [:link:](gulp-concat/gulp-concat.d.ts) [gulp-concat](http://github.com/wearefractal/gulp-concat) by [Keita Kagurazaka](https://github.com/k-kagurazaka)
@@ -596,9 +598,9 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam
* [:link:](xml2js/xml2js.d.ts) [node-xml2js](https://github.com/Leonidas-from-XIV/node-xml2js) by [Michel Salib](https://github.com/michelsalib), [Jason McNeil](https://github.com/jasonrm)
* [:link:](node/node.d.ts) [Node.js](http://nodejs.org) by [Microsoft TypeScript](http://typescriptlang.org), [DefinitelyTyped](https://github.com/borisyankov/DefinitelyTyped)
* [:link:](restify/restify.d.ts) [node.js REST framework](https://github.com/mcavage/node-restify) by [Bret Little](https://github.com/blittle)
* [:link:](acl/acl-redisBackend.d.ts) [node_acl](https://github.com/optimalbits/node_acl) by [Qubo](https://github.com/tkQubo)
* [:link:](acl/acl-mongodbBackend.d.ts) [node_acl](https://github.com/optimalbits/node_acl) by [Qubo](https://github.com/tkQubo)
* [:link:](acl/acl.d.ts) [node_acl](https://github.com/optimalbits/node_acl) by [Qubo](https://github.com/tkQubo)
* [:link:](acl/acl-mongodbBackend.d.ts) [node_acl](https://github.com/optimalbits/node_acl) by [Qubo](https://github.com/tkQubo)
* [:link:](acl/acl-redisBackend.d.ts) [node_acl](https://github.com/optimalbits/node_acl) by [Qubo](https://github.com/tkQubo)
* [:link:](mdns/mdns.d.ts) [node_mdns](https://github.com/agnat/node_mdns) by [Stefan Steinhart](https://github.com/reppners)
* [:link:](node_redis/node_redis.d.ts) [node_redis](https://github.com/mranney/node_redis) by [Boris Yankov](https://github.com/borisyankov)
* [:link:](each/each.d.ts) [NodeEach](http://www.adaltas.com/projects/node-each) by [Michael Zabka](https://github.com/misak113)
@@ -608,8 +610,8 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam
* [:link:](nopt/nopt.d.ts) [nopt](https://github.com/npm/nopt) by [jbondc](https://github.com/jbondc)
* [:link:](notifyjs/notifyjs.d.ts) [notify.js](https://github.com/alexgibson/notify.js) by [soundTricker](https://github.com/soundTricker)
* [:link:](notify/notify.d.ts) [Notify.js](https://github.com/jpillora/notifyjs) by [Xiaohan Zhang](https://github.com/hellochar)
* [:link:](nouislider/nouislider.d.ts) [nouislider](https://github.com/leongersen/noUiSlider) by [Corey Jepperson](https://github.com/acoreyj)
* [:link:](wnumb/wnumb.d.ts) [nouislider](https://github.com/leongersen/wnumb) by [Corey Jepperson](https://github.com/acoreyj)
* [:link:](nouislider/nouislider.d.ts) [nouislider](https://github.com/leongersen/noUiSlider) by [Corey Jepperson](https://github.com/acoreyj)
* [:link:](noVNC/noVNC.d.ts) [noVNC](https://github.com/kanaka/noVNC) by [Ken Smith](https://github.com/smithkl42)
* [:link:](npm/npm.d.ts) [npm](https://github.com/npm/npm) by [Maxime LUCE](https://github.com/SomaticIT)
* [:link:](nprogress/NProgress.d.ts) [NProgress](https://github.com/rstacruz/nprogress) by [Judah Gabriel Himango](http://debuggerdotbreak.wordpress.com)
@@ -656,9 +658,9 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam
* [:link:](poly2tri/poly2tri.d.ts) [poly2tri](http://github.com/r3mi/poly2tri.js) by [Elemar Junior](https://github.com/elemarjr)
* [:link:](polymer/polymer.d.ts) [polymer](https://github.com/polymer) by [Louis Grignon](https://github.com/lgrignon)
* [:link:](polymer/polymer.paper-dialog.d.ts) [polymer's paper-dialog](https://github.com/Polymer/paper-dialog) by [Louis Grignon](https://github.com/lgrignon)
* [:link:](polymer/polymer.core-drawer-panel.d.ts) [polymer's paper-toast](https://github.com/Polymer/core-drawer-panel) by [Louis Grignon](https://github.com/lgrignon)
* [:link:](polymer/polymer.core-overlay.d.ts) [polymer's paper-toast](https://github.com/Polymer/core-selector) by [Louis Grignon](https://github.com/lgrignon)
* [:link:](polymer/polymer.paper-toast.d.ts) [polymer's paper-toast](https://github.com/Polymer/paper-toast) by [Louis Grignon](https://github.com/lgrignon)
* [:link:](polymer/polymer.core-drawer-panel.d.ts) [polymer's paper-toast](https://github.com/Polymer/core-drawer-panel) by [Louis Grignon](https://github.com/lgrignon)
* [:link:](polymer/polymer.core-selector.d.ts) [polymer's paper-toast](https://github.com/Polymer/core-selector) by [Louis Grignon](https://github.com/lgrignon)
* [:link:](popcorn/popcorn.d.ts) [Popcorn](https://github.com/mozilla/popcorn-js) by [grapswiz](https://github.com/grapswiz)
* [:link:](pouchDB/pouch.d.ts) [Pouch](http://pouchdb.com) by [Bill Sears](https://github.com/MrBigDog2U)
+30
View File
@@ -0,0 +1,30 @@
/// <reference path="../estree/estree.d.ts" />
/// <reference path="acorn.d.ts" />
import acorn = require('acorn');
var token: acorn.Token;
var tokens: acorn.Token[];
var comment: acorn.Comment;
var comments: acorn.Comment[];
var program: ESTree.Program;
var any: any;
var string: string;
// acorn
string = acorn.version;
program = acorn.parse('code');
program = acorn.parse('code', {range: true, onToken: tokens, onComment: comments});
program = acorn.parse('code', {
ranges: true,
onToken: (token) => tokens.push(token),
onComment: (isBlock, text, start, end) => { }
});
// Token
token = tokens[0];
string = token.type.label;
any = token.value;
// Comment
string = comment.value;
+67
View File
@@ -0,0 +1,67 @@
// Type definitions for Acorn v1.0.1
// Project: https://github.com/marijnh/acorn
// Definitions by: RReverser <https://github.com/RReverser>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
/// <reference path="../estree/estree.d.ts" />
declare module acorn {
var version: string;
function parse(input: string, options?: Options): ESTree.Program;
function parseExpressionAt(input: string, pos: number, options?: Options): ESTree.Expression;
var defaultOptions: Options;
interface TokenType {
label: string;
keyword: string;
beforeExpr: boolean;
startsExpr: boolean;
isLoop: boolean;
isAssign: boolean;
prefix: boolean;
postfix: boolean;
binop: number;
updateContext: (prevType: TokenType) => any;
}
interface AbstractToken {
start: number;
end: number;
loc: ESTree.SourceLocation;
range: [number, number];
}
interface Token extends AbstractToken {
type: TokenType;
value: any;
}
interface Comment extends AbstractToken {
type: string;
value: string;
}
interface Options {
ecmaVersion?: number;
sourceType?: string;
onInsertedSemicolon?: (lastTokEnd: number, lastTokEndLoc?: ESTree.Position) => any;
onTrailingComma?: (lastTokEnd: number, lastTokEndLoc?: ESTree.Position) => any;
allowReserved?: boolean;
allowReturnOutsideFunction?: boolean;
allowImportExportEverywhere?: boolean;
allowHashBang?: boolean;
locations?: boolean;
onToken?: ((token: Token) => any) | Token[];
onComment?: ((isBlock: boolean, text: string, start: number, end: number, startLoc?: ESTree.Position, endLoc?: ESTree.Position) => any) | Comment[];
ranges?: boolean;
program?: ESTree.Program;
sourceFile?: string;
directSourceFile?: string;
preserveParens?: boolean;
plugins?: { [name: string]: Function; };
}
}
declare module "acorn" {
export = acorn
}
+9 -9
View File
@@ -1,4 +1,4 @@
// Type definitions for Angular Material 0.8.3+ (ng.material module)
// Type definitions for Angular Material 0.8.3+ (angular.material module)
// Project: https://github.com/angular/material
// Definitions by: Matt Traynham <https://github.com/mtraynham>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
@@ -12,14 +12,14 @@ declare module angular.material {
controller?: any;
locals?: {[index: string]: any};
targetEvent?: any;
resolve?: {[index: string]: ng.IPromise<any>}
resolve?: {[index: string]: angular.IPromise<any>}
controllerAs?: string;
parent?: Element;
disableParentScroll?: boolean;
}
interface MDBottomSheetService {
show(options: MDBottomSheetOptions): ng.IPromise<any>;
show(options: MDBottomSheetOptions): angular.IPromise<any>;
hide(response?: any): void;
cancel(response?: any): void;
}
@@ -49,14 +49,14 @@ declare module angular.material {
controller?: any;
locals?: {[index: string]: any};
bindToController?: boolean;
resolve?: {[index: string]: ng.IPromise<any>}
resolve?: {[index: string]: angular.IPromise<any>}
controllerAs?: string;
parent?: Element;
onComplete?: Function;
}
interface MDDialogService {
show(dialog: MDDialogOptions|MDPresetDialog<any>): ng.IPromise<any>;
show(dialog: MDDialogOptions|MDPresetDialog<any>): angular.IPromise<any>;
confirm(): MDConfirmDialog;
alert(): MDAlertDialog;
hide(response?: any): void;
@@ -64,7 +64,7 @@ declare module angular.material {
}
interface MDIcon {
(path: string): ng.IPromise<Element>;
(path: string): angular.IPromise<Element>;
}
interface MDIconProvider {
@@ -110,14 +110,14 @@ declare module angular.material {
controller?: any;
locals?: {[index: string]: any};
bindToController?: boolean;
resolve?: {[index: string]: ng.IPromise<any>}
resolve?: {[index: string]: angular.IPromise<any>}
controllerAs?: string;
parent?: Element;
}
interface MDToastService {
show(optionsOrPreset: MDToastOptions|MDToastPreset<any>): ng.IPromise<any>;
showSimple(): ng.IPromise<any>;
show(optionsOrPreset: MDToastOptions|MDToastPreset<any>): angular.IPromise<any>;
showSimple(): angular.IPromise<any>;
simple(): MDSimpleToastPreset;
build(): MDToastPreset<any>;
updateContent(): void;
+3 -3
View File
@@ -62,7 +62,7 @@ declare module angular.ui {
reloadOnSearch?: boolean;
}
interface IStateProvider extends IServiceProvider {
interface IStateProvider extends ng.IServiceProvider {
state(name:string, config:IState): IStateProvider;
state(config:IState): IStateProvider;
decorator(name?: string, decorator?: (state: IState, parent: Function) => any): any;
@@ -81,7 +81,7 @@ declare module angular.ui {
type(name: string, definition: any, definitionFn?: any): any;
}
interface IUrlRouterProvider extends IServiceProvider {
interface IUrlRouterProvider extends ng.IServiceProvider {
when(whenPath: RegExp, handler: Function): IUrlRouterProvider;
when(whenPath: RegExp, handler: any[]): IUrlRouterProvider;
when(whenPath: RegExp, toPath: string): IUrlRouterProvider;
@@ -143,7 +143,7 @@ declare module angular.ui {
*
* @param options Options object.
*/
go(to: string, params?: {}, options?: IStateOptions): IPromise<any>;
go(to: string, params?: {}, options?: IStateOptions): ng.IPromise<any>;
transitionTo(state: string, params?: {}, updateLocation?: boolean): void;
transitionTo(state: string, params?: {}, options?: IStateOptions): void;
includes(state: string, params?: {}): boolean;
+1 -1
View File
@@ -238,7 +238,7 @@ declare module Backbone {
initial(n: number): TModel[];
inject(iterator: (memo: any, element: TModel, index: number) => any, initialMemo: any, context?: any): any;
isEmpty(object: any): boolean;
invoke(methodName: string, arguments?: any[]): any;
invoke(methodName: string, args?: any[]): any;
last(): TModel;
last(n: number): TModel[];
lastIndexOf(element: TModel, fromIndex?: number): number;
+1 -2
View File
@@ -3,7 +3,6 @@
import core = breeze.core;
import config = breeze.config;
function test_dataType() {
var typ = breeze.DataType.DateTime;
var nm = typ.getName();
@@ -888,4 +887,4 @@ function test_config() {
config.registerType(f1, "myCtor");
s = config.stringifyPad;
o = config.typeRegistry;
}
}
+1
View File
@@ -115,6 +115,7 @@ interface CircularInstance extends ChartInstance {
update: () => void;
addData: (valuesArray: CircularChartData[], index: number) => void;
removeData: (index: number) => void;
segments: Array<CircularChartData>;
}
interface LineChartOptions extends ChartOptions {
+13 -8
View File
@@ -1,4 +1,4 @@
// Type definitions for Chosen.JQuery 0.9
// Type definitions for Chosen.JQuery 1.4.2
// Project: http://harvesthq.github.com/chosen/
// Definitions by: Boris Yankov <https://github.com/borisyankov/>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
@@ -8,18 +8,23 @@
interface ChosenOptions {
allow_single_deselect?: boolean;
disable_search_threshold?: number;
disable_search?: boolean;
disable_search_threshold?: number;
enable_split_word_search?: boolean;
inherit_select_classes?: boolean;
max_selected_options?: number;
no_results_text?: string;
placeholder_text_multiple?: string;
placeholder_text_single?: string;
search_contains?: boolean;
single_backstroke_delete?: boolean;
max_selected_options?: number;
placeholder_text_multiple?: string;
placeholder_text?: string;
placeholder_text_single?: string;
no_results_text?: string;
width?: number;
display_disabled_options?: boolean;
display_selected_options?: boolean;
include_group_label_in_selected?: boolean;
}
interface JQuery {
chosen(): JQuery;
chosen(options: ChosenOptions): JQuery;
}
}
+31
View File
@@ -0,0 +1,31 @@
/// <reference path="circular-json.d.ts" />
import CircularJSON = require('circular-json');
var replacer = (key: any, val: any) => {
return val;
}
var replacerArray = ['a', 'x'];
// implements JSON interface
var json_obj: JSON = CircularJSON;
CircularJSON.parse('{"a":"b"}');
CircularJSON.parse('{"a":"b"}', replacer);
// just stringify a value
CircularJSON.stringify({a: 'b'});
// do replacements for part of the object
CircularJSON.stringify({a: 'b'}, replacer);
CircularJSON.stringify({a: 'b'}, replacerArray);
// add whitespace to the output
CircularJSON.stringify({a: 'b'}, replacer, 5);
CircularJSON.stringify({a: 'b'}, replacerArray, 5);
// do not actually set up a re-parseable object
CircularJSON.stringify({a: 'b'}, replacer, 5, true);
CircularJSON.stringify({a: 'b'}, replacerArray, 5, true);
+15
View File
@@ -0,0 +1,15 @@
// Type definitions for circular-json v0.1.6
// Project: https://github.com/WebReflection/circular-json
// Definitions by: Jonathan Pevarnek <https://github.com/jpevarnek/>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
declare module 'circular-json' {
interface ICircularJSON extends JSON {
parse(text: string, reviver?: (key: any, value: any) => any): any;
stringify(value: any, replacer?: ((key: string, value: any) => any) | any[], space?: any, placeholder?: boolean): string;
}
var CircularJSON: ICircularJSON;
export = CircularJSON;
}
+9 -9
View File
@@ -444,7 +444,7 @@ declare module Ember {
static metaForProperty(key: string): {};
static isClass: boolean;
static isMethod: boolean;
static initializer(arguments?: ApplicationInitializerArguments): void;
static initializer(args?: ApplicationInitializerArguments): void;
/**
Call advanceReadiness after any asynchronous setup logic has completed.
Each call to deferReadiness must be matched by a call to advanceReadiness
@@ -1318,9 +1318,9 @@ declare module Ember {
Creates an instance of the class.
@param arguments A hash containing values with which to initialize the newly instantiated object.
**/
static create<T extends Mixin>(arguments?: {}): T;
static create<T extends Mixin>(args: {}): T;
detect(obj: any): boolean;
reopen<T extends Mixin>(arguments?: {}): T;
reopen<T extends Mixin>(args?: {}): T;
}
class MutableArray implements Array, MutableEnumberable {
addArrayObserver(target: any, opts?: EnumerableConfigurationOptions): any[];
@@ -1581,17 +1581,17 @@ declare module Ember {
/**
Creates a subclass of the Object class.
**/
static extend<T>(arguments?: CoreObjectArguments): T;
static extend<T>(mixins? : Mixin, arguments?: CoreObjectArguments): T;
static extend<T>(args?: CoreObjectArguments): T;
static extend<T>(mixins? : Mixin, args?: CoreObjectArguments): T;
/**
Creates an instance of the class.
@param arguments A hash containing values with which to initialize the newly instantiated object.
**/
static create<T extends {}>(arguments?: {}): T;
static create<T extends {}>(args?: {}): T;
/**
Equivalent to doing extend(arguments).create(). If possible use the normal create method instead.
**/
static createWithMixins<T extends {}>(arguments?: {}): T;
static createWithMixins<T extends {}>(args?: {}): T;
static detect(obj: any): boolean;
static detectInstance(obj: any): boolean;
/**
@@ -1608,13 +1608,13 @@ declare module Ember {
Augments a constructor's prototype with additional properties and functions.
To add functions and properties to the constructor itself, see reopenClass.
**/
static reopen<T extends {}>(arguments?: {}): T;
static reopen<T extends {}>(args?: {}): T;
/**
Augments a constructor's own properties and functions.
To add functions and properties to instances of a constructor by extending the
constructor's prototype see reopen.
**/
static reopenClass<T extends {}>(arguments?: {}): T;
static reopenClass<T extends {}>(args?: {}): T;
static isClass: boolean;
static isMethod: boolean;
addObserver: ModifyObserver;
+3 -184
View File
@@ -1,27 +1,12 @@
/// <reference path="../estree/estree.d.ts" />
/// <reference path="esprima.d.ts" />
import esprima = require('esprima');
import Syntax = esprima.Syntax;
var token: esprima.Token;
var options: esprima.Options;
var comment: Syntax.Comment;
var program: Syntax.Program;
var statement: Syntax.Statement;
var expression: Syntax.Expression;
var property: Syntax.Property;
var identifier: Syntax.Identifier;
var literal: Syntax.Literal;
var switchCase: Syntax.SwitchCase;
var catchClause: Syntax.CatchClause;
var variableDeclaratorOrExpression: Syntax.VariableDeclaratorOrExpression;
var literalOrIdentifier: Syntax.LiteralOrIdentifier;
var blockStatementOrExpression: Syntax.BlockStatementOrExpression;
var identifierOrExpression: Syntax.IdentifierOrExpression;
var any: any;
var comment: esprima.Comment;
var program: ESTree.Program;
var string: string;
var boolean: boolean;
var number: number;
// esprima
string = esprima.version;
@@ -34,171 +19,5 @@ token = esprima.tokenize('code', {range: true})[0];
string = token.type;
string = token.value;
// Program
string = program.type;
statement = program.body[0];
comment = program.comments[0]
// Location
number = program.loc.start.line;
number = program.loc.start.column;
number = program.loc.end.line;
number = program.loc.end.column;
number = program.range[0];
// Comment
string = comment.value;
// Statement
// BlockStatement
var blockStatement: Syntax.BlockStatement;
string = blockStatement.type;
statement = blockStatement.body[0];
comment = blockStatement.leadingComments[0];
comment = blockStatement.trailingComments[0];
// ExpressionStatement
var expressionStatement: Syntax.ExpressionStatement;
expression = expressionStatement.expression;
// IfStatement
var ifStatement: Syntax.IfStatement;
expression = ifStatement.test;
statement = ifStatement.consequent;
statement = ifStatement.alternate;
// LabeledStatement
var labeledStatement: Syntax.LabeledStatement;
identifier = labeledStatement.label;
statement = labeledStatement.body;
// WithStatement
var withStatement: Syntax.WithStatement;
expression = withStatement.object;
// SwitchStatement
var switchStatement: Syntax.SwitchStatement;
expression = switchStatement.discriminant;
switchCase = switchStatement.cases[0];
boolean = switchStatement.lexical;
// ReturnStatement
var returnStatement: Syntax.ReturnStatement;
expression = returnStatement.argument;
// TryStatement
var tryStatement: Syntax.TryStatement;
blockStatement = tryStatement.block;
catchClause = tryStatement.handler;
catchClause = tryStatement.guardedHandlers[0];
blockStatement = tryStatement.finalizer;
// ForStatement
var forStatement: Syntax.ForStatement;
variableDeclaratorOrExpression = forStatement.init;
expression = forStatement.update;
// ForInStatement
var forInStatement: Syntax.ForInStatement;
variableDeclaratorOrExpression = forInStatement.left;
expression = forInStatement.right;
boolean = forInStatement.each;
// Expression
// ArrayExpression
var arrayExpression: Syntax.ArrayExpression;
string = arrayExpression.type;
expression = arrayExpression.elements[0];
// ObjectExpression
var objectExpression: Syntax.ObjectExpression;
property = objectExpression.properties[0];
string = property.type;
literalOrIdentifier = property.key;
expression = property.value;
string = property.kind;
// FunctionExpression
var functionExpression: Syntax.FunctionExpression;
identifier = functionExpression.id;
identifier = functionExpression.params[0];
expression = functionExpression.defaults[0];
identifier = functionExpression.rest;
blockStatementOrExpression = functionExpression.body;
boolean = functionExpression.generator;
boolean = functionExpression.expression;
// SequenceExpression
var sequenceExpression: Syntax.SequenceExpression;
expression = sequenceExpression.expressions[0]
// UnaryExpression
var unaryExpression: Syntax.UnaryExpression;
string = unaryExpression.operator;
boolean = unaryExpression.prefix;
// BinaryExpression
var binaryExpression: Syntax.BinaryExpression;
expression = binaryExpression.left;
expression = binaryExpression.right;
// ConditionalExpression
var conditionalExpression: Syntax.ConditionalExpression;
expression = conditionalExpression.test;
expression = conditionalExpression.alternate;
expression = conditionalExpression.consequent;
// NewExpression
var newExpression: Syntax.NewExpression;
expression = newExpression.callee;
expression = newExpression.arguments[0];
// CallExpression
var callExpression: Syntax.CallExpression;
expression = callExpression.callee;
expression = callExpression.arguments[0];
// MemberExpression
var memberExpression: Syntax.MemberExpression;
expression = memberExpression.object;
identifierOrExpression = memberExpression.property;
boolean = memberExpression.computed;
// Declarations
var functionDeclaration: Syntax.FunctionDeclaration;
identifier = functionDeclaration.id;
var params:Syntax.Identifier[] = functionDeclaration.params;
var defaults:Syntax.Expression[] = functionDeclaration.defaults;
identifier = functionDeclaration.rest;
var body:Syntax.BlockStatementOrExpression = functionDeclaration.body;
boolean = functionDeclaration.generator;
boolean = functionDeclaration.expression;
var variableDeclaration: Syntax.VariableDeclaration;
var declarations:Syntax.VariableDeclarator[] = variableDeclaration.declarations;
string = variableDeclaration.kind; // "var" | "let" | "const"
var variableDeclarator: Syntax.VariableDeclarator;
identifier = variableDeclarator.id; // Pattern
expression = variableDeclarator.init;
// Clauses
// SwitchCase
string = switchCase.type;
expression = switchCase.test;
statement = switchCase.consequent[0];
// CatchClause
string = catchClause.type;
identifier = catchClause.param;
expression = catchClause.guard;
blockStatement = catchClause.body;
// Misc
// Identifier
string = identifier.type;
string = identifier.name;
// Literal
string = literal.type;
any = literal.value;
+11 -243
View File
@@ -1,18 +1,24 @@
// Type definitions for Esprima v1.2.0
// Type definitions for Esprima v2.1.0
// Project: http://esprima.org
// Definitions by: teppeis <https://github.com/teppeis/>
// Definitions by: teppeis <https://github.com/teppeis>, RReverser <https://github.com/RReverser>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
/// <reference path="../estree/estree.d.ts" />
declare module esprima {
var version: string;
function parse(code: string, options?: Options): Syntax.Program;
function tokenize(code: string, options?: Options): Array<Token>;
var version: string
function parse(code: string, options?: Options): ESTree.Program
function tokenize(code: string, options?: Options): Array<Token>
interface Token {
type: string
value: string
}
interface Comment extends ESTree.Node {
value: string
}
interface Options {
loc?: boolean
range?: boolean
@@ -23,244 +29,6 @@ declare module esprima {
tolerant?: boolean
source?: boolean
}
module Syntax {
// Node
interface Node {
type: string
loc?: LineLocation
range?: number[]
leadingComments?: Comment[]
trailingComments?: Comment[]
}
interface LineLocation {
start: Position
end: Position
}
interface Position {
line: number
column: number
}
// Comment
interface Comment extends Node {
value: string
}
// Program
interface Program extends Node {
body: Statement[]
comments?: Comment[]
}
// Function
interface Function extends Node {
id: Identifier // | null
params: Identifier[]
defaults: Expression[]
rest: Identifier // | null
body: BlockStatementOrExpression
generator: boolean
expression: boolean
}
interface BlockStatementOrExpression extends BlockStatement, Expression {
}
// Statement
interface Statement extends Node {
}
interface EmptyStatement extends Statement {
}
interface BlockStatement extends Statement {
body: Statement[]
}
interface ExpressionStatement extends Statement {
expression: Expression
}
interface IfStatement extends Statement {
test: Expression
consequent: Statement
alternate: Statement
}
interface LabeledStatement extends Statement {
label: Identifier
body: Statement
}
interface BreakStatement extends Statement {
label: Identifier // | null
}
interface ContinueStatement extends Statement {
label: Identifier // | null
}
interface WithStatement extends Statement {
object: Expression
body: Statement
}
interface SwitchStatement extends Statement {
discriminant: Expression
cases: SwitchCase[]
lexical: boolean
}
interface ReturnStatement extends Statement {
argument: Expression // | null
}
interface ThrowStatement extends Statement {
argument: Expression
}
interface TryStatement extends Statement {
block: BlockStatement
handler: CatchClause // | null
guardedHandlers: CatchClause[]
finalizer: BlockStatement // | null
}
interface WhileStatement extends Statement {
test: Expression
body: Statement
}
interface DoWhileStatement extends Statement {
body: Statement
test: Expression
}
interface ForStatement extends Statement {
init: VariableDeclaratorOrExpression // | null
test: Expression // | null
update: Expression // | null
body: Statement
}
interface ForInStatement extends Statement {
left: VariableDeclaratorOrExpression
right: Expression
body: Statement
each: boolean
}
interface VariableDeclaratorOrExpression extends VariableDeclarator, Expression {
}
interface DebuggerStatement extends Statement {
}
interface StatementOrList extends Array<Statement>, Statement {
}
// Declaration
interface Declaration extends Statement {
}
interface FunctionDeclaration extends Declaration {
id: Identifier
params: Identifier[] // Pattern
defaults: Expression[]
rest: Identifier
body: BlockStatementOrExpression
generator: boolean
expression: boolean
}
interface VariableDeclaration extends Declaration {
declarations: VariableDeclarator[]
kind: string // "var" | "let" | "const"
}
interface VariableDeclarator extends Node {
id: Identifier // Pattern
init: Expression
}
// Expression
interface Expression extends Node { // | Pattern
}
//interface Expression extends
// ThisExpression, ArrayExpression, ObjectExpression, FunctionExpression,
// ArrowFunctionExpression, SequenceExpression, UnaryExpression, BinaryExpression,
// AssignmentExpression, UpdateExpression, LogicalExpression, ConditionalExpression,
// NewExpression, CallExpression, MemberExpression {
//}
interface ThisExpression extends Expression {
}
interface ArrayExpression extends Expression {
elements: Expression[] // [ Expression | null ]
}
interface ObjectExpression extends Expression {
properties: Property[]
}
interface Property extends Node {
key: LiteralOrIdentifier // Literal | Identifier
value: Expression
kind: string // "init" | "get" | "set"
}
interface LiteralOrIdentifier extends Literal, Identifier {
}
interface FunctionExpression extends Function, Expression {
}
interface ArrowFunctionExpression extends Function, Expression {
}
interface SequenceExpression extends Expression {
expressions: Expression[]
}
interface UnaryExpression extends Expression {
operator: string // UnaryOperator
prefix: boolean
argument: Expression
}
interface BinaryExpression extends Expression {
operator: string // BinaryOperator
left: Expression
right: Expression
}
interface AssignmentExpression extends Expression {
operator: string // AssignmentOperator
left: Expression
right: Expression
}
interface UpdateExpression extends Expression {
operator: string // UpdateOperator
argument: Expression
prefix: boolean
}
interface LogicalExpression extends Expression {
operator: string // LogicalOperator
left: Expression
right: Expression
}
interface ConditionalExpression extends Expression {
test: Expression
alternate: Expression
consequent: Expression
}
interface NewExpression extends Expression {
callee: Expression
arguments: Expression[]
}
interface CallExpression extends Expression {
callee: Expression
arguments: Expression[]
}
interface MemberExpression extends Expression {
object: Expression
property: IdentifierOrExpression // Identifier | Expression
computed: boolean
}
interface IdentifierOrExpression extends Identifier, Expression {
}
// Pattern
// interface Pattern extends Node {
// }
// Clauses
interface SwitchCase extends Node {
test: Expression
consequent: Statement[]
}
interface CatchClause extends Node {
param: Identifier // Pattern
guard: Expression
body: BlockStatement
}
// Misc
interface Identifier extends Node, Expression { // | Pattern
name: string
}
interface Literal extends Node, Expression {
value: any // string | boolean | null | number | RegExp
}
}
}
declare module "esprima" {
+177
View File
@@ -0,0 +1,177 @@
/// <reference path="estree.d.ts" />
var program: ESTree.Program;
var statement: ESTree.Statement;
var expression: ESTree.Expression;
var property: ESTree.Property;
var identifier: ESTree.Identifier;
var literal: ESTree.Literal;
var switchCase: ESTree.SwitchCase;
var catchClause: ESTree.CatchClause;
var pattern: ESTree.Pattern;
var assignmentPattern: ESTree.AssignmentPattern;
var variableDeclaratorOrExpression: ESTree.VariableDeclaration | ESTree.Expression;
var literalOrIdentifier: ESTree.Literal | ESTree.Identifier;
var blockStatementOrExpression: ESTree.BlockStatement | ESTree.Expression;
var identifierOrExpression: ESTree.Expression;
var any: any;
var string: string;
var boolean: boolean;
var number: number;
// Program
string = program.type;
statement = program.body[0];
// Location
number = program.loc.start.line;
number = program.loc.start.column;
number = program.loc.end.line;
number = program.loc.end.column;
number = program.range[0];
// Statement
// BlockStatement
var blockStatement: ESTree.BlockStatement;
string = blockStatement.type;
statement = blockStatement.body[0];
// ExpressionStatement
var expressionStatement: ESTree.ExpressionStatement;
expression = expressionStatement.expression;
// IfStatement
var ifStatement: ESTree.IfStatement;
expression = ifStatement.test;
statement = ifStatement.consequent;
statement = ifStatement.alternate;
// LabeledStatement
var labeledStatement: ESTree.LabeledStatement;
identifier = labeledStatement.label;
statement = labeledStatement.body;
// WithStatement
var withStatement: ESTree.WithStatement;
expression = withStatement.object;
// SwitchStatement
var switchStatement: ESTree.SwitchStatement;
expression = switchStatement.discriminant;
switchCase = switchStatement.cases[0];
boolean = switchStatement.lexical;
// ReturnStatement
var returnStatement: ESTree.ReturnStatement;
expression = returnStatement.argument;
// TryStatement
var tryStatement: ESTree.TryStatement;
blockStatement = tryStatement.block;
catchClause = tryStatement.handler;
blockStatement = tryStatement.finalizer;
// ForStatement
var forStatement: ESTree.ForStatement;
variableDeclaratorOrExpression = forStatement.init;
expression = forStatement.update;
// ForInStatement
var forInStatement: ESTree.ForInStatement;
variableDeclaratorOrExpression = forInStatement.left;
expression = forInStatement.right;
// Expression
// ArrayExpression
var arrayExpression: ESTree.ArrayExpression;
string = arrayExpression.type;
expression = arrayExpression.elements[0];
// ObjectExpression
var objectExpression: ESTree.ObjectExpression;
property = objectExpression.properties[0];
string = property.type;
expression = property.key;
expression = property.value;
string = property.kind;
// FunctionExpression
var functionExpression: ESTree.FunctionExpression;
identifier = functionExpression.id;
assignmentPattern = <ESTree.AssignmentPattern>functionExpression.params[0];
pattern = assignmentPattern.left;
expression = assignmentPattern.right;
blockStatementOrExpression = functionExpression.body;
boolean = functionExpression.generator;
// SequenceExpression
var sequenceExpression: ESTree.SequenceExpression;
expression = sequenceExpression.expressions[0]
// UnaryExpression
var unaryExpression: ESTree.UnaryExpression;
string = unaryExpression.operator;
boolean = unaryExpression.prefix;
// BinaryExpression
var binaryExpression: ESTree.BinaryExpression;
expression = binaryExpression.left;
expression = binaryExpression.right;
// ConditionalExpression
var conditionalExpression: ESTree.ConditionalExpression;
expression = conditionalExpression.test;
expression = conditionalExpression.alternate;
expression = conditionalExpression.consequent;
// NewExpression
var newExpression: ESTree.NewExpression;
expression = newExpression.callee;
expression = newExpression.arguments[0];
// CallExpression
var callExpression: ESTree.CallExpression;
expression = callExpression.callee;
expression = callExpression.arguments[0];
// MemberExpression
var memberExpression: ESTree.MemberExpression;
expression = memberExpression.object;
identifierOrExpression = memberExpression.property;
boolean = memberExpression.computed;
// Declarations
var functionDeclaration: ESTree.FunctionDeclaration;
identifier = functionDeclaration.id;
var params:ESTree.Pattern[] = functionDeclaration.params;
var body:ESTree.BlockStatement | ESTree.Expression = functionDeclaration.body;
boolean = functionDeclaration.generator;
var variableDeclaration: ESTree.VariableDeclaration;
var declarations:ESTree.VariableDeclarator[] = variableDeclaration.declarations;
string = variableDeclaration.kind; // "var" | "let" | "const"
var variableDeclarator: ESTree.VariableDeclarator;
pattern = variableDeclarator.id; // Pattern
expression = variableDeclarator.init;
// Clauses
// SwitchCase
string = switchCase.type;
expression = switchCase.test;
statement = switchCase.consequent[0];
// CatchClause
string = catchClause.type;
pattern = catchClause.param;
expression = catchClause.guard;
blockStatement = catchClause.body;
// Misc
// Identifier
string = identifier.type;
string = identifier.name;
// Literal
string = literal.type;
any = literal.value;
+369
View File
@@ -0,0 +1,369 @@
// Type definitions for ESTree AST specification
// Project: https://github.com/estree/estree
// Definitions by: RReverser <https://github.com/RReverser>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
declare module ESTree {
interface Node {
type: string;
loc?: SourceLocation;
range?: [number, number];
}
interface SourceLocation {
source?: string;
start: Position;
end: Position;
}
interface Position {
line: number;
column: number;
}
interface Program extends Node {
body: Array<Statement>;
sourceType: string;
}
interface Function extends Node {
id?: Identifier;
params: Array<Pattern>;
body: BlockStatement | Expression;
generator: boolean;
}
interface Statement extends Node {}
interface EmptyStatement extends Statement {}
interface BlockStatement extends Statement {
body: Array<Statement>;
}
interface ExpressionStatement extends Statement {
expression: Expression;
}
interface IfStatement extends Statement {
test: Expression;
consequent: Statement;
alternate?: Statement;
}
interface LabeledStatement extends Statement {
label: Identifier;
body: Statement;
}
interface BreakStatement extends Statement {
label?: Identifier;
}
interface ContinueStatement extends Statement {
label?: Identifier;
}
interface WithStatement extends Statement {
object: Expression;
body: Statement;
}
interface SwitchStatement extends Statement {
discriminant: Expression;
cases: Array<SwitchCase>;
lexical: boolean;
}
interface ReturnStatement extends Statement {
argument?: Expression;
}
interface ThrowStatement extends Statement {
argument: Expression;
}
interface TryStatement extends Statement {
block: BlockStatement;
handler?: CatchClause;
finalizer?: BlockStatement;
}
interface WhileStatement extends Statement {
test: Expression;
body: Statement;
}
interface DoWhileStatement extends Statement {
body: Statement;
test: Expression;
}
interface ForStatement extends Statement {
init?: VariableDeclaration | Expression;
test?: Expression;
update?: Expression;
body: Statement;
}
interface ForInStatement extends Statement {
left: VariableDeclaration | Expression;
right: Expression;
body: Statement;
}
interface DebuggerStatement extends Statement {}
interface Declaration extends Statement {}
interface FunctionDeclaration extends Function, Declaration {
id: Identifier;
}
interface VariableDeclaration extends Declaration {
declarations: Array<VariableDeclarator>;
kind: string;
}
interface VariableDeclarator extends Node {
id: Pattern;
init?: Expression;
}
interface Expression extends Node {}
interface ThisExpression extends Expression {}
interface ArrayExpression extends Expression {
elements: Array<Expression | SpreadElement>;
}
interface ObjectExpression extends Expression {
properties: Array<Property>;
}
interface Property extends Node {
key: Expression;
value: Expression;
kind: string;
method: boolean;
shorthand: boolean;
computed: boolean;
}
interface FunctionExpression extends Function, Expression {}
interface SequenceExpression extends Expression {
expressions: Array<Expression>;
}
interface UnaryExpression extends Expression {
operator: UnaryOperator;
prefix: boolean;
argument: Expression;
}
interface BinaryExpression extends Expression {
operator: BinaryOperator;
left: Expression;
right: Expression;
}
interface AssignmentExpression extends Expression {
operator: AssignmentOperator;
left: Pattern | MemberExpression;
right: Expression;
}
interface UpdateExpression extends Expression {
operator: UpdateOperator;
argument: Expression;
prefix: boolean;
}
interface LogicalExpression extends Expression {
operator: LogicalOperator;
left: Expression;
right: Expression;
}
interface ConditionalExpression extends Expression {
test: Expression;
alternate: Expression;
consequent: Expression;
}
interface CallExpression extends Expression {
callee: Expression | Super;
arguments: Array<Expression | SpreadElement>;
}
interface NewExpression extends CallExpression {}
interface MemberExpression extends Expression, Pattern {
object: Expression | Super;
property: Expression;
computed: boolean;
}
interface Pattern extends Node {}
interface SwitchCase extends Node {
test?: Expression;
consequent: Array<Statement>;
}
interface CatchClause extends Node {
param: Pattern;
guard: any;
body: BlockStatement;
}
interface Identifier extends Node, Expression, Pattern {
name: string;
}
interface Literal extends Node, Expression {
value?: string | boolean | number | RegExp;
}
interface RegexLiteral extends Literal {
regex: {
pattern: string;
flags: string;
};
}
type UnaryOperator = string;
type BinaryOperator = string;
type LogicalOperator = string;
type AssignmentOperator = string;
type UpdateOperator = string;
interface ForOfStatement extends ForInStatement {}
interface Super extends Node {}
interface SpreadElement extends Node {
argument: Expression;
}
interface ArrowFunctionExpression extends Function, Expression {
expression: boolean;
}
interface YieldExpression extends Expression {
argument?: Expression;
}
interface TemplateLiteral extends Expression {
quasis: Array<TemplateElement>;
expressions: Array<Expression>;
}
interface TaggedTemplateExpression extends Expression {
tag: Expression;
quasi: TemplateLiteral;
}
interface TemplateElement extends Node {
tail: boolean;
value: {
cooked: string;
value: string;
};
}
interface AssignmentProperty extends Property {
value: Pattern;
kind: string;
method: boolean;
}
interface ObjectPattern extends Pattern {
properties: Array<AssignmentProperty>;
}
interface ArrayPattern extends Pattern {
elements: Array<Pattern>;
}
interface RestElement extends Pattern {
argument: Pattern;
}
interface AssignmentPattern extends Pattern {
left: Pattern;
right: Expression;
}
interface Class extends Node {
id?: Identifier;
superClass: Expression;
body: ClassBody;
}
interface ClassBody extends Node {
body: Array<MethodDefinition>;
}
interface MethodDefinition extends Node {
key: Identifier;
value: FunctionExpression;
kind: string;
computed: boolean;
static: boolean;
}
interface ClassDeclaration extends Class, Declaration {
id: Identifier;
}
interface ClassExpression extends Class, Expression {}
interface MetaProperty extends Expression {
meta: Identifier;
property: Identifier;
}
interface ImportDeclaration extends Node {
specifiers: Array<ImportSpecifier | ImportDefaultSpecifier | ImportNamespaceSpecifier>;
source: Literal;
}
interface ImportSpecifier {
imported: Identifier;
local: Identifier;
}
interface ImportDefaultSpecifier {
local: Identifier;
}
interface ImportNamespaceSpecifier {
local: Identifier;
}
interface ExportNamedDeclaration extends Node {
declaration?: Declaration;
specifiers: Array<ExportSpecifier>;
source?: Literal;
}
interface ExportSpecifier {
exported: Identifier;
local: Identifier;
}
interface ExportDefaultDeclaration extends Node {
declaration: Declaration | Expression;
}
interface ExportAllDeclaration extends Node {
source: Literal;
}
}
+21
View File
@@ -0,0 +1,21 @@
/// <reference path="express-debug.d.ts" />
import express = require('express');
import debug = require('express-debug');
var app = express();
debug(app, {
depth: 4,
theme: 'public/css/debug.css',
extra_panels: [{
name: 'mypanel',
template: '/absolute/path/to/mypanel.jade',
process: function(locals) {
return { locals: { mypanel: true, }};
}
}],
panels: ['locals', 'request', 'session'],
path: '/express-debug',
extra_attrs: '',
sort: false,
});
+83
View File
@@ -0,0 +1,83 @@
// Type definitions for express-debug 1.1.1
// Project: https://github.com/devoidfury/express-debug
// Definitions by: Federico Bond <https://github.com/federicobond/>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
/* =================== USAGE ===================
import debug = require('express-debug');
debug(app, options);
=============================================== */
/// <reference path="../express/express.d.ts" />
declare module "express-debug" {
import express = require('express');
interface CustomPanel {
name: string;
template: string;
process(locals: any): any;
standalone?: boolean;
initialize?(req: express.Request): void;
finalize?(req: express.Request): void;
pre_render?(req: express.Request): void;
post_render?(req: express.Request): void;
options?: any;
}
/**
* Node.js middleware for serving a favicon.
*/
function debug(app: express.Application, settings?: {
/**
* How deep to recurse through printed objects. This is the default unless the
* print_obj function is passed an options object with a 'depth' property.
*/
depth?: number;
/**
* Absolute path to a css file to include and override EDT's default css.
*/
theme?: string;
/**
* Additional panels to show.
*/
extra_panels?: CustomPanel[];
/**
* Allows changing the default panel.
*/
panels?: string[];
/**
* Path to render standalone express-debug.
*/
path?: string;
/**
* If you need to add arbitrary attributes to the containing element of EDT,
* this allows you to.
*/
extra_attrs?: string;
/**
* Global option to determine sort order of printed object values. false for
* default order, true for basic default sort, or a function to use for sort.
*/
sort?: boolean | ((a: number, b: number) => number);
}): void;
export = debug;
}
+49
View File
@@ -1345,6 +1345,55 @@ declare module google.maps {
}
export module places {
export class AutocompleteService extends MVCObject {
constructor();
getPlacePredictions(request: AutocompletionRequest, callback: (result: AutocompletePrediction[], status: PlacesServiceStatus) => void): void;
getQueryPredictions(request: QueryAutocompletionRequest, callback: (result: QueryAutocompletePrediction[], status: PlacesServiceStatus) => void): void;
}
export interface AutocompletionRequest {
input: string;
bounds?: LatLngBounds;
componentRestrictions?: ComponentRestrictions;
location?: LatLng;
offset?: number;
radius?: number;
types?: string[];
}
export interface QueryAutocompletionRequest {
input: string;
bounds?: LatLngBounds;
location?: LatLng;
offset?: number;
radius?: number;
}
export interface AutocompletePrediction {
description: string;
matched_substrings: PredictionSubstring[];
place_id: string;
terms: PredictionTerm[];
types: string[]
}
export interface PredictionTerm {
offset: number;
value: string;
}
export interface PredictionSubstring {
length: number;
offset: number;
}
export interface QueryAutocompletePrediction {
description: string;
matched_substrings: PredictionSubstring[];
place_id: string;
terms: PredictionTerm[];
}
export class Autocomplete extends MVCObject {
constructor (inputField: HTMLInputElement, opts?: AutocompleteOptions);
+13
View File
@@ -82,5 +82,18 @@ server.route([{
}
}]);
// config.validate parameters should be optional
server.route([{
method: 'GET',
path: '/hello2',
handler: function(request: Hapi.Request, reply: Function) {
reply('hello world2');
},
config: {
validate: {
}
}
}]);
// Start the server
server.start();
+7 -7
View File
@@ -568,7 +568,7 @@ declare module "hapi" {
optionsthe server validation options.
next(err, value)the callback function called when validation is completed.
*/
headers: boolean | IJoi | IValidationFunction;
headers?: boolean | IJoi | IValidationFunction;
/** validation rules for incoming request path parameters, after matching the path against the route and extracting any parameters then stored in request.params.Values allowed:
@@ -579,7 +579,7 @@ declare module "hapi" {
valuethe object containing the path parameters.
optionsthe server validation options.
next(err, value)the callback function called when validation is completed. */
params: boolean | IJoi | IValidationFunction;
params?: boolean | IJoi | IValidationFunction;
/** validation rules for an incoming request URI query component (the key- value part of the URI between '?' and '#').The query is parsed into its individual key- value pairs (using the qs module) and stored in request.query prior to validation.Values allowed:
trueany query parameters allowed (no validation performed).This is the default.
falseno query parameters allowed.
@@ -588,7 +588,7 @@ declare module "hapi" {
valuethe object containing the query parameters.
optionsthe server validation options.
next(err, value)the callback function called when validation is completed. */
query: boolean | IJoi | IValidationFunction;
query?: boolean | IJoi | IValidationFunction;
/** validation rules for an incoming request payload (request body).Values allowed:
trueany payload allowed (no validation performed).This is the default.
falseno payload allowed.
@@ -597,9 +597,9 @@ declare module "hapi" {
valuethe object containing the payload object.
optionsthe server validation options.
next(err, value)the callback function called when validation is completed. */
payload: boolean | IJoi | IValidationFunction;
payload?: boolean | IJoi | IValidationFunction;
/** an optional object with error fields copied into every validation error response. */
errorFields: any;
errorFields?: any;
/** determines how to handle invalid requests.Allowed values are:
'error'return a Bad Request (400) error response.This is the default value.
'log'log the error but continue processing the request.
@@ -609,9 +609,9 @@ declare module "hapi" {
replythe continuation reply interface.
sourcethe source of the invalid field (e.g. 'path', 'query', 'payload').
errorthe error object prepared for the client response (including the validation function error under error.data). */
failAction: string | IRouteFailFunction;
failAction?: string | IRouteFailFunction;
/** options to pass to Joi.Useful to set global options such as stripUnknown or abortEarly (the complete list is available here: https://github.com/hapijs/joi#validatevalue-schema-options-callback ).Defaults to no options. */
options: any;
options?: any;
};
/** define timeouts for processing durations: */
timeout?: {
@@ -0,0 +1,23 @@
/// <reference path="../jquery/jquery.d.ts"/>
/// <reference path="jquery-jsonrpcclient.d.ts"/>
var foo = new $.JsonRpcClient({ ajaxUrl: '/backend/jsonrpc' });
foo.call(
'bar', ['A parameter', 'B parameter'],
function (result) { alert('Foo bar answered: ' + result.my_answer); },
function (error) { console.log('There was an error', error); }
);
var foo = new $.JsonRpcClient({ ajaxUrl: '/backend/jsonrpc' });
foo.batch(
function (batch) {
batch.call('bar', ['A parameter', 'B parameter'], function () { }, function () { });
batch.call('baz', { parameters: 'could be object' }, function () { }, function () { });
},
function (all_result_array) { alert('All done.'); },
function (error_data) { alert('Error in batch response.'); }
);
var foo = new $.JsonRpcClient({ ajaxUrl: '/backend/jsonrpc', socketUrl: 'ws://example.com/' });
foo.call('bar', ['param'], function () { }, function () { });
+97
View File
@@ -0,0 +1,97 @@
// Type definitions for jquery.jsonrpc 0.7.0
// Project: https://github.com/Textalk/jquery.jsonrpcclient.js
// Definitions by: Maksim Karelov <https://github.com/Ty3uK>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
/// <reference path="../jquery/jquery.d.ts" />
interface JsonRpcClientOptions extends JQueryAjaxSettings {
ajaxUrl?: string;
headers?: {[key:string]: any};
sockerUrl?: string;
onmessage?: () => void;
onopen?: () => void;
onclose?: () => void;
onerror?: () => void;
getSockect?: (onmessageCb: () => void) => WebSocket;
}
interface JsonRpcClient {
/**
* @fn call
* @memberof JsonRpcClient
*
* @param {string} method The method to run on JSON-RPC server.
* @param {object|array} params The params; an array or object.
* @param {function} successCb A callback for successful request.
* @param {function} errorCb A callback for error.
*
* @return {object} Returns the deferred object that $.ajax returns or {null} for websockets
*/
call(method: string, params: Object | Array<any>, successCb: (result: any) => void, errorCb: (result: any) => void): JQueryDeferred<JQueryXHR>;
/**
* Notify sends a command to the server that won't need a response. In http, there is probably
* an empty response - that will be dropped, but in ws there should be no response at all.
*
* This is very similar to call, but has no id and no handling of callbacks.
*
* @fn notify
* @memberof JsonRpcClient
*
* @param {string} method The method to run on JSON-RPC server.
* @param {object|array} params The params; an array or object.
*
* @return {object} Returns the deferred object that $.ajax returns or {null} for websockets
*/
notify(method: string, params: Object | Array<any>): JQueryDeferred<JQueryXHR>;
/**
* Make a batch-call by using a callback.
*
* The callback will get an object "batch" as only argument. On batch, you can call the methods
* "call" and "notify" just as if it was a normal JsonRpcClient object, and all calls will be
* sent as a batch call then the callback is done.
*
* @fn batch
* @memberof JsonRpcClient
*
* @param {function} callback This function will get a batch handler to run call and notify on.
* @param {function} allDoneCb A callback function to call after all results have been handled.
* @param {function} errorCb A callback function to call if there is an error from the server.
* Note, that batch calls should always get an overall success, and the
* only error
*/
batch(callback: (batch: JsonRpcClient) => void, allDoneCb: (result: any) => void, errorCb: (error: any) => void): void;
}
interface JsonRpcClientFactory {
/**
* @fn new
* @memberof JsonRpcClient
*
* @param {object} options An object stating the backends:
* ajaxUrl A url (relative or absolute) to a http(s) backend.
* headers An object that will be passed along to $.ajax in options.headers
* xhrFields An object that will be passed along to $.ajax in options.xhrFields
* socketUrl A url (relative of absolute) to a ws(s) backend.
* onmessage A socket message handler for other messages (non-responses).
* onopen A socket onopen handler. (Not used for custom getSocket.)
* onclose A socket onclose handler. (Not used for custom getSocket.)
* onerror A socket onerror handler. (Not used for custom getSocket.)
* getSocket A function returning a WebSocket or null.
* It must take an onmessage_cb and bind it to the onmessage event
* (or chain it before/after some other onmessage handler).
* Or, it could return null if no socket is available.
* The returned instance must have readyState <= 1, and if less than 1,
* react to onopen binding.
* timeout (optional) A number of ms to wait before timing out and failing a
* call. If specified a setTimeout will be used to keep track of calls
* made through a websocket.
*/
new (options?: JsonRpcClientOptions): JsonRpcClient;
}
interface JQueryStatic {
JsonRpcClient: JsonRpcClientFactory;
}
+27 -98
View File
@@ -39,6 +39,7 @@ interface pickadateOptions extends pickerOptions {
formatSubmit?: string; // e.g. 'yyyy/mm/dd'
hiddenPrefix?: string; // default undefined
hiddenSuffix?: string; // default '_submit'
hiddenName?: boolean; // default undefined
// Dropdown selectors
selectYears?: any; // Specify the number of years selectable using an even integer - half before and half after the year in focus:
@@ -223,23 +224,21 @@ interface TimePickerSetThings extends SetThings {
interval?: any;
}
interface PickerObject {
interface PickerObject<TPickerObject, TItemObject extends PickerItemObject, TOptions extends SetThings> {
/** The picker's relative input element wrapped as a jQuery object. */
$node: JQuery;
/** The picker's relative root holder element wrapped as a jQuery object. */
$root: JQuery;
}
interface DatePickerObject extends PickerObject {
open(withoutFocus?: boolean): DatePickerObject;
close(withFocus?: boolean): DatePickerObject;
open(withoutFocus?: boolean): TPickerObject;
close(withFocus?: boolean): TPickerObject;
/** Rebuild the picker. */
start(): DatePickerObject;
start(): TPickerObject;
/** Destroy the picker. */
stop(): DatePickerObject;
stop(): TPickerObject;
/**
* Refresh the picker box after adding something to the holder.
@@ -247,10 +246,10 @@ interface DatePickerObject extends PickerObject {
* has its contents re-rendered. To render the entire picker from
* the root up, pass true as the first argument.
*/
render(entirePicker?: boolean): DatePickerObject;
render(entirePicker?: boolean): TPickerObject;
/** Clear the value in the picker's input element. */
clear(): DatePickerObject;
clear(): TPickerObject;
/** Short for picker.get('value') */
get(): string;
@@ -262,19 +261,19 @@ interface DatePickerObject extends PickerObject {
get(thing: 'value'): string;
/** Returns the item object that is visually selected. */
get(thing: 'select'): DatePickerItemObject;
get(thing: 'select'): TItemObject;
/** Returns the item object that is visually highlighted. */
get(thing: 'highlight'): DatePickerItemObject;
get(thing: 'highlight'): TItemObject;
/** Returns the item object that sets the current view. */
get(thing: 'view'): DatePickerItemObject;
get(thing: 'view'): TItemObject;
/** Returns the item object that limits the picker's lower range. */
get(thing: 'min'): DatePickerItemObject;
get(thing: 'min'): TItemObject;
/** Returns the item object that limits the picker's upper range. */
get(thing: 'max'): DatePickerItemObject;
get(thing: 'max'): TItemObject;
/** Returns a boolean value of whether the picker is open or not. */
get(thing: 'open'): boolean;
@@ -292,99 +291,29 @@ interface DatePickerObject extends PickerObject {
get(thing: string, format: string): string;
/** Set the properties, objects, and states to change the state of the picker. */
set(thing: string, value?: any): DatePickerObject;
set(things: SetThings): DatePickerObject;
set(thing: string, value?: any, options?: any): TPickerObject;
set(things: TOptions, options?: any): TPickerObject;
/** Bind callbacks to get fired off when the relative picker method is called. */
on(methodName, callback: () => void ): DatePickerObject;
on(methodName, callback: () => void): TPickerObject;
/** Bind multiple callbacks at once to get fired off when the relative picker method is called. */
on(callbackObject: CallbackObject): DatePickerObject;
on(callbackObject: CallbackObject): TPickerObject;
/** Trigger callbacks that have been queued up using the the on method. */
trigger(event: string): DatePickerObject;
trigger(event: string): TPickerObject;
}
interface TimePickerObject extends PickerObject {
open(withoutFocus?: boolean): TimePickerObject;
close(withFocus?: boolean): TimePickerObject;
/** Rebuild the picker. */
start(): TimePickerObject;
/** Destroy the picker. */
stop(): TimePickerObject;
/**
* Refresh the picker box after adding something to the holder.
* By default, only the "face" of the picker (i.e. the box element)
* has its contents re-rendered. To render the entire picker from
* the root up, pass true as the first argument.
*/
render(entirePicker?: boolean): TimePickerObject;
/** Clear the value in the picker's input element. */
clear(): TimePickerObject;
/** Short for picker.get('value') */
get(): string;
/** Get the properties, objects, and states that make up the current state of the picker. */
get(thing: string): any;
/** Returns the string value of the picker's input element. */
get(thing: 'value'): string;
/** Returns the item object that is visually selected. */
get(thing: 'select'): TimePickerItemObject;
/** Returns the item object that is visually highlighted. */
get(thing: 'highlight'): TimePickerItemObject;
/** Returns the item object that sets the current view. */
get(thing: 'view'): TimePickerItemObject;
/** Returns the item object that limits the picker's lower range. */
get(thing: 'min'): TimePickerItemObject;
/** Returns the item object that limits the picker's upper range. */
get(thing: 'max'): TimePickerItemObject;
/** Returns a boolean value of whether the picker is open or not. */
get(thing: 'open'): boolean;
/** Returns a boolean value of whether the picker has started or not. */
get(thing: 'start'): boolean;
/** Returns a unique 9-digit integer that is the ID of the picker. */
get(thing: 'id'): number;
/** Returns an array of items that determine which item objects to disable on the picker. */
get(thing: 'disable'): any[];
/** Returns a formatted string for the item object specified by `thing` */
get(thing: string, format: string): string;
/** Set the properties, objects, and states to change the state of the picker. */
set(thing: string, value?: any): TimePickerObject;
set(things: TimePickerSetThings): TimePickerObject;
/** Bind callbacks to get fired off when the relative picker method is called. */
on(methodName, callback: () => void ): TimePickerObject;
/** Bind multiple callbacks at once to get fired off when the relative picker method is called. */
on(callbackObject: CallbackObject): TimePickerObject;
/** Trigger callbacks that have been queued up using the the on method. */
trigger(event: string): TimePickerObject;
}
interface DatePickerObject extends PickerObject<DatePickerObject, DatePickerItemObject, SetThings> { }
interface TimePickerObject extends PickerObject<TimePickerObject, TimePickerItemObject, TimePickerSetThings> { }
interface JQuery {
pickadate(options?: pickadateOptions): HTMLInputElement;
pickatime(options?: pickatimeOptions): HTMLInputElement;
pickadate(methodName: "picker"): DatePickerObject;
pickadate(methodName: string): any;
pickadate(options?: pickadateOptions): JQuery;
pickatime(methodName: "picker"): TimePickerObject;
pickatime(methodName: string): any;
pickatime(options?: pickatimeOptions): JQuery;
}
interface HTMLInputElement {
pickadate(picker: string): DatePickerObject;
pickatime(picker: string): TimePickerObject;
}
+55
View File
@@ -0,0 +1,55 @@
/// <reference path="jsonpath.d.ts" />
import jp = require('jsonpath');
var data: any;
/**
* jp.query(obj, pathExpression)
* Find elements in obj matching pathExpression. Returns an array of elements that satisfy the provided JSONPath expression, or an empty array if none were matched.
*/
var authors = jp.query(data, '$..author');
/**
* jp.paths(obj, pathExpression)
* Find elements in obj matching pathExpression. Returns an array of element paths that satisfy the provided JSONPath expression. Each path is itself an array of keys representing the location within obj of the matching element.
*/
var paths = jp.paths(data, '$..author');
/**
* jp.nodes(obj, pathExpression)
* Find elements and their corresponding paths in obj matching pathExpression. Returns an array of node objects where each node has a path containing an array of keys representing the location within obj, and a value pointing to the matched element.
*/
var nodes = jp.nodes(data, '$..author');
/**
* jp.value(obj, pathExpression, [newValue])
* Returns the value of the first element matching pathExpression. If newValue is provided, sets the value of the first matching element and returns the new value.
*/
var value = jp.value(data, '$.store..price');
jp.value(data, '$.store..price', 12.5);
/**
* jp.parent(obj, pathExpression)
* Returns the parent of the first matching element.
*/
var parent = jp.parent(data, '$.store..price');
/**
* jp.apply(obj, pathExpression, fn)
* Runs the supplied function fn on each matching element, and replaces each matching element with the return value from the function. The function accepts the value of the matching element as its only parameter. Returns matching nodes with their updated values.
*/
var nodes = jp.apply(data, '$..author', (value: string) => { return value.toUpperCase() });
/**
* jp.parse(pathExpression)
* Parse the provided JSONPath expression into path components and their associated operations.
*/
var path = jp.parse('$..author');
/**
* jp.stringify(path)
* Returns a path expression in string form, given a path. The supplied path may either be a flat array of keys, as returned by jp.nodes for example, or may alternatively be a fully parsed path expression in the form of an array of path components as returned by jp.parse.
*/
var pathExpression = jp.stringify(['$', 'store', 'book', 0, 'author']);
+21
View File
@@ -0,0 +1,21 @@
// Type definitions for jsonpath 0.1.3
// Project: https://www.npmjs.org/package/jsonpath
// Definitions by: Hiroki Horiuchi <https://github.com/horiuchi>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
declare module "jsonpath" {
type PathComponent = string|number;
export function query(obj: any, pathExpression: string): any[];
export function paths(obj: any, pathExpression: string): PathComponent[][];
export function nodes(obj: any, pathExpression: string): { path: PathComponent[]; value: any; }[];
export function value(obj: any, pathExpression: string): any;
export function value(obj: any, pathExpression: string, newValue: any): any;
export function parent(obj: any, pathExpression: string): any;
export function apply(obj: any, pathExpression: string, fn: (x: any) => any): { path: PathComponent[]; value: any; }[];
export function parse(pathExpression: string): any[];
export function stringify(path: PathComponent[]): string;
}
+28
View File
@@ -0,0 +1,28 @@
/// <reference path="less-middleware.d.ts" />
import express = require('express');
import lessMiddleware = require('less-middleware');
var app = express();
app.use(lessMiddleware('public', {
cacheFile: null,
debug: false,
dest: 'dest',
force: false,
once: false,
pathRoot: 'root',
postprocess: {
css: function(css, req) { return css; },
},
preprocess: {
less: function(src, req) { return src; },
path: function(pathname, req) { return pathname; },
importPaths: function(paths, req) { return paths; }
},
render: {
compress: 'auto',
yuicompress: false,
paths: ['foo', 'bar']
},
storeCss: function(css, req, next) {},
}));
+108
View File
@@ -0,0 +1,108 @@
// Type definitions for less-middleware 2.0.1
// Project: https://github.com/emberfeather/less.js-middleware
// Definitions by: Federico Bond <https://github.com/federicobond/>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
/* =================== USAGE ===================
import lessMiddleware = require('less-middleware');
app.use(lessMiddleware(source, options));
=============================================== */
/// <reference path="../express/express.d.ts" />
declare module "less-middleware" {
import express = require('express');
/**
* Middleware created to allow processing of Less files for Connect JS framework
* and by extension the Express JS framework
*/
function lessMiddleware(source: string, options?: {
/**
* Show more verbose logging?
*/
debug?: boolean;
/**
* Destination directory to output the compiled .css files.
*/
dest?: string;
/**
* Always re-compile less files on each request.
*/
force?: boolean;
/**
* Only recompile once after each server restart.
* Useful for reducing disk i/o on production.
*/
once?: boolean;
/**
* Common root of the source and destination.
* It is prepended to both the source and destination before being used.
*/
pathRoot?: string;
/**
* Object containing functions relevant to preprocessing data.
*/
postprocess?: {
/**
* Function that modifies the compiled css output before being stored.
*/
css?(css: string, req: express.Request): string;
};
/**
* Object containing functions relevant to preprocessing data.
*/
preprocess?: {
/**
* Function that modifies the raw less output before being parsed and compiled.
*/
less?(css: string, req: express.Request): string;
/**
* Function that modifies the less pathname before being loaded from the filesystem.
*/
path?(pathname: string, req: express.Request): string;
/**
* Function that modifies the import paths used by the less parser per request.
*/
importPaths?(paths: string[], req: express.Request): string[];
};
/**
* Options for the less render.
*/
render?: {
compress?: string;
yuicompress?: boolean;
paths?: string[];
};
/**
* Function that is in charge of storing the css in the filesystem.
*/
storeCss?(pathname: string, css: string, req: express.Request, next: Function): void;
/**
* Path to a JSON file that will be used to cache less data across server restarts.
* This can greatly speed up initial load time after a server restart - if the less
* files haven't changed and the css files still exist, specifying this option will
* mean that the less files don't need to be recompiled after a server restart.
*/
cacheFile?: string;
}): express.RequestHandler;
export = lessMiddleware;
}
+6 -27
View File
@@ -2,33 +2,12 @@
import less = require("less");
declare var __dirname: string;
less.render('.class { width: (1 + 1) }', (e, css) => console.log(css));
var parser: less.Parser = new less.Parser;
parser.parse('.class { width: (1 + 1) }', function (err, tree) {
if (err) return console.error(err);
tree.toCSS();
less.render(".class { width: (1 + 1) }").then((output) => {
console.log(output.css);
});
var parser2 = new less.Parser({
paths: ['.', './lib'],
filename: 'style.less'
less.render("fail").then((output) => {
throw new Error("promise should have been rejected");
}, () => {
console.log("rejected as expected");
});
parser2.parse('.class { width: (1 + 1) }', (e, tree) => tree.toCSS({ compress: true }));
var lessParser = new less.Parser({
paths: [__dirname],
filename: "out.less"
});
lessParser.parse('.class { width: (1 + 1) }', function (err, tree) {
tree.rules.forEach(function (rule) {
if (rule.path) {
console.log(rule.path);
}
});
});
+55 -536
View File
@@ -1,556 +1,75 @@
// Type definitions for LESS
// Project: http://lesscss.org/
// Definitions by: AndrewGaspar <https://github.com/AndrewGaspar>
// Definitions by: Tom Hasner <https://github.com/thasner>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
declare module less {
class LessError {
constructor(e: Error, env);
declare module Less {
// Promise definitions from ../es6-promise/es6-promise.d.ts
interface Thenable<R> {
then<U>(onFulfilled?: (value: R) => U | Thenable<U>, onRejected?: (error: any) => U | Thenable<U>): Thenable<U>;
}
type: any;
message: string;
class Promise<R> implements Thenable<R> {
constructor(callback: (resolve : (value?: R | Thenable<R>) => void, reject: (error?: any) => void) => void);
then<U>(onFulfilled?: (value: R) => U | Thenable<U>, onRejected?: (error: any) => U | Thenable<U>): Promise<U>;
catch<U>(onRejected?: (error: any) => U | Thenable<U>): Promise<U>;
finally<U>(finallyCallback: () => any): Promise<U>;
}
interface RootFileInfo {
filename: string;
index;
line: number;
callLine: number;
callExtract;
stack;
column;
extract: any[];
relativeUrls: boolean;
rootpath: string;
currentDirectory: string;
entryPath: string;
rootFilename: string;
}
class PluginManager {
constructor(less: LessStatic);
}
interface Plugin {
install: (less: LessStatic, pluginManager: PluginManager) => void;
}
interface SourceMapOption {
sourceMapURL: string;
sourceMapBasepath: string;
sourceMapRootpath: string;
outputSourceFiles: boolean;
sourceMapFileInline: boolean;
}
interface Options {
contents?;
rootpath?: string;
files?;
paths?: string[];
mime?: string;
sourceMap?: SourceMapOption;
filename?: string;
optimization?: number;
dumpLineNumbers?: boolean;
strictImports?;
entryPath?: string;
relativeUrls?;
errback? (path: string, paths: string[], callback: Function, env: Options);
frames?;
compress?: boolean;
plugins: Plugin[];
rootFileInfo?: RootFileInfo;
}
export module tree {
export module mixin { // TODO
export class Call {
}
export class Definition extends Ruleset {
}
}
export module functions {
export function rgb(r: number, g: number, b: number): Color;
export function rgba(r: number, g: number, b: number, a: number): Color;
export function hsl(h: number, s?: number, l?: number): Color;
export function hsla(h: number, s?: number, l?: number, a?: number): Color;
export function hsv(h: number, s: number, v: number): Color;
export function hsva(h: number, s: number, v: number, a: number): Color;
export function hue(color: Color): Dimension;
export function saturation(color: Color): Dimension;
export function lightness(color: Color): Dimension;
export function red(color: Color): Dimension;
export function green(color: Color): Dimension;
export function blue(color: Color): Dimension;
export function alpha(color: Color): Dimension;
export function luma(color: Color): Dimension;
export function saturate(color: Color, amount: IValuableNumber): Color;
export function desaturate(color: Color, amount: IValuableNumber): Color;
export function lighten(color: Color, amount: IValuableNumber): Color;
export function darken(color: Color, amount: IValuableNumber): Color;
export function fadein(color: Color, amount: IValuableNumber): Color;
export function fadeout(color: Color, amount: IValuableNumber): Color;
export function fade(color: Color, amount: IValuableNumber): Color;
export function spin(color: Color, amount: IValuableNumber): Color;
export function mix(color1: Color, color2: Color, weight: Dimension): Color;
export function greyscale(color: Color): Color;
export function contrast(color: Color, dark?: Color, light?: Color, threshold?: IValuableNumber): Color;
export function contrast(color: Color, dark?: Color, light?: Color, threshold?: number): Color;
export function e(str: string): Anonymous;
export function e(str: JavaScript): Anonymous;
export function escape(str: IValuableString): Anonymous;
export function unit(val: IValuableNumber, unit?: ICSSable): Dimension;
export function round(n: Dimension, f?: IValuableNumber): Dimension;
export function round(n: number, f?: IValuableNumber): number;
export function ceil(n: number): number;
export function ceil(n: Dimension): Dimension;
export function floor(n: number): number;
export function floor(n: Dimension): Dimension;
export function argb(color: Color): Anonymous;
export function percentage(n: IValuableNumber): Dimension;
export function color(n: Quoted): Color;
export function iscolor(n): Keyword;
export function isnumber(n): Keyword;
export function isstring(n): Keyword;
export function iskeyword(n): Keyword;
export function isurl(n): Keyword;
export function ispixel(n): Keyword;
export function ispercentage(n): Keyword;
export function isem(n): Keyword;
export function multiply(color1: Color, color2: Color): Color;
export function screen(color1: Color, color2: Color): Color;
export function overlay(color1: Color, color2: Color): Color;
export function softlight(color1: Color, color2: Color): Color;
export function hardlight(color1: Color, color2: Color): Color;
export function difference(color1: Color, color2: Color): Color;
export function exclusion(color1: Color, color2: Color): Color;
export function average(color1: Color, color2: Color): Color;
export function negation(color1: Color, color2: Color): Color;
export function tint(color: Color, amount: Dimension): Color;
export function shade(color: Color, amount: Dimension): Color;
}
export var colors: any; // Could be module - got lazy
interface HasDebugInfo {
debugInfo: DebugInfo;
}
interface DebugInfo {
lineNumber;
fileName: string;
}
interface HSL {
h: number;
s: number;
l: number;
a: number;
}
interface DebugInfoFunction {
(env: Options, ctx: HasDebugInfo): string;
asComment(ctx: HasDebugInfo): string;
asMediaQuery(ctx: HasDebugInfo): string;
}
interface RuleContainer {
[name: string]: Rule;
}
interface ICSSable {
toCSS(ctx?, env?: Options): string;
}
interface IEvalable {
eval(env: Options): IEvalable;
}
interface IInjectable extends ICSSable, IEvalable {}
interface IOperable {
operate(op: Operation, other: IOperable): IOperable;
}
interface IComparable {
compare(x: IComparable): number;
}
interface IColorable {
toColor(): Color;
}
interface IValuableNumber {
value: number;
}
interface IValuableString {
value: string;
}
export class Color implements IOperable, IInjectable, IComparable {
constructor(rgb: string, a: number);
constructor(rgb: number[], a: number);
rgb: number[];
alpha: number;
eval(): Color;
toCSS(): string;
operate(op: Operation, other: Color): Color;
operate(op: Operation, other: IColorable): Color;
toHSL(): HSL;
toARGB(): string;
compare(x: Color): number;
}
export class Directive implements IInjectable {
constructor(name, value);
name;
value: ICSSable;
ruleset: Ruleset;
toCSS(ctx?, env?: Options): string;
eval(env: Options): Directive;
variable(name);
find();
rulesets();
}
export class Operation implements IEvalable {
constructor(op, operands);
op: string;
operands: IEvalable;
eval(env: Options): IEvalable;
operate(op: string, a: number, b: number): number;
}
export class Dimension implements IColorable, IInjectable, IOperable, IComparable {
constructor(value: number, unit: string);
value: number;
unit: string;
eval(): Dimension;
toColor(): Color;
toCSS(): string;
operate(op: Operation, other: Dimension): Dimension;
compare(other: IComparable): number;
}
export class Keyword implements IInjectable, IComparable {
constructor(value: string);
value: string;
eval(): Keyword;
toCSS(): string;
compare(other: IComparable): number;
static True: Keyword;
static False: Keyword;
}
export class Variable implements IEvalable {
constructor(name: string, index, file: string);
name: string;
index;
file: string;
eval(env: Options): IEvalable;
}
export class AbstractRuleset implements IEvalable {
selectors: Selector[];
rules: any[];
strictImports;
eval(env: Options): Ruleset;
evalImports(env: Options): void;
makeImportant(): Ruleset;
matchArgs(args: any): boolean;
resetCache(): void;
variables(): RuleContainer;
variable(): Rule;
rulesets(): Ruleset[];
find(selector: Selector, self: Rule): Rule[];
joinSelectors(paths: string[], context: any[][], selectors: Selector[]): void;
joinSelector(paths: string[], context: any[][], selector: Selector): void;
mergeElementsOnToSelectors(elements: Element[], selectors: Selector[]): void;
}
export class Ruleset extends AbstractRuleset {
constructor(selectors: Selector[], rules: Rule[], strictImports);
toCSS(context?: any[][], env?: Options): string;
}
export class Element implements IInjectable {
constructor(combinator: Combinator, value, index);
combinator: Combinator;
value;
index;
eval(env: Options): Element;
toCSS(env?: Options): string;
}
export class Combinator implements ICSSable {
constructor(value: string);
value: string;
toCSS(env?: Options): string;
}
export class Selector implements IInjectable {
constructor(elements: Element[]);
match(other: Selector): boolean;
eval(env: Options): Selector;
toCSS(env?: Options): string;
}
export class Quoted implements IInjectable, IComparable {
constructor(str: string, content: string, escaped: boolean, i);
escaped: boolean;
value: string;
quote: string;
index;
toCSS(): string;
eval(env: Options): Quoted;
compare(x: IComparable): number;
}
export class Expression implements IInjectable {
constructor(value: IEvalable[]);
value: IEvalable[];
eval(env: Options): IEvalable;
toCSS(env?: Options): string;
}
export class Rule implements IInjectable {
constructor(name: string, value?: Value, important?: string, index?, inline?: boolean);
name: string;
value: Value;
important: string;
index;
inline: boolean;
toCSS(env?: Options): string;
eval(context): Rule;
makeImportant(): Rule;
}
export class Shorthand implements IInjectable {
constructor(a: ICSSable, b: ICSSable);
a: ICSSable;
b: ICSSable;
toCSS(env?: Options): string;
eval(): Shorthand;
}
export class Call implements IInjectable {
constructor(name: string, args: IEvalable[], index, filename: string);
name: string;
args: IEvalable[];
index;
filename: string;
eval(env: Options): IEvalable;
toCSS(env?: Options): string;
}
export class URL implements IInjectable {
constructor(val, rootpath: string);
value;
rootpath: string;
toCSS(): string;
eval(ctx): URL;
}
export class Alpha implements IInjectable {
constructor(val);
value;
toCSS(): string;
eval(env: Options): Alpha;
}
export class Import implements IInjectable {
constructor(path, imports, features: ICSSable, once: boolean, index, rootpath);
once: boolean;
index;
features: ICSSable;
rootpath;
path: string;
css: boolean;
toCSS(env?: Options): string;
eval(env: Options): IEvalable;
}
export class Comment implements IInjectable {
constructor(value: string, silent);
value: string;
silent: boolean;
toCSS(env?: Options): string;
eval(): Comment;
}
export class Anonymous implements IInjectable, IComparable {
constructor(value: string);
value: string;
toCSS(): string;
eval(): Anonymous;
compare(x): number;
}
export class Value implements IInjectable {
constructor(value: IEvalable[]);
value: IEvalable[];
is: string;
eval(env: Options): IEvalable;
toCSS(env?: Options): string;
}
export class JavaScript implements IEvalable {
constructor(expression: string, index, escaped: boolean);
escaped: boolean;
expression: string;
index;
eval(env: Options): IEvalable;
}
export class Assignment implements IInjectable {
constructor(key: string, val);
constructor(key: string, val: ICSSable);
constructor(key: string, val: IEvalable);
key: string;
value;
toCSS(): string;
eval(env: Options): Assignment;
}
export class Condition {
constructor(op: string, l, r, i, negate: boolean);
op: string;
lvalue;
rvalue;
index;
negate: boolean;
eval(env: Options): boolean;
}
export class Paren implements IInjectable {
constructor(node: IInjectable);
value: IInjectable;
toCSS(env?: Options): string;
eval(env: Options): Paren;
}
export class Media implements IInjectable {
constructor(value, features);
selectors: Selector[];
features: Value;
ruleset: Ruleset;
toCSS(ctx?, env?: Options): string;
eval(env: Options): IEvalable;
variable(name): Rule;
rulesets(): Ruleset[];
find(selector: Selector, self: Rule): Rule[];
emptySelectors(): Selector[];
evalTop(env: Options): IEvalable;
evalNested(env: Options): Ruleset;
permute(arr: any[]): any[];
bubbleSelectors(selectors: Selector[]): void;
}
export class Ratio implements IInjectable {
constructor(value: string);
value: string;
toCSS(env?: Options): string;
eval(): Ratio;
}
export class UnicodeDescriptor implements IInjectable {
constructor(value: string);
value: string;
toCSS(env?: Options): string;
eval(): UnicodeDescriptor;
}
export class Attribute implements IInjectable {
constructor(value: string);
value: string;
toCSS(env?: Options): string;
genCSS(env: Options, output): string;
eval(): Attribute;
}
export var debugInfo: DebugInfoFunction;
export function find(obj: any[], fun: Function): any;
export function jsify(obj: any): string;
export function operate(op: string, a: number, b: number): number;
export var True: Keyword;
export var False: Keyword;
interface RenderOutput {
css: string;
map: string;
imports: string[];
}
}
class ParserNode extends tree.AbstractRuleset {
toCSS(): string;
toCSS(options: { compress: boolean; }, variables?): string;
}
interface LessStatic {
render(input: string, callback: (output: Less.RenderOutput) => void): void;
render(input: string, options: Less.Options, callback: (output: Less.RenderOutput) => void): void;
export class Parser {
constructor(env?: Options);
render(input: string): Less.Promise<Less.RenderOutput>;
render(input: string, options: Less.Options): Less.Promise<Less.RenderOutput>;
imports: {
paths: string[];
queue: string[];
files;
contents;
mime: string;
error;
push(path: string, callback: (e, root, imported) => void);
}; // TODO
parse: (str: string, callback: (error: LessError, root: ParserNode) => void ) => void;
parsers: { // Major TODO
};
}
export function render(input: string, callback: (e, css: string) => void): void;
export function render(input: string, options: Options,
callback: (e, css: string) => void): void;
export function formatError(ctx, options: { color: boolean; }): string;
export function writeError(ctx, options: { color: boolean; }): void;
export var version: number[];
version: number[];
}
declare module "less" {
export = less;
export = less;
}
declare var less: LessStatic;
+12
View File
@@ -5745,6 +5745,18 @@ declare module _ {
**/
isEmpty(value: any): boolean;
}
//_.isError
interface LoDashStatic {
/**
* Checks if value is an Error, EvalError, RangeError, ReferenceError, SyntaxError, TypeError,
* or URIError object.
* @param value The value to check.
* @return True if value is an error object, else false.
*/
isError(value: any): boolean;
}
//_.isEqual
interface LoDashStatic {
+2 -2
View File
@@ -38,7 +38,7 @@ declare module Backbone {
include(value: any): boolean;
initial(): View<TModel>;
initial(n: number): View<TModel>[];
invoke(methodName: string, arguments?: any[]): any;
invoke(methodName: string, args?: any[]): any;
isEmpty(object: any): boolean;
last(): View<TModel>;
last(n: number): View<TModel>[];
@@ -533,7 +533,7 @@ declare module Marionette {
* Calls the method named by methodName on each value in the collection. Any extra
* arguments passed to invoke will be forwarded on to the method invocation.
*/
invoke(methodName: string, arguments?: any[]): any;
invoke(methodName: string, args?: any[]): any;
/**
* Returns true if the RegionManager contains no regions.
@@ -1,127 +0,0 @@
/// <reference path="./mozilla-spidermonkey-parser-api.d.ts" />
import Syntax = spiderMonkeyParserAPI.Syntax;
var literal:Syntax.Literal = {
loc: {
source: null,
start: {
line: 1,
column: 10
},
end: {
line: 1,
column: 12
}
},
type: "Literal",
value: 42
};
// generated by http://esprima.org/demo/parse.html?code=%22use%20strict%22%3B%0A%0Afunction%20Test%20()%20%7B%0A%7D%0A%0ATest.prototype.hello%20%3D%20function(word)%20%7B%0A%09word%20%3D%20word%20%7C%7C%20%22TypeScript%22%3B%0A%09return%20word%3B%0A%7D%3B%0A
var program:Syntax.Program = {
"type": "Program",
"body": [
<Syntax.Expression>{
"type": "ExpressionStatement",
"expression": <Syntax.Literal>{
"type": "Literal",
"value": "use strict",
"raw": "\"use strict\""
}
},
<Syntax.FunctionDeclaration>{
"type": "FunctionDeclaration",
"id": <Syntax.Identifier>{
"type": "Identifier",
"name": "Test"
},
"params": [],
"defaults": [],
"body": <Syntax.BlockStatement>{
"type": "BlockStatement",
"body": []
},
"rest": null,
"generator": false,
"expression": false
},
<Syntax.Expression>{
"type": "ExpressionStatement",
"expression": <Syntax.AssignmentExpression>{
"type": "AssignmentExpression",
"operator": "=",
"left": <Syntax.MemberExpression>{
"type": "MemberExpression",
"computed": false,
"object": <Syntax.MemberExpression>{
"type": "MemberExpression",
"computed": false,
"object": <Syntax.Identifier>{
"type": "Identifier",
"name": "Test"
},
"property": <Syntax.Identifier>{
"type": "Identifier",
"name": "prototype"
}
},
"property": <Syntax.Identifier>{
"type": "Identifier",
"name": "hello"
}
},
"right": <Syntax.FunctionExpression>{
"type": "FunctionExpression",
"id": null,
"params": [
<Syntax.Identifier>{
"type": "Identifier",
"name": "word"
}
],
"defaults": [],
"body": <Syntax.BlockStatement>{
"type": "BlockStatement",
"body": [
<Syntax.Expression>{
"type": "ExpressionStatement",
"expression": <Syntax.AssignmentExpression>{
"type": "AssignmentExpression",
"operator": "=",
"left": <Syntax.Identifier>{
"type": "Identifier",
"name": "word"
},
"right": <Syntax.LogicalExpression>{
"type": "LogicalExpression",
"operator": "||",
"left": <Syntax.Identifier>{
"type": "Identifier",
"name": "word"
},
"right": <Syntax.Literal>{
"type": "Literal",
"value": "TypeScript",
"raw": "\"TypeScript\""
}
}
}
},
<Syntax.ReturnStatement>{
"type": "ReturnStatement",
"argument": {
"type": "Identifier",
"name": "word"
}
}
]
},
"rest": null,
"generator": false,
"expression": false
}
}
}
]
};
@@ -1,614 +0,0 @@
// Type definitions for Mozilla SpiderMonkey Parser API 1.8.5
// Project: https://developer.mozilla.org/en-US/docs/Mozilla/Projects/SpiderMonkey/Parser_API
// Definitions by: vvakame <https://github.com/vvakame/>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
declare module spiderMonkeyParserAPI {
// NOTE if property can hold null, that property to be optional.
module Syntax {
/**
* By default, Reflect.parse() produces Node objects, which are plain JavaScript objects (i.e., their prototype derives from the standard Object prototype).
* All node types implement the following interface:
*/
interface Node {
/**
* The type field is a string representing the AST variant type.
* Each subtype of Node is documented below with the specific string of its type field.
* You can use this field to determine which interface a node implements.
*/
type: string;
/**
* The loc field represents the source location information of the node.
* If the parser produced no information about the node's source location, the field is null; otherwise it is an object consisting of a start position (the position of the first character of the parsed source region) and an end position (the position of the first character after the parsed source region):
*/
loc?: SourceLocation;
}
interface SourceLocation {
source?: string;
start: Position;
end: Position;
}
/**
* Each Position object consists of a line number (1-indexed) and a column number (0-indexed):
*/
interface Position {
line: number; // uint32 >= 1;
column: number; // uint32 >= 0;
}
/**
* A complete program source tree.
*/
interface Program extends Node {
type: string; // "Program"
body: Statement[];
}
/**
* A function declaration or expression.
* The body of the function may be a block statement, or in the case of an expression closure, an expression.
* If the generator flag is true, the function is a generator function, i.e., contains a yield expression in its body (other than in a nested function).
* If the expression flag is true, the function is an expression closure and the body field is an expression.
*/
interface Function extends Node {
id?: Identifier;
params: Pattern[];
defaults: Expression[];
rest?: Identifier;
body?: BlockStatement | Expression;
generator: boolean;
expression: boolean;
}
/**
* Any statement.
*/
interface Statement extends Node {
}
/**
* An empty statement, i.e., a solitary semicolon.
*/
interface EmptyStatement extends Statement {
type: string; // "EmptyStatement";
}
/**
* A block statement, i.e., a sequence of statements surrounded by braces.
*/
interface BlockStatement extends Statement {
type: string; // "BlockStatement";
body: Statement[];
}
/**
* An if statement.
*/
interface IfStatement extends Statement {
type: string; // "IfStatement";
test: Expression;
consequent: Statement;
alternate?: Statement;
}
/**
* A labeled statement, i.e., a statement prefixed by a break/continue label.
*/
interface LabeledStatement extends Statement {
type: string; // "LabeledStatement";
label: Identifier;
body: Statement;
}
/**
* A break statement.
*/
interface BreakStatement extends Statement {
type: string; // "BreakStatement";
label?: Identifier;
}
/**
* A continue statement.
*/
interface ContinueStatement extends Statement {
type: string; // "ContinueStatement";
label?: Identifier;
}
/**
* A with statement.
*/
interface WithStatement extends Statement {
type: string; // "WithStatement";
object: Expression;
body: Statement;
}
/**
* A switch statement.
* The lexical flag is metadata indicating whether the switch statement contains any unnested let declarations (and therefore introduces a new lexical scope).
*/
interface SwitchStatement extends Statement {
type: string; // "SwitchStatement";
discriminant: Expression;
cases: SwitchCase[];
lexical: boolean;
}
/**
* A return statement.
*/
interface ReturnStatement extends Statement {
type: string; // "ReturnStatement";
argument?: Expression;
}
/**
* A throw statement.
*/
interface ThrowStatement extends Statement {
type: string; // "ThrowStatement";
argument: Expression;
}
/**
* A try statement.
*/
interface TryStatement extends Statement {
type: string; //"TryStatement";
block: BlockStatement;
handler?: CatchClause;
guardedHandlers: CatchClause[];
finalizer?: BlockStatement;
}
/**
* A while statement.
*/
interface WhileStatement extends Statement {
type: string; // "WhileStatement";
test: Expression;
body: Statement;
}
/**
* A do/while statement.
*/
interface DoWhileStatement extends Statement {
type: string; // "DoWhileStatement";
body: Statement;
test: Expression;
}
/**
* A for statement.
*/
interface ForStatement extends Statement {
type: string; // "ForStatement";
init?: VariableDeclaration | Expression;
test?: Expression;
update?: Expression;
body: Statement;
}
/**
* A for/in statement, or, if each is true, a for each/in statement.
*/
interface ForInStatement extends Statement {
type: string; // "ForInStatement";
left: VariableDeclaration | Expression;
right: Expression;
body: Statement;
each: boolean;
}
/**
* A for/of statement.
*/
interface ForOfStatement extends Statement {
type: string; // "ForOfStatement";
left: VariableDeclaration | Expression;
right: Expression;
body: Statement;
}
/**
* A let statement.
*/
interface LetStatement extends Statement {
type: string; // "LetStatement";
head: VariableDeclarator[];
body: Statement;
}
/**
* A debugger statement.
*/
interface DebuggerStatement extends Statement {
type: string; // "DebuggerStatement";
}
/**
* Any declaration node. Note that declarations are considered statements; this is because declarations can appear in any statement context in the language recognized by the SpiderMonkey parser.
*/
interface Declaration extends Statement {
}
/**
* A function declaration.
*/
interface FunctionDeclaration extends Function, Declaration {
type: string; // "FunctionDeclaration";
id: Identifier; // Note: The id field cannot be null.
params: Pattern[];
defaults: Expression[];
rest?: Identifier;
body: BlockStatement | Expression;
generator: boolean;
expression: boolean;
}
/**
* A variable declaration, via one of var, let, or const.
*/
interface VariableDeclaration extends Declaration {
type: string; // "VariableDeclaration";
declarations: VariableDeclarator[];
kind: string; // "var" | "let" | "const";
}
/**
* A variable declarator.
*/
interface VariableDeclarator extends Node {
type: string; // "VariableDeclarator";
id: Pattern; // Note: The id field cannot be null.
init?: Expression;
}
/**
* Any expression node.
* Since the left-hand side of an assignment may be any expression in general, an expression can also be a pattern.
*/
interface Expression extends Node, Pattern {
}
/**
* A this expression.
*/
interface ThisExpression extends Expression {
type: string; // "ThisExpression";
}
/**
* An array expression.
*/
interface ArrayExpression extends Expression {
type: string; // "ArrayExpression";
elements: Expression[]; // [ Expression | null ];
}
/**
* An object expression.
*/
interface ObjectExpression extends Expression {
type: string; // "ObjectExpression";
properties: Property[];
}
/**
* A literal property in an object expression can have either a string or number as its value.
* Ordinary property initializers have a kind value "init"; getters and setters have the kind values "get" and "set", respectively.
*/
interface Property extends Node {
type: string; // "Property";
key: Literal | Identifier;
value: Expression;
kind: string; // "init" | "get" | "set";
}
/**
* A function expression.
*/
interface FunctionExpression extends Function, Expression {
type: string; // "FunctionExpression";
id?: Identifier;
params: Pattern[];
defaults: Expression[];
rest?: Identifier;
body: BlockStatement | Expression;
generator: boolean;
expression: boolean;
}
/**
* A fat arrow function expression, i.e., `let foo = (bar) => { ... body ... }`.
*/
interface ArrowExpression extends Function, Expression {
type: string; // "ArrowExpression";
params: Pattern[];
defaults: Expression[];
rest?: Identifier;
body: BlockStatement | Expression;
generator: boolean;
expression: boolean;
}
/**
* A sequence expression, i.e., a comma-separated sequence of expressions.
*/
interface SequenceExpression extends Expression {
type: string; // "SequenceExpression";
expressions: Expression[];
}
/**
* A unary operator expression.
*/
interface UnaryExpression extends Expression {
type: string; // "UnaryExpression";
operator: UnaryOperator;
prefix: boolean;
argument: Expression;
}
/**
* A binary operator expression.
*/
interface BinaryExpression extends Expression {
type: string; // "BinaryExpression";
operator: BinaryOperator;
left: Expression;
right: Expression;
}
/**
* An assignment operator expression.
*/
interface AssignmentExpression extends Expression {
type: string; // "AssignmentExpression";
operator: AssignmentOperator;
left: Expression;
right: Expression;
}
/**
* An update (increment or decrement) operator expression.
*/
interface UpdateExpression extends Expression {
type: string; // "UpdateExpression";
operator: UpdateOperator;
argument: Expression;
prefix: boolean;
}
/**
* A logical operator expression.
*/
interface LogicalExpression extends Expression {
type: string; // "LogicalExpression";
operator: LogicalOperator;
left: Expression;
right: Expression;
}
/**
* A conditional expression, i.e., a ternary ?/: expression.
*/
interface ConditionalExpression extends Expression {
type: string; // "ConditionalExpression";
test: Expression;
alternate: Expression;
consequent: Expression;
}
/**
* A new expression.
*/
interface NewExpression extends Expression {
type: string; // "NewExpression";
callee: Expression;
arguments: Expression[];
}
/**
* A function or method call expression.
*/
interface CallExpression extends Expression {
type: string; // "CallExpression";
callee: Expression;
arguments: Expression[];
}
/**
* A member expression.
* If computed === true, the node corresponds to a computed e1[e2] expression and property is an Expression.
* If computed === false, the node corresponds to a static e1.x expression and property is an Identifier.
*/
interface MemberExpression extends Expression {
type: string; // "MemberExpression";
object: Expression;
property: Identifier | Expression;
computed: boolean;
}
/**
* A yield expression.
*/
interface YieldExpression extends Expression {
type: string; // "YieldExpression";
argument?: Expression;
}
/**
* An array comprehension.
* The blocks array corresponds to the sequence of for and for each blocks.
* The optional filter expression corresponds to the final if clause, if present.
*/
interface ComprehensionExpression extends Expression {
type: string; // "ComprehensionExpression";
body: Expression;
blocks: ComprehensionBlock[];
filter?: Expression;
}
/**
* A generator expression.
* As with array comprehensions, the blocks array corresponds to the sequence of for and for each blocks, and the optional filter expression corresponds to the final if clause, if present.
*/
interface GeneratorExpression extends Expression {
type: string; // "GeneratorExpression";
body: Expression;
blocks: ComprehensionBlock[];
filter?: Expression;
}
/**
* A graph expression, aka "sharp literal," such as #1={ self: #1# }.
*/
interface GraphExpression extends Expression {
type: string; // "GraphExpression";
index: number; // uint32;
expression: Literal;
}
/**
* A graph index expression, aka "sharp variable," such as #1#.
*/
interface GraphIndexExpression extends Expression {
type: string; // "GraphIndexExpression";
index: number; // uint32;
}
/**
* A let expression.
*/
interface LetExpression extends Expression {
type: string; // "LetExpression";
head: VariableDeclarator[];
body: Expression;
}
/**
* JavaScript 1.7 introduced destructuring assignment and binding forms.
* All binding forms (such as function parameters, variable declarations, and catch block headers) accept array and object destructuring patterns in addition to plain identifiers.
* The left-hand sides of assignment expressions can be arbitrary expressions, but in the case where the expression is an object or array literal, it is interpreted by SpiderMonkey as a destructuring pattern.
*
* Since the left-hand side of an assignment can in general be any expression, in an assignment context, a pattern can be any expression.
* In binding positions (such as function parameters, variable declarations, and catch headers), patterns can only be identifiers in the base case, not arbitrary expressions.
*/
interface Pattern extends Node {
}
/**
* An object-destructuring pattern. A literal property in an object pattern can have either a string or number as its value.
*/
interface ObjectPattern extends Pattern {
type: string; // "ObjectPattern";
properties: {key: Literal | Identifier; value: Pattern;}[]; // [ { key: Literal | Identifier, value: Pattern } ];
}
/**
* An array-destructuring pattern.
*/
interface ArrayPattern extends Pattern {
type: string; // "ArrayPattern";
elements: Pattern[]; // [ Pattern | null ];
}
/**
* A case (if test is an Expression) or default (if test === null) clause in the body of a switch statement.
*/
interface SwitchCase extends Node {
type: string; // "SwitchCase";
test?: Expression;
consequent: Statement[];
}
/**
* A catch clause following a try block.
* The optional guard property corresponds to the optional expression guard on the bound variable.
*/
interface CatchClause extends Node {
type: string; // "CatchClause";
param: Pattern;
guard?: Expression;
body: BlockStatement;
}
/**
* A for or for each block in an array comprehension or generator expression.
*/
interface ComprehensionBlock extends Node {
type: string; // "ComprehensionBlock";
left: Pattern;
right: Expression;
each: boolean;
}
/**
* An identifier.
* Note that an identifier may be an expression or a destructuring pattern.
*/
interface Identifier extends Node, Expression, Pattern {
type: string; // "Identifier";
name: string;
}
/**
* A literal token. Note that a literal can be an expression.
*/
interface Literal extends Node, Expression {
type: string; // "Literal";
value?: string | boolean | number | RegExp;
}
/**
* A unary operator token.
*/
interface UnaryOperator extends String {
// "-" | "+" | "!" | "~" | "typeof" | "void" | "delete"
}
/**
* A binary operator token.
*/
interface BinaryOperator extends String {
// "==" | "!=" | "===" | "!=="
// | "<" | "<=" | ">" | ">="
// | "<<" | ">>" | ">>>"
// | "+" | "-" | "*" | "/" | "%"
// | "|" | "^" | "&" | "in"
// | "instanceof" | ".."
// Note: The .. operator is E4X-specific.
}
/**
* A logical operator token.
*/
interface LogicalOperator extends String {
// "||" | "&&"
}
/**
* An assignment operator token.
*/
interface AssignmentOperator extends String {
// "=" | "+=" | "-=" | "*=" | "/=" | "%="
// | "<<=" | ">>=" | ">>>="
// | "|=" | "^=" | "&="
}
/**
* An update (increment or decrement) operator token.
*/
interface UpdateOperator extends String {
// "++" | "--"
}
}
}
+15 -15
View File
@@ -63,7 +63,7 @@ selectionProvider.selectedItems = [];
selectionProvider.selectedIndex = 1;
selectionProvider.lastClickedRow = {};
selectionProvider.ignoreSelectedItemChanges = false;
selectionProvider.pKeyParser = <ng.ICompiledExpression>{};
selectionProvider.pKeyParser = <angular.ICompiledExpression>{};
selectionProvider.ChangeSelection({}, {});
nr = selectionProvider.getSelection({});
nr = selectionProvider.getSelectionIndex({});
@@ -256,15 +256,15 @@ nr = gridScope.totalRowWidth();
a = gridScope.headerScrollerDim();
var gridInstance: ngGrid.IGridInstance = <ngGrid.IGridInstance>{};
gridInstance.$canvas = <ng.IAugmentedJQuery>{};
gridInstance.$viewport = <ng.IAugmentedJQuery>{};
gridInstance.$groupPanel = <ng.IAugmentedJQuery>{};
gridInstance.$footerPanel = <ng.IAugmentedJQuery>{};
gridInstance.$headerScroller = <ng.IAugmentedJQuery>{};
gridInstance.$headerContainer = <ng.IAugmentedJQuery>{};
gridInstance.$headers = <ng.IAugmentedJQuery>{};
gridInstance.$topPanel = <ng.IAugmentedJQuery>{};
gridInstance.$root = <ng.IAugmentedJQuery>{};
gridInstance.$canvas = <angular.IAugmentedJQuery>{};
gridInstance.$viewport = <angular.IAugmentedJQuery>{};
gridInstance.$groupPanel = <angular.IAugmentedJQuery>{};
gridInstance.$footerPanel = <angular.IAugmentedJQuery>{};
gridInstance.$headerScroller = <angular.IAugmentedJQuery>{};
gridInstance.$headerContainer = <angular.IAugmentedJQuery>{};
gridInstance.$headers = <angular.IAugmentedJQuery>{};
gridInstance.$topPanel = <angular.IAugmentedJQuery>{};
gridInstance.$root = <angular.IAugmentedJQuery>{};
gridInstance.config = <ngGrid.IGridOptions>{};
gridInstance.data = {};
gridInstance.elementDims = <ngGrid.IElementDimension>{};
@@ -290,7 +290,7 @@ gridInstance.clearSortingData();
gridInstance.configureColumnWidths();
gridInstance.fixColumnIndexes();
gridInstance.fixGroupIndexes();
var p:ng.IPromise<any> = gridInstance.getTemplate('');
var p:angular.IPromise<any> = gridInstance.getTemplate('');
p = gridInstance.init();
p = gridInstance.initTemplates();
gridInstance.minRowsToRender();
@@ -302,12 +302,12 @@ gridInstance.sortColumnsInit();
gridInstance.sortData(<ngGrid.IColumn>{}, {});
var test_styleProvider:ngGrid.IStyleProvider = new ngStyleProvider(<ngGrid.IGridScope>{}, <ngGrid.IGridInstance>{});
var test_searchProvider:ngGrid.ISearchProvider = new ngSearchProvider(<ngGrid.IGridScope>{}, <ngGrid.IGridInstance>{}, <ng.IFilterService>{});
var test_selectionProvider:ngGrid.ISelectionProvider = new ngSelectionProvider(<ngGrid.IGridInstance>{}, <ngGrid.IGridScope>{}, <ng.IParseService>{});
var test_eventProvider:ngGrid.IEventProvider = new ngEventProvider(<ngGrid.IGridInstance>{}, <ngGrid.IGridScope>{}, <ngGrid.service.IDomUtilityService>{}, <ng.ITimeoutService>{});
var test_searchProvider:ngGrid.ISearchProvider = new ngSearchProvider(<ngGrid.IGridScope>{}, <ngGrid.IGridInstance>{}, <angular.IFilterService>{});
var test_selectionProvider:ngGrid.ISelectionProvider = new ngSelectionProvider(<ngGrid.IGridInstance>{}, <ngGrid.IGridScope>{}, <angular.IParseService>{});
var test_eventProvider:ngGrid.IEventProvider = new ngEventProvider(<ngGrid.IGridInstance>{}, <ngGrid.IGridScope>{}, <ngGrid.service.IDomUtilityService>{}, <angular.ITimeoutService>{});
var test_aggregate:ngGrid.IAggregate = new ngAggregate({}, <ngGrid.IRowFactory>{}, 10, true);
var test_renderedRange:ngGrid.IRenderedRange = new ngRenderedRange(1, 2);
var test_dimension:ngGrid.IDimension = new ngDimension({});
var test_row:ngGrid.IRow = new ngRow({}, <ngGrid.IRowConfig>{}, <ngGrid.ISelectionProvider>{}, 0, {});
var test_column:ngGrid.IColumn = new ngColumn(<ngGrid.IGridOptions>{}, <ngGrid.IGridScope>{}, <ngGrid.IGridInstance>{}, <ngGrid.service.IDomUtilityService>{}, <ng.ITemplateCacheService>{}, {});
var test_column:ngGrid.IColumn = new ngColumn(<ngGrid.IGridOptions>{}, <ngGrid.IGridScope>{}, <ngGrid.IGridInstance>{}, <ngGrid.service.IDomUtilityService>{}, <angular.ITemplateCacheService>{}, {});
var test_footer:ngGrid.IFooter = new ngFooter(<ngGrid.IGridScope>{}, <ngGrid.IGridInstance>{});
+21 -21
View File
@@ -30,9 +30,9 @@ declare module ngGrid {
export interface IDomAccessProvider {
previousColumn:IColumn;
grid:IGridInstance;
changeUserSelect(elm:ng.IAugmentedJQuery, value:string):void;
changeUserSelect(elm:angular.IAugmentedJQuery, value:string):void;
focusCellElement($scope:IGridScope, index:number):void;
selectionHandlers($scope:IGridScope, elm:ng.IAugmentedJQuery):void;
selectionHandlers($scope:IGridScope, elm:angular.IAugmentedJQuery):void;
}
export interface IStyleProviderStatic {
@@ -43,7 +43,7 @@ declare module ngGrid {
}
export interface ISearchProviderStatic {
new($scope:IGridScope, grid:IGridInstance, $filter:ng.IFilterService):ISearchProvider;
new($scope:IGridScope, grid:IGridInstance, $filter:angular.IFilterService):ISearchProvider;
}
export interface ISearchProvider {
@@ -53,7 +53,7 @@ declare module ngGrid {
}
export interface ISelectionProviderStatic {
new(grid:IGridInstance, $scope:IGridScope, $parse:ng.IParseService):ISelectionProvider;
new(grid:IGridInstance, $scope:IGridScope, $parse:angular.IParseService):ISelectionProvider;
}
export interface ISelectionProvider {
@@ -62,7 +62,7 @@ declare module ngGrid {
selectedIndex:number;
lastClickedRow:any;
ignoreSelectedItemChanges:boolean;
pKeyParser:ng.ICompiledExpression;
pKeyParser:angular.ICompiledExpression;
ChangeSelection(rowItem:any, event:any):void;
getSelection(entity:any):number;
getSelectionIndex(entity:any):number;
@@ -71,7 +71,7 @@ declare module ngGrid {
}
export interface IEventProviderStatic {
new(grid:IGridInstance, $scope:IGridScope, domUtilityService:service.IDomUtilityService, $timeout:ng.ITimeoutService):IEventProvider;
new(grid:IGridInstance, $scope:IGridScope, domUtilityService:service.IDomUtilityService, $timeout:angular.ITimeoutService):IEventProvider;
}
export interface IEventProvider {
@@ -203,7 +203,7 @@ declare module ngGrid {
}
export interface IColumnStatic {
new(config:IGridOptions, $scope:IGridScope, grid:IGridInstance, domUtilityService:service.IDomUtilityService, $templateCache:ng.ITemplateCacheService, $utils:any):IColumn;
new(config:IGridOptions, $scope:IGridScope, grid:IGridInstance, domUtilityService:service.IDomUtilityService, $templateCache:angular.ITemplateCacheService, $utils:any):IColumn;
}
export interface IColumn {
@@ -251,7 +251,7 @@ declare module ngGrid {
setVars(fromCol:IColumn):void;
}
export interface IGridScope extends ng.IScope {
export interface IGridScope extends angular.IScope {
elementsNeedMeasuring:boolean;
columns:any[];
renderedRows:any[];
@@ -292,15 +292,15 @@ declare module ngGrid {
}
export interface IGridInstance {
$canvas:ng.IAugmentedJQuery;
$viewport:ng.IAugmentedJQuery;
$groupPanel:ng.IAugmentedJQuery;
$footerPanel:ng.IAugmentedJQuery;
$headerScroller:ng.IAugmentedJQuery;
$headerContainer:ng.IAugmentedJQuery;
$headers:ng.IAugmentedJQuery;
$topPanel:ng.IAugmentedJQuery;
$root:ng.IAugmentedJQuery;
$canvas:angular.IAugmentedJQuery;
$viewport:angular.IAugmentedJQuery;
$groupPanel:angular.IAugmentedJQuery;
$footerPanel:angular.IAugmentedJQuery;
$headerScroller:angular.IAugmentedJQuery;
$headerContainer:angular.IAugmentedJQuery;
$headers:angular.IAugmentedJQuery;
$topPanel:angular.IAugmentedJQuery;
$root:angular.IAugmentedJQuery;
config:IGridOptions;
data:any;
elementDims:IElementDimension;
@@ -327,9 +327,9 @@ declare module ngGrid {
configureColumnWidths():void;
fixColumnIndexes():void;
fixGroupIndexes():void;
getTemplate(key:string):ng.IPromise<any>;
init():ng.IPromise<any>;
initTemplates():ng.IPromise<any>;
getTemplate(key:string):angular.IPromise<any>;
init():angular.IPromise<any>;
initTemplates():angular.IPromise<any>;
minRowsToRender():void;
refreshDomSizes():void;
resizeOnData(col:IColumn):void;
@@ -602,7 +602,7 @@ declare module ngGrid {
eventStorage:any;
numberOfGrids:number;
immediate:number;
AssignGridContainers($scope:IGridScope, rootel:ng.IAugmentedJQuery, grid:IGridInstance):void;
AssignGridContainers($scope:IGridScope, rootel:angular.IAugmentedJQuery, grid:IGridInstance):void;
getRealWidth(obj:IDimension):number;
UpdateGridLayout($scope:IGridScope, grid:IGridInstance):void;
setStyleText(grid:IGridInstance, css:string):void;
+2 -2
View File
@@ -832,8 +832,8 @@ declare module "azure" {
whereKeys(partitionKey: string, rowKey: string): TableQuery;
whereNextKeys(partitionKey: string, rowKey: string): TableQuery;
where(condition: string, ...values: string[]): TableQuery;
and(condition: string, ...arguments: string[]): TableQuery;
or(condition: string, ...arguments: string[]): TableQuery;
and(condition: string, ...args: string[]): TableQuery;
or(condition: string, ...args: string[]): TableQuery;
top(integer: number): TableQuery;
toQueryObject(): any;
toPath(): string;
+53
View File
@@ -0,0 +1,53 @@
/// <reference path="sanitizer.d.ts" />
import sanitizer = require('sanitizer');
// example copied from the tests https://github.com/theSmaw/Caja-HTML-Sanitizer/blob/master/test/test-sanitizer.js#L346
var events:any[] = [];
var addTextEvent = function(type:string, text:string, param:any) {
var n = events.length;
if (events[n - 3] === type && events[n - 1] === param) {
events[n - 2] += text;
} else {
events.push(type, text, param);
}
};
sanitizer.makeSaxParser({
startTag: function(name, attribs, param) {
events.push('startTag', name + '[' + attribs.join(';') + ']', param);
},
endTag: function(name, param) {
events.push('endTag', name, param);
},
pcdata: function(text, param) {
addTextEvent('pcdata', text, param);
},
cdata: function(text, param) {
addTextEvent('cdata', text, param);
},
rcdata: function(text, param) {
addTextEvent('rcdata', text, param);
},
comment: function(text, param) {
events.push('comment', text, param);
},
startDoc: function(param) {
events.push('startDoc', '', param);
},
endDoc: function(param) {
events.push('endDoc', '', param);
}
});
sanitizer.escape('<script>alert("hi")</script>');
sanitizer.sanitize('<script>alert("hi")</script>');
sanitizer.normalizeRCData('<script>alert("hi")</script>');
sanitizer.unescapeEntities('<script>alert("hi")</script>');
+27
View File
@@ -0,0 +1,27 @@
// Type definitions for Sanitizer
// Project: https://github.com/theSmaw/Caja-HTML-Sanitizer
// Definitions by: Dave Taylor <http://davetayls.me>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
declare module 'sanitizer' {
export interface ISaxHandler {
startTag(name:string, attribs:string[], param:any):void;
endTag(name:string, param:any):void;
pcdata(text:string, param:any):void;
cdata(text:string, param:any):void;
rcdata(text:string, param:any):void;
comment(text:string, param:any):void;
startDoc(param:any):void;
endDoc(param:any):void;
}
export function escape(s:string):string;
export function makeSaxParser(yourHandler:ISaxHandler):(...any:any[])=>any;
export function normalizeRCData(s:string):string;
export function sanitize(s:string):string;
export function unescapeEntities(s:string):string;
}
+93
View File
@@ -0,0 +1,93 @@
/// <reference path="sweetalert.d.ts" />
// A basic message
swal("Here's a message!");
// A title with a text under
swal("Here's a message!", "It's pretty, isn't it?");
// A success message!
swal("Good job!", "You clicked the button!", "success");
// A warning message, with a function attached to the "Confirm"-button...
swal({
title: "Are you sure?",
text: "You will not be able to recover this imaginary file!",
type: "warning",
showCancelButton: true,
confirmButtonColor: "#DD6B55",
confirmButtonText: "Yes, delete it!",
closeOnConfirm: false
},
function () {
swal("Deleted!", "Your imaginary file has been deleted.", "success");
});
// ... and by passing a parameter, you can execute something else for "Cancel".
swal({
title: "Are you sure?",
text: "You will not be able to recover this imaginary file!",
type: "warning",
showCancelButton: true,
confirmButtonColor: "#DD6B55",
confirmButtonText: "Yes, delete it!",
cancelButtonText: "No, cancel plx!",
closeOnConfirm: false,
closeOnCancel: false
},
function (isConfirm) {
if (isConfirm) {
swal("Deleted!", "Your imaginary file has been deleted.", "success");
} else {
swal("Cancelled", "Your imaginary file is safe :)", "error");
}
});
// A message with a custom icon
swal({
title: "Sweet!",
text: "Here's a custom image.",
imageUrl: "images/thumbs-up.jpg"
});
// An HTML message
swal({
title: "HTML <small>Title</small>!",
text: "A custom <span style=\"color: #F8BB86\">html<span> message.",
html: true
});
// A message with auto close timer
swal({
title: "Auto close alert!",
text: "I will close in 2 seconds.",
timer: 2000,
showConfirmButton: false
});
// A replacement for the "prompt" function
swal({
title: "An input!",
text: "Write something interesting:",
type: "input",
showCancelButton: true,
closeOnConfirm: false,
animation: "slide-from-top"
},
function (inputValue) {
if (inputValue === false) return false;
if (inputValue === "") {
swal.showInputError("You need to write something!");
return false;
}
swal("Nice!", "You wrote: " + inputValue, "success");
}
);
swal.setDefaults({ confirmButtonColor: "#000000" });
swal.close();
swal.showInputError("Invalid email!");
+181
View File
@@ -0,0 +1,181 @@
// Type definitions for SweetAlert 0.5.0
// Project: https://github.com/t4t5/sweetalert/
// Definitions by: Markus Peloso <https://github.com/ToastHawaii/>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
declare var sweetAlert: SweetAlert.SweetAlertStatic;
declare var swal: SweetAlert.SweetAlertStatic;
declare module "sweetalert" {
export = swal;
}
declare module SweetAlert {
interface SettingsBase {
/**
* A description for the modal.
* Default: null
*/
text?: string;
/**
* The type of the modal. SweetAlert comes with 4 built-in types which will show a corresponding icon animation: "warning", "error", "success" and "info". You can also set it as "input" to get a prompt modal.
* Default: null
*/
type?: string;
/**
* If set to true, the user can dismiss the modal by pressing the Escape key.
* Default: true
*/
allowEsxcapeKey?: boolean;
/**
* A custom CSS class for the modal.
* Default: null
*/
customClass?: string;
/**
* If set to true, the user can dismiss the modal by clicking outside it.
* Default: false
*/
allowOutsideClick?: boolean;
/**
* If set to true, a "Cancel"-button will be shown, which the user can click on to dismiss the modal.
* Default: false
*/
showCancelButton?: boolean;
/**
* If set to false, the "OK/Confirm"-button will be hidden. Make sure you set a timer or set allowOutsideClick to true when using this, in order not to annoy the user.
* Default: true
*/
showConfirmButton?: boolean;
/**
* Use this to change the text on the "Confirm"-button. If showCancelButton is set as true, the confirm button will automatically show "Confirm" instead of "OK".
* Default: "OK"
*/
confirmButtonText?: string;
/**
* Use this to change the background color of the "Confirm"-button (must be a HEX value).
* Default: "#AEDEF4"
*/
confirmButtonColor?: string;
/**
* Use this to change the text on the "Cancel"-button.
* Default: "Cancel"
*/
cancelButtonText?: string;
/**
* Set to false if you want the modal to stay open even if the user presses the "Confirm"-button. This is especially useful if the function attached to the "Confirm"-button is another SweetAlert.
* Default: true
*/
closeOnConfirm?: boolean;
/**
* Add a customized icon for the modal.Should contain a string with the path to the image.
* Default: null
*/
imageUrl?: string;
/**
* If imageUrl is set, you can specify imageSize to describes how big you want the icon to be in px. Pass in a string with two values separated by an "x". The first value is the width, the second is the height.
* Default: "80x80"
*/
imageSize?: string;
/**
* Auto close timer of the modal.Set in ms (milliseconds).
* Default: null
*/
timer?: number;
/**
* If set to true, will not escape title and text parameters. (Set to false if you're worried about XSS attacks.)
* Default: false
*/
html?: boolean;
/**
* If set to false, the modal's animation will be disabled. Possible animations: "slide-from-top", "slide-from-bottom", "pop" (use true instead) and "none" (use false instead).
* Default: true, "pop"
*/
animation?: boolean | string;
/**
* Change the type of the input field when using type: "input" (this can be useful if you want users to type in their password for example).
* Default: "text"
*/
inputType?: string;
}
interface Settings extends SettingsBase {
/**
* The title of the modal.
*/
title: string;
}
interface SetDefaultsSettings extends SettingsBase {
/**
* The title of the modal.
* Default: null
*/
title?: string;
}
/**
* Is true or false if the user confirms or cancels the alert. Except for the type "input", then when the user confirms the alert, this variable contains the value of the input element.
*/
type CallbackArgument = boolean | string;
interface SweetAlertStatic {
/**
* SweetAlert automatically centers itself on the page and looks great no matter if you're using a desktop computer, mobile or tablet. An awesome replacement for JavaScript's alert.
* @param title The title of the modal.
*/
(title: string): void;
/**
* SweetAlert automatically centers itself on the page and looks great no matter if you're using a desktop computer, mobile or tablet. An awesome replacement for JavaScript's alert.
* @param title The title of the modal.
* @param text A description for the modal.
*/
(title: string, text: string): void;
/**
* SweetAlert automatically centers itself on the page and looks great no matter if you're using a desktop computer, mobile or tablet. An awesome replacement for JavaScript's alert.
* @param title The title of the modal.
* @param text A description for the modal.
* @param type The type of the modal. SweetAlert comes with 4 built-in types which will show a corresponding icon animation: "warning", "error", "success" and "info". You can also set it as "input" to get a prompt modal.
*/
(title: string, text: string, type: string): void;
/**
* SweetAlert automatically centers itself on the page and looks great no matter if you're using a desktop computer, mobile or tablet. An awesome replacement for JavaScript's alert.
* @param callback The callback from the users action. The value is true or false if the user confirms or cancels the alert. Except for the type "input", then when the user confirms the alert, the argument contains the value of the input element.
*/
(settings: Settings, callback?: (isConfirmOrInputValue: CallbackArgument) => any): void;
/**
* If you end up using a lot of the same settings when calling SweetAlert, you can use setDefaults at the start of your program to set them once and for all!
*/
setDefaults(settings: SetDefaultsSettings): void;
/**
* Close the currently open SweetAlert programmatically.
*/
close(): void;
/**
* Show an error message after validating the input field, if the user's data is bad.
*/
showInputError(errorMessage: string): void;
}
}
+2 -2
View File
@@ -12203,8 +12203,8 @@ declare module Windows {
createWithId(tileId: string): Windows.UI.StartScreen.SecondaryTile;
}
export class SecondaryTile implements Windows.UI.StartScreen.ISecondaryTile {
constructor(tileId: string, shortName: string, displayName: string, arguments: string, tileOptions: Windows.UI.StartScreen.TileOptions, logoReference: Windows.Foundation.Uri);
constructor(tileId: string, shortName: string, displayName: string, arguments: string, tileOptions: Windows.UI.StartScreen.TileOptions, logoReference: Windows.Foundation.Uri, wideLogoReference: Windows.Foundation.Uri);
constructor(tileId: string, shortName: string, displayName: string, args: string, tileOptions: Windows.UI.StartScreen.TileOptions, logoReference: Windows.Foundation.Uri);
constructor(tileId: string, shortName: string, displayName: string, args: string, tileOptions: Windows.UI.StartScreen.TileOptions, logoReference: Windows.Foundation.Uri, wideLogoReference: Windows.Foundation.Uri);
constructor(tileId: string);
constructor();
arguments: string;
+14
View File
@@ -0,0 +1,14 @@
// Type definitions for Microsoft Dynamics xRM ClientGlobalContext.js.aspx
// Project: http://msdn.microsoft.com/en-us/library/gg328255.aspx
// Definitions by: David Berry <https://github.com/6ix4our/>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
/// <reference path="xrm.d.ts" />
/**
* Gets the xRM application context, for HTML web resources
* @returns {Xrm.Context} The application context for the user's current session.
* @remarks The ClientGlobalContext.js.aspx page will include some global event handlers. These event handlers will
* cancel the onselectstart, contextmenu, and ondragstart events.
*/
declare function GetGlobalContext(): Xrm.Context;
+143
View File
@@ -0,0 +1,143 @@
// Type definitions for Microsoft Parature extentions to Xrm.Page - available for CRM Online Only
// Project: http://msdn.microsoft.com/en-us/library/gg328255.aspx
// Definitions by: David Berry <https://github.com/6ix4our/>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
/// <reference path="xrm.d.ts" />
declare module Xrm.Page
{
/**
* Interface for Parature's knowledge base search control.
*
* @sa Control
*/
export interface KbSearchControl extends Control
{
/**
* Use this method to add an event handler to the OnResultOpened event.
*
* @param {Function} handler The handler.
*/
addOnResultOpened( handler: () => void ): void;
/**
* Use this method to add an event handler to the OnSelection event.
*
* @param {Function} handler The handler.
*/
addOnSelection( handler: () => void ): void;
/**
* Use this method to get the text used as the search criteria for the knowledge base management control.
*
* @return The search query.
*/
getSearchQuery(): string;
/**
* Use this method to get the currently selected result of the search control. The currently selected result also
* represents the result that is currently open.
*
* @return The selected result.
*/
getSelectedResult(): KbSearchResult;
/**
* Use this method to remove an event handler from the OnResultOpened event.
*
* @param {Function} handler The handler.
*/
removeOnResultOpened( handler: () => void ): void;
/**
* Use this method to remove an event handler from the OnSelection event.
*
* @param {Function} handler The handler.
*/
removeOnSelection( handler: () => void ): void;
/**
* Use this method to set the text used as the search criteria for the knowledge base management control.
*
* @param {string} query The text for the search query.
*/
setSearchQuery( query: string ): void;
}
/**
* Interface for a Parature knowledge base search result.
*/
export interface KbSearchResult
{
/**
* The HTML markup containing the content of the article.
*/
answer: string;
/**
* The Article ID in a Parature department
*/
articleId: string;
/**
* Unique Article ID for the Parature system.
*/
articleUid: string;
/**
* The date the article was created.
*/
createdOn: Date;
/**
* The date the article was or will be expired.
*/
expiredDate: Date;
/**
* Whether the article is associated with the parent record or not
*/
isAssociated: boolean;
/**
* Date on which the article was last modified.
*/
lastModifiedOn: Date;
/**
* Support Portal URL of the article.
*/
publicUrl: string;
/**
* Whether the Article is in published or draft state.
*/
published: boolean;
/**
* The title of the article.
*/
question: string;
/**
* The rating of the article.
*/
rating: number;
/**
* A short snippet of article content which contains the areas where the search query was hit.
*/
searchBlurb: string;
/**
* Link to the article in the Parature service desk.
*/
serviceDeskUri: string;
/**
* The number of times an article is viewed on the Parature portal by customers.
*/
timesViewed: number;
}
}
+2071
View File
File diff suppressed because it is too large Load Diff
+69
View File
@@ -0,0 +1,69 @@
/// <reference path="xrm-6.d.ts" />
/// <reference path="clientglobalcontext.d.ts" />
function _getContext()
{
var errorMessage = "Context is not available.";
if ( typeof GetGlobalContext != "undefined" )
{ return GetGlobalContext(); }
else
{
if ( typeof Xrm != "undefined" )
{
return Xrm.Page.context;
}
else { throw new Error( errorMessage ); }
}
}
var crmContext = _getContext();
var grids = Xrm.Page.getControl(( control ) =>
{
return control.getControlType() === "subgrid";
});
var selectedGridReferences: Xrm.Page.LookupValue[] = [];
grids.forEach(( gridControl: Xrm.Page.GridControl ) =>
{
gridControl.refresh();
});
var lookupAttribute = Xrm.Page.getControl<Xrm.Page.LookupControl>( "customerid" );
lookupAttribute.addCustomFilter( `<filter type="and">
<condition attribute="address1_city" operator="eq" value="Redmond" />
</filter>`, "account" );
lookupAttribute.addPreSearch(() => { alert( "A search was performed." ); });
var lookupValues = lookupAttribute.getAttribute().getValue();
if ( lookupValues !== null )
if ( !lookupValues[0].id || !lookupValues[0].entityType )
throw new Error("Invalid value in Lookup control.");
Xrm.Page.ui.controls.forEach(( control ) => { control.setVisible( true ); });
Xrm.Page.ui.tabs.forEach(( tab ) =>
{
tab.setVisible( true );
tab.sections.forEach(( section ) =>
{
section.setVisible( true );
});
});
Xrm.Page.data.entity.addOnSave(( context ) =>
{
var eventArgs = context.getEventArgs();
if ( eventArgs.getSaveMode() === Xrm.Page.SaveMode.AutoSave || eventArgs.getSaveMode() === Xrm.Page.SaveMode.SaveAndClose )
eventArgs.preventDefault();
});
alert( `The current form type is: ${Xrm.Page.ui.getFormType() }` );
alert( `The current entity type is: ${Xrm.Page.data.entity.getEntityName() }` );
+2350
View File
File diff suppressed because it is too large Load Diff
+72
View File
@@ -0,0 +1,72 @@
/// <reference path="xrm-7.0.d.ts" />
/// <reference path="clientglobalcontext.d.ts" />
function _getContext()
{
var errorMessage = "Context is not available.";
if ( typeof GetGlobalContext != "undefined" )
{ return GetGlobalContext(); }
else
{
if ( typeof Xrm != "undefined" )
{
return Xrm.Page.context;
}
else { throw new Error( errorMessage ); }
}
}
var crmContext = _getContext();
var grids = Xrm.Page.getControl(( control ) =>
{
return control.getControlType() === "subgrid";
});
var selectedGridReferences: Xrm.Page.LookupValue[] = [];
grids.forEach(( gridControl: Xrm.Page.GridControl ) =>
{
gridControl.refresh();
});
var lookupAttribute = Xrm.Page.getControl<Xrm.Page.LookupControl>( "customerid" );
lookupAttribute.addCustomFilter( `<filter type="and">
<condition attribute="address1_city" operator="eq" value="Redmond" />
</filter>`, "account" );
lookupAttribute.addPreSearch(() => { alert( "A search was performed." ); });
var lookupValues = lookupAttribute.getAttribute().getValue();
if ( lookupValues !== null )
if ( !lookupValues[0].id || !lookupValues[0].entityType )
throw new Error("Invalid value in Lookup control.");
if (Xrm.Page.data.process != null)
Xrm.Page.data.process.moveNext(( status ) => { alert( `Process moved forward with status: ${status}` ) });
Xrm.Page.ui.controls.forEach(( control ) => { control.setVisible( true ); });
Xrm.Page.ui.tabs.forEach(( tab ) =>
{
tab.setVisible( true );
tab.sections.forEach(( section ) =>
{
section.setVisible( true );
});
});
Xrm.Page.data.entity.addOnSave(( context ) =>
{
var eventArgs = context.getEventArgs();
if ( eventArgs.getSaveMode() === Xrm.Page.SaveMode.AutoSave || eventArgs.getSaveMode() === Xrm.Page.SaveMode.SaveAndClose )
eventArgs.preventDefault();
});
alert( `The current form type is: ${Xrm.Page.ui.getFormType() }` );
alert( `The current entity type is: ${Xrm.Page.data.entity.getEntityName() }` );
+103
View File
@@ -0,0 +1,103 @@
/// <reference path="xrm.d.ts" />
/// <reference path="clientglobalcontext.d.ts" />
/// <reference path="parature.d.ts" />
/// Demonstrate clientglobalcontext.d.ts
function _getContext()
{
var errorMessage = "Context is not available.";
if ( typeof GetGlobalContext != "undefined" )
{ return GetGlobalContext(); }
else
{
if ( typeof Xrm != "undefined" )
{
return Xrm.Page.context;
}
else { throw new Error( errorMessage ); }
}
}
var crmContext = _getContext();
/// Demonstrate iterator typing
var grids = Xrm.Page.getControl(( control ) =>
{
return control.getControlType() === "subgrid";
});
var selectedGridReferences: Xrm.Page.LookupValue[] = [];
/// Demonstrate iterator typing with v7.1 additions
grids.forEach(( gridControl: Xrm.Page.GridControl ) =>
{
gridControl.getGrid().getSelectedRows().forEach(( row ) =>
{
selectedGridReferences.push( row.getData().getEntity().getEntityReference() );
})
});
/// Demonstrate generic overload vs typecast
var lookupAttribute = <Xrm.Page.LookupControl>Xrm.Page.getControl( "customerid" );
var lookupAttribute2 = Xrm.Page.getControl<Xrm.Page.LookupControl>( "customerid" );
/// Demonstrate ES6 String literal syntax
lookupAttribute.addCustomFilter( `<filter type="and">
<condition attribute="address1_city" operator="eq" value="Redmond" />
</filter>`, "account" );
lookupAttribute.addPreSearch(() => { alert( "A search was performed." ); });
/// Demonstrate strong-typed attribute association with strong-typed control
var lookupValues = lookupAttribute.getAttribute().getValue();
if ( lookupValues !== null )
if ( !lookupValues[0].id || !lookupValues[0].entityType )
throw new Error("Invalid value in Lookup control.");
/// Demonstrate v7.0 BPF API
if (Xrm.Page.data.process != null)
Xrm.Page.data.process.moveNext(( status ) => { alert( `Process moved forward with status: ${status}` ) });
/// Demonstrate v7.1 Quick Create form
Xrm.Utility.openQuickCreate(( newRecord ) => { alert( `Newly created record Id: ${newRecord.id}` ); }, "account" );
/// Make all controls visible.
Xrm.Page.ui.controls.forEach(( control ) => { control.setVisible( true ); });
/// Make all tabs and sections visible.
Xrm.Page.ui.tabs.forEach(( tab ) =>
{
tab.setVisible( true );
tab.sections.forEach(( section ) =>
{
section.setVisible( true );
});
});
/// Demonstrate OnSave event context.
Xrm.Page.data.entity.addOnSave(( context ) =>
{
var eventArgs = context.getEventArgs();
if ( eventArgs.getSaveMode() === Xrm.Page.SaveMode.AutoSave || eventArgs.getSaveMode() === Xrm.Page.SaveMode.SaveAndClose )
eventArgs.preventDefault();
});
/// Demonstrate ES6 String literal with templates
alert( `The current form type is: ${Xrm.Page.ui.getFormType() }` );
alert( `The current entity type is: ${Xrm.Page.data.entity.getEntityName() }` );
+2586
View File
File diff suppressed because it is too large Load Diff