mirror of
https://github.com/aspnet/JavaScriptServices.git
synced 2025-12-22 17:47:53 +00:00
Update remaining templates to TypeScript 2 / @types / etc.
This commit is contained in:
committed by
SteveSandersonMS
parent
a7ed0112db
commit
f6d7321243
@@ -2,21 +2,21 @@
|
|||||||
"name": "Angular2Spa",
|
"name": "Angular2Spa",
|
||||||
"version": "0.0.0",
|
"version": "0.0.0",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@angular/common": "2.0.0",
|
"@angular/common": "2.0.2",
|
||||||
"@angular/compiler": "2.0.0",
|
"@angular/compiler": "2.0.2",
|
||||||
"@angular/core": "2.0.0",
|
"@angular/core": "2.0.2",
|
||||||
"@angular/forms": "2.0.0",
|
"@angular/forms": "2.0.2",
|
||||||
"@angular/http": "2.0.0",
|
"@angular/http": "2.0.2",
|
||||||
"@angular/platform-browser": "2.0.0",
|
"@angular/platform-browser": "2.0.2",
|
||||||
"@angular/platform-browser-dynamic": "2.0.0",
|
"@angular/platform-browser-dynamic": "2.0.2",
|
||||||
"@angular/platform-server": "2.0.0",
|
"@angular/platform-server": "2.0.2",
|
||||||
"@angular/router": "3.0.0",
|
"@angular/router": "3.0.2",
|
||||||
"@types/node": "^6.0.38",
|
"@types/node": "^6.0.42",
|
||||||
"angular2-platform-node": "~2.0.10",
|
"angular2-platform-node": "~2.0.11",
|
||||||
"angular2-universal": "~2.0.10",
|
"angular2-universal": "~2.0.11",
|
||||||
"angular2-universal-polyfills": "~2.0.10",
|
"angular2-universal-polyfills": "~2.0.11",
|
||||||
"aspnet-prerendering": "^1.0.6",
|
"aspnet-prerendering": "^1.0.7",
|
||||||
"aspnet-webpack": "^1.0.11",
|
"aspnet-webpack": "^1.0.17",
|
||||||
"bootstrap": "^3.3.7",
|
"bootstrap": "^3.3.7",
|
||||||
"css": "^2.2.1",
|
"css": "^2.2.1",
|
||||||
"css-loader": "^0.25.0",
|
"css-loader": "^0.25.0",
|
||||||
@@ -30,15 +30,15 @@
|
|||||||
"preboot": "^4.5.2",
|
"preboot": "^4.5.2",
|
||||||
"raw-loader": "^0.5.1",
|
"raw-loader": "^0.5.1",
|
||||||
"rxjs": "5.0.0-beta.12",
|
"rxjs": "5.0.0-beta.12",
|
||||||
"style-loader": "^0.13.0",
|
"style-loader": "^0.13.1",
|
||||||
"to-string-loader": "^1.1.5",
|
"to-string-loader": "^1.1.5",
|
||||||
"ts-loader": "^0.8.2",
|
"ts-loader": "^0.8.2",
|
||||||
"typescript": "^2.0.0",
|
"typescript": "^2.0.3",
|
||||||
"url-loader": "^0.5.7",
|
"url-loader": "^0.5.7",
|
||||||
"webpack": "^1.12.14",
|
"webpack": "^1.13.2",
|
||||||
|
"webpack-hot-middleware": "^2.12.2",
|
||||||
"webpack-node-externals": "^1.4.3",
|
"webpack-node-externals": "^1.4.3",
|
||||||
"webpack-hot-middleware": "^2.10.0",
|
|
||||||
"webpack-merge": "^0.14.1",
|
"webpack-merge": "^0.14.1",
|
||||||
"zone.js": "^0.6.21"
|
"zone.js": "^0.6.25"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
import './css/site.css';
|
import './css/site.css';
|
||||||
import * as ko from 'knockout';
|
import * as ko from 'knockout';
|
||||||
import { createHistory } from 'history';
|
|
||||||
import './webpack-component-loader';
|
import './webpack-component-loader';
|
||||||
import AppRootComponent from './components/app-root/app-root';
|
import AppRootComponent from './components/app-root/app-root';
|
||||||
|
const createHistory = require('history').createBrowserHistory;
|
||||||
|
|
||||||
// Load and register the <app-root> component
|
// Load and register the <app-root> component
|
||||||
ko.components.register('app-root', AppRootComponent);
|
ko.components.register('app-root', AppRootComponent);
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ class AppRootViewModel {
|
|||||||
public route: KnockoutObservable<Route>;
|
public route: KnockoutObservable<Route>;
|
||||||
private _router: Router;
|
private _router: Router;
|
||||||
|
|
||||||
constructor(params: { history: HistoryModule.History }) {
|
constructor(params: { history: History.History }) {
|
||||||
// Activate the client-side router
|
// Activate the client-side router
|
||||||
this._router = new Router(params.history, routes)
|
this._router = new Router(params.history, routes)
|
||||||
this.route = this._router.currentRoute;
|
this.route = this._router.currentRoute;
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ export class Router {
|
|||||||
private disposeHistory: () => void;
|
private disposeHistory: () => void;
|
||||||
private clickEventListener: EventListener;
|
private clickEventListener: EventListener;
|
||||||
|
|
||||||
constructor(history: HistoryModule.History, routes: Route[]) {
|
constructor(history: History.History, routes: Route[]) {
|
||||||
// Reset and configure Crossroads so it matches routes and updates this.currentRoute
|
// Reset and configure Crossroads so it matches routes and updates this.currentRoute
|
||||||
crossroads.removeAllRoutes();
|
crossroads.removeAllRoutes();
|
||||||
crossroads.resetState();
|
crossroads.resetState();
|
||||||
@@ -38,8 +38,11 @@ export class Router {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
$(document).on('click', 'a', this.clickEventListener);
|
$(document).on('click', 'a', this.clickEventListener);
|
||||||
|
|
||||||
|
// Initialize Crossroads with starting location
|
||||||
|
// Need to cast history to 'any' because @types/history is out-of-date
|
||||||
|
crossroads.parse((history as any).location.pathname);
|
||||||
}
|
}
|
||||||
|
|
||||||
public dispose() {
|
public dispose() {
|
||||||
|
|||||||
@@ -2,24 +2,33 @@
|
|||||||
"name": "WebApplicationBasic",
|
"name": "WebApplicationBasic",
|
||||||
"version": "0.0.0",
|
"version": "0.0.0",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"aspnet-webpack": "^1.0.6",
|
"@types/core-js": "^0.9.34",
|
||||||
|
"@types/crossroads": "0.0.29",
|
||||||
|
"@types/history": "^2.0.38",
|
||||||
|
"@types/jquery": "^2.0.32",
|
||||||
|
"@types/knockout": "^3.4.35",
|
||||||
|
"@types/react-router": "^2.0.37",
|
||||||
|
"@types/requirejs": "^2.1.26",
|
||||||
|
"@types/signals": "0.0.16",
|
||||||
|
"@types/whatwg-fetch": "0.0.30",
|
||||||
|
"aspnet-webpack": "^1.0.17",
|
||||||
"bootstrap": "^3.3.6",
|
"bootstrap": "^3.3.6",
|
||||||
"bundle-loader": "^0.5.4",
|
"bundle-loader": "^0.5.4",
|
||||||
"crossroads": "^0.12.2",
|
"crossroads": "^0.12.2",
|
||||||
"css-loader": "^0.23.1",
|
"css-loader": "^0.25.0",
|
||||||
"event-source-polyfill": "^0.0.7",
|
"event-source-polyfill": "^0.0.7",
|
||||||
"extract-text-webpack-plugin": "^1.0.1",
|
"extract-text-webpack-plugin": "^1.0.1",
|
||||||
"file-loader": "^0.8.5",
|
"file-loader": "^0.9.0",
|
||||||
"history": "^2.0.1",
|
"history": "^4.3.0",
|
||||||
"isomorphic-fetch": "^2.2.1",
|
"isomorphic-fetch": "^2.2.1",
|
||||||
"jquery": "^2.2.1",
|
"jquery": "^2.2.1",
|
||||||
"knockout": "^3.4.0",
|
"knockout": "^3.4.0",
|
||||||
"raw-loader": "^0.5.1",
|
"raw-loader": "^0.5.1",
|
||||||
"style-loader": "^0.13.0",
|
"style-loader": "^0.13.1",
|
||||||
"ts-loader": "^0.8.1",
|
"ts-loader": "^0.8.2",
|
||||||
"typescript": "^1.8.2",
|
"typescript": "^2.0.3",
|
||||||
"url-loader": "^0.5.7",
|
"url-loader": "^0.5.7",
|
||||||
"webpack": "^1.12.14",
|
"webpack": "^1.13.2",
|
||||||
"webpack-hot-middleware": "^2.10.0"
|
"webpack-hot-middleware": "^2.12.2"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,36 +0,0 @@
|
|||||||
{
|
|
||||||
"version": "v4",
|
|
||||||
"repo": "borisyankov/DefinitelyTyped",
|
|
||||||
"ref": "master",
|
|
||||||
"path": "typings",
|
|
||||||
"bundle": "typings/tsd.d.ts",
|
|
||||||
"installed": {
|
|
||||||
"knockout/knockout.d.ts": {
|
|
||||||
"commit": "9f0f926a12026287b5a4a229e5672c01e7549313"
|
|
||||||
},
|
|
||||||
"requirejs/require.d.ts": {
|
|
||||||
"commit": "9f0f926a12026287b5a4a229e5672c01e7549313"
|
|
||||||
},
|
|
||||||
"es6-promise/es6-promise.d.ts": {
|
|
||||||
"commit": "9f0f926a12026287b5a4a229e5672c01e7549313"
|
|
||||||
},
|
|
||||||
"history/history.d.ts": {
|
|
||||||
"commit": "9f0f926a12026287b5a4a229e5672c01e7549313"
|
|
||||||
},
|
|
||||||
"react-router/history.d.ts": {
|
|
||||||
"commit": "9f0f926a12026287b5a4a229e5672c01e7549313"
|
|
||||||
},
|
|
||||||
"crossroads/crossroads.d.ts": {
|
|
||||||
"commit": "9f0f926a12026287b5a4a229e5672c01e7549313"
|
|
||||||
},
|
|
||||||
"js-signals/js-signals.d.ts": {
|
|
||||||
"commit": "9f0f926a12026287b5a4a229e5672c01e7549313"
|
|
||||||
},
|
|
||||||
"isomorphic-fetch/isomorphic-fetch.d.ts": {
|
|
||||||
"commit": "57ec5fbb76060329c10959d449eb1d4e70b15a65"
|
|
||||||
},
|
|
||||||
"jquery/jquery.d.ts": {
|
|
||||||
"commit": "f470e7569e7046c62866f57bc4fea56ba79975d5"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,159 +0,0 @@
|
|||||||
// Type definitions for Crossroads.js
|
|
||||||
// Project: http://millermedeiros.github.io/crossroads.js/
|
|
||||||
// Definitions by: Diullei Gomes <https://github.com/diullei>
|
|
||||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
|
||||||
|
|
||||||
/// <reference path="../js-signals/js-signals.d.ts" />
|
|
||||||
|
|
||||||
declare module CrossroadsJs {
|
|
||||||
|
|
||||||
export interface Route {
|
|
||||||
matched: Signal;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Signal dispatched every time a request "leaves" the route.
|
|
||||||
*/
|
|
||||||
switched: Signal;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Object used to configure parameters/segments validation rules.
|
|
||||||
*/
|
|
||||||
rules: any;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* If crossroads should try to match this Route even after matching another Route.
|
|
||||||
*/
|
|
||||||
greedy: boolean;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Remove route from crossroads and destroy it, releasing memory.
|
|
||||||
*/
|
|
||||||
dispose(): void;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Test if Route matches against request. Return true if request validate against route rules and pattern.
|
|
||||||
*/
|
|
||||||
match(request: any): boolean;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Return a string that matches the route replacing the capturing groups with the values provided in the replacements object.
|
|
||||||
*/
|
|
||||||
interpolate(replacements: any): string;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Add a listener to the signal.
|
|
||||||
*
|
|
||||||
* @param listener Signal handler function.
|
|
||||||
* @param listenercontext Context on which listener will be executed (object that should represent the `this` variable inside listener function).
|
|
||||||
* @param priority The priority level of the event listener. Listeners with higher priority will be executed before listeners with lower priority. Listeners with same priority level will be executed at the same order as they were added. (default = 0)
|
|
||||||
*/
|
|
||||||
add(listener: Function, listenerContext?: any, priority?: Number): SignalBinding;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface CrossRoadsStatic {
|
|
||||||
|
|
||||||
NORM_AS_ARRAY: Function;
|
|
||||||
|
|
||||||
NORM_AS_OBJECT: Function;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Creates a new route pattern listener and add it to crossroads routes collection.
|
|
||||||
*
|
|
||||||
* @param pattern String pattern or Regular Expression that should be used to match against requests.
|
|
||||||
* @param handler Function that should be executed when a request matches the Route pattern.
|
|
||||||
* @param priority Route execution priority.
|
|
||||||
*/
|
|
||||||
addRoute(pattern: any, handler?: Function, priority?: number): Route;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Remove a single route from crossroads collection.
|
|
||||||
*
|
|
||||||
* @param route Reference to the Route object returned by crossroads.addRoute().
|
|
||||||
*/
|
|
||||||
removeRoute(route: Route): void;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Remove all routes from crossroads collection.
|
|
||||||
*/
|
|
||||||
removeAllRoutes(): void;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Parse a string input and dispatch matched Signal of the first Route that matches the request.
|
|
||||||
*
|
|
||||||
* @param request String that should be evaluated and matched against Routes to define which Route handlers should be executed and which parameters should be passed to the handlers.
|
|
||||||
* @param defaultargs Array containing values passed to matched/routed/bypassed signals as first arguments. Useful for node.js in case you need to access the request and response objects.
|
|
||||||
*/
|
|
||||||
parse(request: string, ...defaultArgs: any[]): void;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get number of Routes contained on the crossroads collection.
|
|
||||||
*/
|
|
||||||
getNumRoutes(): number;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Signal dispatched every time that crossroads.parse can't find a Route that matches the request. Useful for debuging and error handling.
|
|
||||||
*/
|
|
||||||
bypassed: Signal;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Signal dispatched every time that crossroads.parse find a Route that matches the request. Useful for debuging and for executing tasks that should happen at each routing.
|
|
||||||
*/
|
|
||||||
routed: Signal;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Create a new independent Router instance.
|
|
||||||
*/
|
|
||||||
create(): CrossRoadsStatic;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Sets a default function that should be used to normalize parameters before passing them to the Route.matched, works similarly to Route.rules.normalize_.
|
|
||||||
*/
|
|
||||||
normalizeFn: Function;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set if crossroads should typecast route paths. Default value is false (IMPORTANT: on v0.5.0 it was true by default).
|
|
||||||
*/
|
|
||||||
shouldTypecast: boolean;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* String representation of the crossroads version number (e.g. "0.6.0").
|
|
||||||
*/
|
|
||||||
VERSION: string;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Sets global route matching behavior to greedy so crossroads will try to match every single route with the supplied request (if true it won't stop at first match).
|
|
||||||
*/
|
|
||||||
greedy: boolean;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Sets if the greedy routes feature is enabled. If false it won't try to match multiple routes (faster).
|
|
||||||
*/
|
|
||||||
greedyEnabled: boolean;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Resets the Router internal state. Will clear reference to previously matched routes (so they won't dispatch switched signal when matching a new route) and reset last request.
|
|
||||||
*/
|
|
||||||
resetState(): void;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Sets if Router should care about previous state, so multiple crossroads.parse() calls passing same argument would not trigger the routed, matched and bypassed signals.
|
|
||||||
*/
|
|
||||||
ignoreState: boolean;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Pipe routers, so all crossroads.parse() calls will be forwarded to the other router as well.
|
|
||||||
*/
|
|
||||||
pipe(router: CrossRoadsStatic): void;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* "Ceci n'est pas une pipe"
|
|
||||||
*/
|
|
||||||
unpipe(router: CrossRoadsStatic): void;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
declare var crossroads: CrossroadsJs.CrossRoadsStatic;
|
|
||||||
|
|
||||||
declare module 'crossroads'{
|
|
||||||
export = crossroads;
|
|
||||||
}
|
|
||||||
@@ -1,75 +0,0 @@
|
|||||||
// Type definitions for es6-promise
|
|
||||||
// Project: https://github.com/jakearchibald/ES6-Promise
|
|
||||||
// Definitions by: François de Campredon <https://github.com/fdecampredon/>, vvakame <https://github.com/vvakame>
|
|
||||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
|
||||||
|
|
||||||
interface Thenable<T> {
|
|
||||||
then<U>(onFulfilled?: (value: T) => U | Thenable<U>, onRejected?: (error: any) => U | Thenable<U>): Thenable<U>;
|
|
||||||
then<U>(onFulfilled?: (value: T) => U | Thenable<U>, onRejected?: (error: any) => void): Thenable<U>;
|
|
||||||
catch<U>(onRejected?: (error: any) => U | Thenable<U>): Thenable<U>;
|
|
||||||
}
|
|
||||||
|
|
||||||
declare class Promise<T> implements Thenable<T> {
|
|
||||||
/**
|
|
||||||
* If you call resolve in the body of the callback passed to the constructor,
|
|
||||||
* your promise is fulfilled with result object passed to resolve.
|
|
||||||
* If you call reject your promise is rejected with the object passed to reject.
|
|
||||||
* For consistency and debugging (eg stack traces), obj should be an instanceof Error.
|
|
||||||
* Any errors thrown in the constructor callback will be implicitly passed to reject().
|
|
||||||
*/
|
|
||||||
constructor(callback: (resolve : (value?: T | Thenable<T>) => void, reject: (error?: any) => void) => void);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* onFulfilled is called when/if "promise" resolves. onRejected is called when/if "promise" rejects.
|
|
||||||
* Both are optional, if either/both are omitted the next onFulfilled/onRejected in the chain is called.
|
|
||||||
* Both callbacks have a single parameter , the fulfillment value or rejection reason.
|
|
||||||
* "then" returns a new promise equivalent to the value you return from onFulfilled/onRejected after being passed through Promise.resolve.
|
|
||||||
* If an error is thrown in the callback, the returned promise rejects with that error.
|
|
||||||
*
|
|
||||||
* @param onFulfilled called when/if "promise" resolves
|
|
||||||
* @param onRejected called when/if "promise" rejects
|
|
||||||
*/
|
|
||||||
then<U>(onFulfilled?: (value: T) => U | Thenable<U>, onRejected?: (error: any) => U | Thenable<U>): Promise<U>;
|
|
||||||
then<U>(onFulfilled?: (value: T) => U | Thenable<U>, onRejected?: (error: any) => void): Promise<U>;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Sugar for promise.then(undefined, onRejected)
|
|
||||||
*
|
|
||||||
* @param onRejected called when/if "promise" rejects
|
|
||||||
*/
|
|
||||||
catch<U>(onRejected?: (error: any) => U | Thenable<U>): Promise<U>;
|
|
||||||
}
|
|
||||||
|
|
||||||
declare module Promise {
|
|
||||||
/**
|
|
||||||
* Make a new promise from the thenable.
|
|
||||||
* A thenable is promise-like in as far as it has a "then" method.
|
|
||||||
*/
|
|
||||||
function resolve<T>(value?: T | Thenable<T>): Promise<T>;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Make a promise that rejects to obj. For consistency and debugging (eg stack traces), obj should be an instanceof Error
|
|
||||||
*/
|
|
||||||
function reject(error: any): Promise<any>;
|
|
||||||
function reject<T>(error: T): Promise<T>;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Make a promise that fulfills when every item in the array fulfills, and rejects if (and when) any item rejects.
|
|
||||||
* the array passed to all can be a mixture of promise-like objects and other objects.
|
|
||||||
* The fulfillment value is an array (in order) of fulfillment values. The rejection value is the first rejection value.
|
|
||||||
*/
|
|
||||||
function all<T>(promises: (T | Thenable<T>)[]): Promise<T[]>;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Make a Promise that fulfills when any item fulfills, and rejects if any item rejects.
|
|
||||||
*/
|
|
||||||
function race<T>(promises: (T | Thenable<T>)[]): Promise<T>;
|
|
||||||
}
|
|
||||||
|
|
||||||
declare module 'es6-promise' {
|
|
||||||
var foo: typeof Promise; // Temp variable to reference Promise in local context
|
|
||||||
module rsvp {
|
|
||||||
export var Promise: typeof foo;
|
|
||||||
}
|
|
||||||
export = rsvp;
|
|
||||||
}
|
|
||||||
@@ -1,61 +0,0 @@
|
|||||||
// Type definitions for History.js 1.8.0
|
|
||||||
// Project: https://github.com/browserstate/history.js
|
|
||||||
// Definitions by: Boris Yankov <https://github.com/borisyankov/>, Gidon Junge <https://github.com/gjunge/>
|
|
||||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
|
||||||
|
|
||||||
|
|
||||||
interface HistoryAdapter {
|
|
||||||
bind(element: any, event: string, callback: () => void): void;
|
|
||||||
trigger(element: any, event: string): void;
|
|
||||||
onDomLoad(callback: () => void): void;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Since History is defined in lib.d.ts as well
|
|
||||||
// the name for our interfaces was chosen to be Historyjs
|
|
||||||
// However at runtime you would need to do
|
|
||||||
// https://github.com/borisyankov/DefinitelyTyped/issues/277
|
|
||||||
// var Historyjs: Historyjs = <any>History;
|
|
||||||
|
|
||||||
interface Historyjs {
|
|
||||||
|
|
||||||
enabled: boolean;
|
|
||||||
|
|
||||||
pushState(data: any, title: string, url: string): void;
|
|
||||||
replaceState(data: any, title: string, url: string): void;
|
|
||||||
getState(): HistoryState;
|
|
||||||
getStateByIndex(index: number): HistoryState;
|
|
||||||
getCurrentIndex(): number;
|
|
||||||
getHash(): string;
|
|
||||||
|
|
||||||
Adapter: HistoryAdapter;
|
|
||||||
|
|
||||||
back(): void;
|
|
||||||
forward(): void;
|
|
||||||
go(x: Number): void;
|
|
||||||
|
|
||||||
log(...messages: any[]): void;
|
|
||||||
debug(...messages: any[]): void;
|
|
||||||
|
|
||||||
options: HistoryOptions;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface HistoryState {
|
|
||||||
data?: any;
|
|
||||||
title?: string;
|
|
||||||
url: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface HistoryOptions {
|
|
||||||
hashChangeInterval?: number;
|
|
||||||
safariPollInterval?: number;
|
|
||||||
doubleCheckInterval?: number;
|
|
||||||
disableSuid?: boolean;
|
|
||||||
storeInterval?: number;
|
|
||||||
busyDelay?: number;
|
|
||||||
debug?: boolean;
|
|
||||||
initialTitle?: string;
|
|
||||||
html4Mode?: boolean;
|
|
||||||
delayInit?: number;
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,119 +0,0 @@
|
|||||||
// Type definitions for isomorphic-fetch
|
|
||||||
// Project: https://github.com/matthew-andrews/isomorphic-fetch
|
|
||||||
// Definitions by: Todd Lucas <https://github.com/toddlucas>
|
|
||||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
|
||||||
|
|
||||||
declare enum RequestContext {
|
|
||||||
"audio", "beacon", "cspreport", "download", "embed", "eventsource",
|
|
||||||
"favicon", "fetch", "font", "form", "frame", "hyperlink", "iframe",
|
|
||||||
"image", "imageset", "import", "internal", "location", "manifest",
|
|
||||||
"object", "ping", "plugin", "prefetch", "script", "serviceworker",
|
|
||||||
"sharedworker", "subresource", "style", "track", "video", "worker",
|
|
||||||
"xmlhttprequest", "xslt"
|
|
||||||
}
|
|
||||||
declare enum RequestMode { "same-origin", "no-cors", "cors" }
|
|
||||||
declare enum RequestCredentials { "omit", "same-origin", "include" }
|
|
||||||
declare enum RequestCache {
|
|
||||||
"default", "no-store", "reload", "no-cache", "force-cache",
|
|
||||||
"only-if-cached"
|
|
||||||
}
|
|
||||||
declare enum ResponseType { "basic", "cors", "default", "error", "opaque" }
|
|
||||||
|
|
||||||
declare type HeaderInit = Headers | Array<string>;
|
|
||||||
declare type BodyInit = ArrayBuffer | ArrayBufferView | Blob | FormData | string;
|
|
||||||
declare type RequestInfo = Request | string;
|
|
||||||
|
|
||||||
interface RequestInit {
|
|
||||||
method?: string;
|
|
||||||
headers?: HeaderInit | { [index: string]: string };
|
|
||||||
body?: BodyInit;
|
|
||||||
mode?: string | RequestMode;
|
|
||||||
credentials?: string | RequestCredentials;
|
|
||||||
cache?: string | RequestCache;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface IHeaders {
|
|
||||||
get(name: string): string;
|
|
||||||
getAll(name: string): Array<string>;
|
|
||||||
has(name: string): boolean;
|
|
||||||
}
|
|
||||||
|
|
||||||
declare class Headers implements IHeaders {
|
|
||||||
append(name: string, value: string): void;
|
|
||||||
delete(name: string):void;
|
|
||||||
get(name: string): string;
|
|
||||||
getAll(name: string): Array<string>;
|
|
||||||
has(name: string): boolean;
|
|
||||||
set(name: string, value: string): void;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface IBody {
|
|
||||||
bodyUsed: boolean;
|
|
||||||
arrayBuffer(): Promise<ArrayBuffer>;
|
|
||||||
blob(): Promise<Blob>;
|
|
||||||
formData(): Promise<FormData>;
|
|
||||||
json(): Promise<any>;
|
|
||||||
json<T>(): Promise<T>;
|
|
||||||
text(): Promise<string>;
|
|
||||||
}
|
|
||||||
|
|
||||||
declare class Body implements IBody {
|
|
||||||
bodyUsed: boolean;
|
|
||||||
arrayBuffer(): Promise<ArrayBuffer>;
|
|
||||||
blob(): Promise<Blob>;
|
|
||||||
formData(): Promise<FormData>;
|
|
||||||
json(): Promise<any>;
|
|
||||||
json<T>(): Promise<T>;
|
|
||||||
text(): Promise<string>;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface IRequest extends IBody {
|
|
||||||
method: string;
|
|
||||||
url: string;
|
|
||||||
headers: Headers;
|
|
||||||
context: string | RequestContext;
|
|
||||||
referrer: string;
|
|
||||||
mode: string | RequestMode;
|
|
||||||
credentials: string | RequestCredentials;
|
|
||||||
cache: string | RequestCache;
|
|
||||||
}
|
|
||||||
|
|
||||||
declare class Request extends Body implements IRequest {
|
|
||||||
constructor(input: string | Request, init?: RequestInit);
|
|
||||||
method: string;
|
|
||||||
url: string;
|
|
||||||
headers: Headers;
|
|
||||||
context: string | RequestContext;
|
|
||||||
referrer: string;
|
|
||||||
mode: string | RequestMode;
|
|
||||||
credentials: string | RequestCredentials;
|
|
||||||
cache: string | RequestCache;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface IResponse extends IBody {
|
|
||||||
url: string;
|
|
||||||
status: number;
|
|
||||||
statusText: string;
|
|
||||||
ok: boolean;
|
|
||||||
headers: IHeaders;
|
|
||||||
type: string | ResponseType;
|
|
||||||
size: number;
|
|
||||||
timeout: number;
|
|
||||||
redirect(url: string, status: number): IResponse;
|
|
||||||
error(): IResponse;
|
|
||||||
clone(): IResponse;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface IFetchStatic {
|
|
||||||
Promise: any;
|
|
||||||
Headers: IHeaders
|
|
||||||
Request: IRequest;
|
|
||||||
Response: IResponse;
|
|
||||||
(url: string | IRequest, init?: RequestInit): Promise<IResponse>;
|
|
||||||
}
|
|
||||||
|
|
||||||
declare var fetch: IFetchStatic;
|
|
||||||
|
|
||||||
declare module "isomorphic-fetch" {
|
|
||||||
export = fetch;
|
|
||||||
}
|
|
||||||
3242
templates/KnockoutSpa/typings/jquery/jquery.d.ts
vendored
3242
templates/KnockoutSpa/typings/jquery/jquery.d.ts
vendored
File diff suppressed because it is too large
Load Diff
@@ -1,110 +0,0 @@
|
|||||||
// Type definitions for JS-Signals
|
|
||||||
// Project: http://millermedeiros.github.io/js-signals/
|
|
||||||
// Definitions by: Diullei Gomes <https://github.com/diullei>
|
|
||||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
|
||||||
|
|
||||||
declare var signals: SignalWrapper;
|
|
||||||
|
|
||||||
declare module "signals" {
|
|
||||||
export = signals;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface SignalWrapper {
|
|
||||||
Signal: Signal
|
|
||||||
}
|
|
||||||
|
|
||||||
interface SignalBinding {
|
|
||||||
active: boolean;
|
|
||||||
context: any;
|
|
||||||
params: any;
|
|
||||||
detach(): Function;
|
|
||||||
execute(paramsArr?:any[]): any;
|
|
||||||
getListener(): Function;
|
|
||||||
getSignal(): Signal;
|
|
||||||
isBound(): boolean;
|
|
||||||
isOnce(): boolean;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface Signal {
|
|
||||||
/**
|
|
||||||
* Custom event broadcaster
|
|
||||||
* <br />- inspired by Robert Penner's AS3 Signals.
|
|
||||||
* @name Signal
|
|
||||||
* @author Miller Medeiros
|
|
||||||
* @constructor
|
|
||||||
*/
|
|
||||||
new(): Signal;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* If Signal is active and should broadcast events.
|
|
||||||
*/
|
|
||||||
active: boolean;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* If Signal should keep record of previously dispatched parameters and automatically
|
|
||||||
* execute listener during add()/addOnce() if Signal was already dispatched before.
|
|
||||||
*/
|
|
||||||
memorize: boolean;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Signals Version Number
|
|
||||||
*/
|
|
||||||
VERSION: string;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Add a listener to the signal.
|
|
||||||
*
|
|
||||||
* @param listener Signal handler function.
|
|
||||||
* @param listenercontext Context on which listener will be executed (object that should represent the `this` variable inside listener function).
|
|
||||||
* @param priority The priority level of the event listener. Listeners with higher priority will be executed before listeners with lower priority. Listeners with same priority level will be executed at the same order as they were added. (default = 0)
|
|
||||||
*/
|
|
||||||
add(listener: Function, listenerContext?: any, priority?: Number): SignalBinding;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Add listener to the signal that should be removed after first execution (will be executed only once).
|
|
||||||
*
|
|
||||||
* @param listener Signal handler function.
|
|
||||||
* @param listenercontext Context on which listener will be executed (object that should represent the `this` variable inside listener function).
|
|
||||||
* @param priority The priority level of the event listener. Listeners with higher priority will be executed before listeners with lower priority. Listeners with same priority level will be executed at the same order as they were added. (default = 0)
|
|
||||||
*/
|
|
||||||
addOnce(listener: Function, listenerContext?: any, priority?: Number): SignalBinding;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Dispatch/Broadcast Signal to all listeners added to the queue.
|
|
||||||
*
|
|
||||||
* @param params Parameters that should be passed to each handler.
|
|
||||||
*/
|
|
||||||
dispatch(...params: any[]): void;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Remove all bindings from signal and destroy any reference to external objects (destroy Signal object).
|
|
||||||
*/
|
|
||||||
dispose(): void;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Forget memorized arguments.
|
|
||||||
*/
|
|
||||||
forget(): void;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns a number of listeners attached to the Signal.
|
|
||||||
*/
|
|
||||||
getNumListeners(): number;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Stop propagation of the event, blocking the dispatch to next listeners on the queue.
|
|
||||||
*/
|
|
||||||
halt(): void;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Check if listener was attached to Signal.
|
|
||||||
*/
|
|
||||||
has(listener: Function, context?: any): boolean;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Remove a single listener from the dispatch queue.
|
|
||||||
*/
|
|
||||||
remove(listener: Function, context?: any): Function;
|
|
||||||
|
|
||||||
removeAll(): void;
|
|
||||||
}
|
|
||||||
631
templates/KnockoutSpa/typings/knockout/knockout.d.ts
vendored
631
templates/KnockoutSpa/typings/knockout/knockout.d.ts
vendored
@@ -1,631 +0,0 @@
|
|||||||
// Type definitions for Knockout v3.2.0
|
|
||||||
// Project: http://knockoutjs.com
|
|
||||||
// Definitions by: Boris Yankov <https://github.com/borisyankov/>, Igor Oleinikov <https://github.com/Igorbek/>, Clément Bourgeois <https://github.com/moonpyk/>
|
|
||||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
|
||||||
|
|
||||||
|
|
||||||
interface KnockoutSubscribableFunctions<T> {
|
|
||||||
[key: string]: KnockoutBindingHandler;
|
|
||||||
|
|
||||||
notifySubscribers(valueToWrite?: T, event?: string): void;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface KnockoutComputedFunctions<T> {
|
|
||||||
[key: string]: KnockoutBindingHandler;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface KnockoutObservableFunctions<T> {
|
|
||||||
[key: string]: KnockoutBindingHandler;
|
|
||||||
|
|
||||||
equalityComparer(a: any, b: any): boolean;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface KnockoutObservableArrayFunctions<T> {
|
|
||||||
// General Array functions
|
|
||||||
indexOf(searchElement: T, fromIndex?: number): number;
|
|
||||||
slice(start: number, end?: number): T[];
|
|
||||||
splice(start: number): T[];
|
|
||||||
splice(start: number, deleteCount: number, ...items: T[]): T[];
|
|
||||||
pop(): T;
|
|
||||||
push(...items: T[]): void;
|
|
||||||
shift(): T;
|
|
||||||
unshift(...items: T[]): number;
|
|
||||||
reverse(): KnockoutObservableArray<T>;
|
|
||||||
sort(): KnockoutObservableArray<T>;
|
|
||||||
sort(compareFunction: (left: T, right: T) => number): KnockoutObservableArray<T>;
|
|
||||||
|
|
||||||
// Ko specific
|
|
||||||
[key: string]: KnockoutBindingHandler;
|
|
||||||
|
|
||||||
replace(oldItem: T, newItem: T): void;
|
|
||||||
|
|
||||||
remove(item: T): T[];
|
|
||||||
remove(removeFunction: (item: T) => boolean): T[];
|
|
||||||
removeAll(items: T[]): T[];
|
|
||||||
removeAll(): T[];
|
|
||||||
|
|
||||||
destroy(item: T): void;
|
|
||||||
destroy(destroyFunction: (item: T) => boolean): void;
|
|
||||||
destroyAll(items: T[]): void;
|
|
||||||
destroyAll(): void;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface KnockoutSubscribableStatic {
|
|
||||||
fn: KnockoutSubscribableFunctions<any>;
|
|
||||||
|
|
||||||
new <T>(): KnockoutSubscribable<T>;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface KnockoutSubscription {
|
|
||||||
dispose(): void;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface KnockoutSubscribable<T> extends KnockoutSubscribableFunctions<T> {
|
|
||||||
subscribe(callback: (newValue: T) => void, target?: any, event?: string): KnockoutSubscription;
|
|
||||||
subscribe<TEvent>(callback: (newValue: TEvent) => void, target: any, event: string): KnockoutSubscription;
|
|
||||||
extend(requestedExtenders: { [key: string]: any; }): KnockoutSubscribable<T>;
|
|
||||||
getSubscriptionsCount(): number;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface KnockoutComputedStatic {
|
|
||||||
fn: KnockoutComputedFunctions<any>;
|
|
||||||
|
|
||||||
<T>(): KnockoutComputed<T>;
|
|
||||||
<T>(func: () => T, context?: any, options?: any): KnockoutComputed<T>;
|
|
||||||
<T>(def: KnockoutComputedDefine<T>, context?: any): KnockoutComputed<T>;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface KnockoutComputed<T> extends KnockoutObservable<T>, KnockoutComputedFunctions<T> {
|
|
||||||
fn: KnockoutComputedFunctions<any>;
|
|
||||||
|
|
||||||
dispose(): void;
|
|
||||||
isActive(): boolean;
|
|
||||||
getDependenciesCount(): number;
|
|
||||||
extend(requestedExtenders: { [key: string]: any; }): KnockoutComputed<T>;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface KnockoutObservableArrayStatic {
|
|
||||||
fn: KnockoutObservableArrayFunctions<any>;
|
|
||||||
|
|
||||||
<T>(value?: T[]): KnockoutObservableArray<T>;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface KnockoutObservableArray<T> extends KnockoutObservable<T[]>, KnockoutObservableArrayFunctions<T> {
|
|
||||||
extend(requestedExtenders: { [key: string]: any; }): KnockoutObservableArray<T>;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface KnockoutObservableStatic {
|
|
||||||
fn: KnockoutObservableFunctions<any>;
|
|
||||||
|
|
||||||
<T>(value?: T): KnockoutObservable<T>;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface KnockoutObservable<T> extends KnockoutSubscribable<T>, KnockoutObservableFunctions<T> {
|
|
||||||
(): T;
|
|
||||||
(value: T): void;
|
|
||||||
|
|
||||||
peek(): T;
|
|
||||||
valueHasMutated?:{(): void;};
|
|
||||||
valueWillMutate?:{(): void;};
|
|
||||||
extend(requestedExtenders: { [key: string]: any; }): KnockoutObservable<T>;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface KnockoutComputedDefine<T> {
|
|
||||||
read(): T;
|
|
||||||
write? (value: T): void;
|
|
||||||
disposeWhenNodeIsRemoved?: Node;
|
|
||||||
disposeWhen? (): boolean;
|
|
||||||
owner?: any;
|
|
||||||
deferEvaluation?: boolean;
|
|
||||||
pure?: boolean;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface KnockoutBindingContext {
|
|
||||||
$parent: any;
|
|
||||||
$parents: any[];
|
|
||||||
$root: any;
|
|
||||||
$data: any;
|
|
||||||
$rawData: any | KnockoutObservable<any>;
|
|
||||||
$index?: KnockoutObservable<number>;
|
|
||||||
$parentContext?: KnockoutBindingContext;
|
|
||||||
$component: any;
|
|
||||||
$componentTemplateNodes: Node[];
|
|
||||||
|
|
||||||
extend(properties: any): any;
|
|
||||||
createChildContext(dataItemOrAccessor: any, dataItemAlias?: any, extendCallback?: Function): any;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface KnockoutAllBindingsAccessor {
|
|
||||||
(): any;
|
|
||||||
get(name: string): any;
|
|
||||||
has(name: string): boolean;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface KnockoutBindingHandler {
|
|
||||||
after?: Array<string>;
|
|
||||||
init?: (element: any, valueAccessor: () => any, allBindingsAccessor?: KnockoutAllBindingsAccessor, viewModel?: any, bindingContext?: KnockoutBindingContext) => void | { controlsDescendantBindings: boolean; };
|
|
||||||
update?: (element: any, valueAccessor: () => any, allBindingsAccessor?: KnockoutAllBindingsAccessor, viewModel?: any, bindingContext?: KnockoutBindingContext) => void;
|
|
||||||
options?: any;
|
|
||||||
preprocess?: (value: string, name: string, addBindingCallback?: (name: string, value: string) => void) => string;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface KnockoutBindingHandlers {
|
|
||||||
[bindingHandler: string]: KnockoutBindingHandler;
|
|
||||||
|
|
||||||
// Controlling text and appearance
|
|
||||||
visible: KnockoutBindingHandler;
|
|
||||||
text: KnockoutBindingHandler;
|
|
||||||
html: KnockoutBindingHandler;
|
|
||||||
css: KnockoutBindingHandler;
|
|
||||||
style: KnockoutBindingHandler;
|
|
||||||
attr: KnockoutBindingHandler;
|
|
||||||
|
|
||||||
// Control Flow
|
|
||||||
foreach: KnockoutBindingHandler;
|
|
||||||
if: KnockoutBindingHandler;
|
|
||||||
ifnot: KnockoutBindingHandler;
|
|
||||||
with: KnockoutBindingHandler;
|
|
||||||
|
|
||||||
// Working with form fields
|
|
||||||
click: KnockoutBindingHandler;
|
|
||||||
event: KnockoutBindingHandler;
|
|
||||||
submit: KnockoutBindingHandler;
|
|
||||||
enable: KnockoutBindingHandler;
|
|
||||||
disable: KnockoutBindingHandler;
|
|
||||||
value: KnockoutBindingHandler;
|
|
||||||
textInput: KnockoutBindingHandler;
|
|
||||||
hasfocus: KnockoutBindingHandler;
|
|
||||||
checked: KnockoutBindingHandler;
|
|
||||||
options: KnockoutBindingHandler;
|
|
||||||
selectedOptions: KnockoutBindingHandler;
|
|
||||||
uniqueName: KnockoutBindingHandler;
|
|
||||||
|
|
||||||
// Rendering templates
|
|
||||||
template: KnockoutBindingHandler;
|
|
||||||
|
|
||||||
// Components (new for v3.2)
|
|
||||||
component: KnockoutBindingHandler;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface KnockoutMemoization {
|
|
||||||
memoize(callback: () => string): string;
|
|
||||||
unmemoize(memoId: string, callbackParams: any[]): boolean;
|
|
||||||
unmemoizeDomNodeAndDescendants(domNode: any, extraCallbackParamsArray: any[]): boolean;
|
|
||||||
parseMemoText(memoText: string): string;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface KnockoutVirtualElement {}
|
|
||||||
|
|
||||||
interface KnockoutVirtualElements {
|
|
||||||
allowedBindings: { [bindingName: string]: boolean; };
|
|
||||||
emptyNode(node: KnockoutVirtualElement ): void;
|
|
||||||
firstChild(node: KnockoutVirtualElement ): KnockoutVirtualElement;
|
|
||||||
insertAfter( container: KnockoutVirtualElement, nodeToInsert: Node, insertAfter: Node ): void;
|
|
||||||
nextSibling(node: KnockoutVirtualElement): Node;
|
|
||||||
prepend(node: KnockoutVirtualElement, toInsert: Node ): void;
|
|
||||||
setDomNodeChildren(node: KnockoutVirtualElement, newChildren: { length: number;[index: number]: Node; } ): void;
|
|
||||||
childNodes(node: KnockoutVirtualElement ): Node[];
|
|
||||||
}
|
|
||||||
|
|
||||||
interface KnockoutExtenders {
|
|
||||||
throttle(target: any, timeout: number): KnockoutComputed<any>;
|
|
||||||
notify(target: any, notifyWhen: string): any;
|
|
||||||
|
|
||||||
rateLimit(target: any, timeout: number): any;
|
|
||||||
rateLimit(target: any, options: { timeout: number; method?: string; }): any;
|
|
||||||
|
|
||||||
trackArrayChanges(target: any): any;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// NOTE TO MAINTAINERS AND CONTRIBUTORS : pay attention to only include symbols that are
|
|
||||||
// publicly exported in the minified version of ko, without that you can give the false
|
|
||||||
// impression that some functions will be available in production builds.
|
|
||||||
//
|
|
||||||
interface KnockoutUtils {
|
|
||||||
//////////////////////////////////
|
|
||||||
// utils.domData.js
|
|
||||||
//////////////////////////////////
|
|
||||||
|
|
||||||
domData: {
|
|
||||||
get (node: Element, key: string): any;
|
|
||||||
|
|
||||||
set (node: Element, key: string, value: any): void;
|
|
||||||
|
|
||||||
getAll(node: Element, createIfNotFound: boolean): any;
|
|
||||||
|
|
||||||
clear(node: Element): boolean;
|
|
||||||
};
|
|
||||||
|
|
||||||
//////////////////////////////////
|
|
||||||
// utils.domNodeDisposal.js
|
|
||||||
//////////////////////////////////
|
|
||||||
|
|
||||||
domNodeDisposal: {
|
|
||||||
addDisposeCallback(node: Element, callback: Function): void;
|
|
||||||
|
|
||||||
removeDisposeCallback(node: Element, callback: Function): void;
|
|
||||||
|
|
||||||
cleanNode(node: Node): Element;
|
|
||||||
|
|
||||||
removeNode(node: Node): void;
|
|
||||||
};
|
|
||||||
|
|
||||||
addOrRemoveItem<T>(array: T[] | KnockoutObservable<T>, value: T, included: T): void;
|
|
||||||
|
|
||||||
arrayFilter<T>(array: T[], predicate: (item: T) => boolean): T[];
|
|
||||||
|
|
||||||
arrayFirst<T>(array: T[], predicate: (item: T) => boolean, predicateOwner?: any): T;
|
|
||||||
|
|
||||||
arrayForEach<T>(array: T[], action: (item: T, index: number) => void): void;
|
|
||||||
|
|
||||||
arrayGetDistinctValues<T>(array: T[]): T[];
|
|
||||||
|
|
||||||
arrayIndexOf<T>(array: T[], item: T): number;
|
|
||||||
|
|
||||||
arrayMap<T, U>(array: T[], mapping: (item: T) => U): U[];
|
|
||||||
|
|
||||||
arrayPushAll<T>(array: T[] | KnockoutObservableArray<T>, valuesToPush: T[]): T[];
|
|
||||||
|
|
||||||
arrayRemoveItem(array: any[], itemToRemove: any): void;
|
|
||||||
|
|
||||||
compareArrays<T>(a: T[], b: T[]): Array<KnockoutArrayChange<T>>;
|
|
||||||
|
|
||||||
extend(target: Object, source: Object): Object;
|
|
||||||
|
|
||||||
fieldsIncludedWithJsonPost: any[];
|
|
||||||
|
|
||||||
getFormFields(form: any, fieldName: string): any[];
|
|
||||||
|
|
||||||
objectForEach(obj: any, action: (key: any, value: any) => void): void;
|
|
||||||
|
|
||||||
parseHtmlFragment(html: string): any[];
|
|
||||||
|
|
||||||
parseJson(jsonString: string): any;
|
|
||||||
|
|
||||||
postJson(urlOrForm: any, data: any, options: any): void;
|
|
||||||
|
|
||||||
peekObservable<T>(value: KnockoutObservable<T>): T;
|
|
||||||
|
|
||||||
range(min: any, max: any): any;
|
|
||||||
|
|
||||||
registerEventHandler(element: any, eventType: any, handler: Function): void;
|
|
||||||
|
|
||||||
setHtml(node: Element, html: () => string): void;
|
|
||||||
|
|
||||||
setHtml(node: Element, html: string): void;
|
|
||||||
|
|
||||||
setTextContent(element: any, textContent: string | KnockoutObservable<string>): void;
|
|
||||||
|
|
||||||
stringifyJson(data: any, replacer?: Function, space?: string): string;
|
|
||||||
|
|
||||||
toggleDomNodeCssClass(node: any, className: string, shouldHaveClass: boolean): void;
|
|
||||||
|
|
||||||
triggerEvent(element: any, eventType: any): void;
|
|
||||||
|
|
||||||
unwrapObservable<T>(value: KnockoutObservable<T> | T): T;
|
|
||||||
|
|
||||||
// NOT PART OF THE MINIFIED API SURFACE (ONLY IN knockout-{version}.debug.js) https://github.com/SteveSanderson/knockout/issues/670
|
|
||||||
// forceRefresh(node: any): void;
|
|
||||||
// ieVersion: number;
|
|
||||||
// isIe6: boolean;
|
|
||||||
// isIe7: boolean;
|
|
||||||
// jQueryHtmlParse(html: string): any[];
|
|
||||||
// makeArray(arrayLikeObject: any): any[];
|
|
||||||
// moveCleanedNodesToContainerElement(nodes: any[]): HTMLElement;
|
|
||||||
// replaceDomNodes(nodeToReplaceOrNodeArray: any, newNodesArray: any[]): void;
|
|
||||||
// setDomNodeChildren(domNode: any, childNodes: any[]): void;
|
|
||||||
// setElementName(element: any, name: string): void;
|
|
||||||
// setOptionNodeSelectionState(optionNode: any, isSelected: boolean): void;
|
|
||||||
// simpleHtmlParse(html: string): any[];
|
|
||||||
// stringStartsWith(str: string, startsWith: string): boolean;
|
|
||||||
// stringTokenize(str: string, delimiter: string): string[];
|
|
||||||
// stringTrim(str: string): string;
|
|
||||||
// tagNameLower(element: any): string;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface KnockoutArrayChange<T> {
|
|
||||||
status: string;
|
|
||||||
value: T;
|
|
||||||
index: number;
|
|
||||||
moved?: number;
|
|
||||||
}
|
|
||||||
|
|
||||||
//////////////////////////////////
|
|
||||||
// templateSources.js
|
|
||||||
//////////////////////////////////
|
|
||||||
|
|
||||||
interface KnockoutTemplateSourcesDomElement {
|
|
||||||
text(): any;
|
|
||||||
text(value: any): void;
|
|
||||||
|
|
||||||
data(key: string): any;
|
|
||||||
data(key: string, value: any): any;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface KnockoutTemplateAnonymous extends KnockoutTemplateSourcesDomElement {
|
|
||||||
nodes(): any;
|
|
||||||
nodes(value: any): void;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface KnockoutTemplateSources {
|
|
||||||
|
|
||||||
domElement: {
|
|
||||||
prototype: KnockoutTemplateSourcesDomElement
|
|
||||||
new (element: Element): KnockoutTemplateSourcesDomElement
|
|
||||||
};
|
|
||||||
|
|
||||||
anonymousTemplate: {
|
|
||||||
prototype: KnockoutTemplateAnonymous;
|
|
||||||
new (element: Element): KnockoutTemplateAnonymous;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
//////////////////////////////////
|
|
||||||
// nativeTemplateEngine.js
|
|
||||||
//////////////////////////////////
|
|
||||||
|
|
||||||
interface KnockoutNativeTemplateEngine {
|
|
||||||
|
|
||||||
renderTemplateSource(templateSource: Object, bindingContext?: KnockoutBindingContext, options?: Object): any[];
|
|
||||||
}
|
|
||||||
|
|
||||||
//////////////////////////////////
|
|
||||||
// templateEngine.js
|
|
||||||
//////////////////////////////////
|
|
||||||
|
|
||||||
interface KnockoutTemplateEngine extends KnockoutNativeTemplateEngine {
|
|
||||||
|
|
||||||
createJavaScriptEvaluatorBlock(script: string): string;
|
|
||||||
|
|
||||||
makeTemplateSource(template: any, templateDocument?: Document): any;
|
|
||||||
|
|
||||||
renderTemplate(template: any, bindingContext: KnockoutBindingContext, options: Object, templateDocument: Document): any;
|
|
||||||
|
|
||||||
isTemplateRewritten(template: any, templateDocument: Document): boolean;
|
|
||||||
|
|
||||||
rewriteTemplate(template: any, rewriterCallback: Function, templateDocument: Document): void;
|
|
||||||
}
|
|
||||||
|
|
||||||
/////////////////////////////////
|
|
||||||
|
|
||||||
interface KnockoutStatic {
|
|
||||||
utils: KnockoutUtils;
|
|
||||||
memoization: KnockoutMemoization;
|
|
||||||
|
|
||||||
bindingHandlers: KnockoutBindingHandlers;
|
|
||||||
getBindingHandler(handler: string): KnockoutBindingHandler;
|
|
||||||
|
|
||||||
virtualElements: KnockoutVirtualElements;
|
|
||||||
extenders: KnockoutExtenders;
|
|
||||||
|
|
||||||
applyBindings(viewModelOrBindingContext?: any, rootNode?: any): void;
|
|
||||||
applyBindingsToDescendants(viewModelOrBindingContext: any, rootNode: any): void;
|
|
||||||
applyBindingAccessorsToNode(node: Node, bindings: (bindingContext: KnockoutBindingContext, node: Node) => {}, bindingContext: KnockoutBindingContext): void;
|
|
||||||
applyBindingAccessorsToNode(node: Node, bindings: {}, bindingContext: KnockoutBindingContext): void;
|
|
||||||
applyBindingAccessorsToNode(node: Node, bindings: (bindingContext: KnockoutBindingContext, node: Node) => {}, viewModel: any): void;
|
|
||||||
applyBindingAccessorsToNode(node: Node, bindings: {}, viewModel: any): void;
|
|
||||||
applyBindingsToNode(node: Node, bindings: any, viewModelOrBindingContext?: any): any;
|
|
||||||
|
|
||||||
subscribable: KnockoutSubscribableStatic;
|
|
||||||
observable: KnockoutObservableStatic;
|
|
||||||
|
|
||||||
computed: KnockoutComputedStatic;
|
|
||||||
pureComputed<T>(evaluatorFunction: () => T, context?: any): KnockoutComputed<T>;
|
|
||||||
pureComputed<T>(options: KnockoutComputedDefine<T>, context?: any): KnockoutComputed<T>;
|
|
||||||
|
|
||||||
observableArray: KnockoutObservableArrayStatic;
|
|
||||||
|
|
||||||
contextFor(node: any): any;
|
|
||||||
isSubscribable(instance: any): boolean;
|
|
||||||
toJSON(viewModel: any, replacer?: Function, space?: any): string;
|
|
||||||
toJS(viewModel: any): any;
|
|
||||||
isObservable(instance: any): boolean;
|
|
||||||
isWriteableObservable(instance: any): boolean;
|
|
||||||
isComputed(instance: any): boolean;
|
|
||||||
dataFor(node: any): any;
|
|
||||||
removeNode(node: Element): void;
|
|
||||||
cleanNode(node: Element): Element;
|
|
||||||
renderTemplate(template: Function, viewModel: any, options?: any, target?: any, renderMode?: any): any;
|
|
||||||
renderTemplate(template: string, viewModel: any, options?: any, target?: any, renderMode?: any): any;
|
|
||||||
unwrap<T>(value: KnockoutObservable<T> | T): T;
|
|
||||||
|
|
||||||
computedContext: KnockoutComputedContext;
|
|
||||||
|
|
||||||
//////////////////////////////////
|
|
||||||
// templateSources.js
|
|
||||||
//////////////////////////////////
|
|
||||||
|
|
||||||
templateSources: KnockoutTemplateSources;
|
|
||||||
|
|
||||||
//////////////////////////////////
|
|
||||||
// templateEngine.js
|
|
||||||
//////////////////////////////////
|
|
||||||
|
|
||||||
templateEngine: {
|
|
||||||
|
|
||||||
prototype: KnockoutTemplateEngine;
|
|
||||||
|
|
||||||
new (): KnockoutTemplateEngine;
|
|
||||||
};
|
|
||||||
|
|
||||||
//////////////////////////////////
|
|
||||||
// templateRewriting.js
|
|
||||||
//////////////////////////////////
|
|
||||||
|
|
||||||
templateRewriting: {
|
|
||||||
|
|
||||||
ensureTemplateIsRewritten(template: Node, templateEngine: KnockoutTemplateEngine, templateDocument: Document): any;
|
|
||||||
ensureTemplateIsRewritten(template: string, templateEngine: KnockoutTemplateEngine, templateDocument: Document): any;
|
|
||||||
|
|
||||||
memoizeBindingAttributeSyntax(htmlString: string, templateEngine: KnockoutTemplateEngine): any;
|
|
||||||
|
|
||||||
applyMemoizedBindingsToNextSibling(bindings: any, nodeName: string): string;
|
|
||||||
};
|
|
||||||
|
|
||||||
//////////////////////////////////
|
|
||||||
// nativeTemplateEngine.js
|
|
||||||
//////////////////////////////////
|
|
||||||
|
|
||||||
nativeTemplateEngine: {
|
|
||||||
|
|
||||||
prototype: KnockoutNativeTemplateEngine;
|
|
||||||
|
|
||||||
new (): KnockoutNativeTemplateEngine;
|
|
||||||
|
|
||||||
instance: KnockoutNativeTemplateEngine;
|
|
||||||
};
|
|
||||||
|
|
||||||
//////////////////////////////////
|
|
||||||
// jqueryTmplTemplateEngine.js
|
|
||||||
//////////////////////////////////
|
|
||||||
|
|
||||||
jqueryTmplTemplateEngine: {
|
|
||||||
|
|
||||||
prototype: KnockoutTemplateEngine;
|
|
||||||
|
|
||||||
renderTemplateSource(templateSource: Object, bindingContext: KnockoutBindingContext, options: Object): Node[];
|
|
||||||
|
|
||||||
createJavaScriptEvaluatorBlock(script: string): string;
|
|
||||||
|
|
||||||
addTemplate(templateName: string, templateMarkup: string): void;
|
|
||||||
};
|
|
||||||
|
|
||||||
//////////////////////////////////
|
|
||||||
// templating.js
|
|
||||||
//////////////////////////////////
|
|
||||||
|
|
||||||
setTemplateEngine(templateEngine: KnockoutNativeTemplateEngine): void;
|
|
||||||
|
|
||||||
renderTemplate(template: Function, dataOrBindingContext: KnockoutBindingContext, options: Object, targetNodeOrNodeArray: Node, renderMode: string): any;
|
|
||||||
renderTemplate(template: any, dataOrBindingContext: KnockoutBindingContext, options: Object, targetNodeOrNodeArray: Node, renderMode: string): any;
|
|
||||||
renderTemplate(template: Function, dataOrBindingContext: any, options: Object, targetNodeOrNodeArray: Node, renderMode: string): any;
|
|
||||||
renderTemplate(template: any, dataOrBindingContext: any, options: Object, targetNodeOrNodeArray: Node, renderMode: string): any;
|
|
||||||
renderTemplate(template: Function, dataOrBindingContext: KnockoutBindingContext, options: Object, targetNodeOrNodeArray: Node[], renderMode: string): any;
|
|
||||||
renderTemplate(template: any, dataOrBindingContext: KnockoutBindingContext, options: Object, targetNodeOrNodeArray: Node[], renderMode: string): any;
|
|
||||||
renderTemplate(template: Function, dataOrBindingContext: any, options: Object, targetNodeOrNodeArray: Node[], renderMode: string): any;
|
|
||||||
renderTemplate(template: any, dataOrBindingContext: any, options: Object, targetNodeOrNodeArray: Node[], renderMode: string): any;
|
|
||||||
|
|
||||||
renderTemplateForEach(template: Function, arrayOrObservableArray: any[], options: Object, targetNode: Node, parentBindingContext: KnockoutBindingContext): any;
|
|
||||||
renderTemplateForEach(template: any, arrayOrObservableArray: any[], options: Object, targetNode: Node, parentBindingContext: KnockoutBindingContext): any;
|
|
||||||
renderTemplateForEach(template: Function, arrayOrObservableArray: KnockoutObservable<any>, options: Object, targetNode: Node, parentBindingContext: KnockoutBindingContext): any;
|
|
||||||
renderTemplateForEach(template: any, arrayOrObservableArray: KnockoutObservable<any>, options: Object, targetNode: Node, parentBindingContext: KnockoutBindingContext): any;
|
|
||||||
|
|
||||||
expressionRewriting: {
|
|
||||||
bindingRewriteValidators: any;
|
|
||||||
parseObjectLiteral: { (objectLiteralString: string): any[] }
|
|
||||||
};
|
|
||||||
|
|
||||||
/////////////////////////////////
|
|
||||||
|
|
||||||
bindingProvider: {
|
|
||||||
instance: KnockoutBindingProvider;
|
|
||||||
new (): KnockoutBindingProvider;
|
|
||||||
}
|
|
||||||
|
|
||||||
/////////////////////////////////
|
|
||||||
// selectExtensions.js
|
|
||||||
/////////////////////////////////
|
|
||||||
|
|
||||||
selectExtensions: {
|
|
||||||
|
|
||||||
readValue(element: HTMLElement): any;
|
|
||||||
|
|
||||||
writeValue(element: HTMLElement, value: any): void;
|
|
||||||
};
|
|
||||||
|
|
||||||
components: KnockoutComponents;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface KnockoutBindingProvider {
|
|
||||||
nodeHasBindings(node: Node): boolean;
|
|
||||||
getBindings(node: Node, bindingContext: KnockoutBindingContext): {};
|
|
||||||
getBindingAccessors?(node: Node, bindingContext: KnockoutBindingContext): { [key: string]: string; };
|
|
||||||
}
|
|
||||||
|
|
||||||
interface KnockoutComputedContext {
|
|
||||||
getDependenciesCount(): number;
|
|
||||||
isInitial: () => boolean;
|
|
||||||
isSleeping: boolean;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// refactored types into a namespace to reduce global pollution
|
|
||||||
// and used Union Types to simplify overloads (requires TypeScript 1.4)
|
|
||||||
//
|
|
||||||
declare module KnockoutComponentTypes {
|
|
||||||
|
|
||||||
interface Config {
|
|
||||||
viewModel?: ViewModelFunction | ViewModelSharedInstance | ViewModelFactoryFunction | AMDModule;
|
|
||||||
template: string | Node[]| DocumentFragment | TemplateElement | AMDModule;
|
|
||||||
synchronous?: boolean;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface ComponentConfig {
|
|
||||||
viewModel?: ViewModelFunction | ViewModelSharedInstance | ViewModelFactoryFunction | AMDModule;
|
|
||||||
template: any;
|
|
||||||
createViewModel?: any;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface EmptyConfig {
|
|
||||||
}
|
|
||||||
|
|
||||||
// common AMD type
|
|
||||||
interface AMDModule {
|
|
||||||
require: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
// viewmodel types
|
|
||||||
interface ViewModelFunction {
|
|
||||||
(params?: any): any;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface ViewModelSharedInstance {
|
|
||||||
instance: any;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface ViewModelFactoryFunction {
|
|
||||||
createViewModel: (params?: any, componentInfo?: ComponentInfo) => any;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface ComponentInfo {
|
|
||||||
element: Node;
|
|
||||||
templateNodes: Node[];
|
|
||||||
}
|
|
||||||
|
|
||||||
interface TemplateElement {
|
|
||||||
element: string | Node;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface Loader {
|
|
||||||
getConfig? (componentName: string, callback: (result: ComponentConfig) => void): void;
|
|
||||||
loadComponent? (componentName: string, config: ComponentConfig, callback: (result: Definition) => void): void;
|
|
||||||
loadTemplate? (componentName: string, templateConfig: any, callback: (result: Node[]) => void): void;
|
|
||||||
loadViewModel? (componentName: string, viewModelConfig: any, callback: (result: any) => void): void;
|
|
||||||
suppressLoaderExceptions?: boolean;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface Definition {
|
|
||||||
template: Node[];
|
|
||||||
createViewModel? (params: any, options: { element: Node; }): any;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
interface KnockoutComponents {
|
|
||||||
// overloads for register method:
|
|
||||||
register(componentName: string, config: KnockoutComponentTypes.Config | KnockoutComponentTypes.EmptyConfig): void;
|
|
||||||
|
|
||||||
isRegistered(componentName: string): boolean;
|
|
||||||
unregister(componentName: string): void;
|
|
||||||
get(componentName: string, callback: (definition: KnockoutComponentTypes.Definition) => void): void;
|
|
||||||
clearCachedDefinition(componentName: string): void
|
|
||||||
defaultLoader: KnockoutComponentTypes.Loader;
|
|
||||||
loaders: KnockoutComponentTypes.Loader[];
|
|
||||||
getComponentNameForNode(node: Node): string;
|
|
||||||
}
|
|
||||||
|
|
||||||
declare var ko: KnockoutStatic;
|
|
||||||
|
|
||||||
declare module "knockout" {
|
|
||||||
export = ko;
|
|
||||||
}
|
|
||||||
@@ -1,233 +0,0 @@
|
|||||||
// Type definitions for history v2.0.0
|
|
||||||
// Project: https://github.com/rackt/history
|
|
||||||
// Definitions by: Sergey Buturlakin <https://github.com/sergey-buturlakin>, Nathan Brown <https://github.com/ngbrown>
|
|
||||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
|
||||||
|
|
||||||
|
|
||||||
declare namespace HistoryModule {
|
|
||||||
|
|
||||||
// types based on https://github.com/rackt/history/blob/master/docs/Terms.md
|
|
||||||
|
|
||||||
type Action = string
|
|
||||||
|
|
||||||
type BeforeUnloadHook = () => string | boolean
|
|
||||||
|
|
||||||
type CreateHistory<T> = (options?: HistoryOptions) => T
|
|
||||||
|
|
||||||
type CreateHistoryEnhancer<T, E> = (createHistory: CreateHistory<T>) => CreateHistory<T & E>
|
|
||||||
|
|
||||||
interface History {
|
|
||||||
listenBefore(hook: TransitionHook): () => void
|
|
||||||
listen(listener: LocationListener): () => void
|
|
||||||
transitionTo(location: Location): void
|
|
||||||
push(path: LocationDescriptor): void
|
|
||||||
replace(path: LocationDescriptor): void
|
|
||||||
go(n: number): void
|
|
||||||
goBack(): void
|
|
||||||
goForward(): void
|
|
||||||
createKey(): LocationKey
|
|
||||||
createPath(path: LocationDescriptor): Path
|
|
||||||
createHref(path: LocationDescriptor): Href
|
|
||||||
createLocation(path?: LocationDescriptor, action?: Action, key?: LocationKey): Location
|
|
||||||
|
|
||||||
/** @deprecated use a location descriptor instead */
|
|
||||||
createLocation(path?: Path, state?: LocationState, action?: Action, key?: LocationKey): Location
|
|
||||||
/** @deprecated use location.key to save state instead */
|
|
||||||
pushState(state: LocationState, path: Path): void
|
|
||||||
/** @deprecated use location.key to save state instead */
|
|
||||||
replaceState(state: LocationState, path: Path): void
|
|
||||||
/** @deprecated use location.key to save state instead */
|
|
||||||
setState(state: LocationState): void
|
|
||||||
/** @deprecated use listenBefore instead */
|
|
||||||
registerTransitionHook(hook: TransitionHook): void
|
|
||||||
/** @deprecated use the callback returned from listenBefore instead */
|
|
||||||
unregisterTransitionHook(hook: TransitionHook): void
|
|
||||||
}
|
|
||||||
|
|
||||||
type HistoryOptions = {
|
|
||||||
getCurrentLocation?: () => Location
|
|
||||||
finishTransition?: (nextLocation: Location) => boolean
|
|
||||||
saveState?: (key: LocationKey, state: LocationState) => void
|
|
||||||
go?: (n: number) => void
|
|
||||||
getUserConfirmation?: (message: string, callback: (result: boolean) => void) => void
|
|
||||||
keyLength?: number
|
|
||||||
queryKey?: string | boolean
|
|
||||||
stringifyQuery?: (obj: any) => string
|
|
||||||
parseQueryString?: (str: string) => any
|
|
||||||
basename?: string
|
|
||||||
entries?: string | [any]
|
|
||||||
current?: number
|
|
||||||
}
|
|
||||||
|
|
||||||
type Href = string
|
|
||||||
|
|
||||||
type Location = {
|
|
||||||
pathname: Pathname
|
|
||||||
search: Search
|
|
||||||
query: Query
|
|
||||||
state: LocationState
|
|
||||||
action: Action
|
|
||||||
key: LocationKey
|
|
||||||
basename?: string
|
|
||||||
}
|
|
||||||
|
|
||||||
type LocationDescriptorObject = {
|
|
||||||
pathname?: Pathname
|
|
||||||
search?: Search
|
|
||||||
query?: Query
|
|
||||||
state?: LocationState
|
|
||||||
}
|
|
||||||
|
|
||||||
type LocationDescriptor = LocationDescriptorObject | Path
|
|
||||||
|
|
||||||
type LocationKey = string
|
|
||||||
|
|
||||||
type LocationListener = (location: Location) => void
|
|
||||||
|
|
||||||
type LocationState = Object
|
|
||||||
|
|
||||||
type Path = string // Pathname + QueryString
|
|
||||||
|
|
||||||
type Pathname = string
|
|
||||||
|
|
||||||
type Query = Object
|
|
||||||
|
|
||||||
type QueryString = string
|
|
||||||
|
|
||||||
type Search = string
|
|
||||||
|
|
||||||
type TransitionHook = (location: Location, callback: (result: any) => void) => any
|
|
||||||
|
|
||||||
|
|
||||||
interface HistoryBeforeUnload {
|
|
||||||
listenBeforeUnload(hook: BeforeUnloadHook): () => void
|
|
||||||
}
|
|
||||||
|
|
||||||
interface HistoryQueries {
|
|
||||||
pushState(state: LocationState, pathname: Pathname | Path, query?: Query): void
|
|
||||||
replaceState(state: LocationState, pathname: Pathname | Path, query?: Query): void
|
|
||||||
createPath(path: Path, query?: Query): Path
|
|
||||||
createHref(path: Path, query?: Query): Href
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// Global usage, without modules, needs the small trick, because lib.d.ts
|
|
||||||
// already has `history` and `History` global definitions:
|
|
||||||
// var createHistory = ((window as any).History as HistoryModule.Module).createHistory;
|
|
||||||
interface Module {
|
|
||||||
createHistory: CreateHistory<History>
|
|
||||||
createHashHistory: CreateHistory<History>
|
|
||||||
createMemoryHistory: CreateHistory<History>
|
|
||||||
createLocation(path?: Path, state?: LocationState, action?: Action, key?: LocationKey): Location
|
|
||||||
useBasename<T>(createHistory: CreateHistory<T>): CreateHistory<T>
|
|
||||||
useBeforeUnload<T>(createHistory: CreateHistory<T>): CreateHistory<T & HistoryBeforeUnload>
|
|
||||||
useQueries<T>(createHistory: CreateHistory<T>): CreateHistory<T & HistoryQueries>
|
|
||||||
actions: {
|
|
||||||
PUSH: string
|
|
||||||
REPLACE: string
|
|
||||||
POP: string
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
declare module "history/lib/createBrowserHistory" {
|
|
||||||
|
|
||||||
export default function createBrowserHistory(options?: HistoryModule.HistoryOptions): HistoryModule.History
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
declare module "history/lib/createHashHistory" {
|
|
||||||
|
|
||||||
export default function createHashHistory(options?: HistoryModule.HistoryOptions): HistoryModule.History
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
declare module "history/lib/createMemoryHistory" {
|
|
||||||
|
|
||||||
export default function createMemoryHistory(options?: HistoryModule.HistoryOptions): HistoryModule.History
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
declare module "history/lib/createLocation" {
|
|
||||||
|
|
||||||
export default function createLocation(path?: HistoryModule.Path, state?: HistoryModule.LocationState, action?: HistoryModule.Action, key?: HistoryModule.LocationKey): HistoryModule.Location
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
declare module "history/lib/useBasename" {
|
|
||||||
|
|
||||||
export default function useBasename<T>(createHistory: HistoryModule.CreateHistory<T>): HistoryModule.CreateHistory<T>
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
declare module "history/lib/useBeforeUnload" {
|
|
||||||
|
|
||||||
export default function useBeforeUnload<T>(createHistory: HistoryModule.CreateHistory<T>): HistoryModule.CreateHistory<T & HistoryModule.HistoryBeforeUnload>
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
declare module "history/lib/useQueries" {
|
|
||||||
|
|
||||||
export default function useQueries<T>(createHistory: HistoryModule.CreateHistory<T>): HistoryModule.CreateHistory<T & HistoryModule.HistoryQueries>
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
declare module "history/lib/actions" {
|
|
||||||
|
|
||||||
export const PUSH: string
|
|
||||||
|
|
||||||
export const REPLACE: string
|
|
||||||
|
|
||||||
export const POP: string
|
|
||||||
|
|
||||||
export default {
|
|
||||||
PUSH,
|
|
||||||
REPLACE,
|
|
||||||
POP
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
declare module "history/lib/DOMUtils" {
|
|
||||||
export function addEventListener(node: EventTarget, event: string, listener: EventListenerOrEventListenerObject): void;
|
|
||||||
export function removeEventListener(node: EventTarget, event: string, listener: EventListenerOrEventListenerObject): void;
|
|
||||||
export function getHashPath(): string;
|
|
||||||
export function replaceHashPath(path: string): void;
|
|
||||||
export function getWindowPath(): string;
|
|
||||||
export function go(n: number): void;
|
|
||||||
export function getUserConfirmation(message: string, callback: (result: boolean) => void): void;
|
|
||||||
export function supportsHistory(): boolean;
|
|
||||||
export function supportsGoWithoutReloadUsingHash(): boolean;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
declare module "history" {
|
|
||||||
|
|
||||||
export { default as createHistory } from "history/lib/createBrowserHistory"
|
|
||||||
|
|
||||||
export { default as createHashHistory } from "history/lib/createHashHistory"
|
|
||||||
|
|
||||||
export { default as createMemoryHistory } from "history/lib/createMemoryHistory"
|
|
||||||
|
|
||||||
export { default as createLocation } from "history/lib/createLocation"
|
|
||||||
|
|
||||||
export { default as useBasename } from "history/lib/useBasename"
|
|
||||||
|
|
||||||
export { default as useBeforeUnload } from "history/lib/useBeforeUnload"
|
|
||||||
|
|
||||||
export { default as useQueries } from "history/lib/useQueries"
|
|
||||||
|
|
||||||
import * as Actions from "history/lib/actions"
|
|
||||||
|
|
||||||
export { Actions }
|
|
||||||
|
|
||||||
}
|
|
||||||
397
templates/KnockoutSpa/typings/requirejs/require.d.ts
vendored
397
templates/KnockoutSpa/typings/requirejs/require.d.ts
vendored
@@ -1,397 +0,0 @@
|
|||||||
// Type definitions for RequireJS 2.1.20
|
|
||||||
// Project: http://requirejs.org/
|
|
||||||
// Definitions by: Josh Baldwin <https://github.com/jbaldwin/>
|
|
||||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
|
||||||
|
|
||||||
/*
|
|
||||||
require-2.1.8.d.ts may be freely distributed under the MIT license.
|
|
||||||
|
|
||||||
Copyright (c) 2013 Josh Baldwin https://github.com/jbaldwin/require.d.ts
|
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person
|
|
||||||
obtaining a copy of this software and associated documentation
|
|
||||||
files (the "Software"), to deal in the Software without
|
|
||||||
restriction, including without limitation the rights to use,
|
|
||||||
copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
copies of the Software, and to permit persons to whom the
|
|
||||||
Software is furnished to do so, subject to the following conditions:
|
|
||||||
|
|
||||||
The above copyright notice and this permission notice shall be
|
|
||||||
included in all copies or substantial portions of the Software.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
||||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
|
||||||
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
||||||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
|
||||||
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
|
||||||
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
||||||
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
|
||||||
OTHER DEALINGS IN THE SOFTWARE.
|
|
||||||
*/
|
|
||||||
|
|
||||||
declare module 'module' {
|
|
||||||
var mod: {
|
|
||||||
config: () => any;
|
|
||||||
id: string;
|
|
||||||
uri: string;
|
|
||||||
}
|
|
||||||
export = mod;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface RequireError extends Error {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The error ID that maps to an ID on a web page.
|
|
||||||
**/
|
|
||||||
requireType: string;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Required modules.
|
|
||||||
**/
|
|
||||||
requireModules: string[];
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The original error, if there is one (might be null).
|
|
||||||
**/
|
|
||||||
originalError: Error;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface RequireShim {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* List of dependencies.
|
|
||||||
**/
|
|
||||||
deps?: string[];
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Name the module will be exported as.
|
|
||||||
**/
|
|
||||||
exports?: string;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Initialize function with all dependcies passed in,
|
|
||||||
* if the function returns a value then that value is used
|
|
||||||
* as the module export value instead of the object
|
|
||||||
* found via the 'exports' string.
|
|
||||||
* @param dependencies
|
|
||||||
* @return
|
|
||||||
**/
|
|
||||||
init?: (...dependencies: any[]) => any;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface RequireConfig {
|
|
||||||
|
|
||||||
// The root path to use for all module lookups.
|
|
||||||
baseUrl?: string;
|
|
||||||
|
|
||||||
// Path mappings for module names not found directly under
|
|
||||||
// baseUrl.
|
|
||||||
paths?: { [key: string]: any; };
|
|
||||||
|
|
||||||
|
|
||||||
// Dictionary of Shim's.
|
|
||||||
// does not cover case of key->string[]
|
|
||||||
shim?: { [key: string]: RequireShim; };
|
|
||||||
|
|
||||||
/**
|
|
||||||
* For the given module prefix, instead of loading the
|
|
||||||
* module with the given ID, substitude a different
|
|
||||||
* module ID.
|
|
||||||
*
|
|
||||||
* @example
|
|
||||||
* requirejs.config({
|
|
||||||
* map: {
|
|
||||||
* 'some/newmodule': {
|
|
||||||
* 'foo': 'foo1.2'
|
|
||||||
* },
|
|
||||||
* 'some/oldmodule': {
|
|
||||||
* 'foo': 'foo1.0'
|
|
||||||
* }
|
|
||||||
* }
|
|
||||||
* });
|
|
||||||
**/
|
|
||||||
map?: {
|
|
||||||
[id: string]: {
|
|
||||||
[id: string]: string;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Allows pointing multiple module IDs to a module ID that contains a bundle of modules.
|
|
||||||
*
|
|
||||||
* @example
|
|
||||||
* requirejs.config({
|
|
||||||
* bundles: {
|
|
||||||
* 'primary': ['main', 'util', 'text', 'text!template.html'],
|
|
||||||
* 'secondary': ['text!secondary.html']
|
|
||||||
* }
|
|
||||||
* });
|
|
||||||
**/
|
|
||||||
bundles?: { [key: string]: string[]; };
|
|
||||||
|
|
||||||
/**
|
|
||||||
* AMD configurations, use module.config() to access in
|
|
||||||
* define() functions
|
|
||||||
**/
|
|
||||||
config?: { [id: string]: {}; };
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Configures loading modules from CommonJS packages.
|
|
||||||
**/
|
|
||||||
packages?: {};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The number of seconds to wait before giving up on loading
|
|
||||||
* a script. The default is 7 seconds.
|
|
||||||
**/
|
|
||||||
waitSeconds?: number;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* A name to give to a loading context. This allows require.js
|
|
||||||
* to load multiple versions of modules in a page, as long as
|
|
||||||
* each top-level require call specifies a unique context string.
|
|
||||||
**/
|
|
||||||
context?: string;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* An array of dependencies to load.
|
|
||||||
**/
|
|
||||||
deps?: string[];
|
|
||||||
|
|
||||||
/**
|
|
||||||
* A function to pass to require that should be require after
|
|
||||||
* deps have been loaded.
|
|
||||||
* @param modules
|
|
||||||
**/
|
|
||||||
callback?: (...modules: any[]) => void;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* If set to true, an error will be thrown if a script loads
|
|
||||||
* that does not call define() or have shim exports string
|
|
||||||
* value that can be checked.
|
|
||||||
**/
|
|
||||||
enforceDefine?: boolean;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* If set to true, document.createElementNS() will be used
|
|
||||||
* to create script elements.
|
|
||||||
**/
|
|
||||||
xhtml?: boolean;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Extra query string arguments appended to URLs that RequireJS
|
|
||||||
* uses to fetch resources. Most useful to cache bust when
|
|
||||||
* the browser or server is not configured correctly.
|
|
||||||
*
|
|
||||||
* @example
|
|
||||||
* urlArgs: "bust= + (new Date()).getTime()
|
|
||||||
**/
|
|
||||||
urlArgs?: string;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Specify the value for the type="" attribute used for script
|
|
||||||
* tags inserted into the document by RequireJS. Default is
|
|
||||||
* "text/javascript". To use Firefox's JavasScript 1.8
|
|
||||||
* features, use "text/javascript;version=1.8".
|
|
||||||
**/
|
|
||||||
scriptType?: string;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* If set to true, skips the data-main attribute scanning done
|
|
||||||
* to start module loading. Useful if RequireJS is embedded in
|
|
||||||
* a utility library that may interact with other RequireJS
|
|
||||||
* library on the page, and the embedded version should not do
|
|
||||||
* data-main loading.
|
|
||||||
**/
|
|
||||||
skipDataMain?: boolean;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Allow extending requirejs to support Subresource Integrity
|
|
||||||
* (SRI).
|
|
||||||
**/
|
|
||||||
onNodeCreated?: (node: HTMLScriptElement, config: RequireConfig, moduleName: string, url: string) => void;
|
|
||||||
}
|
|
||||||
|
|
||||||
// todo: not sure what to do with this guy
|
|
||||||
interface RequireModule {
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
**/
|
|
||||||
config(): {};
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
**/
|
|
||||||
interface RequireMap {
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
**/
|
|
||||||
prefix: string;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
**/
|
|
||||||
name: string;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
**/
|
|
||||||
parentMap: RequireMap;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
**/
|
|
||||||
url: string;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
**/
|
|
||||||
originalName: string;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
**/
|
|
||||||
fullName: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface Require {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Configure require.js
|
|
||||||
**/
|
|
||||||
config(config: RequireConfig): Require;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* CommonJS require call
|
|
||||||
* @param module Module to load
|
|
||||||
* @return The loaded module
|
|
||||||
*/
|
|
||||||
(module: string): any;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Start the main app logic.
|
|
||||||
* Callback is optional.
|
|
||||||
* Can alternatively use deps and callback.
|
|
||||||
* @param modules Required modules to load.
|
|
||||||
**/
|
|
||||||
(modules: string[]): void;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @see Require()
|
|
||||||
* @param ready Called when required modules are ready.
|
|
||||||
**/
|
|
||||||
(modules: string[], ready: Function): void;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @see http://requirejs.org/docs/api.html#errbacks
|
|
||||||
* @param ready Called when required modules are ready.
|
|
||||||
**/
|
|
||||||
(modules: string[], ready: Function, errback: Function): void;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Generate URLs from require module
|
|
||||||
* @param module Module to URL
|
|
||||||
* @return URL string
|
|
||||||
**/
|
|
||||||
toUrl(module: string): string;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns true if the module has already been loaded and defined.
|
|
||||||
* @param module Module to check
|
|
||||||
**/
|
|
||||||
defined(module: string): boolean;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns true if the module has already been requested or is in the process of loading and should be available at some point.
|
|
||||||
* @param module Module to check
|
|
||||||
**/
|
|
||||||
specified(module: string): boolean;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* On Error override
|
|
||||||
* @param err
|
|
||||||
**/
|
|
||||||
onError(err: RequireError, errback?: (err: RequireError) => void): void;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Undefine a module
|
|
||||||
* @param module Module to undefine.
|
|
||||||
**/
|
|
||||||
undef(module: string): void;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Semi-private function, overload in special instance of undef()
|
|
||||||
**/
|
|
||||||
onResourceLoad(context: Object, map: RequireMap, depArray: RequireMap[]): void;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface RequireDefine {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Define Simple Name/Value Pairs
|
|
||||||
* @param config Dictionary of Named/Value pairs for the config.
|
|
||||||
**/
|
|
||||||
(config: { [key: string]: any; }): void;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Define function.
|
|
||||||
* @param func: The function module.
|
|
||||||
**/
|
|
||||||
(func: () => any): void;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Define function with dependencies.
|
|
||||||
* @param deps List of dependencies module IDs.
|
|
||||||
* @param ready Callback function when the dependencies are loaded.
|
|
||||||
* callback param deps module dependencies
|
|
||||||
* callback return module definition
|
|
||||||
**/
|
|
||||||
(deps: string[], ready: Function): void;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Define module with simplified CommonJS wrapper.
|
|
||||||
* @param ready
|
|
||||||
* callback require requirejs instance
|
|
||||||
* callback exports exports object
|
|
||||||
* callback module module
|
|
||||||
* callback return module definition
|
|
||||||
**/
|
|
||||||
(ready: (require: Require, exports: { [key: string]: any; }, module: RequireModule) => any): void;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Define a module with a name and dependencies.
|
|
||||||
* @param name The name of the module.
|
|
||||||
* @param deps List of dependencies module IDs.
|
|
||||||
* @param ready Callback function when the dependencies are loaded.
|
|
||||||
* callback deps module dependencies
|
|
||||||
* callback return module definition
|
|
||||||
**/
|
|
||||||
(name: string, deps: string[], ready: Function): void;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Define a module with a name.
|
|
||||||
* @param name The name of the module.
|
|
||||||
* @param ready Callback function when the dependencies are loaded.
|
|
||||||
* 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.
|
|
||||||
* This helps avoid conflict with any other existing JavaScript code that could have defined a define() function
|
|
||||||
* that does not conform to the AMD API.
|
|
||||||
* define.amd.jQuery is specific to jQuery and indicates that the loader is able to account for multiple version
|
|
||||||
* of jQuery being loaded simultaneously.
|
|
||||||
*/
|
|
||||||
amd: Object;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Ambient declarations for 'require' and 'define'
|
|
||||||
declare var requirejs: Require;
|
|
||||||
declare var require: Require;
|
|
||||||
declare var define: RequireDefine;
|
|
||||||
9
templates/KnockoutSpa/typings/tsd.d.ts
vendored
9
templates/KnockoutSpa/typings/tsd.d.ts
vendored
@@ -1,9 +0,0 @@
|
|||||||
/// <reference path="es6-promise/es6-promise.d.ts" />
|
|
||||||
/// <reference path="knockout/knockout.d.ts" />
|
|
||||||
/// <reference path="requirejs/require.d.ts" />
|
|
||||||
/// <reference path="history/history.d.ts" />
|
|
||||||
/// <reference path="react-router/history.d.ts" />
|
|
||||||
/// <reference path="crossroads/crossroads.d.ts" />
|
|
||||||
/// <reference path="js-signals/js-signals.d.ts" />
|
|
||||||
/// <reference path="isomorphic-fetch/isomorphic-fetch.d.ts" />
|
|
||||||
/// <reference path="jquery/jquery.d.ts" />
|
|
||||||
@@ -1,14 +1,14 @@
|
|||||||
import { createStore, applyMiddleware, compose, combineReducers } from 'redux';
|
import { createStore, applyMiddleware, compose, combineReducers, GenericStoreEnhancer } from 'redux';
|
||||||
import * as thunkModule from 'redux-thunk';
|
import thunk from 'redux-thunk';
|
||||||
import { routerReducer } from 'react-router-redux';
|
import { routerReducer } from 'react-router-redux';
|
||||||
import * as Store from './store';
|
import * as Store from './store';
|
||||||
import { typedToPlain } from 'redux-typed';
|
import { typedToPlain } from 'redux-typed';
|
||||||
|
|
||||||
export default function configureStore(initialState?: Store.ApplicationState) {
|
export default function configureStore(initialState?: Store.ApplicationState) {
|
||||||
// Build middleware. These are functions that can process the actions before they reach the store.
|
// Build middleware. These are functions that can process the actions before they reach the store.
|
||||||
const thunk = (thunkModule as any).default; // Workaround for TypeScript not importing thunk module as expected
|
|
||||||
const windowIfDefined = typeof window === 'undefined' ? null : window as any;
|
const windowIfDefined = typeof window === 'undefined' ? null : window as any;
|
||||||
const devToolsExtension = windowIfDefined && windowIfDefined.devToolsExtension; // If devTools is installed, connect to it
|
// If devTools is installed, connect to it
|
||||||
|
const devToolsExtension = windowIfDefined && windowIfDefined.devToolsExtension as () => GenericStoreEnhancer;
|
||||||
const createStoreWithMiddleware = compose(
|
const createStoreWithMiddleware = compose(
|
||||||
applyMiddleware(thunk, typedToPlain),
|
applyMiddleware(thunk, typedToPlain),
|
||||||
devToolsExtension ? devToolsExtension() : f => f
|
devToolsExtension ? devToolsExtension() : f => f
|
||||||
@@ -16,7 +16,7 @@ export default function configureStore(initialState?: Store.ApplicationState) {
|
|||||||
|
|
||||||
// Combine all reducers and instantiate the app-wide store instance
|
// Combine all reducers and instantiate the app-wide store instance
|
||||||
const allReducers = buildRootReducer(Store.reducers);
|
const allReducers = buildRootReducer(Store.reducers);
|
||||||
const store = createStoreWithMiddleware(allReducers, initialState) as Redux.Store;
|
const store = createStoreWithMiddleware(allReducers, initialState) as Redux.Store<Store.ApplicationState>;
|
||||||
|
|
||||||
// Enable Webpack hot module replacement for reducers
|
// Enable Webpack hot module replacement for reducers
|
||||||
if (module.hot) {
|
if (module.hot) {
|
||||||
@@ -30,5 +30,5 @@ export default function configureStore(initialState?: Store.ApplicationState) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function buildRootReducer(allReducers) {
|
function buildRootReducer(allReducers) {
|
||||||
return combineReducers(Object.assign({}, allReducers, { routing: routerReducer })) as Redux.Reducer;
|
return combineReducers<Store.ApplicationState>(Object.assign({}, allReducers, { routing: routerReducer }));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,8 +13,7 @@ export default <Route component={ Layout }>
|
|||||||
</Route>
|
</Route>
|
||||||
</Route>;
|
</Route>;
|
||||||
|
|
||||||
// Allow Hot Module Reloading
|
// Enable Hot Module Replacement (HMR)
|
||||||
declare var module: any;
|
|
||||||
if (module.hot) {
|
if (module.hot) {
|
||||||
module.hot.accept();
|
module.hot.accept();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,8 +2,20 @@
|
|||||||
"name": "WebApplicationBasic",
|
"name": "WebApplicationBasic",
|
||||||
"version": "0.0.0",
|
"version": "0.0.0",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"aspnet-prerendering": "^1.0.2",
|
"@types/react": "^0.14.29",
|
||||||
"aspnet-webpack": "^1.0.6",
|
"@types/react-dom": "^0.14.14",
|
||||||
|
"@types/react-redux": "^4.4.29",
|
||||||
|
"@types/react-router": "^2.0.30",
|
||||||
|
"@types/react-router-redux": "^4.0.30",
|
||||||
|
"@types/redux": "3.5.27",
|
||||||
|
"@types/redux-thunk": "^2.1.28",
|
||||||
|
"@types/source-map": "^0.1.28",
|
||||||
|
"@types/uglify-js": "^2.0.27",
|
||||||
|
"@types/webpack": "^1.12.35",
|
||||||
|
"@types/webpack-env": "^1.12.1",
|
||||||
|
"@types/whatwg-fetch": "0.0.28",
|
||||||
|
"aspnet-prerendering": "^1.0.7",
|
||||||
|
"aspnet-webpack": "^1.0.17",
|
||||||
"aspnet-webpack-react": "^1.0.2",
|
"aspnet-webpack-react": "^1.0.2",
|
||||||
"babel-core": "^6.5.2",
|
"babel-core": "^6.5.2",
|
||||||
"babel-loader": "^6.2.3",
|
"babel-loader": "^6.2.3",
|
||||||
@@ -11,26 +23,26 @@
|
|||||||
"babel-preset-react": "^6.5.0",
|
"babel-preset-react": "^6.5.0",
|
||||||
"bootstrap": "^3.3.6",
|
"bootstrap": "^3.3.6",
|
||||||
"css-loader": "^0.23.1",
|
"css-loader": "^0.23.1",
|
||||||
"domain-task": "^2.0.0",
|
"domain-task": "^2.0.1",
|
||||||
"event-source-polyfill": "^0.0.7",
|
"event-source-polyfill": "^0.0.7",
|
||||||
"extract-text-webpack-plugin": "^1.0.1",
|
"extract-text-webpack-plugin": "^1.0.1",
|
||||||
"file-loader": "^0.8.5",
|
"file-loader": "^0.8.5",
|
||||||
"jquery": "^2.2.1",
|
"jquery": "^2.2.1",
|
||||||
"react": "^15.0.1",
|
"react": "^15.3.2",
|
||||||
"react-dom": "^15.0.1",
|
"react-dom": "^15.3.2",
|
||||||
"react-redux": "^4.4.4",
|
"react-redux": "^4.4.5",
|
||||||
"react-router": "^2.1.1",
|
"react-router": "^2.8.1",
|
||||||
"react-router-redux": "^4.0.2",
|
"react-router-redux": "^4.0.6",
|
||||||
"redux": "^3.4.0",
|
"redux": "^3.6.0",
|
||||||
"redux-thunk": "^2.0.1",
|
"redux-thunk": "^2.1.0",
|
||||||
"redux-typed": "^1.0.0",
|
"redux-typed": "^1.0.1",
|
||||||
"style-loader": "^0.13.0",
|
"style-loader": "^0.13.0",
|
||||||
"ts-loader": "^0.8.1",
|
"ts-loader": "^0.8.1",
|
||||||
"typescript": "^1.8.2",
|
"typescript": "2.0.3",
|
||||||
"url-loader": "^0.5.7",
|
"url-loader": "^0.5.7",
|
||||||
"webpack": "^1.12.14",
|
"webpack": "^1.13.2",
|
||||||
"webpack-node-externals": "^1.4.3",
|
"webpack-node-externals": "^1.4.3",
|
||||||
"webpack-hot-middleware": "^2.10.0",
|
"webpack-hot-middleware": "^2.12.2",
|
||||||
"webpack-merge": "^0.14.1"
|
"webpack-merge": "^0.14.1"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,7 +5,9 @@
|
|||||||
"jsx": "preserve",
|
"jsx": "preserve",
|
||||||
"experimentalDecorators": true,
|
"experimentalDecorators": true,
|
||||||
"sourceMap": true,
|
"sourceMap": true,
|
||||||
"skipDefaultLibCheck": true
|
"skipDefaultLibCheck": true,
|
||||||
|
"lib": ["es6", "dom"],
|
||||||
|
"types": [ "webpack-env", "whatwg-fetch" ]
|
||||||
},
|
},
|
||||||
"exclude": [
|
"exclude": [
|
||||||
"bin",
|
"bin",
|
||||||
|
|||||||
@@ -1,45 +0,0 @@
|
|||||||
{
|
|
||||||
"version": "v4",
|
|
||||||
"repo": "borisyankov/DefinitelyTyped",
|
|
||||||
"ref": "master",
|
|
||||||
"path": "typings",
|
|
||||||
"bundle": "typings/tsd.d.ts",
|
|
||||||
"installed": {
|
|
||||||
"react/react.d.ts": {
|
|
||||||
"commit": "9f0f926a12026287b5a4a229e5672c01e7549313"
|
|
||||||
},
|
|
||||||
"react-router/react-router.d.ts": {
|
|
||||||
"commit": "9f0f926a12026287b5a4a229e5672c01e7549313"
|
|
||||||
},
|
|
||||||
"react/react-dom.d.ts": {
|
|
||||||
"commit": "dade4414712ce84e3c63393f1aae407e9e7e6af7"
|
|
||||||
},
|
|
||||||
"react-router/history.d.ts": {
|
|
||||||
"commit": "9f0f926a12026287b5a4a229e5672c01e7549313"
|
|
||||||
},
|
|
||||||
"whatwg-fetch/whatwg-fetch.d.ts": {
|
|
||||||
"commit": "dade4414712ce84e3c63393f1aae407e9e7e6af7"
|
|
||||||
},
|
|
||||||
"react-redux/react-redux.d.ts": {
|
|
||||||
"commit": "9f0f926a12026287b5a4a229e5672c01e7549313"
|
|
||||||
},
|
|
||||||
"redux/redux.d.ts": {
|
|
||||||
"commit": "9f0f926a12026287b5a4a229e5672c01e7549313"
|
|
||||||
},
|
|
||||||
"react-router-redux/react-router-redux.d.ts": {
|
|
||||||
"commit": "9f0f926a12026287b5a4a229e5672c01e7549313"
|
|
||||||
},
|
|
||||||
"redux-thunk/redux-thunk.d.ts": {
|
|
||||||
"commit": "9f0f926a12026287b5a4a229e5672c01e7549313"
|
|
||||||
},
|
|
||||||
"uglify-js/uglify-js.d.ts": {
|
|
||||||
"commit": "9f0f926a12026287b5a4a229e5672c01e7549313"
|
|
||||||
},
|
|
||||||
"source-map/source-map.d.ts": {
|
|
||||||
"commit": "9f0f926a12026287b5a4a229e5672c01e7549313"
|
|
||||||
},
|
|
||||||
"webpack/webpack-env.d.ts": {
|
|
||||||
"commit": "9f0f926a12026287b5a4a229e5672c01e7549313"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,68 +0,0 @@
|
|||||||
// Type definitions for react-redux 4.4.0
|
|
||||||
// Project: https://github.com/rackt/react-redux
|
|
||||||
// Definitions by: Qubo <https://github.com/tkqubo>
|
|
||||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
|
||||||
|
|
||||||
/// <reference path="../react/react.d.ts" />
|
|
||||||
/// <reference path="../redux/redux.d.ts" />
|
|
||||||
|
|
||||||
declare module "react-redux" {
|
|
||||||
import { ComponentClass, Component, StatelessComponent } from 'react';
|
|
||||||
import { Store, Dispatch, ActionCreator } from 'redux';
|
|
||||||
|
|
||||||
export interface ComponentConstructDecorator<P> {
|
|
||||||
<TComponentConstruct extends (ComponentClass<P>|StatelessComponent<P>)>(component: TComponentConstruct): TComponentConstruct
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Connects a React component to a Redux store.
|
|
||||||
* @param mapStateToProps
|
|
||||||
* @param mapDispatchToProps
|
|
||||||
* @param mergeProps
|
|
||||||
* @param options
|
|
||||||
*/
|
|
||||||
export function connect<P>(mapStateToProps?: MapStateToProps,
|
|
||||||
mapDispatchToProps?: MapDispatchToPropsFunction|MapDispatchToPropsObject,
|
|
||||||
mergeProps?: MergeProps,
|
|
||||||
options?: Options): ComponentConstructDecorator<P>;
|
|
||||||
|
|
||||||
interface MapStateToProps {
|
|
||||||
(state: any, ownProps?: any): any;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface MapDispatchToPropsFunction {
|
|
||||||
(dispatch: Dispatch, ownProps?: any): any;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface MapDispatchToPropsObject {
|
|
||||||
[name: string]: ActionCreator;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface MergeProps {
|
|
||||||
(stateProps: any, dispatchProps: any, ownProps: any): any;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface Options {
|
|
||||||
/**
|
|
||||||
* If true, implements shouldComponentUpdate and shallowly compares the result of mergeProps,
|
|
||||||
* preventing unnecessary updates, assuming that the component is a “pure” component
|
|
||||||
* and does not rely on any input or state other than its props and the selected Redux store’s state.
|
|
||||||
* Defaults to true.
|
|
||||||
* @default true
|
|
||||||
*/
|
|
||||||
pure: boolean;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface Property {
|
|
||||||
/**
|
|
||||||
* The single Redux store in your application.
|
|
||||||
*/
|
|
||||||
store?: Store;
|
|
||||||
children?: Function;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Makes the Redux store available to the connect() calls in the component hierarchy below.
|
|
||||||
*/
|
|
||||||
export class Provider extends Component<Property, {}> { }
|
|
||||||
}
|
|
||||||
@@ -1,62 +0,0 @@
|
|||||||
// Type definitions for react-router-redux v4.0.0
|
|
||||||
// Project: https://github.com/rackt/react-router-redux
|
|
||||||
// Definitions by: Isman Usoh <http://github.com/isman-usoh>, Noah Shipley <https://github.com/noah79>, Dimitri Rosenberg <https://github.com/rosendi>
|
|
||||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
|
||||||
|
|
||||||
/// <reference path="../redux/redux.d.ts" />
|
|
||||||
/// <reference path="../react-router/react-router.d.ts"/>
|
|
||||||
|
|
||||||
declare namespace ReactRouterRedux {
|
|
||||||
import R = Redux;
|
|
||||||
import H = HistoryModule;
|
|
||||||
|
|
||||||
const CALL_HISTORY_METHOD: string;
|
|
||||||
const LOCATION_CHANGE: string;
|
|
||||||
|
|
||||||
const push: PushAction;
|
|
||||||
const replace: ReplaceAction;
|
|
||||||
const go: GoAction;
|
|
||||||
const goBack: GoForwardAction;
|
|
||||||
const goForward: GoBackAction;
|
|
||||||
const routerActions: RouteActions;
|
|
||||||
|
|
||||||
type LocationDescriptor = H.Location | H.Path;
|
|
||||||
type PushAction = (nextLocation: LocationDescriptor) => RouterAction;
|
|
||||||
type ReplaceAction = (nextLocation: LocationDescriptor) => RouterAction;
|
|
||||||
type GoAction = (n: number) => RouterAction;
|
|
||||||
type GoForwardAction = () => RouterAction;
|
|
||||||
type GoBackAction = () => RouterAction;
|
|
||||||
|
|
||||||
type RouterAction = {
|
|
||||||
type: string
|
|
||||||
payload?: any
|
|
||||||
}
|
|
||||||
|
|
||||||
interface RouteActions {
|
|
||||||
push: PushAction;
|
|
||||||
replace: ReplaceAction;
|
|
||||||
go: GoAction;
|
|
||||||
goForward: GoForwardAction;
|
|
||||||
goBack: GoBackAction;
|
|
||||||
}
|
|
||||||
interface ReactRouterReduxHistory extends H.History {
|
|
||||||
unsubscribe(): void;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface DefaultSelectLocationState extends Function {
|
|
||||||
(state: any): any;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface SyncHistoryWithStoreOptions {
|
|
||||||
selectLocationState?: DefaultSelectLocationState;
|
|
||||||
adjustUrlOnReplay?: boolean;
|
|
||||||
}
|
|
||||||
|
|
||||||
function routerReducer(state?: any, options?: any): R.Reducer;
|
|
||||||
function syncHistoryWithStore(history: H.History, store: R.Store, options?: SyncHistoryWithStoreOptions): ReactRouterReduxHistory;
|
|
||||||
function routerMiddleware(history: H.History): R.Middleware;
|
|
||||||
}
|
|
||||||
|
|
||||||
declare module "react-router-redux" {
|
|
||||||
export = ReactRouterRedux;
|
|
||||||
}
|
|
||||||
@@ -1,233 +0,0 @@
|
|||||||
// Type definitions for history v2.0.0
|
|
||||||
// Project: https://github.com/rackt/history
|
|
||||||
// Definitions by: Sergey Buturlakin <https://github.com/sergey-buturlakin>, Nathan Brown <https://github.com/ngbrown>
|
|
||||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
|
||||||
|
|
||||||
|
|
||||||
declare namespace HistoryModule {
|
|
||||||
|
|
||||||
// types based on https://github.com/rackt/history/blob/master/docs/Terms.md
|
|
||||||
|
|
||||||
type Action = string
|
|
||||||
|
|
||||||
type BeforeUnloadHook = () => string | boolean
|
|
||||||
|
|
||||||
type CreateHistory<T> = (options?: HistoryOptions) => T
|
|
||||||
|
|
||||||
type CreateHistoryEnhancer<T, E> = (createHistory: CreateHistory<T>) => CreateHistory<T & E>
|
|
||||||
|
|
||||||
interface History {
|
|
||||||
listenBefore(hook: TransitionHook): () => void
|
|
||||||
listen(listener: LocationListener): () => void
|
|
||||||
transitionTo(location: Location): void
|
|
||||||
push(path: LocationDescriptor): void
|
|
||||||
replace(path: LocationDescriptor): void
|
|
||||||
go(n: number): void
|
|
||||||
goBack(): void
|
|
||||||
goForward(): void
|
|
||||||
createKey(): LocationKey
|
|
||||||
createPath(path: LocationDescriptor): Path
|
|
||||||
createHref(path: LocationDescriptor): Href
|
|
||||||
createLocation(path?: LocationDescriptor, action?: Action, key?: LocationKey): Location
|
|
||||||
|
|
||||||
/** @deprecated use a location descriptor instead */
|
|
||||||
createLocation(path?: Path, state?: LocationState, action?: Action, key?: LocationKey): Location
|
|
||||||
/** @deprecated use location.key to save state instead */
|
|
||||||
pushState(state: LocationState, path: Path): void
|
|
||||||
/** @deprecated use location.key to save state instead */
|
|
||||||
replaceState(state: LocationState, path: Path): void
|
|
||||||
/** @deprecated use location.key to save state instead */
|
|
||||||
setState(state: LocationState): void
|
|
||||||
/** @deprecated use listenBefore instead */
|
|
||||||
registerTransitionHook(hook: TransitionHook): void
|
|
||||||
/** @deprecated use the callback returned from listenBefore instead */
|
|
||||||
unregisterTransitionHook(hook: TransitionHook): void
|
|
||||||
}
|
|
||||||
|
|
||||||
type HistoryOptions = {
|
|
||||||
getCurrentLocation?: () => Location
|
|
||||||
finishTransition?: (nextLocation: Location) => boolean
|
|
||||||
saveState?: (key: LocationKey, state: LocationState) => void
|
|
||||||
go?: (n: number) => void
|
|
||||||
getUserConfirmation?: (message: string, callback: (result: boolean) => void) => void
|
|
||||||
keyLength?: number
|
|
||||||
queryKey?: string | boolean
|
|
||||||
stringifyQuery?: (obj: any) => string
|
|
||||||
parseQueryString?: (str: string) => any
|
|
||||||
basename?: string
|
|
||||||
entries?: string | [any]
|
|
||||||
current?: number
|
|
||||||
}
|
|
||||||
|
|
||||||
type Href = string
|
|
||||||
|
|
||||||
type Location = {
|
|
||||||
pathname: Pathname
|
|
||||||
search: Search
|
|
||||||
query: Query
|
|
||||||
state: LocationState
|
|
||||||
action: Action
|
|
||||||
key: LocationKey
|
|
||||||
basename?: string
|
|
||||||
}
|
|
||||||
|
|
||||||
type LocationDescriptorObject = {
|
|
||||||
pathname?: Pathname
|
|
||||||
search?: Search
|
|
||||||
query?: Query
|
|
||||||
state?: LocationState
|
|
||||||
}
|
|
||||||
|
|
||||||
type LocationDescriptor = LocationDescriptorObject | Path
|
|
||||||
|
|
||||||
type LocationKey = string
|
|
||||||
|
|
||||||
type LocationListener = (location: Location) => void
|
|
||||||
|
|
||||||
type LocationState = Object
|
|
||||||
|
|
||||||
type Path = string // Pathname + QueryString
|
|
||||||
|
|
||||||
type Pathname = string
|
|
||||||
|
|
||||||
type Query = Object
|
|
||||||
|
|
||||||
type QueryString = string
|
|
||||||
|
|
||||||
type Search = string
|
|
||||||
|
|
||||||
type TransitionHook = (location: Location, callback: (result: any) => void) => any
|
|
||||||
|
|
||||||
|
|
||||||
interface HistoryBeforeUnload {
|
|
||||||
listenBeforeUnload(hook: BeforeUnloadHook): () => void
|
|
||||||
}
|
|
||||||
|
|
||||||
interface HistoryQueries {
|
|
||||||
pushState(state: LocationState, pathname: Pathname | Path, query?: Query): void
|
|
||||||
replaceState(state: LocationState, pathname: Pathname | Path, query?: Query): void
|
|
||||||
createPath(path: Path, query?: Query): Path
|
|
||||||
createHref(path: Path, query?: Query): Href
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// Global usage, without modules, needs the small trick, because lib.d.ts
|
|
||||||
// already has `history` and `History` global definitions:
|
|
||||||
// var createHistory = ((window as any).History as HistoryModule.Module).createHistory;
|
|
||||||
interface Module {
|
|
||||||
createHistory: CreateHistory<History>
|
|
||||||
createHashHistory: CreateHistory<History>
|
|
||||||
createMemoryHistory: CreateHistory<History>
|
|
||||||
createLocation(path?: Path, state?: LocationState, action?: Action, key?: LocationKey): Location
|
|
||||||
useBasename<T>(createHistory: CreateHistory<T>): CreateHistory<T>
|
|
||||||
useBeforeUnload<T>(createHistory: CreateHistory<T>): CreateHistory<T & HistoryBeforeUnload>
|
|
||||||
useQueries<T>(createHistory: CreateHistory<T>): CreateHistory<T & HistoryQueries>
|
|
||||||
actions: {
|
|
||||||
PUSH: string
|
|
||||||
REPLACE: string
|
|
||||||
POP: string
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
declare module "history/lib/createBrowserHistory" {
|
|
||||||
|
|
||||||
export default function createBrowserHistory(options?: HistoryModule.HistoryOptions): HistoryModule.History
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
declare module "history/lib/createHashHistory" {
|
|
||||||
|
|
||||||
export default function createHashHistory(options?: HistoryModule.HistoryOptions): HistoryModule.History
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
declare module "history/lib/createMemoryHistory" {
|
|
||||||
|
|
||||||
export default function createMemoryHistory(options?: HistoryModule.HistoryOptions): HistoryModule.History
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
declare module "history/lib/createLocation" {
|
|
||||||
|
|
||||||
export default function createLocation(path?: HistoryModule.Path, state?: HistoryModule.LocationState, action?: HistoryModule.Action, key?: HistoryModule.LocationKey): HistoryModule.Location
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
declare module "history/lib/useBasename" {
|
|
||||||
|
|
||||||
export default function useBasename<T>(createHistory: HistoryModule.CreateHistory<T>): HistoryModule.CreateHistory<T>
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
declare module "history/lib/useBeforeUnload" {
|
|
||||||
|
|
||||||
export default function useBeforeUnload<T>(createHistory: HistoryModule.CreateHistory<T>): HistoryModule.CreateHistory<T & HistoryModule.HistoryBeforeUnload>
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
declare module "history/lib/useQueries" {
|
|
||||||
|
|
||||||
export default function useQueries<T>(createHistory: HistoryModule.CreateHistory<T>): HistoryModule.CreateHistory<T & HistoryModule.HistoryQueries>
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
declare module "history/lib/actions" {
|
|
||||||
|
|
||||||
export const PUSH: string
|
|
||||||
|
|
||||||
export const REPLACE: string
|
|
||||||
|
|
||||||
export const POP: string
|
|
||||||
|
|
||||||
export default {
|
|
||||||
PUSH,
|
|
||||||
REPLACE,
|
|
||||||
POP
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
declare module "history/lib/DOMUtils" {
|
|
||||||
export function addEventListener(node: EventTarget, event: string, listener: EventListenerOrEventListenerObject): void;
|
|
||||||
export function removeEventListener(node: EventTarget, event: string, listener: EventListenerOrEventListenerObject): void;
|
|
||||||
export function getHashPath(): string;
|
|
||||||
export function replaceHashPath(path: string): void;
|
|
||||||
export function getWindowPath(): string;
|
|
||||||
export function go(n: number): void;
|
|
||||||
export function getUserConfirmation(message: string, callback: (result: boolean) => void): void;
|
|
||||||
export function supportsHistory(): boolean;
|
|
||||||
export function supportsGoWithoutReloadUsingHash(): boolean;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
declare module "history" {
|
|
||||||
|
|
||||||
export { default as createHistory } from "history/lib/createBrowserHistory"
|
|
||||||
|
|
||||||
export { default as createHashHistory } from "history/lib/createHashHistory"
|
|
||||||
|
|
||||||
export { default as createMemoryHistory } from "history/lib/createMemoryHistory"
|
|
||||||
|
|
||||||
export { default as createLocation } from "history/lib/createLocation"
|
|
||||||
|
|
||||||
export { default as useBasename } from "history/lib/useBasename"
|
|
||||||
|
|
||||||
export { default as useBeforeUnload } from "history/lib/useBeforeUnload"
|
|
||||||
|
|
||||||
export { default as useQueries } from "history/lib/useQueries"
|
|
||||||
|
|
||||||
import * as Actions from "history/lib/actions"
|
|
||||||
|
|
||||||
export { Actions }
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,480 +0,0 @@
|
|||||||
// Type definitions for react-router v2.0.0
|
|
||||||
// Project: https://github.com/rackt/react-router
|
|
||||||
// Definitions by: Sergey Buturlakin <https://github.com/sergey-buturlakin>, Yuichi Murata <https://github.com/mrk21>, Václav Ostrožlík <https://github.com/vasek17>, Nathan Brown <https://github.com/ngbrown>
|
|
||||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
|
||||||
|
|
||||||
|
|
||||||
/// <reference path="../react/react.d.ts" />
|
|
||||||
/// <reference path="./history.d.ts"/>
|
|
||||||
|
|
||||||
|
|
||||||
declare namespace ReactRouter {
|
|
||||||
|
|
||||||
import React = __React
|
|
||||||
|
|
||||||
import H = HistoryModule
|
|
||||||
|
|
||||||
// types based on https://github.com/rackt/react-router/blob/master/docs/Glossary.md
|
|
||||||
|
|
||||||
type Component = React.ReactType
|
|
||||||
|
|
||||||
type EnterHook = (nextState: RouterState, replaceState: RedirectFunction, callback?: Function) => any
|
|
||||||
|
|
||||||
type LeaveHook = () => any
|
|
||||||
|
|
||||||
type Params = Object
|
|
||||||
|
|
||||||
type ParseQueryString = (queryString: H.QueryString) => H.Query
|
|
||||||
|
|
||||||
type RedirectFunction = (state: H.LocationState, pathname: H.Pathname | H.Path, query?: H.Query) => void
|
|
||||||
|
|
||||||
type RouteComponent = Component
|
|
||||||
|
|
||||||
// use the following interface in an app code to get access to route param values, history, location...
|
|
||||||
// interface MyComponentProps extends ReactRouter.RouteComponentProps<{}, { id: number }> {}
|
|
||||||
// somewhere in MyComponent
|
|
||||||
// ...
|
|
||||||
// let id = this.props.routeParams.id
|
|
||||||
// ...
|
|
||||||
// this.props.history. ...
|
|
||||||
// ...
|
|
||||||
interface RouteComponentProps<P, R> {
|
|
||||||
history?: History
|
|
||||||
location?: H.Location
|
|
||||||
params?: P
|
|
||||||
route?: PlainRoute
|
|
||||||
routeParams?: R
|
|
||||||
routes?: PlainRoute[]
|
|
||||||
children?: React.ReactElement<any>
|
|
||||||
}
|
|
||||||
|
|
||||||
type RouteComponents = { [key: string]: RouteComponent }
|
|
||||||
|
|
||||||
type RouteConfig = React.ReactNode | PlainRoute | PlainRoute[]
|
|
||||||
|
|
||||||
type RouteHook = (nextLocation?: H.Location) => any
|
|
||||||
|
|
||||||
type RoutePattern = string
|
|
||||||
|
|
||||||
type StringifyQuery = (queryObject: H.Query) => H.QueryString
|
|
||||||
|
|
||||||
type RouterListener = (error: Error, nextState: RouterState) => void
|
|
||||||
|
|
||||||
interface RouterState {
|
|
||||||
location: H.Location
|
|
||||||
routes: PlainRoute[]
|
|
||||||
params: Params
|
|
||||||
components: RouteComponent[]
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
interface HistoryBase extends H.History {
|
|
||||||
routes: PlainRoute[]
|
|
||||||
parseQueryString?: ParseQueryString
|
|
||||||
stringifyQuery?: StringifyQuery
|
|
||||||
}
|
|
||||||
|
|
||||||
type History = HistoryBase & H.HistoryQueries & HistoryRoutes
|
|
||||||
const browserHistory: History;
|
|
||||||
const hashHistory: History;
|
|
||||||
|
|
||||||
/* components */
|
|
||||||
|
|
||||||
interface RouterProps extends React.Props<Router> {
|
|
||||||
history?: H.History
|
|
||||||
routes?: RouteConfig // alias for children
|
|
||||||
createElement?: (component: RouteComponent, props: Object) => any
|
|
||||||
onError?: (error: any) => any
|
|
||||||
onUpdate?: () => any
|
|
||||||
parseQueryString?: ParseQueryString
|
|
||||||
stringifyQuery?: StringifyQuery
|
|
||||||
}
|
|
||||||
interface Router extends React.ComponentClass<RouterProps> {}
|
|
||||||
interface RouterElement extends React.ReactElement<RouterProps> {}
|
|
||||||
const Router: Router
|
|
||||||
|
|
||||||
|
|
||||||
interface LinkProps extends React.HTMLAttributes, React.Props<Link> {
|
|
||||||
activeStyle?: React.CSSProperties
|
|
||||||
activeClassName?: string
|
|
||||||
onlyActiveOnIndex?: boolean
|
|
||||||
to: RoutePattern
|
|
||||||
query?: H.Query
|
|
||||||
state?: H.LocationState
|
|
||||||
}
|
|
||||||
interface Link extends React.ComponentClass<LinkProps> {}
|
|
||||||
interface LinkElement extends React.ReactElement<LinkProps> {}
|
|
||||||
const Link: Link
|
|
||||||
|
|
||||||
|
|
||||||
const IndexLink: Link
|
|
||||||
|
|
||||||
|
|
||||||
interface RouterContextProps extends React.Props<RouterContext> {
|
|
||||||
history?: H.History
|
|
||||||
router: Router
|
|
||||||
createElement: (component: RouteComponent, props: Object) => any
|
|
||||||
location: H.Location
|
|
||||||
routes: RouteConfig
|
|
||||||
params: Params
|
|
||||||
components?: RouteComponent[]
|
|
||||||
}
|
|
||||||
interface RouterContext extends React.ComponentClass<RouterContextProps> {}
|
|
||||||
interface RouterContextElement extends React.ReactElement<RouterContextProps> {
|
|
||||||
history?: H.History
|
|
||||||
location: H.Location
|
|
||||||
router?: Router
|
|
||||||
}
|
|
||||||
const RouterContext: RouterContext
|
|
||||||
|
|
||||||
|
|
||||||
/* components (configuration) */
|
|
||||||
|
|
||||||
interface RouteProps extends React.Props<Route> {
|
|
||||||
path?: RoutePattern
|
|
||||||
component?: RouteComponent
|
|
||||||
components?: RouteComponents
|
|
||||||
getComponent?: (location: H.Location, cb: (error: any, component?: RouteComponent) => void) => void
|
|
||||||
getComponents?: (location: H.Location, cb: (error: any, components?: RouteComponents) => void) => void
|
|
||||||
onEnter?: EnterHook
|
|
||||||
onLeave?: LeaveHook
|
|
||||||
getIndexRoute?: (location: H.Location, cb: (error: any, indexRoute: RouteConfig) => void) => void
|
|
||||||
getChildRoutes?: (location: H.Location, cb: (error: any, childRoutes: RouteConfig) => void) => void
|
|
||||||
}
|
|
||||||
interface Route extends React.ComponentClass<RouteProps> {}
|
|
||||||
interface RouteElement extends React.ReactElement<RouteProps> {}
|
|
||||||
const Route: Route
|
|
||||||
|
|
||||||
|
|
||||||
interface PlainRoute {
|
|
||||||
path?: RoutePattern
|
|
||||||
component?: RouteComponent
|
|
||||||
components?: RouteComponents
|
|
||||||
getComponent?: (location: H.Location, cb: (error: any, component?: RouteComponent) => void) => void
|
|
||||||
getComponents?: (location: H.Location, cb: (error: any, components?: RouteComponents) => void) => void
|
|
||||||
onEnter?: EnterHook
|
|
||||||
onLeave?: LeaveHook
|
|
||||||
indexRoute?: PlainRoute
|
|
||||||
getIndexRoute?: (location: H.Location, cb: (error: any, indexRoute: RouteConfig) => void) => void
|
|
||||||
childRoutes?: PlainRoute[]
|
|
||||||
getChildRoutes?: (location: H.Location, cb: (error: any, childRoutes: RouteConfig) => void) => void
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
interface RedirectProps extends React.Props<Redirect> {
|
|
||||||
path?: RoutePattern
|
|
||||||
from?: RoutePattern // alias for path
|
|
||||||
to: RoutePattern
|
|
||||||
query?: H.Query
|
|
||||||
state?: H.LocationState
|
|
||||||
}
|
|
||||||
interface Redirect extends React.ComponentClass<RedirectProps> {}
|
|
||||||
interface RedirectElement extends React.ReactElement<RedirectProps> {}
|
|
||||||
const Redirect: Redirect
|
|
||||||
|
|
||||||
|
|
||||||
interface IndexRouteProps extends React.Props<IndexRoute> {
|
|
||||||
component?: RouteComponent
|
|
||||||
components?: RouteComponents
|
|
||||||
getComponent?: (location: H.Location, cb: (error: any, component?: RouteComponent) => void) => void
|
|
||||||
getComponents?: (location: H.Location, cb: (error: any, components?: RouteComponents) => void) => void
|
|
||||||
onEnter?: EnterHook
|
|
||||||
onLeave?: LeaveHook
|
|
||||||
}
|
|
||||||
interface IndexRoute extends React.ComponentClass<IndexRouteProps> {}
|
|
||||||
interface IndexRouteElement extends React.ReactElement<IndexRouteProps> {}
|
|
||||||
const IndexRoute: IndexRoute
|
|
||||||
|
|
||||||
|
|
||||||
interface IndexRedirectProps extends React.Props<IndexRedirect> {
|
|
||||||
to: RoutePattern
|
|
||||||
query?: H.Query
|
|
||||||
state?: H.LocationState
|
|
||||||
}
|
|
||||||
interface IndexRedirect extends React.ComponentClass<IndexRedirectProps> {}
|
|
||||||
interface IndexRedirectElement extends React.ReactElement<IndexRedirectProps> {}
|
|
||||||
const IndexRedirect: IndexRedirect
|
|
||||||
|
|
||||||
interface RouterOnContext extends H.History {
|
|
||||||
setRouteLeaveHook(route: PlainRoute, hook?: RouteHook): () => void;
|
|
||||||
isActive(pathOrLoc: H.LocationDescriptor, indexOnly?: boolean): boolean;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* mixins */
|
|
||||||
|
|
||||||
interface HistoryMixin {
|
|
||||||
history: History
|
|
||||||
}
|
|
||||||
const History: React.Mixin<any, any>
|
|
||||||
|
|
||||||
|
|
||||||
interface LifecycleMixin {
|
|
||||||
routerWillLeave(nextLocation: H.Location): string | boolean
|
|
||||||
}
|
|
||||||
const Lifecycle: React.Mixin<any, any>
|
|
||||||
|
|
||||||
|
|
||||||
const RouteContext: React.Mixin<any, any>
|
|
||||||
|
|
||||||
|
|
||||||
/* utils */
|
|
||||||
|
|
||||||
interface HistoryRoutes {
|
|
||||||
listen(listener: RouterListener): Function
|
|
||||||
listenBeforeLeavingRoute(route: PlainRoute, hook: RouteHook): void
|
|
||||||
match(location: H.Location, callback: (error: any, nextState: RouterState, nextLocation: H.Location) => void): void
|
|
||||||
isActive(pathname: H.Pathname, query?: H.Query, indexOnly?: boolean): boolean
|
|
||||||
setRouteLeaveHook(route: PlainRoute, callback: RouteHook): void
|
|
||||||
}
|
|
||||||
|
|
||||||
function useRoutes<T>(createHistory: HistoryModule.CreateHistory<T>): HistoryModule.CreateHistory<T & HistoryRoutes>
|
|
||||||
|
|
||||||
|
|
||||||
function createRoutes(routes: RouteConfig): PlainRoute[]
|
|
||||||
|
|
||||||
|
|
||||||
interface MatchArgs {
|
|
||||||
routes?: RouteConfig
|
|
||||||
history?: H.History
|
|
||||||
location?: H.Location
|
|
||||||
parseQueryString?: ParseQueryString
|
|
||||||
stringifyQuery?: StringifyQuery
|
|
||||||
}
|
|
||||||
interface MatchState extends RouterState {
|
|
||||||
history: History
|
|
||||||
}
|
|
||||||
function match(args: MatchArgs, cb: (error: any, nextLocation: H.Location, nextState: MatchState) => void): void
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
declare module "react-router/lib/Router" {
|
|
||||||
|
|
||||||
export default ReactRouter.Router
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
declare module "react-router/lib/Link" {
|
|
||||||
|
|
||||||
export default ReactRouter.Link
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
declare module "react-router/lib/IndexLink" {
|
|
||||||
|
|
||||||
export default ReactRouter.IndexLink
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
declare module "react-router/lib/IndexRedirect" {
|
|
||||||
|
|
||||||
export default ReactRouter.IndexRedirect
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
declare module "react-router/lib/IndexRoute" {
|
|
||||||
|
|
||||||
export default ReactRouter.IndexRoute
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
declare module "react-router/lib/Redirect" {
|
|
||||||
|
|
||||||
export default ReactRouter.Redirect
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
declare module "react-router/lib/Route" {
|
|
||||||
|
|
||||||
export default ReactRouter.Route
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
declare module "react-router/lib/History" {
|
|
||||||
|
|
||||||
export default ReactRouter.History
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
declare module "react-router/lib/Lifecycle" {
|
|
||||||
|
|
||||||
export default ReactRouter.Lifecycle
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
declare module "react-router/lib/RouteContext" {
|
|
||||||
|
|
||||||
export default ReactRouter.RouteContext
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
declare module "react-router/lib/useRoutes" {
|
|
||||||
|
|
||||||
export default ReactRouter.useRoutes
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
declare module "react-router/lib/PatternUtils" {
|
|
||||||
|
|
||||||
export function formatPattern(pattern: string, params: {}): string;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
declare module "react-router/lib/RouteUtils" {
|
|
||||||
|
|
||||||
type E = __React.ReactElement<any>
|
|
||||||
|
|
||||||
export function isReactChildren(object: E | E[]): boolean
|
|
||||||
|
|
||||||
export function createRouteFromReactElement(element: E): ReactRouter.PlainRoute
|
|
||||||
|
|
||||||
export function createRoutesFromReactChildren(children: E | E[], parentRoute: ReactRouter.PlainRoute): ReactRouter.PlainRoute[]
|
|
||||||
|
|
||||||
export import createRoutes = ReactRouter.createRoutes
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
declare module "react-router/lib/RouterContext" {
|
|
||||||
|
|
||||||
export default ReactRouter.RouterContext
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
declare module "react-router/lib/PropTypes" {
|
|
||||||
|
|
||||||
import React = __React
|
|
||||||
|
|
||||||
export function falsy(props: any, propName: string, componentName: string): Error;
|
|
||||||
|
|
||||||
export const history: React.Requireable<any>
|
|
||||||
|
|
||||||
export const location: React.Requireable<any>
|
|
||||||
|
|
||||||
export const component: React.Requireable<any>
|
|
||||||
|
|
||||||
export const components: React.Requireable<any>
|
|
||||||
|
|
||||||
export const route: React.Requireable<any>
|
|
||||||
|
|
||||||
export const routes: React.Requireable<any>
|
|
||||||
|
|
||||||
export default {
|
|
||||||
falsy,
|
|
||||||
history,
|
|
||||||
location,
|
|
||||||
component,
|
|
||||||
components,
|
|
||||||
route
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
declare module "react-router/lib/browserHistory" {
|
|
||||||
export default ReactRouter.browserHistory;
|
|
||||||
}
|
|
||||||
|
|
||||||
declare module "react-router/lib/hashHistory" {
|
|
||||||
export default ReactRouter.hashHistory;
|
|
||||||
}
|
|
||||||
|
|
||||||
declare module "react-router/lib/match" {
|
|
||||||
|
|
||||||
export default ReactRouter.match
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
declare module "react-router" {
|
|
||||||
|
|
||||||
import Router from "react-router/lib/Router"
|
|
||||||
|
|
||||||
import Link from "react-router/lib/Link"
|
|
||||||
|
|
||||||
import IndexLink from "react-router/lib/IndexLink"
|
|
||||||
|
|
||||||
import IndexRedirect from "react-router/lib/IndexRedirect"
|
|
||||||
|
|
||||||
import IndexRoute from "react-router/lib/IndexRoute"
|
|
||||||
|
|
||||||
import Redirect from "react-router/lib/Redirect"
|
|
||||||
|
|
||||||
import Route from "react-router/lib/Route"
|
|
||||||
|
|
||||||
import History from "react-router/lib/History"
|
|
||||||
|
|
||||||
import Lifecycle from "react-router/lib/Lifecycle"
|
|
||||||
|
|
||||||
import RouteContext from "react-router/lib/RouteContext"
|
|
||||||
|
|
||||||
import browserHistory from "react-router/lib/browserHistory"
|
|
||||||
|
|
||||||
import hashHistory from "react-router/lib/hashHistory"
|
|
||||||
|
|
||||||
import useRoutes from "react-router/lib/useRoutes"
|
|
||||||
|
|
||||||
import { createRoutes } from "react-router/lib/RouteUtils"
|
|
||||||
|
|
||||||
import { formatPattern } from "react-router/lib/PatternUtils"
|
|
||||||
|
|
||||||
import RouterContext from "react-router/lib/RouterContext"
|
|
||||||
|
|
||||||
import PropTypes from "react-router/lib/PropTypes"
|
|
||||||
|
|
||||||
import match from "react-router/lib/match"
|
|
||||||
|
|
||||||
// PlainRoute is defined in the API documented at:
|
|
||||||
// https://github.com/rackt/react-router/blob/master/docs/API.md
|
|
||||||
// but not included in any of the .../lib modules above.
|
|
||||||
export type PlainRoute = ReactRouter.PlainRoute
|
|
||||||
|
|
||||||
// The following definitions are also very useful to export
|
|
||||||
// because by using these types lots of potential type errors
|
|
||||||
// can be exposed:
|
|
||||||
export type EnterHook = ReactRouter.EnterHook
|
|
||||||
export type LeaveHook = ReactRouter.LeaveHook
|
|
||||||
export type ParseQueryString = ReactRouter.ParseQueryString
|
|
||||||
export type RedirectFunction = ReactRouter.RedirectFunction
|
|
||||||
export type RouteComponentProps<P,R> = ReactRouter.RouteComponentProps<P,R>;
|
|
||||||
export type RouteHook = ReactRouter.RouteHook
|
|
||||||
export type StringifyQuery = ReactRouter.StringifyQuery
|
|
||||||
export type RouterListener = ReactRouter.RouterListener
|
|
||||||
export type RouterState = ReactRouter.RouterState
|
|
||||||
export type HistoryBase = ReactRouter.HistoryBase
|
|
||||||
export type RouterOnContext = ReactRouter.RouterOnContext
|
|
||||||
|
|
||||||
export {
|
|
||||||
Router,
|
|
||||||
Link,
|
|
||||||
IndexLink,
|
|
||||||
IndexRedirect,
|
|
||||||
IndexRoute,
|
|
||||||
Redirect,
|
|
||||||
Route,
|
|
||||||
History,
|
|
||||||
browserHistory,
|
|
||||||
hashHistory,
|
|
||||||
Lifecycle,
|
|
||||||
RouteContext,
|
|
||||||
useRoutes,
|
|
||||||
createRoutes,
|
|
||||||
formatPattern,
|
|
||||||
RouterContext,
|
|
||||||
PropTypes,
|
|
||||||
match
|
|
||||||
}
|
|
||||||
|
|
||||||
export default Router
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,66 +0,0 @@
|
|||||||
// Type definitions for React v0.14 (react-dom)
|
|
||||||
// Project: http://facebook.github.io/react/
|
|
||||||
// Definitions by: Asana <https://asana.com>, AssureSign <http://www.assuresign.com>, Microsoft <https://microsoft.com>
|
|
||||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
|
||||||
|
|
||||||
/// <reference path="react.d.ts" />
|
|
||||||
|
|
||||||
declare namespace __React {
|
|
||||||
namespace __DOM {
|
|
||||||
function findDOMNode<E extends Element>(instance: ReactInstance): E;
|
|
||||||
function findDOMNode(instance: ReactInstance): Element;
|
|
||||||
|
|
||||||
function render<P>(
|
|
||||||
element: DOMElement<P>,
|
|
||||||
container: Element,
|
|
||||||
callback?: (element: Element) => any): Element;
|
|
||||||
function render<P, S>(
|
|
||||||
element: ClassicElement<P>,
|
|
||||||
container: Element,
|
|
||||||
callback?: (component: ClassicComponent<P, S>) => any): ClassicComponent<P, S>;
|
|
||||||
function render<P, S>(
|
|
||||||
element: ReactElement<P>,
|
|
||||||
container: Element,
|
|
||||||
callback?: (component: Component<P, S>) => any): Component<P, S>;
|
|
||||||
|
|
||||||
function unmountComponentAtNode(container: Element): boolean;
|
|
||||||
|
|
||||||
var version: string;
|
|
||||||
|
|
||||||
function unstable_batchedUpdates<A, B>(callback: (a: A, b: B) => any, a: A, b: B): void;
|
|
||||||
function unstable_batchedUpdates<A>(callback: (a: A) => any, a: A): void;
|
|
||||||
function unstable_batchedUpdates(callback: () => any): void;
|
|
||||||
|
|
||||||
function unstable_renderSubtreeIntoContainer<P>(
|
|
||||||
parentComponent: Component<any, any>,
|
|
||||||
nextElement: DOMElement<P>,
|
|
||||||
container: Element,
|
|
||||||
callback?: (element: Element) => any): Element;
|
|
||||||
function unstable_renderSubtreeIntoContainer<P, S>(
|
|
||||||
parentComponent: Component<any, any>,
|
|
||||||
nextElement: ClassicElement<P>,
|
|
||||||
container: Element,
|
|
||||||
callback?: (component: ClassicComponent<P, S>) => any): ClassicComponent<P, S>;
|
|
||||||
function unstable_renderSubtreeIntoContainer<P, S>(
|
|
||||||
parentComponent: Component<any, any>,
|
|
||||||
nextElement: ReactElement<P>,
|
|
||||||
container: Element,
|
|
||||||
callback?: (component: Component<P, S>) => any): Component<P, S>;
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace __DOMServer {
|
|
||||||
function renderToString(element: ReactElement<any>): string;
|
|
||||||
function renderToStaticMarkup(element: ReactElement<any>): string;
|
|
||||||
var version: string;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
declare module "react-dom" {
|
|
||||||
import DOM = __React.__DOM;
|
|
||||||
export = DOM;
|
|
||||||
}
|
|
||||||
|
|
||||||
declare module "react-dom/server" {
|
|
||||||
import DOMServer = __React.__DOMServer;
|
|
||||||
export = DOMServer;
|
|
||||||
}
|
|
||||||
2405
templates/ReactReduxSpa/typings/react/react.d.ts
vendored
2405
templates/ReactReduxSpa/typings/react/react.d.ts
vendored
File diff suppressed because it is too large
Load Diff
@@ -1,18 +0,0 @@
|
|||||||
// Type definitions for redux-thunk
|
|
||||||
// Project: https://github.com/gaearon/redux-thunk
|
|
||||||
// Definitions by: Qubo <https://github.com/tkqubo>
|
|
||||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
|
||||||
|
|
||||||
/// <reference path="../redux/redux.d.ts" />
|
|
||||||
|
|
||||||
declare module ReduxThunk {
|
|
||||||
export interface Thunk extends Redux.Middleware {}
|
|
||||||
export interface ThunkInterface {
|
|
||||||
<T>(dispatch: Redux.Dispatch, getState?: () => T): any;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
declare module "redux-thunk" {
|
|
||||||
var thunk: ReduxThunk.Thunk;
|
|
||||||
export = thunk;
|
|
||||||
}
|
|
||||||
52
templates/ReactReduxSpa/typings/redux/redux.d.ts
vendored
52
templates/ReactReduxSpa/typings/redux/redux.d.ts
vendored
@@ -1,52 +0,0 @@
|
|||||||
// Type definitions for Redux v1.0.0
|
|
||||||
// Project: https://github.com/rackt/redux
|
|
||||||
// Definitions by: William Buchwalter <https://github.com/wbuchwalter/>, Vincent Prouillet <https://github.com/Keats/>
|
|
||||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
|
||||||
|
|
||||||
declare module Redux {
|
|
||||||
|
|
||||||
interface ActionCreator extends Function {
|
|
||||||
(...args: any[]): any;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface Reducer extends Function {
|
|
||||||
(state: any, action: any): any;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface Dispatch extends Function {
|
|
||||||
(action: any): any;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface StoreMethods {
|
|
||||||
dispatch: Dispatch;
|
|
||||||
getState(): any;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
interface MiddlewareArg {
|
|
||||||
dispatch: Dispatch;
|
|
||||||
getState: Function;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface Middleware extends Function {
|
|
||||||
(obj: MiddlewareArg): Function;
|
|
||||||
}
|
|
||||||
|
|
||||||
class Store {
|
|
||||||
getReducer(): Reducer;
|
|
||||||
replaceReducer(nextReducer: Reducer): void;
|
|
||||||
dispatch(action: any): any;
|
|
||||||
getState(): any;
|
|
||||||
subscribe(listener: Function): Function;
|
|
||||||
}
|
|
||||||
|
|
||||||
function createStore(reducer: Reducer, initialState?: any, enhancer?: ()=>any): Store;
|
|
||||||
function bindActionCreators<T>(actionCreators: T, dispatch: Dispatch): T;
|
|
||||||
function combineReducers(reducers: any): Reducer;
|
|
||||||
function applyMiddleware(...middlewares: Middleware[]): Function;
|
|
||||||
function compose<T extends Function>(...functions: Function[]): T;
|
|
||||||
}
|
|
||||||
|
|
||||||
declare module "redux" {
|
|
||||||
export = Redux;
|
|
||||||
}
|
|
||||||
@@ -1,90 +0,0 @@
|
|||||||
// Type definitions for source-map v0.1.38
|
|
||||||
// Project: https://github.com/mozilla/source-map
|
|
||||||
// Definitions by: Morten Houston Ludvigsen <https://github.com/MortenHoustonLudvigsen>
|
|
||||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
|
||||||
|
|
||||||
declare module SourceMap {
|
|
||||||
interface StartOfSourceMap {
|
|
||||||
file?: string;
|
|
||||||
sourceRoot?: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface RawSourceMap extends StartOfSourceMap {
|
|
||||||
version: string;
|
|
||||||
sources: Array<string>;
|
|
||||||
names: Array<string>;
|
|
||||||
sourcesContent?: string[];
|
|
||||||
mappings: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface Position {
|
|
||||||
line: number;
|
|
||||||
column: number;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface MappedPosition extends Position {
|
|
||||||
source: string;
|
|
||||||
name?: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface MappingItem {
|
|
||||||
source: string;
|
|
||||||
generatedLine: number;
|
|
||||||
generatedColumn: number;
|
|
||||||
originalLine: number;
|
|
||||||
originalColumn: number;
|
|
||||||
name: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface Mapping {
|
|
||||||
generated: Position;
|
|
||||||
original: Position;
|
|
||||||
source: string;
|
|
||||||
name?: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface CodeWithSourceMap {
|
|
||||||
code: string;
|
|
||||||
map: SourceMapGenerator;
|
|
||||||
}
|
|
||||||
|
|
||||||
class SourceMapConsumer {
|
|
||||||
public static GENERATED_ORDER: number;
|
|
||||||
public static ORIGINAL_ORDER: number;
|
|
||||||
|
|
||||||
constructor(rawSourceMap: RawSourceMap);
|
|
||||||
public originalPositionFor(generatedPosition: Position): MappedPosition;
|
|
||||||
public generatedPositionFor(originalPosition: MappedPosition): Position;
|
|
||||||
public sourceContentFor(source: string): string;
|
|
||||||
public eachMapping(callback: (mapping: MappingItem) => void, context?: any, order?: number): void;
|
|
||||||
}
|
|
||||||
|
|
||||||
class SourceMapGenerator {
|
|
||||||
constructor(startOfSourceMap?: StartOfSourceMap);
|
|
||||||
public static fromSourceMap(sourceMapConsumer: SourceMapConsumer): SourceMapGenerator;
|
|
||||||
public addMapping(mapping: Mapping): void;
|
|
||||||
public setSourceContent(sourceFile: string, sourceContent: string): void;
|
|
||||||
public applySourceMap(sourceMapConsumer: SourceMapConsumer, sourceFile?: string, sourceMapPath?: string): void;
|
|
||||||
public toString(): string;
|
|
||||||
}
|
|
||||||
|
|
||||||
class SourceNode {
|
|
||||||
constructor();
|
|
||||||
constructor(line: number, column: number, source: string);
|
|
||||||
constructor(line: number, column: number, source: string, chunk?: string, name?: string);
|
|
||||||
public static fromStringWithSourceMap(code: string, sourceMapConsumer: SourceMapConsumer, relativePath?: string): SourceNode;
|
|
||||||
public add(chunk: any): SourceNode;
|
|
||||||
public prepend(chunk: any): SourceNode;
|
|
||||||
public setSourceContent(sourceFile: string, sourceContent: string): void;
|
|
||||||
public walk(fn: (chunk: string, mapping: MappedPosition) => void): void;
|
|
||||||
public walkSourceContents(fn: (file: string, content: string) => void): void;
|
|
||||||
public join(sep: string): SourceNode;
|
|
||||||
public replaceRight(pattern: string, replacement: string): SourceNode;
|
|
||||||
public toString(): string;
|
|
||||||
public toStringWithSourceMap(startOfSourceMap?: StartOfSourceMap): CodeWithSourceMap;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
declare module 'source-map' {
|
|
||||||
export = SourceMap;
|
|
||||||
}
|
|
||||||
13
templates/ReactReduxSpa/typings/tsd.d.ts
vendored
13
templates/ReactReduxSpa/typings/tsd.d.ts
vendored
@@ -1,13 +0,0 @@
|
|||||||
|
|
||||||
/// <reference path="react/react.d.ts" />
|
|
||||||
/// <reference path="react-router/history.d.ts" />
|
|
||||||
/// <reference path="react-router/react-router.d.ts" />
|
|
||||||
/// <reference path="react/react-dom.d.ts" />
|
|
||||||
/// <reference path="whatwg-fetch/whatwg-fetch.d.ts" />
|
|
||||||
/// <reference path="react-redux/react-redux.d.ts" />
|
|
||||||
/// <reference path="react-router-redux/react-router-redux.d.ts" />
|
|
||||||
/// <reference path="redux-thunk/redux-thunk.d.ts" />
|
|
||||||
/// <reference path="redux/redux.d.ts" />
|
|
||||||
/// <reference path="source-map/source-map.d.ts" />
|
|
||||||
/// <reference path="uglify-js/uglify-js.d.ts" />
|
|
||||||
/// <reference path="webpack/webpack-env.d.ts" />
|
|
||||||
@@ -1,430 +0,0 @@
|
|||||||
// Type definitions for UglifyJS 2 v2.6.1
|
|
||||||
// Project: https://github.com/mishoo/UglifyJS2
|
|
||||||
// Definitions by: Tanguy Krotoff <https://github.com/tkrotoff>
|
|
||||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
|
||||||
|
|
||||||
/// <reference path="../source-map/source-map.d.ts" />
|
|
||||||
|
|
||||||
declare module 'uglify-js' {
|
|
||||||
import * as MOZ_SourceMap from 'source-map';
|
|
||||||
|
|
||||||
namespace UglifyJS {
|
|
||||||
interface Tokenizer {
|
|
||||||
/**
|
|
||||||
* The type of this token.
|
|
||||||
* Can be "num", "string", "regexp", "operator", "punc", "atom", "name", "keyword", "comment1" or "comment2".
|
|
||||||
* "comment1" and "comment2" are for single-line, respectively multi-line comments.
|
|
||||||
*/
|
|
||||||
type: string;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The name of the file where this token originated from. Useful when compressing multiple files at once to generate the proper source map.
|
|
||||||
*/
|
|
||||||
file: string;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The "value" of the token.
|
|
||||||
* That's additional information and depends on the token type: "num", "string" and "regexp" tokens you get their literal value.
|
|
||||||
* - For "operator" you get the operator.
|
|
||||||
* - For "punc" it's the punctuation sign (parens, comma, semicolon etc).
|
|
||||||
* - For "atom", "name" and "keyword" it's the name of the identifier
|
|
||||||
* - For comments it's the body of the comment (excluding the initial "//" and "/*".
|
|
||||||
*/
|
|
||||||
value: string;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The line number of this token in the original code.
|
|
||||||
* 1-based index.
|
|
||||||
*/
|
|
||||||
line: number;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The column number of this token in the original code.
|
|
||||||
* 0-based index.
|
|
||||||
*/
|
|
||||||
col: number;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Short for "newline before", it's a boolean that tells us whether there was a newline before this node in the original source. It helps for automatic semicolon insertion.
|
|
||||||
* For multi-line comments in particular this will be set to true if there either was a newline before this comment, or * * if this comment contains a newline.
|
|
||||||
*/
|
|
||||||
nlb: boolean;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This doesn't apply for comment tokens, but for all other token types it will be an array of comment tokens that were found before.
|
|
||||||
*/
|
|
||||||
comments_before: string[];
|
|
||||||
}
|
|
||||||
|
|
||||||
interface AST_Node {
|
|
||||||
// The first token of this node
|
|
||||||
start: AST_Node;
|
|
||||||
|
|
||||||
// The last token of this node
|
|
||||||
end: AST_Node;
|
|
||||||
|
|
||||||
transform(tt: TreeTransformer): AST_Toplevel;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface AST_Toplevel extends AST_Node {
|
|
||||||
// UglifyJS contains a scope analyzer which figures out variable/function definitions, references etc.
|
|
||||||
// You need to call it manually before compression or mangling.
|
|
||||||
// The figure_out_scope method is defined only on the AST_Toplevel node.
|
|
||||||
figure_out_scope(): void;
|
|
||||||
|
|
||||||
// Get names that are optimized for GZip compression (names will be generated using the most frequent characters first)
|
|
||||||
compute_char_frequency(): void;
|
|
||||||
|
|
||||||
mangle_names(): void;
|
|
||||||
|
|
||||||
print(stream: OutputStream): void;
|
|
||||||
|
|
||||||
print_to_string(options?: BeautifierOptions): string;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface MinifyOptions {
|
|
||||||
spidermonkey?: boolean;
|
|
||||||
outSourceMap?: string;
|
|
||||||
sourceRoot?: string;
|
|
||||||
inSourceMap?: string;
|
|
||||||
fromString?: boolean;
|
|
||||||
warnings?: boolean;
|
|
||||||
mangle?: Object;
|
|
||||||
output?: MinifyOutput,
|
|
||||||
compress?: Object;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface MinifyOutput {
|
|
||||||
code: string;
|
|
||||||
map: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
function minify(files: string | Array<string>, options?: MinifyOptions): MinifyOutput;
|
|
||||||
|
|
||||||
|
|
||||||
interface ParseOptions {
|
|
||||||
// Default is false
|
|
||||||
strict?: boolean;
|
|
||||||
|
|
||||||
// Input file name, default is null
|
|
||||||
filename?: string;
|
|
||||||
|
|
||||||
// Default is null
|
|
||||||
toplevel?: AST_Toplevel;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The parser creates a custom abstract syntax tree given a piece of JavaScript code.
|
|
||||||
* Perhaps you should read about the AST first.
|
|
||||||
*/
|
|
||||||
function parse(code: string, options?: ParseOptions): AST_Toplevel;
|
|
||||||
|
|
||||||
|
|
||||||
interface BeautifierOptions {
|
|
||||||
/**
|
|
||||||
* Start indentation on every line (only when `beautify`)
|
|
||||||
*/
|
|
||||||
indent_start?: number;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Indentation level (only when `beautify`)
|
|
||||||
*/
|
|
||||||
indent_level?: number;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Quote all keys in object literals?
|
|
||||||
*/
|
|
||||||
quote_keys?: boolean;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Add a space after colon signs?
|
|
||||||
*/
|
|
||||||
space_colon?: boolean;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Output ASCII-safe? (encodes Unicode characters as ASCII)
|
|
||||||
*/
|
|
||||||
ascii_only?: boolean;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Escape "</script"?
|
|
||||||
*/
|
|
||||||
inline_script?: boolean;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Informative maximum line width (for beautified output)
|
|
||||||
*/
|
|
||||||
width?: number;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Maximum line length (for non-beautified output)
|
|
||||||
*/
|
|
||||||
max_line_len?: number;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Output IE-safe code?
|
|
||||||
*/
|
|
||||||
ie_proof?: boolean;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Beautify output?
|
|
||||||
*/
|
|
||||||
beautify?: boolean;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Output a source map
|
|
||||||
*/
|
|
||||||
source_map?: SourceMapOptions;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Use brackets every time?
|
|
||||||
*/
|
|
||||||
bracketize?: boolean;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Output comments?
|
|
||||||
*/
|
|
||||||
comments?: boolean;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Use semicolons to separate statements? (otherwise, newlines)
|
|
||||||
*/
|
|
||||||
semicolons?: boolean;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface OutputStream {
|
|
||||||
// Return the output so far as a string
|
|
||||||
get(): string;
|
|
||||||
toString(): string;
|
|
||||||
|
|
||||||
// Insert one indentation string (usually 4 characters).
|
|
||||||
// Optionally pass true to indent half the width (I'm using that for case and default lines in switch blocks.
|
|
||||||
// If beautify is off, this function does nothing.
|
|
||||||
indent(half?: boolean): void;
|
|
||||||
|
|
||||||
// Return the current indentation width (not level; for example if we're in level 2 and indent_level is 4, this method would return 8.
|
|
||||||
indentation(): number;
|
|
||||||
|
|
||||||
// return the width of the current line text minus indentation.
|
|
||||||
current_width(): number
|
|
||||||
|
|
||||||
// Return true if current_width() is bigger than options.width (assuming options.width is non-null, non-zero).
|
|
||||||
should_break(): boolean;
|
|
||||||
|
|
||||||
// If beautification is on, this inserts a newline. Otherwise it does nothing.
|
|
||||||
newline(): void;
|
|
||||||
|
|
||||||
// Include the given string into the output, adjusting current_line, current_col and current_pos accordingly.
|
|
||||||
print(str: string): void;
|
|
||||||
|
|
||||||
// If beautification is on this always includes a space character.
|
|
||||||
// Otherwise it saves a hint somewhere that a space might be needed at current point.
|
|
||||||
// The space will go in at the next output but only when absolutely required, for example it will insert the space in return 10 but not in return"stuff".
|
|
||||||
space(): void;
|
|
||||||
|
|
||||||
// Inserts a comma, and calls space() — that is, if beautification is on you'll get a space after the comma.
|
|
||||||
comma(): void;
|
|
||||||
|
|
||||||
// Inserts a colon, and calls space() if options.space_colon is set.
|
|
||||||
colon(): void;
|
|
||||||
|
|
||||||
// Returns the last printed chunk.
|
|
||||||
last(): string;
|
|
||||||
|
|
||||||
// If beautification is on it always inserts a semicolon.
|
|
||||||
// Otherwise it saves a hint that a semicolon might be needed at current point.
|
|
||||||
// The semicolon is inserted when the next output comes in, only if required to not break the JS syntax.
|
|
||||||
semicolon(): void;
|
|
||||||
|
|
||||||
// Always inserts a semicolon and clears the hint that a semicolon might be needed.
|
|
||||||
force_semicolon(): void;
|
|
||||||
|
|
||||||
// Encodes any non-ASCII characters in string with JavaScript's conventions (using \uCODE).
|
|
||||||
to_ascii(str: string): void;
|
|
||||||
|
|
||||||
// Prints an identifier. If options.ascii_only is set, non-ASCII chars will be encoded with JavaScript conventions.
|
|
||||||
print_name(name: string): void;
|
|
||||||
|
|
||||||
// Prints a string. It adds quotes automatically.
|
|
||||||
// It prefers double-quotes, but will actually count any quotes in the string and will use single-quotes if the output proves to be shorter (depending on how many backslashes it has to insert).
|
|
||||||
// It encodes to ASCII if options.ascii_only is set.
|
|
||||||
print_string(str: string): void;
|
|
||||||
|
|
||||||
// Returns the width of the next indentation level. For example if current level is 2 and options.indent_level is 4, it'll return 12.
|
|
||||||
next_indent(): number;
|
|
||||||
|
|
||||||
// Sets the current indentation to col (column), calls the function and thereafter restores the previous indentation level.
|
|
||||||
// If beautification is off it simply calls func.
|
|
||||||
with_indent(col: number, func: Function): void;
|
|
||||||
|
|
||||||
// This is used to output blocks in curly brackets.
|
|
||||||
// It'll print an open bracket at current point, then call newline() and with the next indentation level it calls your func.
|
|
||||||
// Lastly, it'll print an indented closing bracket. As usual, if beautification is off you'll just get {x} where x is whatever func outputs.
|
|
||||||
with_block(func: Function): void;
|
|
||||||
|
|
||||||
// Adds parens around the output that your function prints.
|
|
||||||
with_parens(func: Function): void;
|
|
||||||
|
|
||||||
// Adds square brackets around the output that your function prints.
|
|
||||||
with_square(func: Function): void;
|
|
||||||
|
|
||||||
// If options.source_map is set, this will generate a source mapping between the given token (which should be an AST_Token-like object) and the current line/col.
|
|
||||||
// The name is optional; in most cases it will be inferred from the token.
|
|
||||||
add_mapping(token: AST_Node, name?: string): void;
|
|
||||||
|
|
||||||
// Returns the option with the given name.
|
|
||||||
option(name: string): any;
|
|
||||||
|
|
||||||
// Returns the current line in the output (1-based).
|
|
||||||
line(): number;
|
|
||||||
|
|
||||||
// Returns the current column in the output (zero-based).
|
|
||||||
col(): number;
|
|
||||||
|
|
||||||
// Push the given node into an internal stack. This is used to keep track of current node's parent(s).
|
|
||||||
push_node(node: AST_Node): void;
|
|
||||||
|
|
||||||
// Pops the top of the stack and returns it.
|
|
||||||
pop_node(): AST_Node;
|
|
||||||
|
|
||||||
// Returns that internal stack.
|
|
||||||
stack(): any;
|
|
||||||
|
|
||||||
// Returns the n-th parent node (where zero means the direct parent).
|
|
||||||
parent(n: number): AST_Node;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The code generator is a recursive process of getting back source code from an AST returned by the parser.
|
|
||||||
* Every AST node has a “print” method that takes an OutputStream and dumps the code from that node into it.
|
|
||||||
* The stream object supports a lot of options that control the output.
|
|
||||||
* You can specify whether you'd like to get human-readable (indented) output, the indentation level, whether you'd like to quote all properties in object literals etc.
|
|
||||||
*/
|
|
||||||
function OutputStream(options?: BeautifierOptions): OutputStream;
|
|
||||||
|
|
||||||
|
|
||||||
interface SourceMapOptions {
|
|
||||||
/**
|
|
||||||
* The compressed file name
|
|
||||||
*/
|
|
||||||
file?: string;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The root URL to the original sources
|
|
||||||
*/
|
|
||||||
root?: string;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The input source map.
|
|
||||||
* Useful when you compress code that was generated from some other source (possibly other programming language).
|
|
||||||
* If you have an input source map, pass it in this argument and UglifyJS will generate a mapping that maps back
|
|
||||||
* to the original source (as opposed to the compiled code that you are compressing).
|
|
||||||
*/
|
|
||||||
orig?: Object | JSON;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface SourceMap {
|
|
||||||
add(source: string, gen_line: number, gen_col: number, orig_line: number, orig_col: number, name?: string): void;
|
|
||||||
get(): MOZ_SourceMap.SourceMapGenerator;
|
|
||||||
toString(): string;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The output stream keeps track of the current line/column in the output and can trivially generate a source mapping to the original code via Mozilla's source-map library.
|
|
||||||
* To use this functionality, you must load this library (it's automatically require-d by UglifyJS in the NodeJS version, but in a browser you must load it yourself)
|
|
||||||
* and make it available via the global MOZ_SourceMap variable.
|
|
||||||
*/
|
|
||||||
function SourceMap(options?: SourceMapOptions): SourceMap;
|
|
||||||
|
|
||||||
|
|
||||||
interface CompressorOptions {
|
|
||||||
// Join consecutive statemets with the “comma operator”
|
|
||||||
sequences?: boolean;
|
|
||||||
|
|
||||||
// Optimize property access: a["foo"] → a.foo
|
|
||||||
properties?: boolean;
|
|
||||||
|
|
||||||
// Discard unreachable code
|
|
||||||
dead_code?: boolean;
|
|
||||||
|
|
||||||
// Discard “debugger” statements
|
|
||||||
drop_debugger?: boolean;
|
|
||||||
|
|
||||||
// Some unsafe optimizations (see below)
|
|
||||||
unsafe?: boolean;
|
|
||||||
|
|
||||||
// Optimize if-s and conditional expressions
|
|
||||||
conditionals?: boolean;
|
|
||||||
|
|
||||||
// Optimize comparisons
|
|
||||||
comparisons?: boolean;
|
|
||||||
|
|
||||||
// Evaluate constant expressions
|
|
||||||
evaluate?: boolean;
|
|
||||||
|
|
||||||
// Optimize boolean expressions
|
|
||||||
booleans?: boolean;
|
|
||||||
|
|
||||||
// Optimize loops
|
|
||||||
loops?: boolean;
|
|
||||||
|
|
||||||
// Drop unused variables/functions
|
|
||||||
unused?: boolean;
|
|
||||||
|
|
||||||
// Hoist function declarations
|
|
||||||
hoist_funs?: boolean;
|
|
||||||
|
|
||||||
// Hoist variable declarations
|
|
||||||
hoist_vars?: boolean;
|
|
||||||
|
|
||||||
// Optimize if-s followed by return/continue
|
|
||||||
if_return?: boolean;
|
|
||||||
|
|
||||||
// Join var declarations
|
|
||||||
join_vars?: boolean;
|
|
||||||
|
|
||||||
// Try to cascade `right` into `left` in sequences
|
|
||||||
cascade?: boolean;
|
|
||||||
|
|
||||||
// Drop side-effect-free statements
|
|
||||||
side_effects?: boolean;
|
|
||||||
|
|
||||||
// Warn about potentially dangerous optimizations/code
|
|
||||||
warnings?: boolean;
|
|
||||||
|
|
||||||
// Global definitions
|
|
||||||
global_defs?: Object;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The compressor is a tree transformer which reduces the code size by applying various optimizations on the AST
|
|
||||||
*/
|
|
||||||
function Compressor(options?: CompressorOptions): AST_Toplevel;
|
|
||||||
|
|
||||||
|
|
||||||
// TODO
|
|
||||||
interface TreeWalker {
|
|
||||||
}
|
|
||||||
|
|
||||||
type visitor = (node: AST_Node, descend: Function) => boolean;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* UglifyJS provides a TreeWalker object and every node has a walk method that given a walker will apply your visitor to each node in the tree.
|
|
||||||
* Your visitor can return a non-falsy value in order to prevent descending the current node.
|
|
||||||
*/
|
|
||||||
function TreeWalker(visitor: visitor): TreeWalker;
|
|
||||||
|
|
||||||
|
|
||||||
// TODO
|
|
||||||
interface TreeTransformer extends TreeWalker {
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The tree transformer is a special case of a tree walker.
|
|
||||||
* In fact it even inherits from TreeWalker and you can use the same methods, but initialization and visitor protocol are a bit different.
|
|
||||||
*/
|
|
||||||
function TreeTransformer(before: visitor, after: visitor): TreeTransformer;
|
|
||||||
}
|
|
||||||
|
|
||||||
export = UglifyJS;
|
|
||||||
}
|
|
||||||
@@ -1,232 +0,0 @@
|
|||||||
// Type definitions for webpack 1.12.2 (module API)
|
|
||||||
// Project: https://github.com/webpack/webpack
|
|
||||||
// Definitions by: use-strict <https://github.com/use-strict>
|
|
||||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Webpack module API - variables and global functions available inside modules
|
|
||||||
*/
|
|
||||||
|
|
||||||
declare namespace __WebpackModuleApi {
|
|
||||||
interface RequireContext {
|
|
||||||
keys(): string[];
|
|
||||||
<T>(id: string): T;
|
|
||||||
resolve(id: string): string;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface RequireFunction {
|
|
||||||
/**
|
|
||||||
* Returns the exports from a dependency. The call is sync. No request to the server is fired. The compiler ensures that the dependency is available.
|
|
||||||
*/
|
|
||||||
<T>(path: string): T;
|
|
||||||
/**
|
|
||||||
* Behaves similar to require.ensure, but the callback is called with the exports of each dependency in the paths array. There is no option to provide a chunk name.
|
|
||||||
*/
|
|
||||||
(paths: string[], callback: (...modules: any[]) => void): void;
|
|
||||||
/**
|
|
||||||
* Download additional dependencies on demand. The paths array lists modules that should be available. When they are, callback is called. If the callback is a function expression, dependencies in that source part are extracted and also loaded on demand. A single request is fired to the server, except if all modules are already available.
|
|
||||||
*
|
|
||||||
* This creates a chunk. The chunk can be named. If a chunk with this name already exists, the dependencies are merged into that chunk and that chunk is used.
|
|
||||||
*/
|
|
||||||
ensure: (paths: string[], callback: (require: <T>(path: string) => T) => void, chunkName?: string) => void;
|
|
||||||
context: (path: string, deep?: boolean, filter?: RegExp) => RequireContext;
|
|
||||||
/**
|
|
||||||
* Returns the module id of a dependency. The call is sync. No request to the server is fired. The compiler ensures that the dependency is available.
|
|
||||||
*
|
|
||||||
* The module id is a number in webpack (in contrast to node.js where it is a string, the filename).
|
|
||||||
*/
|
|
||||||
resolve(path: string): number;
|
|
||||||
/**
|
|
||||||
* Like require.resolve, but doesn’t include the module into the bundle. It’s a weak dependency.
|
|
||||||
*/
|
|
||||||
resolveWeak(path: string): number;
|
|
||||||
/**
|
|
||||||
* Ensures that the dependency is available, but don’t execute it. This can be use for optimizing the position of a module in the chunks.
|
|
||||||
*/
|
|
||||||
include(path: string): void;
|
|
||||||
/**
|
|
||||||
* Multiple requires to the same module result in only one module execution and only one export. Therefore a cache in the runtime exists. Removing values from this cache cause new module execution and a new export. This is only needed in rare cases (for compatibility!).
|
|
||||||
*/
|
|
||||||
cache: {
|
|
||||||
[id: string]: any;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
interface Module {
|
|
||||||
exports: any;
|
|
||||||
require(id: string): any;
|
|
||||||
id: string;
|
|
||||||
filename: string;
|
|
||||||
loaded: boolean;
|
|
||||||
parent: any;
|
|
||||||
children: any[];
|
|
||||||
hot: Hot;
|
|
||||||
}
|
|
||||||
type ModuleId = string|number;
|
|
||||||
|
|
||||||
interface Hot {
|
|
||||||
/**
|
|
||||||
* Accept code updates for the specified dependencies. The callback is called when dependencies were replaced.
|
|
||||||
* @param dependencies
|
|
||||||
* @param callback
|
|
||||||
*/
|
|
||||||
accept(dependencies: string[], callback: (updatedDependencies: ModuleId[]) => void): void;
|
|
||||||
/**
|
|
||||||
* Accept code updates for the specified dependencies. The callback is called when dependencies were replaced.
|
|
||||||
* @param dependency
|
|
||||||
* @param callback
|
|
||||||
*/
|
|
||||||
accept(dependency: string, callback: () => void): void;
|
|
||||||
/**
|
|
||||||
* Accept code updates for this module without notification of parents.
|
|
||||||
* This should only be used if the module doesn’t export anything.
|
|
||||||
* The errHandler can be used to handle errors that occur while loading the updated module.
|
|
||||||
* @param errHandler
|
|
||||||
*/
|
|
||||||
accept(errHandler?: (err: Error) => void): void;
|
|
||||||
/**
|
|
||||||
* Do not accept updates for the specified dependencies. If any dependencies is updated, the code update fails with code "decline".
|
|
||||||
*/
|
|
||||||
decline(dependencies: string[]): void;
|
|
||||||
/**
|
|
||||||
* Do not accept updates for the specified dependencies. If any dependencies is updated, the code update fails with code "decline".
|
|
||||||
*/
|
|
||||||
decline(dependency: string): void;
|
|
||||||
/**
|
|
||||||
* Flag the current module as not update-able. If updated the update code would fail with code "decline".
|
|
||||||
*/
|
|
||||||
decline(): void;
|
|
||||||
/**
|
|
||||||
* Add a one time handler, which is executed when the current module code is replaced.
|
|
||||||
* Here you should destroy/remove any persistent resource you have claimed/created.
|
|
||||||
* If you want to transfer state to the new module, add it to data object.
|
|
||||||
* The data will be available at module.hot.data on the new module.
|
|
||||||
* @param callback
|
|
||||||
*/
|
|
||||||
dispose<T>(callback: (data: T) => void): void;
|
|
||||||
/**
|
|
||||||
* Add a one time handler, which is executed when the current module code is replaced.
|
|
||||||
* Here you should destroy/remove any persistent resource you have claimed/created.
|
|
||||||
* If you want to transfer state to the new module, add it to data object.
|
|
||||||
* The data will be available at module.hot.data on the new module.
|
|
||||||
* @param callback
|
|
||||||
*/
|
|
||||||
addDisposeHandler<T>(callback: (data: T) => void): void;
|
|
||||||
/**
|
|
||||||
* Remove a handler.
|
|
||||||
* This can useful to add a temporary dispose handler. You could i. e. replace code while in the middle of a multi-step async function.
|
|
||||||
* @param callback
|
|
||||||
*/
|
|
||||||
removeDisposeHandler<T>(callback: (data: T) => void): void;
|
|
||||||
/**
|
|
||||||
* Throws an exceptions if status() is not idle.
|
|
||||||
* Check all currently loaded modules for updates and apply updates if found.
|
|
||||||
* If no update was found, the callback is called with null.
|
|
||||||
* If autoApply is truthy the callback will be called with all modules that were disposed.
|
|
||||||
* apply() is automatically called with autoApply as options parameter.
|
|
||||||
* If autoApply is not set the callback will be called with all modules that will be disposed on apply().
|
|
||||||
* @param autoApply
|
|
||||||
* @param callback
|
|
||||||
*/
|
|
||||||
check(autoApply: boolean, callback: (err: Error, outdatedModules: ModuleId[]) => void): void;
|
|
||||||
/**
|
|
||||||
* Throws an exceptions if status() is not idle.
|
|
||||||
* Check all currently loaded modules for updates and apply updates if found.
|
|
||||||
* If no update was found, the callback is called with null.
|
|
||||||
* The callback will be called with all modules that will be disposed on apply().
|
|
||||||
* @param callback
|
|
||||||
*/
|
|
||||||
check(callback: (err: Error, outdatedModules: ModuleId[]) => void): void;
|
|
||||||
/**
|
|
||||||
* If status() != "ready" it throws an error.
|
|
||||||
* Continue the update process.
|
|
||||||
* @param options
|
|
||||||
* @param callback
|
|
||||||
*/
|
|
||||||
apply(options: AcceptOptions, callback: (err: Error, outdatedModules: ModuleId[]) => void): void;
|
|
||||||
/**
|
|
||||||
* If status() != "ready" it throws an error.
|
|
||||||
* Continue the update process.
|
|
||||||
* @param callback
|
|
||||||
*/
|
|
||||||
apply(callback: (err: Error, outdatedModules: ModuleId[]) => void): void;
|
|
||||||
/**
|
|
||||||
* Return one of idle, check, watch, watch-delay, prepare, ready, dispose, apply, abort or fail.
|
|
||||||
*/
|
|
||||||
status(): string;
|
|
||||||
/** Register a callback on status change. */
|
|
||||||
status(callback: (status: string) => void): void;
|
|
||||||
/** Register a callback on status change. */
|
|
||||||
addStatusHandler(callback: (status: string) => void): void;
|
|
||||||
/**
|
|
||||||
* Remove a registered status change handler.
|
|
||||||
* @param callback
|
|
||||||
*/
|
|
||||||
removeStatusHandler(callback: (status: string) => void): void;
|
|
||||||
|
|
||||||
active: boolean;
|
|
||||||
data: {};
|
|
||||||
}
|
|
||||||
|
|
||||||
interface AcceptOptions {
|
|
||||||
/**
|
|
||||||
* If true the update process continues even if some modules are not accepted (and would bubble to the entry point).
|
|
||||||
*/
|
|
||||||
ignoreUnaccepted?: boolean;
|
|
||||||
/**
|
|
||||||
* Indicates that apply() is automatically called by check function
|
|
||||||
*/
|
|
||||||
autoApply?: boolean;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
declare var require: __WebpackModuleApi.RequireFunction;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The resource query of the current module.
|
|
||||||
*
|
|
||||||
* e.g. __resourceQuery === "?test" // Inside "file.js?test"
|
|
||||||
*/
|
|
||||||
declare var __resourceQuery: string;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Equals the config options output.publicPath.
|
|
||||||
*/
|
|
||||||
declare var __webpack_public_path__: string;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The raw require function. This expression isn’t parsed by the Parser for dependencies.
|
|
||||||
*/
|
|
||||||
declare var __webpack_require__: any;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The internal chunk loading function
|
|
||||||
*
|
|
||||||
* @param chunkId The id for the chunk to load.
|
|
||||||
* @param callback A callback function called once the chunk is loaded.
|
|
||||||
*/
|
|
||||||
declare var __webpack_chunk_load__: (chunkId: any, callback: (require: (id: string) => any) => void) => void;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Access to the internal object of all modules.
|
|
||||||
*/
|
|
||||||
declare var __webpack_modules__: any[];
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Access to the hash of the compilation.
|
|
||||||
*
|
|
||||||
* Only available with the HotModuleReplacementPlugin or the ExtendedAPIPlugin
|
|
||||||
*/
|
|
||||||
declare var __webpack_hash__: any;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Generates a require function that is not parsed by webpack. Can be used to do cool stuff with a global require function if available.
|
|
||||||
*/
|
|
||||||
declare var __non_webpack_require__: any;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Equals the config option debug
|
|
||||||
*/
|
|
||||||
declare var DEBUG: boolean;
|
|
||||||
|
|
||||||
declare var module: __WebpackModuleApi.Module;
|
|
||||||
@@ -1,85 +0,0 @@
|
|||||||
// Type definitions for fetch API
|
|
||||||
// Project: https://github.com/github/fetch
|
|
||||||
// Definitions by: Ryan Graham <https://github.com/ryan-codingintrigue>
|
|
||||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
|
||||||
|
|
||||||
declare class Request extends Body {
|
|
||||||
constructor(input: string|Request, init?:RequestInit);
|
|
||||||
method: string;
|
|
||||||
url: string;
|
|
||||||
headers: Headers;
|
|
||||||
context: string|RequestContext;
|
|
||||||
referrer: string;
|
|
||||||
mode: string|RequestMode;
|
|
||||||
credentials: string|RequestCredentials;
|
|
||||||
cache: string|RequestCache;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface RequestInit {
|
|
||||||
method?: string;
|
|
||||||
headers?: HeaderInit|{ [index: string]: string };
|
|
||||||
body?: BodyInit;
|
|
||||||
mode?: string|RequestMode;
|
|
||||||
credentials?: string|RequestCredentials;
|
|
||||||
cache?: string|RequestCache;
|
|
||||||
}
|
|
||||||
|
|
||||||
declare enum RequestContext {
|
|
||||||
"audio", "beacon", "cspreport", "download", "embed", "eventsource", "favicon", "fetch",
|
|
||||||
"font", "form", "frame", "hyperlink", "iframe", "image", "imageset", "import",
|
|
||||||
"internal", "location", "manifest", "object", "ping", "plugin", "prefetch", "script",
|
|
||||||
"serviceworker", "sharedworker", "subresource", "style", "track", "video", "worker",
|
|
||||||
"xmlhttprequest", "xslt"
|
|
||||||
}
|
|
||||||
declare enum RequestMode { "same-origin", "no-cors", "cors" }
|
|
||||||
declare enum RequestCredentials { "omit", "same-origin", "include" }
|
|
||||||
declare enum RequestCache { "default", "no-store", "reload", "no-cache", "force-cache", "only-if-cached" }
|
|
||||||
|
|
||||||
declare class Headers {
|
|
||||||
append(name: string, value: string): void;
|
|
||||||
delete(name: string):void;
|
|
||||||
get(name: string): string;
|
|
||||||
getAll(name: string): Array<string>;
|
|
||||||
has(name: string): boolean;
|
|
||||||
set(name: string, value: string): void;
|
|
||||||
}
|
|
||||||
|
|
||||||
declare class Body {
|
|
||||||
bodyUsed: boolean;
|
|
||||||
arrayBuffer(): Promise<ArrayBuffer>;
|
|
||||||
blob(): Promise<Blob>;
|
|
||||||
formData(): Promise<FormData>;
|
|
||||||
json(): Promise<any>;
|
|
||||||
json<T>(): Promise<T>;
|
|
||||||
text(): Promise<string>;
|
|
||||||
}
|
|
||||||
declare class Response extends Body {
|
|
||||||
constructor(body?: BodyInit, init?: ResponseInit);
|
|
||||||
error(): Response;
|
|
||||||
redirect(url: string, status: number): Response;
|
|
||||||
type: string|ResponseType;
|
|
||||||
url: string;
|
|
||||||
status: number;
|
|
||||||
ok: boolean;
|
|
||||||
statusText: string;
|
|
||||||
headers: Headers;
|
|
||||||
clone(): Response;
|
|
||||||
}
|
|
||||||
|
|
||||||
declare enum ResponseType { "basic", "cors", "default", "error", "opaque" }
|
|
||||||
|
|
||||||
interface ResponseInit {
|
|
||||||
status: number;
|
|
||||||
statusText?: string;
|
|
||||||
headers?: HeaderInit;
|
|
||||||
}
|
|
||||||
|
|
||||||
declare type HeaderInit = Headers|Array<string>;
|
|
||||||
declare type BodyInit = Blob|FormData|string;
|
|
||||||
declare type RequestInfo = Request|string;
|
|
||||||
|
|
||||||
interface Window {
|
|
||||||
fetch(url: string|Request, init?: RequestInit): Promise<Response>;
|
|
||||||
}
|
|
||||||
|
|
||||||
declare var fetch: typeof window.fetch;
|
|
||||||
@@ -2,27 +2,32 @@
|
|||||||
"name": "WebApplicationBasic",
|
"name": "WebApplicationBasic",
|
||||||
"version": "0.0.0",
|
"version": "0.0.0",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"aspnet-webpack": "^1.0.6",
|
"@types/history": "^2.0.39",
|
||||||
|
"@types/isomorphic-fetch": "0.0.31",
|
||||||
|
"@types/react": "^0.14.38",
|
||||||
|
"@types/react-dom": "^0.14.17",
|
||||||
|
"@types/react-router": "^2.0.38",
|
||||||
|
"aspnet-webpack": "^1.0.17",
|
||||||
"aspnet-webpack-react": "^1.0.2",
|
"aspnet-webpack-react": "^1.0.2",
|
||||||
"babel-core": "^6.5.2",
|
"babel-core": "^6.17.0",
|
||||||
"babel-loader": "^6.2.3",
|
"babel-loader": "^6.2.5",
|
||||||
"babel-preset-es2015": "^6.5.0",
|
"babel-preset-es2015": "^6.16.0",
|
||||||
"babel-preset-react": "^6.5.0",
|
"babel-preset-react": "^6.16.0",
|
||||||
"bootstrap": "^3.3.6",
|
"bootstrap": "^3.3.6",
|
||||||
"css-loader": "^0.23.1",
|
"css-loader": "^0.25.0",
|
||||||
"event-source-polyfill": "^0.0.7",
|
"event-source-polyfill": "^0.0.7",
|
||||||
"extract-text-webpack-plugin": "^1.0.1",
|
"extract-text-webpack-plugin": "^1.0.1",
|
||||||
"file-loader": "^0.8.5",
|
"file-loader": "^0.9.0",
|
||||||
"isomorphic-fetch": "^2.2.1",
|
"isomorphic-fetch": "^2.2.1",
|
||||||
"jquery": "^2.2.1",
|
"jquery": "^2.2.1",
|
||||||
"react": "^15.0.1",
|
"react": "^15.3.2",
|
||||||
"react-dom": "^15.0.1",
|
"react-dom": "^15.3.2",
|
||||||
"react-router": "^2.1.1",
|
"react-router": "^2.8.1",
|
||||||
"style-loader": "^0.13.0",
|
"style-loader": "^0.13.1",
|
||||||
"ts-loader": "^0.8.1",
|
"ts-loader": "^0.8.2",
|
||||||
"typescript": "^1.8.2",
|
"typescript": "^2.0.3",
|
||||||
"url-loader": "^0.5.7",
|
"url-loader": "^0.5.7",
|
||||||
"webpack": "^1.12.14",
|
"webpack": "^1.13.2",
|
||||||
"webpack-hot-middleware": "^2.10.0"
|
"webpack-hot-middleware": "^2.12.2"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,24 +0,0 @@
|
|||||||
{
|
|
||||||
"version": "v4",
|
|
||||||
"repo": "borisyankov/DefinitelyTyped",
|
|
||||||
"ref": "master",
|
|
||||||
"path": "typings",
|
|
||||||
"bundle": "typings/tsd.d.ts",
|
|
||||||
"installed": {
|
|
||||||
"react/react.d.ts": {
|
|
||||||
"commit": "dade4414712ce84e3c63393f1aae407e9e7e6af7"
|
|
||||||
},
|
|
||||||
"react-router/react-router.d.ts": {
|
|
||||||
"commit": "dade4414712ce84e3c63393f1aae407e9e7e6af7"
|
|
||||||
},
|
|
||||||
"react/react-dom.d.ts": {
|
|
||||||
"commit": "dade4414712ce84e3c63393f1aae407e9e7e6af7"
|
|
||||||
},
|
|
||||||
"react-router/history.d.ts": {
|
|
||||||
"commit": "dade4414712ce84e3c63393f1aae407e9e7e6af7"
|
|
||||||
},
|
|
||||||
"isomorphic-fetch/isomorphic-fetch.d.ts": {
|
|
||||||
"commit": "57ec5fbb76060329c10959d449eb1d4e70b15a65"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,119 +0,0 @@
|
|||||||
// Type definitions for isomorphic-fetch
|
|
||||||
// Project: https://github.com/matthew-andrews/isomorphic-fetch
|
|
||||||
// Definitions by: Todd Lucas <https://github.com/toddlucas>
|
|
||||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
|
||||||
|
|
||||||
declare enum RequestContext {
|
|
||||||
"audio", "beacon", "cspreport", "download", "embed", "eventsource",
|
|
||||||
"favicon", "fetch", "font", "form", "frame", "hyperlink", "iframe",
|
|
||||||
"image", "imageset", "import", "internal", "location", "manifest",
|
|
||||||
"object", "ping", "plugin", "prefetch", "script", "serviceworker",
|
|
||||||
"sharedworker", "subresource", "style", "track", "video", "worker",
|
|
||||||
"xmlhttprequest", "xslt"
|
|
||||||
}
|
|
||||||
declare enum RequestMode { "same-origin", "no-cors", "cors" }
|
|
||||||
declare enum RequestCredentials { "omit", "same-origin", "include" }
|
|
||||||
declare enum RequestCache {
|
|
||||||
"default", "no-store", "reload", "no-cache", "force-cache",
|
|
||||||
"only-if-cached"
|
|
||||||
}
|
|
||||||
declare enum ResponseType { "basic", "cors", "default", "error", "opaque" }
|
|
||||||
|
|
||||||
declare type HeaderInit = Headers | Array<string>;
|
|
||||||
declare type BodyInit = ArrayBuffer | ArrayBufferView | Blob | FormData | string;
|
|
||||||
declare type RequestInfo = Request | string;
|
|
||||||
|
|
||||||
interface RequestInit {
|
|
||||||
method?: string;
|
|
||||||
headers?: HeaderInit | { [index: string]: string };
|
|
||||||
body?: BodyInit;
|
|
||||||
mode?: string | RequestMode;
|
|
||||||
credentials?: string | RequestCredentials;
|
|
||||||
cache?: string | RequestCache;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface IHeaders {
|
|
||||||
get(name: string): string;
|
|
||||||
getAll(name: string): Array<string>;
|
|
||||||
has(name: string): boolean;
|
|
||||||
}
|
|
||||||
|
|
||||||
declare class Headers implements IHeaders {
|
|
||||||
append(name: string, value: string): void;
|
|
||||||
delete(name: string):void;
|
|
||||||
get(name: string): string;
|
|
||||||
getAll(name: string): Array<string>;
|
|
||||||
has(name: string): boolean;
|
|
||||||
set(name: string, value: string): void;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface IBody {
|
|
||||||
bodyUsed: boolean;
|
|
||||||
arrayBuffer(): Promise<ArrayBuffer>;
|
|
||||||
blob(): Promise<Blob>;
|
|
||||||
formData(): Promise<FormData>;
|
|
||||||
json(): Promise<any>;
|
|
||||||
json<T>(): Promise<T>;
|
|
||||||
text(): Promise<string>;
|
|
||||||
}
|
|
||||||
|
|
||||||
declare class Body implements IBody {
|
|
||||||
bodyUsed: boolean;
|
|
||||||
arrayBuffer(): Promise<ArrayBuffer>;
|
|
||||||
blob(): Promise<Blob>;
|
|
||||||
formData(): Promise<FormData>;
|
|
||||||
json(): Promise<any>;
|
|
||||||
json<T>(): Promise<T>;
|
|
||||||
text(): Promise<string>;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface IRequest extends IBody {
|
|
||||||
method: string;
|
|
||||||
url: string;
|
|
||||||
headers: Headers;
|
|
||||||
context: string | RequestContext;
|
|
||||||
referrer: string;
|
|
||||||
mode: string | RequestMode;
|
|
||||||
credentials: string | RequestCredentials;
|
|
||||||
cache: string | RequestCache;
|
|
||||||
}
|
|
||||||
|
|
||||||
declare class Request extends Body implements IRequest {
|
|
||||||
constructor(input: string | Request, init?: RequestInit);
|
|
||||||
method: string;
|
|
||||||
url: string;
|
|
||||||
headers: Headers;
|
|
||||||
context: string | RequestContext;
|
|
||||||
referrer: string;
|
|
||||||
mode: string | RequestMode;
|
|
||||||
credentials: string | RequestCredentials;
|
|
||||||
cache: string | RequestCache;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface IResponse extends IBody {
|
|
||||||
url: string;
|
|
||||||
status: number;
|
|
||||||
statusText: string;
|
|
||||||
ok: boolean;
|
|
||||||
headers: IHeaders;
|
|
||||||
type: string | ResponseType;
|
|
||||||
size: number;
|
|
||||||
timeout: number;
|
|
||||||
redirect(url: string, status: number): IResponse;
|
|
||||||
error(): IResponse;
|
|
||||||
clone(): IResponse;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface IFetchStatic {
|
|
||||||
Promise: any;
|
|
||||||
Headers: IHeaders
|
|
||||||
Request: IRequest;
|
|
||||||
Response: IResponse;
|
|
||||||
(url: string | IRequest, init?: RequestInit): Promise<IResponse>;
|
|
||||||
}
|
|
||||||
|
|
||||||
declare var fetch: IFetchStatic;
|
|
||||||
|
|
||||||
declare module "isomorphic-fetch" {
|
|
||||||
export = fetch;
|
|
||||||
}
|
|
||||||
192
templates/ReactSpa/typings/react-router/history.d.ts
vendored
192
templates/ReactSpa/typings/react-router/history.d.ts
vendored
@@ -1,192 +0,0 @@
|
|||||||
// Type definitions for history v1.13.1
|
|
||||||
// Project: https://github.com/rackt/history
|
|
||||||
// Definitions by: Sergey Buturlakin <http://github.com/sergey-buturlakin>
|
|
||||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
|
||||||
|
|
||||||
|
|
||||||
declare namespace HistoryModule {
|
|
||||||
|
|
||||||
// types based on https://github.com/rackt/history/blob/master/docs/Terms.md
|
|
||||||
|
|
||||||
type Action = string
|
|
||||||
|
|
||||||
type BeforeUnloadHook = () => string | boolean
|
|
||||||
|
|
||||||
type CreateHistory<T> = (options?: HistoryOptions) => T
|
|
||||||
|
|
||||||
type CreateHistoryEnhancer<T, E> = (createHistory: CreateHistory<T>) => CreateHistory<T & E>
|
|
||||||
|
|
||||||
interface History {
|
|
||||||
listenBefore(hook: TransitionHook): Function
|
|
||||||
listen(listener: LocationListener): Function
|
|
||||||
transitionTo(location: Location): void
|
|
||||||
pushState(state: LocationState, path: Path): void
|
|
||||||
replaceState(state: LocationState, path: Path): void
|
|
||||||
push(path: Path): void
|
|
||||||
replace(path: Path): void
|
|
||||||
go(n: number): void
|
|
||||||
goBack(): void
|
|
||||||
goForward(): void
|
|
||||||
createKey(): LocationKey
|
|
||||||
createPath(path: Path): Path
|
|
||||||
createHref(path: Path): Href
|
|
||||||
createLocation(path?: Path, state?: LocationState, action?: Action, key?: LocationKey): Location
|
|
||||||
|
|
||||||
/** @deprecated use location.key to save state instead */
|
|
||||||
setState(state: LocationState): void
|
|
||||||
/** @deprecated use listenBefore instead */
|
|
||||||
registerTransitionHook(hook: TransitionHook): void
|
|
||||||
/** @deprecated use the callback returned from listenBefore instead */
|
|
||||||
unregisterTransitionHook(hook: TransitionHook): void
|
|
||||||
}
|
|
||||||
|
|
||||||
type HistoryOptions = Object
|
|
||||||
|
|
||||||
type Href = string
|
|
||||||
|
|
||||||
type Location = {
|
|
||||||
pathname: Pathname
|
|
||||||
search: QueryString
|
|
||||||
query: Query
|
|
||||||
state: LocationState
|
|
||||||
action: Action
|
|
||||||
key: LocationKey
|
|
||||||
}
|
|
||||||
|
|
||||||
type LocationKey = string
|
|
||||||
|
|
||||||
type LocationListener = (location: Location) => void
|
|
||||||
|
|
||||||
type LocationState = Object
|
|
||||||
|
|
||||||
type Path = string // Pathname + QueryString
|
|
||||||
|
|
||||||
type Pathname = string
|
|
||||||
|
|
||||||
type Query = Object
|
|
||||||
|
|
||||||
type QueryString = string
|
|
||||||
|
|
||||||
type TransitionHook = (location: Location, callback: Function) => any
|
|
||||||
|
|
||||||
|
|
||||||
interface HistoryBeforeUnload {
|
|
||||||
listenBeforeUnload(hook: BeforeUnloadHook): Function
|
|
||||||
}
|
|
||||||
|
|
||||||
interface HistoryQueries {
|
|
||||||
pushState(state: LocationState, pathname: Pathname | Path, query?: Query): void
|
|
||||||
replaceState(state: LocationState, pathname: Pathname | Path, query?: Query): void
|
|
||||||
createPath(path: Path, query?: Query): Path
|
|
||||||
createHref(path: Path, query?: Query): Href
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// Global usage, without modules, needs the small trick, because lib.d.ts
|
|
||||||
// already has `history` and `History` global definitions:
|
|
||||||
// var createHistory = ((window as any).History as HistoryModule.Module).createHistory;
|
|
||||||
interface Module {
|
|
||||||
createHistory: CreateHistory<History>
|
|
||||||
createHashHistory: CreateHistory<History>
|
|
||||||
createMemoryHistory: CreateHistory<History>
|
|
||||||
createLocation(path?: Path, state?: LocationState, action?: Action, key?: LocationKey): Location
|
|
||||||
useBasename<T>(createHistory: CreateHistory<T>): CreateHistory<T>
|
|
||||||
useBeforeUnload<T>(createHistory: CreateHistory<T>): CreateHistory<T & HistoryBeforeUnload>
|
|
||||||
useQueries<T>(createHistory: CreateHistory<T>): CreateHistory<T & HistoryQueries>
|
|
||||||
actions: {
|
|
||||||
PUSH: string
|
|
||||||
REPLACE: string
|
|
||||||
POP: string
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
declare module "history/lib/createBrowserHistory" {
|
|
||||||
|
|
||||||
export default function createBrowserHistory(options?: HistoryModule.HistoryOptions): HistoryModule.History
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
declare module "history/lib/createHashHistory" {
|
|
||||||
|
|
||||||
export default function createHashHistory(options?: HistoryModule.HistoryOptions): HistoryModule.History
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
declare module "history/lib/createMemoryHistory" {
|
|
||||||
|
|
||||||
export default function createMemoryHistory(options?: HistoryModule.HistoryOptions): HistoryModule.History
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
declare module "history/lib/createLocation" {
|
|
||||||
|
|
||||||
export default function createLocation(path?: HistoryModule.Path, state?: HistoryModule.LocationState, action?: HistoryModule.Action, key?: HistoryModule.LocationKey): HistoryModule.Location
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
declare module "history/lib/useBasename" {
|
|
||||||
|
|
||||||
export default function useBasename<T>(createHistory: HistoryModule.CreateHistory<T>): HistoryModule.CreateHistory<T>
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
declare module "history/lib/useBeforeUnload" {
|
|
||||||
|
|
||||||
export default function useBeforeUnload<T>(createHistory: HistoryModule.CreateHistory<T>): HistoryModule.CreateHistory<T & HistoryModule.HistoryBeforeUnload>
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
declare module "history/lib/useQueries" {
|
|
||||||
|
|
||||||
export default function useQueries<T>(createHistory: HistoryModule.CreateHistory<T>): HistoryModule.CreateHistory<T & HistoryModule.HistoryQueries>
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
declare module "history/lib/actions" {
|
|
||||||
|
|
||||||
export const PUSH: string
|
|
||||||
|
|
||||||
export const REPLACE: string
|
|
||||||
|
|
||||||
export const POP: string
|
|
||||||
|
|
||||||
export default {
|
|
||||||
PUSH,
|
|
||||||
REPLACE,
|
|
||||||
POP
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
declare module "history" {
|
|
||||||
|
|
||||||
export { default as createHistory } from "history/lib/createBrowserHistory"
|
|
||||||
|
|
||||||
export { default as createHashHistory } from "history/lib/createHashHistory"
|
|
||||||
|
|
||||||
export { default as createMemoryHistory } from "history/lib/createMemoryHistory"
|
|
||||||
|
|
||||||
export { default as createLocation } from "history/lib/createLocation"
|
|
||||||
|
|
||||||
export { default as useBasename } from "history/lib/useBasename"
|
|
||||||
|
|
||||||
export { default as useBeforeUnload } from "history/lib/useBeforeUnload"
|
|
||||||
|
|
||||||
export { default as useQueries } from "history/lib/useQueries"
|
|
||||||
|
|
||||||
import * as Actions from "history/lib/actions"
|
|
||||||
|
|
||||||
export { Actions }
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,474 +0,0 @@
|
|||||||
// Type definitions for react-router v2.0.0-rc5
|
|
||||||
// Project: https://github.com/rackt/react-router
|
|
||||||
// Definitions by: Sergey Buturlakin <http://github.com/sergey-buturlakin>, Yuichi Murata <https://github.com/mrk21>, Václav Ostrožlík <https://github.com/vasek17>
|
|
||||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
|
||||||
|
|
||||||
|
|
||||||
/// <reference path="../react/react.d.ts" />
|
|
||||||
/// <reference path="./history.d.ts"/>
|
|
||||||
|
|
||||||
|
|
||||||
declare namespace ReactRouter {
|
|
||||||
|
|
||||||
import React = __React
|
|
||||||
|
|
||||||
import H = HistoryModule
|
|
||||||
|
|
||||||
// types based on https://github.com/rackt/react-router/blob/master/docs/Glossary.md
|
|
||||||
|
|
||||||
type Component = React.ReactType
|
|
||||||
|
|
||||||
type EnterHook = (nextState: RouterState, replaceState: RedirectFunction, callback?: Function) => any
|
|
||||||
|
|
||||||
type LeaveHook = () => any
|
|
||||||
|
|
||||||
type Params = Object
|
|
||||||
|
|
||||||
type ParseQueryString = (queryString: H.QueryString) => H.Query
|
|
||||||
|
|
||||||
type RedirectFunction = (state: H.LocationState, pathname: H.Pathname | H.Path, query?: H.Query) => void
|
|
||||||
|
|
||||||
type RouteComponent = Component
|
|
||||||
|
|
||||||
// use the following interface in an app code to get access to route param values, history, location...
|
|
||||||
// interface MyComponentProps extends ReactRouter.RouteComponentProps<{}, { id: number }> {}
|
|
||||||
// somewhere in MyComponent
|
|
||||||
// ...
|
|
||||||
// let id = this.props.routeParams.id
|
|
||||||
// ...
|
|
||||||
// this.props.history. ...
|
|
||||||
// ...
|
|
||||||
interface RouteComponentProps<P, R> {
|
|
||||||
history?: History
|
|
||||||
location?: H.Location
|
|
||||||
params?: P
|
|
||||||
route?: PlainRoute
|
|
||||||
routeParams?: R
|
|
||||||
routes?: PlainRoute[]
|
|
||||||
children?: React.ReactElement<any>
|
|
||||||
}
|
|
||||||
|
|
||||||
type RouteComponents = { [key: string]: RouteComponent }
|
|
||||||
|
|
||||||
type RouteConfig = React.ReactNode | PlainRoute | PlainRoute[]
|
|
||||||
|
|
||||||
type RouteHook = (nextLocation?: H.Location) => any
|
|
||||||
|
|
||||||
type RoutePattern = string
|
|
||||||
|
|
||||||
type StringifyQuery = (queryObject: H.Query) => H.QueryString
|
|
||||||
|
|
||||||
type RouterListener = (error: Error, nextState: RouterState) => void
|
|
||||||
|
|
||||||
interface RouterState {
|
|
||||||
location: H.Location
|
|
||||||
routes: PlainRoute[]
|
|
||||||
params: Params
|
|
||||||
components: RouteComponent[]
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
interface HistoryBase extends H.History {
|
|
||||||
routes: PlainRoute[]
|
|
||||||
parseQueryString?: ParseQueryString
|
|
||||||
stringifyQuery?: StringifyQuery
|
|
||||||
}
|
|
||||||
|
|
||||||
type History = HistoryBase & H.HistoryQueries & HistoryRoutes
|
|
||||||
const browserHistory: History;
|
|
||||||
const hashHistory: History;
|
|
||||||
|
|
||||||
/* components */
|
|
||||||
|
|
||||||
interface RouterProps extends React.Props<Router> {
|
|
||||||
history?: H.History
|
|
||||||
routes?: RouteConfig // alias for children
|
|
||||||
createElement?: (component: RouteComponent, props: Object) => any
|
|
||||||
onError?: (error: any) => any
|
|
||||||
onUpdate?: () => any
|
|
||||||
parseQueryString?: ParseQueryString
|
|
||||||
stringifyQuery?: StringifyQuery
|
|
||||||
}
|
|
||||||
interface Router extends React.ComponentClass<RouterProps> {}
|
|
||||||
interface RouterElement extends React.ReactElement<RouterProps> {}
|
|
||||||
const Router: Router
|
|
||||||
|
|
||||||
|
|
||||||
interface LinkProps extends React.HTMLAttributes, React.Props<Link> {
|
|
||||||
activeStyle?: React.CSSProperties
|
|
||||||
activeClassName?: string
|
|
||||||
onlyActiveOnIndex?: boolean
|
|
||||||
to: RoutePattern
|
|
||||||
query?: H.Query
|
|
||||||
state?: H.LocationState
|
|
||||||
}
|
|
||||||
interface Link extends React.ComponentClass<LinkProps> {}
|
|
||||||
interface LinkElement extends React.ReactElement<LinkProps> {}
|
|
||||||
const Link: Link
|
|
||||||
|
|
||||||
|
|
||||||
const IndexLink: Link
|
|
||||||
|
|
||||||
|
|
||||||
interface RouterContextProps extends React.Props<RouterContext> {
|
|
||||||
history?: H.History
|
|
||||||
router: Router
|
|
||||||
createElement: (component: RouteComponent, props: Object) => any
|
|
||||||
location: H.Location
|
|
||||||
routes: RouteConfig
|
|
||||||
params: Params
|
|
||||||
components?: RouteComponent[]
|
|
||||||
}
|
|
||||||
interface RouterContext extends React.ComponentClass<RouterContextProps> {}
|
|
||||||
interface RouterContextElement extends React.ReactElement<RouterContextProps> {
|
|
||||||
history?: H.History
|
|
||||||
location: H.Location
|
|
||||||
router?: Router
|
|
||||||
}
|
|
||||||
const RouterContext: RouterContext
|
|
||||||
|
|
||||||
|
|
||||||
/* components (configuration) */
|
|
||||||
|
|
||||||
interface RouteProps extends React.Props<Route> {
|
|
||||||
path?: RoutePattern
|
|
||||||
component?: RouteComponent
|
|
||||||
components?: RouteComponents
|
|
||||||
getComponent?: (location: H.Location, cb: (error: any, component?: RouteComponent) => void) => void
|
|
||||||
getComponents?: (location: H.Location, cb: (error: any, components?: RouteComponents) => void) => void
|
|
||||||
onEnter?: EnterHook
|
|
||||||
onLeave?: LeaveHook
|
|
||||||
getIndexRoute?: (location: H.Location, cb: (error: any, indexRoute: RouteConfig) => void) => void
|
|
||||||
getChildRoutes?: (location: H.Location, cb: (error: any, childRoutes: RouteConfig) => void) => void
|
|
||||||
}
|
|
||||||
interface Route extends React.ComponentClass<RouteProps> {}
|
|
||||||
interface RouteElement extends React.ReactElement<RouteProps> {}
|
|
||||||
const Route: Route
|
|
||||||
|
|
||||||
|
|
||||||
interface PlainRoute {
|
|
||||||
path?: RoutePattern
|
|
||||||
component?: RouteComponent
|
|
||||||
components?: RouteComponents
|
|
||||||
getComponent?: (location: H.Location, cb: (error: any, component?: RouteComponent) => void) => void
|
|
||||||
getComponents?: (location: H.Location, cb: (error: any, components?: RouteComponents) => void) => void
|
|
||||||
onEnter?: EnterHook
|
|
||||||
onLeave?: LeaveHook
|
|
||||||
indexRoute?: PlainRoute
|
|
||||||
getIndexRoute?: (location: H.Location, cb: (error: any, indexRoute: RouteConfig) => void) => void
|
|
||||||
childRoutes?: PlainRoute[]
|
|
||||||
getChildRoutes?: (location: H.Location, cb: (error: any, childRoutes: RouteConfig) => void) => void
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
interface RedirectProps extends React.Props<Redirect> {
|
|
||||||
path?: RoutePattern
|
|
||||||
from?: RoutePattern // alias for path
|
|
||||||
to: RoutePattern
|
|
||||||
query?: H.Query
|
|
||||||
state?: H.LocationState
|
|
||||||
}
|
|
||||||
interface Redirect extends React.ComponentClass<RedirectProps> {}
|
|
||||||
interface RedirectElement extends React.ReactElement<RedirectProps> {}
|
|
||||||
const Redirect: Redirect
|
|
||||||
|
|
||||||
|
|
||||||
interface IndexRouteProps extends React.Props<IndexRoute> {
|
|
||||||
component?: RouteComponent
|
|
||||||
components?: RouteComponents
|
|
||||||
getComponent?: (location: H.Location, cb: (error: any, component?: RouteComponent) => void) => void
|
|
||||||
getComponents?: (location: H.Location, cb: (error: any, components?: RouteComponents) => void) => void
|
|
||||||
onEnter?: EnterHook
|
|
||||||
onLeave?: LeaveHook
|
|
||||||
}
|
|
||||||
interface IndexRoute extends React.ComponentClass<IndexRouteProps> {}
|
|
||||||
interface IndexRouteElement extends React.ReactElement<IndexRouteProps> {}
|
|
||||||
const IndexRoute: IndexRoute
|
|
||||||
|
|
||||||
|
|
||||||
interface IndexRedirectProps extends React.Props<IndexRedirect> {
|
|
||||||
to: RoutePattern
|
|
||||||
query?: H.Query
|
|
||||||
state?: H.LocationState
|
|
||||||
}
|
|
||||||
interface IndexRedirect extends React.ComponentClass<IndexRedirectProps> {}
|
|
||||||
interface IndexRedirectElement extends React.ReactElement<IndexRedirectProps> {}
|
|
||||||
const IndexRedirect: IndexRedirect
|
|
||||||
|
|
||||||
|
|
||||||
/* mixins */
|
|
||||||
|
|
||||||
interface HistoryMixin {
|
|
||||||
history: History
|
|
||||||
}
|
|
||||||
const History: React.Mixin<any, any>
|
|
||||||
|
|
||||||
|
|
||||||
interface LifecycleMixin {
|
|
||||||
routerWillLeave(nextLocation: H.Location): string | boolean
|
|
||||||
}
|
|
||||||
const Lifecycle: React.Mixin<any, any>
|
|
||||||
|
|
||||||
|
|
||||||
const RouteContext: React.Mixin<any, any>
|
|
||||||
|
|
||||||
|
|
||||||
/* utils */
|
|
||||||
|
|
||||||
interface HistoryRoutes {
|
|
||||||
listen(listener: RouterListener): Function
|
|
||||||
listenBeforeLeavingRoute(route: PlainRoute, hook: RouteHook): void
|
|
||||||
match(location: H.Location, callback: (error: any, nextState: RouterState, nextLocation: H.Location) => void): void
|
|
||||||
isActive(pathname: H.Pathname, query?: H.Query, indexOnly?: boolean): boolean
|
|
||||||
}
|
|
||||||
|
|
||||||
function useRoutes<T>(createHistory: HistoryModule.CreateHistory<T>): HistoryModule.CreateHistory<T & HistoryRoutes>
|
|
||||||
|
|
||||||
|
|
||||||
function createRoutes(routes: RouteConfig): PlainRoute[]
|
|
||||||
|
|
||||||
|
|
||||||
interface MatchArgs {
|
|
||||||
routes?: RouteConfig
|
|
||||||
history?: H.History
|
|
||||||
location?: H.Location
|
|
||||||
parseQueryString?: ParseQueryString
|
|
||||||
stringifyQuery?: StringifyQuery
|
|
||||||
}
|
|
||||||
interface MatchState extends RouterState {
|
|
||||||
history: History
|
|
||||||
}
|
|
||||||
function match(args: MatchArgs, cb: (error: any, nextLocation: H.Location, nextState: MatchState) => void): void
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
declare module "react-router/lib/Router" {
|
|
||||||
|
|
||||||
export default ReactRouter.Router
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
declare module "react-router/lib/Link" {
|
|
||||||
|
|
||||||
export default ReactRouter.Link
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
declare module "react-router/lib/IndexLink" {
|
|
||||||
|
|
||||||
export default ReactRouter.IndexLink
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
declare module "react-router/lib/IndexRedirect" {
|
|
||||||
|
|
||||||
export default ReactRouter.IndexRedirect
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
declare module "react-router/lib/IndexRoute" {
|
|
||||||
|
|
||||||
export default ReactRouter.IndexRoute
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
declare module "react-router/lib/Redirect" {
|
|
||||||
|
|
||||||
export default ReactRouter.Redirect
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
declare module "react-router/lib/Route" {
|
|
||||||
|
|
||||||
export default ReactRouter.Route
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
declare module "react-router/lib/History" {
|
|
||||||
|
|
||||||
export default ReactRouter.History
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
declare module "react-router/lib/Lifecycle" {
|
|
||||||
|
|
||||||
export default ReactRouter.Lifecycle
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
declare module "react-router/lib/RouteContext" {
|
|
||||||
|
|
||||||
export default ReactRouter.RouteContext
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
declare module "react-router/lib/useRoutes" {
|
|
||||||
|
|
||||||
export default ReactRouter.useRoutes
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
declare module "react-router/lib/PatternUtils" {
|
|
||||||
|
|
||||||
export function formatPattern(pattern: string, params: {}): string;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
declare module "react-router/lib/RouteUtils" {
|
|
||||||
|
|
||||||
type E = __React.ReactElement<any>
|
|
||||||
|
|
||||||
export function isReactChildren(object: E | E[]): boolean
|
|
||||||
|
|
||||||
export function createRouteFromReactElement(element: E): ReactRouter.PlainRoute
|
|
||||||
|
|
||||||
export function createRoutesFromReactChildren(children: E | E[], parentRoute: ReactRouter.PlainRoute): ReactRouter.PlainRoute[]
|
|
||||||
|
|
||||||
export import createRoutes = ReactRouter.createRoutes
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
declare module "react-router/lib/RouterContext" {
|
|
||||||
|
|
||||||
export default ReactRouter.RouterContext
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
declare module "react-router/lib/PropTypes" {
|
|
||||||
|
|
||||||
import React = __React
|
|
||||||
|
|
||||||
export function falsy(props: any, propName: string, componentName: string): Error;
|
|
||||||
|
|
||||||
export const history: React.Requireable<any>
|
|
||||||
|
|
||||||
export const location: React.Requireable<any>
|
|
||||||
|
|
||||||
export const component: React.Requireable<any>
|
|
||||||
|
|
||||||
export const components: React.Requireable<any>
|
|
||||||
|
|
||||||
export const route: React.Requireable<any>
|
|
||||||
|
|
||||||
export const routes: React.Requireable<any>
|
|
||||||
|
|
||||||
export default {
|
|
||||||
falsy,
|
|
||||||
history,
|
|
||||||
location,
|
|
||||||
component,
|
|
||||||
components,
|
|
||||||
route
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
declare module "react-router/lib/browserHistory" {
|
|
||||||
export default ReactRouter.browserHistory;
|
|
||||||
}
|
|
||||||
|
|
||||||
declare module "react-router/lib/hashHistory" {
|
|
||||||
export default ReactRouter.hashHistory;
|
|
||||||
}
|
|
||||||
|
|
||||||
declare module "react-router/lib/match" {
|
|
||||||
|
|
||||||
export default ReactRouter.match
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
declare module "react-router" {
|
|
||||||
|
|
||||||
import Router from "react-router/lib/Router"
|
|
||||||
|
|
||||||
import Link from "react-router/lib/Link"
|
|
||||||
|
|
||||||
import IndexLink from "react-router/lib/IndexLink"
|
|
||||||
|
|
||||||
import IndexRedirect from "react-router/lib/IndexRedirect"
|
|
||||||
|
|
||||||
import IndexRoute from "react-router/lib/IndexRoute"
|
|
||||||
|
|
||||||
import Redirect from "react-router/lib/Redirect"
|
|
||||||
|
|
||||||
import Route from "react-router/lib/Route"
|
|
||||||
|
|
||||||
import History from "react-router/lib/History"
|
|
||||||
|
|
||||||
import Lifecycle from "react-router/lib/Lifecycle"
|
|
||||||
|
|
||||||
import RouteContext from "react-router/lib/RouteContext"
|
|
||||||
|
|
||||||
import browserHistory from "react-router/lib/browserHistory"
|
|
||||||
|
|
||||||
import hashHistory from "react-router/lib/hashHistory"
|
|
||||||
|
|
||||||
import useRoutes from "react-router/lib/useRoutes"
|
|
||||||
|
|
||||||
import { createRoutes } from "react-router/lib/RouteUtils"
|
|
||||||
|
|
||||||
import { formatPattern } from "react-router/lib/PatternUtils"
|
|
||||||
|
|
||||||
import RouterContext from "react-router/lib/RouterContext"
|
|
||||||
|
|
||||||
import PropTypes from "react-router/lib/PropTypes"
|
|
||||||
|
|
||||||
import match from "react-router/lib/match"
|
|
||||||
|
|
||||||
// PlainRoute is defined in the API documented at:
|
|
||||||
// https://github.com/rackt/react-router/blob/master/docs/API.md
|
|
||||||
// but not included in any of the .../lib modules above.
|
|
||||||
export type PlainRoute = ReactRouter.PlainRoute
|
|
||||||
|
|
||||||
// The following definitions are also very useful to export
|
|
||||||
// because by using these types lots of potential type errors
|
|
||||||
// can be exposed:
|
|
||||||
export type EnterHook = ReactRouter.EnterHook
|
|
||||||
export type LeaveHook = ReactRouter.LeaveHook
|
|
||||||
export type ParseQueryString = ReactRouter.ParseQueryString
|
|
||||||
export type RedirectFunction = ReactRouter.RedirectFunction
|
|
||||||
export type RouteComponentProps<P,R> = ReactRouter.RouteComponentProps<P,R>;
|
|
||||||
export type RouteHook = ReactRouter.RouteHook
|
|
||||||
export type StringifyQuery = ReactRouter.StringifyQuery
|
|
||||||
export type RouterListener = ReactRouter.RouterListener
|
|
||||||
export type RouterState = ReactRouter.RouterState
|
|
||||||
export type HistoryBase = ReactRouter.HistoryBase
|
|
||||||
|
|
||||||
export {
|
|
||||||
Router,
|
|
||||||
Link,
|
|
||||||
IndexLink,
|
|
||||||
IndexRedirect,
|
|
||||||
IndexRoute,
|
|
||||||
Redirect,
|
|
||||||
Route,
|
|
||||||
History,
|
|
||||||
browserHistory,
|
|
||||||
hashHistory,
|
|
||||||
Lifecycle,
|
|
||||||
RouteContext,
|
|
||||||
useRoutes,
|
|
||||||
createRoutes,
|
|
||||||
formatPattern,
|
|
||||||
RouterContext,
|
|
||||||
PropTypes,
|
|
||||||
match
|
|
||||||
}
|
|
||||||
|
|
||||||
export default Router
|
|
||||||
|
|
||||||
}
|
|
||||||
66
templates/ReactSpa/typings/react/react-dom.d.ts
vendored
66
templates/ReactSpa/typings/react/react-dom.d.ts
vendored
@@ -1,66 +0,0 @@
|
|||||||
// Type definitions for React v0.14 (react-dom)
|
|
||||||
// Project: http://facebook.github.io/react/
|
|
||||||
// Definitions by: Asana <https://asana.com>, AssureSign <http://www.assuresign.com>, Microsoft <https://microsoft.com>
|
|
||||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
|
||||||
|
|
||||||
/// <reference path="react.d.ts" />
|
|
||||||
|
|
||||||
declare namespace __React {
|
|
||||||
namespace __DOM {
|
|
||||||
function findDOMNode<E extends Element>(instance: ReactInstance): E;
|
|
||||||
function findDOMNode(instance: ReactInstance): Element;
|
|
||||||
|
|
||||||
function render<P>(
|
|
||||||
element: DOMElement<P>,
|
|
||||||
container: Element,
|
|
||||||
callback?: (element: Element) => any): Element;
|
|
||||||
function render<P, S>(
|
|
||||||
element: ClassicElement<P>,
|
|
||||||
container: Element,
|
|
||||||
callback?: (component: ClassicComponent<P, S>) => any): ClassicComponent<P, S>;
|
|
||||||
function render<P, S>(
|
|
||||||
element: ReactElement<P>,
|
|
||||||
container: Element,
|
|
||||||
callback?: (component: Component<P, S>) => any): Component<P, S>;
|
|
||||||
|
|
||||||
function unmountComponentAtNode(container: Element): boolean;
|
|
||||||
|
|
||||||
var version: string;
|
|
||||||
|
|
||||||
function unstable_batchedUpdates<A, B>(callback: (a: A, b: B) => any, a: A, b: B): void;
|
|
||||||
function unstable_batchedUpdates<A>(callback: (a: A) => any, a: A): void;
|
|
||||||
function unstable_batchedUpdates(callback: () => any): void;
|
|
||||||
|
|
||||||
function unstable_renderSubtreeIntoContainer<P>(
|
|
||||||
parentComponent: Component<any, any>,
|
|
||||||
nextElement: DOMElement<P>,
|
|
||||||
container: Element,
|
|
||||||
callback?: (element: Element) => any): Element;
|
|
||||||
function unstable_renderSubtreeIntoContainer<P, S>(
|
|
||||||
parentComponent: Component<any, any>,
|
|
||||||
nextElement: ClassicElement<P>,
|
|
||||||
container: Element,
|
|
||||||
callback?: (component: ClassicComponent<P, S>) => any): ClassicComponent<P, S>;
|
|
||||||
function unstable_renderSubtreeIntoContainer<P, S>(
|
|
||||||
parentComponent: Component<any, any>,
|
|
||||||
nextElement: ReactElement<P>,
|
|
||||||
container: Element,
|
|
||||||
callback?: (component: Component<P, S>) => any): Component<P, S>;
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace __DOMServer {
|
|
||||||
function renderToString(element: ReactElement<any>): string;
|
|
||||||
function renderToStaticMarkup(element: ReactElement<any>): string;
|
|
||||||
var version: string;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
declare module "react-dom" {
|
|
||||||
import DOM = __React.__DOM;
|
|
||||||
export = DOM;
|
|
||||||
}
|
|
||||||
|
|
||||||
declare module "react-dom/server" {
|
|
||||||
import DOMServer = __React.__DOMServer;
|
|
||||||
export = DOMServer;
|
|
||||||
}
|
|
||||||
2281
templates/ReactSpa/typings/react/react.d.ts
vendored
2281
templates/ReactSpa/typings/react/react.d.ts
vendored
File diff suppressed because it is too large
Load Diff
6
templates/ReactSpa/typings/tsd.d.ts
vendored
6
templates/ReactSpa/typings/tsd.d.ts
vendored
@@ -1,6 +0,0 @@
|
|||||||
|
|
||||||
/// <reference path="react/react.d.ts" />
|
|
||||||
/// <reference path="react-router/history.d.ts" />
|
|
||||||
/// <reference path="react-router/react-router.d.ts" />
|
|
||||||
/// <reference path="react/react-dom.d.ts" />
|
|
||||||
/// <reference path="isomorphic-fetch/isomorphic-fetch.d.ts" />
|
|
||||||
@@ -2,7 +2,7 @@
|
|||||||
"name": "WebApplicationBasic",
|
"name": "WebApplicationBasic",
|
||||||
"version": "0.0.0",
|
"version": "0.0.0",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"bootstrap": "^3.3.6",
|
"bootstrap": "^3.3.7",
|
||||||
"css-loader": "^0.23.1",
|
"css-loader": "^0.23.1",
|
||||||
"event-source-polyfill": "^0.0.7",
|
"event-source-polyfill": "^0.0.7",
|
||||||
"extendify": "^1.0.0",
|
"extendify": "^1.0.0",
|
||||||
@@ -11,8 +11,8 @@
|
|||||||
"jquery": "^2.2.1",
|
"jquery": "^2.2.1",
|
||||||
"style-loader": "^0.13.0",
|
"style-loader": "^0.13.0",
|
||||||
"ts-loader": "^0.8.1",
|
"ts-loader": "^0.8.1",
|
||||||
"typescript": "^1.8.2",
|
"typescript": "^2.0.3",
|
||||||
"url-loader": "^0.5.7",
|
"url-loader": "^0.5.7",
|
||||||
"webpack": "^1.12.14"
|
"webpack": "^1.13.2"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
"moduleResolution": "node",
|
"moduleResolution": "node",
|
||||||
"target": "es5",
|
"target": "es5",
|
||||||
"sourceMap": true,
|
"sourceMap": true,
|
||||||
|
"lib": ["es6", "dom"],
|
||||||
"skipDefaultLibCheck": true
|
"skipDefaultLibCheck": true
|
||||||
},
|
},
|
||||||
"exclude": [
|
"exclude": [
|
||||||
|
|||||||
Reference in New Issue
Block a user