mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-04 06:47:03 +00:00
Merge branch 'master' of https://github.com/DefinitelyTyped/DefinitelyTyped into create-hexo-log
This commit is contained in:
Vendored
+5
-7
@@ -44,16 +44,14 @@ declare namespace accepts {
|
||||
|
||||
/**
|
||||
* Return the first accepted type (and it is returned as the same text as what appears in the `types` array). If nothing in `types` is accepted, then `false` is returned.
|
||||
* If no types are supplied, return the entire set of acceptable types.
|
||||
*
|
||||
* The `types` array can contain full MIME types or file extensions. Any value that is not a full MIME types is passed to `require('mime-types').lookup`.
|
||||
*/
|
||||
type(types: string[]): string | false;
|
||||
type(...types: string[]): string | false;
|
||||
|
||||
/**
|
||||
* Return the types that the request accepts, in the order of the client's preference (most preferred first).
|
||||
*/
|
||||
types(): string[];
|
||||
type(types: string[]): string[] | string | false;
|
||||
type(...types: string[]): string[] | string | false;
|
||||
types(types: string[]): string[] | string | false;
|
||||
types(...types: string[]): string[] | string | false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,171 @@
|
||||
(() => {
|
||||
// https://wiki.openoffice.org/wiki/Documentation/DevGuide/ProUNO/Bridge/Automation_Bridge
|
||||
|
||||
// This is a JScript example
|
||||
// The service manager is always the starting point
|
||||
// If there is no office running then an office is started up
|
||||
const serviceManager = new ActiveXObject('com.sun.star.ServiceManager');
|
||||
|
||||
// Create the CoreReflection service that is later used to create structs
|
||||
const coreReflection = serviceManager.createInstance("com.sun.star.reflection.CoreReflection");
|
||||
|
||||
// Create the Desktop
|
||||
const desktop = serviceManager.defaultContext.getByName('/singleton/com.sun.star.frame.theDesktop');
|
||||
|
||||
// Open a new empty writer document
|
||||
const args: any[] = [];
|
||||
const document = desktop.loadComponentFromURL("private:factory/swriter", "_blank", 0, args); // as com.sun.star.text.TextDocument;
|
||||
|
||||
// Create a text object
|
||||
const text = document.Text;
|
||||
|
||||
// Create a cursor object
|
||||
const cursor = (text.createTextCursor() as any) as com.sun.star.text.TextCursor;
|
||||
|
||||
// Inserting some Text
|
||||
text.insertString(cursor, "The first line in the newly created text document.\n", false);
|
||||
|
||||
// Inserting a second line
|
||||
text.insertString(cursor, "Now we're in the second line", false);
|
||||
|
||||
// Create instance of a text table with 4 columns and 4 rows
|
||||
const table = document.createInstance("com.sun.star.text.TextTable");
|
||||
table.initialize(4, 4);
|
||||
|
||||
// Insert the table
|
||||
text.insertTextContent(cursor, table, false);
|
||||
|
||||
// Get first row
|
||||
const rows = table.Rows;
|
||||
const row = rows.getByIndex(0) as com.sun.star.table.TableRow;
|
||||
|
||||
// Set the table background color
|
||||
((table as any) as com.sun.star.beans.XPropertySet).setPropertyValue("BackTransparent", false);
|
||||
((table as any) as com.sun.star.beans.XPropertySet).setPropertyValue("BackColor", 13421823);
|
||||
|
||||
// Set a different background color for the first row
|
||||
row.setPropertyValue("BackTransparent", false);
|
||||
row.setPropertyValue("BackColor", 6710932);
|
||||
|
||||
// Fill the first table row
|
||||
insertIntoCell("A1", "FirstColumn", table); // insertIntoCell is a helper function, see below
|
||||
insertIntoCell("B1", "SecondColumn", table);
|
||||
insertIntoCell("C1", "ThirdColumn", table);
|
||||
insertIntoCell("D1", "SUM", table);
|
||||
|
||||
table.getCellByName("A2").setValue(22.5);
|
||||
table.getCellByName("B2").setValue(5615.3);
|
||||
table.getCellByName("C2").setValue(-2315.7);
|
||||
table.getCellByName("D2").setFormula("sum ");
|
||||
|
||||
table.getCellByName("A3").setValue(21.5);
|
||||
table.getCellByName("B3").setValue(615.3);
|
||||
table.getCellByName("C3").setValue(- 315.7);
|
||||
table.getCellByName("D3").setFormula("sum ");
|
||||
|
||||
table.getCellByName("A4").setValue(121.5);
|
||||
table.getCellByName("B4").setValue(-615.3);
|
||||
table.getCellByName("C4").setValue(415.7);
|
||||
table.getCellByName("D4").setFormula("sum ");
|
||||
|
||||
// Change the CharColor and add a Shadow
|
||||
cursor.setPropertyValue("CharColor", 255);
|
||||
cursor.setPropertyValue("CharShadowed", true);
|
||||
|
||||
// Create a paragraph break
|
||||
// The second argument is a com::sun::star::text::ControlCharacter::PARAGRAPH_BREAK constant
|
||||
text.insertControlCharacter(cursor, 0, false);
|
||||
|
||||
// Inserting colored Text.
|
||||
text.insertString(cursor, " This is a colored Text - blue with shadow\n", false);
|
||||
|
||||
// Create a paragraph break ( ControlCharacter::PARAGRAPH_BREAK).
|
||||
text.insertControlCharacter(cursor, 0, false);
|
||||
|
||||
// Create a TextFrame.
|
||||
const textFrame = document.createInstance("com.sun.star.text.TextFrame");
|
||||
|
||||
// Create a Size struct.
|
||||
const size = createStruct("com.sun.star.awt.Size"); // helper function, see below
|
||||
size.Width = 15000;
|
||||
size.Height = 400;
|
||||
textFrame.setSize(size);
|
||||
|
||||
// TextContentAnchorType.AS_CHARACTER = 1
|
||||
textFrame.setPropertyValue("AnchorType", com.sun.star.text.TextContentAnchorType.AS_CHARACTER);
|
||||
|
||||
// insert the frame
|
||||
text.insertTextContent(cursor, textFrame, false);
|
||||
|
||||
// Get the text object of the frame
|
||||
const objFrameText = textFrame.Text;
|
||||
|
||||
// Create a cursor object
|
||||
const objFrameTextCursor = objFrameText.createTextCursor();
|
||||
|
||||
// Inserting some Text
|
||||
objFrameText.insertString(objFrameTextCursor, "The first line in the newly created text frame.", false);
|
||||
objFrameText.insertString(objFrameTextCursor, "\nWith this second line the height of the frame raises.", false);
|
||||
|
||||
// Create a paragraph break
|
||||
// The second argument is a com::sun::star::text::ControlCharacter::PARAGRAPH_BREAK constant
|
||||
objFrameText.insertControlCharacter(cursor, 0, false);
|
||||
|
||||
// Change the CharColor and add a Shadow
|
||||
cursor.setPropertyValue("CharColor", 65536);
|
||||
cursor.setPropertyValue("CharShadowed", false);
|
||||
|
||||
// Insert another string
|
||||
text.insertString(cursor, " That's all for now !!", false);
|
||||
|
||||
function insertIntoCell(strCellName: string, strText: string, objTable: com.sun.star.text.TextTable) {
|
||||
const objCellText = objTable.getCellByName(strCellName) as com.sun.star.table.Cell;
|
||||
const objCellCursor = (objCellText.createTextCursor() as any) as com.sun.star.text.TextCursor;
|
||||
objCellCursor.setPropertyValue("CharColor", 16777215);
|
||||
objCellText.insertString(objCellCursor, strText, false);
|
||||
}
|
||||
|
||||
function createStruct<K extends keyof LibreOffice.StructNameMap>(strTypeName: K): LibreOffice.StructNameMap[K] {
|
||||
const classSize = coreReflection.forName(strTypeName);
|
||||
const aStruct: [LibreOffice.StructNameMap[K]] = [] as any;
|
||||
classSize.createObject(aStruct);
|
||||
return aStruct[0];
|
||||
}
|
||||
})();
|
||||
|
||||
(() => {
|
||||
// This shows some specific features of the Automation bridge
|
||||
|
||||
const serviceManager = new ActiveXObject('com.sun.star.ServiceManager');
|
||||
|
||||
// singleton access
|
||||
const desktop = serviceManager.defaultContext.getByName('/singleton/com.sun.star.frame.theDesktop');
|
||||
|
||||
// defaultContext property implements XNameAccess
|
||||
// sequence is returned as a safearray
|
||||
const elementNames = new VBArray(serviceManager.defaultContext.getElementNames()).toArray().join('\n');
|
||||
WScript.Echo(elementNames);
|
||||
|
||||
// get/set methods exposed as properties -- getText => Text, getViewData/setViewData => ViewData
|
||||
const document = desktop.loadComponentFromURL("private:factory/swriter", "_blank", 0, []);
|
||||
const viewData = document.ViewData;
|
||||
WScript.Echo(viewData.Count);
|
||||
const text = document.Text;
|
||||
WScript.Echo(text);
|
||||
})();
|
||||
|
||||
(() => {
|
||||
// Forces use of tuple type for out parameters
|
||||
// Instantiating via reflection
|
||||
const serviceManager = new ActiveXObject('com.sun.star.ServiceManager');
|
||||
const coreReflection = serviceManager.defaultContext.getByName('/singleton/com.sun.star.reflection.theCoreReflection');
|
||||
const classInfo = coreReflection.forName('com.sun.star.accessibility.Accessible');
|
||||
const accessible: [com.sun.star.accessibility.XAccessible] = [] as any;
|
||||
classInfo.createObject(accessible);
|
||||
accessible[0].acquire();
|
||||
|
||||
// Get a struct via Bridge_GetStruct
|
||||
const size = serviceManager.Bridge_GetStruct('com.sun.star.awt.Size');
|
||||
size.Height = 110;
|
||||
size.Width = 120;
|
||||
})();
|
||||
Vendored
+105882
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,21 @@
|
||||
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": ["es5", "scripthost"],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"activex-libreoffice-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"extends": "dtslint/dt.json",
|
||||
"rules": {
|
||||
"interface-name": [false],
|
||||
"ban-types": false,
|
||||
"no-unnecessary-qualifier": false
|
||||
}
|
||||
}
|
||||
@@ -20,11 +20,11 @@ namespace AdoneRootTests {
|
||||
{ const a: object = adone.o({}); }
|
||||
{ const a: typeof Date = adone.Date; }
|
||||
{ const a: typeof process.hrtime = adone.hrtime; }
|
||||
{ const a: typeof setTimeout = adone.setTimeout; }
|
||||
{ const a: typeof global.setTimeout = adone.setTimeout; }
|
||||
{ const a: typeof clearTimeout = adone.clearTimeout; }
|
||||
{ const a: typeof setInterval = adone.setInterval; }
|
||||
{ const a: typeof clearInterval = adone.clearInterval; }
|
||||
{ const a: typeof setImmediate = adone.setImmediate; }
|
||||
{ const a: typeof global.setImmediate = adone.setImmediate; }
|
||||
{ const a: typeof clearImmediate = adone.clearImmediate; }
|
||||
adone.lazify({});
|
||||
adone.lazify({}, {});
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
|
||||
|
||||
var testApp = angular.module('testApp');
|
||||
const testApp = angular.module('testApp');
|
||||
|
||||
testApp.config((
|
||||
$accordionConfig: ng.ui.bootstrap.IAccordionConfig,
|
||||
@@ -176,7 +174,7 @@ testApp.controller('TestCtrl', (
|
||||
/**
|
||||
* test the $modal service
|
||||
*/
|
||||
var modalInstance = $modal.open({
|
||||
const modalInstance = $modal.open({
|
||||
ariaLabelledBy: "label",
|
||||
ariaDescribedBy: "description",
|
||||
animation: false,
|
||||
@@ -220,10 +218,20 @@ testApp.controller('TestCtrl', (
|
||||
backdrop: 'static'
|
||||
});
|
||||
|
||||
$modal.open({
|
||||
template: () => "<div>i'm a template!</div>"
|
||||
});
|
||||
|
||||
$modal.open({
|
||||
templateUrl: () => '/templates/modal.html'
|
||||
});
|
||||
|
||||
$modal.getPromiseChain().then(() => {});
|
||||
|
||||
$modal.getPromiseChain().then((value) => value * 2);
|
||||
|
||||
$modal.getPromiseChain().then((value: string) => value);
|
||||
|
||||
/**
|
||||
* test the $modalStack service
|
||||
*/
|
||||
@@ -240,13 +248,13 @@ testApp.controller('TestCtrl', (
|
||||
/**
|
||||
* test the $position service
|
||||
*/
|
||||
var elementLogger = (coordinates: ng.ui.bootstrap.IPositionCoordinates): void=> {
|
||||
const elementLogger = (coordinates: ng.ui.bootstrap.IPositionCoordinates): void=> {
|
||||
$log.log('height', coordinates.height);
|
||||
$log.log('left', coordinates.left);
|
||||
$log.log('top', coordinates.top);
|
||||
$log.log('width', coordinates.width);
|
||||
};
|
||||
var element = angular.element('<div/>');
|
||||
const element = angular.element('<div/>');
|
||||
elementLogger($position.position(element));
|
||||
elementLogger($position.offset(element));
|
||||
|
||||
@@ -257,7 +265,7 @@ testApp.controller('TestCtrl', (
|
||||
$log.log('animationEndEventName', $transition.animationEndEventName);
|
||||
$log.log('transitionEndEventName', $transition.transitionEndEventName);
|
||||
|
||||
var transitionElement = angular.element('<div/>');
|
||||
const transitionElement = angular.element('<div/>');
|
||||
$transition(transitionElement, 'transition-class', { animation: true });
|
||||
$transition(transitionElement, { height: '100px', width: '50px' }, { animation: true });
|
||||
$transition(transitionElement, ()=> {}, { animation: true });
|
||||
|
||||
+6
-1
@@ -320,6 +320,11 @@ declare module 'angular' {
|
||||
}
|
||||
|
||||
interface IModalService {
|
||||
/**
|
||||
* @returns {IPromise}
|
||||
*/
|
||||
getPromiseChain(): IPromise<any>;
|
||||
|
||||
/**
|
||||
* @param {IModalSettings} options
|
||||
* @returns {IModalInstanceService}
|
||||
@@ -389,7 +394,7 @@ declare module 'angular' {
|
||||
/**
|
||||
* inline template representing the modal's content
|
||||
*/
|
||||
template?: string;
|
||||
template?: string | (() => string);
|
||||
|
||||
/**
|
||||
* a scope instance to be used for the modal's content (actually the $modal service is going to create a child scope of a provided scope).
|
||||
|
||||
@@ -197,6 +197,11 @@ class UrlLocatorTestService implements IUrlLocatorTestService {
|
||||
this.$state.get(this.$state.current);
|
||||
this.$state.get(this.$state.current, "yourState");
|
||||
this.$state.get(this.$state.current, this.$state.current);
|
||||
|
||||
// make sure get() accepts a discriminated union type as well
|
||||
let myState: string | ng.ui.IState;
|
||||
this.$state.get(myState);
|
||||
|
||||
this.$state.reload();
|
||||
|
||||
// http://angular-ui.github.io/ui-router/site/#/api/ui.router.state.$state#properties
|
||||
|
||||
Vendored
+5
-6
@@ -1,6 +1,8 @@
|
||||
// Type definitions for Angular JS (ui.router module) 1.1.5
|
||||
// Type definitions for Angular JS (ui.router module) 1.1.38
|
||||
// Project: https://github.com/angular-ui/ui-router
|
||||
// Definitions by: Michel Salib <https://github.com/michelsalib>, Ivan Matiishyn <https://github.com/matiishyn>
|
||||
// Definitions by: Michel Salib <https://github.com/michelsalib>
|
||||
// Ivan Matiishyn <https://github.com/matiishyn>
|
||||
// Mike Haas <https://github.com/mikehaas763>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.3
|
||||
|
||||
@@ -272,10 +274,7 @@ declare module 'angular' {
|
||||
is(state: IState, params?: {}): boolean;
|
||||
href(state: IState, params?: {}, options?: IHrefOptions): string;
|
||||
href(state: string, params?: {}, options?: IHrefOptions): string;
|
||||
get(state: string, context?: string): IState;
|
||||
get(state: IState, context?: string): IState;
|
||||
get(state: string, context?: IState): IState;
|
||||
get(state: IState, context?: IState): IState;
|
||||
get(state: string | IState, context?: string | IState): IState;
|
||||
get(): IState[];
|
||||
/** A reference to the state's config object. However you passed it in. Useful for accessing custom data. */
|
||||
current: IState;
|
||||
|
||||
@@ -13,5 +13,6 @@ blobUtil.blobToBase64String(testBlob); // $ExpectType Promise<string>
|
||||
blobUtil.blobToBinaryString(testBlob); // $ExpectType Promise<string>
|
||||
blobUtil.canvasToBlob(new HTMLCanvasElement()); // $ExpectType Promise<Blob>
|
||||
blobUtil.dataURLToBlob('data:abcd'); // $ExpectType Promise<Blob>
|
||||
blobUtil.blobToDataURL(testBlob); // $ExpectType Promise<string>
|
||||
blobUtil.imgSrcToDataURL('test.jpg'); // $ExpectType Promise<string>
|
||||
blobUtil.revokeObjectURL('blob:example'); // $ExpectType void
|
||||
|
||||
Vendored
+2
-1
@@ -1,4 +1,4 @@
|
||||
// Type definitions for blob-util 1.2
|
||||
// Type definitions for blob-util 1.3
|
||||
// Project: https://github.com/nolanlawson/blob-util#readme
|
||||
// Definitions by: Max Battcher <https://github.com/WorldMaker>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
@@ -12,6 +12,7 @@ export function binaryStringToBlob(binary: string, type?: string): Promise<Blob>
|
||||
export function blobToBase64String(blob: Blob): Promise<string>;
|
||||
export function base64StringToBlob(base64: string, type?: string): Promise<Blob>;
|
||||
export function dataURLToBlob(dataURL: string): Promise<Blob>;
|
||||
export function blobToDataURL(blob: Blob): Promise<string>;
|
||||
export function imgSrcToDataURL(src: string, type?: string, crossOrigin?: string): Promise<string>;
|
||||
export function canvasToBlob(canvas: HTMLCanvasElement, type?: string): Promise<Blob>;
|
||||
export function imgSrcToBlob(src: string, type?: string, crossOrigin?: string): Promise<Blob>;
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
import valid = require('card-validator');
|
||||
|
||||
const numberValidation = valid.number('4111');
|
||||
|
||||
if (!numberValidation.isPotentiallyValid && numberValidation.card) {
|
||||
numberValidation.card.type;
|
||||
}
|
||||
|
||||
valid.expirationDate('10/19');
|
||||
const dateTest2 = valid.expirationDate({month: '1', year: '2019'});
|
||||
if (dateTest2.isPotentiallyValid) {
|
||||
dateTest2.month;
|
||||
}
|
||||
|
||||
const expirationMonthCheck = valid.expirationMonth('10');
|
||||
if (expirationMonthCheck.isPotentiallyValid) {
|
||||
expirationMonthCheck.isValidForThisYear;
|
||||
}
|
||||
|
||||
const expirationYearCheck = valid.expirationYear('10');
|
||||
if (expirationYearCheck.isPotentiallyValid) {
|
||||
expirationYearCheck.isCurrentYear;
|
||||
}
|
||||
|
||||
let postalCodeCheck = valid.postalCode('123');
|
||||
|
||||
if (postalCodeCheck.isValid) {
|
||||
postalCodeCheck = valid.postalCode('123', {});
|
||||
postalCodeCheck = valid.postalCode('123', {minLength: 5});
|
||||
}
|
||||
|
||||
const cvvCeck = valid.cvv('1234');
|
||||
if (cvvCeck.isValid) {
|
||||
valid.cvv('12345', 4);
|
||||
}
|
||||
Vendored
+43
@@ -0,0 +1,43 @@
|
||||
// Type definitions for card-validator 4.1
|
||||
// Project: https://github.com/braintree/card-validator
|
||||
// Definitions by: Gregory Moore <https://github.com/ChanceM>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
export interface Card {
|
||||
niceType: string;
|
||||
type: string;
|
||||
pattern: string;
|
||||
isAmex: boolean;
|
||||
gaps: number[];
|
||||
lengths: number[];
|
||||
code: {name: string, size: number};
|
||||
}
|
||||
|
||||
export interface valid {
|
||||
isPotentiallyValid: boolean;
|
||||
isValid: boolean;
|
||||
}
|
||||
|
||||
export interface validNumber extends valid {
|
||||
card: Card | null;
|
||||
}
|
||||
|
||||
export interface validExpirationDate extends valid {
|
||||
month: string | null;
|
||||
year: string | null;
|
||||
}
|
||||
|
||||
export interface validExpirationMonth extends valid {
|
||||
isValidForThisYear: boolean;
|
||||
}
|
||||
|
||||
export interface validExpirationYear extends valid {
|
||||
isCurrentYear: boolean;
|
||||
}
|
||||
|
||||
export function number(value: string): validNumber;
|
||||
export function expirationDate(value: string | {month: string, year: string}): validExpirationDate;
|
||||
export function expirationMonth(value: string): validExpirationMonth;
|
||||
export function expirationYear(value: string): validExpirationYear;
|
||||
export function cvv(value: string, maxLength?: number): valid;
|
||||
export function postalCode(value: string, options?: {minLength?: number}): valid;
|
||||
@@ -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",
|
||||
"card-validator-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Vendored
-2
@@ -513,12 +513,10 @@ export interface Client extends events.EventEmitter {
|
||||
|
||||
connect(callback: Callback): void;
|
||||
eachRow(query: string, params?: any, options?: QueryOptions, rowCallback?: Callback, callback?: Callback): void;
|
||||
|
||||
execute(query: string, params: any, options: QueryOptions, callback: ResultCallback): void;
|
||||
execute(query: string, params: any, callback: ResultCallback): void;
|
||||
execute(query: string, callback: ResultCallback): void;
|
||||
execute(query: string, params?: any, options?: QueryOptions): Promise<types.ResultSet>;
|
||||
|
||||
getReplicas(keyspace: string, token: Buffer): Array<any>; // TODO: Should this be a more explicit return?
|
||||
shutdown(callback?: Callback): void;
|
||||
stream(query: string, params?: any, options?: QueryOptions, callback?: Callback): NodeJS.ReadableStream;
|
||||
|
||||
@@ -46,6 +46,15 @@ commonTags.source`
|
||||
</div>
|
||||
`;
|
||||
|
||||
let userMessages = ['hi', 'what are you up to?', '<script>alert("something evil")</script>']
|
||||
commonTags.html`
|
||||
<div class="chat-list">
|
||||
<ul>
|
||||
${userMessages.map(message => commonTags.safeHtml`<li>${message}</li>`)}
|
||||
</ul>
|
||||
</div>
|
||||
`
|
||||
|
||||
commonTags.oneLine`
|
||||
foo
|
||||
bar
|
||||
@@ -145,6 +154,10 @@ new commonTags.TemplateTag(commonTags.stripIndentTransformer('initial'));
|
||||
new commonTags.TemplateTag(commonTags.stripIndentTransformer('all'));
|
||||
|
||||
new commonTags.TemplateTag(commonTags.replaceResultTransformer('foo', 'bar'));
|
||||
new commonTags.TemplateTag(commonTags.replaceSubstitutionTransformer(/baz/g, 'bar'));
|
||||
|
||||
new commonTags.TemplateTag(commonTags.replaceSubstitutionTransformer('foo', 'bar'));
|
||||
new commonTags.TemplateTag(commonTags.replaceSubstitutionTransformer(/baz/g, 'bar'));
|
||||
|
||||
new commonTags.TemplateTag(commonTags.inlineArrayTransformer());
|
||||
new commonTags.TemplateTag(commonTags.inlineArrayTransformer({}));
|
||||
|
||||
Vendored
+7
-2
@@ -1,6 +1,7 @@
|
||||
// Type definitions for common-tags v1.2.1
|
||||
// Type definitions for common-tags v1.4.0
|
||||
// Project: https://github.com/declandewet/common-tags
|
||||
// Definitions by: Viktor Zozuliak <https://github.com/zuzusik>
|
||||
// Paul Wang <https://github.com/tzupengwang>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
declare module 'common-tags' {
|
||||
@@ -24,6 +25,8 @@ declare module 'common-tags' {
|
||||
|
||||
export var source: TemplateTag;
|
||||
|
||||
export var safeHtml: TemplateTag;
|
||||
|
||||
export var oneLine: TemplateTag;
|
||||
|
||||
export var oneLineTrim: TemplateTag;
|
||||
@@ -54,7 +57,9 @@ declare module 'common-tags' {
|
||||
|
||||
export var stripIndentTransformer: (type?: 'initial'|'all') => TemplateTransformer;
|
||||
|
||||
export var replaceResultTransformer: (replaceWhat: string, replaceWith: string) => TemplateTransformer;
|
||||
export var replaceResultTransformer: (replaceWhat: string|RegExp, replaceWith: string) => TemplateTransformer;
|
||||
|
||||
export var replaceSubstitutionTransformer: (replaceWhat: string|RegExp, replaceWith: string) => TemplateTransformer;
|
||||
|
||||
export var inlineArrayTransformer: (opts?: {separator?: string, conjunction?: string}) => TemplateTransformer;
|
||||
|
||||
|
||||
@@ -34,3 +34,5 @@ var configSources: config.IConfigSource[] = config.util.getConfigSources();
|
||||
var configSource: config.IConfigSource = configSources[0];
|
||||
var configSourceName: string = configSource.name;
|
||||
var configSourceOriginal: string | undefined = configSource.original;
|
||||
|
||||
var moduleDefaults: any = config.util.setModuleDefaults("moduleName", {});
|
||||
|
||||
Vendored
+10
-1
@@ -1,6 +1,8 @@
|
||||
// Type definitions for node-config
|
||||
// Project: https://github.com/lorenwest/node-config
|
||||
// Definitions by: Roman Korneev <https://github.com/RWander>
|
||||
// Forrest Bice <https://github.com/forrestbice>
|
||||
// James Donald <https://github.com/jndonald3>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
|
||||
@@ -31,12 +33,19 @@ declare namespace c {
|
||||
|
||||
// Get the current value of a config environment variable
|
||||
getEnv(varName: string): string;
|
||||
|
||||
|
||||
// Return the config for the project based on directory param if not directory then return default one (config).
|
||||
loadFileConfigs(configDir: string): any;
|
||||
|
||||
// Return the sources for the configurations
|
||||
getConfigSources(): IConfigSource[];
|
||||
|
||||
/**
|
||||
* This allows module developers to attach their configurations onto
|
||||
* the 6 years agoInitial 0.4 checkin default configuration object so
|
||||
* they can be configured by the consumers of the module.
|
||||
*/
|
||||
setModuleDefaults(moduleName:string, defaults:any): any;
|
||||
}
|
||||
|
||||
interface IConfig {
|
||||
|
||||
@@ -1 +1,7 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
{
|
||||
"extends": "dtslint/dt.json",
|
||||
"rules": {
|
||||
// TODO
|
||||
"no-object-literal-type-assertion": false
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import RSVP from 'rsvp';
|
||||
import RSVP = require('rsvp');
|
||||
|
||||
function testAndThen() {
|
||||
const result: RSVP.Promise<string, never> = andThen(() => 'some string');
|
||||
|
||||
+1
-1
@@ -10,7 +10,7 @@
|
||||
|
||||
/// <reference types="jquery" />
|
||||
|
||||
import RSVP from 'rsvp';
|
||||
import RSVP = require('rsvp');
|
||||
|
||||
type KeyEventType = 'keydown' | 'keyup' | 'keypress';
|
||||
type WaitResult<T> = RSVP.Promise<T, never>;
|
||||
|
||||
@@ -14,8 +14,7 @@
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"allowSyntheticDefaultImports": true
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
|
||||
Vendored
+1
-1
@@ -10,7 +10,7 @@
|
||||
|
||||
// Capitalization is intentional: this makes it much easier to re-export RSVP on
|
||||
// the Ember namespace.
|
||||
import Rsvp from 'rsvp';
|
||||
import Rsvp = require('rsvp');
|
||||
|
||||
declare namespace EmberStates {
|
||||
interface Transition {
|
||||
|
||||
@@ -14,8 +14,7 @@
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"allowSyntheticDefaultImports": true
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
|
||||
@@ -2,7 +2,7 @@ import esprima = require('esprima');
|
||||
import * as ESTree from 'estree';
|
||||
|
||||
let token: esprima.Token;
|
||||
let program: ESTree.Program;
|
||||
let program: esprima.Program;
|
||||
let string: string;
|
||||
|
||||
// esprima
|
||||
@@ -20,6 +20,9 @@ program = esprima.parseScript('"use strict"; with (x) {}', { tolerant: true });
|
||||
program = esprima.parseScript('answer = 42', { range: true });
|
||||
program = esprima.parseScript('answer = 42', { range: true });
|
||||
program = esprima.parseScript('const answer = 42', { tokens: true });
|
||||
if (program.tokens) {
|
||||
token = program.tokens[0];
|
||||
}
|
||||
program = esprima.parseScript('answer = 42 // TODO: why', { comment: true });
|
||||
program = esprima.parseScript('answer = 42 // TODO: why', { comment: true, range: true });
|
||||
|
||||
|
||||
Vendored
+6
-2
@@ -7,10 +7,14 @@ import * as ESTree from 'estree';
|
||||
|
||||
export const version: string;
|
||||
|
||||
export function parseScript(input: string, config?: ParseOptions, delegate?: (node: ESTree.Node, meta: any) => void): ESTree.Program;
|
||||
export function parseModule(input: string, config?: ParseOptions, delegate?: (node: ESTree.Node, meta: any) => void): ESTree.Program;
|
||||
export function parseScript(input: string, config?: ParseOptions, delegate?: (node: ESTree.Node, meta: any) => void): Program;
|
||||
export function parseModule(input: string, config?: ParseOptions, delegate?: (node: ESTree.Node, meta: any) => void): Program;
|
||||
export function tokenize(input: string, config?: TokenizeOptions): Token[];
|
||||
|
||||
export interface Program extends ESTree.Program {
|
||||
tokens?: Token[];
|
||||
}
|
||||
|
||||
export interface Token {
|
||||
type: string;
|
||||
value: string;
|
||||
|
||||
+1
-1
@@ -351,7 +351,7 @@ interface Request extends http.IncomingMessage, Express.Request {
|
||||
*
|
||||
* @param type
|
||||
*/
|
||||
is(type: string): boolean;
|
||||
is(type: string): string | false;
|
||||
|
||||
/**
|
||||
* Return the protocol string "http" or "https"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import * as filenamify from 'filenamify';
|
||||
import filenamify = require('filenamify');
|
||||
|
||||
filenamify('<foo/bar>');
|
||||
// => 'foo!bar'
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
import * as webpack from 'webpack';
|
||||
import * as FriendlyErrorsPlugin from 'friendly-errors-webpack-plugin';
|
||||
|
||||
const compiler = webpack({
|
||||
plugins: [
|
||||
new FriendlyErrorsPlugin(),
|
||||
],
|
||||
});
|
||||
+40
@@ -0,0 +1,40 @@
|
||||
// Type definitions for friendly-errors-webpack-plugin 0.1
|
||||
// Project: https://github.com/geowarin/friendly-errors-webpack-plugin
|
||||
// Definitions by: Arne Bahlo <https://github.com/bahlo>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.4
|
||||
|
||||
import { Plugin } from 'webpack';
|
||||
|
||||
export = FriendlyErrorsWebpackPlugin;
|
||||
|
||||
declare class FriendlyErrorsWebpackPlugin extends Plugin {
|
||||
constructor(options?: FriendlyErrorsWebpackPlugin.Options);
|
||||
}
|
||||
|
||||
declare namespace FriendlyErrorsWebpackPlugin {
|
||||
enum Severity {
|
||||
Error = "error",
|
||||
Warning = "warning",
|
||||
}
|
||||
|
||||
interface Options {
|
||||
compilationSuccessInfo?: {
|
||||
messages: string[],
|
||||
notes: string[],
|
||||
};
|
||||
onErrors?(severity: Severity, errors: string): void;
|
||||
clearConsole?: true;
|
||||
additionalFormatters?: Array<(errors: WebpackError[], type: Severity) => string[]>;
|
||||
additionalTransformers?: Array<(error: any) => any>;
|
||||
}
|
||||
|
||||
interface WebpackError {
|
||||
message: string;
|
||||
file: string;
|
||||
origin: string;
|
||||
name: string;
|
||||
severity: Severity;
|
||||
webpackError: any;
|
||||
}
|
||||
}
|
||||
@@ -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",
|
||||
"friendly-errors-webpack-plugin-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
@@ -671,7 +671,6 @@ $(document).ready(() => {
|
||||
const y = date.getFullYear();
|
||||
|
||||
$('#calendar').fullCalendar({
|
||||
theme: true,
|
||||
header: {
|
||||
left: 'prev,next today',
|
||||
center: 'title',
|
||||
@@ -790,7 +789,6 @@ $(document).ready(() => {
|
||||
const y = date.getFullYear();
|
||||
|
||||
$('#calendar').fullCalendar({
|
||||
theme: true,
|
||||
header: {
|
||||
left: 'prev,next today',
|
||||
center: 'title',
|
||||
@@ -824,7 +822,6 @@ $(document).ready(() => {
|
||||
});
|
||||
|
||||
$('#calendar').fullCalendar({
|
||||
theme: true,
|
||||
header: {
|
||||
left: 'prev,next today',
|
||||
center: 'title',
|
||||
|
||||
Vendored
+771
-79
@@ -1,6 +1,9 @@
|
||||
// Type definitions for FullCalendar 2.7
|
||||
// Type definitions for FullCalendar 3.5
|
||||
// Project: http://fullcalendar.io/
|
||||
// Definitions by: Neil Stalker <https://github.com/nestalk>, Marcelo Camargo <https://github.com/hasellcamargo>, Patrick Niemann <https://github.com/panic175>
|
||||
// Definitions by: Neil Stalker <https://github.com/nestalk>,
|
||||
// Marcelo Camargo <https://github.com/hasellcamargo>,
|
||||
// Patrick Niemann <https://github.com/panic175>
|
||||
// Hadrien Milano <https://github.com/hmil>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.3
|
||||
|
||||
@@ -34,70 +37,627 @@ export interface Header {
|
||||
right: string;
|
||||
}
|
||||
|
||||
export interface Options extends AgendaOptions, EventDraggingResizingOptions, DroppingExternalElementsOptions, SelectionOptions {
|
||||
// General display - http://fullcalendar.io/docs/display/
|
||||
export interface CustomButtonDefinition {
|
||||
text: string;
|
||||
click(element: JQuery): void;
|
||||
icon?: string;
|
||||
themeIcon?: string;
|
||||
bootstrapGlyphicon?: string;
|
||||
}
|
||||
|
||||
export interface ButtonIconsDefinition {
|
||||
prev: string;
|
||||
next: string;
|
||||
prevYear: string;
|
||||
nextYear: string;
|
||||
}
|
||||
|
||||
export interface EventSegment {
|
||||
/**
|
||||
* the Event Object
|
||||
*/
|
||||
event: EventObject;
|
||||
|
||||
/**
|
||||
* the Moment for when this stretch of the event begins
|
||||
*/
|
||||
start: moment.Moment;
|
||||
|
||||
/**
|
||||
* the Moment for when this stretch of the event ends (exclusive)
|
||||
*/
|
||||
end: moment.Moment;
|
||||
|
||||
/**
|
||||
* boolean if this is chronologically the first segment for the event
|
||||
*/
|
||||
isStart: boolean;
|
||||
|
||||
/**
|
||||
* boolean if this is chronologically the last segment for the event
|
||||
*/
|
||||
isEnd: boolean;
|
||||
}
|
||||
|
||||
export interface CellInfo {
|
||||
/**
|
||||
* the Moment date of the day
|
||||
*/
|
||||
date: moment.Moment;
|
||||
|
||||
/**
|
||||
* jQuery element for the day cell
|
||||
*/
|
||||
dayEl: JQuery;
|
||||
|
||||
/**
|
||||
* jQuery element for the "more" link
|
||||
*/
|
||||
moreEl: JQuery;
|
||||
|
||||
/**
|
||||
* array of all event "segment" objects for the given day
|
||||
*/
|
||||
segs: EventSegment[];
|
||||
|
||||
/**
|
||||
* array of only the segment objects that were not displayed prior
|
||||
*/
|
||||
hiddenSegs: EventSegment[];
|
||||
}
|
||||
|
||||
export interface TimeRange {
|
||||
start: string | Date | moment.Moment;
|
||||
end: string | Date | moment.Moment;
|
||||
}
|
||||
|
||||
export interface DropInfo {
|
||||
start: moment.Moment;
|
||||
|
||||
/**
|
||||
* exclusive end date/time
|
||||
*/
|
||||
end: moment.Moment;
|
||||
|
||||
/**
|
||||
* if you are using a Resource View
|
||||
*/
|
||||
resourceId?: string;
|
||||
}
|
||||
|
||||
export interface Options extends
|
||||
GeneralDisplayOptions,
|
||||
TimezoneOptions,
|
||||
ViewsOptions,
|
||||
AgendaOptions,
|
||||
ListViewOptions,
|
||||
CurrentDateOptions,
|
||||
TextTimeCustomizationOptions,
|
||||
ClickingAndHoveringOptions,
|
||||
SelectionOptions,
|
||||
EventDataOptions,
|
||||
EventRenderingOptions,
|
||||
EventDraggingResizingOptions,
|
||||
DroppingExternalElementsOptions {
|
||||
// scheduler options
|
||||
resourceAreaWidth?: number;
|
||||
schedulerLicenseKey?: string;
|
||||
resourceLabelText?: any;
|
||||
resourceColumns?: any;
|
||||
displayEventTime?: any;
|
||||
}
|
||||
|
||||
/**
|
||||
* General display - https://fullcalendar.io/docs/display/
|
||||
*/
|
||||
export interface GeneralDisplayOptions {
|
||||
/**
|
||||
* Defines the buttons and title at the top of the calendar.
|
||||
*
|
||||
* default:
|
||||
* {
|
||||
* left: 'title',
|
||||
* center: '',
|
||||
* right: 'today prev,next'
|
||||
* }
|
||||
*/
|
||||
header?: boolean | Header;
|
||||
theme?: boolean;
|
||||
buttonIcons?: {
|
||||
prev: string;
|
||||
next: string;
|
||||
};
|
||||
|
||||
/**
|
||||
* Renders a set of controls at the bottom of the calendar.
|
||||
*
|
||||
* default: false
|
||||
*/
|
||||
footer?: boolean | Header;
|
||||
|
||||
/**
|
||||
* Defines custom buttons that can be used in the header.
|
||||
*/
|
||||
customButtons?: { [name: string]: CustomButtonDefinition };
|
||||
|
||||
/**
|
||||
* Determines which icons are displayed in buttons of the header.
|
||||
*
|
||||
* default:
|
||||
* {
|
||||
* prev: 'left-single-arrow',
|
||||
* next: 'right-single-arrow',
|
||||
* prevYear: 'left-double-arrow',
|
||||
* nextYear: 'right-double-arrow'
|
||||
* }
|
||||
*
|
||||
*/
|
||||
buttonIcons?: boolean | ButtonIconsDefinition;
|
||||
|
||||
/**
|
||||
* Renders the calendar with a given theme system.
|
||||
*
|
||||
* default: 'standard'
|
||||
*/
|
||||
themeSystem?: 'standard' | 'bootstrap3' | 'jquery-ui';
|
||||
|
||||
/**
|
||||
* Determines which icons are displayed in buttons of the header when jQuery UI theming is on.
|
||||
*/
|
||||
themeButtonIcons?: boolean | ButtonIconsDefinition;
|
||||
|
||||
/**
|
||||
* Determines which icons are displayed in buttons of the header when Bootstrap theming is on.
|
||||
*/
|
||||
bootstrapGlyphicons?: boolean | ButtonIconsDefinition;
|
||||
|
||||
/**
|
||||
* The day that each week begins.
|
||||
*
|
||||
* 0 = Sunday
|
||||
*
|
||||
* default: set by the current `locale`
|
||||
*/
|
||||
firstDay?: number;
|
||||
|
||||
/**
|
||||
* Displays the calendar in right-to-left mode.
|
||||
*
|
||||
* default: false
|
||||
*/
|
||||
isRTL?: boolean;
|
||||
|
||||
/**
|
||||
* Whether to include Saturday/Sunday columns in any of the calendar views.
|
||||
*
|
||||
* default: true
|
||||
*/
|
||||
weekends?: boolean;
|
||||
|
||||
/**
|
||||
* Exclude certain days-of-the-week from being displayed.
|
||||
*
|
||||
* default: []
|
||||
*/
|
||||
hiddenDays?: number[];
|
||||
weekMode?: string;
|
||||
|
||||
/**
|
||||
* Determines the number of weeks displayed in a month view.
|
||||
*
|
||||
* default: true
|
||||
*/
|
||||
fixedWeekCount?: boolean;
|
||||
|
||||
/**
|
||||
* Determines if week numbers should be displayed on the calendar.
|
||||
*
|
||||
* default: false
|
||||
*/
|
||||
weekNumbers?: boolean;
|
||||
weekNumberCalculation?: any; // String/Function
|
||||
|
||||
/**
|
||||
* Determines the styling for week numbers in month view and the basic views.
|
||||
*
|
||||
* default: false
|
||||
*/
|
||||
weekNumbersWithinDays?: boolean;
|
||||
|
||||
/**
|
||||
* The method for calculating week numbers that are displayed with the weekNumbers setting.
|
||||
*
|
||||
* default: 'local'
|
||||
*/
|
||||
weekNumberCalculation?: 'local' | 'ISO' | ((m: moment.Moment) => number);
|
||||
|
||||
/**
|
||||
* Emphasizes certain time slots on the calendar. By default, Monday-Friday, 9am-5pm.
|
||||
*
|
||||
* default: false
|
||||
*/
|
||||
businessHours?: boolean | BusinessHours | BusinessHours[];
|
||||
height?: number | 'auto' | 'parent';
|
||||
contentHeight?: number;
|
||||
|
||||
/**
|
||||
* In month view, whether dates in the previous or next month should be rendered at all.
|
||||
*
|
||||
* default: true
|
||||
*/
|
||||
showNonCurrentDates?: boolean;
|
||||
|
||||
/**
|
||||
* Will make the entire calendar (including header) a pixel height.
|
||||
*
|
||||
* default: undefined
|
||||
*/
|
||||
height?: number | 'auto' | 'parent' | (() => number);
|
||||
|
||||
/**
|
||||
* Will make the calendar's content area a pixel height.
|
||||
*/
|
||||
contentHeight?: number | 'auto' | (() => number);
|
||||
|
||||
/**
|
||||
* Determines the width-to-height aspect ratio of the calendar.
|
||||
*
|
||||
* default: 1.35
|
||||
*/
|
||||
aspectRatio?: number;
|
||||
|
||||
/**
|
||||
* Whether to automatically resize the calendar when the browser window resizes.
|
||||
*
|
||||
* default: true
|
||||
*/
|
||||
handleWindowResize?: boolean;
|
||||
views?: ViewSpecificOptions;
|
||||
|
||||
/**
|
||||
* Time, in milliseconds, the calendar will wait to adjust its size after a window resize event occurs.
|
||||
*
|
||||
* default: 100
|
||||
*/
|
||||
windowResizeDelay?: number;
|
||||
|
||||
/**
|
||||
* Limits the number of events displayed on a day.
|
||||
*
|
||||
* default: false
|
||||
*/
|
||||
eventLimit?: boolean | number;
|
||||
|
||||
/**
|
||||
* Determines the action taken when the user clicks on a "more" link created by the eventLimit option.
|
||||
*/
|
||||
eventLimitClick?: 'popover' | 'week' | 'day' | string | ((cellinfo: CellInfo, jsevent: Event) => void);
|
||||
|
||||
/**
|
||||
* Triggered when a new date-range is rendered, or when the view type switches.
|
||||
*/
|
||||
viewRender?(view: ViewObject, element: JQuery): void;
|
||||
|
||||
/**
|
||||
* Triggered when a rendered date-range needs to be torn down.
|
||||
*/
|
||||
viewDestroy?(view: ViewObject, element: JQuery): void;
|
||||
dayRender?(date: Date, cell: JQuery): void;
|
||||
|
||||
/**
|
||||
* A hook for modifying a day cell.
|
||||
*/
|
||||
dayRender?(date: moment.Moment, cell: JQuery): void;
|
||||
|
||||
/**
|
||||
* Triggered after the calendar's dimensions have been changed due to the browser window being resized.
|
||||
*/
|
||||
windowResize?(view: ViewObject): void;
|
||||
}
|
||||
|
||||
// Timezone
|
||||
/**
|
||||
* Timezone - https://fullcalendar.io/docs/timezone/
|
||||
*/
|
||||
export interface TimezoneOptions {
|
||||
/**
|
||||
* Determines the timezone in which dates throughout the API are parsed and rendered.
|
||||
*
|
||||
* default: false
|
||||
*/
|
||||
timezone?: string | boolean;
|
||||
|
||||
/**
|
||||
* Explicitly sets the "today" date of the calendar. This is the day that is normally highlighted in yellow.
|
||||
*/
|
||||
now?: moment.Moment | Date | string | (() => moment.Moment);
|
||||
}
|
||||
|
||||
// Views - http://fullcalendar.io/docs/views/
|
||||
|
||||
/**
|
||||
* Views - https://fullcalendar.io/docs/views/
|
||||
*/
|
||||
export interface ViewsOptions {
|
||||
/**
|
||||
* The initial view when the calendar loads.
|
||||
*
|
||||
* default: 'month'
|
||||
*/
|
||||
defaultView?: string;
|
||||
|
||||
// Current Date - http://fullcalendar.io/docs/current_date/
|
||||
views?: ViewSpecificOptions;
|
||||
}
|
||||
|
||||
/**
|
||||
* Agenda Options - https://fullcalendar.io/docs/agenda/
|
||||
*/
|
||||
export interface AgendaOptions {
|
||||
/**
|
||||
* Determines if the "all-day" slot is displayed at the top of the calendar.
|
||||
*
|
||||
* default: true
|
||||
*/
|
||||
allDaySlot?: boolean;
|
||||
|
||||
/**
|
||||
* The text titling the "all-day" slot at the top of the calendar.
|
||||
*
|
||||
* default: 'all-day'
|
||||
*/
|
||||
allDayText?: string;
|
||||
|
||||
/**
|
||||
* The frequency for displaying time slots.
|
||||
*
|
||||
* default: '00:30:00'
|
||||
*/
|
||||
slotDuration?: moment.Duration;
|
||||
|
||||
/**
|
||||
* Determines the time-text that will be displayed on the vertical axis of the agenda views.
|
||||
*
|
||||
* default: 'h(:mm)a'
|
||||
*/
|
||||
slotLabelFormat?: string;
|
||||
|
||||
/**
|
||||
* Determines how often the time-axis is labeled with text displaying the date/time of slots.
|
||||
*/
|
||||
slotLabelInterval?: moment.Duration;
|
||||
|
||||
/**
|
||||
* The time interval at which a dragged event will snap to the agenda view time grid. Also affects the granularity at which `selections` can be made.
|
||||
*/
|
||||
snapDuration?: moment.Duration;
|
||||
|
||||
/**
|
||||
* Determines how far down the scroll pane is initially scrolled down.
|
||||
*
|
||||
* default: '06:00:00' (6am)
|
||||
*/
|
||||
scrollTime?: moment.Duration;
|
||||
|
||||
/**
|
||||
* Determines the starting time that will be displayed, even when the scrollbars have been scrolled all the way up.
|
||||
*
|
||||
* default: "00:00:00"
|
||||
*/
|
||||
minTime?: moment.Duration;
|
||||
|
||||
/**
|
||||
* Determines the end time (exclusively) that will be displayed, even when the scrollbars have been scrolled all the way down.
|
||||
*
|
||||
* default: "24:00:00"
|
||||
*/
|
||||
maxTime?: moment.Duration;
|
||||
|
||||
/**
|
||||
* Determines if timed events in agenda view should visually overlap.
|
||||
*
|
||||
* default: true
|
||||
*/
|
||||
slotEventOverlap?: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* List View - https://fullcalendar.io/docs/list_view/
|
||||
*/
|
||||
export interface ListViewOptions {
|
||||
/**
|
||||
* A date formatting string that affects the text on the left side of the day headings in list view.
|
||||
*/
|
||||
listDayFormat?: string | boolean;
|
||||
|
||||
/**
|
||||
* A date formatting string that affects the text on the right side of the day headings in list view.
|
||||
*/
|
||||
listDayAltFormat?: string | boolean;
|
||||
|
||||
/**
|
||||
* The text that is displayed in the middle of list view, alerting the user that there are no events within the given range.
|
||||
*
|
||||
* default: "No events to display"
|
||||
*/
|
||||
noEventsMessage?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Current Date - https://fullcalendar.io/docs/current_date/
|
||||
*/
|
||||
export interface CurrentDateOptions {
|
||||
/**
|
||||
* The initial date displayed when the calendar first loads.
|
||||
*/
|
||||
defaultDate?: moment.Moment | Date | string;
|
||||
year?: number;
|
||||
month?: number;
|
||||
date?: number;
|
||||
|
||||
// Text/Time Customization - http://fullcalendar.io/docs/text/
|
||||
/**
|
||||
* Whether or not to display a marker indicating the current time.
|
||||
*
|
||||
* default: false
|
||||
*/
|
||||
nowIndicator?: boolean;
|
||||
|
||||
timeFormat?: any; // String
|
||||
columnFormat?: any; // String
|
||||
titleFormat?: any; // String
|
||||
/**
|
||||
* Sets the exact date range that is visible in a view.
|
||||
*/
|
||||
visibleRange?: ((currentDate: moment.Moment) => TimeRange) | TimeRange;
|
||||
|
||||
/**
|
||||
* Limits which dates the user can navigate to and where events can go.
|
||||
*/
|
||||
validRange?: TimeRange;
|
||||
|
||||
/**
|
||||
* How far into the future/past the calendar navigates when prev/next is executed.
|
||||
*/
|
||||
dateIncrement?: moment.Duration;
|
||||
|
||||
/**
|
||||
* Determines the first visible day for a Custom or Generic view.
|
||||
*/
|
||||
dateAlignment?: string;
|
||||
|
||||
/**
|
||||
* Sets the exact duration of a Custom or Generic view.
|
||||
*/
|
||||
duration?: moment.Duration;
|
||||
|
||||
/**
|
||||
* Sets the exact number of days displayed in a Custom or Generic view, regardless of weekends or hiddenDays.
|
||||
*/
|
||||
dayCount?: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* Text/Time Customization - https://fullcalendar.io/docs/text/
|
||||
*/
|
||||
export interface TextTimeCustomizationOptions {
|
||||
/**
|
||||
* Customize the language and localization options for the calendar.
|
||||
*
|
||||
* default 'en'
|
||||
*/
|
||||
locale?: string;
|
||||
|
||||
/**
|
||||
* Determines the time-text that will be displayed on each event.
|
||||
*/
|
||||
timeFormat?: string;
|
||||
|
||||
/**
|
||||
* Determines the text that will be displayed on the calendar's column headings.
|
||||
*/
|
||||
columnFormat?: string;
|
||||
|
||||
/**
|
||||
* Determines the text that will be displayed in the header's title.
|
||||
*/
|
||||
titleFormat?: string;
|
||||
|
||||
/**
|
||||
* Text that will be displayed on buttons of the header.
|
||||
*/
|
||||
buttonText?: ButtonTextObject;
|
||||
|
||||
/**
|
||||
* Full names of months.
|
||||
*/
|
||||
monthNames?: string[];
|
||||
|
||||
/**
|
||||
* Abbreviated names of months.
|
||||
*/
|
||||
monthNamesShort?: string[];
|
||||
|
||||
/**
|
||||
* Full names of days-of-week.
|
||||
*/
|
||||
dayNames?: string[];
|
||||
|
||||
/**
|
||||
* Abbreviated names of days-of-week.
|
||||
*/
|
||||
dayNamesShort?: string[];
|
||||
|
||||
/**
|
||||
* The heading text for week numbers.
|
||||
*
|
||||
* default: 'W'
|
||||
*/
|
||||
weekNumberTitle?: string;
|
||||
|
||||
// Clicking & Hovering - http://fullcalendar.io/docs/mouse/
|
||||
/**
|
||||
* Whether or not to display the text for an event's time.
|
||||
*/
|
||||
displayEventTime?: boolean;
|
||||
|
||||
/**
|
||||
* Whether or not to display an event's end time text when it is rendered on the calendar.
|
||||
*/
|
||||
displayEventEnd?: boolean;
|
||||
|
||||
/**
|
||||
* Determines the text of the link created by eventLimit setting.
|
||||
*
|
||||
* default: "more"
|
||||
*/
|
||||
eventLimitText?: string | ((nEvents: number) => string);
|
||||
|
||||
/**
|
||||
* Determines the date format of title of the popover created by the eventLimitClick option.
|
||||
*/
|
||||
dayPopoverFormat?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Clicking & Hovering - https://fullcalendar.io/docs/mouse/
|
||||
*/
|
||||
export interface ClickingAndHoveringOptions {
|
||||
/**
|
||||
* Determines if day names and week names are clickable.
|
||||
*
|
||||
* default: false
|
||||
*/
|
||||
navLinks?: boolean;
|
||||
|
||||
/**
|
||||
* Determines what happens upon a day heading nav-link click.
|
||||
*/
|
||||
navLinkDayClick?: string | ((date: any, jsEvent: Event) => void);
|
||||
|
||||
/**
|
||||
* Determines what happens upon a week-number nav-link click.
|
||||
*/
|
||||
navLinkWeekClick?: string | ((weekStart: any, jsEvent: Event) => void);
|
||||
|
||||
/**
|
||||
* Triggered when the user clicks on a day.
|
||||
*/
|
||||
dayClick?(date: Date, jsEvent: MouseEvent, view: ViewObject): void;
|
||||
eventClick?(event: EventObject, jsEvent: MouseEvent, view: ViewObject): any; // return type boolean or void
|
||||
|
||||
/**
|
||||
* Triggered when the user clicks an event.
|
||||
*/
|
||||
eventClick?(event: EventObject, jsEvent: MouseEvent, view: ViewObject): boolean | void; // return type boolean or void
|
||||
|
||||
/**
|
||||
* Triggered when the user mouses over an event.
|
||||
*/
|
||||
eventMouseover?(event: EventObject, jsEvent: MouseEvent, view: ViewObject): void;
|
||||
|
||||
/**
|
||||
* Triggered when the user mouses out of an event.
|
||||
*/
|
||||
eventMouseout?(event: EventObject, jsEvent: MouseEvent, view: ViewObject): void;
|
||||
}
|
||||
|
||||
// Event Data - http://fullcalendar.io/docs/event_data/
|
||||
/**
|
||||
* Selection - https://fullcalendar.io/docs/selection/
|
||||
*/
|
||||
export interface SelectionOptions {
|
||||
selectable?: boolean;
|
||||
selectHelper?: boolean;
|
||||
unselectAuto?: boolean;
|
||||
unselectCancel?: string;
|
||||
selectOverlap?: boolean | ((event: EventObject) => boolean);
|
||||
selectConstraint?: Timespan | BusinessHours;
|
||||
select?(start: moment.Moment, end: moment.Moment, jsEvent: MouseEvent, view: ViewObject, resource?: any): void;
|
||||
unselect?(view: ViewObject, jsEvent: Event): void;
|
||||
}
|
||||
|
||||
/**
|
||||
* Event Data - https://fullcalendar.io/docs/event_data/
|
||||
*
|
||||
* TODO: update interface to v3
|
||||
*/
|
||||
export interface EventDataOptions {
|
||||
/**
|
||||
* This has one of the following types:
|
||||
*
|
||||
@@ -123,81 +683,206 @@ export interface Options extends AgendaOptions, EventDraggingResizingOptions, Dr
|
||||
lazyFetching?: boolean;
|
||||
eventDataTransform?(eventData: any): EventObject;
|
||||
loading?(isLoading: boolean, view: ViewObject): void;
|
||||
eventLimit?: boolean;
|
||||
|
||||
// Event Rendering - http://fullcalendar.io/docs/event_rendering/
|
||||
|
||||
eventColor?: string;
|
||||
eventBackgroundColor?: string;
|
||||
eventBorderColor?: string;
|
||||
eventTextColor?: string;
|
||||
eventRender?(event: EventObject, element: JQuery, view: ViewObject): void;
|
||||
eventAfterRender?(event: EventObject, element: JQuery, view: ViewObject): void;
|
||||
eventAfterAllRender?(view: ViewObject): void;
|
||||
eventDestroy?(event: EventObject, element: JQuery, view: ViewObject): void;
|
||||
|
||||
// scheduler options
|
||||
resourceAreaWidth?: number;
|
||||
schedulerLicenseKey?: string;
|
||||
customButtons?: any;
|
||||
resourceLabelText?: any;
|
||||
resourceColumns?: any;
|
||||
displayEventTime?: any;
|
||||
}
|
||||
|
||||
/**
|
||||
* Agenda Options - http://fullcalendar.io/docs/agenda/
|
||||
* Event Rendering - https://fullcalendar.io/docs/event_rendering/
|
||||
*/
|
||||
export interface AgendaOptions {
|
||||
allDaySlot?: boolean;
|
||||
allDayText?: string;
|
||||
slotDuration?: moment.DurationInputArg1;
|
||||
slotLabelFormat?: string;
|
||||
slotLabelInterval?: moment.Duration;
|
||||
snapDuration?: moment.Duration;
|
||||
scrollTime?: moment.Duration;
|
||||
minTime?: moment.Duration; // Integer/String
|
||||
maxTime?: moment.Duration; // Integer/String
|
||||
slotEventOverlap?: boolean;
|
||||
export interface EventRenderingOptions {
|
||||
/**
|
||||
* Sets the background and border colors for all events on the calendar.
|
||||
*/
|
||||
eventColor?: string;
|
||||
|
||||
/**
|
||||
* Sets the background color for all events on the calendar.
|
||||
*/
|
||||
eventBackgroundColor?: string;
|
||||
|
||||
/**
|
||||
* Sets the border color for all events on the calendar.
|
||||
*/
|
||||
eventBorderColor?: string;
|
||||
|
||||
/**
|
||||
* Sets the text color for all events on the calendar.
|
||||
*/
|
||||
eventTextColor?: string;
|
||||
|
||||
/**
|
||||
* When an event's end time spans into another day, the minimum time it must be in order for it to render as if it were on that day.
|
||||
*
|
||||
* default: "09:00:00" (9am)
|
||||
*/
|
||||
nextDayThreshold?: moment.Duration;
|
||||
|
||||
/**
|
||||
* Determines the vertical ordering events that have the same dates / times.
|
||||
*
|
||||
* default 'title'
|
||||
*/
|
||||
eventOrder?: string | Array<((a: EventObject, b: EventObject) => number) | (string | ((a: EventObject, b: EventObject) => number))>;
|
||||
|
||||
/**
|
||||
* The amount of milliseconds to wait after an operation, before rendering events.
|
||||
*
|
||||
* default: null
|
||||
*/
|
||||
eventRenderWait?: number | null;
|
||||
|
||||
/**
|
||||
* Triggered while an event is being rendered.
|
||||
*/
|
||||
eventRender?(event: EventObject, element: JQuery, view: ViewObject): void;
|
||||
|
||||
/**
|
||||
* Triggered after an event has been placed on the calendar in its final position.
|
||||
*/
|
||||
eventAfterRender?(event: EventObject, element: JQuery, view: ViewObject): void;
|
||||
|
||||
/**
|
||||
* Triggered after all events have finished rendering.
|
||||
*/
|
||||
eventAfterAllRender?(view: ViewObject): void;
|
||||
|
||||
/**
|
||||
* Called before an event's element is removed from the DOM.
|
||||
*/
|
||||
eventDestroy?(event: EventObject, element: JQuery, view: ViewObject): void;
|
||||
}
|
||||
|
||||
/*
|
||||
* Event Dragging & Resizing
|
||||
*/
|
||||
/**
|
||||
* Event Dragging & Resizing - https://fullcalendar.io/docs/event_ui/
|
||||
*/
|
||||
export interface EventDraggingResizingOptions {
|
||||
/**
|
||||
* Determines whether the events on the calendar can be modified.
|
||||
*
|
||||
* default: false
|
||||
*/
|
||||
editable?: boolean;
|
||||
|
||||
/**
|
||||
* Allow events' start times to be editable through dragging.
|
||||
*
|
||||
* default: true
|
||||
*/
|
||||
eventStartEditable?: boolean;
|
||||
|
||||
/**
|
||||
* Allow events' durations to be editable through resizing.
|
||||
*
|
||||
* default: true
|
||||
*/
|
||||
eventDurationEditable?: boolean;
|
||||
|
||||
/**
|
||||
* Time it takes for an event to revert to its original position after an unsuccessful drag.
|
||||
*
|
||||
* default: 500
|
||||
*/
|
||||
dragRevertDuration?: number; // integer, milliseconds
|
||||
dragOpacity?: number; // float
|
||||
|
||||
/**
|
||||
* The opacity of an event while it is being dragged.
|
||||
*
|
||||
* default: .75
|
||||
*/
|
||||
dragOpacity?: number;
|
||||
|
||||
/**
|
||||
* Whether to automatically move scroll containers during event drag-and-drop or while selecting.
|
||||
*
|
||||
* default: true
|
||||
*/
|
||||
dragScroll?: boolean;
|
||||
|
||||
/**
|
||||
* Determines if events on the calendar, when dragged and resized, are allowed to overlap each other.
|
||||
*
|
||||
* default: true
|
||||
*/
|
||||
eventOverlap?: boolean | ((stillEvent: EventObject, movingEvent: EventObject) => boolean);
|
||||
eventConstraint?: "businessHours" | BusinessHours | Timespan;
|
||||
|
||||
/**
|
||||
* Limits event dragging and resizing to certain windows of time.
|
||||
*/
|
||||
eventConstraint?: "businessHours" | BusinessHours | Timespan | string;
|
||||
|
||||
/**
|
||||
* Exact programmatic control over where an event can be dropped.
|
||||
*/
|
||||
eventAllow?: ((dropInfo: DropInfo, draggedEvent: Event) => boolean);
|
||||
|
||||
/**
|
||||
* For touch devices, the amount of time the user most hold down before an event becomes draggable or a date becomes selectable.
|
||||
*
|
||||
* default: 1000
|
||||
*/
|
||||
longPressDelay?: number;
|
||||
|
||||
/**
|
||||
* For touch devices, the amount of time the user most hold down before an event becomes draggable.
|
||||
*
|
||||
* default: 1000
|
||||
*/
|
||||
eventLongPressDelay?: number;
|
||||
|
||||
/**
|
||||
* Triggered when event dragging begins.
|
||||
*/
|
||||
eventDragStart?(event: EventObject, jsEvent: MouseEvent, ui: any, view: ViewObject): void;
|
||||
|
||||
/**
|
||||
* Triggered when event dragging stops.
|
||||
*/
|
||||
eventDragStop?(event: EventObject, jsEvent: MouseEvent, ui: any, view: ViewObject): void;
|
||||
|
||||
/**
|
||||
* Triggered when dragging stops and the event has moved to a different day/time.
|
||||
*/
|
||||
eventDrop?(event: EventObject, delta: moment.Duration, revertFunc: Function, jsEvent: Event, ui: any, view: ViewObject): void;
|
||||
|
||||
/**
|
||||
* Triggered when event resizing begins.
|
||||
*/
|
||||
eventResizeStart?(event: EventObject, jsEvent: MouseEvent, ui: any, view: ViewObject): void;
|
||||
|
||||
/**
|
||||
* Triggered when event resizing stops.
|
||||
*/
|
||||
eventResizeStop?(event: EventObject, jsEvent: MouseEvent, ui: any, view: ViewObject): void;
|
||||
|
||||
/**
|
||||
* Triggered when resizing stops and the event has changed in duration.
|
||||
*/
|
||||
eventResize?(event: EventObject, delta: moment.Duration, revertFunc: Function, jsEvent: Event, ui: any, view: ViewObject): void;
|
||||
}
|
||||
/*
|
||||
* Selection - http://fullcalendar.io/docs/selection/
|
||||
*/
|
||||
export interface SelectionOptions {
|
||||
selectable?: boolean;
|
||||
selectHelper?: boolean;
|
||||
unselectAuto?: boolean;
|
||||
unselectCancel?: string;
|
||||
selectOverlap?: boolean | ((event: EventObject) => boolean);
|
||||
selectConstraint?: Timespan | BusinessHours;
|
||||
select?(start: moment.Moment, end: moment.Moment, jsEvent: MouseEvent, view: ViewObject, resource?: any): void;
|
||||
unselect?(view: ViewObject, jsEvent: Event): void;
|
||||
}
|
||||
|
||||
/**
|
||||
* Dropping External Elements - https://fullcalendar.io/docs/dropping/
|
||||
*/
|
||||
export interface DroppingExternalElementsOptions {
|
||||
/**
|
||||
* Determines if jQuery UI draggables can be dropped onto the calendar.
|
||||
*
|
||||
* default: false
|
||||
*/
|
||||
droppable?: boolean;
|
||||
|
||||
/**
|
||||
* Provides a way to filter which elements can be dropped onto the calendar.
|
||||
*/
|
||||
dropAccept?: string | ((draggable: any) => boolean);
|
||||
|
||||
/**
|
||||
* Called when a valid jQuery UI draggable has been dropped onto the calendar.
|
||||
*/
|
||||
drop?(date: moment.Moment, jsEvent: MouseEvent, ui: any): void;
|
||||
|
||||
/**
|
||||
* Called when an external element, containing event data, is dropped on the calendar.
|
||||
*/
|
||||
eventReceive?(event: EventObject): void;
|
||||
}
|
||||
|
||||
@@ -210,8 +895,10 @@ export interface ButtonTextObject {
|
||||
month?: string;
|
||||
week?: string;
|
||||
day?: string;
|
||||
list?: string;
|
||||
}
|
||||
|
||||
// TODO: check compatibility with v3 and update if necessary
|
||||
/* Refer to http://fullcalendar.io/docs/event_data/Event_Object/ */
|
||||
export interface EventObject extends Timespan {
|
||||
id?: any; // String/number
|
||||
@@ -234,6 +921,7 @@ export interface EventObject extends Timespan {
|
||||
[x: string]: any;
|
||||
}
|
||||
|
||||
// TODO: check compatibility with v3 and update if necessary
|
||||
export interface ViewObject extends Timespan {
|
||||
name: string;
|
||||
title: string;
|
||||
@@ -241,6 +929,7 @@ export interface ViewObject extends Timespan {
|
||||
intervalEnd: moment.Moment;
|
||||
}
|
||||
|
||||
// TODO: check compatibility with v3 and update if necessary
|
||||
export interface EventSource extends JQueryAjaxSettings {
|
||||
/**
|
||||
* This has one of the following types:
|
||||
@@ -266,6 +955,7 @@ export interface EventSource extends JQueryAjaxSettings {
|
||||
|
||||
/*
|
||||
* View Specific Options - http://fullcalendar.io/docs/views/View-Specific-Options/
|
||||
* TODO: check compatibility with v3 and update if necessary
|
||||
*/
|
||||
export interface ViewSpecificOptions {
|
||||
basic?: Options;
|
||||
@@ -278,7 +968,9 @@ export interface ViewSpecificOptions {
|
||||
agendaWeek?: Options;
|
||||
agendaDay?: Options;
|
||||
}
|
||||
|
||||
declare global {
|
||||
// TODO: check compatibility with v3 and update if necessary
|
||||
interface JQuery {
|
||||
/**
|
||||
* Get/Set option value
|
||||
|
||||
+12
-12
@@ -410,7 +410,7 @@ declare namespace google {
|
||||
}
|
||||
|
||||
export interface ChartArea {
|
||||
backgroundColor: string | { stroke: string; strokeWidth?: number };
|
||||
backgroundColor?: string | { stroke: string; strokeWidth?: number };
|
||||
top?: number | string;
|
||||
left?: number | string;
|
||||
right?: number | string;
|
||||
@@ -584,7 +584,7 @@ declare namespace google {
|
||||
draw(data: DataTable | DataView, options: ColumnChartOptions): void;
|
||||
}
|
||||
|
||||
// https://developers.google.com/chart/interactive/docs/gallery/columnchart#Configuration_Options
|
||||
// https://developers.google.com/chart/interactive/docs/gallery/columnchart#configuration-options
|
||||
export interface ColumnChartOptions {
|
||||
aggregationTarget?: string;
|
||||
animation?: TransitionAnimation;
|
||||
@@ -600,7 +600,7 @@ declare namespace google {
|
||||
fontName?: string;
|
||||
hAxis?: ChartAxis;
|
||||
height?: number;
|
||||
isStacked?: boolean;
|
||||
isStacked?: boolean | 'percent' | 'relative' | 'absolute';
|
||||
legend?: ChartLegend | 'none';
|
||||
reverseCategories?: boolean;
|
||||
selectionMode?: string // single / multiple
|
||||
@@ -663,7 +663,7 @@ declare namespace google {
|
||||
//#endregion
|
||||
//#region BarChart
|
||||
|
||||
// https://developers.google.com/chart/interactive/docs/gallery/barchart#Configuration_Options
|
||||
// https://developers.google.com/chart/interactive/docs/gallery/barchart#configuration-options
|
||||
export interface BarChartOptions {
|
||||
aggregationTarget?: string;
|
||||
animation?: TransitionAnimation;
|
||||
@@ -681,7 +681,7 @@ declare namespace google {
|
||||
hAxes?: any;
|
||||
hAxis?: ChartAxis;
|
||||
height?: number;
|
||||
isStacked?: boolean;
|
||||
isStacked?: boolean | 'percent' | 'relative' | 'absolute';
|
||||
legend?: ChartLegend | 'none';
|
||||
reverseCategories?: boolean;
|
||||
series?: any;
|
||||
@@ -708,7 +708,7 @@ declare namespace google {
|
||||
draw(data: DataTable | DataView, options: HistogramOptions): void;
|
||||
}
|
||||
|
||||
// https://developers.google.com/chart/interactive/docs/gallery/histogram#Configuration_Options
|
||||
// https://developers.google.com/chart/interactive/docs/gallery/histogram#configuration-options
|
||||
export interface HistogramOptions {
|
||||
animation?: TransitionAnimation;
|
||||
axisTitlesPosition?: string; // in, out, none
|
||||
@@ -725,7 +725,7 @@ declare namespace google {
|
||||
histogram?: HistogramHistogramOptions;
|
||||
height?: number;
|
||||
interpolateNulls?: boolean;
|
||||
isStacked?: boolean;
|
||||
isStacked?: boolean | 'percent' | 'relative' | 'absolute';
|
||||
legend?: ChartLegend | 'none';
|
||||
orientation?: string;
|
||||
reverseCategories?: boolean;
|
||||
@@ -754,7 +754,7 @@ declare namespace google {
|
||||
draw(data: DataTable | DataView, options: AreaChartOptions): void;
|
||||
}
|
||||
|
||||
// https://developers.google.com/chart/interactive/docs/gallery/areachart#Configuration_Options
|
||||
// https://developers.google.com/chart/interactive/docs/gallery/areachart#configuration-options
|
||||
export interface AreaChartOptions {
|
||||
aggregationTarget?: string;
|
||||
animation?: TransitionAnimation;
|
||||
@@ -774,7 +774,7 @@ declare namespace google {
|
||||
hAxis?: ChartAxis;
|
||||
height?: number;
|
||||
interpolateNulls?: boolean;
|
||||
isStacked?: boolean;
|
||||
isStacked?: boolean | 'percent' | 'relative' | 'absolute';
|
||||
legend?: ChartLegend | 'none';
|
||||
lineWidth?: number;
|
||||
orientation?: string;
|
||||
@@ -842,7 +842,7 @@ declare namespace google {
|
||||
draw(data: DataTable | DataView, options: SteppedAreaChartOptions): void;
|
||||
}
|
||||
|
||||
// https://developers.google.com/chart/interactive/docs/gallery/areachart#Configuration_Options
|
||||
// https://developers.google.com/chart/interactive/docs/gallery/steppedareachart#configuration-options
|
||||
export interface SteppedAreaChartOptions {
|
||||
aggregationTarget?: string;
|
||||
animation?: TransitionAnimation;
|
||||
@@ -859,7 +859,7 @@ declare namespace google {
|
||||
hAxis?: ChartAxis;
|
||||
height?: number;
|
||||
interpolateNulls?: boolean;
|
||||
isStacked?: boolean;
|
||||
isStacked?: boolean | 'percent' | 'relative' | 'absolute';
|
||||
legend?: ChartLegend | 'none';
|
||||
reverseCategories?: boolean;
|
||||
selectionMode?: string // single / multiple
|
||||
@@ -882,7 +882,7 @@ declare namespace google {
|
||||
draw(data: DataTable | DataView, options: PieChartOptions): void;
|
||||
}
|
||||
|
||||
// https://developers.google.com/chart/interactive/docs/gallery/piechart#Configuration_Options
|
||||
// https://developers.google.com/chart/interactive/docs/gallery/piechart#configuration-options
|
||||
export interface PieChartOptions {
|
||||
backgroundColor?: any;
|
||||
chartArea?: ChartArea;
|
||||
|
||||
Vendored
+13
@@ -36,6 +36,16 @@ export interface ExecutionResult {
|
||||
errors?: GraphQLError[];
|
||||
}
|
||||
|
||||
export type ExecutionArgs = {
|
||||
schema: GraphQLSchema,
|
||||
document: DocumentNode,
|
||||
rootValue?: any,
|
||||
contextValue?: any,
|
||||
variableValues?: {[key: string]: any},
|
||||
operationName?: string,
|
||||
fieldResolver?: GraphQLFieldResolver<any, any>
|
||||
};
|
||||
|
||||
/**
|
||||
* Implements the "Evaluating requests" section of the GraphQL specification.
|
||||
*
|
||||
@@ -43,7 +53,10 @@ export interface ExecutionResult {
|
||||
*
|
||||
* If the arguments to this function do not result in a legal execution context,
|
||||
* a GraphQLError will be thrown immediately explaining the invalid input.
|
||||
*
|
||||
* Accepts either an object with named arguments, or individual arguments.
|
||||
*/
|
||||
export function execute(args: ExecutionArgs): Promise<ExecutionResult>;
|
||||
export function execute(
|
||||
schema: GraphQLSchema,
|
||||
document: DocumentNode,
|
||||
|
||||
Vendored
+1
@@ -2,6 +2,7 @@ export {
|
||||
execute,
|
||||
defaultFieldResolver,
|
||||
responsePathAsArray,
|
||||
ExecutionArgs,
|
||||
ExecutionResult
|
||||
} from './execute';
|
||||
|
||||
|
||||
Vendored
+24
-4
@@ -1,3 +1,5 @@
|
||||
import { Source } from './language/source';
|
||||
import { GraphQLFieldResolver } from './type/definition';
|
||||
import { GraphQLSchema } from './type/schema';
|
||||
import { ExecutionResult } from './execution/execute';
|
||||
|
||||
@@ -10,9 +12,11 @@ import { ExecutionResult } from './execution/execute';
|
||||
* may wish to separate the validation and execution phases to a static time
|
||||
* tooling step, and a server runtime step.
|
||||
*
|
||||
* Accepts either an object with named arguments, or individual arguments:
|
||||
*
|
||||
* schema:
|
||||
* The GraphQL type system to use when validating and executing a query.
|
||||
* requestString:
|
||||
* source:
|
||||
* A GraphQL language formatted string representing the requested operation.
|
||||
* rootValue:
|
||||
* The value provided as the first argument to resolver functions on the top
|
||||
@@ -24,14 +28,30 @@ import { ExecutionResult } from './execution/execute';
|
||||
* The name of the operation to use if requestString contains multiple
|
||||
* possible operations. Can be omitted if requestString contains only
|
||||
* one operation.
|
||||
* fieldResolver:
|
||||
* A resolver function to use when one is not provided by the schema.
|
||||
* If not provided, the default field resolver is used (which looks for a
|
||||
* value or method on the source value with the field's name).
|
||||
*/
|
||||
export function graphql(
|
||||
export function graphql(args: {
|
||||
schema: GraphQLSchema,
|
||||
requestString: string,
|
||||
source: string | Source,
|
||||
rootValue?: any,
|
||||
contextValue?: any,
|
||||
variableValues?: {
|
||||
[key: string]: any
|
||||
},
|
||||
operationName?: string
|
||||
operationName?: string,
|
||||
fieldResolver?: GraphQLFieldResolver<any, any>
|
||||
}): Promise<ExecutionResult>;
|
||||
export function graphql(
|
||||
schema: GraphQLSchema,
|
||||
source: string | Source,
|
||||
rootValue?: any,
|
||||
contextValue?: any,
|
||||
variableValues?: {
|
||||
[key: string]: any
|
||||
},
|
||||
operationName?: string,
|
||||
fieldResolver?: GraphQLFieldResolver<any, any>
|
||||
): Promise<ExecutionResult>;
|
||||
|
||||
Vendored
+1
@@ -30,6 +30,7 @@ export {
|
||||
defaultFieldResolver,
|
||||
responsePathAsArray,
|
||||
getDirectiveValues,
|
||||
ExecutionArgs,
|
||||
ExecutionResult,
|
||||
} from './execution';
|
||||
|
||||
|
||||
Vendored
+7
-1
@@ -6,4 +6,10 @@ export { createLexer, TokenKind, Lexer } from './lexer';
|
||||
export { parse, parseValue, parseType, ParseOptions } from './parser';
|
||||
export { print } from './printer';
|
||||
export { Source } from './source';
|
||||
export { visit, visitInParallel, visitWithTypeInfo, BREAK } from './visitor';
|
||||
export {
|
||||
visit,
|
||||
visitInParallel,
|
||||
visitWithTypeInfo,
|
||||
getVisitFn,
|
||||
BREAK
|
||||
} from './visitor';
|
||||
|
||||
Vendored
+6
@@ -47,3 +47,9 @@ export function visit(root: any, visitor: any, keyMap?: any): any;
|
||||
export function visitInParallel(visitors: any): any;
|
||||
|
||||
export function visitWithTypeInfo(typeInfo: any, visitor: any): any;
|
||||
|
||||
/**
|
||||
* Given a visitor instance, if it is leaving or not, and a node kind, return
|
||||
* the function the visitor runtime should call.
|
||||
*/
|
||||
export function getVisitFn(visitor: any, kind: any, isLeaving: any): any;
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
import gravatarUrl = require('gravatar-url');
|
||||
|
||||
gravatarUrl('sindresorhus@gmail.com'); // $ExpectType string
|
||||
gravatarUrl('sindresorhus@gmail.com', { default: 'monsterid' }); // $ExpectType string
|
||||
gravatarUrl('sindresorhus@gmail.com', { default: 'monsterid', size: 200 }); // $ExpectType string
|
||||
gravatarUrl('sindresorhus@gmail.com', { default: 'monsterid', rating: 'g', size: 200 }); // $ExpectType string
|
||||
gravatarUrl('sindresorhus@gmail.com', { rating: 'g' }); // $ExpectType string
|
||||
gravatarUrl('sindresorhus@gmail.com', { rating: 'pg' }); // $ExpectType string
|
||||
gravatarUrl('sindresorhus@gmail.com', { rating: 'r' }); // $ExpectType string
|
||||
gravatarUrl('sindresorhus@gmail.com', { rating: 'x' }); // $ExpectType string
|
||||
gravatarUrl('sindresorhus@gmail.com', { rating: 'g', size: 200 }); // $ExpectType string
|
||||
gravatarUrl('sindresorhus@gmail.com', { size: 200 }); // $ExpectType string
|
||||
Vendored
+16
@@ -0,0 +1,16 @@
|
||||
// Type definitions for gravatar-url 2.0
|
||||
// Project: https://github.com/sindresorhus/gravatar-url
|
||||
// Definitions by: Ivan Gabriele <https://github.com/ivangabriele>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
export = GravatarUrl;
|
||||
|
||||
declare function GravatarUrl(email: string, options?: GravatarUrl.Options): string;
|
||||
|
||||
declare namespace GravatarUrl {
|
||||
interface Options {
|
||||
default?: string;
|
||||
rating?: 'g' | 'pg' | 'r' | 'x';
|
||||
size?: number;
|
||||
}
|
||||
}
|
||||
@@ -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",
|
||||
"gravatar-url-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Vendored
+2
-2
@@ -1430,9 +1430,9 @@ declare namespace Hls {
|
||||
*/
|
||||
levelId?: number;
|
||||
/**
|
||||
* ErrorDetails type
|
||||
* ErrorDetails type or Level Details
|
||||
*/
|
||||
details?: string;
|
||||
details?: string | LevelDetails;
|
||||
/**
|
||||
* PTS drift observed when parsing last fragment
|
||||
*/
|
||||
|
||||
Vendored
+2
-1
@@ -1,4 +1,4 @@
|
||||
// Type definitions for Jasmine 2.5.2
|
||||
// Type definitions for Jasmine 2.6.0
|
||||
// Project: http://jasmine.github.io/
|
||||
// Definitions by: Boris Yankov <https://github.com/borisyankov>, Theodore Brown <https://github.com/theodorejb>, David Pärsson <https://github.com/davidparsson>, Gabe Moothart <https://github.com/gmoothart>, Lukas Zech <https://github.com/lukas-zech-software>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
@@ -427,6 +427,7 @@ declare namespace jasmine {
|
||||
toBeTruthy(expectationFailOutput?: any): boolean;
|
||||
toBeFalsy(expectationFailOutput?: any): boolean;
|
||||
toHaveBeenCalled(): boolean;
|
||||
toHaveBeenCalledBefore(expected: Spy): boolean;
|
||||
toHaveBeenCalledWith(...params: any[]): boolean;
|
||||
toHaveBeenCalledTimes(expected: number): boolean;
|
||||
toContain(expected: any, expectationFailOutput?: any): boolean;
|
||||
|
||||
@@ -270,19 +270,24 @@ describe("Pending specs", () => {
|
||||
});
|
||||
|
||||
describe("A spy", () => {
|
||||
var foo: any, bar: any = null;
|
||||
var foo: any, bar: any, baz: any = null;
|
||||
|
||||
beforeEach(() => {
|
||||
foo = {
|
||||
setBar: (value: any) => {
|
||||
bar = value;
|
||||
},
|
||||
setBaz: (value: any) => {
|
||||
baz = value;
|
||||
}
|
||||
};
|
||||
|
||||
spyOn(foo, 'setBar');
|
||||
spyOn(foo, 'setBaz');
|
||||
|
||||
foo.setBar(123);
|
||||
foo.setBar(456, 'another param');
|
||||
foo.setBaz(789);
|
||||
});
|
||||
|
||||
it("tracks that the spy was called", () => {
|
||||
@@ -294,6 +299,10 @@ describe("A spy", () => {
|
||||
expect(foo.setBar).toHaveBeenCalledWith(456, 'another param');
|
||||
});
|
||||
|
||||
it("tracks the order in which spies were called", () => {
|
||||
expect(foo.setBar).toHaveBeenCalledBefore(foo.setBaz);
|
||||
});
|
||||
|
||||
it("stops all execution on a function", () => {
|
||||
expect(bar).toBeNull();
|
||||
});
|
||||
|
||||
Vendored
+279
-357
File diff suppressed because it is too large
Load Diff
+58
-75
@@ -8,7 +8,7 @@ var num: number = 0;
|
||||
var str: string = '';
|
||||
var bool: boolean = false;
|
||||
var exp: RegExp = null;
|
||||
var obj: Object = null;
|
||||
var obj: object = null;
|
||||
var date: Date = null;
|
||||
var err: Error = null;
|
||||
var func: Function = null;
|
||||
@@ -18,15 +18,16 @@ var numArr: number[] = [];
|
||||
var strArr: string[] = [];
|
||||
var boolArr: boolean[] = [];
|
||||
var expArr: RegExp[] = [];
|
||||
var objArr: Object[] = [];
|
||||
var objArr: object[] = [];
|
||||
var errArr: Error[] = [];
|
||||
var funcArr: Function[] = [];
|
||||
|
||||
// --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---
|
||||
|
||||
var schema: Joi.Schema = null;
|
||||
var schemaLike: Joi.SchemaLike = null;
|
||||
|
||||
var anySchema: Joi.AnySchema<Joi.Schema> = null;
|
||||
var anySchema: Joi.AnySchema = null;
|
||||
var numSchema: Joi.NumberSchema = null;
|
||||
var strSchema: Joi.StringSchema = null;
|
||||
var arrSchema: Joi.ArraySchema = null;
|
||||
@@ -40,6 +41,7 @@ var altSchema: Joi.AlternativesSchema = null;
|
||||
var schemaArr: Joi.Schema[] = [];
|
||||
|
||||
var ref: Joi.Reference = null;
|
||||
var description: Joi.Description = null;
|
||||
|
||||
// --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---
|
||||
|
||||
@@ -53,10 +55,25 @@ validOpts = { stripUnknown: bool };
|
||||
validOpts = { stripUnknown: { arrays: bool } };
|
||||
validOpts = { stripUnknown: { objects: bool } };
|
||||
validOpts = { stripUnknown: { arrays: bool, objects: bool } };
|
||||
validOpts = { language: bool };
|
||||
validOpts = { presence: str };
|
||||
validOpts = { presence: 'optional' || 'required' || 'forbidden' };
|
||||
validOpts = { context: obj };
|
||||
validOpts = { noDefaults: bool };
|
||||
validOpts = {
|
||||
language: {
|
||||
root: str,
|
||||
key: str,
|
||||
messages: { wrapArrays: bool },
|
||||
string: { base: str },
|
||||
number: { base: str },
|
||||
object: {
|
||||
base: false,
|
||||
children: { childRule: str }
|
||||
},
|
||||
customType: {
|
||||
customRule: str
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---
|
||||
|
||||
@@ -96,11 +113,12 @@ uriOpts = { scheme: expArr };
|
||||
|
||||
// --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---
|
||||
|
||||
var whenOpts: Joi.WhenOptions<any> = null;
|
||||
var whenOpts: Joi.WhenOptions = null;
|
||||
|
||||
whenOpts = { is: x };
|
||||
whenOpts = { is: schema, then: schema };
|
||||
whenOpts = { is: schema, otherwise: schema };
|
||||
whenOpts = { is: schemaLike, then: schemaLike, otherwise: schemaLike };
|
||||
|
||||
// --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---
|
||||
|
||||
@@ -146,8 +164,6 @@ schema = dateSchema;
|
||||
schema = funcSchema;
|
||||
schema = objSchema;
|
||||
|
||||
schema = ref;
|
||||
|
||||
anySchema = anySchema;
|
||||
anySchema = numSchema;
|
||||
anySchema = strSchema;
|
||||
@@ -179,8 +195,20 @@ schemaMap = {
|
||||
{ b1: strSchema },
|
||||
{ b2: anySchema }
|
||||
],
|
||||
c: arrSchema
|
||||
c: arrSchema,
|
||||
d: schemaLike
|
||||
};
|
||||
schemaMap = {
|
||||
a: 1,
|
||||
b: {
|
||||
b1: '1',
|
||||
b2: 2
|
||||
},
|
||||
c: [
|
||||
{ c1: true },
|
||||
{ c2: null }
|
||||
]
|
||||
}
|
||||
|
||||
// --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---
|
||||
|
||||
@@ -256,9 +284,9 @@ arrSchema = arrSchema.sparse(bool);
|
||||
arrSchema = arrSchema.single();
|
||||
arrSchema = arrSchema.single(bool);
|
||||
arrSchema = arrSchema.ordered(anySchema);
|
||||
arrSchema = arrSchema.ordered(anySchema, numSchema, strSchema, arrSchema, boolSchema, binSchema, dateSchema, funcSchema, objSchema);
|
||||
arrSchema = arrSchema.ordered(anySchema, numSchema, strSchema, arrSchema, boolSchema, binSchema, dateSchema, funcSchema, objSchema, schemaLike);
|
||||
arrSchema = arrSchema.ordered(schemaMap);
|
||||
arrSchema = arrSchema.ordered([schemaMap, schemaMap]);
|
||||
arrSchema = arrSchema.ordered([schemaMap, schemaMap, schemaLike]);
|
||||
arrSchema = arrSchema.min(num);
|
||||
arrSchema = arrSchema.max(num);
|
||||
arrSchema = arrSchema.length(num);
|
||||
@@ -268,11 +296,11 @@ arrSchema = arrSchema.unique('customer.id');
|
||||
|
||||
|
||||
arrSchema = arrSchema.items(numSchema);
|
||||
arrSchema = arrSchema.items(numSchema, strSchema);
|
||||
arrSchema = arrSchema.items([numSchema, strSchema]);
|
||||
arrSchema = arrSchema.items(numSchema, strSchema, schemaLike);
|
||||
arrSchema = arrSchema.items([numSchema, strSchema, schemaLike]);
|
||||
arrSchema = arrSchema.items(schemaMap);
|
||||
arrSchema = arrSchema.items(schemaMap, schemaMap);
|
||||
arrSchema = arrSchema.items([schemaMap, schemaMap]);
|
||||
arrSchema = arrSchema.items(schemaMap, schemaMap, schemaLike);
|
||||
arrSchema = arrSchema.items([schemaMap, schemaMap, schemaLike]);
|
||||
|
||||
// - - - - - - - -
|
||||
|
||||
@@ -609,6 +637,7 @@ objSchema = objSchema.max(num);
|
||||
objSchema = objSchema.length(num);
|
||||
|
||||
objSchema = objSchema.pattern(exp, schema);
|
||||
objSchema = objSchema.pattern(exp, schemaLike);
|
||||
|
||||
objSchema = objSchema.and(str);
|
||||
objSchema = objSchema.and(str, str);
|
||||
@@ -843,8 +872,8 @@ namespace validate_tests {
|
||||
});
|
||||
let returnValue: Joi.ValidationResult<typeof value>;
|
||||
|
||||
returnValue = Joi.validate(value);
|
||||
value = Joi.validate(value, (err, value) => value);
|
||||
returnValue = schema.validate(value);
|
||||
value = schema.validate(value, (err, value) => value);
|
||||
|
||||
returnValue = Joi.validate(value, schema);
|
||||
returnValue = Joi.validate(value, obj);
|
||||
@@ -872,17 +901,22 @@ schema = Joi.compile(schemaMap);
|
||||
Joi.assert(obj, schema);
|
||||
Joi.assert(obj, schema, str);
|
||||
Joi.assert(obj, schema, err);
|
||||
Joi.assert(obj, schemaLike);
|
||||
|
||||
Joi.attempt(obj, schema);
|
||||
Joi.attempt(obj, schema, str);
|
||||
Joi.attempt(obj, schema, err);
|
||||
Joi.attempt(obj, schemaLike);
|
||||
|
||||
ref = Joi.ref(str, refOpts);
|
||||
ref = Joi.ref(str);
|
||||
|
||||
Joi.isRef(ref);
|
||||
|
||||
schema = Joi.reach(schema, '');
|
||||
description = Joi.describe(schema);
|
||||
description = schema.describe();
|
||||
|
||||
schema = Joi.reach(objSchema, '');
|
||||
|
||||
const Joi2 = Joi.extend({ name: '', base: schema });
|
||||
|
||||
@@ -892,9 +926,11 @@ const Joi3 = Joi.extend({
|
||||
language: {
|
||||
asd: 'must be exactly asd(f)',
|
||||
},
|
||||
pre (value, state, options) {
|
||||
pre(value, state, options) {
|
||||
return value;
|
||||
},
|
||||
describe (description) {
|
||||
describe(description) {
|
||||
return description;
|
||||
},
|
||||
rules: [
|
||||
{
|
||||
@@ -902,10 +938,10 @@ const Joi3 = Joi.extend({
|
||||
params: {
|
||||
allowF: Joi.boolean().default(false),
|
||||
},
|
||||
setup (params) {
|
||||
setup(params) {
|
||||
const fIsAllowed = params.allowF;
|
||||
},
|
||||
validate (params, value, state, options) {
|
||||
validate(params, value, state, options) {
|
||||
if (value === 'asd' || params.allowF && value === 'asdf') {
|
||||
return value;
|
||||
}
|
||||
@@ -914,56 +950,3 @@ const Joi3 = Joi.extend({
|
||||
},
|
||||
],
|
||||
});
|
||||
|
||||
// --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- ---
|
||||
|
||||
schema = Joi.allow(x, x);
|
||||
schema = Joi.allow([x, x, x]);
|
||||
schema = Joi.valid(x);
|
||||
schema = Joi.valid(x, x);
|
||||
schema = Joi.valid([x, x, x]);
|
||||
schema = Joi.only(x);
|
||||
schema = Joi.only(x, x);
|
||||
schema = Joi.only([x, x, x]);
|
||||
schema = Joi.equal(x);
|
||||
schema = Joi.equal(x, x);
|
||||
schema = Joi.equal([x, x, x]);
|
||||
schema = Joi.invalid(x);
|
||||
schema = Joi.invalid(x, x);
|
||||
schema = Joi.invalid([x, x, x]);
|
||||
schema = Joi.disallow(x);
|
||||
schema = Joi.disallow(x, x);
|
||||
schema = Joi.disallow([x, x, x]);
|
||||
schema = Joi.not(x);
|
||||
schema = Joi.not(x, x);
|
||||
schema = Joi.not([x, x, x]);
|
||||
|
||||
schema = Joi.required();
|
||||
schema = Joi.optional();
|
||||
schema = Joi.forbidden();
|
||||
schema = Joi.strip();
|
||||
|
||||
schema = Joi.description(str);
|
||||
schema = Joi.notes(str);
|
||||
schema = Joi.notes(strArr);
|
||||
schema = Joi.tags(str);
|
||||
schema = Joi.tags(strArr);
|
||||
|
||||
schema = Joi.meta(obj);
|
||||
schema = Joi.example(obj);
|
||||
schema = Joi.unit(str);
|
||||
|
||||
schema = Joi.options(validOpts);
|
||||
schema = Joi.strict();
|
||||
schema = Joi.strict(bool);
|
||||
schema = Joi.concat(x);
|
||||
|
||||
schema = Joi.when(str, whenOpts);
|
||||
schema = Joi.when(ref, whenOpts);
|
||||
|
||||
schema = Joi.label(str);
|
||||
schema = Joi.raw();
|
||||
schema = Joi.raw(bool);
|
||||
schema = Joi.empty();
|
||||
schema = Joi.empty(str);
|
||||
schema = Joi.empty(anySchema);
|
||||
|
||||
Vendored
+1
-1
@@ -92,7 +92,7 @@ interface JQueryStatic {
|
||||
/**
|
||||
* A simple, lightweight jQuery plugin for reading, writing and deleting cookies.
|
||||
*/
|
||||
cookie?: JQueryCookieStatic;
|
||||
cookie: JQueryCookieStatic;
|
||||
/**
|
||||
* Deletes a cookie
|
||||
* @param name Name of cookie to delete
|
||||
|
||||
Vendored
+3
-3
@@ -25,9 +25,9 @@ export class SObject<T> {
|
||||
find<T>(query?: any, fields?: Object | string[] | string, callback?: (err: Error, ret: T[]) => void): Query<T>;
|
||||
find<T>(query?: any, fields?: Object | string[] | string, options?: Object, callback?: (err: Error, ret: T[]) => void): Query<T>;
|
||||
|
||||
findOne<T>(query?: any, callback?: (err: Error, ret: T) => void): void;
|
||||
findOne<T>(query?: any, fields?: Object | string[] | string, callback?: (err: Error, ret: T) => void): void;
|
||||
findOne<T>(query?: any, fields?: Object | string[] | string, options?: Object, callback?: (err: Error, ret: T) => void): void;
|
||||
findOne<T>(query?: any, callback?: (err: Error, ret: T) => void): Query<T>;
|
||||
findOne<T>(query?: any, fields?: Object | string[] | string, callback?: (err: Error, ret: T) => void): Query<T>;
|
||||
findOne<T>(query?: any, fields?: Object | string[] | string, options?: Object, callback?: (err: Error, ret: T) => void): Query<T>;
|
||||
|
||||
approvalLayouts(callback?: (layoutInfo: ApprovalLayoutInfo) => void): Promise<ApprovalLayoutInfo>;
|
||||
bulkload(operation: string, options?: { extIdField?: string }, input?: Array<Record<T>> | stream.Stream[] | string[], callback?: (err: Error, ret: RecordResult) => void): Batch;
|
||||
|
||||
Vendored
+266
-61
@@ -1,10 +1,229 @@
|
||||
// Type definitions for JW Player 6.0
|
||||
// Type definitions for JW Player V8.0
|
||||
// Project: http://developer.longtailvideo.com/trac/
|
||||
// Definitions by: Martin Duparc <https://github.com/martinduparc>
|
||||
// Tomer Kruvi <https://github.com/kutomer>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
// JW Player is the leading HTML5 & Flash video player, optimized for mobile and the desktop. Easy enough for beginners, advanced enough for pros.
|
||||
|
||||
interface Version {
|
||||
version: string;
|
||||
major: number;
|
||||
minor: number
|
||||
}
|
||||
|
||||
interface Browser {
|
||||
chrome: boolean;
|
||||
edge: boolean;
|
||||
facebook: boolean;
|
||||
firefox: boolean;
|
||||
ie: boolean;
|
||||
msie: boolean;
|
||||
safari: boolean;
|
||||
version: Version;
|
||||
}
|
||||
|
||||
interface OS {
|
||||
android: boolean;
|
||||
androidNative: boolean; // Android native browser
|
||||
iOS: boolean;
|
||||
mobile: boolean;
|
||||
mac: boolean;
|
||||
iPad: boolean;
|
||||
iPhone: boolean;
|
||||
windows: boolean;
|
||||
version: Version;
|
||||
}
|
||||
|
||||
interface Features {
|
||||
flash: boolean;
|
||||
flashVersion: number;
|
||||
iframe: boolean;
|
||||
}
|
||||
|
||||
interface Environment{
|
||||
Browser: Browser;
|
||||
OS: OS;
|
||||
Features: Features;
|
||||
}
|
||||
|
||||
interface CallbackParam {
|
||||
}
|
||||
|
||||
interface AdProgressParam extends CallbackParam {
|
||||
client: 'vast' | 'googima';
|
||||
creativetype: string;
|
||||
tag: string;
|
||||
}
|
||||
|
||||
interface AdCompanionsParam extends CallbackParam {
|
||||
companions: any[];
|
||||
tag: string;
|
||||
}
|
||||
|
||||
interface AdErrorParam extends CallbackParam {
|
||||
message: string;
|
||||
tag: string;
|
||||
}
|
||||
|
||||
interface AdRequestParam extends CallbackParam {
|
||||
adposition: 'pre' | 'mid' | 'post';
|
||||
client: 'vast' | 'googima';
|
||||
offset: 'pre' | 'mid' | 'post';
|
||||
tag: string;
|
||||
}
|
||||
|
||||
interface AdImpressionParam extends CallbackParam {
|
||||
adposition: 'pre' | 'mid' | 'post';
|
||||
adsystem: string;
|
||||
adtitle: string;
|
||||
clickThroughUrl: string;
|
||||
client: 'vast' | 'googima';
|
||||
creativetype: string;
|
||||
linear: string;
|
||||
mediafile: any;
|
||||
tag: string;
|
||||
vastversion: number;
|
||||
wrapper: any[];
|
||||
}
|
||||
|
||||
interface AdStartedParam extends CallbackParam {
|
||||
creativetype: string;
|
||||
tag: string;
|
||||
}
|
||||
|
||||
interface AdPlayParam extends CallbackParam {
|
||||
creativetype: string;
|
||||
newstate: string;
|
||||
oldstate: string;
|
||||
tag: string;
|
||||
}
|
||||
|
||||
interface BufferParam extends CallbackParam {
|
||||
newstate: string;
|
||||
oldstate: string;
|
||||
reason: 'loading' | 'complete' | 'stalled' | 'error';
|
||||
}
|
||||
|
||||
interface BufferChangeParam extends CallbackParam {
|
||||
duration: number;
|
||||
bufferPercent: number;
|
||||
position: number;
|
||||
metadata: any;
|
||||
}
|
||||
|
||||
interface AdTimeParam extends CallbackParam {
|
||||
client: 'vast' | 'googima';
|
||||
creativetype: string;
|
||||
duration: number;
|
||||
position: number;
|
||||
sequence: number;
|
||||
tag: string;
|
||||
}
|
||||
|
||||
interface AudioTracksParam extends CallbackParam {
|
||||
levels: any[];
|
||||
}
|
||||
|
||||
interface CaptionsChangedParam extends CallbackParam {
|
||||
currentTrack: number;
|
||||
}
|
||||
|
||||
interface CaptionsListParam extends CallbackParam {
|
||||
tracks: any[];
|
||||
}
|
||||
|
||||
interface AudioTrackChangedParam extends CallbackParam {
|
||||
currentTrack: number;
|
||||
}
|
||||
|
||||
interface MetadataParam extends CallbackParam {
|
||||
metadata: any;
|
||||
}
|
||||
|
||||
interface ControlsParam extends CallbackParam {
|
||||
controls: boolean;
|
||||
}
|
||||
|
||||
interface ErrorParam extends CallbackParam {
|
||||
message: string;
|
||||
}
|
||||
|
||||
interface FullscreenParam extends CallbackParam {
|
||||
fullscreen: boolean;
|
||||
}
|
||||
|
||||
interface IdleParam extends CallbackParam {
|
||||
oldstate: 'buffering' | 'playing' | 'paused';
|
||||
}
|
||||
|
||||
interface LevelsChangedParam extends CallbackParam {
|
||||
currentQuality: number;
|
||||
}
|
||||
|
||||
interface MuteParam extends CallbackParam {
|
||||
mute: boolean;
|
||||
}
|
||||
|
||||
interface VolumeParam extends CallbackParam {
|
||||
volume: boolean;
|
||||
}
|
||||
|
||||
interface PlayParam extends CallbackParam {
|
||||
oldstate: 'buffering' | 'playing';
|
||||
viewable: 0 | 1;
|
||||
}
|
||||
|
||||
interface PlaylistParam extends CallbackParam {
|
||||
playlist: any[];
|
||||
}
|
||||
|
||||
interface PlaylistItemParam extends CallbackParam {
|
||||
index: number;
|
||||
item: any;
|
||||
}
|
||||
|
||||
interface ReadyParam extends CallbackParam {
|
||||
setupTime: number;
|
||||
viewable: 0 | 1;
|
||||
}
|
||||
|
||||
interface ResizeParam extends CallbackParam {
|
||||
width: number;
|
||||
height: number;
|
||||
}
|
||||
|
||||
interface VisualQualityParam extends CallbackParam {
|
||||
mode: string;
|
||||
label: string;
|
||||
reason: string;
|
||||
}
|
||||
|
||||
interface LevelsParam extends CallbackParam {
|
||||
width: number;
|
||||
levels: any[];
|
||||
}
|
||||
|
||||
interface SeekParam extends CallbackParam {
|
||||
position: number;
|
||||
offset: number;
|
||||
}
|
||||
|
||||
interface TimeParam extends CallbackParam {
|
||||
duration: number;
|
||||
position: number;
|
||||
viewable: 0 | 1;
|
||||
}
|
||||
|
||||
interface FirstFrameParam extends CallbackParam {
|
||||
loadTime: number;
|
||||
viewable: 0 | 1;
|
||||
}
|
||||
|
||||
interface EventCallback<T extends CallbackParam> {
|
||||
(param: T): void;
|
||||
}
|
||||
|
||||
interface JWPlayer {
|
||||
addButton(icon: string, label: string, handler: () => void, id: string): void;
|
||||
getAudioTracks(): any[];
|
||||
@@ -27,68 +246,54 @@ interface JWPlayer {
|
||||
getSafeRegion(): any[];
|
||||
getState(): string;
|
||||
getVolume(): number;
|
||||
getEnvironment(): Environment;
|
||||
getWidth(): number;
|
||||
load(playlist: any[]): void;
|
||||
load(playlist: string): void;
|
||||
onAdClick(callback: (o: { tag: string; }) => void): void;
|
||||
onAdCompanions(callback: (o: {
|
||||
tag: string;
|
||||
companions: any[];
|
||||
}) => void): void;
|
||||
onAdComplete(callback: (o: { tag: string; }) => void): void;
|
||||
onAdError(callback: (o: {
|
||||
tag: string;
|
||||
message: string;
|
||||
}) => void): void;
|
||||
onAdImpression(callback: (o: { tag: string; }) => void): void;
|
||||
onAdPause(callback: (o: { tag: string; }) => void): void;
|
||||
onAdPlay(callback: (o: { tag: string; }) => void): void;
|
||||
onAdSkipped(callback: (o: { tag: string; }) => void): void;
|
||||
onAdTime(callback: (o: {
|
||||
tag: string;
|
||||
position: number;
|
||||
duration: number;
|
||||
sequence: number;
|
||||
}) => void): void;
|
||||
onAudioTracks(callback: (o: { levels: any[]; }) => void): void;
|
||||
onAudioTrackChange(callback: (o: { currentTrack: number; }) => void): void;
|
||||
onBeforeComplete(callback: () => void): void;
|
||||
onBeforePlay(callback: () => void): void;
|
||||
onBuffer(callback: (o: { oldstate: string }) => void): void;
|
||||
onBufferChange(callback: () => void): void;
|
||||
onCaptionsChange(callback: (o: { track: number; }) => void): void;
|
||||
onCaptionsList(callback: (o: { tracks: any[]; }) => void): void;
|
||||
onComplete(callback: () => void): void;
|
||||
onControls(callback: (o: { controls: boolean; }) => void): void;
|
||||
onDisplayClick(callback: () => void): void;
|
||||
onError(callback: (o: { message: string }) => void): void;
|
||||
onFullscreen(callback: (o: { fullscreen: boolean; }) => void): void;
|
||||
onIdle(callback: (o: { oldstate: string }) => void): void;
|
||||
onLevelsChanged(callback: (o: { currentQuality: number }) => void): void;
|
||||
onMeta(callback: (o: { metadata: any; }) => void): void;
|
||||
onMute(callback: (o: { mute: boolean; }) => void): void;
|
||||
onPause(callback: (o: { oldstate: string }) => void): void;
|
||||
onPlay(callback: (o: { oldstate: string }) => void): void;
|
||||
onPlaylist(callback: () => void): void;
|
||||
onPlaylistItem(callback: () => void): void;
|
||||
onPlaylistComplete(callback: () => void): void;
|
||||
onReady(callback: () => void): void;
|
||||
onResize(callback: () => void): void;
|
||||
onQualityChange(callback: () => void): void;
|
||||
onQualityLevels(callback: (o: { levels: any[] }) => void): void;
|
||||
onSeek(callback: (o: {
|
||||
position: number;
|
||||
offset: number;
|
||||
}) => void): void;
|
||||
onSetupError(callback: (o: {
|
||||
fallback: boolean;
|
||||
message: string;
|
||||
}) => void): void;
|
||||
onTime(callback: (o: {
|
||||
duration: number;
|
||||
position: number;
|
||||
}) => void): void;
|
||||
onVolume(callback: (o: { volume: number; }) => void): void;
|
||||
on(event: 'adClick', callback: EventCallback<AdProgressParam>): void;
|
||||
on(event: 'adCompanions', callback: EventCallback<AdCompanionsParam>): void;
|
||||
on(event: 'adComplete', callback: EventCallback<AdProgressParam>): void;
|
||||
on(event: 'adSkipped', callback: EventCallback<AdProgressParam>): void;
|
||||
on(event: 'adError', callback: EventCallback<AdErrorParam>): void;
|
||||
on(event: 'adBlock', callback: () => void): void;
|
||||
on(event: 'adRequest', callback: EventCallback<AdRequestParam>): void;
|
||||
on(event: 'adStarted', callback: EventCallback<AdStartedParam>): void;
|
||||
on(event: 'adImpression', callback: EventCallback<AdImpressionParam>): void;
|
||||
on(event: 'adPlay', callback: EventCallback<AdPlayParam>): void;
|
||||
on(event: 'adPause', callback: EventCallback<AdPlayParam>): void;
|
||||
on(event: 'adTime', callback: EventCallback<AdTimeParam>): void;
|
||||
on(event: 'meta', callback: EventCallback<MetadataParam>): void;
|
||||
on(event: 'audioTracks', callback: EventCallback<AudioTracksParam>): void;
|
||||
on(event: 'audioTrackChanged', callback: EventCallback<AudioTrackChangedParam>): void;
|
||||
on(event: 'beforeComplete', callback: () => void): void;
|
||||
on(event: 'complete', callback: () => void): void;
|
||||
on(event: 'firstFrame', callback: EventCallback<FirstFrameParam>): void;
|
||||
on(event: 'beforePlay', callback: () => void): void;
|
||||
on(event: 'buffer', callback: EventCallback<BufferParam>): void;
|
||||
on(event: 'bufferChange', callback: EventCallback<BufferChangeParam>): void;
|
||||
on(event: 'captionsChanged', callback: EventCallback<CaptionsChangedParam>): void;
|
||||
on(event: 'captionsList', callback: EventCallback<CaptionsListParam>): void;
|
||||
on(event: 'controls', callback: EventCallback<ControlsParam>): void;
|
||||
on(event: 'displayClick', callback: () => void): void;
|
||||
on(event: 'error', callback: EventCallback<ErrorParam>): void;
|
||||
on(event: 'fullscreen', callback: EventCallback<FullscreenParam>): void;
|
||||
on(event: 'idle', callback: EventCallback<IdleParam>): void;
|
||||
on(event: 'levelsChanged', callback: EventCallback<LevelsChangedParam>): void;
|
||||
on(event: 'mute', callback: EventCallback<MuteParam>): void;
|
||||
on(event: 'volume', callback: EventCallback<VolumeParam>): void;
|
||||
on(event: 'pause', callback: EventCallback<PlayParam>): void;
|
||||
on(event: 'play', callback: EventCallback<PlayParam>): void;
|
||||
on(event: 'playlist', callback: EventCallback<PlaylistParam>): void;
|
||||
on(event: 'playlistItem', callback: EventCallback<PlaylistItemParam>): void;
|
||||
on(event: 'playlistComplete', callback: () => void): void;
|
||||
on(event: 'ready', callback: EventCallback<ReadyParam>): void;
|
||||
on(event: 'resize', callback: EventCallback<ResizeParam>): void;
|
||||
on(event: 'visualQuality', callback: EventCallback<VisualQualityParam>): void;
|
||||
on(event: 'levels', callback: EventCallback<LevelsParam>): void;
|
||||
on(event: 'seek', callback: EventCallback<SeekParam>): void;
|
||||
on(event: 'setupError', callback: EventCallback<ErrorParam>): void;
|
||||
on(event: 'remove', callback: () => void): void;
|
||||
on(event: 'time', callback: EventCallback<TimeParam>): void;
|
||||
pause(state?: boolean): void;
|
||||
play(state?: boolean): void;
|
||||
playAd(tag: string): void;
|
||||
@@ -115,4 +320,4 @@ interface JWPlayerStatic {
|
||||
version: string;
|
||||
}
|
||||
|
||||
declare var jwplayer:JWPlayerStatic;
|
||||
declare const jwplayer:JWPlayerStatic;
|
||||
|
||||
Vendored
+1
-1
@@ -7025,7 +7025,7 @@ declare namespace kendo.ui {
|
||||
name?: string;
|
||||
autoHide?: boolean;
|
||||
animation?: boolean|TooltipAnimation;
|
||||
content?: TooltipContent;
|
||||
content?: string | TooltipContent | ((e: any) => string);
|
||||
callout?: boolean;
|
||||
filter?: string;
|
||||
iframe?: boolean;
|
||||
|
||||
Vendored
+25
@@ -0,0 +1,25 @@
|
||||
// Type definitions for lozad 1.0
|
||||
// Project: https://github.com/ApoorvSaxena/lozad.js
|
||||
// Definitions by: York Yao <https://github.com/plantain-00>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
interface Option {
|
||||
rootMargin?: string;
|
||||
threshold?: number;
|
||||
load?(element: HTMLElement | HTMLCanvasElement): void;
|
||||
}
|
||||
|
||||
interface Observer {
|
||||
observe(): void;
|
||||
}
|
||||
|
||||
declare function lozad(selector?: string, options?: Option): Observer;
|
||||
|
||||
declare namespace lozad {
|
||||
const prototype: {
|
||||
};
|
||||
}
|
||||
|
||||
export as namespace lozad;
|
||||
|
||||
export = lozad;
|
||||
@@ -0,0 +1,13 @@
|
||||
import lozad = require('lozad');
|
||||
|
||||
const observer = lozad('.lozad', {
|
||||
rootMargin: '10px 0px', // syntax similar to that of CSS Margin
|
||||
threshold: 0.1, // ratio of element convergence
|
||||
load(el) {
|
||||
console.log('loading element');
|
||||
|
||||
// Custom implementation to load an element
|
||||
// e.g. el.src = el.dataset.src;
|
||||
}
|
||||
});
|
||||
observer.observe();
|
||||
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es5",
|
||||
"dom"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"lozad-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"extends": "dtslint/dt.json"
|
||||
}
|
||||
Vendored
+779
-695
File diff suppressed because it is too large
Load Diff
+21
-30
@@ -1,44 +1,35 @@
|
||||
import * as lunr from 'lunr';
|
||||
|
||||
|
||||
/**
|
||||
* Basic test, from http://lunrjs.com/
|
||||
*/
|
||||
function basic_test() {
|
||||
var index = lunr(function () {
|
||||
this.field('title', {boost: 10});
|
||||
this.field('body');
|
||||
this.ref('id');
|
||||
const index = lunr(function() {
|
||||
this.field("title");
|
||||
this.field("body");
|
||||
this.ref("id");
|
||||
this.add({
|
||||
id: 1,
|
||||
title: "Foo",
|
||||
body: "Foo foo foo!"
|
||||
});
|
||||
this.add({
|
||||
id: 2,
|
||||
title: "Bar",
|
||||
body: "Bar bar bar!"
|
||||
});
|
||||
});
|
||||
|
||||
index.add({
|
||||
id: 1,
|
||||
title: 'Foo',
|
||||
body: 'Foo foo foo!'
|
||||
});
|
||||
|
||||
index.add({
|
||||
id: 2,
|
||||
title: 'Bar',
|
||||
body: 'Bar bar bar!'
|
||||
});
|
||||
|
||||
index.search('foo');
|
||||
index.search("foo");
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Pipeline test, from http://lunrjs.com/
|
||||
*/
|
||||
function pipeline_test() {
|
||||
var index = lunr(function () {
|
||||
this.pipeline.add(function (token:string, tokenIndex:number, tokens:string[]):string {
|
||||
const index = lunr(function() {
|
||||
this.pipeline.add(function(token, tokenIndex, tokens) {
|
||||
// text processing in here
|
||||
return token;
|
||||
});
|
||||
|
||||
this.pipeline.after(lunr.stopWordFilter, function (token:string, tokenIndex:number, tokens:string[]):string {
|
||||
this.pipeline.after(lunr.stopWordFilter, function(token, tokenIndex, tokens) {
|
||||
// text processing in here
|
||||
return token;
|
||||
});
|
||||
})
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -5,8 +5,8 @@
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": false,
|
||||
"strictNullChecks": false,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"extends": "dtslint/dt.json",
|
||||
"rules": {
|
||||
"ban-types": false,
|
||||
"only-arrow-functions": [false],
|
||||
"no-single-declare-module": false,
|
||||
"no-unnecessary-qualifier": true
|
||||
}
|
||||
}
|
||||
Vendored
+828
@@ -0,0 +1,828 @@
|
||||
// Type definitions for lunr.js 0.5
|
||||
// Project: https://github.com/olivernn/lunr.js
|
||||
// Definitions by: Sebastian Lenz <https://github.com/sebastian-lenz>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/**
|
||||
* lunr - http://lunrjs.com - A bit like Solr, but much smaller and not as bright - 0.5.4
|
||||
* Copyright (C) 2014 Oliver Nightingale
|
||||
* MIT Licensed
|
||||
* @license
|
||||
*/
|
||||
declare namespace lunr {
|
||||
const version: string;
|
||||
|
||||
/**
|
||||
* A function for splitting a string into tokens ready to be inserted into
|
||||
* the search index. Uses `lunr.tokenizer.seperator` to split strings, change
|
||||
* the value of this property to change how strings are split into tokens.
|
||||
*
|
||||
* @module
|
||||
* @param {String} obj The string to convert into tokens
|
||||
* @see lunr.tokenizer.seperator
|
||||
* @returns {Array}
|
||||
*/
|
||||
function tokenizer(obj: any): string[];
|
||||
|
||||
type TokenizerFunction = (obj: any) => string[];
|
||||
|
||||
namespace tokenizer {
|
||||
/**
|
||||
* The sperator used to split a string into tokens. Override this property to change the behaviour of
|
||||
* `lunr.tokenizer` behaviour when tokenizing strings. By default this splits on whitespace and hyphens.
|
||||
*
|
||||
* @static
|
||||
* @see lunr.tokenizer
|
||||
*
|
||||
* (Note: this is misspelled in the original API, kept for compatibility sake)
|
||||
*/
|
||||
const seperator: RegExp | string;
|
||||
|
||||
const label: string;
|
||||
|
||||
const registeredFunctions: {[label: string]: TokenizerFunction};
|
||||
|
||||
/**
|
||||
* Register a tokenizer function.
|
||||
*
|
||||
* Functions that are used as tokenizers should be registered if they are to be used with a serialised index.
|
||||
*
|
||||
* Registering a function does not add it to an index, functions must still be associated with a specific index for them to be used when indexing and searching documents.
|
||||
*
|
||||
* @param {Function} fn The function to register.
|
||||
* @param {String} label The label to register this function with
|
||||
* @memberOf tokenizer
|
||||
*/
|
||||
function registerFunction(fn: TokenizerFunction, label: string): void;
|
||||
|
||||
/**
|
||||
* Loads a previously serialised tokenizer.
|
||||
*
|
||||
* A tokenizer function to be loaded must already be registered with lunr.tokenizer.
|
||||
* If the serialised tokenizer has not been registered then an error will be thrown.
|
||||
*
|
||||
* @param {String} label The label of the serialised tokenizer.
|
||||
* @returns {Function}
|
||||
* @memberOf tokenizer
|
||||
*/
|
||||
function load(label: string): TokenizerFunction;
|
||||
}
|
||||
|
||||
/**
|
||||
* lunr.stemmer is an english language stemmer, this is a JavaScript implementation of
|
||||
* the PorterStemmer taken from http://tartaurs.org/~martin
|
||||
*
|
||||
* @param token The string to stem
|
||||
*/
|
||||
function stemmer(token: string): string;
|
||||
|
||||
/**
|
||||
* lunr.stopWordFilter is an English language stop word list filter, any words contained
|
||||
* in the list will not be passed through the filter.
|
||||
*
|
||||
* This is intended to be used in the Pipeline. If the token does not pass the filter then
|
||||
* undefined will be returned.
|
||||
*
|
||||
* @param token The token to pass through the filter
|
||||
*/
|
||||
function stopWordFilter(token: string): string;
|
||||
|
||||
namespace stopWordFilter {
|
||||
const stopWords: SortedSet<string>;
|
||||
}
|
||||
|
||||
/**
|
||||
* lunr.trimmer is a pipeline function for trimming non word characters from the beginning
|
||||
* and end of tokens before they enter the index.
|
||||
*
|
||||
* This implementation may not work correctly for non latin characters and should either
|
||||
* be removed or adapted for use with languages with non-latin characters.
|
||||
* @param token The token to pass through the filter
|
||||
*/
|
||||
function trimmer(token: string): string;
|
||||
|
||||
/**
|
||||
* lunr.EventEmitter is an event emitter for lunr. It manages adding and removing event handlers
|
||||
* and triggering events and their handlers.
|
||||
*/
|
||||
class EventEmitter {
|
||||
/**
|
||||
* Can bind a single function to many different events in one call.
|
||||
*
|
||||
* @param eventName The name(s) of events to bind this function to.
|
||||
* @param handler The function to call when an event is fired. Binds a handler
|
||||
* function to a specific event(s).
|
||||
*/
|
||||
addListener(eventName: string, handler: Function): void;
|
||||
addListener(eventName: string, eventName2: string, handler: Function): void;
|
||||
addListener(eventName: string, eventName2: string, eventName3: string, handler: Function): void;
|
||||
addListener(eventName: string, eventName2: string, eventName3: string, eventName4: string, handler: Function): void;
|
||||
addListener(eventName: string, eventName2: string, eventName3: string, eventName4: string, eventName5: string, handler: Function): void;
|
||||
|
||||
/**
|
||||
* Removes a handler function from a specific event.
|
||||
*
|
||||
* @param eventName The name of the event to remove this function from.
|
||||
* @param handler The function to remove from an event.
|
||||
*/
|
||||
removeListener(eventName: string, handler: Function): void;
|
||||
|
||||
/**
|
||||
* Calls all functions bound to the given event.
|
||||
*
|
||||
* Additional data can be passed to the event handler as arguments to emit after the event name.
|
||||
*
|
||||
* @param eventName The name of the event to emit.
|
||||
* @param args
|
||||
*/
|
||||
emit(eventName: string, ...args: any[]): void;
|
||||
|
||||
/**
|
||||
* Checks whether a handler has ever been stored against an event.
|
||||
*
|
||||
* @param eventName The name of the event to check.
|
||||
*/
|
||||
hasHandler(eventName: string): boolean;
|
||||
}
|
||||
|
||||
type IPipelineFunction = (token: string, tokenIndex?: number, tokens?: string[]) => string;
|
||||
|
||||
/**
|
||||
* lunr.Pipelines maintain an ordered list of functions to be applied to all tokens in documents
|
||||
* entering the search index and queries being ran against the index.
|
||||
*
|
||||
* An instance of lunr.Index created with the lunr shortcut will contain a pipeline with a stop
|
||||
* word filter and an English language stemmer. Extra functions can be added before or after either
|
||||
* of these functions or these default functions can be removed.
|
||||
*
|
||||
* When run the pipeline will call each function in turn, passing a token, the index of that token
|
||||
* in the original list of all tokens and finally a list of all the original tokens.
|
||||
*
|
||||
* The output of functions in the pipeline will be passed to the next function in the pipeline.
|
||||
* To exclude a token from entering the index the function should return undefined, the rest of
|
||||
* the pipeline will not be called with this token.
|
||||
*
|
||||
* For serialisation of pipelines to work, all functions used in an instance of a pipeline should
|
||||
* be registered with lunr.Pipeline. Registered functions can then be loaded. If trying to load a
|
||||
* serialised pipeline that uses functions that are not registered an error will be thrown.
|
||||
*
|
||||
* If not planning on serialising the pipeline then registering pipeline functions is not necessary.
|
||||
*/
|
||||
class Pipeline {
|
||||
registeredFunctions: {[label: string]: Function};
|
||||
|
||||
/**
|
||||
* Register a function with the pipeline.
|
||||
*
|
||||
* Functions that are used in the pipeline should be registered if the pipeline needs to be
|
||||
* serialised, or a serialised pipeline needs to be loaded.
|
||||
*
|
||||
* Registering a function does not add it to a pipeline, functions must still be added to instances
|
||||
* of the pipeline for them to be used when running a pipeline.
|
||||
*
|
||||
* @param fn The function to check for.
|
||||
* @param label The label to register this function with
|
||||
*/
|
||||
registerFunction(fn: IPipelineFunction, label: string): void;
|
||||
|
||||
/**
|
||||
* Warns if the function is not registered as a Pipeline function.
|
||||
*
|
||||
* @param fn The function to check for.
|
||||
*/
|
||||
warnIfFunctionNotRegistered(fn: IPipelineFunction): void;
|
||||
|
||||
/**
|
||||
* Adds new functions to the end of the pipeline.
|
||||
*
|
||||
* Logs a warning if the function has not been registered.
|
||||
*
|
||||
* @param functions Any number of functions to add to the pipeline.
|
||||
*/
|
||||
add(...functions: IPipelineFunction[]): void;
|
||||
|
||||
/**
|
||||
* Adds a single function after a function that already exists in the pipeline.
|
||||
*
|
||||
* Logs a warning if the function has not been registered.
|
||||
*
|
||||
* @param existingFn A function that already exists in the pipeline.
|
||||
* @param newFn The new function to add to the pipeline.
|
||||
*/
|
||||
after(existingFn: IPipelineFunction, newFn: IPipelineFunction): void;
|
||||
|
||||
/**
|
||||
* Adds a single function before a function that already exists in the pipeline.
|
||||
*
|
||||
* Logs a warning if the function has not been registered.
|
||||
*
|
||||
* @param existingFn A function that already exists in the pipeline.
|
||||
* @param newFn The new function to add to the pipeline.
|
||||
*/
|
||||
before(existingFn: IPipelineFunction, newFn: IPipelineFunction): void;
|
||||
|
||||
/**
|
||||
* Removes a function from the pipeline.
|
||||
*
|
||||
* @param fn The function to remove from the pipeline.
|
||||
*/
|
||||
remove(fn: IPipelineFunction): void;
|
||||
|
||||
/**
|
||||
* Runs the current list of functions that make up the pipeline against
|
||||
* the passed tokens.
|
||||
*
|
||||
* @param tokens The tokens to run through the pipeline.
|
||||
*/
|
||||
run(tokens: string[]): string[];
|
||||
|
||||
/**
|
||||
* Resets the pipeline by removing any existing processors.
|
||||
*/
|
||||
reset(): void;
|
||||
|
||||
/**
|
||||
* Returns a representation of the pipeline ready for serialisation.
|
||||
*/
|
||||
toJSON(): any;
|
||||
|
||||
/**
|
||||
* Loads a previously serialised pipeline.
|
||||
*
|
||||
* All functions to be loaded must already be registered with lunr.Pipeline. If any function from
|
||||
* the serialised data has not been registered then an error will be thrown.
|
||||
*
|
||||
* @param serialised The serialised pipeline to load.
|
||||
*/
|
||||
static load(serialised: any): Pipeline;
|
||||
}
|
||||
|
||||
/**
|
||||
* lunr.Vectors implement vector related operations for a series of elements.
|
||||
*/
|
||||
class Vector {
|
||||
list: Node;
|
||||
|
||||
/**
|
||||
* Calculates the magnitude of this vector.
|
||||
*/
|
||||
magnitude(): number;
|
||||
|
||||
/**
|
||||
* Calculates the dot product of this vector and another vector.
|
||||
* @param otherVector The vector to compute the dot product with.
|
||||
*/
|
||||
dot(otherVector: Vector): number;
|
||||
|
||||
/**
|
||||
* Calculates the cosine similarity between this vector and another vector.
|
||||
*
|
||||
* @param otherVector The other vector to calculate the
|
||||
*/
|
||||
similarity(otherVector: Vector): number;
|
||||
}
|
||||
|
||||
/**
|
||||
* lunr.Vector.Node is a simple struct for each node in a lunr.Vector.
|
||||
*/
|
||||
class Node {
|
||||
/**
|
||||
* The index of the node in the vector.
|
||||
*/
|
||||
idx: number;
|
||||
|
||||
/**
|
||||
* The data at this node in the vector.
|
||||
*/
|
||||
val: number;
|
||||
|
||||
/**
|
||||
* The node directly after this node in the vector.
|
||||
*/
|
||||
next: Node;
|
||||
|
||||
/**
|
||||
* @param idx The index of the node in the vector.
|
||||
* @param val The data at this node in the vector.
|
||||
* @param next The node directly after this node in the vector.
|
||||
*/
|
||||
constructor(idx: number, val: number, next: Node);
|
||||
}
|
||||
|
||||
/**
|
||||
* lunr.SortedSets are used to maintain an array of unique values in a sorted order.
|
||||
*/
|
||||
class SortedSet<T> {
|
||||
elements: T[];
|
||||
|
||||
length: number;
|
||||
|
||||
/**
|
||||
* Inserts new items into the set in the correct position to maintain the order.
|
||||
*
|
||||
* @param values The objects to add to this set.
|
||||
*/
|
||||
add(...values: T[]): void;
|
||||
|
||||
/**
|
||||
* Converts this sorted set into an array.
|
||||
*/
|
||||
toArray(): T[];
|
||||
|
||||
/**
|
||||
* Creates a new array with the results of calling a provided function on
|
||||
* every element in this sorted set.
|
||||
*
|
||||
* Delegates to Array.prototype.map and has the same signature.
|
||||
*
|
||||
* @param fn The function that is called on each element of the
|
||||
* @param ctx An optional object that can be used as the context
|
||||
*/
|
||||
map(fn: Function, ctx: any): T[];
|
||||
|
||||
/**
|
||||
* Executes a provided function once per sorted set element.
|
||||
*
|
||||
* Delegates to Array.prototype.forEach and has the same signature.
|
||||
*
|
||||
* @param fn The function that is called on each element of the
|
||||
* @param ctx An optional object that can be used as the context
|
||||
*/
|
||||
forEach(fn: Function, ctx: any): any;
|
||||
|
||||
/**
|
||||
* Returns the index at which a given element can be found in the sorted
|
||||
* set, or -1 if it is not present.
|
||||
*
|
||||
* @param elem The object to locate in the sorted set.
|
||||
* @param start An optional index at which to start searching from
|
||||
* @param end An optional index at which to stop search from within
|
||||
*/
|
||||
indexOf(elem: T, start?: number, end?: number): number;
|
||||
|
||||
/**
|
||||
* Returns the position within the sorted set that an element should be
|
||||
* inserted at to maintain the current order of the set.
|
||||
*
|
||||
* This function assumes that the element to search for does not already exist
|
||||
* in the sorted set.
|
||||
*
|
||||
* @param elem - The elem to find the position for in the set
|
||||
* @param start - An optional index at which to start searching from
|
||||
* @param end - An optional index at which to stop search from within
|
||||
*/
|
||||
locationFor(elem: T, start?: number, end?: number): number;
|
||||
|
||||
/**
|
||||
* Creates a new lunr.SortedSet that contains the elements in the
|
||||
* intersection of this set and the passed set.
|
||||
*
|
||||
* @param otherSet The set to intersect with this set.
|
||||
*/
|
||||
intersect(otherSet: SortedSet<T>): SortedSet<T>;
|
||||
|
||||
/**
|
||||
* Creates a new lunr.SortedSet that contains the elements in the union of this
|
||||
* set and the passed set.
|
||||
*
|
||||
* @param otherSet The set to union with this set.
|
||||
*/
|
||||
union(otherSet: SortedSet<T>): SortedSet<T>;
|
||||
|
||||
/**
|
||||
* Makes a copy of this set
|
||||
*/
|
||||
clone(): SortedSet<T>;
|
||||
|
||||
/**
|
||||
* Returns a representation of the sorted set ready for serialisation.
|
||||
*/
|
||||
toJSON(): any;
|
||||
|
||||
/**
|
||||
* Loads a previously serialised sorted set.
|
||||
*
|
||||
* @param serialisedData The serialised set to load.
|
||||
*/
|
||||
static load<T>(serialisedData: T[]): SortedSet<T>;
|
||||
}
|
||||
|
||||
interface IndexField {
|
||||
/**
|
||||
* The name of the field within the document that
|
||||
*/
|
||||
name: string;
|
||||
|
||||
/**
|
||||
* An optional boost that can be applied to terms in this field.
|
||||
*/
|
||||
boost: number;
|
||||
}
|
||||
|
||||
interface IndexSearchResult {
|
||||
ref: any;
|
||||
|
||||
score: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* lunr.Index is object that manages a search index. It contains the indexes and stores
|
||||
* all the tokens and document lookups. It also provides the main user facing API for
|
||||
* the library.
|
||||
*/
|
||||
class Index {
|
||||
eventEmitter: EventEmitter;
|
||||
|
||||
documentStore: Store<string>;
|
||||
|
||||
tokenStore: TokenStore;
|
||||
|
||||
corpusTokens: SortedSet<string>;
|
||||
|
||||
pipeline: Pipeline;
|
||||
|
||||
_fields: IndexField[];
|
||||
|
||||
_ref: string;
|
||||
|
||||
_idfCache: {[key: string]: string};
|
||||
|
||||
/**
|
||||
* Bind a handler to events being emitted by the index.
|
||||
*
|
||||
* The handler can be bound to many events at the same time.
|
||||
*
|
||||
* @param eventName The name(s) of events to bind the function to.
|
||||
* @param handler The function to call when an event is fired. Binds a handler
|
||||
* function to a specific event(s).
|
||||
*/
|
||||
on(eventName: string, handler: Function): void;
|
||||
on(eventName: string, eventName2: string, handler: Function): void;
|
||||
on(eventName: string, eventName2: string, eventName3: string, handler: Function): void;
|
||||
on(eventName: string, eventName2: string, eventName3: string, eventName4: string, handler: Function): void;
|
||||
on(eventName: string, eventName2: string, eventName3: string, eventName4: string, eventName5: string, handler: Function): void;
|
||||
|
||||
/**
|
||||
* Removes a handler from an event being emitted by the index.
|
||||
*
|
||||
* @param eventName The name of events to remove the function from.
|
||||
* @param handler The serialised set to load.
|
||||
*/
|
||||
off(eventName: string, handler: Function): void;
|
||||
|
||||
/**
|
||||
* Adds a field to the list of fields that will be searchable within documents in the index.
|
||||
*
|
||||
* An optional boost param can be passed to affect how much tokens in this field rank in
|
||||
* search results, by default the boost value is 1.
|
||||
*
|
||||
* Fields should be added before any documents are added to the index, fields that are added
|
||||
* after documents are added to the index will only apply to new documents added to the index.
|
||||
*
|
||||
* @param fieldName The name of the field within the document that
|
||||
* @param options An optional boost that can be applied to terms in this field.
|
||||
*/
|
||||
field(fieldName: string, options?: {boost?: number}): Index;
|
||||
|
||||
/**
|
||||
* Sets the property used to uniquely identify documents added to the index, by default this
|
||||
* property is 'id'.
|
||||
*
|
||||
* This should only be changed before adding documents to the index, changing the ref property
|
||||
* without resetting the index can lead to unexpected results.
|
||||
*
|
||||
* @refName The property to use to uniquely identify the
|
||||
*/
|
||||
ref(refName: string): Index;
|
||||
|
||||
/**
|
||||
* Add a document to the index.
|
||||
*
|
||||
* This is the way new documents enter the index, this function will run the fields from the
|
||||
* document through the index's pipeline and then add it to the index, it will then show up
|
||||
* in search results.
|
||||
*
|
||||
* An 'add' event is emitted with the document that has been added and the index the document
|
||||
* has been added to. This event can be silenced by passing false as the second argument to add.
|
||||
*
|
||||
* @param doc The document to add to the index.
|
||||
* @param emitEvent Whether or not to emit events, default true.
|
||||
*/
|
||||
add(doc: any, emitEvent?: boolean): void;
|
||||
|
||||
/**
|
||||
* Removes a document from the index.
|
||||
*
|
||||
* To make sure documents no longer show up in search results they can be removed from the
|
||||
* index using this method.
|
||||
*
|
||||
* The document passed only needs to have the same ref property value as the document that was
|
||||
* added to the index, they could be completely different objects.
|
||||
*
|
||||
* A 'remove' event is emitted with the document that has been removed and the index the
|
||||
* document has been removed from. This event can be silenced by passing false as the second
|
||||
* argument to remove.
|
||||
*
|
||||
* @param doc The document to remove from the index.
|
||||
* @param emitEvent Whether to emit remove events, defaults to true
|
||||
*/
|
||||
remove(doc: any, emitEvent?: boolean): void;
|
||||
|
||||
/**
|
||||
* Updates a document in the index.
|
||||
*
|
||||
* When a document contained within the index gets updated, fields changed, added or removed,
|
||||
* to make sure it correctly matched against search queries, it should be updated in the index.
|
||||
*
|
||||
* This method is just a wrapper around [[remove]] and [[add]].
|
||||
*
|
||||
* An 'update' event is emitted with the document that has been updated and the index.
|
||||
* This event can be silenced by passing false as the second argument to update. Only an
|
||||
* update event will be fired, the 'add' and 'remove' events of the underlying calls are
|
||||
* silenced.
|
||||
*
|
||||
* @param doc The document to update in the index.
|
||||
* @param emitEvent Whether to emit update events, defaults to true
|
||||
*/
|
||||
update(doc: any, emitEvent?: boolean): void;
|
||||
|
||||
/**
|
||||
* Calculates the inverse document frequency for a token within the index.
|
||||
*
|
||||
* @param token The token to calculate the idf of.
|
||||
*/
|
||||
idf(token: string): string;
|
||||
|
||||
/**
|
||||
* Searches the index using the passed query.
|
||||
*
|
||||
* Queries should be a string, multiple words are allowed and will lead to an AND based
|
||||
* query, e.g. idx.search('foo bar') will run a search for documents containing both
|
||||
* 'foo' and 'bar'.
|
||||
*
|
||||
* All query tokens are passed through the same pipeline that document tokens are passed
|
||||
* through, so any language processing involved will be run on every query term.
|
||||
*
|
||||
* Each query term is expanded, so that the term 'he' might be expanded to 'hello'
|
||||
* and 'help' if those terms were already included in the index.
|
||||
*
|
||||
* Matching documents are returned as an array of objects, each object contains the
|
||||
* matching document ref, as set for this index, and the similarity score for this
|
||||
* document against the query.
|
||||
*
|
||||
* @param query The query to search the index with.
|
||||
*/
|
||||
search(query: string): IndexSearchResult[];
|
||||
|
||||
/**
|
||||
* Generates a vector containing all the tokens in the document matching the
|
||||
* passed documentRef.
|
||||
*
|
||||
* The vector contains the tf-idf score for each token contained in the document with
|
||||
* the passed documentRef. The vector will contain an element for every token in the
|
||||
* indexes corpus, if the document does not contain that token the element will be 0.
|
||||
*
|
||||
* @param documentRef The ref to find the document with.
|
||||
*/
|
||||
documentVector(documentRef: string): Vector;
|
||||
|
||||
/**
|
||||
* Returns a representation of the index ready for serialisation.
|
||||
*/
|
||||
toJSON(): any;
|
||||
|
||||
/**
|
||||
* Applies a plugin to the current index.
|
||||
*
|
||||
* A plugin is a function that is called with the index as its context. Plugins can be
|
||||
* used to customise or extend the behaviour the index in some way. A plugin is just a
|
||||
* function, that encapsulated the custom behaviour that should be applied to the index.
|
||||
*
|
||||
* The plugin function will be called with the index as its argument, additional arguments
|
||||
* can also be passed when calling use. The function will be called with the index as
|
||||
* its context.
|
||||
*
|
||||
* Example:
|
||||
*
|
||||
* ```javascript
|
||||
* var myPlugin = function(idx, arg1, arg2) {
|
||||
* // `this` is the index to be extended
|
||||
* // apply any extensions etc here.
|
||||
* };
|
||||
*
|
||||
* var idx = lunr(function() {
|
||||
* this.use(myPlugin, 'arg1', 'arg2');
|
||||
* });
|
||||
* ```
|
||||
*
|
||||
* @param plugin The plugin to apply.
|
||||
* @param args
|
||||
*/
|
||||
use(plugin: Function, ...args: any[]): void;
|
||||
|
||||
/**
|
||||
* Loads a previously serialised index.
|
||||
*
|
||||
* Issues a warning if the index being imported was serialised by a different version
|
||||
* of lunr.
|
||||
*
|
||||
* @param serialisedData The serialised set to load.
|
||||
*/
|
||||
static load(serialisedData: any): Index;
|
||||
}
|
||||
|
||||
/**
|
||||
* lunr.Store is a simple key-value store used for storing sets of tokens for documents
|
||||
* stored in index.
|
||||
*/
|
||||
class Store<T> {
|
||||
store: {[id: string]: SortedSet<T>};
|
||||
|
||||
length: number;
|
||||
|
||||
/**
|
||||
* Stores the given tokens in the store against the given id.
|
||||
*
|
||||
* @param id The key used to store the tokens against.
|
||||
* @param tokens The tokens to store against the key.
|
||||
*/
|
||||
set(id: string, tokens: SortedSet<T>): void;
|
||||
|
||||
/**
|
||||
* Retrieves the tokens from the store for a given key.
|
||||
*
|
||||
* @param id The key to lookup and retrieve from the store.
|
||||
*/
|
||||
get(id: string): SortedSet<T>;
|
||||
|
||||
/**
|
||||
* Checks whether the store contains a key.
|
||||
*
|
||||
* @param id The id to look up in the store.
|
||||
*/
|
||||
has(id: string): boolean;
|
||||
|
||||
/**
|
||||
* Removes the value for a key in the store.
|
||||
*
|
||||
* @param id The id to remove from the store.
|
||||
*/
|
||||
remove(id: string): void;
|
||||
|
||||
/**
|
||||
* Returns a representation of the store ready for serialisation.
|
||||
*/
|
||||
toJSON(): any;
|
||||
|
||||
/**
|
||||
* Loads a previously serialised store.
|
||||
*
|
||||
* @param serialisedData The serialised store to load.
|
||||
*/
|
||||
static load(serialisedData: any): Store<any>;
|
||||
}
|
||||
|
||||
interface TokenDocument {
|
||||
ref: number;
|
||||
|
||||
tf: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* lunr.TokenStore is used for efficient storing and lookup of the reverse index of token
|
||||
* to document ref.
|
||||
*/
|
||||
class TokenStore {
|
||||
root: {[token: string]: TokenStore};
|
||||
|
||||
docs: {[ref: string]: TokenDocument};
|
||||
|
||||
length: number;
|
||||
|
||||
/**
|
||||
* Adds a new token doc pair to the store.
|
||||
*
|
||||
* By default this function starts at the root of the current store, however it can
|
||||
* start at any node of any token store if required.
|
||||
*
|
||||
* @param token The token to store the doc under
|
||||
* @param doc The doc to store against the token
|
||||
* @param root An optional node at which to start looking for the
|
||||
*/
|
||||
add(token: string, doc: TokenDocument, root?: TokenStore): void;
|
||||
|
||||
/**
|
||||
* Checks whether this key is contained within this lunr.TokenStore.
|
||||
*
|
||||
* @param token The token to check for
|
||||
*/
|
||||
has(token: string): boolean;
|
||||
|
||||
/**
|
||||
* Retrieve a node from the token store for a given token.
|
||||
*
|
||||
* @param token The token to get the node for.
|
||||
*/
|
||||
getNode(token: string): TokenStore;
|
||||
|
||||
/**
|
||||
* Retrieve the documents for a node for the given token.
|
||||
*
|
||||
* By default this function starts at the root of the current store, however it can
|
||||
* start at any node of any token store if required.
|
||||
*
|
||||
* @param token The token to get the documents for.
|
||||
* @param root An optional node at which to start.
|
||||
*/
|
||||
get(token: string, root: TokenStore): {[ref: string]: TokenDocument};
|
||||
|
||||
count(token: string, root: TokenStore): number;
|
||||
|
||||
/**
|
||||
* Remove the document identified by ref from the token in the store.
|
||||
*
|
||||
* @param token The token to get the documents for.
|
||||
* @param ref The ref of the document to remove from this token.
|
||||
*/
|
||||
remove(token: string, ref: string): void;
|
||||
|
||||
/**
|
||||
* Find all the possible suffixes of the passed token using tokens currently in
|
||||
* the store.
|
||||
*
|
||||
* @param token The token to expand.
|
||||
* @param memo
|
||||
*/
|
||||
expand(token: string, memo?: string[]): string[];
|
||||
|
||||
/**
|
||||
* Returns a representation of the token store ready for serialisation.
|
||||
*/
|
||||
toJSON(): any;
|
||||
|
||||
/**
|
||||
* Loads a previously serialised token store.
|
||||
*
|
||||
* @param serialisedData The serialised token store to load.
|
||||
*/
|
||||
static load(serialisedData: any): TokenStore;
|
||||
}
|
||||
|
||||
/**
|
||||
* A namespace containing utils for the rest of the lunr library
|
||||
*/
|
||||
namespace utils {
|
||||
/**
|
||||
* Print a warning message to the console.
|
||||
*
|
||||
* @param {String} message The message to be printed.
|
||||
* @memberOf Utils
|
||||
*/
|
||||
function warn(message: any): void;
|
||||
|
||||
/**
|
||||
* Convert an object to a string.
|
||||
*
|
||||
* In the case of `null` and `undefined` the function returns
|
||||
* the empty string, in all other cases the result of calling
|
||||
* `toString` on the passed object is returned.
|
||||
*
|
||||
* @param {Any} obj The object to convert to a string.
|
||||
* @return {String} string representation of the passed object.
|
||||
* @memberOf Utils
|
||||
*/
|
||||
function asString(obj: any): string;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience function for instantiating a new lunr index and configuring it with the default
|
||||
* pipeline functions and the passed config function.
|
||||
*
|
||||
* When using this convenience function a new index will be created with the following functions
|
||||
* already in the pipeline:
|
||||
*
|
||||
* * lunr.StopWordFilter - filters out any stop words before they enter the index
|
||||
*
|
||||
* * lunr.stemmer - stems the tokens before entering the index.
|
||||
*
|
||||
* Example:
|
||||
*
|
||||
* ```javascript
|
||||
* var idx = lunr(function () {
|
||||
* this.field('title', 10);
|
||||
* this.field('tags', 100);
|
||||
* this.field('body');
|
||||
*
|
||||
* this.ref('cid');
|
||||
*
|
||||
* this.pipeline.add(function () {
|
||||
* // some custom pipeline function
|
||||
* });
|
||||
* });
|
||||
* ```
|
||||
*/
|
||||
declare function lunr(config: Function): lunr.Index;
|
||||
|
||||
export = lunr;
|
||||
export as namespace lunr;
|
||||
@@ -0,0 +1,41 @@
|
||||
/**
|
||||
* Basic test, from http://lunrjs.com/
|
||||
*/
|
||||
function basic_test() {
|
||||
const index = lunr(function() {
|
||||
this.field('title', {boost: 10});
|
||||
this.field('body');
|
||||
this.ref('id');
|
||||
});
|
||||
|
||||
index.add({
|
||||
id: 1,
|
||||
title: 'Foo',
|
||||
body: 'Foo foo foo!'
|
||||
});
|
||||
|
||||
index.add({
|
||||
id: 2,
|
||||
title: 'Bar',
|
||||
body: 'Bar bar bar!'
|
||||
});
|
||||
|
||||
index.search('foo');
|
||||
}
|
||||
|
||||
/**
|
||||
* Pipeline test, from http://lunrjs.com/
|
||||
*/
|
||||
function pipeline_test() {
|
||||
const index = lunr(function() {
|
||||
this.pipeline.add(function(token: string, tokenIndex: number, tokens: string[]): string {
|
||||
// text processing in here
|
||||
return token;
|
||||
});
|
||||
|
||||
this.pipeline.after(lunr.stopWordFilter, function(token: string, tokenIndex: number, tokens: string[]): string {
|
||||
// text processing in here
|
||||
return token;
|
||||
});
|
||||
});
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": false,
|
||||
"strictNullChecks": false,
|
||||
"baseUrl": "../../",
|
||||
"typeRoots": [
|
||||
"../../"
|
||||
],
|
||||
"paths": {
|
||||
"lunr": ["lunr/v0"]
|
||||
},
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"lunr-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"extends": "dtslint/dt.json",
|
||||
"rules": {
|
||||
"ban-types": false,
|
||||
"only-arrow-functions": [false],
|
||||
"no-single-declare-module": false,
|
||||
"no-unnecessary-qualifier": true
|
||||
}
|
||||
}
|
||||
Vendored
+1
-1
@@ -1724,7 +1724,7 @@ declare namespace __MaterialUI {
|
||||
onCellHoverExit?(row: number, column: number): void;
|
||||
onRowHover?(row: number): void;
|
||||
onRowHoverExit?(row: number): void;
|
||||
onRowSelection?(selectedRows: number[] | string): void;
|
||||
onRowSelection?(selectedRows: number[] | 'all'): void;
|
||||
selectable?: boolean;
|
||||
style?: React.CSSProperties;
|
||||
wrapperStyle?: React.CSSProperties;
|
||||
|
||||
Vendored
+4
@@ -7,6 +7,8 @@ declare module Match {
|
||||
var undefined: any;
|
||||
var Object: any;
|
||||
|
||||
function Maybe(pattern: any): boolean;
|
||||
|
||||
function Optional(pattern: any): boolean;
|
||||
|
||||
function ObjectIncluding(dico: any): boolean;
|
||||
@@ -29,6 +31,8 @@ declare module "meteor/check" {
|
||||
var undefined: any;
|
||||
var Object: any;
|
||||
|
||||
function Maybe(pattern: any): boolean;
|
||||
|
||||
function Optional(pattern: any): boolean;
|
||||
|
||||
function ObjectIncluding(dico: any): boolean;
|
||||
|
||||
Vendored
+1
@@ -16,6 +16,7 @@
|
||||
/// <reference path="./mongo.d.ts" />
|
||||
/// <reference path="./random.d.ts" />
|
||||
/// <reference path="./reactive-var.d.ts" />
|
||||
/// <reference path="./server-render.d.ts" />
|
||||
/// <reference path="./session.d.ts" />
|
||||
/// <reference path="./templating.d.ts" />
|
||||
/// <reference path="./tiny-test.d.ts" />
|
||||
|
||||
Vendored
+16
@@ -0,0 +1,16 @@
|
||||
import * as http from "http";
|
||||
declare module "meteor/server-render" {
|
||||
interface Sink {
|
||||
request?: http.IncomingMessage;
|
||||
arch?: string;
|
||||
head?: string;
|
||||
body?: string;
|
||||
htmlById?: { [key: string]: string };
|
||||
maybeMadeChanges?: boolean;
|
||||
appendToHead(html: string): void;
|
||||
appendToBody(html: string): void;
|
||||
appendToElementById(id: string, html: string): void;
|
||||
renderIntoElementById(id: string, html: string): void;
|
||||
}
|
||||
function onPageLoad(sink: Sink): Promise<any> | any;
|
||||
}
|
||||
@@ -29,6 +29,7 @@
|
||||
"meteor.d.ts",
|
||||
"mongo.d.ts",
|
||||
"reactive-var.d.ts",
|
||||
"server-render.d.ts",
|
||||
"session.d.ts",
|
||||
"tiny-test.d.ts",
|
||||
"tools.d.ts",
|
||||
|
||||
Vendored
+3
-3
@@ -21,9 +21,9 @@ declare function request <T>(options: Mithril.RequestOptions<T> & { url: string
|
||||
declare function request <T>(url: string, options?: Mithril.RequestOptions<T>): Promise<T>;
|
||||
|
||||
/** Makes a JSON-P request and returns a promise. */
|
||||
declare function jsonp<T>(options: Mithril.JsonpOptions & { url: string }): Promise<T>;
|
||||
declare function jsonp<T>(options: Mithril.JsonpOptions & { url: string }): Promise<T>; // tslint:disable-line:no-unnecessary-generics
|
||||
/** Makes a JSON-P request and returns a promise. */
|
||||
declare function jsonp<T>(url: string, options?: Mithril.JsonpOptions): Promise<T>;
|
||||
declare function jsonp<T>(url: string, options?: Mithril.JsonpOptions): Promise<T>; // tslint:disable-line:no-unnecessary-generics
|
||||
|
||||
/** Creates an event handler which takes the value of the specified DOM element property and calls a function with it as the argument. */
|
||||
declare function withAttr(name: string, callback: (value: any) => any): (e: { currentTarget: any, [p: string]: any }) => void;
|
||||
@@ -116,7 +116,7 @@ declare namespace Mithril {
|
||||
/** Whether to send cookies to 3rd party domains. */
|
||||
withCredentials?: boolean;
|
||||
/** Exposes the underlying XMLHttpRequest object for low-level configuration. */
|
||||
config?(xhr: XMLHttpRequest): XMLHttpRequest | void;
|
||||
config?(xhr: XMLHttpRequest, options: this): XMLHttpRequest | void;
|
||||
/** Headers to append to the request before sending it. */
|
||||
headers?: { [key: string]: string };
|
||||
/** A constructor to be applied to each object in the response. */
|
||||
|
||||
@@ -20,7 +20,7 @@ const FRAME_BUDGET = 100;
|
||||
{
|
||||
const vnode = m.fragment({key: 123}, [m("div")]);
|
||||
console.assert((vnode.children as Array<m.Vnode<any, any>>).length === 1);
|
||||
console.assert(vnode.children![0].tag === 'div');
|
||||
console.assert((vnode.children as Array<m.Vnode<any, any>>)[0].tag === 'div');
|
||||
}
|
||||
|
||||
{
|
||||
|
||||
@@ -50,7 +50,7 @@ const comp2: Component<Comp2Attrs, {}> = {
|
||||
m(comp2, {title: '', description: ''});
|
||||
|
||||
// Correct use with lifecycle method
|
||||
m(comp2, {title: '', description: '', oncreate: (v) => v.attrs.title + '\n' + v.attrs.description});
|
||||
m(comp2, {title: '', description: '', oncreate: (v) => `${v.attrs.title}\n${v.attrs.description}`});
|
||||
|
||||
// Properties missing
|
||||
// $ExpectError
|
||||
|
||||
@@ -44,8 +44,9 @@ request<Result>('/id', {
|
||||
});
|
||||
|
||||
request<Result>('/item', {
|
||||
config: xhr => {
|
||||
config: (xhr, opts) => {
|
||||
xhr.setRequestHeader('accept', '*');
|
||||
console.log(opts.background);
|
||||
return xhr;
|
||||
},
|
||||
headers: {"Content-Type": "application/json"},
|
||||
|
||||
@@ -134,17 +134,6 @@ import { Stream } from 'mithril/stream';
|
||||
console.assert(b()() === undefined);
|
||||
}
|
||||
|
||||
{
|
||||
let count = 0;
|
||||
const a = stream(1);
|
||||
const b = stream.combine(a => stream.HALT, [a])
|
||||
["fantasy-land/map"](() => {
|
||||
count++;
|
||||
return 1;
|
||||
});
|
||||
console.assert(b() === undefined);
|
||||
}
|
||||
|
||||
{
|
||||
const all = stream.merge([
|
||||
stream(10),
|
||||
@@ -215,112 +204,6 @@ import { Stream } from 'mithril/stream';
|
||||
console.assert(doubled() === 4);
|
||||
}
|
||||
|
||||
{
|
||||
const s = stream<number>();
|
||||
const doubled = s["fantasy-land/map"]((n: number) => n * 2);
|
||||
s(3);
|
||||
console.assert(doubled() === 6);
|
||||
}
|
||||
|
||||
{
|
||||
const s = stream(3);
|
||||
const doubled = s["fantasy-land/map"]((n: number) => n * 2);
|
||||
console.assert(doubled() === 6);
|
||||
}
|
||||
|
||||
{
|
||||
const s = stream<undefined>();
|
||||
const mapped = s["fantasy-land/map"](String);
|
||||
s(undefined);
|
||||
console.assert(mapped() === "undefined");
|
||||
}
|
||||
|
||||
{
|
||||
const s = stream(undefined);
|
||||
const mapped = s["fantasy-land/map"](String);
|
||||
console.assert(mapped() === "undefined");
|
||||
}
|
||||
|
||||
{
|
||||
const s = stream(undefined);
|
||||
const mapped = s["fantasy-land/map"]((_value: undefined) => stream());
|
||||
console.assert(mapped()() === undefined);
|
||||
}
|
||||
|
||||
{
|
||||
const s = stream(undefined);
|
||||
console.assert(s["fantasy-land/map"] === s.map);
|
||||
}
|
||||
|
||||
{
|
||||
const apply = stream((n: number) => n * 2);
|
||||
const s = stream(3);
|
||||
const applied = s["fantasy-land/ap"](apply);
|
||||
console.assert(applied() === 6);
|
||||
apply(n => n / 3);
|
||||
console.assert(applied() === 1);
|
||||
s(9);
|
||||
console.assert(applied() === 3);
|
||||
}
|
||||
|
||||
{
|
||||
const apply = stream<(value: undefined) => string>(String);
|
||||
const s = stream(undefined);
|
||||
const applied = s["fantasy-land/ap"](apply);
|
||||
console.assert(applied() === "undefined");
|
||||
apply(value => String(value) + "a");
|
||||
console.assert(applied() === "undefineda");
|
||||
}
|
||||
|
||||
{
|
||||
const s = stream(3);
|
||||
const mapped = s["fantasy-land/map"]((v: number) => v);
|
||||
console.assert(s() === mapped());
|
||||
}
|
||||
|
||||
{
|
||||
const f = (x: number) => x * 2;
|
||||
const g = (x: number) => x * x;
|
||||
const s = stream(3);
|
||||
const mapped = s["fantasy-land/map"]((value: any) => f(g(value)));
|
||||
const composed = s["fantasy-land/map"](g)["fantasy-land/map"](f);
|
||||
console.assert(mapped() === 18);
|
||||
console.assert(mapped() === composed());
|
||||
}
|
||||
|
||||
{
|
||||
const a = stream((n: number) => n * 2);
|
||||
const u = stream((n: number) => n * 3);
|
||||
const v = stream(5);
|
||||
const mapped = v["fantasy-land/ap"](u["fantasy-land/ap"](a["fantasy-land/map"]((f: any) => (g: any) => (x: any) => f(g(x)))));
|
||||
const composed = v["fantasy-land/ap"](u)["fantasy-land/ap"](a);
|
||||
console.assert(mapped() === 30);
|
||||
console.assert(mapped() === composed());
|
||||
}
|
||||
|
||||
{
|
||||
const a = stream()["fantasy-land/of"]((value: number) => value);
|
||||
const v = stream(5);
|
||||
console.assert(v["fantasy-land/ap"](a)() === 5);
|
||||
console.assert(v["fantasy-land/ap"](a)() === v());
|
||||
}
|
||||
|
||||
{
|
||||
const a = stream(0);
|
||||
const f = (n: number) => n * 2;
|
||||
const x = 3;
|
||||
console.assert(a["fantasy-land/of"](x)["fantasy-land/ap"](a["fantasy-land/of"](f))() === 6);
|
||||
console.assert(a["fantasy-land/of"](x)["fantasy-land/ap"](a["fantasy-land/of"](f))() === a["fantasy-land/of"](f(x))());
|
||||
}
|
||||
|
||||
{
|
||||
const u = stream((n: number) => n * 2);
|
||||
const a = stream();
|
||||
const y = 3;
|
||||
console.assert(a["fantasy-land/of"](y)["fantasy-land/ap"](u)() === 6);
|
||||
console.assert(a["fantasy-land/of"](y)["fantasy-land/ap"](u)() === u["fantasy-land/ap"](a["fantasy-land/of"]((f: any) => f(y)))());
|
||||
}
|
||||
|
||||
// scan
|
||||
|
||||
{
|
||||
|
||||
@@ -5,9 +5,8 @@
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"suppressImplicitAnyIndexErrors": true,
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"noEmit": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": ["../"],
|
||||
"types": []
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
"rules": {
|
||||
// TODOs
|
||||
"no-duplicate-imports": false,
|
||||
"object-literal-key-quotes": false,
|
||||
"no-empty-interface": false
|
||||
}
|
||||
}
|
||||
|
||||
Vendored
+6
@@ -15,6 +15,12 @@ declare module 'moment' {
|
||||
* Use persian digits as decribed by unicode
|
||||
*/
|
||||
usePersianDigits?: boolean;
|
||||
/**
|
||||
* use dialect option to change usePersian dialect, available options are:
|
||||
* persian: default dialect(امرداد، آدینه، ...)
|
||||
* persian-modern: modern dialect(مرداد، جمعه، ...)
|
||||
*/
|
||||
dialect?: 'persian' | 'persian-modern';
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Vendored
+55
-42
@@ -1,31 +1,30 @@
|
||||
// Type definitions for morgan 1.7.0
|
||||
// Type definitions for morgan 1.7
|
||||
// Project: https://github.com/expressjs/morgan
|
||||
// Definitions by: James Roland Cabresos <https://github.com/staticfunction>
|
||||
// Paolo Scanferla <https://github.com/pscanf>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.2
|
||||
|
||||
import express = require('express');
|
||||
|
||||
declare namespace morgan {
|
||||
type FormatFn = (tokens: TokenIndexer, req: express.Request, res: express.Response) => string;
|
||||
|
||||
export interface FormatFn extends Function {
|
||||
(tokens: TokenIndexer, req: express.Request, res: express.Response): string;
|
||||
}
|
||||
type TokenCallbackFn = (req: express.Request, res: express.Response, arg?: string | number | boolean) => string;
|
||||
|
||||
export interface TokenCallbackFn extends Function {
|
||||
(req: express.Request, res: express.Response, arg?: string | number | boolean): string;
|
||||
}
|
||||
|
||||
export interface TokenIndexer {
|
||||
interface TokenIndexer {
|
||||
[tokenName: string]: TokenCallbackFn;
|
||||
}
|
||||
|
||||
/**
|
||||
* Public interface of morgan logger
|
||||
* Public interface of morgan logger.
|
||||
*/
|
||||
export interface Morgan {
|
||||
interface Morgan {
|
||||
/***
|
||||
* Create a new morgan logger middleware function using the given format and options. The format argument may be a string of a predefined name (see below for the names),
|
||||
* or a string of a format string containing defined tokens.
|
||||
* Create a new morgan logger middleware function using the given format
|
||||
* and options. The format argument may be a string of a predefined name
|
||||
* (see below for the names), or a string of a format string containing
|
||||
* defined tokens.
|
||||
* @param format
|
||||
* @param options
|
||||
*/
|
||||
@@ -45,7 +44,10 @@ declare namespace morgan {
|
||||
*/
|
||||
(format: 'common', options?: Options): express.RequestHandler;
|
||||
/**
|
||||
* Concise output colored by response status for development use. The :status token will be colored red for server error codes, yellow for client error codes, cyan for redirection codes, and uncolored for all other codes.
|
||||
* Concise output colored by response status for development use. The
|
||||
* :status token will be colored red for server error codes, yellow for
|
||||
* client error codes, cyan for redirection codes, and uncolored for
|
||||
* all other codes.
|
||||
* :method :url :status :response-time ms - :res[content-length]
|
||||
* @param format
|
||||
* @param options
|
||||
@@ -69,29 +71,32 @@ declare namespace morgan {
|
||||
(format: 'tiny', options?: Options): express.RequestHandler;
|
||||
|
||||
/***
|
||||
* Create a new morgan logger middleware function using the given format and options. The format argument may be a
|
||||
* custom format function which adheres to the signature.
|
||||
* Create a new morgan logger middleware function using the given format
|
||||
* and options. The format argument may be a custom format function
|
||||
* which adheres to the signature.
|
||||
* @param format
|
||||
* @param options
|
||||
*/
|
||||
(format: FormatFn, options?: Options): express.RequestHandler;
|
||||
|
||||
/**
|
||||
* Define a custom token which can be used in custom morgan logging formats.
|
||||
* Define a custom token which can be used in custom morgan logging
|
||||
* formats.
|
||||
*/
|
||||
token(name: string, callback: TokenCallbackFn): Morgan;
|
||||
/**
|
||||
* Define a named custom format by specifying a format string in token notation
|
||||
* Define a named custom format by specifying a format string in token
|
||||
* notation.
|
||||
*/
|
||||
format(name: string, fmt: string): Morgan;
|
||||
|
||||
/**
|
||||
* Define a named custom format by specifying a format function
|
||||
* Define a named custom format by specifying a format function.
|
||||
*/
|
||||
format(name: string, fmt: FormatFn): Morgan;
|
||||
|
||||
/**
|
||||
* Compile a format string in token notation into a format function
|
||||
* Compile a format string in token notation into a format function.
|
||||
*/
|
||||
compile(format: string): FormatFn;
|
||||
}
|
||||
@@ -99,49 +104,53 @@ declare namespace morgan {
|
||||
/**
|
||||
* Define a custom token which can be used in custom morgan logging formats.
|
||||
*/
|
||||
export function token(name: string, callback: TokenCallbackFn): Morgan;
|
||||
function token(name: string, callback: TokenCallbackFn): Morgan;
|
||||
|
||||
/**
|
||||
* Define a named custom format by specifying a format string in token notation
|
||||
* Define a named custom format by specifying a format string in token
|
||||
* notation.
|
||||
*/
|
||||
export function format(name: string, fmt: string): Morgan;
|
||||
function format(name: string, fmt: string): Morgan;
|
||||
|
||||
/**
|
||||
* Define a named custom format by specifying a format function
|
||||
* Define a named custom format by specifying a format function.
|
||||
*/
|
||||
export function format(name: string, fmt: FormatFn): Morgan;
|
||||
function format(name: string, fmt: FormatFn): Morgan;
|
||||
|
||||
/**
|
||||
* Compile a format string in token notation into a format function
|
||||
* Compile a format string in token notation into a format function.
|
||||
*/
|
||||
export function compile(format: string): FormatFn;
|
||||
function compile(format: string): FormatFn;
|
||||
|
||||
export interface StreamOptions {
|
||||
interface StreamOptions {
|
||||
/**
|
||||
* Output stream for writing log lines
|
||||
* Output stream for writing log lines.
|
||||
*/
|
||||
write: (str: string) => void;
|
||||
write(str: string): void;
|
||||
}
|
||||
|
||||
/***
|
||||
* Morgan accepts these properties in the options object.
|
||||
*/
|
||||
export interface Options {
|
||||
|
||||
interface Options {
|
||||
/***
|
||||
* Buffer duration before writing logs to the stream, defaults to false. When set to true, defaults to 1000 ms.
|
||||
* Buffer duration before writing logs to the stream, defaults to false.
|
||||
* When set to true, defaults to 1000 ms.
|
||||
*/
|
||||
buffer?: boolean;
|
||||
|
||||
/***
|
||||
* Write log line on request instead of response. This means that a requests will be logged even if the server crashes, but data from the response cannot be logged (like the response code).
|
||||
* Write log line on request instead of response. This means that a
|
||||
* requests will be logged even if the server crashes, but data from the
|
||||
* response cannot be logged (like the response code).
|
||||
*/
|
||||
immediate?: boolean;
|
||||
|
||||
/***
|
||||
* Function to determine if logging is skipped, defaults to false. This function will be called as skip(req, res).
|
||||
* Function to determine if logging is skipped, defaults to false. This
|
||||
* function will be called as skip(req, res).
|
||||
*/
|
||||
skip?: (req: express.Request, res: express.Response) => boolean;
|
||||
skip?(req: express.Request, res: express.Response): boolean;
|
||||
|
||||
/***
|
||||
* Output stream for writing log lines, defaults to process.stdout.
|
||||
@@ -152,8 +161,9 @@ declare namespace morgan {
|
||||
}
|
||||
|
||||
/***
|
||||
* Create a new morgan logger middleware function using the given format and options. The format argument may be a string of a predefined name (see below for the names),
|
||||
* or a string of a format string containing defined tokens.
|
||||
* Create a new morgan logger middleware function using the given format and
|
||||
* options. The format argument may be a string of a predefined name (see below
|
||||
* for the names), or a string of a format string containing defined tokens.
|
||||
* @param format
|
||||
* @param options
|
||||
*/
|
||||
@@ -176,7 +186,9 @@ declare function morgan(format: 'combined', options?: morgan.Options): express.R
|
||||
declare function morgan(format: 'common', options?: morgan.Options): express.RequestHandler;
|
||||
|
||||
/***
|
||||
* Concise output colored by response status for development use. The :status token will be colored red for server error codes, yellow for client error codes, cyan for redirection codes, and uncolored for all other codes.
|
||||
* Concise output colored by response status for development use. The :status
|
||||
* token will be colored red for server error codes, yellow for client error
|
||||
* codes, cyan for redirection codes, and uncolored for all other codes.
|
||||
* :method :url :status :response-time ms - :res[content-length]
|
||||
* @param format
|
||||
* @param options
|
||||
@@ -200,11 +212,12 @@ declare function morgan(format: 'short', options?: morgan.Options): express.Requ
|
||||
declare function morgan(format: 'tiny', options?: morgan.Options): express.RequestHandler;
|
||||
|
||||
/***
|
||||
* Create a new morgan logger middleware function using the given format and options. The format argument may be a
|
||||
* custom format function which adheres to the signature.
|
||||
* Create a new morgan logger middleware function using the given format and
|
||||
* options. The format argument may be a custom format function which adheres to
|
||||
* the signature.
|
||||
* @param format
|
||||
* @param options
|
||||
*/
|
||||
declare function morgan(custom: (req: express.Request, res: express.Response) => string): express.RequestHandler
|
||||
declare function morgan(format: morgan.FormatFn, options?: morgan.Options): express.RequestHandler;
|
||||
|
||||
export = morgan;
|
||||
|
||||
@@ -6,72 +6,86 @@ import morgan = require('morgan');
|
||||
import express = require('express');
|
||||
|
||||
// a pre-defined name
|
||||
morgan('combined')
|
||||
morgan('common')
|
||||
morgan('short')
|
||||
morgan('tiny')
|
||||
morgan('combined');
|
||||
morgan('common');
|
||||
morgan('short');
|
||||
morgan('tiny');
|
||||
|
||||
// a format string
|
||||
morgan(':remote-addr :method :url')
|
||||
morgan(':remote-addr :method :url');
|
||||
|
||||
morgan('combined', {
|
||||
buffer: true,
|
||||
immediate: true,
|
||||
skip: function (req, res) { return res.statusCode < 400 },
|
||||
stream: {
|
||||
write: (str: string) => {
|
||||
console.log(str);
|
||||
}
|
||||
buffer: true,
|
||||
immediate: true,
|
||||
skip: (req, res) => res.statusCode < 400,
|
||||
stream: {
|
||||
write: (str: string) => {
|
||||
console.log(str);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// a custom format function
|
||||
morgan((tokens, req, res) => {
|
||||
return [
|
||||
tokens.method(req, res),
|
||||
tokens.url(req, res),
|
||||
tokens.status(req, res),
|
||||
tokens.res(req, res, 'content-length'), '-',
|
||||
tokens['response-time'](req, res), 'ms'
|
||||
].join(' ');
|
||||
});
|
||||
// a custom format function with options
|
||||
morgan((_tokens, _req, _res) => "", {
|
||||
buffer: true,
|
||||
immediate: true,
|
||||
skip: (req, res) => res.statusCode < 400,
|
||||
stream: {
|
||||
write: (str: string) => {
|
||||
console.log(str);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// test interface definition for morgan
|
||||
|
||||
// a named custom format defined as string (example: extend 'tiny' format with user-agent token)
|
||||
morgan.format('tiny-extended', ':method :url :status :res[content-length] - :response-time ms :user-agent');
|
||||
|
||||
|
||||
// a named custom format defined using the Function signature (example: extend 'dev' format with user-agent token)
|
||||
|
||||
// extend morgan.FormatFn interface with memoizer property to avoid unnecessary re-compiling
|
||||
// of status-code range driven colorized format functions
|
||||
interface IFormatFnIndexer {
|
||||
interface FormatFnIndexer {
|
||||
[memoizerName: string]: morgan.FormatFn;
|
||||
}
|
||||
|
||||
interface IExtendedFormatFn extends morgan.FormatFn {
|
||||
memoizer?: IFormatFnIndexer;
|
||||
interface ExtendedFormatFn extends morgan.FormatFn {
|
||||
memoizer: FormatFnIndexer;
|
||||
}
|
||||
|
||||
|
||||
var developmentExtendedFormatLine : IExtendedFormatFn = function(tokens, req, res):string {
|
||||
|
||||
const developmentExtendedFormatLine = ((tokens, req, res): string => {
|
||||
// get the status code if response written
|
||||
var status = res.statusCode
|
||||
? res.statusCode
|
||||
: undefined;
|
||||
const status = res.statusCode;
|
||||
|
||||
// get status color
|
||||
var color = status >= 500 ? 31 // red
|
||||
const color = status >= 500 ? 31 // red
|
||||
: status >= 400 ? 33 // yellow
|
||||
: status >= 300 ? 36 // cyan
|
||||
: status >= 200 ? 32 // green
|
||||
: 0; // no color
|
||||
|
||||
// get colored format function, if previously memoized, otherwise undefined
|
||||
var fn: morgan.FormatFn = developmentExtendedFormatLine.memoizer[color];
|
||||
let fn: morgan.FormatFn | undefined = developmentExtendedFormatLine.memoizer[color];
|
||||
|
||||
if (!fn) {
|
||||
// compile
|
||||
fn = developmentExtendedFormatLine.memoizer[color] = morgan.compile('\x1b[0m:method :url \x1b['
|
||||
+ color + 'm:status \x1b[0m:response-time ms - :res[content-length]\x1b[0m :user-agent');
|
||||
fn = developmentExtendedFormatLine.memoizer[color] = morgan.compile(`\x1b[0m:method :url \x1b[${color}m:status \x1b[0m:response-time ms - :res[content-length]\x1b[0m :user-agent`);
|
||||
}
|
||||
|
||||
return fn(tokens, req, res);
|
||||
};
|
||||
}) as ExtendedFormatFn;
|
||||
|
||||
developmentExtendedFormatLine.memoizer = {};
|
||||
|
||||
|
||||
morgan.format('dev-extended', developmentExtendedFormatLine);
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": false,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
@@ -19,4 +19,4 @@
|
||||
"index.d.ts",
|
||||
"morgan-tests.ts"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"extends": "dtslint/dt.json",
|
||||
"rules": {
|
||||
"unified-signatures": false
|
||||
}
|
||||
}
|
||||
+4
-1
@@ -6,12 +6,15 @@
|
||||
import * as nodemailer from 'nodemailer';
|
||||
|
||||
declare namespace mailgunTransport {
|
||||
interface Options {
|
||||
auth: AuthOptions;
|
||||
}
|
||||
interface AuthOptions {
|
||||
api_key: string;
|
||||
domain?: string;
|
||||
}
|
||||
}
|
||||
|
||||
declare function mailgunTransport(options: mailgunTransport.AuthOptions): nodemailer.Transport;
|
||||
declare function mailgunTransport(options: mailgunTransport.Options): nodemailer.Transport;
|
||||
|
||||
export = mailgunTransport;
|
||||
|
||||
@@ -1,13 +1,17 @@
|
||||
import mailgunTransport = require('nodemailer-mailgun-transport');
|
||||
import nodemailer = require('nodemailer');
|
||||
|
||||
const opts: mailgunTransport.AuthOptions = {
|
||||
api_key: "harry"
|
||||
const opts: mailgunTransport.Options = {
|
||||
auth: {
|
||||
api_key: "harry"
|
||||
}
|
||||
};
|
||||
|
||||
const optsWithDomain: mailgunTransport.AuthOptions = {
|
||||
api_key: "harry",
|
||||
domain: "http://www.foo.com"
|
||||
const optsWithDomain: mailgunTransport.Options = {
|
||||
auth: {
|
||||
api_key: "harry",
|
||||
domain: "http://www.foo.com"
|
||||
}
|
||||
};
|
||||
|
||||
const transport: nodemailer.Transporter = nodemailer.createTransport(mailgunTransport(optsWithDomain));
|
||||
|
||||
Vendored
+9
-7
@@ -1,6 +1,8 @@
|
||||
// Type definitions for OpenLayers v4.3.0
|
||||
// Project: http://openlayers.org/
|
||||
// Definitions by: Olivier Sechet <https://github.com/osechet>, Guilhem Brouat <https://github.com/ganlhi>
|
||||
// Definitions by: Olivier Sechet <https://github.com/osechet>
|
||||
// Guilhem Brouat <https://github.com/ganlhi>
|
||||
// Bin Wang <https://github.com/wb14123>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// Definitions partially generated using tsd-jsdoc (https://github.com/englercj/tsd-jsdoc)
|
||||
|
||||
@@ -1830,11 +1832,11 @@ declare module ol {
|
||||
* Get the feature's style. This return for this method depends on what was
|
||||
* provided to the {@link ol.Feature#setStyle} method.
|
||||
* @return {ol.style.Style|Array.<ol.style.Style>|
|
||||
* ol.FeatureStyleFunction} The feature style.
|
||||
* ol.FeatureStyleFunction|ol.StyleFunction} The feature style.
|
||||
* @api stable
|
||||
* @observable
|
||||
*/
|
||||
getStyle(): (ol.style.Style | ol.style.Style[] | ol.FeatureStyleFunction);
|
||||
getStyle(): (ol.style.Style | ol.style.Style[] | ol.FeatureStyleFunction | ol.StyleFunction);
|
||||
|
||||
/**
|
||||
* Get the feature's style function.
|
||||
@@ -1858,11 +1860,11 @@ declare module ol {
|
||||
* of styles, or a function that takes a resolution and returns an array of
|
||||
* styles. If it is `null` the feature has no style (a `null` style).
|
||||
* @param {ol.style.Style|Array.<ol.style.Style>|
|
||||
* ol.FeatureStyleFunction} style Style for this feature.
|
||||
* ol.FeatureStyleFunction|ol.StyleFunction} style Style for this feature.
|
||||
* @api stable
|
||||
* @observable
|
||||
*/
|
||||
setStyle(style: (ol.style.Style | ol.style.Style[] | ol.FeatureStyleFunction)): void;
|
||||
setStyle(style: (ol.style.Style | ol.style.Style[] | ol.FeatureStyleFunction | ol.StyleFunction)): void;
|
||||
|
||||
/**
|
||||
* Set the feature id. The feature id is considered stable and may be used when
|
||||
@@ -7597,7 +7599,7 @@ declare module ol {
|
||||
* @observable
|
||||
* @api stable
|
||||
*/
|
||||
setPosition(position: (ol.Coordinate)): void;
|
||||
setPosition(position: (ol.Coordinate | undefined)): void;
|
||||
|
||||
/**
|
||||
* Set the positioning for this overlay.
|
||||
@@ -10590,7 +10592,7 @@ declare module ol {
|
||||
* @api
|
||||
*/
|
||||
clone(): ol.style.Style;
|
||||
|
||||
|
||||
/**
|
||||
* Get the geometry to be rendered.
|
||||
* @return {string|ol.geom.Geometry|ol.StyleGeometryFunction}
|
||||
|
||||
@@ -376,7 +376,7 @@ feature = feature.clone();
|
||||
geometry = feature.getGeometry();
|
||||
stringValue = feature.getGeometryName();
|
||||
let featureGetId: string | number = feature.getId();
|
||||
let featureGetStyle: ol.style.Style | Array<ol.style.Style> | ol.FeatureStyleFunction = feature.getStyle();
|
||||
let featureGetStyle: ol.style.Style | Array<ol.style.Style> | ol.FeatureStyleFunction | ol.StyleFunction = feature.getStyle();
|
||||
featureStyleFunction = feature.getStyleFunction();
|
||||
voidValue = feature.setGeometry(geometry);
|
||||
voidValue = feature.setGeometryName(stringValue);
|
||||
@@ -385,6 +385,7 @@ voidValue = feature.setId(numberValue);
|
||||
voidValue = feature.setStyle(style);
|
||||
voidValue = feature.setStyle(styleArray);
|
||||
voidValue = feature.setStyle(featureStyleFunction);
|
||||
voidValue = feature.setStyle(styleFunction);
|
||||
voidValue = feature.setProperties(object);
|
||||
|
||||
//
|
||||
@@ -590,6 +591,7 @@ voidValue = popup.setElement(popupElement);
|
||||
voidValue = popup.setMap(popupMap);
|
||||
voidValue = popup.setOffset(popupOffset);
|
||||
voidValue = popup.setPosition(coordinate);
|
||||
voidValue = popup.setPosition(undefined);
|
||||
voidValue = popup.setPositioning(popupPositioning);
|
||||
|
||||
|
||||
|
||||
Vendored
+2
-2
@@ -116,8 +116,8 @@ export class Client extends events.EventEmitter {
|
||||
resumeDrain(): void;
|
||||
|
||||
on(event: "drain", listener: () => void): this;
|
||||
on(event: "error", listener: (err: Error) => void): this;
|
||||
on(event: "notification" | "notice", listener: (message: Notification) => void): this;
|
||||
on(event: "error" | "notice", listener: (err: Error) => void): this;
|
||||
on(event: "notification", listener: (message: Notification) => void): this;
|
||||
// tslint:disable-next-line unified-signatures
|
||||
on(event: "end", listener: () => void): this;
|
||||
}
|
||||
|
||||
Vendored
+18
-10
@@ -9,6 +9,7 @@
|
||||
// Vítor Castro <https://github.com/teves-castro>
|
||||
// Jordan Quagliatini <https://github.com/1M0reBug>
|
||||
// Simon Højberg <https://github.com/hojberg>
|
||||
// Charles-Philippe Clermont <https://github.com/charlespwd>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.4
|
||||
|
||||
@@ -63,6 +64,11 @@ declare namespace R {
|
||||
set<T, U>(str: string, obj: T): U;
|
||||
}
|
||||
|
||||
interface Filter<T> {
|
||||
(list: T[]): T[];
|
||||
(obj: Dictionary<T>): Dictionary<T>;
|
||||
}
|
||||
|
||||
type Evolver<T> =
|
||||
| ((x: T) => T)
|
||||
| { [K in keyof T]?: Evolver<T[K]> };
|
||||
@@ -189,8 +195,8 @@ declare namespace R {
|
||||
* A function that returns the first argument if it's falsy otherwise the second argument. Note that this is
|
||||
* NOT short-circuited, meaning that if expressions are passed they are both evaluated.
|
||||
*/
|
||||
and<T extends { and?: ((...a: any[]) => any); } | number | boolean | string>(fn1: T, val2: boolean | any): boolean;
|
||||
and<T extends { and?: ((...a: any[]) => any); } | number | boolean | string>(fn1: T): (val2: boolean | any) => boolean;
|
||||
and<T extends { and?: ((...a: any[]) => any); } | number | boolean | string>(fn1: T, val2: any): boolean;
|
||||
and<T extends { and?: ((...a: any[]) => any); } | number | boolean | string>(fn1: T): (val2: any) => boolean;
|
||||
|
||||
/**
|
||||
* Returns true if at least one of elements of the list match the predicate, false otherwise.
|
||||
@@ -583,8 +589,9 @@ declare namespace R {
|
||||
/**
|
||||
* Returns a new list containing only those items that match a given predicate function. The predicate function is passed one argument: (value).
|
||||
*/
|
||||
filter<T>(fn: (value: T) => boolean): (list: T[]) => T[];
|
||||
filter<T>(fn: (value: T) => boolean): Filter<T>;
|
||||
filter<T>(fn: (value: T) => boolean, list: T[]): T[];
|
||||
filter<T>(fn: (value: T) => boolean, obj: Dictionary<T>): Dictionary<T>;
|
||||
|
||||
/**
|
||||
* Returns the first element of the list which matches the predicate, or `undefined` if no
|
||||
@@ -787,7 +794,7 @@ declare namespace R {
|
||||
/**
|
||||
* Returns a new object with the keys of the given object as values, and the values of the given object as keys.
|
||||
*/
|
||||
invertObj(obj: any | { [index: number]: string }): { [index: string]: string };
|
||||
invertObj(obj: { [index: string]: string } | { [index: number]: string }): { [index: string]: string };
|
||||
|
||||
/**
|
||||
* Turns a named method of an object (or object prototype) into a function that can be
|
||||
@@ -1220,9 +1227,9 @@ declare namespace R {
|
||||
* If the given, non-null object has a value at the given path, returns the value at that path.
|
||||
* Otherwise returns the provided default value.
|
||||
*/
|
||||
pathOr<T>(d: T, p: Path, obj: any): T | any;
|
||||
pathOr<T>(d: T, p: Path): (obj: any) => T | any;
|
||||
pathOr<T>(d: T): CurriedFunction2<Path, any, T | any>;
|
||||
pathOr<T>(d: T, p: Path, obj: any): any;
|
||||
pathOr<T>(d: T, p: Path): (obj: any) => any;
|
||||
pathOr<T>(d: T): CurriedFunction2<Path, any, any>;
|
||||
|
||||
/**
|
||||
* Returns true if the specified object property at given path satisfies the given predicate; false otherwise.
|
||||
@@ -1526,8 +1533,9 @@ declare namespace R {
|
||||
* Similar to `filter`, except that it keeps only values for which the given predicate
|
||||
* function returns falsy.
|
||||
*/
|
||||
reject<T>(fn: (value: T) => boolean): Filter<T>;
|
||||
reject<T>(fn: (value: T) => boolean, list: T[]): T[];
|
||||
reject<T>(fn: (value: T) => boolean): (list: T[]) => T[];
|
||||
reject<T>(fn: (value: T) => boolean, obj: Dictionary<T>): Dictionary<T>;
|
||||
|
||||
/**
|
||||
* Removes the sub-list of `list` starting at index `start` and containing `count` elements.
|
||||
@@ -1737,7 +1745,7 @@ declare namespace R {
|
||||
* Note that the order of the output array is not guaranteed to be
|
||||
* consistent across different JS platforms.
|
||||
*/
|
||||
toPairs<F, S>(obj: { [k: string]: S } | { [k: number]: S } | any): Array<[F, S]>;
|
||||
toPairs<F, S>(obj: { [k: string]: S } | { [k: number]: S }): Array<[F, S]>;
|
||||
|
||||
/**
|
||||
* Converts an object into an array of key, value arrays.
|
||||
@@ -1745,7 +1753,7 @@ declare namespace R {
|
||||
* Note that the order of the output array is not guaranteed to be
|
||||
* consistent across different JS platforms.
|
||||
*/
|
||||
toPairsIn<F, S>(obj: { [k: string]: S } | { [k: number]: S } | any): Array<[F, S]>;
|
||||
toPairsIn<F, S>(obj: { [k: string]: S } | { [k: number]: S }): Array<[F, S]>;
|
||||
|
||||
/**
|
||||
* Returns the string representation of the given value. eval'ing the output should
|
||||
|
||||
@@ -9,6 +9,7 @@ function shout(x: number): string {
|
||||
}
|
||||
|
||||
class F {
|
||||
[k: string]: string;
|
||||
x = "X";
|
||||
y = "Y";
|
||||
}
|
||||
@@ -369,6 +370,7 @@ R.times(i, 5);
|
||||
const filterIndexed = R.addIndex(R.filter);
|
||||
|
||||
R.filter(isEven, [1, 2, 3, 4]); // => [2, 4]
|
||||
R.filter(isEven, { a: 0, b: 1 }); // => { a: 0 }
|
||||
|
||||
function lastTwo(val: number, idx: number, list: number[]) {
|
||||
return list.length - idx <= 2;
|
||||
@@ -381,6 +383,7 @@ R.times(i, 5);
|
||||
}
|
||||
|
||||
R.reject(isOdd, [1, 2, 3, 4]); // => [2, 4]
|
||||
R.reject(isOdd, { a: 0, b: 1 }); // => { a: 0 }
|
||||
});
|
||||
(() => {
|
||||
function isNotFour(x: number) {
|
||||
@@ -510,9 +513,14 @@ R.times(i, 5);
|
||||
function isEven(n: number) {
|
||||
return n % 2 === 0;
|
||||
}
|
||||
R.filter(isEven, [1, 2, 3, 4]); // => [2, 4]
|
||||
const isEvenFn = R.filter(isEven);
|
||||
isEvenFn([1, 2, 3, 4]);
|
||||
|
||||
const filterEven = R.filter(isEven);
|
||||
filterEven({ a: 0, b: 1 }); // => { a: 0 }
|
||||
filterEven([0, 1]); // => [0]
|
||||
|
||||
const rejectEven = R.reject(isEven);
|
||||
rejectEven({ a: 0, b: 1 }); // => { b: 1 }
|
||||
rejectEven([0, 1]); // => [1]
|
||||
};
|
||||
|
||||
() => {
|
||||
|
||||
+9
@@ -81,6 +81,10 @@ export interface RemoteObjSpec {
|
||||
|
||||
export interface BootstrapTableProps extends Props<BootstrapTable> {
|
||||
/**
|
||||
Set version='4' to use bootstrap@4, else bootstrap@3 is used.
|
||||
*/
|
||||
version?: string;
|
||||
/**
|
||||
Use data to specify the data that you want to display on table.
|
||||
*/
|
||||
data: any[];
|
||||
@@ -156,6 +160,11 @@ export interface BootstrapTableProps extends Props<BootstrapTable> {
|
||||
*/
|
||||
searchPlaceholder?: string;
|
||||
/**
|
||||
Enable strict search, default is false.
|
||||
More info here: https://github.com/AllenFang/react-bootstrap-table/issues/1199
|
||||
*/
|
||||
strictSearch?: boolean;
|
||||
/**
|
||||
Enable multi search by multiColumnSearch, default is false.
|
||||
If you want to use multi search, you must enable search at first.
|
||||
Tips: Use space to delimited search text. EX: 3 4, which means match all 3 or 4 datas in table.
|
||||
|
||||
Vendored
+6
-1
@@ -251,7 +251,7 @@ declare namespace AdazzleReactDataGrid {
|
||||
* The editor for this column. Several editors are available in "react-data-grid/addons".
|
||||
* @default A simple text editor
|
||||
*/
|
||||
editor?: React.ReactElement<any>
|
||||
editor?: React.ReactElement<any> | React.ComponentClass<any> | React.StatelessComponent<any>
|
||||
/**
|
||||
* A custom read-only formatter for this column. An image formatter is available in "react-data-grid/addons".
|
||||
*/
|
||||
@@ -277,6 +277,11 @@ declare namespace AdazzleReactDataGrid {
|
||||
* A class name to be applied to the cells in the column
|
||||
*/
|
||||
cellClass?: string;
|
||||
/**
|
||||
* Whether this column can be dragged (re-arranged).
|
||||
* @default false
|
||||
*/
|
||||
draggable?: boolean;
|
||||
}
|
||||
|
||||
interface ColumnEventCallback {
|
||||
|
||||
Vendored
+1
-1
@@ -138,7 +138,7 @@ declare namespace ReactIntl {
|
||||
}
|
||||
|
||||
interface Props extends MessageDescriptor {
|
||||
values?: {[key: string]: string | number | JSX.Element};
|
||||
values?: {[key: string]: string | number | boolean | Date | JSX.Element};
|
||||
tagName?: string;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -115,6 +115,20 @@ class SomeComponent extends React.Component<SomeComponentProps & InjectedIntlPro
|
||||
values={{ count: 123 }}
|
||||
tagName="div" />
|
||||
|
||||
<FormattedMessage
|
||||
id="test"
|
||||
description="Test"
|
||||
defaultMessage="Hi {bool}!"
|
||||
values={{ bool: false }}
|
||||
tagName="div" />
|
||||
|
||||
<FormattedMessage
|
||||
id="test"
|
||||
description="Test"
|
||||
defaultMessage="Hi {date}!"
|
||||
values={{ date: new Date() }}
|
||||
tagName="div" />
|
||||
|
||||
<FormattedMessage
|
||||
id="test"
|
||||
description="Test"
|
||||
@@ -136,6 +150,27 @@ class SomeComponent extends React.Component<SomeComponentProps & InjectedIntlPro
|
||||
values={{ name: "bob" }}
|
||||
tagName="div" />
|
||||
|
||||
<FormattedHTMLMessage
|
||||
id="test"
|
||||
description="Test"
|
||||
defaultMessage="Hi numbers {count}!"
|
||||
values={{ count: 123 }}
|
||||
tagName="div" />
|
||||
|
||||
<FormattedHTMLMessage
|
||||
id="test"
|
||||
description="Test"
|
||||
defaultMessage="Hi {bool}!"
|
||||
values={{ bool: false }}
|
||||
tagName="div" />
|
||||
|
||||
<FormattedHTMLMessage
|
||||
id="test"
|
||||
description="Test"
|
||||
defaultMessage="Hi {date}!"
|
||||
values={{ date: new Date() }}
|
||||
tagName="div" />
|
||||
|
||||
<FormattedNumber
|
||||
value={123456.78}
|
||||
format="N"
|
||||
|
||||
Vendored
+1
-1
@@ -15,7 +15,7 @@ export interface LazyLoadProps {
|
||||
children?: JSX.Element;
|
||||
throttle?: number | boolean;
|
||||
debounce?: number | boolean;
|
||||
placeholder?: Node;
|
||||
placeholder?: any;
|
||||
unmountIfInvisible?: boolean;
|
||||
}
|
||||
|
||||
|
||||
Vendored
+16
-15
@@ -1,10 +1,11 @@
|
||||
// Type definitions for react-redux 5.0.5
|
||||
// Type definitions for react-redux 5.0.8
|
||||
// Project: https://github.com/rackt/react-redux
|
||||
// Definitions by: Qubo <https://github.com/tkqubo>,
|
||||
// Thomas Hasner <https://github.com/thasner>,
|
||||
// Kenzie Togami <https://github.com/kenzierocks>,
|
||||
// Curits Layne <https://github.com/clayne11>
|
||||
// Frank Tan <https://github.com/tansongyang>
|
||||
// Nicholas Boll <https://github.com/nicholasboll>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.4
|
||||
|
||||
@@ -37,7 +38,7 @@ interface AdvancedComponentDecorator<TProps, TOwnProps> {
|
||||
export interface InferableComponentEnhancerWithProps<TInjectedProps, TNeedsProps> {
|
||||
<P extends TInjectedProps>(
|
||||
component: Component<P>
|
||||
): ComponentClass<Omit<P, keyof TInjectedProps> & TNeedsProps>
|
||||
): ComponentClass<Omit<P, keyof TInjectedProps> & TNeedsProps> & {WrappedComponent: Component<P>}
|
||||
}
|
||||
|
||||
// Injects props and removes them from the prop requirements.
|
||||
@@ -67,66 +68,66 @@ export type InferableComponentEnhancer<TInjectedProps> =
|
||||
*/
|
||||
export declare function connect(): InferableComponentEnhancer<DispatchProp<any>>;
|
||||
|
||||
export declare function connect<TStateProps, no_dispatch, TOwnProps>(
|
||||
export declare function connect<TStateProps = {}, no_dispatch = {}, TOwnProps = {}>(
|
||||
mapStateToProps: MapStateToPropsParam<TStateProps, TOwnProps>
|
||||
): InferableComponentEnhancerWithProps<TStateProps & DispatchProp<any>, TOwnProps>;
|
||||
|
||||
export declare function connect<no_state, TDispatchProps, TOwnProps>(
|
||||
export declare function connect<no_state = {}, TDispatchProps = {}, TOwnProps = {}>(
|
||||
mapStateToProps: null | undefined,
|
||||
mapDispatchToProps: MapDispatchToPropsParam<TDispatchProps, TOwnProps>
|
||||
): InferableComponentEnhancerWithProps<TDispatchProps, TOwnProps>;
|
||||
|
||||
export declare function connect<TStateProps, TDispatchProps, TOwnProps>(
|
||||
export declare function connect<TStateProps = {}, TDispatchProps = {}, TOwnProps = {}>(
|
||||
mapStateToProps: MapStateToPropsParam<TStateProps, TOwnProps>,
|
||||
mapDispatchToProps: MapDispatchToPropsParam<TDispatchProps, TOwnProps>
|
||||
): InferableComponentEnhancerWithProps<TStateProps & TDispatchProps, TOwnProps>;
|
||||
|
||||
export declare function connect<TStateProps, no_dispatch, TOwnProps, TMergedProps>(
|
||||
export declare function connect<TStateProps = {}, no_dispatch = {}, TOwnProps = {}, TMergedProps = {}>(
|
||||
mapStateToProps: MapStateToPropsParam<TStateProps, TOwnProps>,
|
||||
mapDispatchToProps: null | undefined,
|
||||
mergeProps: MergeProps<TStateProps, undefined, TOwnProps, TMergedProps>,
|
||||
): InferableComponentEnhancerWithProps<TMergedProps, TOwnProps>;
|
||||
|
||||
export declare function connect<no_state, TDispatchProps, TOwnProps, TMergedProps>(
|
||||
export declare function connect<no_state = {}, TDispatchProps = {}, TOwnProps = {}, TMergedProps = {}>(
|
||||
mapStateToProps: null | undefined,
|
||||
mapDispatchToProps: MapDispatchToPropsParam<TDispatchProps, TOwnProps>,
|
||||
mergeProps: MergeProps<undefined, TDispatchProps, TOwnProps, TMergedProps>,
|
||||
): InferableComponentEnhancerWithProps<TMergedProps, TOwnProps>;
|
||||
|
||||
export declare function connect<no_state, no_dispatch, TOwnProps, TMergedProps>(
|
||||
export declare function connect<no_state = {}, no_dispatch = {}, TOwnProps = {}, TMergedProps = {}>(
|
||||
mapStateToProps: null | undefined,
|
||||
mapDispatchToProps: null | undefined,
|
||||
mergeProps: MergeProps<undefined, undefined, TOwnProps, TMergedProps>,
|
||||
): InferableComponentEnhancerWithProps<TMergedProps, TOwnProps>;
|
||||
|
||||
export declare function connect<TStateProps, TDispatchProps, TOwnProps, TMergedProps>(
|
||||
export declare function connect<TStateProps = {}, TDispatchProps = {}, TOwnProps = {}, TMergedProps = {}>(
|
||||
mapStateToProps: MapStateToPropsParam<TStateProps, TOwnProps>,
|
||||
mapDispatchToProps: MapDispatchToPropsParam<TDispatchProps, TOwnProps>,
|
||||
mergeProps: MergeProps<TStateProps, TDispatchProps, TOwnProps, TMergedProps>,
|
||||
): InferableComponentEnhancerWithProps<TMergedProps, TOwnProps>;
|
||||
|
||||
export declare function connect<TStateProps, no_dispatch, TOwnProps>(
|
||||
export declare function connect<TStateProps = {}, no_dispatch = {}, TOwnProps = {}>(
|
||||
mapStateToProps: MapStateToPropsParam<TStateProps, TOwnProps>,
|
||||
mapDispatchToProps: null | undefined,
|
||||
mergeProps: null | undefined,
|
||||
options: Options<TStateProps, TOwnProps>
|
||||
): InferableComponentEnhancerWithProps<DispatchProp<any> & TStateProps, TOwnProps>;
|
||||
|
||||
export declare function connect<no_state, TDispatchProps, TOwnProps>(
|
||||
export declare function connect<no_state = {}, TDispatchProps = {}, TOwnProps = {}>(
|
||||
mapStateToProps: null | undefined,
|
||||
mapDispatchToProps: MapDispatchToPropsParam<TDispatchProps, TOwnProps>,
|
||||
mergeProps: null | undefined,
|
||||
options: Options<no_state, TOwnProps>
|
||||
): InferableComponentEnhancerWithProps<TDispatchProps, TOwnProps>;
|
||||
|
||||
export declare function connect<TStateProps, TDispatchProps, TOwnProps>(
|
||||
export declare function connect<TStateProps = {}, TDispatchProps = {}, TOwnProps = {}>(
|
||||
mapStateToProps: MapStateToPropsParam<TStateProps, TOwnProps>,
|
||||
mapDispatchToProps: MapDispatchToPropsParam<TDispatchProps, TOwnProps>,
|
||||
mergeProps: null | undefined,
|
||||
options: Options<TStateProps, TOwnProps>
|
||||
): InferableComponentEnhancerWithProps<TStateProps & TDispatchProps, TOwnProps>;
|
||||
|
||||
export declare function connect<TStateProps, TDispatchProps, TOwnProps, TMergedProps>(
|
||||
export declare function connect<TStateProps = {}, TDispatchProps = {}, TOwnProps = {}, TMergedProps = {}>(
|
||||
mapStateToProps: MapStateToPropsParam<TStateProps, TOwnProps>,
|
||||
mapDispatchToProps: MapDispatchToPropsParam<TDispatchProps, TOwnProps>,
|
||||
mergeProps: MergeProps<TStateProps, TDispatchProps, TOwnProps, TMergedProps>,
|
||||
@@ -141,7 +142,7 @@ interface MapStateToPropsFactory<TStateProps, TOwnProps> {
|
||||
(initialState: any, ownProps: TOwnProps): MapStateToProps<TStateProps, TOwnProps>;
|
||||
}
|
||||
|
||||
type MapStateToPropsParam<TStateProps, TOwnProps> = MapStateToProps<TStateProps, TOwnProps> | MapStateToPropsFactory<TStateProps, TOwnProps>;
|
||||
type MapStateToPropsParam<TStateProps, TOwnProps> = MapStateToPropsFactory<TStateProps, TOwnProps> | MapStateToProps<TStateProps, TOwnProps> | null | undefined;
|
||||
|
||||
interface MapDispatchToPropsFunction<TDispatchProps, TOwnProps> {
|
||||
(dispatch: Dispatch<any>, ownProps: TOwnProps): TDispatchProps;
|
||||
@@ -154,7 +155,7 @@ interface MapDispatchToPropsFactory<TDispatchProps, TOwnProps> {
|
||||
(dispatch: Dispatch<any>, ownProps: TOwnProps): MapDispatchToProps<TDispatchProps, TOwnProps>;
|
||||
}
|
||||
|
||||
type MapDispatchToPropsParam<TDispatchProps, TOwnProps> = MapDispatchToProps<TDispatchProps, TOwnProps> | MapDispatchToPropsFactory<TDispatchProps, TOwnProps>;
|
||||
type MapDispatchToPropsParam<TDispatchProps, TOwnProps> = MapDispatchToPropsFactory<TDispatchProps, TOwnProps> | MapDispatchToProps<TDispatchProps, TOwnProps>;
|
||||
|
||||
interface MergeProps<TStateProps, TDispatchProps, TOwnProps, TMergedProps> {
|
||||
(stateProps: TStateProps, dispatchProps: TDispatchProps, ownProps: TOwnProps): TMergedProps;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { Component, ReactElement } from 'react';
|
||||
import * as React from 'react';
|
||||
import * as ReactDOM from 'react-dom';
|
||||
import { Store, Dispatch, ActionCreator, bindActionCreators } from 'redux';
|
||||
import { Store, Dispatch, ActionCreator, bindActionCreators, ActionCreatorsMapObject } from 'redux';
|
||||
import { connect, Provider, DispatchProp, MapStateToProps } from 'react-redux';
|
||||
import objectAssign = require('object-assign');
|
||||
|
||||
@@ -10,6 +10,265 @@ import objectAssign = require('object-assign');
|
||||
// https://github.com/rackt/react-redux/blob/master/docs/quick-start.md#quick-start
|
||||
//
|
||||
|
||||
// Test cases written in a way to isolate types and variables and verify the
|
||||
// output of `connect` to make sure the signature is what is expected
|
||||
|
||||
namespace Empty {
|
||||
interface OwnProps { foo: string, dispatch: Dispatch<any> }
|
||||
|
||||
class TestComponent extends Component<OwnProps> {}
|
||||
|
||||
const Test = connect()(TestComponent)
|
||||
|
||||
const verify = <Test foo='bar' />
|
||||
}
|
||||
|
||||
namespace MapState {
|
||||
interface OwnProps { foo: string }
|
||||
interface StateProps { bar: number }
|
||||
|
||||
class TestComponent extends Component<OwnProps & StateProps> {}
|
||||
|
||||
const mapStateToProps = (_: any) => ({
|
||||
bar: 1
|
||||
})
|
||||
|
||||
const Test = connect(
|
||||
mapStateToProps
|
||||
)(TestComponent)
|
||||
|
||||
const verify = <Test foo='bar' />
|
||||
}
|
||||
|
||||
namespace MapStateWithDispatchProp {
|
||||
interface OwnProps { foo: string }
|
||||
interface StateProps { bar: number, dispatch: Dispatch<any> }
|
||||
|
||||
class TestComponent extends Component<OwnProps & StateProps> {}
|
||||
|
||||
const mapStateToProps = (_: any) => ({
|
||||
bar: 1
|
||||
})
|
||||
|
||||
const Test = connect(
|
||||
mapStateToProps
|
||||
)(TestComponent)
|
||||
|
||||
const verify = <Test foo='bar' />
|
||||
}
|
||||
|
||||
namespace MapStateFactory {
|
||||
interface OwnProps { foo: string }
|
||||
interface StateProps { bar: number }
|
||||
|
||||
class TestComponent extends Component<OwnProps & StateProps> {}
|
||||
|
||||
const mapStateToProps = () => () => ({
|
||||
bar: 1
|
||||
})
|
||||
|
||||
const Test = connect(
|
||||
mapStateToProps
|
||||
)(TestComponent)
|
||||
|
||||
const verify = <Test foo='bar' />
|
||||
}
|
||||
|
||||
namespace MapDispatch {
|
||||
interface OwnProps { foo: string }
|
||||
interface DispatchProps { onClick: () => void }
|
||||
|
||||
class TestComponent extends Component<OwnProps & DispatchProps> {}
|
||||
|
||||
const mapDispatchToProps = () => ({
|
||||
onClick: () => {}
|
||||
})
|
||||
|
||||
const TestNull = connect(
|
||||
null,
|
||||
mapDispatchToProps,
|
||||
)(TestComponent)
|
||||
|
||||
const verifyNull = <TestNull foo='bar' />
|
||||
|
||||
const TestUndefined = connect(
|
||||
undefined,
|
||||
mapDispatchToProps,
|
||||
)(TestComponent)
|
||||
|
||||
const verifyUndefined = <TestUndefined foo='bar' />
|
||||
}
|
||||
|
||||
namespace MapStateAndDispatchObject {
|
||||
interface ClickPayload { count: number }
|
||||
const onClick: ActionCreator<ClickPayload> = () => ({ count: 1 });
|
||||
const dispatchToProps = {
|
||||
onClick,
|
||||
};
|
||||
|
||||
interface OwnProps { foo: string }
|
||||
interface StateProps { bar: number }
|
||||
interface DispatchProps { onClick: ActionCreator<ClickPayload> }
|
||||
|
||||
const mapStateToProps = (_: any, __: OwnProps): StateProps => ({
|
||||
bar: 1
|
||||
})
|
||||
|
||||
class TestComponent extends Component<OwnProps & StateProps & DispatchProps> {}
|
||||
|
||||
const Test = connect(
|
||||
mapStateToProps,
|
||||
dispatchToProps,
|
||||
)(TestComponent)
|
||||
|
||||
const verify = <Test foo='bar' />
|
||||
}
|
||||
|
||||
namespace MapDispatchFactory {
|
||||
interface OwnProps { foo: string }
|
||||
interface DispatchProps { onClick: () => void }
|
||||
|
||||
class TestComponent extends Component<OwnProps & DispatchProps> {}
|
||||
|
||||
const mapDispatchToPropsFactory = () => () => ({
|
||||
onClick: () => {}
|
||||
})
|
||||
|
||||
const TestNull = connect(
|
||||
null,
|
||||
mapDispatchToPropsFactory,
|
||||
)(TestComponent)
|
||||
|
||||
const verifyNull = <TestNull foo='bar' />
|
||||
|
||||
const TestUndefined = connect(
|
||||
undefined,
|
||||
mapDispatchToPropsFactory,
|
||||
)(TestComponent)
|
||||
|
||||
const verifyUndefined = <TestUndefined foo='bar' />
|
||||
}
|
||||
|
||||
namespace MapStateAndDispatch {
|
||||
interface OwnProps { foo: string }
|
||||
interface StateProps { bar: number }
|
||||
interface DispatchProps { onClick: () => void }
|
||||
|
||||
class TestComponent extends Component<OwnProps & StateProps & DispatchProps> {}
|
||||
|
||||
const mapStateToProps = () => ({
|
||||
bar: 1
|
||||
})
|
||||
|
||||
const mapDispatchToProps = () => ({
|
||||
onClick: () => {}
|
||||
})
|
||||
|
||||
const Test = connect(
|
||||
mapStateToProps,
|
||||
mapDispatchToProps,
|
||||
)(TestComponent)
|
||||
|
||||
const verify = <Test foo='bar' />
|
||||
}
|
||||
|
||||
namespace MapStateFactoryAndDispatch {
|
||||
interface OwnProps { foo: string }
|
||||
interface StateProps { bar: number }
|
||||
interface DispatchProps { onClick: () => void }
|
||||
|
||||
const mapStateToPropsFactory = () => () =>({
|
||||
bar: 1
|
||||
})
|
||||
|
||||
const mapDispatchToProps = () => ({
|
||||
onClick: () => {}
|
||||
})
|
||||
|
||||
class TestComponent extends Component<OwnProps & StateProps & DispatchProps> {}
|
||||
|
||||
const Test = connect(
|
||||
mapStateToPropsFactory,
|
||||
mapDispatchToProps,
|
||||
)(TestComponent)
|
||||
|
||||
const verify = <Test foo='bar' />
|
||||
}
|
||||
|
||||
namespace MapStateFactoryAndDispatchFactory {
|
||||
interface OwnProps { foo: string }
|
||||
interface StateProps { bar: number }
|
||||
interface DispatchProps { onClick: () => void }
|
||||
|
||||
const mapStateToPropsFactory = () => () =>({
|
||||
bar: 1
|
||||
})
|
||||
|
||||
const mapDispatchToPropsFactory = () => () => ({
|
||||
onClick: () => {}
|
||||
})
|
||||
|
||||
class TestComponent extends Component<OwnProps & StateProps & DispatchProps> {}
|
||||
|
||||
const Test = connect(
|
||||
mapStateToPropsFactory,
|
||||
mapDispatchToPropsFactory,
|
||||
)(TestComponent)
|
||||
|
||||
const verify = <Test foo='bar' />
|
||||
}
|
||||
|
||||
namespace MapStateAndDispatchAndMerge {
|
||||
interface OwnProps { foo: string }
|
||||
interface StateProps { bar: number }
|
||||
interface DispatchProps { onClick: () => void }
|
||||
|
||||
class TestComponent extends Component<OwnProps & StateProps & DispatchProps> {}
|
||||
|
||||
const mapStateToProps = () => ({
|
||||
bar: 1
|
||||
})
|
||||
|
||||
const mapDispatchToProps = () => ({
|
||||
onClick: () => {}
|
||||
})
|
||||
|
||||
const mergeProps = (stateProps: StateProps, dispatchProps: DispatchProps) => (
|
||||
Object.assign({}, stateProps, dispatchProps)
|
||||
)
|
||||
|
||||
const Test = connect(
|
||||
mapStateToProps,
|
||||
mapDispatchToProps,
|
||||
mergeProps,
|
||||
)(TestComponent)
|
||||
|
||||
const verify = <Test foo='bar' />
|
||||
}
|
||||
|
||||
namespace MapStateAndOptions {
|
||||
interface OwnProps { foo: string }
|
||||
interface StateProps { bar: number }
|
||||
interface DispatchProps { dispatch: Dispatch<any> }
|
||||
|
||||
class TestComponent extends Component<OwnProps & StateProps & DispatchProps> {}
|
||||
|
||||
const mapStateToProps = () => ({
|
||||
bar: 1
|
||||
})
|
||||
|
||||
const Test = connect(
|
||||
mapStateToProps,
|
||||
null,
|
||||
null,
|
||||
{
|
||||
pure: true
|
||||
}
|
||||
)(TestComponent)
|
||||
|
||||
const verify = <Test foo='bar' />
|
||||
}
|
||||
|
||||
interface CounterState {
|
||||
counter: number;
|
||||
}
|
||||
@@ -57,7 +316,7 @@ interface ICounterDispatchProps {
|
||||
onIncrement: () => void
|
||||
}
|
||||
// with higher order functions
|
||||
connect<ICounterStateProps, ICounterDispatchProps, {}>(
|
||||
connect<ICounterStateProps, ICounterDispatchProps>(
|
||||
() => mapStateToProps,
|
||||
() => mapDispatchToProps
|
||||
)(Counter);
|
||||
@@ -67,11 +326,11 @@ connect<ICounterStateProps, ICounterDispatchProps, {}>(
|
||||
(dispatch: Dispatch<CounterState>, ownProps) => mapDispatchToProps
|
||||
)(Counter);
|
||||
// only first argument
|
||||
connect<ICounterStateProps, {}, {}>(
|
||||
connect<ICounterStateProps>(
|
||||
() => mapStateToProps
|
||||
)(Counter);
|
||||
// wrap only one argument
|
||||
connect<ICounterStateProps, ICounterDispatchProps, {}>(
|
||||
connect<ICounterStateProps, ICounterDispatchProps>(
|
||||
mapStateToProps,
|
||||
() => mapDispatchToProps
|
||||
)(Counter);
|
||||
@@ -569,3 +828,25 @@ namespace TestDispatchToPropsAsObject {
|
||||
const Header = connect(mapStateToProps, dispatchToProps)(HeaderComponent);
|
||||
<Header />
|
||||
}
|
||||
|
||||
namespace TestWrappedComponent {
|
||||
type InnerProps = {
|
||||
name: string,
|
||||
};
|
||||
const Inner: React.StatelessComponent<InnerProps> = (props) => {
|
||||
return <h1>{props.name}</h1>;
|
||||
}
|
||||
|
||||
const mapStateToProps = (state: any) => {
|
||||
return {
|
||||
name: "Connected",
|
||||
};
|
||||
};
|
||||
const Connected = connect(mapStateToProps)(Inner);
|
||||
|
||||
// `Inner` and `Connected.WrappedComponent` require explicit `name` prop
|
||||
const TestInner = (props: any) => <Inner name="Inner" />;
|
||||
const TestWrapped = (props: any) => <Connected.WrappedComponent name="Wrapped" />;
|
||||
// `Connected` does not require explicit `name` prop
|
||||
const TestConnected = (props: any) => <Connected />;
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user