{
* Returns a wrapper with the direct parent of the node in the current wrapper.
*/
parent(): ReactWrapper;
+
+ /**
+ * A method that sets the props of the root component, and re-renders. Useful for when you are wanting to test
+ * how the component behaves over time with changing props. Calling this, for instance, will call the
+ * componentWillReceiveProps lifecycle method.
+ *
+ * Similar to setState, this method accepts a props object and will merge it in with the already existing props.
+ * Returns itself.
+ *
+ * NOTE: can only be called on a wrapper instance that is also the root instance.
+ * @param props
+ * @param [callback]
+ */
+ setProps(props: Pick
, callback?: () => void): this;
}
export interface ShallowRendererProps {
diff --git a/types/express-fileupload/express-fileupload-tests.ts b/types/express-fileupload/express-fileupload-tests.ts
new file mode 100644
index 0000000000..61b8c2a9cc
--- /dev/null
+++ b/types/express-fileupload/express-fileupload-tests.ts
@@ -0,0 +1,29 @@
+import * as express from 'express';
+import { RequestHandler, Request, Response, NextFunction } from 'express-serve-static-core';
+import { fileUpload, UploadedFile } from 'express-fileupload';
+
+const app: express.Express = express();
+
+app.use(fileUpload({debug: true}));
+
+function isUploadedFile(file: UploadedFile | UploadedFile[]): file is UploadedFile {
+ return typeof file === 'object' && ( file).name !== undefined;
+}
+
+const uploadHandler: RequestHandler = (req: Request, res: Response, next: NextFunction) => {
+ if (typeof req.files === 'object') {
+ const fileField = req.files.field;
+ if (isUploadedFile(fileField)) {
+ console.log(fileField.name);
+ }
+
+ const fileList = req.files.fileList;
+ if (Array.isArray(fileList)) {
+ for (const file of fileList) {
+ console.log(file.name);
+ }
+ }
+ }
+};
+
+app.post('/upload', uploadHandler);
diff --git a/types/express-fileupload/index.d.ts b/types/express-fileupload/index.d.ts
new file mode 100644
index 0000000000..33863758b4
--- /dev/null
+++ b/types/express-fileupload/index.d.ts
@@ -0,0 +1,36 @@
+// Type definitions for express-fileupload 0.1
+// Project: https://github.com/richardgirges/express-fileupload#readme
+// Definitions by: Gintautas Miselis
+// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
+// TypeScript Version: 2.3
+
+import express = require('express');
+
+declare global {
+ namespace Express {
+ interface Request {
+ files?: FileArray;
+ }
+ }
+}
+
+export class FileArray {
+ [index: string]: UploadedFile | UploadedFile[]
+}
+
+export interface UploadedFile {
+ name: string;
+ encoding: string;
+ mimetype: string;
+ data: Buffer;
+ mv(path: string, callback: (err: any) => {}): void;
+}
+
+export interface Options {
+ debug?: boolean;
+ safeFileNames?: boolean;
+ preserveExtension?: boolean | string | number;
+ [property: string]: any;
+}
+
+export function fileUpload(options?: Options): express.RequestHandler;
diff --git a/types/express-fileupload/tsconfig.json b/types/express-fileupload/tsconfig.json
new file mode 100644
index 0000000000..53c878d430
--- /dev/null
+++ b/types/express-fileupload/tsconfig.json
@@ -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",
+ "express-fileupload-tests.ts"
+ ]
+}
diff --git a/types/express-fileupload/tslint.json b/types/express-fileupload/tslint.json
new file mode 100644
index 0000000000..3db14f85ea
--- /dev/null
+++ b/types/express-fileupload/tslint.json
@@ -0,0 +1 @@
+{ "extends": "dtslint/dt.json" }
diff --git a/types/hellojs/hellojs-tests.ts b/types/hellojs/hellojs-tests.ts
index 9883c7a529..478e67fa94 100644
--- a/types/hellojs/hellojs-tests.ts
+++ b/types/hellojs/hellojs-tests.ts
@@ -1,7 +1,124 @@
+import * as hello from 'hellojs';
+// Test code copied from Azure AD B2C sample app at
+// https://github.com/Azure-Samples/active-directory-b2c-javascript-hellojs-singlepageapp/tree/cd5982f09a7bff0a72b7b4e44c4b5190b09e20fa
+hello.init({
+ serviceName: {
+ name: 'Test',
+ oauth: {
+ version: 2,
+ auth: '',
+ grant: ''
+ },
+ refresh: true,
+ scope_delim: ' ',
+ logout: () => {
+ let id_token = hello('networkName').getAuthResponse().id_token;
+ hello.utils.store('networkName', null);
+ },
+ xhr: (p) => {
+ let token = p.query.access_token;
+ delete p.query.access_token;
+ if (token) {
+ p.headers = {
+ Authorization: 'Bearer ' + token,
+ };
+ }
+
+ if (p.method === 'post' || p.method === 'put') {
+ if (typeof (p.data) === 'object') {
+ try {
+ p.data = JSON.stringify(p.data);
+ p.headers['content-type'] = 'application/json';
+ } catch (e) { }
+ }
+ } else if (p.method === 'patch') {
+ hello.utils.extend(p.query, p.data);
+ p.data = null;
+ }
+ return true;
+ },
+ form: false
+ }
+});
+
+// Test code copied from hello.js built-in modules at
+// https://github.com/MrSwitch/hello.js/blob/v1.15.1/src/modules/joinme.js
+hello.init({
+ joinme: {
+ name: 'join.me',
+ oauth: {
+ version: 2,
+ auth: '',
+ grant: ''
+ },
+ refresh: false,
+ scope: {
+ basic: 'user_info',
+ user: 'user_info',
+ scheduler: 'scheduler',
+ start: 'start_meeting',
+ email: '',
+ friends: '',
+ share: '',
+ publish: '',
+ photos: '',
+ publish_files: '',
+ files: '',
+ videos: '',
+ offline_access: ''
+ },
+ scope_delim: ' ',
+ login: (p) => {
+ p.options.popup.width = 400;
+ p.options.popup.height = 700;
+ },
+ base: 'https://api.join.me/v1/',
+ get: {
+ me: 'user',
+ meetings: 'meetings',
+ 'meetings/info': 'meetings/@{id}'
+ },
+ post: {
+ 'meetings/start/adhoc': (p, callback) => {
+ callback('meetings/start');
+ },
+ },
+ patch: {
+ 'meetings/update': (p, callback) => {
+ callback('meetings/' + p.data.meetingId);
+ }
+ },
+ del: {
+ 'meetings/delete': 'meetings/@{id}'
+ },
+ wrap: {
+ me: (o, headers) => {
+ if (!o.email) {
+ return o;
+ }
+
+ o.name = o.fullName;
+ o.first_name = o.name.split(' ')[0];
+ o.last_name = o.name.split(' ')[1];
+ o.id = o.email;
+
+ return o;
+ },
+ default: (o, headers) => {
+ return o;
+ }
+ },
+ xhr: (p, qs) => {
+ let token = qs.access_token;
+ delete qs.access_token;
+ p.headers.Authorization = 'Bearer ' + token;
+ }
+ }
+});
hello.init({
- 'facebook': '',
+ facebook: '',
}, {
redirect_uri: 'hello.html',
display: 'page',
@@ -19,30 +136,28 @@ hello('facebook').logout();
hello.on('auth.login', auth => {
alert('log to ' + auth.network);
}).on('auth.logout', auth => {
- alert('unlog from ' + auth.network);
- });
+ alert('unlog from ' + auth.network);
+});
hello.getAuthResponse('facebook');
hello.login('facebook', null, () => {
- var req = hello.getAuthResponse('facebook');
+ let req = hello.getAuthResponse('facebook');
});
hello.logout('facebook');
-var serviceInfo = hello.service('facebook');
-
-hello("facebook").api("me").success(function(json) {
+hello("facebook").api("me").then((json) => {
alert("Your name is " + json.name);
-}).error(function () {
+}, () => {
alert("Whoops!");
});
-var sessionstart = function () {
+let sessionstart = () => {
alert("Session has started");
};
hello.on("auth.login", sessionstart);
hello.off("auth.login", sessionstart);
-hello("facebook").login({ scope: "friends,photos,publish" });
\ No newline at end of file
+hello("facebook").login({ scope: "friends,photos,publish" });
diff --git a/types/hellojs/index.d.ts b/types/hellojs/index.d.ts
index ec07219cc3..16b19afb4a 100644
--- a/types/hellojs/index.d.ts
+++ b/types/hellojs/index.d.ts
@@ -1,127 +1,148 @@
-// Type definitions for hello.js 0.2
+// Type definitions for hello.js 1.15
// Project: http://adodson.com/hello.js/
// Definitions by: Pavel Zika
+// Mikko Vuorinen
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
+// TypeScript Version: 2.3
-interface HelloJSLoginOptions {
- redirect_uri?: string;
- display?: string;
- scope?: string;
- response_type?: string;
- force?: boolean;
- oauth_proxy?: string;
- timeout?: number;
- default_service?: string;
-}
-
-interface HelloJSLogoutOptions {
- force?: boolean;
-}
-
-interface HelloJSImmediateSuccessCB {
- (value: T): TP;
-}
-
-interface HelloJSImmediateErrorCB {
- (err: any): TP;
-}
-
-interface HelloJSDeferredSuccessCB {
- (value: T): HelloJSThenable;
-}
-
-interface HelloJSDeferredErrorCB {
- (error: any): HelloJSThenable;
-}
-
-interface HelloJSThenable {
- then(
- successCB?: HelloJSDeferredSuccessCB,
- errorCB?: HelloJSDeferredErrorCB
- ): HelloJSThenable;
-
- then(
- successCB?: HelloJSDeferredSuccessCB,
- errorCB?: HelloJSImmediateErrorCB
- ): HelloJSThenable;
-
- then(
- successCB?: HelloJSImmediateSuccessCB,
- errorCB?: HelloJSDeferredErrorCB
- ): HelloJSThenable;
-
- then(
- successCB?: HelloJSImmediateSuccessCB,
- errorCB?: HelloJSImmediateErrorCB
- ): HelloJSThenable;
-}
-
-interface HelloJSEvent extends HelloJSThenable {
- on(event: string, callback: (auth: HelloJSEventArgument) => void): HelloJSStatic;
- off(event: string, callback: (auth: HelloJSEventArgument) => void): HelloJSStatic;
- findEvents(event: string, callback: (name: string, index: number) => void): void;
- emit(event: string, data: any): HelloJSStatic;
- emitAfter(): HelloJSStatic;
- success(callback: (json?: any) => void): HelloJSStatic;
- error(callback: (json?: any) => void): HelloJSStatic;
- complete(callback: (json?: any) => void): HelloJSStatic;
-}
-
-
-
-interface HelloJSEventArgument {
- network: string;
- authResponse?: any;
-}
-
-
-interface HelloJSStatic extends HelloJSEvent {
- init(serviceAppIds: { [id: string]: string; }, options?: HelloJSLoginOptions): void;
- login(network: string, options?: HelloJSLoginOptions, callback?: () => void): HelloJSStatic;
- logout(network: string, options?: HelloJSLogoutOptions, callback?: () => void): HelloJSStatic;
- getAuthResponse(network: string): any;
- service(network: string): HelloJSServiceDef;
- settings: HelloJSLoginOptions;
- (network: string): HelloJSStaticNamed;
- init(servicesDef: { [id: string]: HelloJSServiceDef; }): void;
-}
-
-interface HelloJSStaticNamed {
- login(option?: HelloJSLoginOptions, callback?: () => void): void;
- logout(callback?: () => void): void;
- getAuthResponse(): any;
- api(path?: string, method?: string, data?: any, callback?: (json?: any) => void): HelloJSStatic;
-}
-
-interface HelloJSOAuthDef {
- version: number;
- auth: string;
- request: string;
- token: string;
-}
-
-interface HelloJSServiceDef {
- name: string;
- oauth: HelloJSOAuthDef;
- scope?: { [id: string]: string; };
- scope_delim?: string;
- autorefresh?: boolean;
- base?: string;
- root?: string;
- get?: { [id: string]: any; };
- post?: { [id: string]: any; };
- del?: { [id: string]: string; };
- put?: { [id: string]: any; };
- wrap?: { [id: string]: (par: any) => void; };
- xhr?: (par: any) => void;
- jsonp?: (par: any) => void;
- form?: (par: any) => void;
- api?: (...par: any[]) => void;
-}
-
-declare var hello: HelloJSStatic;
-
-// Support AMD require
-declare module 'hellojs' {
- export = hello;
+export = hello;
+
+declare const hello: hello.HelloJSStatic;
+
+declare namespace hello {
+ interface HelloJSUtils {
+ extend(r: object, ...a: any[]): any;
+ error(code: number, message: string): { code: number, message: string };
+ qs(url: string, params?: object, formatFunction?: (param: any) => string): string;
+ param(o: object, formatFunction?: (param: any) => string): string;
+ param(s: string, formatFunction?: (param: string) => any): any;
+ store(name?: string, value?: any): any;
+ append(node: string | HTMLElement, attr: object | undefined | null, target: string | HTMLElement): HTMLElement;
+ iframe(src: string, redirectUri?: string): void;
+ merge(...a: any[]): any;
+ args(o: object, args: object): any | false;
+ url(): Location;
+ url(path: string): URL | HTMLAnchorElement;
+ diff(a: any[], b: any[]): any[];
+ diffKey(a: any[], b: any[]): any[];
+ unique(a: any[]): any[];
+ isEmpty(obj: any): boolean;
+ Event: HelloJSEvent;
+ globalEvent(callback: () => void, guid?: string): string;
+ popup(url: string, redirectUri?: string, options?: object): Window | any;
+ responseHandler(window: Window, parent?: any): void;
+ }
+
+ // API utilities
+ interface HelloJSUtils {
+ request(p: object, callback: HelloJSResponseCallback): void;
+ request_cors(callback: HelloJSResponseCallback): boolean;
+ domInstance(type: string, data: any): boolean;
+ clone(obj: T): T;
+ xhr(method: string, url: string, headers: object, data: any, callback: HelloJSResponseCallback): XMLHttpRequest;
+ jsonp(url: string, callback: () => void, callbackID?: string, timeout?: number): void;
+ post(url: string, data: any, options: object, callback: HelloJSResponseCallback, callbackID?: string, timeout?: number): void;
+ hasBinary(data: any): boolean;
+ isBinary(data: any): boolean;
+ toBlob(dataURI: string): Blob | string;
+ dataToJSON(p: any): any;
+ nodeListToJSON(nodelist: NodeList): any;
+ }
+
+ type HelloJSResponseCallback = (r: any, headers: any) => void;
+
+ type HelloJSTokenResponseType = "token" | "code";
+
+ interface HelloJSLoginOptions {
+ redirect_uri?: string;
+ display?: string;
+ scope?: string;
+ response_type?: HelloJSTokenResponseType;
+ force?: boolean | null;
+ oauth_proxy?: string;
+ timeout?: number;
+ default_service?: string;
+ popup?: HelloJSPopupOptions;
+ state?: string;
+ }
+
+ interface HelloJSLogoutOptions {
+ force?: boolean;
+ }
+
+ interface HelloJSPopupOptions {
+ resizable: number;
+ scrollbars: number;
+ width: number;
+ height: number;
+ }
+
+ interface HelloJSEvent {
+ on(event: string, callback: (auth: HelloJSEventArgument) => void): HelloJSStatic;
+ off(event: string, callback: (auth: HelloJSEventArgument) => void): HelloJSStatic;
+ findEvents(event: string, callback: (name: string, index: number) => void): void;
+ emit(event: string, data: any): HelloJSStatic;
+ emitAfter(): HelloJSStatic;
+ }
+
+ interface HelloJSEventArgument {
+ network: string;
+ authResponse?: any;
+ }
+
+ interface HelloJSStatic extends HelloJSEvent {
+ init(serviceAppIds: { [id: string]: string; }, options?: HelloJSLoginOptions): void;
+ init(servicesDef: { [id: string]: HelloJSServiceDef; }): void;
+ login(callback: () => void): PromiseLike;
+ login(options?: HelloJSLoginOptions, callback?: () => void): PromiseLike;
+ login(network?: string, options?: HelloJSLoginOptions, callback?: () => void): PromiseLike;
+ logout(callback?: () => void): PromiseLike;
+ logout(options?: HelloJSLogoutOptions, callback?: () => void): PromiseLike;
+ logout(network?: string, options?: HelloJSLogoutOptions, callback?: () => void): PromiseLike;
+ getAuthResponse(network?: string): any;
+ settings: HelloJSLoginOptions;
+ (network: string): HelloJSStatic;
+ utils: HelloJSUtils;
+ api(options: object): PromiseLike;
+ api(path?: string, method?: string, data?: object, callback?: (json: any) => void): PromiseLike;
+ api(path?: string, query?: object, method?: string, data?: object, timeout?: number, callback?: (json: any) => void): PromiseLike;
+ }
+
+ interface HelloJSOAuthDef {
+ version: string | number;
+ auth?: string;
+ }
+
+ interface HelloJSOAuth2Def extends HelloJSOAuthDef {
+ grant?: string;
+ response_type?: HelloJSTokenResponseType;
+ }
+
+ interface HelloJSOAuth1Def extends HelloJSOAuthDef {
+ request?: string;
+ token?: string;
+ }
+
+ type HelloJSUrlMappingFunction = (p: any, callback: (url: string) => void) => void;
+
+ interface HelloJSServiceDef {
+ name?: string;
+ oauth: HelloJSOAuth2Def | HelloJSOAuth1Def;
+ scope?: { [id: string]: string; };
+ scope_delim?: string;
+ refresh?: boolean;
+ base?: string;
+ root?: string;
+ get?: { [id: string]: string | HelloJSUrlMappingFunction };
+ post?: { [id: string]: string | HelloJSUrlMappingFunction };
+ del?: { [id: string]: string | HelloJSUrlMappingFunction };
+ put?: { [id: string]: string | HelloJSUrlMappingFunction };
+ patch?: { [id: string]: string | HelloJSUrlMappingFunction };
+ wrap?: { [id: string]: (r: any, headers: any, p: any) => void; };
+ xhr?(p: any, query: any): void;
+ jsonp?: ((p: any, query: any) => void) | boolean;
+ form?: ((p: any, query: any) => void) | boolean;
+ login?(p: any): void;
+ logout?: ((callback: () => void | string) => void) | string;
+ }
}
diff --git a/types/hellojs/tslint.json b/types/hellojs/tslint.json
new file mode 100644
index 0000000000..2750cc0197
--- /dev/null
+++ b/types/hellojs/tslint.json
@@ -0,0 +1 @@
+{ "extends": "dtslint/dt.json" }
\ No newline at end of file
diff --git a/types/hls.js/hls.js-tests.ts b/types/hls.js/hls.js-tests.ts
index 9af972ebcc..daab1f23f2 100644
--- a/types/hls.js/hls.js-tests.ts
+++ b/types/hls.js/hls.js-tests.ts
@@ -1,33 +1,69 @@
import * as Hls from 'hls.js';
function process(playlist: string) {
- return playlist;
+ return playlist;
}
class pLoader extends Hls.DefaultConfig.loader {
- constructor(config: Hls.LoaderConfig) {
- super(config);
- const load = this.load.bind(this);
- this.load = (context: Hls.LoaderContext, cfg: Hls.LoaderConfig, callbacks: Hls.LoaderCallbacks) => {
- if (context.type === 'manifest') {
- const onSuccess = callbacks.onSuccess;
- callbacks.onSuccess = (response: Hls.LoaderResponse, stats: Hls.LoaderStats, context: Hls.LoaderContext) => {
- response.data = process(response.data as string);
- onSuccess(response, stats, context);
+ constructor(config: Hls.LoaderConfig) {
+ super(config);
+ const load = this.load.bind(this);
+ this.load = (context: Hls.LoaderContext, cfg: Hls.LoaderConfig, callbacks: Hls.LoaderCallbacks) => {
+ if (context.type === 'manifest') {
+ const onSuccess = callbacks.onSuccess;
+ callbacks.onSuccess = (response: Hls.LoaderResponse, stats: Hls.LoaderStats, context: Hls.LoaderContext) => {
+ response.data = process(response.data as string);
+ onSuccess(response, stats, context);
+ };
+ }
+ load(context, config, callbacks);
};
- }
- load(context, config, callbacks);
- };
- }
+ }
}
if (Hls.isSupported()) {
- const video = document.getElementById('video');
- const hls = new Hls({ pLoader });
- const version: string = Hls.version;
- hls.loadSource('http://www.streambox.fr/playlists/test_001/stream.m3u8');
- hls.attachMedia(video);
- hls.on(Hls.Events.MANIFEST_PARSED, () => {
- video.play();
- });
+ const video = document.getElementById('video');
+ const hls = new Hls({ pLoader });
+ const version: string = Hls.version;
+ hls.loadSource('http://www.streambox.fr/playlists/test_001/stream.m3u8');
+ hls.attachMedia(video);
+
+ hls.on(Hls.Events.MANIFEST_PARSED, () => {
+ video.play();
+ });
+
+ hls.on(Hls.Events.FRAG_LOAD_ERMERGENCY_ABORTED, (event: string, data: Hls.Data) => {
+ console.log('frag: ', data.frag);
+ });
+
+ hls.on(Hls.Events.ERROR, (event: string, data: Hls.Data) => {
+ const errorType = data.type;
+ const errorDetails = data.details;
+ const errorFatal = data.fatal;
+
+ if (errorDetails) {
+ switch (errorDetails) {
+ case Hls.ErrorDetails.FRAG_LOAD_ERROR:
+ break;
+ default:
+ break;
+ }
+ }
+
+ if (errorFatal) {
+ switch (data.type) {
+ case Hls.ErrorTypes.NETWORK_ERROR:
+ console.log('fatal network error encoutered, try to recover');
+ hls.startLoad();
+ break;
+ case Hls.ErrorTypes.MEDIA_ERROR:
+ console.log('fatal media error encourted, try to recover');
+ hls.recoverMediaError();
+ break;
+ default:
+ hls.destroy();
+ break;
+ }
+ }
+ });
}
diff --git a/types/hls.js/index.d.ts b/types/hls.js/index.d.ts
index e80eecae3f..d8b34e5969 100644
--- a/types/hls.js/index.d.ts
+++ b/types/hls.js/index.d.ts
@@ -55,6 +55,11 @@ declare namespace Hls {
* data: { tracks : { container, codec, levelCodec, initSegment, metadata } }
*/
const BUFFER_CODECS: string;
+ /**
+ * fired when sourcebuffers have been created
+ * data: { tracks: tracks }
+ */
+ const BUFFER_CREATED: string;
/**
* fired when we append a segment to the buffer
* data: { segment: segment object }
@@ -205,6 +210,11 @@ declare namespace Hls {
* data: { frag : fragment object with frag.loaded=stats.loaded, stats : { trequest, tfirst, loaded, total } }
*/
const FRAG_LOAD_PROGRESS: string;
+ /**
+ * identifier for fragment load aborting for emergency switch down
+ * data: { frag: fragment object }
+ */
+ const FRAG_LOAD_ERMERGENCY_ABORTED: string;
/**
* fired when a fragment loading is completed
* data: { frag : fragment object, payload : fragment payload, stats : { trequest, tfirst, tload, length}}
@@ -275,12 +285,18 @@ declare namespace Hls {
* data: { }
*/
const DESTROYING: string;
+ /**
+ * fired upon stream controller state transitions
+ * data: { previousState, nextState }
+ */
+ const STREAM_STATE_TRANSITION: string;
}
/**
* Hls error details
*/
namespace ErrorDetails {
+ // NETWORK_ERRORS //
/**
* raised when manifest loading fails because of a network error
* data: { type : NETWORK_ERROR, details : Hls.ErrorDetails.MANIFEST_LOAD_ERROR, fatal : true, url : manifest URL, response : { code: error code, text: error text }, loader : URL loader }
@@ -307,35 +323,57 @@ declare namespace Hls {
*/
const LEVEL_LOAD_TIMEOUT: string;
/**
- * raised when level switching fails
- * data: { type : OTHER_ERROR, details : Hls.ErrorDetails.LEVEL_SWITCH_ERROR, fatal : false, level : failed level index, reason : failure reason }
+ * raised when audio track loading fails because of a network error
+ * data: { type: NETWORK_ERROR, details: Hls.ErrorDetails.AUDIO_TRACK_LOAD_ERROR, fatal: false, url: audio URL, loader: URL loader }
*/
- const LEVEL_SWITCH_ERROR: string;
+ const AUDIO_TRACK_LOAD_ERROR: string;
+ /**
+ * raised when audio track loading fails because of a timeout
+ * data: { type: NETWORK_ERROR, details: Hls.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT, fatal: false, url: audio URL, response: { code: error code, text: error text }, loader: URL loader }
+ */
+ const AUDIO_TRACK_LOAD_TIMEOUT: string;
/**
* raised when fragment loading fails because of a network error
* data: { type : NETWORK_ERROR, details : Hls.ErrorDetails.FRAG_LOAD_ERROR, fatal : true or false, frag : fragment object, response : { code: error code, text: error text } }
*/
const FRAG_LOAD_ERROR: string;
- /**
- * raised upon detection of same fragment being requested in loop
- * data: { type : NETWORK_ERROR, details : Hls.ErrorDetails.FRAG_LOOP_LOADING_ERROR, fatal : true or false, frag : fragment object }
- */
- const FRAG_LOOP_LOADING_ERROR: string;
/**
* raised when fragment loading fails because of a timeout
* data: { type : NETWORK_ERROR, details : Hls.ErrorDetails.FRAG_LOAD_TIMEOUT, fatal : true or false, frag : fragment object }
*/
const FRAG_LOAD_TIMEOUT: string;
/**
- * raised when fragment parsing fails
- * data: { type : NETWORK_ERROR, details : Hls.ErrorDetails.FRAG_PARSING_ERROR, fatal : true or false, reason : failure reason }
+ * raised when decrypt key loading fails because of a network error
+ * data: { type: NETWORK_ERROR, details: Hls.ErrorDetails.KEY_LOAD_ERROR, fatal: false, frag: fragment object }
*/
- const FRAG_PARSING_ERROR: string;
+ const KEY_LOAD_ERROR: string;
+ /**
+ * raised when decrypt key loading fails because of timeout
+ * data: { type: NETWORK_EROR, details: Hls.ErrorDetails.KEY_LOAD_TIMEOUT, fatal: true, frag: fragment object }
+ */
+ const KEY_LOAD_TIMEOUT: string;
+
+ // MEDIA_ERRORS //
/**
* raised when manifest only contains quality level with codecs incompatible with MediaSource Engine.
* data: { type : MEDIA_ERROR, details : Hls.ErrorDetails.MANIFEST_INCOMPATIBLE_CODECS_ERROR, fatal : true, url : manifest URL }
*/
const MANIFEST_INCOMPATIBLE_CODECS_ERROR: string;
+ /**
+ * raised upon detection of same fragment being requested in loop
+ * data: { type : NETWORK_ERROR, details : Hls.ErrorDetails.FRAG_LOOP_LOADING_ERROR, fatal : true or false, frag : fragment object }
+ */
+ const FRAG_LOOP_LOADING_ERROR: string;
+ /**
+ * raised when fragment decryption fails
+ * data: { type: MEDIA_ERROR, details: Hls.ErrorDetails.FRAG_DECRYPT_ERROR, fatal: true, reason: failure reason }
+ */
+ const FRAG_DECRYPT_ERROR: string;
+ /**
+ * raised when fragment parsing fails
+ * data: { type : NETWORK_ERROR, details : Hls.ErrorDetails.FRAG_PARSING_ERROR, fatal : true or false, reason : failure reason }
+ */
+ const FRAG_PARSING_ERROR: string;
/**
* raised when MediaSource fails to add new sourceBuffer
* data: { type : MEDIA_ERROR, details : Hls.ErrorDetails.BUFFER_ADD_CODEC_ERROR, fatal : false, err : error raised by MediaSource, mimeType: mimeType on which the failure happened }
@@ -367,6 +405,30 @@ declare namespace Hls {
* data: { type : MEDIA_ERROR, details : Hls.ErrorDetails.BUFFER_SEEK_OVER_HOLE, fatal : false, hole : hole duration }
*/
const BUFFER_SEEK_OVER_HOLE: string;
+ /**
+ * raised when playback is stuck although currentTime is in a buffered aread
+ * data: { type: MEDIA_ERROR, details: Hls.ErrorDetails.BUFFERED_STALLED_ERROR, fatal: true }
+ */
+ const BUFFER_NUDGE_ON_STALL: string;
+
+ // MUX_ERROR //
+ /**
+ * raised when memory allocation fails during remuxing
+ * data: { type: MUX_ERROR, details: Hls.ErrorDetails.REMUX_ALLOC_ERROR, fatal: false, bytes: mdat size, reason: failure reason }
+ */
+ const REMUX_ALLOC_ERROR: string;
+
+ // OTHER_ERROR //
+ /**
+ * raised when level switching fails
+ * data: { type : OTHER_ERROR, details : Hls.ErrorDetails.LEVEL_SWITCH_ERROR, fatal : false, level : failed level index, reason : failure reason }
+ */
+ const LEVEL_SWITCH_ERROR: string;
+ /**
+ * raised when an exception occurs in an internal hls.js event handler
+ * data: { type: OTHER_ERROR, details: Hls.ErrorDetails.INTERNAL_EXCEPTION, fatal: true or false, event: event object or string, error: { message: error message } }
+ */
+ const INTERNAL_EXCEPTION: string;
}
/**
@@ -381,6 +443,10 @@ declare namespace Hls {
* media/video related errors
*/
const MEDIA_ERROR: string;
+ /**
+ * muxing related errors
+ */
+ const MUX_ERROR: string;
/**
* all other erros
*/
@@ -1364,9 +1430,9 @@ declare namespace Hls {
*/
levelId?: number;
/**
- * levelDetails object
+ * ErrorDetails type
*/
- details?: LevelDetails;
+ details?: string;
/**
* PTS drift observed when parsing last fragment
*/
@@ -1659,24 +1725,24 @@ declare class Hls {
*
* set to -1 for automatic level selection
*/
- nextLevel: Hls.Level;
+ nextLevel: number;
/**
* get: return last loaded fragment quality level
* set: quality level for next loaded fragment
* set to -1 for automatic level selection
*/
- loadLevel: Hls.Level;
+ loadLevel: number;
/**
* get: return quality level that will be used to load next fragment
* set: force quality level for next loaded fragment
* quality level will be forced only for that fragment
* after a fragment at this quality level has been loaded, hls.loadLevel will prevail
*/
- nextLoadLevel: Hls.Level;
+ nextLoadLevel: number;
/**
* first level index (index of first level appearing in Manifest. it is usually defined as start level hint for player)
*/
- firstLevel: Hls.Level;
+ firstLevel: number;
/**
* array of audio tracks exposed in manifest
*/
diff --git a/types/joi/index.d.ts b/types/joi/index.d.ts
index fb3547b3e4..0772c82fbe 100644
--- a/types/joi/index.d.ts
+++ b/types/joi/index.d.ts
@@ -2,11 +2,11 @@
// Project: https://github.com/hapijs/joi
// Definitions by: Bart van der Schoor , Laurence Dougal Myers , Christopher Glantschnig , David Broder-Rodgers , Gael Magnan de Bornier , Rytis Alekna , Pavel Ivanov
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
+// TypeScript Version: 2.4
// TODO express type of Schema in a type-parameter (.default, .valid, .example etc)
-
export interface ValidationOptions {
/**
* when true, stops validation on the first error, otherwise returns all the errors found. Defaults to true.
@@ -337,6 +337,25 @@ export interface AnySchema> {
* option has been set to `false`).
*/
error?(err: Error | ValidationErrorFunction): T;
+
+ /**
+ * Creates a joi error object.
+ * Used in conjunction with custom rules.
+ * @param ruleName - the rule name to create the error for.
+ * @param context - must contain `v` eg. the value that was validated, all other properties
+ * are available in the `language` templates.
+ * @param state - should the context passed into the `validate` function in a
+ * custom rule
+ * @param options - should the context passed into the `validate` function in a
+ * custom rule
+ */
+ createError(ruleName: string, context: {
+ v: any;
+ [key: string]: any;
+ }, state: State, options: ValidationOptions): Err;
+}
+
+export interface State {
}
export interface BooleanSchema extends AnySchema {
@@ -825,20 +844,26 @@ export interface Terms {
export interface Rules {
name: string;
params?: ObjectSchema | { [key: string]: Schema };
- setup?: Function;
- validate?: Function;
+ setup?: (this: AnySchema>, description: { [key: string]: any }) => AnySchema> | void;
+ validate?: (this: AnySchema>, params: { [key: string]: any }, value: any, state: State, options: ValidationOptions) => Err | undefined;
description?: string | Function;
}
export interface Extension {
name: string;
base?: Schema;
- pre?: Function;
- language?: {};
- describe?: Function;
+ pre?: (this: AnySchema>, params: { [key: string]: any }, value: any, state: State, options: ValidationOptions) => Err | void;
+ language?: {
+ [key: string]: string;
+ },
+ describe?: (this: AnySchema>, description: any) => any;
rules?: Rules[];
}
+export interface Err {
+ toString(): string;
+}
+
// --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---
/**
diff --git a/types/joi/joi-tests.ts b/types/joi/joi-tests.ts
index a0684724b7..fb0537f6f9 100644
--- a/types/joi/joi-tests.ts
+++ b/types/joi/joi-tests.ts
@@ -886,6 +886,35 @@ schema = Joi.reach(schema, '');
const Joi2 = Joi.extend({ name: '', base: schema });
+const Joi3 = Joi.extend({
+ base: Joi.string(),
+ name: 'string',
+ language: {
+ asd: 'must be exactly asd(f)',
+ },
+ pre (value, state, options) {
+ },
+ describe (description) {
+ },
+ rules: [
+ {
+ name: 'asd',
+ params: {
+ allowF: Joi.boolean().default(false),
+ },
+ setup (params) {
+ const fIsAllowed = params.allowF;
+ },
+ validate (params, value, state, options) {
+ if (value === 'asd' || params.allowF && value === 'asdf') {
+ return value;
+ }
+ return this.createError('asd', { v: value }, state, options);
+ },
+ },
+ ],
+});
+
// --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---
schema = Joi.allow(x, x);
diff --git a/types/materialize-css/index.d.ts b/types/materialize-css/index.d.ts
index 18a5ac1feb..1cb283e2d7 100644
--- a/types/materialize-css/index.d.ts
+++ b/types/materialize-css/index.d.ts
@@ -1,6 +1,8 @@
-// Type definitions for materialize-css v0.98.0
+// Type definitions for materialize-css v0.100.1
// Project: http://materializecss.com/
-// Definitions by: Erik Lieben , Leon Yu , Sukhdeep Singh
+// Definitions by: Erik Lieben
+// Leon Yu
+// Sukhdeep Singh
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
@@ -9,588 +11,687 @@
declare namespace Materialize {
- /**
- * The collapsible options
- */
- interface CollapsibleOptions {
- /**
- * A setting that changes the collapsible behavior to expandable instead of the default accordion style
- */
- accordion?: boolean;
+ /**
+ * The collapsible options
+ */
+ interface CollapsibleOptions {
+ /**
+ * A setting that changes the collapsible behavior to expandable instead of the default accordion style
+ */
+ accordion?: boolean;
- /**
- * Callback for Collapsible section close.
- * Default: function() { alert('Closed'); }
- */
- onClose?: Function;
+ /**
+ * Callback for Collapsible section close.
+ * @default `function() { alert('Closed'); }`
+ */
+ onClose?: Function;
- /**
- * Callback for Collapsible section open.
- * Default: function() { alert('Opened'); }
- */
- onOpen?: Function;
- }
+ /**
+ * Callback for Collapsible section open.
+ * @default `function() { alert('Opened'); }`
+ */
+ onOpen?: Function;
+ }
- interface TooltipOptions {
- /**
- * The delay before the tooltip shows (in milliseconds)
- */
- delay: number;
- /**
- * Tooltip text. Can use custom HTML if you set the html option
- */
- tooltip?: string;
- /**
- * Set the direction of the tooltip. 'top', 'right', 'bottom', 'left'.
- *
- * (Default: 'bottom')
- */
- position?: string;
- /**
- * Allow custom html inside the tooltip.
- *
- * (Default: false)
- */
- html?: boolean;
- }
+ interface TooltipOptions {
+ /**
+ * The delay before the tooltip shows (in milliseconds)
+ */
+ delay: number;
+ /**
+ * Tooltip text. Can use custom HTML if you set the html option
+ */
+ tooltip?: string;
+ /**
+ * Set the direction of the tooltip. 'top', 'right', 'bottom', 'left'.
+ *
+ * @default `'bottom'`
+ */
+ position?: string;
+ /**
+ * Allow custom html inside the tooltip.
+ *
+ * @default `false`
+ */
+ html?: boolean;
+ }
- /**
- * The dropdown options
- */
- interface DropDownOptions {
+ /**
+ * The dropdown options
+ */
+ interface DropDownOptions {
- /**
- * The duration of the transition enter in milliseconds.
- * Default: 300
- */
- inDuration?: number;
+ /**
+ * The duration of the transition enter in milliseconds.
+ * @default `300`
+ */
+ inDuration?: number;
- /**
- * The duration of the transition out in milliseconds.
- * Default: 225
- */
- outDuration?: number;
+ /**
+ * The duration of the transition out in milliseconds.
+ * @default `225`
+ */
+ outDuration?: number;
- /**
- * If true, constrainWidth to the size of the dropdown activator.
- * Default: true
- */
- constrainWidth?: boolean;
- /**
- * If true, the dropdown will open on hover.
- * Default: false
- */
- hover?: boolean;
+ /**
+ * If true, constrainWidth to the size of the dropdown activator.
+ * @default `true`
+ */
+ constrainWidth?: boolean;
+ /**
+ * If true, the dropdown will open on hover.
+ * @default `false`
+ */
+ hover?: boolean;
- /**
- * This defines the spacing from the aligned edge.
- * Default: 0
- */
- gutter?: number;
+ /**
+ * This defines the spacing from the aligned edge.
+ * @default `0`
+ */
+ gutter?: number;
- /**
- * If true, the dropdown will show below the activator.
- * Default: false
- */
- belowOrigin?: boolean;
+ /**
+ * If true, the dropdown will show below the activator.
+ * @default `false`
+ */
+ belowOrigin?: boolean;
- /**
- * Defines the edge the menu is aligned to.
- * Default: 'left'
- */
- alignment?: string;
- /**
- * If true, stops the event propagating from the dropdown origin click handler.
- *
- * Default: false
- */
- stopPropagation?: boolean
- }
+ /**
+ * Defines the edge the menu is aligned to.
+ * @default `'left'`
+ */
+ alignment?: string;
+ /**
+ * If true, stops the event propagating from the dropdown origin click handler.
+ *
+ * @default `false`
+ */
+ stopPropagation?: boolean
+ }
- /**
- * The slider options
- */
- interface SliderOptions {
+ /**
+ * The slider options
+ */
+ interface SliderOptions {
- /**
- * Set to false to hide slide indicators.
- * Default: true
- */
- indicators?: boolean;
+ /**
+ * Set to false to hide slide indicators.
+ * @default `true`
+ */
+ indicators?: boolean;
- /**
- * Set height of slider.
- * Default: 400
- */
- height?: number;
+ /**
+ * Set height of slider.
+ * @default `400`
+ */
+ height?: number;
- /**
- * Set the duration of the transition animation in ms.
- * Default: 500
- */
- transition?: number;
+ /**
+ * Set the duration of the transition animation in ms.
+ * @default `500`
+ */
+ transition?: number;
- /**
- * Set the duration between transitions in ms.
- * Default: 6000
- */
- interval?: number;
- }
+ /**
+ * Set the duration between transitions in ms.
+ * @default `6000`
+ */
+ interval?: number;
+ }
- /**
- * The carousel options
- */
- interface CarouselOptions {
- /**
- * Transition duration in milliseconds
- * Default: 200
- */
- duration?: number;
+ /**
+ * The carousel options
+ */
+ interface CarouselOptions {
+ /**
+ * Transition duration in milliseconds
+ * @default `200`
+ */
+ duration?: number;
- /**
- * Perspective zoom. If 0, all items are the same size.
- * Default: -100
- */
- dist?: number;
+ /**
+ * Perspective zoom. If 0, all items are the same size.
+ * @default `-100`
+ */
+ dist?: number;
- /**
- * Set the duration of the transition animation in ms.
- * Default: 500
- */
- shift?: number;
+ /**
+ * Set the duration of the transition animation in ms.
+ * @default `500`
+ */
+ shift?: number;
- /**
- * Set the duration between transitions in ms.
- * Default: 6000
- */
- padding?: number;
+ /**
+ * Set the duration between transitions in ms.
+ * @default `6000`
+ */
+ padding?: number;
- /**
- * Set the width of the carousel.
- * Default: false
- */
- fullWidth?: boolean;
- /**
- * Set to true to show indicators.
- *
- * Default: false
- */
- indicators?: boolean;
- /**
- * Don't wrap around and cycle through items.
- *
- * Default: false
- */
- noWrap?: boolean;
- }
+ /**
+ * Set the width of the carousel.
+ * @default `false`
+ */
+ fullWidth?: boolean;
+ /**
+ * Set to true to show indicators.
+ *
+ * @default `false`
+ */
+ indicators?: boolean;
+ /**
+ * Don't wrap around and cycle through items.
+ *
+ * @default `false`
+ */
+ noWrap?: boolean;
+ }
- /**
- * The modal options
- */
- interface ModalOptions {
+ /**
+ * The modal options
+ */
+ interface ModalOptions {
- /**
- * Modal can be dismissed by clicking outside of the modal.
- * Default: true
- */
- dismissible?: boolean;
+ /**
+ * Modal can be dismissed by clicking outside of the modal.
+ * @default `true`
+ */
+ dismissible?: boolean;
- /**
- * Opacity of modal background.
- * Default. .5
- */
- opacity?: number;
+ /**
+ * Opacity of modal background.
+ * @default `.5`
+ */
+ opacity?: number;
- /**
- * Transition in duration.
- * Default: 300
- */
- inDuration?: number;
+ /**
+ * Transition in duration.
+ * @default `300`
+ */
+ inDuration?: number;
- /**
- * Transition out duration.
- * Default: 200
- */
- outDuration?: number;
- /**
- * Starting top style attribute
- * Default: `4%`
- */
- startingTop?: string;
- /**
- * Ending top style attribute
- * Default : `10%`
- */
- endingTop?: string;
+ /**
+ * Transition out duration.
+ * @default `200`
+ */
+ outDuration?: number;
+ /**
+ * Starting top style attribute
+ * @default `4%`
+ */
+ startingTop?: string;
+ /**
+ * Ending top style attribute
+ * @default `10%`
+ */
+ endingTop?: string;
- /**
- * Callback for Modal open.
- * Default: function() { alert('Ready'); }
- */
- ready?: Function;
+ /**
+ * Callback for Modal open.
+ * @default `function() { alert('Ready'); }`
+ */
+ ready?: Function;
- /**
- * Callback for Modal close.
- * Default: function() { alert('Closed'); }
- */
- complete?: Function;
- }
+ /**
+ * Callback for Modal close.
+ * @default `function() { alert('Closed'); }`
+ */
+ complete?: Function;
+ }
- /**
- * The push pin options
- */
- interface PushpinOptions {
+ /**
+ * The push pin options
+ */
+ interface PushpinOptions {
- /**
- * The distance in pixels from the top of the page where the element becomes fixed.
- * Default: 0
- */
- top?: number;
+ /**
+ * The distance in pixels from the top of the page where the element becomes fixed.
+ * @default `0`
+ */
+ top?: number;
- /**
- * The distance in pixels from the top of the page where the elements stops being fixed.
- * Default: Infinity
- */
- bottom?: number;
+ /**
+ * The distance in pixels from the top of the page where the elements stops being fixed.
+ * @default `Infinity`
+ */
+ bottom?: number;
- /**
- * The offset from the top the element will be fixed at.
- * Default: 0
- */
- offset?: number;
- }
+ /**
+ * The offset from the top the element will be fixed at.
+ * @default `0`
+ */
+ offset?: number;
+ }
- /**
- * The scroll spy options
- */
- interface ScrollSpyOptions {
- /**
- * Offset from top.
- * Default: 200
- */
- scrollOffset?: number;
- }
+ /**
+ * The scroll spy options
+ */
+ interface ScrollSpyOptions {
+ /**
+ * Offset from top.
+ * @default `200`
+ */
+ scrollOffset?: number;
+ /**
+ * Class name to be added to the active link.
+ * @default `active`
+ */
+ activeClass?: string;
+ /**
+ * Function that returns a selector to add activeClass to. The parameter is the section id
+ */
+ getActiveElement?: Function;
+ }
- /**
- * The slideNav options
- */
- interface SideNavOptions {
- /**
- * Default: 240
- */
- menuWidth?: number;
+ /**
+ * The slideNav options
+ */
+ interface SideNavOptions {
+ /**
+ * @default `240`
+ */
+ menuWidth?: number;
- /**
- * The horizontal origin
- * Default: ' left'
- */
- edge?: string;
+ /**
+ * The horizontal origin
+ * @default `'left'`
+ */
+ edge?: string;
- /**
- * Closes side-nav on clicks, useful for Angular/Meteor
- * Default: false
- */
- closeOnClick?: boolean;
+ /**
+ * Closes side-nav on clicks, useful for Angular/Meteor
+ * @default `false`
+ */
+ closeOnClick?: boolean;
- /**
- * Choose whether you can drag to open on touch screens
- * Default: true
- */
- draggable?: boolean;
- }
+ /**
+ * Choose whether you can drag to open on touch screens
+ * @default `true`
+ */
+ draggable?: boolean;
+ }
- interface ScrollFireOptions {
+ interface ScrollFireOptions {
- /**
- * The selector for the element that is being tracked.
- */
- selector?: string;
+ /**
+ * The selector for the element that is being tracked.
+ */
+ selector?: string;
- /**
- * Offset to use when activating the scroll fire event
- * If this is 0, the callback will be fired when the selector element is at the very bottom of the user's window.
- */
- offset?: number;
+ /**
+ * Offset to use when activating the scroll fire event
+ * If this is 0, the callback will be fired when the selector element is at the very bottom of the user's window.
+ */
+ offset?: number;
- /**
- * The string function call that you want to make when the user scrolls to the threshold.
- * It will only be called once.
- * Example: 'console.log("hello, world!")';
- * or callback: () => { console.log('hello world'); }
- */
- callback?: string | (() => void);
- }
+ /**
+ * The string function call that you want to make when the user scrolls to the threshold.
+ * It will only be called once.
+ * Example: 'console.log("hello, world!")';
+ * or callback: () => { console.log('hello world'); }
+ */
+ callback?: string | (() => void);
+ }
- interface TabOptions {
- /**
- * Execute a callback function when the tab is changed.
- *
- * The callback provides a parameter which refers to the current tab being shown.
- */
- onShow?: Function;
+ interface TabOptions {
+ /**
+ * Execute a callback function when the tab is changed.
+ *
+ * The callback provides a parameter which refers to the current tab being shown.
+ */
+ onShow?: Function;
- /**
- * Set to true to enable swipeable tabs. This also uses the responsiveThreshold option.
- *
- * Default: false
- */
- swipeable?: boolean;
+ /**
+ * Set to true to enable swipeable tabs. This also uses the responsiveThreshold option.
+ *
+ * @default `false`
+ */
+ swipeable?: boolean;
- /**
- * The maximum width of the screen, in pixels, where the swipeable functionality initializes.
- *
- * Default: Infinity
- */
- responsiveThreshold?: number;
- }
+ /**
+ * The maximum width of the screen, in pixels, where the swipeable functionality initializes.
+ *
+ * @default `Infinity`
+ */
+ responsiveThreshold?: number;
+ }
- interface ChipDataObject {
- tag: string,
- image?: string,
- id?: number
- }
+ interface ChipDataObject {
+ tag: string,
+ image?: string,
+ id?: number
+ }
- interface ChipOptions {
- /**
- * Set the chip data
- */
- data?: Materialize.ChipDataObject[];
- /**
- * Set first placeholder when there are no tags
- */
- placeholder?: string;
- /**
- * Set second placeholder when adding additional tags.
- */
- secondaryPlaceholder?: string;
- /**
- * Set autocomplete data.
- */
- autocompleteData?: any;
- /**
- * Set autocomplete limit.
- */
- autocompleteLimit?: number;
- }
+ interface ChipOptions {
+ /**
+ * Set the chip data
+ */
+ data?: Materialize.ChipDataObject[];
+ /**
+ * Set first placeholder when there are no tags
+ */
+ placeholder?: string;
+ /**
+ * Set second placeholder when adding additional tags.
+ */
+ secondaryPlaceholder?: string;
+ /**
+ * Set autocomplete data.
+ */
+ autocompleteData?: any;
+ /**
+ * Set autocomplete limit.
+ */
+ autocompleteLimit?: number;
+ /**
+ * Set autocompleteOptions
+ */
+ autocompleteOptions?: Materialize.AutoCompleteOptions;
+ }
+ interface AutoCompleteOptions {
+ /**
+ * The JSON object data to be used for the autocomplete suggetions list
+ */
+ data: object;
+ /**
+ * The max amount of results that can be shown at once.
+ * @default `Infinity`
+ */
+ limit?: number;
+ /**
+ * Callback function when value is autcompleted.
+ */
+ onAutocomplete?: (val: any) => void;
+ /**
+ * The minimum length of the input for the autocomplete to start.
+ * @default `1`
+ */
+ minLength?: number;
- /**
- * The Materialize object
- */
- interface Materialize {
+ }
- /**
- * Displays a toast message on screen
- *
- * @name message The message to display on screen
- * @name displayLength The duration in milliseconds to display the message on screen
- * @name className The className to use to format the message to display
- * @name completeCallback Callback function to call when the messages completes/hides.
- */
- toast(message: string | JQuery, displayLength: number, className?: string, completeCallback?: Function): void;
+ interface Toast {
+ /**
+ * Dismiss all toasts
+ */
+ removeAll: Function;
+ }
- /**
- * Fires an event when the page is scrolled to a certain area
- *
- * @name options optional parameter with scroll fire options
- */
- scrollFire(options?: ScrollFireOptions[]): void;
+ /**
+ * The Materialize object
+ */
+ interface Materialize {
- /**
- * A staggered reveal effect for any UL Tag with list items
- *
- * @name selector the selector for the list to show in staggered fasion
- */
- showStaggeredList(selector: string): void;
+ /**
+ * Displays a toast message on screen
+ *
+ * @param string | JQuery message The message to display on screen
+ * @param number displayLength The duration in milliseconds to display the message on screen
+ * @param string className The className to use to format the message to display
+ * @param Function completeCallback Callback function to call when the messages completes/hides.
+ */
+ toast(message: string | JQuery, displayLength: number, className?: string, completeCallback?: Function): void;
- /**
- * Fade in images. It also animates grayscale and brightness to give it a unique effect.
- *
- * @name selector the selector for the image to fade in
- */
- fadeInImage(selector: string): void;
+ /**
+ * Fires an event when the page is scrolled to a certain area
+ *
+ * @param ScrollFireOptions options optional parameter with scroll fire options
+ */
+ scrollFire(options?: ScrollFireOptions[]): void;
- /**
- * Update all text field to reinitialize all the Materialize labels on the page if dynamically adding inputs
- */
- updateTextFields(): void;
- }
+ /**
+ * A staggered reveal effect for any UL Tag with list items
+ *
+ * @param string selector the selector for the list to show in staggered fasion
+ */
+ showStaggeredList(selector: string): void;
+
+ /**
+ * Fade in images. It also animates grayscale and brightness to give it a unique effect.
+ *
+ * @param string selector the selector for the image to fade in
+ */
+ fadeInImage(selector: string): void;
+
+ /**
+ * Update all text field to reinitialize all the Materialize labels on the page if dynamically adding inputs
+ */
+ updateTextFields(): void;
+
+ /**
+ * Toast functions
+ */
+ Toast: Materialize.Toast;
+ }
+}
+
+/**
+ * Declare Pickadate namespace again in order to add more Materialize specific properties to TimeOptions interface
+ *
+ * @see http://www.typescriptlang.org/docs/handbook/declaration-merging.html
+ */
+declare namespace Pickadate {
+ export interface TimeOptions {
+ /**
+ * Set default time such as : 'now', '1:30AM', '16:30'.
+ * @default `'now'`
+ */
+ default?: string;
+ /**
+ * set default time to * milliseconds from now (using with default = 'now')
+ * @default `0`
+ */
+ fromnow?: number;
+ /**
+ * Use AM/PM or 24-hour format
+ * @default `false`
+ */
+ twelvehour?: boolean;
+ /**
+ * text for done-button
+ * @default `'OK'`
+ */
+ donetext?: string;
+ /**
+ * text for clear-button
+ * @default `'Clear'`
+ */
+ cleartext?: string;
+ /**
+ * Text for cancel-button
+ * @default `'Cancel'`
+ */
+ canceltext?: string;
+ /**
+ * automatic close timepicker
+ * @default `false`
+ */
+ autoclose?: boolean;
+ /**
+ * make AM PM clickable
+ * @default `true`
+ */
+ ampmclickable?: boolean;
+ /**
+ * Function for after opening timepicker
+ */
+ aftershow?: Function;
+ }
}
declare var Materialize: Materialize.Materialize;
interface JQuery {
- /**
- * open Fixed Action Button
- */
- openFAB(): void;
- /**
- * close Fixed Action Button
- */
- closeFAB(): void;
+ /**
+ * open Fixed Action Button
+ */
+ openFAB(): void;
+ /**
+ * close Fixed Action Button
+ */
+ closeFAB(): void;
- /**
- * Select allows user input through specified options.
- * Initialization
- */
- material_select(): void;
+ /**
+ * Select allows user input through specified options.
+ *
+ * @param string method "destroy" destroy the material select
+ */
+ material_select(method?: string): void;
- /**
- * Select allows user input through specified options.
- * Updating/Destroying Select
- *
- * @name method "destroy" destroy the material select
- */
- material_select(method: string): void;
+ /**
+ * Use a character counter in fields where a character restriction is in place.
+ */
+ characterCounter(): JQuery;
- /**
- * Use a character counter in fields where a character restriction is in place.
- */
- characterCounter(): JQuery;
+ /**
+ * Collapsibles are accordion elements that expand when clicked on.
+ * They allow you to hide content that is not immediately relevant to the user.
+ *
+ * @param CollapsibleOptions options the collapsible options
+ */
+ collapsible(options?: Materialize.CollapsibleOptions): JQuery;
- /**
- * Collapsibles are accordion elements that expand when clicked on.
- * They allow you to hide content that is not immediately relevant to the user.
- *
- * @name options the collapsible options
- */
- collapsible(options?: Materialize.CollapsibleOptions): JQuery;
+ /**
+ * Tooltips are small, interactive, textual hints for mainly graphical elements.
+ * When using icons for actions you can use a tooltip to give people clarification on its function.
+ *
+ * @param TooltipOptions | string options the tooltip options or the string "remove" to remove the tooltip function
+ */
+ tooltip(options?: Materialize.TooltipOptions | string): JQuery;
- /**
- * Tooltips are small, interactive, textual hints for mainly graphical elements.
- * When using icons for actions you can use a tooltip to give people clarification on its function.
- *
- * @name options the tooltip options or the string "remove" to remove the tooltip function
- */
- tooltip(options?: Materialize.TooltipOptions | string): JQuery;
+ /**
+ * Add a dropdown list to any button.
+ * Make sure that the data-activates attribute matches the id in the