Merge remote-tracking branch 'upstream/master'

This commit is contained in:
clarenceh
2017-06-28 10:20:14 +08:00
47 changed files with 1352 additions and 336 deletions
+1 -1
View File
@@ -17,7 +17,7 @@
"scripts": {
"compile-scripts": "tsc -p scripts",
"not-needed": "node scripts/not-needed.js",
"test": "node node_modules/types-publisher/bin/tester/test.js --run-from-definitely-typed --nProcesses 1",
"test": "node node_modules/types-publisher/bin/tester/test.js --run-from-definitely-typed --nProcesses 4",
"lint": "dtslint types"
},
"devDependencies": {
+3 -1
View File
@@ -1,3 +1,4 @@
// Project: http://jquery.com/
// Definitions by: Boris Yankov <https://github.com/borisyankov/>
// Christian Hoffmeister <https://github.com/choffmeister>
// Steve Fenton <https://github.com/Steve-Fenton>
@@ -19,6 +20,7 @@
// Dick van den Brink <https://github.com/DickvdBrink>
// Thomas Schulz <https://github.com/King2500>
// Leonard Thieu <https://github.com/leonard-thieu>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// Definitions copied from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/0480c5ec87fab41aa23047a02b27f0ea71aaf975/types/jquery/v2/index.d.ts
@@ -664,7 +666,7 @@ interface JQuery {
}
interface JQueryStatic {
(element: string | Element): JQuery;
(element: string | Element | Document): JQuery;
}
/**
@@ -0,0 +1,11 @@
import nextTick from 'async.nexttick';
function calledOnNextTick(a: string): number {
return parseInt(a, 10);
}
const aString = 'Hi!';
nextTick(() => {
calledOnNextTick(aString);
});
+6
View File
@@ -0,0 +1,6 @@
// Type definitions for async.nexttick 0.5
// Project: https://www.npmjs.com/package/async.nexttick
// Definitions by: Damien "pyrho" Rajon <https://github.com/pyrho>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
export default function nextTick(callback: () => void, ...args: any[]): void;
+24
View File
@@ -0,0 +1,24 @@
{
"compilerOptions": {
"target": "es6",
"module": "commonjs",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"async.nexttick-tests.ts"
]
}
+3
View File
@@ -0,0 +1,3 @@
{
"extends": "dtslint/dt.json"
}
@@ -0,0 +1,12 @@
import 'browser-report';
function test_sync() {
var browserInfo = window.browserReportSync();
console.log(browserInfo.browser.name);
}
function test_async() {
window.browserReport((error, result) => {
console.log(result.ip + ' ' + result.browser.name);
});
}
+56
View File
@@ -0,0 +1,56 @@
// Type definitions for browser-report v2.2.9
// Project: https://github.com/JTOne123/browser-report
// Definitions by: Paul Datsiuk <https://github.com/JTOne123>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
interface Window {
browserReport(result: (error: ErrorEvent, report: ReportResult) => any): void;
browserReportSync(): ReportResult;
}
interface ReportResult {
"browser": {
"name": string,
"version": string
},
"cookies": boolean,
"flash": {
"version": string
},
"ip": string,
"country": {
"name": string,
"code": string,
"city": string,
"latitude" : string,
"longitude": string,
"timezone": string
},
"java": {
"version": string
},
"lang": Array<string>,
"os": {
"name": string,
"version": string
},
"screen": {
"colors": number,
"dppx": number,
"height": number,
"width": number
},
"scripts": boolean,
"timestamp": string,
"userAgent": string,
"viewport": {
"height": number,
"layout": {
"height": number,
"width": number
}
"width": number,
"zoom": number
}
"websockets": boolean
}
+23
View File
@@ -0,0 +1,23 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6",
"dom"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": false,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"browser-report-tests.ts"
]
}
+33
View File
@@ -145,3 +145,36 @@ secret.remove((err, response) => {
secret.update((err, response) => {
// NOOP
});
const node = docker.getNode('nodeName');
node.inspect((err, reponse) => {
// NOOP
});
node.inspect().then(response => {
// NOOP
});
node.update({}, (err, response) => {
// NOOP
});
node.update((err, response) => {
// NOOP
});
node.update({}).then(response => {
// NOOP;
});
node.remove({}, (err, response) => {
// NOOP
});
node.remove((err, response) => {
// NOOP
});
node.remove({}).then(response => {
// NOOP;
});
+8
View File
@@ -170,6 +170,14 @@ declare namespace Dockerode {
inspect(callback: Callback<any>): void;
inspect(): Promise<any>;
update(options: {}, callback: Callback<any>): void;
update(callback: Callback<any>): void;
update(options?: {}): Promise<any>;
remove(options: {}, callback: Callback<any>): void;
remove(callback: Callback<any>): void;
remove(options?: {}): Promise<any>;
modem: any;
id?: string;
}
+1 -1
View File
@@ -3086,7 +3086,7 @@ interface ITextOptions extends IObjectOptions {
textBackgroundColor?: string;
path?: string;
useNative?: Boolean;
useNative?: boolean;
text?: string;
}
export interface Text extends ITextOptions {}
+273 -237
View File
@@ -6,8 +6,24 @@
/// <reference types="gapi" />
declare namespace gapi.client.drive {
export namespace files {
declare namespace gapi.client {
export module drive {
const files: {
get: (parameters: GetParameters) => HttpRequest<FileResource>;
patch: (parameters: PatchParameters) => HttpRequest<FileResource>;
copy: (parameters: CopyParameters) => HttpRequest<FileResource>;
delete: (parameters: DeleteParameters) => HttpRequest<any>;
emptyTrash: () => HttpRequest<any>;
export: (parameters: ExportParameters) => HttpRequest<FileResource>;
generateIds: (parameters: GenerateIdsParameters) => HttpRequest<IdsResource>;
insert: (parameters: InsertParameters) => HttpRequest<FileResource>;
list: (parameters: ListParameters) => HttpRequest<FileListResource>;
touch: (parameters: TouchParameters) => HttpRequest<FileResource>;
trash: (parameters: TrashParameters) => HttpRequest<FileResource>;
untrash: (parameters: UntrashParameters) => HttpRequest<FileResource>;
watch: (parameters: WatchParameters) => HttpRequest<ChannelResource>;
}
interface GetParameters {
fileId: string;
acknowledgeAbuse?: boolean;
@@ -17,8 +33,6 @@ declare namespace gapi.client.drive {
updateViewedDate?: boolean;
}
export function get(parameters: GetParameters): HttpRequest<FileResource>;
interface PatchParameters {
fileId: string;
resource?: FileResource
@@ -37,8 +51,6 @@ declare namespace gapi.client.drive {
useContentAsIndexableText?: boolean;
}
export function patch(parameters: PatchParameters): HttpRequest<FileResource>;
interface CopyParameters {
fileId: string;
resource?: FileResource;
@@ -52,13 +64,39 @@ declare namespace gapi.client.drive {
visibility?: string;
}
export function copy(parameters: CopyParameters): HttpRequest<FileResource>;
interface DeleteParameters {
fileId: string;
supportsTeamDrives?: boolean;
}
interface ExportParameters {
fileId: string;
mimeType: string;
}
interface GenerateIdsParameters {
maxResults?: number;
space?: string;
}
interface InsertParameters {
uploadType: string;
convert?: boolean;
ocr?: boolean;
ocrLanguage?: string;
pinned?: boolean;
supportsTeamDrives?: boolean;
timedTextLanguage?: string;
timedTextTrackName?: string;
usecontentAsIndexableText?: boolean;
visibility?: string;
}
interface ListParameters {
corpora?: string;
corpus?: string;
includeTeamDriveItems?: boolean;
maxResults: number;
maxResults?: number;
orderBy?: string;
pageToken?: string;
projection?: string;
@@ -68,28 +106,22 @@ declare namespace gapi.client.drive {
teamDriveId?: string;
}
export function list(parameters: ListParameters): HttpRequest<FileListResource>;
interface TouchParameters {
fileId: string;
supportsTeamDrives?: boolean;
}
export function touch(parameters: TouchParameters): HttpRequest<FileResource>;
interface TrashParameters {
fileId: string;
supportsTeamDrives?: boolean;
}
export function trash(parameters: TrashParameters): HttpRequest<FileResource>;
interface UntrashParameters {
fileId: string;
supportsTeamDrives?: boolean;
}
export function untrash(parameters: UntrashParameters): HttpRequest<FileResource>;
interface WatchParameters {
fileId: string;
@@ -98,239 +130,243 @@ declare namespace gapi.client.drive {
supportsTeamDrives?: boolean;
}
export function watch(parameters: WatchParameters): HttpRequest<ChannelResource>;
}
export interface FileResource {
kind: 'drive#file';
id?: string;
// etag
selfLink?: string;
webContentLink?: string;
webViewLink?: string;
alternateLink?: string;
embedLink?: string;
// openWithLinks
defaultOpenWithLink?: string;
iconLink?: string;
hasThumbnail?: boolean;
thumbnailLink?: string;
thumbnail?: {
image: Uint8Array;
mimType: string;
};
title?: string;
mimeType?: string;
description?: string;
labels?: {
starred?: boolean;
hidden?: boolean;
trashed?: boolean;
restricted?: boolean;
viewed?: boolean;
modified?: boolean;
};
createdDate?: Date;
modifiedDate?: Date;
modifiedByMeDate?: Date;
lastViewedByMeDate?: Date;
markedViewedByMeDate?: Date;
sharedWithMeDate?: Date;
version?: number;
sharingUser?: {
kind: 'drive#user';
displayName?: string;
picture?: {
url: string;
interface FileResource {
kind: 'drive#file';
id: string;
etag: string;
selfLink: string;
webContentLink: string;
webViewLink: string;
alternateLink: string;
embedLink: string;
// openWithLinks
defaultOpenWithLink: string;
iconLink: string;
hasThumbnail: boolean;
thumbnailLink: string;
thumbnail: {
image: Uint8Array;
mimType: string;
};
isAuthenticatedUser?: boolean;
permissionId?: string;
emailAddress?: string;
};
parents?: ParentResource[];
downloadUrl?: string;
// exportLinks
indexableText?: {
text: string;
};
userPermission?: PermissionResource;
permissions?: PermissionResource[];
hasAugmentedPermissions?: boolean;
originalFilename?: string;
fileExtension?: string;
fullFileExtension?: string;
md5Checksum?: string;
fileSize?: number;
quotaBytesUsed?: number;
ownerNames?: string[];
owners?: {
kind: 'drive#user';
displayName?: string;
picture?: {
url: string;
title: string;
mimeType: string;
description: string;
labels: {
starred: boolean;
hidden: boolean;
trashed: boolean;
restricted: boolean;
viewed: boolean;
modified: boolean;
};
isAuthenticatedUser?: boolean;
permissionId?: string;
emailAddress?: string;
}[];
teamDriveId?: string;
lastModifyingUserName?: string;
lastModifyingUser?: {
kind: 'drive#user';
displayName?: string;
picture?: {
url: string;
createdDate: Date;
modifiedDate: Date;
modifiedByMeDate: Date;
lastViewedByMeDate: Date;
markedViewedByMeDate: Date;
sharedWithMeDate: Date;
version: number;
sharingUser: {
kind: 'drive#user';
displayName: string;
picture: {
url: string;
};
isAuthenticatedUser: boolean;
permissionId: string;
emailAddress: string;
};
isAuthenticatedUser?: boolean;
permissionId?: string;
emailAddress?: string;
};
ownedByMe?: boolean;
capabilities?: {
canAddChildren?: boolean;
canChangeRestrictedDownload?: boolean;
canComment?: boolean;
canCopy?: boolean;
canDelete?: boolean;
canDownload?: boolean;
canEdit?: boolean;
canListChildren?: boolean;
canMoveItemIntoTeamDrive?: boolean;
canMoveTeamDriveItem?: boolean;
canReadRevisions?: boolean;
canReadTeamDrive?: boolean;
canRemoveChildren?: boolean;
canRename?: boolean;
canShare?: boolean;
canTrash?: boolean;
canUntrash?: boolean;
};
editable?: boolean;
canComment?: boolean;
canReadRevisions?: boolean;
shareable?: boolean;
copyable?: boolean;
writersCanShare?: boolean;
shared?: boolean;
explicitlyTrashed?: boolean;
trashingUser?: {
kind: 'drive#user';
displayName?: string;
picture?: {
url: string;
parents: ParentResource[];
downloadUrl: string;
// exportLinks
indexableText: {
text: string;
};
isAuthenticatedUser?: boolean;
permissionId?: string;
emailAddress?: string;
};
trashedDate?: Date;
appDataContents?: boolean;
headRevisionId?: string;
properties?: PropertiesResource[];
folderColorRgb?: string;
imageMediaMetadata?: {
width?: number;
height?: number;
rotation?: number;
location?: {
latitude?: number;
longitude?: number;
altitude?: number;
userPermission: PermissionResource;
permissions: PermissionResource[];
hasAugmentedPermissions: boolean;
originalFilename: string;
fileExtension: string;
fullFileExtension: string;
md5Checksum: string;
fileSize: number;
quotaBytesUsed: number;
ownerNames: string[];
owners: {
kind: 'drive#user';
displayName: string;
picture: {
url: string;
};
isAuthenticatedUser: boolean;
permissionId: string;
emailAddress: string;
}[];
teamDriveId: string;
lastModifyingUserName: string;
lastModifyingUser: {
kind: 'drive#user';
displayName: string;
picture: {
url: string;
};
isAuthenticatedUser: boolean;
permissionId: string;
emailAddress: string;
};
date?: string;
cameraMake?: string;
cameraModel?: string;
exposureTime?: number;
aperture?: number;
flashUsed?: boolean;
focalLength?: number;
isoSpeed?: number;
meteringMode?: string;
sensor?: string;
exposureMode?: string;
colorSpace?: string;
whiteBalance?: string;
exposureBias?: number;
maxApertureValue?: number;
subjectDistance?: number;
lens?: string;
};
videoMediaMetadata?: {
width?: number;
height?: number;
durationMillis?: number;
};
spaces?: string[];
isAppAuthorized?: boolean;
}
ownedByMe: boolean;
capabilities: {
canAddChildren: boolean;
canChangeRestrictedDownload: boolean;
canComment: boolean;
canCopy: boolean;
canDelete: boolean;
canDownload: boolean;
canEdit: boolean;
canListChildren: boolean;
canMoveItemIntoTeamDrive: boolean;
canMoveTeamDriveItem: boolean;
canReadRevisions: boolean;
canReadTeamDrive: boolean;
canRemoveChildren: boolean;
canRename: boolean;
canShare: boolean;
canTrash: boolean;
canUntrash: boolean;
};
editable: boolean;
canComment: boolean;
canReadRevisions: boolean;
shareable: boolean;
copyable: boolean;
writersCanShare: boolean;
shared: boolean;
explicitlyTrashed: boolean;
trashingUser: {
kind: 'drive#user';
displayName: string;
picture: {
url: string;
};
isAuthenticatedUser: boolean;
permissionId: string;
emailAddress: string;
};
trashedDate: Date;
appDataContents: boolean;
headRevisionId: string;
properties: PropertiesResource[];
folderColorRgb: string;
imageMediaMetadata: {
width: number;
height: number;
rotation: number;
location: {
latitude: number;
longitude: number;
altitude: number;
};
date: string;
cameraMake: string;
cameraModel: string;
exposureTime: number;
aperture: number;
flashUsed: boolean;
focalLength: number;
isoSpeed: number;
meteringMode: string;
sensor: string;
exposureMode: string;
colorSpace: string;
whiteBalance: string;
exposureBias: number;
maxApertureValue: number;
subjectDistance: number;
lens: string;
};
videoMediaMetadata: {
width: number;
height: number;
durationMillis: number;
};
spaces: string[];
isAppAuthorized: boolean;
}
export interface FileListResource {
kind: 'drive#fileList';
// etag
selfLink?: string;
nextPageToken?: string;
nextLink?: string;
incompleteSearch?: boolean;
items: FileResource[];
}
interface FileListResource {
kind: 'drive#fileList';
etag: string;
selfLink: string;
nextPageToken: string;
nextLink: string;
incompleteSearch: boolean;
items: FileResource[];
}
export interface ParentResource {
kind: 'drive#parentReference';
id?: string;
selfLink?: string;
parentLink?: string;
isRoot?: boolean;
}
interface ParentResource {
kind: 'drive#parentReference';
id: string;
selfLink: string;
parentLink: string;
isRoot: boolean;
}
export interface PermissionResource {
kind: 'drive#permission';
// etag
id?: string;
selfLink?: string;
name?: string;
emailAddress?: string;
domain?: string;
role?: string;
additionalRoles?: string[];
type?: string;
value?: string;
authKey?: string;
withLink?: boolean;
photoLink?: string;
expirationDate?: Date;
teamDrivePermissionDetails?: {
teamDrivePermissionType?: string;
role?: string;
additionalRoles?: string[];
inheritedFrom?: string;
inherited?: boolean;
}[];
deleted?: boolean;
}
interface PermissionResource {
kind: 'drive#permission';
etag: string;
id: string;
selfLink: string;
name: string;
emailAddress: string;
domain: string;
role: string;
additionalRoles: string[];
type: string;
value: string;
authKey: string;
withLink: boolean;
photoLink: string;
expirationDate: Date;
teamDrivePermissionDetails: {
teamDrivePermissionType: string;
role: string;
additionalRoles: string[];
inheritedFrom: string;
inherited: boolean;
}[];
deleted: boolean;
}
export interface PropertiesResource {
kind: 'drive$property';
// etag
selfLink?: string;
key?: string;
visibility?: string;
value?: string;
}
interface PropertiesResource {
kind: 'drive$property';
etag: string;
selfLink: string;
key: string;
visibility: string;
value: string;
}
export interface WatchResource {
id?: string;
expiration?: number;
token?: string;
type?: string;
address?: string;
}
interface WatchResource {
id: string;
expiration: number;
token: string;
type: string;
address: string;
}
export interface ChannelResource {
kind: 'api#channel';
id?: string;
resourceId?: string;
resourceUri?: string;
token?: string;
expiration?: number;
interface ChannelResource {
kind: 'api#channel';
id: string;
resourceId: string;
resourceUri: string;
token: string;
expiration: number;
}
interface IdsResource {
kind: 'drive#generatedIds';
space: string;
ids: string[];
}
}
}
+3 -3
View File
@@ -8,11 +8,11 @@ export function formatError(error: GraphQLError): GraphQLFormattedError;
export type GraphQLFormattedError = {
message: string,
locations: Array<GraphQLErrorLocation>,
path: Array<string | number>
locations?: Array<GraphQLErrorLocation>,
path?: Array<string | number>
};
export type GraphQLErrorLocation = {
line: number,
column: number
};
};
@@ -0,0 +1,32 @@
import {IFrameComponent, IFrameOptions, iframeResizer} from "iframe-resizer";
function testOne(): void {
let iframe: HTMLIFrameElement = document.createElement('iframe');
let options: IFrameOptions = {log: true};
let components: IFrameComponent[] = iframeResizer(options, iframe);
if (components) {
components.forEach(component => console.log(component.iFrameResizer));
} else {
console.log("No components");
}
}
function testTwo(): void {
let iframe: HTMLIFrameElement = document.createElement('iframe');
let components: IFrameComponent[] = iframeResizer({
initCallback: () => {
console.log('Init');
},
closedCallback: () => {
console.log('Closed');
}
}, iframe);
if (components) {
components.forEach(component => console.log(component.iFrameResizer));
} else {
console.log("No components");
}
}
testOne();
testTwo();
+196
View File
@@ -0,0 +1,196 @@
// Type definitions for iframe-resizer 3.5
// Project: https://github.com/davidjbradshaw/iframe-resizer
// Definitions by: Armin Baljic <https://github.com/arminbaljic>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// tslint:disable:prefer-method-signature
// tslint:disable-next-line:no-single-declare-module
declare module 'iframe-resizer' {
// tslint:disable-next-line:interface-name
interface IFrameObject {
close(): void;
moveToAnchor(anchor: string): void;
resize(): void;
sendMessage(message: any): void;
}
// tslint:disable-next-line:interface-name
interface IFrameComponent extends HTMLIFrameElement {
iFrameResizer: IFrameObject;
}
// tslint:disable-next-line:interface-name
interface IFrameOptions {
/**
* When enabled changes to the Window size or the DOM will cause the iFrame to resize to the new content size.
* Disable if using size method with custom dimensions.
*/
autoResize?: boolean;
/**
* Override the body background style in the iFrame.
*/
bodyBackground?: string;
/**
* Override the default body margin style in the iFrame. A string can be any valid value for the
* CSS margin attribute, for example '8px 3em'. A number value is converted into px.
*/
bodyMargin?: number;
/**
* When set to true, only allow incoming messages from the domain listed in the src property of the iFrame tag.
* If your iFrame navigates between different domains, ports or protocols; then you will need to
* provide an array of URLs or disable this option.
*/
checkOrigin?: boolean;
/**
* When enabled in page linking inside the iFrame and from the iFrame to the parent page will be enabled.
*/
inPageLinks?: boolean;
/**
* Height calculation method.
*/
heightCalculationMethod?: string;
/**
* Set iFrame Id
*/
id?: string;
/**
* In browsers that don't support mutationObserver, such as IE10, the library falls back to using
* setInterval, to check for changes to the page size.
*/
interval?: number;
/**
* Setting the log option to true will make the scripts in both the host page and the iFrame output
* everything they do to the JavaScript console so you can see the communication between the two scripts.
*/
log?: boolean;
/**
* Set maximum height of iFrame.
*/
maxHeight?: number;
/**
* Set maximum width of iFrame.
*/
maxWidth?: number;
/**
* Set minimum height of iFrame.
*/
minHeight?: number;
/**
* Set minimum width of iFrame.
*/
minWidth?: number;
/**
* Listen for resize events from the parent page, or the iFrame. Select the 'child' value if the iFrame
* can be resized independently of the browser window. Selecting this value can cause issues with some
* height calculation methods on mobile devices.
*/
resizeFrom?: string;
/**
* Enable scroll bars in iFrame.
*/
scrolling?: boolean;
/**
* Resize iFrame to content height.
*/
sizeHeight?: boolean;
/**
* Resize iFrame to content width.
*/
sizeWidth?: boolean;
/**
* Set the number of pixels the iFrame content size has to change by, before triggering a resize of the iFrame.
*/
tolerance?: number;
/**
* Width calculation method.
*/
widthCalculationMethod?: string;
/**
* Called when iFrame is closed via parentIFrame.close() or iframe.iframeResizer.close() methods.
*/
closedCallback?: (iframeId?: string) => void;
/**
* Initial setup callback function.
*/
initCallback?: (iframe?: IFrameComponent) => void;
/**
* Receive message posted from iFrame with the parentIFrame.sendMessage() method.
*/
messageCallback?: (data: IFrameMessageData) => void;
/**
* Function called after iFrame resized. Passes in messageData object containing the iFrame, height, width
* and the type of event that triggered the iFrame to resize.
*/
resizedCallback?: (data: IFrameResizedData) => void;
/**
* Called before the page is repositioned after a request from the iFrame, due to either an in page link,
* or a direct request from either parentIFrame.scrollTo() or parentIFrame.scrollToOffset().
* If this callback function returns false, it will stop the library from repositioning the page, so that
* you can implement your own animated page scrolling instead.
*/
scrollCallback?: (data: IFrameScrollData) => boolean;
}
// tslint:disable-next-line:interface-name
interface IFramePageOptions {
/**
* This option allows you to restrict the domain of the parent page,
* to prevent other sites mimicking your parent page.
*/
targetOrigin?: string;
/**
* Receive message posted from the parent page with the iframe.iFrameResizer.sendMessage() method.
*/
messageCallback?: (message: any) => void;
/**
* This function is called once iFrame-Resizer has been initialized after receiving a call from the parent page.
*/
readyCallback?: () => void;
/**
* These option can be used to override the option set in the parent page
*/
heightCalculationMethod?: string;
/**
* These option can be used to override the option set in the parent page
*/
widthCalculationMethod?: string;
}
// tslint:disable-next-line:interface-name
interface IFramePage {
autoResize(resize?: boolean): boolean;
close(): void;
getId(): string;
getPageInfo(callback: (data: any) => void | false): void;
scrollTo(x: number, y: number): void;
scrollToOffset(x: number, y: number): void;
sendMessage(message: any, targetOrigin: string): void;
setHeightCalculationMethod(method: string): void;
setWidthCalculationMethod(method: string): void;
setTargetOrigin(targetOrigin: string): void;
size(customHeight: string, customWidth: string): void;
}
// tslint:disable-next-line:interface-name
interface IFrameResizedData {
iframe: IFrameComponent;
height: number;
width: number;
type: string;
}
// tslint:disable-next-line:interface-name
interface IFrameMessageData {
iframe: IFrameComponent;
message: string;
}
// tslint:disable-next-line:interface-name
interface IFrameScrollData {
x: number;
y: number;
}
function iframeResizer(options: IFrameOptions, target: HTMLElement): IFrameComponent[];
}
// tslint:enable:prefer-method-signature
+26
View File
@@ -0,0 +1,26 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6",
"dom"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"exclude": [
"node_modules"
],
"files": [
"index.d.ts",
"iframe-resizer-tests.ts"
]
}
+3
View File
@@ -0,0 +1,3 @@
{
"extends": "dtslint/dt.json"
}
+3
View File
@@ -1,6 +1,7 @@
// Type definitions for jquery.fancytree 2.7.0
// Project: https://github.com/mar10/fancytree
// Definitions by: Peter Palotas <https://github.com/alphaleonis>
// Mahdi Abedi <https://github.com/abedi-ir>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
@@ -721,6 +722,8 @@ declare namespace Fancytree {
restore?(event: JQueryEventObject, data: EventData): void;
/** `data.node` was selected */
select?(event: JQueryEventObject, data: EventData): void;
/** Enable RTL version, default is false */
rtl?: boolean;
}
interface FancytreeOptions extends FancytreeEvents {
+1 -1
View File
@@ -16,8 +16,8 @@ declare namespace kendo {
names: string[];
namesAbbr: string[];
namesShort: string[];
firstDay: number;
};
firstDay: number;
months: {
names: string[];
namesAbbr: string[];
+5 -2
View File
@@ -1,4 +1,4 @@
// Type definitions for Mapbox GL JS v0.38.0
// Type definitions for Mapbox GL JS v0.39.0
// Project: https://github.com/mapbox/mapbox-gl-js
// Definitions by: Dominik Bruderer <https://github.com/dobrud>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
@@ -173,7 +173,7 @@ declare namespace mapboxgl {
keyboard: KeyboardHandler;
doublClickZoom: DoubleClickZoomHandler;
doubleClickZoom: DoubleClickZoomHandler;
touchZoomRotate: TouchZoomRotateHandler;
}
@@ -254,6 +254,9 @@ declare namespace mapboxgl {
/** Initial zoom level */
zoom?: number;
/** Maximum tile cache size for each layer. */
maxTileCacheSize?: number;
}
export interface PaddingOptions {
+59
View File
@@ -0,0 +1,59 @@
// Type definitions for @mapbox/shelf-pack 3.0
// Project: https://github.com/mapbox/shelf-pack
// Definitions by: Gyusun Yeom <https://github.com/Perlmint>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// tslint:disable-next-line no-single-declare-module
declare module "@mapbox/shelf-pack" {
export = ShelfPack;
class ShelfPack {
constructor(width?: number, height?: number, options?: ShelfPack.CreateOption);
pack(bins: Array<ShelfPack.RequestShort | ShelfPack.RequestLong>, options?: ShelfPack.PackOption): ShelfPack.Bin[];
packOne(w: number, h: number, id?: ShelfPack.ID): ShelfPack.Bin;
getBin(id: ShelfPack.ID): ShelfPack.Bin;
ref(bin: ShelfPack.Bin): number;
unref(bin: ShelfPack.Bin): number;
clear(): void;
resize(w: number, h: number): boolean;
w: number;
h: number;
}
namespace ShelfPack {
class Bin {
constructor(id: ID, x: number, y: number, w: number, h: number, maxw?: number, maxh?: number);
id: ID;
x: number;
y: number;
w: number;
h: number;
}
type ID = number | string;
interface Request {
id?: ID;
}
interface RequestShort extends Request {
w: number;
h: number;
}
interface RequestLong extends Request {
width: number;
height: number;
}
interface PackOption {
/// If true , the supplied bin objects will be updated inplace with x and y properties
inPlace?: boolean;
}
interface CreateOption {
/// If true , the sprite will automatically grow
autoResize?: boolean;
}
}
}
@@ -0,0 +1,30 @@
import * as ShelfPack from '@mapbox/shelf-pack';
let sprite = new ShelfPack(64, 64);
for (let i = 0; i < 5; i++) {
const bin = sprite.packOne(32, 32);
}
sprite.clear();
sprite.resize(128, 128);
sprite = new ShelfPack(64, 64);
[100, 101, 102].forEach(id => {
const bin = sprite.packOne(16, 16, id);
});
const bin102 = sprite.packOne(16, 16, 102);
const bin101 = sprite.getBin(101);
sprite.ref(bin101);
const bin100 = sprite.getBin(100);
sprite.unref(bin100);
const bin103 = sprite.packOne(16, 15, 103);
sprite.unref(bin103);
const bin104 = sprite.packOne(16, 16, 104);
+22
View File
@@ -0,0 +1,22 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"mapbox__shelf-pack-tests.ts"
]
}
+1
View File
@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }
+2
View File
@@ -942,6 +942,8 @@ declare namespace __MaterialUI {
utils?: propTypes.utils;
}
export class DatePicker extends React.Component<DatePickerProps> {
focus(): void;
openDialog(): void;
}
interface DatePickerDialogProps {
+2
View File
@@ -58,6 +58,8 @@ interface IConnection {
end(callback: (err: IError, ...args: any[]) => void): void;
end(options: any, callback: (err: IError, ...args: any[]) => void): void;
ping(callback: (err: IError) => void): void;
destroy(): void;
pause(): void;
+5
View File
@@ -148,6 +148,11 @@ connection.connect(function (err) {
console.log('connected as id ' + connection.threadId);
});
connection.ping(function (err) {
if (err) throw err;
console.log('Ping was successful');
})
/// Pools
var poolConfig = {
+7 -4
View File
@@ -1,17 +1,20 @@
// Type definitions for node-hid 0.5
// Project: https://github.com/node-hid/node-hid#readme
// Definitions by: Mohamed Hegazy <https://github.com/mhegazy>
// Robert Kiss <https://github.com/ert78gb>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
export interface Device {
vendorId: number;
productId: number;
path: string;
serialNumber: string;
manufacturer: string;
product: string;
path?: string;
serialNumber?: string;
manufacturer?: string;
product?: string;
release: number;
interface: number;
usagePage?: number;
usage?: number;
}
export class HID {
+7 -1
View File
@@ -6,6 +6,8 @@
// Roberto Desideri <https://github.com/RobDesideri>
// Christian Vaagland Tellnes <https://github.com/tellnes>
// Wilco Bakker <https://github.com/WilcoBakker>
// Nicolas Voigt <https://github.com/octo-sniffle>
// Chigozirim C. <https://github.com/smac89>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.2
@@ -307,7 +309,7 @@ declare namespace NodeJS {
export interface ReadableStream extends EventEmitter {
readable: boolean;
read(size?: number): string | Buffer;
setEncoding(encoding: string | null): this;
setEncoding(encoding: string): this;
pause(): this;
resume(): this;
isPaused(): boolean;
@@ -3827,6 +3829,8 @@ declare module "stream" {
end(): void;
end(chunk: any, cb?: Function): void;
end(chunk: any, encoding?: string, cb?: Function): void;
cork(): void;
uncork(): void;
/**
* Event emitter
@@ -3912,6 +3916,8 @@ declare module "stream" {
end(): void;
end(chunk: any, cb?: Function): void;
end(chunk: any, encoding?: string, cb?: Function): void;
cork(): void;
uncork(): void;
}
export interface TransformOptions extends DuplexOptions {
+1 -1
View File
@@ -157,7 +157,7 @@ export interface SelectRow {
Give an array data to perform which rows you want to be selected when table loading.
The content of array should be the rowkey which you want to be selected.
*/
selected?: string[];
selected?: string[] | number[];
/**
if true, the radio/checkbox column will be hide.
You can enable this attribute if you enable clickToSelect and you don't want to show the selection column.
+2
View File
@@ -847,6 +847,7 @@ declare namespace ReactBootstrap {
// <Badge />
interface BadgeProps extends React.HTMLProps<Badge> {
bsClass?: string;
pullRight?: boolean;
}
type Badge = React.ClassicComponent<BadgeProps>;
@@ -908,6 +909,7 @@ declare namespace ReactBootstrap {
responsive?: boolean;
striped?: boolean;
fill?: boolean;
bsClass?: string;
}
type Table = React.ClassicComponent<TableProps>;
var Table: React.ClassicComponentClass<TableProps>;
+1 -1
View File
@@ -9,7 +9,7 @@
import * as React from "react";
import * as moment from "moment";
interface ReactDatePickerProps {
export interface ReactDatePickerProps {
autoComplete?: string;
autoFocus?: boolean;
calendarClassName?: string;
+5 -3
View File
@@ -1,8 +1,10 @@
// Type definitions for react-native 0.44
// Project: https://github.com/facebook/react-native
// Definitions by: Eloy Durán <https://github.com/alloy>, Fedor Nezhivoi <https://github.com/gyzerok>,
// HuHuanming <https://github.com/huhuanming>, Jeremi Stadler <https://github.com/jeremistadler>,
// Kyle Roach <https://github.com/iRoachie>
// Definitions by: Eloy Durán <https://github.com/alloy>
// Fedor Nezhivoi <https://github.com/gyzerok>
// HuHuanming <https://github.com/huhuanming>
// Jeremi Stadler <https://github.com/jeremistadler>
// Kyle Roach <https://github.com/iRoachie>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
+41 -25
View File
@@ -4,6 +4,7 @@
// mhcgrq <https://github.com/mhcgrq>
// fangpenlin <https://github.com/fangpenlin>
// abrahambotros <https://github.com/abrahambotros>
// petejkim <https://github.com/petejkim>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
@@ -188,46 +189,63 @@ export interface NavigationParams {
[key: string]: any,
}
export type NavigationNavigateAction = {
type: 'Navigation/NAVIGATE',
export interface NavigationNavigateActionPayload {
routeName: string,
params?: NavigationParams,
// The action to run inside the sub-router
action?: NavigationNavigateAction,
};
}
export type NavigationBackAction = {
type: 'Navigation/BACK',
export interface NavigationNavigateAction extends NavigationNavigateActionPayload {
type: 'Navigation/NAVIGATE',
}
export interface NavigationBackActionPayload {
key?: string | null,
};
}
export type NavigationSetParamsAction = {
type: 'Navigation/SET_PARAMS',
export interface NavigationBackAction extends NavigationBackActionPayload {
type: 'Navigation/BACK',
}
export interface NavigationSetParamsActionPayload {
// The key of the route where the params should be set
key: string,
// The new params to merge into the existing route params
params?: NavigationParams,
};
}
export type NavigationInitAction = {
type: 'Navigation/INIT',
export interface NavigationSetParamsAction extends NavigationSetParamsActionPayload {
type: 'Navigation/SET_PARAMS',
}
export interface NavigationInitActionPayload {
params?: NavigationParams,
};
}
export type NavigationResetAction = {
type: 'Navigation/RESET',
export interface NavigationInitAction extends NavigationInitActionPayload {
type: 'Navigation/INIT',
}
export interface NavigationResetActionPayload {
index: number,
key?: string | null,
actions: Array<NavigationNavigateAction>,
};
}
export type NavigationUriAction = {
type: 'Navigation/URI',
export interface NavigationResetAction extends NavigationResetActionPayload {
type: 'Navigation/RESET',
}
export interface NavigationUriActionPayload {
uri: string,
};
}
export interface NavigationUriAction extends NavigationUriActionPayload {
type: 'Navigation/URI',
}
export interface NavigationStackViewConfig {
mode?: 'card' | 'modal',
@@ -575,15 +593,13 @@ export const TabBarBottom: React.ComponentClass<any>;
/**
* NavigationActions
* @todo Is this necessary, or can we remove? Not referenced anywhere else here, but it seems a
* recent commit or two touches these. Can anyone provide a strong use case for keeping this in?
*/
export namespace NavigationActions {
function init(options?: NavigationInitAction): NavigationInitAction;
function navigate(options: NavigationNavigateAction): NavigationNavigateAction;
function reset(options: NavigationResetAction): NavigationResetAction;
function back(options?: NavigationBackAction): NavigationBackAction;
function setParams(options: NavigationSetParamsAction): NavigationSetParamsAction;
export function init(options?: NavigationInitActionPayload): NavigationInitAction;
export function navigate(options: NavigationNavigateActionPayload): NavigationNavigateAction;
export function reset(options: NavigationResetActionPayload): NavigationResetAction;
export function back(options?: NavigationBackActionPayload): NavigationBackAction;
export function setParams(options: NavigationSetParamsActionPayload): NavigationSetParamsAction;
}
/**
@@ -5,22 +5,28 @@ import {
ViewStyle,
} from 'react-native';
import {
addNavigationHelpers,
NavigationAction,
NavigationActions,
NavigationBackAction,
NavigationInitAction,
NavigationNavigateAction,
NavigationProp,
NavigationResetAction,
NavigationRouteConfigMap,
NavigationScreenProp,
NavigationScreenProps,
NavigationSetParamsAction,
NavigationStackAction,
NavigationStackScreenOptions,
NavigationTabScreenOptions,
NavigationTransitionProps,
StackNavigator,
StackNavigatorConfig,
TabBarTop,
TabNavigator,
TabNavigatorConfig,
TabBarTop,
Transitioner,
NavigationProp,
NavigationAction,
NavigationTransitionProps,
addNavigationHelpers,
} from 'react-navigation';
// Constants
@@ -42,6 +48,7 @@ interface StartScreenNavigationParams {
id: number,
s: string,
}
interface StartScreenProps extends NavigationScreenProps<StartScreenNavigationParams> { }
class StartScreen extends React.Component<StartScreenProps, {}> {
render() {
@@ -219,3 +226,36 @@ class CustomTransitioner extends React.Component<CustomTransitionerProps, null>
return {}
}
}
const initAction: NavigationInitAction = NavigationActions.init({
params: {
foo: "bar"
}
})
const navigateAction: NavigationNavigateAction = NavigationActions.navigate({
routeName: "FooScreen",
params: {
foo: "bar"
},
action: NavigationActions.navigate({ routeName: "BarScreen" })
})
const resetAction: NavigationResetAction = NavigationActions.reset({
index: 0,
key: "foo",
actions: [
NavigationActions.navigate({ routeName: "FooScreen" })
]
})
const backAction: NavigationBackAction = NavigationActions.back({
key: "foo"
})
const setParamsAction: NavigationSetParamsAction = NavigationActions.setParams({
key: "foo",
params: {
foo: "bar"
}
})
+120
View File
@@ -0,0 +1,120 @@
// Type definitions for react-sortable-tree 0.1
// Project: https://fritz-c.github.io/react-sortable-tree
// Definitions by: Wouter Hardeman <https://github.com/wouterhardeman>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
import * as React from 'react';
import { ListProps, Index } from 'react-virtualized';
import { ConnectDragSource, ConnectDragPreview, DragSourceMonitor } from 'react-dnd';
export * from './utils/tree-data-utils';
export * from './utils/default-handlers';
export interface TreeItem {
title?: string;
subtitle?: string;
expanded?: boolean;
children: TreeItem[];
[x: string]: any;
}
export interface TreeNode {
node: TreeItem;
}
export interface TreePath {
path: NumberArrayOrStringArray;
}
export interface TreeIndex {
treeIndex: number;
}
export interface FullTree {
treeData: TreeItem[];
}
export interface NodeData extends TreeNode, TreePath, TreeIndex {}
export interface SearchData extends NodeData {
searchQuery: any;
}
export interface ExtendedNodeData extends NodeData {
lowerSiblingsCounts: number[];
isSearchMatch: boolean;
isSearchFocus: boolean;
}
export interface OnVisibilityToggleData extends FullTree, TreeNode {
expanded: boolean;
}
export interface PreviousAnNextLocation {
prevPath: number[];
prevParent: TreeItem;
prevTreeIndex: number;
nextPath: number[];
nextParent: TreeItem;
nextTreeIndex: number;
}
export type NodeRenderer = React.ComponentClass<NodeRendererProps>;
export interface NodeRendererProps {
node: TreeItem;
path: NumberArrayOrStringArray;
treeIndex: number;
isSearchMatch: boolean;
isSearchFocus: boolean;
canDrag: boolean;
scaffoldBlockPxWidth: number;
toggleChildrenVisibility?(data: NodeData): void;
buttons?: any[];
className?: string;
style?: {[index: string]: any};
connectDragPreview: ConnectDragPreview;
connectDragSource: ConnectDragSource;
parentNode?: {[index: string]: any};
startDrag: any;
endDrag: any;
isDragging: boolean;
didDrop: boolean;
draggedNode?: {[index: string]: any};
isOver: boolean;
canDrop?: boolean;
}
type NumberArrayOrStringArray = string[] | number[];
export interface ReactSortableTreeProps {
treeData: TreeItem[];
onChange(treeData: TreeItem[]): void;
style?: {[index: string]: any; };
className?: string;
innerStyle?: {[index: string]: any; };
maxDepth?: number;
searchMethod?(data: SearchData): boolean;
searchQuery?: string | any;
searchFocusOffset?: number;
searchFinishCallback?(matches: NodeData[]): void;
generateNodeProps?(data: ExtendedNodeData): {[index: string]: any};
getNodeKey?(data: TreeNode & TreeIndex): string | number;
onMoveNode?(data: NodeData & FullTree): void;
onVisibilityToggle?(data: OnVisibilityToggleData): void;
canDrag?: ((data: ExtendedNodeData) => boolean) | boolean;
canDrop?(data: PreviousAnNextLocation & NodeData): boolean;
reactVirtualizedListProps?: ListProps;
rowHeight?: ((info: Index) => number) | number;
slideRegionSize?: number;
scaffoldBlockPxWidth?: number;
isVirtualized?: boolean;
nodeContentRenderer?: NodeRenderer;
}
declare const SortableTree: React.ComponentClass<ReactSortableTreeProps>;
export const SortableTreeWithoutDndContext: React.ComponentClass<ReactSortableTreeProps>;
export default SortableTree;
@@ -0,0 +1,66 @@
import * as React from "react";
import SortableTree,
{
SortableTreeWithoutDndContext,
defaultGetNodeKey,
NodeRenderer,
TreeItem,
defaultSearchMethod,
SearchData,
NodeData,
ExtendedNodeData,
FullTree,
OnVisibilityToggleData,
PreviousAnNextLocation
} from "react-sortable-tree";
import { ListProps, ListRowRenderer } from "react-virtualized";
class Test extends React.Component {
render() {
const treeData = [
{
title: "Title", subtitle: "Subtitle", children: [
{title: "Child 1", subtitle: "Subtitle", children: []},
{title: "Child 2", subtitle: "Subtitle", children: []}
]
}
];
const reactVirtualizedListProps: ListProps = {
width: 100, height: 44, rowCount: 3, rowHeight: 44, rowRenderer: "test" as any as ListRowRenderer
};
const nodeRenderer: NodeRenderer = "test" as any as NodeRenderer;
return (
<div>
<SortableTree
treeData={treeData}
onChange={(data: TreeItem[]) => {}}
style={{width: "100%"}}
className="test-class"
innerStyle={{backgroundColor: "#3A3A3A"}}
maxDepth={3}
searchMethod={defaultSearchMethod}
searchQuery={"Child 1"}
searchFocusOffset={1}
searchFinishCallback={(matches: NodeData[]) => { const firstTitle = matches[0].node.title; }}
generateNodeProps={(data: ExtendedNodeData) => ({buttons: [data.node.title]}) }
getNodeKey={defaultGetNodeKey}
onMoveNode={(data: NodeData & FullTree) => {}}
onVisibilityToggle={(data: OnVisibilityToggleData) => {}}
canDrag={true}
canDrop={(data: PreviousAnNextLocation & NodeData) => true}
reactVirtualizedListProps={reactVirtualizedListProps}
rowHeight={62}
slideRegionSize={100}
scaffoldBlockPxWidth={44}
isVirtualized={true}
nodeContentRenderer={nodeRenderer}
/>
<SortableTreeWithoutDndContext
treeData={[{title: "Title", subtitle: "Subtitle", children: []}]}
onChange={(treeData: TreeItem[]) => {}}
style={{width: "100px"}}
/>
</div>
);
}
}
+23
View File
@@ -0,0 +1,23 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"jsx": "react",
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"react-sortable-tree-tests.tsx"
]
}
+1
View File
@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }
+4
View File
@@ -0,0 +1,4 @@
import { TreeIndex, SearchData } from 'react-sortable-tree';
export function defaultGetNodeKey(data: TreeIndex): number;
export function defaultSearchMethod(data: SearchData): boolean;
+21
View File
@@ -0,0 +1,21 @@
import { FullTree, TreePath, TreeItem, TreeIndex, SearchData, NodeData, TreeNode } from 'react-sortable-tree';
type GetNodeKeyFunction = (data: TreeIndex & TreeNode) => string | number;
type WalkAndMapFunctionParameters = FullTree & {getNodeKey: GetNodeKeyFunction, callback: Function, ignoreCollapsed?: boolean}
type FlattenedData = (TreeNode & TreePath & {lowerSiblingsCounts: number[]})[];
export function getDescendantCount(data: TreeNode & {ignoreCollapsed?: boolean}): number;
export function getVisibleNodeCount(data: FullTree): number;
export function getVisibleNodeInfoAtIndex(data: FullTree & {targetIndex: number, getNodeKey: GetNodeKeyFunction}): TreeNode & TreePath & {lowerSiblingsCounts: number[]};
export function walk(data: WalkAndMapFunctionParameters): void;
export function map(data: WalkAndMapFunctionParameters): TreeItem[];
export function changeNodeAtPath(data: FullTree & TreePath & {newNode: Function | any, getNodeKey: GetNodeKeyFunction, ignoreCollapsed?: boolean}): TreeItem[];
export function removeNodeAtPath(data: FullTree & TreePath & {getNodeKey: GetNodeKeyFunction, ignoreCollapsed?: boolean}): TreeItem[];
export function getNodeAtPath(data: FullTree & TreePath & {getNodeKey: GetNodeKeyFunction, ignoreCollapsed?: boolean}): TreeItem | null;
export function addNodeUnderParent(data: FullTree & {newNode: TreeItem, parentKey?: number | string, getNodeKey: GetNodeKeyFunction, ignoreCollapsed?: boolean, expandParent?: boolean}): FullTree & TreeIndex;
export function insertNode(data: FullTree & {depth: number, newNode: TreeItem, minimumTreeIndex: number, ignoreCollapsed?: boolean, expandParent?: boolean, getNodeKey: GetNodeKeyFunction}): FullTree & TreeIndex & TreePath & {parentNode: TreeItem};
export function getFlatDataFromTree(data: FullTree & {getNodeKey: GetNodeKeyFunction, ignoreCollapsed?: boolean}): (TreeNode & TreePath & {lowerSiblingsCounts: number[], parentNode: TreeItem})[];
export function getTreeFromFlatData(data: {flatData: FlattenedData, getKey?: GetNodeKeyFunction, getParentKey?: GetNodeKeyFunction, rootKey?: string | number}): TreeItem[]
export function isDescendant(older: TreeItem, younger: TreeItem): boolean;
export function getDepth(node: TreeItem, depth?: number): number;
export function find(data: FullTree & {getNodeKey: GetNodeKeyFunction, searchQuery?: string | number, searchMethod: (data: SearchData) => boolean, searchFocusOffset?: number, expandAllMatchPaths?: boolean, expandFocusMatchPaths?: boolean}): {matches: NodeData[]} & FullTree;
+1
View File
@@ -143,6 +143,7 @@ declare namespace request {
gzip?: boolean;
preambleCRLF?: boolean;
postambleCRLF?: boolean;
withCredentials?: boolean;
key?: Buffer;
cert?: Buffer;
passphrase?: string;
+102 -44
View File
@@ -1,19 +1,9 @@
// Type definitions for transducers-js 0.4
// Project: https://github.com/cognitect-labs/transducers-js
// Definitions by: Colin Kahn <https://github.com/colinkahn>
// David Philipson <https://github.com/dphilipson>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
export interface IteratorResult<T> {
done: boolean;
value?: T;
}
export interface Iterator<T> {
next(value?: any): IteratorResult<T>;
return?(value?: any): IteratorResult<T>;
throw?(e?: any): IteratorResult<T>;
}
export interface Reduced<TResult> {
['@@transducer/reduced']: boolean;
['@@transducer/value']: TResult;
@@ -21,7 +11,12 @@ export interface Reduced<TResult> {
export type Reducer<TResult, TInput> = (result: TResult, input: TInput) => TResult;
export type Transducer<TResult, TInput, TOutput> = (xf: Transformer<TResult, TOutput>) => Transformer<TResult, TInput>;
// Common case: Transducer<TInput, TOutput> =
// Transformer<TResult, TOutput> => Transformer<TResult, TInput>.
export type Transducer<TInput, TOutput> =
<TResult, TCompleteResult>(
xf: CompletingTransformer<TResult, TCompleteResult, TOutput>
) => CompletingTransformer<TResult, TCompleteResult, TInput>;
export interface CompletingTransformer <TResult, TCompleteResult, TInput> {
['@@transducer/init'](): TResult | void;
@@ -44,12 +39,15 @@ export function isReduced(x: any): boolean;
/**
* Function composition. Take N function and return their composition.
*/
export function comp<T>(...args: T[]): T;
// Infers correct return type when all arguments have same type.
export function comp<T extends (x: any) => any>(...args: T[]): T;
// Falls back to (any => any) when argument types differ.
export function comp(...args: Array<(x: any) => any>): (x: any) => any;
/**
* Take a predicate function and return its complement.
*/
export function complement(f: Function): Function;
export function complement<T>(f: (x: T) => boolean): (x: T) => boolean;
/**
* Identity function.
@@ -66,7 +64,7 @@ export class Map<TResult, TInput, TOutput> implements Transformer<TResult, TInpu
/**
* Mapping transducer constructor
*/
export function map<TResult, TInput, TOutput>(f: (x: TInput) => TOutput): Transducer<TResult, TInput, TOutput>;
export function map<TInput, TOutput>(f: (x: TInput) => TOutput): Transducer<TInput, TOutput>;
export class Filter<TResult, TInput> implements Transformer<TResult, TInput> {
constructor(pred: (x: TInput) => boolean, xf: Transformer<TResult, TInput>);
@@ -78,13 +76,13 @@ export class Filter<TResult, TInput> implements Transformer<TResult, TInput> {
/**
* Filtering transducer constructor
*/
export function filter<TResult, TInput>(pred: (x: TInput) => boolean): Transducer<TResult, TInput, TInput>;
export function filter<TInput>(pred: (x: TInput) => boolean): Transducer<TInput, TInput>;
/**
* Similar to filter except the predicate is used to
* eliminate values.
*/
export function remove<TResult, TInput>(pred: (x: TInput) => boolean): Transducer<TResult, TInput, TInput>;
export function remove<TInput>(pred: (x: TInput) => boolean): Transducer<TInput, TInput>;
export class Keep<TResult, TInput> implements Transformer<TResult, TInput> {
constructor(f: (x: TInput) => any, xf: Transformer<TResult, TInput>);
@@ -97,7 +95,7 @@ export class Keep<TResult, TInput> implements Transformer<TResult, TInput> {
* A keeping transducer. Keep inputs as long as the provided
* function does not return null or undefined.
*/
export function keep<TResult, TInput>(f: (x: TInput) => any): Transducer<TResult, TInput, TInput>;
export function keep<TInput>(f: (x: TInput) => any): Transducer<TInput, TInput>;
export class KeepIndexed<TResult, TInput> implements Transformer<TResult, TInput> {
constructor(f: (i: number, x: TInput) => any, xf: Transformer<TResult, TInput>);
@@ -110,7 +108,7 @@ export class KeepIndexed<TResult, TInput> implements Transformer<TResult, TInput
* Like keep but the provided function will be passed the
* index as the fist argument.
*/
export function keepIndexed<TResult, TInput>(f: (i: number, x: TInput) => any): Transducer<TResult, TInput, TInput>;
export function keepIndexed<TInput>(f: (i: number, x: TInput) => any): Transducer<TInput, TInput>;
export class Take<TResult, TInput> implements Transformer<TResult, TInput> {
constructor(n: number, xf: Transformer<TResult, TInput>);
@@ -123,7 +121,7 @@ export class Take<TResult, TInput> implements Transformer<TResult, TInput> {
* A take transducer constructor. Will take n values before
* returning a reduced result.
*/
export function take<TResult, TInput>(n: number): Transducer<TResult, TInput, TInput>;
export function take<TInput>(n: number): Transducer<TInput, TInput>;
export class TakeWhile<TResult, TInput> implements Transformer<TResult, TInput> {
constructor(pred: (n: TInput) => boolean, xf: Transformer<TResult, TInput>);
@@ -136,7 +134,7 @@ export class TakeWhile<TResult, TInput> implements Transformer<TResult, TInput>
* Like the take transducer except takes as long as the pred
* return true for inputs.
*/
export function takeWhile<TResult, TInput>(pred: (n: TInput) => boolean): Transducer<TResult, TInput, TInput>;
export function takeWhile<TInput>(pred: (n: TInput) => boolean): Transducer<TInput, TInput>;
export class TakeNth<TResult, TInput> implements Transformer<TResult, TInput> {
constructor(n: number, xf: Transformer<TResult, TInput>);
@@ -148,7 +146,7 @@ export class TakeNth<TResult, TInput> implements Transformer<TResult, TInput> {
/**
* A transducer that takes every Nth input
*/
export function takeNth<TResult, TInput>(n: number): Transducer<TResult, TInput, TInput>;
export function takeNth<TInput>(n: number): Transducer<TInput, TInput>;
export class Drop<TResult, TInput> implements Transformer<TResult, TInput> {
constructor(n: number, xf: Transformer<TResult, TInput>);
@@ -160,7 +158,7 @@ export class Drop<TResult, TInput> implements Transformer<TResult, TInput> {
/**
* A dropping transducer constructor
*/
export function drop<TResult, TInput>(n: number): Transducer<TResult, TInput, TInput>;
export function drop<TInput>(n: number): Transducer<TInput, TInput>;
export class DropWhile<TResult, TInput> implements Transformer<TResult, TInput> {
constructor(pred: (input: TInput) => boolean, xf: Transformer<TResult, TInput>);
@@ -173,7 +171,7 @@ export class DropWhile<TResult, TInput> implements Transformer<TResult, TInput>
* A dropping transducer that drop inputs as long as
* pred is true.
*/
export function dropWhile<TResult, TInput>(pred: (input: TInput) => boolean): Transducer<TResult, TInput, TInput>;
export function dropWhile<TInput>(pred: (input: TInput) => boolean): Transducer<TInput, TInput>;
export class PartitionBy<TResult, TInput> implements Transformer<TResult, TInput> {
constructor(f: (input: TInput) => any, xf: Transformer<TResult, TInput[]>);
@@ -187,7 +185,7 @@ export class PartitionBy<TResult, TInput> implements Transformer<TResult, TInput
* arrays as long as predicate remains true for contiguous
* inputs.
*/
export function partitionBy<TResult, TInput>(f: (input: TInput) => any): Transducer<TResult, TInput, TInput[]>;
export function partitionBy<TInput>(f: (input: TInput) => any): Transducer<TInput, TInput[]>;
export class PartitionAll<TResult, TInput> implements Transformer<TResult, TInput> {
constructor(n: number, xf: Transformer<TResult, TInput[]>);
@@ -200,7 +198,7 @@ export class PartitionAll<TResult, TInput> implements Transformer<TResult, TInpu
* A partitioning transducer. Collects inputs into
* arrays of size N.
*/
export function partitionAll<TResult, TInput>(n: number): Transducer<TResult, TInput, TInput[]>;
export function partitionAll<TResult, TInput>(n: number): Transducer<TInput, TInput[]>;
export class Completing<TResult, TCompleteResult, TInput> implements CompletingTransformer<TResult, TCompleteResult, TInput> {
constructor(cf: (result: TResult) => TCompleteResult, xf: Transformer<TResult, TInput>);
@@ -213,10 +211,12 @@ export class Completing<TResult, TCompleteResult, TInput> implements CompletingT
* A completing transducer constructor. Useful to provide cleanup
* logic at the end of a reduction/transduction.
*/
export function completing<TResult, TCompleteResult, TInput>(cf: (result: TResult) => TCompleteResult): CompletingTransformer<TResult, TCompleteResult, TInput>;
export function completing<TResult, TCompleteResult, TInput>(
xf: Transformer<TResult, TInput> | Reducer<TResult, TInput>,
cf: (result: TResult) => TCompleteResult): CompletingTransformer<TResult, TCompleteResult, TInput>;
export class Wrap<TResult, TInput> implements Transformer<TResult, TInput> {
constructor(stepFn: Reducer<TResult, TInput>, xf: Transformer<TResult, TInput>);
constructor(stepFn: Reducer<TResult, TInput>);
['@@transducer/init'](): TResult;
['@@transducer/step'](result: TResult, input: TInput): TResult;
['@@transducer/result'](result: TResult): TResult;
@@ -227,44 +227,102 @@ export class Wrap<TResult, TInput> implements Transformer<TResult, TInput> {
* accumluation and the second argument is the next input and convert
* it into a transducer transformer object.
*/
export function wrap<TResult, TInput>(stepFn: Reducer<TResult, TInput>): Transducer<TResult, TInput, TInput>;
export function wrap<TResult, TInput>(stepFn: Reducer<TResult, TInput>): Transformer<TResult, TInput>;
/**
* Given a transformer return a concatenating transformer
*/
export function cat<TResult, TInput>(xf: Transformer<TResult, TInput>): Transformer<TResult, TInput> ;
export function cat<TResult, TInput>(xf: Transformer<TResult, TInput>): Transformer<TResult, Iterable<TInput>>;
/**
* A mapping concatenating transformer
*/
export function mapcat<TResult, TInput, TOutput>(f: (arr: TInput[]) => TOutput[]): Transducer<TResult, TInput[], TOutput>;
export function mapcat<TResult, TInput, TOutput>(f: (arr: TInput) => Iterable<TOutput>): Transducer<TInput, TOutput>;
/**
* Given a transducer, a builder function, an initial value
* and a iterable collection - returns the reduction.
*/
export function transduce<TResult, TInput, TOutput>(
xf: Transducer<TResult, TInput, TOutput>,
f: Transformer<TResult, TInput> | Reducer<TResult, TInput>,
xf: Transducer<TInput, TOutput>,
f: Reducer<TResult, TOutput>,
init: TResult,
coll: TInput[] | Iterator<TInput> | string | Object): TResult;
coll: Iterable<TInput>): TResult;
export function transduce<TResult, TCompleteResult, TInput, TOutput>(
xf: Transducer<TInput, TOutput>,
f: CompletingTransformer<TResult, TCompleteResult, TOutput>,
init: TResult,
coll: Iterable<TInput>): TCompleteResult;
export function transduce<TResult, TCompleteResult, TInput, TOutput>(
xf: Transducer<TInput, TOutput>,
f: CompletingTransformer<TResult, TCompleteResult, TOutput>,
coll: Iterable<TInput>): TCompleteResult;
// Overloads for object iteration.
export function transduce<TResult, TInput, TOutput>(
xf: Transducer<[string, TInput], TOutput>,
f: Reducer<TResult, TOutput>,
init: TResult,
coll: { [key: string]: TInput }): TResult;
export function transduce<TResult, TCompleteResult, TInput, TOutput>(
xf: Transducer<[string, TInput], TOutput>,
f: CompletingTransformer<TResult, TCompleteResult, TOutput>,
init: TResult,
coll: { [key: string]: TInput }): TCompleteResult;
export function transduce<TResult, TCompleteResult, TInput, TOutput>(
xf: Transducer<[string, TInput], TOutput>,
f: CompletingTransformer<TResult, TCompleteResult, TOutput>,
coll: { [key: string]: TInput }): TCompleteResult;
/**
* Given a transducer, an intial value and a
* collection - returns the reduction.
*/
export function reduce<TResult, TInput, TOutput>(
xf: Transducer<TResult, TInput, TOutput>,
export function reduce<TResult, TInput>(
xf: Transformer<TResult, TInput> | Reducer<TResult, TInput>,
init: TResult,
coll: TInput[] | Iterator<TInput> | string | Object): TResult;
coll: Iterable<TInput>): TResult;
export function reduce<TResult, TCompleteResult, TInput>(
xf: CompletingTransformer<TResult, TCompleteResult, TInput>,
init: TResult,
coll: Iterable<TInput>): TCompleteResult;
// Overloads for object iteration.
export function reduce<TResult, TInput>(
xf: Transformer<TResult, [string, TInput]> | Reducer<TResult, [string, TInput]>,
init: TResult,
coll: { [key: string]: TInput }): TResult;
export function reduce<TResult, TCompleteResult, TInput>(
xf: CompletingTransformer<TResult, TCompleteResult, [string, TInput]>,
init: TResult,
coll: { [key: string]: TInput }): TCompleteResult;
/**
* Reduce a value into the given empty value using a transducer.
*/
export function into<TResult, TInput, TOutput>(
empty: TResult,
xf: Transducer<TResult, TInput, TOutput>,
coll: TInput[] | Iterator<TInput> | string | Object): TResult;
export function into<TInput, TOutput>(
empty: TOutput[],
xf: Transducer<TInput, TOutput>,
coll: Iterable<TInput>): TOutput[];
export function into<TInput>(
empty: string,
xf: Transducer<TInput, string>,
coll: Iterable<TInput>): string;
export function into<TInput, TOutput>(
empty: { [key: string]: TOutput },
xf: Transducer<TInput, [string, TOutput]>,
coll: Iterable<TInput>): { [key: string]: TOutput };
// Overloads for object iteration.
export function into<TInput, TOutput>(
empty: TOutput[],
xf: Transducer<[string, TInput], TOutput>,
coll: { [key: string]: TInput }): TOutput[];
export function into<TInput>(
empty: string,
xf: Transducer<[string, TInput], string>,
coll: { [key: string]: TInput }): string;
export function into<TInput, TOutput>(
empty: { [key: string]: TOutput },
xf: Transducer<[string, TInput], [string, TOutput]>,
coll: { [key: string]: TInput }): { [key: string]: TOutput };
/**
* Convert a transducer transformer object into a function so
@@ -272,9 +330,9 @@ export function into<TResult, TInput, TOutput>(
* Underscore, lodash
*/
export function toFn<TResult, TInput, TOutput>(
xf: Transducer<TResult, TInput, TOutput>,
builder: Reducer<TResult, TInput> | Transformer<TResult, TInput>
): Reducer<TResult, TInput>;
xf: Transducer<TInput, TOutput>,
builder: Reducer<TResult, TOutput> | Transformer<TResult, TOutput>
): Reducer<TResult, TOutput>;
/**
* A transformer which simply returns the first input.
@@ -124,3 +124,59 @@ function mapcatExample() {
const xf = t.mapcat(reverse);
t.into([], xf, [[3, 2, 1], [6, 5, 4]]); // [1, 2, 3, 4, 5, 6]
}
// Original tests
function transduceExample() {
const { completing, transduce, wrap } = t;
const stringAppendFn = (acc: string, x: number) => acc + x;
const stringAppendTransformer = wrap(stringAppendFn);
const stringAppendThenLengthTransformer = completing(
stringAppendFn,
s => s.length,
);
const lengthsString1: string = transduce(
t.map((s: string) => s.length),
stringAppendFn,
"",
["a", "b"],
);
const lengthsString2: string = transduce(
t.map((s: string) => s.length),
stringAppendTransformer,
"",
["a", "b"],
);
const lengthsStringLength: number = transduce(
t.map((s: string) => s.length),
stringAppendThenLengthTransformer,
"",
["a", "b"],
);
}
function advancedIntoExample() {
const array: number[] = into([], t.map((s: string) => s.length), [
"a",
"b",
]);
const string: string = into("", t.map((s: string) => s + s), ["a", "b"]);
const object1: { [key: string]: number } = into(
{},
t.map((s: string) => [s, s.length]),
["a", "b"],
);
const object2: { [key: string]: boolean } = into(
{},
t.map((kv: [string, number]) => [kv[0], true]),
{ a: 1, b: 2 }
);
}
function compExample() {
const fn1: t.Transducer<number, number> = comp(map(inc), filter(isEven));
const fn2: t.Transducer<number, string> = comp(
filter(isEven),
map((x: number) => "" + x),
);
}
+2 -3
View File
@@ -1,7 +1,6 @@
// Type definitions for webpack 3.0
// Project: https://github.com/webpack/webpack
// Definitions by: Qubo <https://github.com/tkqubo>
// Matt Lewis <https://github.com/mattlewis92>
// Benjamin Lim <https://github.com/bumbleblym>
// Boris Cherny <https://github.com/bcherny>
// Tommy Troy Lin <https://github.com/tommytroylin>
@@ -504,7 +503,7 @@ declare namespace webpack {
* Turns hints on/off. In addition, tells webpack to throw either an error or a warning when hints are
* found. This property is set to "warning" by default.
*/
hints?: 'warning' | 'error' | boolean;
hints?: 'warning' | 'error' | false;
/**
* An asset is any emitted file from webpack. This option controls when webpack emits a performance hint
* based on individual asset size. The default value is 250000 (bytes).
@@ -1216,7 +1215,7 @@ declare namespace webpack {
* Target of compilation. Passed from configuration options.
* Example values: "web", "node"
*/
target: 'web' | 'node' | string;
target: 'web' | 'webworker' | 'async-node' | 'node' | 'electron-main' | 'electron-renderer' | 'node-webkit' | string;
/**
* This boolean is set to true when this is compiled by webpack.
+3 -3
View File
@@ -181,7 +181,7 @@ export interface IExtension {
export declare class request extends events.EventEmitter {
/** A reference to the original Node HTTP request object */
httpRequest: http.ClientRequest;
httpRequest: http.IncomingMessage;
/** This will include the port number if a non-standard port is used */
host: string;
/** A string containing the path that was requested by the client */
@@ -222,7 +222,7 @@ export declare class request extends events.EventEmitter {
requestedProtocols: string[];
protocolFullCaseMap: { [key: string]: string };
constructor(socket: net.Socket, httpRequest: http.ClientRequest, config: IServerConfig);
constructor(socket: net.Socket, httpRequest: http.IncomingMessage, config: IServerConfig);
/**
* After inspecting the `request` properties, call this function on the
@@ -580,7 +580,7 @@ declare class client extends events.EventEmitter {
declare class routerRequest extends events.EventEmitter {
/** A reference to the original Node HTTP request object */
httpRequest: http.ClientRequest;
httpRequest: http.IncomingMessage;
/** A string containing the path that was requested by the client */
resource: string;
/** Parsed resource, including the query string parameters */