mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-07-04 09:10:09 +00:00
Merge branch 'master' of https://github.com/DefinitelyTyped/DefinitelyTyped
Merge branch 'master' of DefinitelyTyped
This commit is contained in:
@@ -67,3 +67,6 @@ acorn.getLineInfo('string', 56);
|
||||
|
||||
acorn.plugins['test'] = function (p: acorn.Parser, config: any) {
|
||||
}
|
||||
|
||||
acorn.tokenizer('console.log("hello world)', {locations: true}).getToken();
|
||||
acorn.tokenizer('console.log("hello world)', {locations: true})[Symbol.iterator]().next();
|
||||
|
||||
9
acorn/index.d.ts
vendored
9
acorn/index.d.ts
vendored
@@ -238,9 +238,12 @@ declare namespace acorn {
|
||||
|
||||
function parseExpressionAt(input: string, pos?: number, options?: Options): ESTree.Expression;
|
||||
|
||||
// todo: here the tokenizer function returns a Parser instance, that is targeting the detail of
|
||||
// Parser prototype. Someone need this please reade README.md first.
|
||||
// function tokenizer(options: Options, input: string): Parser;
|
||||
interface ITokenizer {
|
||||
getToken() : Token,
|
||||
[Symbol.iterator](): Iterator<Token>
|
||||
}
|
||||
|
||||
function tokenizer(input: string, options: Options): ITokenizer;
|
||||
|
||||
let parse_dammit: IParse | undefined;
|
||||
let LooseParser: ILooseParserClass | undefined;
|
||||
|
||||
10
angular-oauth2/angular-oauth2-tests.ts
Normal file
10
angular-oauth2/angular-oauth2-tests.ts
Normal file
@@ -0,0 +1,10 @@
|
||||
import * as angular from 'angular';
|
||||
|
||||
angular.module('angular-oauth2-test', ['angular-oauth2'])
|
||||
.config(['OAuthProvider', function(OAuthProvider:angular.oauth2.OAuthProvider){
|
||||
OAuthProvider.configure({
|
||||
baseUrl: 'https://api.website.com',
|
||||
clientId: 'CLIENT_ID',
|
||||
clientSecret: 'CLIENT_SECRET' // optional
|
||||
});
|
||||
}]);
|
||||
49
angular-oauth2/index.d.ts
vendored
Normal file
49
angular-oauth2/index.d.ts
vendored
Normal file
@@ -0,0 +1,49 @@
|
||||
// Type definitions for angular-oauth2 4.1
|
||||
// Project: https://github.com/oauthjs/angular-oauth2
|
||||
// Definitions by: Antério Vieira <https://github.com/anteriovieira>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
import * as angular from 'angular';
|
||||
|
||||
declare module 'angular' {
|
||||
export namespace oauth2 {
|
||||
interface OAuthConfig {
|
||||
baseUrl: string;
|
||||
clientId: string;
|
||||
clientSecret?: string;
|
||||
grantPath?: string;
|
||||
revokePath?: string;
|
||||
}
|
||||
|
||||
interface OAuthProvider {
|
||||
configure(params: OAuthConfig): OAuthConfig;
|
||||
}
|
||||
|
||||
interface Data {
|
||||
username: string;
|
||||
password: string;
|
||||
}
|
||||
|
||||
interface OAuth {
|
||||
isAuthenticated(): boolean;
|
||||
getAccessToken(data: Data, options?: any): angular.IPromise<string>;
|
||||
getRefreshToken(data?: Data, options?: any): angular.IPromise<string>;
|
||||
revokeToken(data?: Data, options?: any): angular.IPromise<string>;
|
||||
}
|
||||
|
||||
interface OAuthTokenConfig {
|
||||
name: string;
|
||||
options: any;
|
||||
}
|
||||
|
||||
interface OAuthTokenOptions {
|
||||
secure: boolean;
|
||||
}
|
||||
|
||||
interface OAuthTokenProvider {
|
||||
configure(params: OAuthTokenConfig): OAuthTokenConfig;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
20
angular-oauth2/tsconfig.json
Normal file
20
angular-oauth2/tsconfig.json
Normal file
@@ -0,0 +1,20 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"target": "es6",
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"angular-oauth2-tests.ts"
|
||||
]
|
||||
}
|
||||
1
angular-oauth2/tslint.json
Normal file
1
angular-oauth2/tslint.json
Normal file
@@ -0,0 +1 @@
|
||||
{ "extends": "../tslint.json" }
|
||||
@@ -1,4 +1,4 @@
|
||||
import 'auth0-js';
|
||||
import * as auth0 from 'auth0-js';
|
||||
|
||||
let webAuth = new auth0.WebAuth({
|
||||
domain: 'mine.auth0.com',
|
||||
|
||||
871
auth0-js/index.d.ts
vendored
871
auth0-js/index.d.ts
vendored
@@ -3,454 +3,453 @@
|
||||
// Definitions by: Adrian Chia <https://github.com/adrianchia>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
declare namespace auth0 {
|
||||
export as namespace auth0;
|
||||
|
||||
export class Authentication {
|
||||
constructor(options: AuthOptions);
|
||||
|
||||
passwordless: PasswordlessAuthentication;
|
||||
dbConnection: DBConnection;
|
||||
export class Authentication {
|
||||
constructor(options: AuthOptions);
|
||||
|
||||
/**
|
||||
* Builds and returns the `/authorize` url in order to initialize a new authN/authZ transaction
|
||||
*
|
||||
* @method buildAuthorizeUrl
|
||||
* @param {Object} options: https://auth0.com/docs/api/authentication#!#get--authorize_db
|
||||
*/
|
||||
buildAuthorizeUrl(options: any): string;
|
||||
passwordless: PasswordlessAuthentication;
|
||||
dbConnection: DBConnection;
|
||||
|
||||
/**
|
||||
* Builds and returns the Logout url in order to initialize a new authN/authZ transaction
|
||||
*
|
||||
* @method buildLogoutUrl
|
||||
* @param {Object} options: https://auth0.com/docs/api/authentication#!#get--v2-logout
|
||||
*/
|
||||
buildLogoutUrl(options?: any): string;
|
||||
/**
|
||||
* Builds and returns the `/authorize` url in order to initialize a new authN/authZ transaction
|
||||
*
|
||||
* @method buildAuthorizeUrl
|
||||
* @param {Object} options: https://auth0.com/docs/api/authentication#!#get--authorize_db
|
||||
*/
|
||||
buildAuthorizeUrl(options: any): string;
|
||||
|
||||
/**
|
||||
* Makes a call to the `oauth/token` endpoint with `password` grant type
|
||||
*
|
||||
* @method loginWithDefaultDirectory
|
||||
* @param {Object} options: https://auth0.com/docs/api-auth/grant/password
|
||||
* @param {Function} callback
|
||||
*/
|
||||
loginWithDefaultDirectory(options: any, callback: (error?: Auth0Error, authResult?: any) => any): void;
|
||||
/**
|
||||
* Builds and returns the Logout url in order to initialize a new authN/authZ transaction
|
||||
*
|
||||
* @method buildLogoutUrl
|
||||
* @param {Object} options: https://auth0.com/docs/api/authentication#!#get--v2-logout
|
||||
*/
|
||||
buildLogoutUrl(options?: any): string;
|
||||
|
||||
/**
|
||||
* Makes a call to the `/ro` endpoint
|
||||
* @param {any} options
|
||||
* @param {Function} callback
|
||||
* @deprecated `loginWithResourceOwner` will be soon deprecated, user `login` instead.
|
||||
*/
|
||||
loginWithResourceOwner(options: any, callback: (error?: Auth0Error, authResult?: any) => any): void;
|
||||
/**
|
||||
* Makes a call to the `oauth/token` endpoint with `password` grant type
|
||||
*
|
||||
* @method loginWithDefaultDirectory
|
||||
* @param {Object} options: https://auth0.com/docs/api-auth/grant/password
|
||||
* @param {Function} callback
|
||||
*/
|
||||
loginWithDefaultDirectory(options: any, callback: (error?: Auth0Error, authResult?: any) => any): void;
|
||||
|
||||
/**
|
||||
* Makes a call to the `oauth/token` endpoint with `password-realm` grant type
|
||||
* @param {any} options
|
||||
* @param {Function} callback
|
||||
*/
|
||||
login(options: any, callback: (error?: Auth0Error, authResult?: any) => any): void;
|
||||
/**
|
||||
* Makes a call to the `/ro` endpoint
|
||||
* @param {any} options
|
||||
* @param {Function} callback
|
||||
* @deprecated `loginWithResourceOwner` will be soon deprecated, user `login` instead.
|
||||
*/
|
||||
loginWithResourceOwner(options: any, callback: (error?: Auth0Error, authResult?: any) => any): void;
|
||||
|
||||
/**
|
||||
* Makes a call to the `oauth/token` endpoint
|
||||
* @param {any} options
|
||||
* @param {Function} callback
|
||||
*/
|
||||
oauthToken(options: any, callback: (error?: Auth0Error, authResult?: any) => any): void;
|
||||
/**
|
||||
* Makes a call to the `oauth/token` endpoint with `password-realm` grant type
|
||||
* @param {any} options
|
||||
* @param {Function} callback
|
||||
*/
|
||||
login(options: any, callback: (error?: Auth0Error, authResult?: any) => any): void;
|
||||
|
||||
/**
|
||||
* Makes a call to the `/ssodata` endpoint
|
||||
*
|
||||
* @method getSSOData
|
||||
* @param {Boolean} withActiveDirectories
|
||||
* @param {Function} callback
|
||||
* @deprecated `getSSOData` will be soon deprecated.
|
||||
*/
|
||||
getSSOData(callback?: (error?: Auth0Error, authResult?: any) => any): void;
|
||||
/**
|
||||
* Makes a call to the `oauth/token` endpoint
|
||||
* @param {any} options
|
||||
* @param {Function} callback
|
||||
*/
|
||||
oauthToken(options: any, callback: (error?: Auth0Error, authResult?: any) => any): void;
|
||||
|
||||
/**
|
||||
* Makes a call to the `/ssodata` endpoint
|
||||
*
|
||||
* @method getSSOData
|
||||
* @param {Boolean} withActiveDirectories
|
||||
* @param {Function} callback
|
||||
* @deprecated `getSSOData` will be soon deprecated.
|
||||
*/
|
||||
getSSOData(withActiveDirectories: boolean, callback?: (error?: Auth0Error, authResult?: any) => any): void;
|
||||
/**
|
||||
* Makes a call to the `/ssodata` endpoint
|
||||
*
|
||||
* @method getSSOData
|
||||
* @param {Boolean} withActiveDirectories
|
||||
* @param {Function} callback
|
||||
* @deprecated `getSSOData` will be soon deprecated.
|
||||
*/
|
||||
getSSOData(callback?: (error?: Auth0Error, authResult?: any) => any): void;
|
||||
|
||||
/**
|
||||
* Makes a call to the `/userinfo` endpoint and returns the user profile
|
||||
*
|
||||
* @method userInfo
|
||||
* @param {String} accessToken
|
||||
* @param {Function} callback
|
||||
*/
|
||||
userInfo(token: string, callback: (error?: Auth0Error, user?: any) => any): void;
|
||||
/**
|
||||
* Makes a call to the `/ssodata` endpoint
|
||||
*
|
||||
* @method getSSOData
|
||||
* @param {Boolean} withActiveDirectories
|
||||
* @param {Function} callback
|
||||
* @deprecated `getSSOData` will be soon deprecated.
|
||||
*/
|
||||
getSSOData(withActiveDirectories: boolean, callback?: (error?: Auth0Error, authResult?: any) => any): void;
|
||||
|
||||
/**
|
||||
* Makes a call to the `/delegation` endpoint
|
||||
*
|
||||
* @method delegation
|
||||
* @param {Object} options: https://auth0.com/docs/api/authentication#!#post--delegation
|
||||
* @param {Function} callback
|
||||
* @deprecated `delegation` will be soon deprecated.
|
||||
*/
|
||||
delegation(options: any, callback: (error?: Auth0Error, authResult?: Auth0DelegationToken) => any): any;
|
||||
/**
|
||||
* Makes a call to the `/userinfo` endpoint and returns the user profile
|
||||
*
|
||||
* @method userInfo
|
||||
* @param {String} accessToken
|
||||
* @param {Function} callback
|
||||
*/
|
||||
userInfo(token: string, callback: (error?: Auth0Error, user?: any) => any): void;
|
||||
|
||||
/**
|
||||
* Fetches the user country based on the ip.
|
||||
*
|
||||
* @method getUserCountry
|
||||
* @param {Function} callback
|
||||
*/
|
||||
getUserCountry(callback: (error?: Auth0Error, result?: any) => any): void;
|
||||
}
|
||||
|
||||
export class PasswordlessAuthentication {
|
||||
constructor(request: any, option: any);
|
||||
|
||||
/**
|
||||
* Builds and returns the passwordless TOTP verify url in order to initialize a new authN/authZ transaction
|
||||
*
|
||||
* @method buildVerifyUrl
|
||||
* @param {Object} options
|
||||
* @param {Function} callback
|
||||
*/
|
||||
buildVerifyUrl(options: any): string;
|
||||
|
||||
/**
|
||||
* Initializes a new passwordless authN/authZ transaction
|
||||
*
|
||||
* @method start
|
||||
* @param {Object} options: https://auth0.com/docs/api/authentication#passwordless
|
||||
* @param {Function} callback
|
||||
*/
|
||||
start(options: PasswordlessStartOptions, callback: any): void;
|
||||
|
||||
/**
|
||||
* Verifies the passwordless TOTP and returns an error if any.
|
||||
*
|
||||
* @method buildVerifyUrl
|
||||
* @param {Object} options
|
||||
* @param {Function} callback
|
||||
*/
|
||||
verify(options: any, callback: any): void;
|
||||
}
|
||||
|
||||
export class DBConnection {
|
||||
constructor(request: any, option: any);
|
||||
|
||||
/**
|
||||
* Signup a new user
|
||||
*
|
||||
* @method signup
|
||||
* @param {Object} options: https://auth0.com/docs/api/authentication#!#post--dbconnections-signup
|
||||
* @param {Function} calback
|
||||
*/
|
||||
signup(options: any, callback: any): void;
|
||||
|
||||
/**
|
||||
* Initializes the change password flow
|
||||
*
|
||||
* @method signup
|
||||
* @param {Object} options: https://auth0.com/docs/api/authentication#!#post--dbconnections-change_password
|
||||
* @param {Function} callback
|
||||
*/
|
||||
changePassword(options: ChangePasswordOptions, callback: any): void;
|
||||
}
|
||||
|
||||
export class Management {
|
||||
constructor(options: ManagementOptions);
|
||||
|
||||
/**
|
||||
* Returns the user profile. https://auth0.com/docs/api/management/v2#!/Users/get_users_by_id
|
||||
*
|
||||
* @method getUser
|
||||
* @param {String} userId
|
||||
* @param {Function} callback
|
||||
*/
|
||||
getUser(userId: string, callback: (error?: Auth0Error, user?: any) => any): void;
|
||||
|
||||
/**
|
||||
* Updates the user metdata. It will patch the user metdata with the attributes sent.
|
||||
* https://auth0.com/docs/api/management/v2#!/Users/patch_users_by_id
|
||||
*
|
||||
* @method patchUserMetadata
|
||||
* @param {String} userId
|
||||
* @param {Object} userMetadata
|
||||
* @param {Function} callback
|
||||
*/
|
||||
patchUserMetadata(userId: string, userMetadata: any, callback: (error?: Auth0Error, user?: any) => any): void;
|
||||
|
||||
/**
|
||||
* Link two users. https://auth0.com/docs/api/management/v2#!/Users/post_identities
|
||||
*
|
||||
* @method linkUser
|
||||
* @param {String} userId
|
||||
* @param {String} secondaryUserToken
|
||||
* @param {Function} callback
|
||||
*/
|
||||
linkUser(userId: string, secondaryUserToken: string, callback: (error?: Auth0Error, user?: any) => any): void;
|
||||
}
|
||||
|
||||
export class WebAuth {
|
||||
constructor(options: AuthOptions);
|
||||
client: Authentication;
|
||||
popup: Popup;
|
||||
redirect: Redirect;
|
||||
|
||||
/**
|
||||
* Redirects to the hosted login page (`/authorize`) in order to initialize a new authN/authZ transaction
|
||||
*
|
||||
* @method authorize
|
||||
* @param {Object} options: https://auth0.com/docs/api/authentication#!#get--authorize_db
|
||||
*/
|
||||
authorize(options: any): void;
|
||||
|
||||
/**
|
||||
* Parse the url hash and extract the returned tokens depending on the transaction.
|
||||
*
|
||||
* Only validates id_tokens signed by Auth0 using the RS256 algorithm using the public key exposed
|
||||
* by the `/.well-known/jwks.json` endpoint. Id tokens signed with other algorithms will not be
|
||||
* accepted.
|
||||
*
|
||||
* @method parseHash
|
||||
* @param {Object} options:
|
||||
* @param {String} options.state [OPTIONAL] to verify the response
|
||||
* @param {String} options.nonce [OPTIONAL] to verify the id_token
|
||||
* @param {String} options.hash [OPTIONAL] the url hash. If not provided it will extract from window.location.hash
|
||||
* @param {Function} callback: any(err, token_payload)
|
||||
*/
|
||||
parseHash(options: any, callback: (error?: Auth0Error, authResult?: any) => any): void;
|
||||
|
||||
/**
|
||||
* Decodes the id_token and verifies the nonce.
|
||||
*
|
||||
* @method validateToken
|
||||
* @param {String} token
|
||||
* @param {String} state
|
||||
* @param {String} nonce
|
||||
* @param {Function} callback: function(err, {payload, transaction})
|
||||
*/
|
||||
validateToken(token: string, state: string, nonce: string, callback: any): void;
|
||||
|
||||
/**
|
||||
* Executes a silent authentication transaction under the hood in order to fetch a new token.
|
||||
*
|
||||
* @method renewAuth
|
||||
* @param {Object} options: any valid oauth2 parameter to be sent to the `/authorize` endpoint
|
||||
* @param {Function} callback
|
||||
*/
|
||||
renewAuth(options: any, callback: (error?: Auth0Error, authResult?: any) => any): void;
|
||||
|
||||
/**
|
||||
* Initialices a change password transaction
|
||||
*
|
||||
* @method changePassword
|
||||
* @param {Object} options: https://auth0.com/docs/api/authentication#!#post--dbconnections-change_password
|
||||
* @param {Function} callback
|
||||
*/
|
||||
changePassword(options: any, callback: (error?: Auth0Error, authResult?: any) => any): void;
|
||||
|
||||
/**
|
||||
* Signs up a new user
|
||||
*
|
||||
* @method signup
|
||||
* @param {Object} options: https://auth0.com/docs/api/authentication#!#post--dbconnections-signup
|
||||
* @param {Function} callback
|
||||
*/
|
||||
signup(options: any, callback: any): void;
|
||||
|
||||
/**
|
||||
* Signs up a new user, automatically logs the user in after the signup and returns the user token.
|
||||
* The login will be done using /oauth/token with password-realm grant type.
|
||||
*
|
||||
* @method signupAndAuthorize
|
||||
* @param {Object} options: https://auth0.com/docs/api/authentication#!#post--dbconnections-signup
|
||||
* @param {Function} callback
|
||||
*/
|
||||
signupAndAuthorize(options: any, callback: (error?: Auth0Error, authResult?: any) => any): void;
|
||||
|
||||
/**
|
||||
* Redirects to the auth0 logout page
|
||||
*
|
||||
* @method logout
|
||||
* @param {Object} options: https://auth0.com/docs/api/authentication#!#get--v2-logout
|
||||
*/
|
||||
logout(options: any): void;
|
||||
|
||||
passwordlessStart(options: PasswordlessStartOptions, callback: (error?: Auth0Error, data?: any) => any): void;
|
||||
|
||||
/**
|
||||
* Verifies the passwordless TOTP and redirects to finish the passwordless transaction
|
||||
*
|
||||
* @method passwordlessVerify
|
||||
* @param {Object} options:
|
||||
* @param {Object} options.type: `sms` or `email`
|
||||
* @param {Object} options.phoneNumber: only if type = sms
|
||||
* @param {Object} options.email: only if type = email
|
||||
* @param {Object} options.connection: the connection name
|
||||
* @param {Object} options.verificationCode: the TOTP code
|
||||
* @param {Function} callback
|
||||
*/
|
||||
passwordlessVerify(options: any, callback: any): void;
|
||||
}
|
||||
|
||||
export class Redirect {
|
||||
constructor(client: any, options: any);
|
||||
|
||||
/**
|
||||
* Initializes the legacy Lock login flow in a popup
|
||||
*
|
||||
* @method loginWithCredentials
|
||||
* @param {Object} options
|
||||
* @param {Function} callback
|
||||
* @deprecated `webauth.popup.loginWithCredentials` will be soon deprecated, use `webauth.client.login` instead.
|
||||
*/
|
||||
loginWithCredentials(options: any, callback: any): void;
|
||||
|
||||
/**
|
||||
* Signs up a new user and automatically logs the user in after the signup.
|
||||
*
|
||||
* @method signupAndLogin
|
||||
* @param {Object} options: https://auth0.com/docs/api/authentication#!#post--dbconnections-signup
|
||||
* @param {Function} callback
|
||||
*/
|
||||
signupAndLogin(options: any, callback: any): void;
|
||||
}
|
||||
|
||||
export class Popup {
|
||||
constructor(client: any, options: any);
|
||||
|
||||
/**
|
||||
* Initializes the popup window and returns the instance to be used later in order to avoid being blocked by the browser.
|
||||
*
|
||||
* @method preload
|
||||
* @param {Object} options: receives the window height and width and any other window feature to be sent to window.open
|
||||
*/
|
||||
preload(options: any): any;
|
||||
|
||||
/**
|
||||
* Internal use.
|
||||
*
|
||||
* @method getPopupHandler
|
||||
*/
|
||||
getPopupHandler(options: any, preload: boolean): any;
|
||||
/**
|
||||
* Opens in a popup the hosted login page (`/authorize`) in order to initialize a new authN/authZ transaction
|
||||
*
|
||||
* @method authorize
|
||||
* @param {Object} options: https://auth0.com/docs/api/authentication#!#get--authorize_db
|
||||
* @param {Function} callback
|
||||
*/
|
||||
authorize(options: any, callback: any): void;
|
||||
|
||||
/**
|
||||
* Initializes the legacy Lock login flow in a popup
|
||||
*
|
||||
* @method loginWithCredentials
|
||||
* @param {Object} options
|
||||
* @param {Function} callback
|
||||
* @deprecated `webauth.popup.loginWithCredentials` will be soon deprecated, use `webauth.client.login` instead.
|
||||
*/
|
||||
loginWithCredentials(options: any, callback: any): void;
|
||||
|
||||
/**
|
||||
* Verifies the passwordless TOTP and returns the requested token
|
||||
*
|
||||
* @method passwordlessVerify
|
||||
* @param {Object} options:
|
||||
* @param {Object} options.type: `sms` or `email`
|
||||
* @param {Object} options.phoneNumber: only if type = sms
|
||||
* @param {Object} options.email: only if type = email
|
||||
* @param {Object} options.connection: the connection name
|
||||
* @param {Object} options.verificationCode: the TOTP code
|
||||
* @param {Function} callback
|
||||
*/
|
||||
passwordlessVerify(options: any, callback: any): void;
|
||||
|
||||
/**
|
||||
* Signs up a new user and automatically logs the user in after the signup.
|
||||
*
|
||||
* @method signupAndLogin
|
||||
* @param {Object} options: https://auth0.com/docs/api/authentication#!#post--dbconnections-signup
|
||||
* @param {Function} callback
|
||||
*/
|
||||
signupAndLogin(options: any, callback: any): void;
|
||||
}
|
||||
|
||||
interface ManagementOptions {
|
||||
domain: string;
|
||||
token: string;
|
||||
_sendTelemetry?: boolean;
|
||||
_telemetryInfo?: any;
|
||||
}
|
||||
|
||||
interface AuthOptions {
|
||||
domain: string;
|
||||
clientID: string;
|
||||
responseType?: string;
|
||||
responseMode?: string;
|
||||
redirectUri?: string;
|
||||
scope?: string;
|
||||
audience?: string;
|
||||
leeway?: number;
|
||||
_disableDeprecationWarnings?: boolean;
|
||||
_sendTelemetry?: boolean;
|
||||
_telemetryInfo?: any;
|
||||
}
|
||||
|
||||
interface PasswordlessAuthOptions {
|
||||
connection: string;
|
||||
verificationCode: string;
|
||||
phoneNumber: string;
|
||||
email: string;
|
||||
}
|
||||
|
||||
interface Auth0Error {
|
||||
error: any;
|
||||
errorDescription: string;
|
||||
}
|
||||
|
||||
interface Auth0DecodedHash {
|
||||
accessToken?: string;
|
||||
idToken?: string;
|
||||
idTokenPayload?: any;
|
||||
refreshToken?: string;
|
||||
state?: string;
|
||||
expiresIn?: number;
|
||||
tokenType?: string;
|
||||
}
|
||||
|
||||
/** Represents the response from an API Token Delegation request. */
|
||||
interface Auth0DelegationToken {
|
||||
/** The length of time in seconds the token is valid for. */
|
||||
ExpiresIn: number;
|
||||
/** The JWT for delegated access. */
|
||||
idToken: string;
|
||||
/** The type of token being returned. Possible values: "Bearer" */
|
||||
tokenType: string;
|
||||
}
|
||||
|
||||
interface ChangePasswordOptions {
|
||||
connection: string;
|
||||
email: string;
|
||||
password?: string;
|
||||
}
|
||||
|
||||
interface PasswordlessStartOptions {
|
||||
connection: string;
|
||||
send: string;
|
||||
phoneNumber?: string;
|
||||
email?: string;
|
||||
authParams?: any;
|
||||
}
|
||||
|
||||
interface PasswordlessVerifyOptions {
|
||||
connection: string;
|
||||
verificationCode: string;
|
||||
phoneNumber?: string;
|
||||
email?: string;
|
||||
}
|
||||
/**
|
||||
* Makes a call to the `/delegation` endpoint
|
||||
*
|
||||
* @method delegation
|
||||
* @param {Object} options: https://auth0.com/docs/api/authentication#!#post--delegation
|
||||
* @param {Function} callback
|
||||
* @deprecated `delegation` will be soon deprecated.
|
||||
*/
|
||||
delegation(options: any, callback: (error?: Auth0Error, authResult?: Auth0DelegationToken) => any): any;
|
||||
|
||||
/**
|
||||
* Fetches the user country based on the ip.
|
||||
*
|
||||
* @method getUserCountry
|
||||
* @param {Function} callback
|
||||
*/
|
||||
getUserCountry(callback: (error?: Auth0Error, result?: any) => any): void;
|
||||
}
|
||||
|
||||
export class PasswordlessAuthentication {
|
||||
constructor(request: any, option: any);
|
||||
|
||||
/**
|
||||
* Builds and returns the passwordless TOTP verify url in order to initialize a new authN/authZ transaction
|
||||
*
|
||||
* @method buildVerifyUrl
|
||||
* @param {Object} options
|
||||
* @param {Function} callback
|
||||
*/
|
||||
buildVerifyUrl(options: any): string;
|
||||
|
||||
/**
|
||||
* Initializes a new passwordless authN/authZ transaction
|
||||
*
|
||||
* @method start
|
||||
* @param {Object} options: https://auth0.com/docs/api/authentication#passwordless
|
||||
* @param {Function} callback
|
||||
*/
|
||||
start(options: PasswordlessStartOptions, callback: any): void;
|
||||
|
||||
/**
|
||||
* Verifies the passwordless TOTP and returns an error if any.
|
||||
*
|
||||
* @method buildVerifyUrl
|
||||
* @param {Object} options
|
||||
* @param {Function} callback
|
||||
*/
|
||||
verify(options: any, callback: any): void;
|
||||
}
|
||||
|
||||
export class DBConnection {
|
||||
constructor(request: any, option: any);
|
||||
|
||||
/**
|
||||
* Signup a new user
|
||||
*
|
||||
* @method signup
|
||||
* @param {Object} options: https://auth0.com/docs/api/authentication#!#post--dbconnections-signup
|
||||
* @param {Function} calback
|
||||
*/
|
||||
signup(options: any, callback: any): void;
|
||||
|
||||
/**
|
||||
* Initializes the change password flow
|
||||
*
|
||||
* @method signup
|
||||
* @param {Object} options: https://auth0.com/docs/api/authentication#!#post--dbconnections-change_password
|
||||
* @param {Function} callback
|
||||
*/
|
||||
changePassword(options: ChangePasswordOptions, callback: any): void;
|
||||
}
|
||||
|
||||
export class Management {
|
||||
constructor(options: ManagementOptions);
|
||||
|
||||
/**
|
||||
* Returns the user profile. https://auth0.com/docs/api/management/v2#!/Users/get_users_by_id
|
||||
*
|
||||
* @method getUser
|
||||
* @param {String} userId
|
||||
* @param {Function} callback
|
||||
*/
|
||||
getUser(userId: string, callback: (error?: Auth0Error, user?: any) => any): void;
|
||||
|
||||
/**
|
||||
* Updates the user metdata. It will patch the user metdata with the attributes sent.
|
||||
* https://auth0.com/docs/api/management/v2#!/Users/patch_users_by_id
|
||||
*
|
||||
* @method patchUserMetadata
|
||||
* @param {String} userId
|
||||
* @param {Object} userMetadata
|
||||
* @param {Function} callback
|
||||
*/
|
||||
patchUserMetadata(userId: string, userMetadata: any, callback: (error?: Auth0Error, user?: any) => any): void;
|
||||
|
||||
/**
|
||||
* Link two users. https://auth0.com/docs/api/management/v2#!/Users/post_identities
|
||||
*
|
||||
* @method linkUser
|
||||
* @param {String} userId
|
||||
* @param {String} secondaryUserToken
|
||||
* @param {Function} callback
|
||||
*/
|
||||
linkUser(userId: string, secondaryUserToken: string, callback: (error?: Auth0Error, user?: any) => any): void;
|
||||
}
|
||||
|
||||
export class WebAuth {
|
||||
constructor(options: AuthOptions);
|
||||
client: Authentication;
|
||||
popup: Popup;
|
||||
redirect: Redirect;
|
||||
|
||||
/**
|
||||
* Redirects to the hosted login page (`/authorize`) in order to initialize a new authN/authZ transaction
|
||||
*
|
||||
* @method authorize
|
||||
* @param {Object} options: https://auth0.com/docs/api/authentication#!#get--authorize_db
|
||||
*/
|
||||
authorize(options: any): void;
|
||||
|
||||
/**
|
||||
* Parse the url hash and extract the returned tokens depending on the transaction.
|
||||
*
|
||||
* Only validates id_tokens signed by Auth0 using the RS256 algorithm using the public key exposed
|
||||
* by the `/.well-known/jwks.json` endpoint. Id tokens signed with other algorithms will not be
|
||||
* accepted.
|
||||
*
|
||||
* @method parseHash
|
||||
* @param {Object} options:
|
||||
* @param {String} options.state [OPTIONAL] to verify the response
|
||||
* @param {String} options.nonce [OPTIONAL] to verify the id_token
|
||||
* @param {String} options.hash [OPTIONAL] the url hash. If not provided it will extract from window.location.hash
|
||||
* @param {Function} callback: any(err, token_payload)
|
||||
*/
|
||||
parseHash(options: any, callback: (error?: Auth0Error, authResult?: any) => any): void;
|
||||
|
||||
/**
|
||||
* Decodes the id_token and verifies the nonce.
|
||||
*
|
||||
* @method validateToken
|
||||
* @param {String} token
|
||||
* @param {String} state
|
||||
* @param {String} nonce
|
||||
* @param {Function} callback: function(err, {payload, transaction})
|
||||
*/
|
||||
validateToken(token: string, state: string, nonce: string, callback: any): void;
|
||||
|
||||
/**
|
||||
* Executes a silent authentication transaction under the hood in order to fetch a new token.
|
||||
*
|
||||
* @method renewAuth
|
||||
* @param {Object} options: any valid oauth2 parameter to be sent to the `/authorize` endpoint
|
||||
* @param {Function} callback
|
||||
*/
|
||||
renewAuth(options: any, callback: (error?: Auth0Error, authResult?: any) => any): void;
|
||||
|
||||
/**
|
||||
* Initialices a change password transaction
|
||||
*
|
||||
* @method changePassword
|
||||
* @param {Object} options: https://auth0.com/docs/api/authentication#!#post--dbconnections-change_password
|
||||
* @param {Function} callback
|
||||
*/
|
||||
changePassword(options: any, callback: (error?: Auth0Error, authResult?: any) => any): void;
|
||||
|
||||
/**
|
||||
* Signs up a new user
|
||||
*
|
||||
* @method signup
|
||||
* @param {Object} options: https://auth0.com/docs/api/authentication#!#post--dbconnections-signup
|
||||
* @param {Function} callback
|
||||
*/
|
||||
signup(options: any, callback: any): void;
|
||||
|
||||
/**
|
||||
* Signs up a new user, automatically logs the user in after the signup and returns the user token.
|
||||
* The login will be done using /oauth/token with password-realm grant type.
|
||||
*
|
||||
* @method signupAndAuthorize
|
||||
* @param {Object} options: https://auth0.com/docs/api/authentication#!#post--dbconnections-signup
|
||||
* @param {Function} callback
|
||||
*/
|
||||
signupAndAuthorize(options: any, callback: (error?: Auth0Error, authResult?: any) => any): void;
|
||||
|
||||
/**
|
||||
* Redirects to the auth0 logout page
|
||||
*
|
||||
* @method logout
|
||||
* @param {Object} options: https://auth0.com/docs/api/authentication#!#get--v2-logout
|
||||
*/
|
||||
logout(options: any): void;
|
||||
|
||||
passwordlessStart(options: PasswordlessStartOptions, callback: (error?: Auth0Error, data?: any) => any): void;
|
||||
|
||||
/**
|
||||
* Verifies the passwordless TOTP and redirects to finish the passwordless transaction
|
||||
*
|
||||
* @method passwordlessVerify
|
||||
* @param {Object} options:
|
||||
* @param {Object} options.type: `sms` or `email`
|
||||
* @param {Object} options.phoneNumber: only if type = sms
|
||||
* @param {Object} options.email: only if type = email
|
||||
* @param {Object} options.connection: the connection name
|
||||
* @param {Object} options.verificationCode: the TOTP code
|
||||
* @param {Function} callback
|
||||
*/
|
||||
passwordlessVerify(options: any, callback: any): void;
|
||||
}
|
||||
|
||||
export class Redirect {
|
||||
constructor(client: any, options: any);
|
||||
|
||||
/**
|
||||
* Initializes the legacy Lock login flow in a popup
|
||||
*
|
||||
* @method loginWithCredentials
|
||||
* @param {Object} options
|
||||
* @param {Function} callback
|
||||
* @deprecated `webauth.popup.loginWithCredentials` will be soon deprecated, use `webauth.client.login` instead.
|
||||
*/
|
||||
loginWithCredentials(options: any, callback: any): void;
|
||||
|
||||
/**
|
||||
* Signs up a new user and automatically logs the user in after the signup.
|
||||
*
|
||||
* @method signupAndLogin
|
||||
* @param {Object} options: https://auth0.com/docs/api/authentication#!#post--dbconnections-signup
|
||||
* @param {Function} callback
|
||||
*/
|
||||
signupAndLogin(options: any, callback: any): void;
|
||||
}
|
||||
|
||||
export class Popup {
|
||||
constructor(client: any, options: any);
|
||||
|
||||
/**
|
||||
* Initializes the popup window and returns the instance to be used later in order to avoid being blocked by the browser.
|
||||
*
|
||||
* @method preload
|
||||
* @param {Object} options: receives the window height and width and any other window feature to be sent to window.open
|
||||
*/
|
||||
preload(options: any): any;
|
||||
|
||||
/**
|
||||
* Internal use.
|
||||
*
|
||||
* @method getPopupHandler
|
||||
*/
|
||||
getPopupHandler(options: any, preload: boolean): any;
|
||||
/**
|
||||
* Opens in a popup the hosted login page (`/authorize`) in order to initialize a new authN/authZ transaction
|
||||
*
|
||||
* @method authorize
|
||||
* @param {Object} options: https://auth0.com/docs/api/authentication#!#get--authorize_db
|
||||
* @param {Function} callback
|
||||
*/
|
||||
authorize(options: any, callback: any): void;
|
||||
|
||||
/**
|
||||
* Initializes the legacy Lock login flow in a popup
|
||||
*
|
||||
* @method loginWithCredentials
|
||||
* @param {Object} options
|
||||
* @param {Function} callback
|
||||
* @deprecated `webauth.popup.loginWithCredentials` will be soon deprecated, use `webauth.client.login` instead.
|
||||
*/
|
||||
loginWithCredentials(options: any, callback: any): void;
|
||||
|
||||
/**
|
||||
* Verifies the passwordless TOTP and returns the requested token
|
||||
*
|
||||
* @method passwordlessVerify
|
||||
* @param {Object} options:
|
||||
* @param {Object} options.type: `sms` or `email`
|
||||
* @param {Object} options.phoneNumber: only if type = sms
|
||||
* @param {Object} options.email: only if type = email
|
||||
* @param {Object} options.connection: the connection name
|
||||
* @param {Object} options.verificationCode: the TOTP code
|
||||
* @param {Function} callback
|
||||
*/
|
||||
passwordlessVerify(options: any, callback: any): void;
|
||||
|
||||
/**
|
||||
* Signs up a new user and automatically logs the user in after the signup.
|
||||
*
|
||||
* @method signupAndLogin
|
||||
* @param {Object} options: https://auth0.com/docs/api/authentication#!#post--dbconnections-signup
|
||||
* @param {Function} callback
|
||||
*/
|
||||
signupAndLogin(options: any, callback: any): void;
|
||||
}
|
||||
|
||||
interface ManagementOptions {
|
||||
domain: string;
|
||||
token: string;
|
||||
_sendTelemetry?: boolean;
|
||||
_telemetryInfo?: any;
|
||||
}
|
||||
|
||||
interface AuthOptions {
|
||||
domain: string;
|
||||
clientID: string;
|
||||
responseType?: string;
|
||||
responseMode?: string;
|
||||
redirectUri?: string;
|
||||
scope?: string;
|
||||
audience?: string;
|
||||
leeway?: number;
|
||||
_disableDeprecationWarnings?: boolean;
|
||||
_sendTelemetry?: boolean;
|
||||
_telemetryInfo?: any;
|
||||
}
|
||||
|
||||
interface PasswordlessAuthOptions {
|
||||
connection: string;
|
||||
verificationCode: string;
|
||||
phoneNumber: string;
|
||||
email: string;
|
||||
}
|
||||
|
||||
interface Auth0Error {
|
||||
error: any;
|
||||
errorDescription: string;
|
||||
}
|
||||
|
||||
interface Auth0DecodedHash {
|
||||
accessToken?: string;
|
||||
idToken?: string;
|
||||
idTokenPayload?: any;
|
||||
refreshToken?: string;
|
||||
state?: string;
|
||||
expiresIn?: number;
|
||||
tokenType?: string;
|
||||
}
|
||||
|
||||
/** Represents the response from an API Token Delegation request. */
|
||||
interface Auth0DelegationToken {
|
||||
/** The length of time in seconds the token is valid for. */
|
||||
ExpiresIn: number;
|
||||
/** The JWT for delegated access. */
|
||||
idToken: string;
|
||||
/** The type of token being returned. Possible values: "Bearer" */
|
||||
tokenType: string;
|
||||
}
|
||||
|
||||
interface ChangePasswordOptions {
|
||||
connection: string;
|
||||
email: string;
|
||||
password?: string;
|
||||
}
|
||||
|
||||
interface PasswordlessStartOptions {
|
||||
connection: string;
|
||||
send: string;
|
||||
phoneNumber?: string;
|
||||
email?: string;
|
||||
authParams?: any;
|
||||
}
|
||||
|
||||
interface PasswordlessVerifyOptions {
|
||||
connection: string;
|
||||
verificationCode: string;
|
||||
phoneNumber?: string;
|
||||
email?: string;
|
||||
}
|
||||
|
||||
52
b_/b_-tests.ts
Normal file
52
b_/b_-tests.ts
Normal file
@@ -0,0 +1,52 @@
|
||||
import b_ = require("b_");
|
||||
|
||||
const blockClass: string = b_("block");
|
||||
const blockWithModsClass: string = b_("block", {stringMod: "string", boolMod: true, numberMod: 5});
|
||||
const elemClass: string = b_("block", "elem");
|
||||
const elemWithModsClass: string = b_("block", "elem", {stringMod: "string", boolMod: true, numberMod: 5});
|
||||
|
||||
const withBlock = b_.with("block");
|
||||
const withBlockClass: string = withBlock();
|
||||
const withBlockWithModsClass: string = withBlock({stringMod: "string", boolMod: true, numberMod: 5});
|
||||
const withBlockElemClass: string = withBlock("elem");
|
||||
const withBlockElemWithModsClass: string = withBlock("elem", {stringMod: "string", boolMod: true, numberMod: 5});
|
||||
|
||||
const lockBlock = b_.lock("block");
|
||||
const lockBlockClass: string = lockBlock();
|
||||
const lockBlockWithModsClass: string = lockBlock({stringMod: "string", boolMod: true, numberMod: 5});
|
||||
const lockBlockElemClass: string = lockBlock("elem");
|
||||
const lockBlockElemWithModsClass: string = lockBlock("elem", {stringMod: "string", boolMod: true, numberMod: 5});
|
||||
|
||||
const withElem = b_.with("block", "elem");
|
||||
const withElemClass: string = withElem();
|
||||
const withElemWithModsClass: string = withElem({stringMod: "string", boolMod: true, numberMod: 5});
|
||||
|
||||
const parameterizedB_ = b_.B({
|
||||
tailSpace: " ",
|
||||
elementSeparator: "-",
|
||||
modSeparator: "_",
|
||||
modValueSeparator: "-",
|
||||
classSeparator: " ",
|
||||
isFullModifier: true
|
||||
});
|
||||
|
||||
const parameterizedBlockClass: string = parameterizedB_("block");
|
||||
const parameterizedBlockWithModsClass: string = parameterizedB_("block", {stringMod: "string", boolMod: true, numberMod: 5});
|
||||
const parameterizedElemClass: string = parameterizedB_("block", "elem");
|
||||
const parameterizedElemWithModsClass: string = parameterizedB_("block", "elem", {stringMod: "string", boolMod: true, numberMod: 5});
|
||||
|
||||
const parameterizedWithBlock = parameterizedB_.with("block");
|
||||
const parameterizedWithBlockClass: string = parameterizedWithBlock();
|
||||
const parameterizedWithBlockWithModsClass: string = parameterizedWithBlock({stringMod: "string", boolMod: true, numberMod: 5});
|
||||
const parameterizedWithBlockElemClass: string = parameterizedWithBlock("elem");
|
||||
const parameterizedWithBlockElemWithModsClass: string = parameterizedWithBlock("elem", {stringMod: "string", boolMod: true, numberMod: 5});
|
||||
|
||||
const parameterizedLockBlock = parameterizedB_.lock("block");
|
||||
const parameterizedLockBlockClass: string = parameterizedLockBlock();
|
||||
const parameterizedLockBlockWithModsClass: string = parameterizedLockBlock({stringMod: "string", boolMod: true, numberMod: 5});
|
||||
const parameterizedLockBlockElemClass: string = parameterizedLockBlock("elem");
|
||||
const parameterizedLockBlockElemWithModsClass: string = parameterizedLockBlock("elem", {stringMod: "string", boolMod: true, numberMod: 5});
|
||||
|
||||
const parameterizedWithElem = parameterizedB_.with("block", "elem");
|
||||
const parameterizedWithElemClass: string = parameterizedWithElem();
|
||||
const parameterizedWithElemWithModsClass: string = parameterizedWithElem({stringMod: "string", boolMod: true, numberMod: 5});
|
||||
40
b_/index.d.ts
vendored
Normal file
40
b_/index.d.ts
vendored
Normal file
@@ -0,0 +1,40 @@
|
||||
// Type definitions for b_ 1.3
|
||||
// Project: https://github.com/azproduction/b_
|
||||
// Definitions by: Vasya Aksyonov <https://github.com/outring>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
interface Options {
|
||||
tailSpace?: string;
|
||||
elementSeparator?: string;
|
||||
modSeparator?: string;
|
||||
modValueSeparator?: string;
|
||||
classSeparator?: string;
|
||||
isFullModifier?: boolean;
|
||||
}
|
||||
|
||||
interface Mods {
|
||||
[name: string]: any;
|
||||
}
|
||||
|
||||
interface Formatter {
|
||||
(block: string, mods?: Mods): string;
|
||||
(block: string, elem: string, mods?: Mods): string;
|
||||
|
||||
with(block: string): BlockFormatter;
|
||||
with(block: string, elem: string): ElemFormatter;
|
||||
|
||||
lock(block: string): BlockFormatter;
|
||||
lock(block: string, elem: string): ElemFormatter;
|
||||
|
||||
B(options: Options): Formatter;
|
||||
}
|
||||
|
||||
interface BlockFormatter {
|
||||
(mods?: Mods): string;
|
||||
(elem: string, mods?: Mods): string;
|
||||
}
|
||||
|
||||
type ElemFormatter = (mods?: Mods) => string;
|
||||
|
||||
declare const formatter: Formatter;
|
||||
export = formatter;
|
||||
22
b_/tsconfig.json
Normal file
22
b_/tsconfig.json
Normal file
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"b_-tests.ts"
|
||||
]
|
||||
}
|
||||
1
b_/tslint.json
Normal file
1
b_/tslint.json
Normal file
@@ -0,0 +1 @@
|
||||
{ "extends": "../tslint.json" }
|
||||
@@ -40,5 +40,8 @@ expect(wrapper).to.have.data("test", "Test");
|
||||
expect(wrapper).to.have.style("background", "green");
|
||||
expect(wrapper).to.have.state("test", "test");
|
||||
expect(wrapper).to.have.prop("test", 5);
|
||||
expect(wrapper).to.have.props(["test1", "test2"]);
|
||||
expect(wrapper).to.have.props({ test: 5 });
|
||||
expect(wrapper).to.contain(<Test/>);
|
||||
expect(wrapper).to.containMatchingElement(<Test/>);
|
||||
expect(wrapper).to.match(<Test/>);
|
||||
|
||||
20
chai-enzyme/index.d.ts
vendored
20
chai-enzyme/index.d.ts
vendored
@@ -1,4 +1,4 @@
|
||||
// Type definitions for chai-enzyme 0.5.0
|
||||
// Type definitions for chai-enzyme 0.6.1
|
||||
// Project: https://github.com/producthunt/chai-enzyme
|
||||
// Definitions by: Alexey Svetliakov <https://github.com/asvetliakov>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
@@ -39,6 +39,12 @@ declare namespace Chai {
|
||||
*/
|
||||
className(name: string): Assertion;
|
||||
|
||||
/**
|
||||
* Assert that the wrapper contains a certain element:
|
||||
* @param selector
|
||||
*/
|
||||
containMatchingElement(selector: EnzymeSelector): Assertion;
|
||||
|
||||
/**
|
||||
* Assert that the wrapper contains a descendant matching the given selector:
|
||||
* @param selector
|
||||
@@ -140,6 +146,18 @@ declare namespace Chai {
|
||||
* @param val
|
||||
*/
|
||||
prop(key: string, val?: any): Assertion;
|
||||
|
||||
/**
|
||||
* Assert that the wrapper has given props [with values]:
|
||||
* @param keys
|
||||
*/
|
||||
props(keys: string[]): Assertion;
|
||||
|
||||
/**
|
||||
* Assert that the wrapper has given props [with values]:
|
||||
* @param props
|
||||
*/
|
||||
props(props: EnzymeSelector): Assertion;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
4
chrome/index.d.ts
vendored
4
chrome/index.d.ts
vendored
@@ -1831,7 +1831,7 @@ declare namespace chrome.devtools.panels {
|
||||
* If you specify the callback parameter, it should be a function that looks like this:
|
||||
* function() {...};
|
||||
*/
|
||||
setObject(jsonObject: string, rootTitle?: string, callback?: () => void): void;
|
||||
setObject(jsonObject: Object, rootTitle?: string, callback?: () => void): void;
|
||||
/**
|
||||
* Sets a JSON-compliant object to be displayed in the sidebar pane.
|
||||
* @param jsonObject An object to be displayed in context of the inspected page. Evaluated in the context of the caller (API client).
|
||||
@@ -1839,7 +1839,7 @@ declare namespace chrome.devtools.panels {
|
||||
* If you specify the callback parameter, it should be a function that looks like this:
|
||||
* function() {...};
|
||||
*/
|
||||
setObject(jsonObject: string, callback?: () => void): void;
|
||||
setObject(jsonObject: Object, callback?: () => void): void;
|
||||
/**
|
||||
* Sets an HTML page to be displayed in the sidebar pane.
|
||||
* @param path Relative path of an extension page to display within the sidebar.
|
||||
|
||||
30
combined-stream/combined-stream-tests.ts
Normal file
30
combined-stream/combined-stream-tests.ts
Normal file
@@ -0,0 +1,30 @@
|
||||
import * as CombinedStream from "combined-stream";
|
||||
import { createReadStream, createWriteStream } from "fs";
|
||||
|
||||
const stream1 = new CombinedStream();
|
||||
|
||||
stream1.append(createReadStream("tsconfig.json"));
|
||||
stream1.append(createReadStream("tslint.json"));
|
||||
stream1.append(createReadStream("index.d.ts"));
|
||||
|
||||
stream1.pipe(createWriteStream("combined.txt"));
|
||||
|
||||
const stream2 = CombinedStream.create({
|
||||
maxDataSize: 1 << 32,
|
||||
pauseStreams: false,
|
||||
});
|
||||
|
||||
stream1.destroy();
|
||||
|
||||
// should log true
|
||||
console.log(CombinedStream.isStreamLike(stream2));
|
||||
|
||||
stream2.on("data", (data) => {
|
||||
console.log(data);
|
||||
});
|
||||
|
||||
stream2.pipe(createWriteStream("combined.txt"));
|
||||
|
||||
stream2.write(CombinedStream.name);
|
||||
|
||||
stream2.destroy();
|
||||
56
combined-stream/index.d.ts
vendored
Normal file
56
combined-stream/index.d.ts
vendored
Normal file
@@ -0,0 +1,56 @@
|
||||
// Type definitions for combined-stream 1.0
|
||||
// Project: https://github.com/felixge/node-combined-stream
|
||||
// Definitions by: Felix Geisendörfer <https://github.com/felixge>, Tomek Łaziuk <https://github.com/tlaziuk>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference types="node" />
|
||||
|
||||
import { Stream } from "stream";
|
||||
|
||||
declare class CombinedStream extends Stream implements CombinedStream.Options {
|
||||
readonly writable: boolean;
|
||||
readonly readable: boolean;
|
||||
readonly dataSize: number;
|
||||
maxDataSize: number;
|
||||
pauseStreams: boolean;
|
||||
append(stream: NodeJS.ReadableStream | NodeJS.WritableStream | Buffer | string): this;
|
||||
write(data: any): void;
|
||||
pause(): void;
|
||||
resume(): void;
|
||||
end(): void;
|
||||
destroy(): void;
|
||||
|
||||
// private properties
|
||||
_released: boolean;
|
||||
// @TODO it should be a type of Array<'delayed-stream' instance | Buffer | string>
|
||||
_streams: Array<Stream | Buffer | string>;
|
||||
_currentStream: Stream | Buffer | string | null;
|
||||
_getNext(): void;
|
||||
_pipeNext(): void;
|
||||
_handleErrors(stream: NodeJS.EventEmitter): void;
|
||||
_reset(): void;
|
||||
_checkDataSize(): void;
|
||||
_updateDataSize(): void;
|
||||
_emitError(error: Error): void;
|
||||
|
||||
// events
|
||||
on(event: "close" | "end" | "resume" | "pause", cb: () => void): this;
|
||||
on(event: "error", cb: (err: Error) => void): this;
|
||||
on(event: "data", cb: (data: any) => void): this;
|
||||
once(event: "close" | "end" | "resume" | "pause", cb: () => void): this;
|
||||
once(event: "error", cb: (err: Error) => void): this;
|
||||
once(event: "data", cb: (data: any) => void): this;
|
||||
}
|
||||
|
||||
declare namespace CombinedStream {
|
||||
export interface Options {
|
||||
maxDataSize?: number;
|
||||
pauseStreams?: boolean;
|
||||
}
|
||||
|
||||
export function create(options?: Options): CombinedStream;
|
||||
|
||||
export function isStreamLike(stream: any): stream is Stream;
|
||||
}
|
||||
|
||||
export = CombinedStream;
|
||||
20
combined-stream/tsconfig.json
Normal file
20
combined-stream/tsconfig.json
Normal file
@@ -0,0 +1,20 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"target": "es6",
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"combined-stream-tests.ts"
|
||||
]
|
||||
}
|
||||
1
combined-stream/tslint.json
Normal file
1
combined-stream/tslint.json
Normal file
@@ -0,0 +1 @@
|
||||
{ "extends": "../tslint.json" }
|
||||
@@ -537,6 +537,19 @@ geoPathCentroid = geoPathCanvas.centroid(sampleExtendedFeatureCollection);
|
||||
|
||||
// geoPathCentroid = geoPathSVG.centroid(sampleExtendedFeatureCollection); // fails, wrong data object type
|
||||
|
||||
|
||||
// measure(...) ------------------------------------------------------
|
||||
|
||||
let geoPathMeasure: number = geoPathCanvas.measure(samplePolygon);
|
||||
geoPathMeasure = geoPathCanvas.measure(sampleSphere);
|
||||
geoPathMeasure = geoPathCanvas.measure(sampleGeometryCollection);
|
||||
geoPathMeasure = geoPathCanvas.measure(sampleExtendedGeometryCollection);
|
||||
geoPathMeasure = geoPathCanvas.measure(sampleFeature);
|
||||
geoPathMeasure = geoPathCanvas.measure(sampleExtendedFeature1);
|
||||
geoPathMeasure = geoPathCanvas.measure(sampleExtendedFeature2);
|
||||
geoPathMeasure = geoPathCanvas.measure(sampleFeatureCollection);
|
||||
geoPathMeasure = geoPathCanvas.measure(sampleExtendedFeatureCollection);
|
||||
|
||||
// render path to context of get path string----------------------------
|
||||
|
||||
// render to GeoContext/Canvas
|
||||
|
||||
18
d3-geo/index.d.ts
vendored
18
d3-geo/index.d.ts
vendored
@@ -1,4 +1,4 @@
|
||||
// Type definitions for D3JS d3-geo module v1.4.0
|
||||
// Type definitions for D3JS d3-geo module v1.5.0
|
||||
// Project: https://github.com/d3/d3-geo/
|
||||
// Definitions by: Hugues Stefanski <https://github.com/Ledragon>, Tom Wanzek <https://github.com/tomwanzek>, Alex Ford <https://github.com/gustavderdrache>, Boris Yankov <https://github.com/borisyankov>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
@@ -908,7 +908,7 @@ export interface GeoPath<This, DatumObject extends GeoPermissibleObjects> {
|
||||
* this method first computes the area of the exterior ring, and then subtracts the area of any interior holes.
|
||||
* This method observes any clipping performed by the projection; see projection.clipAngle and projection.clipExtent.
|
||||
*
|
||||
* @param An object for which the area is to be calculated.
|
||||
* @param object An object for which the area is to be calculated.
|
||||
*/
|
||||
area(object: DatumObject): number;
|
||||
|
||||
@@ -921,7 +921,7 @@ export interface GeoPath<This, DatumObject extends GeoPermissibleObjects> {
|
||||
* the minimum latitude is typically the maximum y-value, and the maximum latitude is typically the minimum y-value.)
|
||||
* This method observes any clipping performed by the projection; see projection.clipAngle and projection.clipExtent.
|
||||
*
|
||||
* @param An object for which the bounds are to be calculated.
|
||||
* @param object An object for which the bounds are to be calculated.
|
||||
*/
|
||||
bounds(object: DatumObject): [[number, number], [number, number]];
|
||||
|
||||
@@ -931,10 +931,20 @@ export interface GeoPath<This, DatumObject extends GeoPermissibleObjects> {
|
||||
* For example, a noncontiguous cartogram might scale each state around its centroid.
|
||||
* This method observes any clipping performed by the projection; see projection.clipAngle and projection.clipExtent.
|
||||
*
|
||||
* @param An object for which the centroid is to be calculated.
|
||||
* @param pbject An object for which the centroid is to be calculated.
|
||||
*/
|
||||
centroid(object: DatumObject): [number, number];
|
||||
|
||||
/**
|
||||
* Returns the projected planar length (typically in pixels) for the specified GeoJSON object.
|
||||
* Point and MultiPoint features have zero length. For Polygon and MultiPolygon features, this method computes the summed length of all rings.
|
||||
*
|
||||
* This method observes any clipping performed by the projection.
|
||||
*
|
||||
* @param object An object for which the measure is to be calculated.
|
||||
*/
|
||||
measure(object: DatumObject): number;
|
||||
|
||||
/**
|
||||
* Returns the current render context which defaults to null.
|
||||
*
|
||||
|
||||
2
d3/index.d.ts
vendored
2
d3/index.d.ts
vendored
@@ -1,4 +1,4 @@
|
||||
// Type definitions for D3JS d3 standard bundle 4.5
|
||||
// Type definitions for D3JS d3 standard bundle 4.6
|
||||
// Project: https://github.com/d3/d3
|
||||
// Definitions by: Tom Wanzek <https://github.com/tomwanzek>, Alex Ford <https://github.com/gustavderdrache>, Boris Yankov <https://github.com/borisyankov>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
@@ -180,6 +180,8 @@ d3.json("data/yelp_test_set_business.json", (yelp_data:IYelpData[]) => {
|
||||
.xAxis()
|
||||
.tickFormat((v: string) => v);
|
||||
|
||||
lineChart.legend(dc.legend().x(200).y(10).itemHeight(13).gap(5));
|
||||
|
||||
rowChart
|
||||
.width(340)
|
||||
.height(850)
|
||||
|
||||
16
dc/index.d.ts
vendored
16
dc/index.d.ts
vendored
@@ -111,14 +111,14 @@ declare namespace dc {
|
||||
}
|
||||
|
||||
export interface Legend {
|
||||
x: IGetSet<number, number>;
|
||||
y: IGetSet<number, number>;
|
||||
gap: IGetSet<number, number>;
|
||||
itemHeight: IGetSet<number, number>;
|
||||
horizontal: IGetSet<boolean, boolean>;
|
||||
legendWidth: IGetSet<number, number>;
|
||||
itemWidth: IGetSet<number, number>;
|
||||
autoItemWidth: IGetSet<boolean, boolean>;
|
||||
x: IGetSet<number, Legend>;
|
||||
y: IGetSet<number, Legend>;
|
||||
gap: IGetSet<number, Legend>;
|
||||
itemHeight: IGetSet<number, Legend>;
|
||||
horizontal: IGetSet<boolean, Legend>;
|
||||
legendWidth: IGetSet<number, Legend>;
|
||||
itemWidth: IGetSet<number, Legend>;
|
||||
autoItemWidth: IGetSet<boolean, Legend>;
|
||||
render: () => void;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,8 +1,11 @@
|
||||
|
||||
import * as deepEqual from "deep-equal";
|
||||
import deepEqual = require("deep-equal");
|
||||
|
||||
let isDeepEqual1: boolean = deepEqual({}, {});
|
||||
let isDeepEqual2: boolean = deepEqual({}, {}, { strict: true });
|
||||
let isDeepEqual3: boolean = deepEqual({}, {}, { strict: false });
|
||||
const isDeepEqual1: boolean = deepEqual({}, {});
|
||||
const isDeepEqual2: boolean = deepEqual({}, {}, { strict: true });
|
||||
const isDeepEqual3: boolean = deepEqual({}, {}, { strict: false });
|
||||
const isDeepEqual4: boolean = deepEqual(undefined, undefined);
|
||||
const isDeepEqual5: boolean = deepEqual(3, false);
|
||||
const isDeepEqual6: boolean = deepEqual("a-string", null);
|
||||
|
||||
console.log(isDeepEqual1, isDeepEqual2, isDeepEqual3);
|
||||
console.log(isDeepEqual1, isDeepEqual2, isDeepEqual3, isDeepEqual4, isDeepEqual5, isDeepEqual6);
|
||||
|
||||
14
deep-equal/index.d.ts
vendored
14
deep-equal/index.d.ts
vendored
@@ -1,17 +1,15 @@
|
||||
// Type definitions for deep-equal
|
||||
// Type definitions for deep-equal 1.0
|
||||
// Project: https://github.com/substack/node-deep-equal
|
||||
// Definitions by: remojansen <https://github.com/remojansen>
|
||||
// Definitions by: remojansen <https://github.com/remojansen>, Jay Anslow <http://github.com/janslow>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
|
||||
|
||||
interface DeepEqualOptions {
|
||||
strict: boolean;
|
||||
}
|
||||
|
||||
declare let deepEqual: (
|
||||
actual: Object,
|
||||
expected: Object,
|
||||
opts?: DeepEqualOptions) => boolean;
|
||||
declare function deepEqual(
|
||||
actual: any,
|
||||
expected: any,
|
||||
opts?: DeepEqualOptions): boolean;
|
||||
|
||||
export = deepEqual;
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": false,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
|
||||
3
deep-equal/tslint.json
Normal file
3
deep-equal/tslint.json
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"extends": "../tslint.json"
|
||||
}
|
||||
1
dockerode/index.d.ts
vendored
1
dockerode/index.d.ts
vendored
@@ -184,6 +184,7 @@ declare namespace Dockerode {
|
||||
Created: number;
|
||||
Ports: Port[];
|
||||
Labels: { [label: string]: string };
|
||||
State: string;
|
||||
Status: string;
|
||||
HostConfig: {
|
||||
NetworkMode: string;
|
||||
|
||||
78
griddle-react/griddle-react-tests.tsx
Normal file
78
griddle-react/griddle-react-tests.tsx
Normal file
@@ -0,0 +1,78 @@
|
||||
/*
|
||||
Licensed under the MIT License (MIT)
|
||||
|
||||
Copyright (c) 2016 David Hara
|
||||
*/
|
||||
|
||||
import * as React from 'react';
|
||||
import { render } from 'react-dom';
|
||||
import Griddle, { CustomColumnComponentProps } from 'griddle-react';
|
||||
import CustomColumnComponentGrid from './test/CustomColumnComponent';
|
||||
import CustomHeaderComponentGrid from './test/CustomHeaderComponent';
|
||||
import CustomFilterComponentGrid from './test/CustomFilterComponent';
|
||||
|
||||
interface MyCustomResult {
|
||||
name: string,
|
||||
test: string
|
||||
}
|
||||
|
||||
class LinkComponent extends React.Component<CustomColumnComponentProps<MyCustomResult>, any> {
|
||||
render() {
|
||||
var url = "speakers/" + this.props.rowData.test + "/" + this.props.data;
|
||||
return <a href={url}>{this.props.data}</a>
|
||||
}
|
||||
}
|
||||
|
||||
const StatelessFunctionComponent = (props: CustomColumnComponentProps<MyCustomResult>) => {
|
||||
var url = "speakers/" + props.rowData.test + "/" + props.data;
|
||||
return <a href={url}>{props.data}</a>
|
||||
};
|
||||
|
||||
var columnMeta = [
|
||||
{
|
||||
columnName: "name",
|
||||
order: 1,
|
||||
locked: false,
|
||||
visible: true,
|
||||
customComponent: StatelessFunctionComponent
|
||||
}];
|
||||
|
||||
var results: MyCustomResult[] = [
|
||||
{
|
||||
name: 'David Hara',
|
||||
test: 'blah'
|
||||
},
|
||||
{
|
||||
name: 'Hara, David',
|
||||
test: 'blah2'
|
||||
}
|
||||
];
|
||||
|
||||
var rowMetaData = {
|
||||
bodyCssClassName: (rowData: MyCustomResult) => {
|
||||
return rowData.test;
|
||||
}
|
||||
};
|
||||
|
||||
type TypedGriddle = new () => Griddle<MyCustomResult>;
|
||||
const TypedGriddle = Griddle as TypedGriddle;
|
||||
|
||||
render(
|
||||
<div>
|
||||
<h1>Custom Column Component Grid</h1>
|
||||
<CustomColumnComponentGrid />
|
||||
<h1>Custom Header Component Grid</h1>
|
||||
<CustomHeaderComponentGrid />
|
||||
<h1>Custom Filter Component Grid</h1>
|
||||
<CustomFilterComponentGrid />
|
||||
<TypedGriddle
|
||||
results={results}
|
||||
columnMetadata={columnMeta}
|
||||
rowMetadata={rowMetaData}
|
||||
sortAscendingComponent={<span className="fa fa-sort-alpha-asc"/>}
|
||||
sortDescendingComponent={<span className="fa fa-sort-alpha-desc"/>}
|
||||
customRowComponent={LinkComponent}
|
||||
/>
|
||||
</div>,
|
||||
document.getElementById('root')
|
||||
);
|
||||
170
griddle-react/index.d.ts
vendored
Normal file
170
griddle-react/index.d.ts
vendored
Normal file
@@ -0,0 +1,170 @@
|
||||
// Type definitions for griddle-react 0.7
|
||||
// Project: https://github.com/griddlegriddle/griddle
|
||||
// Definitions by: David Hara <https://github.com/hodavidhara>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.1
|
||||
|
||||
/*
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2016 David Hara
|
||||
|
||||
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.
|
||||
*/
|
||||
|
||||
import * as React from 'react';
|
||||
|
||||
type ReactClass<T> = React.ComponentClass<T> | React.StatelessComponent<T>
|
||||
|
||||
export interface CustomColumnComponentProps<T> {
|
||||
data: any;
|
||||
rowData: T;
|
||||
metaData: ColumnMetaData<T>;
|
||||
}
|
||||
|
||||
export interface CustomRowComponentProps<T> {
|
||||
data: T;
|
||||
}
|
||||
|
||||
export interface CustomGridComponentProps<T> {
|
||||
data: T[];
|
||||
}
|
||||
|
||||
export interface CustomPagerComponentProps {
|
||||
currentPage: number;
|
||||
maxPage: number;
|
||||
nextText: string;
|
||||
previousText: string;
|
||||
next(): void;
|
||||
previous(): void;
|
||||
setPage(number: number): void;
|
||||
}
|
||||
|
||||
export interface CustomHeaderComponentProps {
|
||||
filterByColumn?(filter: string, columnName: string): void;
|
||||
columnName: string;
|
||||
displayName: string;
|
||||
}
|
||||
|
||||
export interface CustomFilterComponentProps {
|
||||
placeholderText?: string;
|
||||
changeFilter(val: any): void;
|
||||
}
|
||||
|
||||
export interface ColumnMetaData<T> {
|
||||
columnName: string;
|
||||
cssClassName?: string;
|
||||
customComponent?: ReactClass<CustomColumnComponentProps<T>>;
|
||||
customHeaderComponent?: ReactClass<CustomHeaderComponentProps>;
|
||||
customHeaderComponentProps?: {};
|
||||
displayName?: string;
|
||||
locked?: boolean;
|
||||
order?: number;
|
||||
sortable?: boolean;
|
||||
visible?: boolean;
|
||||
}
|
||||
|
||||
export interface BodyCssClassNameFunction<T> {
|
||||
(rowData: T): string;
|
||||
}
|
||||
|
||||
export interface RowMetaData<T> {
|
||||
bodyCssClassName?: BodyCssClassNameFunction<T> | string;
|
||||
}
|
||||
|
||||
export interface GriddleProps<T> {
|
||||
columns?: string[];
|
||||
columnMetadata?: ColumnMetaData<T>[];
|
||||
rowMetadata?: RowMetaData<T>;
|
||||
results?: T[];
|
||||
resultsPerPage?: number;
|
||||
initialSort?: string;
|
||||
initialSortAscending?: boolean;
|
||||
gridClassName?: string;
|
||||
tableClassName?: string;
|
||||
customFormatClassName?: string;
|
||||
settingsText?: string;
|
||||
filterPlaceholderText?: string;
|
||||
nextText?: string;
|
||||
previousText?: string;
|
||||
maxRowsText?: string;
|
||||
enableCustomFormatText?: string;
|
||||
childrenColumnName?: string;
|
||||
metadataColumns?: string[];
|
||||
showFilter?: boolean;
|
||||
showSettings?: boolean;
|
||||
useCustomRowComponent?: boolean;
|
||||
useCustomGridComponent?: boolean;
|
||||
useCustomPagerComponent?: boolean;
|
||||
useCustomFilterer?: boolean;
|
||||
useCustomFilterComponent?: boolean;
|
||||
useGriddleStyles?: boolean;
|
||||
customRowComponent?: ReactClass<CustomRowComponentProps<T>>
|
||||
customGridComponent?: ReactClass<CustomGridComponentProps<T>>
|
||||
customPagerComponent?: ReactClass<CustomPagerComponentProps>
|
||||
customFilterComponent?: ReactClass<CustomFilterComponentProps>
|
||||
customFilterer?(items: T[], query: any): T[];
|
||||
enableToggleCustom?: boolean;
|
||||
noDataMessage?: string;
|
||||
noDataClassName?: string;
|
||||
customNoDataComponent?: ReactClass<void>
|
||||
showTableHeading?: boolean;
|
||||
showPager?: boolean;
|
||||
useFixedHeader?: boolean;
|
||||
useExternal?: boolean;
|
||||
externalSetPage?(index: number): void;
|
||||
externalChangeSort?(sort: string, sortAscending: boolean): void;
|
||||
externalSetFilter?(filter: string): void;
|
||||
externalSetPageSize?(size: number): void;
|
||||
externalMaxPage?: number;
|
||||
externalCurrentPage?: number;
|
||||
externalSortColumn?: string;
|
||||
externalSortAscending?: boolean;
|
||||
externalLoadingComponent?: ReactClass<void>
|
||||
externalIsLoading?: boolean;
|
||||
enableInfiniteScroll?: boolean;
|
||||
bodyHeight?: number;
|
||||
paddingHeight?: number;
|
||||
rowHeight?: number;
|
||||
infiniteScrollLoadTreshold?: number;
|
||||
useFixedLayout?: boolean;
|
||||
isSubGriddle?: boolean;
|
||||
enableSort?: boolean;
|
||||
sortAscendingClassName?: string;
|
||||
sortDescendingClassName?: string;
|
||||
parentRowCollapsedClassName?: string;
|
||||
parentRowExpandedClassName?: string;
|
||||
settingsToggleClassName?: string;
|
||||
nextClassName?: string;
|
||||
previousClassName?: string;
|
||||
sortAscendingComponent?: string | React.ReactElement<any>;
|
||||
sortDescendingComponent?: string | React.ReactElement<any>;
|
||||
sortDefaultComponent?: string | React.ReactElement<any>;
|
||||
parentRowCollapsedComponent?: string | React.ReactElement<any>;
|
||||
parentRowExpandedComponent?: string | React.ReactElement<any>;
|
||||
settingsIconComponent?: string | React.ReactElement<any>;
|
||||
nextIconComponent?: string | React.ReactElement<any>;
|
||||
previousIconComponent?: string | React.ReactElement<any>;
|
||||
onRowClick?(): void;
|
||||
}
|
||||
|
||||
declare class Griddle<T> extends React.Component<GriddleProps<T>, any> {
|
||||
}
|
||||
|
||||
export default Griddle;
|
||||
70
griddle-react/test/CustomColumnComponent.tsx
Normal file
70
griddle-react/test/CustomColumnComponent.tsx
Normal file
@@ -0,0 +1,70 @@
|
||||
/*
|
||||
Licensed under the MIT License (MIT)
|
||||
|
||||
Copyright (c) 2016 David Hara
|
||||
*/
|
||||
|
||||
import * as React from 'react';
|
||||
import Griddle, { CustomColumnComponentProps } from 'griddle-react';
|
||||
|
||||
interface MyCustomResult {
|
||||
name: string,
|
||||
test: string
|
||||
}
|
||||
|
||||
class LinkComponent extends React.Component<CustomColumnComponentProps<MyCustomResult>, any> {
|
||||
render() {
|
||||
var url = "speakers/" + this.props.rowData.test + "/" + this.props.data;
|
||||
return <a href={url}>{this.props.data}</a>
|
||||
}
|
||||
}
|
||||
|
||||
const StatelessFunctionComponent = (props: CustomColumnComponentProps<MyCustomResult>) => {
|
||||
var url = "speakers/" + props.rowData.test + "/" + props.data;
|
||||
return <a href={url}>{props.data}</a>
|
||||
};
|
||||
|
||||
var columnMeta = [
|
||||
{
|
||||
columnName: "name",
|
||||
order: 1,
|
||||
locked: false,
|
||||
visible: true,
|
||||
customComponent: StatelessFunctionComponent
|
||||
}];
|
||||
|
||||
var results: MyCustomResult[] = [
|
||||
{
|
||||
name: 'David Hara',
|
||||
test: 'blah'
|
||||
},
|
||||
{
|
||||
name: 'Hara, David',
|
||||
test: 'blah2'
|
||||
}
|
||||
];
|
||||
|
||||
var rowMetaData = {
|
||||
bodyCssClassName: (rowData: MyCustomResult) => {
|
||||
return rowData.test;
|
||||
}
|
||||
};
|
||||
|
||||
class CustomColumnComponentGrid extends React.Component<any, any> {
|
||||
render() {
|
||||
type TypedGriddle = new () => Griddle<MyCustomResult>;
|
||||
const TypedGriddle = Griddle as TypedGriddle;
|
||||
|
||||
return (
|
||||
<TypedGriddle
|
||||
results={results}
|
||||
columnMetadata={columnMeta}
|
||||
rowMetadata={rowMetaData}
|
||||
sortAscendingComponent={<span className="fa fa-sort-alpha-asc"/>}
|
||||
sortDescendingComponent={<span className="fa fa-sort-alpha-desc"/>}
|
||||
customRowComponent={LinkComponent} />
|
||||
);
|
||||
};
|
||||
}
|
||||
|
||||
export default CustomColumnComponentGrid;
|
||||
91
griddle-react/test/CustomFilterComponent.tsx
Normal file
91
griddle-react/test/CustomFilterComponent.tsx
Normal file
@@ -0,0 +1,91 @@
|
||||
/*
|
||||
Licensed under the MIT License (MIT)
|
||||
|
||||
Copyright (c) 2016 David Hara
|
||||
*/
|
||||
|
||||
import * as _ from 'lodash';
|
||||
import * as React from 'react';
|
||||
import Griddle, { CustomFilterComponentProps } from 'griddle-react';
|
||||
|
||||
const CustomFilterFunction = (items: ResultType[], query: string): ResultType[] => {
|
||||
return _.filter(items, (item) => {
|
||||
|
||||
let match = false;
|
||||
_.forIn(item, (value, key) => {
|
||||
if (String(value).toLowerCase().indexOf(query.toLowerCase()) >= 0) {
|
||||
match = true;
|
||||
return;
|
||||
}
|
||||
});
|
||||
|
||||
return match;
|
||||
});
|
||||
};
|
||||
|
||||
class CustomFilterComponent extends React.Component<CustomFilterComponentProps, any> {
|
||||
query: string = '';
|
||||
|
||||
searchChange(event: React.FormEvent<HTMLInputElement>) {
|
||||
this.query = event.currentTarget.value;
|
||||
this.props.changeFilter(this.query);
|
||||
}
|
||||
|
||||
render() {
|
||||
return (
|
||||
<div className="filter-container">
|
||||
<input type="text"
|
||||
name="search"
|
||||
placeholder="Search..."
|
||||
onChange={this.searchChange.bind(this)}/>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
interface ResultType {
|
||||
id: number;
|
||||
name: string;
|
||||
city: string;
|
||||
state: string;
|
||||
country: string;
|
||||
company: string;
|
||||
favoriteNumber: number;
|
||||
}
|
||||
|
||||
var someData: ResultType[] = [
|
||||
{
|
||||
"id": 0,
|
||||
"name": "Mayer Leonard",
|
||||
"city": "Kapowsin",
|
||||
"state": "Hawaii",
|
||||
"country": "United Kingdom",
|
||||
"company": "Ovolo",
|
||||
"favoriteNumber": 7
|
||||
},
|
||||
{
|
||||
"id": 1,
|
||||
"name": "Koch Becker",
|
||||
"city": "Johnsonburg",
|
||||
"state": "New Jersey",
|
||||
"country": "Madagascar",
|
||||
"company": "Eventage",
|
||||
"favoriteNumber": 2
|
||||
}
|
||||
];
|
||||
|
||||
class CustomFilterComponentGrid extends React.Component<any, any> {
|
||||
render() {
|
||||
|
||||
type TypedGriddle = new () => Griddle<ResultType>;
|
||||
const TypedGriddle = Griddle as TypedGriddle;
|
||||
|
||||
return (
|
||||
<TypedGriddle results={someData} showFilter={true}
|
||||
useCustomFilterer={true} customFilterer={CustomFilterFunction}
|
||||
useCustomFilterComponent={true} customFilterComponent={CustomFilterComponent}/>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
export default CustomFilterComponentGrid;
|
||||
95
griddle-react/test/CustomHeaderComponent.tsx
Normal file
95
griddle-react/test/CustomHeaderComponent.tsx
Normal file
@@ -0,0 +1,95 @@
|
||||
/*
|
||||
Licensed under the MIT License (MIT)
|
||||
|
||||
Copyright (c) 2016 David Hara
|
||||
*/
|
||||
|
||||
import * as React from 'react';
|
||||
import Griddle, { ColumnMetaData, CustomHeaderComponentProps } from 'griddle-react';
|
||||
|
||||
interface MoreCustomHeaderComponentProps extends CustomHeaderComponentProps {
|
||||
color: string;
|
||||
}
|
||||
|
||||
class HeaderComponent extends React.Component<MoreCustomHeaderComponentProps, any> {
|
||||
textOnClick(e: React.FormEvent<HTMLInputElement>) {
|
||||
e.stopPropagation();
|
||||
}
|
||||
|
||||
filterText(e: React.FormEvent<HTMLInputElement>) {
|
||||
this.props.filterByColumn(e.currentTarget.value, this.props.columnName)
|
||||
}
|
||||
|
||||
render() {
|
||||
return (
|
||||
<span>
|
||||
<div><strong style={{color: this.props.color}}>{this.props.displayName}</strong></div>
|
||||
<input type='text' onChange={this.filterText.bind(this)} onClick={this.textOnClick.bind(this)}/>
|
||||
</span>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
interface ResultType {
|
||||
id: number;
|
||||
name: string;
|
||||
city: string;
|
||||
state: string;
|
||||
country: string;
|
||||
company: string;
|
||||
favoriteNumber: number;
|
||||
}
|
||||
|
||||
var someData: ResultType[] = [
|
||||
{
|
||||
"id": 0,
|
||||
"name": "Mayer Leonard",
|
||||
"city": "Kapowsin",
|
||||
"state": "Hawaii",
|
||||
"country": "United Kingdom",
|
||||
"company": "Ovolo",
|
||||
"favoriteNumber": 7
|
||||
},
|
||||
{
|
||||
"id": 1,
|
||||
"name": "Koch Becker",
|
||||
"city": "Johnsonburg",
|
||||
"state": "New Jersey",
|
||||
"country": "Madagascar",
|
||||
"company": "Eventage",
|
||||
"favoriteNumber": 2
|
||||
}
|
||||
];
|
||||
|
||||
var columnMeta: ColumnMetaData<ResultType>[] = [
|
||||
{
|
||||
columnName: 'name',
|
||||
order: 1,
|
||||
sortable: false,
|
||||
visible: true,
|
||||
},
|
||||
{
|
||||
columnName: 'city',
|
||||
customHeaderComponent: HeaderComponent,
|
||||
customHeaderComponentProps: {color: 'red'}
|
||||
},
|
||||
{
|
||||
columnName: 'state',
|
||||
customHeaderComponent: HeaderComponent,
|
||||
customHeaderComponentProps: {color: 'blue'}
|
||||
}
|
||||
];
|
||||
|
||||
class CustomHeaderComponentGrid extends React.Component<any, any> {
|
||||
render() {
|
||||
|
||||
type TypedGriddle = new () => Griddle<ResultType>;
|
||||
const TypedGriddle = Griddle as TypedGriddle;
|
||||
|
||||
return (
|
||||
<TypedGriddle results={someData} columnMetadata={columnMeta} columns={["name", "city", "state", "country"]}/>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
export default CustomHeaderComponentGrid;
|
||||
27
griddle-react/tsconfig.json
Normal file
27
griddle-react/tsconfig.json
Normal file
@@ -0,0 +1,27 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6",
|
||||
"dom"
|
||||
],
|
||||
"jsx": "preserve",
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": false,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"griddle-react-tests.tsx",
|
||||
"test/CustomColumnComponent.tsx",
|
||||
"test/CustomFilterComponent.tsx",
|
||||
"test/CustomHeaderComponent.tsx"
|
||||
]
|
||||
}
|
||||
3
griddle-react/tslint.json
Normal file
3
griddle-react/tslint.json
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"extends": "../tslint.json"
|
||||
}
|
||||
8
joi/index.d.ts
vendored
8
joi/index.d.ts
vendored
@@ -91,6 +91,12 @@ export interface IpOptions {
|
||||
cidr?: string;
|
||||
}
|
||||
|
||||
export type GuidVersions = 'uuidv1' | 'uuidv2' | 'uuidv3' | 'uuidv4' | 'uuidv5'
|
||||
|
||||
export interface GuidOptions {
|
||||
version: GuidVersions[] | GuidVersions
|
||||
}
|
||||
|
||||
export interface UriOptions {
|
||||
/**
|
||||
* Specifies one or more acceptable Schemes, should only include the scheme name.
|
||||
@@ -443,7 +449,7 @@ export interface StringSchema extends AnySchema<StringSchema> {
|
||||
/**
|
||||
* Requires the string value to be a valid GUID.
|
||||
*/
|
||||
guid(): StringSchema;
|
||||
guid(options?: GuidOptions): StringSchema;
|
||||
|
||||
/**
|
||||
* Requires the string value to be a valid hexadecimal string.
|
||||
|
||||
@@ -691,6 +691,8 @@ strSchema = strSchema.ip(ipOpts);
|
||||
strSchema = strSchema.uri();
|
||||
strSchema = strSchema.uri(uriOpts);
|
||||
strSchema = strSchema.guid();
|
||||
strSchema = strSchema.guid({version: ['uuidv1', 'uuidv2', 'uuidv3', 'uuidv4', 'uuidv5']});
|
||||
strSchema = strSchema.guid({version: 'uuidv4'});
|
||||
strSchema = strSchema.hex();
|
||||
strSchema = strSchema.hostname();
|
||||
strSchema = strSchema.isoDate();
|
||||
|
||||
115
maker.js/index.d.ts
vendored
115
maker.js/index.d.ts
vendored
@@ -1,4 +1,4 @@
|
||||
// Type definitions for Maker.js 0.9.31
|
||||
// Type definitions for Maker.js 0.9.33
|
||||
// Project: https://github.com/Microsoft/maker.js
|
||||
// Definitions by: Dan Marshall <https://github.com/danmarshall>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
@@ -66,6 +66,17 @@ declare namespace MakerJs {
|
||||
* @returns String of the flattened array.
|
||||
*/
|
||||
function createRouteKey(route: string[]): string;
|
||||
/**
|
||||
* Travel along a route inside of a model to extract a specific node in its tree.
|
||||
*
|
||||
* @param modelContext Model to travel within.
|
||||
* @param routeKeyOrRoute String of a flattened route, or a string array of route segments.
|
||||
* @returns Model or Path object within the modelContext tree.
|
||||
*/
|
||||
function travel(modelContext: IModel, routeKeyOrRoute: string | string[]): {
|
||||
path: IPath | IModel;
|
||||
offset: IPoint;
|
||||
};
|
||||
/**
|
||||
* Clone an object.
|
||||
*
|
||||
@@ -139,6 +150,15 @@ declare namespace MakerJs {
|
||||
*/
|
||||
high: IPoint;
|
||||
}
|
||||
/**
|
||||
* A measurement of extents, with a center point.
|
||||
*/
|
||||
interface IMeasureWithCenter extends IMeasure {
|
||||
/**
|
||||
* The center point of the rectangle containing the item being measured.
|
||||
*/
|
||||
center: IPoint;
|
||||
}
|
||||
/**
|
||||
* A map of measurements.
|
||||
*/
|
||||
@@ -926,7 +946,7 @@ declare namespace MakerJs.path {
|
||||
*
|
||||
* @param pathToMove The path to move.
|
||||
* @param origin The new origin for the path.
|
||||
* @returns The original path (for chaining).
|
||||
* @returns The original path (for cascading).
|
||||
*/
|
||||
function move(pathToMove: IPath, origin: IPoint): IPath;
|
||||
/**
|
||||
@@ -935,7 +955,7 @@ declare namespace MakerJs.path {
|
||||
* @param pathToMove The path to move.
|
||||
* @param delta The x & y adjustments as a point object.
|
||||
* @param subtract Optional boolean to subtract instead of add.
|
||||
* @returns The original path (for chaining).
|
||||
* @returns The original path (for cascading).
|
||||
*/
|
||||
function moveRelative(pathToMove: IPath, delta: IPoint, subtract?: boolean): IPath;
|
||||
/**
|
||||
@@ -952,7 +972,7 @@ declare namespace MakerJs.path {
|
||||
* @param pathToRotate The path to rotate.
|
||||
* @param angleInDegrees The amount of rotation, in degrees.
|
||||
* @param rotationOrigin The center point of rotation.
|
||||
* @returns The original path (for chaining).
|
||||
* @returns The original path (for cascading).
|
||||
*/
|
||||
function rotate(pathToRotate: IPath, angleInDegrees: number, rotationOrigin?: IPoint): IPath;
|
||||
/**
|
||||
@@ -960,7 +980,7 @@ declare namespace MakerJs.path {
|
||||
*
|
||||
* @param pathToScale The path to scale.
|
||||
* @param scaleValue The amount of scaling.
|
||||
* @returns The original path (for chaining).
|
||||
* @returns The original path (for cascading).
|
||||
*/
|
||||
function scale(pathToScale: IPath, scaleValue: number): IPath;
|
||||
/**
|
||||
@@ -1215,11 +1235,11 @@ declare namespace MakerJs.model {
|
||||
*/
|
||||
function mirror(modelToMirror: IModel, mirrorX: boolean, mirrorY: boolean): IModel;
|
||||
/**
|
||||
* Move a model to an absolute point. Note that this is also accomplished by directly setting the origin property. This function exists for chaining.
|
||||
* Move a model to an absolute point. Note that this is also accomplished by directly setting the origin property. This function exists for cascading.
|
||||
*
|
||||
* @param modelToMove The model to move.
|
||||
* @param origin The new position of the model.
|
||||
* @returns The original model (for chaining).
|
||||
* @returns The original model (for cascading).
|
||||
*/
|
||||
function move(modelToMove: IModel, origin: IPoint): IModel;
|
||||
/**
|
||||
@@ -1227,7 +1247,7 @@ declare namespace MakerJs.model {
|
||||
*
|
||||
* @param modelToMove The model to move.
|
||||
* @param delta The x & y adjustments as a point object.
|
||||
* @returns The original model (for chaining).
|
||||
* @returns The original model (for cascading).
|
||||
*/
|
||||
function moveRelative(modelToMove: IModel, delta: IPoint): IModel;
|
||||
/**
|
||||
@@ -1235,7 +1255,7 @@ declare namespace MakerJs.model {
|
||||
*
|
||||
* @param modelToPrefix The model to prefix.
|
||||
* @param prefix The prefix to prepend on paths ids.
|
||||
* @returns The original model (for chaining).
|
||||
* @returns The original model (for cascading).
|
||||
*/
|
||||
function prefixPathIds(modelToPrefix: IModel, prefix: string): IModel;
|
||||
/**
|
||||
@@ -1244,7 +1264,7 @@ declare namespace MakerJs.model {
|
||||
* @param modelToRotate The model to rotate.
|
||||
* @param angleInDegrees The amount of rotation, in degrees.
|
||||
* @param rotationOrigin The center point of rotation.
|
||||
* @returns The original model (for chaining).
|
||||
* @returns The original model (for cascading).
|
||||
*/
|
||||
function rotate(modelToRotate: IModel, angleInDegrees: number, rotationOrigin?: IPoint): IModel;
|
||||
/**
|
||||
@@ -1253,7 +1273,7 @@ declare namespace MakerJs.model {
|
||||
* @param modelToScale The model to scale.
|
||||
* @param scaleValue The amount of scaling.
|
||||
* @param scaleOrigin Optional boolean to scale the origin point. Typically false for the root model.
|
||||
* @returns The original model (for chaining).
|
||||
* @returns The original model (for cascading).
|
||||
*/
|
||||
function scale(modelToScale: IModel, scaleValue: number, scaleOrigin?: boolean): IModel;
|
||||
/**
|
||||
@@ -1261,7 +1281,7 @@ declare namespace MakerJs.model {
|
||||
*
|
||||
* @param modeltoConvert The model to convert.
|
||||
* @param destUnitType The unit system.
|
||||
* @returns The scaled model (for chaining).
|
||||
* @returns The scaled model (for cascading).
|
||||
*/
|
||||
function convertUnits(modeltoConvert: IModel, destUnitType: string): IModel;
|
||||
/**
|
||||
@@ -1373,7 +1393,7 @@ declare namespace MakerJs.model {
|
||||
*
|
||||
* @param modelContext The originated model to search for similar paths.
|
||||
* @param options Optional options object.
|
||||
* @returns The simplified model (for chaining).
|
||||
* @returns The simplified model (for cascading).
|
||||
*/
|
||||
function simplify(modelToSimplify: IModel, options?: ISimplifyOptions): IModel;
|
||||
}
|
||||
@@ -1478,7 +1498,7 @@ declare namespace MakerJs.measure {
|
||||
* @param baseMeasure The measurement to increase.
|
||||
* @param addMeasure The additional measurement.
|
||||
* @param addOffset Optional offset point of the additional measurement.
|
||||
* @returns The increased original measurement (for chaining).
|
||||
* @returns The increased original measurement (for cascading).
|
||||
*/
|
||||
function increase(baseMeasure: IMeasure, addMeasure: IMeasure): IMeasure;
|
||||
/**
|
||||
@@ -1583,7 +1603,7 @@ declare namespace MakerJs.measure {
|
||||
* @param atlas Optional atlas to save measurements.
|
||||
* @returns object with low and high points.
|
||||
*/
|
||||
function modelExtents(modelToMeasure: IModel, atlas?: measure.Atlas): IMeasure;
|
||||
function modelExtents(modelToMeasure: IModel, atlas?: measure.Atlas): IMeasureWithCenter;
|
||||
/**
|
||||
* A list of maps of measurements.
|
||||
*
|
||||
@@ -1612,6 +1632,22 @@ declare namespace MakerJs.measure {
|
||||
constructor(modelContext: IModel);
|
||||
measureModels(): void;
|
||||
}
|
||||
/**
|
||||
* A hexagon which surrounds a model.
|
||||
*/
|
||||
interface IBoundingHex extends IModel {
|
||||
/**
|
||||
* Radius of the hexagon, which is also the length of a side.
|
||||
*/
|
||||
radius: number;
|
||||
}
|
||||
/**
|
||||
* Measures the minimum bounding hexagon surrounding a model. The hexagon is oriented such that the right and left sides are vertical, and the top and bottom are pointed.
|
||||
*
|
||||
* @param modelToMeasure The model to measure.
|
||||
* @returns IBoundingHex object which is a hexagon model, with an additional radius property.
|
||||
*/
|
||||
function boundingHexagon(modelToMeasure: IModel): IBoundingHex;
|
||||
}
|
||||
declare namespace MakerJs.exporter {
|
||||
/**
|
||||
@@ -1787,6 +1823,29 @@ declare namespace MakerJs.model {
|
||||
function findChains(modelContext: IModel, callback: IChainCallback, options?: IFindChainsOptions): void;
|
||||
}
|
||||
declare namespace MakerJs.chain {
|
||||
/**
|
||||
* Shift the links of an endless chain.
|
||||
*
|
||||
* @param chainContext Chain to cycle through. Must be endless.
|
||||
* @param amount Optional number of links to shift. May be negative to cycle backwards.
|
||||
* @returns The chainContext for cascading.
|
||||
*/
|
||||
function cycle(chainContext: IChain, amount?: number): IChain;
|
||||
/**
|
||||
* Reverse the links of a chain.
|
||||
*
|
||||
* @param chainContext Chain to reverse.
|
||||
* @returns The chainContext for cascading.
|
||||
*/
|
||||
function reverse(chainContext: IChain): IChain;
|
||||
/**
|
||||
* Set the beginning of an endless chain to a known routeKey of a path.
|
||||
*
|
||||
* @param chainContext Chain to cycle through. Must be endless.
|
||||
* @param routeKey RouteKey of the desired path to start the chain with.
|
||||
* @returns The chainContext for cascading.
|
||||
*/
|
||||
function startAt(chainContext: IChain, routeKey: string): IChain;
|
||||
/**
|
||||
* Get points along a chain of paths.
|
||||
*
|
||||
@@ -1825,7 +1884,7 @@ declare namespace MakerJs.model {
|
||||
*
|
||||
* @param modelContext The model to search for dead ends.
|
||||
* @param options Optional options object.
|
||||
* @returns The input model (for chaining).
|
||||
* @returns The input model (for cascading).
|
||||
*/
|
||||
function removeDeadEnds(modelContext: IModel, pointMatchingDistance?: any, keep?: IWalkPathBooleanCallback): IModel;
|
||||
}
|
||||
@@ -2123,6 +2182,18 @@ declare namespace MakerJs.models {
|
||||
* @param numericList String containing a list of numbers which can be delimited by spaces, commas, or anything non-numeric (Note: [exponential notation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/toExponential) is allowed).
|
||||
*/
|
||||
constructor(numericList: string);
|
||||
/**
|
||||
* Create a model by connecting points designated in a string. The model will be 'closed' - i.e. the last point will connect to the first point.
|
||||
*
|
||||
* Example:
|
||||
* ```
|
||||
* var c = new makerjs.models.ConnectTheDots(false, '-10 0 10 0 0 20'); // 3 coordinates to form a polyline
|
||||
* ```
|
||||
*
|
||||
* @param isClosed Flag to specify if last point should connect to the first point.
|
||||
* @param numericList String containing a list of numbers which can be delimited by spaces, commas, or anything non-numeric (Note: [exponential notation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/toExponential) is allowed).
|
||||
*/
|
||||
constructor(isClosed: boolean, numericList: string);
|
||||
/**
|
||||
* Create a model by connecting points designated in a numeric array. The model will be 'closed' - i.e. the last point will connect to the first point.
|
||||
*
|
||||
@@ -2134,6 +2205,18 @@ declare namespace MakerJs.models {
|
||||
* @param coords Array of coordinates.
|
||||
*/
|
||||
constructor(coords: number[]);
|
||||
/**
|
||||
* Create a model by connecting points designated in a numeric array. The model will be 'closed' - i.e. the last point will connect to the first point.
|
||||
*
|
||||
* Example:
|
||||
* ```
|
||||
* var c = new makerjs.models.ConnectTheDots(false, [-10, 0, 10, 0, 0, 20]); // 3 coordinates to form a polyline
|
||||
* ```
|
||||
*
|
||||
* @param isClosed Flag to specify if last point should connect to the first point.
|
||||
* @param coords Array of coordinates.
|
||||
*/
|
||||
constructor(isClosed: boolean, coords: number[]);
|
||||
/**
|
||||
* Create a model by connecting points designated in an array of points. The model may be closed, or left open.
|
||||
*
|
||||
|
||||
@@ -51,6 +51,7 @@ function test() {
|
||||
makerjs.isPoint([]);
|
||||
makerjs.pathType.Circle;
|
||||
makerjs.round(44.44444, .01);
|
||||
makerjs.travel(model, '');
|
||||
makerjs.unitType.Millimeter;
|
||||
new makerjs.Collector();
|
||||
}
|
||||
@@ -105,6 +106,7 @@ function test() {
|
||||
}
|
||||
|
||||
function testMeasure() {
|
||||
makerjs.measure.boundingHexagon(model).radius;
|
||||
makerjs.measure.increase(mp, mm);
|
||||
makerjs.measure.isPointEqual(p1, p2);
|
||||
makerjs.measure.isPathEqual(paths.line, paths.circle, 4);
|
||||
@@ -123,6 +125,7 @@ function test() {
|
||||
makerjs.measure.pointDistance([0,0], [9,9]);
|
||||
new makerjs.measure.Atlas(model);
|
||||
mm.low[0];
|
||||
mm.center;
|
||||
mp.high[1];
|
||||
var s = makerjs.measure.lineSlope(paths.line);
|
||||
makerjs.measure.isPointOnSlope([], s);
|
||||
@@ -172,6 +175,10 @@ function test() {
|
||||
new makerjs.models.BoltCircle(7, 7, 7, 7),
|
||||
new makerjs.models.BoltRectangle(2, 2, 2),
|
||||
new makerjs.models.ConnectTheDots(true, [ [0,0], [1,1] ]),
|
||||
new makerjs.models.ConnectTheDots([0, 0, 1, 1]),
|
||||
new makerjs.models.ConnectTheDots(true, [0, 0, 1, 1]),
|
||||
new makerjs.models.ConnectTheDots(true, '0, 0, 1, 1'),
|
||||
new makerjs.models.ConnectTheDots('0, 0, 1, 1'),
|
||||
new makerjs.models.Dogbone(1,1,1),
|
||||
new makerjs.models.Dome(5, 7),
|
||||
new makerjs.models.Ellipse(2,2),
|
||||
@@ -255,7 +262,10 @@ function test() {
|
||||
}
|
||||
|
||||
function testChain() {
|
||||
makerjs.chain.cycle(chain, 7);
|
||||
makerjs.chain.fillet(chain, 1);
|
||||
makerjs.chain.reverse(chain);
|
||||
makerjs.chain.startAt(chain, '');
|
||||
makerjs.chain.toKeyPoints(chain);
|
||||
makerjs.chain.toPoints(chain, 1);
|
||||
}
|
||||
|
||||
6
material-ui/index.d.ts
vendored
6
material-ui/index.d.ts
vendored
@@ -533,7 +533,7 @@ declare namespace __MaterialUI {
|
||||
type cornersAndCenter = 'bottom-center' | 'bottom-left' | 'bottom-right' | 'top-center' | 'top-left' | 'top-right';
|
||||
}
|
||||
|
||||
interface AutoCompleteProps<DataItem> {
|
||||
interface AutoCompleteProps<DataItem> extends TextFieldProps {
|
||||
anchorOrigin?: propTypes.origin;
|
||||
animated?: boolean;
|
||||
animation?: React.ComponentClass<Popover.PopoverAnimationProps>;
|
||||
@@ -723,6 +723,7 @@ declare namespace __MaterialUI {
|
||||
className?: string;
|
||||
disableTouchRipple?: boolean;
|
||||
disabled?: boolean;
|
||||
hoveredStyle?: React.CSSProperties;
|
||||
iconClassName?: string;
|
||||
iconStyle?: React.CSSProperties;
|
||||
onBlur?: React.FocusEventHandler<{}>;
|
||||
@@ -1331,6 +1332,9 @@ declare namespace __MaterialUI {
|
||||
className?: string;
|
||||
maxHeight?: number;
|
||||
menuStyle?: any;
|
||||
listStyle?: React.CSSProperties;
|
||||
menuItemStyle?: React.CSSProperties;
|
||||
selectedMenuItemStyle?: React.CSSProperties;
|
||||
openImmediately?: boolean;
|
||||
}
|
||||
export class SelectField extends React.Component<SelectFieldProps, {}> {
|
||||
|
||||
2
meteor/index.d.ts
vendored
2
meteor/index.d.ts
vendored
@@ -605,7 +605,7 @@ declare namespace Meteor {
|
||||
function setTimeout(func: Function, delay: number): number;
|
||||
var settings: { public: {[id:string]: any}, private: {[id:string]: any}, [id:string]: any};
|
||||
function startup(func: Function): void;
|
||||
function status(): Meteor.StatusEnum;
|
||||
function status(): DDP.DDPStatus;
|
||||
function subscribe(name: string, ...args: any[]): Meteor.SubscriptionHandle;
|
||||
function user(): Meteor.User;
|
||||
function userId(): string;
|
||||
|
||||
3
mongoose/index.d.ts
vendored
3
mongoose/index.d.ts
vendored
@@ -385,6 +385,9 @@ declare module "mongoose" {
|
||||
* If connecting to multiple mongos servers, set the mongos option to true.
|
||||
*/
|
||||
mongos?: boolean;
|
||||
|
||||
/** sets the underlying driver's promise library (see http://mongodb.github.io/node-mongodb-native/2.1/api/MongoClient.html) */
|
||||
promiseLibrary?: any;
|
||||
}
|
||||
|
||||
interface ConnectionOptions extends
|
||||
|
||||
38
node-forge/index.d.ts
vendored
38
node-forge/index.d.ts
vendored
@@ -1,6 +1,7 @@
|
||||
// Type definitions for node-forge 0.6.42
|
||||
// Project: https://github.com/digitalbazaar/forge
|
||||
// Definitions by: Seth Westphal <https://github.com/westy92>
|
||||
// Kay Schecker <https://github.com/flynetworks>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
declare module "node-forge" {
|
||||
@@ -23,6 +24,7 @@ declare module "node-forge" {
|
||||
|
||||
function privateKeyToPem(key: Key, maxline?: number): PEM;
|
||||
function publicKeyToPem(key: Key, maxline?: number): PEM;
|
||||
function certificateToPem(cert: Certificate, maxline?: number): PEM;
|
||||
|
||||
interface oids {
|
||||
[key: string]: string;
|
||||
@@ -234,4 +236,40 @@ declare module "node-forge" {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
namespace pkcs12 {
|
||||
|
||||
interface BagsFilter {
|
||||
localKeyId?: string;
|
||||
localKeyIdHex?: string;
|
||||
friendlyName?: string;
|
||||
bagType?: string;
|
||||
}
|
||||
|
||||
interface Bag {
|
||||
type: string;
|
||||
attributes: any;
|
||||
key?: pki.Key;
|
||||
cert?: pki.Certificate;
|
||||
asn1: asn1.Asn1
|
||||
}
|
||||
|
||||
interface Pkcs12Pfx {
|
||||
version: string;
|
||||
safeContents: [{
|
||||
encrypted: boolean;
|
||||
safeBags: Bag[];
|
||||
}];
|
||||
getBags: (filter: BagsFilter) => {
|
||||
[key: string]: Bag[];
|
||||
localKeyId?: Bag[];
|
||||
friendlyName?: Bag[];
|
||||
};
|
||||
getBagsByFriendlyName: (fiendlyName: string, bagType: string) => Bag[]
|
||||
getBagsByLocalKeyId: (localKeyId: string, bagType: string) => Bag[]
|
||||
}
|
||||
|
||||
function pkcs12FromAsn1(obj:any, strict?: boolean, password?: string) : Pkcs12Pfx;
|
||||
function pkcs12FromAsn1(obj:any, password?: string) : Pkcs12Pfx;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -305,6 +305,12 @@
|
||||
"typingsPackageName": "gaea-model",
|
||||
"sourceRepoURL": "https://github.com/ascoders/gaea-model",
|
||||
"asOfVersion": "0.0.0"
|
||||
},
|
||||
{
|
||||
"libraryName": "Raven JS",
|
||||
"typingsPackageName": "raven-js",
|
||||
"sourceRepoURL": "https://github.com/getsentry/raven-js",
|
||||
"asOfVersion": "3.10.0"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
25
passport-facebook/index.d.ts
vendored
25
passport-facebook/index.d.ts
vendored
@@ -31,12 +31,31 @@ interface IStrategyOption {
|
||||
scopeSeparator?: string;
|
||||
enableProof?: boolean;
|
||||
profileFields?: string[];
|
||||
passReqToCallback?: boolean;
|
||||
}
|
||||
|
||||
interface IStrategyOptionWithRequest {
|
||||
clientID: string;
|
||||
clientSecret: string;
|
||||
callbackURL: string;
|
||||
|
||||
scopeSeparator?: string;
|
||||
enableProof?: boolean;
|
||||
profileFields?: string[];
|
||||
passReqToCallback: boolean;
|
||||
}
|
||||
|
||||
interface VerifyFunction {
|
||||
(accessToken: string, refreshToken: string, profile: Profile, done: (error: any, user?: any, info?: any) => void): void;
|
||||
}
|
||||
|
||||
interface VerifyFunctionWithRequest {
|
||||
(req: express.Request, accessToken: string, refreshToken: string, profile: Profile, done: (error: any, user?: any, info?: any) => void): void;
|
||||
}
|
||||
|
||||
declare class Strategy implements passport.Strategy {
|
||||
constructor(options: IStrategyOption,
|
||||
verify: (accessToken: string, refreshToken: string, profile: Profile, done: (error: any, user?: any, info?: any) => void) => void);
|
||||
constructor(options: IStrategyOptionWithRequest, verify: VerifyFunctionWithRequest);
|
||||
constructor(options: IStrategyOption, verify: VerifyFunction);
|
||||
|
||||
name: string;
|
||||
authenticate: (req: express.Request, options?: Object) => void;
|
||||
}
|
||||
|
||||
125
proj4/index.d.ts
vendored
125
proj4/index.d.ts
vendored
@@ -1,102 +1,67 @@
|
||||
// Type definitions for proj4 2.3.15
|
||||
// Type definitions for proj4 2.3
|
||||
// Project: https://github.com/proj4js/proj4js
|
||||
// Definitions by: Denis Carriere <https://github.com/DenisCarriere>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
declare module "proj4" {
|
||||
const TemplateCoordinates: Array<number> | InterfaceCoordinates;
|
||||
declare namespace proj4 {
|
||||
type TemplateCoordinates = number[] | InterfaceCoordinates;
|
||||
|
||||
interface InterfaceCoordinates {
|
||||
x: number,
|
||||
y: number,
|
||||
z?: number,
|
||||
m?: number
|
||||
x: number;
|
||||
y: number;
|
||||
z?: number;
|
||||
m?: number;
|
||||
}
|
||||
|
||||
interface InterfaceDatum {
|
||||
datum_type: number
|
||||
a: number
|
||||
b: number
|
||||
es: number
|
||||
ep2: number
|
||||
datum_type: number;
|
||||
a: number;
|
||||
b: number;
|
||||
es: number;
|
||||
ep2: number;
|
||||
}
|
||||
|
||||
interface Proj4Static {
|
||||
forward(coordinates: typeof TemplateCoordinates): Array<number>
|
||||
inverse(coordinates: typeof TemplateCoordinates): Array<number>
|
||||
interface Static {
|
||||
forward(coordinates: TemplateCoordinates): number[];
|
||||
inverse(coordinates: TemplateCoordinates): number[];
|
||||
}
|
||||
|
||||
interface InterfaceProjection {
|
||||
datum: string
|
||||
b: number
|
||||
rf: number
|
||||
sphere: number
|
||||
es: number
|
||||
e: number
|
||||
ep2: number
|
||||
forward(coordinates: typeof TemplateCoordinates): Array<number>
|
||||
inverse(coordinates: typeof TemplateCoordinates): Array<number>
|
||||
datum: string;
|
||||
b: number;
|
||||
rf: number;
|
||||
sphere: number;
|
||||
es: number;
|
||||
e: number;
|
||||
ep2: number;
|
||||
forward(coordinates: TemplateCoordinates): number[];
|
||||
inverse(coordinates: TemplateCoordinates): number[];
|
||||
}
|
||||
|
||||
namespace proj4 {
|
||||
/**
|
||||
* @name defaultDatum
|
||||
*/
|
||||
export const defaultDatum: string;
|
||||
export const defaultDatum: string;
|
||||
|
||||
/**
|
||||
* @name Proj
|
||||
*/
|
||||
export function Proj(srsCode:any, callback?: any): InterfaceProjection;
|
||||
|
||||
/**
|
||||
* @name WGS84
|
||||
*/
|
||||
export const WGS84: any;
|
||||
export function Proj(srsCode: any, callback?: any): InterfaceProjection;
|
||||
|
||||
/**
|
||||
* Depecrated v3
|
||||
* @name Point
|
||||
*/
|
||||
export function Point(x: number, y: number, z?: number): InterfaceCoordinates;
|
||||
export function Point(coordinates: Array<number>): InterfaceCoordinates;
|
||||
export function Point(coordinates: InterfaceCoordinates): InterfaceCoordinates;
|
||||
export function Point(coordinates: string): InterfaceCoordinates;
|
||||
|
||||
/**
|
||||
* @name toPoint
|
||||
*/
|
||||
export function toPoint(array: Array<number>): InterfaceCoordinates;
|
||||
|
||||
/**
|
||||
* @name defs
|
||||
*/
|
||||
export function defs(name: string): any;
|
||||
export function defs(name: string, projection: string): any;
|
||||
export function defs(name: Array<Array<string>>): any;
|
||||
|
||||
/**
|
||||
* @name transform
|
||||
*/
|
||||
export function transform(source: InterfaceProjection, dest: InterfaceProjection, point: typeof TemplateCoordinates): any;
|
||||
|
||||
/**
|
||||
* @name mgrs
|
||||
*/
|
||||
export function mgrs(coordinates: Array<number>, accuracy: number): string;
|
||||
|
||||
/**
|
||||
* @name version
|
||||
*/
|
||||
export const version: string;
|
||||
}
|
||||
export const WGS84: any;
|
||||
|
||||
/**
|
||||
* @name proj4
|
||||
* Depecrated v3
|
||||
*/
|
||||
function proj4(fromProjection: string): Proj4Static;
|
||||
function proj4(fromProjection: string, toProjection: string): Proj4Static;
|
||||
function proj4(fromProjection: string, coordinates: typeof TemplateCoordinates): Array<number>;
|
||||
function proj4(fromProjection: string, toProjection: string, coordinates: typeof TemplateCoordinates): Array<number>;
|
||||
export = proj4
|
||||
export function Point(x: number, y: number, z?: number): InterfaceCoordinates;
|
||||
export function Point(coordinates: TemplateCoordinates | string): InterfaceCoordinates;
|
||||
|
||||
export function toPoint(array: number[]): InterfaceCoordinates;
|
||||
|
||||
export function defs(name: string, projection?: string): any;
|
||||
export function defs(name: string[][]): any;
|
||||
|
||||
export function transform(source: InterfaceProjection, dest: InterfaceProjection, point: TemplateCoordinates): any;
|
||||
|
||||
export function mgrs(coordinates: number[], accuracy: number): string;
|
||||
|
||||
export const version: string;
|
||||
}
|
||||
|
||||
declare function proj4(fromProjection: string, toProjection?: string, coordinates?: proj4.TemplateCoordinates): proj4.Static;
|
||||
declare function proj4(fromProjection: string, coordinates: proj4.TemplateCoordinates): number[];
|
||||
export = proj4;
|
||||
|
||||
@@ -1,49 +1,49 @@
|
||||
import * as proj4 from 'proj4'
|
||||
import * as proj4 from 'proj4';
|
||||
|
||||
///////////////////////////////////////////
|
||||
// Tests data initialisation
|
||||
///////////////////////////////////////////
|
||||
const name = 'WGS84'
|
||||
const name = 'WGS84';
|
||||
const epsg = {
|
||||
4269: '+title=NAD83 (long/lat) +proj=longlat +a=6378137.0 +b=6356752.31414036 +ellps=GRS80 +datum=NAD83 +units=degrees',
|
||||
4326: '+title=WGS 84 (long/lat) +proj=longlat +ellps=WGS84 +datum=WGS84 +units=degrees',
|
||||
}
|
||||
const point1 = [-71, 41]
|
||||
const point2 = {x: 2, y: 5}
|
||||
const mgrs = "24XWT783908"
|
||||
};
|
||||
const point1 = [-71, 41];
|
||||
const point2 = {x: 2, y: 5};
|
||||
const mgrs = "24XWT783908";
|
||||
|
||||
///////////////////////////////////////////
|
||||
// Tests Measurement
|
||||
///////////////////////////////////////////
|
||||
proj4(epsg['4269'], epsg['4326'], point1)
|
||||
proj4(epsg['4269'], point1)
|
||||
proj4(epsg['4269'], epsg['4326']).forward(point2)
|
||||
proj4(epsg['4269'], epsg['4326']).inverse(point2)
|
||||
proj4(epsg['4269'], epsg['4326'], point1);
|
||||
proj4(epsg['4269'], point1);
|
||||
proj4(epsg['4269'], epsg['4326']).forward(point2);
|
||||
proj4(epsg['4269'], epsg['4326']).inverse(point2);
|
||||
|
||||
///////////////////////////////////
|
||||
// Named Projections
|
||||
///////////////////////////////////
|
||||
proj4.defs('WGS84', epsg['4326'])
|
||||
proj4.defs('WGS84', epsg['4326']);
|
||||
proj4.defs([
|
||||
['EPSG:4326', epsg['4326']],
|
||||
['EPSG:4269', epsg['4269']]
|
||||
])
|
||||
proj4.defs('urn:x-ogc:def:crs:EPSG:4326', proj4.defs('EPSG:4326'))
|
||||
]);
|
||||
proj4.defs('urn:x-ogc:def:crs:EPSG:4326', proj4.defs('EPSG:4326'));
|
||||
|
||||
///////////////////////////////////
|
||||
// Utils
|
||||
///////////////////////////////////
|
||||
// WGS84
|
||||
proj4.WGS84
|
||||
proj4.WGS84;
|
||||
|
||||
// Proj
|
||||
proj4.Proj('WGS84')
|
||||
proj4.Proj('WGS84');
|
||||
|
||||
// toPoint
|
||||
proj4.toPoint([1, 2])
|
||||
proj4.toPoint([1, 2, 3])
|
||||
proj4.toPoint([1, 2, 3, 4])
|
||||
proj4.toPoint([1, 2]);
|
||||
proj4.toPoint([1, 2, 3]);
|
||||
proj4.toPoint([1, 2, 3, 4]);
|
||||
|
||||
// Point
|
||||
// WARNING: Deprecated in v3
|
||||
proj4.Point([1, 2, 3, 4])
|
||||
proj4.Point([1, 2, 3, 4]);
|
||||
1
proj4/tslint.json
Normal file
1
proj4/tslint.json
Normal file
@@ -0,0 +1 @@
|
||||
{ "extends": "../tslint.json" }
|
||||
1
protractor-helpers/index.d.ts
vendored
1
protractor-helpers/index.d.ts
vendored
@@ -2,6 +2,7 @@
|
||||
// Project: https://github.com/wix/protractor-helpers
|
||||
// Definitions by: John Cant <https://github.com/johncant/>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.1
|
||||
|
||||
/// <reference types="selenium-webdriver" />
|
||||
|
||||
|
||||
4
ramda/index.d.ts
vendored
4
ramda/index.d.ts
vendored
@@ -185,8 +185,8 @@ declare namespace R {
|
||||
* Returns a new list, composed of n-tuples of consecutive elements If n is greater than the length of the list,
|
||||
* an empty list is returned.
|
||||
*/
|
||||
aperture<T>(n: number, list: T): T[][];
|
||||
aperture(n: number): <T>(list: T) => T[][];
|
||||
aperture<T>(n: number, list: T[]): T[][];
|
||||
aperture(n: number): <T>(list: T[]) => T[][];
|
||||
|
||||
/**
|
||||
* Returns a new list containing the contents of the given list, followed by the given element.
|
||||
|
||||
338
raven-js/index.d.ts
vendored
338
raven-js/index.d.ts
vendored
@@ -1,338 +0,0 @@
|
||||
// Type definitions for Raven.js
|
||||
// Project: https://github.com/getsentry/raven-js
|
||||
// Definitions by: Santi Albo <https://github.com/santialbo/>, Benjamin Pannell <http://github.com/spartan563>, Gary Blackwood <http://github.com/Garee>, Rich Rout <http://github.com/richrout>, Ben Vinegar <https://github.com/benvinegar>, Ilya Pirogov <https://github.com/ilya-pirogov>, Eli White <https://github.com/TheSavior>, David Cramer <https://github.com/dcramer>, Connor Peet <https://github.com/connor4312>, comaz <https://github.com/combmag>, Luca Vazzano <https://github.com/LucaVazz>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
|
||||
declare let Raven: RavenStatic;
|
||||
export default Raven;
|
||||
|
||||
interface RavenStatic {
|
||||
/** Raven.js version. */
|
||||
VERSION: string;
|
||||
|
||||
/** A list of currently active plugins. */
|
||||
Plugins: { [id: string]: RavenPlugin };
|
||||
|
||||
/**
|
||||
* Allow Raven to be configured as soon as it is loaded.
|
||||
* It uses a global RavenConfig = {dsn: '...', config: {}}
|
||||
*/
|
||||
afterLoad(): void;
|
||||
|
||||
/**
|
||||
* Allow multiple versions of Raven to be installed.
|
||||
* Strip Raven from the global context and returns the instance.
|
||||
*/
|
||||
noConflict(): RavenStatic;
|
||||
|
||||
/**
|
||||
* Configure Raven with a DSN and extra options
|
||||
*
|
||||
* @param dsn The public Sentry DSN
|
||||
* @param options Optional set of of global options
|
||||
*/
|
||||
config(dsn: string, options?: RavenGlobalOptions): RavenStatic;
|
||||
|
||||
/**
|
||||
* Set the DSN (can be called multiple times, unlike config)
|
||||
*
|
||||
* @param dsn The public Sentry DSN
|
||||
*/
|
||||
setDSN(dsn: string): RavenStatic;
|
||||
|
||||
/**
|
||||
* Installs a global window.onerror error handler to capture and report uncaught exceptions.
|
||||
* At this point, install() is required to be called due to the way TraceKit is set up.
|
||||
*/
|
||||
install(): RavenStatic;
|
||||
|
||||
/**
|
||||
* Adds a plugin to Raven
|
||||
*/
|
||||
addPlugin(plugin: RavenPlugin, ...pluginArgs: any[]): RavenStatic;
|
||||
|
||||
/**
|
||||
* Wrap code within a context so Raven can capture errors reliably across domains that is
|
||||
* executed immediately.
|
||||
*
|
||||
* @param options A specific set of options for this context
|
||||
* @param func The callback to be immediately executed within the context
|
||||
* @param args An array of arguments to be called with the callback
|
||||
*/
|
||||
context(func: Function, ...args: any[]): void;
|
||||
context(options: RavenWrapOptions, func: Function, ...args: any[]): void;
|
||||
|
||||
/**
|
||||
* Wrap code within a context and returns back a new function to be executed
|
||||
*
|
||||
* @param options A specific set of options for this context
|
||||
* @param func The function to be wrapped in a new context
|
||||
* @return The newly wrapped functions with a context
|
||||
*/
|
||||
wrap(func: Function): Function;
|
||||
wrap(options: RavenWrapOptions, func: Function): Function;
|
||||
wrap<T extends Function>(func: T): T;
|
||||
wrap<T extends Function>(options: RavenWrapOptions, func: T): T;
|
||||
|
||||
/**
|
||||
* Uninstalls the global error handler.
|
||||
*/
|
||||
uninstall(): RavenStatic;
|
||||
|
||||
/**
|
||||
* Manually capture an exception and send it over to Sentry
|
||||
*
|
||||
* @param ex An exception to be logged
|
||||
* @param options A specific set of options for this error
|
||||
*/
|
||||
captureException(ex: Error, options?: RavenOptions): RavenStatic;
|
||||
|
||||
/*
|
||||
* Manually send a message to Sentry
|
||||
*
|
||||
* @param msg A plain message to be captured in Sentry
|
||||
* @param options A specific set of options for this message
|
||||
*/
|
||||
captureMessage(msg: string, options?: RavenOptions): RavenStatic;
|
||||
|
||||
/**
|
||||
* Add a breadcrumb
|
||||
* @param crumb The trail which should be added to the trail
|
||||
*/
|
||||
captureBreadcrumb(crumb: RavenBreadcrumb): RavenStatic;
|
||||
|
||||
/**
|
||||
* Set a user to be sent along with payloads.
|
||||
*
|
||||
* @param user The definition of the currently active user's unique identity
|
||||
*/
|
||||
setUserContext(user: RavenUserContext): RavenStatic;
|
||||
|
||||
/**
|
||||
* Clear the user context, removing the user data that would be sent to Sentry.
|
||||
*/
|
||||
setUserContext(): RavenStatic;
|
||||
|
||||
/**
|
||||
* Add arbitrary data to be sent along with the payload.
|
||||
* @param extra data of an arbitrary, nested type which will be added
|
||||
*/
|
||||
setExtraContext(extra: { [prop: string]: any }): RavenStatic;
|
||||
|
||||
/**
|
||||
* Add additional tags to be sent along with payloads.
|
||||
* @param tags A key/value-pair which will be added
|
||||
*/
|
||||
setTagsContext(tags: { [id: string]: string }): RavenStatic;
|
||||
|
||||
/**
|
||||
* Clear the whole currently set context.
|
||||
*/
|
||||
clearContext(): RavenStatic;
|
||||
|
||||
/**
|
||||
* Get a copy of the current context.
|
||||
*/
|
||||
getContext(): Object;
|
||||
|
||||
/**
|
||||
* Set environment of application
|
||||
* @param environment Typically something like 'production'
|
||||
*/
|
||||
setEnvironment(environment: string): RavenStatic;
|
||||
|
||||
/**
|
||||
* Set release version of application
|
||||
* @param release Typically something like a git SHA to identify the current version
|
||||
*/
|
||||
setRelease(release: string): RavenStatic;
|
||||
|
||||
/**
|
||||
* Specify a function that can mutate the payload right before it is being sent to Sentry.
|
||||
* @param callback The function which can mutate the data
|
||||
*/
|
||||
setDataCallback(callback: (data: any, orig?: string) => any): RavenStatic;
|
||||
|
||||
/**
|
||||
* Specify a callback function that can mutate or filter breadcrumbs when they are captured.
|
||||
* @param callback The function which applies the filter
|
||||
*/
|
||||
setBreadcrumbCallback(callback :(data: any, orig?: string) => any): RavenStatic;
|
||||
|
||||
/**
|
||||
* Specify a callback function that determines if the given message should be sent to Sentry.
|
||||
* @param callback The function which determines if the given blob should be sent
|
||||
*/
|
||||
setShouldSendCallback(callback: (data: any, orig?: string) => boolean): RavenStatic;
|
||||
|
||||
/**
|
||||
* Override the default HTTP data transport handler.
|
||||
* @param transport The function which will be invoked to handle the data transmission
|
||||
*/
|
||||
setTransport(transport: (options: RavenTransportOptions) => void): RavenStatic;
|
||||
|
||||
/**
|
||||
* Get the latest raw exception that was captured by Raven.
|
||||
*/
|
||||
lastException(): Error;
|
||||
|
||||
/**
|
||||
* Get the ID of the last Event captured by Raven.
|
||||
*/
|
||||
lastEventId(): string;
|
||||
|
||||
/**
|
||||
* Determine if Raven is setup and ready to go.
|
||||
*/
|
||||
isSetup(): boolean;
|
||||
|
||||
/**
|
||||
* Show the User Feedback Dialog of Sentry
|
||||
* @param RavenReportDialogOptions Optional Options to set for the User Feedback
|
||||
*/
|
||||
showReportDialog(options?: RavenReportDialogOptions): void;
|
||||
}
|
||||
|
||||
|
||||
// --- Helper Interfaces for Options --------------
|
||||
export interface RavenBreadcrumOptions {
|
||||
/** Whether to collect XHR calls, defaults to true */
|
||||
xhr?: boolean;
|
||||
|
||||
/** Whether to collect console logs, defaults to true */
|
||||
console?: boolean;
|
||||
|
||||
/** Whether to collect dom events, defaults to true */
|
||||
dom?: boolean;
|
||||
|
||||
/** Whether to record window location and navigation, defaults to true */
|
||||
location?: boolean;
|
||||
}
|
||||
|
||||
export interface CommonRavenOptions {
|
||||
/** The environment of the application you are monitoring with Sentry */
|
||||
environment?: string;
|
||||
|
||||
/** The release version of the application you are monitoring with Sentry */
|
||||
release?: string;
|
||||
|
||||
/** Additional key/value-data to be tagged onto the error. */
|
||||
tags?: { [id: string]: string };
|
||||
|
||||
/** Additional, arbitrary metadata to collect */
|
||||
extra?: { [prop: string]: any };
|
||||
|
||||
/** The name of the logger used by Sentry. Default: javascript */
|
||||
logger?: string;
|
||||
|
||||
/** set to true to get the strack trace of your message */
|
||||
stacktrace?: boolean;
|
||||
}
|
||||
|
||||
export interface RavenOptions extends CommonRavenOptions {
|
||||
/** The name of the server or device that the client is running on */
|
||||
server_name?: string;
|
||||
|
||||
/** The log level associated with this event. Default: error */
|
||||
level?: string;
|
||||
|
||||
/** In some cases you may see issues where Sentry groups multiple events together when they
|
||||
* should be separate entities. In other cases, Sentry simply doesn’t group events together
|
||||
* because they’re so sporadic that they never look the same. */
|
||||
fingerprint?: string[];
|
||||
|
||||
/** Number of frames to trim off the stacktrace. Default: 1 */
|
||||
trimHeadFrames?: number;
|
||||
|
||||
/** The name of the device platform. Default: "javascript" */
|
||||
platform?: string;
|
||||
}
|
||||
|
||||
export interface RavenGlobalOptions extends CommonRavenOptions {
|
||||
/** The name of the server or device that the client is running on */
|
||||
serverName?: string;
|
||||
|
||||
/** Configures which breadcrumbs are collected automatically */
|
||||
autoBreadcrumbs?: boolean | RavenBreadcrumOptions;
|
||||
|
||||
/** Whether to collect errors on the window via TraceKit.collectWindowErrors. Default: true. */
|
||||
collectWindowErrors?: boolean;
|
||||
|
||||
/** Max number of breadcrumbs to collect. Default: 100 */
|
||||
maxBreadcrumbs?: number;
|
||||
|
||||
/** Exclude messages which match one of the given RegEx-Patterns from being sent to Sentry. */
|
||||
ignoreErrors?: (RegExp | string)[];
|
||||
|
||||
/** Exclude messages which come from whole urls matching one of the given RegEx patterns. */
|
||||
ignoreUrls?: (RegExp | string)[];
|
||||
|
||||
/** Only report messages which come from whole urls matching one of the given RegEx patterns. */
|
||||
whitelistUrls?: (RegExp | string)[];
|
||||
|
||||
/** An array of RegEx patterns to indicate which urls are a part of your app. */
|
||||
includePaths?: (RegExp | string)[];
|
||||
|
||||
/** Maximum amount of stack frames to collect. Default: Infinity */
|
||||
stackTraceLimit?: number;
|
||||
|
||||
/** Override the default HTTP data transport handler. */
|
||||
transport?: (options: RavenTransportOptions) => void;
|
||||
|
||||
/** Limit the maxium length of a message to this number of characters. Default: Infinity */
|
||||
maxMessageLength?: number;
|
||||
|
||||
/** Allows you to apply your own filters to determine if the message should be sent to Sentry. */
|
||||
shouldSendCallback?: (data: any) => boolean;
|
||||
|
||||
/** A function which allows mutation of the data payload right before being sent to Sentry */
|
||||
dataCallback?: (data: any) => any;
|
||||
}
|
||||
|
||||
export interface RavenWrapOptions extends RavenOptions {
|
||||
/** Whether to run the wrap recursively. Default: false. */
|
||||
deep?: boolean;
|
||||
}
|
||||
|
||||
export interface RavenTransportOptions {
|
||||
url: string;
|
||||
data: any;
|
||||
auth: {
|
||||
sentry_version: string;
|
||||
sentry_client: string;
|
||||
sentry_key: string;
|
||||
};
|
||||
onSuccess: () => void;
|
||||
onFailure: () => void;
|
||||
}
|
||||
|
||||
export interface RavenReportDialogOptions {
|
||||
eventId?: number,
|
||||
dsn?: string,
|
||||
user?: {
|
||||
name?: string,
|
||||
email?: string
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// --- Helper Interfaces for complex Data Structures --------------
|
||||
export interface RavenPlugin {
|
||||
(raven: RavenStatic, ...args: any[]): RavenStatic;
|
||||
}
|
||||
|
||||
export interface RavenUserContext {
|
||||
id?: string;
|
||||
username?: string;
|
||||
email?: string;
|
||||
ip_address?: string;
|
||||
extra?: { [prop: string]: any };
|
||||
}
|
||||
|
||||
export interface RavenBreadcrumb {
|
||||
message: string;
|
||||
data: { [id: string]: string };
|
||||
category: string;
|
||||
level: string;
|
||||
}
|
||||
@@ -1,61 +0,0 @@
|
||||
import RavenJS from 'raven-js';
|
||||
|
||||
RavenJS.config('https://public@getsentry.com/1').install();
|
||||
|
||||
|
||||
RavenJS.config(
|
||||
'https://public@getsentry.com/1',
|
||||
{
|
||||
logger: 'my-logger',
|
||||
ignoreUrls: [
|
||||
/graph\.facebook\.com/i
|
||||
],
|
||||
ignoreErrors: [
|
||||
'fb_xd_fragment'
|
||||
],
|
||||
includePaths: [
|
||||
/https?:\/\/(www\.)?getsentry\.com/,
|
||||
/https?:\/\/d3nslu0hdya83q\.cloudfront\.net/
|
||||
]
|
||||
}
|
||||
).install();
|
||||
|
||||
var throwsError = () => {
|
||||
throw new Error('broken');
|
||||
};
|
||||
|
||||
try {
|
||||
throwsError();
|
||||
} catch(e) {
|
||||
RavenJS.captureException(e);
|
||||
RavenJS.captureException(e, {tags: { key: "value" }});
|
||||
}
|
||||
|
||||
RavenJS.context(throwsError);
|
||||
RavenJS.context({tags: { key: "value" }}, throwsError);
|
||||
RavenJS.context({extra: {planet: {name: 'Earth'}}}, throwsError);
|
||||
|
||||
setTimeout(RavenJS.wrap(throwsError), 1000);
|
||||
RavenJS.wrap({logger: "my.module"}, throwsError)();
|
||||
RavenJS.wrap({tags: {git_commit: 'c0deb10c4'}}, throwsError)();
|
||||
|
||||
RavenJS.setUserContext({
|
||||
email: 'matt@example.com',
|
||||
id: '123'
|
||||
});
|
||||
|
||||
RavenJS.captureMessage('Broken!');
|
||||
RavenJS.captureMessage('Broken!', {tags: { key: "value" }});
|
||||
|
||||
RavenJS.showReportDialog({
|
||||
eventId: 0815,
|
||||
dsn:'1337asdf',
|
||||
user: {
|
||||
name: 'DefenitelyTyped',
|
||||
email: 'df@ts.ms'
|
||||
}
|
||||
});
|
||||
|
||||
RavenJS.setTagsContext({ key: "value" });
|
||||
|
||||
RavenJS.setExtraContext({ foo: "bar" });
|
||||
15
react-autosuggest/index.d.ts
vendored
15
react-autosuggest/index.d.ts
vendored
@@ -1,11 +1,16 @@
|
||||
// Type definitions for react-autosuggest 7.0
|
||||
// Type definitions for react-autosuggest 8.0
|
||||
// Project: http://react-autosuggest.js.org/
|
||||
// Definitions by: Nicolas Schmitt <https://github.com/nicolas-schmitt>, Philip Ottesen <https://github.com/pjo256>, Robert Essig <https://github.com/robessog>
|
||||
// Definitions by: Nicolas Schmitt <https://github.com/nicolas-schmitt>, Philip Ottesen <https://github.com/pjo256>, Robert Essig <https://github.com/robessog>, Terry Bayne <https://github.com/tbayne>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.1
|
||||
|
||||
import * as React from 'react';
|
||||
|
||||
import * as React from 'react';
|
||||
declare class Autosuggest extends React.Component<any, any> {}
|
||||
|
||||
export = Autosuggest;
|
||||
|
||||
declare namespace Autosuggest {
|
||||
interface SuggestionsFetchRequest {
|
||||
value: string;
|
||||
reason: string;
|
||||
@@ -31,7 +36,7 @@ import * as React from 'react';
|
||||
onBlur?: (event: React.FormEvent<any>, params?: BlurEvent) => void;
|
||||
}
|
||||
|
||||
export interface SuggestionSelectedEventData<TSuggestion> {
|
||||
export interface SuggestionSelectedEventData<TSuggestion> {
|
||||
method: 'click' | 'enter';
|
||||
sectionIndex: number | null;
|
||||
suggestion: TSuggestion;
|
||||
@@ -71,4 +76,4 @@ import * as React from 'react';
|
||||
id?: string;
|
||||
}
|
||||
|
||||
export class Autosuggest extends React.Component<any, any> {}
|
||||
}
|
||||
|
||||
@@ -1,42 +1,69 @@
|
||||
// region Imports
|
||||
import React = require('react');
|
||||
import ReactDOM = require('react-dom');
|
||||
import { Autosuggest, SuggestionSelectedEventData } from 'react-autosuggest';
|
||||
import Autosuggest = require('react-autosuggest');
|
||||
// endregion
|
||||
|
||||
interface Language {
|
||||
name: string;
|
||||
year: number;
|
||||
name : string;
|
||||
year : number;
|
||||
}
|
||||
|
||||
// https://developer.mozilla.org/en/docs/Web/JavaScript/Guide/Regular_Expressions#Using_Special_Characters
|
||||
function escapeRegexCharacters(str: string): string {
|
||||
// https://developer.mozilla.org/en/docs/Web/JavaScript/Guide/Regular_Expression
|
||||
// s#Using_Special_Characters
|
||||
function escapeRegexCharacters(str : string) : string {
|
||||
return str.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
||||
}
|
||||
|
||||
export class ReactAutosuggestBasicTest extends React.Component<any, any> {
|
||||
// region Fields
|
||||
static languages: Language[] = [
|
||||
{name: 'C', year: 1972},
|
||||
{name: 'C#', year: 2000},
|
||||
{name: 'C++', year: 1983},
|
||||
{name: 'Clojure', year: 2007},
|
||||
{name: 'Elm', year: 2012},
|
||||
{name: 'Go', year: 2009},
|
||||
{name: 'Haskell', year: 1990},
|
||||
{name: 'Java', year: 1995},
|
||||
{name: 'Javascript', year: 1995},
|
||||
{name: 'Perl', year: 1987},
|
||||
{name: 'PHP', year: 1995},
|
||||
{name: 'Python', year: 1991},
|
||||
{name: 'Ruby', year: 1995},
|
||||
{name: 'Scala', year: 2003}
|
||||
static languages : Language[] = [
|
||||
{
|
||||
name: 'C',
|
||||
year: 1972
|
||||
}, {
|
||||
name: 'C#',
|
||||
year: 2000
|
||||
}, {
|
||||
name: 'C++',
|
||||
year: 1983
|
||||
}, {
|
||||
name: 'Clojure',
|
||||
year: 2007
|
||||
}, {
|
||||
name: 'Elm',
|
||||
year: 2012
|
||||
}, {
|
||||
name: 'Go',
|
||||
year: 2009
|
||||
}, {
|
||||
name: 'Haskell',
|
||||
year: 1990
|
||||
}, {
|
||||
name: 'Java',
|
||||
year: 1995
|
||||
}, {
|
||||
name: 'Javascript',
|
||||
year: 1995
|
||||
}, {
|
||||
name: 'Perl',
|
||||
year: 1987
|
||||
}, {
|
||||
name: 'PHP',
|
||||
year: 1995
|
||||
}, {
|
||||
name: 'Python',
|
||||
year: 1991
|
||||
}, {
|
||||
name: 'Ruby',
|
||||
year: 1995
|
||||
}, {
|
||||
name: 'Scala',
|
||||
year: 2003
|
||||
}
|
||||
];
|
||||
// endregion
|
||||
|
||||
|
||||
// region Constructor
|
||||
constructor(props: any) {
|
||||
// endregion region Constructor
|
||||
constructor(props : any) {
|
||||
super(props);
|
||||
|
||||
this.state = {
|
||||
@@ -44,15 +71,15 @@ export class ReactAutosuggestBasicTest extends React.Component<any, any> {
|
||||
suggestions: this.getSuggestions('')
|
||||
};
|
||||
}
|
||||
// endregion
|
||||
|
||||
// region Rendering methods
|
||||
render(): JSX.Element {
|
||||
// endregion region Rendering methods
|
||||
render() : JSX.Element {
|
||||
const {value, suggestions} = this.state;
|
||||
const inputProps = {
|
||||
placeholder: `Type 'c'`,
|
||||
value,
|
||||
onChange: this.onChange.bind(this)
|
||||
onChange: this
|
||||
.onChange
|
||||
.bind(this)
|
||||
};
|
||||
|
||||
const theme = {
|
||||
@@ -61,42 +88,38 @@ export class ReactAutosuggestBasicTest extends React.Component<any, any> {
|
||||
suggestionFocused: 'active'
|
||||
};
|
||||
|
||||
return <Autosuggest suggestions={suggestions}
|
||||
onSuggestionsFetchRequested={this.onSuggestionsFetchRequested.bind(this)}
|
||||
getSuggestionValue={this.getSuggestionValue}
|
||||
renderSuggestion={this.renderSuggestion}
|
||||
onSuggestionSelected={this.onSuggestionsSelected}
|
||||
alwaysRenderSuggestions={true}
|
||||
inputProps={inputProps}
|
||||
theme={theme}
|
||||
/>;
|
||||
return <Autosuggest
|
||||
suggestions={suggestions}
|
||||
onSuggestionsFetchRequested={this
|
||||
.onSuggestionsFetchRequested
|
||||
.bind(this)}
|
||||
getSuggestionValue={this.getSuggestionValue}
|
||||
renderSuggestion={this.renderSuggestion}
|
||||
onSuggestionSelected={this.onSuggestionsSelected}
|
||||
alwaysRenderSuggestions={true}
|
||||
inputProps={inputProps}
|
||||
theme={theme}/>;
|
||||
}
|
||||
|
||||
protected onSuggestionsSelected(event: React.FormEvent<any>, data: SuggestionSelectedEventData<Language>): void {
|
||||
protected onSuggestionsSelected(event : React.FormEvent<any>, data : Autosuggest.SuggestionSelectedEventData<Language>) : void {
|
||||
alert(`Selected language is ${data.suggestion.name} (${data.suggestion.year}).`);
|
||||
}
|
||||
|
||||
protected renderSuggestion(suggestion: Language): JSX.Element {
|
||||
protected renderSuggestion(suggestion : Language) : JSX.Element {
|
||||
return <span>{suggestion.name}</span>;
|
||||
}
|
||||
// endregion
|
||||
|
||||
// region Event handlers
|
||||
protected onChange(event: React.FormEvent<any>, {newValue, method}: any): void {
|
||||
this.setState({
|
||||
value: newValue
|
||||
});
|
||||
// endregion region Event handlers
|
||||
protected onChange(event : React.FormEvent<any>, {newValue, method} : any) : void {
|
||||
this.setState({value: newValue});
|
||||
}
|
||||
|
||||
protected onSuggestionsFetchRequested({ value }: any): void {
|
||||
protected onSuggestionsFetchRequested({value}: any) : void {
|
||||
this.setState({
|
||||
suggestions: this.getSuggestions(value)
|
||||
});
|
||||
}
|
||||
// endregion
|
||||
|
||||
// region Helper methods
|
||||
protected getSuggestions(value: string): Language[] {
|
||||
// endregion region Helper methods
|
||||
protected getSuggestions(value: string) : Language[] {
|
||||
const escapedValue = escapeRegexCharacters(value.trim());
|
||||
|
||||
if (escapedValue === '') {
|
||||
@@ -105,69 +128,97 @@ export class ReactAutosuggestBasicTest extends React.Component<any, any> {
|
||||
|
||||
const regex = new RegExp('^' + escapedValue, 'i');
|
||||
|
||||
return ReactAutosuggestBasicTest.languages.filter(language => regex.test(language.name));
|
||||
return ReactAutosuggestBasicTest
|
||||
.languages
|
||||
.filter(language => regex.test(language.name));
|
||||
}
|
||||
|
||||
protected getSuggestionValue(suggestion: Language): string {
|
||||
return suggestion.name;
|
||||
}
|
||||
protected getSuggestionValue(suggestion: Language) : string {return suggestion.name;}
|
||||
// endregion
|
||||
}
|
||||
|
||||
ReactDOM.render(<ReactAutosuggestBasicTest />, document.getElementById('app'));
|
||||
ReactDOM.render(
|
||||
<ReactAutosuggestBasicTest/>, document.getElementById('app'));
|
||||
|
||||
interface LanguageGroup {
|
||||
title: string;
|
||||
languages: Language[];
|
||||
title : string;
|
||||
languages : Language[];
|
||||
}
|
||||
|
||||
export class ReactAutosuggestMultipleTest extends React.Component<any, any> {
|
||||
export class ReactAutosuggestMultipleTest extends React.Component<any,any> {
|
||||
// region Fields
|
||||
static languages: LanguageGroup[] = [
|
||||
static languages : LanguageGroup[] = [
|
||||
{
|
||||
title: '1970s',
|
||||
languages: [
|
||||
{name: 'C', year: 1972}
|
||||
{
|
||||
name: 'C',
|
||||
year: 1972
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
}, {
|
||||
title: '1980s',
|
||||
languages: [
|
||||
{name: 'C++', year: 1983},
|
||||
{name: 'Perl', year: 1987}
|
||||
{
|
||||
name: 'C++',
|
||||
year: 1983
|
||||
}, {
|
||||
name: 'Perl',
|
||||
year: 1987
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
}, {
|
||||
title: '1990s',
|
||||
languages: [
|
||||
{name: 'Haskell', year: 1990},
|
||||
{name: 'Python', year: 1991},
|
||||
{name: 'Java', year: 1995},
|
||||
{name: 'Javascript', year: 1995},
|
||||
{name: 'PHP', year: 1995},
|
||||
{name: 'Ruby', year: 1995}
|
||||
{
|
||||
name: 'Haskell',
|
||||
year: 1990
|
||||
}, {
|
||||
name: 'Python',
|
||||
year: 1991
|
||||
}, {
|
||||
name: 'Java',
|
||||
year: 1995
|
||||
}, {
|
||||
name: 'Javascript',
|
||||
year: 1995
|
||||
}, {
|
||||
name: 'PHP',
|
||||
year: 1995
|
||||
}, {
|
||||
name: 'Ruby',
|
||||
year: 1995
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
}, {
|
||||
title: '2000s',
|
||||
languages: [
|
||||
{name: 'C#', year: 2000},
|
||||
{name: 'Scala', year: 2003},
|
||||
{name: 'Clojure', year: 2007},
|
||||
{name: 'Go', year: 2009}
|
||||
{
|
||||
name: 'C#',
|
||||
year: 2000
|
||||
}, {
|
||||
name: 'Scala',
|
||||
year: 2003
|
||||
}, {
|
||||
name: 'Clojure',
|
||||
year: 2007
|
||||
}, {
|
||||
name: 'Go',
|
||||
year: 2009
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
}, {
|
||||
title: '2010s',
|
||||
languages: [
|
||||
{name: 'Elm', year: 2012}
|
||||
{
|
||||
name: 'Elm',
|
||||
year: 2012
|
||||
}
|
||||
]
|
||||
}
|
||||
];
|
||||
// endregion
|
||||
|
||||
// region Constructor
|
||||
constructor(props: any) {
|
||||
// endregion region Constructor
|
||||
constructor(props : any) {
|
||||
super(props);
|
||||
|
||||
this.state = {
|
||||
@@ -175,59 +226,56 @@ export class ReactAutosuggestMultipleTest extends React.Component<any, any> {
|
||||
suggestions: this.getSuggestions('')
|
||||
};
|
||||
}
|
||||
// endregion
|
||||
|
||||
// region Rendering methods
|
||||
render(): JSX.Element {
|
||||
const { value, suggestions } = this.state;
|
||||
// endregion region Rendering methods
|
||||
render() : JSX.Element {
|
||||
const {value, suggestions} = this.state;
|
||||
const inputProps = {
|
||||
placeholder: `Type 'c'`,
|
||||
value,
|
||||
onChange: this.onChange.bind(this)
|
||||
onChange: this
|
||||
.onChange
|
||||
.bind(this)
|
||||
};
|
||||
|
||||
return <Autosuggest multiSection={true}
|
||||
suggestions={suggestions}
|
||||
onSuggestionsFetchRequested={this.onSuggestionsFetchRequested.bind(this)}
|
||||
onSuggestionSelected={this.onSuggestionSelected}
|
||||
getSuggestionValue={this.getSuggestionValue}
|
||||
renderSuggestion={this.renderSuggestion}
|
||||
renderSectionTitle={this.renderSectionTitle}
|
||||
getSectionSuggestions={this.getSectionSuggestions}
|
||||
inputProps={inputProps} />;
|
||||
return <Autosuggest
|
||||
multiSection={true}
|
||||
suggestions={suggestions}
|
||||
onSuggestionsFetchRequested={this
|
||||
.onSuggestionsFetchRequested
|
||||
.bind(this)}
|
||||
onSuggestionSelected={this.onSuggestionSelected}
|
||||
getSuggestionValue={this.getSuggestionValue}
|
||||
renderSuggestion={this.renderSuggestion}
|
||||
renderSectionTitle={this.renderSectionTitle}
|
||||
getSectionSuggestions={this.getSectionSuggestions}
|
||||
inputProps={inputProps}/>;
|
||||
}
|
||||
|
||||
protected onSuggestionSelected(event: React.FormEvent<any>, data: SuggestionSelectedEventData<Language>): void {
|
||||
protected onSuggestionSelected(event : React.FormEvent<any>, data : Autosuggest.SuggestionSelectedEventData<Language>) : void {
|
||||
const language = data.suggestion as Language;
|
||||
|
||||
alert(`Selected language is ${language.name} (${language.year}).`);
|
||||
}
|
||||
|
||||
protected renderSuggestion(suggestion: Language): JSX.Element {
|
||||
protected renderSuggestion(suggestion : Language) : JSX.Element {
|
||||
return <span>{suggestion.name}</span>;
|
||||
}
|
||||
|
||||
protected renderSectionTitle(section: LanguageGroup): JSX.Element {
|
||||
protected renderSectionTitle(section : LanguageGroup) : JSX.Element {
|
||||
return <strong>{section.title}</strong>;
|
||||
}
|
||||
// endregion
|
||||
|
||||
// region Event handlers
|
||||
protected onChange(event: React.FormEvent<any>, { newValue, method }: any): void {
|
||||
this.setState({
|
||||
value: newValue
|
||||
});
|
||||
// endregion region Event handlers
|
||||
protected onChange(event : React.FormEvent<any>, {newValue, method} : any) : void {
|
||||
this.setState({value: newValue});
|
||||
}
|
||||
|
||||
protected onSuggestionsFetchRequested({ value }: any): void {
|
||||
protected onSuggestionsFetchRequested({value} : any) : void {
|
||||
this.setState({
|
||||
suggestions: this.getSuggestions(value)
|
||||
});
|
||||
}
|
||||
// endregion
|
||||
|
||||
// region Helper methods
|
||||
protected getSuggestions(value: string): LanguageGroup[] {
|
||||
// endregion region Helper methods
|
||||
protected getSuggestions(value : string) : LanguageGroup[] {
|
||||
const escapedValue = escapeRegexCharacters(value.trim());
|
||||
|
||||
if (escapedValue === '') {
|
||||
@@ -236,46 +284,61 @@ export class ReactAutosuggestMultipleTest extends React.Component<any, any> {
|
||||
|
||||
const regex = new RegExp('^' + escapedValue, 'i');
|
||||
|
||||
return ReactAutosuggestMultipleTest.languages
|
||||
return ReactAutosuggestMultipleTest
|
||||
.languages
|
||||
.map(section => {
|
||||
return {
|
||||
title: section.title,
|
||||
languages: section.languages.filter(language => regex.test(language.name))
|
||||
languages: section
|
||||
.languages
|
||||
.filter(language => regex.test(language.name))
|
||||
};
|
||||
})
|
||||
.filter(section => section.languages.length > 0);
|
||||
}
|
||||
|
||||
protected getSuggestionValue(suggestion: Language) {
|
||||
protected getSuggestionValue(suggestion : Language) {
|
||||
return suggestion.name;
|
||||
}
|
||||
|
||||
protected getSectionSuggestions(section: LanguageGroup) {
|
||||
protected getSectionSuggestions(section : LanguageGroup) {
|
||||
return section.languages;
|
||||
}
|
||||
// endregion
|
||||
}
|
||||
|
||||
ReactDOM.render(<ReactAutosuggestMultipleTest />, document.getElementById('app'));
|
||||
ReactDOM.render(
|
||||
<ReactAutosuggestMultipleTest/>, document.getElementById('app'));
|
||||
|
||||
interface Person {
|
||||
first: string;
|
||||
last: string;
|
||||
twitter: string;
|
||||
first : string;
|
||||
last : string;
|
||||
twitter : string;
|
||||
}
|
||||
|
||||
export class ReactAutosuggestCustomTest extends React.Component<any, any> {
|
||||
export class ReactAutosuggestCustomTest extends React.Component<any,any> {
|
||||
// region Fields
|
||||
static people: Person[] = [
|
||||
{first: 'Charlie', last: 'Brown', twitter: 'dancounsell'},
|
||||
{first: 'Charlotte', last: 'White', twitter: 'mtnmissy'},
|
||||
{first: 'Chloe', last: 'Jones', twitter: 'ladylexy'},
|
||||
{first: 'Cooper', last: 'King', twitter: 'steveodom'}
|
||||
static people : Person[] = [
|
||||
{
|
||||
first: 'Charlie',
|
||||
last: 'Brown',
|
||||
twitter: 'dancounsell'
|
||||
}, {
|
||||
first: 'Charlotte',
|
||||
last: 'White',
|
||||
twitter: 'mtnmissy'
|
||||
}, {
|
||||
first: 'Chloe',
|
||||
last: 'Jones',
|
||||
twitter: 'ladylexy'
|
||||
}, {
|
||||
first: 'Cooper',
|
||||
last: 'King',
|
||||
twitter: 'steveodom'
|
||||
}
|
||||
];
|
||||
// endregion
|
||||
|
||||
// region Constructor
|
||||
constructor(props: any) {
|
||||
// endregion region Constructor
|
||||
constructor(props : any) {
|
||||
super(props);
|
||||
|
||||
this.state = {
|
||||
@@ -283,64 +346,62 @@ export class ReactAutosuggestCustomTest extends React.Component<any, any> {
|
||||
suggestions: this.getSuggestions('')
|
||||
};
|
||||
}
|
||||
// endregion
|
||||
|
||||
// region Rendering methods
|
||||
render(): JSX.Element {
|
||||
const { value, suggestions } = this.state;
|
||||
// endregion region Rendering methods
|
||||
render() : JSX.Element {
|
||||
const {value, suggestions} = this.state;
|
||||
const inputProps = {
|
||||
placeholder: "Type 'c'",
|
||||
value,
|
||||
onChange: this.onChange.bind(this)
|
||||
onChange: this
|
||||
.onChange
|
||||
.bind(this)
|
||||
};
|
||||
|
||||
return <Autosuggest suggestions={suggestions}
|
||||
onSuggestionsFetchRequested={this.onSuggestionsFetchRequested}
|
||||
getSuggestionValue={this.getSuggestionValue}
|
||||
renderSuggestion={this.renderSuggestion}
|
||||
inputProps={inputProps} />;
|
||||
return<Autosuggest
|
||||
suggestions={suggestions}
|
||||
onSuggestionsFetchRequested={this.onSuggestionsFetchRequested}
|
||||
getSuggestionValue={this.getSuggestionValue}
|
||||
renderSuggestion={this.renderSuggestion}
|
||||
inputProps={inputProps}/>;
|
||||
}
|
||||
|
||||
protected renderSuggestion(suggestion: Person, { value, valueBeforeUpDown }: any): JSX.Element {
|
||||
protected renderSuggestion(suggestion : Person, {value, valueBeforeUpDown} : any) : JSX.Element {
|
||||
const suggestionText = `${suggestion.first} ${suggestion.last}`;
|
||||
const query = (valueBeforeUpDown || value).trim();
|
||||
const parts = suggestionText.split(' ').map((part: string) => {
|
||||
return {
|
||||
highlight: (Math.ceil(Math.random() * 10)) % 2,
|
||||
text: part
|
||||
};
|
||||
});
|
||||
const parts = suggestionText
|
||||
.split(' ')
|
||||
.map((part : string) => {
|
||||
return {
|
||||
highlight: (Math.ceil(Math.random() * 10)) % 2,
|
||||
text: part
|
||||
};
|
||||
});
|
||||
|
||||
return <span className={'suggestion-content ' + suggestion.twitter}>
|
||||
<span className="name">
|
||||
{
|
||||
parts.map((part, index) => {
|
||||
const className = part.highlight ? 'highlight' : undefined;
|
||||
return<span className={'suggestion-content ' + suggestion.twitter}>
|
||||
<span className="name">
|
||||
{parts.map((part, index) => {
|
||||
const className = part.highlight
|
||||
? 'highlight'
|
||||
: undefined;
|
||||
|
||||
return <span className={className} key={index}>{part.text}</span>;
|
||||
})
|
||||
}
|
||||
</span>
|
||||
</span>;
|
||||
return<span className={className} key={index}>{part.text}</span>;
|
||||
})
|
||||
}
|
||||
</span>
|
||||
</span>;
|
||||
}
|
||||
// endregion
|
||||
|
||||
// region Event handlers
|
||||
protected onChange(event: React.FormEvent<any>, {newValue, method}: any): void {
|
||||
this.setState({
|
||||
value: newValue
|
||||
});
|
||||
// endregion region Event handlers
|
||||
protected onChange(event : React.FormEvent<any>, {newValue, method} : any) : void {
|
||||
this.setState({value: newValue});
|
||||
}
|
||||
|
||||
protected onSuggestionsFetchRequested({ value }: any): void {
|
||||
protected onSuggestionsFetchRequested({value} : any) : void {
|
||||
this.setState({
|
||||
suggestions: this.getSuggestions(value)
|
||||
});
|
||||
}
|
||||
// endregion
|
||||
|
||||
// region Helper methods
|
||||
protected getSuggestions(value: string): Person[] {
|
||||
// endregion region Helper methods
|
||||
protected getSuggestions(value : string) : Person[] {
|
||||
const escapedValue = escapeRegexCharacters(value.trim());
|
||||
|
||||
if (escapedValue === '') {
|
||||
@@ -349,13 +410,14 @@ export class ReactAutosuggestCustomTest extends React.Component<any, any> {
|
||||
|
||||
const regex = new RegExp('\\b' + escapedValue, 'i');
|
||||
|
||||
return ReactAutosuggestCustomTest.people.filter(person => regex.test(this.getSuggestionValue(person)));
|
||||
return ReactAutosuggestCustomTest
|
||||
.people
|
||||
.filter(person => regex.test(this.getSuggestionValue(person)));
|
||||
}
|
||||
|
||||
protected getSuggestionValue(suggestion: Person): string {
|
||||
return `${suggestion.first} ${suggestion.last}`;
|
||||
}
|
||||
protected getSuggestionValue(suggestion : Person) : string {return `${suggestion.first} ${suggestion.last}`;}
|
||||
// endregion
|
||||
}
|
||||
|
||||
ReactDOM.render(<ReactAutosuggestCustomTest />, document.getElementById('app'));
|
||||
ReactDOM.render(
|
||||
<ReactAutosuggestCustomTest/>, document.getElementById('app'));
|
||||
|
||||
11
react-bootstrap/index.d.ts
vendored
11
react-bootstrap/index.d.ts
vendored
@@ -1,6 +1,6 @@
|
||||
// Type definitions for react-bootstrap
|
||||
// Project: https://github.com/react-bootstrap/react-bootstrap
|
||||
// Definitions by: Walker Burgin <https://github.com/walkerburgin>, Vincent Siao <https://github.com/vsiao>, Danilo Barros <https://github.com/danilojrr>, Batbold Gansukh <https://github.com/Batbold-Gansukh>, Raymond May Jr. <https://github.com/octatone>
|
||||
// Definitions by: Walker Burgin <https://github.com/walkerburgin>, Vincent Siao <https://github.com/vsiao>, Danilo Barros <https://github.com/danilojrr>, Batbold Gansukh <https://github.com/Batbold-Gansukh>, Raymond May Jr. <https://github.com/octatone>, Cheng Sieu Ly <https://github.com/chengsieuly>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.1
|
||||
|
||||
@@ -867,6 +867,15 @@ declare namespace ReactBootstrap {
|
||||
type Image = React.ClassicComponent<ImageProps, {}>;
|
||||
var Image: React.ClassicComponentClass<ImageProps>;
|
||||
|
||||
// <ResponsiveEmbed />
|
||||
interface ResponsiveEmbedProps extends React.HTMLProps<ResponsiveEmbed> {
|
||||
a16by9?: boolean;
|
||||
a4by3?: boolean;
|
||||
bsClass?: string;
|
||||
}
|
||||
class ResponsiveEmbed extends React.Component<ResponsiveEmbedProps, {}> {
|
||||
}
|
||||
|
||||
// <PageHeader />
|
||||
interface PageHeaderProps extends React.HTMLProps<PageHeader> {
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@ import {
|
||||
Nav, NavItem, Navbar, NavDropdown,
|
||||
Tabs, Tab, Pager, PageItem,
|
||||
Pagination, Alert, Carousel, SafeAnchor,
|
||||
Grid, Row, Col, Thumbnail, Image,
|
||||
Grid, Row, Col, Thumbnail, Image, ResponsiveEmbed,
|
||||
Label, Badge, Jumbotron, PageHeader,
|
||||
Glyphicon, Table, Form, FormGroup,
|
||||
ControlLabel, FormControl, HelpBlock,
|
||||
@@ -845,6 +845,20 @@ export class ReactBootstrapTest extends Component<any, any> {
|
||||
<Image src="https://placeholdit.imgix.net/~text?txtsize=33&txt=AUDIO&w=150&h=150" rounded />
|
||||
</div>
|
||||
|
||||
<div style={style}>
|
||||
<div>
|
||||
<ResponsiveEmbed a16by9>
|
||||
Embedded Content
|
||||
</ResponsiveEmbed>
|
||||
<ResponsiveEmbed a4by3>
|
||||
Embedded Content
|
||||
</ResponsiveEmbed>
|
||||
<ResponsiveEmbed bsClass='embed-responsive'>
|
||||
Embedded Content
|
||||
</ResponsiveEmbed>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div style={style}>
|
||||
<PageHeader>Example page header <small>Subtext for header</small></PageHeader>
|
||||
</div>
|
||||
|
||||
285
react-color/index.d.ts
vendored
285
react-color/index.d.ts
vendored
@@ -1,249 +1,58 @@
|
||||
// Type definitions for react-color v2.3.4
|
||||
// Project: https://casesandberg.github.io/react-color/
|
||||
// Type definitions for react-color 2.11
|
||||
// Project: https://github.com/casesandberg/react-color/
|
||||
// Definitions by: Karol Janyst <https://github.com/LKay>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.1
|
||||
|
||||
///<reference types="react" />
|
||||
import { ComponentClass, ClassAttributes, StatelessComponent, ReactNode } from "react";
|
||||
|
||||
declare namespace ReactColor {
|
||||
interface HSLColor {
|
||||
a?: number
|
||||
h: number
|
||||
l: number
|
||||
s: number
|
||||
}
|
||||
|
||||
interface RGBColor {
|
||||
a?: number
|
||||
b: number
|
||||
g: number
|
||||
r: number
|
||||
}
|
||||
|
||||
type Color = string | HSLColor | RGBColor
|
||||
|
||||
interface ColorResult {
|
||||
hex: string
|
||||
hsl: HSLColor
|
||||
rgb: RGBColor
|
||||
}
|
||||
|
||||
type ColorChangeHandler = (color: ColorResult) => void
|
||||
|
||||
interface ColorPickerProps<A> extends React.ClassAttributes<A> {
|
||||
color?: Color
|
||||
onChange?: ColorChangeHandler
|
||||
onChangeComplete?: ColorChangeHandler
|
||||
}
|
||||
|
||||
/* Predefined pickers */
|
||||
interface AlphaPickerProps extends ColorPickerProps<AlphaPicker> {
|
||||
height?: string
|
||||
width?: string
|
||||
}
|
||||
interface AlphaPicker extends React.ComponentClass<AlphaPickerProps> {}
|
||||
const AlphaPicker: AlphaPicker
|
||||
|
||||
interface BlockPickerProps extends ColorPickerProps<BlockPicker> {
|
||||
colors?: Array<string>
|
||||
width?: string
|
||||
}
|
||||
interface BlockPicker extends React.ComponentClass<BlockPickerProps> {}
|
||||
const BlockPicker: BlockPicker
|
||||
|
||||
interface ChromePickerProps extends ColorPickerProps<ChromePicker> {
|
||||
disableAlpha?: boolean
|
||||
}
|
||||
interface ChromePicker extends React.ComponentClass<ChromePickerProps> {}
|
||||
const ChromePicker: ChromePicker
|
||||
|
||||
interface CirclePickerProps extends ColorPickerProps<CirclePicker> {
|
||||
colors?: Array<string>
|
||||
width?: string
|
||||
}
|
||||
interface CirclePicker extends React.ComponentClass<CirclePickerProps> {}
|
||||
const CirclePicker: CirclePicker
|
||||
|
||||
interface CompactPickerProps extends ColorPickerProps<CompactPicker> {
|
||||
colors?: Array<string>
|
||||
}
|
||||
interface CompactPicker extends React.ComponentClass<CompactPickerProps> {}
|
||||
const CompactPicker: CompactPicker
|
||||
|
||||
interface GithubPickerProps extends ColorPickerProps<GithubPicker> {
|
||||
colors?: Array<string>
|
||||
width?: string
|
||||
}
|
||||
interface GithubPicker extends React.ComponentClass<GithubPickerProps> {}
|
||||
const GithubPicker: GithubPicker
|
||||
|
||||
interface HuePickerProps extends ColorPickerProps<HuePicker> {
|
||||
height?: string
|
||||
width?: string
|
||||
}
|
||||
interface HuePicker extends React.ComponentClass<HuePickerProps> {}
|
||||
const HuePicker: HuePicker
|
||||
|
||||
interface MaterialPickerProps extends ColorPickerProps<MaterialPicker> {}
|
||||
interface MaterialPicker extends React.ComponentClass<MaterialPickerProps> {}
|
||||
const MaterialPicker: MaterialPicker
|
||||
|
||||
interface PhotoshopPickerProps extends ColorPickerProps<PhotoshopPicker> {
|
||||
header?: string
|
||||
onAccept?: ColorChangeHandler
|
||||
onCancel?: ColorChangeHandler
|
||||
}
|
||||
interface PhotoshopPicker extends React.ComponentClass<PhotoshopPickerProps> {}
|
||||
const PhotoshopPicker: PhotoshopPicker
|
||||
|
||||
interface SketchPickerProps extends ColorPickerProps<SketchPicker> {
|
||||
disableAlpha?: boolean
|
||||
presetColors?: Array<string>
|
||||
width?: string
|
||||
}
|
||||
interface SketchPicker extends React.ComponentClass<SketchPickerProps> {}
|
||||
const SketchPicker: SketchPicker
|
||||
|
||||
interface SliderPickerProps extends ColorPickerProps<SliderPicker> {}
|
||||
interface SliderPicker extends React.ComponentClass<SliderPickerProps> {}
|
||||
const SliderPicker: SliderPicker
|
||||
|
||||
interface SwatchesPickerProps extends ColorPickerProps<SwatchesPicker> {
|
||||
colors?: Array<Array<string>>
|
||||
height?: number
|
||||
width?: number
|
||||
}
|
||||
interface SwatchesPicker extends React.ComponentClass<SwatchesPickerProps> {}
|
||||
const SwatchesPicker: SwatchesPicker
|
||||
|
||||
interface TwitterPickerProps extends ColorPickerProps<TwitterPicker> {}
|
||||
interface TwitterPicker extends React.ComponentClass<TwitterPickerProps> {}
|
||||
const TwitterPicker: TwitterPicker
|
||||
|
||||
/* For custom picker */
|
||||
interface InjectedColorProps {
|
||||
hex?: string
|
||||
hsl?: HSLColor
|
||||
rgb?: RGBColor
|
||||
onChange?: ColorChangeHandler
|
||||
}
|
||||
|
||||
function CustomPicker<A>(component: React.ComponentClass<A> | React.StatelessComponent<A>): React.ComponentClass<A & InjectedColorProps>
|
||||
|
||||
interface CustomPickerProps<A> extends React.ClassAttributes<A> {
|
||||
color?: Color
|
||||
pointer?: React.ReactNode
|
||||
onChange?: ColorChangeHandler
|
||||
}
|
||||
|
||||
interface AlphaProps extends CustomPickerProps<Alpha> {}
|
||||
interface Alpha extends React.ComponentClass<AlphaProps> {}
|
||||
const Alpha: Alpha
|
||||
|
||||
interface EditableInputStyles {
|
||||
input?: React.CSSProperties
|
||||
label?: React.CSSProperties
|
||||
wrap?: React.CSSProperties
|
||||
}
|
||||
interface EditableInputProps extends React.ClassAttributes<Alpha> {
|
||||
color?: Color
|
||||
label?: string
|
||||
onChange?: ColorChangeHandler
|
||||
styles?: EditableInputStyles
|
||||
value?: any
|
||||
}
|
||||
interface EditableInput extends React.ComponentClass<EditableInputProps> {}
|
||||
const EditableInput: EditableInput
|
||||
|
||||
interface HueProps extends CustomPickerProps<Hue> {
|
||||
direction?: "horizontal" | "vertical"
|
||||
}
|
||||
interface Hue extends React.ComponentClass<HueProps> {}
|
||||
const Hue: Hue
|
||||
|
||||
interface SaturationProps extends CustomPickerProps<Saturation> {}
|
||||
interface Saturation extends React.ComponentClass<SaturationProps> {}
|
||||
const Saturation: Saturation
|
||||
|
||||
interface CheckboardProps extends React.ClassAttributes<Checkboard> {
|
||||
grey?: string
|
||||
size?: number
|
||||
white?: string
|
||||
}
|
||||
interface Checkboard extends React.ComponentClass<CheckboardProps> {}
|
||||
const Checkboard: Checkboard
|
||||
export interface HSLColor {
|
||||
a?: number;
|
||||
h: number;
|
||||
l: number;
|
||||
s: number;
|
||||
}
|
||||
|
||||
declare module "react-color/lib/components/common/Alpha" { export default ReactColor.Alpha }
|
||||
declare module "react-color/lib/components/common/Checkboard" { export default ReactColor.Checkboard }
|
||||
declare module "react-color/lib/components/common/EditableInput" { export default ReactColor.EditableInput }
|
||||
declare module "react-color/lib/components/common/Hue" { export default ReactColor.Hue }
|
||||
declare module "react-color/lib/components/common/Saturation" { export default ReactColor.Saturation }
|
||||
declare module "react-color/lib/components/common/ColorWrap" { export default ReactColor.CustomPicker }
|
||||
|
||||
declare module "react-color/lib/components/common" {
|
||||
import Alpha from "react-color/lib/components/common/Alpha"
|
||||
import Checkboard from "react-color/lib/components/common/Checkboard"
|
||||
import EditableInput from "react-color/lib/components/common/EditableInput"
|
||||
import Hue from "react-color/lib/components/common/Hue"
|
||||
import Saturation from "react-color/lib/components/common/Saturation"
|
||||
|
||||
export {
|
||||
Alpha,
|
||||
Checkboard,
|
||||
EditableInput,
|
||||
Hue,
|
||||
Saturation
|
||||
}
|
||||
export interface RGBColor {
|
||||
a?: number;
|
||||
b: number;
|
||||
g: number;
|
||||
r: number;
|
||||
}
|
||||
|
||||
declare module "react-color/lib/components/alpha/Alpha" { export default ReactColor.AlphaPicker }
|
||||
declare module "react-color/lib/components/block/Block" { export default ReactColor.BlockPicker }
|
||||
declare module "react-color/lib/components/chrome/Chrome" { export default ReactColor.ChromePicker }
|
||||
declare module "react-color/lib/components/circle/Circle" { export default ReactColor.CirclePicker }
|
||||
declare module "react-color/lib/components/compact/Compact" { export default ReactColor.CompactPicker }
|
||||
declare module "react-color/lib/components/github/Github" { export default ReactColor.GithubPicker }
|
||||
declare module "react-color/lib/components/hue/Hue" { export default ReactColor.HuePicker }
|
||||
declare module "react-color/lib/components/meterial/Material" { export default ReactColor.MaterialPicker }
|
||||
declare module "react-color/lib/components/photoshop/Photoshop" { export default ReactColor.PhotoshopPicker }
|
||||
declare module "react-color/lib/components/sketch/Sketch" { export default ReactColor.SketchPicker }
|
||||
declare module "react-color/lib/components/slider/Slider" { export default ReactColor.SliderPicker }
|
||||
declare module "react-color/lib/components/swatches/Swatches" { export default ReactColor.SwatchesPicker }
|
||||
declare module "react-color/lib/components/twitter/Twitter" { export default ReactColor.TwitterPicker }
|
||||
export type Color = string | HSLColor | RGBColor;
|
||||
|
||||
declare module "react-color" {
|
||||
import AlphaPicker from "react-color/lib/components/alpha/Alpha"
|
||||
import BlockPicker from "react-color/lib/components/block/Block"
|
||||
import ChromePicker from "react-color/lib/components/chrome/Chrome"
|
||||
import CirclePicker from "react-color/lib/components/circle/Circle"
|
||||
import CompactPicker from "react-color/lib/components/compact/Compact"
|
||||
import GithubPicker from "react-color/lib/components/github/Github"
|
||||
import HuePicker from "react-color/lib/components/hue/Hue"
|
||||
import MaterialPicker from "react-color/lib/components/meterial/Material"
|
||||
import PhotoshopPicker from "react-color/lib/components/photoshop/Photoshop"
|
||||
import SketchPicker from "react-color/lib/components/sketch/Sketch"
|
||||
import SliderPicker from "react-color/lib/components/slider/Slider"
|
||||
import SwatchesPicker from "react-color/lib/components/swatches/Swatches"
|
||||
import TwitterPicker from "react-color/lib/components/twitter/Twitter"
|
||||
import CustomPicker from "react-color/lib/components/common/ColorWrap"
|
||||
|
||||
export type CustomPickerProps<A> = ReactColor.CustomPickerProps<A>
|
||||
|
||||
export {
|
||||
AlphaPicker,
|
||||
BlockPicker,
|
||||
ChromePicker,
|
||||
CirclePicker,
|
||||
CompactPicker,
|
||||
GithubPicker,
|
||||
HuePicker,
|
||||
MaterialPicker,
|
||||
PhotoshopPicker,
|
||||
SketchPicker,
|
||||
SliderPicker,
|
||||
SwatchesPicker,
|
||||
TwitterPicker,
|
||||
CustomPicker
|
||||
}
|
||||
export interface ColorResult {
|
||||
hex: string;
|
||||
hsl: HSLColor;
|
||||
rgb: RGBColor;
|
||||
}
|
||||
|
||||
export type ColorChangeHandler = (color: ColorResult) => void;
|
||||
|
||||
export interface ColorPickerProps<A> extends ClassAttributes<A> {
|
||||
color?: Color;
|
||||
onChange?: ColorChangeHandler;
|
||||
onChangeComplete?: ColorChangeHandler;
|
||||
}
|
||||
|
||||
export interface CustomPickerProps<A> extends ClassAttributes<A> {
|
||||
color?: Color;
|
||||
pointer?: ReactNode;
|
||||
onChange: ColorChangeHandler;
|
||||
}
|
||||
|
||||
export { default as AlphaPicker, AlphaPickerProps } from "react-color/lib/components/alpha/Alpha";
|
||||
export { default as BlockPicker, BlockPickerProps } from "react-color/lib/components/block/Block";
|
||||
export { default as ChromePicker, ChromePickerProps } from "react-color/lib/components/chrome/Chrome";
|
||||
export { default as CirclePicker, CirclePickerProps } from "react-color/lib/components/circle/Circle";
|
||||
export { default as CompactPicker, CompactPickerProps } from "react-color/lib/components/compact/Compact";
|
||||
export { default as GithubPicker, GithubPickerProps } from "react-color/lib/components/github/Github";
|
||||
export { default as HuePicker, HuePickerProps } from "react-color/lib/components/hue/Hue";
|
||||
export { default as MaterialPicker, MaterialPickerProps } from "react-color/lib/components/material/Material";
|
||||
export { default as PhotoshopPicker, PhotoshopPickerProps } from "react-color/lib/components/photoshop/Photoshop";
|
||||
export { default as SketchPicker, SketchPickerProps } from "react-color/lib/components/sketch/Sketch";
|
||||
export { default as SliderPicker, SliderPickerProps } from "react-color/lib/components/slider/Slider";
|
||||
export { default as SwatchesPicker, SwatchesPickerProps } from "react-color/lib/components/swatches/Swatches";
|
||||
export { default as TwitterPicker, TwitterPickerProps } from "react-color/lib/components/twitter/Twitter";
|
||||
export { default as CustomPicker, InjectedColorProps } from "react-color/lib/components/common/ColorWrap";
|
||||
|
||||
9
react-color/lib/components/alpha/Alpha.d.ts
vendored
Normal file
9
react-color/lib/components/alpha/Alpha.d.ts
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
import { Component } from "react";
|
||||
import { ColorPickerProps } from "react-color";
|
||||
|
||||
export interface AlphaPickerProps extends ColorPickerProps<AlphaPicker> {
|
||||
height?: string;
|
||||
width?: string;
|
||||
}
|
||||
|
||||
export default class AlphaPicker extends Component<AlphaPickerProps, any> {}
|
||||
9
react-color/lib/components/block/Block.d.ts
vendored
Normal file
9
react-color/lib/components/block/Block.d.ts
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
import { Component } from "react";
|
||||
import { ColorPickerProps } from "react-color";
|
||||
|
||||
export interface BlockPickerProps extends ColorPickerProps<BlockPicker> {
|
||||
colors?: string[];
|
||||
width?: string;
|
||||
}
|
||||
|
||||
export default class BlockPicker extends Component<BlockPickerProps, any> {}
|
||||
8
react-color/lib/components/chrome/Chrome.d.ts
vendored
Normal file
8
react-color/lib/components/chrome/Chrome.d.ts
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
import { Component } from "react";
|
||||
import { ColorPickerProps } from "react-color";
|
||||
|
||||
export interface ChromePickerProps extends ColorPickerProps<ChromePicker> {
|
||||
disableAlpha?: boolean;
|
||||
}
|
||||
|
||||
export default class ChromePicker extends Component<ChromePickerProps, any> {}
|
||||
9
react-color/lib/components/circle/Circle.d.ts
vendored
Normal file
9
react-color/lib/components/circle/Circle.d.ts
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
import { Component } from "react";
|
||||
import { ColorPickerProps } from "react-color";
|
||||
|
||||
export interface CirclePickerProps extends ColorPickerProps<CirclePicker> {
|
||||
colors?: string[];
|
||||
width?: string;
|
||||
}
|
||||
|
||||
export default class CirclePicker extends Component<CirclePickerProps, any> {}
|
||||
6
react-color/lib/components/common/Alpha.d.ts
vendored
Normal file
6
react-color/lib/components/common/Alpha.d.ts
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
import { Component } from "react";
|
||||
import { CustomPickerProps } from "react-color";
|
||||
|
||||
export type AlphaProps = CustomPickerProps<Alpha>;
|
||||
|
||||
export default class Alpha extends Component<AlphaProps, any> {}
|
||||
9
react-color/lib/components/common/Checkboard.d.ts
vendored
Normal file
9
react-color/lib/components/common/Checkboard.d.ts
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
import { Component, ClassAttributes } from "react";
|
||||
|
||||
export interface CheckboardProps extends ClassAttributes<Checkboard> {
|
||||
grey?: string;
|
||||
size?: number;
|
||||
white?: string;
|
||||
}
|
||||
|
||||
export default class Checkboard extends Component<CheckboardProps, any> {}
|
||||
11
react-color/lib/components/common/ColorWrap.d.ts
vendored
Normal file
11
react-color/lib/components/common/ColorWrap.d.ts
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
import { ComponentClass, StatelessComponent } from "react";
|
||||
import { HSLColor, RGBColor, ColorChangeHandler } from "react-color";
|
||||
|
||||
export interface InjectedColorProps {
|
||||
hex?: string;
|
||||
hsl?: HSLColor;
|
||||
rgb?: RGBColor;
|
||||
onChange?: ColorChangeHandler;
|
||||
}
|
||||
|
||||
export default function CustomPicker<A>(component: ComponentClass<A> | StatelessComponent<A>): ComponentClass<A & InjectedColorProps>;
|
||||
19
react-color/lib/components/common/EditableInput.d.ts
vendored
Normal file
19
react-color/lib/components/common/EditableInput.d.ts
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
import { Component, ClassAttributes, CSSProperties } from "react";
|
||||
import { Color, ColorChangeHandler } from "react-color";
|
||||
|
||||
export interface EditableInputStyles {
|
||||
input?: CSSProperties;
|
||||
label?: CSSProperties;
|
||||
wrap?: CSSProperties;
|
||||
}
|
||||
|
||||
export interface EditableInputProps extends ClassAttributes<EditableInput> {
|
||||
color?: Color;
|
||||
label?: string;
|
||||
onChange?: ColorChangeHandler;
|
||||
styles?: EditableInputStyles;
|
||||
value?: any;
|
||||
}
|
||||
|
||||
export default class EditableInput extends Component<EditableInputProps, any> {}
|
||||
|
||||
8
react-color/lib/components/common/Hue.d.ts
vendored
Normal file
8
react-color/lib/components/common/Hue.d.ts
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
import { Component } from "react";
|
||||
import { CustomPickerProps } from "react-color";
|
||||
|
||||
export interface HueProps extends CustomPickerProps<Hue> {
|
||||
direction?: "horizontal" | "vertical";
|
||||
}
|
||||
|
||||
export default class Hue extends Component<HueProps, any> {}
|
||||
6
react-color/lib/components/common/Saturation.d.ts
vendored
Normal file
6
react-color/lib/components/common/Saturation.d.ts
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
import { Component } from "react";
|
||||
import { CustomPickerProps } from "react-color";
|
||||
|
||||
export type SaturationProps = CustomPickerProps<Saturation>;
|
||||
|
||||
export default class Saturation extends Component<SaturationProps, any> {}
|
||||
5
react-color/lib/components/common/index.d.ts
vendored
Normal file
5
react-color/lib/components/common/index.d.ts
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
export { default as Alpha } from "react-color/lib/components/common/Alpha";
|
||||
export { default as Checkboard } from "react-color/lib/components/common/Checkboard";
|
||||
export { default as EditableInput } from "react-color/lib/components/common/EditableInput";
|
||||
export { default as Hue } from "react-color/lib/components/common/Hue";
|
||||
export { default as Saturation } from "react-color/lib/components/common/Saturation";
|
||||
8
react-color/lib/components/compact/Compact.d.ts
vendored
Normal file
8
react-color/lib/components/compact/Compact.d.ts
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
import { Component } from "react";
|
||||
import { ColorPickerProps } from "react-color";
|
||||
|
||||
export interface CompactPickerProps extends ColorPickerProps<CompactPicker> {
|
||||
colors?: string[];
|
||||
}
|
||||
|
||||
export default class CompactPicker extends Component<CompactPickerProps, any> {}
|
||||
9
react-color/lib/components/github/Github.d.ts
vendored
Normal file
9
react-color/lib/components/github/Github.d.ts
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
import { Component } from "react";
|
||||
import { ColorPickerProps } from "react-color";
|
||||
|
||||
export interface GithubPickerProps extends ColorPickerProps<GithubPicker> {
|
||||
colors?: string[];
|
||||
width?: string;
|
||||
}
|
||||
|
||||
export default class GithubPicker extends Component<GithubPickerProps, any> {}
|
||||
9
react-color/lib/components/hue/Hue.d.ts
vendored
Normal file
9
react-color/lib/components/hue/Hue.d.ts
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
import { Component } from "react";
|
||||
import { ColorPickerProps } from "react-color";
|
||||
|
||||
export interface HuePickerProps extends ColorPickerProps<HuePicker> {
|
||||
height?: string;
|
||||
width?: string;
|
||||
}
|
||||
|
||||
export default class HuePicker extends Component<HuePickerProps, any> {}
|
||||
6
react-color/lib/components/material/Material.d.ts
vendored
Normal file
6
react-color/lib/components/material/Material.d.ts
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
import { Component } from "react";
|
||||
import { ColorPickerProps } from "react-color";
|
||||
|
||||
export type MaterialPickerProps = ColorPickerProps<MaterialPicker>;
|
||||
|
||||
export default class MaterialPicker extends Component<MaterialPickerProps, any> {}
|
||||
10
react-color/lib/components/photoshop/Photoshop.d.ts
vendored
Normal file
10
react-color/lib/components/photoshop/Photoshop.d.ts
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
import { Component } from "react";
|
||||
import { ColorChangeHandler, ColorPickerProps } from "react-color";
|
||||
|
||||
export interface PhotoshopPickerProps extends ColorPickerProps<PhotoshopPicker> {
|
||||
header?: string;
|
||||
onAccept?: ColorChangeHandler;
|
||||
onCancel?: ColorChangeHandler;
|
||||
}
|
||||
|
||||
export default class PhotoshopPicker extends Component<PhotoshopPickerProps, any> {}
|
||||
10
react-color/lib/components/sketch/Sketch.d.ts
vendored
Normal file
10
react-color/lib/components/sketch/Sketch.d.ts
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
import { Component } from "react";
|
||||
import { ColorPickerProps } from "react-color";
|
||||
|
||||
export interface SketchPickerProps extends ColorPickerProps<SketchPicker> {
|
||||
disableAlpha?: boolean;
|
||||
presetColors?: string[];
|
||||
width?: string;
|
||||
}
|
||||
|
||||
export default class SketchPicker extends Component<SketchPickerProps, any> {}
|
||||
6
react-color/lib/components/slider/Slider.d.ts
vendored
Normal file
6
react-color/lib/components/slider/Slider.d.ts
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
import { Component } from "react";
|
||||
import { ColorPickerProps } from "react-color";
|
||||
|
||||
export type SliderPickerProps = ColorPickerProps<SliderPicker>;
|
||||
|
||||
export default class SliderPicker extends Component<SliderPickerProps, any> {}
|
||||
10
react-color/lib/components/swatches/Swatches.d.ts
vendored
Normal file
10
react-color/lib/components/swatches/Swatches.d.ts
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
import { Component } from "react";
|
||||
import { ColorPickerProps } from "react-color";
|
||||
|
||||
export interface SwatchesPickerProps extends ColorPickerProps<SwatchesPicker> {
|
||||
colors?: string[][];
|
||||
height?: number;
|
||||
width?: number;
|
||||
}
|
||||
|
||||
export default class SwatchesPicker extends Component<SwatchesPickerProps, any> {}
|
||||
6
react-color/lib/components/twitter/Twitter.d.ts
vendored
Normal file
6
react-color/lib/components/twitter/Twitter.d.ts
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
import { Component } from "react";
|
||||
import { ColorPickerProps } from "react-color";
|
||||
|
||||
export type TwitterPickerProps = ColorPickerProps<TwitterPicker>;
|
||||
|
||||
export default class TwitterPicker extends Component<TwitterPickerProps, any> {}
|
||||
@@ -5,16 +5,19 @@ import {
|
||||
AlphaPicker, BlockPicker, ChromePicker, CirclePicker,
|
||||
CompactPicker, GithubPicker, HuePicker, MaterialPicker,
|
||||
PhotoshopPicker, SketchPicker, SliderPicker, SwatchesPicker,
|
||||
TwitterPicker, CustomPicker
|
||||
TwitterPicker, CustomPicker, InjectedColorProps, ColorResult,
|
||||
Color
|
||||
} from "react-color"
|
||||
import { Alpha, Checkboard, EditableInput, Hue, Saturation } from "react-color/lib/components/common"
|
||||
|
||||
interface CustomProps extends ReactColor.InjectedColorProps {
|
||||
color?: ReactColor.Color
|
||||
interface CustomProps extends InjectedColorProps {
|
||||
color?: Color
|
||||
}
|
||||
|
||||
var CustomComponent: StatelessComponent<CustomProps> = (props: CustomProps) => {
|
||||
function onChange (color: ReactColor.ColorResult) {}
|
||||
function onChange (color: ColorResult) {
|
||||
console.log(color)
|
||||
}
|
||||
|
||||
return (
|
||||
<div>
|
||||
|
||||
@@ -15,10 +15,32 @@
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"jsx": "react"
|
||||
"jsx": "react",
|
||||
"noUnusedParameters": true,
|
||||
"noUnusedLocals": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"lib/components/alpha/Alpha.d.ts",
|
||||
"lib/components/block/Block.d.ts",
|
||||
"lib/components/chrome/Chrome.d.ts",
|
||||
"lib/components/circle/Circle.d.ts",
|
||||
"lib/components/common/Alpha.d.ts",
|
||||
"lib/components/common/Checkboard.d.ts",
|
||||
"lib/components/common/ColorWrap.d.ts",
|
||||
"lib/components/common/EditableInput.d.ts",
|
||||
"lib/components/common/Hue.d.ts",
|
||||
"lib/components/common/index.d.ts",
|
||||
"lib/components/common/Saturation.d.ts",
|
||||
"lib/components/compact/Compact.d.ts",
|
||||
"lib/components/github/Github.d.ts",
|
||||
"lib/components/hue/Hue.d.ts",
|
||||
"lib/components/material/Material.d.ts",
|
||||
"lib/components/photoshop/Photoshop.d.ts",
|
||||
"lib/components/sketch/Sketch.d.ts",
|
||||
"lib/components/slider/Slider.d.ts",
|
||||
"lib/components/swatches/Swatches.d.ts",
|
||||
"lib/components/twitter/Twitter.d.ts",
|
||||
"react-color-tests.tsx"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
1
react-color/tslint.json
Normal file
1
react-color/tslint.json
Normal file
@@ -0,0 +1 @@
|
||||
{ "extends": "../tslint.json" }
|
||||
364
react-dates/index.d.ts
vendored
Normal file
364
react-dates/index.d.ts
vendored
Normal file
@@ -0,0 +1,364 @@
|
||||
// Type definitions for react-dates v7.0.1
|
||||
// Project: https://github.com/airbnb/react-dates
|
||||
// Definitions by: Artur Ampilogov <https://github.com/Artur-A>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.1
|
||||
|
||||
import * as React from "react";
|
||||
import * as moment from "moment";
|
||||
|
||||
export = ReactDates;
|
||||
|
||||
declare namespace momentPropTypes{
|
||||
type momentObj = any;
|
||||
type momentString = any;
|
||||
type momentDurationObj = any;
|
||||
}
|
||||
|
||||
|
||||
declare namespace ReactDates{
|
||||
type AnchorDirectionShape = 'left' | 'right';
|
||||
type FocusedInputShape = 'startDate' | 'endDate';
|
||||
type OrientationShape = 'horizontal' | 'vertical';
|
||||
type ScrollableOrientationShape = 'horizontal' | 'vertical' | 'verticalScrollable';
|
||||
|
||||
|
||||
interface DateRangePickerShape{
|
||||
startDate?: momentPropTypes.momentObj,
|
||||
endDate?: momentPropTypes.momentObj,
|
||||
focusedInput?: FocusedInputShape,
|
||||
screenReaderInputMessage?: string,
|
||||
minimumNights?: number,
|
||||
isDayBlocked?: (day: any) => boolean,
|
||||
isOutsideRange?: (day: any) => boolean,
|
||||
enableOutsideDays?: boolean,
|
||||
reopenPickerOnClearDates?: boolean,
|
||||
keepOpenOnDateSelect?: boolean,
|
||||
numberOfMonths?: number,
|
||||
showClearDates?: boolean,
|
||||
disabled?: boolean,
|
||||
required?: boolean,
|
||||
showDefaultInputIcon?: boolean,
|
||||
|
||||
orientation?: OrientationShape,
|
||||
anchorDirection?: AnchorDirectionShape,
|
||||
horizontalMargin?: number,
|
||||
// portal options
|
||||
withPortal?: boolean,
|
||||
withFullScreenPortal?: boolean,
|
||||
|
||||
startDateId?: string,
|
||||
startDatePlaceholderText?: string,
|
||||
endDateId?: string,
|
||||
endDatePlaceholderText?: string,
|
||||
|
||||
initialVisibleMonth?: () => moment.Moment,
|
||||
onDatesChange?: (arg: { startDate: any, endDate: any }) => void,
|
||||
onFocusChange?: (arg: FocusedInputShape) => void,
|
||||
onPrevMonthClick?: (e: React.EventHandler<React.MouseEvent<HTMLSpanElement>>) => void,
|
||||
onNextMonthClick?: (e: React.EventHandler<React.MouseEvent<HTMLSpanElement>>) => void,
|
||||
|
||||
renderDay?: (day: any) => (string | JSX.Element),
|
||||
|
||||
// i18n
|
||||
displayFormat?: (string | (()=> string)),
|
||||
monthFormat?: string,
|
||||
phrases?: {
|
||||
closeDatePicker: string | JSX.Element,
|
||||
clearDates: string | JSX.Element,
|
||||
}
|
||||
}
|
||||
|
||||
type DateRangePicker = React.ClassicComponentClass<DateRangePickerShape>;
|
||||
var DateRangePicker: React.ClassicComponentClass<DateRangePickerShape>;
|
||||
|
||||
interface SingleDatePickerShape{
|
||||
id: string,
|
||||
placeholder?: string,
|
||||
date?: momentPropTypes.momentObj,
|
||||
focused?: boolean,
|
||||
showClearDate?: boolean,
|
||||
reopenPickerOnClearDates?: boolean,
|
||||
keepOpenOnDateSelect?: boolean,
|
||||
disabled?: boolean,
|
||||
required?: boolean,
|
||||
screenReaderInputMessage?: string,
|
||||
|
||||
onDateChange?: (date: any) => void,
|
||||
onFocusChange?: (arg: { focused: boolean | null }) => void,
|
||||
|
||||
isDayBlocked?: (day: any) => boolean,
|
||||
isOutsideRange?: (day: any) => boolean,
|
||||
enableOutsideDays?: boolean,
|
||||
numberOfMonths?: number,
|
||||
orientation?: OrientationShape,
|
||||
initialVisibleMonth?: () => moment.Moment,
|
||||
anchorDirection?: AnchorDirectionShape,
|
||||
horizontalMargin?: number,
|
||||
|
||||
navPrev?: string | JSX.Element,
|
||||
navNext?: string | JSX.Element,
|
||||
|
||||
// portal options
|
||||
withPortal?: boolean,
|
||||
withFullScreenPortal?: boolean,
|
||||
|
||||
onPrevMonthClick?: (e: React.EventHandler<React.MouseEvent<HTMLSpanElement>>) => void,
|
||||
onNextMonthClick?: (e: React.EventHandler<React.MouseEvent<HTMLSpanElement>>) => void,
|
||||
|
||||
renderDay?: (day: any) => (string | JSX.Element),
|
||||
|
||||
// i18n
|
||||
displayFormat?: (string | (()=> string)),
|
||||
monthFormat?: string,
|
||||
phrases?: {
|
||||
closeDatePicker: string | JSX.Element,
|
||||
},
|
||||
}
|
||||
type SingleDatePicker = React.ClassicComponentClass<SingleDatePickerShape>;
|
||||
var SingleDatePicker: React.ClassicComponentClass<SingleDatePickerShape>;
|
||||
|
||||
|
||||
|
||||
interface DateRangePickerInputControllerShape {
|
||||
startDate?: momentPropTypes.momentObj,
|
||||
startDateId?: string,
|
||||
startDatePlaceholderText?: string,
|
||||
isStartDateFocused?: boolean,
|
||||
|
||||
endDate?: momentPropTypes.momentObj,
|
||||
endDateId?: string,
|
||||
endDatePlaceholderText?: string,
|
||||
isEndDateFocused?: boolean,
|
||||
|
||||
screenReaderMessage?: string,
|
||||
showClearDates?: boolean,
|
||||
showCaret?: boolean,
|
||||
showDefaultInputIcon?: boolean,
|
||||
disabled?: boolean,
|
||||
required?: boolean,
|
||||
|
||||
keepOpenOnDateSelect?: boolean,
|
||||
reopenPickerOnClearDates?: boolean,
|
||||
withFullScreenPortal?: boolean,
|
||||
isOutsideRange?: (day: any) => boolean,
|
||||
displayFormat?: (string | (()=> string)),
|
||||
|
||||
onFocusChange?: (arg: FocusedInputShape) => void,
|
||||
onDatesChange?: (arg: { startDate: any, endDate: any }) => void,
|
||||
|
||||
customInputIcon?: string | JSX.Element,
|
||||
customArrowIcon?: string | JSX.Element,
|
||||
|
||||
// i18n
|
||||
phrases?: {
|
||||
clearDates: string | JSX.Element,
|
||||
}
|
||||
}
|
||||
type DateRangePickerInputController = React.ClassicComponentClass<DateRangePickerInputControllerShape>;
|
||||
var DateRangePickerInputController: React.ClassicComponentClass<DateRangePickerInputControllerShape>;
|
||||
|
||||
|
||||
|
||||
interface DateRangePickerInputShape{
|
||||
startDateId?: string,
|
||||
startDatePlaceholderText?: string,
|
||||
screenReaderMessage?: string,
|
||||
|
||||
endDateId?: string,
|
||||
endDatePlaceholderText?: string,
|
||||
|
||||
onStartDateFocus?: (e: React.EventHandler<React.MouseEvent<HTMLSpanElement>>) => void,
|
||||
onEndDateFocus?: (e: React.EventHandler<React.FocusEvent<HTMLInputElement>>) => void,
|
||||
onStartDateChange?: (e: React.EventHandler<React.FormEvent<HTMLInputElement>>) => void,
|
||||
onEndDateChange?: (e: React.EventHandler<React.FormEvent<HTMLInputElement>>) => void,
|
||||
onStartDateShiftTab?: (e: React.EventHandler<React.KeyboardEvent<HTMLInputElement>>) => void,
|
||||
onEndDateTab?: (e: React.EventHandler<React.KeyboardEvent<HTMLInputElement>>) => void,
|
||||
onClearDates?: (e: React.EventHandler<React.MouseEvent<HTMLButtonElement>>) => void,
|
||||
|
||||
startDate?: string,
|
||||
startDateValue?: string,
|
||||
endDate?: string,
|
||||
endDateValue?: string,
|
||||
|
||||
isStartDateFocused?: boolean,
|
||||
isEndDateFocused?: boolean,
|
||||
showClearDates?: boolean,
|
||||
disabled?: boolean,
|
||||
required?: boolean,
|
||||
showCaret?: boolean,
|
||||
showDefaultInputIcon?: boolean,
|
||||
customInputIcon?: string | JSX.Element,
|
||||
customArrowIcon?: string | JSX.Element,
|
||||
|
||||
// i18n
|
||||
phrases?:{
|
||||
clearDates: string | JSX.Element,
|
||||
},
|
||||
}
|
||||
type DateRangePickerInput = React.ClassicComponentClass<DateRangePickerInputShape>;
|
||||
var DateRangePickerInput: React.ClassicComponentClass<DateRangePickerInputShape>;
|
||||
|
||||
|
||||
|
||||
interface SingleDatePickerInputShape{
|
||||
id: string,
|
||||
placeholder?: string, // also used as label
|
||||
displayValue?: string,
|
||||
inputValue?: string,
|
||||
screenReaderMessage?: string,
|
||||
focused?: boolean,
|
||||
disabled?: boolean,
|
||||
required?: boolean,
|
||||
showCaret?: boolean,
|
||||
showClearDate?: boolean,
|
||||
|
||||
onChange?: (e: React.EventHandler<React.FormEvent<HTMLInputElement>>) => void,
|
||||
onClearDate?: (e: React.EventHandler<React.MouseEvent<HTMLButtonElement>>) => void,
|
||||
onFocus?: (e: React.EventHandler<React.FocusEvent<HTMLInputElement>>) => void,
|
||||
onKeyDownShiftTab?: (e: React.EventHandler<React.KeyboardEvent<HTMLInputElement>>) => void,
|
||||
onKeyDownTab?: (e: React.EventHandler<React.KeyboardEvent<HTMLInputElement>>) => void,
|
||||
|
||||
// i18n
|
||||
phrases?: {
|
||||
clearDate: string | JSX.Element,
|
||||
}
|
||||
}
|
||||
type SingleDatePickerInput = React.ClassicComponentClass<SingleDatePickerInputShape>;
|
||||
var SingleDatePickerInput: React.ClassicComponentClass<SingleDatePickerInputShape>;
|
||||
|
||||
|
||||
|
||||
|
||||
interface DayPickerShape{
|
||||
enableOutsideDays?: boolean,
|
||||
numberOfMonths?: number,
|
||||
modifiers?: any,
|
||||
orientation?: ScrollableOrientationShape,
|
||||
withPortal?: boolean,
|
||||
hidden?: boolean,
|
||||
initialVisibleMonth?: () => moment.Moment,
|
||||
|
||||
navPrev?: string | JSX.Element,
|
||||
navNext?: string | JSX.Element,
|
||||
|
||||
onDayClick?: (day: any, e: React.EventHandler<React.MouseEvent<HTMLTableDataCellElement>>) => void,
|
||||
onDayMouseEnter?: (day: any, e: React.EventHandler<React.MouseEvent<HTMLTableDataCellElement>>) => void,
|
||||
onDayMouseLeave?: (day: any, e: React.EventHandler<React.MouseEvent<HTMLTableDataCellElement>>) => void,
|
||||
onPrevMonthClick?: (e: React.EventHandler<React.MouseEvent<HTMLSpanElement>>) => void,
|
||||
onNextMonthClick?: (e: React.EventHandler<React.MouseEvent<HTMLSpanElement>>) => void,
|
||||
onOutsideClick?: (e: MouseEvent) => void,
|
||||
|
||||
renderDay?: (day: any) => (string | JSX.Element),
|
||||
|
||||
// i18n
|
||||
monthFormat?: string,
|
||||
}
|
||||
type DayPicker = React.ClassicComponentClass<DayPickerShape>;
|
||||
var DayPicker: React.ClassicComponentClass<DayPickerShape>;
|
||||
|
||||
|
||||
|
||||
interface DayPickerRangeControllerShape{
|
||||
startDate?: momentPropTypes.momentObj,
|
||||
endDate?: momentPropTypes.momentObj,
|
||||
onDatesChange?: (arg: { startDate: any, endDate: any }) => void,
|
||||
|
||||
focusedInput?: FocusedInputShape,
|
||||
onFocusChange?: (arg: FocusedInputShape) => void,
|
||||
|
||||
keepOpenOnDateSelect?: boolean,
|
||||
minimumNights?: number,
|
||||
isOutsideRange?: (day: any) => boolean,
|
||||
isDayBlocked?: (day: any) => boolean,
|
||||
isDayHighlighted?: (day: any) => boolean,
|
||||
|
||||
// DayPicker props
|
||||
enableOutsideDays?: boolean,
|
||||
numberOfMonths?: number,
|
||||
orientation?: ScrollableOrientationShape,
|
||||
withPortal?: boolean,
|
||||
hidden?: boolean,
|
||||
initialVisibleMonth?: () => moment.Moment,
|
||||
|
||||
navPrev?: string | JSX.Element,
|
||||
navNext?: string | JSX.Element,
|
||||
|
||||
onPrevMonthClick?: (e: React.EventHandler<React.MouseEvent<HTMLSpanElement>>) => void,
|
||||
onNextMonthClick?: (e: React.EventHandler<React.MouseEvent<HTMLSpanElement>>) => void,
|
||||
onOutsideClick?: (e: MouseEvent) => void,
|
||||
renderDay?: (day: any) => (string | JSX.Element),
|
||||
|
||||
// i18n
|
||||
monthFormat?: string,
|
||||
}
|
||||
type DayPickerRangeController = React.ClassicComponentClass<DayPickerRangeControllerShape>;
|
||||
var DayPickerRangeController: React.ClassicComponentClass<DayPickerRangeControllerShape>;
|
||||
|
||||
|
||||
interface CalendarMonthGridShape{
|
||||
enableOutsideDays?: boolean,
|
||||
firstVisibleMonthIndex?: number,
|
||||
initialMonth?: momentPropTypes.momentObj,
|
||||
isAnimating?: boolean,
|
||||
numberOfMonths?: number,
|
||||
modifiers?: any,
|
||||
orientation?: ScrollableOrientationShape,
|
||||
onDayClick?: (day: any, e: React.EventHandler<React.MouseEvent<HTMLTableDataCellElement>>) => void,
|
||||
onDayMouseEnter?: (day: any, e: React.EventHandler<React.MouseEvent<HTMLTableDataCellElement>>) => void,
|
||||
onDayMouseLeave?: (day: any, e: React.EventHandler<React.MouseEvent<HTMLTableDataCellElement>>) => void,
|
||||
onMonthTransitionEnd?: ()=> void,
|
||||
renderDay?: (day: any) => (string | JSX.Element),
|
||||
transformValue?: string,
|
||||
|
||||
// i18n
|
||||
monthFormat?: string,
|
||||
}
|
||||
type CalendarMonthGrid = React.ClassicComponentClass<CalendarMonthGridShape>;
|
||||
var CalendarMonthGrid: React.ClassicComponentClass<CalendarMonthGridShape>;
|
||||
|
||||
|
||||
|
||||
interface CalendarMonthShape{
|
||||
month?: momentPropTypes.momentObj,
|
||||
isVisible?: boolean,
|
||||
enableOutsideDays?: boolean,
|
||||
modifiers?: any,
|
||||
orientation?: ScrollableOrientationShape,
|
||||
onDayClick?: (day: any, e: React.EventHandler<React.MouseEvent<HTMLTableDataCellElement>>) => void,
|
||||
onDayMouseEnter?: (day: any, e: React.EventHandler<React.MouseEvent<HTMLTableDataCellElement>>) => void,
|
||||
onDayMouseLeave?: (day: any, e: React.EventHandler<React.MouseEvent<HTMLTableDataCellElement>>) => void,
|
||||
renderDay?: (day: any) => (string | JSX.Element),
|
||||
|
||||
// i18n
|
||||
monthFormat?: string,
|
||||
}
|
||||
type CalendarMonth = React.ClassicComponentClass<CalendarMonthShape>;
|
||||
var CalendarMonth: React.ClassicComponentClass<CalendarMonthShape>;
|
||||
|
||||
|
||||
interface CalendarDayShape{
|
||||
day?: momentPropTypes.momentObj,
|
||||
isOutsideDay?: boolean,
|
||||
modifiers?: any,
|
||||
onDayClick?: (day: any, e: React.EventHandler<React.MouseEvent<HTMLTableDataCellElement>>) => void,
|
||||
onDayMouseEnter?: (day: any, e: React.EventHandler<React.MouseEvent<HTMLTableDataCellElement>>) => void,
|
||||
onDayMouseLeave?: (day: any, e: React.EventHandler<React.MouseEvent<HTMLTableDataCellElement>>) => void,
|
||||
renderDay?: (day: any) => (string | JSX.Element),
|
||||
}
|
||||
type CalendarDay = React.ClassicComponentClass<CalendarDayShape>;
|
||||
var CalendarDay: React.ClassicComponentClass<CalendarDayShape>;
|
||||
|
||||
|
||||
|
||||
|
||||
var isInclusivelyAfterDay: (a: moment.Moment, b: moment.Moment) => boolean;
|
||||
var isInclusivelyBeforeDay: (a: moment.Moment, b: moment.Moment) => boolean;
|
||||
var isNextDay: (a: moment.Moment, b: moment.Moment) => boolean;
|
||||
var isSameDay: (a: moment.Moment, b: moment.Moment) => boolean;
|
||||
|
||||
var toISODateString: (date: moment.MomentInput, currentFormat: moment.MomentFormatSpecification) => string | null;
|
||||
var toLocalizedDateString: (date: moment.MomentInput, currentFormat: moment.MomentFormatSpecification) => string | null;
|
||||
|
||||
var toMomentObject: (dateString: moment.MomentInput, customFormat: moment.MomentFormatSpecification) => moment.Moment | null;
|
||||
}
|
||||
5
react-dates/package.json
Normal file
5
react-dates/package.json
Normal file
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"dependencies": {
|
||||
"moment": ">=2.17.1"
|
||||
}
|
||||
}
|
||||
357
react-dates/react-dates-tests.tsx
Normal file
357
react-dates/react-dates-tests.tsx
Normal file
@@ -0,0 +1,357 @@
|
||||
import * as React from "react";
|
||||
import * as moment from "moment";
|
||||
|
||||
import {
|
||||
CalendarDay,
|
||||
CalendarMonth,
|
||||
CalendarMonthGrid,
|
||||
SingleDatePickerInput,
|
||||
SingleDatePicker,
|
||||
DayPicker,
|
||||
DayPickerRangeController,
|
||||
DateRangePickerInput,
|
||||
DateRangePickerInputController,
|
||||
DateRangePicker,
|
||||
isInclusivelyAfterDay,
|
||||
isInclusivelyBeforeDay,
|
||||
isNextDay,
|
||||
isSameDay,
|
||||
toISODateString,
|
||||
toLocalizedDateString,
|
||||
toMomentObject} from "react-dates";
|
||||
|
||||
|
||||
class CalendarDayRenderingMinimumTest extends React.Component<{}, {}> {
|
||||
render() {
|
||||
return <CalendarDay />
|
||||
}
|
||||
}
|
||||
|
||||
class CalendarDayRenderingFullTest extends React.Component<{}, {}> {
|
||||
render() {
|
||||
return <CalendarDay day={moment()}
|
||||
isOutsideDay={false}
|
||||
renderDay={day => day.toString()}
|
||||
onDayClick={(day,e) => {}}
|
||||
onDayMouseEnter={(day,e) => {}}
|
||||
onDayMouseLeave={(day,e) => {}}
|
||||
/>
|
||||
}
|
||||
}
|
||||
|
||||
class CalendarMonthMinimumTest extends React.Component<{}, {}> {
|
||||
render() {
|
||||
return <CalendarMonth />
|
||||
}
|
||||
}
|
||||
|
||||
class CalendarMonthFullTest extends React.Component<{}, {}> {
|
||||
render() {
|
||||
return <CalendarMonth enableOutsideDays={true}
|
||||
isVisible={true}
|
||||
month={moment()}
|
||||
orientation="horizontal"
|
||||
monthFormat="MM"
|
||||
renderDay={day => day.toString()}
|
||||
onDayClick={(day,e) => {}}
|
||||
onDayMouseEnter={(day,e) => {}}
|
||||
onDayMouseLeave={(day,e) => {}}
|
||||
/>
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
class SingleDatePickerInputMinimumTest extends React.Component<{}, {}> {
|
||||
render() {
|
||||
return <SingleDatePickerInput id="SingleDatePickerInput" />
|
||||
}
|
||||
}
|
||||
|
||||
class SingleDatePickerInputFullTest extends React.Component<{}, {}> {
|
||||
render() {
|
||||
return <SingleDatePickerInput
|
||||
id="SingleDatePickerInput"
|
||||
disabled={false}
|
||||
displayValue="SingleDatePicker"
|
||||
focused={false}
|
||||
inputValue="test"
|
||||
onChange={e => {}}
|
||||
onClearDate={e => {}}
|
||||
onFocus={e => {}}
|
||||
onKeyDownShiftTab={e => {}}
|
||||
onKeyDownTab={e => {}}
|
||||
phrases={{clearDate: "clear"}}
|
||||
placeholder="test"
|
||||
required={false}
|
||||
screenReaderMessage="arial-test"
|
||||
showCaret={true}
|
||||
showClearDate={true}
|
||||
/>
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
class SingleDatePickerMinimumTest extends React.Component<{}, {}> {
|
||||
render() {
|
||||
return <SingleDatePicker id="SingleDatePickerInput" />
|
||||
}
|
||||
}
|
||||
|
||||
class SingleDatePickerFullTest extends React.Component<{}, {}> {
|
||||
render() {
|
||||
return <SingleDatePicker
|
||||
id="SingleDatePickerInput"
|
||||
disabled={false}
|
||||
displayFormat="dd.mm.yyyy"
|
||||
anchorDirection="right"
|
||||
date={moment()}
|
||||
enableOutsideDays={true}
|
||||
horizontalMargin={20}
|
||||
initialVisibleMonth={() => moment()}
|
||||
placeholder="test"
|
||||
required={false}
|
||||
showClearDate={true}
|
||||
isDayBlocked={(day:any)=> false}
|
||||
isOutsideRange={(day:any)=> false}
|
||||
keepOpenOnDateSelect={true}
|
||||
navNext="next"
|
||||
navPrev="prev"
|
||||
withPortal={false}
|
||||
onDateChange={d => {}}
|
||||
focused={false}
|
||||
phrases={{closeDatePicker: <span>Close</span>}}
|
||||
reopenPickerOnClearDates={true}
|
||||
screenReaderInputMessage="arial-test"
|
||||
withFullScreenPortal={true}
|
||||
onFocusChange={arg => {}}
|
||||
onNextMonthClick={e => {}}
|
||||
onPrevMonthClick={e => {}}
|
||||
numberOfMonths={2}
|
||||
orientation="horizontal"
|
||||
monthFormat="MM"
|
||||
renderDay={day => day.toString()}
|
||||
/>
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
class DayPickerRangeControllerMinimumTest extends React.Component<{}, {}> {
|
||||
render() {
|
||||
return <DayPickerRangeController />
|
||||
}
|
||||
}
|
||||
|
||||
class DayPickerRangeControllerFullTest extends React.Component<{}, {}> {
|
||||
render() {
|
||||
return <DayPickerRangeController
|
||||
startDate={moment()}
|
||||
endDate={moment()}
|
||||
focusedInput="startDate"
|
||||
initialVisibleMonth={() => moment()}
|
||||
hidden={false}
|
||||
isDayBlocked={(day:any)=> false}
|
||||
isDayHighlighted={(day:any)=> false}
|
||||
isOutsideRange={(day:any)=> false}
|
||||
keepOpenOnDateSelect={true}
|
||||
minimumNights={3}
|
||||
navNext="next"
|
||||
navPrev="prev"
|
||||
withPortal={false}
|
||||
onDatesChange={arg => {}}
|
||||
onFocusChange={arg => {}}
|
||||
onNextMonthClick={e => {}}
|
||||
onPrevMonthClick={e => {}}
|
||||
onOutsideClick={e => {}}
|
||||
enableOutsideDays={true}
|
||||
numberOfMonths={2}
|
||||
orientation="horizontal"
|
||||
monthFormat="MM"
|
||||
renderDay={day => day.toString()}
|
||||
/>
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
class DayPickerTest extends React.Component<{}, {}> {
|
||||
render() {
|
||||
return <DayPicker />
|
||||
}
|
||||
}
|
||||
|
||||
class DayPickerFullTest extends React.Component<{}, {}> {
|
||||
render() {
|
||||
return <DayPicker
|
||||
onDayClick={(day,e)=> {}}
|
||||
onDayMouseEnter={(day,e)=>{}}
|
||||
onDayMouseLeave={(day,e)=>{}}
|
||||
initialVisibleMonth={() => moment()}
|
||||
hidden={false}
|
||||
navNext="next"
|
||||
navPrev="prev"
|
||||
withPortal={false}
|
||||
onNextMonthClick={e => {}}
|
||||
onPrevMonthClick={e => {}}
|
||||
onOutsideClick={e => {}}
|
||||
enableOutsideDays={true}
|
||||
numberOfMonths={2}
|
||||
orientation="horizontal"
|
||||
monthFormat="MM"
|
||||
renderDay={day => day.toString()}
|
||||
/>
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
class DateRangePickerInputMinimumTest extends React.Component<{}, {}> {
|
||||
render() {
|
||||
return <DateRangePickerInput startDateId="id1" endDateId="id2" />
|
||||
}
|
||||
}
|
||||
|
||||
class DateRangePickerInputFullTest extends React.Component<{}, {}> {
|
||||
render() {
|
||||
return <DateRangePickerInput
|
||||
customArrowIcon="<"
|
||||
customInputIcon=">"
|
||||
disabled={false}
|
||||
startDateId="id1"
|
||||
endDateId="id2"
|
||||
startDateValue={"1.1.2020"}
|
||||
endDateValue={"1.1.2020"}
|
||||
startDatePlaceholderText="placeholder"
|
||||
endDatePlaceholderText="placeholder"
|
||||
isEndDateFocused={false}
|
||||
isStartDateFocused={false}
|
||||
onClearDates={e => {}}
|
||||
onEndDateChange={e => {}}
|
||||
onEndDateFocus={e => {}}
|
||||
onEndDateTab={e => {}}
|
||||
onStartDateChange={e => {}}
|
||||
onStartDateFocus={e => {}}
|
||||
onStartDateShiftTab={e => {}}
|
||||
showDefaultInputIcon={true}
|
||||
required={false}
|
||||
screenReaderMessage="arial-test"
|
||||
showCaret={true}
|
||||
showClearDates={true}
|
||||
phrases={{clearDates: "clear"}}
|
||||
/>
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
class DateRangePickerInputControllerMinimumTest extends React.Component<{}, {}> {
|
||||
render() {
|
||||
return <DateRangePickerInputController startDateId="id1" endDateId="id2" />
|
||||
}
|
||||
}
|
||||
|
||||
class DateRangePickerInputControllerFullTest extends React.Component<{}, {}> {
|
||||
render() {
|
||||
return <DateRangePickerInput
|
||||
customArrowIcon="<"
|
||||
customInputIcon=">"
|
||||
disabled={false}
|
||||
startDateId="id1"
|
||||
endDateId="id2"
|
||||
startDateValue={"1.1.2020"}
|
||||
endDateValue={"1.1.2020"}
|
||||
startDatePlaceholderText="placeholder"
|
||||
endDatePlaceholderText="placeholder"
|
||||
isEndDateFocused={false}
|
||||
isStartDateFocused={false}
|
||||
onClearDates={e => {}}
|
||||
onEndDateChange={e => {}}
|
||||
onEndDateFocus={e => {}}
|
||||
onEndDateTab={e => {}}
|
||||
onStartDateChange={e => {}}
|
||||
onStartDateFocus={e => {}}
|
||||
onStartDateShiftTab={e => {}}
|
||||
showDefaultInputIcon={true}
|
||||
required={false}
|
||||
screenReaderMessage="arial-test"
|
||||
showCaret={true}
|
||||
showClearDates={true}
|
||||
phrases={{clearDates: "clear"}}
|
||||
startDate="1.1.2020"
|
||||
endDate="1.1.2020"
|
||||
/>
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
class DateRangePickerMinimumTest extends React.Component<{}, {}> {
|
||||
render() {
|
||||
return <DateRangePicker startDateId="id1" endDateId="id2" />
|
||||
}
|
||||
}
|
||||
|
||||
class DateRangePickerFullTest extends React.Component<{}, {}> {
|
||||
render() {
|
||||
return <DateRangePicker
|
||||
disabled={false}
|
||||
startDateId="id1"
|
||||
endDateId="id2"
|
||||
startDatePlaceholderText="placeholder"
|
||||
endDatePlaceholderText="placeholder"
|
||||
showDefaultInputIcon={true}
|
||||
required={false}
|
||||
showClearDates={true}
|
||||
phrases={{clearDates: "clear", closeDatePicker: "close"}}
|
||||
startDate="1.1.2020"
|
||||
endDate="1.1.2020"
|
||||
anchorDirection="left"
|
||||
focusedInput="startDate"
|
||||
minimumNights={2}
|
||||
onDatesChange={arg => {arg.startDate; arg.endDate;}}
|
||||
displayFormat="dd.mm.yyyy"
|
||||
enableOutsideDays={true}
|
||||
horizontalMargin={20}
|
||||
initialVisibleMonth={() => moment()}
|
||||
isDayBlocked={(day:any)=> false}
|
||||
isOutsideRange={(day:any)=> false}
|
||||
keepOpenOnDateSelect={true}
|
||||
withPortal={false}
|
||||
reopenPickerOnClearDates={true}
|
||||
screenReaderInputMessage="arial-test"
|
||||
withFullScreenPortal={true}
|
||||
onFocusChange={arg => {}}
|
||||
onNextMonthClick={e => {}}
|
||||
onPrevMonthClick={e => {}}
|
||||
numberOfMonths={2}
|
||||
orientation="horizontal"
|
||||
monthFormat="MM"
|
||||
renderDay={day => day.toString()}
|
||||
/>
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
const isInclusivelyAfterDayResult: boolean = isInclusivelyAfterDay(moment(),moment());
|
||||
const isInclusivelyBeforeDayResult: boolean = isInclusivelyBeforeDay(moment(),moment());
|
||||
const isNextDayDayResult: boolean = isNextDay(moment(),moment());
|
||||
const isSameDayResult: boolean = isSameDay(moment(),moment());
|
||||
const toISODateStringResult: string | null = toISODateString(moment(), "dd.mm.yyyy");
|
||||
const toLocalizedDateStringResult: string | null = toLocalizedDateString(moment(), "dd.mm.yyyy");
|
||||
const toMomentObjectResult: moment.Moment | null = toMomentObject(moment(), "dd.mm.yyyy");
|
||||
|
||||
|
||||
@@ -7,8 +7,9 @@
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": false,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"jsx": "react",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
@@ -18,6 +19,6 @@
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"raven-js-tests.ts"
|
||||
"react-dates-tests.tsx"
|
||||
]
|
||||
}
|
||||
}
|
||||
11
react-redux/index.d.ts
vendored
11
react-redux/index.d.ts
vendored
@@ -49,14 +49,9 @@ export interface InferableComponentDecorator {
|
||||
export declare function connect(): InferableComponentDecorator;
|
||||
|
||||
export declare function connect<TStateProps, TDispatchProps, TOwnProps>(
|
||||
mapStateToProps: FuncOrSelf<MapStateToProps<TStateProps, TOwnProps>>,
|
||||
mapDispatchToProps?: FuncOrSelf<MapDispatchToPropsFunction<TDispatchProps, TOwnProps> | MapDispatchToPropsObject>
|
||||
): ComponentDecorator<TStateProps & TDispatchProps, TOwnProps>;
|
||||
|
||||
export declare function connect<TStateProps, TDispatchProps, TOwnProps>(
|
||||
mapStateToProps: FuncOrSelf<MapStateToProps<TStateProps, TOwnProps>>,
|
||||
mapDispatchToProps: FuncOrSelf<MapDispatchToPropsFunction<TDispatchProps, TOwnProps> | MapDispatchToPropsObject>,
|
||||
mergeProps: MergeProps<TStateProps, TDispatchProps, TOwnProps>,
|
||||
mapStateToProps?: FuncOrSelf<MapStateToProps<TStateProps, TOwnProps>>,
|
||||
mapDispatchToProps?: FuncOrSelf<MapDispatchToPropsFunction<TDispatchProps, TOwnProps> | MapDispatchToPropsObject>,
|
||||
mergeProps?: MergeProps<TStateProps, TDispatchProps, TOwnProps>,
|
||||
options?: Options
|
||||
): ComponentDecorator<TStateProps & TDispatchProps, TOwnProps>;
|
||||
|
||||
|
||||
@@ -258,8 +258,9 @@ function mergeProps(stateProps: TodoState, dispatchProps: DispatchProps, ownProp
|
||||
connect(mapStateToProps2, actionCreators, mergeProps)(TodoApp);
|
||||
|
||||
|
||||
|
||||
|
||||
//https://github.com/DefinitelyTyped/DefinitelyTyped/issues/14622#issuecomment-279820358
|
||||
//Allow for undefined mapStateToProps
|
||||
connect(undefined, mapDispatchToProps6)(TodoApp);
|
||||
|
||||
interface TestProp {
|
||||
property1: number;
|
||||
|
||||
4
redux-form/index.d.ts
vendored
4
redux-form/index.d.ts
vendored
@@ -1,6 +1,6 @@
|
||||
// Type definitions for redux-form v6.3.1
|
||||
// Type definitions for redux-form v6.3.3
|
||||
// Project: https://github.com/erikras/redux-form
|
||||
// Definitions by: Carson Full <https://github.com/carsonf>, Daniel Lytkin <https://github.com/aikoven>
|
||||
// Definitions by: Carson Full <https://github.com/carsonf>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.1
|
||||
|
||||
|
||||
10
redux-form/lib/reduxForm.d.ts
vendored
10
redux-form/lib/reduxForm.d.ts
vendored
@@ -48,14 +48,14 @@ export interface Config<FormData extends DataShape, P, S> {
|
||||
asyncBlurFields?: string[];
|
||||
|
||||
/**
|
||||
* a function that takes all the form values, the dispatch function, and
|
||||
* the props given to your component, and returns a Promise that will
|
||||
* resolve if the validation is passed, or will reject with an object of
|
||||
* validation errors in the form { field1: <String>, field2: <String> }.
|
||||
* a function that takes all the form values, the dispatch function,
|
||||
* the props given to your component and the current blurred field,
|
||||
* and returns a Promise that will resolve if the validation is passed,
|
||||
* or will reject with an object of validation errors in the form { field1: <String>, field2: <String> }.
|
||||
*
|
||||
* See Asynchronous Blur Validation Example for more details.
|
||||
*/
|
||||
asyncValidate?(values: FormData, dispatch: Dispatch<S>, props: P): Promise<any>;
|
||||
asyncValidate?(values: FormData, dispatch: Dispatch<S>, props: P, blurredField: string): Promise<any>;
|
||||
|
||||
/**
|
||||
* Whether or not to automatically destroy your form's state in the Redux
|
||||
|
||||
1
request/index.d.ts
vendored
1
request/index.d.ts
vendored
@@ -145,6 +145,7 @@ declare namespace request {
|
||||
|
||||
export interface RequestResponse extends http.IncomingMessage {
|
||||
request: Options;
|
||||
body: any;
|
||||
}
|
||||
|
||||
export interface HttpArchiveRequest {
|
||||
|
||||
1
selenium-webdriver/index.d.ts
vendored
1
selenium-webdriver/index.d.ts
vendored
@@ -2,6 +2,7 @@
|
||||
// Project: https://github.com/SeleniumHQ/selenium/tree/master/javascript/node/selenium-webdriver
|
||||
// Definitions by: Bill Armstrong <https://github.com/BillArmstrong>, Yuki Kokubun <https://github.com/Kuniwak>, Craig Nishina <https://github.com/cnishina>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.1
|
||||
|
||||
import * as chrome from './chrome';
|
||||
import * as edge from './edge';
|
||||
|
||||
38
selenium-webdriver/remote.d.ts
vendored
38
selenium-webdriver/remote.d.ts
vendored
@@ -65,3 +65,41 @@ export class DriverService {
|
||||
*/
|
||||
stop(): webdriver.promise.Promise<any>;
|
||||
}
|
||||
|
||||
/**
|
||||
* A {@link webdriver.FileDetector} that may be used when running
|
||||
* against a remote
|
||||
* [Selenium server](http://selenium-release.storage.googleapis.com/index.html).
|
||||
*
|
||||
* When a file path on the local machine running this script is entered with
|
||||
* {@link webdriver.WebElement#sendKeys WebElement#sendKeys}, this file detector
|
||||
* will transfer the specified file to the Selenium server's host; the sendKeys
|
||||
* command will be updated to use the transfered file's path.
|
||||
*
|
||||
* __Note:__ This class depends on a non-standard command supported on the
|
||||
* Java Selenium server. The file detector will fail if used with a server that
|
||||
* only supports standard WebDriver commands (such as the ChromeDriver).
|
||||
*
|
||||
* @final
|
||||
*/
|
||||
export class FileDetector extends webdriver.FileDetector {
|
||||
/**
|
||||
* @constructor
|
||||
**/
|
||||
constructor();
|
||||
|
||||
/**
|
||||
* Prepares a `file` for use with the remote browser. If the provided path
|
||||
* does not reference a normal file (i.e. it does not exist or is a
|
||||
* directory), then the promise returned by this method will be resolved with
|
||||
* the original file path. Otherwise, this method will upload the file to the
|
||||
* remote server, which will return the file's path on the remote system so
|
||||
* it may be referenced in subsequent commands.
|
||||
*
|
||||
* @param {!webdriver.WebDriver} driver The driver for the current browser.
|
||||
* @param {string} file The path of the file to process.
|
||||
* @return {!webdriver.promise.Promise<string>} A promise for the processed
|
||||
* file path.
|
||||
*/
|
||||
handleFile(driver: webdriver.WebDriver, file: string): webdriver.promise.Promise<string>;
|
||||
}
|
||||
|
||||
11
selenium-webdriver/test/remote.ts
Normal file
11
selenium-webdriver/test/remote.ts
Normal file
@@ -0,0 +1,11 @@
|
||||
import * as remote from "selenium-webdriver/remote";
|
||||
import * as webdriver from "selenium-webdriver";
|
||||
|
||||
function TestRemoteFileDetector() {
|
||||
const driver: webdriver.WebDriver = new webdriver.Builder()
|
||||
.withCapabilities(webdriver.Capabilities.chrome())
|
||||
.build();
|
||||
|
||||
const fileDetector: remote.FileDetector = new remote.FileDetector();
|
||||
fileDetector.handleFile(driver, 'path/to/file').then((path: string) => { /* empty */ });
|
||||
}
|
||||
@@ -30,6 +30,7 @@
|
||||
"testing.d.ts",
|
||||
"test/index.ts",
|
||||
"test/chrome.ts",
|
||||
"test/firefox.ts"
|
||||
"test/firefox.ts",
|
||||
"test/remote.ts"
|
||||
]
|
||||
}
|
||||
35
tedious-connection-pool/index.d.ts
vendored
35
tedious-connection-pool/index.d.ts
vendored
@@ -1,14 +1,14 @@
|
||||
// Type definitions for tedious-connection-pool
|
||||
// Type definitions for tedious-connection-pool 1.0
|
||||
// Project: https://github.com/pekim/tedious-connection-pool
|
||||
// Definitions by: Cyprien Autexier <https://github.com/sandorfr>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference types="tedious" />
|
||||
/// <reference types="node" />
|
||||
|
||||
import events = require('events');
|
||||
import tedious = require('tedious');
|
||||
|
||||
declare namespace tcp {
|
||||
|
||||
/**
|
||||
* Extends Tedious Connection with release function
|
||||
*/
|
||||
@@ -20,22 +20,16 @@ declare namespace tcp {
|
||||
}
|
||||
|
||||
/**
|
||||
* Acquire function callback signature
|
||||
* Provides a connection or an error
|
||||
* @param err error if any
|
||||
* @param connection issued from the pool
|
||||
*/
|
||||
export interface ConnectionCallback {
|
||||
/**
|
||||
* Provides a connection or an error
|
||||
* @param err error if any
|
||||
* @param connection issued from the pool
|
||||
*/
|
||||
(err: Error, connection: PooledConnection): void;
|
||||
}
|
||||
export type ConnectionCallback = (err: Error, connection: PooledConnection) => void;
|
||||
|
||||
/**
|
||||
* Pool Configuration interface
|
||||
*/
|
||||
export interface PoolConfig {
|
||||
|
||||
/**
|
||||
* Minimum concurrent connections
|
||||
*/
|
||||
@@ -66,15 +60,12 @@ declare namespace tcp {
|
||||
*/
|
||||
acquireTimeout?: number;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Tedious Connection Pool Class
|
||||
*/
|
||||
declare class tcp {
|
||||
|
||||
declare class tcp extends events.EventEmitter {
|
||||
/**
|
||||
* Connection Pool constructor
|
||||
* @param poolConfig the pool configuration
|
||||
@@ -88,20 +79,10 @@ declare class tcp {
|
||||
*/
|
||||
acquire(callback: tcp.ConnectionCallback): void;
|
||||
|
||||
/**
|
||||
* listens for a specific connection pool event
|
||||
* @param event the event name
|
||||
* @param callback invoked when the event is raised
|
||||
*/
|
||||
on(event: string, callback: Function): void;
|
||||
|
||||
/**
|
||||
* closes opened connections
|
||||
*/
|
||||
drain(): void;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
export = tcp;
|
||||
|
||||
@@ -30,6 +30,12 @@ pool.on('error', (err: Error) => {
|
||||
console.error(err);
|
||||
});
|
||||
|
||||
pool.once('error', (err: Error) => {
|
||||
console.error(err);
|
||||
});
|
||||
|
||||
pool.removeAllListeners();
|
||||
|
||||
pool.acquire((err: Error, connection: ConnectionPool.PooledConnection) =>{
|
||||
console.log("hurray");
|
||||
connection.beginTransaction((error: Error): void => {}, "some name");
|
||||
|
||||
3
tedious-connection-pool/tslint.json
Normal file
3
tedious-connection-pool/tslint.json
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"extends": "../tslint.json"
|
||||
}
|
||||
16
three/index.d.ts
vendored
16
three/index.d.ts
vendored
@@ -1,6 +1,6 @@
|
||||
// Type definitions for three.js 0.83
|
||||
// Project: http://mrdoob.github.com/three.js/
|
||||
// Definitions by: Kon <http://phyzkit.net/>, Satoru Kimura <https://github.com/gyohk>, Florent Poujol <https://github.com/florentpoujol>, SereznoKot <https://github.com/SereznoKot>, HouChunlei <https://github.com/omni360>
|
||||
// Definitions by: Kon <http://phyzkit.net/>, Satoru Kimura <https://github.com/gyohk>, Florent Poujol <https://github.com/florentpoujol>, SereznoKot <https://github.com/SereznoKot>, HouChunlei <https://github.com/omni360>, Ivo <https://github.com/ivoisbelongtous>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/// <reference path="detector.d.ts" />
|
||||
@@ -6416,13 +6416,13 @@ declare namespace THREE {
|
||||
}
|
||||
|
||||
export interface TextGeometryParameters {
|
||||
font: Font;
|
||||
size: number;
|
||||
height: number;
|
||||
curveSegments: number;
|
||||
bevelEnabled: boolean;
|
||||
bevelThickness: number;
|
||||
bevelSize: number;
|
||||
font?: Font;
|
||||
size?: number;
|
||||
height?: number;
|
||||
curveSegments?: number;
|
||||
bevelEnabled?: boolean;
|
||||
bevelThickness?: number;
|
||||
bevelSize?: number;
|
||||
}
|
||||
|
||||
export class TextGeometry extends ExtrudeGeometry {
|
||||
|
||||
17
webpack/index.d.ts
vendored
17
webpack/index.d.ts
vendored
@@ -1,6 +1,6 @@
|
||||
// Type definitions for webpack 2.2
|
||||
// Project: https://github.com/webpack/webpack
|
||||
// Definitions by: Qubo <https://github.com/tkqubo>, Matt Lewis <https://github.com/mattlewis92>, Benjamin Lim <https://github.com/bumbleblym>, Boris Cherny <https://github.com/bcherny>
|
||||
// Definitions by: Qubo <https://github.com/tkqubo>, Matt Lewis <https://github.com/mattlewis92>, Benjamin Lim <https://github.com/bumbleblym>, Boris Cherny <https://github.com/bcherny>, Tommy Troy Lin <https://github.com/tommytroylin>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference types="node" />
|
||||
@@ -661,7 +661,20 @@ declare namespace webpack {
|
||||
*/
|
||||
|
||||
class BannerPlugin extends Plugin {
|
||||
constructor(banner: any, options: any);
|
||||
constructor(options: string | BannerPlugin.Options);
|
||||
}
|
||||
|
||||
namespace BannerPlugin {
|
||||
type Filter = string | RegExp;
|
||||
|
||||
interface Options {
|
||||
banner: string;
|
||||
entryOnly?: boolean;
|
||||
exclude?: Filter | Filter[];
|
||||
include?: Filter | Filter[];
|
||||
raw?: boolean;
|
||||
test?: Filter | Filter[];
|
||||
}
|
||||
}
|
||||
|
||||
class ContextReplacementPlugin extends Plugin {
|
||||
|
||||
@@ -257,7 +257,18 @@ plugin = new webpack.IgnorePlugin(requestRegExp, contextRegExp);
|
||||
|
||||
plugin = new webpack.PrefetchPlugin(context, request);
|
||||
plugin = new webpack.PrefetchPlugin(request);
|
||||
plugin = new webpack.BannerPlugin(banner, options);
|
||||
plugin = new webpack.BannerPlugin('banner');
|
||||
plugin = new webpack.BannerPlugin({
|
||||
banner: 'banner'
|
||||
});
|
||||
plugin = new webpack.BannerPlugin({
|
||||
banner: 'banner',
|
||||
entryOnly: true,
|
||||
exclude: /index/,
|
||||
include: 'test',
|
||||
raw: false,
|
||||
test: ['test', /index/]
|
||||
});
|
||||
plugin = new webpack.optimize.DedupePlugin();
|
||||
plugin = new webpack.optimize.LimitChunkCountPlugin(options);
|
||||
plugin = new webpack.optimize.MinChunkSizePlugin(options);
|
||||
|
||||
Reference in New Issue
Block a user