mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-08-12 13:00:19 +00:00
Merge branch 'master' into equality-comparer
This commit is contained in:
+2
-1
@@ -1104,6 +1104,7 @@
|
||||
/types/ffprobe-static/ @iamstevetran
|
||||
/types/fhir-js-client/ @rmchndrng
|
||||
/types/fibers/ @soywiz
|
||||
/types/fibjs/ @richardo2016
|
||||
/types/figures/ @BendingBender
|
||||
/types/file-exists/ @BendingBender
|
||||
/types/file-saver/ @cyrilschumacher @DaIgeb @chrismbarr
|
||||
@@ -3383,7 +3384,7 @@
|
||||
/types/react-json/ @spielc
|
||||
/types/react-json-pretty/ @LKay
|
||||
/types/react-json-tree/ @gnestor
|
||||
/types/react-jsonschema-form/ @iamdanfox @sirreal @iplus26 @KurtPreston
|
||||
/types/react-jsonschema-form/ @iamdanfox @iplus26 @KurtPreston
|
||||
/types/react-lazyload/ @m0a
|
||||
/types/react-leaflet/ @danzel @davschne @yuit
|
||||
/types/react-list/ @buptyyf @tomshen
|
||||
|
||||
Vendored
+2
-1
@@ -832,8 +832,9 @@ declare namespace AceAjax {
|
||||
|
||||
/**
|
||||
* [Sets the value of the distance between the left of the editor and the leftmost part of the visible content.]{: #EditSession.setScrollLeft}
|
||||
* @param scrollLeft The new scroll left value
|
||||
**/
|
||||
setScrollLeft(): void;
|
||||
setScrollLeft(scrollLeft: number): void;
|
||||
|
||||
/**
|
||||
* [Returns the value of the distance between the left of the editor and the leftmost part of the visible content.]{: #EditSession.getScrollLeft}
|
||||
|
||||
@@ -18,6 +18,23 @@ function createFoldTestSession() {
|
||||
return session;
|
||||
}
|
||||
|
||||
function createScrollTestRenderer(): AceAjax.VirtualRenderer | null {
|
||||
var el = document.createElement("div");
|
||||
|
||||
if (!el.getBoundingClientRect) {
|
||||
console.log("Skipping test: This test only runs in the browser");
|
||||
return null;
|
||||
}
|
||||
|
||||
el.style.left = "20px";
|
||||
el.style.top = "30px";
|
||||
el.style.width = "300px";
|
||||
el.style.height = "100px";
|
||||
document.body.appendChild(el);
|
||||
|
||||
return new AceAjax.VirtualRenderer(el);
|
||||
}
|
||||
|
||||
function assertArray(a, b) {
|
||||
assert.equal(a + "", b + "");
|
||||
assert.ok(a.length == b.length);
|
||||
@@ -915,5 +932,25 @@ const aceEditSessionTests = {
|
||||
session = new AceAjax.EditSession(new Array(30).join("\n"));
|
||||
session.documentToScreenPosition(2, 0);
|
||||
session.documentToScreenPosition(2, 0);
|
||||
},
|
||||
|
||||
"test setScrollTop()": function() {
|
||||
var renderer = createScrollTestRenderer();
|
||||
var session = new AceAjax.EditSession(["1", "2", "3", "2", "3", "4"]);
|
||||
renderer.setSession(session);
|
||||
assert.equal(renderer.getScrollTop(), 0);
|
||||
session.setScrollTop(40);
|
||||
assert.equal(renderer.getScrollTop(), 40);
|
||||
renderer.getScrollTop()
|
||||
},
|
||||
|
||||
"test setScrollLeft()": function() {
|
||||
var renderer = createScrollTestRenderer();
|
||||
var session = new AceAjax.EditSession(["1", "2", "3", "2", "3", "4"]);
|
||||
renderer.setSession(session);
|
||||
assert.equal(renderer.getScrollLeft(), 0);
|
||||
session.setScrollLeft(40);
|
||||
assert.equal(renderer.getScrollLeft(), 40);
|
||||
renderer.getScrollLeft()
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
import * as bencode from "bencode";
|
||||
|
||||
bencode.byteLength("abcde"); // $ExpectType number
|
||||
bencode.encodingLength("abcde"); // $ExpectType number
|
||||
bencode.encode([1, 2, 3, 4], new Buffer([]), 1); // $ExpectType Buffer
|
||||
bencode.decode(new Buffer("abcde"), 1, 3); // $ExpectType any
|
||||
Vendored
+16
@@ -0,0 +1,16 @@
|
||||
// Type definitions for bencode 2.0
|
||||
// Project: https://github.com/themasch/node-bencode#readme
|
||||
// Definitions by: Tobenna <https://github.com/tobenna>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference types="node" />
|
||||
|
||||
export function byteLength(value: any): number;
|
||||
export function encodingLength(value: any): number;
|
||||
export function encode(data: any, buffer?: Buffer, offset?: number): Buffer;
|
||||
export function decode(
|
||||
data: Buffer,
|
||||
start?: number,
|
||||
end?: number,
|
||||
encoding?: string
|
||||
): any;
|
||||
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"bencode-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
@@ -14,3 +14,6 @@ const b6 = b4.multiply(b5);
|
||||
|
||||
console.log(b6);
|
||||
// => BigInteger { '0': 420, '1': 0, t: 1, s: 0 }
|
||||
|
||||
console.log(b1.compareTo(b2));
|
||||
// => 70
|
||||
|
||||
Vendored
+1
-1
@@ -23,7 +23,7 @@ declare class bigi {
|
||||
clamp(): void;
|
||||
clearBit(n: number): bigi;
|
||||
clone(): bigi;
|
||||
compareTo(a: bigi): bigi;
|
||||
compareTo(a: bigi): number;
|
||||
copyTo(r: any): void;
|
||||
dAddOffset(n: any, w: any): void;
|
||||
dMultiply(n: number): void;
|
||||
|
||||
@@ -71,3 +71,18 @@ euro = chance.euro({opt: 'abc'});
|
||||
|
||||
let coin = chance.coin();
|
||||
coin = chance.coin();
|
||||
|
||||
// Make sure date works with min and max parameters
|
||||
let date: string|Date = chance.date();
|
||||
|
||||
let min = new Date();
|
||||
let max = new Date();
|
||||
date = chance.date({min, max});
|
||||
|
||||
min = new Date();
|
||||
min.setFullYear(new Date().getFullYear() - 15);
|
||||
max = new Date();
|
||||
max.setFullYear(new Date().getFullYear() + 15);
|
||||
date = chance.date({min, max});
|
||||
date = chance.date({min});
|
||||
date = chance.date({max});
|
||||
|
||||
Vendored
+3
-1
@@ -1,4 +1,4 @@
|
||||
// Type definitions for Chance 1.0.13
|
||||
// Type definitions for Chance 1.0.16
|
||||
// Project: http://chancejs.com
|
||||
// Definitions by: Chris Bowdon <https://github.com/cbowdon>
|
||||
// Brice BERNARD <https://github.com/brikou>
|
||||
@@ -189,6 +189,8 @@ declare namespace Chance {
|
||||
year?: number;
|
||||
month?: number;
|
||||
day?: number;
|
||||
min?: Date;
|
||||
max?: Date;
|
||||
}
|
||||
|
||||
interface Month {
|
||||
|
||||
Vendored
+3
-2
@@ -12,6 +12,7 @@
|
||||
// Simon Archer <https://github.com/archy-bold>
|
||||
// Ken Elkabany <https://github.com/braincore>
|
||||
// Slavik Nychkalo <https://github.com/gebeto>
|
||||
// Francesco Benedetto <https://github.com/frabnt>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.3
|
||||
|
||||
@@ -483,7 +484,7 @@ declare namespace Chart {
|
||||
pointHoverBackgroundColor?: ChartColor | ChartColor[];
|
||||
pointHoverBorderColor?: ChartColor | ChartColor[];
|
||||
pointHoverBorderWidth?: number | number[];
|
||||
pointStyle?: PointStyle | HTMLImageElement | Array<PointStyle | HTMLImageElement>;
|
||||
pointStyle?: PointStyle | HTMLImageElement | HTMLCanvasElement | Array<PointStyle | HTMLImageElement | HTMLCanvasElement>;
|
||||
xAxisID?: string;
|
||||
yAxisID?: string;
|
||||
type?: string;
|
||||
@@ -517,6 +518,7 @@ declare namespace Chart {
|
||||
barThickness?: number;
|
||||
maxBarThickness?: number;
|
||||
scaleLabel?: ScaleTitleOptions;
|
||||
time?: TimeScale;
|
||||
offset?: boolean;
|
||||
beforeUpdate?(scale?: any): void;
|
||||
beforeSetDimension?(scale?: any): void;
|
||||
@@ -538,7 +540,6 @@ declare namespace Chart {
|
||||
categoryPercentage?: number;
|
||||
barPercentage?: number;
|
||||
distribution?: 'linear' | 'series';
|
||||
time?: TimeScale;
|
||||
}
|
||||
|
||||
// tslint:disable-next-line no-empty-interface
|
||||
|
||||
Vendored
+1586
-591
File diff suppressed because it is too large
Load Diff
@@ -1,7 +1,7 @@
|
||||
import runtime = chrome.app.runtime;
|
||||
import cwindow = chrome.app.window;
|
||||
|
||||
var createOptions: cwindow.CreateWindowOptions = {
|
||||
const createOptions: cwindow.CreateWindowOptions = {
|
||||
id: "My Window",
|
||||
bounds: {
|
||||
left: 0,
|
||||
@@ -324,5 +324,40 @@ function testSystemNetwork() {
|
||||
});
|
||||
}
|
||||
|
||||
import webview = chrome.webview;
|
||||
let element: webview.HTMLWebViewElement;
|
||||
const gcmMessage = <chrome.gcm.OutgoingMessage>{};
|
||||
gcmMessage.data = {
|
||||
/*goog: 'any', should not be allowed, and it is not :) */
|
||||
test: true
|
||||
};
|
||||
|
||||
let wve: chrome.webview.HTMLWebViewElement = (<any>document.getElementById('webview'));
|
||||
wve.name = 'test';
|
||||
wve.src = 'https://github.com/DefinitelyTyped';
|
||||
wve.allowtransparency = true;
|
||||
wve.autosize = 'on';
|
||||
wve.partition = 'persist:githubwebview';
|
||||
wve.addEventListener('close', () => {
|
||||
return;
|
||||
});
|
||||
wve.addEventListener('consolemessage', (ev) => {
|
||||
if (ev.level === chrome.webview.ConsoleMessageLevel.LOG_ERROR) {
|
||||
const msg = ev.message;
|
||||
}
|
||||
});
|
||||
wve.addEventListener('dialog', (ev) => {
|
||||
ev.dialog.ok('Hello World!');
|
||||
});
|
||||
wve.addEventListener('loadstart', (ev) => {
|
||||
if (ev.isTopLevel) {
|
||||
return ev.url;
|
||||
}
|
||||
return;
|
||||
});
|
||||
wve.addEventListener('zoomchange', (ev) => {
|
||||
return ev.newZoomFactor || ev.oldZoomFactor;
|
||||
});
|
||||
wve.addEventListener('loadredirect', (ev) => {
|
||||
return ev.newUrl || ev.oldUrl;
|
||||
});
|
||||
|
||||
chrome.bluetoothLowEnergy.connect('1111111', () => { });
|
||||
|
||||
+33
@@ -0,0 +1,33 @@
|
||||
const startupConfiguration: any = { camera_position: 'back' };
|
||||
|
||||
// Some code samples from the wikitude ionic starter
|
||||
WikitudePlugin.loadARchitectWorld(
|
||||
success => {
|
||||
console.log('ARchitect World loaded successfully.');
|
||||
},
|
||||
fail => {
|
||||
console.log('Failed to load ARchitect World!');
|
||||
},
|
||||
'www/assets/07_3dModels_6_3dModelAtGeoLocation/index.html',
|
||||
['geo'],
|
||||
<JSON> startupConfiguration
|
||||
);
|
||||
|
||||
WikitudePlugin.setOnUrlInvokeCallback(url => {
|
||||
if (url.indexOf('captureScreen') > -1) {
|
||||
WikitudePlugin.captureScreen(
|
||||
absoluteFilePath => {
|
||||
WikitudePlugin.callJavaScript(
|
||||
`World.testFunction('Screenshot saved at: ${absoluteFilePath}');`
|
||||
);
|
||||
},
|
||||
errorMessage => {
|
||||
console.log(errorMessage);
|
||||
},
|
||||
true,
|
||||
null
|
||||
);
|
||||
} else {
|
||||
alert(url + 'not handled');
|
||||
}
|
||||
});
|
||||
@@ -0,0 +1,82 @@
|
||||
// Type definitions for com.wikitude.phonegap.wikitudeplugin 7.2
|
||||
// Project: https://github.com/Wikitude/wikitude-cordova-plugin
|
||||
// Definitions by: zbarbuto <https://github.com/zbarbuto>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.2
|
||||
|
||||
// The following types are taken directly (unmodified) from the wikitude-ionic-3-starter-app
|
||||
// https://github.com/pbreuss/wikitude-ionic-3-starter-app
|
||||
// Latest commit at time of writing was 647cd546f6d1805765c4cee725566e246ca6259d
|
||||
|
||||
/**
|
||||
* Wrapper for the Wikitude SDK Phonegap Plugin - to use with IONIC2
|
||||
* (c) 2016 Schneeweis.Technology
|
||||
*/
|
||||
interface WikitudePlugin {
|
||||
isDeviceSupported(
|
||||
successCallback: (success: string) => void,
|
||||
errorCallback: (message: string) => void,
|
||||
requiredFeatures: [string]
|
||||
): void;
|
||||
|
||||
loadARchitectWorld(
|
||||
successCallback: (success: string) => void,
|
||||
errorCallback: (message: string) => void,
|
||||
architectWorldPath: string,
|
||||
requiredFeatures: [string],
|
||||
startupConfiguration: JSON | object
|
||||
): void;
|
||||
|
||||
close(): void;
|
||||
|
||||
hide(): void;
|
||||
|
||||
show(): void;
|
||||
|
||||
// test type ok?
|
||||
callJavaScript(js: any): void;
|
||||
|
||||
setOnUrlInvokeCallback(onUrlInvokeCallback: (success: string) => void): void;
|
||||
|
||||
setLocation(latitude: any, longitude: any, altitude: any, accuracy: any): void;
|
||||
|
||||
captureScreen(
|
||||
successCallback: (success: string) => void,
|
||||
errorCallback: (message: string) => void,
|
||||
includeWebView: boolean,
|
||||
imagePathInBundleOrNullForPhotoLibrary: string | null
|
||||
): void;
|
||||
|
||||
setErrorHandler(errorHandler: (message: string) => void): void;
|
||||
|
||||
setDeviceSensorsNeedCalibrationHandler(
|
||||
startCalibrationHandler: (message: string) => void
|
||||
): void;
|
||||
|
||||
setDeviceSensorsFinishedCalibrationHandler(
|
||||
finishedCalibrationHandler: (message: string) => void
|
||||
): void;
|
||||
|
||||
setBackButtonCallback(onBackButtonCallback: (message: string) => void): void;
|
||||
|
||||
/* Lifecycle updates */
|
||||
|
||||
onResume(): void;
|
||||
onBackButton(): void;
|
||||
onPause(): void;
|
||||
|
||||
onWikitudeOK(): void;
|
||||
onWikitudeError(): void;
|
||||
|
||||
_sdkKey: string;
|
||||
FeatureGeo: string;
|
||||
Feature2DTracking: string;
|
||||
CameraPositionUndefined: number;
|
||||
CameraPositionFront: number;
|
||||
CameraPositionBack: number;
|
||||
CameraFocusRangeNone: number;
|
||||
CameraFocusRangeNear: number;
|
||||
CameraFocusRangeFar: number;
|
||||
}
|
||||
|
||||
declare var WikitudePlugin: WikitudePlugin;
|
||||
@@ -0,0 +1,24 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6",
|
||||
"dom"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"com.wikitude.phonegap.wikitudeplugin-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"extends": "dtslint/dt.json"
|
||||
}
|
||||
@@ -7,7 +7,10 @@
|
||||
"paths": {
|
||||
"mongodb": [
|
||||
"mongodb/v2"
|
||||
]
|
||||
],
|
||||
"mongoose": [
|
||||
"mongoose/v4"
|
||||
]
|
||||
},
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
@@ -25,4 +28,4 @@
|
||||
"index.d.ts",
|
||||
"connect-mongo-tests.ts"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
import csso = require('csso');
|
||||
|
||||
csso.minify('.test { color: #ff0000; }').css;
|
||||
csso.minify('.test { color: #ff0000; }').map;
|
||||
csso.minify('.test { color: #ff0000; }', {
|
||||
sourceMap: true,
|
||||
filename: '',
|
||||
debug: true,
|
||||
beforeCompress: () => {},
|
||||
afterCompress: () => {},
|
||||
restructure: false,
|
||||
forceMediaMerge: true,
|
||||
clone: false,
|
||||
comments: '',
|
||||
logger: () => {}
|
||||
});
|
||||
|
||||
csso.minifyBlock('color: rgba(255, 0, 0, 1); color: #ff0000').css;
|
||||
csso.minifyBlock('color: rgba(255, 0, 0, 1); color: #ff0000').map;
|
||||
csso.minifyBlock('color: rgba(255, 0, 0, 1); color: #ff0000', {
|
||||
sourceMap: true,
|
||||
filename: '',
|
||||
debug: true,
|
||||
beforeCompress: () => {},
|
||||
afterCompress: () => {},
|
||||
restructure: false,
|
||||
forceMediaMerge: true,
|
||||
clone: false,
|
||||
comments: '',
|
||||
logger: () => {}
|
||||
});
|
||||
|
||||
csso.compress({}).ast;
|
||||
csso.compress({}, {
|
||||
restructure: false,
|
||||
forceMediaMerge: true,
|
||||
clone: false,
|
||||
comments: '',
|
||||
logger: () => {}
|
||||
}).ast;
|
||||
Vendored
+107
@@ -0,0 +1,107 @@
|
||||
// Type definitions for csso 3.5
|
||||
// Project: https://github.com/css/csso
|
||||
// Definitions by: Christian Rackerseder <https://github.com/screendriver>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.6
|
||||
|
||||
declare namespace csso {
|
||||
interface Result {
|
||||
/**
|
||||
* Resulting CSS.
|
||||
*/
|
||||
css: string;
|
||||
/**
|
||||
* Instance of SourceMapGenerator or null.
|
||||
*/
|
||||
map: object | null;
|
||||
}
|
||||
|
||||
interface CompressOptions {
|
||||
/**
|
||||
* Disable or enable a structure optimisations.
|
||||
* @default true
|
||||
*/
|
||||
restructure?: boolean;
|
||||
/**
|
||||
* Enables merging of @media rules with the same media query by splitted by other rules.
|
||||
* The optimisation is unsafe in general, but should work fine in most cases. Use it on your own risk.
|
||||
* @default false
|
||||
*/
|
||||
forceMediaMerge?: boolean;
|
||||
/**
|
||||
* Transform a copy of input AST if true. Useful in case of AST reuse.
|
||||
* @default false
|
||||
*/
|
||||
clone?: boolean;
|
||||
/**
|
||||
* Specify what comments to leave:
|
||||
* - 'exclamation' or true – leave all exclamation comments
|
||||
* - 'first-exclamation' – remove every comment except first one
|
||||
* - false – remove all comments
|
||||
* @default true
|
||||
*/
|
||||
comments?: string | boolean;
|
||||
/**
|
||||
* Usage data for advanced optimisations.
|
||||
*/
|
||||
usage?: object;
|
||||
/**
|
||||
* Function to track every step of transformation.
|
||||
*/
|
||||
logger?: () => void;
|
||||
}
|
||||
|
||||
interface MinifyOptions {
|
||||
/**
|
||||
* Generate a source map when true.
|
||||
* @default false
|
||||
*/
|
||||
sourceMap?: boolean;
|
||||
/**
|
||||
* Filename of input CSS, uses for source map generation.
|
||||
* @default '<unknown>'
|
||||
*/
|
||||
filename?: string;
|
||||
/**
|
||||
* Output debug information to stderr.
|
||||
* @default false
|
||||
*/
|
||||
debug?: boolean;
|
||||
/**
|
||||
* Called right after parse is run.
|
||||
*/
|
||||
beforeCompress?: BeforeCompressFn | BeforeCompressFn[];
|
||||
/**
|
||||
* Called right after compress() is run.
|
||||
*/
|
||||
afterCompress?: AfterCompressFn | AfterCompressFn[];
|
||||
restructure?: boolean;
|
||||
}
|
||||
|
||||
type BeforeCompressFn = (ast: object, options: CompressOptions) => void;
|
||||
type AfterCompressFn = (compressResult: string, options: CompressOptions) => void;
|
||||
}
|
||||
|
||||
interface Csso {
|
||||
/**
|
||||
* Minify source CSS passed as String
|
||||
* @param source
|
||||
* @param options
|
||||
*/
|
||||
minify(source: string, options?: csso.MinifyOptions & csso.CompressOptions): csso.Result;
|
||||
|
||||
/**
|
||||
* The same as minify() but for list of declarations. Usually it's a style attribute value.
|
||||
* @param source
|
||||
* @param options
|
||||
*/
|
||||
minifyBlock(source: string, options?: csso.MinifyOptions & csso.CompressOptions): csso.Result;
|
||||
|
||||
/**
|
||||
* Does the main task – compress an AST.
|
||||
*/
|
||||
compress(ast: object, options?: csso.CompressOptions): { ast: object };
|
||||
}
|
||||
|
||||
declare const csso: Csso;
|
||||
export = csso;
|
||||
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"csso-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
@@ -2,14 +2,8 @@
|
||||
|
||||
// TODO: document all aliases as aliases, not as duplicates!
|
||||
|
||||
const assert = (tag: boolean) => { if (!tag) throw new Error(); };
|
||||
const aliases = (...obj: Array<{}>) => { if (obj.slice(1).some((alias) => alias !== obj[0])) throw new Error(); };
|
||||
const events = (obj: any) => {
|
||||
aliases(obj.on, obj.bind, obj.listen, obj.addListener);
|
||||
aliases(obj.promiseOn, obj.pon);
|
||||
aliases(obj.off, obj.unbind, obj.unlisten, obj.removeListener);
|
||||
aliases(obj.emit, obj.trigger);
|
||||
};
|
||||
const assert = (tag: boolean) => {};
|
||||
const aliases = (...obj: Array<{}>) => {};
|
||||
|
||||
// definitions
|
||||
function oneOf<A, B, C, D, E>(a: A, b: B, c: C, d: D, e: E): A | B | C | D | E;
|
||||
@@ -129,7 +123,7 @@ cy.on('zoom', (event) => {
|
||||
}
|
||||
});
|
||||
cy.off('zoom');
|
||||
events(cy);
|
||||
// events(cy); - TODO
|
||||
|
||||
cy.add({ data: { id: 'g' }, position: {x: 200, y: 150} });
|
||||
cy.add([
|
||||
@@ -383,11 +377,18 @@ assert(eles.removed());
|
||||
assert(!eles.inside());
|
||||
eles.restore();
|
||||
|
||||
([ele, eles, node, nodes, edge, edges] as cytoscape.CollectionReturnValue[]).forEach((elem) => {
|
||||
aliases(elem.clone, elem.copy);
|
||||
events(elem);
|
||||
aliases(elem.data, elem.attr);
|
||||
aliases(elem.removeData, elem.removeAttr);
|
||||
([ele, eles, node, nodes, edge, edges] as [
|
||||
cytoscape.SingularElementReturnValue,
|
||||
cytoscape.CollectionReturnValue,
|
||||
cytoscape.NodeSingular,
|
||||
cytoscape.NodeCollection,
|
||||
cytoscape.EdgeSingular,
|
||||
cytoscape.EdgeCollection
|
||||
]).forEach((elemType) => {
|
||||
aliases(elemType.clone, elemType.copy);
|
||||
// events(elemType); - TODO
|
||||
aliases(elemType.data, elemType.attr);
|
||||
aliases(elemType.removeData, elemType.removeAttr);
|
||||
});
|
||||
// TODO: tests for data flow
|
||||
|
||||
@@ -490,6 +491,6 @@ eles.reduce<any[]>((prev, ele, i, eles) => [...prev, [ele, i]], []).concat(['fin
|
||||
const min = eles.min((ele, i, eles) => ele.id.length + i); min.ele.scratch('min', min.value);
|
||||
const max = eles.max((ele, i, eles) => ele.id.length + i); max.ele.scratch('max', max.value);
|
||||
|
||||
// TODO: traversing (need to actively check the nodes/edeges distinction)
|
||||
// TODO: traversing (need to actively check the nodes/edges distinction)
|
||||
// TODO: algorithms
|
||||
// TODO: compound nodes (there aren't any in current test case)
|
||||
|
||||
Vendored
+25
-10
@@ -1118,7 +1118,7 @@ declare namespace cytoscape {
|
||||
* http://js.cytoscape.org/#collection
|
||||
*/
|
||||
interface Collection<TOut = SingularElementReturnValue, TIn = SingularElementArgument>
|
||||
extends Singular,
|
||||
extends
|
||||
CollectionGraphManipulation, CollectionEvents,
|
||||
CollectionData, CollectionPosition,
|
||||
CollectionLayout,
|
||||
@@ -1129,8 +1129,10 @@ declare namespace cytoscape {
|
||||
/**
|
||||
* ele --> Cy.Singular
|
||||
* a collection of a single element (node or edge)
|
||||
* NB: every singular collection is a general collection too (but not vice versa)!
|
||||
*/
|
||||
interface Singular extends
|
||||
interface Singular<TOut = SingularElementReturnValue, TIn = SingularElementArgument>
|
||||
extends Collection<TOut, TIn>,
|
||||
SingularGraphManipulation,
|
||||
SingularData, SingularPosition,
|
||||
SingularSelection, SingularStyle, SingularAnimation { }
|
||||
@@ -1154,7 +1156,7 @@ declare namespace cytoscape {
|
||||
*
|
||||
* The output is a collection of edge elements OR single edge.
|
||||
*/
|
||||
interface EdgeCollection extends Collection<EdgeSingular, EdgeSingular>, EdgeSingular,
|
||||
interface EdgeCollection extends EdgeSingular,
|
||||
EdgeCollectionTraversing { }
|
||||
/**
|
||||
* nodes -> Cy.NodeCollection
|
||||
@@ -1162,7 +1164,7 @@ declare namespace cytoscape {
|
||||
*
|
||||
* The output is a collection of node elements OR single node.
|
||||
*/
|
||||
interface NodeCollection extends Collection<NodeSingular, NodeSingular>, NodeSingular,
|
||||
interface NodeCollection extends NodeSingular,
|
||||
NodeCollectionMetadata, NodeCollectionPosition, NodeCollectionTraversing,
|
||||
NodeCollectionCompound { }
|
||||
|
||||
@@ -1172,14 +1174,14 @@ declare namespace cytoscape {
|
||||
* edge --> Cy.EdgeSingular
|
||||
* a collection of a single edge
|
||||
*/
|
||||
interface EdgeSingular extends Singular,
|
||||
interface EdgeSingular extends Singular<EdgeSingular, EdgeSingular>,
|
||||
EdgeSingularData, EdgeSingularPoints, EdgeSingularTraversing { }
|
||||
|
||||
/**
|
||||
* node --> Cy.NodeSingular
|
||||
* a collection of a single node
|
||||
*/
|
||||
interface NodeSingular extends Singular,
|
||||
interface NodeSingular extends Singular<NodeSingular, NodeSingular>,
|
||||
NodeSingularMetadata, NodeSingularPosition, NodeSingularCompound { }
|
||||
|
||||
/**
|
||||
@@ -1251,6 +1253,15 @@ declare namespace cytoscape {
|
||||
on(events: EventNames, selector: string, data: any, handler: EventHandler): void;
|
||||
on(events: EventNames, selector: string, handler: EventHandler): void;
|
||||
on(events: EventNames, handler: EventHandler): void;
|
||||
bind(events: EventNames, selector: string, data: any, handler: EventHandler): void;
|
||||
bind(events: EventNames, selector: string, handler: EventHandler): void;
|
||||
bind(events: EventNames, handler: EventHandler): void;
|
||||
listen(events: EventNames, selector: string, data: any, handler: EventHandler): void;
|
||||
listen(events: EventNames, selector: string, handler: EventHandler): void;
|
||||
listen(events: EventNames, handler: EventHandler): void;
|
||||
addListener(events: EventNames, selector: string, data: any, handler: EventHandler): void;
|
||||
addListener(events: EventNames, selector: string, handler: EventHandler): void;
|
||||
addListener(events: EventNames, handler: EventHandler): void;
|
||||
/**
|
||||
* http://js.cytoscape.org/#eles.promiseOn
|
||||
* alias: pon
|
||||
@@ -1280,11 +1291,15 @@ declare namespace cytoscape {
|
||||
* alias unbind, unlisten, removeListener
|
||||
*/
|
||||
off(events: EventNames, selector?: string, handler?: EventHandler): void;
|
||||
unbind(events: EventNames, selector?: string, handler?: EventHandler): void;
|
||||
unlisten(events: EventNames, selector?: string, handler?: EventHandler): void;
|
||||
removeListener(events: EventNames, selector?: string, handler?: EventHandler): void;
|
||||
/**
|
||||
* http://js.cytoscape.org/#eles.trigger
|
||||
* alias: emit
|
||||
*/
|
||||
trigger(events: EventNames, extra?: string[]): void;
|
||||
emit(events: EventNames, extra?: string[]): void;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -2747,28 +2762,28 @@ declare namespace cytoscape {
|
||||
*
|
||||
* @param selector [optional] An optional selector that is used to filter the resultant collection.
|
||||
*/
|
||||
outgoers(selector?: Selector): EdgeCollection;
|
||||
outgoers(selector?: Selector): CollectionReturnValue;
|
||||
|
||||
/**
|
||||
* Recursively get edges (and their targets) coming out of the nodes in the collection (i.e. the outgoers, the outgoers' outgoers, ...).
|
||||
*
|
||||
* @param selector [optional] An optional selector that is used to filter the resultant collection.
|
||||
*/
|
||||
successors(selector?: Selector): EdgeCollection;
|
||||
successors(selector?: Selector): CollectionReturnValue;
|
||||
|
||||
/**
|
||||
* Get edges (and their sources) coming into the nodes in the collection.
|
||||
*
|
||||
* @param selector [optional] An optional selector that is used to filter the resultant collection.
|
||||
*/
|
||||
incomers(selector?: Selector): EdgeCollection;
|
||||
incomers(selector?: Selector): CollectionReturnValue;
|
||||
|
||||
/**
|
||||
* Recursively get edges (and their sources) coming into the nodes in the collection (i.e. the incomers, the incomers' incomers, ...).
|
||||
*
|
||||
* @param selector [optional] An optional selector that is used to filter the resultant collection.
|
||||
*/
|
||||
predecessors(selector?: Selector): EdgeCollection;
|
||||
predecessors(selector?: Selector): CollectionReturnValue;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Vendored
+2
-2
@@ -51,8 +51,7 @@ export class GUI {
|
||||
__folders: GUI[];
|
||||
domElement: HTMLElement;
|
||||
|
||||
add(target: Object, propName:string): GUIController;
|
||||
add(target: Object, propName:string, min: number, max: number): GUIController;
|
||||
add(target: Object, propName:string, min?: number, max?: number, step?: number): GUIController;
|
||||
add(target: Object, propName:string, status: boolean): GUIController;
|
||||
add(target: Object, propName:string, items:string[]): GUIController;
|
||||
add(target: Object, propName:string, items:number[]): GUIController;
|
||||
@@ -64,6 +63,7 @@ export class GUI {
|
||||
destroy(): void;
|
||||
|
||||
addFolder(propName:string): GUI;
|
||||
removeFolder(subFolder:GUI):void;
|
||||
|
||||
open(): void;
|
||||
close(): void;
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
$(document).ready(() => {
|
||||
const config: DataTables.Settings = {
|
||||
// Scroller extension options
|
||||
scroller: {
|
||||
trace: true,
|
||||
rowHeight: 30,
|
||||
serverWait: 1000,
|
||||
displayBuffer: 10,
|
||||
boundaryScale: 0.6,
|
||||
loadingIndicator: true
|
||||
}
|
||||
};
|
||||
});
|
||||
+106
@@ -0,0 +1,106 @@
|
||||
// Type definitions for datatables.net-scroller 1.4
|
||||
// Project: https://datatables.net
|
||||
// Definitions by: Konstantin Rohde <https://github.com/RohdeK>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.4
|
||||
|
||||
/// <reference types="jquery" />
|
||||
/// <reference types="datatables.net"/>
|
||||
|
||||
declare namespace DataTables {
|
||||
interface Settings {
|
||||
/*
|
||||
* Select extension options
|
||||
*/
|
||||
scroller?: boolean | ScrollerSettings;
|
||||
}
|
||||
|
||||
interface ScrollerSettings {
|
||||
/*
|
||||
* Indicate if Scroller show show trace information on the console or not.
|
||||
*/
|
||||
trace?: boolean;
|
||||
|
||||
/*
|
||||
* Scroller will attempt to automatically calculate the height of rows for it's internal
|
||||
* calculations. However the height that is used can be overridden using this parameter.
|
||||
*/
|
||||
rowHeight?: number | string;
|
||||
|
||||
/*
|
||||
* When using server-side processing, Scroller will wait a small amount of time to allow
|
||||
* the scrolling to finish before requesting more data from the server.
|
||||
*/
|
||||
serverWait?: number;
|
||||
|
||||
/*
|
||||
* The display buffer is what Scroller uses to calculate how many rows it should pre-fetch
|
||||
* for scrolling.
|
||||
*/
|
||||
displayBuffer?: number;
|
||||
|
||||
/*
|
||||
* Scroller uses the boundary scaling factor to decide when to redraw the table - which it
|
||||
* typically does before you reach the end of the currently loaded data set (in order to
|
||||
* allow the data to look continuous to a user scrolling through the data).
|
||||
*/
|
||||
boundaryScale?: number;
|
||||
|
||||
/*
|
||||
* Show (or not) the loading element in the background of the table. Note that you should
|
||||
* include the dataTables.scroller.css file for this to be displayed correctly.
|
||||
*/
|
||||
loadingIndicator?: boolean;
|
||||
}
|
||||
|
||||
interface Api {
|
||||
scroller: ScrollerMethodsModel;
|
||||
}
|
||||
|
||||
interface ScrollerMethodsModel {
|
||||
/*
|
||||
* Calculate and store information about how many rows are to be displayed
|
||||
* in the scrolling viewport, based on current dimensions in the browser's
|
||||
* rendering.
|
||||
*/
|
||||
measure(redraw?: boolean): Api;
|
||||
/*
|
||||
* Get information about current displayed record range.
|
||||
*/
|
||||
page(): PageInfo;
|
||||
/*
|
||||
* Get Scroller Api
|
||||
*/
|
||||
scroller(): ScrollerMethods;
|
||||
}
|
||||
|
||||
interface ScrollerMethods extends Api {
|
||||
/*
|
||||
* Calculate the pixel position from the top of the scrolling container for
|
||||
* a given row
|
||||
*/
|
||||
rowToPixels(rowIdx: number, intParse?: boolean, virtual?: boolean): number;
|
||||
/*
|
||||
* Calculate the row number that will be found at the given pixel position
|
||||
* (y-scroll).
|
||||
*/
|
||||
pixelsToRow(pixels: number, intParse?: boolean, virtual?: boolean): number;
|
||||
scrollToRow(rowIdx: number, animate?: boolean): Api;
|
||||
}
|
||||
|
||||
/*
|
||||
* start: {int}, // the 0-indexed record at the top of the viewport
|
||||
* end: {int}, // the 0-indexed record at the bottom of the viewport
|
||||
*/
|
||||
interface PageInfo {
|
||||
start: number;
|
||||
end: number;
|
||||
}
|
||||
|
||||
interface RowMethods {
|
||||
/**
|
||||
* Scroll to a row
|
||||
*/
|
||||
scrollTo(animate?: boolean): Api;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6",
|
||||
"dom"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"datatables.net-scroller-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
@@ -0,0 +1,3 @@
|
||||
import emojiRegex from "emoji-regex";
|
||||
|
||||
emojiRegex(); // $ExpectType RegExp
|
||||
Vendored
+7
@@ -0,0 +1,7 @@
|
||||
// Type definitions for emoji-regex 7.0
|
||||
// Project: https://github.com/mathiasbynens/emoji-regex
|
||||
// Definitions by: iKBAHT <https://github.com/iKBAHT>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
declare function createRegExp(): RegExp;
|
||||
export = createRegExp;
|
||||
@@ -0,0 +1,24 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"allowSyntheticDefaultImports": true,
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictFunctionTypes": true,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"emoji-regex-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
@@ -0,0 +1,4 @@
|
||||
import { CallData, BlockParamLiteral } from 'ethereum-protocol';
|
||||
BlockParamLiteral.Earliest;
|
||||
BlockParamLiteral.Latest;
|
||||
BlockParamLiteral.Pending;
|
||||
Vendored
+293
@@ -0,0 +1,293 @@
|
||||
// Type definitions for ethereum-protocol 1.0
|
||||
// Project: https://www.npmjs.com/package/ethereum-protocol
|
||||
// Definitions by: Leonid Logvinov <https://github.com/LogvinovLeon>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.4
|
||||
|
||||
import BigNumber from 'bignumber.js';
|
||||
|
||||
export type JSONRPCErrorCallback = (err: Error | null, result?: JSONRPCResponsePayload) => void;
|
||||
|
||||
/**
|
||||
* Do not create your own provider. Use an existing provider from a Web3 or ProviderEngine library
|
||||
* Read more about Providers in the 0x wiki.
|
||||
*/
|
||||
export interface Provider {
|
||||
sendAsync(payload: JSONRPCRequestPayload, callback: JSONRPCErrorCallback): void;
|
||||
}
|
||||
|
||||
export type ContractAbi = AbiDefinition[];
|
||||
|
||||
export type AbiDefinition = FunctionAbi | EventAbi;
|
||||
|
||||
export type FunctionAbi = MethodAbi | ConstructorAbi | FallbackAbi;
|
||||
|
||||
export type ConstructorStateMutability = 'nonpayable' | 'payable';
|
||||
export type StateMutability = 'pure' | 'view' | ConstructorStateMutability;
|
||||
|
||||
export enum AbiType {
|
||||
Function = 'function',
|
||||
Constructor = 'constructor',
|
||||
Event = 'event',
|
||||
Fallback = 'fallback',
|
||||
}
|
||||
|
||||
export interface MethodAbi {
|
||||
type: AbiType.Function;
|
||||
name: string;
|
||||
inputs: DataItem[];
|
||||
outputs: DataItem[];
|
||||
constant: boolean;
|
||||
stateMutability: StateMutability;
|
||||
payable: boolean;
|
||||
}
|
||||
|
||||
export interface ConstructorAbi {
|
||||
type: AbiType.Constructor;
|
||||
inputs: DataItem[];
|
||||
payable: boolean;
|
||||
stateMutability: ConstructorStateMutability;
|
||||
}
|
||||
|
||||
export interface FallbackAbi {
|
||||
type: AbiType.Fallback;
|
||||
payable: boolean;
|
||||
}
|
||||
|
||||
export interface EventParameter extends DataItem {
|
||||
indexed: boolean;
|
||||
}
|
||||
|
||||
export interface EventAbi {
|
||||
type: AbiType.Event;
|
||||
name: string;
|
||||
inputs: EventParameter[];
|
||||
anonymous: boolean;
|
||||
}
|
||||
|
||||
export interface DataItem {
|
||||
name: string;
|
||||
type: string;
|
||||
components?: DataItem[];
|
||||
}
|
||||
|
||||
export enum OpCode {
|
||||
DelegateCall = 'DELEGATECALL',
|
||||
Revert = 'REVERT',
|
||||
Create = 'CREATE',
|
||||
Stop = 'STOP',
|
||||
Invalid = 'INVALID',
|
||||
CallCode = 'CALLCODE',
|
||||
StaticCall = 'STATICCALL',
|
||||
Return = 'RETURN',
|
||||
Call = 'CALL',
|
||||
SelfDestruct = 'SELFDESTRUCT',
|
||||
}
|
||||
|
||||
export interface StructLog {
|
||||
depth: number;
|
||||
error: string;
|
||||
gas: number;
|
||||
gasCost: number;
|
||||
memory: string[];
|
||||
op: OpCode;
|
||||
pc: number;
|
||||
stack: string[];
|
||||
storage: { [location: string]: string };
|
||||
}
|
||||
|
||||
export interface TransactionTrace {
|
||||
gas: number;
|
||||
returnValue: any;
|
||||
structLogs: StructLog[];
|
||||
}
|
||||
|
||||
export type Unit =
|
||||
| 'kwei'
|
||||
| 'ada'
|
||||
| 'mwei'
|
||||
| 'babbage'
|
||||
| 'gwei'
|
||||
| 'shannon'
|
||||
| 'szabo'
|
||||
| 'finney'
|
||||
| 'ether'
|
||||
| 'kether'
|
||||
| 'grand'
|
||||
| 'einstein'
|
||||
| 'mether'
|
||||
| 'gether'
|
||||
| 'tether';
|
||||
|
||||
export interface JSONRPCRequestPayload {
|
||||
params: any[];
|
||||
method: string;
|
||||
id: number;
|
||||
jsonrpc: string;
|
||||
}
|
||||
|
||||
export interface JSONRPCResponsePayload {
|
||||
result: any;
|
||||
id: number;
|
||||
jsonrpc: string;
|
||||
}
|
||||
|
||||
export interface AbstractBlock {
|
||||
number: number | null;
|
||||
hash: string | null;
|
||||
parentHash: string;
|
||||
nonce: string | null;
|
||||
sha3Uncles: string;
|
||||
logsBloom: string | null;
|
||||
transactionsRoot: string;
|
||||
stateRoot: string;
|
||||
miner: string;
|
||||
difficulty: BigNumber;
|
||||
totalDifficulty: BigNumber;
|
||||
extraData: string;
|
||||
size: number;
|
||||
gasLimit: number;
|
||||
gasUsed: number;
|
||||
timestamp: number;
|
||||
uncles: string[];
|
||||
}
|
||||
|
||||
export interface BlockWithoutTransactionData extends AbstractBlock {
|
||||
transactions: string[];
|
||||
}
|
||||
|
||||
export interface BlockWithTransactionData extends AbstractBlock {
|
||||
transactions: Transaction[];
|
||||
}
|
||||
|
||||
export interface Transaction {
|
||||
hash: string;
|
||||
nonce: number;
|
||||
blockHash: string | null;
|
||||
blockNumber: number | null;
|
||||
transactionIndex: number | null;
|
||||
from: string;
|
||||
to: string | null;
|
||||
value: BigNumber;
|
||||
gasPrice: BigNumber;
|
||||
gas: number;
|
||||
input: string;
|
||||
}
|
||||
|
||||
export interface CallTxDataBase {
|
||||
to?: string;
|
||||
value?: number | string | BigNumber;
|
||||
gas?: number | string | BigNumber;
|
||||
gasPrice?: number | string | BigNumber;
|
||||
data?: string;
|
||||
nonce?: number;
|
||||
}
|
||||
|
||||
export interface TxData extends CallTxDataBase {
|
||||
from: string;
|
||||
}
|
||||
|
||||
export interface CallData extends CallTxDataBase {
|
||||
from?: string;
|
||||
}
|
||||
|
||||
export interface FilterObject {
|
||||
fromBlock?: number | string;
|
||||
toBlock?: number | string;
|
||||
address?: string;
|
||||
topics?: LogTopic[];
|
||||
}
|
||||
|
||||
export type LogTopic = null | string | string[];
|
||||
|
||||
export interface DecodedLogEntry<A> extends LogEntry {
|
||||
event: string;
|
||||
args: A;
|
||||
}
|
||||
|
||||
export interface DecodedLogEntryEvent<A> extends DecodedLogEntry<A> {
|
||||
removed: boolean;
|
||||
}
|
||||
|
||||
export interface LogEntryEvent extends LogEntry {
|
||||
removed: boolean;
|
||||
}
|
||||
|
||||
export interface LogEntry {
|
||||
logIndex: number | null;
|
||||
transactionIndex: number | null;
|
||||
transactionHash: string;
|
||||
blockHash: string | null;
|
||||
blockNumber: number | null;
|
||||
address: string;
|
||||
data: string;
|
||||
topics: string[];
|
||||
}
|
||||
|
||||
export interface TxDataPayable extends TxData {
|
||||
value?: BigNumber;
|
||||
}
|
||||
|
||||
export interface TransactionReceipt {
|
||||
blockHash: string;
|
||||
blockNumber: number;
|
||||
transactionHash: string;
|
||||
transactionIndex: number;
|
||||
from: string;
|
||||
to: string;
|
||||
status: null | string | 0 | 1;
|
||||
cumulativeGasUsed: number;
|
||||
gasUsed: number;
|
||||
contractAddress: string | null;
|
||||
logs: LogEntry[];
|
||||
}
|
||||
|
||||
export type ContractEventArg = string | BigNumber | number | boolean;
|
||||
|
||||
export interface DecodedLogArgs {
|
||||
[argName: string]: ContractEventArg;
|
||||
}
|
||||
|
||||
export interface LogWithDecodedArgs<ArgsType extends DecodedLogArgs> extends DecodedLogEntry<ArgsType> {}
|
||||
export type RawLog = LogEntry;
|
||||
|
||||
export enum BlockParamLiteral {
|
||||
Earliest = 'earliest',
|
||||
Latest = 'latest',
|
||||
Pending = 'pending',
|
||||
}
|
||||
|
||||
export type BlockParam = BlockParamLiteral | number;
|
||||
|
||||
export interface RawLogEntry {
|
||||
logIndex: string | null;
|
||||
transactionIndex: string | null;
|
||||
transactionHash: string;
|
||||
blockHash: string | null;
|
||||
blockNumber: string | null;
|
||||
address: string;
|
||||
data: string;
|
||||
topics: string[];
|
||||
}
|
||||
|
||||
export enum SolidityTypes {
|
||||
Address = 'address',
|
||||
Uint256 = 'uint256',
|
||||
Uint8 = 'uint8',
|
||||
Uint = 'uint',
|
||||
}
|
||||
|
||||
/**
|
||||
* Contains the logs returned by a TransactionReceipt. We attempt to decode the
|
||||
* logs using AbiDecoder. If we have the logs corresponding ABI, we decode it,
|
||||
* otherwise we don't.
|
||||
*/
|
||||
export interface TransactionReceiptWithDecodedLogs extends TransactionReceipt {
|
||||
logs: Array<LogWithDecodedArgs<DecodedLogArgs> | LogEntry>;
|
||||
}
|
||||
|
||||
export interface TraceParams {
|
||||
disableMemory?: boolean;
|
||||
disableStack?: boolean;
|
||||
disableStorage?: boolean;
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"private": true,
|
||||
"dependencies": { "bignumber.js": "7.2.1" }
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": ["es6"],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": ["../"],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": ["index.d.ts", "ethereum-protocol-tests.ts"]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Vendored
+5
-4
@@ -1,6 +1,6 @@
|
||||
// Type definitions for node-ffi 0.1
|
||||
// Type definitions for node-ffi 0.2
|
||||
// Project: https://github.com/rbranson/node-ffi
|
||||
// Definitions by: Paul Loyd <https://github.com/loyd>
|
||||
// Definitions by: Paul Loyd <https://github.com/loyd>, Waiting Song <https://github.com/waitingsong>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.2
|
||||
|
||||
@@ -135,12 +135,13 @@ export const DynamicLibrary: {
|
||||
* The function pointer may be used in other C functions that
|
||||
* accept C callback functions.
|
||||
*/
|
||||
export const Callback: {
|
||||
export interface Callback {
|
||||
new (retType: any, argTypes: any[], abi: number, fn: any): Buffer;
|
||||
new (retType: any, argTypes: any[], fn: any): Buffer;
|
||||
(retType: any, argTypes: any[], abi: number, fn: any): Buffer;
|
||||
(retType: any, argTypes: any[], fn: any): Buffer;
|
||||
};
|
||||
}
|
||||
export const Callback: Callback;
|
||||
|
||||
export const ffiType: {
|
||||
/** Get a `ffi_type *` Buffer appropriate for the given type. */
|
||||
|
||||
Vendored
+1
-1
@@ -214,7 +214,7 @@ declare module "dgram" {
|
||||
*
|
||||
*
|
||||
*/
|
||||
export class DgramSocket extends Class_DgramSocket {}
|
||||
export class Socket extends Class_DgramSocket {}
|
||||
|
||||
|
||||
|
||||
|
||||
Vendored
+7
-7
@@ -196,7 +196,7 @@
|
||||
|
||||
/** module Or Internal Object */
|
||||
/**
|
||||
* @brief 超文本传输协议模块,用以支持 http 协议处理
|
||||
* @brief 超文本传输协议模块,用以支持 http 协议处理,模块别名:https
|
||||
* @detail
|
||||
*/
|
||||
declare module "http" {
|
||||
@@ -212,7 +212,7 @@ declare module "http" {
|
||||
*
|
||||
*
|
||||
*/
|
||||
export class HttpRequest extends Class_HttpRequest {}
|
||||
export class Request extends Class_HttpRequest {}
|
||||
|
||||
|
||||
/**
|
||||
@@ -221,7 +221,7 @@ declare module "http" {
|
||||
*
|
||||
*
|
||||
*/
|
||||
export class HttpResponse extends Class_HttpResponse {}
|
||||
export class Response extends Class_HttpResponse {}
|
||||
|
||||
|
||||
/**
|
||||
@@ -230,7 +230,7 @@ declare module "http" {
|
||||
*
|
||||
*
|
||||
*/
|
||||
export class HttpCookie extends Class_HttpCookie {}
|
||||
export class Cookie extends Class_HttpCookie {}
|
||||
|
||||
|
||||
/**
|
||||
@@ -239,7 +239,7 @@ declare module "http" {
|
||||
*
|
||||
*
|
||||
*/
|
||||
export class HttpServer extends Class_HttpServer {}
|
||||
export class Server extends Class_HttpServer {}
|
||||
|
||||
|
||||
/**
|
||||
@@ -248,7 +248,7 @@ declare module "http" {
|
||||
*
|
||||
*
|
||||
*/
|
||||
export class HttpClient extends Class_HttpClient {}
|
||||
export class Client extends Class_HttpClient {}
|
||||
|
||||
|
||||
/**
|
||||
@@ -266,7 +266,7 @@ declare module "http" {
|
||||
*
|
||||
*
|
||||
*/
|
||||
export class HttpHandler extends Class_HttpHandler {}
|
||||
export class Handler extends Class_HttpHandler {}
|
||||
|
||||
|
||||
|
||||
|
||||
Vendored
+1
-1
@@ -271,7 +271,7 @@ declare module "net" {
|
||||
*
|
||||
*
|
||||
*/
|
||||
export class UrlObject extends Class_UrlObject {}
|
||||
export class Url extends Class_UrlObject {}
|
||||
|
||||
|
||||
|
||||
|
||||
Vendored
+4
-4
@@ -196,7 +196,7 @@
|
||||
|
||||
/** module Or Internal Object */
|
||||
/**
|
||||
* @brief ssl/tls 模块
|
||||
* @brief ssl/tls 模块,模块别名:tls
|
||||
* @detail
|
||||
*/
|
||||
declare module "ssl" {
|
||||
@@ -300,7 +300,7 @@ declare module "ssl" {
|
||||
*
|
||||
*
|
||||
*/
|
||||
export class SslSocket extends Class_SslSocket {}
|
||||
export class Socket extends Class_SslSocket {}
|
||||
|
||||
|
||||
/**
|
||||
@@ -309,7 +309,7 @@ declare module "ssl" {
|
||||
*
|
||||
*
|
||||
*/
|
||||
export class SslHandler extends Class_SslHandler {}
|
||||
export class Handler extends Class_SslHandler {}
|
||||
|
||||
|
||||
/**
|
||||
@@ -318,7 +318,7 @@ declare module "ssl" {
|
||||
*
|
||||
*
|
||||
*/
|
||||
export class SslServer extends Class_SslServer {}
|
||||
export class Server extends Class_SslServer {}
|
||||
|
||||
|
||||
|
||||
|
||||
Vendored
+2
-2
@@ -292,7 +292,7 @@ declare module "ws" {
|
||||
*
|
||||
*
|
||||
*/
|
||||
export class WebSocketMessage extends Class_WebSocketMessage {}
|
||||
export class Message extends Class_WebSocketMessage {}
|
||||
|
||||
|
||||
/**
|
||||
@@ -301,7 +301,7 @@ declare module "ws" {
|
||||
*
|
||||
*
|
||||
*/
|
||||
export class WebSocket extends Class_WebSocket {}
|
||||
export class Socket extends Class_WebSocket {}
|
||||
|
||||
|
||||
|
||||
|
||||
Vendored
+1
-1
@@ -284,7 +284,7 @@ declare module "xml" {
|
||||
*
|
||||
*
|
||||
*/
|
||||
export class XmlDocument extends Class_XmlDocument {}
|
||||
export class Document extends Class_XmlDocument {}
|
||||
|
||||
|
||||
|
||||
|
||||
Vendored
+1
-1
@@ -300,7 +300,7 @@ declare module "zmq" {
|
||||
*
|
||||
*
|
||||
*/
|
||||
export class ZmqSocket extends Class_ZmqSocket {}
|
||||
export class Socket extends Class_ZmqSocket {}
|
||||
|
||||
|
||||
|
||||
|
||||
Vendored
+1
-1
@@ -1,6 +1,6 @@
|
||||
// Type definitions for fibjs 0.25
|
||||
// Project: https://github.com/fibjs/fibjs
|
||||
// Definitions by: Richard <https://github.com/richardo2016>
|
||||
// Definitions by: richardo2016 <https://github.com/richardo2016>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference path="declare/index.d.ts" />
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
import { GraphQLConnector, GraphQLModel } from '@gramps/rest-helpers';
|
||||
|
||||
const myConnector = new GraphQLConnector();
|
||||
|
||||
myConnector.apiBaseUri = "some uri";
|
||||
myConnector.headers = {};
|
||||
myConnector.cacheExpiry = 300;
|
||||
myConnector.enableCache = true;
|
||||
myConnector.redis = false;
|
||||
|
||||
myConnector.get("someurl");
|
||||
myConnector.post("someendpoint", {}, {}).then(() => {});
|
||||
myConnector.put("someendpoint", {}, {}).then(() => {});
|
||||
myConnector.delete("someendpoint", {}).then(() => {});
|
||||
|
||||
const myModel = new GraphQLModel(myConnector);
|
||||
+26
@@ -0,0 +1,26 @@
|
||||
// Type definitions for @gramps/rest-helpers 1.1
|
||||
// Project: https://github.com/gramps-graphql/rest-helpers
|
||||
// Definitions by: Claude Ciocan <https://github.com/claude>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.3
|
||||
|
||||
export class GraphQLConnector {
|
||||
constructor();
|
||||
|
||||
apiBaseUri: string;
|
||||
headers: object;
|
||||
request: any;
|
||||
cacheExpiry: number;
|
||||
enableCache: boolean;
|
||||
redis: boolean;
|
||||
get(endpoint: string): Promise<any>;
|
||||
post(endpoint: string, body: object, options: object): Promise<any>;
|
||||
put(endpoint: string, body: object, options: object): Promise<any>;
|
||||
delete(endpoint: string, options: object): Promise<any>;
|
||||
}
|
||||
|
||||
export class GraphQLModel {
|
||||
connector: GraphQLConnector;
|
||||
|
||||
constructor({});
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"paths": {
|
||||
"@gramps/rest-helpers": [
|
||||
"gramps__rest-helpers"
|
||||
]
|
||||
}
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"gramps__rest-helpers-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"extends": "dtslint/dt.json"
|
||||
}
|
||||
Vendored
+7
-1
@@ -2354,7 +2354,7 @@ declare namespace Highcharts {
|
||||
* can be customized by defining a new array of items and assigning null to unwanted positions.
|
||||
* @since 2.0
|
||||
*/
|
||||
menuItems?: MenuItem[];
|
||||
menuItems?: string[] | MenuItem[];
|
||||
/**
|
||||
* A click handler callback to use on the button directly instead of the popup menu.
|
||||
* @since 2.0
|
||||
@@ -2661,6 +2661,12 @@ declare namespace Highcharts {
|
||||
* @default ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']
|
||||
*/
|
||||
shortMonths?: string[];
|
||||
/**
|
||||
* Short week days, starting Sunday. If not specified, Highcharts uses the first three letters of the lang.weekdays option.
|
||||
* @default undefined
|
||||
* @since 4.2.4
|
||||
*/
|
||||
shortWeekdays?: string[];
|
||||
/**
|
||||
* The default thousands separator used in the Highcharts.numberFormat method unless otherwise specified in the
|
||||
* function arguments. Since Highcharts 4.1 it defaults to a single space character, which is compatible with ISO
|
||||
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
// Type definitions for Highcharts Drilldown 4.2.7
|
||||
// Project: http://www.highcharts.com/
|
||||
// Definitions by: Konstantin Rohde <https://github.com/RohdeK>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
import { Static } from "highcharts";
|
||||
|
||||
declare function HighchartsDrilldown(H: Static): Static;
|
||||
export = HighchartsDrilldown;
|
||||
export as namespace HighchartsDrilldown;
|
||||
@@ -0,0 +1 @@
|
||||
HighchartsDrilldown(Highcharts);
|
||||
@@ -21,6 +21,7 @@
|
||||
"index.d.ts",
|
||||
"modules/map/index.d.ts",
|
||||
"modules/boost.d.ts",
|
||||
"modules/drilldown.d.ts",
|
||||
"modules/exporting.d.ts",
|
||||
"modules/no-data-to-display.d.ts",
|
||||
"modules/offline-exporting.d.ts",
|
||||
@@ -28,6 +29,7 @@
|
||||
"highstock.d.ts",
|
||||
"js/highcharts/index.d.ts",
|
||||
"test/boost.ts",
|
||||
"test/drilldown.ts",
|
||||
"test/exporting.ts",
|
||||
"test/highstock.ts",
|
||||
"test/index.ts",
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
import GracefulShutdown = require('http-graceful-shutdown');
|
||||
import * as http from "http";
|
||||
|
||||
const opts: GracefulShutdown.Options = {
|
||||
signals: "SIGINT SIGTERM",
|
||||
timeout: 1337,
|
||||
development: false,
|
||||
onShutdown: () => {
|
||||
console.log('fake shutdown handler');
|
||||
return Promise.resolve();
|
||||
},
|
||||
finally: () => {
|
||||
console.log('fake finally handler');
|
||||
}
|
||||
};
|
||||
|
||||
const server = http.createServer((req, res) => {
|
||||
res.end();
|
||||
});
|
||||
|
||||
GracefulShutdown(server, opts);
|
||||
+22
@@ -0,0 +1,22 @@
|
||||
// Type definitions for http-graceful-shutdown 2.1
|
||||
// Project: https://github.com/sebhildebrandt/http-graceful-shutdown
|
||||
// Definitions by: Dave Lee <https://github.com/dlee-nvisia>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference types="node" />
|
||||
|
||||
import { Server } from "http";
|
||||
|
||||
declare function GracefulShutdown(server: Server, options?: GracefulShutdown.Options): void;
|
||||
|
||||
declare namespace GracefulShutdown {
|
||||
interface Options {
|
||||
signals?: string;
|
||||
timeout?: number;
|
||||
development?: boolean;
|
||||
onShutdown?: () => Promise<void>;
|
||||
finally?: () => void;
|
||||
}
|
||||
}
|
||||
|
||||
export = GracefulShutdown;
|
||||
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"http-graceful-shutdown-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
@@ -0,0 +1,24 @@
|
||||
import * as i18next from 'i18next';
|
||||
import * as i18nextko from 'i18next-ko';
|
||||
import * as ko from 'knockout';
|
||||
|
||||
const resourceStore = {
|
||||
en: {
|
||||
translation: {
|
||||
testTranslation: 'Test translation'
|
||||
}
|
||||
},
|
||||
|
||||
de: {
|
||||
translation: {
|
||||
testTranslation: 'Test-Übersetzung'
|
||||
}
|
||||
}
|
||||
};
|
||||
i18nextko.init(resourceStore, 'en', ko);
|
||||
|
||||
i18nextko.setLanguage('de');
|
||||
|
||||
i18nextko.i18n;
|
||||
|
||||
i18nextko.t('testTranslation');
|
||||
Vendored
+25
@@ -0,0 +1,25 @@
|
||||
// Type definitions for i18next-ko 3.0
|
||||
// Project: https://github.com/leMaik/i18next-ko
|
||||
// Definitions by: Daniel Waxweiler <https://github.com/dwaxweiler>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.3
|
||||
|
||||
/// <reference types="knockout"/>
|
||||
|
||||
import * as i18next from 'i18next';
|
||||
|
||||
export const i18n: i18next.i18n;
|
||||
|
||||
export function init(resourceStore: i18nextkoResourceStore, language: string, ko: KnockoutStatic): void;
|
||||
|
||||
export function setLanguage(language: string): void;
|
||||
|
||||
export function t(key: string): KnockoutComputed<string>;
|
||||
|
||||
export interface i18nextkoResourceStore {
|
||||
[language: string]: {
|
||||
translation: {
|
||||
[key: string]: string
|
||||
}
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"i18next-ko-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"extends": "dtslint/dt.json"
|
||||
}
|
||||
Vendored
+229
-22
@@ -1,10 +1,11 @@
|
||||
// Type definitions for jquery.fancytree 2.7.0
|
||||
// Type definitions for jquery.fancytree 2.28.2-0
|
||||
// Project: https://github.com/mar10/fancytree
|
||||
// Definitions by: Peter Palotas <https://github.com/alphaleonis>
|
||||
// Mahdi Abedi <https://github.com/abedi-ir>
|
||||
// Nikolai Ommundsen <https://github.com/niikoo>
|
||||
// Nitecube <https://github.com/Nitecube>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.3
|
||||
// TypeScript Version: 2.8
|
||||
|
||||
|
||||
///<reference types="jquery" />
|
||||
@@ -95,10 +96,10 @@ declare namespace Fancytree {
|
||||
findNextNode(match: (node: FancytreeNode) => boolean, startNode?: FancytreeNode): FancytreeNode;
|
||||
|
||||
/** Find all nodes that matches condition.
|
||||
*
|
||||
*
|
||||
* @returns array of nodes (may be empty)
|
||||
*/
|
||||
findAll(match: string|((node: FancytreeNode) => boolean|undefined)): FancytreeNode[];
|
||||
findAll(match: string | ((node: FancytreeNode) => boolean | undefined)): FancytreeNode[];
|
||||
|
||||
/** Generate INPUT elements that can be submitted with html forms. In selectMode 3 only the topmost selected nodes are considered. */
|
||||
generateFormElements(selected?: boolean, active?: boolean): void;
|
||||
@@ -315,7 +316,7 @@ declare namespace Fancytree {
|
||||
* @param map callback function(NodeData) that could modify the new node
|
||||
* @returns new node.
|
||||
*/
|
||||
copyTo(node: FancytreeNode, mode?: string, map?: (node: NodeData) => void) : FancytreeNode;
|
||||
copyTo(node: FancytreeNode, mode?: string, map?: (node: NodeData) => void): FancytreeNode;
|
||||
|
||||
/** Count direct and indirect children.
|
||||
*
|
||||
@@ -545,7 +546,7 @@ declare namespace Fancytree {
|
||||
resetLazy(): void;
|
||||
|
||||
/** Schedule activity for delayed execution (cancel any pending request). scheduleAction('cancel') will only cancel a pending request (if any). */
|
||||
scheduleAction(mode: string, ms: number) : void;
|
||||
scheduleAction(mode: string, ms: number): void;
|
||||
|
||||
/**
|
||||
* @param effects animation options.
|
||||
@@ -761,7 +762,20 @@ declare namespace Fancytree {
|
||||
/** Make sure that the active node is always visible, i.e. its parents are expanded (default: true). */
|
||||
activeVisible?: boolean;
|
||||
/** Default options for ajax requests. */
|
||||
ajax?: Object;
|
||||
ajax?: {
|
||||
/**
|
||||
* HTTP Method (default: 'GET')
|
||||
*/
|
||||
type: string;
|
||||
/**
|
||||
* false: Append random '_' argument to the request url to prevent caching.
|
||||
*/
|
||||
cache: boolean;
|
||||
/**
|
||||
* Default 'json' -> Expect json format and pass json object to callbacks.
|
||||
*/
|
||||
dataType: string;
|
||||
};
|
||||
/** (default: false) Add WAI-ARIA attributes to markup */
|
||||
aria?: boolean;
|
||||
/** Activate a node when focused with the keyboard (default: true) */
|
||||
@@ -771,24 +785,26 @@ declare namespace Fancytree {
|
||||
/** Scroll node into visible area, when focused by keyboard (default: false). */
|
||||
autoScroll?: boolean;
|
||||
/** Display checkboxes to allow selection (default: false) */
|
||||
checkbox?: boolean|string|((event: JQueryEventObject, data: EventData) => boolean);
|
||||
checkbox?: boolean | string | ((event: JQueryEventObject, data: EventData) => boolean);
|
||||
/** Defines what happens, when the user click a folder node. (default: activate_dblclick_expands) */
|
||||
clickFolderMode?: FancytreeClickFolderMode;
|
||||
/** 0..2 (null: use global setting $.ui.fancytree.debugInfo) */
|
||||
debugLevel?: number;
|
||||
/** 0..4 (null: use global setting $.ui.fancytree.debugInfo) */
|
||||
debugLevel?: 0 | 1 | 2 | 3 | 4;
|
||||
/** callback(node) is called for new nodes without a key. Must return a new unique key. (default null: generates default keys like that: "_" + counter) */
|
||||
defaultKey?: (node: FancytreeNode) => string;
|
||||
/** Accept passing ajax data in a property named `d` (default: true). */
|
||||
enableAspx?: boolean;
|
||||
/** Enable titles (default: false) */
|
||||
enableTitles?: boolean;
|
||||
/** List of active extensions (default: []) */
|
||||
extensions?: string[];
|
||||
extensions?: Array<keyof Extensions.List | string>;
|
||||
/** Set focus when node is checked by a mouse click (default: false) */
|
||||
focusOnSelect?: boolean;
|
||||
/** Add `id="..."` to node markup (default: true). */
|
||||
generateIds?: boolean;
|
||||
/** Display node icons (default: true) */
|
||||
icons?: boolean;
|
||||
/** (default: "ft_") */
|
||||
/** Node icon url, if only filename, please use imagePath to set the path */
|
||||
icon?: boolean | string;
|
||||
/** Prefix (default: "ft_") */
|
||||
idPrefix?: string;
|
||||
/** Path to a folder containing icons (default: null, using 'skin/' subdirectory). */
|
||||
imagePath?: string;
|
||||
@@ -800,36 +816,227 @@ declare namespace Fancytree {
|
||||
minExpandLevel?: number;
|
||||
/** navigate to next node by typing the first letters (default: false) */
|
||||
quicksearch?: boolean;
|
||||
/** Right to left mode (default: false) */
|
||||
rtl?: false;
|
||||
/** optional margins for node.scrollIntoView() (default: {top: 0, bottom: 0}) */
|
||||
scrollOfs?: Object;
|
||||
scrollOfs?: { top: number, bottom: number };
|
||||
/** scrollable container for node.scrollIntoView() (default: $container) */
|
||||
scrollParent?: JQuery;
|
||||
scrollParent?: JQuery | null;
|
||||
/** default: multi_hier */
|
||||
selectMode?: FancytreeSelectMode;
|
||||
/** Used to Initialize the tree. */
|
||||
source?: any;
|
||||
source?: any[] | any;
|
||||
/** Translation table */
|
||||
strings?: Object;
|
||||
strings?: TranslationTable;
|
||||
/** Add tabindex='0' to container, so tree can be reached using TAB */
|
||||
tabbable?: boolean;
|
||||
/** Add tabindex='0' to node title span, so it can receive keyboard focus */
|
||||
titlesTabbable?: boolean;
|
||||
/** Animation options, false:off (default: { effect: "blind", options: {direction: "vertical", scale: "box"}, duration: 200 }) */
|
||||
toggleEffect?: JQueryUI.EffectOptions;
|
||||
/** Tooltips */
|
||||
tooltip?: boolean;
|
||||
|
||||
/** (dynamic Option)Prevent (de-)selection using mouse or keyboard. */
|
||||
unselectable?: boolean|((event: JQueryEventObject, data: Fancytree.EventData) => boolean|undefined);
|
||||
unselectable?: boolean | ((event: JQueryEventObject, data: Fancytree.EventData) => boolean | undefined);
|
||||
/** (dynamic Option)Ignore this node when calculating the partsel status of parent nodes in selectMode 3 propagation. */
|
||||
unselectableIgnore?: boolean|((event: JQueryEventObject, data: Fancytree.EventData) => boolean|undefined);
|
||||
unselectableIgnore?: boolean | ((event: JQueryEventObject, data: Fancytree.EventData) => boolean | undefined);
|
||||
/** (dynamic Option)Use this as constant selected value (overriding selectMode 3 propagation). */
|
||||
unselectableStatus?: boolean|((event: JQueryEventObject, data: Fancytree.EventData) => boolean|undefined);
|
||||
unselectableStatus?: boolean | ((event: JQueryEventObject, data: Fancytree.EventData) => boolean | undefined);
|
||||
|
||||
////////////////
|
||||
// EXTENSIONS //
|
||||
////////////////
|
||||
dnd5?: Extensions.DragAndDrop5;
|
||||
filter?: Extensions.Filter;
|
||||
table?: Extensions.Table;
|
||||
|
||||
/** Options for misc extensions - see docs for typings */
|
||||
[extension: string]: any;
|
||||
}
|
||||
|
||||
interface TranslationTable {
|
||||
/**
|
||||
* "Loading..." // … would be escaped when escapeTitles is true
|
||||
*/
|
||||
loading: string;
|
||||
/**
|
||||
* "Load error!"
|
||||
*/
|
||||
loadError: string;
|
||||
/**
|
||||
* "More..."
|
||||
*/
|
||||
moreData: string;
|
||||
/**
|
||||
* "No data."
|
||||
*/
|
||||
noData: string;
|
||||
}
|
||||
|
||||
namespace Extensions {
|
||||
interface List {
|
||||
dnd5?: DragAndDrop5;
|
||||
filter?: Filter;
|
||||
table?: Table;
|
||||
[extension: string]: any;
|
||||
}
|
||||
|
||||
interface DragAndDrop5 {
|
||||
/**
|
||||
* Expand nodes after n milliseconds of hovering.
|
||||
*/
|
||||
autoExpandMS?: number;
|
||||
/**
|
||||
* Absolute position offset for .fancytree-drop-marker
|
||||
*/
|
||||
dropMarkerOffsetX?: number;
|
||||
/**
|
||||
* Additional offset for drop-marker with hitMode = "before"/"after"
|
||||
*/
|
||||
dropMarkerInsertOffsetX?: number;
|
||||
/**
|
||||
* true: Drag multiple (i.e. selected) nodes.
|
||||
*/
|
||||
multiSource?: boolean;
|
||||
/**
|
||||
* Prevent dropping nodes from different Fancytrees
|
||||
*/
|
||||
preventForeignNodes?: boolean;
|
||||
/**
|
||||
* Prevent dropping items other than Fancytree nodes
|
||||
*/
|
||||
preventNonNodes?: boolean;
|
||||
/**
|
||||
* Prevent dropping nodes on own descendants
|
||||
*/
|
||||
preventRecursiveMoves?: boolean;
|
||||
/**
|
||||
* Prevent dropping nodes 'before self', etc.
|
||||
*/
|
||||
preventVoidMoves?: boolean;
|
||||
/**
|
||||
* Enable auto-scrolling while dragging
|
||||
*/
|
||||
scroll?: boolean;
|
||||
/**
|
||||
* Active top/bottom margin in pixel
|
||||
*/
|
||||
scrollSensitivity?: number;
|
||||
/**
|
||||
* Pixel per event
|
||||
*/
|
||||
scrollSpeed?: number;
|
||||
/**
|
||||
* Allow dragging of nodes to different IE windows, default: false
|
||||
*/
|
||||
setTextTypeJson?: boolean;
|
||||
/**
|
||||
* Callback(sourceNode, data), return true, to enable dnd drag
|
||||
*/
|
||||
dragStart?: (sourceNode: FancytreeNode, data: any) => void;
|
||||
dragDrag?: (sourceNode: FancytreeNode, data: any) => void;
|
||||
dragEnd?: (sourceNode: FancytreeNode, data: any) => void;
|
||||
/**
|
||||
* Callback(targetNode, data), return true, to enable dnd drop
|
||||
*/
|
||||
dragEnter?: (targetNode: FancytreeNode, data: any) => void;
|
||||
/**
|
||||
* Events (drag over)
|
||||
*/
|
||||
dragOver?: (targetNode: FancytreeNode, data: any) => void;
|
||||
/**
|
||||
* Callback(targetNode, data), return false to prevent autoExpand
|
||||
*/
|
||||
dragExpand?: (targetNode: FancytreeNode, data: any) => void;
|
||||
/**
|
||||
* Events (drag drop)
|
||||
*/
|
||||
dragDrop?: (node: FancytreeNode, data: any) => void;
|
||||
dragLeave?: (targetNode: FancytreeNode, data: any) => void;
|
||||
/**
|
||||
* Support misc options
|
||||
*/
|
||||
[key: string]: any;
|
||||
}
|
||||
/**
|
||||
* Define filter-extension options
|
||||
*/
|
||||
interface Filter {
|
||||
/**
|
||||
* Re-apply last filter if lazy data is loaded
|
||||
*/
|
||||
autoApply: boolean;
|
||||
/**
|
||||
* Expand all branches that contain matches while filtered
|
||||
*/
|
||||
autoExpand: boolean;
|
||||
/**
|
||||
* Show a badge with number of matching child nodes near parent icons
|
||||
*/
|
||||
counter: boolean;
|
||||
/**
|
||||
* Match single characters in order, e.g. 'fb' will match 'FooBar'
|
||||
*/
|
||||
fuzzy: boolean;
|
||||
/**
|
||||
* Hide counter badge if parent is expanded
|
||||
*/
|
||||
hideExpandedCounter: boolean;
|
||||
/**
|
||||
* Hide expanders if all child nodes are hidden by filter
|
||||
*/
|
||||
hideExpanders: boolean;
|
||||
/**
|
||||
* Highlight matches by wrapping inside <mark> tags
|
||||
*/
|
||||
highlight: boolean;
|
||||
/**
|
||||
* Match end nodes only
|
||||
*/
|
||||
leavesOnly: boolean;
|
||||
/**
|
||||
* Display a 'no data' status node if result is empty
|
||||
*/
|
||||
nodata: boolean;
|
||||
/**
|
||||
* Grayout unmatched nodes (pass "hide" to remove unmatched node instead); default 'dimm'
|
||||
*/
|
||||
mode: 'dimm' | 'string';
|
||||
/**
|
||||
* Support misc options
|
||||
*/
|
||||
[key: string]: any;
|
||||
}
|
||||
/**
|
||||
* Define table-extension options
|
||||
*/
|
||||
interface Table {
|
||||
/**
|
||||
* Render the checkboxes into the this column index (default: nodeColumnIdx)
|
||||
*/
|
||||
checkboxColumnIdx: any;
|
||||
/**
|
||||
* Indent every node level by 16px; default: 16
|
||||
*/
|
||||
indentation: number;
|
||||
/**
|
||||
* Render node expander, icon, and title to this column (default: 0)
|
||||
*/
|
||||
nodeColumnIdx: number;
|
||||
/**
|
||||
* Support misc options
|
||||
*/
|
||||
[key: string]: any;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/** Data object passed to FancytreeNode() constructor. Note: typically these attributes are accessed by meber methods, e.g. `node.isExpanded()` and `node.setSelected(false)`. */
|
||||
interface NodeData {
|
||||
/** node text (may contain HTML tags) */
|
||||
title: string;
|
||||
icon?: boolean|string;
|
||||
icon?: boolean | string;
|
||||
/** unique key for this node (auto-generated if omitted) */
|
||||
key?: string;
|
||||
/** (reserved) */
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
$("#tree").fancytree({
|
||||
$("#tree").fancytree(<Fancytree.FancytreeOptions>{
|
||||
source: [
|
||||
{ title: "Node 1", key: "1" },
|
||||
{
|
||||
@@ -12,16 +12,20 @@ $("#tree").fancytree({
|
||||
{ title: "Node 1", key: "1" },
|
||||
{
|
||||
title: "Folder 2", key: "2", folder: true, children: [
|
||||
{ title: "Node 2.1", key: "3" },
|
||||
{ title: "Node 2.2", key: "4" },
|
||||
{ title: "NOde 2.3", key: "5", icon: "./icon.svg", checkbox: "radio"}
|
||||
]
|
||||
{ title: "Node 2.1", key: "3" },
|
||||
{ title: "Node 2.2", key: "4" },
|
||||
{ title: "NOde 2.3", key: "5", icon: "./icon.svg", checkbox: "radio" }
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
extensions: ['dnd5'],
|
||||
dnd5: {
|
||||
dragDrag: (node, data) => { }
|
||||
},
|
||||
click: (ev: JQueryEventObject, node: Fancytree.EventData) => {
|
||||
return true;
|
||||
},
|
||||
@@ -51,9 +55,9 @@ $("#tree").fancytree({
|
||||
|
||||
//$("#tree").fancytree();
|
||||
|
||||
var tree : Fancytree.Fancytree = $("#tree").fancytree("getTree");
|
||||
var tree: Fancytree.Fancytree = $("#tree").fancytree("getTree");
|
||||
|
||||
var activeNode : Fancytree.FancytreeNode = tree.getRootNode();
|
||||
var activeNode: Fancytree.FancytreeNode = tree.getRootNode();
|
||||
|
||||
// Sort children of active node:
|
||||
activeNode.sortChildren();
|
||||
@@ -72,15 +76,15 @@ activeNode.addChildren({
|
||||
tree.loadKeyPath("/1/2", function (node, status) {
|
||||
if (status === "loaded") {
|
||||
console.log("loaded intermiediate node " + node);
|
||||
} else if (status === "ok") {
|
||||
} else if (status === "ok") {
|
||||
node.setActive();
|
||||
}
|
||||
});
|
||||
|
||||
var node = $.ui.fancytree.getNode($("#tree"));
|
||||
var node = $.ui.fancytree.getNode($("#tree"));
|
||||
alert($.ui.fancytree.version);
|
||||
var f = $.ui.fancytree.debounce(50, (a : number) => { console.log(a); }, true);
|
||||
f(2);
|
||||
var f = $.ui.fancytree.debounce(50, (a: number) => { console.log(a); }, true);
|
||||
f(2);
|
||||
|
||||
node = tree.getFirstChild();
|
||||
node.setExpanded().done(function () {
|
||||
@@ -120,4 +124,4 @@ node.addChildren({
|
||||
statusNodeType: "loading",
|
||||
unselectableIgnore: true,
|
||||
unselectableStatus: false,
|
||||
}, 0);
|
||||
}, 0);
|
||||
|
||||
Vendored
+20
@@ -0,0 +1,20 @@
|
||||
// Type definitions for json-patch-gen 1.0
|
||||
// Project: https://github.com/gregsexton/json-patch-gen
|
||||
// Definitions by: Konstantin Rohde <https://github.com/RohdeK>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.2
|
||||
|
||||
declare function diff(obj1: object | null, obj2: object | null): diff.JsonPatch[];
|
||||
|
||||
declare namespace diff {
|
||||
type PatchOperation = "replace" | "add" | "remove";
|
||||
|
||||
interface JsonPatch {
|
||||
op: PatchOperation;
|
||||
path: string;
|
||||
value: any;
|
||||
}
|
||||
}
|
||||
|
||||
export = diff;
|
||||
export as namespace diff;
|
||||
@@ -0,0 +1,24 @@
|
||||
import diff = require("json-patch-gen");
|
||||
|
||||
const assertEqual = (a: object, b: object) => JSON.stringify(a) === JSON.stringify(b);
|
||||
const assertLength = (a: any[], b: number) => a.length === b;
|
||||
|
||||
assertLength(diff({a: "a"}, {a: "a", b: "b"}), 1);
|
||||
assertEqual(diff({a: "a"}, {a: "a", b: "b"})[0], {
|
||||
op: "add",
|
||||
path: "/b",
|
||||
value: "b"
|
||||
});
|
||||
|
||||
assertLength(diff({a: "a", b: "b"}, {a: "a"}), 1);
|
||||
assertEqual(diff({a: "a", b: "b"}, {a: "a"})[0], {
|
||||
op: "remove",
|
||||
path: "/b"
|
||||
});
|
||||
|
||||
assertLength(diff({a: "a"}, {a: "b"}), 1);
|
||||
assertEqual(diff({a: "a"}, {a: "b"})[0], {
|
||||
op: "replace",
|
||||
path: "/a",
|
||||
value: "b"
|
||||
});
|
||||
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"json-patch-gen-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,80 @@
|
||||
{
|
||||
"extends": "dtslint/dt.json",
|
||||
"rules": {
|
||||
"adjacent-overload-signatures": false,
|
||||
"array-type": false,
|
||||
"arrow-return-shorthand": false,
|
||||
"ban-types": false,
|
||||
"callable-types": false,
|
||||
"comment-format": false,
|
||||
"dt-header": false,
|
||||
"eofline": false,
|
||||
"export-just-namespace": false,
|
||||
"import-spacing": false,
|
||||
"interface-name": false,
|
||||
"interface-over-type-literal": false,
|
||||
"jsdoc-format": false,
|
||||
"max-line-length": false,
|
||||
"member-access": false,
|
||||
"new-parens": false,
|
||||
"no-any-union": false,
|
||||
"no-boolean-literal-compare": false,
|
||||
"no-conditional-assignment": false,
|
||||
"no-consecutive-blank-lines": false,
|
||||
"no-construct": false,
|
||||
"no-declare-current-package": false,
|
||||
"no-duplicate-imports": false,
|
||||
"no-duplicate-variable": false,
|
||||
"no-empty-interface": false,
|
||||
"no-eval": false,
|
||||
"no-for-in-array": false,
|
||||
"no-inferrable-types": false,
|
||||
"no-internal-module": false,
|
||||
"no-irregular-whitespace": false,
|
||||
"no-mergeable-namespace": false,
|
||||
"no-misused-new": false,
|
||||
"no-namespace": false,
|
||||
"no-object-literal-type-assertion": false,
|
||||
"no-padding": false,
|
||||
"no-redundant-jsdoc": false,
|
||||
"no-redundant-jsdoc-2": false,
|
||||
"no-redundant-undefined": false,
|
||||
"no-reference-import": false,
|
||||
"no-relative-import-in-test": false,
|
||||
"no-self-import": false,
|
||||
"no-single-declare-module": false,
|
||||
"no-string-throw": false,
|
||||
"no-unnecessary-callback-wrapper": false,
|
||||
"no-unnecessary-class": false,
|
||||
"no-unnecessary-generics": false,
|
||||
"no-unnecessary-qualifier": false,
|
||||
"no-unnecessary-type-assertion": false,
|
||||
"no-useless-files": false,
|
||||
"no-var-keyword": false,
|
||||
"no-var-requires": false,
|
||||
"no-void-expression": false,
|
||||
"no-trailing-whitespace": false,
|
||||
"object-literal-key-quotes": false,
|
||||
"object-literal-shorthand": false,
|
||||
"one-line": false,
|
||||
"one-variable-per-declaration": false,
|
||||
"only-arrow-functions": false,
|
||||
"prefer-conditional-expression": false,
|
||||
"prefer-const": false,
|
||||
"prefer-declare-function": false,
|
||||
"prefer-for-of": false,
|
||||
"prefer-method-signature": false,
|
||||
"prefer-template": false,
|
||||
"radix": false,
|
||||
"semicolon": false,
|
||||
"space-before-function-paren": false,
|
||||
"space-within-parens": false,
|
||||
"strict-export-declare-modifiers": false,
|
||||
"trim-file": false,
|
||||
"triple-equals": false,
|
||||
"typedef-whitespace": false,
|
||||
"unified-signatures": false,
|
||||
"void-return": false,
|
||||
"whitespace": false
|
||||
}
|
||||
}
|
||||
Vendored
+4
-8
@@ -9,22 +9,18 @@
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.3
|
||||
|
||||
interface KnockoutExtensionFunctions {
|
||||
[key: string]: any;
|
||||
}
|
||||
|
||||
interface KnockoutSubscribableFunctions<T> extends KnockoutExtensionFunctions {
|
||||
interface KnockoutSubscribableFunctions<T> {
|
||||
notifySubscribers(valueToWrite?: T, event?: string): void;
|
||||
}
|
||||
|
||||
interface KnockoutComputedFunctions<T> extends KnockoutExtensionFunctions {
|
||||
interface KnockoutComputedFunctions<T> {
|
||||
}
|
||||
|
||||
interface KnockoutObservableFunctions<T> extends KnockoutExtensionFunctions {
|
||||
interface KnockoutObservableFunctions<T> {
|
||||
equalityComparer(a: T, b: T): boolean;
|
||||
}
|
||||
|
||||
interface KnockoutObservableArrayFunctions<T> extends KnockoutExtensionFunctions {
|
||||
interface KnockoutObservableArrayFunctions<T> {
|
||||
// General Array functions
|
||||
indexOf(searchElement: T, fromIndex?: number): number;
|
||||
slice(start: number, end?: number): T[];
|
||||
|
||||
Vendored
+4
-4
@@ -1,6 +1,6 @@
|
||||
// Type definitions for koa-bodyparser 4.2
|
||||
// Type definitions for koa-bodyparser 5.0
|
||||
// Project: https://github.com/koajs/bodyparser
|
||||
// Definitions by: Jerry Chin <https://github.com/hellopao>
|
||||
// Definitions by: Jerry Chin <https://github.com/hellopao>, Anup Kishore <https://github.com/anup-2s>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.3
|
||||
|
||||
@@ -18,8 +18,8 @@ import * as Koa from "koa";
|
||||
|
||||
declare module "koa" {
|
||||
interface Request {
|
||||
body: any;
|
||||
rawBody: any;
|
||||
body: {} | null | undefined;
|
||||
rawBody: {} | null | undefined;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Vendored
+3
-3
@@ -1,6 +1,6 @@
|
||||
// Type definitions for koa-websocket 2.1
|
||||
// Type definitions for koa-websocket 5.0
|
||||
// Project: https://github.com/kudos/koa-websocket
|
||||
// Definitions by: My Self <https://github.com/me>
|
||||
// Definitions by: Maël Lavault <https://github.com/moimael>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.3
|
||||
|
||||
@@ -21,7 +21,7 @@ declare class KoaWebsocketServer {
|
||||
middleware: Koa.Middleware[];
|
||||
|
||||
constructor(app: Koa);
|
||||
listen(server: http.Server | https.Server): ws.Server;
|
||||
listen(options: ws.ServerOptions): ws.Server;
|
||||
onConnection(handler: KoaWebsocketConnectionHandler): void;
|
||||
use(middleware: KoaWebsocketMiddleware): this;
|
||||
}
|
||||
|
||||
Vendored
+20
-14
@@ -1,4 +1,4 @@
|
||||
// Type definitions for luxon 0.5
|
||||
// Type definitions for luxon 1.2
|
||||
// Project: https://github.com/moment/luxon#readme
|
||||
// Definitions by: Colby DeHart <https://github.com/colbydehart>
|
||||
// Hyeonseok Yang <https://github.com/FourwingsY>
|
||||
@@ -180,14 +180,14 @@ declare module 'luxon' {
|
||||
zoneName: string;
|
||||
diff(
|
||||
other: DateTime,
|
||||
unit?: string | string[],
|
||||
unit?: DurationUnit | DurationUnit[],
|
||||
options?: DiffOptions
|
||||
): Duration;
|
||||
diffNow(unit?: string | string[], options?: DiffOptions): Duration;
|
||||
endOf(unit: string): DateTime;
|
||||
diffNow(unit?: DurationUnit | DurationUnit[], options?: DiffOptions): Duration;
|
||||
endOf(unit: DurationUnit): DateTime;
|
||||
equals(other: DateTime): boolean;
|
||||
get(unit: string): number;
|
||||
hasSame(other: DateTime, unit: string): boolean;
|
||||
get(unit: keyof DateTime): number;
|
||||
hasSame(other: DateTime, unit: DurationUnit): boolean;
|
||||
minus(duration: Duration | number | DurationObject): DateTime;
|
||||
plus(duration: Duration | number | DurationObject): DateTime;
|
||||
reconfigure(properties: LocaleOptions): DateTime;
|
||||
@@ -195,7 +195,8 @@ declare module 'luxon' {
|
||||
set(values: DateObjectUnits): DateTime;
|
||||
setLocale(locale: any): DateTime;
|
||||
setZone(zone: string | Zone, options?: ZoneOptions): DateTime;
|
||||
startOf(unit: string): DateTime;
|
||||
startOf(unit: DurationUnit): DateTime;
|
||||
toBSON(): Date;
|
||||
toFormat(format: string, options?: ToFormatOptions): string;
|
||||
toHTTP(): string;
|
||||
toISO(options?: ISOTimeOptions): string;
|
||||
@@ -207,6 +208,7 @@ declare module 'luxon' {
|
||||
toLocal(): DateTime;
|
||||
toLocaleParts(options?: DateTimeFormatOptions): any[];
|
||||
toLocaleString(options?: DateTimeFormatOptions): string;
|
||||
toMillis(): number;
|
||||
toObject(options?: { includeConfig?: boolean }): DateObject;
|
||||
toMillis(): number;
|
||||
toRFC2822(): string;
|
||||
@@ -238,6 +240,9 @@ declare module 'luxon' {
|
||||
|
||||
type DurationObject = DurationObjectUnits & DurationOptions;
|
||||
|
||||
type DurationUnit = 'year' | 'years' | 'quarter' | 'quarters' | 'month' | 'months' | 'week' | 'weeks' | 'day' | 'days'
|
||||
| 'hour' | 'hours' | 'minute' | 'minutes' | 'second' | 'seconds' | 'millisecond' | 'milliseconds';
|
||||
|
||||
class Duration {
|
||||
static fromISO(text: string, options?: DurationOptions): Duration;
|
||||
static fromMillis(
|
||||
@@ -261,16 +266,16 @@ declare module 'luxon' {
|
||||
seconds: number;
|
||||
weeks: number;
|
||||
years: number;
|
||||
as(unit: string): number;
|
||||
as(unit: DurationUnit): number;
|
||||
equals(other: Duration): boolean;
|
||||
get(unit: string): number;
|
||||
get(unit: DurationUnit): number;
|
||||
minus(duration: Duration | number | DurationObject): Duration;
|
||||
negate(): Duration;
|
||||
normalize(): Duration;
|
||||
plus(duration: Duration | number | DurationObject): Duration;
|
||||
reconfigure(objectPattern: DurationOptions): Duration;
|
||||
set(values: DurationObjectUnits): Duration;
|
||||
shiftTo(...units: string[]): Duration;
|
||||
shiftTo(...units: DurationUnit[]): Duration;
|
||||
toFormat(format: string, options?: ToFormatOptions): string;
|
||||
toISO(): string;
|
||||
toJSON(): string;
|
||||
@@ -278,6 +283,7 @@ declare module 'luxon' {
|
||||
includeConfig?: boolean;
|
||||
}): DurationObject;
|
||||
toString(): string;
|
||||
valueOf(): number;
|
||||
}
|
||||
|
||||
type EraLength = 'short' | 'long';
|
||||
@@ -341,23 +347,23 @@ declare module 'luxon' {
|
||||
abutsEnd(other: Interval): boolean;
|
||||
abutsStart(other: Interval): boolean;
|
||||
contains(dateTime: DateTime): boolean;
|
||||
count(unit?: string): number;
|
||||
count(unit?: DurationUnit): number;
|
||||
difference(...intervals: Interval[]): Interval[];
|
||||
divideEqually(numberOfParts?: number): Interval[];
|
||||
engulfs(other: Interval): boolean;
|
||||
equals(other: Interval): boolean;
|
||||
hasSame(unit: string): boolean;
|
||||
hasSame(unit: DurationUnit): boolean;
|
||||
intersection(other: Interval): Interval;
|
||||
isAfter(dateTime: DateTime): boolean;
|
||||
isBefore(dateTime: DateTime): boolean;
|
||||
isEmpty(): boolean;
|
||||
length(unit?: string): number;
|
||||
length(unit?: DurationUnit): number;
|
||||
overlaps(other: Interval): boolean;
|
||||
set(values: IntervalObject): Interval;
|
||||
splitAt(...dateTimes: DateTime[]): Interval[];
|
||||
splitBy(duration: Duration | DurationObject | number): Interval[];
|
||||
toDuration(
|
||||
unit: string | string[],
|
||||
unit: DurationUnit | DurationUnit[],
|
||||
options?: DiffOptions
|
||||
): Duration;
|
||||
toFormat(
|
||||
|
||||
Vendored
+1
-2
@@ -12,6 +12,5 @@ interface IMergedStream extends NodeJS.ReadWriteStream {
|
||||
isEmpty(): boolean;
|
||||
}
|
||||
|
||||
declare function merge<T extends NodeJS.ReadableStream>(streams: T[]): IMergedStream;
|
||||
declare function merge<T extends NodeJS.ReadableStream>(...streams: T[]): IMergedStream;
|
||||
declare function merge<T extends NodeJS.ReadableStream>(...streams: (T | T[])[]): IMergedStream;
|
||||
export = merge;
|
||||
|
||||
Vendored
+1
-1
@@ -2846,7 +2846,7 @@ declare global {
|
||||
|
||||
// #region Deprecations
|
||||
|
||||
/** @deprecated use `Mocha.DoneCallback` instead. */
|
||||
/** @deprecated use `Mocha.Done` instead. */
|
||||
type MochaDone = Mocha.Done;
|
||||
|
||||
/** @deprecated use `Mocha.ReporterConstructor` instead. */
|
||||
|
||||
Vendored
+85
@@ -0,0 +1,85 @@
|
||||
// Type definitions for mosca 2.8
|
||||
// Project: https://github.com/mcollina/mosca
|
||||
// Definitions by: Joao Gabriel Gouveia <https://github.com/GabrielGouv>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
export class Server {
|
||||
opts: any;
|
||||
modernOpts: any;
|
||||
clients: any;
|
||||
closed: boolean;
|
||||
|
||||
constructor(opts: any, callback?: () => void);
|
||||
|
||||
on(when: string, callback: (() => void) | ((client: Client) => void) | ((packet: Packet, client: Client) => void)): void;
|
||||
once(when: string, callback: () => void): void;
|
||||
toString(): string;
|
||||
subscribe(topic: string, callback: () => void, done: () => void): void;
|
||||
publish(message: Message, callback: (obj: any, packet: Packet) => void): void;
|
||||
authenticate(client: Client, username: string, password: string,
|
||||
callback: (obj: any, authenticated: boolean) => void): void;
|
||||
published(packet: Packet, client: Client, callback: (obj: any) => void): void;
|
||||
authorizePublish(client: Client, topic: string, payload: string,
|
||||
callback: (obj: any, authorized: boolean) => void): void;
|
||||
authorizeSubscribe(client: Client, topic: string, callback: (obj: any, authorized: boolean) => void): void;
|
||||
authorizeForward(client: Client, packet: Packet, callback: (obj: any, authorized: boolean) => void): void;
|
||||
storePacket(packet: Packet, callback: () => void): void;
|
||||
deleteOfflinePacket(client: Client, messageId: number, callback: () => void): void;
|
||||
forwardRetained(pattern: string, client: Client, callback: () => void): void;
|
||||
restoreClientSubscriptions(client: Client, callback: () => void): void;
|
||||
forwardOfflinePackets(client: Client, callback: () => void): void;
|
||||
updateOfflinePacket(client: Client, originMessageId: number, packet: Packet,
|
||||
callback: (obj: any, packet: Packet) => void): void;
|
||||
persistClient(client: Client, callback: () => void): void;
|
||||
close(callback?: () => void): void;
|
||||
attachHttpServer(server: any, path?: any): void;
|
||||
}
|
||||
|
||||
export class Client {
|
||||
id: string;
|
||||
connection: any;
|
||||
server: Server;
|
||||
logger: any;
|
||||
subscriptions: any;
|
||||
nextId: number;
|
||||
inflight: any;
|
||||
inflightCounter: number;
|
||||
|
||||
constructor(connection: any, server: Server);
|
||||
|
||||
close(callback?: () => void, reason?: string): void;
|
||||
}
|
||||
|
||||
export class Stats {
|
||||
maxConnectedClients: number;
|
||||
connectedClients: number;
|
||||
lastIntervalConnectedClients: number;
|
||||
publishedMessages: number;
|
||||
lastIntervalPublishedMessages: number;
|
||||
started: Date;
|
||||
load: any;
|
||||
|
||||
wire(server: Server): void;
|
||||
}
|
||||
|
||||
export class Authorizer {
|
||||
users: any;
|
||||
|
||||
addUser(username: string, password: string, authorizePublish: string,
|
||||
authorizeSubscribe: string, callback: (func: any) => void): void;
|
||||
}
|
||||
|
||||
export interface Packet {
|
||||
topic: string;
|
||||
payload: any;
|
||||
messageId: string;
|
||||
qos: number;
|
||||
retain: boolean;
|
||||
}
|
||||
|
||||
export interface Message {
|
||||
topic: string;
|
||||
payload: any;
|
||||
qos: number;
|
||||
retain: boolean;
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
import { Server, Client, Packet } from 'mosca';
|
||||
|
||||
const settings = {
|
||||
port: 1883,
|
||||
host: '0.0.0.0'
|
||||
};
|
||||
|
||||
const server = new Server(settings);
|
||||
|
||||
server.on('ready', () => {});
|
||||
|
||||
server.on('clientConnected', (client: Client) => {});
|
||||
|
||||
server.on('clientDisconnected', (client: Client) => {});
|
||||
|
||||
server.on('published', (packet: Packet, client: Client) => {});
|
||||
@@ -0,0 +1,21 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": ["../"],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"mosca-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"extends": "dtslint/dt.json"
|
||||
}
|
||||
Vendored
+220
-26
@@ -1,53 +1,247 @@
|
||||
// Type definitions for Mustache 0.8.2
|
||||
// Type definitions for Mustache 0.8.3
|
||||
// Project: https://github.com/janl/mustache.js
|
||||
// Definitions by: Mark Ashley Bell <https://github.com/markashleybell>
|
||||
// Definitions by: Mark Ashley Bell <https://github.com/markashleybell>, Manuel Thalmann <https://github.com/manuth>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/**
|
||||
* Provides the functionality to render templates with `{{mustaches}}`.
|
||||
*/
|
||||
interface MustacheStatic {
|
||||
/**
|
||||
* The name of the module.
|
||||
*/
|
||||
name: string;
|
||||
|
||||
interface MustacheScanner {
|
||||
/**
|
||||
* The version of the module.
|
||||
*/
|
||||
version: string;
|
||||
|
||||
/**
|
||||
* The opening and closing tags to parse.
|
||||
*/
|
||||
tags: string;
|
||||
|
||||
/**
|
||||
* A simple string scanner that is used by the template parser to find tokens in template strings.
|
||||
*/
|
||||
Scanner: typeof MustacheScanner
|
||||
|
||||
/**
|
||||
* Represents a rendering context by wrapping a view object and maintaining a reference to the parent context.
|
||||
*/
|
||||
Context: typeof MustacheContext;
|
||||
|
||||
/**
|
||||
* A Writer knows how to take a stream of tokens and render them to a `string`, given a context.
|
||||
*
|
||||
* It also maintains a cache of templates to avoid the need to parse the same template twice.
|
||||
*/
|
||||
Writer: typeof MustacheWriter;
|
||||
|
||||
/**
|
||||
* Escapes HTML-characters.
|
||||
*
|
||||
* @param value
|
||||
* The string to escape.
|
||||
*/
|
||||
escape: (value: string) => string;
|
||||
|
||||
/**
|
||||
* Clears all cached templates in this writer.
|
||||
*/
|
||||
clearCache(): void;
|
||||
|
||||
/**
|
||||
* Parses and caches the given template in the default writer and returns the array of tokens it contains.
|
||||
*
|
||||
* Doing this ahead of time avoids the need to parse templates on the fly as they are rendered.
|
||||
*
|
||||
* @param template
|
||||
* The template to parse.
|
||||
*
|
||||
* @param tags
|
||||
* The tags to use.
|
||||
*/
|
||||
parse(template: string, tags?: string[]): any;
|
||||
|
||||
/**
|
||||
* Renders the `template` with the given `view` and `partials` using the default writer.
|
||||
*
|
||||
* @param template
|
||||
* The template to render.
|
||||
*
|
||||
* @param view
|
||||
* The view to render the template with.
|
||||
*
|
||||
* @param partials
|
||||
* Either an object that contains the names and templates of partials that are used in a template
|
||||
*
|
||||
* -- or --
|
||||
*
|
||||
* A function that is used to load partial template on the fly that takes a single argument: the name of the partial.
|
||||
*/
|
||||
render(template: string, view: any | MustacheContext, partials?: any): string;
|
||||
|
||||
/**
|
||||
* Renders the `template` with the given `view` and `partials` using the default writer.
|
||||
*
|
||||
* @param template
|
||||
* The template to render.
|
||||
*
|
||||
* @param view
|
||||
* The view to render the template with.
|
||||
*
|
||||
* @param partials
|
||||
* Either an object that contains the names and templates of partials that are used in a template
|
||||
*
|
||||
* -- or --
|
||||
*
|
||||
* A function that is used to load partial template on the fly that takes a single argument: the name of the partial.
|
||||
*/
|
||||
to_html(template: string, view: any | MustacheContext, partials?: any, send?: any): any;
|
||||
}
|
||||
|
||||
/**
|
||||
* A simple string scanner that is used by the template parser to find tokens in template strings.
|
||||
*/
|
||||
declare class MustacheScanner {
|
||||
string: string;
|
||||
tail: string;
|
||||
pos: number;
|
||||
|
||||
/**
|
||||
* Initializes a new instance of the `MustacheScanner` class.
|
||||
*/
|
||||
constructor(string: string);
|
||||
|
||||
/**
|
||||
* Returns `true` if the tail is empty (end of string).
|
||||
*/
|
||||
eos(): boolean;
|
||||
|
||||
/**
|
||||
* Tries to match the given regular expression at the current position.
|
||||
*
|
||||
* @param re
|
||||
* The regex-pattern to match.
|
||||
*
|
||||
* @returns
|
||||
* The matched text if it can match, the empty string otherwise.
|
||||
*/
|
||||
scan(re: RegExp): string;
|
||||
|
||||
/**
|
||||
* Skips all text until the given regular expression can be matched.
|
||||
*
|
||||
* @param re
|
||||
* The regex-pattern to match.
|
||||
*
|
||||
* @returns
|
||||
* Returns the skipped string, which is the entire tail if no match can be made.
|
||||
*/
|
||||
scanUntil(re: RegExp): string;
|
||||
}
|
||||
|
||||
interface MustacheContext {
|
||||
/**
|
||||
* Represents a rendering context by wrapping a view object and maintaining a reference to the parent context.
|
||||
*/
|
||||
declare class MustacheContext {
|
||||
view: any;
|
||||
parentContext: MustacheContext;
|
||||
|
||||
/**
|
||||
* Initializes a new instance of the `MustacheContenxt` class.
|
||||
*/
|
||||
constructor(view: any, parentContext: MustacheContext);
|
||||
|
||||
/**
|
||||
* Initializes a new instance of the `MustacheContenxt` class.
|
||||
*/
|
||||
constructor(view: any);
|
||||
|
||||
/**
|
||||
* Creates a new context using the given view with this context as the parent.
|
||||
*
|
||||
* @param view
|
||||
* The view to create the new context with.
|
||||
*/
|
||||
push(view: any): MustacheContext;
|
||||
|
||||
/**
|
||||
* Returns the value of the given name in this context, traversing up the context hierarchy if the value is absent in this context's view.
|
||||
*
|
||||
* @param name
|
||||
* The name to look up.
|
||||
*/
|
||||
lookup(name: string): any;
|
||||
}
|
||||
|
||||
interface MustacheWriter {
|
||||
(view: any): string;
|
||||
/**
|
||||
* A Writer knows how to take a stream of tokens and render them to a `string`, given a context.
|
||||
*
|
||||
* It also maintains a cache of templates to avoid the need to parse the same template twice.
|
||||
*/
|
||||
declare class MustacheWriter {
|
||||
/**
|
||||
* Initializes a new instance of the `MustacheWriter` class.
|
||||
*/
|
||||
constructor();
|
||||
|
||||
/**
|
||||
* Clears all cached templates in this writer.
|
||||
*/
|
||||
clearCache(): void;
|
||||
|
||||
/**
|
||||
* Parses and caches the given `template` and returns the array of tokens that is generated from the parse.
|
||||
*
|
||||
* @param template
|
||||
* The template to parse.
|
||||
*/
|
||||
parse(template: string, tags?: any): any;
|
||||
render(template: string, view: any, partials: any): string;
|
||||
|
||||
/**
|
||||
* High-level method that is used to render the given `template` with the given `view`.
|
||||
*
|
||||
* @param template
|
||||
* The template to render.
|
||||
*
|
||||
* @param view
|
||||
* The view to render the template with.
|
||||
*
|
||||
* @param partials
|
||||
* Either an object that contains the names and templates of partials that are used in a template
|
||||
*
|
||||
* -- or --
|
||||
*
|
||||
* A function that is used to load partial template on the fly that takes a single argument: the name of the partial.
|
||||
*/
|
||||
render(template: string, view: any | MustacheContext, partials: any): string;
|
||||
|
||||
/**
|
||||
* Low-level method that renders the given array of `tokens` using the given `context` and `partials`.
|
||||
*
|
||||
* @param tokens
|
||||
* The tokens to render.
|
||||
*
|
||||
* @param context
|
||||
* The context to use for rendering the tokens.
|
||||
*
|
||||
* @param partials
|
||||
* The partials to use for rendering the tokens.
|
||||
*
|
||||
* @param originalTemplate
|
||||
* An object used to extract the portion of the original template that was contained in a higher-order section.
|
||||
*
|
||||
* If the template doesn't use higher-order sections, this argument may be omitted.
|
||||
*/
|
||||
renderTokens(tokens: string[], context: MustacheContext, partials: any, originalTemplate: any): string;
|
||||
}
|
||||
|
||||
interface MustacheStatic {
|
||||
name: string;
|
||||
version: string;
|
||||
tags: string;
|
||||
Scanner: MustacheScanner;
|
||||
Context: MustacheContext;
|
||||
Writer: MustacheWriter;
|
||||
escape: any;
|
||||
|
||||
clearCache(): MustacheWriter;
|
||||
parse(template: string, tags?: any): any;
|
||||
render(template: string, view: any, partials?: any): string;
|
||||
to_html(template: string, view: any, partials?: any, send?: any): any;
|
||||
}
|
||||
|
||||
/**
|
||||
* Provides the functionality to render templates with `{{mustaches}}`.
|
||||
*/
|
||||
declare var Mustache: MustacheStatic;
|
||||
|
||||
declare module 'mustache' {
|
||||
export = Mustache;
|
||||
}
|
||||
export = Mustache;
|
||||
export as namespace Mustache;
|
||||
|
||||
@@ -12,3 +12,18 @@ var output2 = Mustache.render(template2, view2);
|
||||
var view3 = { firstName: "John", lastName: "Smith", blogURL: "http://testblog.com" };
|
||||
var template3 = "<h1>{{firstName}} {{lastName}}</h1>Blog: {{blogURL}}";
|
||||
var html = Mustache.to_html(template3, view3);
|
||||
|
||||
var view4 = new class extends Mustache.Context
|
||||
{
|
||||
constructor()
|
||||
{
|
||||
super({});
|
||||
}
|
||||
|
||||
public lookup(name: string)
|
||||
{
|
||||
return name.toUpperCase();
|
||||
}
|
||||
};
|
||||
var template4 = "Hello, {{firstName}} {{lastName}}";
|
||||
var html4 = Mustache.render(template4, view4);
|
||||
Vendored
+7
-7
@@ -13,7 +13,7 @@ declare namespace NewRelic {
|
||||
* @param releaseId The ID or version of this release; for example, a version number, build number
|
||||
* from your CI environment, GitHub SHA, GUID, or a hash of the contents. Since New Relic converts this
|
||||
* value into a string, you can also use null or undefined if necessary
|
||||
* @see https://docs.newrelic.com/docs/browser/new-relic-browser/browser-agent-spa-api/addRelease
|
||||
* @see https://docs.newrelic.com/docs/browser/new-relic-browser/browser-agent-spa-api/add-release
|
||||
*/
|
||||
addRelease(releaseName: string, releaseId: string): void;
|
||||
|
||||
@@ -23,9 +23,9 @@ declare namespace NewRelic {
|
||||
* @param name Name or category of the action. Reports to Insights as the actionName attribute.
|
||||
* @param attributes JSON object with one or more key/value pairs.
|
||||
* The key will report to Insights as its own PageAction attribute with the specified values.
|
||||
* @see https://docs.newrelic.com/docs/browser/new-relic-browser/browser-agent-spa-api/addPageAction
|
||||
* @see https://docs.newrelic.com/docs/browser/new-relic-browser/browser-agent-spa-api/add-page-action
|
||||
*/
|
||||
addPageAction(name: string, attributes: { [key: string]: string }): void;
|
||||
addPageAction(name: string, attributes: { [key: string]: string | number }): void;
|
||||
|
||||
/**
|
||||
* Adds a JavaScript object with a custom name, start time, etc. to an in-progress session trace.
|
||||
@@ -51,7 +51,7 @@ declare namespace NewRelic {
|
||||
*
|
||||
* @param Provide a meaningful error message that you can use when analyzing data on
|
||||
* New Relic Browser's JavaScript errors page.
|
||||
* @see https://docs.newrelic.com/docs/browser/new-relic-browser/browser-agent-spa-api/noticeError
|
||||
* @see https://docs.newrelic.com/docs/browser/new-relic-browser/browser-agent-spa-api/notice-error
|
||||
*/
|
||||
noticeError(error: any): void;
|
||||
|
||||
@@ -63,7 +63,7 @@ declare namespace NewRelic {
|
||||
* @param value Value of the attribute. Appears as the value in the named attribute column in the
|
||||
* PageView event. It will appear as a column in the PageAction event if you are using it. Custom attribute
|
||||
* values cannot be complex objects, only simple types such as strings and numbers.
|
||||
* @see https://docs.newrelic.com/docs/browser/new-relic-browser/browser-agent-spa-api/setCustomAttribute
|
||||
* @see https://docs.newrelic.com/docs/browser/new-relic-browser/browser-agent-spa-api/set-custom-attribute
|
||||
*/
|
||||
setCustomAttribute(name: string, value: string): void;
|
||||
|
||||
@@ -72,7 +72,7 @@ declare namespace NewRelic {
|
||||
*
|
||||
* @param filterCallback The callback will be called with each error, so it is not
|
||||
* specific to one error. `err` will usually be an error object, but it can be other data types.
|
||||
* @see https://docs.newrelic.com/docs/browser/new-relic-browser/browser-agent-spa-api/setErrorHandler
|
||||
* @see https://docs.newrelic.com/docs/browser/new-relic-browser/browser-agent-spa-api/set-error-handler
|
||||
*/
|
||||
setErrorHandler(filterCallback: (err: any) => boolean): void;
|
||||
|
||||
@@ -84,7 +84,7 @@ declare namespace NewRelic {
|
||||
* To further group these custom transactions, provide a custom host. Otherwise, the page views will be
|
||||
* assigned the default domain custom.transaction. Segments within the name must be explicitly added to
|
||||
* the Whitelist segments in your URL whitelist settings if they do not already appear.
|
||||
* @see https://docs.newrelic.com/docs/browser/new-relic-browser/browser-agent-spa-api/setPageViewName
|
||||
* @see https://docs.newrelic.com/docs/browser/new-relic-browser/browser-agent-spa-api/set-pageview-name
|
||||
*/
|
||||
setPageViewName(name: string, host?: string): void;
|
||||
|
||||
|
||||
@@ -9,6 +9,7 @@ newrelic.addRelease('checkout page', 'a818994');
|
||||
|
||||
// addPageAction()
|
||||
newrelic.addPageAction('copy-text-button', { result: 'success' });
|
||||
newrelic.addPageAction('async-action', { duration: 3000 });
|
||||
|
||||
// addToTrace()
|
||||
newrelic.addToTrace({
|
||||
|
||||
Vendored
+35
-14
@@ -1,10 +1,43 @@
|
||||
import * as React from "react";
|
||||
|
||||
import { NextContext } from ".";
|
||||
|
||||
export interface RenderPageResponse {
|
||||
buildManifest: { [key: string]: any };
|
||||
chunks: {
|
||||
names: string[];
|
||||
filenames: string[];
|
||||
};
|
||||
html?: string;
|
||||
head: Array<React.ReactElement<any>>;
|
||||
errorHtml: string;
|
||||
}
|
||||
|
||||
export interface PageProps {
|
||||
url: string;
|
||||
}
|
||||
|
||||
export interface AnyPageProps extends PageProps {
|
||||
[key: string]: any;
|
||||
}
|
||||
|
||||
export type Enhancer<E extends PageProps = AnyPageProps, P extends any = E> = (page: React.ComponentType<P>) => React.ComponentType<E>;
|
||||
|
||||
/**
|
||||
* Context object used inside `Document`
|
||||
*/
|
||||
export interface NextDocumentContext extends NextContext {
|
||||
/** A callback that executes the actual React rendering logic (synchronously) */
|
||||
renderPage<E extends PageProps = AnyPageProps, P extends any = E>(enhancer?: Enhancer<E, P>): RenderPageResponse; // tslint:disable-line:no-unnecessary-generics
|
||||
}
|
||||
|
||||
export interface DocumentProps {
|
||||
__NEXT_DATA__?: any;
|
||||
dev?: boolean;
|
||||
chunks?: string[];
|
||||
chunks?: {
|
||||
names: string[];
|
||||
filenames: string[];
|
||||
};
|
||||
html?: string;
|
||||
head?: Array<React.ReactElement<any>>;
|
||||
errorHtml?: string;
|
||||
@@ -13,21 +46,9 @@ export interface DocumentProps {
|
||||
[key: string]: any;
|
||||
}
|
||||
|
||||
/**
|
||||
* Context object used inside `Document`
|
||||
*/
|
||||
export interface NextDocumentContext extends NextContext {
|
||||
/** A callback that executes the actual React rendering logic (synchronously) */
|
||||
renderPage(
|
||||
cb?: (enhancer: () => JSX.Element) => React.ComponentType<any>
|
||||
): {
|
||||
[key: string]: any
|
||||
};
|
||||
}
|
||||
|
||||
export class Head extends React.Component<any> {}
|
||||
export class Main extends React.Component {}
|
||||
export class NextScript extends React.Component {}
|
||||
export default class extends React.Component<DocumentProps> {
|
||||
static getInitialProps(ctx: NextContext): DocumentProps;
|
||||
static getInitialProps(ctx: NextDocumentContext): Promise<DocumentProps> | DocumentProps;
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import Document, { Head, Main, NextScript, NextDocumentContext } from 'next/document';
|
||||
import Document, { DocumentProps, Enhancer, Head, Main, NextScript, NextDocumentContext, PageProps } from 'next/document';
|
||||
import * as React from "react";
|
||||
|
||||
const results = (
|
||||
const basicResults = (
|
||||
<Document any="property" should="work" here>
|
||||
<Head some="more" properties>
|
||||
<meta name="description" content="Head can have children, too!" />
|
||||
@@ -11,16 +11,18 @@ const results = (
|
||||
</Document>
|
||||
);
|
||||
|
||||
const Wrapper: React.SFC = ({ children }) => <React.Fragment>{children}</React.Fragment>;
|
||||
|
||||
export default class MyDocument extends Document {
|
||||
class MyDoc extends Document {
|
||||
static async getInitialProps({ renderPage }: NextDocumentContext) {
|
||||
// Without callback
|
||||
const page = renderPage();
|
||||
// With callback
|
||||
const differentPage = renderPage(App => props => <Wrapper><App {...props} /></Wrapper>);
|
||||
// without callback
|
||||
const _page = renderPage();
|
||||
|
||||
// with callback
|
||||
const enhancer: Enhancer<PageProps, {}> = (App) => (props) => (<App />);
|
||||
const { html, head, errorHtml, chunks, buildManifest } = renderPage(enhancer);
|
||||
|
||||
const style = {};
|
||||
return { ...page, style };
|
||||
|
||||
return { html, head, errorHtml, chunks, buildManifest, style };
|
||||
}
|
||||
|
||||
render() {
|
||||
@@ -33,8 +35,45 @@ export default class MyDocument extends Document {
|
||||
<body>
|
||||
<Main />
|
||||
<NextScript />
|
||||
{this.props.children}
|
||||
</body>
|
||||
</html>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
const extendedResults = (
|
||||
<MyDoc any="property" should="work" here>
|
||||
<Head some="more" properties>
|
||||
<meta name="description" content="Head can have children, too!" />
|
||||
</Head>
|
||||
<h1>Hey there</h1>
|
||||
</MyDoc>
|
||||
);
|
||||
|
||||
const renderPage: NextDocumentContext['renderPage'] = (enhancer) => ({
|
||||
buildManifest: {},
|
||||
chunks: { names: [], filenames: [] },
|
||||
html: '',
|
||||
head: [<React.Fragment />],
|
||||
errorHtml: '',
|
||||
});
|
||||
|
||||
interface PageInitialProps extends PageProps {
|
||||
foo: string;
|
||||
bar: number;
|
||||
}
|
||||
|
||||
interface ProcessedInitialProps {
|
||||
fooLength: number;
|
||||
bar: boolean;
|
||||
}
|
||||
|
||||
const enhancerExplicit: Enhancer<PageProps, {}> = (App) => (props) => (<App />);
|
||||
const enhancerInferred = (App: React.ComponentType<ProcessedInitialProps>) => ({ foo, bar }: PageInitialProps) => (<App fooLength={foo.length} bar={!!bar} />);
|
||||
const explicitEnhancerRenderResponse = renderPage(enhancerExplicit);
|
||||
const inferredEnhancerRenderResponse = renderPage(enhancerInferred);
|
||||
const defaultedTypesRenderResponse = renderPage((App) => (props) => (<App url={props.url} />));
|
||||
const defaultedTypesExtendedRenderResponse = renderPage((App) => (props) => (<App foo="bar" url={props.url} />));
|
||||
const explicitTypesRenderResponseOne = renderPage<PageProps, {}>((App) => (props) => (<App />));
|
||||
const explicitTypesRenderResponseTwo = renderPage<PageInitialProps, ProcessedInitialProps>((App) => ({ foo, bar }) => (<App fooLength={foo.length} bar={!!bar} />));
|
||||
|
||||
Vendored
+1
-1
@@ -111,7 +111,7 @@ declare namespace NodeVault {
|
||||
debug?(...args: any[]): any;
|
||||
tv4?(...args: any[]): any;
|
||||
commands?: Array<{ method: string, path: string, scheme: any }>;
|
||||
mustache?: MustacheStatic;
|
||||
mustache?: typeof mustache;
|
||||
"request-promise"?: any;
|
||||
Promise?: PromiseConstructor;
|
||||
|
||||
|
||||
Vendored
+57
-9
@@ -13559,12 +13559,46 @@ declare namespace OfficeExtension {
|
||||
}
|
||||
|
||||
declare namespace OfficeExtension {
|
||||
/**
|
||||
* Specifies which properties of an object should be loaded. This load happens when the sync() method is executed. This synchronizes the states between Office objects and corresponding JavaScript proxy objects.
|
||||
*
|
||||
* @remarks
|
||||
*
|
||||
* For Word, the preferred method for specifying the properties and paging information is by using a string literal. The first two examples show the preferred way to request the text and font size properties for paragraphs in a paragraph collection:
|
||||
*
|
||||
* `context.load(paragraphs, 'text, font/size');`
|
||||
*
|
||||
* `paragraphs.load('text, font/size');`
|
||||
*
|
||||
* Here is a similar example using object notation (includes paging):
|
||||
*
|
||||
* `context.load(paragraphs, {select: 'text, font/size', expand: 'font', top: 50, skip: 0});`
|
||||
*
|
||||
* `paragraphs.load({select: 'text, font/size', expand: 'font', top: 50, skip: 0});`
|
||||
*
|
||||
* Note that if we don't specify the specific properties on the font object in the select statement, the expand statement by itself would indicate that all of the font properties are loaded.
|
||||
*/
|
||||
interface LoadOption {
|
||||
/**
|
||||
* A comma-delimited string, or array of strings, that specifies the properties/relationships to load.
|
||||
*/
|
||||
select?: string | string[];
|
||||
/**
|
||||
* A comma-delimited string, or array of strings, that specifies the relationships to load.
|
||||
*/
|
||||
expand?: string | string[];
|
||||
/**
|
||||
* Only usable on collection types. Specifies the maximum number of collection items that can be included in the result.
|
||||
*/
|
||||
top?: number;
|
||||
/**
|
||||
* Only usable on collection types. Specifies the number of items in the collection that are to be skipped and not included in the result. If top is specified, the result set will start after skipping the specified number of items.
|
||||
*/
|
||||
skip?: number;
|
||||
}
|
||||
/**
|
||||
* Provides an option for suppressing an error when the object that is used to set multiple properties tries to set read-only properties.
|
||||
*/
|
||||
interface UpdateOptions {
|
||||
/**
|
||||
* Throw an error if the passed-in property list includes read-only properties (default = true).
|
||||
@@ -13592,7 +13626,11 @@ declare namespace OfficeExtension {
|
||||
/** Request headers */
|
||||
requestHeaders: { [name: string]: string };
|
||||
|
||||
/** Queues up a command to load the specified properties of the object. You must call `context.sync()` before reading the properties. */
|
||||
/** Queues up a command to load the specified properties of the object. You must call `context.sync()` before reading the properties.
|
||||
*
|
||||
* @param object The object whose properties are loaded.
|
||||
* @param option A comma-delimited string, or array of strings, that specifies the properties/relationships to load, or an {@link Office.OfficeExtension.LoadOption} object.
|
||||
*/
|
||||
load(object: ClientObject, option?: string | string[] | LoadOption): void;
|
||||
|
||||
/**
|
||||
@@ -13652,7 +13690,9 @@ declare namespace OfficeExtension {
|
||||
*/
|
||||
extendedErrorLogging: boolean;
|
||||
};
|
||||
|
||||
/**
|
||||
* Provides information about an error.
|
||||
*/
|
||||
interface DebugInfo {
|
||||
/** Error code string, such as "InvalidArgument". */
|
||||
code: string;
|
||||
@@ -13660,24 +13700,20 @@ declare namespace OfficeExtension {
|
||||
message: string;
|
||||
/** Inner error, if applicable. */
|
||||
innerError?: DebugInfo | string;
|
||||
|
||||
/** The object type and property or method name (or similar information), if available. */
|
||||
errorLocation?: string;
|
||||
|
||||
/**
|
||||
* The statement that caused the error, if available.
|
||||
*
|
||||
* This statement will never contain any potentially-sensitive data and may not match the code exactly as written, but will be a close approximation.
|
||||
*/
|
||||
statements?: string;
|
||||
|
||||
/**
|
||||
* The statements that closely precede and follow the statement that caused the error, if available.
|
||||
*
|
||||
* These statements will never contain any potentially-sensitive data and may not match the code exactly as written, but will be a close approximation.
|
||||
*/
|
||||
surroundingStatements?: string[];
|
||||
|
||||
/**
|
||||
* All statements in the batch request (including any potentially-sensitive information that was specified in the request), if available.
|
||||
*
|
||||
@@ -13731,11 +13767,23 @@ declare namespace OfficeExtension {
|
||||
declare namespace OfficeExtension {
|
||||
/** Collection of tracked objects, contained within a request context. See "context.trackedObjects" for more information. */
|
||||
class TrackedObjects {
|
||||
/** Track a new object for automatic adjustment based on surrounding changes in the document. Only some object types require this. If you are using an object across ".sync" calls and outside the sequential execution of a ".run" batch, and get an "InvalidObjectPath" error when setting a property or invoking a method on the object, you needed to have added the object to the tracked object collection when the object was first created. */
|
||||
/**
|
||||
* Track a new object for automatic adjustment based on surrounding changes in the document. Only some object types require this. If you are using an object across ".sync" calls and outside the sequential execution of a ".run" batch, and get an "InvalidObjectPath" error when setting a property or invoking a method on the object, you needed to have added the object to the tracked object collection when the object was first created.
|
||||
*
|
||||
* This method also has the following signature:
|
||||
*
|
||||
* `add(objects: ClientObject[]): void;` Where objects is an array of objects to be tracked.
|
||||
*/
|
||||
add(object: ClientObject): void;
|
||||
/** Track a new object for automatic adjustment based on surrounding changes in the document. Only some object types require this. If you are using an object across ".sync" calls and outside the sequential execution of a ".run" batch, and get an "InvalidObjectPath" error when setting a property or invoking a method on the object, you needed to have added the object to the tracked object collection when the object was first created. */
|
||||
/** Track a set of objects for automatic adjustment based on surrounding changes in the document. Only some object types require this. If you are using an object across ".sync" calls and outside the sequential execution of a ".run" batch, and get an "InvalidObjectPath" error when setting a property or invoking a method on the object, you needed to have added the object to the tracked object collection when the object was first created. */
|
||||
add(objects: ClientObject[]): void;
|
||||
/** Release the memory associated with an object that was previously added to this collection. Having many tracked objects slows down the host application, so please remember to free any objects you add, once you're done using them. You will need to call `context.sync()` before the memory release takes effect. */
|
||||
/**
|
||||
* Release the memory associated with an object that was previously added to this collection. Having many tracked objects slows down the host application, so please remember to free any objects you add, once you're done using them. You will need to call `context.sync()` before the memory release takes effect.
|
||||
*
|
||||
* This method also has the following signature:
|
||||
*
|
||||
* `remove(objects: ClientObject[]): void;` Where objects is an array of objects to be removed.
|
||||
*/
|
||||
remove(object: ClientObject): void;
|
||||
/** Release the memory associated with an object that was previously added to this collection. Having many tracked objects slows down the host application, so please remember to free any objects you add, once you're done using them. You will need to call `context.sync()` before the memory release takes effect. */
|
||||
remove(objects: ClientObject[]): void;
|
||||
|
||||
Vendored
+2
-2
@@ -5,8 +5,8 @@
|
||||
|
||||
export = pTimeout;
|
||||
|
||||
declare function pTimeout<T>(input: Promise<T>, ms: number, message?: string | pTimeout.TimeoutError): Promise<T>;
|
||||
declare function pTimeout<T, R>(input: Promise<T>, ms: number, fallback: () => R | Promise<R>): Promise<T | R>;
|
||||
declare function pTimeout<T>(input: PromiseLike<T>, ms: number, message?: string | pTimeout.TimeoutError): Promise<T>;
|
||||
declare function pTimeout<T, R>(input: PromiseLike<T>, ms: number, fallback: () => R | Promise<R>): Promise<T | R>;
|
||||
|
||||
declare namespace pTimeout {
|
||||
class TimeoutError extends Error {
|
||||
|
||||
Vendored
+1
-1
@@ -85,7 +85,7 @@ export interface PackerOptions {
|
||||
|
||||
export type PNGOptions = BaseOptions & ParserOptions & PackerOptions;
|
||||
|
||||
export type ColorType = 0 | 1 | 2 | 4;
|
||||
export type ColorType = 0 | 2 | 4 | 6;
|
||||
|
||||
export interface Metadata {
|
||||
width: number;
|
||||
|
||||
Vendored
+2
-1
@@ -1,6 +1,7 @@
|
||||
// Type definitions for pouchdb-find 6.3
|
||||
// Project: https://pouchdb.com/
|
||||
// Definitions by: Jakub Navratil <https://github.com/trubit>
|
||||
// Sebastian Ramirez <https://github.com/tiangolo>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.3
|
||||
|
||||
@@ -100,7 +101,7 @@ declare namespace PouchDB {
|
||||
}
|
||||
|
||||
interface FindResponse<Content extends {}> {
|
||||
docs: Array<Core.Document<Content>>;
|
||||
docs: Array<Core.ExistingDocument<Content>>;
|
||||
}
|
||||
|
||||
interface CreateIndexOptions {
|
||||
|
||||
Vendored
+22
@@ -0,0 +1,22 @@
|
||||
// Type definitions for react-amplitude 0.1
|
||||
// Project: https://github.com/rorygarand/react-amplitude
|
||||
// Definitions by: Raymond Ho <https://github.com/rayzor65>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
export interface AmplitudeInstance {
|
||||
init(apiKey: string, userId?: string, config?: any, cb?: () => void): void;
|
||||
amplitude(): void;
|
||||
clearUserProperties(): void;
|
||||
getSessionId(): void;
|
||||
identify(idObj: any, cb: () => void): void;
|
||||
isNewSession(): void;
|
||||
logEvent(eventType: string, eventProperties: {}, cb: () => void): void;
|
||||
logEventWithTimestamp(eventType: string, eventProperties: {}, timestamp: number, cb: () => void): void;
|
||||
resetUserId(): void;
|
||||
setUserId(userId: string): void;
|
||||
setUserProperties(userProps: any): void;
|
||||
}
|
||||
|
||||
declare const Amplitude: AmplitudeInstance;
|
||||
|
||||
export default Amplitude;
|
||||
@@ -0,0 +1,2 @@
|
||||
import Amplitude from 'react-amplitude';
|
||||
Amplitude.init('YOUR_UNIQUE_TRACKING_CODE');
|
||||
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"react-amplitude-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Vendored
+20
-1
@@ -143,8 +143,27 @@ declare namespace Autocomplete {
|
||||
open?: boolean;
|
||||
debug?: boolean;
|
||||
}
|
||||
|
||||
interface State {
|
||||
/**
|
||||
* True when the menu is visible. Provided to `onMenuVisibilityChange`.
|
||||
*/
|
||||
isOpen: boolean;
|
||||
|
||||
/**
|
||||
* Index of the highlighted item, `null` if none currently is.
|
||||
*/
|
||||
highlightedIndex: number | null;
|
||||
|
||||
/**
|
||||
* These three `menu___` values are used in CSS to layout the menu.
|
||||
*/
|
||||
menuLeft?: number;
|
||||
menuTop?: number;
|
||||
menuWidth?: number;
|
||||
}
|
||||
}
|
||||
declare class Autocomplete extends Component<Autocomplete.Props> {
|
||||
declare class Autocomplete extends Component<Autocomplete.Props, Autocomplete.State> {
|
||||
/**
|
||||
* Autocomplete exposes a subset of `HTMLInputElement` properties to the parent component.
|
||||
* They can be accessed through Autocomplete's `ref` prop.
|
||||
|
||||
Vendored
+6
-5
@@ -1,8 +1,9 @@
|
||||
// Type definitions for react-beautiful-dnd 6.0
|
||||
// Type definitions for react-beautiful-dnd 7.1
|
||||
// Project: https://github.com/atlassian/react-beautiful-dnd
|
||||
// Definitions by: varHarrie <https://github.com/varHarrie>
|
||||
// Bradley Ayers <https://github.com/bradleyayers>
|
||||
// Austin Turner <https://github.com/paustint>
|
||||
// Mark Nelissen <https://github.com/marknelissen>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.6
|
||||
|
||||
@@ -84,8 +85,8 @@ export class Droppable extends React.Component<DroppableProps> {}
|
||||
*/
|
||||
|
||||
export interface NotDraggingStyle {
|
||||
transform: null | string;
|
||||
transition: null | 'none';
|
||||
transform?: string;
|
||||
transition?: 'none';
|
||||
}
|
||||
|
||||
export interface DraggingStyle {
|
||||
@@ -97,14 +98,14 @@ export interface DraggingStyle {
|
||||
top: number;
|
||||
left: number;
|
||||
margin: 0;
|
||||
transform: null | string;
|
||||
transform?: string;
|
||||
transition: 'none';
|
||||
zIndex: ZIndex;
|
||||
}
|
||||
|
||||
export interface DraggableProvidedDraggableProps {
|
||||
// inline style
|
||||
style: null | DraggingStyle | NotDraggingStyle;
|
||||
style?: DraggingStyle | NotDraggingStyle;
|
||||
// used for shared global styles
|
||||
'data-react-beautiful-dnd-draggable': string;
|
||||
}
|
||||
|
||||
+1
@@ -35,6 +35,7 @@ declare module "react-jsonschema-form" {
|
||||
>;
|
||||
safeRenderCompletion?: boolean;
|
||||
transformErrors?: (errors: AjvError[]) => AjvError[];
|
||||
idPrefix?: string;
|
||||
|
||||
// HTML Attributes
|
||||
id?: string;
|
||||
|
||||
+6
@@ -1,6 +1,7 @@
|
||||
// Type definitions for react-places-autocomplete 6.1
|
||||
// Project: https://github.com/kenny-hibino/react-places-autocomplete/
|
||||
// Definitions by: Guilherme Hübner <https://github.com/guilhermehubner>
|
||||
// Andrew Makarov <https://github.com/r3nya>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.6
|
||||
//
|
||||
@@ -56,6 +57,11 @@ export interface PropTypes {
|
||||
}
|
||||
|
||||
export function geocodeByAddress(address: string, callback: (results: google.maps.GeocoderResult[], status: google.maps.GeocoderStatus) => void): void;
|
||||
export function geocodeByAddress(address: string): Promise<google.maps.GeocoderResult[]>;
|
||||
|
||||
export function geocodeByPlaceId(placeId: string, callback: (results: google.maps.GeocoderResult[], status: google.maps.GeocoderStatus) => void): void;
|
||||
export function geocodeByPlaceId(placeId: string): Promise<google.maps.GeocoderResult[]>;
|
||||
|
||||
export function getLatLng(results: google.maps.GeocoderResult): Promise<google.maps.LatLngLiteral>;
|
||||
|
||||
export default class PlacesAutocomplete extends React.Component<PropTypes> {}
|
||||
|
||||
@@ -0,0 +1,52 @@
|
||||
import * as React from 'react';
|
||||
import PlacesAutocomplete, { geocodeByAddress, geocodeByPlaceId, getLatLng } from 'react-places-autocomplete';
|
||||
|
||||
class Test extends React.Component {
|
||||
state = {
|
||||
address: 'San Francisco, CA',
|
||||
placeId: '12345',
|
||||
};
|
||||
|
||||
handleFormSubmit = (event: any) => {
|
||||
event.preventDefault();
|
||||
|
||||
const { address, placeId } = this.state;
|
||||
|
||||
// Old API
|
||||
geocodeByAddress(address, (results, status) => {
|
||||
const latLng = getLatLng(results[0]);
|
||||
console.info(latLng, status);
|
||||
});
|
||||
|
||||
geocodeByPlaceId(placeId, (results, status) => {
|
||||
const latLng = getLatLng(results[0]);
|
||||
console.info(latLng, status);
|
||||
});
|
||||
|
||||
// New API
|
||||
geocodeByAddress(address)
|
||||
.then((results) => getLatLng(results[0]))
|
||||
.then((latLng) => console.log('Success', latLng))
|
||||
.catch((error) => console.error('Error', error));
|
||||
|
||||
geocodeByPlaceId(placeId)
|
||||
.then((results) => getLatLng(results[0]))
|
||||
.then((latLng) => console.log('Success', latLng))
|
||||
.catch((error) => console.error('Error', error));
|
||||
}
|
||||
|
||||
onChange = (address: string) => this.setState({ address });
|
||||
|
||||
render() {
|
||||
const inputProps = {
|
||||
value: this.state.address,
|
||||
onChange: this.onChange,
|
||||
};
|
||||
|
||||
return (
|
||||
<form onSubmit={this.handleFormSubmit}>
|
||||
<PlacesAutocomplete inputProps={inputProps} />
|
||||
</form>
|
||||
);
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user