Merge remote-tracking branch 'upstream/master'

Conflicts:
	sequelize/sequelize.d.ts
This commit is contained in:
Ivan Drinchev
2015-08-08 11:27:46 +02:00
110 changed files with 12656 additions and 2194 deletions
-1
View File
@@ -1 +0,0 @@
+21
View File
@@ -0,0 +1,21 @@
/// <reference path="amqplib.d.ts" />
import amqp = require("amqplib");
var msg = "Hello World";
amqp.connect("amqp://localhost")
.then(connection => {
return connection.createChannel()
.tap(channel => channel.checkQueue("myQueue"))
.then(channel => channel.sendToQueue("myQueue", new Buffer(msg)))
.ensure(() => connection.close());
});
amqp.connect("amqp://localhost")
.then(connection => {
return connection.createChannel()
.tap(channel => channel.checkQueue("myQueue"))
.then(channel => channel.consume("myQueue", newMsg => console.log("New Message: " + newMsg.content.toString())))
.ensure(() => connection.close());
});
+144
View File
@@ -0,0 +1,144 @@
// Type definitions for amqplib 0.3.x
// Project: https://github.com/squaremo/amqp.node
// Definitions by: Michael Nahkies <https://github.com/mnahkies>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
/// <reference path="../when/when.d.ts" />
/// <reference path="../node/node.d.ts" />
declare module "amqplib" {
import events = require("events");
import when = require("when");
interface Connection extends events.EventEmitter {
close(): when.Promise<void>;
createChannel(): when.Promise<Channel>;
createConfirmChannel(): when.Promise<Channel>;
}
module Replies {
interface Empty {
}
interface AssertQueue {
queue: string;
messageCount: number;
consumerCount: number;
}
interface DeleteQueue {
messageCount: number;
}
interface AssertExchange {
exchange: string;
}
interface Consume {
consumerTag: string;
}
}
module Options {
interface AssertQueue {
exclusive?: boolean;
durable?: boolean;
autoDelete?: boolean;
arguments?: any;
messageTtl?: number;
expires?: number;
deadLetterExchange?: string;
maxLength?: number;
}
interface DeleteQueue {
ifUnused?: boolean;
ifEmpty?: boolean;
}
interface AssertExchange {
durable?: boolean;
internal?: boolean;
autoDelete?: boolean;
alternateExchange?: string;
arguments?: any;
}
interface DeleteExchange {
ifUnused?: boolean;
}
interface Publish {
expiration?: string;
userId?: string;
CC?: string | string[];
mandatory?: boolean;
persistent?: boolean;
deliveryMode?: boolean | number;
BCC?: string | string[];
contentType?: string;
contentEncoding?: string;
headers?: Object;
priority?: number;
correlationId?: string;
replyTo?: string;
messageId?: string;
timestamp?: number;
type?: string;
appId?: string;
}
interface Consume {
consumerTag?: string;
noLocal?: boolean;
noAck?: boolean;
exclusive?: boolean;
priority?: number;
arguments?: Object;
}
interface Get {
noAck?: boolean;
}
}
interface Message {
content: Buffer;
fields: Object;
properties: Object;
}
interface Channel extends events.EventEmitter {
close(): when.Promise<void>;
assertQueue(queue: string, options?: Options.AssertQueue): when.Promise<Replies.AssertQueue>;
checkQueue(queue: string): when.Promise<Replies.AssertQueue>;
deleteQueue(queue: string, options?: Options.DeleteQueue): when.Promise<Replies.DeleteQueue>;
purgeQueue(queue: string): when.Promise<Replies.DeleteQueue>;
bindQueue(queue: string, source: string, pattern: string, args?: any): when.Promise<Replies.Empty>;
unbindQueue(queue: string, source: string, pattern: string, args?: any): when.Promise<Replies.Empty>;
assertExchange(exchange: string, type: string, options?: Options.AssertExchange): when.Promise<Replies.AssertExchange>;
checkExchange(exchange: string): when.Promise<Replies.Empty>;
deleteExchange(exchange: string, options?: Options.DeleteExchange): when.Promise<Replies.Empty>;
bindExchange(destination: string, source: string, pattern: string, args?: any): when.Promise<Replies.Empty>;
unbindExchange(destination: string, source: string, pattern: string, args?: any): when.Promise<Replies.Empty>;
publish(exchange: string, routingKey: string, content: Buffer, options?: Options.Publish): boolean;
sendToQueue(queue: string, content: Buffer, options?: Options.Publish): boolean;
consume(queue: string, onMessage: (msg: Message) => any, options?: Options.Consume): when.Promise<Replies.Consume>;
cancel(consumerTag: string): when.Promise<Replies.Empty>;
get(queue: string, options?: Options.Get): when.Promise<Message | boolean>;
ack(message: Message, allUpTo?: boolean): void;
ackAll(): void;
nack(message: Message, allUpTo?: boolean, requeue?: boolean): void;
nackAll(requeue?: boolean): void;
reject(message: Message, requeue?: boolean): void;
prefetch(count: number, global?: boolean): when.Promise<Replies.Empty>;
recover(): when.Promise<Replies.Empty>;
}
function connect(url: string, socketOptions?: any): when.Promise<Connection>;
}
@@ -0,0 +1,77 @@
/// <reference path='angular-signalr-hub.d.ts' />
/// <reference path='../angularjs/angular.d.ts' />
angular
.module('app', ['SignalR'])
.factory('Employees', ngSignalrTest.EmployeesFactory);
module ngSignalrTest {
export class EmployeesFactory {
static $inject = ['$rootScope', 'Hub', '$timeout'];
private hub: ngSignalr.Hub;
public all: Array<Employee>;
constructor($rootScope: ng.IRootScopeService, Hub: ngSignalr.HubFactory, $timeout: ng.ITimeoutService) {
// declaring the hub connection
this.hub = new Hub('employee', {
// client-side methods
listeners: {
'lockEmployee': (id: number) => {
var employee = this.find(id);
employee.Locked = true;
$rootScope.$apply();
},
'unlockEmployee': (id: number) => {
var employee = this.find(id);
employee.Locked = false;
$rootScope.$apply();
}
},
// server-side methods
methods: ['lock', 'unlock'],
// query params sent on initial connection
queryParams:{
'token': 'exampletoken'
},
// handle connection error
errorHandler: (message: string) => {
console.error(message);
},
stateChanged: (state: SignalRStateChange) => {
// your code here
}
});
}
private find(id: number) {
for (var i = 0; i < this.all.length; i++) {
if (this.all[i].Id === id) return this.all[i];
}
return null;
}
public edit = (employee: Employee) => {
employee.Edit = true;
this.hub.invoke('lock', employee.Id);
};
public done = (employee: Employee) => {
employee.Edit = false;
this.hub.invoke('unlock', employee.Id);
}
}
interface Employee {
Id: number;
Name: string;
Email: string;
Salary: number;
Edit: boolean;
Locked: boolean;
}
}
+73
View File
@@ -0,0 +1,73 @@
// Type definitions for angular-signalr-hub v1.5.0
// Project: https://github.com/JustMaier/angular-signalr-hub
// Definitions by: Adam Santaniello <https://github.com/AdamSantaniello>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
/// <reference path='../signalr/signalr.d.ts' />
declare module ngSignalr {
interface HubFactory {
/**
* Creates a new Hub connection
*/
new(hubName: string, options: HubOptions) : Hub
}
class Hub {
hubName: string;
connection: SignalR;
proxy: HubProxy;
on(event: string, fn: ((...args: any[]) => void)): void;
invoke(method: string, ...args: any[]): JQueryDeferred<any>;
disconnect(): void;
connect(): JQueryPromise<any>;
}
interface HubOptions {
/**
* Collection of client side callbacks
*/
listeners?: { [index: string] : (...args: any[]) => void };
/**
* String array of server side methods which the client can call
*/
methods?: Array<string>;
/**
* Sets the root path for the SignalR web service
*/
rootPath?: string;
/**
* Object representing additional query params to be sent on connection
*/
queryParams?: { [index: string] : string };
/**
* Function to handle hub connection errors
*/
errorHandler?: (error: string) => void;
/**
* Enable/disable logging
*/
logging?: boolean;
/**
* Use a shared global connection or create a new one just for this hub, defaults to true
*/
useSharedConnection?: boolean;
/**
* Sets transport method (e.g 'longPolling' or ['webSockets', 'longPolling'] )
*/
transport?: any;
/**
* Function to handle hub connection state changed event
*/
stateChanged?: (state: SignalRStateChange) => void;
}
}
+1 -1
View File
@@ -13,7 +13,7 @@ declare module "angular-translate" {
declare module angular.translate {
interface ITranslationTable {
[key: string]: string;
[key: string]: any;
}
interface ILanguageKeyAlias {
File diff suppressed because it is too large Load Diff
+411 -157
View File
@@ -1,4 +1,4 @@
// Type definitions for Angular v2.0.0-alpha.33
// Type definitions for Angular v2.0.0-alpha.34
// Project: http://angular.io/
// Definitions by: angular team <https://github.com/angular/>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
@@ -20,12 +20,6 @@ interface Map<K,V> {}
interface StringMap<K,V> extends Map<K,V> {}
declare module ng {
type SetterFn = typeof Function;
type int = number;
interface Type extends Function {
new (...args: any[]): any;
}
// See https://github.com/Microsoft/TypeScript/issues/1168
class BaseException /* extends Error */ {
message: string;
@@ -183,7 +177,7 @@ declare module ng {
* When a component is instantiated, Angular
* - creates a shadow DOM for the component.
* - loads the selected template into the shadow DOM.
* - creates all the injectable objects configured with `hostInjector` and `viewInjector`.
* - creates all the injectable objects configured with `bindings` and `viewBindings`.
*
* All template expressions and statements are then evaluated against the component instance.
*
@@ -251,7 +245,7 @@ declare module ng {
*
* @Component({
* selector: 'greet',
* viewInjector: [
* viewBindings: [
* Greeter
* ]
* })
@@ -264,7 +258,7 @@ declare module ng {
*
* ```
*/
viewInjector: List<any>;
viewBindings: List<any>;
}
@@ -318,11 +312,9 @@ declare module ng {
*
* To inject other directives, declare the constructor parameter as:
* - `directive:DirectiveType`: a directive on the current element only
* - `@Ancestor() directive:DirectiveType`: any directive that matches the type between the current
* - `@Host() directive:DirectiveType`: any directive that matches the type between the current
* element and the
* Shadow DOM root. Current element is not included in the resolution, therefore even if it could
* resolve it, it will
* be ignored.
* Shadow DOM root.
* - `@Query(DirectiveType) query:QueryList<DirectiveType>`: A live collection of direct child
* directives.
* - `@QueryDescendants(DirectiveType) query:QueryList<DirectiveType>`: A live collection of any
@@ -429,21 +421,19 @@ declare module ng {
* ### Injecting a directive from any ancestor elements
*
* Directives can inject other directives declared on any ancestor element (in the current Shadow
* DOM), i.e. on the
* parent element and its parents. By definition, a directive with an `@Ancestor` annotation does
* not attempt to
* resolve dependencies for the current element, even if this would satisfy the dependency.
*
* DOM), i.e. on the current element, the
* parent element, or its parents.
* ```
* @Directive({ selector: '[my-directive]' })
* class MyDirective {
* constructor(@Ancestor() dependency: Dependency) {
* constructor(@Host() dependency: Dependency) {
* expect(dependency.id).toEqual(2);
* }
* }
* ```
*
* `@Ancestor` checks the parent, as well as its parents recursively. If `dependency="2"` didn't
* `@Host` checks the current element, the parent, as well as its parents recursively. If
* `dependency="2"` didn't
* exist on the direct parent, this injection would
* have returned
* `dependency="1"`.
@@ -982,7 +972,7 @@ declare module ng {
*
* @Directive({
* selector: 'greet',
* hostInjector: [
* bindings: [
* Greeter
* ]
* })
@@ -995,7 +985,7 @@ declare module ng {
* }
* ```
*/
hostInjector: List<any>;
bindings: List<any>;
/**
@@ -1078,7 +1068,7 @@ declare module ng {
/**
* Specifies an inline template for an angular component.
* Specifies a template URL for an angular component.
*
* NOTE: either `templateUrl` or `template` should be used, but not both.
*/
@@ -1086,7 +1076,7 @@ declare module ng {
/**
* Specifies a template URL for an angular component.
* Specifies an inline template for an angular component.
*
* NOTE: either `templateUrl` or `template` should be used, but not both.
*/
@@ -1132,8 +1122,9 @@ declare module ng {
/**
* Specify how the template and the styles should be encapsulated.
* The default is {@link ViewEncapsulation.EMULATED} if the view has styles,
* otherwise {@link ViewEncapsulation.NONE}.
* The default is {@link ViewEncapsulation#EMULATED `ViewEncapsulation.EMULATED`} if the view
* has styles,
* otherwise {@link ViewEncapsulation#NONE `ViewEncapsulation.NONE`}.
*/
encapsulation: ViewEncapsulation;
}
@@ -1207,8 +1198,9 @@ declare module ng {
/**
* Defines lifecycle method [onAllChangesDone ] called when the bindings of all its children have
* been changed.
* Defines lifecycle method
* {@link annotations/LifeCycleEvent#onAllChangesDone `LifeCycleEvent.onAllChangesDone`}
* called when the bindings of all its children have been changed.
*/
interface OnAllChangesDone {
@@ -1217,8 +1209,8 @@ declare module ng {
/**
* Defines lifecycle method [onChange] called after all of component's bound
* properties are updated.
* Defines lifecycle method {@link annotations/LifeCycleEvent#onChange `LifeCycleEvent.onChange`}
* called after all of component's bound properties are updated.
*/
interface OnChange {
@@ -1227,7 +1219,8 @@ declare module ng {
/**
* Defines lifecycle method [onDestroy] called when a directive is being destroyed.
* Defines lifecycle method {@link annotations/LifeCycleEvent#onDestroy `LifeCycleEvent.onDestroy`}
* called when a directive is being destroyed.
*/
interface OnDestroy {
@@ -1236,7 +1229,8 @@ declare module ng {
/**
* Defines lifecycle method [onInit] called when a directive is being checked the first time.
* Defines lifecycle method {@link annotations/LifeCycleEvent#onInit `LifeCycleEvent.onInit`}
* called when a directive is being checked the first time.
*/
interface OnInit {
@@ -1245,7 +1239,8 @@ declare module ng {
/**
* Defines lifecycle method [onCheck] called when a directive is being checked.
* Defines lifecycle method {@link annotations/LifeCycleEvent#onCheck `LifeCycleEvent.onCheck`}
* called when a directive is being checked.
*/
interface OnCheck {
@@ -1362,21 +1357,6 @@ declare module ng {
}
/**
* An interface implemented by all Angular parameter decorators, which allows them to be used as ES7
* decorators.
*/
interface ParameterDecorator {
/**
* Invoke as ES7 decorator.
*/
(cls: Type, unusedKey: any, index: number): void;
}
/**
* An interface implemented by all Angular type decorators, which allows them to be used as ES7
* decorators as well as
@@ -1565,10 +1545,10 @@ declare module ng {
events?: List<string>,
host?: StringMap<string, string>,
lifecycle?: List<LifecycleEvent>,
hostInjector?: List<any>,
bindings?: List<any>,
exportAs?: string,
compileChildren?: boolean,
viewInjector?: List<any>,
viewBindings?: List<any>,
changeDetection?: string,
}): ComponentAnnotation;
@@ -1579,10 +1559,10 @@ declare module ng {
events?: List<string>,
host?: StringMap<string, string>,
lifecycle?: List<LifecycleEvent>,
hostInjector?: List<any>,
bindings?: List<any>,
exportAs?: string,
compileChildren?: boolean,
viewInjector?: List<any>,
viewBindings?: List<any>,
changeDetection?: string,
}): ComponentDecorator;
@@ -1648,15 +1628,15 @@ declare module ng {
new(obj: {
selector?: string, properties?: List<string>, events?: List<string>,
host?: StringMap<string, string>, lifecycle?: List<LifecycleEvent>,
hostInjector?: List<any>, exportAs?: string, compileChildren?: boolean;
host?: StringMap<string, string>, lifecycle?: List<LifecycleEvent>, bindings?: List<any>,
exportAs?: string, compileChildren?: boolean;
}): DirectiveAnnotation;
(obj: {
selector?: string, properties?: List<string>, events?: List<string>,
host?: StringMap<string, string>, lifecycle?: List<LifecycleEvent>,
hostInjector?: List<any>, exportAs?: string, compileChildren?: boolean;
host?: StringMap<string, string>, lifecycle?: List<LifecycleEvent>, bindings?: List<any>,
exportAs?: string, compileChildren?: boolean;
}): DirectiveDecorator;
}
@@ -1892,6 +1872,48 @@ declare module ng {
location: string;
}
interface ChangeDetector {
parent: ChangeDetector;
mode: string;
addChild(cd: ChangeDetector): void;
addShadowDomChild(cd: ChangeDetector): void;
removeChild(cd: ChangeDetector): void;
removeShadowDomChild(cd: ChangeDetector): void;
remove(): void;
hydrate(context: any, locals: Locals, directives: any, pipes: any): void;
dehydrate(): void;
markPathToRootAsCheckOnce(): void;
detectChanges(): void;
checkNoChanges(): void;
}
class Locals {
parent: Locals;
current: Map<any, any>;
contains(name: string): boolean;
get(name: string): any;
set(name: string, value: any): void;
clearValues(): void;
}
/**
* Controls change detection.
@@ -1938,6 +1960,8 @@ declare module ng {
wrapped: any;
}
const defaultPipes : Pipes ;
/**
* An interface which all pipes must implement.
@@ -1985,7 +2009,7 @@ declare module ng {
* 'json': [jsonPipeFactory]
* }
* @Component({
* viewInjector: [
* viewBindings: [
* bind(Pipes).toValue(new Pipes(pipesConfig))
* ]
* })
@@ -1996,6 +2020,64 @@ declare module ng {
get(type: string, obj: any, cdRef?: ChangeDetectorRef, existingPipe?: Pipe): Pipe;
}
/**
* A repository of different iterable diffing strategies used by NgFor, NgClass, and others.
*/
class IterableDiffers {
factories: IterableDifferFactory[];
find(iterable: Object): IterableDifferFactory;
}
interface IterableDiffer {
diff(object: Object): any;
onDestroy(): void;
}
/**
* Provides a factory for {@link IterableDiffer}.
*/
interface IterableDifferFactory {
supports(objects: Object): boolean;
create(cdRef: ChangeDetectorRef): IterableDiffer;
}
/**
* A repository of different Map diffing strategies used by NgClass, NgStyle, and others.
*/
class KeyValueDiffers {
factories: KeyValueDifferFactory[];
find(kv: Object): KeyValueDifferFactory;
}
interface KeyValueDiffer {
diff(object: Object): void;
onDestroy(): void;
}
/**
* Provides a factory for {@link KeyValueDiffer}.
*/
interface KeyValueDifferFactory {
supports(objects: Object): boolean;
create(cdRef: ChangeDetectorRef): KeyValueDiffer;
}
interface PipeFactory {
supports(obs: any): boolean;
@@ -2097,6 +2179,18 @@ declare module ng {
}
/**
* Runtime representation of a type.
*
* In JavaScript a Type is a constructor function.
*/
interface Type extends Function {
new(args: any): any;
}
/**
* Specifies app root url for the application.
*
@@ -2606,6 +2700,59 @@ declare module ng {
}
/**
* Provides access to explicitly trigger change detection in an application.
*
* By default, `Zone` triggers change detection in Angular on each virtual machine (VM) turn. When
* testing, or in some
* limited application use cases, a developer can also trigger change detection with the
* `lifecycle.tick()` method.
*
* Each Angular application has a single `LifeCycle` instance.
*
* # Example
*
* This is a contrived example, since the bootstrap automatically runs inside of the `Zone`, which
* invokes
* `lifecycle.tick()` on your behalf.
*
* ```javascript
* bootstrap(MyApp).then((ref:ComponentRef) => {
* var lifeCycle = ref.injector.get(LifeCycle);
* var myApp = ref.instance;
*
* ref.doSomething();
* lifecycle.tick();
* });
* ```
*/
class LifeCycle {
/**
* @private
*/
registerWith(zone: NgZone, changeDetector?: ChangeDetector): void;
/**
* Invoke this method to explicitly process change detection and its side-effects.
*
* In development mode, `tick()` also performs a second change detection cycle to ensure that no
* further
* changes are detected. If additional changes are picked up during this second cycle, bindings
* in
* the app have
* side-effects that cannot be resolved in a single change detection pass. In this case, Angular
* throws an error,
* since an Angular application can only have one change detection pass during which all change
* detection must
* complete.
*/
tick(): void;
}
/**
* Reference to the element.
*
@@ -3099,21 +3246,6 @@ declare module ng {
}
/**
* Specifies how injector should resolve a dependency.
*
* See {@link Self}, {@link Ancestor}, {@link Unbounded}.
*/
class VisibilityMetadata {
crossBoundaries: boolean;
includeSelf: boolean;
toString(): string;
}
/**
* Specifies that an injector should retrieve a dependency from itself.
*
@@ -3132,14 +3264,15 @@ declare module ng {
* expect(nd.dependency).toBeAnInstanceOf(Dependency);
* ```
*/
class SelfMetadata extends VisibilityMetadata {
class SelfMetadata {
toString(): string;
}
/**
* Specifies that an injector should retrieve a dependency from any ancestor from the same boundary.
* Specifies that an injector should retrieve a dependency from any injector until reaching the
* closest host.
*
* ## Example
*
@@ -3148,65 +3281,52 @@ declare module ng {
* }
*
* class NeedsDependency {
* constructor(public @Ancestor() dependency:Dependency) {}
* constructor(public @Host() dependency:Dependency) {}
* }
*
* var parent = Injector.resolveAndCreate([
* bind(Dependency).toClass(AncestorDependency)
* bind(Dependency).toClass(HostDependency)
* ]);
* var child = parent.resolveAndCreateChild([]);
* var grandChild = child.resolveAndCreateChild([NeedsDependency, Depedency]);
* var nd = grandChild.get(NeedsDependency);
* expect(nd.dependency).toBeAnInstanceOf(AncestorDependency);
* ```
*
* You can make an injector to retrive a dependency either from itself or its ancestor by setting
* self to true.
*
* ```
* class NeedsDependency {
* constructor(public @Ancestor({self:true}) dependency:Dependency) {}
* }
* expect(nd.dependency).toBeAnInstanceOf(HostDependency);
* ```
*/
class AncestorMetadata extends VisibilityMetadata {
class HostMetadata {
toString(): string;
}
/**
* Specifies that an injector should retrieve a dependency from any ancestor, crossing boundaries.
* Specifies that the dependency resolution should start from the parent injector.
*
* ## Example
*
*
* ```
* class Dependency {
* class Service {}
*
* class ParentService implements Service {
* }
*
* class NeedsDependency {
* constructor(public @Ancestor() dependency:Dependency) {}
* class ChildService implements Service {
* constructor(public @SkipSelf() parentService:Service) {}
* }
*
* var parent = Injector.resolveAndCreate([
* bind(Dependency).toClass(AncestorDependency)
* bind(Service).toClass(ParentService)
* ]);
* var child = parent.resolveAndCreateChild([]);
* var grandChild = child.resolveAndCreateChild([NeedsDependency, Depedency]);
* var nd = grandChild.get(NeedsDependency);
* expect(nd.dependency).toBeAnInstanceOf(AncestorDependency);
* ```
*
* You can make an injector to retrive a dependency either from itself or its ancestor by setting
* self to true.
*
* ```
* class NeedsDependency {
* constructor(public @Ancestor({self:true}) dependency:Dependency) {}
* }
* var child = parent.resolveAndCreateChild([
* bind(Service).toClass(ChildSerice)
* ]);
* var s = child.get(Service);
* expect(s).toBeAnInstanceOf(ChildService);
* expect(s.parentService).toBeAnInstanceOf(ParentService);
* ```
*/
class UnboundedMetadata extends VisibilityMetadata {
class SkipSelfMetadata {
toString(): string;
}
@@ -3243,8 +3363,6 @@ declare module ng {
token: void;
}
const DEFAULT_VISIBILITY : VisibilityMetadata ;
/**
* Allows to refer to references which are not yet defined.
@@ -3749,7 +3867,9 @@ declare module ng {
optional: boolean;
visibility: VisibilityMetadata;
lowerBoundVisibility: any;
upperBoundVisibility: any;
properties: List<any>;
}
@@ -3971,27 +4091,27 @@ declare module ng {
/**
* Factory for creating {@link AncestorMetadata}.
* Factory for creating {@link HostMetadata}.
*/
interface AncestorFactory {
interface HostFactory {
new(visibility?: {self: boolean}): AncestorMetadata;
new(): HostMetadata;
(visibility?: {self: boolean}): any;
(): any;
}
/**
* Factory for creating {@link UnboundedMetadata}.
* Factory for creating {@link SkipSelfMetadata}.
*/
interface UnboundedFactory {
interface SkipSelfFactory {
new(visibility?: {self: boolean}): UnboundedMetadata;
new(): SkipSelfMetadata;
(visibility?: {self: boolean}): any;
(): any;
}
@@ -4021,15 +4141,15 @@ declare module ng {
/**
* Factory for creating {@link AncestorMetadata}.
* Factory for creating {@link HostMetadata}.
*/
var Ancestor : AncestorFactory ;
var Host : HostFactory ;
/**
* Factory for creating {@link UnboundedMetadata}.
* Factory for creating {@link SkipSelfMetadata}.
*/
var Unbounded : UnboundedFactory ;
var SkipSelf : SkipSelfFactory ;
/**
@@ -4142,7 +4262,7 @@ declare module ng {
templateRef: TemplateRef;
pipes: Pipes;
iterableDiffers: IterableDiffers;
cdr: ChangeDetectorRef;
@@ -4855,7 +4975,7 @@ declare module ng {
* ```
* import {Http, MyNodeBackend, httpInjectables, BaseRequestOptions} from 'angular2/http';
* @Component({
* viewInjector: [
* viewBindings: [
* httpInjectables,
* bind(Http).toFactory((backend, options) => {
* return new Http(backend, options);
@@ -4944,7 +5064,7 @@ declare module ng {
*
* ```
* import {Http, httpInjectables} from 'angular2/http';
* @Component({selector: 'http-app', viewInjector: [httpInjectables]})
* @Component({selector: 'http-app', viewBindings: [httpInjectables]})
* @View({templateUrl: 'people.html'})
* class PeopleComponent {
* constructor(http: Http) {
@@ -5226,7 +5346,7 @@ declare module ng {
*
* ```
* import {httpInjectables, Http} from 'angular2/http';
* @Component({selector: 'http-app', viewInjector: [httpInjectables]})
* @Component({selector: 'http-app', viewBindings: [httpInjectables]})
* @View({template: '{{data}}'})
* class MyApp {
* constructor(http:Http) {
@@ -6029,7 +6149,7 @@ declare module ng {
*
* @Component({
* selector: 'login-comp',
* viewInjector: [
* viewBindings: [
* FormBuilder
* ]
* })
@@ -6093,6 +6213,82 @@ declare module ng {
const formInjectables : List<Type> ;
class DirectiveMetadata {
id: any;
selector: string;
compileChildren: boolean;
events: List<string>;
properties: List<string>;
readAttributes: List<string>;
type: number;
callOnDestroy: boolean;
callOnChange: boolean;
callOnCheck: boolean;
callOnInit: boolean;
callOnAllChangesDone: boolean;
changeDetection: string;
exportAs: string;
hostListeners: Map<string, string>;
hostProperties: Map<string, string>;
hostAttributes: Map<string, string>;
hostActions: Map<string, string>;
}
class DomRenderer extends Renderer {
createRootHostView(hostProtoViewRef: RenderProtoViewRef, fragmentCount: number, hostElementSelector: string): RenderViewWithFragments;
createView(protoViewRef: RenderProtoViewRef, fragmentCount: number): RenderViewWithFragments;
destroyView(viewRef: RenderViewRef): void;
getNativeElementSync(location: RenderElementRef): any;
getRootNodes(fragment: RenderFragmentRef): List<Node>;
attachFragmentAfterFragment(previousFragmentRef: RenderFragmentRef, fragmentRef: RenderFragmentRef): void;
attachFragmentAfterElement(elementRef: RenderElementRef, fragmentRef: RenderFragmentRef): void;
detachFragment(fragmentRef: RenderFragmentRef): void;
hydrateView(viewRef: RenderViewRef): void;
dehydrateView(viewRef: RenderViewRef): void;
setElementProperty(location: RenderElementRef, propertyName: string, propertyValue: any): void;
setElementAttribute(location: RenderElementRef, attributeName: string, attributeValue: string): void;
setElementClass(location: RenderElementRef, className: string, isAdd: boolean): void;
setElementStyle(location: RenderElementRef, styleName: string, styleValue: string): void;
invokeElementMethod(location: RenderElementRef, methodName: string, args: List<any>): void;
setText(viewRef: RenderViewRef, textNodeIndex: number, text: string): void;
setEventDispatcher(viewRef: RenderViewRef, dispatcher: any): void;
}
/**
* A dispatcher for all events happening in a view.
@@ -6236,41 +6432,21 @@ declare module ng {
fragmentRefs: RenderFragmentRef[];
}
class DomRenderer extends Renderer {
class ViewDefinition {
createRootHostView(hostProtoViewRef: RenderProtoViewRef, fragmentCount: number, hostElementSelector: string): RenderViewWithFragments;
componentId: string;
createView(protoViewRef: RenderProtoViewRef, fragmentCount: number): RenderViewWithFragments;
templateAbsUrl: string;
destroyView(viewRef: RenderViewRef): void;
template: string;
getNativeElementSync(location: RenderElementRef): any;
directives: List<DirectiveMetadata>;
getRootNodes(fragment: RenderFragmentRef): List<Node>;
styleAbsUrls: List<string>;
attachFragmentAfterFragment(previousFragmentRef: RenderFragmentRef, fragmentRef: RenderFragmentRef): void;
styles: List<string>;
attachFragmentAfterElement(elementRef: RenderElementRef, fragmentRef: RenderFragmentRef): void;
detachFragment(fragmentRef: RenderFragmentRef): void;
hydrateView(viewRef: RenderViewRef): void;
dehydrateView(viewRef: RenderViewRef): void;
setElementProperty(location: RenderElementRef, propertyName: string, propertyValue: any): void;
setElementAttribute(location: RenderElementRef, attributeName: string, attributeValue: string): void;
setElementClass(location: RenderElementRef, className: string, isAdd: boolean): void;
setElementStyle(location: RenderElementRef, styleName: string, styleValue: string): void;
invokeElementMethod(location: RenderElementRef, methodName: string, args: List<any>): void;
setText(viewRef: RenderViewRef, textNodeIndex: number, text: string): void;
setEventDispatcher(viewRef: RenderViewRef, dispatcher: any): void;
encapsulation: ViewEncapsulation;
}
const DOCUMENT_TOKEN : OpaqueToken ;
@@ -6283,6 +6459,84 @@ declare module ng {
const DOM_REFLECT_PROPERTIES_AS_ATTRIBUTES : OpaqueToken ;
/**
* Defines when a compiled template should be stored as a string
* rather than keeping its Nodes to preserve memory.
*/
const MAX_IN_MEMORY_ELEMENTS_PER_TEMPLATE_TOKEN : OpaqueToken ;
/**
* Create trace scope.
*
* Scopes must be strictly nested and are analogous to stack frames, but
* do not have to follow the stack frames. Instead it is recommended that they follow logical
* nesting. You may want to use
* [Event
* Signatures](http://google.github.io/tracing-framework/instrumenting-code.html#custom-events)
* as they are defined in WTF.
*
* Used to mark scope entry. The return value is used to leave the scope.
*
* final myScope = wtfCreateScope('MyClass#myMethod(ascii someVal)');
*
* someMethod() {
* var s = myScope('Foo'); // 'Foo' gets stored in tracing UI
* // DO SOME WORK HERE
* return wtfLeave(s, 123); // Return value 123
* }
*
* Note, adding try-finally block around the work to ensure that `wtfLeave` gets called can
* negatively impact the performance of your application. For this reason we recommend that
* you don't add them to ensure that `wtfLeave` gets called. In production `wtfLeave` is a noop and
* so try-finally block has no value. When debugging perf issues, skipping `wtfLeave`, do to
* exception, will produce incorrect trace, but presence of exception signifies logic error which
* needs to be fixed before the app should be profiled. Add try-finally only when you expect that
* an exception is expected during normal execution while profiling.
*/
var wtfCreateScope : WtfScopeFn ;
/**
* Used to mark end of Scope.
*
* - `scope` to end.
* - `returnValue` (optional) to be passed to the WTF.
*
* Returns the `returnValue for easy chaining.
*/
var wtfLeave : <T>(scope: any, returnValue?: T) => T ;
/**
* Used to mark Async start. Async are similar to scope but they don't have to be strictly nested.
* The return value is used in the call to [endAsync]. Async ranges only work if WTF has been
* enabled.
*
* someMethod() {
* var s = wtfStartTimeRange('HTTP:GET', 'some.url');
* var future = new Future.delay(5).then((_) {
* wtfEndTimeRange(s);
* });
* }
*/
var wtfStartTimeRange : (rangeType: string, action: string) => any ;
/**
* Ends a async time range operation.
* [range] is the return value from [wtfStartTimeRange] Async ranges only work if WTF has been
* enabled.
*/
var wtfEndTimeRange : (range: any) => void ;
interface WtfScopeFn {
(arg0?: any, arg1?: any): any;
}
var ChangeDetectorRef: InjectableReference;
var ApplicationRef: InjectableReference;
@@ -6303,8 +6557,8 @@ declare module ng {
}
declare module "angular2/angular2" {
export = ng;
}
+469
View File
@@ -0,0 +1,469 @@
// Type definitions for Angular v2.0.0-alpha.34
// Project: http://angular.io/
// Definitions by: angular team <https://github.com/angular/>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
// ***********************************************************
// This file is generated by the Angular build process.
// Please do not create manual edits or send pull requests
// modifying this file.
// ***********************************************************
///<reference path="./angular2-2.0.0-alpha.34.d.ts"/>
/**
* @module
* @description
* Maps application URLs into application states, to support deep-linking and navigation.
*/
declare module ng {
/**
* # Router
* The router is responsible for mapping URLs to components.
*
* You can see the state of the router by inspecting the read-only field `router.navigating`.
* This may be useful for showing a spinner, for instance.
*
* ## Concepts
* Routers and component instances have a 1:1 correspondence.
*
* The router holds reference to a number of "outlets." An outlet is a placeholder that the
* router dynamically fills in depending on the current URL.
*
* When the router navigates from a URL, it must first recognizes it and serialize it into an
* `Instruction`.
* The router uses the `RouteRegistry` to get an `Instruction`.
*/
class Router {
navigating: boolean;
lastNavigationAttempt: string;
registry: RouteRegistry;
parent: Router;
hostComponent: any;
/**
* Constructs a child router. You probably don't need to use this unless you're writing a reusable
* component.
*/
childRouter(hostComponent: any): Router;
/**
* Register an object to notify of route changes. You probably don't need to use this unless
* you're writing a reusable component.
*/
registerOutlet(outlet: RouterOutlet): Promise<boolean>;
/**
* Dynamically update the routing configuration and trigger a navigation.
*
* # Usage
*
* ```
* router.config([
* { 'path': '/', 'component': IndexComp },
* { 'path': '/user/:id', 'component': UserComp },
* ]);
* ```
*/
config(definitions: List<RouteDefinition>): Promise<any>;
/**
* Navigate to a URL. Returns a promise that resolves when navigation is complete.
*
* If the given URL begins with a `/`, router will navigate absolutely.
* If the given URL does not begin with `/`, the router will navigate relative to this component.
*/
navigate(url: string, _skipLocationChange?: boolean): Promise<any>;
/**
* Updates this router and all descendant routers according to the given instruction
*/
commit(instruction: Instruction, _skipLocationChange?: boolean): Promise<any>;
/**
* Subscribe to URL updates from the router
*/
subscribe(onNext: (value: any) => void): void;
/**
* Removes the contents of this router's outlet and all descendant outlets
*/
deactivate(instruction: Instruction): Promise<any>;
/**
* Given a URL, returns an instruction representing the component graph
*/
recognize(url: string): Promise<Instruction>;
/**
* Navigates to either the last URL successfully navigated to, or the last URL requested if the
* router has yet to successfully navigate.
*/
renavigate(): Promise<any>;
/**
* Generate a URL from a component name and optional map of parameters. The URL is relative to the
* app's base href.
*/
generate(linkParams: List<any>): string;
}
class RootRouter extends Router {
commit(instruction: Instruction, _skipLocationChange?: boolean): Promise<any>;
}
/**
* A router outlet is a placeholder that Angular dynamically fills based on the application's route.
*
* ## Use
*
* ```
* <router-outlet></router-outlet>
* ```
*/
class RouterOutlet {
childRouter: Router;
/**
* Given an instruction, update the contents of this outlet.
*/
commit(instruction: Instruction): Promise<any>;
/**
* Called by Router during recognition phase
*/
canDeactivate(nextInstruction: Instruction): Promise<boolean>;
/**
* Called by Router during recognition phase
*/
canReuse(nextInstruction: Instruction): Promise<boolean>;
deactivate(nextInstruction: Instruction): Promise<any>;
}
/**
* The RouterLink directive lets you link to specific parts of your app.
*
* Consider the following route configuration:
*
* ```
* @RouteConfig([
* { path: '/user', component: UserCmp, as: 'user' }
* ]);
* class MyComp {}
* ```
*
* When linking to this `user` route, you can write:
*
* ```
* <a [router-link]="['./user']">link to user component</a>
* ```
*
* RouterLink expects the value to be an array of route names, followed by the params
* for that level of routing. For instance `['/team', {teamId: 1}, 'user', {userId: 2}]`
* means that we want to generate a link for the `team` route with params `{teamId: 1}`,
* and with a child route `user` with params `{userId: 2}`.
*
* The first route name should be prepended with `/`, `./`, or `../`.
* If the route begins with `/`, the router will look up the route from the root of the app.
* If the route begins with `./`, the router will instead look in the current component's
* children for the route. And if the route begins with `../`, the router will look at the
* current component's parent.
*/
class RouterLink {
visibleHref: string;
routeParams: void;
onClick(): boolean;
}
class RouteParams {
params: StringMap<string, string>;
get(param: string): string;
}
/**
* The RouteRegistry holds route configurations for each component in an Angular app.
* It is responsible for creating Instructions from URLs, and generating URLs based on route and
* parameters.
*/
class RouteRegistry {
/**
* Given a component and a configuration object, add the route to this registry
*/
config(parentComponent: any, config: RouteDefinition, isRootLevelRoute?: boolean): void;
/**
* Reads the annotations of a component and configures the registry based on them
*/
configFromComponent(component: any, isRootComponent?: boolean): void;
/**
* Given a URL and a parent component, return the most specific instruction for navigating
* the application into the state specified by the url
*/
recognize(url: string, parentComponent: any): Promise<Instruction>;
/**
* Given a normalized list with component names and params like: `['user', {id: 3 }]`
* generates a url with a leading slash relative to the provided `parentComponent`.
*/
generate(linkParams: List<any>, parentComponent: any): string;
}
class LocationStrategy {
path(): string;
pushState(ctx: any, title: string, url: string): void;
forward(): void;
back(): void;
onPopState(fn: (_: any) => any): void;
getBaseHref(): string;
}
class HashLocationStrategy extends LocationStrategy {
onPopState(fn: EventListener): void;
getBaseHref(): string;
path(): string;
pushState(state: any, title: string, url: string): void;
forward(): void;
back(): void;
}
class HTML5LocationStrategy extends LocationStrategy {
onPopState(fn: EventListener): void;
getBaseHref(): string;
path(): string;
pushState(state: any, title: string, url: string): void;
forward(): void;
back(): void;
}
/**
* This is the service that an application developer will directly interact with.
*
* Responsible for normalizing the URL against the application's base href.
* A normalized URL is absolute from the URL host, includes the application's base href, and has no
* trailing slash:
* - `/my/app/user/123` is normalized
* - `my/app/user/123` **is not** normalized
* - `/my/app/user/123/` **is not** normalized
*/
class Location {
path(): string;
normalize(url: string): string;
normalizeAbsolutely(url: string): string;
go(url: string): void;
forward(): void;
back(): void;
subscribe(onNext: (value: any) => void, onThrow?: (exception: any) => void, onReturn?: () => void): void;
}
const appBaseHrefToken : OpaqueToken ;
/**
* Responsible for performing each step of navigation.
* "Steps" are conceptually similar to "middleware"
*/
class Pipeline {
steps: List<Function>;
process(instruction: Instruction): Promise<any>;
}
/**
* Defines route lifecycle method [onActivate]
*/
interface OnActivate {
onActivate(nextInstruction: Instruction, prevInstruction: Instruction): any;
}
/**
* Defines route lifecycle method [onDeactivate]
*/
interface OnDeactivate {
onDeactivate(nextInstruction: Instruction, prevInstruction: Instruction): any;
}
/**
* Defines route lifecycle method [onReuse]
*/
interface OnReuse {
onReuse(nextInstruction: Instruction, prevInstruction: Instruction): any;
}
/**
* Defines route lifecycle method [canDeactivate]
*/
interface CanDeactivate {
canDeactivate(nextInstruction: Instruction, prevInstruction: Instruction): any;
}
/**
* Defines route lifecycle method [canReuse]
*/
interface CanReuse {
canReuse(nextInstruction: Instruction, prevInstruction: Instruction): any;
}
var CanActivate : (hook: (next: Instruction, prev: Instruction) => Promise<boolean>| boolean) => ClassDecorator ;
/**
* An `Instruction` represents the component hierarchy of the application based on a given route
*/
class Instruction {
accumulatedUrl: string;
reuse: boolean;
specificity: number;
component: any;
capturedUrl: string;
child: Instruction;
params(): StringMap<string, string>;
}
const routerDirectives : List<any> ;
var routerInjectables : List<any> ;
class Route implements RouteDefinition {
path: string;
component: Type;
as: string;
loader: Function;
redirectTo: string;
}
class Redirect implements RouteDefinition {
path: string;
redirectTo: string;
as: string;
}
class AsyncRoute implements RouteDefinition {
path: string;
loader: Function;
as: string;
}
interface RouteDefinition {
path: string;
component?: Type | ComponentDefinition;
loader?: Function;
redirectTo?: string;
as?: string;
}
var RouteConfig : (configs: List<RouteDefinition>) => ClassDecorator ;
interface ComponentDefinition {
type: string;
loader?: Function;
component?: Type;
}
}
declare module "angular2/router" {
export = ng;
}
+191 -181
View File
@@ -1,4 +1,4 @@
// Type definitions for Angular v2.0.0-alpha.31
// Type definitions for Angular v2.0.0-alpha.34
// Project: http://angular.io/
// Definitions by: angular team <https://github.com/angular/>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
@@ -18,120 +18,56 @@
* Maps application URLs into application states, to support deep-linking and navigation.
*/
declare module ng {
interface List<T> extends Array<T> {}
interface Map<K,V> {}
interface StringMap<K,V> extends Map<K,V> {}
export class Instruction {
// "capturedUrl" is the part of the URL captured by this instruction
// "accumulatedUrl" is the part of the URL captured by this instruction and all children
accumulatedUrl: string;
reuse: boolean;
specificity: number;
private _params: StringMap<string, string>;
constructor (component: any, capturedUrl: string,
_recognizer: PathRecognizer, child: Instruction);
params(): StringMap<string, string>;
}
class TouchMap {
map: StringMap<string, string>;
keys: StringMap<string, boolean>;
constructor(map: StringMap<string, any>);
get(key: string): string;
getUnused(): StringMap<string, any>;
}
export class Segment {
name: string;
regex: string;
generate(params: TouchMap): string;
}
export class PathRecognizer {
segments: List<Segment>;
regex: RegExp;
specificity: number;
terminal: boolean;
path: string;
handler: RouteHandler;
constructor(path: string, handler: RouteHandler);
parseParams(url: string): StringMap<string, string>;
generate(params: StringMap<string, any>): string;
resolveComponentType(): Promise<any>;
}
export interface RouteHandler {
componentType: Function;
resolveComponentType(): Promise<any>;
}
/**
* # Router
* The router is responsible for mapping URLs to components.
*
*
* You can see the state of the router by inspecting the read-only field `router.navigating`.
* This may be useful for showing a spinner, for instance.
*
*
* ## Concepts
* Routers and component instances have a 1:1 correspondence.
*
*
* The router holds reference to a number of "outlets." An outlet is a placeholder that the
* router dynamically fills in depending on the current URL.
*
*
* When the router navigates from a URL, it must first recognizes it and serialize it into an
* `Instruction`.
* The router uses the `RouteRegistry` to get an `Instruction`.
*/
class Router {
navigating: boolean;
lastNavigationAttempt: string;
registry: RouteRegistry;
parent: Router;
hostComponent: any;
/**
* Constructs a child router. You probably don't need to use this unless you're writing a reusable
* component.
*/
childRouter(hostComponent: any): Router;
/**
* Register an object to notify of route changes. You probably don't need to use this unless
* you're writing a reusable component.
*/
registerOutlet(outlet: RouterOutlet): Promise<boolean>;
/**
* Dynamically update the routing configuration and trigger a navigation.
*
*
* # Usage
*
* ```
* router.config({ 'path': '/', 'component': IndexCmp});
* ```
*
* Or:
*
*
* ```
* router.config([
* { 'path': '/', 'component': IndexComp },
@@ -139,48 +75,48 @@ declare module ng {
* ]);
* ```
*/
config(config: StringMap<string, any>| List<StringMap<string, any>>): Promise<any>;
config(definitions: List<RouteDefinition>): Promise<any>;
/**
* Navigate to a URL. Returns a promise that resolves when navigation is complete.
*
*
* If the given URL begins with a `/`, router will navigate absolutely.
* If the given URL does not begin with `/`, the router will navigate relative to this component.
*/
navigate(url: string): Promise<any>;
navigate(url: string, _skipLocationChange?: boolean): Promise<any>;
/**
* Updates this router and all descendant routers according to the given instruction
*/
commit(instruction: Instruction): Promise<any>;
commit(instruction: Instruction, _skipLocationChange?: boolean): Promise<any>;
/**
* Subscribe to URL updates from the router
*/
subscribe(onNext: any): void;
subscribe(onNext: (value: any) => void): void;
/**
* Removes the contents of this router's outlet and all descendant outlets
*/
deactivate(instruction: Instruction): Promise<any>;
/**
* Given a URL, returns an instruction representing the component graph
*/
recognize(url: string): Promise<Instruction>;
/**
* Navigates to either the last URL successfully navigated to, or the last URL requested if the
* router has yet to successfully navigate.
*/
renavigate(): Promise<any>;
/**
* Generate a URL from a component name and optional map of parameters. The URL is relative to the
@@ -188,71 +124,71 @@ declare module ng {
*/
generate(linkParams: List<any>): string;
}
class RootRouter extends Router {
commit(instruction: any): Promise<any>;
commit(instruction: Instruction, _skipLocationChange?: boolean): Promise<any>;
}
/**
* A router outlet is a placeholder that Angular dynamically fills based on the application's route.
*
*
* ## Use
*
*
* ```
* <router-outlet></router-outlet>
* ```
*/
class RouterOutlet {
childRouter: Router;
/**
* Given an instruction, update the contents of this outlet.
*/
commit(instruction: Instruction): Promise<any>;
/**
* Called by Router during recognition phase
*/
canDeactivate(nextInstruction: Instruction): Promise<boolean>;
/**
* Called by Router during recognition phase
*/
canReuse(nextInstruction: Instruction): Promise<boolean>;
deactivate(nextInstruction: Instruction): Promise<any>;
}
/**
* The RouterLink directive lets you link to specific parts of your app.
*
*
* Consider the following route configuration:
*
*
* ```
* @RouteConfig({
* path: '/user', component: UserCmp, as: 'user'
* });
* @RouteConfig([
* { path: '/user', component: UserCmp, as: 'user' }
* ]);
* class MyComp {}
* ```
*
*
* When linking to this `user` route, you can write:
*
*
* ```
* <a [router-link]="['./user']">link to user component</a>
* ```
*
*
* RouterLink expects the value to be an array of route names, followed by the params
* for that level of routing. For instance `['/team', {teamId: 1}, 'user', {userId: 2}]`
* means that we want to generate a link for the `team` route with params `{teamId: 1}`,
* and with a child route `user` with params `{userId: 2}`.
*
*
* The first route name should be prepended with `/`, `./`, or `../`.
* If the route begins with `/`, the router will look up the route from the root of the app.
* If the route begins with `./`, the router will instead look in the current component's
@@ -260,21 +196,21 @@ declare module ng {
* current component's parent.
*/
class RouterLink {
visibleHref: string;
routeParams: void;
onClick(): boolean;
}
class RouteParams {
params: StringMap<string, string>;
get(param: string): string;
}
/**
* The RouteRegistry holds route configurations for each component in an Angular app.
@@ -282,26 +218,26 @@ declare module ng {
* parameters.
*/
class RouteRegistry {
/**
* Given a component and a configuration object, add the route to this registry
*/
config(parentComponent: any, config: StringMap<string, any>): void;
config(parentComponent: any, config: RouteDefinition, isRootLevelRoute?: boolean): void;
/**
* Reads the annotations of a component and configures the registry based on them
*/
configFromComponent(component: any): void;
configFromComponent(component: any, isRootComponent?: boolean): void;
/**
* Given a URL and a parent component, return the most specific instruction for navigating
* the application into the state specified by the url
*/
recognize(url: string, parentComponent: any): Promise<Instruction>;
/**
* Given a normalized list with component names and params like: `['user', {id: 3 }]`
@@ -309,56 +245,56 @@ declare module ng {
*/
generate(linkParams: List<any>, parentComponent: any): string;
}
class LocationStrategy {
path(): string;
pushState(ctx: any, title: string, url: string): void;
forward(): void;
back(): void;
onPopState(fn: any): void;
onPopState(fn: (_: any) => any): void;
getBaseHref(): string;
}
class HashLocationStrategy extends LocationStrategy {
onPopState(fn: EventListener): void;
getBaseHref(): string;
path(): string;
pushState(state: any, title: string, url: string): void;
forward(): void;
back(): void;
}
class HTML5LocationStrategy extends LocationStrategy {
onPopState(fn: EventListener): void;
getBaseHref(): string;
path(): string;
pushState(state: any, title: string, url: string): void;
forward(): void;
back(): void;
}
/**
* This is the service that an application developer will directly interact with.
*
*
* Responsible for normalizing the URL against the application's base href.
* A normalized URL is absolute from the URL host, includes the application's base href, and has no
* trailing slash:
@@ -367,93 +303,167 @@ declare module ng {
* - `/my/app/user/123/` **is not** normalized
*/
class Location {
path(): string;
normalize(url: string): string;
normalizeAbsolutely(url: string): string;
go(url: string): void;
forward(): void;
back(): void;
subscribe(onNext: any, onThrow?: any, onReturn?: any): void;
subscribe(onNext: (value: any) => void, onThrow?: (exception: any) => void, onReturn?: () => void): void;
}
var appBaseHrefToken : OpaqueToken ;
const appBaseHrefToken : OpaqueToken ;
/**
* Responsible for performing each step of navigation.
* "Steps" are conceptually similar to "middleware"
*/
class Pipeline {
steps: List<Function>;
process(instruction: Instruction): Promise<any>;
}
/**
* Defines route lifecycle method [onActivate]
*/
interface OnActivate {
onActivate(nextInstruction: Instruction, prevInstruction: Instruction): any;
}
/**
* Defines route lifecycle method [onDeactivate]
*/
interface OnDeactivate {
onDeactivate(nextInstruction: Instruction, prevInstruction: Instruction): any;
}
/**
* Defines route lifecycle method [onReuse]
*/
interface OnReuse {
onReuse(nextInstruction: Instruction, prevInstruction: Instruction): any;
}
/**
* Defines route lifecycle method [canDeactivate]
*/
interface CanDeactivate {
canDeactivate(nextInstruction: Instruction, prevInstruction: Instruction): any;
}
/**
* Defines route lifecycle method [canReuse]
*/
interface CanReuse {
canReuse(nextInstruction: Instruction, prevInstruction: Instruction): any;
}
var CanActivate : (hook: (next: Instruction, prev: Instruction) => Promise<boolean>| boolean) => ClassDecorator ;
var CanActivate:any;
var routerDirectives : List<any> ;
/**
* An `Instruction` represents the component hierarchy of the application based on a given route
*/
class Instruction {
accumulatedUrl: string;
reuse: boolean;
specificity: number;
component: any;
capturedUrl: string;
child: Instruction;
params(): StringMap<string, string>;
}
const routerDirectives : List<any> ;
var routerInjectables : List<any> ;
var RouteConfig:any;
class Route implements RouteDefinition {
path: string;
component: Type;
as: string;
loader: Function;
redirectTo: string;
}
class Redirect implements RouteDefinition {
path: string;
redirectTo: string;
as: string;
}
class AsyncRoute implements RouteDefinition {
path: string;
loader: Function;
as: string;
}
interface RouteDefinition {
path: string;
component?: Type | ComponentDefinition;
loader?: Function;
redirectTo?: string;
as?: string;
}
var RouteConfig : (configs: List<RouteDefinition>) => ClassDecorator ;
interface ComponentDefinition {
type: string;
loader?: Function;
component?: Type;
}
}
declare module "angular2/router" {
export = ng;
}
+12
View File
@@ -242,6 +242,18 @@ foo.then((x) => {
x.toFixed();
});
// $q signature tests
module TestQ {
var $q: ng.IQService;
var promise1: ng.IPromise<any>;
var promise2: ng.IPromise<any>;
// $q.all
$q.all([promise1, promise2]).then((results: any[]) => {});
$q.all<number>([promise1, promise2]).then((results: number[]) => {});
$q.all({a: promise1, b: promise2}).then((results: {[id: string]: any;}) => {});
$q.all<{a: number; b: string;}>({a: promise1, b: promise2}).then((results: {a: number; b: string;}) => {});
}
var httpFoo: ng.IHttpPromise<number>;
httpFoo.then((x) => {
+2 -1
View File
@@ -1006,7 +1006,7 @@ declare module angular {
*
* @param promises An array of promises.
*/
all(promises: IPromise<any>[]): IPromise<any[]>;
all<T>(promises: IPromise<any>[]): IPromise<T[]>;
/**
* Combines multiple promises into a single promise that is resolved when all of the input promises are resolved.
*
@@ -1015,6 +1015,7 @@ declare module angular {
* @param promises A hash of promises.
*/
all(promises: { [id: string]: IPromise<any>; }): IPromise<{ [id: string]: any; }>;
all<T extends {}>(promises: { [id: string]: IPromise<any>; }): IPromise<T>;
/**
* Creates a Deferred object which represents a task which will finish in the future.
*/
@@ -1 +0,0 @@
+1 -1
View File
@@ -6,7 +6,7 @@
/// <reference path="../express/express.d.ts" />
declare module "body-parser" {
import express = require('express');
import * as express from "express";
/**
* bodyParser: use individual json/urlencoded middlewares
+2 -1
View File
@@ -6,7 +6,8 @@
/// <reference path="../node/node.d.ts" />
declare module Boom {
interface BoomError {
export interface BoomError {
data: any;
reformat: () => void;
isBoom: boolean;
+1 -2
View File
@@ -27,14 +27,12 @@ bootbox.prompt("Enter 'ok' to pass test", function (result) {
console.log(result);
});
bootbox.prompt({
title: "Wassup?",
message: "Enter 'ok' to pass test", callback: function (result) {
console.log(result);
}
});
bootbox.prompt({
size: "large",
title: "Wassup?",
message: "Enter 'ok' to pass test", callback: function (result) {
console.log(result);
}
@@ -42,6 +40,7 @@ bootbox.prompt({
bootbox.dialog({
title: "Wassup?",
message: "Test Dialog",
callback: function (result) { }
});
+111 -101
View File
@@ -16,7 +16,6 @@ var nodeName = divTag2[0].nodeName;
var version = $.version;
var libraryName = $.libraryName;
var els = $('li');
var listItems = $.slice(els);
var madeEls = $.make('<p>Stuff</p>');
var moreEls = $.html('<p>Stuff</p>');
var oldTag = $('#oldTag');
@@ -241,108 +240,119 @@ var myPromise = new Promise(function(resolve, reject) {
myPromise.then(function(value) {
// Success:
console.log(value);
},
// Opps! There was a problem:
function(reason) {
console.log(reason);
});
},
// Opps! There was a problem:
function(reason) {
console.log(reason);
});
// Ajax:
$.ajax({
url: "announcement.html",
dataType: "html",
success: function(data) {
// Insert the fragment into the page:
$("#content").html(data);
},
error: function(data) {
$("#content").html("<h4>There was an error while trying to get the file.</h4>");
}
// Fetch API
//===========
// GET:
interface WineObject {
data: Array<WineInterface>;
}
interface WineInterface {
wine: {
name: string;
}
}
fetch('../data/wines.json')
.then($.json)
.then(function<WineObject>(obj: any):any {
$('#message_ajax').empty();
obj.data.forEach(function(wine: any) {
$('#message_ajax').append('<li>' + wine.name + '</li>');
})
});
$.ajax({
url: "me.json",
success: function(data) {
// Before using a JSON object, you need to parse it.
// Here we parse it and assign it to a variable:
var me = JSON.parse(data);
// Here we access the properties of the JSON object:
$("#content").html(me.firstName + " " + me.lastName);
},
error: function(data) {
$('#content').html("<h4>There was an error while trying to get the file.</h4>");
}
});
var myData = {
"name": "Bozo the Clown",
"occupation": "Clown"
};
var mySuccessCallback = function() {
console.log('The post was a success!');
};
var myErrorCallback = function() {
console.log('Ooops! There was a problem posting this.');
};
$.ajax({
url: "/path/to/controller",
method: 'POST',
headers: {
"Content-Type": "application/x-www-form-urlencoded",
"async": true,
"Access-Control-Allow-Origin": "*",
"Accept": "text/plain"
},
data: myData,
success: mySuccessCallback,
error: myErrorCallback
});
$.get('http://my.com/data/stuff.html')
.then(function(response) {
console.log("Success!", response);
}, function(error) {
console.error("Failed!", error);
});
$.get('http://my.com/data/stuff.html')
.then(function(response) {
console.log("Success!", response);
})
.catch(function(error) {
console.error("Failed!", error);
});
$.get('story.json')
.then(JSON.parse)
.then(function(response) {
console.log("Yey JSON!", response);
});
$.getJSON('/data/deserts.json', function(desserts: Array<any>) {
desserts.forEach(function(dessert) {
$('#deserts').append('<li>' + dessert.name + '</li>');
});
});
$.post("updateUser.php",
{ "name": "Joe", "time": "10PM" },
function() {
console.log('The POST was successful.')
},
"json"
);
$.JSONP({ url: 'https://api.github.com/users/yui?callback=?' })
.then(function(users) {
$('.list').append('<li><h3>The name of the library</h3><h4>' + users.data.name + '</h4></li>');
})
.catch(function(err) {
console.log('Unable to get data.')
});
$.JSONP({
url: 'http://www.geonames.org/postalCodeLookupJSON?postalcode=94102&'
// POST:
interface postData {
email: string;
name: string;
msg: string;
}
var formData = $.serialize($('form')[0]);
fetch('../controllers/php-post.php', {
method: 'post',
headers: {
"Content-type": "application/x-www-form-urlencoded; charset=UTF-8"
},
body: formData
})
.then(function(data) {
$('.list').append('<li><h3>My Location</h3><h4>' + data.postalcodes[0].adminName2 + ', ' + data.postalcodes[0].adminName1 + '</h4></li>');
})
.catch(function(err) {
console.log('Unable to get data.')
});
.then($.json)
.then(function<postData>(data: any): any {
if(data.email_check == "valid"){
$("#message_ajax").html("<div class='successMessage'>" + data.email + " is a valid e-mail address. Thank you, " + data.name + ".</div>");
$("#message_ajax").append('<p>' + data.msg + '</p>');
} else {
$("#message_ajax").html("<div class='errorMessage'>Sorry " + data.name + ", " + data.email + " is NOT a valid e-mail address. Try again.</div>");
}
});
// PUT:
interface putData {
base: string;
result: string;
fileName: string;
}
var putData = $('#fileText').val();
fetch('../controllers/php-put.php', {
method: 'put',
headers: {
"Content-type": "application/x-www-form-urlencoded; charset=UTF-8"
},
body: putData
})
.then($.json)
.then(function<putData>(data:any): any {
console.dir(data.base);
$("#message_ajax").append('<p>' + data.result + '</p>');
$("#message_ajax").append('<p>The file name is: ' + data.fileName + '</p>');
})
.catch(function(error:Error) {
console.log(error);
$("#message_ajax").html("<div class='errorMessage'>Sorry, put was not successful.</div>");
});
// DELETE:
interface deleteData {
result: string;
}
var file = $('#fileName').val();
fetch('../controllers/php-delete.php', {
method: 'delete',
headers: {
"Content-type": "application/x-www-form-urlencoded; charset=UTF-8"
},
body: file
})
.then($.json)
.then(function<deleteData>(data: any): any {
$("#message_ajax").html("<div>DELETE was sent to the server successfully.</div>");
$("#message_ajax").append('<p>' + data.result + '</p>');
},
function(data: any) {
console.log('PROBLEM')
console.log(data);
})
.catch(function(error: any) {
$("#message_ajax").html("<div class='errorMessage'>Sorry, 'DELETE' was not successful.</div>");
error.reject();
});
// $.jsonp:
$.jsonp('https://api.github.com/users/rbiggs/repos?name=chipper', {timeout: 10000})
.then($.json)
.then(function(obj: any): any {
console.log(obj);
obj.data.forEach(function(repo: any): any {
$('#message_ajax').append("<li>" + repo.name + "</li>");
});
})
.catch(function(error: any): any {
$('#message_ajax').append("<li>" + error.message + "</li>")
});
// Templates:
var myTemplate = '<li>Name: [[= data.name]]</li>';
@@ -376,10 +386,10 @@ var repeaterTmplate2 = '<li>[[= data.firstName ]], [[= data.lastName]]</li>';
$.template.repeater($('#objectArrayList'), repeaterTmplate2, luminaries.persons);
// Pub/Sub:
var arraySubscriber = function(topic: string, data: any) {
var arraySubscriber = function(topic: string, data: any): any {
$('.list').append('<li><h3>' + topic + '</h3><h4>' + data + '</h4></li>');
var newsSubscription = $.subscribe('news/update', arraySubscriber);
};
var newsSubscription = $.subscribe('news/update', arraySubscriber);
$.publish('news/update', 'The New York Stock Exchange rose an unprecedented 1000 points in just three minutes. Analysts and investors are confused and uncertain how to respond.');
$.unsubscribe('news/update');
// Due to being unsubscribed above, this does nothing:
+1333 -1328
View File
File diff suppressed because it is too large Load Diff
+75 -71
View File
@@ -326,15 +326,15 @@ declare module CodeMirror {
/** Fires every time the content of the editor is changed. */
on(eventName: 'change', handler: (instance: CodeMirror.Editor, change: CodeMirror.EditorChangeLinkedList) => void ): void;
off(eventName: 'change', handler: (instance: CodeMirror.Editor, change: CodeMirror.EditorChangeLinkedList) => void ): void;
/** Like the "change" event, but batched per operation, passing an
* array containing all the changes that happened in the operation.
* This event is fired after the operation finished, and display
* changes it makes will trigger a new operation. */
/** Like the "change" event, but batched per operation, passing an
* array containing all the changes that happened in the operation.
* This event is fired after the operation finished, and display
* changes it makes will trigger a new operation. */
on(eventName: 'changes', handler: (instance: CodeMirror.Editor, change: CodeMirror.EditorChangeLinkedList[]) => void ): void;
off(eventName: 'changes', handler: (instance: CodeMirror.Editor, change: CodeMirror.EditorChangeLinkedList[]) => void ): void;
/** This event is fired before a change is applied, and its handler may choose to modify or cancel the change.
/** This event is fired before a change is applied, and its handler may choose to modify or cancel the change.
The changeObj never has a next property, since this is fired for each individual change, and not batched per operation.
Note: you may not do anything from a "beforeChange" handler that would cause changes to the document or its visualization.
Doing so will, since this handler is called directly from the bowels of the CodeMirror implementation,
@@ -471,6 +471,10 @@ declare module CodeMirror {
It may be "start" , "end" , "head"(the side of the selection that moves when you press shift + arrow),
or "anchor"(the fixed side of the selection).Omitting the argument is the same as passing "head".A { line , ch } object will be returned. */
getCursor(start?: string): CodeMirror.Position;
/** Retrieves a list of all current selections. These will always be sorted, and never overlap (overlapping selections are merged).
Each object in the array contains anchor and head properties referring to {line, ch} objects. */
listSelections(): { anchor: CodeMirror.Position; head: CodeMirror.Position }[];
/** Return true if any text is selected. */
somethingSelected(): boolean;
@@ -612,7 +616,7 @@ declare module CodeMirror {
/** Array of strings representing the text that replaced the changed range (split by line). */
text: string[];
/** Text that used to be between from and to, which is overwritten by this change. */
removed: string[];
removed: string[];
/** String representing the origin of the change event and wether it can be merged with history */
origin: string;
}
@@ -780,9 +784,9 @@ declare module CodeMirror {
This affects the amount of updates needed when scrolling, and the amount of work that such an update does.
You should usually leave it at its default, 10. Can be set to Infinity to make sure the whole document is always rendered,
and thus the browser's text search works on it. This will have bad effects on performance of big documents. */
viewportMargin?: number;
/** Optional lint configuration to be used in conjunction with CodeMirror's linter addon. */
viewportMargin?: number;
/** Optional lint configuration to be used in conjunction with CodeMirror's linter addon. */
lint?: LintOptions;
}
@@ -796,8 +800,8 @@ declare module CodeMirror {
/** Like inclusiveLeft , but for the right side. */
inclusiveRight?: boolean;
/** Atomic ranges act as a single unit when cursor movement is concerned — i.e. it is impossible to place the cursor inside of them.
In atomic ranges, inclusiveLeft and inclusiveRight have a different meaning — they will prevent the cursor from being placed
/** Atomic ranges act as a single unit when cursor movement is concerned — i.e. it is impossible to place the cursor inside of them.
In atomic ranges, inclusiveLeft and inclusiveRight have a different meaning — they will prevent the cursor from being placed
respectively directly before and directly after the range. */
atomic?: boolean;
@@ -808,19 +812,19 @@ declare module CodeMirror {
This is mostly useful for text - replacement widgets that need to 'snap open' when the user tries to edit them.
The "clear" event fired on the range handle can be used to be notified when this happens. */
clearOnEnter?: boolean;
/** Determines whether the mark is automatically cleared when it becomes empty. Default is true. */
clearWhenEmpty?: boolean;
/** Determines whether the mark is automatically cleared when it becomes empty. Default is true. */
clearWhenEmpty?: boolean;
/** Use a given node to display this range.Implies both collapsed and atomic.
The given DOM node must be an inline element(as opposed to a block element). */
replacedWith?: HTMLElement;
/** When replacedWith is given, this determines whether the editor will
* capture mouse and drag events occurring in this widget. Default is
* false—the events will be left alone for the default browser handler,
* or specific handlers on the widget, to capture. */
handleMouseEvents?: boolean;
/** When replacedWith is given, this determines whether the editor will
* capture mouse and drag events occurring in this widget. Default is
* false—the events will be left alone for the default browser handler,
* or specific handlers on the widget, to capture. */
handleMouseEvents?: boolean;
/** A read - only span can, as long as it is not cleared, not be modified except by calling setValue to reset the whole document.
Note: adding a read - only span currently clears the undo history of the editor,
@@ -835,12 +839,12 @@ declare module CodeMirror {
/** Equivalent to startStyle, but for the rightmost span. */
endStyle?: string;
/** A string of CSS to be applied to the covered text. For example "color: #fe3". */
css?: string;
/** When given, will give the nodes created for this span a HTML title attribute with the given value. */
title?: string;
/** A string of CSS to be applied to the covered text. For example "color: #fe3". */
css?: string;
/** When given, will give the nodes created for this span a HTML title attribute with the given value. */
title?: string;
/** When the target document is linked to other documents, you can set shared to true to make the marker appear in all documents.
By default, a marker appears only in its target document. */
@@ -1041,48 +1045,48 @@ declare module CodeMirror {
* Both modes get to parse all of the text, but when both assign a non-null style to a piece of code, the overlay wins, unless
* the combine argument was true and not overridden, or state.overlay.combineTokens was true, in which case the styles are combined.
*/
function overlayMode<T, S>(base: Mode<T>, overlay: Mode<S>, combine?: boolean): Mode<any>
/**
* async specifies that the lint process runs asynchronously. hasGutters specifies that lint errors should be displayed in the CodeMirror
* gutter, note that you must use this in conjunction with [ "CodeMirror-lint-markers" ] as an element in the gutters argument on
* initialization of the CodeMirror instance.
*/
interface LintStateOptions {
async: boolean;
hasGutters: boolean;
}
/**
* Adds the getAnnotations callback to LintStateOptions which may be overridden by the user if they choose use their own
* linter.
*/
interface LintOptions extends LintStateOptions {
getAnnotations: AnnotationsCallback;
}
/**
* A function that calls the updateLintingCallback with any errors found during the linting process.
*/
interface AnnotationsCallback {
(content: string, updateLintingCallback: UpdateLintingCallback, options: LintStateOptions, codeMirror: Editor): void;
}
/**
* A function that, given an array of annotations, updates the CodeMirror linting GUI with those annotations
*/
interface UpdateLintingCallback {
(codeMirror: Editor, annotations: Annotation[]): void;
}
/**
* An annotation contains a description of a lint error, detailing the location of the error within the code, the severity of the error,
* and an explaination as to why the error was thrown.
*/
interface Annotation {
from: Position;
message?: string;
severity?: string;
to?: Position;
function overlayMode<T, S>(base: Mode<T>, overlay: Mode<S>, combine?: boolean): Mode<any>
/**
* async specifies that the lint process runs asynchronously. hasGutters specifies that lint errors should be displayed in the CodeMirror
* gutter, note that you must use this in conjunction with [ "CodeMirror-lint-markers" ] as an element in the gutters argument on
* initialization of the CodeMirror instance.
*/
interface LintStateOptions {
async: boolean;
hasGutters: boolean;
}
/**
* Adds the getAnnotations callback to LintStateOptions which may be overridden by the user if they choose use their own
* linter.
*/
interface LintOptions extends LintStateOptions {
getAnnotations: AnnotationsCallback;
}
/**
* A function that calls the updateLintingCallback with any errors found during the linting process.
*/
interface AnnotationsCallback {
(content: string, updateLintingCallback: UpdateLintingCallback, options: LintStateOptions, codeMirror: Editor): void;
}
/**
* A function that, given an array of annotations, updates the CodeMirror linting GUI with those annotations
*/
interface UpdateLintingCallback {
(codeMirror: Editor, annotations: Annotation[]): void;
}
/**
* An annotation contains a description of a lint error, detailing the location of the error within the code, the severity of the error,
* and an explaination as to why the error was thrown.
*/
interface Annotation {
from: Position;
message?: string;
severity?: string;
to?: Position;
}
}
+1 -1
View File
@@ -7,7 +7,7 @@ context.settings({compress: true});
context.attach('#test', [
{header: 'header 1'},
{divider: true},
{text:'foobar', submenu: [
{text:'foobar', subMenu: [
{text:'sub1'},
{text:'sub2'}
]}
@@ -1 +0,0 @@
@@ -1 +0,0 @@
Binary file not shown.
-1
View File
@@ -1 +0,0 @@
-1
View File
@@ -1 +0,0 @@
-1
View File
@@ -1 +0,0 @@
@@ -1 +0,0 @@
+37
View File
@@ -0,0 +1,37 @@
import dragula = require("dragula");
// containers
var d1 = dragula([document.querySelector('#left'), document.querySelector('#right')]);
// all options
var d2 = dragula({
isContainer: function (el) {
return false;
},
moves: function (el, container, handle) {
return true;
},
accepts: function (el, target, source, sibling) {
return true;
},
invalid: function (el, target) {
return el.tagName === 'A' || el.tagName === 'BUTTON';
},
direction: 'vertical',
copy: false,
revertOnSpill: false,
removeOnSpill: false,
delay: false,
mirrorContainer: document.body
});
// empty call
var d3 = dragula();
// drake API
var drake = dragula({
copy: true
});
drake.containers.push(document.querySelector('#container'));
+31
View File
@@ -0,0 +1,31 @@
/// <reference path="dragula.d.ts" />
var d1 = dragula([document.querySelector('#left'), document.querySelector('#right')]);
var d2 = dragula({
isContainer: function (el) {
return false;
},
moves: function (el, container, handle) {
return true;
},
accepts: function (el, target, source, sibling) {
return true;
},
invalid: function (el, target) {
return el.tagName === 'A' || el.tagName === 'BUTTON';
},
direction: 'vertical',
copy: false,
revertOnSpill: false,
removeOnSpill: false,
delay: false,
mirrorContainer: document.body
});
var d3 = dragula();
var drake = dragula({
copy: true
});
drake.containers.push(document.querySelector('#container'));
+46
View File
@@ -0,0 +1,46 @@
// Type definitions for dragula v2.1.2
// Project: http://bevacqua.github.io/dragula/
// Definitions by: Paul Welter <https://github.com/pwelter34/>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
declare module dragula {
interface DragulaOptions {
containers?: Element[];
isContainer?: (el?: Element) => boolean;
moves?: (el?: Element, container?: Element, handle?: Element) => boolean;
accepts?: (el?: Element, target?: Element, source?: Element, sibling?: Element) => boolean;
invalid?: (el?: Element, target?: Element) => boolean;
direction?: string;
copy?: boolean;
revertOnSpill?: boolean;
removeOnSpill?: boolean;
delay?: boolean | number;
mirrorContainer?: Element;
}
interface Drake {
containers: Element[];
dragging: boolean;
start(item:Element): void;
end(): void;
cancel(revert:boolean): void;
cancel(): void;
remove(): void;
on(events: string, callback: Function): void;
destroy(): void;
}
interface Dragula {
(containers: Element[], options: DragulaOptions): Drake;
(containers: Element, options: DragulaOptions): Drake;
(containers: Element[]): Drake;
(options: DragulaOptions): Drake;
(): Drake;
}
}
declare var dragula: dragula.Dragula;
declare module "dragula" {
export = dragula;
}
+1 -1
View File
@@ -26,7 +26,7 @@ $(document).ready(function() {
$('.slider1').bxSlider({
slideWidth: 200,
minSldies: 2,
minSlides: 2,
maxSlides: 3,
slideMargin: 10
});
@@ -1 +0,0 @@
--noImplicitAny --module commonjs --target es5
-1
View File
@@ -1 +0,0 @@
--noImplicitAny --module commonjs --target es5
+1 -1
View File
@@ -1,6 +1,6 @@
/// <reference path="express.d.ts" />
import express = require('express');
import * as express from 'express';
var app = express();
app.engine('jade', require('jade').__express);
+3 -3
View File
@@ -5,7 +5,7 @@
/* =================== USAGE ===================
import express = require('express');
import * as express from "express";
var app = express();
=============================================== */
@@ -24,8 +24,8 @@ declare module Express {
declare module "express" {
import http = require('http');
import serveStatic = require('serve-static');
import * as http from "http";
import * as serveStatic from "serve-static";
function e(): e.Express;
+2 -2
View File
@@ -70,7 +70,7 @@ function sample2() {
//
// Rendering canvas #2
//
var canvas2 = new fabric.Canvas('c2', { backgroundColor: "#000", renderOnAddition: false }),
var canvas2 = new fabric.Canvas('c2', { backgroundColor: "#000", renderOnAddRemove: false }),
results2 = document.getElementById('results-c2');
startTimer();
@@ -84,7 +84,7 @@ function sample2() {
canvas2.add(dot);
}
canvas2.renderAll(); // Note, calling renderAll() is important in this case
results2.innerHTML = 'Rendering 1000 elements using canvas.renderOnAddition = false in ' + stopTimer() + 'ms';
results2.innerHTML = 'Rendering 1000 elements using canvas.renderOnAddRemove = false in ' + stopTimer() + 'ms';
}
function sample3() {
-1
View File
@@ -1 +0,0 @@
+2 -1
View File
@@ -125,7 +125,8 @@ declare module Foundation {
timer? : string;
tip? : string;
wrapper? : string;
button? : string;
button?: string;
prev_button?: string;
modal? : string;
expose? : string;
expose_cover? : string;
-1
View File
@@ -1 +0,0 @@
+1 -1
View File
@@ -20,7 +20,7 @@ c.connect();
c.connect({
host: "127.0.0.1",
port: 21,
username: "Boo",
user: "Boo",
password: "secret"
});
+5 -1
View File
@@ -48,7 +48,11 @@ declare module gapi.auth {
/**
* The auth scope or scopes to authorize. Auth scopes for individual APIs can be found in their documentation.
*/
scope?: any
scope?: any;
/**
* The user to sign in as. -1 to toggle a multi-account chooser, 0 to default to the user's current account, and 1 to automatically sign in if the user is signed into Google Plus.
*/
authuser?: number;
}, callback: (token: GoogleApiOAuth2TokenObject) => any): void;
/**
* Initializes the authorization feature. Call this when the client loads to prevent popup blockers from blocking the auth window on gapi.auth.authorize calls.
+4
View File
@@ -855,6 +855,10 @@ declare module GitHubElectron {
* cleanup code will not run.
*/
terminate(): void;
/**
* Returns the current application directory.
*/
getAppPath(): string;
/**
* @param name One of: home, appData, userData, cache, userCache, temp, userDesktop, exe, module
* @returns The path to a special directory or file associated with name.
-1
View File
@@ -1 +0,0 @@
-1
View File
@@ -1 +0,0 @@
@@ -0,0 +1,53 @@
/// <reference path="../node/node" />
/// <reference path="../gulp/gulp" />
/// <reference path="../gulp-concat/gulp-concat" />
/// <reference path="gulp-load-plugins" />
import gulp = require('gulp');
import gulpConcat = require('gulp-concat');
import gulpLoadPlugins = require('gulp-load-plugins');
interface GulpPlugins extends IGulpPlugins {
concat: typeof gulpConcat;
}
var plugins = gulpLoadPlugins<GulpPlugins>({
pattern: ['gulp-*', 'gulp.*'],
config: 'package.json',
scope: ['dependencies', 'devDependencies', 'peerDependencies'],
replaceString: /^gulp(-|\.)/,
camelize: true,
lazy: true,
rename: {}
});
plugins = gulpLoadPlugins<GulpPlugins>();
gulp.task('taskName', () => {
gulp.src('*.*')
.pipe(plugins.concat('concatenated.js'))
.pipe(gulp.dest('output'));
});
/*
* From 0.8.0, you can pass in an object of mappings for renaming plugins. For example,
* imagine you want to load the gulp-ruby-sass plugin, but want to refer to it as just
* sass :
*/
plugins = gulpLoadPlugins<GulpPlugins>({
rename: {
'gulp-ruby-sass': 'sass'
}
});
/*
* gulp-load-plugins comes with npm scope support. The major difference is that scoped
* plugins are accessible through an object on plugins that represents the scope. For
* example, if the plugin is @myco/gulp-test-plugin then you can access the plugin as
* shown in the following example:
*/
interface GulpPlugins {
myco: {
testPlugin(): NodeJS.ReadWriteStream;
}
}
plugins.myco.testPlugin();
+42
View File
@@ -0,0 +1,42 @@
// Type definitions for gulp-load-plugins
// Project: https://github.com/jackfranklin/gulp-load-plugins
// Definitions by: Joe Skeen <http://github.com/joeskeen>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
/// <reference path="../node/node.d.ts" />
/** Loads in any gulp plugins and attaches them to an object, freeing you up from having to manually require each gulp plugin. */
declare module 'gulp-load-plugins' {
interface IOptions {
/** the glob(s) to search for, default ['gulp-*', 'gulp.*'] */
pattern?: string[];
/** where to find the plugins, searched up from process.cwd(), default 'package.json' */
config?: string;
/** which keys in the config to look within, default ['dependencies', 'devDependencies', 'peerDependencies'] */
scope?: string[];
/** what to remove from the name of the module when adding it to the context, default /^gulp(-|\.)/ */
replaceString?: RegExp;
/** if true, transforms hyphenated plugin names to camel case, default true */
camelize?: boolean;
/** whether the plugins should be lazy loaded on demand, default true */
lazy?: boolean;
/** a mapping of plugins to rename, the key being the NPM name of the package, and the value being an alias you define */
rename?: IPluginNameMappings;
}
interface IPluginNameMappings {
[npmPackageName: string]: string
}
/** Loads in any gulp plugins and attaches them to an object, freeing you up from having to manually require each gulp plugin. */
function gulpLoadPlugins<T extends IGulpPlugins>(options?: IOptions): T;
export = gulpLoadPlugins;
}
/**
* Extend this interface to use Gulp plugins in your gulpfile.js
*/
interface IGulpPlugins {
}
+7
View File
@@ -28,6 +28,13 @@ declare module gulp {
*/
buffer?: boolean;
/**
* The base path of a glob.
*
* Default is everything before a glob starts.
*/
base?: string;
/**
* The current working directory in which to search.
* Defaults to process.cwd().
+29 -47
View File
@@ -114,7 +114,7 @@ interface HighchartsAxisOptions {
minRange?: number;
minTickInterval?: number;
minorTickColor?: string;
minorTickInterval?: number;
minorTickInterval?: number|string;
minorTickLength?: number;
minorTickPosition?: string; // 'inside' 'outside'
minorTickWidth?: number;
@@ -191,11 +191,11 @@ interface HighchartsChartResetZoomButton {
}
interface HighchartsChartResetZoomButtonTheme {
fill?: string; //css HEX colours.
stroke?: string;//css HEX colours.
fill?: string; //css HEX colours.
stroke?: string;//css HEX colours.
r?: number; // Radius %
states?: any; // HTML element states eg: hover, with css attributes in object.
display?: string; // css attr eg: 'none'
states?: any; // HTML element states eg: hover, with css attributes in object.
display?: string; // css attr eg: 'none'
}
interface HighchartsChartOptions {
@@ -873,11 +873,11 @@ interface HighchartsLineChart {
states?: {
hover: HighchartsAreaStates;
};
step?: boolean;
step?: boolean|string;
stickyTracking?: boolean;
tooltip?: HighchartsTooltipOptions;
turboThreshold?: number;
visible?: number;
visible?: boolean;
zIndex?: number;
}
@@ -911,7 +911,7 @@ interface HighchartsPieChart {
};
stickyTracking?: boolean;
tooltip?: HighchartsTooltipOptions;
visible?: number;
visible?: boolean;
zIndex?: number;
}
@@ -953,7 +953,7 @@ interface HighchartsScatterChart {
stickyTracking?: boolean;
tooltip?: HighchartsTooltipOptions;
turboThreshold?: number;
visible?: number;
visible?: boolean;
zIndex?: number;
}
@@ -986,7 +986,6 @@ interface HighchartsSeriesChart {
dataLabels?: HighchartsDataLabels;
enableMouseTracking?: boolean;
events?: HighchartsPlotEvents;
id?: string;
lineWidth?: number;
marker?: HighchartsMarker;
point?: {
@@ -1006,7 +1005,7 @@ interface HighchartsSeriesChart {
stickyTracking?: boolean;
tooltip?: HighchartsTooltipOptions;
turboThreshold?: number;
visible?: number;
visible?: boolean;
zIndex?: number;
}
@@ -1041,13 +1040,14 @@ interface HighchartsPlotOptions {
*/
interface HighchartsIndividualSeriesOptions {
data?: number[]|[number, number][]| HighchartsDataPoint[]; // [value1,value2, ... ] | [[x1,y1],[x2,y2],... ] | HighchartsDataPoint[]
id?: string;
index?: number;
legendIndex?: number;
name?: string;
stack?: any; // type doesn't matter, as long as grouped series' stack options match each other.
type?: string;
xAxis?: number;
yAxis?: number;
xAxis?: string | number;
yAxis?: string | number;
}
interface HighchartsSeriesOptions extends HighchartsIndividualSeriesOptions, HighchartsSeriesChart { }
@@ -1095,8 +1095,8 @@ interface HighchartsSeriesOptions extends HighchartsSeriesChart {
legendIndex?: number;
name?: string;
stack?: string | number;
xAxis?: number;
yAxis?: number;
xAxis?: string | number;
yAxis?: string | number;
}
interface HighchartsSubtitleOptions {
@@ -1180,6 +1180,7 @@ interface HighchartsAxisObject {
addPlotBand(options: HighchartsPlotBands): void;
addPlotLine(options: HighchartsPlotLines): void;
getExtremes(): HighchartsExtremes;
remove(redraw?: boolean): void;
removePlotBand(id: string): void;
removePlotLine(id: string): void;
setCategories(categories: string[]): void;
@@ -1187,8 +1188,10 @@ interface HighchartsAxisObject {
setExtremes(min: number, max: number): void;
setExtremes(min: number, max: number, redraw: boolean): void;
setExtremes(min: number, max: number, redraw: boolean, animation: boolean | HighchartsAnimation): void;
setTitle(title: HighchartsAxisTitle): void;
setTitle(title: HighchartsAxisTitle, redraw: boolean): void;
setTitle(title: HighchartsAxisTitle, redraw?: boolean): void;
toPixels(value: number, paneCoordinates?: boolean): number;
toValue(pixel: number, paneCoordinates?: boolean): number;
update(options: HighchartsAxisOptions, redraw?: boolean): void;
}
interface HighchartsChartObject {
@@ -1275,52 +1278,31 @@ declare var Highcharts: HighchartsStatic;
interface HighchartsPointObject {
category: string | number;
percentage: number;
remove(): void;
remove(redraw: boolean): void;
remove(redraw: boolean, animation: boolean): void;
remove(redraw: boolean, animation: HighchartsAnimation): void;
remove(redraw?: boolean, animation?: boolean|HighchartsAnimation): void;
select(): void;
select(select: boolean): void;
select(select: boolean, accumulate: boolean): void;
selected: boolean;
series: HighchartsSeriesObject;
slice(): void;
slice(sliced: boolean): void;
slice(sliced: boolean, redraw: boolean): void;
slice(sliced: boolean, redraw: boolean, animation: boolean): void;
slice(sliced: boolean, redraw: boolean, animation: HighchartsAnimation): void;
slice(sliced?: boolean, redraw?: boolean, animation?: boolean|HighchartsAnimation): void;
total: number;
update(options: any): void;
update(options: any, redraw: boolean): void;
update(options: any, redraw: boolean, animation: boolean): void;
update(options: any, redraw: boolean, animation: HighchartsAnimation): void;
update(options: number | [number, number] | HighchartsDataPoint, redraw?: boolean, animation?: boolean | HighchartsAnimation): void;
x: number;
y: number;
}
interface HighchartsSeriesObject {
addPoint(options: number |[number, number]| HighchartsDataPoint): void;
addPoint(options: number |[number, number]| HighchartsDataPoint, redraw: boolean, shift: boolean): void;
addPoint(options: number |[number, number]| HighchartsDataPoint, redraw: boolean, shift: boolean, animation: boolean): void;
addPoint(options: number |[number, number]| HighchartsDataPoint, redraw: boolean, shift: boolean, animation: HighchartsAnimation): void;
addPoint(options: number |[number, number]| HighchartsDataPoint, redraw?: boolean, shift?: boolean, animation?: boolean | HighchartsAnimation): void;
chart: HighchartsChartObject;
data: HighchartsDataPoint[];
data: HighchartsPointObject[];
hide(): void;
name: string;
options: HighchartsSeriesOptions;
remove(): void;
remove(redraw: boolean): void;
select(): void;
select(selected: boolean): void;
remove(redraw?: boolean): void;
select(selected?: boolean): void;
selected: boolean;
setData(data: number[]): void; // [value1,value2, ... ]
setData(data: number[], redraw: boolean): void;
setData(data: number[][]): void; // [[x1,y1],[x2,y2],... ]
setData(data: number[][], redraw: boolean): void;
setData(data: HighchartsDataPoint[]): void; // HighchartsDataPoint[]
setData(data: HighchartsDataPoint[], redraw: boolean): void;
setVisible(visible: boolean): void;
setVisible(visible: boolean, redraw: boolean): void;
setData(data: number[] | number[][] | HighchartsDataPoint[], redraw?: boolean, animation?: boolean | HighchartsAnimation, updatePoints?: boolean): void;
setVisible(visible: boolean, redraw?: boolean): void;
show(): void;
type: string;
update(options: HighchartsSeriesOptions, redraw?: boolean): void;
@@ -1 +0,0 @@
@@ -1 +0,0 @@
+11
View File
@@ -721,6 +721,17 @@ describe("Manually ticking the Jasmine Clock", function () {
jasmine.clock().tick(50);
expect(timerCallback.calls.count()).toEqual(2);
});
describe("Mocking the Date object", function(){
it("mocks the Date object and sets it to a given time", function() {
var baseTime = new Date(2013, 9, 23);
jasmine.clock().mockDate(baseTime);
jasmine.clock().tick(50);
expect(new Date().getTime()).toEqual(baseTime.getTime() + 50);
});
});
});
describe("Asynchronous specs", function () {
+225 -23
View File
@@ -56,6 +56,7 @@ validOpts = {allowUnknown: bool};
validOpts = {skipFunctions: bool};
validOpts = {stripUnknown: bool};
validOpts = {language: bool};
validOpts = {presence: str};
validOpts = {context: obj};
// --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---
@@ -65,6 +66,34 @@ var renOpts: Joi.RenameOptions = null;
renOpts = {alias: bool};
renOpts = {multiple: bool};
renOpts = {override: bool};
renOpts = {ignoreUndefined: bool};
// --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---
var emailOpts: Joi.EmailOptions = null;
emailOpts = {errorLevel: num};
emailOpts = {errorLevel: bool};
emailOpts = {tldWhitelist: strArr};
emailOpts = {tldWhitelist: obj};
emailOpts = {minDomainAtoms: num};
// --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---
var ipOpts: Joi.IpOptions = null;
ipOpts = {version: str};
ipOpts = {version: strArr};
ipOpts = {cidr: str};
// --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---
var uriOpts: Joi.UriOptions = null;
uriOpts = {scheme: str};
uriOpts = {scheme: exp};
uriOpts = {scheme: strArr};
uriOpts = {scheme: expArr};
// --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---
@@ -144,15 +173,30 @@ module common {
anySchema = anySchema.valid(x);
anySchema = anySchema.valid(x, x);
anySchema = anySchema.valid([x, x, x]);
anySchema = anySchema.only(x);
anySchema = anySchema.only(x, x);
anySchema = anySchema.only([x, x, x]);
anySchema = anySchema.equal(x);
anySchema = anySchema.equal(x, x);
anySchema = anySchema.equal([x, x, x]);
anySchema = anySchema.invalid(x);
anySchema = anySchema.invalid(x, x);
anySchema = anySchema.invalid([x, x, x]);
anySchema = anySchema.disallow(x);
anySchema = anySchema.disallow(x, x);
anySchema = anySchema.disallow([x, x, x]);
anySchema = anySchema.not(x);
anySchema = anySchema.not(x, x);
anySchema = anySchema.not([x, x, x]);
anySchema = anySchema.default();
anySchema = anySchema.default(x);
anySchema = anySchema.default(x, str);
anySchema = anySchema.required();
anySchema = anySchema.optional();
anySchema = anySchema.forbidden();
anySchema = anySchema.strip();
anySchema = anySchema.description(str);
anySchema = anySchema.notes(str);
@@ -166,43 +210,65 @@ module common {
anySchema = anySchema.options(validOpts);
anySchema = anySchema.strict();
anySchema = anySchema.strict(bool);
anySchema = anySchema.concat(x);
altSchema = anySchema.when(str, whenOpts);
altSchema = anySchema.when(ref, whenOpts);
anySchema = anySchema.label(str);
anySchema = anySchema.raw();
anySchema = anySchema.raw(bool);
anySchema = anySchema.empty();
anySchema = anySchema.empty(str);
anySchema = anySchema.empty(anySchema);
}
// --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---
arrSchema = Joi.array();
arrSchema = arrSchema.sparse();
arrSchema = arrSchema.sparse(bool);
arrSchema = arrSchema.single();
arrSchema = arrSchema.single(bool);
arrSchema = arrSchema.min(num);
arrSchema = arrSchema.max(num);
arrSchema = arrSchema.length(num);
arrSchema = arrSchema.unique();
arrSchema = arrSchema.includes(numSchema);
arrSchema = arrSchema.includes(numSchema, strSchema);
arrSchema = arrSchema.includes([numSchema, strSchema]);
arrSchema = arrSchema.items(numSchema);
arrSchema = arrSchema.items(numSchema, strSchema);
arrSchema = arrSchema.items([numSchema, strSchema]);
arrSchema = arrSchema.excludes(numSchema);
arrSchema = arrSchema.excludes(numSchema, strSchema);
arrSchema = arrSchema.excludes([numSchema, strSchema]);
// - - - - - - - -
module common_copy_paste {
// use search & replace from any
anySchema = anySchema.allow(x);
anySchema = anySchema.allow(x, x);
anySchema = anySchema.allow([x, x, x]);
anySchema = anySchema.valid(x);
anySchema = anySchema.valid(x, x);
anySchema = anySchema.valid([x, x, x]);
anySchema = anySchema.invalid(x);
anySchema = anySchema.invalid(x, x);
anySchema = anySchema.invalid([x, x, x]);
anySchema = anySchema.default(x);
arrSchema = arrSchema.allow(x);
arrSchema = arrSchema.allow(x, x);
arrSchema = arrSchema.allow([x, x, x]);
arrSchema = arrSchema.valid(x);
arrSchema = arrSchema.valid(x, x);
arrSchema = arrSchema.valid([x, x, x]);
arrSchema = arrSchema.only(x);
arrSchema = arrSchema.only(x, x);
arrSchema = arrSchema.only([x, x, x]);
arrSchema = arrSchema.equal(x);
arrSchema = arrSchema.equal(x, x);
arrSchema = arrSchema.equal([x, x, x]);
arrSchema = arrSchema.invalid(x);
arrSchema = arrSchema.invalid(x, x);
arrSchema = arrSchema.invalid([x, x, x]);
arrSchema = arrSchema.disallow(x);
arrSchema = arrSchema.disallow(x, x);
arrSchema = arrSchema.disallow([x, x, x]);
arrSchema = arrSchema.not(x);
arrSchema = arrSchema.not(x, x);
arrSchema = arrSchema.not([x, x, x]);
arrSchema = arrSchema.default(x);
arrSchema = arrSchema.required();
arrSchema = arrSchema.optional();
@@ -238,10 +304,22 @@ module common_copy_paste {
boolSchema = boolSchema.valid(x);
boolSchema = boolSchema.valid(x, x);
boolSchema = boolSchema.valid([x, x, x]);
boolSchema = boolSchema.only(x);
boolSchema = boolSchema.only(x, x);
boolSchema = boolSchema.only([x, x, x]);
boolSchema = boolSchema.equal(x);
boolSchema = boolSchema.equal(x, x);
boolSchema = boolSchema.equal([x, x, x]);
boolSchema = boolSchema.invalid(x);
boolSchema = boolSchema.invalid(x, x);
boolSchema = boolSchema.invalid([x, x, x]);
boolSchema = boolSchema.disallow(x);
boolSchema = boolSchema.disallow(x, x);
boolSchema = boolSchema.disallow([x, x, x]);
boolSchema = boolSchema.not(x);
boolSchema = boolSchema.not(x, x);
boolSchema = boolSchema.not([x, x, x]);
boolSchema = boolSchema.default(x);
boolSchema = boolSchema.required();
@@ -270,6 +348,7 @@ module common_copy_paste {
binSchema = Joi.binary();
binSchema = binSchema.encoding(str);
binSchema = binSchema.min(num);
binSchema = binSchema.max(num);
binSchema = binSchema.length(num);
@@ -281,10 +360,22 @@ module common {
binSchema = binSchema.valid(x);
binSchema = binSchema.valid(x, x);
binSchema = binSchema.valid([x, x, x]);
binSchema = binSchema.only(x);
binSchema = binSchema.only(x, x);
binSchema = binSchema.only([x, x, x]);
binSchema = binSchema.equal(x);
binSchema = binSchema.equal(x, x);
binSchema = binSchema.equal([x, x, x]);
binSchema = binSchema.invalid(x);
binSchema = binSchema.invalid(x, x);
binSchema = binSchema.invalid([x, x, x]);
binSchema = binSchema.disallow(x);
binSchema = binSchema.disallow(x, x);
binSchema = binSchema.disallow([x, x, x]);
binSchema = binSchema.not(x);
binSchema = binSchema.not(x, x);
binSchema = binSchema.not([x, x, x]);
binSchema = binSchema.default(x);
binSchema = binSchema.required();
@@ -322,6 +413,14 @@ dateSchema = dateSchema.max(str);
dateSchema = dateSchema.min(num);
dateSchema = dateSchema.max(num);
dateSchema = dateSchema.min(ref);
dateSchema = dateSchema.max(ref);
dateSchema = dateSchema.format(str);
dateSchema = dateSchema.format(strArr);
dateSchema = dateSchema.iso();
module common {
dateSchema = dateSchema.allow(x);
dateSchema = dateSchema.allow(x, x);
@@ -329,10 +428,22 @@ module common {
dateSchema = dateSchema.valid(x);
dateSchema = dateSchema.valid(x, x);
dateSchema = dateSchema.valid([x, x, x]);
dateSchema = dateSchema.only(x);
dateSchema = dateSchema.only(x, x);
dateSchema = dateSchema.only([x, x, x]);
dateSchema = dateSchema.equal(x);
dateSchema = dateSchema.equal(x, x);
dateSchema = dateSchema.equal([x, x, x]);
dateSchema = dateSchema.invalid(x);
dateSchema = dateSchema.invalid(x, x);
dateSchema = dateSchema.invalid([x, x, x]);
dateSchema = dateSchema.disallow(x);
dateSchema = dateSchema.disallow(x, x);
dateSchema = dateSchema.disallow([x, x, x]);
dateSchema = dateSchema.not(x);
dateSchema = dateSchema.not(x, x);
dateSchema = dateSchema.not([x, x, x]);
dateSchema = dateSchema.default(x);
dateSchema = dateSchema.required();
@@ -366,8 +477,18 @@ funcSchema = Joi.func();
numSchema = Joi.number();
numSchema = numSchema.min(num);
numSchema = numSchema.min(ref);
numSchema = numSchema.max(num);
numSchema = numSchema.max(ref);
numSchema = numSchema.greater(num);
numSchema = numSchema.greater(ref);
numSchema = numSchema.less(num);
numSchema = numSchema.less(ref);
numSchema = numSchema.integer();
numSchema = numSchema.precision(num);
numSchema = numSchema.multiple(num);
numSchema = numSchema.positive();
numSchema = numSchema.negative();
module common {
numSchema = numSchema.allow(x);
@@ -376,10 +497,22 @@ module common {
numSchema = numSchema.valid(x);
numSchema = numSchema.valid(x, x);
numSchema = numSchema.valid([x, x, x]);
numSchema = numSchema.only(x);
numSchema = numSchema.only(x, x);
numSchema = numSchema.only([x, x, x]);
numSchema = numSchema.equal(x);
numSchema = numSchema.equal(x, x);
numSchema = numSchema.equal([x, x, x]);
numSchema = numSchema.invalid(x);
numSchema = numSchema.invalid(x, x);
numSchema = numSchema.invalid([x, x, x]);
numSchema = numSchema.disallow(x);
numSchema = numSchema.disallow(x, x);
numSchema = numSchema.disallow([x, x, x]);
numSchema = numSchema.not(x);
numSchema = numSchema.not(x, x);
numSchema = numSchema.not([x, x, x]);
numSchema = numSchema.default(x);
numSchema = numSchema.required();
@@ -418,12 +551,23 @@ objSchema = objSchema.length(num);
objSchema = objSchema.pattern(exp, schema);
objSchema = objSchema.and(str);
objSchema = objSchema.and(str, str);
objSchema = objSchema.and(str, str, str);
objSchema = objSchema.and(strArr);
objSchema = objSchema.nand(str);
objSchema = objSchema.nand(str, str);
objSchema = objSchema.nand(str, str, str);
objSchema = objSchema.nand(strArr);
objSchema = objSchema.or(str);
objSchema = objSchema.or(str, str);
objSchema = objSchema.or(str, str, str);
objSchema = objSchema.or(strArr);
objSchema = objSchema.xor(str);
objSchema = objSchema.xor(str, str);
objSchema = objSchema.xor(str, str, str);
objSchema = objSchema.xor(strArr);
@@ -442,6 +586,17 @@ objSchema = objSchema.assert(ref, schema, str);
objSchema = objSchema.unknown();
objSchema = objSchema.unknown(bool);
objSchema = objSchema.type(func);
objSchema = objSchema.type(func, str);
objSchema = objSchema.requiredKeys(str);
objSchema = objSchema.requiredKeys(str, str);
objSchema = objSchema.requiredKeys(strArr);
objSchema = objSchema.optionalKeys(str);
objSchema = objSchema.optionalKeys(str, str);
objSchema = objSchema.optionalKeys(strArr);
module common {
objSchema = objSchema.allow(x);
objSchema = objSchema.allow(x, x);
@@ -449,10 +604,22 @@ module common {
objSchema = objSchema.valid(x);
objSchema = objSchema.valid(x, x);
objSchema = objSchema.valid([x, x, x]);
objSchema = objSchema.only(x);
objSchema = objSchema.only(x, x);
objSchema = objSchema.only([x, x, x]);
objSchema = objSchema.equal(x);
objSchema = objSchema.equal(x, x);
objSchema = objSchema.equal([x, x, x]);
objSchema = objSchema.invalid(x);
objSchema = objSchema.invalid(x, x);
objSchema = objSchema.invalid([x, x, x]);
objSchema = objSchema.disallow(x);
objSchema = objSchema.disallow(x, x);
objSchema = objSchema.disallow([x, x, x]);
objSchema = objSchema.not(x);
objSchema = objSchema.not(x, x);
objSchema = objSchema.not([x, x, x]);
objSchema = objSchema.default(x);
objSchema = objSchema.required();
@@ -483,13 +650,33 @@ strSchema = Joi.string();
strSchema = strSchema.insensitive();
strSchema = strSchema.min(num);
strSchema = strSchema.min(num, str);
strSchema = strSchema.min(ref);
strSchema = strSchema.min(ref, str);
strSchema = strSchema.max(num);
strSchema = strSchema.max(num, str);
strSchema = strSchema.max(ref);
strSchema = strSchema.max(ref, str);
strSchema = strSchema.creditCard();
strSchema = strSchema.length(num);
strSchema = strSchema.length(num, str);
strSchema = strSchema.length(ref);
strSchema = strSchema.length(ref, str);
strSchema = strSchema.regex(exp);
strSchema = strSchema.regex(exp, str);
strSchema = strSchema.replace(exp, str);
strSchema = strSchema.replace(str, str);
strSchema = strSchema.alphanum();
strSchema = strSchema.token();
strSchema = strSchema.email();
strSchema = strSchema.email(emailOpts);
strSchema = strSchema.ip();
strSchema = strSchema.ip(ipOpts);
strSchema = strSchema.uri();
strSchema = strSchema.uri(uriOpts);
strSchema = strSchema.guid();
strSchema = strSchema.hex();
strSchema = strSchema.hostname();
strSchema = strSchema.isoDate();
strSchema = strSchema.lowercase();
strSchema = strSchema.uppercase();
@@ -502,10 +689,22 @@ module common {
strSchema = strSchema.valid(x);
strSchema = strSchema.valid(x, x);
strSchema = strSchema.valid([x, x, x]);
strSchema = strSchema.only(x);
strSchema = strSchema.only(x, x);
strSchema = strSchema.only([x, x, x]);
strSchema = strSchema.equal(x);
strSchema = strSchema.equal(x, x);
strSchema = strSchema.equal([x, x, x]);
strSchema = strSchema.invalid(x);
strSchema = strSchema.invalid(x, x);
strSchema = strSchema.invalid([x, x, x]);
strSchema = strSchema.disallow(x);
strSchema = strSchema.disallow(x, x);
strSchema = strSchema.disallow([x, x, x]);
strSchema = strSchema.not(x);
strSchema = strSchema.not(x, x);
strSchema = strSchema.not([x, x, x]);
strSchema = strSchema.default(x);
strSchema = strSchema.required();
@@ -537,6 +736,7 @@ schema = Joi.alternatives(schema, anySchema, boolSchema);
// --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---
Joi.validate(value, obj);
Joi.validate(value, schema);
Joi.validate(value, schema, validOpts);
Joi.validate(value, schema, validOpts, (err, value) => {
@@ -566,6 +766,8 @@ Joi.validate(value, {});
schema = Joi.compile(obj);
Joi.assert(obj, schema);
Joi.assert(obj, schema, str);
Joi.assert(obj, schema, err);
ref = Joi.ref(str, refOpts);
ref = Joi.ref(str);
+275 -31
View File
@@ -1,6 +1,6 @@
// Type definitions for joi v4.6.0
// Project: https://github.com/spumko/joi
// Definitions by: Bart van der Schoor <https://github.com/Bartvds>
// Definitions by: Bart van der Schoor <https://github.com/Bartvds>, Laurence Dougal Myers <https://github.com/laurence-myers>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
// TODO express type of Schema in a type-parameter (.default, .valid, .example etc)
@@ -19,7 +19,9 @@ declare module 'joi' {
// when true, unknown keys are deleted (only when value is an object). Defaults to false.
stripUnknown?: boolean;
// overrides individual error messages. Defaults to no override ({}).
language?: Object
language?: Object;
// sets the default presence requirements. Supported modes: 'optional', 'required', and 'forbidden'. Defaults to 'optional'.
presence?: string;
// provides an external data set to be used in references
context?: Object;
}
@@ -33,6 +35,28 @@ declare module 'joi' {
override?: boolean;
}
export interface EmailOptions {
// Numerical threshold at which an email address is considered invalid
errorLevel?: number | boolean;
// Specifies a list of acceptable TLDs.
tldWhitelist?: string[] | Object;
// Number of atoms required for the domain. Be careful since some domains, such as io, directly allow email.
minDomainAtoms?: number;
}
export interface IpOptions {
// One or more IP address versions to validate against. Valid values: ipv4, ipv6, ipvfuture
version ?: string | string[];
// Used to determine if a CIDR is allowed or not. Valid values: optional, required, forbidden
cidr?: string;
}
export interface UriOptions {
// Specifies one or more acceptable Schemes, should only include the scheme name.
// Can be an Array or String (strings are automatically escaped for use in a Regular Expression).
scheme ?: string | RegExp | Array<string | RegExp>;
}
export interface WhenOptions {
// the required condition joi type.
is: Schema;
@@ -47,11 +71,16 @@ declare module 'joi' {
contextPrefix?: string;
}
export interface IPOptions {
version?: Array<string>;
cidr?: string
}
export interface ValidationError {
message: string;
details: ValidationErrorItem[];
simple (): string;
annotated (): string;
simple(): string;
annotated(): string;
}
export interface ValidationErrorItem {
@@ -82,20 +111,28 @@ declare module 'joi' {
/**
* Whitelists a value
*/
allow(value: any, ...values : any[]): T;
allow(value: any, ...values: any[]): T;
allow(values: any[]): T;
/**
* Adds the provided values into the allowed whitelist and marks them as the only valid values allowed.
*/
valid(value: any, ...values : any[]): T;
valid(value: any, ...values: any[]): T;
valid(values: any[]): T;
only(value: any, ...values : any[]): T;
only(values: any[]): T;
equal(value: any, ...values : any[]): T;
equal(values: any[]): T;
/**
* Blacklists a value
*/
invalid(value: any, ...values : any[]): T;
invalid(value: any, ...values: any[]): T;
invalid(values: any[]): T;
disallow(value: any, ...values : any[]): T;
disallow(values: any[]): T;
not(value: any, ...values : any[]): T;
not(values: any[]): T;
/**
* Marks a key as required which will not allow undefined as value. All keys are optional by default.
@@ -112,6 +149,11 @@ declare module 'joi' {
*/
forbidden(): T;
/**
* Marks a key to be removed from a resulting object or array after validation. Used to sanitize output.
*/
strip(): T;
/**
* Annotates the key
*/
@@ -152,12 +194,28 @@ declare module 'joi' {
/**
* Sets the options.convert options to false which prevent type casting for the current key and any child keys.
*/
strict(): T;
strict(isStrict?: boolean): T;
/**
* Sets a default value if the original value is undefined.
* @param value - the value.
* value supports references.
* value may also be a function which returns the default value.
* If value is specified as a function that accepts a single parameter, that parameter will be a context
* object that can be used to derive the resulting value. This clones the object however, which incurs some
* overhead so if you don't need access to the context define your method so that it does not accept any
* parameters.
* Without any value, default has no effect, except for object that will then create nested defaults
* (applying inner defaults of that object).
*
* Note that if value is an object, any changes to the object after default() is called will change the
* reference and any future assignment.
*
* Additionally, when specifying a method you must either have a description property on your method or the
* second parameter is required.
*/
default(value: any): T;
default(value: any, description?: string): T;
default(): T;
/**
* Returns a new type that is the result of adding the rules of one type to another.
@@ -169,6 +227,22 @@ declare module 'joi' {
*/
when(ref: string, options: WhenOptions): AlternativesSchema;
when(ref: Reference, options: WhenOptions): AlternativesSchema;
/**
* Overrides the key name in error messages.
*/
label(name: string): T;
/**
* Outputs the original untouched value instead of the casted value.
*/
raw(isRaw?: boolean): T;
/**
* Considers anything that matches the schema to be empty (undefined).
* @param schema - any object or joi schema to match. An undefined schema unsets that rule.
*/
empty(schema?: any) : T;
}
export interface BooleanSchema extends AnySchema<BooleanSchema> {
@@ -178,18 +252,57 @@ declare module 'joi' {
export interface NumberSchema extends AnySchema<NumberSchema> {
/**
* Specifies the minimum value.
* It can also be a reference to another field.
*/
min(limit: number): NumberSchema;
min(limit: Reference): NumberSchema;
/**
* Specifies the maximum value.
* It can also be a reference to another field.
*/
max(limit: number): NumberSchema;
max(limit: Reference): NumberSchema;
/**
* Specifies that the value must be greater than limit.
* It can also be a reference to another field.
*/
greater(limit: number): NumberSchema;
greater(limit: Reference): NumberSchema;
/**
* Specifies that the value must be less than limit.
* It can also be a reference to another field.
*/
less(limit: number): NumberSchema;
less(limit: Reference): NumberSchema;
/**
* Requires the number to be an integer (no floating point).
*/
integer(): NumberSchema;
/**
* Specifies the maximum number of decimal places where:
* limit - the maximum number of decimal places allowed.
*/
precision(limit: number): NumberSchema;
/**
* Specifies that the value must be a multiple of base.
*/
multiple(base: number): NumberSchema;
/**
* Requires the number to be positive.
*/
positive(): NumberSchema;
/**
* Requires the number to be negative.
*/
negative(): NumberSchema;
}
export interface StringSchema extends AnySchema<StringSchema> {
@@ -200,23 +313,47 @@ declare module 'joi' {
/**
* Specifies the minimum number string characters.
* @param limit - the minimum number of string characters required. It can also be a reference to another field.
* @param encoding - if specified, the string length is calculated in bytes using the provided encoding.
*/
min(limit: number): StringSchema;
min(limit: number, encoding?: string): StringSchema;
min(limit: Reference, encoding?: string): StringSchema;
/**
* Specifies the maximum number of string characters.
* @param limit - the maximum number of string characters allowed. It can also be a reference to another field.
* @param encoding - if specified, the string length is calculated in bytes using the provided encoding.
*/
max(limit: number): StringSchema;
max(limit: number, encoding?: string): StringSchema;
max(limit: Reference, encoding?: string): StringSchema;
/**
* Requires the number to be a credit card number (Using Lunh Algorithm).
*/
creditCard(): StringSchema;
/**
* Specifies the exact string length required
* @param limit - the required string length. It can also be a reference to another field.
* @param encoding - if specified, the string length is calculated in bytes using the provided encoding.
*/
length(limit: number): StringSchema;
length(limit: number, encoding?: string): StringSchema;
length(limit: Reference, encoding?: string): StringSchema;
/**
* Defines a regular expression rule.
* @param pattern - a regular expression object the string value must match against.
* @param name - optional name for patterns (useful with multiple patterns). Defaults to 'required'.
*/
regex(pattern: RegExp): StringSchema;
regex(pattern: RegExp, name?: string): StringSchema;
/**
* Replace characters matching the given pattern with the specified replacement string where:
* @param pattern - a regular expression object to match against, or a string of which all occurrences will be replaced.
* @param replacement - the string that will replace the pattern.
*/
replace(pattern: RegExp, replacement: string): StringSchema;
replace(pattern: string, replacement: string): StringSchema;
/**
* Requires the string value to only contain a-z, A-Z, and 0-9.
@@ -231,13 +368,33 @@ declare module 'joi' {
/**
* Requires the string value to be a valid email address.
*/
email(): StringSchema;
email(options?: EmailOptions): StringSchema;
/**
* Requires the string value to be a valid ip address.
*/
ip(options?: IpOptions): StringSchema;
/**
* Requires the string value to be a valid RFC 3986 URI.
*/
uri(options?: UriOptions): StringSchema;
/**
* Requires the string value to be a valid GUID.
*/
guid(): StringSchema;
/**
* Requires the string value to be a valid hexadecimal string.
*/
hex(): StringSchema;
/**
* Requires the string value to be a valid hostname as per RFC1123.
*/
hostname(): StringSchema;
/**
* Requires the string value to be in valid ISO 8601 date format.
*/
@@ -257,25 +414,34 @@ declare module 'joi' {
* Requires the string value to contain no whitespace before or after. If the validation convert option is on (enabled by default), the string will be trimmed.
*/
trim(): StringSchema;
/**
* Requires the string value to be a valid uri with the passed scheme.
*/
uri(options?: { scheme?: string }): StringSchema;
}
export interface ArraySchema extends AnySchema<ArraySchema> {
/**
* List the types allowed for the array value
* Allow this array to be sparse.
* enabled can be used with a falsy value to go back to the default behavior.
*/
includes(type: Schema, ...types: Schema[]): ArraySchema;
includes(types: Schema[]): ArraySchema;
sparse(enabled?: any): ArraySchema;
/**
* List the types forbidden for the array values.
* Allow single values to be checked against rules as if it were provided as an array.
* enabled can be used with a falsy value to go back to the default behavior.
*/
excludes(type: Schema, ...types: Schema[]): ArraySchema;
excludes(types: Schema[]): ArraySchema;
single(enabled?: any): ArraySchema;
/**
* List the types allowed for the array values.
* type can be an array of values, or multiple values can be passed as individual arguments.
* If a given type is .required() then there must be a matching item in the array.
* If a type is .forbidden() then it cannot appear in the array.
* Required items can be added multiple times to signify that multiple items must be found.
* Errors will contain the number of items that didn't match.
* Any unmatched item having a label will be mentioned explicitly.
*
* @param type - a joi schema object to validate each array item against.
*/
items(type: Schema, ...types: Schema[]): ArraySchema;
items(types: Schema[]): ArraySchema;
/**
* Specifies the minimum number of items in the array.
@@ -292,6 +458,12 @@ declare module 'joi' {
*/
length(limit: number): ArraySchema;
/**
* Requires the array values to be unique.
* Be aware that a deep equality is performed on elements of the array having a type of object,
* a performance penalty is to be expected for this kind of operation.
*/
unique(): ArraySchema;
}
export interface ObjectSchema extends AnySchema<ObjectSchema> {
@@ -322,20 +494,30 @@ declare module 'joi' {
/**
* Defines an all-or-nothing relationship between keys where if one of the peers is present, all of them are required as well.
* @param peers - the key names of which if one present, all are required. peers can be a single string value,
* an array of string values, or each peer provided as an argument.
*/
and(peer1: string, peer2: string, ...peers: string[]): ObjectSchema;
and(peer1: string, ...peers: string[]): ObjectSchema;
and(peers: string[]): ObjectSchema;
/**
* Defines a relationship between keys where not all peers can be present at the same time.
* @param peers - the key names of which if one present, the others may not all be present.
* peers can be a single string value, an array of string values, or each peer provided as an argument.
*/
nand(peer1: string, ...peers: string[]): ObjectSchema;
nand(peers: string[]): ObjectSchema;
/**
* Defines a relationship between keys where one of the peers is required (and more than one is allowed).
*/
or(peer1: string, peer2: string, ...peers: string[]): ObjectSchema;
or(peer1: string, ...peers: string[]): ObjectSchema;
or(peers: string[]): ObjectSchema;
/**
* Defines an exclusive relationship between a set of keys. one of them is required but not at the same time where:
*/
xor(peer1: string, peer2: string, ...peers: string[]): ObjectSchema;
xor(peer1: string, ...peers: string[]): ObjectSchema;
xor(peers: string[]): ObjectSchema;
/**
@@ -364,10 +546,48 @@ declare module 'joi' {
/**
* Overrides the handling of unknown keys for the scope of the current object only (does not apply to children).
*/
unknown(allow?:boolean): ObjectSchema;
unknown(allow?: boolean): ObjectSchema;
/**
* Requires the object to be an instance of a given constructor.
*
* @param constructor - the constructor function that the object must be an instance of.
* @param name - an alternate name to use in validation errors. This is useful when the constructor function does not have a name.
*/
type(constructor: Function, name?: string): ObjectSchema;
/**
* Sets the specified children to required.
*
* @param children - can be a single string value, an array of string values, or each child provided as an argument.
*
* var schema = Joi.object().keys({ a: { b: Joi.number() }, c: { d: Joi.string() } });
* var requiredSchema = schema.requiredKeys('', 'a.b', 'c', 'c.d');
*
* Note that in this example '' means the current object, a is not required but b is, as well as c and d.
*/
requiredKeys(children: string): ObjectSchema;
requiredKeys(children: string[]): ObjectSchema;
requiredKeys(child:string, ...children: string[]): ObjectSchema;
/**
* Sets the specified children to optional.
*
* @param children - can be a single string value, an array of string values, or each child provided as an argument.
*
* The behavior is exactly the same as requiredKeys.
*/
optionalKeys(children: string): ObjectSchema;
optionalKeys(children: string[]): ObjectSchema;
optionalKeys(child:string, ...children: string[]): ObjectSchema;
}
export interface BinarySchema extends AnySchema<BinarySchema> {
/**
* Sets the string encoding format if a string input is converted to a buffer.
*/
encoding(encoding: string): BinarySchema;
/**
* Specifies the minimum length of the buffer.
*/
@@ -388,17 +608,37 @@ declare module 'joi' {
/**
* Specifies the oldest date allowed.
* Notes: 'now' can be passed in lieu of date so as to always compare relatively to the current date,
* allowing to explicitly ensure a date is either in the past or in the future.
* It can also be a reference to another field.
*/
min(date: Date): DateSchema;
min(date: number): DateSchema;
min(date: string): DateSchema;
min(date: Reference): DateSchema;
/**
* Specifies the latest date allowed.
* Notes: 'now' can be passed in lieu of date so as to always compare relatively to the current date,
* allowing to explicitly ensure a date is either in the past or in the future.
* It can also be a reference to another field.
*/
max(date: Date): DateSchema;
max(date: number): DateSchema;
max(date: string): DateSchema;
max(date: Reference): DateSchema;
/**
* Specifies the allowed date format:
* @param format - string or array of strings that follow the moment.js format.
*/
format(format: string): DateSchema;
format(format: string[]): DateSchema;
/**
* Requires the string value to be in valid ISO 8601 date format.
*/
iso(): DateSchema;
}
export interface FunctionSchema extends AnySchema<FunctionSchema> {
@@ -480,11 +720,15 @@ declare module 'joi' {
/**
* Validates a value against a schema and throws if validation fails.
*
* @param value - the value to validate.
* @param schema - the schema object.
* @param message - optional message string prefix added in front of the error message. may also be an Error object.
*/
export function assert(value: any, schema: Schema): void;
export function assert(value: any, schema: Schema, message?: string | Error): void;
/**
* Generates a reference to the value of the named key.
*/
export function ref(key:string, options?: ReferenceOptions): Reference;
export function ref(key: string, options?: ReferenceOptions): Reference;
}
+10 -1
View File
@@ -6,6 +6,15 @@
/// <reference path="../jquery/jquery.d.ts" />
interface JQueryColorpickerOptions {
// Events
// TODO: Figure out actual types.
cancel: Function,
close: Function,
init: Function,
select: Function,
ok: Function,
open: Function,
alpha?: boolean;
altAlpha?: boolean;
altField?: string;
@@ -21,7 +30,7 @@ interface JQueryColorpickerOptions {
closeOnOutside?: boolean;
color?: string;
colorFormat?: string;
dragggable?: boolean;
draggable?: boolean;
duration?: string;
hsv?: boolean;
inline?: boolean;
@@ -1 +0,0 @@
--noImplicitAny
+15
View File
@@ -184,6 +184,11 @@ interface Gridster {
**/
add_widget(html: HTMLElement, size_x?: number, size_y?: number, col?: number, row?: number): JQuery;
/**
* @see add_widget
**/
add_widget(html: JQuery, size_x?: number, size_y?: number, col?: number, row?: number): JQuery;
/**
* Change the size of a widget.
* @param $widget The jQuery wrapped HTMLElement that represents the widget is going to be resized.
@@ -208,6 +213,16 @@ interface Gridster {
**/
remove_widget(el: HTMLElement, callback: (el: HTMLElement) => void): Gridster;
/**
* @see remove_widget
**/
remove_widget(el: JQuery, silent?: boolean, callback?: (el: HTMLElement) => void): Gridster;
/**
* @see remove_widget
**/
remove_widget(el: JQuery, callback: (el: HTMLElement) => void): Gridster;
/**
* Returns a serialized array of the widgets in the grid.
* @param $widgets The collection of jQuery wrap ed HTMLElements you want to serialize. If no argument is passed a l widgets will be serialized.
@@ -1 +0,0 @@
+18
View File
@@ -0,0 +1,18 @@
/// <reference path="katex.d.ts" />
import katexLib = require('katex');
class KatexTest {
constructor() {
katexLib.render('My Latex String', document.createElement('div'));
try {
let options: katexLib.KatexOptions = { breakOnUnsupportedCmds: true };
let value: string = katexLib.renderToString('My Latex String', options);
} catch (error) {
if (error instanceof katexLib.ParseError) {
//do something with this error
}
}
}
}
+33
View File
@@ -0,0 +1,33 @@
// Type definitions for KaTeX v.0.5.0
// Project: http://khan.github.io/KaTeX/
// Definitions by: Michael Randolph <https://github.com/mrand01>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
declare module "katex" {
interface KatexOptions {
displayMode?: boolean;
breakOnUnsupportedCmds?: boolean;
errorColor?: string;
}
class ParseError implements Error {
constructor(message: string, lexer: any, position: number);
name: string;
message: string;
position: number;
}
/**
* Renders a TeX expression into the specified DOM element
* @param tex A TeX expression
* @param element The DOM element to render into
* @param options KaTeX options
*/
function render(tex: string, element: HTMLElement, options?:KatexOptions): void;
/**
* Renders a TeX expression into an HTML string
* @param tex A TeX expression
* @param options KaTeX options
*/
function renderToString(tex: string, options?:KatexOptions): string;
}
-1
View File
@@ -1 +0,0 @@
-1
View File
@@ -1 +0,0 @@
+58 -19
View File
@@ -89,6 +89,13 @@ class Dog {
var result: any;
// _.MapCache
var testMapCache: _.MapCache;
result = <(key: string) => boolean>testMapCache.delete;
result = <(key: string) => any>testMapCache.get;
result = <(key: string) => boolean>testMapCache.has;
result = <(key: string, value: any) => _.Dictionary<any>>testMapCache.set;
/*************
* Chaining *
*************/
@@ -354,10 +361,22 @@ result = <{ x: number; }[]>_([{ 'x': 1 }, { 'x': 2 }, { 'x': 1 }]).unique('x').v
result = <number[]>_.without([1, 2, 1, 0, 3, 1, 4], 0, 1);
result = <number[]>_.xor([1, 2, 3, 4, 5], [5, 2, 10]);
result = <number[]>_.xor([1, 2, 3, 4, 5], [5, 2, 10], [4, 5, 6]);
result = <_.LoDashArrayWrapper<number>>_([1, 2, 3, 4, 5]).xor([5, 2, 10]);
result = <_.LoDashArrayWrapper<number>>_([1, 2, 3, 4, 5]).xor([5, 2, 10], [4, 5, 6]);
// _.xor
var testXorArray: number[];
var testXorList: _.List<number>;
result = <number[]>_.xor<number>();
result = <number[]>_.xor<number>(testXorArray);
result = <number[]>_.xor<number>(testXorArray, testXorArray);
result = <number[]>_.xor<number>(testXorArray, testXorArray, testXorArray);
result = <number[]>_.xor<number>(testXorList);
result = <number[]>_.xor<number>(testXorList, testXorList);
result = <number[]>_.xor<number>(testXorList, testXorList, testXorList);
result = <number[]>(_(testXorArray).xor().value());
result = <number[]>(_(testXorArray).xor(testXorArray).value());
result = <number[]>(_(testXorArray).xor(testXorArray, testXorArray).value());
result = <number[]>(_(testXorList).xor().value());
result = <number[]>(_(testXorList).xor(testXorList).value());
result = <number[]>(_(testXorList).xor(testXorList, testXorList).value());
result = <any[][]>_.zip(['moe', 'larry'], [30, 40], [true, false]);
result = <any[][]>_.unzip(['moe', 'larry'], [30, 40], [true, false]);
@@ -909,17 +928,18 @@ var testFlowRightAddFn = (n: number, m: number) => n + m;
result = <number>_.flowRight<(n: number, m: number) => number>(testFlowRightSquareFn, testFlowRightAddFn)(1, 2);
result = <number>_(testFlowRightSquareFn).flowRight<(n: number, m: number) => number>(testFlowRightAddFn).value()(1, 2);
var fibonacci = <Function>_.memoize(function (n: any): number {
return n < 2 ? n : fibonacci(n - 1) + fibonacci(n - 2);
});
var data: { [index: string]: { name: string; age: number; } } = {
'moe': { 'name': 'moe', 'age': 40 },
'curly': { 'name': 'curly', 'age': 60 }
};
var stooge = _.memoize(function (name: string) { return data[name]; }, _.identity);
stooge('curly');
// _.memoize
var testMemoizedFunction: _.MemoizedFunction;
result = <_.MapCache>testMemoizedFunction.cache;
interface TestMemoizedResultFn extends _.MemoizedFunction {
(...args: any[]): any;
}
var testMemoizeFn: (...args: any[]) => any;
var testMemoizeResolverFn: (...args: any[]) => any;
result = <TestMemoizedResultFn>_.memoize<TestMemoizedResultFn>(testMemoizeFn);
result = <TestMemoizedResultFn>_.memoize<TestMemoizedResultFn>(testMemoizeFn, testMemoizeResolverFn);
result = <TestMemoizedResultFn>(_(testMemoizeFn).memoize<TestMemoizedResultFn>().value());
result = <TestMemoizedResultFn>(_(testMemoizeFn).memoize<TestMemoizedResultFn>(testMemoizeResolverFn).value());
var returnedMemoize = _.throttle(function (a: any) { return a * 5; }, 5);
returnedMemoize(4);
@@ -958,9 +978,10 @@ result = <TestNegateResult>_.negate<TestNegatePredicate, TestNegateResult>(testN
result = <TestNegateResult>_(testNegatePredicate).negate().value();
result = <TestNegateResult>_(testNegatePredicate).negate<TestNegateResult>().value();
var initialize = _.once(function () { });
initialize();
initialize();
// _.once
result = <() => void>_.once<() => void>(function () {});
result = <() => void>(_(function () {}).once().value());
var returnedOnce = _.throttle(function (a: any) { return a * 5; }, 5);
returnedOnce(4);
@@ -977,6 +998,16 @@ var optionsPartialRight = {
defaultsDeep(optionsPartialRight, _.templateSettings);
//_.rearg
var testReargFn = (a: string, b: string, c: string) => [a, b, c];
interface TestReargResultFn {
(b: string, c: string, a: string): string[];
}
result = <string[]>(_.rearg<TestReargResultFn>(testReargFn, 2, 0, 1))('b', 'c', 'a');
result = <string[]>(_.rearg<TestReargResultFn>(testReargFn, [2, 0, 1]))('b', 'c', 'a');
result = <string[]>(_(testReargFn).rearg<TestReargResultFn>(2, 0, 1).value())('b', 'c', 'a');
result = <string[]>(_(testReargFn).rearg<TestReargResultFn>([2, 0, 1]).value())('b', 'c', 'a');
//_.restParam
var testRestParamFn = (a: string, b: string, c: number[]) => a + ' ' + b + ' ' + c.join(' ');
interface testRestParamFunc {
@@ -989,6 +1020,14 @@ result = <string>(_.restParam<testRestParamResult, testRestParamFunc>(testRestPa
result = <string>(_.restParam<testRestParamResult>(testRestParamFn, 2))('a', 'b', 1, 2, 3);
result = <string>(_(testRestParamFn).restParam<testRestParamResult>(2).value())('a', 'b', 1, 2, 3);
//_.spread
var testSpreadFn = (who: string, what: string) => who + ' says ' + what;
interface TestSpreadResultFn {
(args: string[]): string;
}
result = <string>(_.spread<TestSpreadResultFn>(testSpreadFn))(['fred', 'hello']);
result = <string>(_(testSpreadFn).spread<TestSpreadResultFn>().value())(['fred', 'hello']);
var throttled = _.throttle(function () { }, 100);
jQuery(window).on('scroll', throttled);
@@ -1410,7 +1449,7 @@ result = <string>_.template('<% print("hello " + name); %>!', { 'name': 'larry'
var listTemplate = '<% $.each(people, function(name) { %><li><%- name %></li><% }); %>';
result = <string>_.template(listTemplate, { 'people': ['moe', 'larry'] }, { 'imports': { '$': jQuery } });
result = <_.TemplateExecutor>_.template('hello <%= name %>', null, { 'sourceURL': '/basic/greeting.jst' });
result = <_.TemplateExecutor>_.template('hello <%= name %>', null, /*sourceURL:*/ '/basic/greeting.jst');
result = <_.TemplateExecutor>_.template('hi <%= data.name %>!', null, { 'variable': 'data' });
result = <string>(<_.TemplateExecutor>result).source;
+132 -40
View File
@@ -94,6 +94,40 @@ declare module _ {
variable?: string;
}
/**
* Creates a cache object to store key/value pairs.
*/
interface MapCache {
/**
* Removes `key` and its value from the cache.
* @param key The key of the value to remove.
* @return Returns `true` if the entry was removed successfully, else `false`.
*/
delete(key: string): boolean;
/**
* Gets the cached value for `key`.
* @param key The key of the value to get.
* @return Returns the cached value.
*/
get(key: string): any;
/**
* Checks if a cached value for `key` exists.
* @param key The key of the entry to check.
* @return Returns `true` if an entry for `key` exists, else `false`.
*/
has(key: string): boolean;
/**
* Sets `value` to `key` of the cache.
* @param key The key of the value to cache.
* @param value The value to cache.
* @return Returns the cache object.
*/
set(key: string, value: any): _.Dictionary<any>;
}
/**
* An object used to flag environments features.
**/
@@ -1868,33 +1902,25 @@ declare module _ {
//_.xor
interface LoDashStatic {
/**
* Creates an array that is the symmetric difference of the provided arrays.
* @param array The array to process
* @param others The arrays of values to calculate the symmetric difference.
* @return Returns a new array of filtered values.
**/
xor<T>(
array: Array<T>,
...others: Array<T>[]): T[];
/**
* @see _.xor
**/
xor<T>(
array: List<T>,
...others: List<T>[]): T[];
* Creates an array of unique values that is the symmetric difference of the provided arrays.
* @param arrays The arrays to inspect.
* @return Returns the new array of values.
*/
xor<T>(...arrays: List<T>[]): T[];
}
interface LoDashArrayWrapper<T> {
/**
* @see _.xor
**/
xor(
...others: Array<T>[]): LoDashArrayWrapper<T>;
* @see _.xor
*/
xor(...arrays: T[][]): LoDashArrayWrapper<T>;
}
interface LoDashObjectWrapper<T> {
/**
* @see _.xor
**/
xor(
...others: List<T>[]): LoDashArrayWrapper<T>;
* @see _.xor
*/
xor(...arrays: T[]): LoDashObjectWrapper<T>;
}
//_.zip
@@ -5534,20 +5560,30 @@ declare module _ {
}
//_.memoize
interface MemoizedFunction extends Function {
cache: MapCache;
}
interface LoDashStatic {
/**
* Creates a function that memoizes the result of func. If resolver is provided it will be
* used to determine the cache key for storing the result based on the arguments provided to
* the memoized function. By default, the first argument provided to the memoized function is
* used as the cache key. The func is executed with the this binding of the memoized function.
* The result cache is exposed as the cache property on the memoized function.
* @param func Computationally expensive function that will now memoized results.
* @param resolver Hash function for storing the result of `fn`.
* @return Returns the new memoizing function.
**/
memoize<T extends Function>(
func: T,
resolver?: Function): T;
* Creates a function that memoizes the result of func. If resolver is provided it determines the cache key for
* storing the result based on the arguments provided to the memoized function. By default, the first argument
* provided to the memoized function is coerced to a string and used as the cache key. The func is invoked with
* the this binding of the memoized function.
* @param func The function to have its output memoized.
* @param resolver The function to resolve the cache key.
* @return Returns the new memoizing function.
*/
memoize<TResult extends MemoizedFunction>(
func: Function,
resolver?: Function): TResult;
}
interface LoDashObjectWrapper<T> {
/**
* @see _.memoize
*/
memoize<TResult extends MemoizedFunction>(resolver?: Function): LoDashObjectWrapper<TResult>;
}
//_.modArgs
@@ -5616,15 +5652,22 @@ declare module _ {
//_.once
interface LoDashStatic {
/**
* Creates a function that is restricted to execute func once. Repeat calls to the function
* will return the value of the first call. The func is executed with the this binding of the
* created function.
* @param func Function to only execute once.
* @return The new restricted function.
**/
* Creates a function that is restricted to invoking func once. Repeat calls to the function return the value
* of the first call. The func is invoked with the this binding and arguments of the created function.
* @param func The function to restrict.
* @return Returns the new restricted function.
*/
once<T extends Function>(func: T): T;
}
interface LoDashObjectWrapper<T> {
/**
* @see _.once
*/
once(): LoDashObjectWrapper<T>;
}
//_.partial
interface LoDashStatic {
/**
@@ -5654,6 +5697,36 @@ declare module _ {
...args: any[]): Function;
}
//_.rearg
interface LoDashStatic {
/**
* Creates a function that invokes func with arguments arranged according to the specified indexes where the
* argument value at the first index is provided as the first argument, the argument value at the second index
* is provided as the second argument, and so on.
* @param func The function to rearrange arguments for.
* @param indexes The arranged argument indexes, specified as individual indexes or arrays of indexes.
* @return Returns the new function.
*/
rearg<TResult extends Function>(func: Function, indexes: number[]): TResult;
/**
* @see _.rearg
*/
rearg<TResult extends Function>(func: Function, ...indexes: number[]): TResult;
}
interface LoDashObjectWrapper<T> {
/**
* @see _.rearg
*/
rearg<TResult extends Function>(indexes: number[]): LoDashObjectWrapper<TResult>;
/**
* @see _.rearg
*/
rearg<TResult extends Function>(...indexes: number[]): LoDashObjectWrapper<TResult>;
}
//_.restParam
interface LoDashStatic {
/**
@@ -5678,6 +5751,25 @@ declare module _ {
restParam<TResult extends Function>(start?: number): LoDashObjectWrapper<TResult>;
}
//_.spread
interface LoDashStatic {
/**
* Creates a function that invokes func with the this binding of the created function and an array of arguments
* much like Function#apply.
* @param func The function to spread arguments over.
* @return Returns the new function.
*/
spread<TResult extends Function>(func: Function): TResult;
}
interface LoDashObjectWrapper<T> {
/**
* @see _.spread
*/
spread<TResult extends Function>(): LoDashObjectWrapper<TResult>;
}
//_.throttle
interface LoDashStatic {
/**
-1
View File
@@ -1 +0,0 @@
--noImplicitAny --module commonjs --target es5
-1
View File
@@ -1 +0,0 @@
+13
View File
@@ -0,0 +1,13 @@
/// <reference path="../jquery/jquery.d.ts"/>
/// <reference path="metismenu.d.ts"/>
$('#menu').metisMenu();
$('.metismenu').metisMenu({toggle: false});
$('.test').metisMenu({
toggle: false,
doubleTapToGo: true,
activeClass: 'active',
collapseClass: 'collapse',
collapseInClass: 'in',
collapsingClass: 'collapsing'
});
+19
View File
@@ -0,0 +1,19 @@
// Type definitions for metisMenu 2.0.3
// Project: http://github.com/onokumus/metisMenu
// Definitions by: onokums <https://github.com/onokumus/>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
/// <reference path="../jquery/jquery.d.ts"/>
interface MetisMenuOptions {
toggle?: boolean;
doubleTapToGo?: boolean;
activeClass?: string;
collapseClass?: string;
collapseInClass?: string;
collapsingClass?: string;
}
interface JQuery {
metisMenu(options?: MetisMenuOptions): JQuery;
}
@@ -467,7 +467,7 @@ var calendarCollection: Microsoft.Live.IObjectCollection<Microsoft.Live.ICalenda
var newCalendar: Microsoft.Live.INewCalendar = {
"name": "Summer Events",
"summary": "Things we are doing this summer."
"description": "Things we are doing this summer."
};
var newCalendarSub: Microsoft.Live.INewCalendarSubscription = {
+1 -1
View File
@@ -1,6 +1,6 @@
/// <reference path="mime.d.ts" />
import mime = require('mime');
import * as mime from "mime";
var str: string;
var obj: Object;
+2 -3
View File
@@ -96,9 +96,8 @@ interface ModernizrStatic {
load(resourceObject: any): void;
load(resourceString: string): void;
prefixed(): boolean;
prefixed(property: string): boolean;
prefixed(property: string, obj: any, element?: any): boolean;
prefixed(property: string): any;
prefixed(property: string, obj: any, element?: any): any;
mq(mediaQuery: string): boolean;
+30 -3
View File
@@ -7,28 +7,55 @@ declare module moment {
interface MomentInput {
/** Year */
years?: number;
/** Year */
year?: number;
/** Year */
y?: number;
/** Month */
months?: number;
/** Month */
month?: number;
/** Month */
M?: number;
weeks?: number;
w?: number;
/** Day/Date */
days?: number;
/** Day/Date */
day?: number;
/** Day/Date */
date?: number;
/** Day/Date */
d?: number;
/** Hour */
hours?: number;
/** Hour */
hour?: number;
/** Hour */
h?: number;
/** Minute */
minutes?: number;
/** Minute */
minute?: number;
/** Minute */
m?: number;
/** Second */
seconds?: number;
/** Second */
second?: number;
/** Second */
s?: number;
/** Millisecond */
milliseconds?: number;
/** Millisecond */
millisecond?: number;
/** Millisecond */
ms?: number;
}
+13 -14
View File
@@ -1,18 +1,17 @@
/// <reference path="node.d.ts" />
import assert = require("assert");
import fs = require("fs");
import events = require("events");
import zlib = require("zlib");
import url = require('url');
import util = require("util");
import crypto = require("crypto");
import tls = require("tls");
import http = require("http");
import net = require("net");
import dgram = require("dgram");
import querystring = require('querystring');
import path = require("path");
import * as assert from "assert";
import * as fs from "fs";
import * as events from "events";
import * as zlib from "zlib";
import * as url from "url";
import * as util from "util";
import * as crypto from "crypto";
import * as tls from "tls";
import * as http from "http";
import * as net from "net";
import * as dgram from "dgram";
import * as querystring from "querystring";
import * as path from "path";
assert(1 + 1 - 2 === 0, "The universe isn't how it should.");
+25 -25
View File
@@ -422,9 +422,9 @@ declare module "events" {
}
declare module "http" {
import events = require("events");
import net = require("net");
import stream = require("stream");
import * as events from "events";
import * as net from "net";
import * as stream from "stream";
export interface Server extends events.EventEmitter {
listen(port: number, hostname?: string, backlog?: number, callback?: Function): Server;
@@ -568,8 +568,8 @@ declare module "http" {
}
declare module "cluster" {
import child = require("child_process");
import events = require("events");
import * as child from "child_process";
import * as events from "events";
export interface ClusterSettings {
exec?: string;
@@ -608,7 +608,7 @@ declare module "cluster" {
}
declare module "zlib" {
import stream = require("stream");
import * as stream from "stream";
export interface ZlibOptions { chunkSize?: number; windowBits?: number; level?: number; memLevel?: number; strategy?: number; dictionary?: any; }
export interface Gzip extends stream.Transform { }
@@ -693,9 +693,9 @@ declare module "os" {
}
declare module "https" {
import tls = require("tls");
import events = require("events");
import http = require("http");
import * as tls from "tls";
import * as events from "events";
import * as http from "http";
export interface ServerOptions {
pfx?: any;
@@ -759,8 +759,8 @@ declare module "punycode" {
}
declare module "repl" {
import stream = require("stream");
import events = require("events");
import * as stream from "stream";
import * as events from "events";
export interface ReplOptions {
prompt?: string;
@@ -777,8 +777,8 @@ declare module "repl" {
}
declare module "readline" {
import events = require("events");
import stream = require("stream");
import * as events from "events";
import * as stream from "stream";
export interface ReadLine extends events.EventEmitter {
setPrompt(prompt: string, length: number): void;
@@ -812,8 +812,8 @@ declare module "vm" {
}
declare module "child_process" {
import events = require("events");
import stream = require("stream");
import * as events from "events";
import * as stream from "stream";
export interface ChildProcess extends events.EventEmitter {
stdin: stream.Writable;
@@ -939,7 +939,7 @@ declare module "dns" {
}
declare module "net" {
import stream = require("stream");
import * as stream from "stream";
export interface Socket extends stream.Duplex {
// Extended base methods
@@ -1007,7 +1007,7 @@ declare module "net" {
}
declare module "dgram" {
import events = require("events");
import * as events from "events";
interface RemoteInfo {
address: string;
@@ -1037,8 +1037,8 @@ declare module "dgram" {
}
declare module "fs" {
import stream = require("stream");
import events = require("events");
import * as stream from "stream";
import * as events from "events";
interface Stats {
isFile(): boolean;
@@ -1476,9 +1476,9 @@ declare module "string_decoder" {
}
declare module "tls" {
import crypto = require("crypto");
import net = require("net");
import stream = require("stream");
import * as crypto from "crypto";
import * as net from "net";
import * as stream from "stream";
var CLIENT_RENEG_LIMIT: number;
var CLIENT_RENEG_WINDOW: number;
@@ -1654,7 +1654,7 @@ declare module "crypto" {
}
declare module "stream" {
import events = require("events");
import * as events from "events";
export interface Stream extends events.EventEmitter {
pipe<T extends NodeJS.WritableStream>(destination: T, options?: { end?: boolean; }): T;
@@ -1819,7 +1819,7 @@ declare module "assert" {
}
declare module "tty" {
import net = require("net");
import * as net from "net";
export function isatty(fd: number): boolean;
export interface ReadStream extends net.Socket {
@@ -1833,7 +1833,7 @@ declare module "tty" {
}
declare module "domain" {
import events = require("events");
import * as events from "events";
export class Domain extends events.EventEmitter {
run(fn: Function): void;
+1 -1
View File
@@ -82,7 +82,7 @@ interface noUiSliderOptions {
animate?: boolean;
/**
* All values on the slider are part of a range. The range has a minimum and maximum value.
*
*/
behaviour?: string;
/**
* To format the slider output, noUiSlider offers a format option.
@@ -1 +0,0 @@
--noImplicitAny --module commonjs --target es5
+1 -1
View File
@@ -24,7 +24,7 @@ doc.addPage({
});
doc.addPage({
margins: {
margin: {
top: 50,
bottom: 50,
left: 72,
+71
View File
@@ -0,0 +1,71 @@
// Type definitions for Postal v0.8.9
// Project: https://github.com/postaljs/postal.js
// Definitions by: Lokesh Peta <https://github.com/lokeshpeta/>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
/// <reference path="../underscore/underscore.d.ts" />
interface IConfiguration{
SYSTEM_CHANNEL: string;
DEFAULT_CHANNEL: string;
resolver: any;
}
interface ISubscriptionDefinition{
unsubscribe(): void;
subscribe(callback: (data: any, envelope: IEnvelope)=> void): void;
defer():ISubscriptionDefinition;
disposeAfter(maxCalls: number): ISubscriptionDefinition;
distinctUntilChanged(): ISubscriptionDefinition;
once(): ISubscriptionDefinition;
withConstraint(predicate: Function): ISubscriptionDefinition;
withConstraints(predicates: Array<Function>): ISubscriptionDefinition;
withContext(context: any): ISubscriptionDefinition;
withDebounce(milliseconds: number, immediate: boolean ): ISubscriptionDefinition;
withDelay(milliseconds: number): ISubscriptionDefinition;
withThrottle(milliseconds: number): ISubscriptionDefinition;
}
interface IEnvelope{
topic: string;
data?: any;
/*Uses DEFAULT_CHANNEL if no channel is provided*/
channel?: string;
timeStamp?: string;
}
interface IChannelDefinition {
subscribe(topic: string): ISubscriptionDefinition;
subscribe(topic: string, callback: (data: any, envelope: IEnvelope)=> void): ISubscriptionDefinition;
publish(topic: string, data?: any): void;
publish(envelope: IEnvelope): void;
channel: string;
}
interface IPostalUtils{
getSubscribersFor(channel: string, tpc: any): any;
reset(): void;
}
interface IPostal {
channel(name?:string): IChannelDefinition;
linkChannels(sources: IEnvelope | IEnvelope[], destinations: IEnvelope | IEnvelope[]): ISubscriptionDefinition[];
utils: IPostalUtils;
configuration: IConfiguration;
}
declare var postal: IPostal;
declare module "postal" {
var postal: IPostal;
export = postal;
}
+67 -32
View File
@@ -1,33 +1,48 @@
// Type definitions for Postal v0.8.9
// Type definitions for Postal v1.0.6
// Project: https://github.com/postaljs/postal.js
// Definitions by: Lokesh Peta <https://github.com/lokeshpeta/>
// Definitions by: Lokesh Peta <https://github.com/lokeshpeta/>, Paul Jolly <https://github.com/myitcv>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
/// <reference path="../underscore/underscore.d.ts" />
interface IConfiguration{
interface IConfiguration {
SYSTEM_CHANNEL: string;
DEFAULT_CHANNEL: string;
resolver: any;
resolver: IResolver;
}
interface ISubscriptionDefinition{
unsubscribe(): void;
subscribe(callback: (data: any, envelope: IEnvelope)=> void): void;
defer():ISubscriptionDefinition;
interface IResolver {
compare(binding: string, topic: string, headerOptions: {}): boolean;
reset(): void;
purge(options?: {topic?: string, binding?: string, compact?: boolean}): void;
}
interface ICallback {
(data: any, envelope: IEnvelope): void
}
interface ISubscriptionDefinition {
channel: string;
topic: string;
callback: ICallback;
// after and before lack documentation
constraint(predicateFn: (data: any, envelope: IEnvelope) => boolean): ISubscriptionDefinition;
constraints(predicateFns: ((data: any, envelope: IEnvelope) => boolean)[]): ISubscriptionDefinition;
context(theContext: any): ISubscriptionDefinition;
debounce(interval: number): ISubscriptionDefinition;
defer(): ISubscriptionDefinition;
delay(waitTime: number): ISubscriptionDefinition;
disposeAfter(maxCalls: number): ISubscriptionDefinition;
distinct(): ISubscriptionDefinition;
distinctUntilChanged(): ISubscriptionDefinition;
logError(): ISubscriptionDefinition;
once(): ISubscriptionDefinition;
withConstraint(predicate: Function): ISubscriptionDefinition;
withConstraints(predicates: Array<Function>): ISubscriptionDefinition;
withContext(context: any): ISubscriptionDefinition;
withDebounce(milliseconds: number, immediate: boolean ): ISubscriptionDefinition;
withDelay(milliseconds: number): ISubscriptionDefinition;
withThrottle(milliseconds: number): ISubscriptionDefinition;
throttle(interval: number): ISubscriptionDefinition;
subscribe(callback: ICallback): ISubscriptionDefinition;
unsubscribe(): void;
}
interface IEnvelope{
interface IEnvelope {
topic: string;
data?: any;
@@ -39,26 +54,45 @@ interface IEnvelope{
interface IChannelDefinition {
subscribe(topic: string): ISubscriptionDefinition;
subscribe(topic: string, callback: (data: any, envelope: IEnvelope)=> void): ISubscriptionDefinition;
subscribe(topic: string, callback: ICallback): ISubscriptionDefinition;
publish(topic: string, data?: any): void;
publish(envelope: IEnvelope): void;
channel: string;
}
interface IPostalUtils{
getSubscribersFor(channel: string, tpc: any): any;
reset(): void;
interface ISourceArg {
topic: string;
channel?: string;
}
interface IDestinationArg {
topic: string | ((topic: string) => string);
channel?: string;
}
interface IPostal {
channel(name?:string): IChannelDefinition;
linkChannels(sources: IEnvelope | IEnvelope[], destinations: IEnvelope | IEnvelope[]): ISubscriptionDefinition[];
utils: IPostalUtils;
subscriptions: {};
wiretaps: ICallback[];
addWireTap(callback: ICallback): () => void;
channel(name?: string): IChannelDefinition;
getSubscribersFor(): ISubscriptionDefinition[];
getSubscribersFor(options: {channel?: string, topic?: string, context?: any}): ISubscriptionDefinition[];
getSubscribersFor(predicateFn: (sub: ISubscriptionDefinition) => boolean): ISubscriptionDefinition[];
linkChannels(source: ISourceArg | ISourceArg[], destination: IDestinationArg | IDestinationArg[]): void;
publish(envelope: IEnvelope): void;
reset(): void;
subscribe(options: {channel?: string, topic: string, callback: ICallback}): ISubscriptionDefinition;
unsubscribe(sub: ISubscriptionDefinition): void;
unsubscribeFor(): void;
unsubscribeFor(options: {channel?: string, topic?: string, context?: any}): void;
configuration: IConfiguration;
}
@@ -66,6 +100,7 @@ interface IPostal {
declare var postal: IPostal;
declare module "postal" {
var postal: IPostal;
export = postal;
}
var postal: IPostal;
export = postal;
}
-2
View File
@@ -1,2 +0,0 @@
--noImplicitAny
+9 -4
View File
@@ -13,6 +13,7 @@ import DragSource = ReactDnd.DragSource;
import DropTarget = ReactDnd.DropTarget;
import DragDropContext = ReactDnd.DragDropContext;
import HTML5Backend = require('react-dnd/modules/backends/HTML5');
import TestBackend = require('react-dnd/modules/backends/Test');
// Game Component
// ----------------------------------------------------------------------
@@ -247,14 +248,18 @@ module Board {
}
}
var DndBoard = DragDropContext(HTML5Backend)(Board);
export var create = React.createFactory(DndBoard);
export var createWithHTMLBackend = React.createFactory(DragDropContext(HTML5Backend)(Board));
export var createWithTestBackend = React.createFactory(DragDropContext(TestBackend)(Board));
}
// Render the Board Component
// ----------------------------------------------------------------------
Board.create({
Board.createWithHTMLBackend({
knightPosition: [0, 0]
});
Board.createWithTestBackend({
knightPosition: [0, 0]
});
+16
View File
@@ -170,3 +170,19 @@ declare module "react-dnd/modules/backends/HTML5" {
export = HTML5Backend;
}
declare module "react-dnd/modules/backends/Test" {
class TestBackend {
setup(): void;
teardown(): void;
connectDragSource(): void;
connectDropTarget(): void;
simulateBeginDrag(sourceIds: __ReactDnd.Identifier[], options?: {}): void;
simulatePublishDragSource(): void;
simulateHover(targetIds: __ReactDnd.Identifier[], options?: {}): void;
simulateDrop(): void;
simulateEndDrag(): void;
}
export = TestBackend;
}
+2
View File
@@ -84,6 +84,8 @@ class ModernComponent extends React.Component<Props, State>
someOtherValue: React.PropTypes.string
}
context: Context;
getChildContext() {
return {
someOtherValue: 'foo'
+5 -2
View File
@@ -137,7 +137,7 @@ declare module "react/addons" {
forceUpdate(): void;
props: P;
state: S;
context: any;
context: {};
refs: {
[key: string]: Component<any, any>
};
@@ -428,6 +428,8 @@ declare module "react/addons" {
crossOrigin?: string;
data?: string;
dateTime?: string;
defaultChecked?: boolean;
defaultValue?: string;
defer?: boolean;
dir?: string;
disabled?: boolean;
@@ -534,6 +536,7 @@ declare module "react/addons" {
fy?: number | string;
gradientTransform?: string;
gradientUnits?: string;
height?: number | string;
markerEnd?: string;
markerMid?: string;
markerStart?: string;
@@ -558,6 +561,7 @@ declare module "react/addons" {
transform?: string;
version?: string;
viewBox?: string;
width?: number | string;
x1?: number | string;
x2?: number | string;
x?: number | string;
@@ -1048,4 +1052,3 @@ declare module "react/addons" {
identifiedTouch(identifier: number): Touch;
}
}
+5 -1
View File
@@ -139,7 +139,7 @@ declare module React {
render(): JSX.Element;
props: P;
state: S;
context: any;
context: {};
refs: {
[key: string]: Component<any, any>
};
@@ -430,6 +430,8 @@ declare module React {
crossOrigin?: string;
data?: string;
dateTime?: string;
defaultChecked?: boolean;
defaultValue?: string;
defer?: boolean;
dir?: string;
disabled?: boolean;
@@ -541,6 +543,7 @@ declare module React {
fy?: number | string;
gradientTransform?: string;
gradientUnits?: string;
height?: number | string;
markerEnd?: string;
markerMid?: string;
markerStart?: string;
@@ -565,6 +568,7 @@ declare module React {
transform?: string;
version?: string;
viewBox?: string;
width?: number | string;
x1?: number | string;
x2?: number | string;
x?: number | string;
+2
View File
@@ -82,6 +82,8 @@ class ModernComponent extends React.Component<Props, State>
someOtherValue: React.PropTypes.string
}
context: Context;
getChildContext() {
return {
someOtherValue: 'foo'
+5 -1
View File
@@ -139,7 +139,7 @@ declare module __React {
render(): JSX.Element;
props: P;
state: S;
context: any;
context: {};
refs: {
[key: string]: Component<any, any>
};
@@ -430,6 +430,8 @@ declare module __React {
crossOrigin?: string;
data?: string;
dateTime?: string;
defaultChecked?: boolean;
defaultValue?: string;
defer?: boolean;
dir?: string;
disabled?: boolean;
@@ -541,6 +543,7 @@ declare module __React {
fy?: number | string;
gradientTransform?: string;
gradientUnits?: string;
height?: number | string;
markerEnd?: string;
markerMid?: string;
markerStart?: string;
@@ -565,6 +568,7 @@ declare module __React {
transform?: string;
version?: string;
viewBox?: string;
width?: number | string;
x1?: number | string;
x2?: number | string;
x?: number | string;
+2 -3
View File
@@ -1,4 +1,4 @@
/// <reference path="resemble.d.ts" />
/// <reference path="resemblejs.d.ts" />
resemble.outputSettings({
errorColor: {
@@ -14,7 +14,7 @@ resemble.outputSettings({
resemble("images/image.png").onComplete(function(data) {
var r: number = data.red;
var g: number = data.green;
var b: number = data.blue;
var b: number = data.blue;
var brightness: number = data.brightness;
});
@@ -31,4 +31,3 @@ resemble("images/image2.png").compareTo("images/image2.png")
var diffImageDataUrl: string = data.getImageDataUrl();
var difference: number = data.misMatchPercentage;
});
+2 -2
View File
@@ -27,7 +27,7 @@ jQuery(document).ready(function () {
fullscreen: {
// fullscreen options go gere
enabled: true,
native: true
nativeFS: true
}
});
});
@@ -49,7 +49,7 @@ jQuery(document).ready(function () {
$(".royalSlider").royalSlider({
// general options go gere
autoScaleSlider: true,
autoPlay: {
autoplay: {
// autoplay options go gere
enabled: true,
pauseOnHover: true
+212 -1
View File
@@ -213,4 +213,215 @@ promiseMe = myModelInst.increment({});
promiseMe = myModelInst.decrement({}, incrOpts);
isBool = myModelInst.equal(myModelInst);
isBool = myModelInst.equalsOneOf([myModelInst]);
myModelPojo = myModelInst.toJSON();
myModelPojo = myModelInst.toJSON();
// data types test
var types:any = Sequelize.STRING;
types = Sequelize.STRING(12);
types = Sequelize.STRING(12, true);
types = Sequelize.STRING.BINARY;
types = Sequelize.STRING(12).BINARY;
types = Sequelize.STRING.BINARY(12);
types = Sequelize.STRING({length:12, binary:true});
types = Sequelize.STRING({length:12}).BINARY;
types = Sequelize.CHAR;
types = Sequelize.CHAR(12);
types = Sequelize.CHAR(12, true);
types = Sequelize.CHAR.BINARY;
types = Sequelize.CHAR(12).BINARY;
types = Sequelize.CHAR.BINARY(12);
types = Sequelize.CHAR({length:12, binary:true});
types = Sequelize.CHAR({length:12}).BINARY;
types = Sequelize.TEXT;
types = Sequelize.TEXT('tiny');
types = Sequelize.TEXT({length:'tiny'});
types = Sequelize.NUMBER;
var numberOptions = {length:12, zerofill:true, decimals:1, precision:1, scale:1, unsigned:true};
types = Sequelize.NUMBER(numberOptions);
types = Sequelize.INTEGER;
types = Sequelize.INTEGER.ZEROFILL;
types = Sequelize.INTEGER.UNSIGNED;
types = Sequelize.INTEGER.ZEROFILL.UNSIGNED;
types = Sequelize.INTEGER.UNSIGNED.ZEROFILL;
types = Sequelize.INTEGER(12);
types = Sequelize.INTEGER(12).ZEROFILL;
types = Sequelize.INTEGER(12).UNSIGNED;
types = Sequelize.INTEGER(12).ZEROFILL.UNSIGNED;
types = Sequelize.INTEGER(12).UNSIGNED.ZEROFILL;
types = Sequelize.INTEGER(numberOptions);
types = Sequelize.INTEGER(numberOptions).ZEROFILL;
types = Sequelize.INTEGER(numberOptions).UNSIGNED;
types = Sequelize.INTEGER(numberOptions).ZEROFILL.UNSIGNED;
types = Sequelize.INTEGER(numberOptions).UNSIGNED.ZEROFILL;
types = Sequelize.BIGINT;
types = Sequelize.BIGINT.ZEROFILL;
types = Sequelize.BIGINT.UNSIGNED;
types = Sequelize.BIGINT.ZEROFILL.UNSIGNED;
types = Sequelize.BIGINT.UNSIGNED.ZEROFILL;
types = Sequelize.BIGINT(12);
types = Sequelize.BIGINT(12).ZEROFILL;
types = Sequelize.BIGINT(12).UNSIGNED;
types = Sequelize.BIGINT(12).ZEROFILL.UNSIGNED;
types = Sequelize.BIGINT(12).UNSIGNED.ZEROFILL;
types = Sequelize.BIGINT(numberOptions);
types = Sequelize.BIGINT(numberOptions).ZEROFILL;
types = Sequelize.BIGINT(numberOptions).UNSIGNED;
types = Sequelize.BIGINT(numberOptions).ZEROFILL.UNSIGNED;
types = Sequelize.BIGINT(numberOptions).UNSIGNED.ZEROFILL;
types = Sequelize.FLOAT;
types = Sequelize.FLOAT.ZEROFILL;
types = Sequelize.FLOAT.UNSIGNED;
types = Sequelize.FLOAT.ZEROFILL.UNSIGNED;
types = Sequelize.FLOAT.UNSIGNED.ZEROFILL;
types = Sequelize.FLOAT(12);
types = Sequelize.FLOAT(12).ZEROFILL;
types = Sequelize.FLOAT(12).UNSIGNED;
types = Sequelize.FLOAT(12).ZEROFILL.UNSIGNED;
types = Sequelize.FLOAT(12).UNSIGNED.ZEROFILL;
types = Sequelize.FLOAT(12,12);
types = Sequelize.FLOAT(12,12).ZEROFILL;
types = Sequelize.FLOAT(12,12).UNSIGNED;
types = Sequelize.FLOAT(12,12).ZEROFILL.UNSIGNED;
types = Sequelize.FLOAT(12,12).UNSIGNED.ZEROFILL;
types = Sequelize.FLOAT(numberOptions);
types = Sequelize.FLOAT(numberOptions).ZEROFILL;
types = Sequelize.FLOAT(numberOptions).UNSIGNED;
types = Sequelize.FLOAT(numberOptions).ZEROFILL.UNSIGNED;
types = Sequelize.FLOAT(numberOptions).UNSIGNED.ZEROFILL;
types = Sequelize.DOUBLE;
types = Sequelize.DOUBLE.ZEROFILL;
types = Sequelize.DOUBLE.UNSIGNED;
types = Sequelize.DOUBLE.ZEROFILL.UNSIGNED;
types = Sequelize.DOUBLE.UNSIGNED.ZEROFILL;
types = Sequelize.DOUBLE(12);
types = Sequelize.DOUBLE(12).ZEROFILL;
types = Sequelize.DOUBLE(12).UNSIGNED;
types = Sequelize.DOUBLE(12).ZEROFILL.UNSIGNED;
types = Sequelize.DOUBLE(12).UNSIGNED.ZEROFILL;
types = Sequelize.DOUBLE(12,12);
types = Sequelize.DOUBLE(12,12).ZEROFILL;
types = Sequelize.DOUBLE(12,12).UNSIGNED;
types = Sequelize.DOUBLE(12,12).ZEROFILL.UNSIGNED;
types = Sequelize.DOUBLE(12,12).UNSIGNED.ZEROFILL;
types = Sequelize.DOUBLE(numberOptions);
types = Sequelize.DOUBLE(numberOptions).ZEROFILL;
types = Sequelize.DOUBLE(numberOptions).UNSIGNED;
types = Sequelize.DOUBLE(numberOptions).ZEROFILL.UNSIGNED;
types = Sequelize.DOUBLE(numberOptions).UNSIGNED.ZEROFILL;
types = Sequelize.TIME;
types = Sequelize.DATE;
types = Sequelize.DATEONLY;
types = Sequelize.BOOLEAN;
types = Sequelize.NOW;
types = Sequelize.BLOB;
types = Sequelize.BLOB('tiny');
types = Sequelize.BLOB({length:'tiny'});
types = Sequelize.DECIMAL;
types = Sequelize.DECIMAL.ZEROFILL;
types = Sequelize.DECIMAL.UNSIGNED;
types = Sequelize.DECIMAL.ZEROFILL.UNSIGNED;
types = Sequelize.DECIMAL.UNSIGNED.ZEROFILL;
types = Sequelize.DECIMAL(12,12);
types = Sequelize.DECIMAL(12,12).ZEROFILL;
types = Sequelize.DECIMAL(12,12).UNSIGNED;
types = Sequelize.DECIMAL(12,12).ZEROFILL.UNSIGNED;
types = Sequelize.DECIMAL(12,12).UNSIGNED.ZEROFILL;
types = Sequelize.DECIMAL(numberOptions);
types = Sequelize.DECIMAL(numberOptions).ZEROFILL;
types = Sequelize.DECIMAL(numberOptions).UNSIGNED;
types = Sequelize.DECIMAL(numberOptions).ZEROFILL.UNSIGNED;
types = Sequelize.DECIMAL(numberOptions).UNSIGNED.ZEROFILL;
types = Sequelize.NUMERIC;
types = Sequelize.NUMERIC.ZEROFILL;
types = Sequelize.NUMERIC.UNSIGNED;
types = Sequelize.NUMERIC.ZEROFILL.UNSIGNED;
types = Sequelize.NUMERIC.UNSIGNED.ZEROFILL;
types = Sequelize.NUMERIC(12,12);
types = Sequelize.NUMERIC(12,12).ZEROFILL;
types = Sequelize.NUMERIC(12,12).UNSIGNED;
types = Sequelize.NUMERIC(12,12).ZEROFILL.UNSIGNED;
types = Sequelize.NUMERIC(12,12).UNSIGNED.ZEROFILL;
types = Sequelize.NUMERIC(numberOptions);
types = Sequelize.NUMERIC(numberOptions).ZEROFILL;
types = Sequelize.NUMERIC(numberOptions).UNSIGNED;
types = Sequelize.NUMERIC(numberOptions).ZEROFILL.UNSIGNED;
types = Sequelize.NUMERIC(numberOptions).UNSIGNED.ZEROFILL;
types = Sequelize.UUID;
types = Sequelize.UUIDV1;
types = Sequelize.UUIDV4;
types = Sequelize.HSTORE;
types = Sequelize.JSON;
types = Sequelize.JSONB;
types = Sequelize.VIRTUAL;
types = Sequelize.ARRAY(Sequelize.INTEGER(12));
types = Sequelize.ARRAY({type: Sequelize.BLOB});
var obj = {};
var isbool:boolean = types.is(obj, obj);
types = Sequelize.NONE;
types = Sequelize.ENUM("one", "two", 'three');
types = Sequelize.RANGE(Sequelize.INTEGER(12));
types = Sequelize.RANGE({subtype: Sequelize.BLOB});
types = Sequelize.REAL;
types = Sequelize.REAL.ZEROFILL;
types = Sequelize.REAL.UNSIGNED;
types = Sequelize.REAL.ZEROFILL.UNSIGNED;
types = Sequelize.REAL.UNSIGNED.ZEROFILL;
types = Sequelize.REAL(12,12);
types = Sequelize.REAL(12,12).ZEROFILL;
types = Sequelize.REAL(12,12).UNSIGNED;
types = Sequelize.REAL(12,12).ZEROFILL.UNSIGNED;
types = Sequelize.REAL(12,12).UNSIGNED.ZEROFILL;
types = Sequelize.REAL(numberOptions);
types = Sequelize.REAL(numberOptions).ZEROFILL;
types = Sequelize.REAL(numberOptions).UNSIGNED;
types = Sequelize.REAL(numberOptions).ZEROFILL.UNSIGNED;
types = Sequelize.REAL(numberOptions).UNSIGNED.ZEROFILL;
types = Sequelize.DOUBLE;
types = Sequelize.DOUBLE.ZEROFILL;
types = Sequelize.DOUBLE.UNSIGNED;
types = Sequelize.DOUBLE.ZEROFILL.UNSIGNED;
types = Sequelize.DOUBLE.UNSIGNED.ZEROFILL;
types = Sequelize.DOUBLE(12,12);
types = Sequelize.DOUBLE(12,12).ZEROFILL;
types = Sequelize.DOUBLE(12,12).UNSIGNED;
types = Sequelize.DOUBLE(12,12).ZEROFILL.UNSIGNED;
types = Sequelize.DOUBLE(12,12).UNSIGNED.ZEROFILL;
types = Sequelize.DOUBLE(numberOptions);
types = Sequelize.DOUBLE(numberOptions).ZEROFILL;
types = Sequelize.DOUBLE(numberOptions).UNSIGNED;
types = Sequelize.DOUBLE(numberOptions).ZEROFILL.UNSIGNED;
types = Sequelize.DOUBLE(numberOptions).UNSIGNED.ZEROFILL;
types = Sequelize["DOUBLE PRECISION"];
types = Sequelize["DOUBLE PRECISION"].ZEROFILL;
types = Sequelize["DOUBLE PRECISION"].UNSIGNED;
types = Sequelize["DOUBLE PRECISION"].ZEROFILL.UNSIGNED;
types = Sequelize["DOUBLE PRECISION"].UNSIGNED.ZEROFILL;
types = Sequelize["DOUBLE PRECISION"](12,12);
types = Sequelize["DOUBLE PRECISION"](12,12).ZEROFILL;
types = Sequelize["DOUBLE PRECISION"](12,12).UNSIGNED;
types = Sequelize["DOUBLE PRECISION"](12,12).ZEROFILL.UNSIGNED;
types = Sequelize["DOUBLE PRECISION"](12,12).UNSIGNED.ZEROFILL;
types = Sequelize["DOUBLE PRECISION"](numberOptions);
types = Sequelize["DOUBLE PRECISION"](numberOptions).ZEROFILL;
types = Sequelize["DOUBLE PRECISION"](numberOptions).UNSIGNED;
types = Sequelize["DOUBLE PRECISION"](numberOptions).ZEROFILL.UNSIGNED;
types = Sequelize["DOUBLE PRECISION"](numberOptions).UNSIGNED.ZEROFILL;
+2 -2
View File
@@ -1,7 +1,7 @@
/// <reference path="serve-static.d.ts" />
import express = require('express');
import serveStatic = require('serve-static');
import * as express from 'express';
import * as serveStatic from 'serve-static';
var app = express();
app.use(serveStatic('/1'));
+4 -4
View File
@@ -5,8 +5,8 @@
/* =================== USAGE ===================
import serveStatic = require('serve-static');
app.use(serveStatic('public/ftp', {'index': ['default.html', 'default.htm']}))
import * as serveStatic from "serve-static";
app.use(serveStatic("public/ftp", {"index": ["default.html", "default.htm"]}))
=============================================== */
@@ -14,7 +14,7 @@
/// <reference path="../mime/mime.d.ts" />
declare module "serve-static" {
import express = require('express');
import * as express from "express";
/**
* Create a new middleware function to serve files from within a given root directory.
@@ -76,7 +76,7 @@ declare module "serve-static" {
setHeaders?: (res: express.Response, path: string, stat: any) => any;
}): express.Handler;
import m = require('mime');
import * as m from "mime";
module serveStatic {
var mime: typeof m;
-1
View File
@@ -6507,7 +6507,6 @@ declare module SP {
static getTaxonomySession(context: SP.ClientContext): TaxonomySession;
get_offlineTermStoreNames(): string[];
get_termStores(): TermStoreCollection;
getTerms(termLabel: string, trimUnavailable: boolean): TermCollection;
getTerms(labelMatchInformation: LabelMatchInformation): TermCollection;
updateCache(): void;
getTerm(guid: SP.Guid): Term;
+2 -2
View File
@@ -18,7 +18,7 @@ declare module "smoothie"
export interface ITimeSeriesPresentationOptions
{
stokeStyle?: string;
strokeStyle?: string;
fillStyle?: string;
lineWidth?: number;
}
@@ -73,7 +73,7 @@ declare module "smoothie"
/** The pixel width of grid lines. */
lineWidth?: number;
/** Colour of grid lines. */
stokeStyle?: string;
strokeStyle?: string;
/** Distance between vertical grid lines. */
millisPerLine?: number;
/** Controls whether grid lines are 1px sharp, or softened. */
+9
View File
@@ -0,0 +1,9 @@
/// <reference path="snake-case.d.ts" />
import camelCase = require('snake-case');
console.log(camelCase('string')); // => "string"
console.log(camelCase('camelCase')); // => "camel_case"
console.log(camelCase('sentence case')); // => "sentence_case"
console.log(camelCase('MY STRING', 'tr')); // => "my_strıng"
+9
View File
@@ -0,0 +1,9 @@
// Type definitions for snake-case
// Project: https://github.com/blakeembrey/snake-case
// Definitions by: Sam Saint-Pettersen <https://github.com/stpettersens>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
declare module "snake-case" {
function snakeCase(string: string, locale?: string): string;
export = snakeCase;
}
-1
View File
@@ -1 +0,0 @@
+5 -1
View File
@@ -28,6 +28,10 @@ declare module THREE {
maxDistance:number;
keys:number[];
position0: THREE.Vector3;
target0: THREE.Vector3;
up0: THREE.Vector3;
update():void;
reset():void;
checkDistances():void;
@@ -38,4 +42,4 @@ declare module THREE {
handleResize():void;
handleEvent(event: any):void;
}
}
}
+23
View File
@@ -0,0 +1,23 @@
// Type definitions for three.js (TransformControls.js)
// Project: https://github.com/mrdoob/three.js/blob/master/examples/js/controls/TransformControls.js
// Definitions by: Stefan Profanter <https://github.com/Pro>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
/// <reference path="./three.d.ts" />
declare module THREE {
class TransformControls extends Object3D {
constructor(object:Camera, domElement?:HTMLElement);
object: Object3D;
update():void;
detach(object: Object3D): void;
attach(object: Object3D): void;
setMode(mode: string): void;
setSnap(snap: any): void;
setSize(size:number):void;
setSpace(space:string):void;
}
}
+1 -1
View File
@@ -5672,7 +5672,7 @@ declare module THREE {
}
export class BoundingBoxHelper extends Mesh {
constructor(object: Object3D, hex?: number);
constructor(object?: Object3D, hex?: number);
object: Object3D;
box: Box3;
-1
View File
@@ -1 +0,0 @@

Some files were not shown because too many files have changed in this diff Show More