mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-05 23:37:04 +00:00
Merge branch 'master' into react-native_fixLinting
# Conflicts: # types/react-native/index.d.ts
This commit is contained in:
Vendored
+3
-1
@@ -474,7 +474,9 @@ declare namespace AceAjax {
|
||||
removeFold(arg: any): void;
|
||||
|
||||
expandFold(arg: any): void;
|
||||
|
||||
|
||||
foldAll(startRow?: number, endRow?: number, depth?: number): void
|
||||
|
||||
unfold(arg1: any, arg2: boolean): void;
|
||||
|
||||
screenToDocumentColumn(row: number, column: number): void;
|
||||
|
||||
Vendored
+1
-3
@@ -2,9 +2,7 @@
|
||||
// Project: http://angularjs.org
|
||||
// Definitions by: Michel Salib <https://github.com/michelsalib>, Adi Dahiya <https://github.com/adidahiya>, Raphael Schweizer <https://github.com/rasch>, Cody Schaaf <https://github.com/codyschaaf>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.3
|
||||
|
||||
/// <reference types="jquery" />
|
||||
// TypeScript Version: 2.1
|
||||
|
||||
declare var _: string;
|
||||
export = _;
|
||||
|
||||
@@ -64,6 +64,7 @@ app.config(function (localStorageServiceProvider: ng.local.storage.ILocalStorage
|
||||
localStorageServiceProvider
|
||||
.setPrefix('myApp')
|
||||
.setStorageType('sessionStorage')
|
||||
.setDefaultToCookie(false)
|
||||
.setNotify(true, true);
|
||||
});
|
||||
|
||||
|
||||
+9
-3
@@ -1,6 +1,6 @@
|
||||
// Type definitions for angular-local-storage v0.1.6
|
||||
// Type definitions for angular-local-storage v0.6.0
|
||||
// Project: https://github.com/grevory/angular-local-storage
|
||||
// Definitions by: Ken Fukuyama <https://github.com/kenfdev>
|
||||
// Definitions by: Ken Fukuyama <https://github.com/kenfdev>, Davide Donadello <https://github.com/dona278>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.3
|
||||
|
||||
@@ -27,12 +27,18 @@ declare module 'angular' {
|
||||
* @param storageType localstorage or sessionStorage. default: localStorage
|
||||
*/
|
||||
setStorageType(storageType: string): ILocalStorageServiceProvider;
|
||||
/**
|
||||
* If localStorage is not supported, the library will default to cookies instead. This behavior can be disabled
|
||||
* @param shouldDefault default: true
|
||||
*/
|
||||
setDefaultToCookie(shouldDefault: boolean): ILocalStorageServiceProvider;
|
||||
/**
|
||||
* Setter for cookie config
|
||||
* @param exp number of days before cookies expire (0 = does not expire). default: 30
|
||||
* @param path the web path the cookie represents. default: '/'
|
||||
* @param secure to store cookies as secure. default: false
|
||||
*/
|
||||
setStorageCookie(exp: number, path: string): ILocalStorageServiceProvider;
|
||||
setStorageCookie(exp: number, path: string, secure: boolean): ILocalStorageServiceProvider;
|
||||
/**
|
||||
* Set the cookie domain, since this runs inside a the config() block, only providers and constants can be injected. As a result, $location service can't be used here, use a hardcoded string or window.location.
|
||||
* No default value
|
||||
|
||||
@@ -178,7 +178,7 @@ mod.controller({
|
||||
mod.directive('myDirectiveA', ($rootScope: ng.IRootScopeService) => {
|
||||
return (scope, el, attrs) => {
|
||||
let foo = 'none';
|
||||
el.click(e => {
|
||||
el.on('click', e => {
|
||||
foo = e.type;
|
||||
$rootScope.$apply();
|
||||
});
|
||||
@@ -188,8 +188,9 @@ mod.directive('myDirectiveA', ($rootScope: ng.IRootScopeService) => {
|
||||
mod.directive('myDirectiveB', ['$rootScope', ($rootScope: ng.IRootScopeService) => {
|
||||
return {
|
||||
link(scope, el, attrs) {
|
||||
el.click(e => {
|
||||
el.hide();
|
||||
el.on('click', e => {
|
||||
// Doesn't exist on jqLite
|
||||
// el.hide();
|
||||
});
|
||||
}
|
||||
};
|
||||
@@ -1017,13 +1018,13 @@ angular.module('multiSlotTranscludeExample', [])
|
||||
},
|
||||
link(scope, element, attrs, ctrl, transclude) {
|
||||
// without scope
|
||||
transclude().appendTo(element);
|
||||
transclude(clone => clone.appendTo(element));
|
||||
element.append(transclude());
|
||||
transclude(clone => element.append(clone));
|
||||
|
||||
// with scope
|
||||
transclude(scope, clone => clone.appendTo(element));
|
||||
transclude(scope, clone => clone.appendTo(element), element, 'button');
|
||||
transclude(scope, null, element, 'list').addClass('drop-down-list').appendTo(element);
|
||||
transclude(scope, clone => element.append(clone));
|
||||
transclude(scope, clone => element.append(clone), element, 'button');
|
||||
element.append(transclude(scope, null, element, 'list').addClass('drop-down-list'));
|
||||
}
|
||||
};
|
||||
});
|
||||
|
||||
Vendored
+1
-20
@@ -4,7 +4,7 @@
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.3
|
||||
|
||||
/// <reference types="jquery" />
|
||||
/// <reference path="jqlite.d.ts" />
|
||||
|
||||
declare var angular: angular.IAngularStatic;
|
||||
|
||||
@@ -2116,22 +2116,3 @@ declare namespace angular {
|
||||
(obj: Object): string;
|
||||
}
|
||||
}
|
||||
|
||||
declare global {
|
||||
interface JQuery {
|
||||
// TODO: events, how to define?
|
||||
// $destroy
|
||||
|
||||
find(element: any): JQuery;
|
||||
find(obj: JQuery): JQuery;
|
||||
controller(name?: string): any;
|
||||
injector(): ng.auto.IInjectorService;
|
||||
/** It's declared generic for custom scope interfaces */
|
||||
scope<T extends ng.IScope>(): T;
|
||||
isolateScope<T extends ng.IScope>(): T;
|
||||
|
||||
inheritedData(key: string, value: any): JQuery;
|
||||
inheritedData(obj: { [key: string]: any; }): JQuery;
|
||||
inheritedData(key?: string): any;
|
||||
}
|
||||
}
|
||||
|
||||
Vendored
+802
@@ -0,0 +1,802 @@
|
||||
// Definitions by: Boris Yankov <https://github.com/borisyankov/>
|
||||
// Christian Hoffmeister <https://github.com/choffmeister>
|
||||
// Steve Fenton <https://github.com/Steve-Fenton>
|
||||
// Diullei Gomes <https://github.com/Diullei>
|
||||
// Tass Iliopoulos <https://github.com/tasoili>
|
||||
// Jason Swearingen <https://github.com/jasons-novaleaf>
|
||||
// Sean Hill <https://github.com/seanski>
|
||||
// Guus Goossens <https://github.com/Guuz>
|
||||
// Kelly Summerlin <https://github.com/ksummerlin>
|
||||
// Basarat Ali Syed <https://github.com/basarat>
|
||||
// Nicholas Wolverson <https://github.com/nwolverson>
|
||||
// Derek Cicerone <https://github.com/derekcicerone>
|
||||
// Andrew Gaspar <https://github.com/AndrewGaspar>
|
||||
// Seikichi Kondo <https://github.com/seikichi>
|
||||
// Benjamin Jackman <https://github.com/benjaminjackman>
|
||||
// Poul Sorensen <https://github.com/s093294>
|
||||
// Josh Strobl <https://github.com/JoshStrobl>
|
||||
// John Reilly <https://github.com/johnnyreilly/>
|
||||
// Dick van den Brink <https://github.com/DickvdBrink>
|
||||
// Thomas Schulz <https://github.com/King2500>
|
||||
// Leonard Thieu <https://github.com/leonard-thieu>
|
||||
|
||||
// Definitions copied from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/0480c5ec87fab41aa23047a02b27f0ea71aaf975/types/jquery/v2/index.d.ts
|
||||
|
||||
interface JQuery {
|
||||
/**
|
||||
* Adds the specified class(es) to each of the set of matched elements.
|
||||
*
|
||||
* @param className One or more space-separated classes to be added to the class attribute of each matched element.
|
||||
* @see {@link https://api.jquery.com/addClass/#addClass-className}
|
||||
*/
|
||||
addClass(className: string): JQuery;
|
||||
|
||||
/**
|
||||
* Insert content, specified by the parameter, after each element in the set of matched elements.
|
||||
*
|
||||
* @param content1 HTML string, DOM element, DocumentFragment, array of elements, or jQuery object to insert after each element in the set of matched elements.
|
||||
* @param content2 One or more additional DOM elements, arrays of elements, HTML strings, or jQuery objects to insert after each element in the set of matched elements.
|
||||
* @see {@link https://api.jquery.com/after/#after-content-content}
|
||||
*/
|
||||
after(content1: JQuery | any[] | Element | DocumentFragment | Text | string, ...content2: any[]): JQuery;
|
||||
/**
|
||||
* Insert content, specified by the parameter, after each element in the set of matched elements.
|
||||
*
|
||||
* @param func A function that returns an HTML string, DOM element(s), or jQuery object to insert after each element in the set of matched elements. Receives the index position of the element in the set as an argument. Within the function, this refers to the current element in the set.
|
||||
* @see {@link https://api.jquery.com/after/#after-function}
|
||||
*/
|
||||
after(func: (index: number, html: string) => string | Element | JQuery): JQuery;
|
||||
|
||||
/**
|
||||
* Insert content, specified by the parameter, to the end of each element in the set of matched elements.
|
||||
*
|
||||
* @param content1 DOM element, DocumentFragment, array of elements, HTML string, or jQuery object to insert at the end of each element in the set of matched elements.
|
||||
* @param content2 One or more additional DOM elements, arrays of elements, HTML strings, or jQuery objects to insert at the end of each element in the set of matched elements.
|
||||
* @see {@link https://api.jquery.com/append/#append-content-content}
|
||||
*/
|
||||
append(content1: JQuery | any[] | Element | DocumentFragment | Text | string, ...content2: any[]): JQuery;
|
||||
/**
|
||||
* Insert content, specified by the parameter, to the end of each element in the set of matched elements.
|
||||
*
|
||||
* @param func A function that returns an HTML string, DOM element(s), or jQuery object to insert at the end of each element in the set of matched elements. Receives the index position of the element in the set and the old HTML value of the element as arguments. Within the function, this refers to the current element in the set.
|
||||
* @see {@link https://api.jquery.com/append/#append-function}
|
||||
*/
|
||||
append(func: (index: number, html: string) => string | Element | JQuery): JQuery;
|
||||
|
||||
/**
|
||||
* Get the value of an attribute for the first element in the set of matched elements.
|
||||
*
|
||||
* @param attributeName The name of the attribute to get.
|
||||
* @see {@link https://api.jquery.com/attr/#attr-attributeName}
|
||||
*/
|
||||
attr(attributeName: string): string;
|
||||
/**
|
||||
* Set one or more attributes for the set of matched elements.
|
||||
*
|
||||
* @param attributeName The name of the attribute to set.
|
||||
* @param value A value to set for the attribute. If this is `null`, the attribute will be deleted.
|
||||
* @see {@link https://api.jquery.com/attr/#attr-attributeName-value}
|
||||
*/
|
||||
attr(attributeName: string, value: string | number | null): JQuery;
|
||||
/**
|
||||
* Set one or more attributes for the set of matched elements.
|
||||
*
|
||||
* @param attributes An object of attribute-value pairs to set.
|
||||
* @see {@link https://api.jquery.com/attr/#attr-attributes}
|
||||
*/
|
||||
attr(attributes: Object): JQuery;
|
||||
|
||||
/**
|
||||
* Attach a handler to an event for the elements.
|
||||
*
|
||||
* @param eventType A string containing one or more DOM event types, such as "click" or "submit," or custom event names.
|
||||
* @param handler A function to execute each time the event is triggered.
|
||||
* @see {@link https://api.jquery.com/bind/#bind-eventType-eventData-handler}
|
||||
*/
|
||||
bind(eventType: string, handler: (eventObject: JQueryEventObject) => any): JQuery;
|
||||
/**
|
||||
* Attach a handler to an event for the elements.
|
||||
*
|
||||
* @param eventType A string containing one or more DOM event types, such as "click" or "submit," or custom event names.
|
||||
* @param preventBubble Setting the third argument to false will attach a function that prevents the default action from occurring and stops the event from bubbling. The default is true.
|
||||
* @see {@link https://api.jquery.com/bind/#bind-eventType-eventData-preventBubble}
|
||||
*/
|
||||
bind(eventType: string, preventBubble: boolean): JQuery;
|
||||
/**
|
||||
* Attach a handler to an event for the elements.
|
||||
*
|
||||
* @param events An object containing one or more DOM event types and functions to execute for them.
|
||||
* @see {@link https://api.jquery.com/bind/#bind-events}
|
||||
*/
|
||||
bind(events: any): JQuery;
|
||||
|
||||
/**
|
||||
* Get the children of each element in the set of matched elements, optionally filtered by a selector.
|
||||
*
|
||||
* @see {@link https://api.jquery.com/children/}
|
||||
*/
|
||||
children(): JQuery;
|
||||
|
||||
/**
|
||||
* Create a deep copy of the set of matched elements.
|
||||
*
|
||||
* @param withDataAndEvents A Boolean indicating whether event handlers and data should be copied along with the elements. The default value is false.
|
||||
* @param deepWithDataAndEvents A Boolean indicating whether event handlers and data for all children of the cloned element should be copied. By default its value matches the first argument's value (which defaults to false).
|
||||
* @see {@link https://api.jquery.com/clone/}
|
||||
*/
|
||||
clone(withDataAndEvents?: boolean, deepWithDataAndEvents?: boolean): JQuery;
|
||||
|
||||
/**
|
||||
* Get the children of each element in the set of matched elements, including text and comment nodes.
|
||||
* @see {@link https://api.jquery.com/contents/}
|
||||
*/
|
||||
contents(): JQuery;
|
||||
|
||||
/**
|
||||
* Get the value of style properties for the first element in the set of matched elements.
|
||||
*
|
||||
* @param propertyName A CSS property.
|
||||
* @see {@link https://api.jquery.com/css/#css-propertyName}
|
||||
*/
|
||||
css(propertyName: string): string;
|
||||
/**
|
||||
* Get the value of style properties for the first element in the set of matched elements.
|
||||
* Results in an object of property-value pairs.
|
||||
*
|
||||
* @param propertyNames An array of one or more CSS properties.
|
||||
* @see {@link https://api.jquery.com/css/#css-propertyNames}
|
||||
*/
|
||||
css(propertyNames: string[]): any;
|
||||
/**
|
||||
* Set one or more CSS properties for the set of matched elements.
|
||||
*
|
||||
* @param propertyName A CSS property name.
|
||||
* @param value A value to set for the property.
|
||||
* @see {@link https://api.jquery.com/css/#css-propertyName-value}
|
||||
*/
|
||||
css(propertyName: string, value: string | number): JQuery;
|
||||
/**
|
||||
* Set one or more CSS properties for the set of matched elements.
|
||||
*
|
||||
* @param propertyName A CSS property name.
|
||||
* @param value A function returning the value to set. this is the current element. Receives the index position of the element in the set and the old value as arguments.
|
||||
* @see {@link https://api.jquery.com/css/#css-propertyName-function}
|
||||
*/
|
||||
css(propertyName: string, value: (index: number, value: string) => string | number): JQuery;
|
||||
/**
|
||||
* Set one or more CSS properties for the set of matched elements.
|
||||
*
|
||||
* @param properties An object of property-value pairs to set.
|
||||
* @see {@link https://api.jquery.com/css/#css-properties}
|
||||
*/
|
||||
css(properties: JQueryCssProperties): JQuery;
|
||||
|
||||
/**
|
||||
* Store arbitrary data associated with the matched elements.
|
||||
*
|
||||
* @param key A string naming the piece of data to set.
|
||||
* @param value The new data value; it can be any JavaScript type including Array or Object.
|
||||
* @see {@link https://api.jquery.com/data/#data-key-value}
|
||||
*/
|
||||
data(key: string, value: any): JQuery;
|
||||
/**
|
||||
* Return the value at the named data store for the first element in the jQuery collection, as set by data(name, value) or by an HTML5 data-* attribute.
|
||||
*
|
||||
* @param key Name of the data stored.
|
||||
* @see {@link https://api.jquery.com/data/#data-key}
|
||||
*/
|
||||
data(key: string): any;
|
||||
/**
|
||||
* Store arbitrary data associated with the matched elements.
|
||||
*
|
||||
* @param obj An object of key-value pairs of data to update.
|
||||
* @see {@link https://api.jquery.com/data/#data-obj}
|
||||
*/
|
||||
data(obj: { [key: string]: any; }): JQuery;
|
||||
/**
|
||||
* Return the value at the named data store for the first element in the jQuery collection, as set by data(name, value) or by an HTML5 data-* attribute.
|
||||
* @see {@link https://api.jquery.com/data/#data}
|
||||
*/
|
||||
data(): any;
|
||||
|
||||
/**
|
||||
* Remove the set of matched elements from the DOM.
|
||||
*
|
||||
* @param selector A selector expression that filters the set of matched elements to be removed.
|
||||
* @see {@link https://api.jquery.com/detach/}
|
||||
*/
|
||||
detach(selector?: string): JQuery;
|
||||
|
||||
/**
|
||||
* Remove all child nodes of the set of matched elements from the DOM.
|
||||
* @see {@link https://api.jquery.com/empty/}
|
||||
*/
|
||||
empty(): JQuery;
|
||||
|
||||
/**
|
||||
* Reduce the set of matched elements to the one at the specified index.
|
||||
*
|
||||
* @param index An integer indicating the 0-based position of the element. OR An integer indicating the position of the element, counting backwards from the last element in the set.
|
||||
* @see {@link https://api.jquery.com/eq/}
|
||||
*/
|
||||
eq(index: number): JQuery;
|
||||
|
||||
/**
|
||||
* Get the descendants of each element in the current set of matched elements, filtered by a selector, jQuery object, or element.
|
||||
*
|
||||
* @param selector A string containing a selector expression to match elements against.
|
||||
* @see {@link https://api.jquery.com/find/#find-selector}
|
||||
*/
|
||||
find(selector: string): JQuery;
|
||||
find(element: any): JQuery;
|
||||
find(obj: JQuery): JQuery;
|
||||
|
||||
/**
|
||||
* Determine whether any of the matched elements are assigned the given class.
|
||||
*
|
||||
* @param className The class name to search for.
|
||||
* @see {@link https://api.jquery.com/hasClass/}
|
||||
*/
|
||||
hasClass(className: string): boolean;
|
||||
|
||||
/**
|
||||
* Get the HTML contents of the first element in the set of matched elements.
|
||||
* @see {@link https://api.jquery.com/html/#html}
|
||||
*/
|
||||
html(): string;
|
||||
/**
|
||||
* Set the HTML contents of each element in the set of matched elements.
|
||||
*
|
||||
* @param htmlString A string of HTML to set as the content of each matched element.
|
||||
* @see {@link https://api.jquery.com/html/#html-htmlString}
|
||||
*/
|
||||
html(htmlString: string): JQuery;
|
||||
/**
|
||||
* Set the HTML contents of each element in the set of matched elements.
|
||||
*
|
||||
* @param func A function returning the HTML content to set. Receives the index position of the element in the set and the old HTML value as arguments. jQuery empties the element before calling the function; use the oldhtml argument to reference the previous content. Within the function, this refers to the current element in the set.
|
||||
* @see {@link https://api.jquery.com/html/#html-function}
|
||||
*/
|
||||
html(func: (index: number, oldhtml: string) => string): JQuery;
|
||||
|
||||
/**
|
||||
* Get the immediately following sibling of each element in the set of matched elements. If a selector is provided, it retrieves the next sibling only if it matches that selector.
|
||||
*
|
||||
* @see {@link https://api.jquery.com/next/}
|
||||
*/
|
||||
next(): JQuery;
|
||||
|
||||
/**
|
||||
* Attach an event handler function for one or more events to the selected elements.
|
||||
*
|
||||
* @param events One or more space-separated event types and optional namespaces, such as "click" or "keydown.myPlugin".
|
||||
* @param handler A function to execute when the event is triggered. The value false is also allowed as a shorthand for a function that simply does return false. Rest parameter args is for optional parameters passed to jQuery.trigger(). Note that the actual parameters on the event handler function must be marked as optional (? syntax).
|
||||
* @see {@link https://api.jquery.com/on/#on-events-selector-data-handler}
|
||||
*/
|
||||
on(events: string, handler: (eventObject: JQueryEventObject, ...args: any[]) => any): JQuery;
|
||||
/**
|
||||
* Attach an event handler function for one or more events to the selected elements.
|
||||
*
|
||||
* @param events One or more space-separated event types and optional namespaces, such as "click" or "keydown.myPlugin".
|
||||
* @param data Data to be passed to the handler in event.data when an event is triggered.
|
||||
* @param handler A function to execute when the event is triggered. The value false is also allowed as a shorthand for a function that simply does return false.
|
||||
* @see {@link https://api.jquery.com/on/#on-events-selector-data-handler}
|
||||
*/
|
||||
on(events: string, data: any, handler: (eventObject: JQueryEventObject, ...args: any[]) => any): JQuery;
|
||||
/**
|
||||
* Attach an event handler function for one or more events to the selected elements.
|
||||
*
|
||||
* @param events One or more space-separated event types and optional namespaces, such as "click" or "keydown.myPlugin".
|
||||
* @param selector A selector string to filter the descendants of the selected elements that trigger the event. If the selector is null or omitted, the event is always triggered when it reaches the selected element.
|
||||
* @param handler A function to execute when the event is triggered. The value false is also allowed as a shorthand for a function that simply does return false.
|
||||
* @see {@link https://api.jquery.com/on/#on-events-selector-data-handler}
|
||||
*/
|
||||
on(events: string, selector: string, handler: (eventObject: JQueryEventObject, ...eventData: any[]) => any): JQuery;
|
||||
/**
|
||||
* Attach an event handler function for one or more events to the selected elements.
|
||||
*
|
||||
* @param events One or more space-separated event types and optional namespaces, such as "click" or "keydown.myPlugin".
|
||||
* @param selector A selector string to filter the descendants of the selected elements that trigger the event. If the selector is null or omitted, the event is always triggered when it reaches the selected element.
|
||||
* @param data Data to be passed to the handler in event.data when an event is triggered.
|
||||
* @param handler A function to execute when the event is triggered. The value false is also allowed as a shorthand for a function that simply does return false.
|
||||
* @see {@link https://api.jquery.com/on/#on-events-selector-data-handler}
|
||||
*/
|
||||
on(events: string, selector: string, data: any, handler: (eventObject: JQueryEventObject, ...eventData: any[]) => any): JQuery;
|
||||
/**
|
||||
* Attach an event handler function for one or more events to the selected elements.
|
||||
*
|
||||
* @param events An object in which the string keys represent one or more space-separated event types and optional namespaces, and the values represent a handler function to be called for the event(s).
|
||||
* @param selector A selector string to filter the descendants of the selected elements that will call the handler. If the selector is null or omitted, the handler is always called when it reaches the selected element.
|
||||
* @param data Data to be passed to the handler in event.data when an event occurs.
|
||||
* @see {@link https://api.jquery.com/on/#on-events-selector-data}
|
||||
*/
|
||||
on(events: { [key: string]: (eventObject: JQueryEventObject, ...args: any[]) => any; }, selector?: string, data?: any): JQuery;
|
||||
/**
|
||||
* Attach an event handler function for one or more events to the selected elements.
|
||||
*
|
||||
* @param events An object in which the string keys represent one or more space-separated event types and optional namespaces, and the values represent a handler function to be called for the event(s).
|
||||
* @param data Data to be passed to the handler in event.data when an event occurs.
|
||||
* @see {@link https://api.jquery.com/on/#on-events-selector-data}
|
||||
*/
|
||||
on(events: { [key: string]: (eventObject: JQueryEventObject, ...args: any[]) => any; }, data?: any): JQuery;
|
||||
|
||||
/**
|
||||
* Remove an event handler.
|
||||
* @see {@link https://api.jquery.com/off/#off}
|
||||
*/
|
||||
off(): JQuery;
|
||||
/**
|
||||
* Remove an event handler.
|
||||
*
|
||||
* @param events One or more space-separated event types and optional namespaces, or just namespaces, such as "click", "keydown.myPlugin", or ".myPlugin".
|
||||
* @param selector A selector which should match the one originally passed to .on() when attaching event handlers.
|
||||
* @param handler A handler function previously attached for the event(s), or the special value false.
|
||||
* @see {@link https://api.jquery.com/off/#off-events-selector-handler}
|
||||
*/
|
||||
off(events: string, selector?: string, handler?: (eventObject: JQueryEventObject) => any): JQuery;
|
||||
/**
|
||||
* Remove an event handler.
|
||||
*
|
||||
* @param events One or more space-separated event types and optional namespaces, or just namespaces, such as "click", "keydown.myPlugin", or ".myPlugin".
|
||||
* @param handler A handler function previously attached for the event(s), or the special value false. Takes handler with extra args that can be attached with on().
|
||||
* @see {@link https://api.jquery.com/off/#off-events-selector-handler}
|
||||
*/
|
||||
off(events: string, handler: (eventObject: JQueryEventObject, ...args: any[]) => any): JQuery;
|
||||
/**
|
||||
* Remove an event handler.
|
||||
*
|
||||
* @param events One or more space-separated event types and optional namespaces, or just namespaces, such as "click", "keydown.myPlugin", or ".myPlugin".
|
||||
* @param handler A handler function previously attached for the event(s), or the special value false.
|
||||
* @see {@link https://api.jquery.com/off/#off-events-selector-handler}
|
||||
*/
|
||||
off(events: string, handler: (eventObject: JQueryEventObject) => any): JQuery;
|
||||
/**
|
||||
* Remove an event handler.
|
||||
*
|
||||
* @param events An object where the string keys represent one or more space-separated event types and optional namespaces, and the values represent handler functions previously attached for the event(s).
|
||||
* @param selector A selector which should match the one originally passed to .on() when attaching event handlers.
|
||||
* @see {@link https://api.jquery.com/off/#off-events-selector}
|
||||
*/
|
||||
off(events: { [key: string]: any; }, selector?: string): JQuery;
|
||||
|
||||
/**
|
||||
* Attach a handler to an event for the elements. The handler is executed at most once per element per event type.
|
||||
*
|
||||
* @param events A string containing one or more JavaScript event types, such as "click" or "submit," or custom event names.
|
||||
* @param handler A function to execute at the time the event is triggered.
|
||||
* @see {@link https://api.jquery.com/one/#one-events-data-handler}
|
||||
*/
|
||||
one(events: string, handler: (eventObject: JQueryEventObject) => any): JQuery;
|
||||
/**
|
||||
* Attach a handler to an event for the elements. The handler is executed at most once per element per event type.
|
||||
*
|
||||
* @param events A string containing one or more JavaScript event types, such as "click" or "submit," or custom event names.
|
||||
* @param data An object containing data that will be passed to the event handler.
|
||||
* @param handler A function to execute at the time the event is triggered.
|
||||
* @see {@link https://api.jquery.com/one/#one-events-data-handler}
|
||||
*/
|
||||
one(events: string, data: Object, handler: (eventObject: JQueryEventObject) => any): JQuery;
|
||||
/**
|
||||
* Attach a handler to an event for the elements. The handler is executed at most once per element per event type.
|
||||
*
|
||||
* @param events One or more space-separated event types and optional namespaces, such as "click" or "keydown.myPlugin".
|
||||
* @param selector A selector string to filter the descendants of the selected elements that trigger the event. If the selector is null or omitted, the event is always triggered when it reaches the selected element.
|
||||
* @param handler A function to execute when the event is triggered. The value false is also allowed as a shorthand for a function that simply does return false.
|
||||
* @see {@link https://api.jquery.com/one/#one-events-selector-data-handler}
|
||||
*/
|
||||
one(events: string, selector: string, handler: (eventObject: JQueryEventObject) => any): JQuery;
|
||||
/**
|
||||
* Attach a handler to an event for the elements. The handler is executed at most once per element per event type.
|
||||
*
|
||||
* @param events One or more space-separated event types and optional namespaces, such as "click" or "keydown.myPlugin".
|
||||
* @param selector A selector string to filter the descendants of the selected elements that trigger the event. If the selector is null or omitted, the event is always triggered when it reaches the selected element.
|
||||
* @param data Data to be passed to the handler in event.data when an event is triggered.
|
||||
* @param handler A function to execute when the event is triggered. The value false is also allowed as a shorthand for a function that simply does return false.
|
||||
* @see {@link https://api.jquery.com/one/#one-events-selector-data-handler}
|
||||
*/
|
||||
one(events: string, selector: string, data: any, handler: (eventObject: JQueryEventObject) => any): JQuery;
|
||||
/**
|
||||
* Attach a handler to an event for the elements. The handler is executed at most once per element per event type.
|
||||
*
|
||||
* @param events An object in which the string keys represent one or more space-separated event types and optional namespaces, and the values represent a handler function to be called for the event(s).
|
||||
* @param selector A selector string to filter the descendants of the selected elements that will call the handler. If the selector is null or omitted, the handler is always called when it reaches the selected element.
|
||||
* @param data Data to be passed to the handler in event.data when an event occurs.
|
||||
* @see {@link https://api.jquery.com/one/#one-events-selector-data}
|
||||
*/
|
||||
one(events: { [key: string]: any; }, selector?: string, data?: any): JQuery;
|
||||
/**
|
||||
* Attach a handler to an event for the elements. The handler is executed at most once per element per event type.
|
||||
*
|
||||
* @param events An object in which the string keys represent one or more space-separated event types and optional namespaces, and the values represent a handler function to be called for the event(s).
|
||||
* @param data Data to be passed to the handler in event.data when an event occurs.
|
||||
* @see {@link https://api.jquery.com/one/#one-events-selector-data}
|
||||
*/
|
||||
one(events: { [key: string]: any; }, data?: any): JQuery;
|
||||
|
||||
/**
|
||||
* Get the parent of each element in the current set of matched elements, optionally filtered by a selector.
|
||||
*
|
||||
* @see {@link https://api.jquery.com/parent/}
|
||||
*/
|
||||
parent(): JQuery;
|
||||
|
||||
/**
|
||||
* Insert content, specified by the parameter, to the beginning of each element in the set of matched elements.
|
||||
*
|
||||
* @param content1 DOM element, DocumentFragment, array of elements, HTML string, or jQuery object to insert at the beginning of each element in the set of matched elements.
|
||||
* @param content2 One or more additional DOM elements, arrays of elements, HTML strings, or jQuery objects to insert at the beginning of each element in the set of matched elements.
|
||||
* @see {@link https://api.jquery.com/prepend/#prepend-content-content}
|
||||
*/
|
||||
prepend(content1: JQuery | any[] | Element | DocumentFragment | Text | string, ...content2: any[]): JQuery;
|
||||
/**
|
||||
* Insert content, specified by the parameter, to the beginning of each element in the set of matched elements.
|
||||
*
|
||||
* @param func A function that returns an HTML string, DOM element(s), or jQuery object to insert at the beginning of each element in the set of matched elements. Receives the index position of the element in the set and the old HTML value of the element as arguments. Within the function, this refers to the current element in the set.
|
||||
* @see {@link https://api.jquery.com/prepend/#prepend-function}
|
||||
*/
|
||||
prepend(func: (index: number, html: string) => string | Element | JQuery): JQuery;
|
||||
|
||||
/**
|
||||
* Get the value of a property for the first element in the set of matched elements.
|
||||
*
|
||||
* @param propertyName The name of the property to get.
|
||||
* @see {@link https://api.jquery.com/prop/#prop-propertyName}
|
||||
*/
|
||||
prop(propertyName: string): any;
|
||||
/**
|
||||
* Set one or more properties for the set of matched elements.
|
||||
*
|
||||
* @param propertyName The name of the property to set.
|
||||
* @param value A value to set for the property.
|
||||
* @see {@link https://api.jquery.com/prop/#prop-propertyName-value}
|
||||
*/
|
||||
prop(propertyName: string, value: string | number | boolean): JQuery;
|
||||
/**
|
||||
* Set one or more properties for the set of matched elements.
|
||||
*
|
||||
* @param properties An object of property-value pairs to set.
|
||||
* @see {@link https://api.jquery.com/prop/#prop-properties}
|
||||
*/
|
||||
prop(properties: Object): JQuery;
|
||||
/**
|
||||
* Set one or more properties for the set of matched elements.
|
||||
*
|
||||
* @param propertyName The name of the property to set.
|
||||
* @param func A function returning the value to set. Receives the index position of the element in the set and the old property value as arguments. Within the function, the keyword this refers to the current element.
|
||||
* @see {@link https://api.jquery.com/prop/#prop-propertyName-function}
|
||||
*/
|
||||
prop(propertyName: string, func: (index: number, oldPropertyValue: any) => any): JQuery;
|
||||
|
||||
/**
|
||||
* Specify a function to execute when the DOM is fully loaded.
|
||||
*
|
||||
* @param handler A function to execute after the DOM is ready.
|
||||
* @see {@link https://api.jquery.com/ready/}
|
||||
*/
|
||||
ready(handler: (jQueryAlias?: JQueryStatic) => any): JQuery;
|
||||
|
||||
/**
|
||||
* Remove the set of matched elements from the DOM.
|
||||
*
|
||||
* @param selector A selector expression that filters the set of matched elements to be removed.
|
||||
* @see {@link https://api.jquery.com/remove/}
|
||||
*/
|
||||
remove(selector?: string): JQuery;
|
||||
|
||||
/**
|
||||
* Remove an attribute from each element in the set of matched elements.
|
||||
*
|
||||
* @param attributeName An attribute to remove; as of version 1.7, it can be a space-separated list of attributes.
|
||||
* @see {@link https://api.jquery.com/removeAttr/}
|
||||
*/
|
||||
removeAttr(attributeName: string): JQuery;
|
||||
|
||||
/**
|
||||
* Remove a single class, multiple classes, or all classes from each element in the set of matched elements.
|
||||
*
|
||||
* @param className One or more space-separated classes to be removed from the class attribute of each matched element.
|
||||
* @see {@link https://api.jquery.com/removeClass/#removeClass-className}
|
||||
*/
|
||||
removeClass(className?: string): JQuery;
|
||||
|
||||
/**
|
||||
* Remove a previously-stored piece of data.
|
||||
*
|
||||
* @param name A string naming the piece of data to delete or space-separated string naming the pieces of data to delete.
|
||||
* @see {@link https://api.jquery.com/removeData/#removeData-name}
|
||||
*/
|
||||
removeData(name: string): JQuery;
|
||||
/**
|
||||
* Remove a previously-stored piece of data.
|
||||
*
|
||||
* @param list An array of strings naming the pieces of data to delete.
|
||||
* @see {@link https://api.jquery.com/removeData/#removeData-list}
|
||||
*/
|
||||
removeData(list: string[]): JQuery;
|
||||
/**
|
||||
* Remove all previously-stored piece of data.
|
||||
* @see {@link https://api.jquery.com/removeData/}
|
||||
*/
|
||||
removeData(): JQuery;
|
||||
|
||||
/**
|
||||
* Replace each element in the set of matched elements with the provided new content and return the set of elements that was removed.
|
||||
*
|
||||
* @param newContent The content to insert. May be an HTML string, DOM element, array of DOM elements, or jQuery object.
|
||||
* @see {@link https://api.jquery.com/replaceWith/#replaceWith-newContent}
|
||||
*/
|
||||
replaceWith(newContent: JQuery | any[] | Element | Text | string): JQuery;
|
||||
/**
|
||||
* Replace each element in the set of matched elements with the provided new content and return the set of elements that was removed.
|
||||
*
|
||||
* @param func A function that returns content with which to replace the set of matched elements.
|
||||
* @see {@link https://api.jquery.com/replaceWith/#replaceWith-function}
|
||||
*/
|
||||
replaceWith(func: () => Element | JQuery): JQuery;
|
||||
|
||||
/**
|
||||
* Get the combined text contents of each element in the set of matched elements, including their descendants.
|
||||
* @see {@link https://api.jquery.com/text/#text}
|
||||
*/
|
||||
text(): string;
|
||||
/**
|
||||
* Set the content of each element in the set of matched elements to the specified text.
|
||||
*
|
||||
* @param text The text to set as the content of each matched element. When Number or Boolean is supplied, it will be converted to a String representation.
|
||||
* @see {@link https://api.jquery.com/text/#text-text}
|
||||
*/
|
||||
text(text: string | number | boolean): JQuery;
|
||||
/**
|
||||
* Set the content of each element in the set of matched elements to the specified text.
|
||||
*
|
||||
* @param func A function returning the text content to set. Receives the index position of the element in the set and the old text value as arguments.
|
||||
* @see {@link https://api.jquery.com/text/#text-function}
|
||||
*/
|
||||
text(func: (index: number, text: string) => string): JQuery;
|
||||
|
||||
/**
|
||||
* Add or remove one or more classes from each element in the set of matched elements, depending on either the class's presence or the value of the switch argument.
|
||||
*
|
||||
* @param className One or more class names (separated by spaces) to be toggled for each element in the matched set.
|
||||
* @param swtch A Boolean (not just truthy/falsy) value to determine whether the class should be added or removed.
|
||||
* @see {@link https://api.jquery.com/toggleClass/#toggleClass-className}
|
||||
*/
|
||||
toggleClass(className: string, swtch?: boolean): JQuery;
|
||||
/**
|
||||
* Add or remove one or more classes from each element in the set of matched elements, depending on either the class's presence or the value of the switch argument.
|
||||
*
|
||||
* @param swtch A boolean value to determine whether the class should be added or removed.
|
||||
* @see {@link https://api.jquery.com/toggleClass/#toggleClass-state}
|
||||
*/
|
||||
toggleClass(swtch?: boolean): JQuery;
|
||||
|
||||
/**
|
||||
* Execute all handlers attached to an element for an event.
|
||||
*
|
||||
* @param eventType A string containing a JavaScript event type, such as click or submit.
|
||||
* @param extraParameters An array of additional parameters to pass along to the event handler.
|
||||
* @see {@link https://api.jquery.com/triggerHandler/#triggerHandler-eventType-extraParameters}
|
||||
*/
|
||||
triggerHandler(eventType: string, ...extraParameters: any[]): Object;
|
||||
/**
|
||||
* Execute all handlers attached to an element for an event.
|
||||
*
|
||||
* @param event A jQuery.Event object.
|
||||
* @param extraParameters An array of additional parameters to pass along to the event handler.
|
||||
* @see {@link https://api.jquery.com/triggerHandler/#triggerHandler-event-extraParameters}
|
||||
*/
|
||||
triggerHandler(event: JQueryEventObject, ...extraParameters: any[]): Object;
|
||||
|
||||
/**
|
||||
* Remove a previously-attached event handler from the elements.
|
||||
*
|
||||
* @param eventType A string containing a JavaScript event type, such as click or submit.
|
||||
* @param handler The function that is to be no longer executed.
|
||||
* @see {@link https://api.jquery.com/unbind/#unbind-eventType-handler}
|
||||
*/
|
||||
unbind(eventType?: string, handler?: (eventObject: JQueryEventObject) => any): JQuery;
|
||||
/**
|
||||
* Remove a previously-attached event handler from the elements.
|
||||
*
|
||||
* @param eventType A string containing a JavaScript event type, such as click or submit.
|
||||
* @param fls Unbinds the corresponding 'return false' function that was bound using .bind( eventType, false ).
|
||||
* @see {@link https://api.jquery.com/unbind/#unbind-eventType-false}
|
||||
*/
|
||||
unbind(eventType: string, fls: boolean): JQuery;
|
||||
/**
|
||||
* Remove a previously-attached event handler from the elements.
|
||||
*
|
||||
* @param evt A JavaScript event object as passed to an event handler.
|
||||
* @see {@link https://api.jquery.com/unbind/#unbind-event}
|
||||
*/
|
||||
unbind(evt: any): JQuery;
|
||||
|
||||
/**
|
||||
* Get the current value of the first element in the set of matched elements.
|
||||
* @see {@link https://api.jquery.com/val/#val}
|
||||
*/
|
||||
val(): any;
|
||||
/**
|
||||
* Set the value of each element in the set of matched elements.
|
||||
*
|
||||
* @param value A string of text, an array of strings or number corresponding to the value of each matched element to set as selected/checked.
|
||||
* @see {@link https://api.jquery.com/val/#val-value}
|
||||
*/
|
||||
val(value: string | string[] | number): JQuery;
|
||||
/**
|
||||
* Set the value of each element in the set of matched elements.
|
||||
*
|
||||
* @param func A function returning the value to set. this is the current element. Receives the index position of the element in the set and the old value as arguments.
|
||||
* @see {@link https://api.jquery.com/val/#val-function}
|
||||
*/
|
||||
val(func: (index: number, value: string) => string): JQuery;
|
||||
|
||||
/**
|
||||
* Wrap an HTML structure around each element in the set of matched elements.
|
||||
*
|
||||
* @param wrappingElement A selector, element, HTML string, or jQuery object specifying the structure to wrap around the matched elements.
|
||||
* @see {@link https://api.jquery.com/wrap/#wrap-wrappingElement}
|
||||
*/
|
||||
wrap(wrappingElement: JQuery | Element | string): JQuery;
|
||||
/**
|
||||
* Wrap an HTML structure around each element in the set of matched elements.
|
||||
*
|
||||
* @param func A callback function returning the HTML content or jQuery object to wrap around the matched elements. Receives the index position of the element in the set as an argument. Within the function, this refers to the current element in the set.
|
||||
* @see {@link https://api.jquery.com/wrap/#wrap-function}
|
||||
*/
|
||||
wrap(func: (index: number) => string | JQuery): JQuery;
|
||||
|
||||
// Undocumented
|
||||
length: number;
|
||||
|
||||
// TODO: events, how to define?
|
||||
// $destroy
|
||||
|
||||
controller(name?: string): any;
|
||||
injector(): ng.auto.IInjectorService;
|
||||
/** It's declared generic for custom scope interfaces */
|
||||
scope<T extends ng.IScope>(): T;
|
||||
isolateScope<T extends ng.IScope>(): T;
|
||||
|
||||
inheritedData(key: string, value: any): JQuery;
|
||||
inheritedData(obj: { [key: string]: any; }): JQuery;
|
||||
inheritedData(key?: string): any;
|
||||
}
|
||||
|
||||
interface JQueryStatic {
|
||||
(element: string | Element): JQuery;
|
||||
}
|
||||
|
||||
/**
|
||||
* Interface of the JQuery extension of the W3C event object
|
||||
* @see {@link https://api.jquery.com/category/events/event-object/}
|
||||
*/
|
||||
interface BaseJQueryEventObject extends Event {
|
||||
/**
|
||||
* The current DOM element within the event bubbling phase.
|
||||
* @see {@link https://api.jquery.com/event.currentTarget/}
|
||||
*/
|
||||
currentTarget: Element;
|
||||
/**
|
||||
* An optional object of data passed to an event method when the current executing handler is bound.
|
||||
* @see {@link https://api.jquery.com/event.data/}
|
||||
*/
|
||||
data: any;
|
||||
/**
|
||||
* The element where the currently-called jQuery event handler was attached.
|
||||
* @see {@link https://api.jquery.com/event.delegateTarget/}
|
||||
*/
|
||||
delegateTarget: Element;
|
||||
/**
|
||||
* Returns whether event.preventDefault() was ever called on this event object.
|
||||
* @see {@link https://api.jquery.com/event.isDefaultPrevented/}
|
||||
*/
|
||||
isDefaultPrevented(): boolean;
|
||||
/**
|
||||
* Returns whether event.stopImmediatePropagation() was ever called on this event object.
|
||||
* @see {@link https://api.jquery.com/event.isImmediatePropagationStopped/}
|
||||
*/
|
||||
isImmediatePropagationStopped(): boolean;
|
||||
/**
|
||||
* Returns whether event.stopPropagation() was ever called on this event object.
|
||||
* @see {@link https://api.jquery.com/event.isPropagationStopped/}
|
||||
*/
|
||||
isPropagationStopped(): boolean;
|
||||
/**
|
||||
* The namespace specified when the event was triggered.
|
||||
* @see {@link https://api.jquery.com/event.namespace/}
|
||||
*/
|
||||
namespace: string;
|
||||
/**
|
||||
* The browser's original Event object.
|
||||
* @see {@link https://api.jquery.com/category/events/event-object/}
|
||||
*/
|
||||
originalEvent: Event;
|
||||
/**
|
||||
* If this method is called, the default action of the event will not be triggered.
|
||||
* @see {@link https://api.jquery.com/event.preventDefault/}
|
||||
*/
|
||||
preventDefault(): any;
|
||||
/**
|
||||
* The other DOM element involved in the event, if any.
|
||||
* @see {@link https://api.jquery.com/event.relatedTarget/}
|
||||
*/
|
||||
relatedTarget: Element;
|
||||
/**
|
||||
* The last value returned by an event handler that was triggered by this event, unless the value was undefined.
|
||||
* @see {@link https://api.jquery.com/event.result/}
|
||||
*/
|
||||
result: any;
|
||||
/**
|
||||
* Keeps the rest of the handlers from being executed and prevents the event from bubbling up the DOM tree.
|
||||
* @see {@link https://api.jquery.com/event.stopImmediatePropagation/}
|
||||
*/
|
||||
stopImmediatePropagation(): void;
|
||||
/**
|
||||
* Prevents the event from bubbling up the DOM tree, preventing any parent handlers from being notified of the event.
|
||||
* @see {@link https://api.jquery.com/event.stopPropagation/}
|
||||
*/
|
||||
stopPropagation(): void;
|
||||
/**
|
||||
* The DOM element that initiated the event.
|
||||
* @see {@link https://api.jquery.com/event.target/}
|
||||
*/
|
||||
target: Element;
|
||||
/**
|
||||
* The mouse position relative to the left edge of the document.
|
||||
* @see {@link https://api.jquery.com/event.pageX/}
|
||||
*/
|
||||
pageX: number;
|
||||
/**
|
||||
* The mouse position relative to the top edge of the document.
|
||||
* @see {@link https://api.jquery.com/event.pageY/}
|
||||
*/
|
||||
pageY: number;
|
||||
/**
|
||||
* For key or mouse events, this property indicates the specific key or button that was pressed.
|
||||
* @see {@link https://api.jquery.com/event.which/}
|
||||
*/
|
||||
which: number;
|
||||
/**
|
||||
* Indicates whether the META key was pressed when the event fired.
|
||||
* @see {@link https://api.jquery.com/event.metaKey/}
|
||||
*/
|
||||
metaKey: boolean;
|
||||
}
|
||||
|
||||
interface JQueryInputEventObject extends BaseJQueryEventObject {
|
||||
altKey: boolean;
|
||||
ctrlKey: boolean;
|
||||
metaKey: boolean;
|
||||
shiftKey: boolean;
|
||||
}
|
||||
|
||||
interface JQueryMouseEventObject extends JQueryInputEventObject {
|
||||
button: number;
|
||||
clientX: number;
|
||||
clientY: number;
|
||||
offsetX: number;
|
||||
offsetY: number;
|
||||
pageX: number;
|
||||
pageY: number;
|
||||
screenX: number;
|
||||
screenY: number;
|
||||
}
|
||||
|
||||
interface JQueryKeyEventObject extends JQueryInputEventObject {
|
||||
char: any;
|
||||
charCode: number;
|
||||
key: any;
|
||||
keyCode: number;
|
||||
}
|
||||
|
||||
interface JQueryEventObject extends BaseJQueryEventObject, JQueryInputEventObject, JQueryMouseEventObject, JQueryKeyEventObject {
|
||||
}
|
||||
|
||||
/**
|
||||
* The interface used to specify the properties parameter in css()
|
||||
*/
|
||||
type cssPropertySetter = (index: number, value?: string) => string | number;
|
||||
interface JQueryCssProperties {
|
||||
[propertyName: string]: string | number | cssPropertySetter;
|
||||
}
|
||||
@@ -0,0 +1,456 @@
|
||||
import * as $ from 'jquery';
|
||||
import * as angular from 'angular';
|
||||
|
||||
function JQuery() {
|
||||
function addClass() {
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('p').addClass('className');
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('p').addClass(function(index, currentClassName) {
|
||||
// $ExpectType HTMLElement
|
||||
this;
|
||||
// $ExpectType number
|
||||
index;
|
||||
// $ExpectType string
|
||||
currentClassName;
|
||||
|
||||
return 'className';
|
||||
});
|
||||
}
|
||||
|
||||
function attr() {
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('#greatphoto').attr('alt', 'Beijing Brush Seller');
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('#greatphoto').attr('width', 200);
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('#greatphoto').attr('title', null);
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('#greatphoto').attr('alt', function(index, attr) {
|
||||
// $ExpectType HTMLElement
|
||||
this;
|
||||
// $ExpectType number
|
||||
index;
|
||||
// $ExpectType string
|
||||
attr;
|
||||
|
||||
return 'Beijing Brush Seller';
|
||||
});
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('#greatphoto').attr('width', function(index, attr) {
|
||||
// $ExpectType HTMLElement
|
||||
this;
|
||||
// $ExpectType number
|
||||
index;
|
||||
// $ExpectType string
|
||||
attr;
|
||||
|
||||
return 200;
|
||||
});
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('#greatphoto').attr('title', function(index, attr) {
|
||||
// $ExpectType HTMLElement
|
||||
this;
|
||||
// $ExpectType number
|
||||
index;
|
||||
// $ExpectType string
|
||||
attr;
|
||||
});
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('#greatphoto').attr('title', function(index, attr) {
|
||||
// $ExpectType HTMLElement
|
||||
this;
|
||||
// $ExpectType number
|
||||
index;
|
||||
// $ExpectType string
|
||||
attr;
|
||||
|
||||
return undefined;
|
||||
});
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('img').attr({
|
||||
src: '/resources/hat.gif',
|
||||
title: 'jQuery',
|
||||
alt: 'jQuery Logo'
|
||||
});
|
||||
|
||||
// $ExpectType string
|
||||
$('img').attr('src');
|
||||
}
|
||||
|
||||
function bind() {
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('p').bind('myEvent', 'myData', function(event) {
|
||||
// $ExpectType HTMLElement
|
||||
this;
|
||||
// $ExpectType Event<HTMLElement, string>
|
||||
event;
|
||||
});
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('p').bind('myEvent', function(event) {
|
||||
// $ExpectType HTMLElement
|
||||
this;
|
||||
// $ExpectType Event<HTMLElement, null>
|
||||
event;
|
||||
});
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('p').bind('myEvent', false);
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('p').bind({
|
||||
myEvent1(event) {
|
||||
// $ExpectType HTMLElement
|
||||
this;
|
||||
},
|
||||
myEvent2: false
|
||||
});
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('p').bind('myEvent', null);
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('p').bind('myEvent', undefined);
|
||||
}
|
||||
|
||||
function children() {
|
||||
$('p').children();
|
||||
|
||||
$('p').children('span');
|
||||
}
|
||||
|
||||
function off() {
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('table').off('myEvent', 'td', function(event) {
|
||||
// $ExpectType HTMLElement
|
||||
this;
|
||||
// $ExpectType Event<HTMLElement, null>
|
||||
event;
|
||||
});
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('table').off('myEvent', 'td', false);
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('table').off('myEvent', 'td');
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('table').off('myEvent', function(event) {
|
||||
// $ExpectType HTMLElement
|
||||
this;
|
||||
// $ExpectType Event<HTMLElement, null>
|
||||
event;
|
||||
});
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('table').off('myEvent', false);
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('table').off('myEvent');
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('table').off({
|
||||
myEvent1(event) {
|
||||
// $ExpectType HTMLElement
|
||||
this;
|
||||
// $ExpectType Event<HTMLElement, null>
|
||||
event;
|
||||
},
|
||||
myEvent2: false
|
||||
}, 'td');
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('table').off({
|
||||
myEvent1(event) {
|
||||
// $ExpectType HTMLElement
|
||||
this;
|
||||
// $ExpectType Event<HTMLElement, null>
|
||||
event;
|
||||
},
|
||||
myEvent2: false
|
||||
});
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('table').off($.Event('myEvent'));
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('table').off();
|
||||
}
|
||||
|
||||
function on() {
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('table').on('myEvent', 'td', 'myData', function(event) {
|
||||
// $ExpectType HTMLElement
|
||||
this;
|
||||
// $ExpectType Event<HTMLElement, string>
|
||||
event;
|
||||
});
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('table').on('myEvent', null, 'myData', function(event) {
|
||||
// $ExpectType HTMLElement
|
||||
this;
|
||||
// $ExpectType Event<HTMLElement, string>
|
||||
event;
|
||||
});
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('table').on('myEvent', 'td', function(event) {
|
||||
// $ExpectType HTMLElement
|
||||
this;
|
||||
// $ExpectType Event<HTMLElement, null>
|
||||
event;
|
||||
});
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('table').on('myEvent', 'td', false);
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('table').on('myEvent', 3, function(event) {
|
||||
// $ExpectType HTMLElement
|
||||
this;
|
||||
// $ExpectType Event<HTMLElement, number>
|
||||
event;
|
||||
});
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('table').on('myEvent', function(event) {
|
||||
// $ExpectType HTMLElement
|
||||
this;
|
||||
// $ExpectType Event<HTMLElement, null>
|
||||
event;
|
||||
});
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('table').on('myEvent', false);
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('table').on({
|
||||
myEvent1(event) {
|
||||
// $ExpectType HTMLElement
|
||||
this;
|
||||
// $ExpectType Event<HTMLElement, string>
|
||||
event;
|
||||
},
|
||||
myEvent2: false
|
||||
}, 'td', 'myData');
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('table').on({
|
||||
myEvent1(event) {
|
||||
// $ExpectType HTMLElement
|
||||
this;
|
||||
// $ExpectType Event<HTMLElement, string>
|
||||
event;
|
||||
},
|
||||
myEvent2: false
|
||||
}, null, 'myData');
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('table').on({
|
||||
myEvent1(event) {
|
||||
// $ExpectType HTMLElement
|
||||
this;
|
||||
// $ExpectType Event<HTMLElement, null>
|
||||
event;
|
||||
},
|
||||
myEvent2: false
|
||||
}, 'td');
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('table').on({
|
||||
myEvent1(event) {
|
||||
// $ExpectType HTMLElement
|
||||
this;
|
||||
// $ExpectType Event<HTMLElement, number>
|
||||
event;
|
||||
},
|
||||
myEvent2: false
|
||||
}, 3);
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('table').on({
|
||||
myEvent1(event) {
|
||||
// $ExpectType HTMLElement
|
||||
this;
|
||||
// $ExpectType Event<HTMLElement, null>
|
||||
event;
|
||||
},
|
||||
myEvent2: false
|
||||
});
|
||||
}
|
||||
|
||||
function one() {
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('table').one('myEvent', 'td', 'myData', function(event) {
|
||||
// $ExpectType HTMLElement
|
||||
this;
|
||||
// $ExpectType Event<HTMLElement, string>
|
||||
event;
|
||||
});
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('table').one('myEvent', null, 'myData', function(event) {
|
||||
// $ExpectType HTMLElement
|
||||
this;
|
||||
// $ExpectType Event<HTMLElement, string>
|
||||
event;
|
||||
});
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('table').one('myEvent', 'td', function(event) {
|
||||
// $ExpectType HTMLElement
|
||||
this;
|
||||
// $ExpectType Event<HTMLElement, null>
|
||||
event;
|
||||
});
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('table').one('myEvent', 'td', false);
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('table').one('myEvent', 3, function(event) {
|
||||
// $ExpectType HTMLElement
|
||||
this;
|
||||
// $ExpectType Event<HTMLElement, number>
|
||||
event;
|
||||
});
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('table').one('myEvent', function(event) {
|
||||
// $ExpectType HTMLElement
|
||||
this;
|
||||
// $ExpectType Event<HTMLElement, null>
|
||||
event;
|
||||
});
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('table').one('myEvent', false);
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('table').one({
|
||||
myEvent1(event) {
|
||||
// $ExpectType HTMLElement
|
||||
this;
|
||||
// $ExpectType Event<HTMLElement, string>
|
||||
event;
|
||||
},
|
||||
myEvent2: false
|
||||
}, 'td', 'myData');
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('table').one({
|
||||
myEvent1(event) {
|
||||
// $ExpectType HTMLElement
|
||||
this;
|
||||
// $ExpectType Event<HTMLElement, string>
|
||||
event;
|
||||
},
|
||||
myEvent2: false
|
||||
}, null, 'myData');
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('table').one({
|
||||
myEvent1(event) {
|
||||
// $ExpectType HTMLElement
|
||||
this;
|
||||
// $ExpectType Event<HTMLElement, null>
|
||||
event;
|
||||
},
|
||||
myEvent2: false
|
||||
}, 'td');
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('table').one({
|
||||
myEvent1(event) {
|
||||
// $ExpectType HTMLElement
|
||||
this;
|
||||
// $ExpectType Event<HTMLElement, number>
|
||||
event;
|
||||
},
|
||||
myEvent2: false
|
||||
}, 3);
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('table').one({
|
||||
myEvent1(event) {
|
||||
// $ExpectType HTMLElement
|
||||
this;
|
||||
// $ExpectType Event<HTMLElement, null>
|
||||
event;
|
||||
},
|
||||
myEvent2: false
|
||||
});
|
||||
}
|
||||
|
||||
function removeClass() {
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('p').removeClass('className');
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('p').removeClass(function(index, currentClassName) {
|
||||
// $ExpectType HTMLElement
|
||||
this;
|
||||
// $ExpectType number
|
||||
index;
|
||||
// $ExpectType string
|
||||
currentClassName;
|
||||
|
||||
return 'className';
|
||||
});
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('p').removeClass();
|
||||
}
|
||||
|
||||
function toggleClass() {
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('p').toggleClass('className', true);
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('p').toggleClass(function(index, className, state) {
|
||||
// $ExpectType HTMLElement
|
||||
this;
|
||||
// $ExpectType number
|
||||
index;
|
||||
// $ExpectType string
|
||||
className;
|
||||
// $ExpectType true
|
||||
state;
|
||||
|
||||
return 'className';
|
||||
}, true);
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('p').toggleClass('className');
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('p').toggleClass(function(index, className, state) {
|
||||
// $ExpectType HTMLElement
|
||||
this;
|
||||
// $ExpectType number
|
||||
index;
|
||||
// $ExpectType string
|
||||
className;
|
||||
// $ExpectType boolean
|
||||
state;
|
||||
|
||||
return 'className';
|
||||
});
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('p').toggleClass(false);
|
||||
|
||||
// $ExpectType JQuery<HTMLElement>
|
||||
$('p').toggleClass();
|
||||
}
|
||||
}
|
||||
@@ -1,13 +1,16 @@
|
||||
{
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"angular-tests.ts"
|
||||
"jqlite.d.ts",
|
||||
"angular-tests.ts",
|
||||
"test/jquery3-merging-tests.ts"
|
||||
],
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6",
|
||||
"dom"
|
||||
"es5",
|
||||
"dom",
|
||||
"es2015.iterable"
|
||||
],
|
||||
"noImplicitAny": false,
|
||||
"noImplicitThis": false,
|
||||
@@ -20,4 +23,4 @@
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -576,7 +576,6 @@ barProm = fooArrProm.spread<Bar>((one: Foo, two: Bar, twotwo: Foo) => {
|
||||
//TODO fix collection inference
|
||||
|
||||
barArrProm = fooProm.all<Bar>();
|
||||
objProm = fooProm.props();
|
||||
fooInspectionPromise = fooProm.reflect();
|
||||
barProm = fooProm.any<Bar>();
|
||||
barArrProm = fooProm.some<Bar>(num);
|
||||
@@ -584,6 +583,17 @@ barProm = fooProm.race<Bar>();
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
var propsValue: { num: number, str: string };
|
||||
Promise.resolve({ num: 1, str: Promise.resolve('a') }).props().then(val => { propsValue = val });
|
||||
Promise.props({ num: 1, str: Promise.resolve('a') }).then(val => { propsValue = val });
|
||||
Promise.props(Promise.props({ num: 1, str: Promise.resolve('a') })).then(val => { propsValue = val });
|
||||
|
||||
var propsMapValue: Map<number, string>;
|
||||
Promise.resolve(new Map<number, Promise<string>>()).props().then(val => { propsMapValue = val });
|
||||
Promise.props(new Map<number, Promise<string>>()).then(val => { propsMapValue = val });
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
Promise.all([fooProm, barProm]).then(result => {
|
||||
result[0].foo();
|
||||
result[1].bar();
|
||||
|
||||
Vendored
+9
-5
@@ -620,8 +620,8 @@ declare class Bluebird<R> implements PromiseLike<R>, Bluebird.Inspection<R> {
|
||||
/**
|
||||
* Same as calling `Promise.props(thisPromise)`. With the exception that if this promise is bound to a value, the returned promise is bound to that value too.
|
||||
*/
|
||||
// TODO how to model instance.props()?
|
||||
props(): Bluebird<Object>;
|
||||
props<K, V>(this: PromiseLike<Map<K, Bluebird.Thenable<V> | V>>): Bluebird<Map<K, V>>;
|
||||
props<T>(this: PromiseLike<Bluebird.ResolvableProps<T>>): Bluebird<T>;
|
||||
|
||||
/**
|
||||
* Same as calling `Promise.any(thisPromise)`. With the exception that if this promise is bound to a value, the returned promise is bound to that value too.
|
||||
@@ -806,11 +806,13 @@ declare class Bluebird<R> implements PromiseLike<R>, Bluebird.Inspection<R> {
|
||||
*
|
||||
* *The original object is not modified.*
|
||||
*/
|
||||
// TODO verify this is correct
|
||||
// trusted promise for object
|
||||
static props(object: Bluebird<Object>): Bluebird<Object>;
|
||||
static props<K, V>(map: PromiseLike<Map<K, PromiseLike<V> | V>>): Bluebird<Map<K, V>>;
|
||||
static props<T>(object: PromiseLike<Bluebird.ResolvableProps<T>>): Bluebird<T>;
|
||||
// map
|
||||
static props<K, V>(map: Map<K, PromiseLike<V> | V>): Bluebird<Map<K, V>>;
|
||||
// object
|
||||
static props(object: Object): Bluebird<Object>;
|
||||
static props<T>(object: Bluebird.ResolvableProps<T>): Bluebird<T>;
|
||||
|
||||
/**
|
||||
* Like `Promise.some()`, with 1 as `count`. However, if the promise fulfills, the fulfillment value is not an array of 1 but the value directly.
|
||||
@@ -1074,6 +1076,8 @@ declare namespace Bluebird {
|
||||
/** @deprecated Use PromiseLike<T> directly. */
|
||||
export type Thenable<T> = PromiseLike<T>;
|
||||
|
||||
export type ResolvableProps<T> = object & { [K in keyof T]: PromiseLike<T[K]> | T[K] };
|
||||
|
||||
export interface Resolver<R> {
|
||||
/**
|
||||
* Returns a reference to the controlled promise that can be passed to clients.
|
||||
|
||||
Vendored
+237
-2
@@ -1,6 +1,6 @@
|
||||
// Type definitions for core-js 0.9
|
||||
// Project: https://github.com/zloirock/core-js/
|
||||
// Definitions by: Ron Buckton <http://github.com/rbuckton>
|
||||
// Definitions by: Ron Buckton <http://github.com/rbuckton>, Michel Felipe <http://github.com/mfdeveloper>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.1
|
||||
|
||||
@@ -50,7 +50,10 @@ declare function $for<T>(iterable: Iterable<T>): $for<T>;
|
||||
// ECMAScript 7
|
||||
// Modules: es7.array.includes, es7.string.at, es7.string.pad-start, es7.string.pad-end,
|
||||
// es7.object.to-array, es7.object.get-own-property-descriptors, es7.regexp.escape,
|
||||
// es7.map.to-json, and es7.set.to-json
|
||||
// es7.map.to-json, es7.set.to-json, es7.reflect.define-metadata, es7.reflect.delete-metadata
|
||||
// es7.reflect.get-metadata, es7.reflect.get-metadata-keys, es7.reflect.get-own-metadata,
|
||||
// es7.reflect.get-own-metadata-keys, es7.reflect.has-metadata, es7.reflect.has-own-metadata
|
||||
// es7.reflect.metadata
|
||||
// #############################################################################################
|
||||
|
||||
interface String {
|
||||
@@ -473,6 +476,202 @@ declare namespace core {
|
||||
function preventExtensions(target: any): boolean;
|
||||
function set(target: any, propertyKey: PropertyKey, value: any, receiver?: any): boolean;
|
||||
function setPrototypeOf(target: any, proto: any): boolean;
|
||||
/**
|
||||
* Define a unique metadata entry on the target.
|
||||
* @param metadataKey A key used to store and retrieve metadata.
|
||||
* @param metadataValue A value that contains attached metadata.
|
||||
* @param target The target object on which to define metadata.
|
||||
* @example
|
||||
*
|
||||
* ### Example
|
||||
*
|
||||
* ```typescript
|
||||
* class Example {
|
||||
* }
|
||||
*
|
||||
* // constructor
|
||||
* Reflect.defineMetadata("custom:annotation", options, Example);
|
||||
*
|
||||
* // decorator factory as metadata-producing annotation.
|
||||
* function MyAnnotation(options): ClassDecorator {
|
||||
* return target => Reflect.defineMetadata("custom:annotation", options, target);
|
||||
* }
|
||||
* ```
|
||||
*/
|
||||
function defineMetadata(metadataKey: any, metadataValue: any, target: Object, targetKey?: string | symbol): void;
|
||||
/**
|
||||
* Deletes the metadata entry from the target object with the provided key.
|
||||
* @param metadataKey A key used to store and retrieve metadata.
|
||||
* @param target The target object on which the metadata is defined.
|
||||
* @returns `true` if the metadata entry was found and deleted; otherwise, false.
|
||||
* @example
|
||||
*
|
||||
* ### Example
|
||||
*
|
||||
* ```typescript
|
||||
* class Example {
|
||||
* }
|
||||
*
|
||||
* // constructor
|
||||
* result = Reflect.deleteMetadata("custom:annotation", Example);
|
||||
* ```
|
||||
*/
|
||||
function deleteMetadata(metadataKey: any, target: Object, targetKey?: string | symbol): boolean;
|
||||
/**
|
||||
* Gets the metadata value for the provided metadata key on the target object or its prototype chain.
|
||||
* @param metadataKey A key used to store and retrieve metadata.
|
||||
* @param target The target object on which the metadata is defined.
|
||||
* @returns The metadata value for the metadata key if found; otherwise, `undefined`.
|
||||
* @example
|
||||
*
|
||||
* ### Example
|
||||
*
|
||||
* ```typescript
|
||||
* class Example {
|
||||
* }
|
||||
*
|
||||
* // constructor
|
||||
* result = Reflect.getMetadata("custom:annotation", Example);
|
||||
* ```
|
||||
*/
|
||||
function getMetadata(metadataKey: any, target: Object, targetKey?: string | symbol): any;
|
||||
/**
|
||||
* Gets the metadata keys defined on the target object or its prototype chain.
|
||||
* @param target The target object on which the metadata is defined.
|
||||
* @returns An array of unique metadata keys.
|
||||
* @example
|
||||
*
|
||||
* ### Example
|
||||
*
|
||||
* ```typescript
|
||||
* class Example {
|
||||
* }
|
||||
*
|
||||
* // constructor
|
||||
* result = Reflect.getMetadataKeys(Example);
|
||||
* ```
|
||||
*/
|
||||
function getMetadataKeys(target: Object, targetKey?: string | symbol): any[];
|
||||
/**
|
||||
* Gets the metadata value for the provided metadata key on the target object.
|
||||
* @param metadataKey A key used to store and retrieve metadata.
|
||||
* @param target The target object on which the metadata is defined.
|
||||
* @returns The metadata value for the metadata key if found; otherwise, `undefined`.
|
||||
* @example
|
||||
*
|
||||
* ### Example
|
||||
*
|
||||
* ```typescript
|
||||
* class Example {
|
||||
* }
|
||||
*
|
||||
* // constructor
|
||||
* result = Reflect.getOwnMetadata("custom:annotation", Example);
|
||||
* ```
|
||||
*/
|
||||
function getOwnMetadata(metadataKey: any, target: Object, targetKey?: string | symbol): any;
|
||||
|
||||
/**
|
||||
* Gets the unique metadata keys defined on the target object.
|
||||
* @param target The target object on which the metadata is defined.
|
||||
* @returns An array of unique metadata keys.
|
||||
* @example
|
||||
*
|
||||
* ### Example
|
||||
*
|
||||
* ```typescript
|
||||
* class Example {
|
||||
* }
|
||||
*
|
||||
* // constructor
|
||||
* result = Reflect.getOwnMetadataKeys(Example);
|
||||
* ```
|
||||
*/
|
||||
function getOwnMetadataKeys(target: Object, targetKey?: string | symbol): any[];
|
||||
/**
|
||||
* Gets a value indicating whether the target object or its prototype chain has the provided metadata key defined.
|
||||
* @param metadataKey A key used to store and retrieve metadata.
|
||||
* @param target The target object on which the metadata is defined.
|
||||
* @returns `true` if the metadata key was defined on the target object or its prototype chain; otherwise, `false`.
|
||||
* @example
|
||||
*
|
||||
* ### Example
|
||||
*
|
||||
* ```typescript
|
||||
* class Example {
|
||||
* }
|
||||
*
|
||||
* // constructor
|
||||
* result = Reflect.hasMetadata("custom:annotation", Example);
|
||||
* ```
|
||||
*/
|
||||
function hasMetadata(metadataKey: any, target: Object, targetKey?: string | symbol): boolean;
|
||||
/**
|
||||
* Gets a value indicating whether the target object has the provided metadata key defined.
|
||||
* @param metadataKey A key used to store and retrieve metadata.
|
||||
* @param target The target object on which the metadata is defined.
|
||||
* @returns `true` if the metadata key was defined on the target object; otherwise, `false`.
|
||||
* @example
|
||||
*
|
||||
* ### Example
|
||||
*
|
||||
* ```typescript
|
||||
*
|
||||
* class Example {
|
||||
* }
|
||||
*
|
||||
* // constructor
|
||||
* result = Reflect.hasOwnMetadata("custom:annotation", Example);
|
||||
* ```
|
||||
*/
|
||||
function hasOwnMetadata(metadataKey: any, target: Object, targetKey?: string | symbol): boolean;
|
||||
/**
|
||||
* A default metadata decorator factory that can be used on a class, class member, or parameter.
|
||||
* @param metadataKey The key for the metadata entry.
|
||||
* @param metadataValue The value for the metadata entry.
|
||||
* @returns A decorator function.
|
||||
* @remarks
|
||||
* If `metadataKey` is already defined for the target and target key, the
|
||||
* metadataValue for that key will be overwritten.
|
||||
* @example
|
||||
*
|
||||
* ### Example
|
||||
*
|
||||
* ```typescript
|
||||
* // constructor
|
||||
* @Reflect.metadata(key, value)
|
||||
* class Example {
|
||||
* }
|
||||
*
|
||||
* // property (on constructor, TypeScript only)
|
||||
* class Example {
|
||||
* @Reflect.metadata(key, value)
|
||||
* static staticProperty;
|
||||
* }
|
||||
*
|
||||
* // property (on prototype, TypeScript only)
|
||||
* class Example {
|
||||
* @Reflect.metadata(key, value)
|
||||
* property;
|
||||
* }
|
||||
*
|
||||
* // method (on constructor)
|
||||
* class Example {
|
||||
* @Reflect.metadata(key, value)
|
||||
* static staticMethod() { }
|
||||
* }
|
||||
*
|
||||
* // method (on prototype)
|
||||
* class Example {
|
||||
* @Reflect.metadata(key, value)
|
||||
* method() { }
|
||||
* }
|
||||
* ```
|
||||
*/
|
||||
function metadata(metadataKey: any, metadataValue: any): {
|
||||
(target: Function): void;
|
||||
(target: Object, targetKey: string | symbol): void;
|
||||
};
|
||||
}
|
||||
|
||||
const Object: {
|
||||
@@ -1991,6 +2190,42 @@ declare module "core-js/library/fn/reflect/set-prototype-of" {
|
||||
const setPrototypeOf: typeof core.Reflect.setPrototypeOf;
|
||||
export = setPrototypeOf;
|
||||
}
|
||||
declare module "core-js/library/fn/reflect/es7/define-metadata" {
|
||||
const defineMetadata: typeof core.Reflect.defineMetadata;
|
||||
export = defineMetadata;
|
||||
}
|
||||
declare module "core-js/library/fn/reflect/es7/delete-metadata" {
|
||||
const deleteMetadata: typeof core.Reflect.deleteMetadata;
|
||||
export = deleteMetadata;
|
||||
}
|
||||
declare module "core-js/library/fn/reflect/es7/get-metadata" {
|
||||
const getMetadata: typeof core.Reflect.getMetadata;
|
||||
export = getMetadata;
|
||||
}
|
||||
declare module "core-js/library/fn/reflect/es7/get-metadata-keys" {
|
||||
const getMetadataKeys: typeof core.Reflect.getMetadataKeys;
|
||||
export = getMetadataKeys;
|
||||
}
|
||||
declare module "core-js/library/fn/reflect/es7/get-own-metadata" {
|
||||
const getOwnMetadata: typeof core.Reflect.getOwnMetadata;
|
||||
export = getOwnMetadata;
|
||||
}
|
||||
declare module "core-js/library/fn/reflect/es7/get-own-metadata-keys'" {
|
||||
const getOwnMetadataKeys: typeof core.Reflect.getOwnMetadataKeys;
|
||||
export = getOwnMetadataKeys;
|
||||
}
|
||||
declare module "core-js/library/fn/reflect/es7/has-metadata'" {
|
||||
const hasMetadata: typeof core.Reflect.hasMetadata;
|
||||
export = hasMetadata;
|
||||
}
|
||||
declare module "core-js/library/fn/reflect/es7/has-own-metadata'" {
|
||||
const hasOwnMetadata: typeof core.Reflect.hasOwnMetadata;
|
||||
export = hasOwnMetadata;
|
||||
}
|
||||
declare module "core-js/library/fn/reflect/es7/metadata'" {
|
||||
const metadata: typeof core.Reflect.metadata;
|
||||
export = metadata;
|
||||
}
|
||||
declare module "core-js/library/fn/regexp" {
|
||||
const RegExp: typeof core.RegExp;
|
||||
export = RegExp;
|
||||
|
||||
Vendored
+1
-1
@@ -54,7 +54,7 @@ declare namespace Draft {
|
||||
* These props are analagous to `value` and `onChange` in controlled React
|
||||
* text inputs.
|
||||
*/
|
||||
interface DraftEditorProps {
|
||||
export interface DraftEditorProps {
|
||||
editorState: EditorState;
|
||||
onChange(editorState: EditorState): void;
|
||||
|
||||
|
||||
Vendored
+118
-118
@@ -13,75 +13,75 @@ declare module Elasticsearch {
|
||||
nodes: Nodes;
|
||||
snapshot: Snapshot;
|
||||
tasks: Tasks;
|
||||
bulk(params: BulkIndexDocumentsParams): PromiseLike<any>;
|
||||
bulk(params: BulkIndexDocumentsParams): Promise<any>;
|
||||
bulk(params: BulkIndexDocumentsParams, callback: (error: any, response: any) => void): void;
|
||||
clearScroll(params: ClearScrollParams, callback: (error: any, response: any) => void): void;
|
||||
clearScroll(params: ClearScrollParams): PromiseLike<any>;
|
||||
clearScroll(params: ClearScrollParams): Promise<any>;
|
||||
count(params: CountParams, callback: (error: any, response: CountResponse) => void): void;
|
||||
count(params: CountParams): PromiseLike<CountResponse>;
|
||||
create(params: CreateDocumentParams): PromiseLike<CreateDocumentResponse>;
|
||||
count(params: CountParams): Promise<CountResponse>;
|
||||
create(params: CreateDocumentParams): Promise<CreateDocumentResponse>;
|
||||
create(params: CreateDocumentParams, callback: (err: any, response: CreateDocumentResponse, status: any) => void): void;
|
||||
delete(params: DeleteDocumentParams): PromiseLike<DeleteDocumentResponse>;
|
||||
delete(params: DeleteDocumentParams): Promise<DeleteDocumentResponse>;
|
||||
delete(params: DeleteDocumentParams, callback: (error: any, response: DeleteDocumentResponse) => void): void;
|
||||
deleteByQuery(params: DeleteDocumentByQueryParams): PromiseLike<DeleteDocumentByQueryResponse>;
|
||||
deleteByQuery(params: DeleteDocumentByQueryParams): Promise<DeleteDocumentByQueryResponse>;
|
||||
deleteByQuery(params: DeleteDocumentByQueryParams, callback: (error: any, response: DeleteDocumentByQueryResponse) => void): void;
|
||||
deleteScript(params: DeleteScriptParams): PromiseLike<any>;
|
||||
deleteScript(params: DeleteScriptParams): Promise<any>;
|
||||
deleteScript(params: DeleteScriptParams, callback: (error: any, response: any) => void): void;
|
||||
deleteTemplate(params: DeleteTemplateParams): PromiseLike<any>;
|
||||
deleteTemplate(params: DeleteTemplateParams): Promise<any>;
|
||||
deleteTemplate(params: DeleteTemplateParams, callback: (error: any, response: any) => void): void;
|
||||
exists(params: ExistsParams): PromiseLike<any>;
|
||||
exists(params: ExistsParams): Promise<any>;
|
||||
exists(params: ExistsParams, callback: (error: any, response: any, status?: any) => void): void;
|
||||
explain(params: ExplainParams): PromiseLike<ExplainResponse>;
|
||||
explain(params: ExplainParams): Promise<ExplainResponse>;
|
||||
explain(params: ExplainParams, callback: (error: any, response: ExplainResponse) => void): void;
|
||||
fieldStats(params: FieldStatsParams): PromiseLike<FieldStatsResponse>;
|
||||
fieldStats(params: FieldStatsParams): Promise<FieldStatsResponse>;
|
||||
fieldStats(params: FieldStatsParams, callback: (error: any, response: FieldStatsResponse) => void): void;
|
||||
get<T>(params: GetParams, callback: (error: any, response: GetResponse<T>) => void): void;
|
||||
get<T>(params: GetParams): PromiseLike<GetResponse<T>>;
|
||||
getScript(params: GetScriptParams): PromiseLike<any>;
|
||||
get<T>(params: GetParams): Promise<GetResponse<T>>;
|
||||
getScript(params: GetScriptParams): Promise<any>;
|
||||
getScript(params: GetScriptParams, callback: (error: any, response: any) => void): void;
|
||||
getSource(params: GetSourceParams): PromiseLike<any>;
|
||||
getSource(params: GetSourceParams): Promise<any>;
|
||||
getSource(params: GetSourceParams, callback: (error: any, response: any) => void): void;
|
||||
getTemplate(params: GetTemplateParams): PromiseLike<any>;
|
||||
getTemplate(params: GetTemplateParams): Promise<any>;
|
||||
getTemplate(params: GetTemplateParams, callback: (error: any, response: any) => void): void;
|
||||
index<T>(params: IndexDocumentParams<T>): PromiseLike<any>;
|
||||
index<T>(params: IndexDocumentParams<T>): Promise<any>;
|
||||
index<T>(params: IndexDocumentParams<T>, callback: (error: any, response: any) => void): void;
|
||||
info(params: InfoParams): PromiseLike<any>;
|
||||
info(params: InfoParams): Promise<any>;
|
||||
info(params: InfoParams, callback: (error: any, response: any) => void): void;
|
||||
mget<T>(params: MGetParams, callback: (error: any, response: MGetResponse<T>) => void): void;
|
||||
mget<T>(params: MGetParams): PromiseLike<MGetResponse<T>>;
|
||||
mget<T>(params: MGetParams): Promise<MGetResponse<T>>;
|
||||
msearch<T>(params: MSearchParams, callback: (error: any, response: MSearchResponse<T>) => void): void;
|
||||
msearch<T>(params: MSearchParams): PromiseLike<MSearchResponse<T>>;
|
||||
msearch<T>(params: MSearchParams): Promise<MSearchResponse<T>>;
|
||||
msearchTemplate<T>(params: MSearchTemplateParams, callback: (error: any, response: MSearchResponse<T>) => void): void;
|
||||
msearchTemplate<T>(params: MSearchTemplateParams): PromiseLike<MSearchResponse<T>>;
|
||||
mtermvectors(params: MTermVectorsParams): PromiseLike<any>;
|
||||
msearchTemplate<T>(params: MSearchTemplateParams): Promise<MSearchResponse<T>>;
|
||||
mtermvectors(params: MTermVectorsParams): Promise<any>;
|
||||
mtermvectors(params: MTermVectorsParams, callback: (error: any, response: any) => void): void;
|
||||
ping(params: PingParams): PromiseLike<any>;
|
||||
ping(params: PingParams): Promise<any>;
|
||||
ping(params: PingParams, callback: (err: any, response: any, status: any) => void): void;
|
||||
putScript(params: PutScriptParams): PromiseLike<any>;
|
||||
putScript(params: PutScriptParams): Promise<any>;
|
||||
putScript(params: PutScriptParams, callback: (err: any, response: any, status: any) => void): void;
|
||||
putTemplate(params: PutTemplateParams): PromiseLike<any>;
|
||||
putTemplate(params: PutTemplateParams): Promise<any>;
|
||||
putTemplate(params: PutTemplateParams, callback: (err: any, response: any, status: any) => void): void;
|
||||
reindex(params: ReindexParams): PromiseLike<ReindexResponse>;
|
||||
reindex(params: ReindexParams): Promise<ReindexResponse>;
|
||||
reindex(params: ReindexParams, callback: (error: any, response: ReindexResponse) => void): void;
|
||||
reindexRethrottle(params: ReindexRethrottleParams): PromiseLike<any>;
|
||||
reindexRethrottle(params: ReindexRethrottleParams): Promise<any>;
|
||||
reindexRethrottle(params: ReindexRethrottleParams, callback: (error: any, response: any) => void): void;
|
||||
renderSearchTemplate(params: RenderSearchTemplateParams): PromiseLike<any>;
|
||||
renderSearchTemplate(params: RenderSearchTemplateParams): Promise<any>;
|
||||
renderSearchTemplate(params: RenderSearchTemplateParams, callback: (error: any, response: any) => void): void;
|
||||
scroll(params: ScrollParams): PromiseLike<any>;
|
||||
scroll(params: ScrollParams, callback: (error: any, response: any) => void): void;
|
||||
search<T>(params: SearchParams): PromiseLike<SearchResponse<T>>;
|
||||
scroll<T>(params: ScrollParams): Promise<SearchResponse<T>>;
|
||||
scroll<T>(params: ScrollParams, callback: (error: any, response: SearchResponse<T>) => void): void;
|
||||
search<T>(params: SearchParams): Promise<SearchResponse<T>>;
|
||||
search<T>(params: SearchParams, callback: (error: any, response: SearchResponse<T>) => void): void;
|
||||
searchShards(params: SearchShardsParams): PromiseLike<SearchShardsResponse>;
|
||||
searchShards(params: SearchShardsParams): Promise<SearchShardsResponse>;
|
||||
searchShards(params: SearchShardsParams, callback: (error: any, response: SearchShardsResponse) => void): void;
|
||||
searchTemplate(params: SearchTemplateParams): PromiseLike<any>;
|
||||
searchTemplate(params: SearchTemplateParams): Promise<any>;
|
||||
searchTemplate(params: SearchTemplateParams, callback: (error: any, response: any) => void): void;
|
||||
suggest(params: SuggestParams): PromiseLike<any>;
|
||||
suggest(params: SuggestParams): Promise<any>;
|
||||
suggest(params: SuggestParams, callback: (error: any, response: any) => void): void;
|
||||
termvectors(params: TermvectorsParams): PromiseLike<any>;
|
||||
termvectors(params: TermvectorsParams): Promise<any>;
|
||||
termvectors(params: TermvectorsParams, callback: (error: any, response: any) => void): void;
|
||||
update(params: UpdateDocumentParams): PromiseLike<any>;
|
||||
update(params: UpdateDocumentParams): Promise<any>;
|
||||
update(params: UpdateDocumentParams, callback: (error: any, response: any) => void): void;
|
||||
updateByQuery(params: UpdateDocumentByQueryParams): PromiseLike<any>;
|
||||
updateByQuery(params: UpdateDocumentByQueryParams): Promise<any>;
|
||||
updateByQuery(params: UpdateDocumentByQueryParams, callback: (error: any, response: any) => void): void;
|
||||
}
|
||||
|
||||
@@ -774,43 +774,43 @@ declare module Elasticsearch {
|
||||
|
||||
export interface Cat {
|
||||
aliases(params: CatAliasesParams, callback: (error: any, response: any) => void): void;
|
||||
aliases(params: CatAliasesParams): PromiseLike<any>;
|
||||
aliases(params: CatAliasesParams): Promise<any>;
|
||||
allocation(params: CatAllocationParams, callback: (error: any, response: any) => void): void;
|
||||
allocation(params: CatAllocationParams): PromiseLike<any>;
|
||||
allocation(params: CatAllocationParams): Promise<any>;
|
||||
count(params: CatCountParams, callback: (error: any, response: any) => void): void;
|
||||
count(params: CatAllocationParams): PromiseLike<any>;
|
||||
count(params: CatAllocationParams): Promise<any>;
|
||||
fielddata(params: CatFielddataParams, callback: (error: any, response: any) => void): void;
|
||||
fielddata(params: CatFielddataParams): PromiseLike<any>;
|
||||
fielddata(params: CatFielddataParams): Promise<any>;
|
||||
health(params: CatHealthParams, callback: (error: any, response: any) => void): void;
|
||||
health(params: CatHealthParams): PromiseLike<any>;
|
||||
health(params: CatHealthParams): Promise<any>;
|
||||
help(params: CatHelpParams, callback: (error: any, response: any) => void): void;
|
||||
help(params: CatHelpParams): PromiseLike<any>;
|
||||
help(params: CatHelpParams): Promise<any>;
|
||||
indices(params: CatIndicesParams, callback: (error: any, response: any) => void): void;
|
||||
indices(params: CatIndicesParams): PromiseLike<any>;
|
||||
indices(params: CatIndicesParams): Promise<any>;
|
||||
master(params: CatCommonParams, callback: (error: any, response: any) => void): void;
|
||||
master(params: CatCommonParams): PromiseLike<any>;
|
||||
master(params: CatCommonParams): Promise<any>;
|
||||
nodeattrs(params: CatCommonParams, callback: (error: any, response: any) => void): void;
|
||||
nodeattrs(params: CatCommonParams): PromiseLike<any>;
|
||||
nodeattrs(params: CatCommonParams): Promise<any>;
|
||||
nodes(params: CatCommonParams, callback: (error: any, response: any) => void): void;
|
||||
nodes(params: CatCommonParams): PromiseLike<any>;
|
||||
nodes(params: CatCommonParams): Promise<any>;
|
||||
pendingTasks(params: CatCommonParams, callback: (error: any, response: any) => void): void;
|
||||
pendingTasks(params: CatCommonParams): PromiseLike<any>;
|
||||
pendingTasks(params: CatCommonParams): Promise<any>;
|
||||
plugins(params: CatCommonParams, callback: (error: any, response: any) => void): void;
|
||||
plugins(params: CatCommonParams): PromiseLike<any>;
|
||||
plugins(params: CatCommonParams): Promise<any>;
|
||||
recovery(params: CatRecoveryParams, callback: (error: any, response: any) => void): void;
|
||||
recovery(params: CatRecoveryParams): PromiseLike<any>;
|
||||
recovery(params: CatRecoveryParams): Promise<any>;
|
||||
repositories(params: CatCommonParams, callback: (error: any, response: any) => void): void;
|
||||
repositories(params: CatCommonParams): PromiseLike<any>;
|
||||
repositories(params: CatCommonParams): Promise<any>;
|
||||
segments(params: CatSegmentsParams, callback: (error: any, response: any) => void): void;
|
||||
segments(params: CatSegmentsParams): PromiseLike<any>;
|
||||
segments(params: CatSegmentsParams): Promise<any>;
|
||||
shards(params: CatShardsParams, callback: (error: any, response: any) => void): void;
|
||||
shards(params: CatShardsParams): PromiseLike<any>;
|
||||
shards(params: CatShardsParams): Promise<any>;
|
||||
snapshots(params: CatSnapshotsParams, callback: (error: any, response: any) => void): void;
|
||||
snapshots(params: CatSnapshotsParams): PromiseLike<any>;
|
||||
snapshots(params: CatSnapshotsParams): Promise<any>;
|
||||
tasks(params: CatTasksParams, callback: (error: any, response: any) => void): void;
|
||||
tasks(params: CatTasksParams): PromiseLike<any>;
|
||||
tasks(params: CatTasksParams): Promise<any>;
|
||||
threadPool(params: CatThreadPoolParams, callback: (error: any, response: any) => void): void;
|
||||
threadPool(params: CatThreadPoolParams): PromiseLike<any>;
|
||||
threadPool(params: CatThreadPoolParams): Promise<any>;
|
||||
}
|
||||
|
||||
export type CatBytes = "b" | "k" | "kb" | "m" | "mb" | "g" | "gb" | "t" | "tb" | "p" | "pb";
|
||||
@@ -907,21 +907,21 @@ declare module Elasticsearch {
|
||||
|
||||
export interface Cluster {
|
||||
allocationExplain(params: ClusterAllocationExplainParams, callback: (error: any, response: any) => void): void;
|
||||
allocationExplain(params: ClusterAllocationExplainParams): PromiseLike<any>;
|
||||
allocationExplain(params: ClusterAllocationExplainParams): Promise<any>;
|
||||
getSettings(params: ClusterGetSettingsParams, callback: (error: any, response: any) => void): void;
|
||||
getSettings(params: ClusterGetSettingsParams): PromiseLike<any>;
|
||||
getSettings(params: ClusterGetSettingsParams): Promise<any>;
|
||||
health(params: ClusterHealthParams, callback: (error: any, response: any) => void): void;
|
||||
health(params: ClusterHealthParams): PromiseLike<any>;
|
||||
health(params: ClusterHealthParams): Promise<any>;
|
||||
pendingTasks(params: ClusterPendingTasksParams, callback: (error: any, response: any) => void): void;
|
||||
pendingTasks(params: ClusterPendingTasksParams): PromiseLike<any>;
|
||||
pendingTasks(params: ClusterPendingTasksParams): Promise<any>;
|
||||
putSettings(params: ClusterPutSettingsParams, callback: (error: any, response: any) => void): void;
|
||||
putSettings(params: ClusterPutSettingsParams): PromiseLike<any>;
|
||||
putSettings(params: ClusterPutSettingsParams): Promise<any>;
|
||||
reroute(params: ClusterRerouteParams, callback: (error: any, response: any) => void): void;
|
||||
reroute(params: ClusterRerouteParams): PromiseLike<any>;
|
||||
reroute(params: ClusterRerouteParams): Promise<any>;
|
||||
state(params: ClusterStateParams, callback: (error: any, response: any) => void): void;
|
||||
state(params: ClusterStateParams): PromiseLike<any>;
|
||||
state(params: ClusterStateParams): Promise<any>;
|
||||
stats(params: ClusterStatsParams, callback: (error: any, response: any) => void): void;
|
||||
stats(params: ClusterStatsParams): PromiseLike<any>;
|
||||
stats(params: ClusterStatsParams): Promise<any>;
|
||||
}
|
||||
|
||||
export interface ClusterAllocationExplainParams extends GenericParams {
|
||||
@@ -988,77 +988,77 @@ declare module Elasticsearch {
|
||||
|
||||
export class Indices {
|
||||
analyze(params: IndicesAnalyzeParams, callback: (error: any, response: any, status: any) => void): void;
|
||||
analyze(params: IndicesAnalyzeParams): PromiseLike<any>;
|
||||
analyze(params: IndicesAnalyzeParams): Promise<any>;
|
||||
clearCache(params: IndicesClearCacheParams, callback: (error: any, response: any, status: any) => void): void;
|
||||
clearCache(params: IndicesClearCacheParams): PromiseLike<any>;
|
||||
clearCache(params: IndicesClearCacheParams): Promise<any>;
|
||||
close(params: IndicesCloseParams, callback: (error: any, response: any, status: any) => void): void;
|
||||
close(params: IndicesCloseParams): PromiseLike<any>;
|
||||
close(params: IndicesCloseParams): Promise<any>;
|
||||
create(params: IndicesCreateParams, callback: (error: any, response: any, status: any) => void): void;
|
||||
create(params: IndicesCreateParams): PromiseLike<any>;
|
||||
create(params: IndicesCreateParams): Promise<any>;
|
||||
delete(params: IndicesDeleteParams, callback: (error: any, response: any, status: any) => void): void;
|
||||
delete(params: IndicesDeleteParams): PromiseLike<any>;
|
||||
delete(params: IndicesDeleteParams): Promise<any>;
|
||||
deleteAlias(params: IndicesDeleteAliasParams, callback: (error: any, response: any, status: any) => void): void;
|
||||
deleteAlias(params: IndicesDeleteAliasParams): PromiseLike<any>;
|
||||
deleteAlias(params: IndicesDeleteAliasParams): Promise<any>;
|
||||
deleteTemplate(params: IndicesDeleteTemplateParams, callback: (error: any, response: any, status: any) => void): void;
|
||||
deleteTemplate(params: IndicesDeleteTemplateParams): PromiseLike<any>;
|
||||
deleteTemplate(params: IndicesDeleteTemplateParams): Promise<any>;
|
||||
exists(params: IndicesExistsParams, callback: (error: any, response: any, status: any) => void): void;
|
||||
exists(params: IndicesExistsParams): PromiseLike<any>;
|
||||
exists(params: IndicesExistsParams): Promise<any>;
|
||||
existsAlias(params: IndicesExistsAliasParams, callback: (error: any, response: any, status: any) => void): void;
|
||||
existsAlias(params: IndicesExistsAliasParams): PromiseLike<any>;
|
||||
existsAlias(params: IndicesExistsAliasParams): Promise<any>;
|
||||
existsTemplate(params: IndicesExistsTemplateParams, callback: (error: any, response: any, status: any) => void): void;
|
||||
existsTemplate(params: IndicesExistsTemplateParams): PromiseLike<any>;
|
||||
existsTemplate(params: IndicesExistsTemplateParams): Promise<any>;
|
||||
existsType(params: IndicesExistsTypeParams, callback: (error: any, response: any, status: any) => void): void;
|
||||
existsType(params: IndicesExistsTypeParams): PromiseLike<any>;
|
||||
existsType(params: IndicesExistsTypeParams): Promise<any>;
|
||||
flush(params: IndicesFlushParams, callback: (error: any, response: any, status: any) => void): void;
|
||||
flush(params: IndicesFlushParams): PromiseLike<any>;
|
||||
flush(params: IndicesFlushParams): Promise<any>;
|
||||
flushSynced(params: IndicesFlushSyncedParams, callback: (error: any, response: any, status: any) => void): void;
|
||||
flushSynced(params: IndicesFlushSyncedParams): PromiseLike<any>;
|
||||
flushSynced(params: IndicesFlushSyncedParams): Promise<any>;
|
||||
forcemerge(params: IndicesForcemergeParams, callback: (error: any, response: any, status: any) => void): void;
|
||||
forcemerge(params: IndicesForcemergeParams): PromiseLike<any>;
|
||||
forcemerge(params: IndicesForcemergeParams): Promise<any>;
|
||||
get(params: IndicesGetParams, callback: (error: any, response: any, status: any) => void): void;
|
||||
get(params: IndicesGetParams): PromiseLike<any>;
|
||||
get(params: IndicesGetParams): Promise<any>;
|
||||
getAlias(params: IndicesGetAliasParams, callback: (error: any, response: any, status: any) => void): void;
|
||||
getAlias(params: IndicesGetAliasParams): PromiseLike<any>;
|
||||
getAlias(params: IndicesGetAliasParams): Promise<any>;
|
||||
getFieldMapping(params: IndicesGetFieldMappingParams, callback: (error: any, response: any, status: any) => void): void;
|
||||
getFieldMapping(params: IndicesGetFieldMappingParams): PromiseLike<any>;
|
||||
getFieldMapping(params: IndicesGetFieldMappingParams): Promise<any>;
|
||||
getMapping(params: IndicesGetMappingParams, callback: (error: any, response: any, status: any) => void): void;
|
||||
getMapping(params: IndicesGetMappingParams): PromiseLike<any>;
|
||||
getMapping(params: IndicesGetMappingParams): Promise<any>;
|
||||
getSettings(params: IndicesGetSettingsParams, callback: (error: any, response: any, status: any) => void): void;
|
||||
getSettings(params: IndicesGetSettingsParams): PromiseLike<any>;
|
||||
getSettings(params: IndicesGetSettingsParams): Promise<any>;
|
||||
getTemplate(params: IndicesGetTemplateParams, callback: (error: any, response: any, status: any) => void): void;
|
||||
getTemplate(params: IndicesGetTemplateParams): PromiseLike<any>;
|
||||
getTemplate(params: IndicesGetTemplateParams): Promise<any>;
|
||||
getUpgrade(params: IndicesGetUpgradeParams, callback: (error: any, response: any, status: any) => void): void;
|
||||
getUpgrade(params: IndicesGetUpgradeParams): PromiseLike<any>;
|
||||
getUpgrade(params: IndicesGetUpgradeParams): Promise<any>;
|
||||
open(params: IndicesOpenParams, callback: (error: any, response: any, status: any) => void): void;
|
||||
open(params: IndicesOpenParams): PromiseLike<any>;
|
||||
open(params: IndicesOpenParams): Promise<any>;
|
||||
putAlias(params: IndicesPutAliasParams, callback: (error: any, response: any, status: any) => void): void;
|
||||
putAlias(params: IndicesPutAliasParams): PromiseLike<any>;
|
||||
putAlias(params: IndicesPutAliasParams): Promise<any>;
|
||||
putMapping(params: IndicesPutMappingParams, callback: (error: any, response: any, status: any) => void): void;
|
||||
putMapping(params: IndicesPutMappingParams): PromiseLike<any>;
|
||||
putMapping(params: IndicesPutMappingParams): Promise<any>;
|
||||
putSettings(params: IndicesPutSettingsParams, callback: (error: any, response: any, status: any) => void): void;
|
||||
putSettings(params: IndicesPutSettingsParams): PromiseLike<any>;
|
||||
putSettings(params: IndicesPutSettingsParams): Promise<any>;
|
||||
putTemplate(params: IndicesPutTemplateParams, callback: (error: any, response: any) => void): void;
|
||||
putTemplate(params: IndicesPutTemplateParams): PromiseLike<any>;
|
||||
putTemplate(params: IndicesPutTemplateParams): Promise<any>;
|
||||
recovery(params: IndicesRecoveryParams, callback: (error: any, response: any) => void): void;
|
||||
recovery(params: IndicesRecoveryParams): PromiseLike<any>;
|
||||
recovery(params: IndicesRecoveryParams): Promise<any>;
|
||||
refresh(params: IndicesRefreshParams, callback: (error: any, response: any) => void): void;
|
||||
refresh(params: IndicesRefreshParams): PromiseLike<any>;
|
||||
refresh(params: IndicesRefreshParams): Promise<any>;
|
||||
rollover(params: IndicesRolloverParams, callback: (error: any, response: IndicesRolloverResponse) => void): void;
|
||||
rollover(params: IndicesRolloverParams): PromiseLike<IndicesRolloverResponse>;
|
||||
rollover(params: IndicesRolloverParams): Promise<IndicesRolloverResponse>;
|
||||
segments(params: IndicesSegmentsParams, callback: (error: any, response: any) => void): void;
|
||||
segments(params: IndicesSegmentsParams): PromiseLike<any>;
|
||||
segments(params: IndicesSegmentsParams): Promise<any>;
|
||||
shardStores(params: IndicesShardStoresParams, callback: (error: any, response: any) => void): void;
|
||||
shardStores(params: IndicesShardStoresParams): PromiseLike<any>;
|
||||
shardStores(params: IndicesShardStoresParams): Promise<any>;
|
||||
shrink(params: IndicesShrinkParams, callback: (error: any, response: any) => void): void;
|
||||
shrink(params: IndicesShrinkParams): PromiseLike<any>;
|
||||
shrink(params: IndicesShrinkParams): Promise<any>;
|
||||
stats(params: IndicesStatsParams, callback: (error: any, response: any) => void): void;
|
||||
stats(params: IndicesStatsParams): PromiseLike<any>;
|
||||
stats(params: IndicesStatsParams): Promise<any>;
|
||||
updateAliases(params: IndicesUpdateAliasesParams, callback: (error: any, response: any) => void): void;
|
||||
updateAliases(params: IndicesUpdateAliasesParams): PromiseLike<any>;
|
||||
updateAliases(params: IndicesUpdateAliasesParams): Promise<any>;
|
||||
upgrade(params: IndicesUpgradeParams, callback: (error: any, response: any) => void): void;
|
||||
upgrade(params: IndicesUpgradeParams): PromiseLike<any>;
|
||||
upgrade(params: IndicesUpgradeParams): Promise<any>;
|
||||
validateQuery(params: IndicesValidateQueryParams, callback: (error: any, response: any) => void): void;
|
||||
validateQuery(params: IndicesValidateQueryParams): PromiseLike<any>;
|
||||
validateQuery(params: IndicesValidateQueryParams): Promise<any>;
|
||||
}
|
||||
|
||||
export interface IndicesAnalyzeParams extends GenericParams {
|
||||
@@ -1416,13 +1416,13 @@ declare module Elasticsearch {
|
||||
|
||||
export class Ingest {
|
||||
deletePipeline(params: IngestDeletePipelineParams, callback: (error: any, response: any, status: any) => void): void;
|
||||
deletePipeline(params: IngestDeletePipelineParams): PromiseLike<any>;
|
||||
deletePipeline(params: IngestDeletePipelineParams): Promise<any>;
|
||||
getPipeline(params: IngestGetPipelineParams, callback: (error: any, response: any, status: any) => void): void;
|
||||
getPipeline(params: IngestGetPipelineParams): PromiseLike<any>;
|
||||
getPipeline(params: IngestGetPipelineParams): Promise<any>;
|
||||
putPipeline(params: IngestPutPipelineParams, callback: (error: any, response: any, status: any) => void): void;
|
||||
putPipeline(params: IngestPutPipelineParams): PromiseLike<any>;
|
||||
putPipeline(params: IngestPutPipelineParams): Promise<any>;
|
||||
simulate(params: IngestSimulateParams, callback: (error: any, response: any, status: any) => void): void;
|
||||
simulate(params: IngestSimulateParams): PromiseLike<any>;
|
||||
simulate(params: IngestSimulateParams): Promise<any>;
|
||||
}
|
||||
|
||||
export interface IngestDeletePipelineParams extends GenericParams {
|
||||
@@ -1450,11 +1450,11 @@ declare module Elasticsearch {
|
||||
|
||||
export class Nodes {
|
||||
hotThreads(params: NodesHotThreadsParams, callback: (error: any, response: any, status: any) => void): void;
|
||||
hotThreads(params: NodesHotThreadsParams): PromiseLike<any>;
|
||||
hotThreads(params: NodesHotThreadsParams): Promise<any>;
|
||||
info(params: NodesInfoParams, callback: (error: any, response: any, status: any) => void): void;
|
||||
info(params: NodesInfoParams): PromiseLike<any>;
|
||||
info(params: NodesInfoParams): Promise<any>;
|
||||
stats(params: NodesStatsParams, callback: (error: any, response: any, status: any) => void): void;
|
||||
stats(params: NodesStatsParams): PromiseLike<any>;
|
||||
stats(params: NodesStatsParams): Promise<any>;
|
||||
}
|
||||
|
||||
export interface NodesHotThreadsParams extends GenericParams {
|
||||
@@ -1491,23 +1491,23 @@ declare module Elasticsearch {
|
||||
|
||||
export class Snapshot {
|
||||
create(params: SnapshotCreateParams, callback: (error: any, response: any, status: any) => void): void;
|
||||
create(params: SnapshotCreateParams): PromiseLike<any>;
|
||||
create(params: SnapshotCreateParams): Promise<any>;
|
||||
createRepository(params: SnapshotCreateRepositoryParams, callback: (error: any, response: any, status: any) => void): void;
|
||||
createRepository(params: SnapshotCreateRepositoryParams): PromiseLike<any>;
|
||||
createRepository(params: SnapshotCreateRepositoryParams): Promise<any>;
|
||||
delete(params: SnapshotDeleteParams, callback: (error: any, response: any, status: any) => void): void;
|
||||
delete(params: SnapshotDeleteParams): PromiseLike<any>;
|
||||
delete(params: SnapshotDeleteParams): Promise<any>;
|
||||
deleteRepository(params: SnapshotDeleteRepositoryParams, callback: (error: any, response: any, status: any) => void): void;
|
||||
deleteRepository(params: SnapshotDeleteRepositoryParams): PromiseLike<any>;
|
||||
deleteRepository(params: SnapshotDeleteRepositoryParams): Promise<any>;
|
||||
get(params: SnapshotGetParams, callback: (error: any, response: any, status: any) => void): void;
|
||||
get(params: SnapshotGetParams): PromiseLike<any>;
|
||||
get(params: SnapshotGetParams): Promise<any>;
|
||||
getRepository(params: SnapshotGetRepositoryParams, callback: (error: any, response: any, status: any) => void): void;
|
||||
getRepository(params: SnapshotGetRepositoryParams): PromiseLike<any>;
|
||||
getRepository(params: SnapshotGetRepositoryParams): Promise<any>;
|
||||
restore(params: SnapshotRestoreParams, callback: (error: any, response: any, status: any) => void): void;
|
||||
restore(params: SnapshotRestoreParams): PromiseLike<any>;
|
||||
restore(params: SnapshotRestoreParams): Promise<any>;
|
||||
status(params: SnapshotStatusParams, callback: (error: any, response: any, status: any) => void): void;
|
||||
status(params: SnapshotStatusParams): PromiseLike<any>;
|
||||
status(params: SnapshotStatusParams): Promise<any>;
|
||||
verifyRepository(params: SnapshotVerifyRepositoryParams, callback: (error: any, response: any, status: any) => void): void;
|
||||
verifyRepository(params: SnapshotVerifyRepositoryParams): PromiseLike<any>;
|
||||
verifyRepository(params: SnapshotVerifyRepositoryParams): Promise<any>;
|
||||
}
|
||||
|
||||
export interface SnapshotCreateParams extends GenericParams {
|
||||
@@ -1571,11 +1571,11 @@ declare module Elasticsearch {
|
||||
|
||||
export class Tasks {
|
||||
cancel(params: TasksCancelParams, callback: (error: any, response: any, status: any) => void): void;
|
||||
cancel(params: TasksCancelParams): PromiseLike<any>;
|
||||
cancel(params: TasksCancelParams): Promise<any>;
|
||||
get(params: TasksGetParams, callback: (error: any, response: any, status: any) => void): void;
|
||||
get(params: TasksGetParams): PromiseLike<any>;
|
||||
get(params: TasksGetParams): Promise<any>;
|
||||
list(params: TasksListParams, callback: (error: any, response: any, status: any) => void): void;
|
||||
list(params: TasksListParams): PromiseLike<any>;
|
||||
list(params: TasksListParams): Promise<any>;
|
||||
}
|
||||
|
||||
export interface TasksCancelParams extends GenericParams {
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
import GoogleMapReact from 'google-map-react';
|
||||
import GoogleMapReact, { BootstrapURLKeys } from 'google-map-react';
|
||||
import * as React from 'react';
|
||||
|
||||
const center = { lat: 0, lng: 0 };
|
||||
|
||||
<GoogleMapReact center={center} zoom={3}/>;
|
||||
const key: BootstrapURLKeys = { key: 'my-google-maps-key' };
|
||||
const client: BootstrapURLKeys = { client: 'my-client-identifier', v: '3.28' , language: 'en' };
|
||||
|
||||
<GoogleMapReact center={center} zoom={3} bootstrapURLKeys={client}/>;
|
||||
|
||||
Vendored
+1
-4
@@ -6,10 +6,7 @@
|
||||
|
||||
import * as React from 'react';
|
||||
|
||||
export interface BootstrapURLKeys {
|
||||
key: string;
|
||||
language?: string;
|
||||
}
|
||||
export type BootstrapURLKeys = ({ key: string; } | { client: string; v: string; }) & { language?: string };
|
||||
|
||||
export interface Options {
|
||||
styles?: any[];
|
||||
|
||||
Vendored
+4
-3
@@ -1935,10 +1935,11 @@ export class Request extends Podium {
|
||||
/** same as pre but represented as the response object created by the pre method. */
|
||||
preResponses: Object;
|
||||
/**
|
||||
* an object containing the query parameters.
|
||||
* TODO update with outcome of: https://github.com/hapijs/hapi/pull/3479
|
||||
* by default the object outputted from [node's URL parse()](https://nodejs.org/docs/latest/api/url.html#url_urlobject_query) method.
|
||||
* Might also be set indirectly via [request.setUrl](https://github.com/DefinitelyTyped/DefinitelyTyped/pull/17354#requestseturlurl-striptrailingslash) in which case it may be
|
||||
* a string (if url is set to an object with the query attribute as an unparsed string).
|
||||
*/
|
||||
query: Object;
|
||||
query: any;
|
||||
/** an object containing the Node HTTP server objects. **Direct interaction with these raw objects is not recommended.** */
|
||||
raw: {
|
||||
req: http.IncomingMessage; // Or http.ClientRequest http://www.apetuts.com/tutorial/node-js-http-client-request-class/ ?
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
// Added test in addition to docs, for request.query
|
||||
|
||||
import * as Hapi from 'hapi';
|
||||
|
||||
interface GetThingQuery {
|
||||
name: string;
|
||||
}
|
||||
|
||||
const handler: Hapi.RouteHandler = function (request, reply) {
|
||||
|
||||
const query = request.query as GetThingQuery;
|
||||
|
||||
return reply(`You asked for ${query.name}`);
|
||||
};
|
||||
@@ -35,6 +35,7 @@
|
||||
"test/request/generate-response.ts",
|
||||
"test/request/get-log.ts",
|
||||
"test/request/log.ts",
|
||||
"test/request/query.ts",
|
||||
"test/request/set-method.ts",
|
||||
"test/request/set-url.ts",
|
||||
"test/request/tail.ts",
|
||||
|
||||
@@ -44,7 +44,7 @@ let map = new H.Map(mapContainer, defaultLayers.normal.map, {
|
||||
// initial center and zoom level of the map
|
||||
zoom: 16,
|
||||
// Champs-Elysees
|
||||
center: {lat: 48.869145, lng: 2.314298}
|
||||
center: { lat: 48.869145, lng: 2.314298 }
|
||||
});
|
||||
|
||||
// Step 3: make the map interactive
|
||||
@@ -85,3 +85,78 @@ let polyline = new H.map.Polyline(new H.geo.Strip());
|
||||
// tslint:disable-next-line:array-type
|
||||
let clipArr: Array<Array<number>>;
|
||||
clipArr = polyline.clip(new H.geo.Rect(5, 5, 5, 5));
|
||||
|
||||
let router = platform.getRoutingService();
|
||||
let calculateRouteParams = {
|
||||
waypoint0: 'geo!52.5,13.4',
|
||||
waypoint1: 'geo!52.5,13.45',
|
||||
mode: 'fastest;car;traffic:disabled'
|
||||
};
|
||||
router.calculateRoute(
|
||||
calculateRouteParams,
|
||||
(result) => {
|
||||
console.log(result.response.route[0]);
|
||||
},
|
||||
(error) => {
|
||||
console.log(error);
|
||||
}
|
||||
);
|
||||
|
||||
let places = platform.getPlacesService();
|
||||
let entryPoint = H.service.PlacesService.EntryPoint;
|
||||
places.request(
|
||||
entryPoint.SEARCH,
|
||||
{
|
||||
at: '52.5044,13.3909',
|
||||
q: 'pizza'
|
||||
},
|
||||
(response) => {
|
||||
console.log(response);
|
||||
let items = response.results.items;
|
||||
places.follow(
|
||||
items[0].href,
|
||||
(resp) => {
|
||||
console.log(resp);
|
||||
},
|
||||
(resp) => {
|
||||
console.log('ERROR: ' + resp);
|
||||
}
|
||||
);
|
||||
},
|
||||
(error) => {
|
||||
console.log('ERROR: ' + error);
|
||||
}
|
||||
);
|
||||
|
||||
let geocoder = platform.getGeocodingService();
|
||||
let geocodingParams: H.service.ServiceParameters = {
|
||||
searchText: '425 W Randolph Street, Chicago'
|
||||
};
|
||||
geocoder.geocode(
|
||||
geocodingParams,
|
||||
(result) => {
|
||||
console.log(result);
|
||||
console.log(result.Response.View[0].Result[0].Location.DisplayPosition);
|
||||
},
|
||||
(error) => {
|
||||
console.log(error);
|
||||
}
|
||||
);
|
||||
|
||||
// deprecated but w/e
|
||||
let enterprieseRouter = platform.getEnterpriseRoutingService();
|
||||
let calculateIsoline: H.service.ServiceParameters = {
|
||||
start: 'geo!52.5,13.4',
|
||||
distance: '1000,2000',
|
||||
mode: 'fastest;car;traffic:disabled'
|
||||
};
|
||||
enterprieseRouter.calculateIsoline(
|
||||
calculateIsoline,
|
||||
(result) => {
|
||||
console.log(result);
|
||||
console.log(result.Response.isolines[0]);
|
||||
},
|
||||
(error) => {
|
||||
console.log(error);
|
||||
}
|
||||
);
|
||||
|
||||
Vendored
+147
-13
@@ -4301,14 +4301,15 @@ declare namespace H {
|
||||
|
||||
/**
|
||||
* This is generic method to query places RestAPI.
|
||||
* @param entryPoint {string} - can be one of available entry points H.service.PlacesService.EntryPoint i.e value of H.service.PlacesService.EntryPoint.SEARCH
|
||||
* @param entryPoint {H.service.PlacesService.EntryPoint} - can be one of available entry points H.service.PlacesService.EntryPoint i.e value of H.service.PlacesService.EntryPoint.SEARCH
|
||||
* @param entryPointParams {Object} - parameter map key value pairs will be transformed into the url key=value parametes. For entry point parameters description please refer to places
|
||||
* restful api documentation documentation for available parameters for chose entry point
|
||||
* @param onResult {Function} - callback which is called when result is returned
|
||||
* @param onError {Function} - callback which is called when error occured (i.e request timeout)
|
||||
* @returns {H.service.JsonpRequestHandle} - jsonp request handle
|
||||
*/
|
||||
request(entryPoint: string, entryPointParams: {}, onResult: () => void, onError: () => void): H.service.JsonpRequestHandle;
|
||||
request(entryPoint: H.service.PlacesService.EntryPoint, entryPointParams: {}, onResult: (result: H.service.ServiceResult) => void, onError: (error: Error) => void):
|
||||
H.service.JsonpRequestHandle;
|
||||
|
||||
/**
|
||||
* Function triggers places api 'search' entry point. Please refer to documentation for parameter specification and response handling.
|
||||
@@ -4317,7 +4318,7 @@ declare namespace H {
|
||||
* @param onError {Function}
|
||||
* @returns {H.service.JsonpRequestHandle} - jsonp request handle
|
||||
*/
|
||||
search(searchParams: H.service.ServiceParameters, onResult: () => void, onError: () => void): H.service.JsonpRequestHandle;
|
||||
search(searchParams: H.service.ServiceParameters, onResult: (result: H.service.ServiceResult) => void, onError: (error: Error) => void): H.service.JsonpRequestHandle;
|
||||
|
||||
/**
|
||||
* Function triggers places api 'suggestions' entry point. Please refer to documentation for parameter specification and response handling.
|
||||
@@ -4326,7 +4327,7 @@ declare namespace H {
|
||||
* @param onError {Function}
|
||||
* @returns {H.service.JsonpRequestHandle} - jsonp request handle
|
||||
*/
|
||||
suggest(suggestParams: H.service.ServiceParameters, onResult: () => void, onError: () => void): H.service.JsonpRequestHandle;
|
||||
suggest(suggestParams: H.service.ServiceParameters, onResult: (result: H.service.ServiceResult) => void, onError: (error: Error) => void): H.service.JsonpRequestHandle;
|
||||
|
||||
/**
|
||||
* Function triggers places api 'explore' entry point. Please refer to documentation for parameter specification and response handling.
|
||||
@@ -4335,7 +4336,7 @@ declare namespace H {
|
||||
* @param onError {Function}
|
||||
* @returns {H.service.JsonpRequestHandle} - jsonp request handle
|
||||
*/
|
||||
explore(exploreParams: H.service.ServiceParameters, onResult: () => void, onError: () => void): H.service.JsonpRequestHandle;
|
||||
explore(exploreParams: H.service.ServiceParameters, onResult: (result: H.service.ServiceResult) => void, onError: (error: Error) => void): H.service.JsonpRequestHandle;
|
||||
|
||||
/**
|
||||
* Function triggers places api 'around' entry point. Please refer to documentation for parameter specification and response handling.
|
||||
@@ -4344,7 +4345,7 @@ declare namespace H {
|
||||
* @param onError {Function}
|
||||
* @returns {H.service.JsonpRequestHandle} - jsonp request handle
|
||||
*/
|
||||
around(aroundParams: H.service.ServiceParameters, onResult: () => void, onError: () => void): H.service.JsonpRequestHandle;
|
||||
around(aroundParams: H.service.ServiceParameters, onResult: (result: H.service.ServiceResult) => void, onError: (error: Error) => void): H.service.JsonpRequestHandle;
|
||||
|
||||
/**
|
||||
* Function triggers places api 'here' entry point. Please refer to documentation for parameter specification and response handling.
|
||||
@@ -4353,7 +4354,7 @@ declare namespace H {
|
||||
* @param onError {Function}
|
||||
* @returns {H.service.JsonpRequestHandle} - jsonp request handle
|
||||
*/
|
||||
here(hereParams: H.service.ServiceParameters, onResult: () => void, onError: () => void): H.service.JsonpRequestHandle;
|
||||
here(hereParams: H.service.ServiceParameters, onResult: (result: H.service.ServiceResult) => void, onError: (error: Error) => void): H.service.JsonpRequestHandle;
|
||||
|
||||
/**
|
||||
* Function triggers places api 'categories' entry point. Please refer to documentation for parameter specification and response handling.
|
||||
@@ -4362,7 +4363,7 @@ declare namespace H {
|
||||
* @param onError {Function}
|
||||
* @returns {H.service.JsonpRequestHandle} - jsonp request handle
|
||||
*/
|
||||
categories(categoriesParams: H.service.ServiceParameters, onResult: () => void, onError: () => void): H.service.JsonpRequestHandle;
|
||||
categories(categoriesParams: H.service.ServiceParameters, onResult: (result: H.service.ServiceResult) => void, onError: (error: Error) => void): H.service.JsonpRequestHandle;
|
||||
|
||||
/**
|
||||
* This method should be used to follow hyperlinks available in results returned by dicovery queries.
|
||||
@@ -4372,7 +4373,7 @@ declare namespace H {
|
||||
* @param opt_additionalParameters {Object=} - additional parameters to send with request
|
||||
* @returns {H.service.JsonpRequestHandle} - jsonp resquest handle
|
||||
*/
|
||||
follow(hyperlink: string, onResult: () => void, onError: () => void, opt_additionalParameters?: {}): H.service.JsonpRequestHandle;
|
||||
follow(hyperlink: string, onResult: (result: H.service.ServiceResult) => void, onError: (error: Error) => void, opt_additionalParameters?: {}): H.service.JsonpRequestHandle;
|
||||
}
|
||||
|
||||
namespace PlacesService {
|
||||
@@ -4605,7 +4606,140 @@ declare namespace H {
|
||||
* This type encapsulates a response object provider by a HERE platform service.
|
||||
*/
|
||||
interface ServiceResult {
|
||||
[key: string]: string;
|
||||
[key: string]: any;
|
||||
response?: {
|
||||
language?: string,
|
||||
route?: Array<{
|
||||
leg: Array<{
|
||||
maneuver: Array<{
|
||||
id: string,
|
||||
instruction: string,
|
||||
length: number,
|
||||
note: string[],
|
||||
position: {
|
||||
latitude: number,
|
||||
longitude: number
|
||||
},
|
||||
shape: string[],
|
||||
travelTime: number,
|
||||
_type: string
|
||||
}>
|
||||
}>,
|
||||
mode: {
|
||||
feature: any[],
|
||||
trafficMode: string,
|
||||
transportModes: string[],
|
||||
type: string
|
||||
}
|
||||
shape: string[],
|
||||
summary: {
|
||||
baseTime: number,
|
||||
distance: number,
|
||||
flags: string[],
|
||||
text: string,
|
||||
trafficTime: number,
|
||||
travelTime: number
|
||||
}
|
||||
waypoint: Array<{
|
||||
label: string,
|
||||
linkId: string,
|
||||
mappedPosition: {
|
||||
latitude: number,
|
||||
longitude: number
|
||||
},
|
||||
mappedRoadName: string,
|
||||
originalPosition: {
|
||||
latitude: number,
|
||||
longitude: number
|
||||
},
|
||||
shapeIndex: number,
|
||||
sideOfStreet: string,
|
||||
spot: number,
|
||||
type: string
|
||||
}>
|
||||
}>,
|
||||
metaInfo: {}
|
||||
};
|
||||
results?: {
|
||||
items?: any[],
|
||||
next?: string
|
||||
};
|
||||
search?: {
|
||||
context: {
|
||||
href: string,
|
||||
location: {
|
||||
address: {
|
||||
city: string,
|
||||
country: string,
|
||||
countryCode: string,
|
||||
county: string,
|
||||
district: string,
|
||||
house: string,
|
||||
postalCode: string,
|
||||
stateCode: string,
|
||||
street: string,
|
||||
text: string
|
||||
},
|
||||
position: number[]
|
||||
},
|
||||
type: string
|
||||
}
|
||||
};
|
||||
Response?: {
|
||||
MetaInfo: {
|
||||
Timestamp: string
|
||||
},
|
||||
View: Array<{
|
||||
Result: Array<{
|
||||
Location: {
|
||||
Address: {
|
||||
AdditionalData: Array<{
|
||||
key: string,
|
||||
value: string
|
||||
}>,
|
||||
City: string,
|
||||
Country: string,
|
||||
County: string,
|
||||
District: string,
|
||||
HouseNumber: string,
|
||||
Label: string,
|
||||
PostalCode: string,
|
||||
State: string,
|
||||
Street: string
|
||||
},
|
||||
DisplayPosition: {
|
||||
Latitude: number,
|
||||
Longitude: number
|
||||
},
|
||||
LocationId: string,
|
||||
LocationType: string,
|
||||
MapView: {
|
||||
BottomRight: {
|
||||
Latitude: number,
|
||||
Longitude: number
|
||||
},
|
||||
TopLeft: {
|
||||
Latitude: number,
|
||||
Longitude: number
|
||||
}
|
||||
},
|
||||
NavigationPosition: Array<{
|
||||
Latitude: number,
|
||||
Longitude: number
|
||||
}>
|
||||
},
|
||||
MatchLevel: string,
|
||||
MatchQuality: {
|
||||
City: number,
|
||||
HouseNumber: number,
|
||||
Street: number[]
|
||||
},
|
||||
MatchType: string,
|
||||
Relevance: number
|
||||
}>
|
||||
}>,
|
||||
isolines: any[]
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -4634,7 +4768,7 @@ declare namespace H {
|
||||
* @param onError {function()}
|
||||
* @returns {H.service.JsonpRequestHandle}
|
||||
*/
|
||||
requestIncidents(serviceParams: H.service.ServiceParameters, onResponse: (result: H.service.ServiceResult) => void, onError: () => void): H.service.JsonpRequestHandle;
|
||||
requestIncidents(serviceParams: H.service.ServiceParameters, onResponse: (result: H.service.ServiceResult) => void, onError: (error: Error) => void): H.service.JsonpRequestHandle;
|
||||
|
||||
/**
|
||||
* This method requests traffic incident information by tile coordinates
|
||||
@@ -4646,8 +4780,8 @@ declare namespace H {
|
||||
* @param opt_serviceParams {H.service.ServiceParameters=} - optional service parameters to be added to the request
|
||||
* @returns {H.service.JsonpRequestHandle}
|
||||
*/
|
||||
requestIncidentsByTile(x: number, y: number, z: number, onResponse: (result: H.service.ServiceResult) => void, onError: () => void, opt_serviceParams?: H.service.ServiceParameters):
|
||||
H.service.JsonpRequestHandle;
|
||||
requestIncidentsByTile(x: number, y: number, z: number, onResponse: (result: H.service.ServiceResult) => void, onError: (error: Error) => void,
|
||||
opt_serviceParams?: H.service.ServiceParameters): H.service.JsonpRequestHandle;
|
||||
}
|
||||
|
||||
namespace TrafficIncidentsService {
|
||||
|
||||
Vendored
+17
-8
@@ -38,7 +38,7 @@ declare function fail(...err:any[]): void;
|
||||
* @param action The action to perform for this task
|
||||
* @param opts Perform this task asynchronously. If you flag a task with this option, you must call the global `complete` method inside the task's action, for execution to proceed to the next task.
|
||||
*/
|
||||
declare function file(name:string, prereqs?:string[], action?:()=>void, opts?:jake.FileTaskOptions): jake.FileTask;
|
||||
declare function file(name:string, prereqs?:string[], action?:(this: jake.FileTask)=>void, opts?:jake.FileTaskOptions): jake.FileTask;
|
||||
|
||||
/**
|
||||
* Creates Jake FileTask from regex patterns
|
||||
@@ -63,9 +63,9 @@ declare function namespace(name:string, scope:()=>void): void;
|
||||
* @param action The action to perform for this task
|
||||
* @param opts
|
||||
*/
|
||||
declare function task(name:string, prereqs?:string[], action?:(...params:any[])=>any, opts?:jake.TaskOptions): jake.Task;
|
||||
declare function task(name:string, action?:(...params:any[])=>any, opts?:jake.TaskOptions): jake.Task;
|
||||
declare function task(name:string, opts?:jake.TaskOptions, action?:(...params:any[])=>any): jake.Task;
|
||||
declare function task(name:string, prereqs?:string[], action?:(this: jake.Task, ...params:any[])=>any, opts?:jake.TaskOptions): jake.Task;
|
||||
declare function task(name:string, action?:(this: jake.Task, ...params:any[])=>any, opts?:jake.TaskOptions): jake.Task;
|
||||
declare function task(name:string, opts?:jake.TaskOptions, action?:(this: jake.Task, ...params:any[])=>any): jake.Task;
|
||||
|
||||
/**
|
||||
* @param name The name of the NpmPublishTask
|
||||
@@ -214,7 +214,7 @@ declare namespace jake{
|
||||
* @param action The action to perform for this task
|
||||
* @param opts Perform this task asynchronously. If you flag a task with this option, you must call the global `complete` method inside the task's action, for execution to proceed to the next task.
|
||||
*/
|
||||
constructor(name:string, prereqs?:string[], action?:()=>void, opts?:TaskOptions);
|
||||
constructor(name:string, prereqs?:string[], action?:(this: Task)=>void, opts?:TaskOptions);
|
||||
|
||||
/**
|
||||
* Runs prerequisites, then this task. If the task has already been run, will not run the task again.
|
||||
@@ -236,10 +236,19 @@ declare namespace jake{
|
||||
listeners(event: string): Function[];
|
||||
emit(event: string, ...args: any[]): boolean;
|
||||
listenerCount(type: string): number;
|
||||
complete(value?: any): void;
|
||||
value: any;
|
||||
|
||||
name?: string;
|
||||
prereqs?: string[];
|
||||
action?: (...params: any[]) => any;
|
||||
taskStatus?: string;
|
||||
async?: boolean;
|
||||
description?: string;
|
||||
fullName: string;
|
||||
}
|
||||
|
||||
export class DirectoryTask{
|
||||
export class DirectoryTask extends FileTask {
|
||||
/**
|
||||
* @param name The name of the directory to create.
|
||||
*/
|
||||
@@ -254,14 +263,14 @@ declare namespace jake{
|
||||
async?: boolean;
|
||||
}
|
||||
|
||||
export class FileTask{
|
||||
export class FileTask extends Task{
|
||||
/**
|
||||
* @param name The name of the Task
|
||||
* @param prereqs Prerequisites to be run before this task
|
||||
* @param action The action to perform to create this file
|
||||
* @param opts Perform this task asynchronously. If you flag a task with this option, you must call the global `complete` method inside the task's action, for execution to proceed to the next task.
|
||||
*/
|
||||
constructor(name:string, prereqs?:string[], action?:()=>void, opts?:FileTaskOptions);
|
||||
constructor(name:string, prereqs?:string[], action?:(this: FileTask)=>void, opts?:FileTaskOptions);
|
||||
}
|
||||
|
||||
interface FileFilter{
|
||||
|
||||
Vendored
+2
@@ -24,6 +24,8 @@ interface JasmineAjaxRequest extends XMLHttpRequest {
|
||||
data(): string;
|
||||
|
||||
respondWith(response: JasmineAjaxResponse): void;
|
||||
responseTimeout(): void;
|
||||
responseError(): void;
|
||||
}
|
||||
|
||||
interface JasmineAjaxRequestTracker {
|
||||
|
||||
Vendored
+1
@@ -17,6 +17,7 @@ declare namespace JQueryMousewheel {
|
||||
}
|
||||
|
||||
interface JQuery {
|
||||
on(event: 'mousewheel', handler: (eventObject: JQueryMousewheel.JQueryMousewheelEventObject, ...args: any[]) => any): JQuery;
|
||||
mousewheel(handler: (eventObject: JQueryMousewheel.JQueryMousewheelEventObject, ...args: any[]) => any): JQuery
|
||||
unmousewheel(): JQuery;
|
||||
}
|
||||
|
||||
Vendored
+9
-7
@@ -9,14 +9,14 @@
|
||||
/**
|
||||
* Interface for pjax:popstate event.
|
||||
*/
|
||||
interface PjaxPopStateEventObject extends JQueryEventObject {
|
||||
interface PjaxPopStateEventObject extends JQuery.Event {
|
||||
/**
|
||||
* Navigation direction. Could be "back" or "forward".
|
||||
*/
|
||||
direction: string
|
||||
}
|
||||
|
||||
interface PjaxSettings extends JQueryAjaxSettings {
|
||||
interface PjaxSettings extends JQuery.AjaxSettings {
|
||||
/**
|
||||
* A jQuery selector indicates where to stick the response body. E.g., $(container).html(xhr.responseBody).
|
||||
* If it is not defined, the `data-pjax` attribute of the link will be treated as container.
|
||||
@@ -33,7 +33,7 @@ interface PjaxSettings extends JQueryAjaxSettings {
|
||||
* Whether to replaceState the URL. Defaults to false.
|
||||
*/
|
||||
replace?: boolean;
|
||||
|
||||
|
||||
/**
|
||||
* How many requests to cache. Defaults to 20.
|
||||
*/
|
||||
@@ -90,6 +90,8 @@ interface JQuery {
|
||||
* @return Returns the jQuery object
|
||||
*/
|
||||
pjax(delegationSelector: string, containerSelector?: string, options?: PjaxSettings): JQuery;
|
||||
|
||||
on(event: 'pjax:popstate', handler: (e: PjaxPopStateEventObject) => void): this;
|
||||
}
|
||||
|
||||
interface JQueryStatic {
|
||||
@@ -120,7 +122,7 @@ interface PjaxStatic {
|
||||
* - push: a boolean indicates whether to pushState the URL. Default is true.
|
||||
* - replace: a boolean indicates whether to use replaceState instead of pushState. Default is false.
|
||||
*/
|
||||
click(event: JQueryEventObject, options?: PjaxSettings): void;
|
||||
click(event: JQuery.Event, options?: PjaxSettings): void;
|
||||
|
||||
/**
|
||||
* PJAX on click handler.
|
||||
@@ -131,7 +133,7 @@ interface PjaxStatic {
|
||||
* - push: a boolean indicates whether to pushState the URL. Default is true.
|
||||
* - replace: a boolean indicates whether to use replaceState instead of pushState. Default is false.
|
||||
*/
|
||||
click(event: JQueryEventObject, containerSelector?: string, options?: PjaxSettings): void;
|
||||
click(event: JQuery.Event, containerSelector?: string, options?: PjaxSettings): void;
|
||||
|
||||
/**
|
||||
* PJAX on form submit handler
|
||||
@@ -141,7 +143,7 @@ interface PjaxStatic {
|
||||
* - push: a boolean indicates whether to pushState the URL. Default is true.
|
||||
* - replace: a boolean indicates whether to use replaceState instead of pushState. Default is false.
|
||||
*/
|
||||
submit(event: JQueryEventObject, options?: PjaxSettings): void;
|
||||
submit(event: JQuery.Event, options?: PjaxSettings): void;
|
||||
|
||||
/**
|
||||
* PJAX on form submit handler
|
||||
@@ -152,7 +154,7 @@ interface PjaxStatic {
|
||||
* - push: a boolean indicates whether to pushState the URL. Default is true.
|
||||
* - replace: a boolean indicates whether to use replaceState instead of pushState. Default is false.
|
||||
*/
|
||||
submit(event: JQueryEventObject, containerSelector?: string, options?: PjaxSettings): void;
|
||||
submit(event: JQuery.Event, containerSelector?: string, options?: PjaxSettings): void;
|
||||
|
||||
/**
|
||||
* Install pjax functions on $.pjax to enable pushState behavior. Does nothing if already enabled.
|
||||
|
||||
@@ -61,9 +61,9 @@ function test_support() {
|
||||
}
|
||||
|
||||
function test_events() {
|
||||
$(document).on('pjax:popstate', function(e: PjaxPopStateEventObject) {
|
||||
$(document).on('pjax:popstate', function(e) {
|
||||
if (e.direction === 'back') {
|
||||
console.log('pjax:popstate is OK');
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,4 +20,4 @@
|
||||
"index.d.ts",
|
||||
"jquery.pjax-tests.ts"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
+16
-1
@@ -9,7 +9,7 @@ When jQuery is globally available, you can use `jQuery` and `$` directly.
|
||||
When you want to import jQuery as a module and have a global DOM available (e.g. browser and browser-like environments):
|
||||
|
||||
```typescript
|
||||
import * as jQuery from 'jquery';
|
||||
import jQuery = require('jquery');
|
||||
```
|
||||
|
||||
#### Importing (without a global DOM available)
|
||||
@@ -23,6 +23,21 @@ const jQuery = jQueryFactory(window, true);
|
||||
|
||||
Note that while the factory function ignores the second parameter, it is required to get correct type declarations.
|
||||
|
||||
### Project structure
|
||||
|
||||
- [jquery-tests.ts](jquery-tests.ts)
|
||||
- Tests that exercise TypeScript-specific usage and cases not covered by other test files.
|
||||
- [test/example-tests.ts](test/example-tests.ts)
|
||||
- Tests generated from examples in jQuery documentation.
|
||||
- [test/longdesc-tests.ts](test/longdesc-tests.ts)
|
||||
- Tests generated from non-example snippets in jQuery documentation.
|
||||
- [test/jquery-window-module-tests.ts](test/jquery-window-module-tests.ts)<br>
|
||||
[test/jquery-slim-window-module-tests.ts](test/jquery-slim-window-module-tests.ts)
|
||||
- Tests importing jQuery with a DOM available
|
||||
- [test/jquery-no-window-module-tests.ts](test/jquery-no-window-module-tests.ts)<br>
|
||||
[test/jquery-slim-no-window-module-tests.ts](test/jquery-slim-no-window-module-tests.ts)
|
||||
- Tests importing jQuery without a DOM available
|
||||
|
||||
### Authoring type definitions for jQuery plugins
|
||||
|
||||
`$.fn` is represented by `JQuery`.
|
||||
|
||||
Vendored
+474
-322
File diff suppressed because it is too large
Load Diff
+2049
-40
File diff suppressed because it is too large
Load Diff
@@ -2434,7 +2434,7 @@ function examples() {
|
||||
}
|
||||
|
||||
function jQuery_error_0() {
|
||||
jQuery.error = console.error as any;
|
||||
jQuery.error = console.error;
|
||||
}
|
||||
|
||||
function jQuery_escape_selector_0() {
|
||||
@@ -2907,7 +2907,7 @@ function examples() {
|
||||
function jQuery_parse_html_0() {
|
||||
var $log = $('#log'),
|
||||
str = 'hello, <b>my name is</b> jQuery.',
|
||||
html = $.parseHTML(str) as HTMLElement[],
|
||||
html = $.parseHTML(str),
|
||||
nodeNames: string[] = [];
|
||||
|
||||
// Append the parsed HTML
|
||||
@@ -4056,7 +4056,7 @@ function examples() {
|
||||
function promise_0() {
|
||||
var div = $('<div>');
|
||||
|
||||
div.promise().done(function(this: JQuery, arg1: JQuery) {
|
||||
div.promise().done(function(this: typeof div, arg1) {
|
||||
// Will fire right away and alert "true"
|
||||
alert(this === div && arg1 === div);
|
||||
});
|
||||
|
||||
Vendored
+2
-3
@@ -177,9 +177,8 @@ declare namespace Knex {
|
||||
|
||||
interface Join {
|
||||
(raw: Raw): QueryBuilder;
|
||||
(builder: QueryBuilder, clause: (this: JoinClause) => void): QueryBuilder;
|
||||
(tableName: string, columns: { [key: string]: string | number | Raw }): QueryBuilder;
|
||||
(tableName: string, callback: Function): QueryBuilder;
|
||||
(tableName: TableName, clause: (this: JoinClause) => void): QueryBuilder;
|
||||
(tableName: TableName, columns: { [key: string]: string | number | Raw }): QueryBuilder;
|
||||
(tableName: TableName, raw: Raw): QueryBuilder;
|
||||
(tableName: TableName, column1: string, column2: string): QueryBuilder;
|
||||
(tableName: TableName, column1: string, raw: Raw): QueryBuilder;
|
||||
|
||||
@@ -213,6 +213,14 @@ knex('users')
|
||||
.join(knex('contacts').select('user_id', 'phone').as('contacts'), 'users.id', 'contacts.user_id')
|
||||
.select('users.id', 'contacts.phone');
|
||||
|
||||
knex('users')
|
||||
.join(knex('contacts').select('user_id', 'phone').as('contacts'), { 'users.id': 'contacts.user_id' })
|
||||
.select('users.id', 'contacts.phone');
|
||||
|
||||
knex.select('*').from('users').join(knex('accounts').select('id', 'owner_id').as('accounts'), function() {
|
||||
this.on('accounts.id', '=', 'users.account_id').orOn('accounts.owner_id', '=', 'users.id')
|
||||
});
|
||||
|
||||
knex.select('*').from('users').join('accounts', function() {
|
||||
this.on('accounts.id', '=', 'users.account_id').orOn('accounts.owner_id', '=', 'users.id')
|
||||
});
|
||||
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
// Type definitions for mongoose-simple-random 0.4
|
||||
// Project: https://github.com/larryprice/mongoose-simple-random
|
||||
// Definitions by: My Self <https://github.com/me>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
/// <reference types="mongoose" />
|
||||
|
||||
// tslint:disable-next-line no-single-declare-module
|
||||
declare module "mongoose" {
|
||||
interface Model<T extends Document> extends NodeJS.EventEmitter, ModelProperties {
|
||||
findRandom(conditions: Object, projection?: Object | null, options?: Object | null, callback?: (err: any, res: T[]) => void)
|
||||
: void;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
import * as mongoose from 'mongoose';
|
||||
|
||||
// test compatibility with other libraries - from @types/mongoose
|
||||
import * as _ from 'lodash';
|
||||
import * as fs from "fs";
|
||||
|
||||
mongoose.Model.findRandom({
|
||||
username: { $ne: "DummyUser" },
|
||||
rating: {
|
||||
$gt: 1,
|
||||
$lt: 11,
|
||||
},
|
||||
}, {}, { limit: 1 }, (error, data) => {
|
||||
if (error) { console.error("Error!"); } else { console.log("Success!"); }
|
||||
});
|
||||
@@ -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",
|
||||
"mongoose-simple-random-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"extends": "dtslint/dt.json",
|
||||
"rules": {
|
||||
// This package uses the Function type, and it will take effort to fix.
|
||||
"ban-types": false
|
||||
}
|
||||
}
|
||||
Vendored
+7
-5
@@ -761,13 +761,14 @@ declare module "http" {
|
||||
import * as events from "events";
|
||||
import * as net from "net";
|
||||
import * as stream from "stream";
|
||||
import { URL } from "url";
|
||||
|
||||
export interface RequestOptions {
|
||||
protocol?: string;
|
||||
host?: string;
|
||||
hostname?: string;
|
||||
family?: number;
|
||||
port?: number;
|
||||
port?: number | string;
|
||||
localAddress?: string;
|
||||
socketPath?: string;
|
||||
method?: string;
|
||||
@@ -935,8 +936,8 @@ declare module "http" {
|
||||
};
|
||||
export function createServer(requestListener?: (request: IncomingMessage, response: ServerResponse) => void): Server;
|
||||
export function createClient(port?: number, host?: string): any;
|
||||
export function request(options: RequestOptions, callback?: (res: IncomingMessage) => void): ClientRequest;
|
||||
export function get(options: any, callback?: (res: IncomingMessage) => void): ClientRequest;
|
||||
export function request(options: RequestOptions | string | URL, callback?: (res: IncomingMessage) => void): ClientRequest;
|
||||
export function get(options: RequestOptions | string | URL, callback?: (res: IncomingMessage) => void): ClientRequest;
|
||||
export var globalAgent: Agent;
|
||||
}
|
||||
|
||||
@@ -1492,6 +1493,7 @@ declare module "https" {
|
||||
import * as tls from "tls";
|
||||
import * as events from "events";
|
||||
import * as http from "http";
|
||||
import { URL } from "url";
|
||||
|
||||
export interface ServerOptions {
|
||||
pfx?: any;
|
||||
@@ -1544,8 +1546,8 @@ declare module "https" {
|
||||
};
|
||||
export interface Server extends tls.Server { }
|
||||
export function createServer(options: ServerOptions, requestListener?: (req: IncomingMessage, res: ServerResponse) => void): Server;
|
||||
export function request(options: RequestOptions, callback?: (res: IncomingMessage) => void): ClientRequest;
|
||||
export function get(options: RequestOptions, callback?: (res: IncomingMessage) => void): ClientRequest;
|
||||
export function request(options: RequestOptions | string | URL, callback?: (res: IncomingMessage) => void): ClientRequest;
|
||||
export function get(options: RequestOptions | string | URL, callback?: (res: IncomingMessage) => void): ClientRequest;
|
||||
export var globalAgent: Agent;
|
||||
}
|
||||
|
||||
|
||||
Vendored
+57
@@ -0,0 +1,57 @@
|
||||
// Type definitions for react-burger-menu 2.1
|
||||
// Project: https://github.com/negomi/react-burger-menu
|
||||
// Definitions by: Rajab Shakirov <https://github.com/radziksh>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
import * as React from "react";
|
||||
|
||||
// TODO (Rajab) actually I don't want export Props, but
|
||||
// `npm run lint react-burger-menu` error doesn't allow me to do it;
|
||||
export interface Props {
|
||||
burgerBarClassName?: string;
|
||||
burgerButtonClassName?: string;
|
||||
crossButtonClassName?: string;
|
||||
crossClassName?: string;
|
||||
customBurgerIcon?: Element | false;
|
||||
customCrossIcon?: Element | false;
|
||||
id?: string;
|
||||
isOpen?: boolean;
|
||||
itemListClassName?: string;
|
||||
menuClassName?: string;
|
||||
morphShapeClassName?: string;
|
||||
noOverlay?: boolean;
|
||||
onStateChange?(): void;
|
||||
// TODO (Rajab) This can be improved, though I do not know how. From PropTypes:
|
||||
// styles && styles.outerContainer ? PropTypes.string.isRequired : PropTypes.string
|
||||
outerContainerId?: string;
|
||||
overlayClassName?: string;
|
||||
// TODO (Rajab) This can be improved, though I do not know how. From PropTypes:
|
||||
// styles && styles.pageWrap ? PropTypes.string.isRequired : PropTypes.string,
|
||||
pageWrapId?: string;
|
||||
right?: boolean;
|
||||
styles?: {
|
||||
bmBurgerButton: CSSStyleDeclaration;
|
||||
bmBurgerBars: CSSStyleDeclaration;
|
||||
bmCrossButton: CSSStyleDeclaration;
|
||||
bmCross: CSSStyleDeclaration;
|
||||
bmMenu: CSSStyleDeclaration;
|
||||
bmMorphShape: CSSStyleDeclaration;
|
||||
bmItemList: CSSStyleDeclaration;
|
||||
bmOverlay: CSSStyleDeclaration;
|
||||
};
|
||||
width?: number | string;
|
||||
}
|
||||
|
||||
// TODO (Rajab) actually I don't want export ReactBurgerMenu, but
|
||||
// `npm run lint react-burger-menu` error doesn't allow me to do it;
|
||||
export class ReactBurgerMenu extends React.Component<Props, {}> { }
|
||||
|
||||
export class slide extends ReactBurgerMenu { }
|
||||
export class stack extends ReactBurgerMenu { }
|
||||
export class elastic extends ReactBurgerMenu { }
|
||||
export class bubble extends ReactBurgerMenu { }
|
||||
export class push extends ReactBurgerMenu { }
|
||||
export class pushRotate extends ReactBurgerMenu { }
|
||||
export class scaleDown extends ReactBurgerMenu { }
|
||||
export class scaleRotate extends ReactBurgerMenu { }
|
||||
export class fallDown extends ReactBurgerMenu { }
|
||||
@@ -0,0 +1,21 @@
|
||||
import * as React from 'react';
|
||||
import { slide as Menu } from 'react-burger-menu';
|
||||
|
||||
class Example extends React.Component<{}, {}> {
|
||||
showSettings(event: {
|
||||
preventDefault(): void;
|
||||
}) {
|
||||
event.preventDefault();
|
||||
}
|
||||
|
||||
render() {
|
||||
return (
|
||||
<Menu>
|
||||
<a id="home" className="menu-item" href="/">Home</a>
|
||||
<a id="about" className="menu-item" href="/about">About</a>
|
||||
<a id="contact" className="menu-item" href="/contact">Contact</a>
|
||||
<a onClick={this.showSettings} className="menu-item--small" href="">Settings</a>
|
||||
</Menu>
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6",
|
||||
"dom"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"jsx": "react"
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"react-burger-menu-tests.tsx"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Vendored
+2
@@ -24,3 +24,5 @@ export default class LazyLoad extends Component<LazyLoadProps> {
|
||||
}
|
||||
|
||||
export function lazyload(option: {}): LazyLoad;
|
||||
|
||||
export function forceCheck(): void;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import * as React from "react";
|
||||
import LazyLoad from "react-lazyload";
|
||||
import LazyLoad, { forceCheck } from "react-lazyload";
|
||||
|
||||
interface State {
|
||||
arr: string[];
|
||||
@@ -14,6 +14,11 @@ class Normal extends React.Component<{}, State> {
|
||||
}
|
||||
this.state = { arr };
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
forceCheck();
|
||||
}
|
||||
|
||||
render() {
|
||||
return (
|
||||
<div>
|
||||
|
||||
+205
@@ -0,0 +1,205 @@
|
||||
// Type definitions for react-native-modalbox 1.3
|
||||
// Project: https://github.com/maxs15/react-native-modalbox#readme
|
||||
// Definitions by: Kyle Roach <https://github.com/me>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.3
|
||||
|
||||
import * as React from 'react';
|
||||
import { ViewProperties } from 'react-native';
|
||||
|
||||
export interface ModalProps extends ViewProperties {
|
||||
/**
|
||||
* Checks if the modal is open
|
||||
*
|
||||
* Default is false
|
||||
*
|
||||
* @type {boolean}
|
||||
* @memberof ModalProps
|
||||
*/
|
||||
isOpen?: boolean;
|
||||
|
||||
/**
|
||||
* Checks if the modal is disabled
|
||||
*
|
||||
* Default is false
|
||||
*
|
||||
* @type {boolean}
|
||||
* @memberof ModalProps
|
||||
*/
|
||||
isDisabled?: boolean;
|
||||
|
||||
/**
|
||||
* If the modal can be closed by pressing on the backdrop
|
||||
*
|
||||
* Default is true
|
||||
*
|
||||
* @type {boolean}
|
||||
* @memberof ModalProps
|
||||
*/
|
||||
backdropPressToClose?: boolean;
|
||||
|
||||
/**
|
||||
* If the modal can be closed by swiping
|
||||
*
|
||||
* Default is true
|
||||
*
|
||||
* @type {boolean}
|
||||
* @memberof ModalProps
|
||||
*/
|
||||
swipeToClose?: boolean;
|
||||
|
||||
/**
|
||||
* The threshold to reach in pixels to close the modal
|
||||
*
|
||||
* Default is 50
|
||||
*
|
||||
* @type {number}
|
||||
* @memberof ModalProps
|
||||
*/
|
||||
swipeThreshold?: number;
|
||||
|
||||
/**
|
||||
* The height in pixels of the swipeable area
|
||||
*
|
||||
* Default is the Window Height
|
||||
*
|
||||
* @type {number}
|
||||
* @memberof ModalProps
|
||||
*/
|
||||
swipeArea?: number;
|
||||
|
||||
/**
|
||||
* The final position of the modal.
|
||||
* Accepts top, center or bottom
|
||||
*
|
||||
* Default is center
|
||||
*
|
||||
* @type {string}
|
||||
* @memberof ModalProps
|
||||
*/
|
||||
position?: 'top' | 'center' | 'bottom' | string;
|
||||
|
||||
/**
|
||||
* The direction modal enters from
|
||||
*
|
||||
* Default is bottom
|
||||
*
|
||||
* @type {('top' | 'bottom' | string)}
|
||||
* @memberof ModalProps
|
||||
*/
|
||||
entry?: 'top' | 'bottom' | string;
|
||||
|
||||
/**
|
||||
* If a backdrop is displayed behind the modal
|
||||
*
|
||||
* Default is true
|
||||
*
|
||||
* @type {boolean}
|
||||
* @memberof ModalProps
|
||||
*/
|
||||
backdrop?: boolean;
|
||||
|
||||
/**
|
||||
* Opacity of the backdrop
|
||||
*
|
||||
* Default is 0.5
|
||||
*
|
||||
* @type {number}
|
||||
* @memberof ModalProps
|
||||
*/
|
||||
backdropOpacity?: number;
|
||||
|
||||
/**
|
||||
* Background color of the backdrop
|
||||
*
|
||||
* Default is black
|
||||
*
|
||||
* @type {string}
|
||||
* @memberof ModalProps
|
||||
*/
|
||||
backdropColor?: string;
|
||||
|
||||
/**
|
||||
* Add an element in the backdrop (a close button for example)
|
||||
*
|
||||
* Default is null
|
||||
*
|
||||
* @type {JSX.Element}
|
||||
* @memberof ModalProps
|
||||
*/
|
||||
backdropContent?: React.ReactNode;
|
||||
|
||||
/**
|
||||
* Duration of the animation
|
||||
*
|
||||
* Default is 400ms
|
||||
*
|
||||
* @type {number}
|
||||
* @memberof ModalProps
|
||||
*/
|
||||
animationDuration?: number;
|
||||
|
||||
/**
|
||||
* (Android only) Close modal when receiving back button event
|
||||
*
|
||||
* Default is false
|
||||
*
|
||||
* @type {boolean}
|
||||
* @memberof ModalProps
|
||||
*/
|
||||
backButtonClose?: boolean;
|
||||
|
||||
/**
|
||||
* If the modal should appear open without animation upon first mount
|
||||
*
|
||||
* Default is false
|
||||
*
|
||||
* @type {boolean}
|
||||
* @memberof ModalProps
|
||||
*/
|
||||
startOpen?: boolean;
|
||||
|
||||
/**
|
||||
* Event fired when the modal is closed and the animation is complete
|
||||
*
|
||||
* @memberof ModalProps
|
||||
*/
|
||||
onClosed?(): void;
|
||||
|
||||
/**
|
||||
* Event fired when the modal is opened and the animation is complete
|
||||
*
|
||||
* @memberof ModalProps
|
||||
*/
|
||||
onOpened?(): void;
|
||||
|
||||
/**
|
||||
* When the state of the swipe to close feature has changed
|
||||
* (useful to change the content of the modal, display a message for example)
|
||||
*
|
||||
* @param {boolean} state
|
||||
*
|
||||
* @memberof ModalProps
|
||||
*/
|
||||
onClosingState?(state: boolean): void;
|
||||
}
|
||||
|
||||
export default class Modal extends React.Component<ModalProps, {}> {
|
||||
/**
|
||||
* Open the modal
|
||||
*
|
||||
* @static
|
||||
*
|
||||
* @memberof Modal
|
||||
*/
|
||||
open(): void;
|
||||
|
||||
/**
|
||||
* Close the modal
|
||||
*
|
||||
* @static
|
||||
*
|
||||
* @memberof Modal
|
||||
*/
|
||||
close(): void;
|
||||
}
|
||||
@@ -0,0 +1,198 @@
|
||||
import * as React from 'react';
|
||||
import {
|
||||
Text,
|
||||
StyleSheet,
|
||||
ScrollView,
|
||||
View,
|
||||
Dimensions,
|
||||
Button
|
||||
} from 'react-native';
|
||||
import Modal from 'react-native-modalbox';
|
||||
|
||||
interface State {
|
||||
isOpen: boolean;
|
||||
isDisabled: boolean;
|
||||
swipeToClose: boolean;
|
||||
sliderValue: number;
|
||||
}
|
||||
|
||||
class Example extends React.Component<{}, State> {
|
||||
modal1: Modal;
|
||||
modal2: Modal;
|
||||
modal3: Modal;
|
||||
modal4: Modal;
|
||||
modal6: Modal;
|
||||
|
||||
constructor() {
|
||||
super();
|
||||
|
||||
this.state = {
|
||||
isOpen: false,
|
||||
isDisabled: false,
|
||||
swipeToClose: true,
|
||||
sliderValue: 0.3
|
||||
};
|
||||
}
|
||||
|
||||
onClose() {
|
||||
console.log('Modal just closed');
|
||||
}
|
||||
|
||||
onOpen() {
|
||||
console.log('Modal just openned');
|
||||
}
|
||||
|
||||
onClosingState() {
|
||||
console.log('the open/close of the swipeToClose just changed');
|
||||
}
|
||||
|
||||
renderList() {
|
||||
const list = [];
|
||||
|
||||
for (let i = 0; i < 50; i++) {
|
||||
list.push(<Text style={styles.text} key={i}>Elem {i}</Text>);
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
render() {
|
||||
const BContent = (
|
||||
<Button title="X" onPress={() => this.setState({ isOpen: false })} />
|
||||
);
|
||||
|
||||
return (
|
||||
<View style={styles.wrapper}>
|
||||
<Button title=" Basic modal" onPress={() => this.modal1.open()} />
|
||||
<Button title="Position top" onPress={() => this.modal2.open()} />
|
||||
<Button
|
||||
title="Position centered + backdrop + disable"
|
||||
onPress={() => this.modal3.open()}
|
||||
/>
|
||||
<Button
|
||||
title="Position bottom + backdrop + slider"
|
||||
onPress={() => this.modal4.open()}
|
||||
/>
|
||||
<Button
|
||||
title=" Backdrop + backdropContent"
|
||||
onPress={() => this.setState({ isOpen: true })}
|
||||
/>
|
||||
<Button
|
||||
title=" Position bottom + ScrollView"
|
||||
onPress={() => this.modal6.open()}
|
||||
/>
|
||||
|
||||
<Modal
|
||||
style={styles.modal}
|
||||
ref={(ref: Modal) => (this.modal1 = ref)}
|
||||
swipeToClose={this.state.swipeToClose}
|
||||
onClosed={() => this.onClose()}
|
||||
onOpened={() => this.onOpen()}
|
||||
onClosingState={this.onClosingState}
|
||||
>
|
||||
<Text style={styles.text}>Basic modal</Text>
|
||||
<Button
|
||||
title={`Disable swipeToClose(${this.state.swipeToClose
|
||||
? 'true'
|
||||
: 'false'}`}
|
||||
onPress={() =>
|
||||
this.setState({ swipeToClose: !this.state.swipeToClose })}
|
||||
/>
|
||||
</Modal>
|
||||
|
||||
<Modal
|
||||
style={[styles.modal, styles.modal2]}
|
||||
backdrop={false}
|
||||
position={'top'}
|
||||
ref={(ref: Modal) => (this.modal2 = ref)}
|
||||
>
|
||||
<Text style={[styles.text, { color: 'white' }]}>Modal on top</Text>
|
||||
</Modal>
|
||||
|
||||
<Modal
|
||||
style={[styles.modal, styles.modal3]}
|
||||
position={'center'}
|
||||
ref={(ref: Modal) => (this.modal3 = ref)}
|
||||
isDisabled={this.state.isDisabled}
|
||||
>
|
||||
<Text style={styles.text}>Modal centered</Text>
|
||||
<Button
|
||||
title={`Disable ${this.state.isDisabled ? 'true' : 'false'}`}
|
||||
onPress={() =>
|
||||
this.setState({ isDisabled: !this.state.isDisabled })}
|
||||
/>
|
||||
</Modal>
|
||||
|
||||
<Modal
|
||||
isOpen={this.state.isOpen}
|
||||
onClosed={() => this.setState({ isOpen: false })}
|
||||
style={[styles.modal, styles.modal4]}
|
||||
position={'center'}
|
||||
backdropContent={BContent}
|
||||
>
|
||||
<Text style={styles.text}>Modal with backdrop content</Text>
|
||||
</Modal>
|
||||
|
||||
<Modal
|
||||
style={[styles.modal, styles.modal4]}
|
||||
position={'bottom'}
|
||||
ref={(ref: Modal) => (this.modal6 = ref)}
|
||||
swipeArea={20}
|
||||
>
|
||||
<ScrollView>
|
||||
<View style={{ width: screen.width, paddingLeft: 10 }}>
|
||||
{this.renderList()}
|
||||
</View>
|
||||
</ScrollView>
|
||||
</Modal>
|
||||
</View>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
const styles = StyleSheet.create({
|
||||
wrapper: {
|
||||
paddingTop: 50,
|
||||
flex: 1
|
||||
},
|
||||
|
||||
modal: {
|
||||
justifyContent: 'center',
|
||||
alignItems: 'center'
|
||||
},
|
||||
|
||||
modal2: {
|
||||
height: 230,
|
||||
backgroundColor: '#3B5998'
|
||||
},
|
||||
|
||||
modal3: {
|
||||
height: 300,
|
||||
width: 300
|
||||
},
|
||||
|
||||
modal4: {
|
||||
height: 300
|
||||
},
|
||||
|
||||
btn: {
|
||||
margin: 10,
|
||||
backgroundColor: '#3B5998',
|
||||
color: 'white',
|
||||
padding: 10
|
||||
},
|
||||
|
||||
btnModal: {
|
||||
position: 'absolute',
|
||||
top: 0,
|
||||
right: 0,
|
||||
width: 50,
|
||||
height: 50,
|
||||
backgroundColor: 'transparent'
|
||||
},
|
||||
|
||||
text: {
|
||||
color: 'black',
|
||||
fontSize: 22
|
||||
}
|
||||
});
|
||||
@@ -0,0 +1,24 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6",
|
||||
"dom"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"jsx": "react"
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"react-native-modalbox-tests.tsx"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"extends": "dtslint/dt.json"
|
||||
}
|
||||
Vendored
+349
-374
@@ -3,35 +3,45 @@
|
||||
// Definitions by: Huhuanming <https://github.com/huhuanming>
|
||||
// mhcgrq <https://github.com/mhcgrq>
|
||||
// fangpenlin <https://github.com/fangpenlin>
|
||||
// abrahambotros <https://github.com/abrahambotros>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.3
|
||||
|
||||
import * as React from 'react'
|
||||
/**
|
||||
* BEGIN FLOW TYPEDEFINITION.JS PORT
|
||||
* Reference: https://github.com/react-community/react-navigation/tree/52a2846e77119148320bcea83b8982a8bc6acce3
|
||||
*
|
||||
* NOTE: Please update the commit/link above when updating to a new Flow
|
||||
* TypeDefinition.js reference, so we can conveniently just look at diffs on
|
||||
* TypeDefinition.js between this latest reference point and the one you are
|
||||
* using when making new updates.
|
||||
*/
|
||||
|
||||
import * as React from 'react';
|
||||
import {
|
||||
Animated,
|
||||
TextStyle,
|
||||
ViewStyle,
|
||||
TextStyle
|
||||
} from 'react-native'
|
||||
} from 'react-native';
|
||||
|
||||
export type HeaderMode = 'float' | 'screen' | 'none'
|
||||
// @todo when we split types into common, native and web,
|
||||
// we can properly change Animated.Value to its real value
|
||||
type AnimatedValue = any;
|
||||
|
||||
export function addNavigationHelpers(params: any): any
|
||||
|
||||
type SubViewProps = NavigationSceneRendererProps & {
|
||||
onNavigateBack?: () => void,
|
||||
}
|
||||
|
||||
type SubViewRenderer = (subViewProps: SubViewProps) => React.ReactElement<any> | undefined
|
||||
export type HeaderMode = 'float' | 'screen' | 'none';
|
||||
|
||||
export type HeaderProps = NavigationSceneRendererProps & {
|
||||
mode: HeaderMode,
|
||||
onNavigateBack?: () => void,
|
||||
renderLeftComponent: SubViewRenderer,
|
||||
renderRightComponent: SubViewRenderer,
|
||||
renderTitleComponent: SubViewRenderer,
|
||||
tintColor?: string,
|
||||
router: NavigationRouter,
|
||||
}
|
||||
router: NavigationRouter<
|
||||
NavigationState,
|
||||
NavigationAction,
|
||||
NavigationStackScreenOptions
|
||||
>,
|
||||
getScreenDetails: (navigationScene: NavigationScene) => NavigationScreenDetails<
|
||||
NavigationStackScreenOptions
|
||||
>,
|
||||
style: Style,
|
||||
};
|
||||
|
||||
/**
|
||||
* NavigationState is a tree of routes for a single navigator, where each child
|
||||
@@ -46,15 +56,17 @@ export type HeaderProps = NavigationSceneRendererProps & {
|
||||
* The state for the root navigator of our app represents the whole navigation
|
||||
* state for the whole app.
|
||||
*/
|
||||
export interface NavigationState {
|
||||
export type NavigationState = {
|
||||
/**
|
||||
* Index refers to the active child route in the routes array.
|
||||
*/
|
||||
index: number,
|
||||
routes: any[],
|
||||
}
|
||||
routes: Array<any>,
|
||||
};
|
||||
|
||||
export interface NavigationRoute<P> {
|
||||
export type NavigationRoute<Params> = NavigationLeafRoute<Params> | NavigationStateRoute<Params>;
|
||||
|
||||
export type NavigationLeafRoute<Params> = {
|
||||
/**
|
||||
* React's key used by some navigators. No need to specify these manually,
|
||||
* they will be defined by the router.
|
||||
@@ -73,236 +85,179 @@ export interface NavigationRoute<P> {
|
||||
* Params passed to this route when navigating to it,
|
||||
* e.g. `{ car_id: 123 }` in a route that displays a car.
|
||||
*/
|
||||
params: P,
|
||||
}
|
||||
params?: Params,
|
||||
};
|
||||
|
||||
export interface NavigationRouter {
|
||||
export type NavigationStateRoute<NavigationLeafRouteParams> = NavigationLeafRoute<NavigationLeafRouteParams> & {
|
||||
index: number,
|
||||
routes: Array<NavigationRoute<any>>,
|
||||
};
|
||||
|
||||
export type NavigationScreenOptionsGetter<Options, Action> = (
|
||||
navigation: NavigationScreenProp<NavigationRoute<any>, Action>,
|
||||
screenProps?: { [key: string]: any }
|
||||
) => Options;
|
||||
|
||||
export type NavigationRouter<State, Action, Options> = {
|
||||
/**
|
||||
* The reducer that outputs the new navigation state for a given action, with
|
||||
* an optional previous state. When the action is considered handled but the
|
||||
* state is unchanged, the output state is null.
|
||||
*/
|
||||
getStateForAction: (
|
||||
action: NavigationAction,
|
||||
lastState?: NavigationState,
|
||||
) => NavigationState | undefined,
|
||||
getStateForAction: (action: Action, lastState: (State | null)) => (State | null),
|
||||
|
||||
/**
|
||||
* Maps a URI-like string to an action. This can be mapped to a state
|
||||
* using `getStateForAction`.
|
||||
*/
|
||||
getActionForPathAndParams: (path: string, params?: NavigationParams) => NavigationAction | undefined,
|
||||
getActionForPathAndParams: (
|
||||
path: string,
|
||||
params?: NavigationParams
|
||||
) => (Action | null),
|
||||
|
||||
getPathAndParamsForState: (state: NavigationState) => { path: string, params?: NavigationParams },
|
||||
getPathAndParamsForState: (
|
||||
state: State
|
||||
) => {
|
||||
path: string,
|
||||
params?: NavigationParams,
|
||||
},
|
||||
|
||||
getComponentForRouteName: (routeName: string) => NavigationComponent,
|
||||
|
||||
getComponentForState: (state: NavigationState) => NavigationComponent,
|
||||
getComponentForState: (state: State) => NavigationComponent,
|
||||
|
||||
/**
|
||||
* Gets the screen config for a given navigation screen prop.
|
||||
* Gets the screen navigation options for a given screen.
|
||||
*
|
||||
* For example, we could get the config for a 'Foo' screen when the
|
||||
* For example, we could get the config for the 'Foo' screen when the
|
||||
* `navigation.state` is:
|
||||
*
|
||||
* {routeName: 'Foo', key: '123'}
|
||||
*/
|
||||
getScreenConfig: (
|
||||
navigation: NavigationScreenProp<any, NavigationAction>,
|
||||
optionName: string,
|
||||
) => any, // todo, fix this any type to become a key of NavigationScreenConfig
|
||||
}
|
||||
getScreenOptions: NavigationScreenOptionsGetter<Options, Action>,
|
||||
};
|
||||
|
||||
type NavigationFunc<E> = (navigation: NavigationScreenProp<any, NavigationAction>, config: E) => E
|
||||
export type NavigationScreenOption<T> =
|
||||
T
|
||||
| ((
|
||||
navigation: NavigationScreenProp<NavigationRoute<any>, NavigationAction>,
|
||||
config: T
|
||||
) => T);
|
||||
|
||||
export type NavigationScreenOption<T> = T | NavigationFunc<T>
|
||||
export type Style = ViewStyle;
|
||||
|
||||
export interface HeaderConfig {
|
||||
/**
|
||||
* Title string used by the navigation bar, or a custom component
|
||||
*/
|
||||
title?: string | React.ReactElement<any>;
|
||||
export type NavigationScreenDetails<T> = {
|
||||
options: T,
|
||||
state: NavigationRoute<any>,
|
||||
navigation: NavigationScreenProp<NavigationRoute<any>, NavigationAction>,
|
||||
};
|
||||
|
||||
/**
|
||||
* Whether the navigation bar is visible.
|
||||
*/
|
||||
visible?: boolean;
|
||||
|
||||
/**
|
||||
* Renders a custom right component
|
||||
*/
|
||||
right?: React.ReactElement<any>,
|
||||
|
||||
/**
|
||||
* Renders a custom left component
|
||||
*/
|
||||
left?: React.ReactElement<any>
|
||||
|
||||
/**
|
||||
* Style passed into navigation bar container
|
||||
*/
|
||||
style?: ViewStyle,
|
||||
|
||||
/**
|
||||
* Style passed into navigation bar title
|
||||
*/
|
||||
titleStyle?: TextStyle,
|
||||
|
||||
// // Style of title text
|
||||
// titleTextStyle?: $NavigationThunk<Object>,
|
||||
// // Tint color of navigation bar contents
|
||||
// tintColor?: $NavigationThunk<string>,
|
||||
// // Navigation bar height
|
||||
// height?: $NavigationThunk<number>,
|
||||
// // Navigation bar translucentcy
|
||||
// translucent?: $NavigationThunk<boolean>,
|
||||
// // Renders a custom left component
|
||||
// renderLeft?: React.Element<*> |
|
||||
// (navigation: NavigationProp<*>, canGoBack: boolean) => React.Element<*>,
|
||||
// // Renders a custom navigation bar background
|
||||
// renderBackground?: $NavigationThunk<React.Element<*>>,
|
||||
}
|
||||
|
||||
export interface TabBarConfig {
|
||||
/**
|
||||
* Icon used by the tab bar.
|
||||
*/
|
||||
icon?: (options: { tintColor: string, focused: boolean }) => React.ReactElement<any> | undefined;
|
||||
/**
|
||||
* Label text used by the tab bar.
|
||||
*/
|
||||
label?: string | React.ReactElement<any>;
|
||||
}
|
||||
|
||||
export interface DrawerConfig {
|
||||
/**
|
||||
* Icon used by the drawer.
|
||||
*/
|
||||
icon?: (options: { tintColor: string, focused: boolean }) => React.ReactElement<any> | undefined;
|
||||
/**
|
||||
* Label text used by the drawer.
|
||||
*/
|
||||
label?: string;
|
||||
}
|
||||
|
||||
export interface CardStackConfig {
|
||||
/**
|
||||
* Whether you can use gestures to dismiss this screen.
|
||||
* Defaults to true on iOS, false on Android.
|
||||
*/
|
||||
gesturesEnabled?: boolean;
|
||||
}
|
||||
|
||||
export interface NavigationScreenOptions {
|
||||
/**
|
||||
* Title is rendered by certain navigators, e.g. the tab navigator,
|
||||
* or on web as the title of the browser tab.
|
||||
*/
|
||||
title?: NavigationScreenOption<string>;
|
||||
/**
|
||||
* Options passed to the navigation bar for this screen.
|
||||
*/
|
||||
header?: NavigationScreenOption<HeaderConfig>;
|
||||
/**
|
||||
* Options passed to the tab bar for this screen.
|
||||
*/
|
||||
tabBar?: NavigationScreenOption<TabBarConfig>;
|
||||
/**
|
||||
* Options passed to the drawer for this screen.
|
||||
*/
|
||||
drawer?: NavigationScreenOption<DrawerConfig>;
|
||||
/**
|
||||
* Options passed to the card stack for this screen.
|
||||
*/
|
||||
cardStack?: NavigationScreenOption<CardStackConfig>;
|
||||
}
|
||||
|
||||
export interface NavigationScreenConfig {
|
||||
export type NavigationScreenOptions = {
|
||||
title?: string,
|
||||
header?: HeaderConfig,
|
||||
tabBar?: TabBarConfig,
|
||||
drawer?: DrawerConfig;
|
||||
}
|
||||
};
|
||||
|
||||
export type NavigationComponent = NavigationScreenComponent<any> | NavigationNavigator<any>
|
||||
export type NavigationScreenConfigProps = {
|
||||
navigation: NavigationScreenProp<NavigationRoute<any>, NavigationAction>,
|
||||
screenProps: { [key: string]: any }
|
||||
};
|
||||
|
||||
export type NavigationScreenComponent<T> = React.ComponentClass<T> & {
|
||||
navigationOptions?: NavigationScreenOptions,
|
||||
}
|
||||
export type NavigationScreenConfig<Options> =
|
||||
Options
|
||||
| (NavigationScreenConfigProps &
|
||||
((navigationOptionsContainer: {
|
||||
navigationOptions: NavigationScreenProp<
|
||||
NavigationRoute<any>,
|
||||
NavigationAction
|
||||
>,
|
||||
}) => Options));
|
||||
|
||||
export type NavigationNavigator<T> = React.ComponentClass<T> & {
|
||||
router?: NavigationRouter,
|
||||
navigationOptions?: NavigationScreenOptions,
|
||||
}
|
||||
export type NavigationComponent =
|
||||
NavigationScreenComponent<any, any>
|
||||
| NavigationNavigator<any, any, any, any>;
|
||||
|
||||
export type NavigationScreenComponent<T, Options> = React.ComponentClass<T> & {
|
||||
navigationOptions?: NavigationScreenConfig<Options>,
|
||||
};
|
||||
|
||||
export type NavigationNavigator<T, State, Action, Options> = React.ComponentClass<T> & {
|
||||
router?: NavigationRouter<State, Action, Options>,
|
||||
navigationOptions?: NavigationScreenConfig<Options>,
|
||||
};
|
||||
|
||||
export interface NavigationParams {
|
||||
[key: string]: any,
|
||||
}
|
||||
|
||||
export interface NavigationNavigateAction {
|
||||
type?: 'Navigation/NAVIGATE',
|
||||
export type NavigationNavigateAction = {
|
||||
type: 'Navigation/NAVIGATE',
|
||||
routeName: string,
|
||||
params?: NavigationParams,
|
||||
|
||||
// The action to run inside the sub-router
|
||||
action?: NavigationNavigateAction,
|
||||
}
|
||||
};
|
||||
|
||||
export interface NavigationBackAction {
|
||||
type?: 'Navigation/BACK',
|
||||
key?: string,
|
||||
}
|
||||
export type NavigationBackAction = {
|
||||
type: 'Navigation/BACK',
|
||||
key?: string | null,
|
||||
};
|
||||
|
||||
export interface NavigationSetParamsAction {
|
||||
type?: 'Navigation/SET_PARAMS',
|
||||
export type NavigationSetParamsAction = {
|
||||
type: 'Navigation/SET_PARAMS',
|
||||
|
||||
// The key of the route where the params should be set
|
||||
key: string,
|
||||
|
||||
// The new params to merge into the existing route params
|
||||
params?: NavigationParams,
|
||||
}
|
||||
};
|
||||
|
||||
export interface NavigationInitAction {
|
||||
type?: 'Navigation/INIT',
|
||||
export type NavigationInitAction = {
|
||||
type: 'Navigation/INIT',
|
||||
params?: NavigationParams,
|
||||
}
|
||||
};
|
||||
|
||||
export interface NavigationResetAction {
|
||||
type?: 'Navigation/RESET',
|
||||
export type NavigationResetAction = {
|
||||
type: 'Navigation/RESET',
|
||||
index: number,
|
||||
key?: string | null,
|
||||
actions: NavigationNavigateAction[],
|
||||
}
|
||||
actions: Array<NavigationNavigateAction>,
|
||||
};
|
||||
|
||||
export interface NavigationUriAction {
|
||||
type?: 'Navigation/URI',
|
||||
export type NavigationUriAction = {
|
||||
type: 'Navigation/URI',
|
||||
uri: string,
|
||||
}
|
||||
|
||||
export interface NavigationContainerOptions {
|
||||
// This is used to extract the path from the URI passed to the app for a deep link
|
||||
URIPrefix?: string,
|
||||
}
|
||||
|
||||
export interface NavigationContainerConfig {
|
||||
containerOptions?: NavigationContainerOptions,
|
||||
}
|
||||
};
|
||||
|
||||
export interface NavigationStackViewConfig {
|
||||
mode?: 'card' | 'modal',
|
||||
headerMode?: HeaderMode,
|
||||
headerComponent?: React.ComponentClass<HeaderProps>,
|
||||
cardStyle?: ViewStyle,
|
||||
cardStyle?: Style,
|
||||
transitionConfig?: () => TransitionConfig,
|
||||
onTransitionStart?: () => void,
|
||||
onTransitionEnd?: () => void,
|
||||
}
|
||||
|
||||
export type NavigationStackScreenOptions = NavigationScreenOptions & {
|
||||
header?: (React.ReactElement<any> | ((headerProps: HeaderProps) => React.ReactElement<any>)) | null,
|
||||
headerTitle?: string | React.ReactElement<any>,
|
||||
headerTitleStyle?: Style,
|
||||
headerTintColor?: string,
|
||||
headerLeft?: React.ReactElement<any>,
|
||||
headerBackTitle?: string,
|
||||
headerTruncatedBackTitle?: string,
|
||||
headerBackTitleStyle?: Style,
|
||||
headerPressColorAndroid?: string,
|
||||
headerRight?: React.ReactElement<any>,
|
||||
headerStyle?: Style,
|
||||
gesturesEnabled?: boolean,
|
||||
};
|
||||
|
||||
export interface NavigationStackRouterConfig {
|
||||
initialRouteName?: string,
|
||||
initialRouteParams?: NavigationParams,
|
||||
paths?: NavigationPathsConfig,
|
||||
navigationOptions?: NavigationScreenOptions,
|
||||
navigationOptions?: NavigationScreenConfig<NavigationStackScreenOptions>,
|
||||
}
|
||||
|
||||
export type NavigationStackAction =
|
||||
@@ -310,238 +265,279 @@ export type NavigationStackAction =
|
||||
| NavigationNavigateAction
|
||||
| NavigationBackAction
|
||||
| NavigationSetParamsAction
|
||||
| NavigationResetAction
|
||||
| NavigationResetAction;
|
||||
|
||||
export type NavigationTabAction =
|
||||
NavigationInitAction
|
||||
| NavigationNavigateAction
|
||||
| NavigationBackAction
|
||||
| NavigationBackAction;
|
||||
|
||||
export type NavigationAction =
|
||||
NavigationInitAction
|
||||
| NavigationStackAction
|
||||
| NavigationTabAction
|
||||
|
||||
export namespace NavigationActions {
|
||||
function init(options?: NavigationInitAction): NavigationInitAction;
|
||||
function navigate(options: NavigationNavigateAction): NavigationNavigateAction;
|
||||
function reset(options: NavigationResetAction): NavigationResetAction;
|
||||
function back(options?: NavigationBackAction): NavigationBackAction;
|
||||
function setParams(options: NavigationSetParamsAction): NavigationSetParamsAction;
|
||||
}
|
||||
| NavigationTabAction;
|
||||
|
||||
export type NavigationRouteConfig<T> = T & {
|
||||
navigationOptions?: NavigationScreenOptions,
|
||||
navigationOptions?: NavigationScreenConfig<any>,
|
||||
path?: string,
|
||||
}
|
||||
};
|
||||
|
||||
export interface NavigationPathsConfig {
|
||||
export type NavigationScreenRouteConfig =
|
||||
{
|
||||
screen: NavigationComponent,
|
||||
}
|
||||
| {
|
||||
getScreen: () => NavigationComponent,
|
||||
};
|
||||
|
||||
export type NavigationPathsConfig = {
|
||||
[routeName: string]: string,
|
||||
}
|
||||
};
|
||||
|
||||
export interface NavigationTabRouterConfig {
|
||||
initialRouteName?: string,
|
||||
paths?: NavigationPathsConfig,
|
||||
navigationOptions?: NavigationScreenOptions,
|
||||
order?: string[], // todo: type these as the real route names rather than 'string'
|
||||
navigationOptions?: NavigationScreenConfig<NavigationTabScreenOptions>,
|
||||
order?: Array<string>, // todo: type these as the real route names rather than 'string'
|
||||
|
||||
// Does the back button cause the router to switch to the initial tab
|
||||
backBehavior?: 'none' | 'initialRoute', // defaults `initialRoute`
|
||||
}
|
||||
|
||||
export interface NavigationRouteConfigMap {
|
||||
export type NavigationTabScreenOptions = NavigationScreenOptions & {
|
||||
tabBarIcon?:
|
||||
React.ReactElement<any>
|
||||
| ((options: { tintColor: (string | null), focused: boolean }) => (React.ReactElement<
|
||||
any
|
||||
> | null)),
|
||||
tabBarLabel?:
|
||||
string
|
||||
| React.ReactElement<any>
|
||||
| ((options: { tintColor: (string | null), focused: boolean }) => (React.ReactElement<
|
||||
any
|
||||
> | null)),
|
||||
tabBarVisible?: boolean,
|
||||
};
|
||||
|
||||
export type NavigationDrawerScreenOptions = NavigationScreenOptions & {
|
||||
drawerIcon?:
|
||||
React.ReactElement<any>
|
||||
| ((options: { tintColor: (string | null), focused: boolean }) => (React.ReactElement<
|
||||
any
|
||||
> | null)),
|
||||
drawerLabel?:
|
||||
React.ReactElement<any>
|
||||
| ((options: { tintColor: (string | null), focused: boolean }) => (React.ReactElement<
|
||||
any
|
||||
> | null)),
|
||||
};
|
||||
|
||||
export type NavigationRouteConfigMap = {
|
||||
[routeName: string]: NavigationRouteConfig<any>,
|
||||
}
|
||||
};
|
||||
|
||||
export type NavigationDispatch<A> = (action: A) => boolean
|
||||
export type NavigationDispatch<A> = (action: A) => boolean;
|
||||
|
||||
export interface NavigationProp<S, A> {
|
||||
export type NavigationProp<S, A> = {
|
||||
state: S,
|
||||
dispatch: NavigationDispatch<A>,
|
||||
}
|
||||
};
|
||||
|
||||
export type NavigationScreenProp<S, A> = NavigationProp<S, A> & {
|
||||
goBack: (routeKey?: string | null) => boolean,
|
||||
navigate: (routeName: string, params?: NavigationParams, action?: NavigationAction) => boolean,
|
||||
export type NavigationScreenProp<S, A> = {
|
||||
state: S,
|
||||
dispatch: NavigationDispatch<A>,
|
||||
goBack: (routeKey?: (string | null)) => boolean,
|
||||
navigate: (
|
||||
routeName: string,
|
||||
params?: NavigationParams,
|
||||
action?: NavigationAction
|
||||
) => boolean,
|
||||
setParams: (newParams: NavigationParams) => boolean,
|
||||
}
|
||||
};
|
||||
|
||||
export interface NavigationNavigatorProps<P> {
|
||||
navigation: NavigationProp<NavigationRoute<P>, NavigationAction>,
|
||||
}
|
||||
export type NavigationNavigatorProps<T> = {
|
||||
navigation?: NavigationProp<T, NavigationAction>,
|
||||
screenProps?: { [key: string]: any }
|
||||
navigationOptions?: any,
|
||||
};
|
||||
|
||||
/**
|
||||
* Gestures, Animations, and Interpolators
|
||||
*/
|
||||
|
||||
export type NavigationAnimatedValue = Animated.Value
|
||||
export type NavigationGestureDirection = 'horizontal' | 'vertical';
|
||||
|
||||
export type NavigationGestureDirection = 'horizontal' | 'vertical'
|
||||
|
||||
export interface NavigationLayout {
|
||||
height: NavigationAnimatedValue,
|
||||
export type NavigationLayout = {
|
||||
height: AnimatedValue,
|
||||
initHeight: number,
|
||||
initWidth: number,
|
||||
isMeasured: boolean,
|
||||
width: NavigationAnimatedValue,
|
||||
}
|
||||
width: AnimatedValue,
|
||||
};
|
||||
|
||||
export interface NavigationScene {
|
||||
export type NavigationScene = {
|
||||
index: number,
|
||||
isActive: boolean,
|
||||
isStale: boolean,
|
||||
key: string,
|
||||
route: any,
|
||||
}
|
||||
route: NavigationRoute<any>,
|
||||
};
|
||||
|
||||
export interface NavigationTransitionProps {
|
||||
// The layout of the transitioner of the scenes.
|
||||
export type NavigationTransitionProps = {
|
||||
// The layout of the screen container
|
||||
layout: NavigationLayout,
|
||||
|
||||
// The navigation state of the transitioner.
|
||||
navigationState: NavigationState,
|
||||
// The destination navigation state of the transition
|
||||
navigation: NavigationScreenProp<NavigationState, NavigationAction>,
|
||||
|
||||
// The progressive index of the transitioner's navigation state.
|
||||
position: NavigationAnimatedValue,
|
||||
position: AnimatedValue,
|
||||
|
||||
// The value that represents the progress of the transition when navigation
|
||||
// state changes from one to another. Its numberic value will range from 0
|
||||
// to 1.
|
||||
// progress.__getAnimatedValue() < 1 : transtion is happening.
|
||||
// progress.__getAnimatedValue() == 1 : transtion completes.
|
||||
progress: NavigationAnimatedValue,
|
||||
progress: AnimatedValue,
|
||||
|
||||
// All the scenes of the transitioner.
|
||||
scenes: NavigationScene[],
|
||||
scenes: Array<NavigationScene>,
|
||||
|
||||
// The active scene, corresponding to the route at
|
||||
// `navigationState.routes[navigationState.index]`. When rendering
|
||||
// `navigation.state.routes[navigation.state.index]`. When rendering
|
||||
// NavigationSceneRendererPropsIndex, the scene does not refer to the active
|
||||
// scene, but instead the scene that is being rendered. The index always
|
||||
// is the index of the scene
|
||||
scene: NavigationScene,
|
||||
index: number,
|
||||
navigation: NavigationScreenProp<any, NavigationAction>,
|
||||
|
||||
// The gesture distance for `horizontal` and `vertical` transitions
|
||||
gestureResponseDistance?: number,
|
||||
}
|
||||
screenProps?: { [key: string]: any }
|
||||
};
|
||||
|
||||
// The scene renderer props are nearly identical to the props used for rendering
|
||||
// a transition. The exception is that the passed scene is not the active scene
|
||||
// but is instead the scene that the renderer should render content for.
|
||||
export type NavigationSceneRendererProps = NavigationTransitionProps
|
||||
export type NavigationSceneRendererProps = NavigationTransitionProps;
|
||||
|
||||
export interface NavigationPanHandlers {
|
||||
onMoveShouldSetResponder: () => void,
|
||||
onMoveShouldSetResponderCapture: () => void,
|
||||
onResponderEnd: () => void,
|
||||
onResponderGrant: () => void,
|
||||
onResponderMove: () => void,
|
||||
onResponderReject: () => void,
|
||||
onResponderRelease: () => void,
|
||||
onResponderStart: () => void,
|
||||
onResponderTerminate: () => void,
|
||||
onResponderTerminationRequest: () => void,
|
||||
onStartShouldSetResponder: () => void,
|
||||
onStartShouldSetResponderCapture: () => void,
|
||||
}
|
||||
|
||||
export interface NavigationTransitionSpec {
|
||||
export type NavigationTransitionSpec = {
|
||||
duration?: number,
|
||||
// An easing function from `Easing`.
|
||||
easing?: () => any,
|
||||
easing?: (t: number) => number,
|
||||
// A timing function such as `Animated.timing`.
|
||||
timing?: (value: NavigationAnimatedValue, config: any) => any,
|
||||
}
|
||||
timing?: (value: AnimatedValue, config: any) => any,
|
||||
};
|
||||
|
||||
/**
|
||||
* Describes a visual transition from one screen to another.
|
||||
*/
|
||||
export type TransitionConfig = {
|
||||
// The basics properties of the animation, such as duration and easing
|
||||
transitionSpec?: NavigationTransitionSpec,
|
||||
// How to animate position and opacity of the screen
|
||||
// based on the value generated by the transitionSpec
|
||||
screenInterpolator?: (props: NavigationSceneRendererProps) => any,
|
||||
};
|
||||
|
||||
export type NavigationAnimationSetter = (
|
||||
position: NavigationAnimatedValue,
|
||||
position: AnimatedValue,
|
||||
newState: NavigationState,
|
||||
lastState: NavigationState,
|
||||
) => void
|
||||
lastState: NavigationState
|
||||
) => void;
|
||||
|
||||
export type NavigationSceneRenderer = (
|
||||
props: NavigationSceneRendererProps,
|
||||
) => React.ReactElement<any>
|
||||
export type NavigationSceneRenderer = () => (React.ReactElement<any> | null);
|
||||
|
||||
export type NavigationStyleInterpolator = (
|
||||
props: NavigationSceneRendererProps,
|
||||
) => ViewStyle
|
||||
props: NavigationSceneRendererProps
|
||||
) => Style;
|
||||
|
||||
export interface LayoutEvent {
|
||||
export type LayoutEvent = {
|
||||
nativeEvent: {
|
||||
layout: {
|
||||
x: number;
|
||||
y: number;
|
||||
width: number;
|
||||
height: number;
|
||||
x: number,
|
||||
y: number,
|
||||
width: number,
|
||||
height: number,
|
||||
},
|
||||
}
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
/**
|
||||
* END FLOW TYPEDEFINITION.JS PORT
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* BEGIN MANUAL DEFINITIONS OUTSIDE OF TYPEDEFINITION.JS
|
||||
*/
|
||||
|
||||
// From addNavigatorHelpers.js
|
||||
export function addNavigationHelpers<S>(navigation: NavigationProp<S, NavigationAction>): NavigationScreenProp<S, NavigationAction>;
|
||||
|
||||
// From createNavigationContainer.js
|
||||
interface NavigationContainerProps {
|
||||
screenProps?: any
|
||||
navigation?: NavigationProp<any, NavigationAction>
|
||||
uriPrefix?: string | RegExp,
|
||||
onNavigationStateChange?: (
|
||||
preNavigationState: NavigationState,
|
||||
prevNavigationState: NavigationState,
|
||||
nextNavigationState: NavigationState,
|
||||
action: NavigationAction,
|
||||
) => void,
|
||||
style?: ViewStyle
|
||||
}
|
||||
|
||||
interface NavigationContainerState {
|
||||
nav?: NavigationState
|
||||
style?: ViewStyle,
|
||||
}
|
||||
|
||||
export interface NavigationContainer extends React.ComponentClass<
|
||||
NavigationContainerProps
|
||||
NavigationContainerProps & NavigationNavigatorProps<any>
|
||||
> {
|
||||
router: NavigationRouter
|
||||
router: NavigationRouter<any, any, any>
|
||||
screenProps: { [key: string]: any },
|
||||
navigationOptions: any,
|
||||
state: { nav: NavigationState | null },
|
||||
}
|
||||
|
||||
export type StackNavigatorConfig =
|
||||
NavigationContainerConfig
|
||||
& NavigationStackViewConfig
|
||||
& NavigationStackRouterConfig;
|
||||
export interface StackNavigatorConfig extends NavigationStackViewConfig, NavigationStackRouterConfig {
|
||||
containerOptions?: any,
|
||||
}
|
||||
|
||||
// Return createNavigationContainer
|
||||
export function StackNavigator(
|
||||
export function StackNavigator<T>(
|
||||
routeConfigMap: NavigationRouteConfigMap,
|
||||
stackConfig?: StackNavigatorConfig,
|
||||
): NavigationContainer
|
||||
): NavigationContainer;
|
||||
|
||||
/**
|
||||
* Drawer Navigator
|
||||
*/
|
||||
export interface DrawNavigatorConfig {
|
||||
drawerWidth?: number,
|
||||
drawerPosition?: 'left'|'right',
|
||||
contentComponent?: React.ReactElement<any>,
|
||||
export interface DrawerViewConfig {
|
||||
drawerWidth: number,
|
||||
drawerPosition: 'left' | 'right',
|
||||
contentComponent: React.ComponentClass<any>,
|
||||
contentOptions?: any,
|
||||
style?: ViewStyle,
|
||||
}
|
||||
export interface DrawerNavigatorConfig extends NavigationTabRouterConfig, DrawerViewConfig {
|
||||
containerConfig?: any,
|
||||
contentOptions?: {
|
||||
activeTintColor?: string,
|
||||
activeBackgroundColor?: string,
|
||||
inactiveTintColor?: string,
|
||||
inactiveBackgroundColor?: string,
|
||||
style?: ViewStyle,
|
||||
labelStyle?: TextStyle
|
||||
labelStyle?: TextStyle,
|
||||
}
|
||||
}
|
||||
|
||||
export function DrawerNavigator(
|
||||
export function DrawerNavigator<T>(
|
||||
routeConfigMap: NavigationRouteConfigMap,
|
||||
drawConfig?: DrawNavigatorConfig,
|
||||
drawerConfig?: DrawerNavigatorConfig,
|
||||
): NavigationContainer;
|
||||
|
||||
/**
|
||||
* Tab Navigator
|
||||
*/
|
||||
export interface TabNavigatorConfig {
|
||||
tabBarComponent?: React.ReactElement<any>,
|
||||
tabBarPosition?: 'top'|'bottom',
|
||||
swipeEnabled?: boolean,
|
||||
animationEnabled?: boolean,
|
||||
lazy?: boolean,
|
||||
|
||||
// From views/TabView/TabView.js
|
||||
export interface TabViewConfig {
|
||||
tabBarComponent?: React.ComponentClass<any>,
|
||||
tabBarPosition?: 'top' | 'bottom',
|
||||
tabBarOptions?: {
|
||||
activeTintColor?: string,
|
||||
activeBackgroundColor?: string,
|
||||
@@ -559,104 +555,83 @@ export interface TabNavigatorConfig {
|
||||
scrollEnabled?: boolean,
|
||||
tabStyle?: ViewStyle,
|
||||
indicatorStyle?: ViewStyle
|
||||
}
|
||||
initialRouteName?: string,
|
||||
order?: string[],
|
||||
paths?: any // TODO: better def
|
||||
backBehavior?: 'initialRoute'|'none'
|
||||
},
|
||||
swipeEnabled?: boolean,
|
||||
animationEnabled?: boolean,
|
||||
lazy?: boolean,
|
||||
}
|
||||
|
||||
export function TabNavigator(
|
||||
// From navigators/TabNavigator.js
|
||||
export interface TabNavigatorConfig extends NavigationTabRouterConfig, TabViewConfig { }
|
||||
|
||||
// From navigators/TabNavigator.js
|
||||
export function TabNavigator<T>(
|
||||
routeConfigMap: NavigationRouteConfigMap,
|
||||
drawConfig?: TabNavigatorConfig,
|
||||
): NavigationContainer;
|
||||
|
||||
export const TabBarTop: React.ComponentClass<any>;
|
||||
export const TabBarBottom: React.ComponentClass<any>;
|
||||
|
||||
/**
|
||||
* Screen Options
|
||||
* NavigationActions
|
||||
* @todo Is this necessary, or can we remove? Not referenced anywhere else here, but it seems a
|
||||
* recent commit or two touches these. Can anyone provide a strong use case for keeping this in?
|
||||
*/
|
||||
export interface StackNavigatorScreenOptions {
|
||||
title?: string;
|
||||
headerVisible?: boolean;
|
||||
headerTitle?: string|React.ReactElement<any>;
|
||||
headerBackTitle?: string;
|
||||
headerTruncatedBackTitle?: string;
|
||||
headerRight?: React.ReactElement<any>;
|
||||
headerLeft?: React.ReactElement<any>;
|
||||
headerStyle?: ViewStyle;
|
||||
headerTitleStyle?: ViewStyle;
|
||||
headerTintColor?: string;
|
||||
headerPressColorAndroid?: string;
|
||||
gesturesEnabled?: boolean;
|
||||
export namespace NavigationActions {
|
||||
function init(options?: NavigationInitAction): NavigationInitAction;
|
||||
function navigate(options: NavigationNavigateAction): NavigationNavigateAction;
|
||||
function reset(options: NavigationResetAction): NavigationResetAction;
|
||||
function back(options?: NavigationBackAction): NavigationBackAction;
|
||||
function setParams(options: NavigationSetParamsAction): NavigationSetParamsAction;
|
||||
}
|
||||
|
||||
export interface TabNavigatorScreenOptions {
|
||||
title?: string;
|
||||
tabBarVisible?: boolean;
|
||||
tabBarIcon?: React.ReactElement<any>
|
||||
| ((options: { focused: boolean, tintColor: string }) => React.ReactElement<any>);
|
||||
tabBarLabel?: string
|
||||
| React.ReactElement<any>
|
||||
| ((options: { focused: boolean, tintColor: string }) => React.ReactElement<any>);
|
||||
}
|
||||
|
||||
export interface DrawerNavigatorScreenOptions {
|
||||
title?: string;
|
||||
drawerLabel?: string
|
||||
|React.ReactElement<any>
|
||||
| ((options: {focused: boolean, tintColor: string}) => React.ReactElement<any>)
|
||||
;
|
||||
drawerIcon?: React.ReactElement<any>
|
||||
| ((options: {focused: boolean, tintColor: string}) => React.ReactElement<any>)
|
||||
;
|
||||
}
|
||||
|
||||
export type NavigationNavigateActionCreator = (options: NavigationNavigateAction) => boolean;
|
||||
export type NavigationResetActionCreator = (options: NavigationResetAction) => boolean;
|
||||
export type NavigationBackActionCreator = (options?: NavigationBackAction) => boolean;
|
||||
export type NavigationSetParamsActionCreator = (options: NavigationSetParamsAction) => boolean;
|
||||
|
||||
export interface NavigationComponentProps<T> {
|
||||
screenProps: any
|
||||
navigation: {
|
||||
dispatch: any
|
||||
goBack: NavigationBackActionCreator
|
||||
navigate: NavigationNavigateActionCreator
|
||||
setParams: NavigationSetParamsActionCreator
|
||||
state: {
|
||||
key: string
|
||||
routeName: string,
|
||||
params: T,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
export const TabBarTop: React.ReactElement<any>;
|
||||
export const TabBarBottom: React.ReactElement<any>;
|
||||
|
||||
/**
|
||||
* Transitioner
|
||||
* @desc From react-navigation/src/views/Transitioner.js
|
||||
*/
|
||||
interface TransitionerProps {
|
||||
configureTransition: (
|
||||
transitionProps: NavigationTransitionProps,
|
||||
prevTransitionProps?: NavigationTransitionProps
|
||||
) => NavigationTransitionSpec
|
||||
navigation: NavigationProp<any, NavigationAction>
|
||||
onTransitionEnd?: () => void
|
||||
onTransitionStart?: () => void
|
||||
) => NavigationTransitionSpec,
|
||||
navigation: NavigationScreenProp<NavigationState, NavigationAction>,
|
||||
onTransitionEnd?: () => void,
|
||||
onTransitionStart?: () => void,
|
||||
render: (
|
||||
transitionProps: NavigationTransitionProps,
|
||||
prevTransitionProps?: NavigationTransitionProps
|
||||
) => any
|
||||
style?: ViewStyle
|
||||
style?: ViewStyle,
|
||||
}
|
||||
|
||||
interface TransitionerState {
|
||||
layout: NavigationLayout
|
||||
position: Animated.Value
|
||||
progress: Animated.Value
|
||||
scenes: Array<NavigationScene>
|
||||
layout: NavigationLayout,
|
||||
position: Animated.Value,
|
||||
progress: Animated.Value,
|
||||
scenes: Array<NavigationScene>,
|
||||
}
|
||||
|
||||
export class Transitioner extends React.Component<
|
||||
TransitionerProps,
|
||||
TransitionerState
|
||||
> {
|
||||
> { }
|
||||
|
||||
/**
|
||||
* END MANUAL DEFINITIONS OUTSIDE OF TYPEDEFINITION.JS
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* BEGIN CUSTOM CONVENIENCE INTERFACES
|
||||
*/
|
||||
|
||||
export interface NavigationScreenProps<Params> {
|
||||
navigation: NavigationScreenProp<NavigationRoute<Params>, NavigationAction>,
|
||||
screenProps?: { [key: string]: any },
|
||||
navigationOptions?: NavigationScreenConfig<any>,
|
||||
}
|
||||
|
||||
/**
|
||||
* END CUSTOM CONVENIENCE INTERFACES
|
||||
*/
|
||||
|
||||
@@ -1,81 +1,221 @@
|
||||
import * as React from 'react';
|
||||
import { View } from 'react-native';
|
||||
import {
|
||||
TouchableOpacity,
|
||||
View,
|
||||
ViewStyle,
|
||||
} from 'react-native';
|
||||
import {
|
||||
addNavigationHelpers,
|
||||
NavigationRouteConfigMap,
|
||||
NavigationScreenProp,
|
||||
NavigationScreenProps,
|
||||
NavigationStackAction,
|
||||
NavigationStackScreenOptions,
|
||||
NavigationTabScreenOptions,
|
||||
StackNavigator,
|
||||
TabNavigatorScreenOptions,
|
||||
StackNavigatorConfig,
|
||||
TabNavigator,
|
||||
TabNavigatorConfig,
|
||||
TabBarTop,
|
||||
TabBarBottom,
|
||||
Transitioner,
|
||||
NavigationProp,
|
||||
NavigationAction,
|
||||
NavigationTransitionProps,
|
||||
Transitioner
|
||||
} from 'react-navigation';
|
||||
|
||||
const Start = (
|
||||
<View />
|
||||
// Constants
|
||||
const viewStyle: ViewStyle = {
|
||||
flex: 1,
|
||||
margin: 42,
|
||||
padding: 0,
|
||||
backgroundColor: "white",
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @class StartScreen @extends React.Component
|
||||
* @desc Simple screen component class with typed component props that should
|
||||
* receive the navigation prop from the AppNavigator.
|
||||
*/
|
||||
const ROUTE_NAME_START_SCREEN = "StartScreen";
|
||||
interface StartScreenNavigationParams {
|
||||
id: number,
|
||||
s: string,
|
||||
}
|
||||
interface StartScreenProps extends NavigationScreenProps<StartScreenNavigationParams> { }
|
||||
class StartScreen extends React.Component<StartScreenProps, {}> {
|
||||
render() {
|
||||
// Implicit type checks.
|
||||
const navigationStateParams: StartScreenNavigationParams = this.props.navigation.state.params;
|
||||
const id = this.props.navigation.state.params.id;
|
||||
const s = this.props.navigation.state.params.s;
|
||||
|
||||
return (
|
||||
<View>
|
||||
<TouchableOpacity onPress={this.navigateToNextScreen} />
|
||||
</View>
|
||||
);
|
||||
}
|
||||
private navigateToNextScreen = (): void => {
|
||||
this.props.navigation.navigate(
|
||||
ROUTE_NAME_NEXT_SCREEN,
|
||||
{
|
||||
id: this.props.navigation.state.params.id,
|
||||
name: this.props.navigation.state.params.s,
|
||||
} as NextScreenNavigationParams,
|
||||
);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @class NextScreen @extends React.Component
|
||||
*/
|
||||
const ROUTE_NAME_NEXT_SCREEN = "NextScreen";
|
||||
interface NextScreenNavigationParams {
|
||||
id: number,
|
||||
name: string,
|
||||
}
|
||||
interface NextScreenProps extends NavigationScreenProps<NextScreenNavigationParams> { }
|
||||
class NextScreen extends React.Component<NextScreenProps, {}> {
|
||||
render() {
|
||||
// Implicit type checks.
|
||||
const navigationStateParams: NextScreenNavigationParams = this.props.navigation.state.params;
|
||||
const id = this.props.navigation.state.params.id;
|
||||
const name = this.props.navigation.state.params.name;
|
||||
|
||||
return (
|
||||
<View />
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
const initialRouteParams: StartScreenNavigationParams = {
|
||||
id: 1,
|
||||
s: "Start",
|
||||
};
|
||||
const routeConfigMap: NavigationRouteConfigMap = {
|
||||
[ROUTE_NAME_START_SCREEN]: {
|
||||
path: "start",
|
||||
screen: StartScreen,
|
||||
},
|
||||
[ROUTE_NAME_NEXT_SCREEN]: {
|
||||
path: "next",
|
||||
screen: NextScreen,
|
||||
},
|
||||
};
|
||||
export const AppNavigator = StackNavigator(
|
||||
routeConfigMap,
|
||||
{
|
||||
initialRouteName: ROUTE_NAME_START_SCREEN,
|
||||
initialRouteParams,
|
||||
},
|
||||
);
|
||||
|
||||
export const AppNavigator = StackNavigator({
|
||||
StartImage: {
|
||||
path: 'startImage',
|
||||
screen: Start,
|
||||
},
|
||||
}, {
|
||||
initialRouteName: 'StartImage',
|
||||
});
|
||||
|
||||
/**
|
||||
* Router.
|
||||
*/
|
||||
const Router = (props: any) => (
|
||||
<AppNavigator
|
||||
navigation={
|
||||
addNavigationHelpers({
|
||||
dispatch: {},
|
||||
state: {},
|
||||
})
|
||||
}
|
||||
<AppNavigator
|
||||
navigation={
|
||||
addNavigationHelpers({
|
||||
dispatch: (action: NavigationStackAction): boolean => true,
|
||||
state: {},
|
||||
})
|
||||
}
|
||||
/>
|
||||
);
|
||||
|
||||
const tabNavigatorScreenOptions: TabNavigatorScreenOptions = {
|
||||
|
||||
/**
|
||||
* Tab navigator.
|
||||
*/
|
||||
|
||||
const tabNavigatorScreenOptions: NavigationTabScreenOptions = {
|
||||
title: 'title',
|
||||
tabBarVisible: true,
|
||||
tabBarIcon: <View />,
|
||||
tabBarLabel: 'label',
|
||||
}
|
||||
};
|
||||
|
||||
const tabNavigatorConfig: TabNavigatorConfig = {
|
||||
lazy: true,
|
||||
tabBarComponent: TabBarTop,
|
||||
tabBarOptions: tabNavigatorScreenOptions,
|
||||
};
|
||||
|
||||
const BasicTabNavigator = TabNavigator(
|
||||
routeConfigMap,
|
||||
tabNavigatorConfig,
|
||||
);
|
||||
|
||||
function renderBasicTabNavigator(): JSX.Element {
|
||||
return (
|
||||
<BasicTabNavigator
|
||||
ref={(ref: any) => { }}
|
||||
style={viewStyle}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Stack navigator.
|
||||
*/
|
||||
|
||||
const stackNavigatorScreenOptions: NavigationStackScreenOptions = {
|
||||
title: 'title',
|
||||
};
|
||||
|
||||
const stackNavigatorConfig: StackNavigatorConfig = {
|
||||
mode: "card",
|
||||
headerMode: "screen",
|
||||
navigationOptions: stackNavigatorScreenOptions,
|
||||
};
|
||||
|
||||
const BasicStackNavigator = StackNavigator(
|
||||
routeConfigMap,
|
||||
stackNavigatorConfig,
|
||||
);
|
||||
|
||||
function renderBasicStackNavigator(): JSX.Element {
|
||||
return (
|
||||
<BasicStackNavigator
|
||||
ref={(ref: any) => { }}
|
||||
style={viewStyle}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @class CustomTransitioner @extends React.Component
|
||||
* @desc Custom transitioner component. Follows react-navigation/src/views/CardStackTransitioner.js.
|
||||
*/
|
||||
interface CustomTransitionerProps {
|
||||
navigation: NavigationProp<any, NavigationAction>
|
||||
navigation: NavigationScreenProp<any, NavigationAction>
|
||||
}
|
||||
|
||||
const configureTransition = (
|
||||
_transitionProps: NavigationTransitionProps,
|
||||
_prevTransitionProps: NavigationTransitionProps
|
||||
) => {
|
||||
return {}
|
||||
}
|
||||
|
||||
const renderTransitioner = (props: NavigationTransitionProps, prevProps: NavigationTransitionProps) => {
|
||||
return <View />
|
||||
class CustomTransitioner extends React.Component<CustomTransitionerProps, null> {
|
||||
render() {
|
||||
return (
|
||||
<Transitioner
|
||||
configureTransition={this._configureTransition}
|
||||
navigation={this.props.navigation}
|
||||
render={this._render}
|
||||
onTransitionStart={() => { }}
|
||||
onTransitionEnd={() => { }}
|
||||
/>
|
||||
);
|
||||
}
|
||||
_render = (props: NavigationTransitionProps, prevProps: NavigationTransitionProps): React.ReactElement<any> => {
|
||||
return (
|
||||
<View />
|
||||
);
|
||||
}
|
||||
_configureTransition = (
|
||||
_transitionProps: NavigationTransitionProps,
|
||||
_prevTransitionProps: NavigationTransitionProps
|
||||
) => {
|
||||
return {}
|
||||
}
|
||||
}
|
||||
|
||||
const CustomTransitioner = (props: CustomTransitionerProps) => {
|
||||
<Transitioner
|
||||
configureTransition={configureTransition}
|
||||
navigation={props.navigation}
|
||||
render={renderTransitioner}
|
||||
onTransitionStart={() => { }}
|
||||
onTransitionEnd={() => { }}
|
||||
/>
|
||||
}
|
||||
|
||||
const BasicStackNavigation = StackNavigator({
|
||||
StartScreen: { screen: Start }
|
||||
});
|
||||
|
||||
<BasicStackNavigation style={{ marginTop: 52 }} />
|
||||
|
||||
@@ -2,7 +2,8 @@
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
"es6",
|
||||
"dom"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
|
||||
Vendored
+7
-7
@@ -2,7 +2,7 @@
|
||||
// Project: https://github.com/ReactTraining/react-router-native
|
||||
// Definitions by: Eduard Zintz <https://github.com/ezintz>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.2
|
||||
// TypeScript Version: 2.3
|
||||
|
||||
export {
|
||||
match,
|
||||
@@ -23,25 +23,25 @@ import * as React from 'react';
|
||||
import * as H from 'history';
|
||||
|
||||
export interface AndroidBackButtonProps {
|
||||
children: Array<React.Component<void, void>>;
|
||||
children: React.Component[];
|
||||
}
|
||||
|
||||
export class AndroidBackButton extends React.Component<AndroidBackButtonProps, void> {}
|
||||
export class AndroidBackButton extends React.Component<AndroidBackButtonProps> {}
|
||||
|
||||
export class DeepLinking extends React.Component<{}, {}> {}
|
||||
export class DeepLinking extends React.Component {}
|
||||
|
||||
export interface LinkProps {
|
||||
component?: React.Component<void, void>;
|
||||
component?: React.Component;
|
||||
replace?: boolean;
|
||||
style?: any;
|
||||
to: H.LocationDescriptor;
|
||||
}
|
||||
|
||||
export class Link extends React.Component<LinkProps, void> {}
|
||||
export class Link extends React.Component<LinkProps> {}
|
||||
|
||||
export interface NativeRouterProps {
|
||||
getUserConfirmation?: Function;
|
||||
keyLength?: number;
|
||||
}
|
||||
|
||||
export class NativeRouter extends React.Component<NativeRouterProps, void> {}
|
||||
export class NativeRouter extends React.Component<NativeRouterProps> {}
|
||||
|
||||
Vendored
+1
-1
@@ -12,7 +12,7 @@ declare module 'react-sortable-hoc' {
|
||||
export type Offset = number | string;
|
||||
|
||||
export interface SortStart {
|
||||
node: React.ReactNode;
|
||||
node: Element;
|
||||
index: number;
|
||||
collection: Offset;
|
||||
}
|
||||
|
||||
Vendored
+12
-3
@@ -11,11 +11,15 @@ declare namespace spinner {
|
||||
/**
|
||||
* Specify spinner to use.
|
||||
*/
|
||||
name?: 'three-bounce' | 'double-bounce' | 'rotating-plane' | 'folding-cube' | 'wave' | 'wandering-cubes' | 'pulse' | 'chasing-dots' | 'circle' | 'cube-grid' | 'wordpress';
|
||||
name?: 'three-bounce' | 'double-bounce' | 'rotating-plane' | 'folding-cube' | 'wave' | 'wandering-cubes' | 'pulse' | 'chasing-dots' | 'circle' | 'cube-grid' | 'wordpress' |
|
||||
'ball-grid-beat' | 'ball-grid-pulse' | 'line-spin-fade-loader' | 'ball-spin-fade-loader' | 'ball-pulse-rise' | 'line-scale' | 'line-scale-pulse-out' |
|
||||
'line-scale-pulse-out-rapid' | 'line-scale-party' | 'ball-triangle-path' | 'ball-scale-ripple-multiple' | 'ball-pulse-sync' | 'ball-beat' |
|
||||
'ball-scale-multiple' | 'ball-zig-zag' | 'ball-zig-zag-deflect' | 'ball-clip-rotate' | 'ball-clip-rotate-pulse' | 'ball-clip-rotate-multiple' |
|
||||
'ball-scale-ripple' | 'triangle-skew-spin' | 'pacman'
|
||||
/**
|
||||
* Disable the initial fade-in of the spinner.
|
||||
* Set the time before the spinner fades in
|
||||
*/
|
||||
noFadeIn?: boolean;
|
||||
fadeIn?: 'full' | 'half' | 'quarter' | 'none';
|
||||
/**
|
||||
* Change the default "spinner" className.
|
||||
*/
|
||||
@@ -24,6 +28,11 @@ declare namespace spinner {
|
||||
* Component className.
|
||||
*/
|
||||
className?: string;
|
||||
/**
|
||||
* Programmatically set the color of the spinners (does not work
|
||||
* for circle or folding-cube); this can either be a hex value or a color word
|
||||
*/
|
||||
color?: string;
|
||||
}
|
||||
|
||||
export interface Spinner extends React.ComponentClass<SpinnerProps> {
|
||||
|
||||
@@ -16,8 +16,37 @@ const spinners = [
|
||||
<Spinner name="cube-grid" />,
|
||||
<Spinner name="wordpress" />,
|
||||
|
||||
// 'loaders.css' spinners
|
||||
<Spinner name="ball-grid-beat" />,
|
||||
<Spinner name="ball-grid-pulse" />,
|
||||
<Spinner name="line-spin-fade-loader" />,
|
||||
<Spinner name="ball-spin-fade-loader" />,
|
||||
<Spinner name="ball-pulse-rise" />,
|
||||
<Spinner name="line-scale" />,
|
||||
<Spinner name="line-scale-pulse-out" />,
|
||||
<Spinner name="line-scale-pulse-out-rapid" />,
|
||||
<Spinner name="line-scale-party" />,
|
||||
<Spinner name="ball-triangle-path" />,
|
||||
<Spinner name="ball-scale-ripple-multiple" />,
|
||||
<Spinner name="ball-pulse-sync" />,
|
||||
<Spinner name="ball-beat" />,
|
||||
<Spinner name="ball-scale-multiple" />,
|
||||
<Spinner name="ball-zig-zag" />,
|
||||
<Spinner name="ball-zig-zag-deflect" />,
|
||||
<Spinner name="ball-clip-rotate" />,
|
||||
<Spinner name="ball-clip-rotate-pulse" />,
|
||||
<Spinner name="ball-clip-rotate-multiple" />,
|
||||
<Spinner name="ball-scale-ripple" />,
|
||||
<Spinner name="triangle-skew-spin" />,
|
||||
<Spinner name="pacman" />,
|
||||
|
||||
// Spinner options
|
||||
<Spinner name="wordpress" noFadeIn />,
|
||||
<Spinner name="wordpress" fadeIn="full"/>,
|
||||
<Spinner name="wordpress" fadeIn="half"/>,
|
||||
<Spinner name="wordpress" fadeIn="quarter"/>,
|
||||
<Spinner name="wordpress" fadeIn="none"/>,
|
||||
<Spinner name="wordpress" color="#F00" />,
|
||||
<Spinner name="wordpress" color="green" />,
|
||||
<Spinner name="wordpress" overrideSpinnerClassName="my-class-to-override" />,
|
||||
<Spinner name="wordpress" className="my-class" />,
|
||||
];
|
||||
|
||||
Vendored
+1
-1
@@ -227,7 +227,7 @@ declare namespace React {
|
||||
|
||||
type SFC<P = {}> = StatelessComponent<P>;
|
||||
interface StatelessComponent<P = {}> {
|
||||
(props: P & { children?: ReactNode }, context?: any): ReactElement<any>;
|
||||
(props: P & { children?: ReactNode }, context?: any): ReactElement<any> | null;
|
||||
propTypes?: ValidationMap<P>;
|
||||
contextTypes?: ValidationMap<any>;
|
||||
defaultProps?: Partial<P>;
|
||||
|
||||
@@ -138,7 +138,7 @@ interface SCProps {
|
||||
}
|
||||
|
||||
function StatelessComponent(props: SCProps) {
|
||||
return React.DOM.div(null, props.foo);
|
||||
return props.foo ? React.DOM.div(null, props.foo) : null;
|
||||
};
|
||||
namespace StatelessComponent {
|
||||
export var displayName = "StatelessComponent";
|
||||
@@ -155,7 +155,8 @@ StatelessComponent2.defaultProps = {
|
||||
|
||||
var StatelessComponent3: React.SFC<SCProps> =
|
||||
// allows usage of props.children
|
||||
props => React.DOM.div(null, props.foo, props.children);
|
||||
// allows null return
|
||||
props => props.foo ? React.DOM.div(null, props.foo, props.children) : null;
|
||||
|
||||
// React.createFactory
|
||||
var factory: React.CFactory<Props, ModernComponent> =
|
||||
|
||||
@@ -69,13 +69,13 @@ function testWithHandlers() {
|
||||
const innerComponent = ({onChange, onSubmit}: InnerProps) =>
|
||||
<div onClick={onSubmit}></div>;
|
||||
|
||||
const enhancer = withHandlers({
|
||||
const enhancer = withHandlers<InnerProps, OutterProps>({
|
||||
onChange: (props: OutterProps) => (e: any) => {},
|
||||
onSubmit: (props: OutterProps) => (e: any) => {},
|
||||
});
|
||||
const enhanced: React.ComponentClass<OutterProps> = enhancer(innerComponent);
|
||||
|
||||
const enhancer2 = withHandlers((props: OutterProps) => ({
|
||||
const enhancer2 = withHandlers<InnerProps, OutterProps>((props: OutterProps) => ({
|
||||
onChange: (props: OutterProps) => (e: any) => {},
|
||||
onSubmit: (props: OutterProps) => (e: any) => {},
|
||||
}));
|
||||
|
||||
Vendored
+1
-17
@@ -11,6 +11,7 @@ import {
|
||||
Middleware,
|
||||
GenericStoreEnhancer
|
||||
} from 'redux';
|
||||
import { History } from 'history';
|
||||
|
||||
export type Nullable<T> = T | null | undefined;
|
||||
|
||||
@@ -104,23 +105,6 @@ export type HistoryAction = string;
|
||||
|
||||
export type Listener = (location: HistoryLocation, action: HistoryAction) => void;
|
||||
|
||||
export interface History {
|
||||
listen(listener: Listener): void;
|
||||
push(pathname: string): void;
|
||||
replace(pathname: string): void;
|
||||
goBack(): void;
|
||||
goForward(): void;
|
||||
go(n: number): void;
|
||||
canGo(n: number): boolean;
|
||||
|
||||
entries: Array<{ pathname: string }>;
|
||||
index: number;
|
||||
length: number;
|
||||
location: {
|
||||
pathname: string;
|
||||
};
|
||||
}
|
||||
|
||||
export type ScrollBehavior = object;
|
||||
|
||||
export interface Router {
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
{
|
||||
"dependencies": {
|
||||
"redux": "^3.7.0"
|
||||
"redux": "^3.7.0",
|
||||
"history": "^4.6.2"
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
import { connectRoutes, History, LocationState, RoutesMap } from 'redux-first-router';
|
||||
import { connectRoutes, LocationState, RoutesMap } from 'redux-first-router';
|
||||
import {
|
||||
createStore,
|
||||
applyMiddleware,
|
||||
@@ -11,6 +11,7 @@ import {
|
||||
GenericStoreEnhancer,
|
||||
StoreEnhancerStoreCreator
|
||||
} from 'redux';
|
||||
import { History } from 'history';
|
||||
|
||||
declare var console: any;
|
||||
declare var history: History;
|
||||
|
||||
Vendored
+1
-1
@@ -86,7 +86,7 @@ export interface Bundle {
|
||||
|
||||
export interface Options {
|
||||
/** The bundle's entry point (e.g. your `main.js` or `app.js` or `index.js`) */
|
||||
entry: string
|
||||
entry: string | string[]
|
||||
/** A previous bundle. Use it to speed up subsequent bundles :) */
|
||||
cache?: Bundle
|
||||
/**
|
||||
|
||||
Vendored
+4
-4
@@ -1,6 +1,6 @@
|
||||
// Type definitions for route-parser 0.0
|
||||
// Type definitions for route-parser 0.1
|
||||
// Project: https://github.com/rcs/route-parser
|
||||
// Definitions by: Ian Ker-Seymer <https://github.com/ianks>
|
||||
// Definitions by: Ian Ker-Seymer <https://github.com/ianks>, Bob Buehler <https://github.com/bobbuehler>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
declare class Route {
|
||||
@@ -23,7 +23,7 @@ declare class Route {
|
||||
* var route = new Route('/:one/:two')
|
||||
* route.match('/foo/bar/') // -> {one: 'foo', two: 'bar'}
|
||||
*/
|
||||
match(pathname: string): { [i: string]: string } | boolean;
|
||||
match(pathname: string): { [i: string]: string } | false;
|
||||
|
||||
/**
|
||||
* Reverse a route specification to a path, returning false if it can't be
|
||||
@@ -32,7 +32,7 @@ declare class Route {
|
||||
* var route = new Route('/:one/:two')
|
||||
* route.reverse({one: 'foo', two: 'bar'}) -> '/foo/bar'
|
||||
*/
|
||||
reverse(params: { [i: string]: any } ): string | boolean;
|
||||
reverse(params: { [i: string]: any } ): string | false;
|
||||
}
|
||||
|
||||
declare namespace Route {}
|
||||
|
||||
Vendored
+1
-1
@@ -1,4 +1,4 @@
|
||||
// Type definitions for jQuery royal-slider v9.4.0
|
||||
// Type definitions for jQuery royal-slider 9.4
|
||||
// Project: http://dimsemenov.com/plugins/royal-slider/documentation/
|
||||
// Definitions by: Christiaan Rakowski <https://github.com/csrakowski/>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
|
||||
|
||||
$(".royalSlider").royalSlider();
|
||||
|
||||
$(".royalSlider").royalSlider({
|
||||
@@ -171,7 +169,7 @@ slider.ev.on('rsAfterSlideChange', function (event) {
|
||||
slider.ev.on('rsBeforeAnimStart', function (event) {
|
||||
// before animation between slides start
|
||||
});
|
||||
slider.ev.on('rsBeforeMove', function (event: JQueryEventObject, type?: string, userAction?: boolean) {
|
||||
slider.ev.on('rsBeforeMove', function (event, type?: string, userAction?: boolean) {
|
||||
// before any transition start (including after drag release)
|
||||
// "type" - can be "next", "prev", or ID of slide to move
|
||||
// userAction (Boolean) - defines if action is trighered by user (e.g. will be false if movement is trighered by autoPlay)
|
||||
@@ -188,7 +186,7 @@ slider.ev.on('rsDragRelease', function () {
|
||||
slider.ev.on('rsBeforeDestroy', function () {
|
||||
// triggers before slider in destroyed
|
||||
});
|
||||
slider.ev.on('rsOnCreateVideoElement', function (e: JQueryEventObject, url?: string) {
|
||||
slider.ev.on('rsOnCreateVideoElement', function (e, url?: string) {
|
||||
// triggers before video element is created, after click on play button.
|
||||
// Read more in Tips&Tricks section
|
||||
});
|
||||
@@ -214,7 +212,7 @@ slider.slides[2].holder.on('rsAfterContentSet', function () {
|
||||
// fires when third slide content is loaded and added to DOM
|
||||
});
|
||||
// or globally
|
||||
slider.ev.on('rsAfterContentSet', function (e: JQueryEventObject, slideObject?: RoyalSlider.RoyalSlider) {
|
||||
slider.ev.on('rsAfterContentSet', function (e, slideObject?: RoyalSlider.RoyalSlider) {
|
||||
// fires when every time when slide content is loaded and added to DOM
|
||||
});
|
||||
|
||||
@@ -224,8 +222,8 @@ slider.ev.on('rsAfterContentSet', function (e: JQueryEventObject, slideObject?:
|
||||
slider.ev.on('rsAfterInit', function () {
|
||||
// after slider is initialized,
|
||||
});
|
||||
slider.ev.on('rsBeforeParseNode', function (e: JQueryEventObject, content?: any, obj?: any) {
|
||||
slider.ev.on('rsBeforeParseNode', function (e, content?: any, obj?: any) {
|
||||
// before slide node is parsed
|
||||
// content - HTML object of slide that is parsed
|
||||
// obj - RoyalSlider data object (stores image URLs)
|
||||
});
|
||||
});
|
||||
|
||||
@@ -20,4 +20,4 @@
|
||||
"index.d.ts",
|
||||
"royalslider-tests.ts"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2032,7 +2032,7 @@ namespace _ {
|
||||
// do is retrieve a reference to the term set with the same ID as the div, and
|
||||
// then add the term that belong to that term set under the div that was clicked.
|
||||
|
||||
function showTerms(event: JQueryEventObject, groupID: SP.Guid, termSetID: SP.Guid) {
|
||||
function showTerms(event: JQuery.Event, groupID: SP.Guid, termSetID: SP.Guid) {
|
||||
// First, cancel the bubble so that the group div click handler does not also fire
|
||||
// because that removes all term set divs and we don't want that here.
|
||||
event.originalEvent.cancelBubble = true;
|
||||
|
||||
Vendored
+1
-1
@@ -421,7 +421,7 @@ declare namespace Sinon {
|
||||
(value: string): SinonMatcher;
|
||||
(expr: RegExp): SinonMatcher;
|
||||
(obj: any): SinonMatcher;
|
||||
(callback: (value: any) => boolean): SinonMatcher;
|
||||
(callback: (value: any) => boolean, message?: string): SinonMatcher;
|
||||
any: SinonMatcher;
|
||||
defined: SinonMatcher;
|
||||
truthy: SinonMatcher;
|
||||
|
||||
@@ -119,6 +119,14 @@ function testPromises() {
|
||||
rejectsStub2 = sinon.stub().rejects("TypeError");
|
||||
}
|
||||
|
||||
function testMatchInvoke() {
|
||||
let stub = sinon.stub();
|
||||
stub(123);
|
||||
stub.calledWithMatch(sinon.match(123));
|
||||
stub.calledWithMatch(sinon.match((value: any) => value === 123));
|
||||
stub.calledWithMatch(sinon.match((value: any) => value === 123, "Must be 123"));
|
||||
}
|
||||
|
||||
function testSymbolMatch() {
|
||||
let stub = sinon.stub();
|
||||
stub(Symbol('TestSymbol'));
|
||||
|
||||
Vendored
+1
-1
@@ -21,7 +21,7 @@ declare namespace TextEncoding {
|
||||
encoding: string;
|
||||
fatal: boolean;
|
||||
ignoreBOM: boolean;
|
||||
decode(input?: ArrayBufferView, options?: TextDecodeOptions): string;
|
||||
decode(input?: ArrayBuffer | ArrayBufferView, options?: TextDecodeOptions): string;
|
||||
}
|
||||
|
||||
interface TextEncoder {
|
||||
|
||||
@@ -27,6 +27,7 @@ function test_encoder() {
|
||||
function test_decoder() {
|
||||
var text = "plain text";
|
||||
var uint8array: Uint8Array = TextEncoder().encode(text);
|
||||
var arrayBuffer: ArrayBuffer = uint8array.buffer
|
||||
|
||||
// constructor
|
||||
text = new TextDecoder().decode(uint8array);
|
||||
@@ -56,5 +57,6 @@ function test_decoder() {
|
||||
// methods
|
||||
decoder.decode();
|
||||
decoder.decode(uint8array);
|
||||
decoder.decode(arrayBuffer);
|
||||
decoder.decode(uint8array, { stream: true });
|
||||
}
|
||||
}
|
||||
|
||||
Vendored
+1
-1
@@ -2626,7 +2626,7 @@ export interface MeshStandardMaterialParameters extends MaterialParameters {
|
||||
bumpMap?: Texture;
|
||||
bumpScale?: number;
|
||||
normalMap?: Texture;
|
||||
normalScale?: number;
|
||||
normalScale?: Vector2;
|
||||
displacementMap?: Texture;
|
||||
displacementScale?: number;
|
||||
displacementBias?: number;
|
||||
|
||||
Vendored
+19
-11
@@ -1,6 +1,6 @@
|
||||
// Type definitions for tinycolor v1.1.1
|
||||
// Type definitions for tinycolor v1.4.1
|
||||
// Project: https://github.com/bgrins/TinyColor
|
||||
// Definitions by: Mordechai Zuber <https://github.com/M-Zuber>, Geert Jansen <https://github.com/geertjansen>
|
||||
// Definitions by: Mordechai Zuber <https://github.com/M-Zuber>, Geert Jansen <https://github.com/geertjansen>, Niels van Hoorn <https://github.com/nvh>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
declare var tinycolor: tinycolor;
|
||||
@@ -70,27 +70,34 @@ interface tinycolor {
|
||||
* @param firstColor - the first color to be used in the comparison.
|
||||
* @param secondColor - the second color to be used in the comparison.
|
||||
*/
|
||||
readability(firstColor: tinycolorInstance, secondColor: tinycolorInstance): Readable.Readable;
|
||||
readability(firstColor: ColorInput, secondColor: ColorInput): Readable.Readable;
|
||||
|
||||
/**
|
||||
* Ensure that foreground and background color combinations provide sufficient contrast.
|
||||
* Ensure that foreground and background color combinations meet WCAG2 guidelines.
|
||||
*
|
||||
* @param foreColor - the fore color wanted.
|
||||
* @param backCOlor - the back color wanted.
|
||||
* @param backColor - the back color wanted.
|
||||
* @param wcag2 - The 'level' property states 'AA' or 'AAA' - if missing or invalid, it defaults to 'AA'; the 'size' property states 'large' or 'small' - if missing or invalid, it defaults to 'small'. If the entire object is absent, isReadable defaults to {level:"AA",size:"small"}.
|
||||
*/
|
||||
isReadable(foreColor: tinycolorInstance, backColor: tinycolorInstance): boolean;
|
||||
isReadable(foreColor: ColorInput, backColor: ColorInput, wcag2?: {level?: string, size?: string}): boolean;
|
||||
|
||||
/**
|
||||
* Given a base color and a list of possible foreground or background colors for that base,
|
||||
* returns the most readable color.
|
||||
* returns the most readable color. Optionally returns Black or White if the most readable color is unreadable.
|
||||
*
|
||||
* @param color - the base color.
|
||||
* @param colorsToCompare - array of colors to pick the most readable one from.
|
||||
* @param args - and object with extra arguments
|
||||
*/
|
||||
mostReadable(color: tinycolorInstance, colorsToCompare: tinycolorInstance[]): tinycolorInstance;
|
||||
mostReadable(color: ColorInput, colorsToCompare: ColorInput[], args?: {includeFallbackColors?: boolean, level?: string, size?: string}): tinycolorInstance;
|
||||
|
||||
/**/
|
||||
mix(color1: tinycolorInstance, color2: tinycolorInstance, amount?: number): tinycolorInstance;
|
||||
mix(color1: ColorInput, color2: ColorInput, amount?: number): tinycolorInstance;
|
||||
|
||||
/**
|
||||
* Can be called with any tinycolor input
|
||||
*/
|
||||
equals(color1: ColorInput, color2: ColorInput): boolean;
|
||||
|
||||
/**
|
||||
* Returns a random color
|
||||
@@ -265,7 +272,6 @@ interface tinycolorInstance {
|
||||
* Default value: 10.
|
||||
*/
|
||||
darken(amount?: number): tinycolorInstance;
|
||||
|
||||
/**
|
||||
* Desaturate the color a given amount.
|
||||
* Providing 100 will is the same as calling greyscale.
|
||||
@@ -380,6 +386,8 @@ declare namespace ColorFormats {
|
||||
}
|
||||
}
|
||||
|
||||
type ColorInput = string | ColorFormats.RGB | ColorFormats.RGBA | ColorFormats.HSL | ColorFormats.HSLA | ColorFormats.HSV | ColorFormats.HSVA | tinycolorInstance
|
||||
|
||||
declare module 'tinycolor2' {
|
||||
export = tinycolor;
|
||||
}
|
||||
}
|
||||
@@ -28,14 +28,18 @@ tester = tinycolor({ h: 0, s: 0, v: 0, a: 0 });
|
||||
|
||||
//tinycolor static methods
|
||||
tester = tinycolor.mix(tester, tester);
|
||||
tester = tinycolor.mix("#ff0000", "#00ff00");
|
||||
tester = tinycolor.mix(tester, tester, 50);
|
||||
tester = tinycolor.random();
|
||||
var isEqual = tinycolor.equals(tester, tester);
|
||||
|
||||
/*Tinycolor object properties*/
|
||||
|
||||
var readable: Readable.Readable = tinycolor.readability(tester, tester);
|
||||
var isReadable: boolean = tinycolor.isReadable(tester, tester);
|
||||
var isReadable: boolean = tinycolor.isReadable(tester, tester, {size: "small"});
|
||||
tester = tinycolor.mostReadable(tester, [tester, tester, tester]);
|
||||
tester = tinycolor.mostReadable(tester, [tester, tester, tester], {size: "large", level:"AA"});
|
||||
|
||||
var hexNames: { [key: string]: string } = tinycolor.hexNames;
|
||||
var names: { [key: string]: string } = tinycolor.names;
|
||||
|
||||
Vendored
+156
@@ -1156,6 +1156,17 @@ declare module "victory" {
|
||||
* y as a function of x. Samples is ignored if x props are provided instead.
|
||||
*/
|
||||
samples?: number;
|
||||
/**
|
||||
* The labels prop defines the labels that will appear above each point.
|
||||
* This prop should be given as an array or as a function of data.
|
||||
*/
|
||||
labels?: string[]|number[]|Function;
|
||||
/**
|
||||
* Use the sortKey prop to indicate how data should be sorted. This prop
|
||||
* is given directly to the lodash sortBy function to be executed on the
|
||||
* final dataset.
|
||||
*/
|
||||
sortKey?: string|string[]|Function;
|
||||
/**
|
||||
* The style prop specifies styles for your VictoryLine. Any valid inline style properties
|
||||
* will be applied. Height, width, and padding should be specified via the height,
|
||||
@@ -1173,6 +1184,151 @@ declare module "victory" {
|
||||
*/
|
||||
export class VictoryLine extends React.Component<VictoryLineProps> {}
|
||||
|
||||
export interface VictoryLegendProps extends VictoryCommonProps, VictoryDatableProps, VictorySingleLabableProps {
|
||||
/**
|
||||
* The colorScale prop defines a color scale to be applied to each data
|
||||
* symbol in VictoryLegend. This prop should be given as an array of CSS
|
||||
* colors, or as a string corresponding to one of the built in color
|
||||
* scales: "grayscale", "qualitative", "heatmap", "warm", "cool", "red",
|
||||
* "green", "blue". VictoryLegend will assign a color to each symbol by
|
||||
* index, unless they are explicitly specified in the data object.
|
||||
* Colors will repeat when there are more symbols than colors in the
|
||||
* provided colorScale.
|
||||
*/
|
||||
colorScale?: ColorScalePropType;
|
||||
/**
|
||||
* The style prop defines the style of the VictoryLegend component.
|
||||
* The style prop should be given as an object with styles defined for data, labels and
|
||||
* parent. Any valid svg styles are supported, but width, height, and
|
||||
* padding should be specified via props as they determine relative
|
||||
* layout for components in VictoryLegend.
|
||||
*/
|
||||
style?: VictoryStyleInterface;
|
||||
/**
|
||||
* The containerComponent prop takes a component instance which will be
|
||||
* used to create a container element for standalone legends. The new
|
||||
* element created from the passed containerComponent will be provided
|
||||
* with the following props: height, width, children (the legend itself)
|
||||
* and style. If a containerComponent is not provided, the default
|
||||
* VictoryContainer component will be used. VictoryContainer supports
|
||||
* title and desc props, which are intended to add accessibility to
|
||||
* Victory components. The more descriptive these props are, the more
|
||||
* accessible your data will be for people using screen readers. These
|
||||
* props may be set by passing them directly to the supplied component.
|
||||
* By default, VictoryContainer renders a responsive svg using the
|
||||
* viewBox attribute. To render a static container, set
|
||||
* responsive={false} directly on the instance of VictoryContainer
|
||||
* supplied via the containerComponent prop. VictoryContainer also
|
||||
* renders a Portal element that may be used in conjunction with
|
||||
* VictoryPortal to force components to render above other children.
|
||||
* @default <VictoryContainer/>
|
||||
*/
|
||||
containerComponent?: React.ReactElement<any>;
|
||||
/**
|
||||
* Specify data via the data prop. VictoryLegend expects data as an
|
||||
* array of objects with name (required), symbol, and labels properties.
|
||||
* The data prop must be given as an array.
|
||||
*/
|
||||
data?: Array<{
|
||||
name?: string;
|
||||
symbol?: {
|
||||
type?: string;
|
||||
};
|
||||
}>;
|
||||
/**
|
||||
* The dataComponent prop takes a component instance which will be
|
||||
* responsible for rendering a data element used to associate a symbol
|
||||
* or color with each data series. The new element created from the
|
||||
* passed dataComponent will be provided with the following properties
|
||||
* calculated by VictoryLegend: x, y, size, style, and symbol. Any of
|
||||
* these props may be overridden by passing in props to the supplied
|
||||
* component, or modified or ignored within the custom component itself.
|
||||
* If a dataComponent is not provided, VictoryLegend will use its
|
||||
* default Point component.
|
||||
*/
|
||||
dataComponent?: React.ReactElement<any>;
|
||||
/**
|
||||
* The groupComponent prop takes an entire component which will be used to
|
||||
* create group elements for use within container elements. This prop defaults
|
||||
* to a <g> tag on web, and a react-native-svg <G> tag on mobile
|
||||
* @default <g/>
|
||||
*/
|
||||
groupComponent?: React.ReactElement<any>;
|
||||
/**
|
||||
* The gutter prop defines the number of pixels between legend rows or
|
||||
* columns, depending on orientation. When orientation is horizontal,
|
||||
* gutters are between columns. When orientation is vertical, gutters
|
||||
* are the space between rows.
|
||||
*/
|
||||
gutter?: number;
|
||||
/**
|
||||
* The labelComponent prop takes a component instance which will be used
|
||||
* to render each legend label. The new element created from the passed
|
||||
* labelComponent will be supplied with the following properties: x, y,
|
||||
* style, and text. Any of these props may be overridden by passing in
|
||||
* props to the supplied component, or modified or ignored within the
|
||||
* custom component itself. If labelComponent is omitted, a new
|
||||
* VictoryLabel will be created with the props described above.
|
||||
*/
|
||||
labelComponent?: React.ReactElement<any>;
|
||||
/**
|
||||
* The orientation prop takes a string that defines whether legend data
|
||||
* are displayed in a row or column. When orientation is "horizontal",
|
||||
* legend items will be displayed in a single row. When orientation is
|
||||
* "vertical", legend items will be displayed in a single column. Line
|
||||
* and text-wrapping is not currently supported, so "vertical"
|
||||
* orientation is both the default setting and recommended for
|
||||
* displaying many series of data.
|
||||
* @default 'vertical'
|
||||
*/
|
||||
orientation?: 'horizontal'|'vertical';
|
||||
/**
|
||||
* The padding prop specifies the amount of padding in pixels between
|
||||
* the edge of the legend and any rendered child components. This prop
|
||||
* can be given as a number or as an object with padding specified for
|
||||
* top, bottom, left and right. As with width and height, the absolute
|
||||
* padding will depend on whether the component is rendered in a
|
||||
* responsive container. When a component is nested within
|
||||
* VictoryLegend, setting padding on the child component will have no
|
||||
* effect.
|
||||
*/
|
||||
padding?: number | {
|
||||
top?: number;
|
||||
bottom?: number;
|
||||
left?: number;
|
||||
right?: number;
|
||||
};
|
||||
/**
|
||||
* The standalone props specifies whether the component should be
|
||||
* rendered in an independent <svg> element or in a <g> tag. This prop
|
||||
* defaults to true, and renders an svg.
|
||||
*/
|
||||
standalone?: boolean;
|
||||
/**
|
||||
* The symbolSpacer prop defines the number of pixels between data
|
||||
* components and label components.
|
||||
*/
|
||||
symbolSpacer?: number;
|
||||
/**
|
||||
* The width and height props define the width and height of the legend.
|
||||
* These props may be given as positive numbers or functions of data. If
|
||||
* these props are not set, width and height will be determined based on
|
||||
* an approximate text size calculated from the text and style props
|
||||
* provided to VictoryLegend.
|
||||
*/
|
||||
width?: number;
|
||||
height?: number;
|
||||
/**
|
||||
* The x and y props define the base position of the legend element.
|
||||
*/
|
||||
x?: number;
|
||||
y?: number;
|
||||
}
|
||||
/**
|
||||
* VictoryLegend renders a chart legend component.
|
||||
*/
|
||||
export class VictoryLegend extends React.Component<VictoryLegendProps, any> {}
|
||||
|
||||
type ScatterSymbolType = "circle" | "diamond" | "plus" | "square" | "star" | "triangleDown" | "triangleUp";
|
||||
export interface VictoryScatterProps extends VictoryCommonProps, VictoryDatableProps, VictoryMultiLabeableProps {
|
||||
/**
|
||||
|
||||
@@ -10,7 +10,9 @@ import {
|
||||
VictoryLine,
|
||||
VictoryChart,
|
||||
VictoryScatter,
|
||||
VictoryPie
|
||||
VictoryPie,
|
||||
VictoryTheme,
|
||||
VictoryLegend
|
||||
} from "victory";
|
||||
|
||||
// VictoryAnimation test
|
||||
@@ -607,3 +609,31 @@ test = (
|
||||
test = (
|
||||
<VictoryChart animate={{ duration: 2000, easing: 'bounce' }} />
|
||||
);
|
||||
|
||||
// VictoryLegend test
|
||||
|
||||
test = (
|
||||
<VictoryLegend
|
||||
data={[
|
||||
{name: "A", symbol: { type: "circle"}},
|
||||
{name: "B", symbol: { type: "square"}},
|
||||
{name: "C", symbol: { type: "star"}}
|
||||
]}
|
||||
gutter={10}
|
||||
orientation="horizontal"
|
||||
symbolSpacer={8}
|
||||
width={100}
|
||||
height={50}
|
||||
x={5}
|
||||
y={5}
|
||||
theme={VictoryTheme.material}
|
||||
style={{
|
||||
data: { fill: "tomato", opacity: 0.7 },
|
||||
labels: { fontSize: 12 },
|
||||
parent: { border: "1px solid #ccc" }
|
||||
}}
|
||||
standalone
|
||||
padding={{ top: 20, right: 40, bottom: 60, left: 20 }}
|
||||
colorScale="heatmap"
|
||||
/>
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user