mirror of
https://github.com/wassname/DefinitelyTyped.git
synced 2026-09-09 11:13:57 +08:00
Merge branch 'master' into streamjs
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
/// <reference path='../angularjs/angular.d.ts' />
|
||||
/// <reference path='angular-dynamic-locale.d.ts' />
|
||||
|
||||
var app = angular.module('testModule', ['tmh.dynamicLocale']);
|
||||
app.config((localStorageServiceProvider: angular.dynamicLocale.tmhDynamicLocaleProvider) => {
|
||||
localStorageServiceProvider
|
||||
.localeLocationPattern("app/config/locales/")
|
||||
.useCookieStorage();
|
||||
});
|
||||
|
||||
class LocaleTestController {
|
||||
|
||||
constructor(tmhDynamicLocaleService: angular.dynamicLocale.tmhDynamicLocaleService) {
|
||||
|
||||
var locale = tmhDynamicLocaleService.get();
|
||||
|
||||
var newLocale = "mt"
|
||||
tmhDynamicLocaleService.set(newLocale);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
app.controller('TestController', LocaleTestController);
|
||||
@@ -0,0 +1,21 @@
|
||||
// Type definitions for angular-dynamic-locale v0.1.27
|
||||
// Project: https://github.com/lgalfaso/angular-dynamic-locale
|
||||
// Definitions by: Stephen Lautier <https://github.com/stephenlautier>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/// <reference path="../angularjs/angular.d.ts" />
|
||||
|
||||
declare module angular.dynamicLocale {
|
||||
|
||||
interface tmhDynamicLocaleService {
|
||||
set(locale: string): void;
|
||||
get(): string;
|
||||
}
|
||||
|
||||
interface tmhDynamicLocaleProvider extends angular.IServiceProvider {
|
||||
localeLocationPattern(location: string): tmhDynamicLocaleProvider;
|
||||
localeLocationPattern(): string;
|
||||
useStorage(storageName: string): void;
|
||||
useCookieStorage(): void;
|
||||
}
|
||||
}
|
||||
+13
-12
@@ -564,7 +564,7 @@ declare module protractor {
|
||||
*/
|
||||
element(subLocator: webdriver.Locator): ElementFinder;
|
||||
|
||||
/**
|
||||
/**
|
||||
* Calls to element may be chained to find an array of elements within a parent.
|
||||
*
|
||||
* @alias element(locator).all(locator)
|
||||
@@ -652,7 +652,7 @@ declare module protractor {
|
||||
/**
|
||||
* Override for WebElement.prototype.isElementPresent so that protractor waits
|
||||
* for Angular to settle before making the check.
|
||||
*
|
||||
*
|
||||
* @see ElementFinder.isPresent
|
||||
*
|
||||
* @param {webdriver.Locator} subLocator Locator for element to look for.
|
||||
@@ -879,7 +879,7 @@ declare module protractor {
|
||||
* filteredElements[0].click();
|
||||
* });
|
||||
*
|
||||
* @param {function(ElementFinder, number): webdriver.WebElement.Promise} filterFn
|
||||
* @param {function(ElementFinder, number): webdriver.WebElement.Promise} filterFn
|
||||
* Filter function that will test if an element should be returned.
|
||||
* filterFn can either return a boolean or a promise that resolves to a boolean.
|
||||
* @return {!ElementArrayFinder} A ElementArrayFinder that represents an array
|
||||
@@ -888,11 +888,11 @@ declare module protractor {
|
||||
filter(filterFn: (element: ElementFinder, index: number) => any): ElementArrayFinder;
|
||||
|
||||
/**
|
||||
* Apply a reduce function against an accumulator and every element found
|
||||
* Apply a reduce function against an accumulator and every element found
|
||||
* using the locator (from left-to-right). The reduce function has to reduce
|
||||
* every element into a single value (the accumulator). Returns promise of
|
||||
* the accumulator. The reduce function receives the accumulator, current
|
||||
* ElementFinder, the index, and the entire array of ElementFinders,
|
||||
* every element into a single value (the accumulator). Returns promise of
|
||||
* the accumulator. The reduce function receives the accumulator, current
|
||||
* ElementFinder, the index, and the entire array of ElementFinders,
|
||||
* respectively.
|
||||
*
|
||||
* @alias element.all(locator).reduce(reduceFn)
|
||||
@@ -912,11 +912,11 @@ declare module protractor {
|
||||
*
|
||||
* expect(value).toEqual('First Second Third ');
|
||||
*
|
||||
* @param {function(number, ElementFinder, number, Array.<ElementFinder>)}
|
||||
* @param {function(number, ElementFinder, number, Array.<ElementFinder>)}
|
||||
* reduceFn Reduce function that reduces every element into a single value.
|
||||
* @param {*} initialValue Initial value of the accumulator.
|
||||
* @param {*} initialValue Initial value of the accumulator.
|
||||
* @return {!webdriver.promise.Promise} A promise that resolves to the final
|
||||
* value of the accumulator.
|
||||
* value of the accumulator.
|
||||
*/
|
||||
reduce<T>(reduceFn: (acc: T, element: ElementFinder, index: number, arr: ElementFinder[]) => webdriver.promise.Promise<T>, initialValue: T): webdriver.promise.Promise<T>;
|
||||
reduce<T>(reduceFn: (acc: T, element: ElementFinder, index: number, arr: ElementFinder[]) => T, initialValue: T): webdriver.promise.Promise<T>;
|
||||
@@ -924,7 +924,7 @@ declare module protractor {
|
||||
/**
|
||||
* Represents the ElementArrayFinder as an array of ElementFinders.
|
||||
*
|
||||
* @return {Array.<ElementFinder>} Return a promise, which resolves to a list
|
||||
* @return {Array.<ElementFinder>} Return a promise, which resolves to a list
|
||||
* of ElementFinders specified by the locator.
|
||||
*/
|
||||
asElementFinders_(): ElementFinder[];
|
||||
@@ -1221,6 +1221,7 @@ declare module protractor {
|
||||
|
||||
interface LocatorWithColumn extends webdriver.Locator {
|
||||
column(index: number): webdriver.Locator;
|
||||
column(name: string): webdriver.Locator;
|
||||
}
|
||||
|
||||
interface RepeaterLocator extends LocatorWithColumn {
|
||||
@@ -1299,7 +1300,7 @@ declare module protractor {
|
||||
* expect(element(by.exactBinding('person_phone')).isPresent()).toBe(true);
|
||||
* expect(element(by.exactBinding('person_phone|uppercase')).isPresent()).toBe(true);
|
||||
* expect(element(by.exactBinding('phone')).isPresent()).toBe(false);
|
||||
*
|
||||
*
|
||||
* @param {string} bindingDescriptor
|
||||
* @return {{findElementsOverride: findElementsOverride, toString: Function|string}}
|
||||
*/
|
||||
|
||||
@@ -141,6 +141,7 @@ testApp.controller('TestCtrl', (
|
||||
scope: $scope,
|
||||
template: "<div>i'm a template!</div>",
|
||||
templateUrl: '/templates/modal.html',
|
||||
backdropClass: 'modal-backdrop-test',
|
||||
windowClass: 'modal-test'
|
||||
});
|
||||
|
||||
@@ -227,4 +228,4 @@ interface IModalTestCtrlScope {
|
||||
|
||||
close(): void;
|
||||
dismiss(): void;
|
||||
}
|
||||
}
|
||||
|
||||
+13
-1
@@ -264,6 +264,11 @@ declare module angular.ui.bootstrap {
|
||||
*/
|
||||
keyboard?: boolean;
|
||||
|
||||
/**
|
||||
* additional CSS class(es) to be added to a modal backdrop template
|
||||
*/
|
||||
backdropClass?: string;
|
||||
|
||||
/**
|
||||
* additional CSS class(es) to be added to a modal window template
|
||||
*/
|
||||
@@ -590,7 +595,14 @@ declare module angular.ui.bootstrap {
|
||||
*
|
||||
* @default false
|
||||
*/
|
||||
appendtoBody?: boolean;
|
||||
appendToBody?: boolean;
|
||||
|
||||
/**
|
||||
* Determines the default open triggers for tooltips and popovers
|
||||
*
|
||||
* @default 'mouseenter' for tooltip, 'click' for popover
|
||||
*/
|
||||
trigger?: string;
|
||||
}
|
||||
|
||||
interface ITooltipProvider {
|
||||
|
||||
@@ -8,6 +8,7 @@ interface IMyResourceClass extends angular.resource.IResourceClass<IMyResource>
|
||||
///////////////////////////////////////
|
||||
var actionDescriptor: angular.resource.IActionDescriptor;
|
||||
|
||||
actionDescriptor.url = '/api/test-url/'
|
||||
actionDescriptor.headers = { header: 'value' };
|
||||
actionDescriptor.isArray = true;
|
||||
actionDescriptor.method = 'method action';
|
||||
@@ -135,4 +136,11 @@ mod = mod.factory('factory name', resourceServiceFactoryFunction);
|
||||
|
||||
///////////////////////////////////////
|
||||
// IResource
|
||||
///////////////////////////////////////
|
||||
///////////////////////////////////////
|
||||
|
||||
|
||||
///////////////////////////////////////
|
||||
// IResourceServiceProvider
|
||||
///////////////////////////////////////
|
||||
var resourceServiceProvider: angular.resource.IResourceServiceProvider;
|
||||
resourceServiceProvider.defaults.stripTrailingSlashes = false;
|
||||
|
||||
Vendored
+9
@@ -21,6 +21,7 @@ declare module angular.resource {
|
||||
stripTrailingSlashes?: boolean;
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// ResourceService
|
||||
// see http://docs.angularjs.org/api/ngResource.$resource
|
||||
@@ -45,6 +46,7 @@ declare module angular.resource {
|
||||
|
||||
// Just a reference to facilitate describing new actions
|
||||
interface IActionDescriptor {
|
||||
url?: string;
|
||||
method: string;
|
||||
isArray?: boolean;
|
||||
params?: any;
|
||||
@@ -143,6 +145,13 @@ declare module angular.resource {
|
||||
($resource: angular.resource.IResourceService): IResourceClass<T>;
|
||||
<U extends IResourceClass<T>>($resource: angular.resource.IResourceService): U;
|
||||
}
|
||||
|
||||
// IResourceServiceProvider used to configure global settings
|
||||
interface IResourceServiceProvider extends ng.IServiceProvider {
|
||||
|
||||
defaults: IResourceOptions;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/** extensions to base ng based on using angular-resource */
|
||||
|
||||
@@ -34,3 +34,7 @@ $routeProvider
|
||||
})
|
||||
.otherwise({ redirectTo: '/' })
|
||||
.otherwise({ redirectTo: ($routeParams?: ng.route.IRouteParamsService, $locationPath?: string, $locationSearch?: any) => "" });
|
||||
|
||||
|
||||
var current: ng.route.ICurrentRoute;
|
||||
current.locals['test-key'] = 'test-value';
|
||||
|
||||
Vendored
+1
@@ -109,6 +109,7 @@ declare module angular.route {
|
||||
// see http://docs.angularjs.org/api/ng.$route#current
|
||||
interface ICurrentRoute extends IRoute {
|
||||
locals: {
|
||||
[index: string]: any;
|
||||
$scope: IScope;
|
||||
$template: string;
|
||||
};
|
||||
|
||||
Regular → Executable
+27
-1
@@ -702,4 +702,30 @@ module locationTests {
|
||||
$location.path() == '/foo/bar'
|
||||
$location.url() == '/foo/bar?x=y'
|
||||
$location.absUrl() == 'http://example.com/#!/foo/bar?x=y'
|
||||
}
|
||||
}
|
||||
|
||||
// NgModelController
|
||||
function NgModelControllerTyping() {
|
||||
var ngModel: angular.INgModelController;
|
||||
var $http: angular.IHttpService;
|
||||
var $q: angular.IQService;
|
||||
|
||||
// See https://docs.angularjs.org/api/ng/type/ngModel.NgModelController#$validators
|
||||
ngModel.$validators['validCharacters'] = function(modelValue, viewValue) {
|
||||
var value = modelValue || viewValue;
|
||||
return /[0-9]+/.test(value) &&
|
||||
/[a-z]+/.test(value) &&
|
||||
/[A-Z]+/.test(value) &&
|
||||
/\W+/.test(value);
|
||||
};
|
||||
|
||||
ngModel.$asyncValidators['uniqueUsername'] = function(modelValue, viewValue) {
|
||||
var value = modelValue || viewValue;
|
||||
return $http.get('/api/users/' + value).
|
||||
then(function resolved() {
|
||||
return $q.reject('exists');
|
||||
}, function rejected() {
|
||||
return true;
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
Vendored
+2
-2
@@ -524,11 +524,11 @@ declare module angular {
|
||||
}
|
||||
|
||||
interface IModelValidators {
|
||||
[index: string]: (...args: any[]) => boolean;
|
||||
[index: string]: (modelValue: any, viewValue: string) => boolean;
|
||||
}
|
||||
|
||||
interface IAsyncModelValidators {
|
||||
[index: string]: (...args: any[]) => IPromise<boolean>;
|
||||
[index: string]: (modelValue: any, viewValue: string) => IPromise<any>;
|
||||
}
|
||||
|
||||
interface IModelParser {
|
||||
|
||||
Vendored
+1
-1
@@ -96,7 +96,7 @@ interface Async {
|
||||
doWhilst(fn: AsyncVoidFunction, test: () => boolean, callback: (err: any) => void): void;
|
||||
until(test: () => boolean, fn: AsyncVoidFunction, callback: (err: any) => void): void;
|
||||
doUntil(fn: AsyncVoidFunction, test: () => boolean, callback: (err: any) => void): void;
|
||||
waterfall(tasks: Function[], callback?: AsyncResultArrayCallback<any>): void;
|
||||
waterfall(tasks: Function[], callback?: (err: any, ...arguments: any[]) => void): void;
|
||||
queue<T>(worker: AsyncWorker<T>, concurrency: number): AsyncQueue<T>;
|
||||
priorityQueue<T>(worker: AsyncWorker<T>, concurrency: number): AsyncPriorityQueue<T>;
|
||||
auto(tasks: any, callback?: AsyncResultArrayCallback<any>): void;
|
||||
|
||||
Vendored
+1
-1
@@ -18,7 +18,7 @@ interface ChosenOptions {
|
||||
placeholder_text_single?: string;
|
||||
search_contains?: boolean;
|
||||
single_backstroke_delete?: boolean;
|
||||
width?: number;
|
||||
width?: number|string;
|
||||
display_disabled_options?: boolean;
|
||||
display_selected_options?: boolean;
|
||||
include_group_label_in_selected?: boolean;
|
||||
|
||||
Vendored
+1
@@ -1082,6 +1082,7 @@ declare module chrome.history {
|
||||
////////////////////
|
||||
declare module chrome.identity {
|
||||
var getAuthToken: (options: any, cb: (token: {}) => void) => void;
|
||||
var launchWebAuthFlow: (options: any, cb: (redirect_url: string) => void) => void;
|
||||
}
|
||||
|
||||
|
||||
|
||||
+16
-3
@@ -873,7 +873,7 @@ function populationPyramid() {
|
||||
// Allow the arrow keys to change the displayed year.
|
||||
window.focus();
|
||||
d3.select(window).on("keydown", function () {
|
||||
switch ((<any> d3.event).keyCode) {
|
||||
switch (d3.event.keyCode) {
|
||||
case 37: year = Math.max(year0, year - 10); break;
|
||||
case 39: year = Math.min(year1, year + 10); break;
|
||||
}
|
||||
@@ -1291,12 +1291,12 @@ function forceDirectedVoronoi() {
|
||||
d3.select(window)
|
||||
.on("keydown", function() {
|
||||
// shift
|
||||
if((<any> d3.event).keyCode == 16) {
|
||||
if(d3.event.keyCode == 16) {
|
||||
zoomToAdd = false
|
||||
}
|
||||
|
||||
// s
|
||||
if((<any> d3.event).keyCode == 83) {
|
||||
if(d3.event.keyCode == 83) {
|
||||
simulate = !simulate
|
||||
if(simulate) {
|
||||
force.start()
|
||||
@@ -2665,3 +2665,16 @@ function multiTest() {
|
||||
.attr("transform", "translate(0," + height + ")")
|
||||
.call(xAxis);
|
||||
}
|
||||
|
||||
function testD3Events () {
|
||||
d3.select('svg')
|
||||
.on('click', () => {
|
||||
var coords = [d3.event.pageX, d3.event.pageY];
|
||||
console.log("clicked", d3.event.target, "at " + coords);
|
||||
})
|
||||
.on('keypress', () => {
|
||||
if (d3.event.shiftKey) {
|
||||
console.log('shift + ' + d3.event.which);
|
||||
}
|
||||
});
|
||||
}
|
||||
Vendored
+7
-1
@@ -918,7 +918,13 @@ declare module d3 {
|
||||
}
|
||||
|
||||
/**
|
||||
* The current event's value. Use this variable in a handler registered with selection.on.
|
||||
* Interface for any and all d3 events.
|
||||
*/
|
||||
interface Event extends KeyboardEvent, MouseEvent {
|
||||
}
|
||||
|
||||
/**
|
||||
* The current event's value. Use this variable in a handler registered with `selection.on`.
|
||||
*/
|
||||
export var event: Event;
|
||||
|
||||
|
||||
Vendored
+19
-12
@@ -20,6 +20,11 @@ declare module DC {
|
||||
(t: T, r?: R): V;
|
||||
}
|
||||
|
||||
export interface IGetSetComputed<T, R, V> {
|
||||
(): R;
|
||||
(t: T): V;
|
||||
}
|
||||
|
||||
export interface Scale<T> {
|
||||
(x: any): T;
|
||||
|
||||
@@ -118,7 +123,7 @@ declare module DC {
|
||||
minWidth: IGetSet<number, T>;
|
||||
minHeight: IGetSet<number, T>;
|
||||
dimension: IGetSet<any, T>;
|
||||
data: IGetSet<(group: any) => Array<any>, T>;
|
||||
data: IGetSetComputed<(group: any) => Array<any>, Array<any>, T>;
|
||||
group: IGetSet<any, T>;
|
||||
ordering: IGetSet<Accessor<any, any>, T>;
|
||||
filterAll(): void;
|
||||
@@ -180,7 +185,7 @@ declare module DC {
|
||||
colorCalculator: IGetSet<Accessor<any, string>, T>;
|
||||
}
|
||||
|
||||
export interface CoordinateGridMixin<T> extends BaseMixin<T>, MarginMixin<T>, BaseMixin<T> {
|
||||
export interface CoordinateGridMixin<T> extends BaseMixin<T>, MarginMixin<T>, ColorMixin<T> {
|
||||
rangeChart: IGetSet<BaseMixin<any>, T>;
|
||||
zoomScale: IGetSet<Array<any>, T>;
|
||||
zoomOutRestrict: IGetSet<boolean, T>;
|
||||
@@ -297,19 +302,21 @@ declare module DC {
|
||||
elasticRadius: IGetSet<boolean, BubbleChart>;
|
||||
}
|
||||
|
||||
export interface CompositeChart extends CoordinateGridMixin<CompositeChart> {
|
||||
useRightAxisGridLines: IGetSet<boolean, CompositeChart>;
|
||||
childOptions: IGetSet<any, CompositeChart>;
|
||||
rightYAxisLabel: IGetSet<string, CompositeChart>;
|
||||
compose: IGetSet<Array<BaseMixin<any>>, CompositeChart>;
|
||||
export interface ICompositeChart<T> extends CoordinateGridMixin<T> {
|
||||
useRightAxisGridLines: IGetSet<boolean, ICompositeChart<T>>;
|
||||
childOptions: IGetSet<any, ICompositeChart<T>>;
|
||||
rightYAxisLabel: IGetSet<string, ICompositeChart<T>>;
|
||||
compose: IGetSet<Array<BaseMixin<any>>, ICompositeChart<T>>;
|
||||
children(): Array<BaseMixin<any>>;
|
||||
shareColors: IGetSet<boolean, CompositeChart>;
|
||||
shareTitle: IGetSet<boolean, CompositeChart>;
|
||||
rightY: IGetSet<(n: any) => any, CompositeChart>;
|
||||
rightYAxis: IGetSet<d3.svg.Axis, CompositeChart>;
|
||||
shareColors: IGetSet<boolean, ICompositeChart<T>>;
|
||||
shareTitle: IGetSet<boolean, ICompositeChart<T>>;
|
||||
rightY: IGetSet<(n: any) => any, ICompositeChart<T>>;
|
||||
rightYAxis: IGetSet<d3.svg.Axis, ICompositeChart<T>>;
|
||||
}
|
||||
|
||||
export interface SeriesChart extends CompositeChart {
|
||||
export interface CompositeChart extends ICompositeChart<CompositeChart> {}
|
||||
|
||||
export interface SeriesChart extends ICompositeChart<SeriesChart> {
|
||||
chart: IGetSet<(c: any) => BaseMixin<any>, SeriesChart>;
|
||||
seriesAccessor: IGetSet<Accessor<any, any>, SeriesChart>;
|
||||
seriesSort: IGetSet<(a: any, b: any) => number, SeriesChart>;
|
||||
|
||||
@@ -1,26 +0,0 @@
|
||||
/// <reference path="dx.chartjs-14.1.d.ts" />
|
||||
|
||||
module Test {
|
||||
$("<div/>").appendTo(document.body).dxChart({
|
||||
size: {
|
||||
width: 600,
|
||||
height: 400
|
||||
},
|
||||
title: {
|
||||
text: 'Chart in jQuery mode',
|
||||
font: { color: 'rgb(0, 128, 128)!important' }
|
||||
},
|
||||
argumentAxis: {
|
||||
categories: ['January', 'February', 'March', 'April', 'May', 'June']
|
||||
},
|
||||
dataSource: [
|
||||
{ arg: 'January', v1: 10, v2: 20, v3: 24 },
|
||||
{ arg: 'February', v1: 5, v2: 35, v3: 43 },
|
||||
{ arg: 'March', v1: 50, v2: 10, v3: 80 },
|
||||
{ arg: 'April', v1: 9, v2: 79, v3: 39 },
|
||||
{ arg: 'May', v1: 100, v2: 42, v3: 22 },
|
||||
{ arg: 'June', v1: 95, v2: 11, v3: 41 }
|
||||
],
|
||||
series: [{ valueField: 'v1' }, { valueField: 'v2' }, { valueField: 'v3' }]
|
||||
});
|
||||
}
|
||||
Vendored
-1865
File diff suppressed because it is too large
Load Diff
@@ -1,258 +0,0 @@
|
||||
/// <reference path="dx.phonejs-14.1.d.ts" />
|
||||
|
||||
module Test {
|
||||
var url = "http://some-json-service.net/data.json";
|
||||
var dsFromUrl = new DevExpress.data.DataSource(url);
|
||||
|
||||
var dsFromObject = new DevExpress.data.DataSource({
|
||||
load: function (loadOptions?: DevExpress.data.LoadOptions) {
|
||||
return $.ajax(url);
|
||||
}
|
||||
});
|
||||
|
||||
var application:DevExpress.framework.html.HtmlApplication = new DevExpress.framework.html.HtmlApplication({
|
||||
namespace: "global",
|
||||
defaultLayout: "slideout",
|
||||
navigation: [
|
||||
{ id: "first", title: "Home", action: "#home" },
|
||||
{ id: "second", title: "About", action: "#about" }
|
||||
]
|
||||
});
|
||||
application.router.register(":view/:id", { view: "home", id: undefined });
|
||||
application.navigate();
|
||||
|
||||
$("div").appendTo(document.body).dxMap({
|
||||
location: [40.749825, -73.987963],
|
||||
zoom: 13,
|
||||
provider: "googleStatic",
|
||||
controls: true,
|
||||
routes: [
|
||||
{
|
||||
weight: 4,
|
||||
opacity: 0.75,
|
||||
color: "red",
|
||||
mode: "walking",
|
||||
locations: [
|
||||
[40.737102, -73.990318],
|
||||
[40.749825, -73.987963],
|
||||
[40.75, -73.98],
|
||||
[40.755823, -73.986397]
|
||||
]
|
||||
}
|
||||
]
|
||||
});
|
||||
$("div").appendTo(document.body).dxTabs({
|
||||
itemClickAction: function (e: any) {
|
||||
console.log(e.itemData.text);
|
||||
},
|
||||
items: [
|
||||
{ text: "user" },
|
||||
{ text: "analytics" },
|
||||
{ text: "customers" },
|
||||
{ text: "search" },
|
||||
{ text: "favorites" }
|
||||
]
|
||||
});
|
||||
|
||||
$("div").appendTo(document.body).dxList({
|
||||
scrollByContent: true,
|
||||
items: ["item1", "item2", "item3"],
|
||||
itemHoldAction: function (e: any) { console.log("itemHold"); },
|
||||
itemClickAction: function (e: any) { console.log("itemClick"); },
|
||||
itemSwipeAction: function (e: any) { console.log("itemSwipe " + e.direction); }
|
||||
});
|
||||
$("div").appendTo(document.body).dxToast({
|
||||
type: 'error',
|
||||
message: 'Sample error message'
|
||||
});
|
||||
$("div").appendTo(document.body).dxPopup({
|
||||
closeButton: true,
|
||||
title: "Popup title"
|
||||
});
|
||||
$("div").appendTo(document.body).dxPivot({
|
||||
items: [
|
||||
{ title: "all", text: "all" },
|
||||
{ title: "unread", text: "unread" },
|
||||
{ title: "favorites", text: "favorites" }
|
||||
],
|
||||
itemSelectAction: function (e: Object) { console.log("itemSelectAction"); }
|
||||
});
|
||||
$("div").appendTo(document.body).dxLookup({
|
||||
items: [
|
||||
{ id: 1, caption: "red" },
|
||||
{ id: 3, caption: "blue" },
|
||||
{ id: 6, caption: "white" },
|
||||
{ id: 2, caption: "green" },
|
||||
{ id: 4, caption: "yellow" },
|
||||
{ id: 5, caption: "orange" },
|
||||
{ id: 7, caption: "purple" }
|
||||
],
|
||||
valueExpr: 'id',
|
||||
displayExpr: 'caption',
|
||||
itemRender: function (item: any) {
|
||||
return "Text is: " + item.caption;
|
||||
}
|
||||
});
|
||||
$("div").appendTo(document.body).dxSlider({
|
||||
min: 50,
|
||||
value: 75,
|
||||
max: 100,
|
||||
disabled: false
|
||||
});
|
||||
$("div").appendTo(document.body).dxNavBar({
|
||||
items: [
|
||||
{ text: "user", icon: "user" },
|
||||
{ text: "find", icon: "find", disabled: false },
|
||||
{ text: "favorites", icon: "favorites" },
|
||||
{ text: "about", icon: "info" },
|
||||
{ text: "home", icon: "home" },
|
||||
{ text: "URI", icon: "tips" }
|
||||
],
|
||||
itemClickAction: function (e: any) { console.log(e.itemData.text); }
|
||||
});
|
||||
$("div").appendTo(document.body).dxSwitch({
|
||||
value: false,
|
||||
onText: 'LongName',
|
||||
offText: 'Short',
|
||||
width: "100%",
|
||||
visible: true
|
||||
});
|
||||
$("div").appendTo(document.body).dxButton({
|
||||
text: "Click me",
|
||||
icon: 'add',
|
||||
clickAction: function () { console.log("clicked"); }
|
||||
});
|
||||
$("div").appendTo(document.body).dxOverlay({
|
||||
visible: false,
|
||||
closeOnOutsideClick: true,
|
||||
contentReadyAction: function () {
|
||||
$("#hideButton").dxButton({
|
||||
text: "Hide",
|
||||
clickAction: function () { $("#overlay").data("dxOverlay").option("visible", false); }
|
||||
});
|
||||
}
|
||||
});
|
||||
$("div").appendTo(document.body).dxDateBox({
|
||||
value: new Date(),
|
||||
format: "datetime"
|
||||
});
|
||||
$("div").appendTo(document.body).dxPopover({
|
||||
width: '300',
|
||||
height: 'auto',
|
||||
visible: true,
|
||||
target: '.dx-button'
|
||||
});
|
||||
$("div").appendTo(document.body).dxTextBox({
|
||||
value: "Text",
|
||||
placeholder: "Placeholder",
|
||||
mode: "email",
|
||||
maxLength: 20,
|
||||
readOnly: false,
|
||||
changeAction: function (e:Object) { console.log("value changed"); },
|
||||
valueUpdateAction: function (e:Object) { console.log("value updated"); }
|
||||
});
|
||||
$("div").appendTo(document.body).dxToolbar({
|
||||
items: [
|
||||
{ align: 'left', widget: 'button', options: { type: 'back', text: 'Back', clickAction: function (e:Object) { console.log("back clicked"); } } },
|
||||
{ align: 'center', widget: 'button', options: { text: 'button', clickAction: function (e:Object) { console.log("button clicked"); } } },
|
||||
{ align: 'center', widget: 'button', options: { icon: 'plus', text: 'add', clickAction: function (e:Object) { console.log("plus clicked"); } } },
|
||||
{ align: 'right', widget: 'button', options: { icon: 'find', clickAction: function (e:Object) { console.log("find clicked"); } }, useMenu: false },
|
||||
{ text: 'Products', isMenu: true }
|
||||
]
|
||||
});
|
||||
$("div").appendTo(document.body).dxTileView({
|
||||
items: [
|
||||
{ text: "item1", widthRatio: 1.7, heightRatio: 1.7 },
|
||||
{ text: "item2", widthRatio: 0.2, heightRatio: 0.2 },
|
||||
{ text: "item3", widthRatio: 2, heightRatio: 2 }
|
||||
],
|
||||
listHeight: 500,
|
||||
itemRender: function (item: any) { return "Text is: " + item.text; },
|
||||
itemClickAction: function () { console.log("itemClick"); },
|
||||
baseItemWidth: 100,
|
||||
baseItemHeight: 100,
|
||||
itemMargin: 20
|
||||
});
|
||||
$("div").appendTo(document.body).dxPanorama({
|
||||
title: "my panorama",
|
||||
items: [
|
||||
{ header: "first", text: "first item" },
|
||||
{ text: "second item" },
|
||||
{ text: "third" },
|
||||
{ text: "fourth" }
|
||||
],
|
||||
selectedIndex: 0,
|
||||
backgroundImage: { width: 89, height: 50 },
|
||||
itemSelectAction: function () { console.log("item selected"); }
|
||||
});
|
||||
$("div").appendTo(document.body).dxCheckBox({
|
||||
checked: false,
|
||||
disabled: false,
|
||||
clickAction: function (e:Object) { console.log("clicked"); }
|
||||
});
|
||||
$("div").appendTo(document.body).dxTextArea({
|
||||
value: 'Disabled',
|
||||
disabled: true,
|
||||
placeholder: "Placeholder"
|
||||
});
|
||||
$("div").appendTo(document.body).dxLoadPanel({
|
||||
message: 'Please wait ...',
|
||||
showIndicator: true,
|
||||
visible: true
|
||||
});
|
||||
$("div").appendTo(document.body).dxNumberBox({
|
||||
value: 100,
|
||||
min: 0,
|
||||
max: 200
|
||||
});
|
||||
$("div").appendTo(document.body).dxSelectBox({
|
||||
value: 2,
|
||||
dataSource: new DevExpress.data.DataSource([1, 2, 2, 3])
|
||||
});
|
||||
$("div").appendTo(document.body).dxScrollable({
|
||||
useNative: false,
|
||||
startAction: function (e:Object) { console.log("start"); },
|
||||
endAction: function (e:Object) { console.log("end"); }
|
||||
});
|
||||
$("div").appendTo(document.body).dxRadioGroup({
|
||||
items: [{ text: "0" }, { text: "1" }, { text: "2" }],
|
||||
name: "Sample",
|
||||
selectedIndex: -1
|
||||
});
|
||||
$("div").appendTo(document.body).dxScrollView({
|
||||
pullDownAction: function (e:Object) { console.log("pulling down"); },
|
||||
reachBottomAction: function (e:Object) { console.log("bottom reached"); },
|
||||
disabled: false
|
||||
});
|
||||
$("div").appendTo(document.body).dxActionSheet({
|
||||
title: 'Select action',
|
||||
items: [
|
||||
{ text: "Reply", clickAction: function () { console.log("Reply"); } },
|
||||
{ text: "Forward", clickAction: function () { console.log("Forward"); } },
|
||||
{ text: "Delete", clickAction: function () { console.log("Delete"); }, type: "danger" },
|
||||
{ text: "Save Image", clickAction: function () { console.log("Save Image"); }, disabled: true }
|
||||
],
|
||||
showTitle: true,
|
||||
disabled: false,
|
||||
target: '#button'
|
||||
});
|
||||
$("div").appendTo(document.body).dxRangeSlider({
|
||||
start: 30,
|
||||
end: 70,
|
||||
min: 0,
|
||||
max: 100,
|
||||
step: 1
|
||||
});
|
||||
$("div").appendTo(document.body).dxAutocomplete({
|
||||
value: "Ivan",
|
||||
dataSource: new DevExpress.data.DataSource(["Ivan", "Svyatoslav", "Alexander", "Nikolay", "Dmitry", "Afanasiy", "John", "Nash", "Stacy", "Izabella", "Margarita", "Anna"]),
|
||||
placeholder: "Type name, please",
|
||||
maxItemsCount: 3,
|
||||
minSearchLength: 2,
|
||||
searchTimeout: 1000
|
||||
});
|
||||
$("div").appendTo(document.body).dxDropDownMenu({
|
||||
items: ["Item 1", "Item 2", "Item 3"],
|
||||
itemTemplate: 'itemWithIcon'
|
||||
});
|
||||
}
|
||||
Vendored
-1507
File diff suppressed because it is too large
Load Diff
@@ -1,93 +0,0 @@
|
||||
/// <reference path="dx.webappjs-14.1.d.ts" />
|
||||
|
||||
module Test {
|
||||
$('<div/>').appendTo(document.body)
|
||||
.dxDataGrid({
|
||||
allowColumnResizing: true,
|
||||
allowColumnReordering: true,
|
||||
cellClick: (clickedCell: Object) => { },
|
||||
rowClick: (clickedRow: Object) => { },
|
||||
columnChooser: {
|
||||
enabled: true,
|
||||
height: 180,
|
||||
width: 400,
|
||||
emptyPanelText: 'A place to hide the columns'
|
||||
},
|
||||
columnAutoWidth: true,
|
||||
columns: [
|
||||
'author', 'title', 'year', 'genre', 'format',
|
||||
{ dataField: 'price', visible: false },
|
||||
{ dataField: 'length', visible: false }
|
||||
],
|
||||
dataSource: new DevExpress.data.DataSource({
|
||||
store: {
|
||||
type: 'array',
|
||||
data: [
|
||||
{ id: 1, title: "The Catcher in the Rye", author: "J. D. Salinger", year: 1951, genre: "Bildungsroman", format: "paperback" },
|
||||
{ id: 2, title: "The Hitchhiker's Guide to the Galaxy", author: "D. Adams", year: 1979, genre: "Comedy, sci-fi", format: "hardcover" },
|
||||
{ id: 3, title: "Fahrenheit 451", author: "R. Bradbury", year: 1953, genre: "Dystopian novel", format: "paperback" },
|
||||
{ id: 4, title: "Nineteen Eighty-Four", author: "G. Orwell", year: 1949, genre: "Dystopian novel, political fiction", format: "hardcover" },
|
||||
{ id: 5, title: "Crime and Punishment", author: "F. Dostoyevsky", year: 1866, genre: "Philosophical novel", format: "paperback" }
|
||||
],
|
||||
key: "id"
|
||||
}
|
||||
}),
|
||||
customizeColumns: (columns: Array<Object>) => { },
|
||||
dataErrorOccurred: (error: Error) => { },
|
||||
disabled: false,
|
||||
editing: {
|
||||
editMode: 'batch',
|
||||
editEnabled: true,
|
||||
insertEnabled: true,
|
||||
removeEnabled: true
|
||||
},
|
||||
filterRow: {
|
||||
visible: true,
|
||||
showOperationChooser: false
|
||||
},
|
||||
groupPanel: {
|
||||
visible: true
|
||||
},
|
||||
grouping: {
|
||||
autoExpandAll: false
|
||||
},
|
||||
height: () => {
|
||||
return 200;
|
||||
},
|
||||
hoverStateEnabled: true,
|
||||
loadPanel: {
|
||||
height: 150,
|
||||
width: 400,
|
||||
text: 'Data is loading...'
|
||||
},
|
||||
noDataText: "It isn't the data you're looking for",
|
||||
pager: {
|
||||
showPageSizeSelector: true,
|
||||
allowedPageSizes: [3, 5, 8]
|
||||
},
|
||||
paging: {
|
||||
pageSize: 8,
|
||||
pageIndex: 19
|
||||
},
|
||||
rowAlternationEnabled: true,
|
||||
rowPrepared: (rowElement: JQuery, rowInfo: Object) => { },
|
||||
rtlEnabled: false,
|
||||
scrolling: { mode: 'infinite' },
|
||||
searchPanel: {
|
||||
visible: true,
|
||||
width: 250
|
||||
},
|
||||
selectedRowKeys: [1, 2, 4],
|
||||
selection: {
|
||||
mode: 'multiple',
|
||||
allowSelectAll: false
|
||||
},
|
||||
showColumnHeaders: true,
|
||||
showColumnLines: true,
|
||||
showRowLines: true,
|
||||
sorting: { mode: 'multiple' },
|
||||
visible: true,
|
||||
width: () => { return 400; },
|
||||
wordWrapEnabled: true
|
||||
});
|
||||
}
|
||||
-1648
File diff suppressed because it is too large
Load Diff
-5813
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,196 @@
|
||||
/// <reference path="google-drive-realtime-api.d.ts" />
|
||||
|
||||
// Don't use this as a reference. Use the examples at
|
||||
// https://developers.google.com/google-apps/realtime/
|
||||
// To use the Realtime API effectively, I needed to read lots of the
|
||||
// (well-written) documentation on the site, and to understand parts of
|
||||
// realtime-client-utils.js
|
||||
// which you can find in the tutorial section of the project's homepage.
|
||||
|
||||
declare var $ : any;
|
||||
interface JQuery {
|
||||
[key: string]: any;
|
||||
};
|
||||
|
||||
type CollabModel = gapi.drive.realtime.Model;
|
||||
type CollabDoc = gapi.drive.realtime.Document;
|
||||
interface CollaborativeObject extends gapi.drive.realtime.CollaborativeObject {}
|
||||
interface CollaborativeList<T> extends gapi.drive.realtime.CollaborativeList<T> {}
|
||||
interface CollaborativeMap<T> extends gapi.drive.realtime.CollaborativeMap<T> {}
|
||||
interface IndexReference<T> extends gapi.drive.realtime.IndexReference<T> {}
|
||||
interface CollaborativeString extends gapi.drive.realtime.CollaborativeString {}
|
||||
|
||||
type CListOfCObj = CollaborativeList<CollaborativeObject>
|
||||
type CObjOrStr = CollaborativeObject | string;
|
||||
type CMapOfCObjOrStr = CollaborativeMap<CObjOrStr>;
|
||||
|
||||
|
||||
module GRealtime {
|
||||
|
||||
|
||||
|
||||
|
||||
var default_loader_options : rtclient.LoaderOptions = {
|
||||
// Your Application ID from the Google APIs Console.
|
||||
appId: "YOUR_APP_ID",
|
||||
|
||||
// This tells us if need to we automatically create a file after auth.
|
||||
autoCreate: false,
|
||||
|
||||
// Client ID from the console.
|
||||
clientId: 'YOUR_CLIENT_ID.apps.googleusercontent.com',
|
||||
|
||||
// The ID of the button to click to authorize. Must be a DOM element ID.
|
||||
authButtonElementId: 'realtime-authorize-button',
|
||||
|
||||
// The MIME type of newly created Drive Files. By default the application
|
||||
// specific MIME type will be used:
|
||||
// application/vnd.google-apps.drive-sdk.
|
||||
//newFileMimeType: 'text/json',
|
||||
newFileMimeType: 'text',
|
||||
//newFileMimeType: null, // default
|
||||
|
||||
// Function to be called to initialize custom Collaborative Objects types.
|
||||
registerTypes: null, // No action
|
||||
|
||||
defaultTitle: "Default default-doc-title",
|
||||
|
||||
// The rest are only defaults
|
||||
afterAuth: function() : void {
|
||||
console.log("default afterAuth called")
|
||||
},
|
||||
|
||||
initializeModel: function(rtmodel:CollabModel) : void {
|
||||
console.log("default initializeModel called");
|
||||
},
|
||||
|
||||
onFileLoaded : function(rtdoc:CollabDoc) : void {
|
||||
console.log("default onFileLoaded called");
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
export class MyRTLoader {
|
||||
public loader_options : rtclient.LoaderOptions = $.extend({},default_loader_options);
|
||||
private rtloader_client : rtclient.RealtimeLoader;
|
||||
|
||||
// call after setting loader_options appropriately
|
||||
authorize() {
|
||||
this.rtloader_client = new rtclient.RealtimeLoader(this.loader_options);
|
||||
this.rtloader_client.start();
|
||||
}
|
||||
|
||||
createNew(title:string, callback: (file:any) => void) {
|
||||
rtclient.createRealtimeFile(title, null, callback);
|
||||
}
|
||||
|
||||
loadAfterAuth(fileid:string) {
|
||||
// use this as part of your afterAuth callback
|
||||
rtclient.params.fileIds = fileid;
|
||||
this.rtloader_client.load();
|
||||
}
|
||||
}
|
||||
|
||||
export class MyRealtimeDoc {
|
||||
protected rtmodel: CollabModel;
|
||||
protected rtdoc: CollabDoc;
|
||||
private myRTLoader = new GRealtime.MyRTLoader();
|
||||
|
||||
newFile(title: string,
|
||||
initializeModel: (x:CollabModel) => void,
|
||||
onFileLoaded: (x:CollabDoc) => void) : void {
|
||||
|
||||
var _afterAuth = () => {
|
||||
this.myRTLoader.createNew(title, (file:rtclient.DriveAPIFileResource) => {
|
||||
console.log(`\n\nThis is the createNew callback. New file's id: ${file.id}\n\n`);
|
||||
$("#file-id-text-input").val(file.id);
|
||||
this.myRTLoader.loadAfterAuth(file.id)
|
||||
})
|
||||
}
|
||||
|
||||
var _initializeModel = (model:CollabModel) => {
|
||||
console.log("\n\nRTModel initialized for NEW document.\n\n");
|
||||
this.rtmodel = model;
|
||||
if( initializeModel ) {
|
||||
initializeModel(model);
|
||||
}
|
||||
}
|
||||
|
||||
var _onFileLoaded = (doc:CollabDoc) => {
|
||||
console.log("\n\nNEW document loaded.\n\n");
|
||||
this.rtmodel = doc.getModel();
|
||||
this.rtdoc = doc;
|
||||
if( onFileLoaded ) {
|
||||
onFileLoaded(doc);
|
||||
}
|
||||
}
|
||||
|
||||
this.myRTLoader.loader_options.onFileLoaded = _onFileLoaded;
|
||||
this.myRTLoader.loader_options.afterAuth = _afterAuth;
|
||||
this.myRTLoader.loader_options.initializeModel = _initializeModel;
|
||||
this.myRTLoader.authorize();
|
||||
}
|
||||
|
||||
loadExisting(fileid: string,
|
||||
onFileLoaded: (doc:CollabDoc) => void) : void {
|
||||
|
||||
rtclient.params.fileIds = fileid;
|
||||
|
||||
var _onFileLoaded = (doc:CollabDoc) => {
|
||||
console.log("\n\nEXISTING document loaded.\n\n");
|
||||
this.rtdoc = doc;
|
||||
this.rtmodel = doc.getModel();
|
||||
if( onFileLoaded ) {
|
||||
onFileLoaded(doc);
|
||||
}
|
||||
};
|
||||
|
||||
this.myRTLoader.loader_options.onFileLoaded = _onFileLoaded;
|
||||
//this.myRTLoader.loader_options.afterAuth = ...
|
||||
this.myRTLoader.authorize();
|
||||
}
|
||||
|
||||
createString() : CollaborativeString { return this.rtmodel.createString(""); }
|
||||
|
||||
createList() : CollaborativeList<CollaborativeObject> { return this.rtmodel.createList<CollaborativeObject>(); }
|
||||
|
||||
createMap() : CollaborativeMap<CollaborativeObject> { return this.rtmodel.createMap<CollaborativeObject>(); }
|
||||
|
||||
addToPersistDocRoot(x:{pdata:any}, key:string) {
|
||||
this.rtmodel.getRoot().set(key,x.pdata);
|
||||
}
|
||||
|
||||
bindString(istring:CollaborativeString, $textinput: JQuery) : gapi.drive.realtime.databinding.Binding {
|
||||
return gapi.drive.realtime.databinding.bindString(
|
||||
<CollaborativeString>istring,
|
||||
<HTMLInputElement>$textinput[0] );
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
// alternative to RealtimePSDoc.bindString
|
||||
function registerLocalStringChangeListener(
|
||||
x: CollaborativeString,
|
||||
listener_or_callback: (e:Event) => void | EventListener) : void {
|
||||
x.addEventListener(gapi.drive.realtime.EventType.TEXT_INSERTED, listener_or_callback);
|
||||
x.addEventListener(gapi.drive.realtime.EventType.TEXT_DELETED, listener_or_callback);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
// Next example from https://developers.google.com/google-apps/realtime/model-events
|
||||
|
||||
declare var doc : CollabDoc;
|
||||
function displayObjectChangedEvent(evt:gapi.drive.realtime.ObjectChangedEvent) {
|
||||
var events = evt.events;
|
||||
var eventCount = evt.events.length;
|
||||
for (var i = 0; i < eventCount; i++) {
|
||||
console.log('Event type: ' + events[i].type);
|
||||
console.log('Local event: ' + events[i].isLocal);
|
||||
console.log('User ID: ' + events[i].userId);
|
||||
console.log('Session ID: ' + events[i].sessionId);
|
||||
}
|
||||
}
|
||||
doc.getModel().getRoot().addEventListener(gapi.drive.realtime.EventType.OBJECT_CHANGED, displayObjectChangedEvent);
|
||||
@@ -0,0 +1,610 @@
|
||||
// Type definitions for Google Realtime API
|
||||
// Project: https://developers.google.com/google-apps/realtime/
|
||||
// Definitions by: Dustin Wehr <http://cs.toronto.edu/~wehr>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
// This definition file is merge-compatible with ../gapi/gapi.d.ts
|
||||
|
||||
// Note the occurrences of "INCOMPLETE". For some interfaces and object types, I have only included
|
||||
// the properties and methods that I've actually used so-far, and will add more as they become useful to me.
|
||||
// Or, maybe you want to complete them?
|
||||
|
||||
// For Typescript newbs: To get shorter names, use e.g.
|
||||
// type CollabModel = gapi.drive.realtime.Model;
|
||||
// interface CollabList<T> extends gapi.drive.realtime.CollaborativeList<T> {}
|
||||
// See section "Type Aliases" of http://www.typescriptlang.org/Content/TypeScript%20Language%20Specification.pdf
|
||||
|
||||
// gapi is a global var introduced by https://apis.google.com/js/api.js
|
||||
declare module gapi.drive.realtime {
|
||||
|
||||
type GoogEventHandler = ((evt:ObjectChangedEvent) => void) | ((e:Event) => void) | EventListener;
|
||||
|
||||
// Complete
|
||||
// https://developers.google.com/google-apps/realtime/reference/gapi.drive.realtime.Collaborator
|
||||
export class Collaborator {
|
||||
// The HTML color associated with this collaborator. When possible, collaborators are assigned unique colors.
|
||||
color : string;
|
||||
|
||||
// The display name for this collaborator.
|
||||
displayName : string;
|
||||
|
||||
// True if this collaborator is anonymous, false otherwise.
|
||||
isAnonymous : boolean
|
||||
|
||||
// True if this collaborator is the local user, false otherwise.
|
||||
isMe : boolean;
|
||||
|
||||
// The permission ID for this collaborator. This ID is stable for a given user and is compatible with the
|
||||
// Drive API permissions APIs. Use the userId property for all other uses.
|
||||
permissionId : string;
|
||||
|
||||
// A URL that points to the profile photo for this collaborator, or to a generic profile photo for
|
||||
// anonymous collaborators.
|
||||
photoUrl : string;
|
||||
|
||||
// The session ID for this collaborator. A single user may have multiple sessions if they have the same document
|
||||
// open on multiple devices or in multiple browser tabs.
|
||||
sessionId : string;
|
||||
|
||||
// The user ID for this collaborator. This ID is stable for a given user and is compatible with most Google APIs
|
||||
// except the Drive API permission APIs. For an ID which is compatible with the Drive API permission APIs,
|
||||
// use the permissionId property.
|
||||
userId : string;
|
||||
|
||||
new (sessionId:string, userId:string, displayName:string, color:string, isMe:boolean, isAnonymous:boolean,
|
||||
photoUrl:string, permissionId:string) : Collaborator;
|
||||
}
|
||||
|
||||
// Complete
|
||||
// https://developers.google.com/google-apps/realtime/reference/gapi.drive.realtime.CollaborativeObject
|
||||
export class CollaborativeObject {
|
||||
// The id of this collaborative object. Read-only.
|
||||
id:string;
|
||||
|
||||
// The type of this collaborative object. For standard collaborative objects,
|
||||
// see gapi.drive.realtime.CollaborrativeType for possible values; for custom collaborative objects, this value is
|
||||
// application-defined.
|
||||
// Addition: the possible values for standard objects are EditableString, List, and Map.
|
||||
type:string;
|
||||
|
||||
// Adds an event listener to the event target. The same handler can only be added once per the type.
|
||||
// Even if you add the same handler multiple times using the same type then it will only be called once
|
||||
// when the event is dispatched.
|
||||
addEventListener(type:string, listener:GoogEventHandler, opt_capture?:boolean):void;
|
||||
|
||||
// Removes all event listeners from this object.
|
||||
removeAllEventListeners():void;
|
||||
|
||||
// Removes an event listener from the event target. The handler must be the same object as the one added.
|
||||
// If the handler has not been added then nothing is done.
|
||||
removeEventListener(type:string, listener:GoogEventHandler, opt_capture?:boolean):void;
|
||||
|
||||
// Returns a string representation of this collaborative object.
|
||||
toString():string;
|
||||
}
|
||||
|
||||
// Complete
|
||||
// https://developers.google.com/google-apps/realtime/reference/gapi.drive.realtime.IndexReference
|
||||
export class IndexReference<V> extends CollaborativeObject {
|
||||
// (Categories of) the shift behavior of an index reference when the element it points at is deleted.
|
||||
static DeleteMode:{
|
||||
SHIFT_AFTER_DELETE: string
|
||||
SHIFT_BEFORE_DELETE: string
|
||||
SHIFT_TO_INVALID: string
|
||||
};
|
||||
|
||||
//The index of the current location the reference points to. Write to this property to change the referenced index.
|
||||
index:number;
|
||||
|
||||
// The behavior of this index reference when the element it points at is deleted.
|
||||
// @return one of the elements of DeleteMode
|
||||
deleteMode():string;
|
||||
|
||||
// The object this reference points to. Read-only.
|
||||
referencedObject():V;
|
||||
}
|
||||
|
||||
// Complete
|
||||
// https://developers.google.com/google-apps/realtime/reference/gapi.drive.realtime.CollaborativeMap
|
||||
export class CollaborativeMap<V> extends CollaborativeObject {
|
||||
size:string;
|
||||
|
||||
static type:string; // equals "Map"
|
||||
|
||||
// Removes all entries.
|
||||
clear():void;
|
||||
|
||||
// Removes the entry for the given key (if such an entry exists).
|
||||
// @return the value that was mapped to this key, or null if there was no existing value.
|
||||
delete(key:string):V;
|
||||
|
||||
// Returns the value mapped to the given key.
|
||||
get(key:string):V;
|
||||
|
||||
// Checks if this map contains an entry for the given key.
|
||||
has(key:string):boolean;
|
||||
|
||||
// Returns whether this map is empty.
|
||||
isEmpty():boolean;
|
||||
|
||||
// Returns an array containing a copy of the items in this map. Modifications to the returned array do
|
||||
// not modify this collaborative map.
|
||||
// @return non-null Array of Arrays, where the inner arrays are tupples [string, V]
|
||||
items():[string,V][];
|
||||
|
||||
// Returns an array containing a copy of the keys in this map. Modifications to the returned array
|
||||
// do not modify this collaborative map.
|
||||
keys():string[];
|
||||
|
||||
// Put the value into the map with the given key, overwriting an existing value for that key.
|
||||
// @return the old map value, if any, that used to be mapped to the given key.
|
||||
set(key:string, value:V):V;
|
||||
|
||||
// Returns an array containing a copy of the values in this map. Modifications to the returned array
|
||||
// do not modify this collaborative map.
|
||||
values():V[];
|
||||
}
|
||||
|
||||
// Complete
|
||||
// https://developers.google.com/google-apps/realtime/reference/gapi.drive.realtime.CollaborativeString
|
||||
export class CollaborativeString extends CollaborativeObject {
|
||||
// The length of the string. Read only.
|
||||
length:number;
|
||||
|
||||
// The text of this collaborative string. Reading from this property is equivalent to calling getText(). Writing to this property is equivalent to calling setText().
|
||||
text:string;
|
||||
|
||||
static type:string; // equals "EditableString"
|
||||
|
||||
// Appends a string to the end of this one.
|
||||
append(text:string):void;
|
||||
|
||||
// Gets a string representation of the collaborative string.
|
||||
getText():string;
|
||||
|
||||
// Inserts a string into the collaborative string at a specific index.
|
||||
insertString(index:number, text:string):void;
|
||||
|
||||
// Creates an IndexReference at the given {@code index}. If {@code canBeDeleted} is set, then a delete
|
||||
// over the index will delete the reference. Otherwise the reference will shift to the beginning of the deleted range.
|
||||
registerReference(index:number, canBeDeleted:boolean):IndexReference<CollaborativeString>;
|
||||
|
||||
// Deletes the text between startIndex (inclusive) and endIndex (exclusive).
|
||||
removeRange(startIndex:number, endIndex:number):void;
|
||||
|
||||
// Sets the contents of this collaborative string. Note that this method performs a text diff between the
|
||||
// current string contents and the new contents so that the string will be modified using the minimum number
|
||||
// of text inserts and deletes possible to change the current contents to the newly-specified contents.
|
||||
setText(text:string):void;
|
||||
}
|
||||
|
||||
// Complete
|
||||
// https://developers.google.com/google-apps/realtime/reference/gapi.drive.realtime.CollaborativeList
|
||||
export class CollaborativeList<V> extends CollaborativeObject {
|
||||
// The number of entries in the list. Assign to this field to reduce the size of the list.
|
||||
// Note that the length given must be less than or equal to the current size.
|
||||
// The length of a list cannot be extended in this way.
|
||||
length:number;
|
||||
|
||||
static type:string; // equals "List"
|
||||
|
||||
// Returns a copy of the contents of this collaborative list as an array.
|
||||
// Changes to the returned object will not affect the original collaborative list.
|
||||
asArray():V[];
|
||||
|
||||
// Removes all values from the list.
|
||||
clear():void;
|
||||
|
||||
// Gets the value at the given index.
|
||||
get(ind:number):V;
|
||||
|
||||
//Returns the first index of the given value, or -1 if it cannot be found.
|
||||
indexOf(value:V, opt_comparatorFn?:(x1:V, x2:V) => boolean):number;
|
||||
|
||||
//Inserts an item into the list at a given index.
|
||||
insert(index:number, value:V):void;
|
||||
|
||||
// Inserts a list of items into the list at a given index.
|
||||
insertAll(index:number, values:V[]):void;
|
||||
|
||||
// Returns the last index of the given value, or -1 if it cannot be found.
|
||||
lastIndexOf(value:V, opt_comparatorFn?:(x1:V, x2:V) => boolean):number;
|
||||
|
||||
//Moves a single element in this list (at index) to immediately before destinationIndex.
|
||||
//Both indices are with respect to the position of elements before the move.
|
||||
//For example, given the list: ['A', 'B', 'C']
|
||||
//move(0, 0) is a no-op
|
||||
//move(0, 1) is a no-op
|
||||
//move(0, 2) yields ['B', 'A', 'C'] ('A' is moved to immediately before 'C')
|
||||
//move(0, 3) yields ['B', 'C', 'A'] ('A' is moved to immediately before an imaginary element after the list end)
|
||||
//move(1, 0) yields ['B', 'A', 'C'] ('B' is moved to immediately before 'A')
|
||||
//move(1, 1) is a no-op
|
||||
//move(1, 2) is a no-op
|
||||
//move(1, 3) yields ['A', 'C', 'B'] ('B' is moved to immediately before an imaginary element after the list end)
|
||||
move(index:number, destinationIndex:number):void;
|
||||
|
||||
// Moves a single element in this list (at index) to immediately before destinationIndex in the list destination.
|
||||
// Both indices are with respect to the position of elements before the move.
|
||||
// If the provided destination is this list, this function is identical to move(index, destinationIndex).
|
||||
moveToList(index:number, destination:CollaborativeList<V>, destinationIndex:number):void;
|
||||
|
||||
// Adds an item to the end of the list.
|
||||
// @return the new length of the list
|
||||
push(value:V):number;
|
||||
|
||||
// Adds an array of values to the end of the list.
|
||||
pushAll(values:V[]):void;
|
||||
|
||||
// Creates an IndexReference at the given index. If canBeDeleted is true, then a delete over the index will delete
|
||||
// the reference. Otherwise the reference will shift to the beginning of the deleted range.
|
||||
registerReference(index:number, canBeDeleted:boolean):IndexReference<CollaborativeList<V>>;
|
||||
|
||||
// Removes the item at the given index from the list.
|
||||
remove(index:number):void;
|
||||
|
||||
// Removes the items between startIndex (inclusive) and endIndex (exclusive).
|
||||
removeRange(startIndex:number, endIndex:number):void;
|
||||
|
||||
// Removes the first instance of the given value from the list.
|
||||
// @return whether the item was removed
|
||||
removeValue(value:V):boolean;
|
||||
|
||||
// Replaces items in the list with the given items, starting at the given index.
|
||||
replaceRange(index:number, values:V[]):void;
|
||||
|
||||
// Sets the item at the given index
|
||||
set(index:number, value:V):void;
|
||||
}
|
||||
|
||||
// Complete
|
||||
// https://developers.google.com/google-apps/realtime/reference/gapi.drive.realtime.Model
|
||||
export class Model {
|
||||
|
||||
// Returns the collaborative object with the given id.
|
||||
// @return non-null Object
|
||||
getObject: (id:string) => CollaborativeObject;
|
||||
|
||||
// An estimate of the number of bytes used by data stored in the model.
|
||||
bytesUsed:number;
|
||||
|
||||
// True if the model can currently redo.
|
||||
canRedo:boolean;
|
||||
|
||||
// True if the model can currently undo.
|
||||
canUndo:boolean;
|
||||
|
||||
// Creates the native JS object for a given collaborative object type.
|
||||
// @return non-null Object
|
||||
createJsObject(typeName:string):any;
|
||||
|
||||
// Adds an event listener to the event target.
|
||||
// The same handler can only be added once per the type. Even if you add the same handler multiple times using the
|
||||
// same type then it will only be called once when the event is dispatched.
|
||||
addEventListener(type:string, listener:() => void | EventListener, opt_capture?:boolean):void;
|
||||
|
||||
// Starts a compound operation. If a name is given, that name will be recorded in the mutation for use in revision
|
||||
// history, undo menus, etc. When beginCompoundOperation() is called, all subsequent edits to the data model will
|
||||
// be batched together in the undo stack and revision history until endCompoundOperation() is called.
|
||||
// Compound operations may be nested inside other compound operations.
|
||||
// If the root compound operation is undoable, all nested compound operations must be undoable as well.
|
||||
// If the root compound operation is non-undoable, nested operations can be undoable, although the entire operation
|
||||
// will obey the root's opt_isUndoable value.
|
||||
// Note that the compound operation MUST start and end in the same synchronous execution block. If this invariant
|
||||
// is violated, the data model will become invalid and all future changes will fail.
|
||||
beginCompoundOperation(opt_name?:string, opt_isUndoable?:boolean):void;
|
||||
|
||||
|
||||
// Creates and returns a new collaborative object. This can be used to create custom collaborative objects.
|
||||
// For built in types, use the specific create* functions.
|
||||
// @return non-null Object
|
||||
create(ref:string|Function, ...var_args:any[]):any;
|
||||
|
||||
// Creates a collaborative list.
|
||||
createList<T>(opt_initialValue?:Array<T>):CollaborativeList<T>;
|
||||
|
||||
// Creates a collaborative map.
|
||||
createMap<T>(opt_initialValue?:Array<[string,T]>):CollaborativeMap<T>;
|
||||
|
||||
// Creates a collaborative string.
|
||||
createString(opt_initialValue?:string):CollaborativeString;
|
||||
|
||||
//Ends a compound operation. This method will throw an exception if no compound operation is in progress.
|
||||
endCompoundOperation():void;
|
||||
|
||||
// Returns the root of the object model.
|
||||
getRoot():CollaborativeMap<any>;
|
||||
|
||||
// The mode of the document. If true, the document is read-only. If false, it is editable.
|
||||
isReadOnly():boolean;
|
||||
|
||||
// Redo the last thing the active collaborator undid.
|
||||
redo():void;
|
||||
|
||||
// Removes all event listeners from this object.
|
||||
removeAllEventListeners():void;
|
||||
|
||||
// Removes an event listener from the event target. The handler must be the same object as the one added.
|
||||
// If the handler has not been added then nothing is done.
|
||||
removeEventListener(type:string, listener:() => void | EventListener, opt_capture?:boolean):void;
|
||||
|
||||
// The current server revision number for this model. The revision number begins at 1 (the initial empty model)
|
||||
// and is incremented each time the model is changed on the server (either by the current session or any
|
||||
// other collaborator). Because this revision number includes only changes that the server knows about,
|
||||
// it is only updated while this client is connected to the Realtime API server and it does not include changes
|
||||
// that have not yet been saved to the server.
|
||||
serverRevision():number;
|
||||
|
||||
// Serializes this data model to a JSON-based format which is compatible with the Realtime API's import/export
|
||||
// REST API. The exported JSON can also be used with gapi.drive.realtime.loadFromJson to load an in-memory
|
||||
// version of this data model which does not require a network connection.
|
||||
// See https://developers.google.com/drive/v2/reference/realtime/update for more information.
|
||||
toJson(opt_appId?:string, opt_revision?:number):string;
|
||||
|
||||
// Undo the last thing the active collaborator did.
|
||||
undo():void;
|
||||
}
|
||||
|
||||
// Complete
|
||||
// https://developers.google.com/google-apps/realtime/reference/gapi.drive.realtime.BaseModelEvent
|
||||
interface BaseModelEvent {
|
||||
// Whether this event bubbles.
|
||||
bubbles : boolean;
|
||||
|
||||
// The list of names from the hierarchy of compound operations that initiated this event.
|
||||
compoundOperationNames : string[];
|
||||
|
||||
// True if this event originated in the local session.
|
||||
isLocal : boolean;
|
||||
|
||||
// True if this event originated from a redo call.
|
||||
isRedo : boolean;
|
||||
|
||||
// True if this event originated from an undo call.
|
||||
isUndo : boolean;
|
||||
|
||||
// Prevents an event from performing its default action. In the Realtime API, this function is only present
|
||||
// for compatibility with the DOM event interface and therefore it does nothing.
|
||||
preventDefault() : void;
|
||||
|
||||
// The id of the session that initiated this event.
|
||||
sessionId : string;
|
||||
|
||||
// The collaborative object that initiated this event.
|
||||
target : CollaborativeObject;
|
||||
|
||||
// The type of the event.
|
||||
type : string;
|
||||
|
||||
// The user id of the user that initiated this event.
|
||||
userId : string;
|
||||
|
||||
// Stops an event which bubbles from propagating to the target's parent.
|
||||
stopPropagation() : void;
|
||||
|
||||
/* Parameters:
|
||||
target
|
||||
gapi.drive.realtime.CollaborativeObject
|
||||
The collaborative object that initiated the event.
|
||||
Value must not be null.
|
||||
|
||||
sessionId
|
||||
string
|
||||
The id of the session that initiated the event.
|
||||
|
||||
userId
|
||||
string
|
||||
The user id of the user that initiated the event.
|
||||
|
||||
compoundOperationNames
|
||||
Array of string
|
||||
The list of names from the hierarchy of compound operations that initiated the event.
|
||||
Value must not be null.
|
||||
isLocal
|
||||
boolean
|
||||
True if the event originated in the local session.
|
||||
|
||||
isUndo
|
||||
boolean
|
||||
True if the event originated from an undo call.
|
||||
|
||||
isRedo
|
||||
boolean
|
||||
True if the event originated from a redo call.
|
||||
*/
|
||||
new (target:CollaborativeObject, sessionId:string, userId:string, compoundOperationNames:string[],
|
||||
isLocal:boolean, isUndo:boolean, isRedo:boolean) : BaseModelEvent;
|
||||
}
|
||||
|
||||
// Complete
|
||||
// https://developers.google.com/google-apps/realtime/reference/gapi.drive.realtime.ObjectChangedEvent
|
||||
interface ObjectChangedEvent extends BaseModelEvent {
|
||||
// parameters as in BaseModelEvent above except for addition of:
|
||||
// events:
|
||||
// Array of gapi.drive.realtime.BaseModelEvent
|
||||
// The specific events that document the changes that occurred on the object.
|
||||
// Value must not be null.
|
||||
new (target:CollaborativeObject, sessionId:string, userId:string, compoundOperationNames:string[],
|
||||
isLocal:boolean, isUndo:boolean, isRedo:boolean, events:BaseModelEvent[]) : ObjectChangedEvent;
|
||||
|
||||
// The specific events that document the changes that occurred on the object.
|
||||
events : BaseModelEvent[];
|
||||
}
|
||||
|
||||
|
||||
// Complete
|
||||
// https://developers.google.com/google-apps/realtime/reference/gapi.drive.realtime.Document
|
||||
export class Document {
|
||||
// Whether the document is closed. Read-only; call close() to close the document.
|
||||
isClosed : boolean;
|
||||
|
||||
// Whether the document is stored in Google Drive. Read-only.
|
||||
// This property is false for documents created using gapi.drive.realtime.newInMemoryDocument or
|
||||
// gapi.drive.realtime.loadFromJson and true for all other documents.
|
||||
isInGoogleDrive : boolean;
|
||||
|
||||
// The approximate amount of time (in milliseconds) that changes have been waiting to be saved in Google Drive.
|
||||
// If there are no unsaved changes or this is an in-memory document, this value is always 0.
|
||||
// This value should remain low (for example, less than a few seconds) as long as the network is healthy and
|
||||
// changes are being saved as quickly as they are generated. If the network is unreliable or down, or if changes
|
||||
// are being made to the model more quickly than they can be saved, this value will continue to grow until the
|
||||
// network catches up and the changes are successfully saved.
|
||||
saveDelay : number;
|
||||
|
||||
// Adds an event listener to the event target. The same handler can only be added once per the type.
|
||||
// Even if you add the same handler multiple times using the same type then it will only be called once when
|
||||
// the event is dispatched.
|
||||
addEventListener(type:string, listener:GoogEventHandler, opt_capture?:boolean) : void;
|
||||
|
||||
// Closes the document and disconnects from the server.
|
||||
// After this function is called, event listeners will no longer fire and attempts to access the document, model,
|
||||
// or model objects will throw a gapi.drive.realtime.DocumentClosedError.
|
||||
// Calling this function after the document has been closed will have no effect.
|
||||
close():void;
|
||||
|
||||
// Gets an array of collaborators active in this session. Each collaborator is a jsMap with these fields:
|
||||
// sessionId, userId, displayName, color, isMe, isAnonymous.
|
||||
getCollaborators() : Collaborator[];
|
||||
|
||||
// Gets the collaborative model associated with this document.
|
||||
// @return non-null Model
|
||||
getModel():Model;
|
||||
|
||||
// Removes all event listeners from this object.
|
||||
removeAllEventListeners() : void;
|
||||
|
||||
// Removes an event listener from the event target. The handler must be the same object as the one added.
|
||||
// If the handler has not been added then nothing is done.
|
||||
removeEventListener(type:string, listener:GoogEventHandler, opt_capture?:boolean) : void;
|
||||
|
||||
// Saves a copy of this document to a new file. After this function is called, all changes to this document no
|
||||
// longer affect the old document and are instead saved to the new file.
|
||||
// The provided file ID must refer to a valid file in Drive which does not have any Realtime data for your app.
|
||||
// This function can also be used on an in-memory file to convert it to a Drive-connected file.
|
||||
saveAs(fileId:string) : void;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
declare module gapi.drive.realtime.databinding {
|
||||
// COMPLETE
|
||||
// https://developers.google.com/google-apps/realtime/reference/gapi.drive.realtime.databinding.Binding
|
||||
export interface Binding {
|
||||
// Throws gapi.drive.realtime.databinding.AlreadyBoundError If domElement has already been bound.
|
||||
|
||||
// The collaborative object to bind.
|
||||
collaborativeObject : CollaborativeObject;
|
||||
|
||||
// The DOM element that the collaborative object is bound to. Value must not be null.
|
||||
domElement : Element;
|
||||
|
||||
// Unbinds the domElement from collaborativeObject.
|
||||
unbind() : void;
|
||||
}
|
||||
|
||||
export function bindString(s:CollaborativeString, textinput:HTMLInputElement) : Binding
|
||||
}
|
||||
|
||||
|
||||
declare module gapi.drive.realtime.EventType {
|
||||
export var TEXT_INSERTED: string
|
||||
export var TEXT_DELETED: string
|
||||
export var OBJECT_CHANGED: string
|
||||
}
|
||||
|
||||
|
||||
// rtclient is a global var introduced by realtime-client-utils.js
|
||||
declare module rtclient {
|
||||
// INCOMPLETE
|
||||
export interface RealtimeLoader {
|
||||
start():void;
|
||||
load():void;
|
||||
}
|
||||
interface RealtimeLoaderFactory {
|
||||
new (options:LoaderOptions) : RealtimeLoader;
|
||||
}
|
||||
|
||||
// ***********************************
|
||||
// The remainder of this file types some (not all) things in realtime-client-utils.js, found here:
|
||||
// https://developers.google.com/google-apps/realtime/realtime-quickstart
|
||||
// and
|
||||
// https://apis.google.com/js/api.js
|
||||
// ***********************************
|
||||
|
||||
|
||||
// Complete
|
||||
export interface LoaderOptions {
|
||||
// Your Application ID from the Google APIs Console.
|
||||
appId: string;
|
||||
|
||||
// Autocreate files right after auth automatically.
|
||||
autoCreate: boolean;
|
||||
|
||||
// Client ID from the console.
|
||||
clientId: string;
|
||||
|
||||
// The ID of the button to click to authorize. Must be a DOM element ID.
|
||||
authButtonElementId: string;
|
||||
|
||||
// The MIME type of newly created Drive Files. By default the application
|
||||
// specific MIME type will be used:
|
||||
// application/vnd.google-apps.drive-sdk.
|
||||
newFileMimeType: string;
|
||||
//newFileMimeType = null // default
|
||||
|
||||
// Function to be called to initialize custom Collaborative Objects types.
|
||||
registerTypes: () => void;
|
||||
|
||||
// The name of newly created Drive files, if no title is specified.
|
||||
defaultTitle: string;
|
||||
|
||||
// Function to be called after authorization and before loading files.
|
||||
afterAuth: () => void;
|
||||
|
||||
// Function to be called when a Realtime model is first created.
|
||||
initializeModel: (model:gapi.drive.realtime.Model) => void;
|
||||
|
||||
// Function to be called every time a Realtime file is loaded.
|
||||
onFileLoaded: (rtdoc:gapi.drive.realtime.Document) => void;
|
||||
}
|
||||
|
||||
// INCOMPLETE
|
||||
export interface DriveAPIFileResource {
|
||||
id: string;
|
||||
}
|
||||
|
||||
// INCOMPLETE
|
||||
export interface ClientUtils {
|
||||
// INCOMPLETE
|
||||
params: {
|
||||
// string containing one or more file ids separated by spaces.
|
||||
fileIds : string
|
||||
};
|
||||
RealtimeLoader : RealtimeLoaderFactory;
|
||||
|
||||
/**
|
||||
* Creates a new Realtime file.
|
||||
* @param title {string} title of the newly created file.
|
||||
* @param mimeType {string} the MIME type of the new file.
|
||||
* @param callback {(file:DriveAPIFileResource) => void} the callback to call after creation.
|
||||
*/
|
||||
createRealtimeFile(title:string, mimeType:string, callback:(file:DriveAPIFileResource) => void) : void;
|
||||
}
|
||||
|
||||
export var RealtimeLoader : RealtimeLoaderFactory
|
||||
|
||||
/**
|
||||
* Creates a new Realtime file.
|
||||
* @param title {string} title of the newly created file.
|
||||
* @param mimeType {string} the MIME type of the new file.
|
||||
* @param callback {(file:DriveAPIFileResource) => void} the callback to call after creation.
|
||||
*/
|
||||
export function createRealtimeFile(title:string, mimeType:string, callback:(file:DriveAPIFileResource) => void) : void
|
||||
}
|
||||
|
||||
// INCOMPLETE
|
||||
declare module rtclient.params {
|
||||
// string containing one or more file ids separated by spaces.
|
||||
export var fileIds:string
|
||||
}
|
||||
|
||||
Vendored
+3
-3
@@ -65,7 +65,7 @@ declare module google.maps {
|
||||
getCenter(): LatLng;
|
||||
getDiv(): Element;
|
||||
getHeading(): number;
|
||||
getMapTypeId(): MapTypeId;
|
||||
getMapTypeId(): MapTypeId | string;
|
||||
getProjection(): Projection;
|
||||
getStreetView(): StreetViewPanorama;
|
||||
getTilt(): number;
|
||||
@@ -75,7 +75,7 @@ declare module google.maps {
|
||||
panToBounds(latLngBounds: LatLngBounds): void;
|
||||
setCenter(latlng: LatLng): void;
|
||||
setHeading(heading: number): void;
|
||||
setMapTypeId(mapTypeId: MapTypeId): void;
|
||||
setMapTypeId(mapTypeId: MapTypeId | string): void;
|
||||
setOptions(options: MapOptions): void;
|
||||
setStreetView(panorama: StreetViewPanorama): void;
|
||||
setTilt(tilt: number): void;
|
||||
@@ -133,7 +133,7 @@ declare module google.maps {
|
||||
|
||||
/***** Controls *****/
|
||||
export interface MapTypeControlOptions {
|
||||
mapTypeIds?: MapTypeId[];
|
||||
mapTypeIds?: (MapTypeId | string)[];
|
||||
position?: ControlPosition;
|
||||
style?: MapTypeControlStyle;
|
||||
}
|
||||
|
||||
Vendored
+1
@@ -46,6 +46,7 @@ declare module jasmine {
|
||||
var clock: () => Clock;
|
||||
|
||||
function any(aclass: any): Any;
|
||||
function anything(): Any;
|
||||
function objectContaining(sample: any): ObjectContaining;
|
||||
function createSpy(name: string, originalFn?: Function): Spy;
|
||||
function createSpyObj(baseName: string, methodNames: any[]): any;
|
||||
|
||||
+14
-13
@@ -1617,20 +1617,21 @@ declare module DataTables {
|
||||
|
||||
//#region "language-settings"
|
||||
|
||||
// these are all optional
|
||||
interface LanguageSettings {
|
||||
emptyTable: string;
|
||||
info: string;
|
||||
infoEmpty: string;
|
||||
infoFiltered: string;
|
||||
infoPostFix: string;
|
||||
thousands: string;
|
||||
lengthMenu: string;
|
||||
loadingRecords: string;
|
||||
processing: string;
|
||||
search: string;
|
||||
zeroRecords: string;
|
||||
paginate: LanguagePaginateSettings;
|
||||
aria: LanguageAriaSettings;
|
||||
emptyTable?: string;
|
||||
info?: string;
|
||||
infoEmpty?: string;
|
||||
infoFiltered?: string;
|
||||
infoPostFix?: string;
|
||||
thousands?: string;
|
||||
lengthMenu?: string;
|
||||
loadingRecords?: string;
|
||||
processing?: string;
|
||||
search?: string;
|
||||
zeroRecords?: string;
|
||||
paginate?: LanguagePaginateSettings;
|
||||
aria?: LanguageAriaSettings;
|
||||
}
|
||||
|
||||
interface LanguagePaginateSettings {
|
||||
|
||||
Vendored
+8
@@ -2455,6 +2455,14 @@ interface JQuery {
|
||||
*/
|
||||
triggerHandler(eventType: string, ...extraParameters: any[]): Object;
|
||||
|
||||
/**
|
||||
* Execute all handlers attached to an element for an event.
|
||||
*
|
||||
* @param event A jQuery.Event object.
|
||||
* @param extraParameters An array of additional parameters to pass along to the event handler.
|
||||
*/
|
||||
triggerHandler(event: JQueryEventObject, ...extraParameters: any[]): Object;
|
||||
|
||||
/**
|
||||
* Remove a previously-attached event handler from the elements.
|
||||
*
|
||||
|
||||
Vendored
+6
-2
@@ -41,6 +41,8 @@ declare module "knex" {
|
||||
fn: any;
|
||||
}
|
||||
|
||||
function Knex( config : Config ) : Knex;
|
||||
|
||||
//
|
||||
// QueryInterface
|
||||
//
|
||||
@@ -341,6 +343,9 @@ declare module "knex" {
|
||||
uuid(columnName: string): ColumnBuilder;
|
||||
comment(val: string): TableBuilder;
|
||||
specificType(columnName: string, type: string): ColumnBuilder;
|
||||
primary(columnNames: string[]) : TableBuilder;
|
||||
index(columnNames: string[], indexName?: string, indexType?: string) : TableBuilder;
|
||||
unique(columnNames: string[], indexName?: string) : TableBuilder;
|
||||
}
|
||||
|
||||
interface CreateTableBuilder extends TableBuilder {
|
||||
@@ -452,6 +457,5 @@ declare module "knex" {
|
||||
tableName?: string;
|
||||
}
|
||||
|
||||
var _: KnexStatic;
|
||||
export = _;
|
||||
export = Knex;
|
||||
}
|
||||
|
||||
Vendored
+1
-1
@@ -1980,7 +1980,7 @@ declare module L {
|
||||
/**
|
||||
* Returns the closest point from a point p on a segment p1 to p2.
|
||||
*/
|
||||
export function closestPointOnSegment(p: Point, p1: Point, p2: Point): number;
|
||||
export function closestPointOnSegment(p: Point, p1: Point, p2: Point): Point;
|
||||
|
||||
/**
|
||||
* Clips the segment a to b by rectangular bounds (modifying the segment points
|
||||
|
||||
Vendored
+2
-1
@@ -465,7 +465,8 @@ declare module moment {
|
||||
max(moments: Moment[]): Moment;
|
||||
|
||||
normalizeUnits(unit: string): string;
|
||||
relativeTimeThreshold(threshold: string, limit: number): void;
|
||||
relativeTimeThreshold(threshold: string): number|boolean;
|
||||
relativeTimeThreshold(threshold: string, limit:number): boolean;
|
||||
|
||||
/**
|
||||
* Constant used to enable explicit ISO_8601 format parsing.
|
||||
|
||||
Vendored
+1
-1
@@ -23,7 +23,7 @@ interface UUIDOptions {
|
||||
* (Number | Date) Time in milliseconds since unix Epoch.
|
||||
* Default: The current time is used.
|
||||
*/
|
||||
msecs?: any
|
||||
msecs?: number|Date
|
||||
|
||||
/**
|
||||
* (Number between 0-9999) additional time, in 100-nanosecond units. Ignored if msecs is unspecified.
|
||||
|
||||
Vendored
+15
@@ -329,6 +329,14 @@ interface NodeBuffer {
|
||||
length: number;
|
||||
copy(targetBuffer: Buffer, targetStart?: number, sourceStart?: number, sourceEnd?: number): number;
|
||||
slice(start?: number, end?: number): Buffer;
|
||||
writeUIntLE(value: number, offset: number, byteLength: number, noAssert?: boolean): number;
|
||||
writeUIntBE(value: number, offset: number, byteLength: number, noAssert?: boolean): number;
|
||||
writeIntLE(value: number, offset: number, byteLength: number, noAssert?: boolean): number;
|
||||
writeIntBE(value: number, offset: number, byteLength: number, noAssert?: boolean): number;
|
||||
readUIntLE(offset: number, byteLength: number, noAssert?: boolean): number;
|
||||
readUIntBE(offset: number, byteLength: number, noAssert?: boolean): number;
|
||||
readIntLE(offset: number, byteLength: number, noAssert?: boolean): number;
|
||||
readIntBE(offset: number, byteLength: number, noAssert?: boolean): number;
|
||||
readUInt8(offset: number, noAsset?: boolean): number;
|
||||
readUInt16LE(offset: number, noAssert?: boolean): number;
|
||||
readUInt16BE(offset: number, noAssert?: boolean): number;
|
||||
@@ -596,12 +604,19 @@ declare module "zlib" {
|
||||
export function createUnzip(options?: ZlibOptions): Unzip;
|
||||
|
||||
export function deflate(buf: Buffer, callback: (error: Error, result: any) =>void ): void;
|
||||
export function deflateSync(buf: Buffer, options?: ZlibOptions): any;
|
||||
export function deflateRaw(buf: Buffer, callback: (error: Error, result: any) =>void ): void;
|
||||
export function deflateRawSync(buf: Buffer, options?: ZlibOptions): any;
|
||||
export function gzip(buf: Buffer, callback: (error: Error, result: any) =>void ): void;
|
||||
export function gzipSync(buf: Buffer, options?: ZlibOptions): any;
|
||||
export function gunzip(buf: Buffer, callback: (error: Error, result: any) =>void ): void;
|
||||
export function gunzipSync(buf: Buffer, options?: ZlibOptions): any;
|
||||
export function inflate(buf: Buffer, callback: (error: Error, result: any) =>void ): void;
|
||||
export function inflateSync(buf: Buffer, options?: ZlibOptions): any;
|
||||
export function inflateRaw(buf: Buffer, callback: (error: Error, result: any) =>void ): void;
|
||||
export function inflateRawSync(buf: Buffer, options?: ZlibOptions): any;
|
||||
export function unzip(buf: Buffer, callback: (error: Error, result: any) =>void ): void;
|
||||
export function unzipSync(buf: Buffer, options?: ZlibOptions): any;
|
||||
|
||||
// Constants
|
||||
export var Z_NO_FLUSH: number;
|
||||
|
||||
@@ -1,23 +1,95 @@
|
||||
/// <reference path="oclazyload.d.ts" />
|
||||
|
||||
var lazyloader:Function = ()=>{};
|
||||
angular.module('app', ['oc.lazyLoad']).config(['$ocLazyLoadProvider', function ($ocLazyLoadProvider: oc.ILazyLoadProvider) {
|
||||
$ocLazyLoadProvider.config({
|
||||
debug: true,
|
||||
events: true,
|
||||
modules: [{
|
||||
name: 'TestModule',
|
||||
files: ['js/TestModule.js']
|
||||
}]
|
||||
})
|
||||
}]);
|
||||
|
||||
var config1: oc.ILazyLoadConfig = {
|
||||
asyncLoader: lazyloader
|
||||
};
|
||||
angular.module('app').controller(['$ocLazyLoadProvider', function ($ocLazyLoad: oc.ILazyLoad) {
|
||||
$ocLazyLoad.load('testModule.js');
|
||||
|
||||
var config2:oc.ILazyLoadConfig = {
|
||||
asyncLoader: lazyloader,
|
||||
loadedModules: ['module1', 'module2']
|
||||
};
|
||||
$ocLazyLoad.load(['testModule.js', 'testModuleCtrl.js', 'testModuleService.js']);
|
||||
|
||||
var moduleConfig:oc.ILazyLoadModuleConfig = {
|
||||
name:'testmodule',
|
||||
files:['testmodule']
|
||||
}
|
||||
$ocLazyLoad.load([
|
||||
'testModule.js',
|
||||
{
|
||||
type: 'css',
|
||||
path: 'testModuleCtrl'
|
||||
},
|
||||
{
|
||||
type: 'html',
|
||||
path: 'testModuleCtrl.html'
|
||||
},
|
||||
{
|
||||
type: 'js',
|
||||
path: 'testModuleCtrl'
|
||||
},
|
||||
'js!testModuleService',
|
||||
'less!testModuleLessFile'
|
||||
]);
|
||||
|
||||
var config2:oc.ILazyLoadConfig = {
|
||||
asyncLoader: lazyloader,
|
||||
loadedModules: ['module1', 'module2'],
|
||||
modules: [moduleConfig]
|
||||
};
|
||||
$ocLazyLoad.load([
|
||||
{
|
||||
files: [
|
||||
'testModule.js',
|
||||
'bower_components/bootstrap/dist/js/bootstrap.js'
|
||||
],
|
||||
cache: false,
|
||||
kjdf: false
|
||||
},
|
||||
{
|
||||
files: ['anotherModule.js'],
|
||||
cache: true
|
||||
}
|
||||
]);
|
||||
|
||||
$ocLazyLoad.load(
|
||||
[
|
||||
'testModule.js',
|
||||
'bower_components/bootstrap/dist/js/bootstrap.js',
|
||||
'anotherModule.js'
|
||||
],
|
||||
{
|
||||
cache: false
|
||||
});
|
||||
|
||||
$ocLazyLoad.load(
|
||||
[
|
||||
'partials/template1.html',
|
||||
'partials/template2.html'
|
||||
],
|
||||
{
|
||||
cache: false,
|
||||
reconfig: true,
|
||||
rerun: true,
|
||||
serie: true,
|
||||
insertBefore: '#load_css_before',
|
||||
timeout: 5000
|
||||
});
|
||||
|
||||
$ocLazyLoad.setModuleConfig({
|
||||
files: [
|
||||
'testModule.js'
|
||||
],
|
||||
cache: true
|
||||
});
|
||||
|
||||
var getConfig: oc.IModuleConfig = $ocLazyLoad.getModuleConfig('testModule');
|
||||
|
||||
var getModules: string[] = $ocLazyLoad.getModules();
|
||||
|
||||
var isLoaded: boolean = $ocLazyLoad.isLoaded([
|
||||
'testModule1.js',
|
||||
'testModule2.js'
|
||||
]);
|
||||
|
||||
$ocLazyLoad.inject('testModule');
|
||||
|
||||
$ocLazyLoad.toggleWatch(true);
|
||||
}]);
|
||||
Vendored
+134
-19
@@ -7,28 +7,143 @@
|
||||
|
||||
declare module oc {
|
||||
|
||||
interface ILazyLoadConfig {
|
||||
asyncLoader:any;
|
||||
loadedModules?:string[];
|
||||
modules?:ILazyLoadModuleConfig[];
|
||||
}
|
||||
|
||||
interface ILazyLoadModuleConfig {
|
||||
name:string;
|
||||
files:string[];
|
||||
}
|
||||
|
||||
interface ILazyLoad {
|
||||
load(module:any):ng.IPromise<any>;
|
||||
loadTemplateFile(url:string, config:ILazyLoadModuleConfig):ng.IPromise<any>;
|
||||
loadTemplateFile(urls:string[], config:ILazyLoadModuleConfig):ng.IPromise<any>;
|
||||
getModuleName(moduleName:string):string;
|
||||
getModules():string[];
|
||||
getModuleConfig(name:string):ILazyLoadModuleConfig;
|
||||
setModuleConfig(config:ILazyLoadModuleConfig):void;
|
||||
/**
|
||||
* Loads a module or a list of modules into Angular.
|
||||
*
|
||||
* @param module The name of a predefined module config object, or a module config object, or an array of either
|
||||
* @param config Options to be used when loading the modules
|
||||
*/
|
||||
load(module: string|ITypedModuleConfig|IModuleConfig|(string|ITypedModuleConfig|IModuleConfig)[], config?: IOptionsConfig): ng.IPromise<any>;
|
||||
|
||||
/**
|
||||
* Defines a module config object.
|
||||
* @param config The module config object
|
||||
* @returns The module config object that was passed in
|
||||
*/
|
||||
setModuleConfig(config: IModuleConfig): IModuleConfig;
|
||||
|
||||
/**
|
||||
* Gets the specified module config object.
|
||||
* @param name The name of the module config object to get
|
||||
*/
|
||||
getModuleConfig(name: string): IModuleConfig;
|
||||
|
||||
/**
|
||||
* Gets the list of loaded module names.
|
||||
*/
|
||||
getModules(): string[];
|
||||
|
||||
/**
|
||||
* Checks if a module name, or list of modules names, has been previously loaded into Angular.
|
||||
*/
|
||||
isLoaded(moduleName: string|string[]): boolean;
|
||||
|
||||
/**
|
||||
* Injects a module with the associated name into Angular. Useful for manual injection when loading through RequireJS, SystemJS, etc. Useful in
|
||||
* conjunction with the toggleWatch() method.
|
||||
*/
|
||||
inject(moduleName: string|string[]): boolean;
|
||||
|
||||
/**
|
||||
* Enables or disables watching Angular for new modules. Useful in conjunction with the inject() method. Make sure to not keep the watch enabled
|
||||
* indefinitely, or unexpected results may occur.
|
||||
*/
|
||||
toggleWatch(watch: boolean): void;
|
||||
}
|
||||
|
||||
interface ITypedModuleConfig extends IOptionsConfig {
|
||||
/**
|
||||
* The file extension, without the period. For example, 'html'.
|
||||
*/
|
||||
type: string;
|
||||
|
||||
/**
|
||||
* The file path, including file name.
|
||||
*/
|
||||
path: string;
|
||||
}
|
||||
|
||||
interface IModuleConfig extends IOptionsConfig {
|
||||
/**
|
||||
* The name of the module for easy retrieval later.
|
||||
*/
|
||||
name?: string;
|
||||
|
||||
/**
|
||||
* The list of files to be loaded for this module.
|
||||
*/
|
||||
files: string[];
|
||||
}
|
||||
|
||||
interface IOptionsConfig extends ng.IRequestShortcutConfig {
|
||||
/**
|
||||
* If true, bypasses browser cache by appending a timestamp to URLs. Defaults to true.
|
||||
*/
|
||||
cache?: boolean;
|
||||
|
||||
/**
|
||||
* If true, a module config will be invoked each time the module is reloaded. Use with caution, as re-invoking configs can lead to unexpected results.
|
||||
* Defaults to false.
|
||||
*/
|
||||
reconfig?: boolean;
|
||||
|
||||
/**
|
||||
* If true, a module run block will be invoked each time the module is reloaded. Use with caution, as re-invoking run blocks can lead to unexpected results.
|
||||
* Defaults to false.
|
||||
*/
|
||||
rerun?: boolean;
|
||||
|
||||
/**
|
||||
* If true, will load files in a series, instead of in parallel. Defaults to false.
|
||||
*/
|
||||
serie?: boolean;
|
||||
|
||||
/**
|
||||
* If set, will insert files immediately before the provided CSS selector, instead of the default behavior of inserting files immediately before the
|
||||
* last child of the <head> element. Defaults to undefined.
|
||||
*/
|
||||
insertBefore?: string;
|
||||
}
|
||||
|
||||
interface ILazyLoadProvider {
|
||||
config(config:ILazyLoadConfig):void;
|
||||
/**
|
||||
* Configures the main service provider.
|
||||
* @param config The configuration settings to use
|
||||
*/
|
||||
config(config: IProviderConfig): void;
|
||||
}
|
||||
|
||||
interface IProviderConfig {
|
||||
/**
|
||||
* If true, all errors will be logged to the console, in addition to rejecting a promise. Defaults to false.
|
||||
*/
|
||||
debug?: boolean;
|
||||
|
||||
/**
|
||||
* If true, an event will be broadcast whenever a module, component or file is loaded. Events that can be broadcast are: ocLazyLoad.moduleLoaded,
|
||||
* ocLazyLoad.moduleReloaded, ocLazyLoad.componentLoaded, ocLazyLoad.fileLoaded. Defaults to false.
|
||||
*/
|
||||
events?: boolean;
|
||||
|
||||
/**
|
||||
* Predefines a set of module configurations for later use. A name must be provided for each module so that it can be retrieved later.
|
||||
*/
|
||||
modules?: IModuleConfig[];
|
||||
}
|
||||
}
|
||||
|
||||
declare module angular {
|
||||
interface IAngularStatic {
|
||||
/**
|
||||
* The angular.module is a global place for creating, registering and retrieving Angular modules. All modules (angular core or 3rd party) that should be available to an application must be registered using this mechanism.
|
||||
*
|
||||
* When passed two or more arguments, a new module is created. If passed only one argument, an existing module (the name passed as the first argument to module) is retrieved.
|
||||
*
|
||||
* @param name The name of the module to create or retrieve.
|
||||
* @param requires The names of modules this module depends on, and/or ocLazyLoad module configurations. If specified then new module is being created. If unspecified then the module is being retrieved for further configuration.
|
||||
* @param configFn Optional configuration function for the module.
|
||||
*/
|
||||
module(name: string, requires?: (string|oc.IModuleConfig)[], configFn?: Function): IModule;
|
||||
}
|
||||
}
|
||||
@@ -265,7 +265,9 @@ function test_user_acl_roles() {
|
||||
role.getRoles().add(role);
|
||||
role.save();
|
||||
|
||||
Parse.User.logOut();
|
||||
Parse.User.logOut().then(function (data) {
|
||||
// logged out
|
||||
});
|
||||
}
|
||||
|
||||
function test_facebook_util() {
|
||||
@@ -397,4 +399,4 @@ function test_view() {
|
||||
|
||||
var model = Parse.User.current();
|
||||
var view = new Parse.View<Parse.User>();
|
||||
}
|
||||
}
|
||||
|
||||
Vendored
+1
-1
@@ -649,7 +649,7 @@ declare module Parse {
|
||||
static current(): User;
|
||||
static signUp<T>(username: string, password: string, attrs: any, options?: ParseDefaultOptions): Promise<T>;
|
||||
static logIn<T>(username: string, password: string, options?: ParseDefaultOptions): Promise<T>;
|
||||
static logOut(): void;
|
||||
static logOut<T>(): Promise<T>;
|
||||
static allowCustomUserClass(isAllowed: boolean): void;
|
||||
static become<T>(sessionToken: string, options?: ParseDefaultOptions): Promise<T>;
|
||||
static requestPasswordReset<T>(email: string, options?: ParseDefaultOptions): Promise<T>;
|
||||
|
||||
+4
@@ -13,6 +13,10 @@ declare module 'passport-facebook' {
|
||||
interface Profile extends passport.Profile {
|
||||
gender: string;
|
||||
profileUrl: string;
|
||||
username: string;
|
||||
|
||||
_raw: string;
|
||||
_json: any;
|
||||
}
|
||||
|
||||
interface IStrategyOption {
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
/**
|
||||
* Created by jcabresos on 4/19/2014.
|
||||
*/
|
||||
import passport = require('passport');
|
||||
import google = require('passport-google-oauth');
|
||||
|
||||
// just some test model
|
||||
var User = {
|
||||
findOrCreate(id:string, provider:string, callback:(err:any, user:any) => void): void {
|
||||
callback(null, {username:'james'});
|
||||
}
|
||||
}
|
||||
|
||||
passport.use(new google.OAuthStrategy({
|
||||
consumerKey: process.env.GOOGLE_CONSUMER_KEY,
|
||||
consumerSecret: process.env.GOOGLE_CONSUMER_SECRET,
|
||||
callbackURL: process.env.PASSPORT_GOOGLE_CALLBACK_URL
|
||||
},
|
||||
function(accessToken:string, refreshToken:string, profile:google.Profile, done:(error:any, user?:any) => void) {
|
||||
User.findOrCreate(profile.id, profile.provider, function(err, user) {
|
||||
if (err) { return done(err); }
|
||||
done(null, user);
|
||||
});
|
||||
})
|
||||
);
|
||||
|
||||
passport.use(new google.OAuth2Strategy({
|
||||
clientID: process.env.GOOGLE_CLIENT_ID,
|
||||
clientSecret: process.env.GOOGLE_CLIENT_SECRET,
|
||||
callbackURL: process.env.PASSPORT_GOOGLE_CALLBACK_URL
|
||||
},
|
||||
function(accessToken:string, refreshToken:string, profile:google.Profile, done:(error:any, user?:any) => void) {
|
||||
User.findOrCreate(profile.id, profile.provider, function(err, user) {
|
||||
if (err) { return done(err); }
|
||||
done(null, user);
|
||||
});
|
||||
})
|
||||
);
|
||||
@@ -0,0 +1,63 @@
|
||||
// Type definitions for passport-facebook 1.0.3
|
||||
// Project: https://github.com/jaredhanson/passport-facebook
|
||||
// Definitions by: James Roland Cabresos <https://github.com/staticfunction>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/// <reference path="../passport/passport.d.ts"/>
|
||||
|
||||
declare module 'passport-google-oauth' {
|
||||
|
||||
import passport = require('passport');
|
||||
import express = require('express');
|
||||
|
||||
interface Profile extends passport.Profile {
|
||||
gender: string;
|
||||
|
||||
_raw: string;
|
||||
_json: any;
|
||||
}
|
||||
|
||||
interface IOAuthStrategyOption {
|
||||
consumerKey: string;
|
||||
consumerSecret: string;
|
||||
callbackURL: string;
|
||||
|
||||
reguestTokenURL?: string;
|
||||
accessTokenURL?: string;
|
||||
userAuthorizationURL?: string;
|
||||
sessionKey?: string;
|
||||
}
|
||||
|
||||
class OAuthStrategy implements passport.Strategy {
|
||||
constructor(options: IOAuthStrategyOption,
|
||||
verify: (accessToken: string, refreshToken: string, profile: Profile, done: (error: any, user?: any) => void) => void);
|
||||
name: string;
|
||||
authenticate: (req: express.Request, options?: Object) => void;
|
||||
}
|
||||
|
||||
interface IOAuth2StrategyOption {
|
||||
clientID: string;
|
||||
clientSecret: string;
|
||||
callbackURL: string;
|
||||
|
||||
authorizationURL?: string;
|
||||
tokenURL?: string;
|
||||
|
||||
accessType?: string;
|
||||
approval_prompt?: string;
|
||||
prompt?: string;
|
||||
loginHint?: string;
|
||||
userID?: string;
|
||||
hostedDomain?: string;
|
||||
display?: string;
|
||||
requestVisibleActions?: string;
|
||||
openIDRealm?: string;
|
||||
}
|
||||
|
||||
class OAuth2Strategy implements passport.Strategy {
|
||||
constructor(options: IOAuth2StrategyOption,
|
||||
verify: (accessToken: string, refreshToken: string, profile: Profile, done: (error: any, user?: any) => void) => void);
|
||||
name: string;
|
||||
authenticate: (req: express.Request, options?: Object) => void;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
/**
|
||||
* Created by jcabresos on 4/19/2014.
|
||||
*/
|
||||
import passport = require('passport');
|
||||
import twitter = require('passport-twitter');
|
||||
|
||||
// just some test model
|
||||
var User = {
|
||||
findOrCreate(id:string, provider:string, callback:(err:any, user:any) => void): void {
|
||||
callback(null, {username:'james'});
|
||||
}
|
||||
}
|
||||
|
||||
passport.use(new twitter.Strategy({
|
||||
consumerKey: process.env.PASSPORT_TWITTER_CONSUMER_KEY,
|
||||
consumerSecret: process.env.PASSPORT_TWITTER_CONSUMER_SECRET,
|
||||
callbackURL: process.env.PASSPORT_TWITTER_CALLBACK_URL
|
||||
},
|
||||
function(accessToken:string, refreshToken:string, profile:twitter.Profile, done:(error:any, user?:any) => void) {
|
||||
User.findOrCreate(profile.id, profile.provider, function(err, user) {
|
||||
if (err) { return done(err); }
|
||||
done(null, user);
|
||||
});
|
||||
})
|
||||
);
|
||||
+42
@@ -0,0 +1,42 @@
|
||||
// Type definitions for passport-facebook 1.0.3
|
||||
// Project: https://github.com/jaredhanson/passport-facebook
|
||||
// Definitions by: James Roland Cabresos <https://github.com/staticfunction>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/// <reference path="../passport/passport.d.ts"/>
|
||||
|
||||
declare module 'passport-twitter' {
|
||||
|
||||
import passport = require('passport');
|
||||
import express = require('express');
|
||||
|
||||
interface Profile extends passport.Profile {
|
||||
gender: string;
|
||||
username: string;
|
||||
|
||||
_raw: string;
|
||||
_json: any;
|
||||
_accessLevel: string;
|
||||
}
|
||||
|
||||
interface IStrategyOption {
|
||||
consumerKey: string;
|
||||
consumerSecret: string;
|
||||
callbackURL: string;
|
||||
|
||||
reguestTokenURL?: string;
|
||||
accessTokenURL?: string;
|
||||
userAuthorizationURL?: string;
|
||||
sessionKey?: string;
|
||||
|
||||
userProfileURL?: string;
|
||||
skipExtendedUserProfile?: boolean;
|
||||
}
|
||||
|
||||
class Strategy implements passport.Strategy {
|
||||
constructor(options: IStrategyOption,
|
||||
verify: (accessToken: string, refreshToken: string, profile: Profile, done: (error: any, user?: any) => void) => void);
|
||||
name: string;
|
||||
authenticate: (req: express.Request, options?: Object) => void;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
/// <reference path="pluralize.d.ts" />
|
||||
|
||||
import pluralize = require('pluralize');
|
||||
|
||||
pluralize('test'); //=> "tests"
|
||||
pluralize('test', 1); //=> "test"
|
||||
pluralize('test', 5); //=> "tests"
|
||||
pluralize('test', 1, true); //=> "1 test"
|
||||
pluralize('test', 5, true); //=> "5 tests"
|
||||
|
||||
pluralize.plural('regex'); //=> "regexes"
|
||||
pluralize.addPluralRule(/gex$/i, 'gexii');
|
||||
pluralize.plural('regex'); //=> "regexii"
|
||||
|
||||
pluralize.singular('singles'); //=> "single"
|
||||
pluralize.addSingularRule(/singles$/i, 'singular');
|
||||
pluralize.singular('singles'); //=> "singular"
|
||||
|
||||
pluralize.plural('irregular'); //=> "irregulars"
|
||||
pluralize.addIrregularRule('irregular', 'regular');
|
||||
pluralize.plural('irregular'); //=> "regular"
|
||||
|
||||
pluralize.plural('paper'); //=> "papers"
|
||||
pluralize.addUncountableRule('paper');
|
||||
pluralize.plural('paper'); //=> "paper"
|
||||
Vendored
+65
@@ -0,0 +1,65 @@
|
||||
// Type definitions for pluralize
|
||||
// Project: https://www.npmjs.com/package/pluralize
|
||||
// Definitions by: Syu Kato <https://github.com/ukyo>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
interface PluralizeStatic {
|
||||
/**
|
||||
* Pluralize or singularize a word based on the passed in count.
|
||||
*
|
||||
* @param word
|
||||
* @param count
|
||||
* @param inclusive
|
||||
*/
|
||||
(word: string, count?: number, inclusive?: boolean): string;
|
||||
|
||||
/**
|
||||
* Pluralize a word based.
|
||||
*
|
||||
* @param word
|
||||
*/
|
||||
plural(word: string): string;
|
||||
|
||||
/**
|
||||
* Singularize a word based.
|
||||
*
|
||||
* @param word
|
||||
*/
|
||||
singular(word: string): string;
|
||||
|
||||
/**
|
||||
* Add a pluralization rule to the collection.
|
||||
*
|
||||
* @param rule
|
||||
* @param replacement
|
||||
*/
|
||||
addPluralRule(rule: string|RegExp, replacemant: string): void;
|
||||
|
||||
/**
|
||||
* Add a singularization rule to the collection.
|
||||
*
|
||||
* @param rule
|
||||
* @param replacement
|
||||
*/
|
||||
addSingularRule(rule: string|RegExp, replacemant: string): void;
|
||||
|
||||
/**
|
||||
* Add an irregular word definition.
|
||||
*
|
||||
* @param single
|
||||
* @param plural
|
||||
*/
|
||||
addIrregularRule(single: string, plural: string): void;
|
||||
|
||||
/**
|
||||
* Add an uncountable word rule.
|
||||
*
|
||||
* @param word
|
||||
*/
|
||||
addUncountableRule(word: string|RegExp): void;
|
||||
}
|
||||
|
||||
declare module "pluralize" {
|
||||
export = pluralize;
|
||||
}
|
||||
declare var pluralize: PluralizeStatic;
|
||||
@@ -0,0 +1,36 @@
|
||||
/// <reference path="../mocha/mocha.d.ts" />
|
||||
/// <reference path="quixote.d.ts" />
|
||||
|
||||
function test_createFrame() {
|
||||
var frame: QFrame;
|
||||
before((done) => {
|
||||
var options = { src: "" };
|
||||
frame = quixote.createFrame(options, done());
|
||||
});
|
||||
}
|
||||
|
||||
function test_resetFrame() {
|
||||
var frame: QFrame;
|
||||
before((done) => {
|
||||
var options = { src: "" };
|
||||
frame = quixote.createFrame(options, done());
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
frame.reset();
|
||||
});
|
||||
}
|
||||
|
||||
function test_removeFrame() {
|
||||
var frame: QFrame;
|
||||
before((done) => {
|
||||
var options = { src: "" };
|
||||
frame = quixote.createFrame(options, done());
|
||||
});
|
||||
|
||||
after(function() {
|
||||
frame.remove();
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Vendored
+233
@@ -0,0 +1,233 @@
|
||||
// Type definitions for quixote v0.7.0
|
||||
// Project: http://quixote-css.com/
|
||||
// Definitions by: Aleksandr Filatov <https://github.com/greybax>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
interface Quixote {
|
||||
// Create a test iframe. This is a slow operation, so once you have a frame, it's best to use QFrame.reset() on it rather than creating a new frame for each test
|
||||
createFrame(options: QuixoteFrameOptions, callback: (err: Error, loadedFrame: QFrame) => void): QFrame;
|
||||
}
|
||||
|
||||
interface QFrame {
|
||||
// Reset the frame back to the state it was in immediately after you called quixote.createFrame()
|
||||
reset(): void;
|
||||
|
||||
// Remove the test frame entirely.
|
||||
remove(): void;
|
||||
|
||||
// Retrieve an element matching a selector. Throws an exception unless exactly one matching element is found
|
||||
get(selector: string, nickname?: string): QElement;
|
||||
|
||||
// Retrieve a list of elements matching a selector. If you want to ensure that exactly one element is retrieved, use frame.get() instead.
|
||||
getAll(selector: string, nickname?: string): QElementList;
|
||||
|
||||
// Create an element and append it to the frame's body. Throws an exception unless exactly one element is created. (But that one element may contain children.)
|
||||
add(html: string, nickname?: string): QElement;
|
||||
|
||||
// Provides access to descriptors for the frame's viewport (the part of the page that you can see in the frame, not including scrollbars)
|
||||
viewport(): QElement;
|
||||
|
||||
// Provides access to descriptors for the frame's page (everything you can see or scroll to, not including scrollbars)
|
||||
page(): QElement;
|
||||
|
||||
// Retrieves the frame's body element.
|
||||
body(): QElement;
|
||||
|
||||
// Changes the size of the frame.
|
||||
resize(width: number, height: number): void;
|
||||
|
||||
// Scroll the page so that top-left corner of the frame is as close as possible to an (x, y) coordinate.
|
||||
scroll(x: number, y: number): void;
|
||||
|
||||
// Determine the (x, y) coordinate of the top-left corner of the frame. This uses pageXOffset and pageYOffset under the covers. (On IE 8, it uses scrollLeft and scrollTop.)
|
||||
getRawScrollPosition(x: number, y: number): Object;
|
||||
|
||||
// Retrieve the underlying HTMLIFrameElement DOM element for the frame.
|
||||
toDomElement(): HTMLIFrameElement;
|
||||
}
|
||||
|
||||
interface QElement {
|
||||
// Compare the element's descriptors to a set of expected values and throw an exception if they don't match
|
||||
assert(expected: ElementDescriptor, message?: string): void;
|
||||
|
||||
// Compare the element's descriptors to a set of expected values.
|
||||
diff(expected: ElementDescriptor): string;
|
||||
|
||||
// Determine how the browser is actually rendering an element's style. This uses getComputedStyle() under the covers. (On IE 8, it uses currentStyle)
|
||||
getRawStyle(property: string): string;
|
||||
|
||||
// Determine where an element is displayed within the frame viewport, as computed by the browser
|
||||
getRawPosition(): RawPositionObject;
|
||||
|
||||
// Retrieve the underlying HTMLElement DOM element for the frame.
|
||||
toDomElement(): HTMLElement;
|
||||
}
|
||||
|
||||
interface QElementList {
|
||||
// Determine the number of elements in the list.
|
||||
length(): number;
|
||||
|
||||
// Retrieve an element from the list. Positive and negative indices are allowed. Throws an exception if the index is out of bounds.
|
||||
at(index: number, nickname?: string): QElement;
|
||||
}
|
||||
|
||||
// Element positions and sizes are available on all QElement instances.
|
||||
interface ElementDescriptor {
|
||||
// The top edge of the element
|
||||
top: PositionDescriptor;
|
||||
|
||||
// The right edge of the element
|
||||
right: PositionDescriptor;
|
||||
|
||||
// The bottom edge of the element
|
||||
bottom: PositionDescriptor;
|
||||
|
||||
// The left edge of the element
|
||||
left: PositionDescriptor;
|
||||
|
||||
// Horizontal center: midway between the right and left edges.
|
||||
center: PositionDescriptor;
|
||||
|
||||
// Vertical middle: midway between the top and bottom edges.
|
||||
middle: PositionDescriptor;
|
||||
|
||||
// Width of the element.
|
||||
width: SizeDescriptor;
|
||||
|
||||
// Height of the element.
|
||||
height: SizeDescriptor;
|
||||
}
|
||||
|
||||
// Viewport positions and sizes are available on QFrame.viewport()
|
||||
interface ViewportDescriptor {
|
||||
// The highest visible part of the page.
|
||||
top: PositionDescriptor;
|
||||
|
||||
// The rightmost visible part of the page.
|
||||
right: PositionDescriptor;
|
||||
|
||||
// The lowest visible part of the page.
|
||||
bottom: PositionDescriptor;
|
||||
|
||||
// The leftmost visible part of the page.
|
||||
left: PositionDescriptor;
|
||||
|
||||
// Horizontal center: midway between right and left
|
||||
center: PositionDescriptor;
|
||||
|
||||
// Vertical middle: midway between top and bottom.
|
||||
middle: PositionDescriptor;
|
||||
|
||||
// Width of the viewport.
|
||||
width: SizeDescriptor;
|
||||
|
||||
// Height of the viewport.
|
||||
height: SizeDescriptor;
|
||||
}
|
||||
|
||||
// Page positions and sizes are available on QFrame.page().
|
||||
interface PageDescriptor {
|
||||
// The top of the page.
|
||||
top: PositionDescriptor;
|
||||
|
||||
// The right side of the page.
|
||||
right: PositionDescriptor;
|
||||
|
||||
// The bottom of the page.
|
||||
bottom: PositionDescriptor;
|
||||
|
||||
// The left side of the page.
|
||||
left: PositionDescriptor;
|
||||
|
||||
// Horizontal center: midway between right and left.
|
||||
center: PositionDescriptor;
|
||||
|
||||
// Vertical middle: midway between top and bottom.
|
||||
middle: PositionDescriptor;
|
||||
|
||||
// Width of the page.
|
||||
width: SizeDescriptor;
|
||||
|
||||
// Height of the page.
|
||||
height: SizeDescriptor;
|
||||
}
|
||||
|
||||
// Position descriptors represent an X or Y coordinate. The top-left corner of the page is (0, 0) and the values increase downward and to the right.
|
||||
interface PositionDescriptor {
|
||||
// Create a new descriptor that is further down the page or to the right.
|
||||
plus(amount: SizeDescriptor): PositionDescriptor;
|
||||
|
||||
// Create a new descriptor that is further down the page or to the right.
|
||||
plus(amount: number): PositionDescriptor;
|
||||
|
||||
// Create a new descriptor that is further down the page or to the right.
|
||||
minus(amount: SizeDescriptor): PositionDescriptor;
|
||||
|
||||
// Create a new descriptor that is further down the page or to the right.
|
||||
minus(amount: number): PositionDescriptor;
|
||||
}
|
||||
|
||||
// Size descriptors represent width or height.
|
||||
interface SizeDescriptor {
|
||||
// Create a descriptor that's bigger than this one.
|
||||
plus(amount: SizeDescriptor): SizeDescriptor;
|
||||
|
||||
// Create a descriptor that's bigger than this one.
|
||||
plus(amount: number): SizeDescriptor;
|
||||
|
||||
// Create a descriptor that's smaller than this one.
|
||||
minus(amount: SizeDescriptor): SizeDescriptor;
|
||||
|
||||
// Create a descriptor that's smaller than this one.
|
||||
minus(amount: number): SizeDescriptor;
|
||||
|
||||
// Create a new descriptor that's a multiple or fraction of the size of this one.
|
||||
times(multiple: number): SizeDescriptor;
|
||||
}
|
||||
|
||||
interface QuixoteFrameOptions {
|
||||
// Width of the iframe. Defaults to a large value (see stability note below)
|
||||
width?: number;
|
||||
|
||||
// Height of the iframe. Defaults to a large value (see stability note below)
|
||||
height?: number;
|
||||
|
||||
// URL of an HTML document to load into the frame. Must be served from same domain as the enclosing test document, or you could get same-origin policy errors. Defaults to an empty document with <!DOCTYPE html> (to enable standards-mode rendering)
|
||||
src?: string;
|
||||
|
||||
// URL of a CSS stylesheet to load into the frame. Defaults to loading nothing
|
||||
stylesheet?: string;
|
||||
}
|
||||
|
||||
interface RawPositionObject {
|
||||
// top edge
|
||||
top: number;
|
||||
|
||||
// right edge
|
||||
right: number;
|
||||
|
||||
// bottom edge
|
||||
bottom: number;
|
||||
|
||||
// left edge
|
||||
left: number;
|
||||
|
||||
// width (right edge minus left edge)
|
||||
width: number;
|
||||
|
||||
// height (bottom edge minus top edge)
|
||||
height: number;
|
||||
}
|
||||
|
||||
declare var quixote: Quixote;
|
||||
|
||||
declare module "quixote" {
|
||||
|
||||
class Quixote {
|
||||
constructor();
|
||||
|
||||
createFrame(options: QuixoteFrameOptions, callback: (err: Error, loadedFrame: QFrame) => void): QFrame;
|
||||
}
|
||||
|
||||
export = Quixote;
|
||||
}
|
||||
@@ -41,3 +41,11 @@ require(['main'], (main: any, $: any, _: any, Backbone: any) => {
|
||||
var recOne = require.config({ baseUrl: 'js' });
|
||||
recOne(['core'], function (core: any) {/*some code*/});
|
||||
|
||||
// Tests for 'module' magic module typings
|
||||
// (Using 'module' only actually makes sense in an external module)
|
||||
|
||||
import module = require('module');
|
||||
|
||||
var moduleConfig: any = module.config();
|
||||
var moduleId: string = module.id;
|
||||
var moduleUri: string = module.uri;
|
||||
|
||||
Vendored
+10
-1
@@ -29,6 +29,15 @@ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
declare module 'module' {
|
||||
var mod: {
|
||||
config: () => any;
|
||||
id: string;
|
||||
uri: string;
|
||||
}
|
||||
export = mod;
|
||||
}
|
||||
|
||||
interface RequireError extends Error {
|
||||
|
||||
/**
|
||||
@@ -342,7 +351,7 @@ interface RequireDefine {
|
||||
* callback return module definition
|
||||
**/
|
||||
(name: string, ready: Function): void;
|
||||
|
||||
|
||||
/**
|
||||
* Used to allow a clear indicator that a global define function (as needed for script src browser loading) conforms
|
||||
* to the AMD API, any global define function SHOULD have a property called "amd" whose value is an object.
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
/// <reference path="unorm.d.ts" />
|
||||
import unorm = require("unorm");
|
||||
|
||||
function listNormalizations(raw: string) {
|
||||
return [
|
||||
unorm.nfd(raw),
|
||||
unorm.nfkd(raw),
|
||||
unorm.nfc(raw),
|
||||
unorm.nfkc(raw),
|
||||
];
|
||||
}
|
||||
Vendored
+19
@@ -0,0 +1,19 @@
|
||||
// Type definitions for unorm 1.3.3
|
||||
// Project: https://github.com/walling/unorm
|
||||
// Definitions by: Christopher Brown <https://github.com/chbrown>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
declare module unorm {
|
||||
interface Static {
|
||||
nfd(str: string): string;
|
||||
nfkd(str: string): string;
|
||||
nfc(str: string): string;
|
||||
nfkc(str: string): string;
|
||||
}
|
||||
}
|
||||
|
||||
declare var unorm: unorm.Static;
|
||||
|
||||
declare module "unorm" {
|
||||
export = unorm;
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
/// <reference path="virtual-dom.d.ts" />
|
||||
import virtual_dom = require("virtual-dom");
|
||||
import VNode = virtual_dom.VNode;
|
||||
import h = virtual_dom.h;
|
||||
|
||||
function renderAny(object: any): VNode {
|
||||
if (object === undefined) {
|
||||
return h('i.undefined', 'undefined');
|
||||
}
|
||||
else if (object === null) {
|
||||
return h('b.null', 'null');
|
||||
}
|
||||
else if (Array.isArray(object)) {
|
||||
return h('span.array', ['[', object.map(renderAny), ']']);
|
||||
}
|
||||
else if (typeof object === 'object') {
|
||||
var object_children = Object.keys(object).map(key => {
|
||||
var child = object[key];
|
||||
return h('div', [
|
||||
h('span.key', [key, ':']),
|
||||
renderAny(child),
|
||||
]);
|
||||
});
|
||||
return h('div.object', object_children);
|
||||
}
|
||||
else if (typeof object === 'number') {
|
||||
return h('span.number', object.toString());
|
||||
}
|
||||
else if (typeof object === 'boolean') {
|
||||
return h('span.boolean', object.toString());
|
||||
}
|
||||
return h('span.string', object.toString());
|
||||
}
|
||||
Vendored
+132
@@ -0,0 +1,132 @@
|
||||
// Type definitions for virtual-dom 2.0.1
|
||||
// Project: https://github.com/Matt-Esch/virtual-dom
|
||||
// Definitions by: Christopher Brown <https://github.com/chbrown>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
declare module VirtualDOM {
|
||||
interface VHook {
|
||||
hook(node: Element, propertyName: string): void;
|
||||
unhook(node: Element, propertyName: string): void;
|
||||
}
|
||||
|
||||
type EventHandler = (...args: any[]) => void;
|
||||
|
||||
interface VProperties {
|
||||
attributes?: {[index: string]: string};
|
||||
/**
|
||||
I would like to use {[index: string]: string}, but then we couldn't use an
|
||||
object literal when setting the styles, since TypeScript doesn't seem to
|
||||
infer that {'fontSize': string; 'fontWeight': string;} is actually quite
|
||||
assignable to the type { [index: string]: string; }
|
||||
*/
|
||||
style?: any;
|
||||
/**
|
||||
The relaxation on `style` above is the reason why we need `any` as an option
|
||||
on the indexer type.
|
||||
*/
|
||||
[index: string]: any | string | boolean | number | VHook | EventHandler | {[index: string]: string | boolean | number};
|
||||
}
|
||||
|
||||
interface VNode {
|
||||
tagName: string;
|
||||
properties: VProperties;
|
||||
children: VTree[];
|
||||
key?: string;
|
||||
namespace?: string;
|
||||
count: number;
|
||||
hasWidgets: boolean;
|
||||
hasThunks: boolean;
|
||||
hooks: any[];
|
||||
descendantHooks: any[];
|
||||
version: string;
|
||||
type: string; // 'VirtualNode'
|
||||
}
|
||||
|
||||
interface VText {
|
||||
text: string;
|
||||
new(text: any): VText;
|
||||
version: string;
|
||||
type: string; // 'VirtualText'
|
||||
}
|
||||
|
||||
interface Widget {
|
||||
type: string; // 'Widget'
|
||||
init(): Element;
|
||||
update(previous: Widget, domNode: Element): void;
|
||||
destroy(node: Element): void;
|
||||
}
|
||||
|
||||
interface Thunk {
|
||||
type: string; // 'Thunk'
|
||||
vnode: VTree;
|
||||
render(previous: VTree): VTree;
|
||||
}
|
||||
|
||||
type VTree = VText | VNode | Widget | Thunk;
|
||||
|
||||
// enum VPatch {
|
||||
// NONE = 0,
|
||||
// VTEXT = 1,
|
||||
// VNODE = 2,
|
||||
// WIDGET = 3,
|
||||
// PROPS = 4,
|
||||
// ORDER = 5,
|
||||
// INSERT = 6,
|
||||
// REMOVE = 7,
|
||||
// THUNK = 8
|
||||
// }
|
||||
interface VPatch {
|
||||
vNode: VNode;
|
||||
patch: any;
|
||||
new(type: number, vNode: VNode, patch: any): VPatch;
|
||||
version: string;
|
||||
/**
|
||||
type is set to 'VirtualPatch' on the prototype, but overridden in the
|
||||
constructor with a number.
|
||||
*/
|
||||
type: number;
|
||||
}
|
||||
|
||||
interface createProperties extends VProperties {
|
||||
key?: string;
|
||||
namespace?: string;
|
||||
}
|
||||
|
||||
type VChild = VTree[] | VTree | string[] | string;
|
||||
|
||||
/**
|
||||
create() calls either document.createElement() or document.createElementNS(),
|
||||
for which the common denominator is Element (not HTMLElement).
|
||||
*/
|
||||
function create(vnode: VText, opts?: {document?: Document; warn?: boolean}): Text;
|
||||
function create(vnode: VNode | Widget | Thunk, opts?: {document?: Document; warn?: boolean}): Element;
|
||||
function h(tagName: string, properties: createProperties, children: string | VChild[]): VNode;
|
||||
function h(tagName: string, children: string | VChild[]): VNode;
|
||||
function diff(left: VTree, right: VTree): VPatch[];
|
||||
/**
|
||||
patch() usually just returns rootNode after doing stuff to it, so we want
|
||||
to preserve that type (though it will usually be just Element).
|
||||
*/
|
||||
function patch<T extends Element>(rootNode: T, patches: VPatch[], renderOptions?: any): T;
|
||||
}
|
||||
|
||||
declare module "virtual-dom/h" {
|
||||
// export = VirtualDOM.h; works just fine, but the DT checker doesn't like it
|
||||
import h = VirtualDOM.h;
|
||||
export = h;
|
||||
}
|
||||
declare module "virtual-dom/create-element" {
|
||||
import create = VirtualDOM.create;
|
||||
export = create;
|
||||
}
|
||||
declare module "virtual-dom/diff" {
|
||||
import diff = VirtualDOM.diff;
|
||||
export = diff;
|
||||
}
|
||||
declare module "virtual-dom/patch" {
|
||||
import patch = VirtualDOM.patch;
|
||||
export = patch;
|
||||
}
|
||||
declare module "virtual-dom" {
|
||||
export = VirtualDOM;
|
||||
}
|
||||
Vendored
+1
-1
@@ -64,7 +64,7 @@ declare module 'xml2js' {
|
||||
normalize?: boolean;
|
||||
normalizeTags?: boolean;
|
||||
strict?: boolean;
|
||||
tagNameProcessors?: (name: string) => string;
|
||||
tagNameProcessors?: [(name: string) => string];
|
||||
trim?: boolean;
|
||||
validator?: Function;
|
||||
xmlns?: boolean;
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
/// <reference path="xmlbuilder.d.ts" />
|
||||
|
||||
import xmlbuilder = require('xmlbuilder');
|
||||
var xml = xmlbuilder.create;
|
||||
|
||||
// https://github.com/oozcitak/xmlbuilder-js/blob/master/test/comment.coffee
|
||||
xml('comment', {}, {}, { headless: true }).comment('<>\'"&\t\n\r').end();
|
||||
|
||||
// https://github.com/oozcitak/xmlbuilder-js/blob/master/test/instructions.coffee
|
||||
xml('test17', { headless: true }).ins('pi', 'mypi').end();
|
||||
|
||||
xml('test17', { headless: true }).ins({ 'pi': 'mypi', 'pi2': 'mypi2', 'pi3': null }).end();
|
||||
|
||||
xml('test17', { headless: true }).ins(['pi', 'pi2']).end();
|
||||
|
||||
xml('test18', { headless: true })
|
||||
.ins('renderCache.subset', '"Verdana" 0 0 ISO-8859-1 4 268 67 "#(),-./')
|
||||
.ins('pitarget', () => 'pivalue')
|
||||
.end();
|
||||
|
||||
// https://github.com/oozcitak/xmlbuilder-js/blob/master/test/createxml.coffee
|
||||
xml('root')
|
||||
.ele('xmlbuilder')
|
||||
.att('for', 'node-js')
|
||||
.com('CoffeeScript is awesome.')
|
||||
.nod('repo')
|
||||
.att('type', 'git')
|
||||
.txt('git://github.com/oozcitak/xmlbuilder-js.git')
|
||||
.up()
|
||||
.up()
|
||||
.ele('test')
|
||||
.att('escaped', 'chars <>\'"&\t\n\r')
|
||||
.txt('complete 100%<>\'"&\t\n\r')
|
||||
.up()
|
||||
.ele('cdata')
|
||||
.cdata('<test att="val">this is a test</test>\nSecond line')
|
||||
.up()
|
||||
.ele('raw')
|
||||
.raw('&<>&')
|
||||
.up()
|
||||
.ele('atttest', { 'att': 'val' }, 'text')
|
||||
.up()
|
||||
.ele('atttest', 'text')
|
||||
.end();
|
||||
Vendored
+89
@@ -0,0 +1,89 @@
|
||||
// Type definitions for xmlbuilder
|
||||
// Project: https://github.com/oozcitak/xmlbuilder-js
|
||||
// Definitions by: Wallymathieu <http://github.com/wallymathieu>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
declare module 'xmlbuilder' {
|
||||
export = xmlbuilder;
|
||||
class XMLDocType {
|
||||
clone(): XMLDocType;
|
||||
element(name: string, value?: Object): XMLDocType;
|
||||
attList(elementName: string, attributeName: string, attributeType: string, defaultValueType?: string, defaultValue?: any): XMLDocType;
|
||||
entity(name: string, value: any): XMLDocType;
|
||||
pEntity(name: string, value: any): XMLDocType;
|
||||
notation(name: string, value: any): XMLDocType;
|
||||
cdata(value: string): XMLDocType;
|
||||
comment(value: string): XMLDocType;
|
||||
instruction(target: string, value: any): XMLDocType;
|
||||
root(): XMLDocType;
|
||||
document(): any;
|
||||
toString(options?: Object, level?: Number): string;
|
||||
|
||||
ele(name: string, value?: Object): XMLDocType;
|
||||
att(elementName: string, attributeName: string, attributeType: string, defaultValueType?: string, defaultValue?: any): XMLDocType;
|
||||
ent(name: string, value: any): XMLDocType;
|
||||
pent(name: string, value: any): XMLDocType;
|
||||
not(name: string, value: any): XMLDocType;
|
||||
dat(value: string): XMLDocType;
|
||||
com(value: string): XMLDocType;
|
||||
ins(target: string, value: any): XMLDocType;
|
||||
up(): XMLDocType;
|
||||
doc(): any;
|
||||
}
|
||||
|
||||
class XMLElementOrXMLNode {
|
||||
// XMLElement:
|
||||
clone(): XMLElementOrXMLNode;
|
||||
attribute(name: any, value?: any): XMLElementOrXMLNode;
|
||||
att(name: any, value?: any): XMLElementOrXMLNode;
|
||||
removeAttribute(name: string): XMLElementOrXMLNode;
|
||||
instruction(target: string, value: any): XMLElementOrXMLNode;
|
||||
instruction(array: Array<any>): XMLElementOrXMLNode;
|
||||
instruction(obj: Object): XMLElementOrXMLNode;
|
||||
ins(target: string, value: any): XMLElementOrXMLNode;
|
||||
ins(array: Array<any>): XMLElementOrXMLNode;
|
||||
ins(obj: Object): XMLElementOrXMLNode;
|
||||
a(name: any, value?: any): XMLElementOrXMLNode;
|
||||
i(target: string, value: any): XMLElementOrXMLNode;
|
||||
i(array: Array<any>): XMLElementOrXMLNode;
|
||||
i(obj: Object): XMLElementOrXMLNode;
|
||||
toString(options?:Object, level?:Number): string;
|
||||
// XMLNode:
|
||||
element(name: any, attributes?: Object, text?: any): XMLElementOrXMLNode;
|
||||
ele(name: any, attributes?: Object, text?: any): XMLElementOrXMLNode;
|
||||
insertBefore(name: any, attributes?: Object, text?: any): XMLElementOrXMLNode;
|
||||
insertAfter(name: any, attributes?: Object, text?: any): XMLElementOrXMLNode;
|
||||
remove(): XMLElementOrXMLNode;
|
||||
node(name: any, attributes?: Object, text?: any): XMLElementOrXMLNode;
|
||||
text(value: string): XMLElementOrXMLNode;
|
||||
cdata(value: string): XMLElementOrXMLNode;
|
||||
comment(value: string): XMLElementOrXMLNode;
|
||||
raw(value: string): XMLElementOrXMLNode;
|
||||
declaration(version: string, encoding: string, standalone: boolean): XMLElementOrXMLNode;
|
||||
doctype(pubID: string, sysID: string): XMLDocType;
|
||||
up(): XMLElementOrXMLNode;
|
||||
root(): XMLElementOrXMLNode;
|
||||
document(): any;
|
||||
end(options?: Object): string;
|
||||
prev(): XMLElementOrXMLNode;
|
||||
next(): XMLElementOrXMLNode;
|
||||
nod(name: any, attributes?: Object, text?: any): XMLElementOrXMLNode;
|
||||
txt(value: string): XMLElementOrXMLNode;
|
||||
dat(value: string): XMLElementOrXMLNode;
|
||||
com(value: string): XMLElementOrXMLNode;
|
||||
doc(): XMLElementOrXMLNode;
|
||||
dec(version: string, encoding: string, standalone: boolean): XMLElementOrXMLNode;
|
||||
dtd(pubID: string, sysID: string): XMLDocType;
|
||||
e(name: any, attributes?: Object, text?: any): XMLElementOrXMLNode;
|
||||
n(name: any, attributes?: Object, text?: any): XMLElementOrXMLNode;
|
||||
t(value: string): XMLElementOrXMLNode;
|
||||
d(value: string): XMLElementOrXMLNode;
|
||||
c(value: string): XMLElementOrXMLNode;
|
||||
r(value: string): XMLElementOrXMLNode;
|
||||
u(): XMLElementOrXMLNode;
|
||||
}
|
||||
|
||||
module xmlbuilder {
|
||||
function create(name: string, xmldec?: Object, doctype?: any, options?: Object): XMLElementOrXMLNode;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user