mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-06 15:57:13 +00:00
Merge remote-tracking branch 'upstream/master' into AlexJ-OutlookMigration
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
import * as Ajv from "ajv";
|
||||
import AjvErrors = require("ajv-errors");
|
||||
|
||||
const ajv = new Ajv({allErrors: true, jsonPointers: true});
|
||||
AjvErrors(ajv);
|
||||
Vendored
+18
@@ -0,0 +1,18 @@
|
||||
// Type definitions for ajv-errors 1.0
|
||||
// Project: https://github.com/epoberezkin/ajv-errors
|
||||
// Definitions by: Afshawn Lotfi <https://github.com/afshawnlotfi>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
import { Ajv } from "ajv";
|
||||
|
||||
/**
|
||||
*
|
||||
* @param ajv Ajv Main Class
|
||||
* https://github.com/epoberezkin/ajv
|
||||
* @param options Optional options for Ajv Errors
|
||||
* https://github.com/epoberezkin/ajv-errors#options
|
||||
*
|
||||
*/
|
||||
|
||||
export = AjvErrors;
|
||||
declare function AjvErrors(ajv: Ajv, options?: {}): Ajv;
|
||||
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictFunctionTypes": true,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"ajv-errors-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
@@ -10,12 +10,12 @@ const o: Options = {
|
||||
onRetry: (e: Error) => 42
|
||||
};
|
||||
|
||||
retry(
|
||||
const hello: Promise<string> = retry(
|
||||
bail => 'hello',
|
||||
{ retries: 3 }
|
||||
);
|
||||
|
||||
retry(
|
||||
const answer: Promise<number> = retry(
|
||||
bail => Promise.resolve(42),
|
||||
{ retries: 3 }
|
||||
);
|
||||
|
||||
Vendored
+1
-1
@@ -19,7 +19,7 @@ declare namespace AsyncRetry {
|
||||
onRetry?: (e: Error) => any;
|
||||
}
|
||||
|
||||
type RetryFunction<A> = (bail: (e: Error) => A, attempt: number) => A|Promise<A>;
|
||||
type RetryFunction<A> = (bail: (e: Error) => void, attempt: number) => A|Promise<A>;
|
||||
}
|
||||
|
||||
export = AsyncRetry;
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
import tokenProvider = require('axios-token-interceptor');
|
||||
|
||||
tokenProvider(); // $ExpectError
|
||||
|
||||
const validOptions = {
|
||||
getToken: () => Promise.resolve('qwerty'),
|
||||
};
|
||||
tokenProvider(validOptions); // $ExpectType TokenProvider
|
||||
|
||||
tokenCache(); // $ExpectError
|
||||
|
||||
const getToken = Promise.resolve('qwerty');
|
||||
const validCacheOptions = {
|
||||
maxAge: 3600,
|
||||
};
|
||||
const cache = tokenProvider.tokenCache(getToken, validCacheOptions); // $Expect TokenCache
|
||||
|
||||
cache.reset(); // $ExpectType void
|
||||
+32
@@ -0,0 +1,32 @@
|
||||
// Type definitions for axios-token-interceptor 0.1
|
||||
// Project: https://github.com/sandrinodimattia/axios-token-interceptor#readme
|
||||
// Definitions by: Mike Dodge <https://github.com/innovation-team>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
import { AxiosRequestConfig } from 'axios';
|
||||
|
||||
// Module
|
||||
declare function AxiosTokenProvider(Options: AxiosTokenProvider.InterceptorOptions): AxiosTokenProvider.TokenProvider;
|
||||
declare namespace AxiosTokenProvider {
|
||||
function tokenCache(getToken: Promise<string>, options: TokenCacheOptions): TokenCache;
|
||||
|
||||
// Interfaces
|
||||
interface InterceptorOptions {
|
||||
token?: string;
|
||||
getToken?: () => string | Promise<string>;
|
||||
header?: string;
|
||||
headerFormatter?: (token: string) => string;
|
||||
}
|
||||
|
||||
type TokenProvider = (config: AxiosRequestConfig) => Promise<AxiosRequestConfig>;
|
||||
|
||||
interface TokenCacheOptions {
|
||||
getMaxAge?: () => number;
|
||||
maxAge?: number;
|
||||
}
|
||||
|
||||
interface TokenCache {
|
||||
reset(): void;
|
||||
}
|
||||
}
|
||||
export = AxiosTokenProvider;
|
||||
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"private": true,
|
||||
"dependencies": {
|
||||
"axios": "^0.16.2"
|
||||
}
|
||||
}
|
||||
@@ -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",
|
||||
"axios-token-interceptor-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
@@ -0,0 +1,13 @@
|
||||
import Backoff = require("backo2");
|
||||
|
||||
const backoff = new Backoff();
|
||||
const backoff2 = new Backoff({});
|
||||
const backoff3 = new Backoff({
|
||||
min: 0,
|
||||
max: 0,
|
||||
jitter: 0,
|
||||
factor: 0
|
||||
});
|
||||
|
||||
const y: number = backoff3.duration();
|
||||
backoff3.reset();
|
||||
Vendored
+36
@@ -0,0 +1,36 @@
|
||||
// Type definitions for backo2 1.0
|
||||
// Project: https://github.com/mokesmokes/backo
|
||||
// Definitions by: Retsam <https://github.com/Retsam>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.1
|
||||
|
||||
type BackoffOptions = Partial<{
|
||||
min: number,
|
||||
max: number,
|
||||
jitter: number,
|
||||
factor: number,
|
||||
}>;
|
||||
|
||||
declare class Backoff {
|
||||
constructor(opts?: BackoffOptions);
|
||||
|
||||
duration(): number;
|
||||
/**
|
||||
* Reset the number of attempts.
|
||||
*/
|
||||
reset(): void;
|
||||
/**
|
||||
* Set the minimum duration
|
||||
*/
|
||||
setMin(min: number): void;
|
||||
/**
|
||||
* Set the maximum duration
|
||||
*/
|
||||
setMax(max: number): void;
|
||||
/**
|
||||
* Set the jitter
|
||||
*/
|
||||
setJitter(jitter: number): void;
|
||||
}
|
||||
|
||||
export = Backoff;
|
||||
@@ -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",
|
||||
"backo2-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
@@ -0,0 +1,8 @@
|
||||
import * as pack from "bin-pack";
|
||||
|
||||
// $ExpectType PackResult<{ width: number; height: number; }>
|
||||
const packResult = pack([
|
||||
{ width: 50, height: 50 },
|
||||
{ width: 25, height: 25 },
|
||||
{ width: 25, height: 20 }
|
||||
]);
|
||||
Vendored
+60
@@ -0,0 +1,60 @@
|
||||
// Type definitions for bin-pack 1.0
|
||||
// Project: https://github.com/bryanburgers/bin-pack
|
||||
// Definitions by: Oren Trutner <https://github.com/orentrutner>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/**
|
||||
* Packs objects that have a width and a height into as small of a square as
|
||||
* possible, using a binary tree bin packing algorithm. After packing, each
|
||||
* object is given an (x, y) coordinate of where it would be optimally packed.
|
||||
* @param bins List of rectangular bins to pack
|
||||
* @param options Packing options. Use inPlace: true to modify the bins
|
||||
* argument in-place.
|
||||
*/
|
||||
declare function pack<T extends pack.Bin>(bins: T[], options?: pack.Options): pack.PackResult<T>;
|
||||
|
||||
declare namespace pack {
|
||||
/** Packing options. */
|
||||
interface Options {
|
||||
/** Use inPlace=true to add x,y fields to the bins argument. */
|
||||
inPlace?: boolean;
|
||||
}
|
||||
|
||||
/** Specifies the dimensions of a bin to pack. */
|
||||
interface Bin {
|
||||
width: number;
|
||||
height: number;
|
||||
}
|
||||
|
||||
/** Describes the location of a packed bin. */
|
||||
interface PackedItem<T> {
|
||||
/** X coordinate of the packed bin. */
|
||||
x: number;
|
||||
|
||||
/** Y coordinate of the packed bin. */
|
||||
y: number;
|
||||
|
||||
/** Width of the bin. */
|
||||
width: number;
|
||||
|
||||
/** Height of the bin. */
|
||||
height: number;
|
||||
|
||||
/** The original bin object. */
|
||||
item: T;
|
||||
}
|
||||
|
||||
/** The return value from the pack function. */
|
||||
interface PackResult<T> {
|
||||
/** Width of the bounding box around all bins. */
|
||||
width: number;
|
||||
|
||||
/** Height of the bounding box around all bins. */
|
||||
height: number;
|
||||
|
||||
/** List of packed bins. */
|
||||
items: Array<PackedItem<T>>;
|
||||
}
|
||||
}
|
||||
|
||||
export = pack;
|
||||
@@ -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",
|
||||
"bin-pack-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Vendored
+5118
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,48 @@
|
||||
Cesium.buildModuleUrl.setBaseUrl('/assets/cesium/');
|
||||
|
||||
const viewer = new Cesium.Viewer('#cesium', {
|
||||
sceneMode: Cesium.SceneMode.COLUMBUS_VIEW,
|
||||
imageryProvider: new Cesium.IonImageryProvider({ assetId: 3845 }),
|
||||
baseLayerPicker: false,
|
||||
geocoder: false,
|
||||
});
|
||||
|
||||
const midnight = Cesium.JulianDate.fromDate(new Date(2018, 5, 14));
|
||||
const prop = new Cesium.SampledPositionProperty();
|
||||
|
||||
const pos = Cesium.Cartesian3.fromDegrees(1, 2, 3);
|
||||
const time = Cesium.JulianDate.addSeconds(midnight, 12345, new Cesium.JulianDate());
|
||||
prop.addSample(time, pos);
|
||||
viewer.entities.add(new Cesium.Entity({
|
||||
position: pos,
|
||||
point: new Cesium.PointGraphics({
|
||||
color: Cesium.Color.fromCssColorString('#123123'),
|
||||
pixelSize: 2
|
||||
})
|
||||
}));
|
||||
|
||||
const objStart = Cesium.JulianDate.addSeconds(midnight, 12340, new Cesium.JulianDate());
|
||||
const objStop = Cesium.JulianDate.addSeconds(midnight, 12350, new Cesium.JulianDate());
|
||||
|
||||
const entity = new Cesium.Entity({
|
||||
name: 'TEST',
|
||||
availability: new Cesium.TimeIntervalCollection([
|
||||
new Cesium.TimeInterval({
|
||||
start: objStart,
|
||||
stop: objStop
|
||||
})
|
||||
]),
|
||||
position: prop,
|
||||
orientation: new Cesium.VelocityOrientationProperty(prop),
|
||||
path: new Cesium.PathGraphics({
|
||||
resolution: 5,
|
||||
width: 3,
|
||||
material: new Cesium.ColorMaterialProperty(Cesium.Color.fromCssColorString('#223344')),
|
||||
leadTime: 0
|
||||
}),
|
||||
model: new Cesium.ModelGraphics({
|
||||
uri: 'http://assets.agi.com/models/rv1.gltf',
|
||||
minimumPixelSize: 48
|
||||
})
|
||||
});
|
||||
viewer.entities.add(entity);
|
||||
@@ -0,0 +1,50 @@
|
||||
import * as Cesium from 'cesium';
|
||||
|
||||
Cesium.buildModuleUrl.setBaseUrl('/assets/cesium/');
|
||||
|
||||
const viewer = new Cesium.Viewer('#cesium', {
|
||||
sceneMode: Cesium.SceneMode.COLUMBUS_VIEW,
|
||||
imageryProvider: new Cesium.IonImageryProvider({ assetId: 3845 }),
|
||||
baseLayerPicker: false,
|
||||
geocoder: false,
|
||||
});
|
||||
|
||||
const midnight = Cesium.JulianDate.fromDate(new Date(2018, 5, 14));
|
||||
const prop = new Cesium.SampledPositionProperty();
|
||||
|
||||
const pos = Cesium.Cartesian3.fromDegrees(1, 2, 3);
|
||||
const time = Cesium.JulianDate.addSeconds(midnight, 12345, new Cesium.JulianDate());
|
||||
prop.addSample(time, pos);
|
||||
viewer.entities.add(new Cesium.Entity({
|
||||
position: pos,
|
||||
point: new Cesium.PointGraphics({
|
||||
color: Cesium.Color.fromCssColorString('#123123'),
|
||||
pixelSize: 2
|
||||
})
|
||||
}));
|
||||
|
||||
const objStart = Cesium.JulianDate.addSeconds(midnight, 12340, new Cesium.JulianDate());
|
||||
const objStop = Cesium.JulianDate.addSeconds(midnight, 12350, new Cesium.JulianDate());
|
||||
|
||||
const entity = new Cesium.Entity({
|
||||
name: 'TEST',
|
||||
availability: new Cesium.TimeIntervalCollection([
|
||||
new Cesium.TimeInterval({
|
||||
start: objStart,
|
||||
stop: objStop
|
||||
})
|
||||
]),
|
||||
position: prop,
|
||||
orientation: new Cesium.VelocityOrientationProperty(prop),
|
||||
path: new Cesium.PathGraphics({
|
||||
resolution: 5,
|
||||
width: 3,
|
||||
material: new Cesium.ColorMaterialProperty(Cesium.Color.fromCssColorString('#223344')),
|
||||
leadTime: 0
|
||||
}),
|
||||
model: new Cesium.ModelGraphics({
|
||||
uri: 'http://assets.agi.com/models/rv1.gltf',
|
||||
minimumPixelSize: 48
|
||||
})
|
||||
});
|
||||
viewer.entities.add(entity);
|
||||
@@ -0,0 +1,25 @@
|
||||
{
|
||||
"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",
|
||||
"test/cesium-global.test.ts",
|
||||
"test/cesium-module.test.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"extends": "dtslint/dt.json",
|
||||
"rules": {
|
||||
"strict-export-declare-modifiers": false
|
||||
}
|
||||
}
|
||||
@@ -20,10 +20,10 @@
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"chrome-app.d.ts",
|
||||
"chrome-cast.d.ts",
|
||||
"chrome-webview.d.ts",
|
||||
"chrome-cast/index.d.ts",
|
||||
"test/index.ts",
|
||||
"test/chrome-app.ts",
|
||||
"test/chrome-webview.ts"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,134 @@
|
||||
cast.framework.VERSION === "1.0.06";
|
||||
cast.framework.setLoggerLevel(cast.framework.LoggerLevel.DEBUG);
|
||||
|
||||
const context = cast.framework.CastContext.getInstance();
|
||||
context.getCastState() === cast.framework.CastState.CONNECTED;
|
||||
context.getSessionState() === cast.framework.SessionState.NO_SESSION;
|
||||
|
||||
context.setOptions({
|
||||
autoJoinPolicy: chrome.cast.AutoJoinPolicy.ORIGIN_SCOPED,
|
||||
language: "en-US",
|
||||
receiverApplicationId: "test",
|
||||
resumeSavedSession: true
|
||||
});
|
||||
|
||||
context.addEventListener(
|
||||
cast.framework.CastContextEventType.CAST_STATE_CHANGED,
|
||||
event => {
|
||||
const { castState } = event;
|
||||
}
|
||||
);
|
||||
context.addEventListener(
|
||||
cast.framework.CastContextEventType.SESSION_STATE_CHANGED,
|
||||
event => {
|
||||
const { sessionState } = event;
|
||||
}
|
||||
);
|
||||
|
||||
const handleSessionStateChange = (
|
||||
event: cast.framework.SessionStateEventData
|
||||
) => {};
|
||||
context.removeEventListener(
|
||||
cast.framework.CastContextEventType.SESSION_STATE_CHANGED,
|
||||
handleSessionStateChange
|
||||
);
|
||||
|
||||
context.requestSession().then(err => {
|
||||
if (err === chrome.cast.ErrorCode.CHANNEL_ERROR) return;
|
||||
|
||||
const session = cast.framework.CastContext.getInstance().getCurrentSession();
|
||||
if (!session) return;
|
||||
|
||||
const handleError = (err?: chrome.cast.ErrorCode) => {};
|
||||
|
||||
session.getSessionObj().sessionId === session.getSessionId();
|
||||
session.getSessionState() === cast.framework.SessionState.SESSION_STARTED;
|
||||
session.getCastDevice().name;
|
||||
session.getApplicationMetadata().applicationId;
|
||||
session.getApplicationStatus() === "";
|
||||
session.getActiveInputState() ===
|
||||
cast.framework.ActiveInputState.ACTIVE_INPUT_STATE_UNKNOWN;
|
||||
session.endSession(false);
|
||||
session.setVolume(0.5).then(handleError);
|
||||
session.getVolume() === 0.5;
|
||||
session.setMute(true).then(handleError);
|
||||
session.isMute();
|
||||
session.sendMessage("namespace", { obj: 1 }).then(handleError);
|
||||
session.sendMessage("namespace", "string");
|
||||
session.sendMessage("namespace", 2);
|
||||
|
||||
session.addMessageListener("namespace", (namespace, message) => {});
|
||||
session.removeMessageListener("namespace", (namespace, message) => {});
|
||||
|
||||
const req = new chrome.cast.media.LoadRequest(
|
||||
new chrome.cast.media.MediaInfo("id", "type")
|
||||
);
|
||||
session.loadMedia(req);
|
||||
|
||||
const media = session.getMediaSession();
|
||||
if (media && media.sessionId) {
|
||||
}
|
||||
|
||||
session.addEventListener(
|
||||
cast.framework.SessionEventType.ACTIVE_INPUT_STATE_CHANGED,
|
||||
({ activeInputState }) => {}
|
||||
);
|
||||
session.addEventListener(
|
||||
cast.framework.SessionEventType.APPLICATION_METADATA_CHANGED,
|
||||
({ metadata }) => {}
|
||||
);
|
||||
session.addEventListener(
|
||||
cast.framework.SessionEventType.APPLICATION_STATUS_CHANGED,
|
||||
({ status }) => {}
|
||||
);
|
||||
session.addEventListener(
|
||||
cast.framework.SessionEventType.MEDIA_SESSION,
|
||||
({ mediaSession }) => {}
|
||||
);
|
||||
session.addEventListener(
|
||||
cast.framework.SessionEventType.VOLUME_CHANGED,
|
||||
({ volume }) => {}
|
||||
);
|
||||
session.removeEventListener(
|
||||
cast.framework.SessionEventType.VOLUME_CHANGED,
|
||||
({ volume }) => {}
|
||||
);
|
||||
});
|
||||
|
||||
const player = new cast.framework.RemotePlayer();
|
||||
{
|
||||
const bool: boolean =
|
||||
player.isConnected &&
|
||||
player.isMediaLoaded &&
|
||||
player.canControlVolume &&
|
||||
player.isPaused &&
|
||||
player.isMuted &&
|
||||
player.canPause &&
|
||||
player.canSeek;
|
||||
const sum: number = player.duration + player.currentTime + player.volumeLevel;
|
||||
const str: string =
|
||||
player.displayName + player.statusText + player.title + player.displayName;
|
||||
}
|
||||
player.mediaInfo && player.mediaInfo.contentId;
|
||||
player.imageUrl && player.imageUrl === "";
|
||||
player.playerState && player.playerState === chrome.cast.media.PlayerState.IDLE;
|
||||
player.savedPlayerState && player.savedPlayerState.currentTime;
|
||||
player.controller === null;
|
||||
|
||||
const playerCtrl = new cast.framework.RemotePlayerController(player);
|
||||
player.controller === playerCtrl;
|
||||
playerCtrl.playOrPause();
|
||||
playerCtrl.stop();
|
||||
playerCtrl.seek();
|
||||
playerCtrl.muteOrUnmute();
|
||||
playerCtrl.setVolumeLevel();
|
||||
playerCtrl.getFormattedTime(60);
|
||||
playerCtrl.getSeekPosition(1, 60) === playerCtrl.getSeekTime(1, 60);
|
||||
playerCtrl.addEventListener(
|
||||
cast.framework.RemotePlayerEventType.ANY_CHANGE,
|
||||
() => {}
|
||||
);
|
||||
playerCtrl.removeEventListener(
|
||||
cast.framework.RemotePlayerEventType.ANY_CHANGE,
|
||||
() => {}
|
||||
);
|
||||
+305
@@ -0,0 +1,305 @@
|
||||
// Type definitions for Cast Application Framework Sender API 1.0
|
||||
// Project: https://developers.google.com/cast/docs/caf_receiver_overview
|
||||
// Definitions by: Samuel Maddock <https://github.com/samuelmaddock>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.4
|
||||
|
||||
/// <reference types="chrome/chrome-cast" />
|
||||
|
||||
////////////////////
|
||||
// Global object
|
||||
////////////////////
|
||||
interface Window {
|
||||
cast: typeof cast;
|
||||
}
|
||||
|
||||
////////////////////
|
||||
// Framework
|
||||
////////////////////
|
||||
/**
|
||||
* Cast Application Framework
|
||||
* @see https://developers.google.com/cast/docs/reference/chrome/cast.framework
|
||||
*/
|
||||
declare namespace cast.framework {
|
||||
enum LoggerLevel {
|
||||
DEBUG,
|
||||
INFO,
|
||||
WARNING,
|
||||
ERROR,
|
||||
NONE
|
||||
}
|
||||
|
||||
enum CastState {
|
||||
NO_DEVICES_AVAILABLE = "NO_DEVICES_AVAILABLE",
|
||||
NOT_CONNECTED = "NOT_CONNECTED",
|
||||
CONNECTING = "CONNECTING",
|
||||
CONNECTED = "CONNECTED"
|
||||
}
|
||||
|
||||
enum SessionState {
|
||||
NO_SESSION = "NO_SESSION",
|
||||
SESSION_STARTING = "SESSION_STARTING",
|
||||
SESSION_STARTED = "SESSION_STARTED",
|
||||
SESSION_START_FAILED = "SESSION_START_FAILED",
|
||||
SESSION_ENDING = "SESSION_ENDING",
|
||||
SESSION_ENDED = "SESSION_ENDED",
|
||||
SESSION_RESUMED = "SESSION_RESUMED"
|
||||
}
|
||||
enum CastContextEventType {
|
||||
CAST_STATE_CHANGED = "caststatechanged",
|
||||
SESSION_STATE_CHANGED = "sessionstatechanged"
|
||||
}
|
||||
enum SessionEventType {
|
||||
APPLICATION_STATUS_CHANGED = "applicationstatuschanged",
|
||||
APPLICATION_METADATA_CHANGED = "applicationmetadatachanged",
|
||||
ACTIVE_INPUT_STATE_CHANGED = "activeinputstatechanged",
|
||||
VOLUME_CHANGED = "volumechanged",
|
||||
MEDIA_SESSION = "mediasession"
|
||||
}
|
||||
enum RemotePlayerEventType {
|
||||
ANY_CHANGE = "anyChanged",
|
||||
IS_CONNECTED_CHANGED = "isConnectedChanged",
|
||||
IS_MEDIA_LOADED_CHANGED = "isMediaLoadedChanged",
|
||||
DURATION_CHANGED = "durationChanged",
|
||||
CURRENT_TIME_CHANGED = "currentTimeChanged",
|
||||
IS_PAUSED_CHANGED = "isPausedChanged",
|
||||
VOLUME_LEVEL_CHANGED = "volumeLevelChanged",
|
||||
CAN_CONTROL_VOLUME_CHANGED = "canControlVolumeChanged",
|
||||
IS_MUTED_CHANGED = "isMutedChanged",
|
||||
CAN_PAUSE_CHANGED = "canPauseChanged",
|
||||
CAN_SEEK_CHANGED = "canSeekChanged",
|
||||
DISPLAY_NAME_CHANGED = "displayNameChanged",
|
||||
STATUS_TEXT_CHANGED = "statusTextChanged",
|
||||
TITLE_CHANGED = "titleChanged",
|
||||
DISPLAY_STATUS_CHANGED = "displayStatusChanged",
|
||||
MEDIA_INFO_CHANGED = "mediaInfoChanged",
|
||||
IMAGE_URL_CHANGED = "imageUrlChanged",
|
||||
PLAYER_STATE_CHANGED = "playerStateChanged"
|
||||
}
|
||||
|
||||
enum ActiveInputState {
|
||||
ACTIVE_INPUT_STATE_UNKNOWN = -1,
|
||||
ACTIVE_INPUT_STATE_NO = 0,
|
||||
ACTIVE_INPUT_STATE_YES = 1
|
||||
}
|
||||
|
||||
interface CastOptions {
|
||||
autoJoinPolicy: chrome.cast.AutoJoinPolicy;
|
||||
language?: string;
|
||||
receiverApplicationId?: string;
|
||||
resumeSavedSession?: boolean;
|
||||
}
|
||||
|
||||
const VERSION: string;
|
||||
function setLoggerLevel(level: LoggerLevel): void;
|
||||
|
||||
class CastContext {
|
||||
static getInstance(): CastContext;
|
||||
setOptions(options: CastOptions): void;
|
||||
getCastState(): CastState;
|
||||
getSessionState(): SessionState;
|
||||
requestSession(): Promise<chrome.cast.ErrorCode | undefined>;
|
||||
getCurrentSession(): CastSession | null;
|
||||
endCurrentSession(stopCasting: boolean): void;
|
||||
|
||||
addEventListener(
|
||||
type: CastContextEventType.CAST_STATE_CHANGED,
|
||||
handler: (event: CastStateEventData) => void
|
||||
): void;
|
||||
addEventListener(
|
||||
type: CastContextEventType.SESSION_STATE_CHANGED,
|
||||
handler: (event: SessionStateEventData) => void
|
||||
): void;
|
||||
removeEventListener(
|
||||
type: CastContextEventType.CAST_STATE_CHANGED,
|
||||
handler: (event: CastStateEventData) => void
|
||||
): void;
|
||||
removeEventListener(
|
||||
type: CastContextEventType.SESSION_STATE_CHANGED,
|
||||
handler: (event: SessionStateEventData) => void
|
||||
): void;
|
||||
}
|
||||
|
||||
class CastSession {
|
||||
constructor(sessionObj: chrome.cast.Session, state: SessionState);
|
||||
getSessionObj(): chrome.cast.Session;
|
||||
getSessionId(): string;
|
||||
getSessionState(): SessionState;
|
||||
getCastDevice(): chrome.cast.Receiver;
|
||||
getApplicationMetadata(): ApplicationMetadata;
|
||||
getApplicationStatus(): string;
|
||||
getActiveInputState(): ActiveInputState;
|
||||
endSession(stopCasting: boolean): void;
|
||||
setVolume(volume: number): Promise<chrome.cast.ErrorCode | undefined>;
|
||||
getVolume(): number;
|
||||
setMute(mute: boolean): Promise<chrome.cast.ErrorCode | undefined>;
|
||||
isMute(): boolean;
|
||||
sendMessage(
|
||||
namespace: string,
|
||||
data: any
|
||||
): Promise<chrome.cast.ErrorCode | undefined>;
|
||||
addMessageListener(
|
||||
namespace: string,
|
||||
listener: (namespace: string, message: string) => void
|
||||
): void;
|
||||
removeMessageListener(
|
||||
namespace: string,
|
||||
listener: (namespace: string, message: string) => void
|
||||
): void;
|
||||
loadMedia(
|
||||
request: chrome.cast.media.LoadRequest
|
||||
): Promise<chrome.cast.ErrorCode | undefined>;
|
||||
getMediaSession(): chrome.cast.media.Media | null;
|
||||
|
||||
addEventListener(
|
||||
type: SessionEventType.ACTIVE_INPUT_STATE_CHANGED,
|
||||
handler: (event: ActiveInputStateEventData) => void
|
||||
): void;
|
||||
addEventListener(
|
||||
type: SessionEventType.APPLICATION_METADATA_CHANGED,
|
||||
handler: (event: ApplicationMetadataEventData) => void
|
||||
): void;
|
||||
addEventListener(
|
||||
type: SessionEventType.APPLICATION_STATUS_CHANGED,
|
||||
handler: (event: ApplicationStatusEventData) => void
|
||||
): void;
|
||||
addEventListener(
|
||||
type: SessionEventType.MEDIA_SESSION,
|
||||
handler: (event: MediaSessionEventData) => void
|
||||
): void;
|
||||
addEventListener(
|
||||
type: SessionEventType.VOLUME_CHANGED,
|
||||
handler: (event: VolumeEventData) => void
|
||||
): void;
|
||||
removeEventListener(
|
||||
type: SessionEventType.ACTIVE_INPUT_STATE_CHANGED,
|
||||
handler: (event: ActiveInputStateEventData) => void
|
||||
): void;
|
||||
removeEventListener(
|
||||
type: SessionEventType.APPLICATION_METADATA_CHANGED,
|
||||
handler: (event: ApplicationMetadataEventData) => void
|
||||
): void;
|
||||
removeEventListener(
|
||||
type: SessionEventType.APPLICATION_STATUS_CHANGED,
|
||||
handler: (event: ApplicationStatusEventData) => void
|
||||
): void;
|
||||
removeEventListener(
|
||||
type: SessionEventType.MEDIA_SESSION,
|
||||
handler: (event: MediaSessionEventData) => void
|
||||
): void;
|
||||
removeEventListener(
|
||||
type: SessionEventType.VOLUME_CHANGED,
|
||||
handler: (event: VolumeEventData) => void
|
||||
): void;
|
||||
}
|
||||
|
||||
class RemotePlayerController {
|
||||
constructor(player: RemotePlayer);
|
||||
playOrPause(): void;
|
||||
stop(): void;
|
||||
seek(): void;
|
||||
muteOrUnmute(): void;
|
||||
setVolumeLevel(): void;
|
||||
getFormattedTime(timeInSec: number): string;
|
||||
getSeekPosition(currentTime: number, duration: number): number;
|
||||
getSeekTime(currentPosition: number, duration: number): number;
|
||||
|
||||
addEventListener(
|
||||
type: RemotePlayerEventType,
|
||||
handler: (event: RemotePlayerChangedEvent) => void
|
||||
): void;
|
||||
removeEventListener(
|
||||
type: RemotePlayerEventType,
|
||||
handler: (event: RemotePlayerChangedEvent) => void
|
||||
): void;
|
||||
}
|
||||
|
||||
interface SavedPlayerState {
|
||||
mediaInfo: chrome.cast.media.PlayerState | null;
|
||||
currentTime: number;
|
||||
isPaused: boolean;
|
||||
}
|
||||
|
||||
class RemotePlayer {
|
||||
isConnected: boolean;
|
||||
isMediaLoaded: boolean;
|
||||
duration: number;
|
||||
currentTime: number;
|
||||
volumeLevel: number;
|
||||
canControlVolume: boolean;
|
||||
isPaused: boolean;
|
||||
isMuted: boolean;
|
||||
canPause: boolean;
|
||||
canSeek: boolean;
|
||||
displayName: string;
|
||||
statusText: string;
|
||||
title: string;
|
||||
displayStatus: string;
|
||||
mediaInfo?: chrome.cast.media.MediaInfo;
|
||||
imageUrl: string | null;
|
||||
playerState: chrome.cast.media.PlayerState | null;
|
||||
savedPlayerState: SavedPlayerState | null;
|
||||
controller: RemotePlayerController | null;
|
||||
}
|
||||
|
||||
class ApplicationMetadata {
|
||||
constructor(sessionObj: chrome.cast.Session);
|
||||
applicationId: string;
|
||||
images: chrome.cast.Image[];
|
||||
name: string;
|
||||
namespaces: string[];
|
||||
}
|
||||
|
||||
abstract class EventData {
|
||||
constructor(type: string);
|
||||
type: string;
|
||||
}
|
||||
|
||||
class ActiveInputStateEventData extends EventData {
|
||||
constructor(activeInputState: ActiveInputState);
|
||||
activeInputState: ActiveInputState;
|
||||
}
|
||||
|
||||
class ApplicationMetadataEventData extends EventData {
|
||||
constructor(metadata: ApplicationMetadata);
|
||||
metadata: ApplicationMetadata;
|
||||
}
|
||||
|
||||
class ApplicationStatusEventData extends EventData {
|
||||
constructor(status: string);
|
||||
status: string;
|
||||
}
|
||||
|
||||
class CastStateEventData extends EventData {
|
||||
constructor(castState: CastState);
|
||||
castState: CastState;
|
||||
}
|
||||
|
||||
class MediaSessionEventData extends EventData {
|
||||
constructor(mediaSession: chrome.cast.media.Media);
|
||||
mediaSession: chrome.cast.media.Media;
|
||||
}
|
||||
|
||||
class RemotePlayerChangedEvent<T = any> extends EventData {
|
||||
constructor(type: RemotePlayerEventType, field: string, value: T);
|
||||
field: string;
|
||||
value: T;
|
||||
}
|
||||
|
||||
class SessionStateEventData extends EventData {
|
||||
constructor(
|
||||
session: CastSession,
|
||||
sessionState: SessionState,
|
||||
opt_errorCode: chrome.cast.ErrorCode
|
||||
);
|
||||
errorCode: chrome.cast.ErrorCode;
|
||||
session: CastSession;
|
||||
sessionState: SessionState;
|
||||
}
|
||||
|
||||
class VolumeEventData extends EventData {
|
||||
constructor(volume: number, isMute: boolean);
|
||||
isMute: boolean;
|
||||
volume: number;
|
||||
}
|
||||
}
|
||||
@@ -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",
|
||||
"chromecast-caf-sender-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
@@ -80,3 +80,17 @@ cy.on('zoom', (event) => {
|
||||
cy.nodes('$node > node').style('opacity', 0);
|
||||
}
|
||||
});
|
||||
|
||||
cy.animate({
|
||||
fit: {
|
||||
padding: 10,
|
||||
eles: cy.nodes()
|
||||
},
|
||||
duration: 500
|
||||
});
|
||||
|
||||
const node = cy.nodes()[0];
|
||||
cy.animate({
|
||||
center: {eles: node},
|
||||
duration: 500
|
||||
});
|
||||
|
||||
Vendored
+1
-2
@@ -1127,8 +1127,7 @@ declare namespace cytoscape {
|
||||
/**
|
||||
* The output is a collection of node and edge elements OR single element.
|
||||
*/
|
||||
interface CollectionElements extends
|
||||
EdgeCollection, NodeCollection, SingularElement { }
|
||||
type CollectionElements = EdgeCollection | NodeCollection | SingularElement;
|
||||
|
||||
/**
|
||||
* edges -> Cy.EdgeCollection
|
||||
|
||||
+11
-1
@@ -3,7 +3,7 @@
|
||||
import ejs = require("ejs");
|
||||
import { readFileSync as read } from 'fs';
|
||||
import LRU = require("lru-cache");
|
||||
import { TemplateFunction, Options } from "ejs";
|
||||
import { TemplateFunction, AsyncTemplateFunction, Options } from "ejs";
|
||||
|
||||
const fileName = 'test.ejs';
|
||||
const people = ['geddy', 'neil', 'alex'];
|
||||
@@ -12,6 +12,8 @@ const template = '<%= people.join(", "); %>';
|
||||
const options = { filename: fileName };
|
||||
let result: string;
|
||||
let ejsFunction: TemplateFunction;
|
||||
let asyncResult: Promise<string>;
|
||||
let ejsAsyncFunction: AsyncTemplateFunction;
|
||||
|
||||
const SimpleCallback = (err: any, html?: string) => {
|
||||
if (err) {
|
||||
@@ -44,11 +46,19 @@ ejsFunction = ejs.compile('<%= it.people.join(", "); %>', { _with: false, locals
|
||||
ejsFunction = ejs.compile(template, { rmWhitespace: true });
|
||||
const customEscape = (str: string) => !str ? '' : str.toUpperCase();
|
||||
ejsFunction = ejs.compile(template, { escape: customEscape });
|
||||
ejsFunction = ejs.compile(template, { async: false });
|
||||
|
||||
ejsAsyncFunction = ejs.compile(template, { async: true });
|
||||
ejsAsyncFunction = ejs.compile(template, { client: true, async: true });
|
||||
|
||||
result = ejsFunction();
|
||||
result = ejsFunction({});
|
||||
result = ejsFunction(data);
|
||||
|
||||
asyncResult = ejsAsyncFunction();
|
||||
asyncResult = ejsAsyncFunction({});
|
||||
asyncResult = ejsAsyncFunction(data);
|
||||
|
||||
/** @see https://github.com/mde/ejs/tree/v2.5.7#custom-fileloader */
|
||||
ejs.fileLoader = (path: string) => "";
|
||||
|
||||
|
||||
Vendored
+12
-3
@@ -1,4 +1,4 @@
|
||||
// Type definitions for ejs.js 2.5
|
||||
// Type definitions for ejs.js 2.6
|
||||
// Project: http://ejs.co/
|
||||
// Definitions by: Ben Liddicott <https://github.com/benliddicott>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
@@ -28,14 +28,20 @@ export function resolveInclude(name: string, filename: string, isDir: boolean):
|
||||
/**
|
||||
* Compile the given `str` of ejs into a template function.
|
||||
*/
|
||||
export function compile(template: string, opts?: Options): (TemplateFunction);
|
||||
export function compile(template: string, opts?: Options & { async: false }): TemplateFunction;
|
||||
export function compile(template: string, opts: Options & { async: true }): AsyncTemplateFunction;
|
||||
export function compile(template: string, opts: Options & { async?: never }): TemplateFunction;
|
||||
export function compile(template: string, opts?: Options): TemplateFunction | AsyncTemplateFunction;
|
||||
/**
|
||||
* Render the given `template` of ejs.
|
||||
*
|
||||
* If you would like to include options but not data, you need to explicitly
|
||||
* call this function with `data` being an empty object or `null`.
|
||||
*/
|
||||
export function render(template: string, data?: Data, opts?: Options): string;
|
||||
export function render(template: string, data?: Data, opts?: Options & { async: false }): string;
|
||||
export function render(template: string, data: Data | undefined, opts: Options & { async: true }): Promise<string>;
|
||||
export function render(template: string, data: Data | undefined, opts: Options & { async?: never }): string;
|
||||
export function render(template: string, data?: Data, opts?: Options): string | Promise<string>;
|
||||
|
||||
export type RenderFileCallback<T> = (err: Error, str?: string) => T;
|
||||
|
||||
@@ -55,6 +61,7 @@ export function renderFile<T>(path: string, data: Data, opts: Options, cb: Rende
|
||||
export function clearCache(): void;
|
||||
|
||||
export type TemplateFunction = (data?: Data) => string;
|
||||
export type AsyncTemplateFunction = (data?: Data) => Promise<string>;
|
||||
export interface Options {
|
||||
/** Compiled functions are cached, requires `filename` */
|
||||
cache?: boolean;
|
||||
@@ -95,6 +102,8 @@ export interface Options {
|
||||
* (By default escapes XML).
|
||||
*/
|
||||
escape?(str: string): string;
|
||||
/** Whether or not to use a Promise */
|
||||
async?: boolean;
|
||||
}
|
||||
|
||||
export function escapeRegexChars(s: string): string;
|
||||
|
||||
@@ -206,7 +206,8 @@ client.mget({
|
||||
index: 'myindex',
|
||||
type: 'mytype',
|
||||
body: {
|
||||
ids: [1, 2, 3]
|
||||
ids: [1, 2, 3],
|
||||
_source: ['test']
|
||||
}
|
||||
}, (error, response) => {
|
||||
// ...
|
||||
|
||||
Vendored
+1
-1
@@ -465,7 +465,7 @@ export interface MGetParams extends GenericParams {
|
||||
preference?: string;
|
||||
realtime?: boolean;
|
||||
refresh?: boolean;
|
||||
source?: NameList;
|
||||
_source?: NameList;
|
||||
_sourceExclude?: NameList;
|
||||
_sourceInclude?: NameList;
|
||||
index?: string;
|
||||
|
||||
+43
-15
@@ -1,4 +1,4 @@
|
||||
// Type definitions for Express 4.11
|
||||
// Type definitions for Express 4.16
|
||||
// Project: http://expressjs.com
|
||||
// Definitions by: Boris Yankov <https://github.com/borisyankov>
|
||||
// Michał Lytek <https://github.com/19majkel94>
|
||||
@@ -23,6 +23,7 @@ declare global {
|
||||
|
||||
import * as http from "http";
|
||||
import { EventEmitter } from "events";
|
||||
import { Options as RangeParserOptions, Result as RangeParserResult, Ranges as RangeParserRanges } from "range-parser";
|
||||
|
||||
export interface NextFunction {
|
||||
// tslint:disable-next-line callable-types (In ts2.1 it thinks the type alias has no call signatures)
|
||||
@@ -174,7 +175,7 @@ export interface CookieOptions {
|
||||
|
||||
export interface ByteRange { start: number; end: number; }
|
||||
|
||||
export interface RequestRanges extends Array<ByteRange> { type: string; }
|
||||
export interface RequestRanges extends RangeParserRanges { }
|
||||
|
||||
export type Errback = (err: Error) => void;
|
||||
|
||||
@@ -283,21 +284,19 @@ export interface Request extends http.IncomingMessage, Express.Request {
|
||||
acceptsLanguages(...lang: string[]): string | false;
|
||||
|
||||
/**
|
||||
* Parse Range header field,
|
||||
* capping to the given `size`.
|
||||
* Parse Range header field, capping to the given `size`.
|
||||
*
|
||||
* Unspecified ranges such as "0-" require
|
||||
* knowledge of your resource length. In
|
||||
* the case of a byte range this is of course
|
||||
* the total number of bytes. If the Range
|
||||
* header field is not given `null` is returned,
|
||||
* `-1` when unsatisfiable, `-2` when syntactically invalid.
|
||||
* Unspecified ranges such as "0-" require knowledge of your resource length. In
|
||||
* the case of a byte range this is of course the total number of bytes.
|
||||
* If the Range header field is not given `undefined` is returned.
|
||||
* If the Range header field is given, return value is a result of range-parser.
|
||||
* See more ./types/range-parser/index.d.ts
|
||||
*
|
||||
* NOTE: remember that ranges are inclusive, so for example "Range: users=0-3"
|
||||
* should respond with 4 users when available, not 3.
|
||||
*
|
||||
* NOTE: remember that ranges are inclusive, so
|
||||
* for example "Range: users=0-3" should respond
|
||||
* with 4 users when available, not 3.
|
||||
*/
|
||||
range(size: number): RequestRanges|null|-1|-2;
|
||||
range(size: number, options?: RangeParserOptions): RangeParserRanges | RangeParserResult | undefined;
|
||||
|
||||
/**
|
||||
* Return an array of Accepted media types
|
||||
@@ -450,6 +449,13 @@ export interface Request extends http.IncomingMessage, Express.Request {
|
||||
baseUrl: string;
|
||||
|
||||
app: Application;
|
||||
|
||||
/**
|
||||
* After middleware.init executed, Request will contain res and next properties
|
||||
* See: express/lib/middleware/init.js
|
||||
*/
|
||||
res?: Response;
|
||||
next?: NextFunction;
|
||||
}
|
||||
|
||||
export interface MediaType {
|
||||
@@ -827,7 +833,13 @@ export interface Response extends http.ServerResponse, Express.Response {
|
||||
*
|
||||
* @since 4.11.0
|
||||
*/
|
||||
append(field: string, value?: string[]|string): Response;
|
||||
append(field: string, value?: string[] | string): Response;
|
||||
|
||||
/**
|
||||
* After middleware.init executed, Response will contain req property
|
||||
* See: express/lib/middleware/init.js
|
||||
*/
|
||||
req?: Request;
|
||||
}
|
||||
|
||||
export interface Handler extends RequestHandler { }
|
||||
@@ -1062,6 +1074,22 @@ export interface Application extends EventEmitter, IRouter, Express.Application
|
||||
_router: any;
|
||||
|
||||
use: ApplicationRequestHandler<this>;
|
||||
|
||||
/**
|
||||
* The mount event is fired on a sub-app, when it is mounted on a parent app.
|
||||
* The parent app is passed to the callback function.
|
||||
*
|
||||
* NOTE:
|
||||
* Sub-apps will:
|
||||
* - Not inherit the value of settings that have a default value. You must set the value in the sub-app.
|
||||
* - Inherit the value of settings with no default value.
|
||||
*/
|
||||
on: (event: string, callback: (parent: Application) => void) => this;
|
||||
|
||||
/**
|
||||
* The app.mountpath property contains one or more path patterns on which a sub-app was mounted.
|
||||
*/
|
||||
mountpath: string | string[];
|
||||
}
|
||||
|
||||
export interface Express extends Application {
|
||||
|
||||
@@ -104,6 +104,9 @@ namespace express_tests {
|
||||
req.headers.existingHeader as string;
|
||||
req.headers.nonExistingHeader as any as undefined;
|
||||
|
||||
// Since 4.14.0 req.range() has options
|
||||
req.range(2, { combine: true });
|
||||
|
||||
res.send(req.query['token']);
|
||||
});
|
||||
|
||||
@@ -128,6 +131,19 @@ namespace express_tests {
|
||||
|
||||
app.use(router);
|
||||
|
||||
// Test req.res, req.next, res.req should exists after middleware.init
|
||||
app.use((req, res) => {
|
||||
req.res;
|
||||
req.next;
|
||||
res.req;
|
||||
});
|
||||
|
||||
// Test on mount event
|
||||
app.on('mount', (parent) => true);
|
||||
|
||||
// Test mountpath
|
||||
const mountPath: string|string[] = app.mountpath;
|
||||
|
||||
app.listen(3000);
|
||||
|
||||
const next: express.NextFunction = () => { };
|
||||
@@ -139,6 +155,7 @@ namespace express_tests {
|
||||
* *
|
||||
***************************/
|
||||
import * as http from 'http';
|
||||
import { RequestRanges } from 'express-serve-static-core';
|
||||
|
||||
namespace node_tests {
|
||||
{
|
||||
|
||||
Vendored
+1
-1
@@ -1,4 +1,4 @@
|
||||
// Type definitions for Express 4.11
|
||||
// Type definitions for Express 4.16
|
||||
// Project: http://expressjs.com
|
||||
// Definitions by: Boris Yankov <https://github.com/borisyankov>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
import GenerateJsonWebpackPlugin = require('generate-json-webpack-plugin');
|
||||
|
||||
new GenerateJsonWebpackPlugin('name', { key: 'value '});
|
||||
|
||||
new GenerateJsonWebpackPlugin('name', { key: 'value '}, (key, value) => `${key}${value}`);
|
||||
|
||||
new GenerateJsonWebpackPlugin('name', { key: 'value '}, (key, value) => `${key}${value}`, 4);
|
||||
|
||||
new GenerateJsonWebpackPlugin('name', { key: 'value '}, (key, value) => `${key}${value}`, ' ');
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
// Type definitions for generate-json-webpack-plugin 0.3
|
||||
// Project: https://github.com/elliottsj/generate-json-webpack-plugin
|
||||
// Definitions by: Ryan Clark <https://github.com/rynclark>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.3
|
||||
|
||||
import { Plugin } from 'webpack';
|
||||
|
||||
export = GenerateJsonWebpackPlugin;
|
||||
|
||||
declare class GenerateJsonWebpackPlugin extends Plugin {
|
||||
constructor(fileName: string, value: object, replacer?: (key: string, value: any) => any, space?: string | number);
|
||||
}
|
||||
@@ -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",
|
||||
"generate-json-webpack-plugin-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Vendored
+1
@@ -20,6 +20,7 @@ declare namespace helmet {
|
||||
ieNoOpen?: boolean,
|
||||
noCache?: boolean,
|
||||
noSniff?: boolean,
|
||||
referrerPolicy?: boolean | IHelmetReferrerPolicyConfiguration,
|
||||
xssFilter?: boolean | IHelmetXssFilterConfiguration,
|
||||
expectCt?: boolean | IHelmetExpectCtConfiguration,
|
||||
}
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
import imperium from 'imperium';
|
||||
|
||||
imperium.role('admin', async (req) => {
|
||||
return true;
|
||||
});
|
||||
|
||||
imperium.role('user')
|
||||
.can('seeUser', { user: '@' })
|
||||
.can('manageUser', { user: '@' });
|
||||
|
||||
imperium.role('admin')
|
||||
.is('user', { user: '*' });
|
||||
|
||||
imperium.can('seeUser');
|
||||
imperium.can(['seeUser', 'manageUser']);
|
||||
imperium.can({ action: 'seeUser', user: ':userId' });
|
||||
imperium.can([{ action: 'manageUser', user: ':userId' }]);
|
||||
imperium.is('admin');
|
||||
imperium.is(['admin', 'user']);
|
||||
Vendored
+98
@@ -0,0 +1,98 @@
|
||||
// Type definitions for imperium 2.0
|
||||
// Project: https://www.npmjs.org/package/imperium
|
||||
// Definitions by: Gaetan SENN <https://github.com/gaetansenn>
|
||||
// Definitions: https://github.com/psnider/DefinitelyTyped/imperium
|
||||
// TypeScript Version: 2.7
|
||||
|
||||
/// <reference types="node" />
|
||||
|
||||
import express = require('express');
|
||||
|
||||
export type GetAcl = (req: express.Request) => Promise<boolean> | Promise<object>;
|
||||
export type Actions = string[] | string;
|
||||
export type Context = Array<'params' | 'query' | 'headers' | 'body'>;
|
||||
// Can contain when key that is evaluated during route action
|
||||
export interface RoleParams {
|
||||
[key: string]: string;
|
||||
}
|
||||
|
||||
export const context: string[];
|
||||
export const roles: Roles;
|
||||
|
||||
// Add new role with specific ImperiumGetAcl
|
||||
export function role(roleName: string, getAcl?: GetAcl): Role;
|
||||
|
||||
// Check if user has role(s) act like as an OR
|
||||
export function is(roleNames: string | string[]): Promise<express.RequestHandler>;
|
||||
|
||||
// Check if current user can do action(s)
|
||||
export function can(actionS: string | string[] | Action | Action[]): Promise<express.RequestHandler>;
|
||||
|
||||
export function evaluateRouteActions(req: express.Request, action: Action[], context: Context): Actions;
|
||||
|
||||
export function evaluateRouteAction(req: express.Request, expr: string, key: string, context: Context): string;
|
||||
|
||||
export function evaluateUserActions(req: express.Request, roles: Role[]): Promise<Action[]>;
|
||||
|
||||
export function evaluateUserAction(action: RoleParams, context: { [key: string]: string[] }): { [key: string]: string[] };
|
||||
|
||||
export class Imperium {
|
||||
constructor()
|
||||
|
||||
context: string[];
|
||||
roles: Roles;
|
||||
|
||||
// Add new role with specific ImperiumGetAcl
|
||||
role(roleName: string, getAcl?: GetAcl): Role;
|
||||
|
||||
// Check if user has role(s) act like as an OR
|
||||
is(roleNames: string | string[]): Promise<express.RequestHandler>;
|
||||
|
||||
// Check if current user can do action(s)
|
||||
can(actionS: string | string[] | Action | Action[]): Promise<express.RequestHandler>;
|
||||
|
||||
private addRole(roleName: string, getAcl: GetAcl): void;
|
||||
|
||||
evaluateRouteActions(req: express.Request, action: Action[], context: Context): Actions;
|
||||
|
||||
evaluateRouteAction(req: express.Request, expr: string, key: string, context: Context): string;
|
||||
|
||||
evaluateUserActions(req: express.Request, roles: Role[]): Promise<Action[]>;
|
||||
|
||||
evaluateUserAction(action: RoleParams, context: { [key: string]: string[] }): { [key: string]: string[] };
|
||||
}
|
||||
|
||||
export interface Roles {
|
||||
[key: string]: RoleActions;
|
||||
}
|
||||
|
||||
export interface RoleActions {
|
||||
actions: Action[];
|
||||
getAcl?: GetAcl;
|
||||
}
|
||||
|
||||
export interface Action {
|
||||
action: string;
|
||||
[key: string]: string;
|
||||
}
|
||||
|
||||
export class Role {
|
||||
constructor(imperium: Imperium, roleName: string)
|
||||
|
||||
// Imperium instance to retreive child role
|
||||
imperium: Imperium;
|
||||
// Role name
|
||||
roleName: string;
|
||||
// Contain all the actions for this specific role
|
||||
role: RoleActions;
|
||||
|
||||
/* Add action with specific params */
|
||||
can(action: string, params: RoleParams): Role;
|
||||
|
||||
/* Get actions of childRoleName and replace params */
|
||||
is(childRoleName: string, params: RoleParams): Role;
|
||||
}
|
||||
|
||||
export class UnauthorizedError extends Error {
|
||||
constructor(message: string, status: number, context: any)
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6",
|
||||
"dom"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"esModuleInterop": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"imperium-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"extends": "dtslint/dt.json"
|
||||
}
|
||||
Vendored
+2
-2
@@ -1,4 +1,4 @@
|
||||
// Type definitions for Jest 22.2
|
||||
// Type definitions for Jest 23.0
|
||||
// Project: http://facebook.github.io/jest/
|
||||
// Definitions by: Asana <https://asana.com>
|
||||
// Ivo Stratev <https://github.com/NoHomey>
|
||||
@@ -218,7 +218,7 @@ declare namespace jest {
|
||||
* @param fn The function for your test
|
||||
* @param timeout The timeout for an async function test
|
||||
*/
|
||||
(name: string, fn?: ProvidesCallback, timeout?: number): void;
|
||||
(name: string, fn: ProvidesCallback, timeout?: number): void;
|
||||
/**
|
||||
* Only runs this test in the current file.
|
||||
*/
|
||||
|
||||
Vendored
+105
@@ -0,0 +1,105 @@
|
||||
// Type definitions for jquery.nicescroll 3.7
|
||||
// Project: https://nicescroll.areaaperta.com
|
||||
// Definitions by: Bohdan Stupak <https://github.com/Wkalmar>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.3
|
||||
|
||||
/// <reference types="jquery"/>
|
||||
|
||||
declare namespace JQueryNiceScroll {
|
||||
interface NiceScrollPage {
|
||||
maxw: number;
|
||||
maxh: number;
|
||||
width: number;
|
||||
height: number;
|
||||
w: number;
|
||||
h: number;
|
||||
}
|
||||
|
||||
interface NiceScroll {
|
||||
show(): NiceScroll;
|
||||
hide(): NiceScroll;
|
||||
toggle(): NiceScroll;
|
||||
onResize(e?: Event, page?: NiceScrollPage): NiceScroll;
|
||||
resize(e?: Event, page?: NiceScrollPage): NiceScroll;
|
||||
remove(): void;
|
||||
stop(): NiceScroll;
|
||||
doScrollPos(x: number, y: number, spd: number): void;
|
||||
doScrollLeft(x: number, duration: number): void;
|
||||
doScrollTop(x: number, duration: number): void;
|
||||
}
|
||||
|
||||
interface NiceScrollOptions {
|
||||
zindex?: "auto" | number;
|
||||
cursoropacitymin?: number;
|
||||
cursoropacitymax?: number;
|
||||
cursorcolor?: string;
|
||||
cursorwidth?: string;
|
||||
cursorborder?: string;
|
||||
cursorborderradius?: string;
|
||||
scrollspeed?: number;
|
||||
mousescrollstep?: number;
|
||||
touchbehavior?: boolean;
|
||||
emulatetouch?: boolean;
|
||||
hwacceleration?: boolean;
|
||||
usetransition?: boolean;
|
||||
boxzoom?: boolean;
|
||||
dblclickzoom?: boolean;
|
||||
gesturezoom?: boolean;
|
||||
grabcursorenabled?: boolean;
|
||||
autohidemode?: "leave" | "scroll" | "cursor" | "hidden" | boolean;
|
||||
background?: string;
|
||||
iframeautoresize?: boolean;
|
||||
cursorminheight?: number;
|
||||
preservenativescrolling?: boolean;
|
||||
railoffset?: boolean | {
|
||||
top?: number;
|
||||
left?: number;
|
||||
};
|
||||
railhoffset?: boolean | {
|
||||
top?: number;
|
||||
left?: number;
|
||||
};
|
||||
bouncescroll?: boolean;
|
||||
spacebarenabled?: boolean;
|
||||
railpadding?: {
|
||||
top: number;
|
||||
right: number;
|
||||
left: number;
|
||||
bottom: number;
|
||||
};
|
||||
disableoutline?: boolean;
|
||||
horizrailenabled?: boolean;
|
||||
railalign?: "right" | "left" | "top" | "bottom";
|
||||
railvalign?: "right" | "left" | "top" | "bottom";
|
||||
enabletranslate3d?: boolean;
|
||||
enablemousewheel?: boolean;
|
||||
enablekeyboard?: boolean;
|
||||
smoothscroll?: boolean;
|
||||
sensitiverail?: boolean;
|
||||
enablemouselockapi?: boolean;
|
||||
cursorfixedheight?: number;
|
||||
directionlockdeadzone?: number;
|
||||
hidecursordelay?: number;
|
||||
nativeparentscrolling?: boolean;
|
||||
enablescrollonselection?: boolean;
|
||||
overflowx?: "auto" | "hidden" | "inherit" | "initial" | "overlay" | "scroll" | "unset" | "visible";
|
||||
overflowy?: "auto" | "hidden" | "inherit" | "initial" | "overlay" | "scroll" | "unset" | "visible";
|
||||
cursordragspeed?: number;
|
||||
rtlmode?: "auto" | boolean;
|
||||
cursordragontouch?: boolean;
|
||||
oneaxismousemode?: "auto" | boolean;
|
||||
scriptpath?: string;
|
||||
preventmultitouchscrolling?: boolean;
|
||||
disablemutationobserver?: boolean;
|
||||
enableobserver?: boolean;
|
||||
scrollbarid?: string;
|
||||
scrollCLass?: string;
|
||||
}
|
||||
}
|
||||
|
||||
interface JQuery {
|
||||
niceScroll(options?: JQueryNiceScroll.NiceScrollOptions): JQueryNiceScroll.NiceScroll;
|
||||
niceScroll(wrapper: string, options: JQueryNiceScroll.NiceScrollOptions): JQueryNiceScroll.NiceScroll;
|
||||
getNiceScroll(index?: number): JQueryNiceScroll.NiceScroll;
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
// cases from documentation
|
||||
// 1. Simple mode, it styles document scrollbar:
|
||||
$(() => {
|
||||
$("body").niceScroll();
|
||||
});
|
||||
|
||||
// 2. Instance with object returned:
|
||||
let nice;
|
||||
$(() => {
|
||||
nice = $("body").niceScroll();
|
||||
});
|
||||
|
||||
// 3. Style a DIV and change cursor color:
|
||||
$(() => {
|
||||
$("#thisdiv").niceScroll({cursorcolor: "#00F"});
|
||||
});
|
||||
|
||||
// 4. DIV with "wrapper", formed by two divs, the first is the vieport, the latter is the content:
|
||||
$(() => {
|
||||
$("#viewportdiv").niceScroll("#wrapperdiv", {cursorcolor: "#00F"});
|
||||
});
|
||||
|
||||
// 5. Get nicescroll object:
|
||||
nice = $("#mydiv").getNiceScroll();
|
||||
|
||||
// 6. Hide scrollbars:
|
||||
$("#mydiv").getNiceScroll().hide();
|
||||
|
||||
// 7. Check for scrollbars resize (when content or position have changed):
|
||||
$("#mydiv").getNiceScroll().resize();
|
||||
|
||||
// 8. Scrolling to a position:
|
||||
$("#mydiv").getNiceScroll(0).doScrollLeft(1, 2); // Scroll X Axis
|
||||
$("#mydiv").getNiceScroll(0).doScrollTop(1, 14); // Scroll Y Axis
|
||||
|
||||
// other cases
|
||||
$(".ui-grid-viewport").niceScroll({
|
||||
cursorcolor: "#fff",
|
||||
cursorwidth: "8px",
|
||||
autohidemode: "leave"
|
||||
});
|
||||
@@ -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",
|
||||
"jquery.nicescroll-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"extends": "dtslint/dt.json"
|
||||
}
|
||||
Vendored
+2
-2
@@ -1855,7 +1855,7 @@ declare namespace kendo.ui {
|
||||
dates?: any;
|
||||
depth?: string;
|
||||
disableDates?: any|Function;
|
||||
footer?: string|Function;
|
||||
footer?: false | string | Function;
|
||||
format?: string;
|
||||
max?: Date;
|
||||
messages?: CalendarMessages;
|
||||
@@ -4293,7 +4293,7 @@ declare namespace kendo.ui {
|
||||
columnMenu?: boolean | GridColumnMenu;
|
||||
dataSource?: any|any|kendo.data.DataSource;
|
||||
detailTemplate?: string|Function;
|
||||
editable?: boolean | GridEditable;
|
||||
editable?: boolean | "inline" | "incell" | "popup" | GridEditable;
|
||||
excel?: GridExcel;
|
||||
filterable?: boolean | GridFilterable;
|
||||
groupable?: boolean | GridGroupable;
|
||||
|
||||
Vendored
+13
-8
@@ -1,30 +1,35 @@
|
||||
// Type definitions for koa-webpack 1.0
|
||||
// Type definitions for koa-webpack 5.x
|
||||
// Project: https://github.com/shellscape/koa-webpack#readme
|
||||
// Definitions by: Luka Maljic <https://github.com/malj>
|
||||
// Lee Benson <https://github.com/leebenson>
|
||||
// miZyind <https://github.com/miZyind>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.3
|
||||
|
||||
import Koa = require('koa');
|
||||
import webpack = require('webpack');
|
||||
import webpackDevMiddleware = require('webpack-dev-middleware');
|
||||
import webpackHotMiddleware = require('webpack-hot-middleware');
|
||||
import connect = require('connect');
|
||||
import webpackHotClient = require('webpack-hot-client');
|
||||
|
||||
declare function koaWebpack(
|
||||
options?: koaWebpack.Options
|
||||
): Koa.Middleware & koaWebpack.CombinedWebpackMiddleware;
|
||||
): Promise<Koa.Middleware & koaWebpack.CombinedWebpackMiddleware>;
|
||||
|
||||
declare namespace koaWebpack {
|
||||
interface Options {
|
||||
compiler?: webpack.Compiler;
|
||||
config?: webpack.Configuration;
|
||||
dev?: webpackDevMiddleware.Options;
|
||||
hot?: webpackHotMiddleware.Options | boolean;
|
||||
devMiddleware?: webpackDevMiddleware.Options;
|
||||
hotClient?: webpackHotClient.Options | boolean;
|
||||
}
|
||||
|
||||
interface CombinedWebpackMiddleware {
|
||||
dev: connect.NextHandleFunction & webpackDevMiddleware.WebpackDevMiddleware;
|
||||
hot: connect.NextHandleFunction & webpackHotMiddleware.EventStream;
|
||||
devMiddleware: webpackDevMiddleware.WebpackDevMiddleware;
|
||||
hotClient: {
|
||||
close: () => void;
|
||||
options: webpackHotClient.Options;
|
||||
server: any;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -7,39 +7,50 @@ const config: webpack.Configuration = {};
|
||||
const compiler = webpack(config);
|
||||
|
||||
// Using the middleware
|
||||
|
||||
const middleware = koaWebpack({
|
||||
koaWebpack({
|
||||
compiler,
|
||||
config,
|
||||
dev: {
|
||||
lazy: true,
|
||||
watchOptions: {
|
||||
aggregateTimeout: 300,
|
||||
poll: true,
|
||||
},
|
||||
publicPath: '/assets/',
|
||||
// Reference: https://github.com/webpack/webpack-dev-middleware#options
|
||||
devMiddleware: {
|
||||
headers: { 'X-Custom-Header': 'yes' },
|
||||
index: 'index.html',
|
||||
headers: {
|
||||
'X-Custom-Header': 'yes'
|
||||
},
|
||||
stats: {
|
||||
colors: true,
|
||||
},
|
||||
lazy: false,
|
||||
logger: undefined,
|
||||
logLevel: 'info',
|
||||
// logTime: false,
|
||||
// mimeTypes: null,
|
||||
publicPath: '/assets/',
|
||||
reporter: null,
|
||||
serverSideRender: false
|
||||
serverSideRender: false,
|
||||
stats: { context: process.cwd() },
|
||||
watchOptions: { aggregateTimeout: 200 },
|
||||
// writeToDisk: false
|
||||
},
|
||||
hot: {
|
||||
log: console.log.bind(console),
|
||||
path: '/__what',
|
||||
heartbeat: 2000
|
||||
// Reference: https://github.com/webpack-contrib/webpack-hot-client#api
|
||||
hotClient: {
|
||||
allEntries: false,
|
||||
autoConfigure: true,
|
||||
host: 'localhost',
|
||||
hmr: true,
|
||||
https: false,
|
||||
logLevel: 'info',
|
||||
logTime: false,
|
||||
port: 0,
|
||||
reload: true,
|
||||
server: undefined,
|
||||
stats: { context: process.cwd() }
|
||||
}
|
||||
});
|
||||
})
|
||||
.then((middleware) => {
|
||||
app.use(middleware);
|
||||
|
||||
app.use(middleware);
|
||||
|
||||
// Accessing the underlying middleware
|
||||
|
||||
middleware.dev.close();
|
||||
middleware.dev.invalidate();
|
||||
middleware.dev.waitUntilValid();
|
||||
middleware.hot.publish(null);
|
||||
// Accessing the underlying middleware
|
||||
middleware.devMiddleware.close();
|
||||
middleware.devMiddleware.invalidate();
|
||||
middleware.devMiddleware.waitUntilValid();
|
||||
middleware.devMiddleware.getFilenameFromUrl('/public/index.html');
|
||||
middleware.devMiddleware.fileSystem;
|
||||
middleware.hotClient.close();
|
||||
middleware.hotClient.options;
|
||||
middleware.hotClient.server;
|
||||
});
|
||||
|
||||
Vendored
+2
-2
@@ -1,16 +1,16 @@
|
||||
// Type definitions for krakenjs 2.2
|
||||
// Project: http://krakenjs.com
|
||||
// Definitions by: Timur Manyanov <https://github.com/darkwebdev>
|
||||
// Satana Charuwichitratana <https://github.com/micksatana>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.2
|
||||
|
||||
import { Express } from 'express';
|
||||
import { EventEmitter } from 'events';
|
||||
|
||||
declare function k(options?: k.Options | string): Express;
|
||||
|
||||
declare namespace k {
|
||||
interface Kraken extends Express, EventEmitter {
|
||||
interface Kraken extends Express {
|
||||
kraken: Kraken;
|
||||
}
|
||||
|
||||
|
||||
Vendored
+11
@@ -1030,6 +1030,17 @@ declare namespace MathJax {
|
||||
* they were MathML, you might need to set this to true.
|
||||
*/
|
||||
addMMLclasses?: boolean;
|
||||
/*This controls whether the SVG output uses <use> elements to re-use font paths rather than repeat paths every
|
||||
* time. If useGlobalCache (see below) is set to false, this will still reduce duplication of paths while keeping
|
||||
* each SVG self-contained.
|
||||
*/
|
||||
useFontCache?: boolean;
|
||||
/*When set to true the SVG Output stores paths (corresponding to “fonts” in the SVG output) in a global SVG
|
||||
* object using <defs> elements so that it can re-use them in all equations via <use> elements (much like a font
|
||||
* file allows re-use of characters across the document). While set to true by default, it will have no effect if
|
||||
* useFontCache is set to false.
|
||||
*/
|
||||
useGlobalCache?: boolean;
|
||||
/*EqnChunk is the number of equations that will be typeset before they appear on screen. Larger values make for
|
||||
* less visual flicker as the equations are drawn, but also mean longer delays before the reader sees anything.
|
||||
*/
|
||||
|
||||
@@ -57,4 +57,11 @@ MathJax.Hub.Config({
|
||||
"HTML-CSS": { linebreaks: { automatic: true } },
|
||||
CommonHTML: { linebreaks: { automatic: true } },
|
||||
SVG: { linebreaks: { automatic: true } }
|
||||
});
|
||||
});
|
||||
|
||||
MathJax.Hub.Config({
|
||||
SVG: {
|
||||
useFontCache: true,
|
||||
useGlobalCache: true
|
||||
}
|
||||
})
|
||||
|
||||
Vendored
+26
@@ -0,0 +1,26 @@
|
||||
// Type definitions for newman 3.9
|
||||
// Project: https://github.com/postmanlabs/newman
|
||||
// Definitions by: Leonid Logvinov <https://github.com/LogvinovLeon>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
export interface NewmanRunSummary {
|
||||
run: NewmanRun;
|
||||
}
|
||||
export interface NewmanRun {
|
||||
executions: NewmanRunExecution[];
|
||||
}
|
||||
export interface NewmanRunExecution {
|
||||
item: NewmanRunExecutionItem;
|
||||
assertions: NewmanRunExecutionAssertion[];
|
||||
}
|
||||
export interface NewmanRunExecutionItem {
|
||||
name: string;
|
||||
}
|
||||
export interface NewmanRunExecutionAssertion {
|
||||
assertion: string;
|
||||
error: NewmanRunExecutionAssertionError;
|
||||
}
|
||||
export interface NewmanRunExecutionAssertionError {
|
||||
message: string;
|
||||
}
|
||||
export function run(options: any, callback?: (err: Error | null, summary: NewmanRunSummary) => void): void;
|
||||
@@ -0,0 +1,11 @@
|
||||
import {
|
||||
run,
|
||||
NewmanRun,
|
||||
NewmanRunExecution,
|
||||
NewmanRunExecutionAssertion,
|
||||
NewmanRunExecutionAssertionError,
|
||||
NewmanRunExecutionItem,
|
||||
NewmanRunSummary,
|
||||
} from 'newman';
|
||||
|
||||
run({});
|
||||
@@ -0,0 +1,16 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": ["es6"],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictFunctionTypes": true,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": ["../"],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": ["index.d.ts", "newman-tests.ts"]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
+29
-3
@@ -1,16 +1,17 @@
|
||||
// Type definitions for node-telegram-bot-api 0.28
|
||||
// Type definitions for node-telegram-bot-api 0.30
|
||||
// Project: https://github.com/yagop/node-telegram-bot-api
|
||||
// Definitions by: Alex Muench <https://github.com/ammuench>
|
||||
// Agadar <https://github.com/agadar>
|
||||
// Giorgio Garasto <https://github.com/Dabolus>
|
||||
// Kallu609 <https://github.com/Kallu609>
|
||||
// XC-Zhang <https://github.com/XC-Zhang>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.3
|
||||
|
||||
/// <reference types="node" />
|
||||
|
||||
import { EventEmitter } from 'events';
|
||||
import { Stream } from 'stream';
|
||||
import { Stream, Readable } from 'stream';
|
||||
import { ServerOptions } from 'https';
|
||||
import { Options } from 'request';
|
||||
|
||||
@@ -58,6 +59,11 @@ declare namespace TelegramBot {
|
||||
restart?: boolean;
|
||||
}
|
||||
|
||||
interface StopPollingOptions {
|
||||
cancel?: boolean;
|
||||
reason?: string;
|
||||
}
|
||||
|
||||
interface SetWebHookOptions {
|
||||
url?: string;
|
||||
certificate?: string | Stream;
|
||||
@@ -136,6 +142,10 @@ declare namespace TelegramBot {
|
||||
|
||||
type SendLocationOptions = SendBasicOptions;
|
||||
|
||||
type EditMessageLiveLocationOptions = EditMessageCaptionOptions;
|
||||
|
||||
type StopMessageLiveLocationOptions = EditMessageCaptionOptions;
|
||||
|
||||
interface SendVenueOptions extends SendBasicOptions {
|
||||
foursquare_id?: string;
|
||||
}
|
||||
@@ -147,6 +157,7 @@ declare namespace TelegramBot {
|
||||
type SendGameOptions = SendBasicOptions;
|
||||
|
||||
interface SendInvoiceOptions extends SendBasicOptions {
|
||||
provider_data?: string;
|
||||
photo_url?: string;
|
||||
photo_size?: number;
|
||||
photo_width?: number;
|
||||
@@ -818,7 +829,7 @@ declare class TelegramBot extends EventEmitter {
|
||||
|
||||
startPolling(options?: TelegramBot.StartPollingOptions): Promise<any>;
|
||||
|
||||
stopPolling(): Promise<any>;
|
||||
stopPolling(options?: TelegramBot.StopPollingOptions): Promise<any>;
|
||||
|
||||
isPolling(): boolean;
|
||||
|
||||
@@ -886,6 +897,11 @@ declare class TelegramBot extends EventEmitter {
|
||||
|
||||
unpinChatMessage(chatId: number | string): Promise<boolean | Error>;
|
||||
|
||||
answerCallbackQuery(callbackQueryId: string, options?: Partial<TelegramBot.AnswerCallbackQueryOptions>): Promise<boolean | Error>;
|
||||
|
||||
/**
|
||||
* @deprecated since version 0.30.0
|
||||
*/
|
||||
answerCallbackQuery(options?: TelegramBot.AnswerCallbackQueryOptions): Promise<boolean | Error>;
|
||||
|
||||
editMessageText(text: string, options?: TelegramBot.EditMessageTextOptions): Promise<TelegramBot.Message | boolean | Error>;
|
||||
@@ -898,6 +914,10 @@ declare class TelegramBot extends EventEmitter {
|
||||
|
||||
sendLocation(chatId: number | string, latitude: number, longitude: number, options?: TelegramBot.SendLocationOptions): Promise<TelegramBot.Message | Error>;
|
||||
|
||||
editMessageLiveLocation(latitude: number, longitude: number, options?: TelegramBot.EditMessageLiveLocationOptions): Promise<TelegramBot.Message | boolean | Error>;
|
||||
|
||||
stopMessageLiveLocation(options?: TelegramBot.StopMessageLiveLocationOptions): Promise<TelegramBot.Message | boolean | Error>;
|
||||
|
||||
sendVenue(chatId: number | string, latitude: number, longitude: number, title: string, address: string, options?: TelegramBot.SendVenueOptions): Promise<TelegramBot.Message | Error>;
|
||||
|
||||
sendContact(chatId: number | string, phoneNumber: string, firstName: string, options?: TelegramBot.SendContactOptions): Promise<TelegramBot.Message | Error>;
|
||||
@@ -906,6 +926,8 @@ declare class TelegramBot extends EventEmitter {
|
||||
|
||||
getFileLink(fileId: string): Promise<string | Error>;
|
||||
|
||||
getFileStream(fileId: string): Readable;
|
||||
|
||||
downloadFile(fileId: string, downloadDir: string): Promise<string | Error>;
|
||||
|
||||
onText(regexp: RegExp, callback: ((msg: TelegramBot.Message, match: RegExpExecArray | null) => void)): void;
|
||||
@@ -926,6 +948,10 @@ declare class TelegramBot extends EventEmitter {
|
||||
|
||||
leaveChat(chatId: number | string): Promise<boolean | Error>;
|
||||
|
||||
setChatStickerSet(chatId: number | string, stickerSetName: string): Promise<boolean | Error>;
|
||||
|
||||
deleteChatStickerSet(chatId: number | string): Promise<boolean | Error>;
|
||||
|
||||
sendGame(chatId: number | string, gameShortName: string, options?: TelegramBot.SendGameOptions): Promise<TelegramBot.Message | Error>;
|
||||
|
||||
setGameScore(userId: string, score: number, options?: TelegramBot.SetGameScoreOptions): Promise<TelegramBot.Message | boolean | Error>;
|
||||
|
||||
@@ -44,6 +44,7 @@ MyTelegramBot.setChatTitle(1234, 'Chat Title');
|
||||
MyTelegramBot.setChatDescription(1234, 'Chat Description');
|
||||
MyTelegramBot.pinChatMessage(1234, 'Pinned Message');
|
||||
MyTelegramBot.unpinChatMessage(1234);
|
||||
MyTelegramBot.answerCallbackQuery('432832');
|
||||
MyTelegramBot.answerCallbackQuery({ callback_query_id: '432832' });
|
||||
MyTelegramBot.editMessageText('test-text', { disable_web_page_preview: true });
|
||||
MyTelegramBot.editMessageCaption('My Witty Caption', { message_id: 1245 });
|
||||
@@ -52,10 +53,13 @@ MyTelegramBot.editMessageReplyMarkup({ inline_keyboard: [[{
|
||||
}]] }, { message_id: 1244 });
|
||||
MyTelegramBot.getUserProfilePhotos('myUserID', { limit: 10 });
|
||||
MyTelegramBot.sendLocation(1234, 100, 200, { reply_to_message_id: 1234 });
|
||||
MyTelegramBot.editMessageLiveLocation(100, 200, { message_id: 1245 });
|
||||
MyTelegramBot.stopMessageLiveLocation({ message_id: 1245 });
|
||||
MyTelegramBot.sendVenue(1234, 100, 200, 'Venue Title', '123 Fake St.', { reply_to_message_id: 1234 });
|
||||
MyTelegramBot.sendContact(1234, '345-555-0192', 'John', { last_name: 'Smith' });
|
||||
MyTelegramBot.getFile('My/File/ID');
|
||||
MyTelegramBot.getFileLink('My/File/ID');
|
||||
MyTelegramBot.getFileStream('My/File/ID');
|
||||
MyTelegramBot.downloadFile('My/File/ID', 'mydownloaddir/');
|
||||
MyTelegramBot.onText(/regex/, (msg, match) => { });
|
||||
MyTelegramBot.removeTextListener(/regex/);
|
||||
@@ -66,6 +70,8 @@ MyTelegramBot.getChatAdministrators(1234);
|
||||
MyTelegramBot.getChatMembersCount(1234);
|
||||
MyTelegramBot.getChatMember(1234, 'myUserID');
|
||||
MyTelegramBot.leaveChat(1234);
|
||||
MyTelegramBot.setChatStickerSet(1234, 'sticker');
|
||||
MyTelegramBot.deleteChatStickerSet(1234);
|
||||
MyTelegramBot.sendGame(1234, 'MygameName', { reply_to_message_id: 1234 });
|
||||
MyTelegramBot.setGameScore('myUserID', 99, { message_id: 1234 });
|
||||
MyTelegramBot.getGameHighScores('myUserID', { message_id: 1234 });
|
||||
|
||||
Vendored
+2
@@ -2178,6 +2178,7 @@ declare module "child_process" {
|
||||
}
|
||||
|
||||
export interface SpawnOptions {
|
||||
argv0?: string;
|
||||
cwd?: string;
|
||||
env?: any;
|
||||
stdio?: any;
|
||||
@@ -2320,6 +2321,7 @@ declare module "child_process" {
|
||||
export function fork(modulePath: string, args?: ReadonlyArray<string>, options?: ForkOptions): ChildProcess;
|
||||
|
||||
export interface SpawnSyncOptions {
|
||||
argv0?: string;
|
||||
cwd?: string;
|
||||
input?: string | Buffer;
|
||||
stdio?: any;
|
||||
|
||||
@@ -2097,8 +2097,10 @@ namespace child_process_tests {
|
||||
childProcess.exec("echo test");
|
||||
childProcess.exec("echo test", { windowsHide: true });
|
||||
childProcess.spawn("echo", ["test"], { windowsHide: true });
|
||||
childProcess.spawn("echo", ["test"], { windowsHide: true, argv0: "echo-test" });
|
||||
childProcess.spawnSync("echo test");
|
||||
childProcess.spawnSync("echo test", {windowsVerbatimArguments: false});
|
||||
childProcess.spawnSync("echo test", {windowsVerbatimArguments: false, argv0: "echo-test"});
|
||||
}
|
||||
|
||||
{
|
||||
|
||||
Vendored
+4
@@ -1698,6 +1698,8 @@ id(value: number|string): this;
|
||||
valueFormat(): string;
|
||||
/*D3 Format object for the label of pie/donut, discrete bar and multibar charts.*/
|
||||
valueFormat(value: string): this;
|
||||
/*D3 Format object for the label of pie/donut, discrete bar and multibar charts.*/
|
||||
valueFormat(format: (d: any) => string): this;
|
||||
/* The width the graph or component created inside the SVG should be made*/
|
||||
width(): number;
|
||||
/*The width the graph or component created inside the SVG should be made.*/
|
||||
@@ -2649,6 +2651,8 @@ id(value: number|string): this;
|
||||
valueFormat(): string;
|
||||
/*D3 Format object for the label of pie/donut, discrete bar and multibar charts.*/
|
||||
valueFormat(value: string): this;
|
||||
/*D3 Format object for the label of pie/donut, discrete bar and multibar charts.*/
|
||||
valueFormat(format: (d: any) => string): this;
|
||||
/*.*/
|
||||
valuePadding(): number;
|
||||
/**/
|
||||
|
||||
@@ -48,6 +48,7 @@ namespace nvd3_test_discreteBarChart {
|
||||
//.staggerLabels(historicalBarChart[0].values.length > 8)
|
||||
.showValues(true)
|
||||
.duration(250)
|
||||
.valueFormat(d3.format("d"))
|
||||
;
|
||||
|
||||
d3.select('#chart1 svg')
|
||||
|
||||
@@ -136,6 +136,7 @@ namespace nvd3_test_multibarHorizontalChart {
|
||||
.barColor(d3.scale.category20().range())
|
||||
.duration(250)
|
||||
.margin({ left: 100 })
|
||||
.valueFormat(d3.format("d"))
|
||||
.stacked(true);
|
||||
|
||||
chart.yAxis.tickFormat(d3.format(',.2f'));
|
||||
|
||||
Vendored
+250
-256
@@ -402,67 +402,104 @@ declare namespace Office {
|
||||
value: any;
|
||||
}
|
||||
/**
|
||||
* Represents the runtime environment of the add-in and provides access to key objects of the API.
|
||||
*
|
||||
* @remarks
|
||||
* Hosts: Access, Excel, Outlook, PowerPoint, Project, Word
|
||||
*/
|
||||
* Represents the runtime environment of the add-in and provides access to key objects of the API.
|
||||
*
|
||||
* @remarks
|
||||
* Hosts: Access, Excel, Outlook, PowerPoint, Project, Word
|
||||
*/
|
||||
interface Context {
|
||||
/**
|
||||
* Provides information and access to the signed-in user.
|
||||
*/
|
||||
auth: Auth;
|
||||
/**
|
||||
* True, if the current platform allows the add-in to display a UI for selling or upgrading; otherwise returns False.
|
||||
*
|
||||
* @remarks
|
||||
* The iOS App Store doesn't support apps with add-ins that provide links to additional payment systems. However, Office Add-ins running on the Windows desktop or for Office Online in the browser, do allow such links. If you want the UI of your add-in to provide a link to an external payment system on platforms other than iOS, you can use the commerceAllowed property to control when that link is displayed.
|
||||
*/
|
||||
commerceAllowed: boolean;
|
||||
/**
|
||||
* Gets the locale (language) specified by the user for editing the document or item.
|
||||
*/
|
||||
contentLanguage: string;
|
||||
/**
|
||||
* Gets information about the environment in which the add-in is running.
|
||||
*/
|
||||
diagnostics: ContextInformation;
|
||||
/**
|
||||
* Gets the locale (language) specified by the user for the UI of the Office host application.
|
||||
* @remarks
|
||||
* When using in Outlook,the applicable modes are Compose or read.
|
||||
*/
|
||||
displayLanguage: string;
|
||||
/**
|
||||
*
|
||||
* Gets an object that represents the document the content or task pane add-in is interacting with.
|
||||
*/
|
||||
document: Document;
|
||||
/**
|
||||
* Contains the Office application host in which the add-in is running.
|
||||
*/
|
||||
host: HostType;
|
||||
/**
|
||||
* Gets the license information for the user's Office installation.
|
||||
*/
|
||||
license: string;
|
||||
/**
|
||||
* Provides access to the Outlook Add-in object model for Microsoft Outlook and Microsoft Outlook on the web.
|
||||
*
|
||||
* Namespaces:
|
||||
*
|
||||
* - diagnostics: Provides diagnostic information to an Outlook add-in.
|
||||
*
|
||||
* - item: Provides methods and properties for accessing a message or appointment in an Outlook add-in.
|
||||
*
|
||||
* - userProfile: Provides information about the user in an Outlook add-in.
|
||||
*
|
||||
* [Api set: Mailbox 1.0]
|
||||
*
|
||||
* @remarks
|
||||
* Minimum permission level: Restricted
|
||||
*
|
||||
* Applicable Outlook mode: Compose or read
|
||||
*/
|
||||
mailbox: Mailbox;
|
||||
/**
|
||||
* Provides access to the properties for Office theme colors.
|
||||
*/
|
||||
officeTheme: OfficeTheme;
|
||||
/**
|
||||
* Provides access to the properties for Office theme colors.
|
||||
* Provides the platform on which the add-in is running.
|
||||
*/
|
||||
platform: PlatformType;
|
||||
/**
|
||||
* Provides a method for determining what requirement sets are supported on the current host and platform.
|
||||
*/
|
||||
requirements: RequirementSetSupport;
|
||||
/**
|
||||
* Gets an object that represents the custom settings or state of a mail add-in saved to a user's mailbox.
|
||||
*
|
||||
* The RoamingSettings object lets you store and access data for a mail add-in that is stored in a user's mailbox, so that is available to that add-in when it is running from any host client application used to access that mailbox.
|
||||
*
|
||||
* [Api set: Mailbox 1.0]
|
||||
*
|
||||
* @remarks
|
||||
* Minimum permission level: Restricted
|
||||
*
|
||||
* Applicable Outlook mode: Compose or read
|
||||
*/
|
||||
roamingSettings: RoamingSettings;
|
||||
/**
|
||||
* Specifies whether the platform and device allows touch interaction.
|
||||
*
|
||||
* @remarks
|
||||
* Use the touchEnabled property to determine when your add-in is running on a touch device and if necessary, adjust the kind of controls, and size and spacing of elements in your add-in's UI to accommodate touch interactions.
|
||||
*/
|
||||
touchEnabled: boolean;
|
||||
/**
|
||||
* Provides objects and methods that you can use to create and manipulate UI components, such as dialog boxes.
|
||||
*/
|
||||
ui: UI;
|
||||
/**
|
||||
* Contains the host in which the add-in (web application) is running in. Possible values are: Word, Excel, PowerPoint
|
||||
*/
|
||||
host: HostType;
|
||||
/**
|
||||
* Provides the platform on which the add-in is running. Possible values are: PC, OfficeOnline, Mac, iOS, Android, Universal
|
||||
*/
|
||||
platform: PlatformType;
|
||||
/**
|
||||
*
|
||||
*/
|
||||
diagnostics: {
|
||||
host: HostType;
|
||||
platform: PlatformType;
|
||||
version: string;
|
||||
};
|
||||
/**
|
||||
* Provides a method for determining what requirement sets are supported on the current host and platform.
|
||||
*/
|
||||
requirements: {
|
||||
/**
|
||||
* Check if the specified requirement set is supported by the host Office application.
|
||||
* @param name - Set name; e.g., "MatrixBindings".
|
||||
* @param minVersion - The minimum required version; e.g., "1.4".
|
||||
*/
|
||||
isSetSupported(name: string, minVersion?: number): boolean;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Provides specific information about an error that occurred during an asynchronous data operation.
|
||||
@@ -587,6 +624,17 @@ declare namespace Office {
|
||||
*/
|
||||
closeContainer(): void;
|
||||
}
|
||||
/**
|
||||
* Provides information about what Requirement Sets are supported in current environment.
|
||||
*/
|
||||
interface RequirementSetSupport {
|
||||
/**
|
||||
* Check if the specified requirement set is supported by the host Office application.
|
||||
* @param name - Set name; e.g., "MatrixBindings".
|
||||
* @param minVersion - The minimum required version; e.g., "1.4".
|
||||
*/
|
||||
isSetSupported(name: string, minVersion?: number): boolean;
|
||||
}
|
||||
/**
|
||||
* Provides options for how a dialog is displayed.
|
||||
*/
|
||||
@@ -650,7 +698,7 @@ declare namespace Office {
|
||||
asyncContext?: any
|
||||
}
|
||||
/**
|
||||
* Provides an option for preserving, unchanged, context data of any type, for use in a callback, that might be changed by an asynchronous method.
|
||||
* Provides an option for preserving context data of any type, unchanged, for use in a callback.
|
||||
*/
|
||||
interface AsyncContextOptions {
|
||||
/**
|
||||
@@ -658,6 +706,23 @@ declare namespace Office {
|
||||
*/
|
||||
asyncContext?: any
|
||||
}
|
||||
/**
|
||||
* Provides information about the environment in which the add-in is running.
|
||||
*/
|
||||
interface ContextInformation {
|
||||
/**
|
||||
* Gets the Office application host in which the add-in is running.
|
||||
*/
|
||||
host: Office.HostType;
|
||||
/**
|
||||
* Gets the platform on which the add-in is running.
|
||||
*/
|
||||
platform: Office.PlatformType;
|
||||
/**
|
||||
* Gets the version of Office on which the add-in is running.
|
||||
*/
|
||||
version: string;
|
||||
}
|
||||
/**
|
||||
* Provides options for how to get the data in a binding.
|
||||
*
|
||||
@@ -757,7 +822,7 @@ declare namespace Office {
|
||||
format: object
|
||||
}
|
||||
/**
|
||||
* Specifies a cell, or row, or column, by its zero-based row and/or column number. Example: {row: 4, column: 3} specifies the cell in the 3rd (zero-based) row in the 4th (zero-based) column.
|
||||
* Specifies a cell, or row, or column, by its zero-based row and/or column number. Example: {row: 3, column: 4} specifies the cell in the 3rd (zero-based) row in the 4th (zero-based) column.
|
||||
*/
|
||||
interface RangeCoordinates {
|
||||
/**
|
||||
@@ -790,10 +855,6 @@ declare namespace Office {
|
||||
* The unique ID of the binding. Autogenerated if not supplied.
|
||||
*/
|
||||
id?: string
|
||||
/**
|
||||
* The names of the columns involved in the binding.
|
||||
*/
|
||||
columns?: Array<string>
|
||||
/**
|
||||
* A user-defined item of any type that is returned, unchanged, in the value property of the AsyncResult object that is passed to a callback.
|
||||
*/
|
||||
@@ -814,7 +875,7 @@ declare namespace Office {
|
||||
/**
|
||||
* Specifies a table of sample data displayed in the prompt UI as an example of the kinds of fields (columns) that can be bound by your add-in. The headers provided in the TableData object specify the labels used in the field selection UI. Note: This parameter is used only in add-ins for Access. It is ignored if provided when calling the method in an add-in for Excel.
|
||||
*/
|
||||
sampleData?: TableData
|
||||
sampleData?: Office.TableData
|
||||
/**
|
||||
* A user-defined item of any type that is returned, unchanged, in the value property of the AsyncResult object that is passed to a callback.
|
||||
*/
|
||||
@@ -982,7 +1043,6 @@ declare namespace Office {
|
||||
* - DialogEventReceived. Triggered when the dialog box has been closed or otherwise unloaded.
|
||||
*/
|
||||
addEventHandler(eventType: Office.EventType, handler: Function): void;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1095,6 +1155,44 @@ declare namespace Office {
|
||||
*/
|
||||
ReadWrite
|
||||
}
|
||||
/**
|
||||
* Specifies the type of the XML node.
|
||||
*
|
||||
* @remarks
|
||||
* Hosts: Word
|
||||
*
|
||||
* Available in Requirement set: CustomXmlParts
|
||||
*/
|
||||
enum CustomXMLNodeType {
|
||||
/**
|
||||
* The node is an attribute.
|
||||
*/
|
||||
Attribute,
|
||||
/**
|
||||
* The node is CData.
|
||||
*/
|
||||
CData,
|
||||
/**
|
||||
* The node is a comment.
|
||||
*/
|
||||
NodeComment,
|
||||
/**
|
||||
* The node is an element.
|
||||
*/
|
||||
Element,
|
||||
/**
|
||||
* The node is a Document element.
|
||||
*/
|
||||
NodeDocument,
|
||||
/**
|
||||
* The node is a processing instruction.
|
||||
*/
|
||||
ProcessingInstruction,
|
||||
/**
|
||||
* The node is text.
|
||||
*/
|
||||
Text,
|
||||
}
|
||||
/**
|
||||
* Specifies the kind of event that was raised. Returned by the type property of an EventNameEventArgs object.
|
||||
*
|
||||
@@ -1238,12 +1336,6 @@ declare namespace Office {
|
||||
*/
|
||||
Index
|
||||
}
|
||||
enum Index {
|
||||
First,
|
||||
Last,
|
||||
Next,
|
||||
Previous
|
||||
}
|
||||
/**
|
||||
* Specifies whether to select (highlight) the location to navigate to (when using the Document.goToByIdAsync method).
|
||||
*
|
||||
@@ -1322,11 +1414,10 @@ declare namespace Office {
|
||||
*
|
||||
* @param eventType The event type. For example, for bindings, it can be **Office.EventType.BindingSelectionChanged**, **Office.EventType.BindingDataChanged**, or the corresponding text values of these enumerations.
|
||||
* @param handler The event handler function to add.
|
||||
* @param options Syntax example: {asyncContext:context}
|
||||
* asyncContext: A user-defined item of any type that is returned in the AsyncResult object without being altered.
|
||||
* @param options Provides an option for preserving context data of any type, unchanged, for use in a callback.
|
||||
* @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type AsyncResult.
|
||||
*/
|
||||
addHandlerAsync(eventType: EventType, handler: any, options?: any, callback?: (result: AsyncResult) => void): void;
|
||||
addHandlerAsync(eventType: EventType, handler: any, options?: AsyncContextOptions, callback?: (result: AsyncResult) => void): void;
|
||||
/**
|
||||
* Returns the data contained within the binding.
|
||||
*
|
||||
@@ -1338,7 +1429,6 @@ declare namespace Office {
|
||||
* When called from a MatrixBinding or TableBinding, the getDataAsync method will return a subset of the bound values if the optional startRow, startColumn, rowCount, and columnCount parameters are specified (and they specify a contiguous and valid range).
|
||||
*
|
||||
* @param options Provides options for how to get the data in a binding.
|
||||
|
||||
* @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type AsyncResult.
|
||||
*/
|
||||
getDataAsync(options?: GetBindingDataOptions, callback?: (result: AsyncResult) => void): void;
|
||||
@@ -1461,11 +1551,10 @@ declare namespace Office {
|
||||
*
|
||||
* Available in Requirement set: MatrixBindings, TableBindings, TextBindings
|
||||
*
|
||||
* @param options Syntax example: {asyncContext:context}
|
||||
* asyncContext: A user-defined item of any type that is returned in the AsyncResult object without being altered.
|
||||
* @param options Provides an option for preserving context data of any type, unchanged, for use in a callback.
|
||||
* @param callback A function that is invoked when the callback returns, whose only parameter is of type AsyncResult.
|
||||
*/
|
||||
getAllAsync(options?: any, callback?: (result: AsyncResult) => void): void;
|
||||
getAllAsync(options?: AsyncContextOptions, callback?: (result: AsyncResult) => void): void;
|
||||
/**
|
||||
* Retrieves a binding based on its Name
|
||||
*
|
||||
@@ -1477,11 +1566,10 @@ declare namespace Office {
|
||||
* Fails if the specified id does not exist.
|
||||
*
|
||||
* @param id Specifies the unique name of the binding object. Required.
|
||||
* @param options Syntax example: {asyncContext:context}
|
||||
* asyncContext: A user-defined item of any type that is returned in the AsyncResult object without being altered.
|
||||
* @param options Provides an option for preserving context data of any type, unchanged, for use in a callback.
|
||||
* @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type AsyncResult.
|
||||
*/
|
||||
getByIdAsync(id: string, options?: any, callback?: (result: AsyncResult) => void): void;
|
||||
getByIdAsync(id: string, options?: AsyncContextOptions, callback?: (result: AsyncResult) => void): void;
|
||||
/**
|
||||
* Removes the binding from the document
|
||||
*
|
||||
@@ -1493,23 +1581,10 @@ declare namespace Office {
|
||||
* Fails if the specified id does not exist.
|
||||
*
|
||||
* @param id Specifies the unique name to be used to identify the binding object. Required.
|
||||
* @param options Syntax example: {asyncContext:context}
|
||||
* asyncContext: A user-defined item of any type that is returned in the AsyncResult object without being altered.
|
||||
* @param options Provides an option for preserving context data of any type, unchanged, for use in a callback.
|
||||
* @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type AsyncResult.
|
||||
*/
|
||||
releaseByIdAsync(id: string, options?: any, callback?: (result: AsyncResult) => void): void;
|
||||
}
|
||||
/**
|
||||
* Represents the runtime environment of the add-in and provides access to key objects of the API.
|
||||
*
|
||||
* @remarks
|
||||
* Hosts: Access, Excel, Outlook, PowerPoint, Project, Word
|
||||
*/
|
||||
interface Context {
|
||||
/**
|
||||
* Gets an object that represents the document the content or task pane add-in is interacting with.
|
||||
*/
|
||||
document: Document;
|
||||
releaseByIdAsync(id: string, options?: AsyncContextOptions, callback?: (result: AsyncResult) => void): void;
|
||||
}
|
||||
/**
|
||||
* Represents an XML node in a tree in a document.
|
||||
@@ -1556,11 +1631,10 @@ declare namespace Office {
|
||||
* Available in Requirement set: CustomXmlParts
|
||||
*
|
||||
* @param xPath The XPath expression that specifies the nodes to get. Required.
|
||||
* @param options Syntax example: {asyncContext:context}
|
||||
* asyncContext: A user-defined item of any type that is returned in the AsyncResult object without being altered.
|
||||
* @param options Provides an option for preserving context data of any type, unchanged, for use in a callback.
|
||||
* @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type AsyncResult.
|
||||
*/
|
||||
getNodesAsync(xPath: string, options?: any, callback?: (result: AsyncResult) => void): void;
|
||||
getNodesAsync(xPath: string, options?: AsyncContextOptions, callback?: (result: AsyncResult) => void): void;
|
||||
/**
|
||||
* Gets the node value.
|
||||
*
|
||||
@@ -1569,11 +1643,10 @@ declare namespace Office {
|
||||
*
|
||||
* Available in Requirement set: CustomXmlParts
|
||||
*
|
||||
* @param options Syntax example: {asyncContext:context}
|
||||
* asyncContext: A user-defined item of any type that is returned in the AsyncResult object without being altered.
|
||||
* @param options Provides an option for preserving context data of any type, unchanged, for use in a callback.
|
||||
* @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type AsyncResult.
|
||||
*/
|
||||
getNodeValueAsync(options?: any, callback?: (result: AsyncResult) => void): void;
|
||||
getNodeValueAsync(options?: AsyncContextOptions, callback?: (result: AsyncResult) => void): void;
|
||||
/**
|
||||
* Gets the text of an XML node in a custom XML part.
|
||||
*
|
||||
@@ -1582,11 +1655,10 @@ declare namespace Office {
|
||||
*
|
||||
* Available in Requirement set: CustomXmlParts
|
||||
*
|
||||
* @param options Syntax example: {asyncContext:context}
|
||||
* asyncContext: A user-defined item of any type that is returned in the AsyncResult object without being altered.
|
||||
* @param options Provides an option for preserving context data of any type, unchanged, for use in a callback.
|
||||
* @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type AsyncResult.
|
||||
*/
|
||||
getTextAsync(options?: any, callback?: (result: AsyncResult) => void): void;
|
||||
getTextAsync(options?: AsyncContextOptions, callback?: (result: AsyncResult) => void): void;
|
||||
/**
|
||||
* Gets the node's XML.
|
||||
*
|
||||
@@ -1595,11 +1667,10 @@ declare namespace Office {
|
||||
*
|
||||
* Available in Requirement set: CustomXmlParts
|
||||
*
|
||||
* @param options Syntax example: {asyncContext:context}
|
||||
* asyncContext: A user-defined item of any type that is returned in the AsyncResult object without being altered.
|
||||
* @param options Provides an option for preserving context data of any type, unchanged, for use in a callback.
|
||||
* @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type AsyncResult.
|
||||
*/
|
||||
getXmlAsync(options?: any, callback?: (result: AsyncResult) => void): void;
|
||||
getXmlAsync(options?: AsyncContextOptions, callback?: (result: AsyncResult) => void): void;
|
||||
/**
|
||||
* Sets the node value.
|
||||
*
|
||||
@@ -1609,11 +1680,10 @@ declare namespace Office {
|
||||
* Available in Requirement set: CustomXmlParts
|
||||
*
|
||||
* @param value The value to be set on the node
|
||||
* @param options Syntax example: {asyncContext:context}
|
||||
* asyncContext: A user-defined item of any type that is returned in the AsyncResult object without being altered.
|
||||
* @param options Provides an option for preserving context data of any type, unchanged, for use in a callback.
|
||||
* @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type AsyncResult.
|
||||
*/
|
||||
setNodeValueAsync(value: string, options?: any, callback?: (result: AsyncResult) => void): void;
|
||||
setNodeValueAsync(value: string, options?: AsyncContextOptions, callback?: (result: AsyncResult) => void): void;
|
||||
/**
|
||||
* Asynchronously sets the text of an XML node in a custom XML part.
|
||||
*
|
||||
@@ -1623,11 +1693,10 @@ declare namespace Office {
|
||||
* Available in Requirement set: CustomXmlParts
|
||||
*
|
||||
* @param text Required. The text value of the XML node.
|
||||
* @param options Syntax example: {asyncContext:context}
|
||||
* asyncContext: A user-defined item of any type that is returned in the AsyncResult object without being altered.
|
||||
* @param options Provides an option for preserving context data of any type, unchanged, for use in a callback.
|
||||
* @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type AsyncResult.
|
||||
*/
|
||||
setTextAsync(text: string, options?: any, callback?: (result: AsyncResult) => void): void;
|
||||
setTextAsync(text: string, options?: AsyncContextOptions, callback?: (result: AsyncResult) => void): void;
|
||||
/**
|
||||
* Sets the node XML.
|
||||
*
|
||||
@@ -1637,11 +1706,10 @@ declare namespace Office {
|
||||
* Available in Requirement set: CustomXmlParts
|
||||
*
|
||||
* @param xml The XML to be set on the node
|
||||
* @param options Syntax example: {asyncContext:context}
|
||||
* asyncContext: A user-defined item of any type that is returned in the AsyncResult object without being altered.
|
||||
* @param options Provides an option for preserving context data of any type, unchanged, for use in a callback.
|
||||
* @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type AsyncResult.
|
||||
*/
|
||||
setXmlAsync(xml: string, options?: any, callback?: (result: AsyncResult) => void): void;
|
||||
setXmlAsync(xml: string, options?: AsyncContextOptions, callback?: (result: AsyncResult) => void): void;
|
||||
}
|
||||
/**
|
||||
* Represents a single CustomXMLPart in a CustomXMLParts collection.
|
||||
@@ -1689,11 +1757,10 @@ declare namespace Office {
|
||||
*
|
||||
* @param eventType Specifies the type of event to add. Required. For a CustomXmlPart object event, the eventType parameter can be specified as Office.EventType.DataNodeDeleted, Office.EventType.DataNodeInserted, Office.EventType.DataNodeReplaced, or the corresponding text values of these enumerations.
|
||||
* @param handler The event handler function to add, whose only parameter is of type NodeDeletedEventArgs, NodeInsertedEventArgs, or NodeReplaceEventArgs. Required.
|
||||
* @param options Syntax example: {asyncContext:context}
|
||||
* asyncContext: A user-defined item of any type that is returned in the AsyncResult object without being altered.
|
||||
* @param options Provides an option for preserving context data of any type, unchanged, for use in a callback..
|
||||
* @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type AsyncResult.
|
||||
*/
|
||||
addHandlerAsync(eventType: EventType, handler: (result: any) => void, options?: any, callback?: (result: AsyncResult) => void): void;
|
||||
addHandlerAsync(eventType: EventType, handler: (result: any) => void, options?: AsyncContextOptions, callback?: (result: AsyncResult) => void): void;
|
||||
/**
|
||||
* Deletes the Custom XML Part.
|
||||
*
|
||||
@@ -1702,11 +1769,10 @@ declare namespace Office {
|
||||
*
|
||||
* Available in Requirement set: CustomXmlParts
|
||||
*
|
||||
* @param options Syntax example: {asyncContext:context}
|
||||
* asyncContext: A user-defined item of any type that is returned in the AsyncResult object without being altered.
|
||||
* @param options Provides an option for preserving context data of any type, unchanged, for use in a callback.
|
||||
* @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type AsyncResult.
|
||||
*/
|
||||
deleteAsync(options?: any, callback?: (result: AsyncResult) => void): void;
|
||||
deleteAsync(options?: AsyncContextOptions, callback?: (result: AsyncResult) => void): void;
|
||||
/**
|
||||
* Asynchronously gets any CustomXmlNodes in this custom XML part which match the specified XPath.
|
||||
*
|
||||
@@ -1716,11 +1782,10 @@ declare namespace Office {
|
||||
* Available in Requirement set: CustomXmlParts
|
||||
*
|
||||
* @param xPath An XPath expression that specifies the nodes you want returned. Required.
|
||||
* @param options Syntax example: {asyncContext:context}
|
||||
* asyncContext: A user-defined item of any type that is returned in the AsyncResult object without being altered.
|
||||
* @param options Provides an option for preserving context data of any type, unchanged, for use in a callback.
|
||||
* @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type AsyncResult.
|
||||
*/
|
||||
getNodesAsync(xPath: string, options?: any, callback?: (result: AsyncResult) => void): void;
|
||||
getNodesAsync(xPath: string, options?: AsyncContextOptions, callback?: (result: AsyncResult) => void): void;
|
||||
/**
|
||||
* Asynchronously gets the XML inside this custom XML part.
|
||||
*
|
||||
@@ -1729,11 +1794,10 @@ declare namespace Office {
|
||||
*
|
||||
* Available in Requirement set: CustomXmlParts
|
||||
*
|
||||
* @param options Syntax example: {asyncContext:context}
|
||||
* asyncContext: A user-defined item of any type that is returned in the AsyncResult object without being altered.
|
||||
* @param options Provides an option for preserving context data of any type, unchanged, for use in a callback.
|
||||
* @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type AsyncResult.
|
||||
*/
|
||||
getXmlAsync(options?: any, callback?: (result: AsyncResult) => void): void;
|
||||
getXmlAsync(options?: AsyncContextOptions, callback?: (result: AsyncResult) => void): void;
|
||||
/**
|
||||
* Removes an event handler for the specified event type.
|
||||
*
|
||||
@@ -1766,11 +1830,10 @@ declare namespace Office {
|
||||
* Available in Requirement set: CustomXmlParts
|
||||
*
|
||||
* @param xml The XML to add to the newly created custom XML part.
|
||||
* @param options Syntax example: {asyncContext:context}
|
||||
* asyncContext: A user-defined item of any type that is returned in the AsyncResult object without being altered.
|
||||
* @param options Provides an option for preserving context data of any type, unchanged, for use in a callback.
|
||||
* @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type AsyncResult.
|
||||
*/
|
||||
addAsync(xml: string, options?: any, callback?: (result: AsyncResult) => void): void;
|
||||
addAsync(xml: string, options?: AsyncContextOptions, callback?: (result: AsyncResult) => void): void;
|
||||
/**
|
||||
* Asynchronously gets the specified custom XML part by its id.
|
||||
*
|
||||
@@ -1780,11 +1843,10 @@ declare namespace Office {
|
||||
* Available in Requirement set: CustomXmlParts
|
||||
*
|
||||
* @param id The GUID of the custom XML part, including opening and closing braces.
|
||||
* @param options Syntax example: {asyncContext:context}
|
||||
* asyncContext: A user-defined item of any type that is returned in the AsyncResult object without being altered.
|
||||
* @param options Provides an option for preserving context data of any type, unchanged, for use in a callback..
|
||||
* @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type AsyncResult.
|
||||
*/
|
||||
getByIdAsync(id: string, options?: any, callback?: (result: AsyncResult) => void): void;
|
||||
getByIdAsync(id: string, options?: AsyncContextOptions, callback?: (result: AsyncResult) => void): void;
|
||||
/**
|
||||
* Asynchronously gets the specified custom XML part(s) by its namespace.
|
||||
*
|
||||
@@ -1794,11 +1856,10 @@ declare namespace Office {
|
||||
* Available in Requirement set: CustomXmlParts
|
||||
*
|
||||
* @param ns The namespace URI.
|
||||
* @param options Syntax example: {asyncContext:context}
|
||||
* asyncContext: A user-defined item of any type that is returned in the AsyncResult object without being altered.
|
||||
* @param options Provides an option for preserving context data of any type, unchanged, for use in a callback.
|
||||
* @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type AsyncResult.
|
||||
*/
|
||||
getByNamespaceAsync(ns: string, options?: any, callback?: (result: AsyncResult) => void): void;
|
||||
getByNamespaceAsync(ns: string, options?: AsyncContextOptions, callback?: (result: AsyncResult) => void): void;
|
||||
}
|
||||
/**
|
||||
* Represents a collection of CustomXmlPart objects.
|
||||
@@ -1819,11 +1880,10 @@ declare namespace Office {
|
||||
*
|
||||
* @param prefix Specifies the prefix to add to the prefix mapping list. Required.
|
||||
* @param ns Specifies the namespace URI to assign to the newly added prefix. Required.
|
||||
* @param options Syntax example: {asyncContext:context}
|
||||
* asyncContext: A user-defined item of any type that is returned in the AsyncResult object without being altered.
|
||||
* @param options Provides an option for preserving context data of any type, unchanged, for use in a callback.
|
||||
* @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type AsyncResult.
|
||||
*/
|
||||
addNamespaceAsync(prefix: string, ns: string, options?: any, callback?: (result: AsyncResult) => void): void;
|
||||
addNamespaceAsync(prefix: string, ns: string, options?: AsyncContextOptions, callback?: (result: AsyncResult) => void): void;
|
||||
/**
|
||||
* Asynchronously gets the namespace mapped to the specified prefix.
|
||||
*
|
||||
@@ -1835,11 +1895,10 @@ declare namespace Office {
|
||||
* If the prefix already exists in the namespace manager, this method will overwrite the mapping of that prefix except when the prefix is one added or used by the data store internally, in which case it will return an error.
|
||||
*
|
||||
* @param prefix TSpecifies the prefix to get the namespace for. Required.
|
||||
* @param options Syntax example: {asyncContext:context}
|
||||
* asyncContext: A user-defined item of any type that is returned in the AsyncResult object without being altered.
|
||||
* @param options Provides an option for preserving context data of any type, unchanged, for use in a callback.
|
||||
* @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type AsyncResult.
|
||||
*/
|
||||
getNamespaceAsync(prefix: string, options?: any, callback?: (result: AsyncResult) => void): void;
|
||||
getNamespaceAsync(prefix: string, options?: AsyncContextOptions, callback?: (result: AsyncResult) => void): void;
|
||||
/**
|
||||
* Asynchronously gets the prefix for the specified namespace.
|
||||
*
|
||||
@@ -1851,11 +1910,10 @@ declare namespace Office {
|
||||
* If no prefix is assigned to the requested namespace, the method returns an empty string (""). If there are multiple prefixes specified in the namespace manager, the method returns the first prefix that matches the supplied namespace.
|
||||
*
|
||||
* @param ns Specifies the namespace to get the prefix for. Required.
|
||||
* @param options Syntax example: {asyncContext:context}
|
||||
* asyncContext: A user-defined item of any type that is returned in the AsyncResult object without being altered.
|
||||
* @param options Provides an option for preserving context data of any type, unchanged, for use in a callback.
|
||||
* @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type AsyncResult.
|
||||
*/
|
||||
getPrefixAsync(ns: string, options?: any, callback?: (result: AsyncResult) => void): void;
|
||||
getPrefixAsync(ns: string, options?: AsyncContextOptions, callback?: (result: AsyncResult) => void): void;
|
||||
}
|
||||
/**
|
||||
* An abstract class that represents the document the add-in is interacting with.
|
||||
@@ -1913,10 +1971,10 @@ declare namespace Office {
|
||||
*
|
||||
* @param eventType For a Document object event, the eventType parameter can be specified as Office.EventType.Document.SelectionChanged or Office.EventType.Document.ActiveViewChanged, or the corresponding text value of this enumeration.
|
||||
* @param handler The event handler function to add, whose only parameter is of type DocumentSelectionChangedEventArgs. Required.
|
||||
* @param options An object like {asyncContext:context} where `context` is a user-defined item of any type that is returned in the AsyncResult object without being altered.
|
||||
* @param options Provides an option for preserving context data of any type, unchanged, for use in a callback.
|
||||
* @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type AsyncResult.
|
||||
*/
|
||||
addHandlerAsync(eventType: EventType, handler: any, options?: any, callback?: (result: AsyncResult) => void): void;
|
||||
addHandlerAsync(eventType: EventType, handler: any, options?: AsyncContextOptions, callback?: (result: AsyncResult) => void): void;
|
||||
/**
|
||||
* Returns the state of the current view of the presentation (edit or read).
|
||||
*
|
||||
@@ -1927,10 +1985,10 @@ declare namespace Office {
|
||||
*
|
||||
* Can trigger an event when the view changes.
|
||||
*
|
||||
* @param options An object like {asyncContext:context} where `context` is a user-defined item of any type that is returned in the AsyncResult object without being altered.
|
||||
* @param options Provides an option for preserving context data of any type, unchanged, for use in a callback..
|
||||
* @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type AsyncResult.
|
||||
*/
|
||||
getActiveViewAsync(options?: any, callback?: (result: AsyncResult) => void): void;
|
||||
getActiveViewAsync(options?: AsyncContextOptions, callback?: (result: AsyncResult) => void): void;
|
||||
/**
|
||||
* Returns the entire document file in slices of up to 4194304 bytes (4 MB). For add-ins for iOS, file slice is supported up to 65536 (64 KB). Note that specifying file slice size of above permitted limit will result in an "Internal Error" failure.
|
||||
*
|
||||
@@ -1966,10 +2024,10 @@ declare namespace Office {
|
||||
*
|
||||
* You get the file's URL with the url property ( asyncResult.value.url).
|
||||
*
|
||||
* @param options An object like {asyncContext:context} where `context` is a user-defined item of any type that is returned in the AsyncResult object without being altered.
|
||||
* @param options Provides an option for preserving context data of any type, unchanged, for use in a callback.
|
||||
* @param callback A function that is invoked when the callback returns, whose only parameter is of type AsyncResult.
|
||||
*/
|
||||
getFilePropertiesAsync(options?: any, callback?: (result: AsyncResult) => void): void;
|
||||
getFilePropertiesAsync(options?: AsyncContextOptions, callback?: (result: AsyncResult) => void): void;
|
||||
/**
|
||||
* Reads the data contained in the current selection in the document.
|
||||
*
|
||||
@@ -2061,6 +2119,60 @@ declare namespace Office {
|
||||
* @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type AsyncResult.
|
||||
*/
|
||||
setSelectedDataAsync(data: string | TableData | any[][], options?: SetSelectedDataOptions, callback?: (result: AsyncResult) => void): void;
|
||||
/**
|
||||
* Project documents only. Get Project field (Ex. ProjectWebAccessURL).
|
||||
* @param fieldId Project level fields.
|
||||
* @param options Provides an option for preserving context data of any type, unchanged, for use in a callback.
|
||||
* @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type AsyncResult.
|
||||
*/
|
||||
getProjectFieldAsync(fieldId: number, options?: AsyncContextOptions, callback?: (result: AsyncResult) => void): void;
|
||||
/**
|
||||
* Project documents only. Get resource field for provided resource Id. (Ex.ResourceName)
|
||||
* @param resourceId Either a string or value of the Resource Id.
|
||||
* @param fieldId Resource Fields.
|
||||
* @param options Provides an option for preserving context data of any type, unchanged, for use in a callback.
|
||||
* @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type AsyncResult.
|
||||
*/
|
||||
getResourceFieldAsync(resourceId: string, fieldId: number, options?: AsyncContextOptions, callback?: (result: AsyncResult) => void): void;
|
||||
/**
|
||||
* Project documents only. Get the current selected Resource's Id.
|
||||
* @param options Provides an option for preserving context data of any type, unchanged, for use in a callback.
|
||||
* @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type AsyncResult.
|
||||
*/
|
||||
getSelectedResourceAsync(options?: AsyncContextOptions, callback?: (result: AsyncResult) => void): void;
|
||||
/**
|
||||
* Project documents only. Get the current selected Task's Id.
|
||||
* @param options Provides an option for preserving context data of any type, unchanged, for use in a callback.
|
||||
* @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type AsyncResult.
|
||||
*/
|
||||
getSelectedTaskAsync(options?: AsyncContextOptions, callback?: (result: AsyncResult) => void): void;
|
||||
/**
|
||||
* Project documents only. Get the current selected View Type (Ex. Gantt) and View Name.
|
||||
* @param options Provides an option for preserving context data of any type, unchanged, for use in a callback.
|
||||
* @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type AsyncResult.
|
||||
*/
|
||||
getSelectedViewAsync(options?: AsyncContextOptions, callback?: (result: AsyncResult) => void): void;
|
||||
/**
|
||||
* Project documents only. Get the Task Name, WSS Task Id, and ResourceNames for given taskId.
|
||||
* @param taskId Either a string or value of the Task Id.
|
||||
* @param options Provides an option for preserving context data of any type, unchanged, for use in a callback.
|
||||
* @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type AsyncResult.
|
||||
*/
|
||||
getTaskAsync(taskId: string, options?: AsyncContextOptions, callback?: (result: AsyncResult) => void): void;
|
||||
/**
|
||||
* Project documents only. Get task field for provided task Id. (Ex. StartDate).
|
||||
* @param taskId Either a string or value of the Task Id.
|
||||
* @param fieldId Task Fields.
|
||||
* @param options Provides an option for preserving context data of any type, unchanged, for use in a callback.
|
||||
* @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type AsyncResult.
|
||||
*/
|
||||
getTaskFieldAsync(taskId: string, fieldId: number, options?: AsyncContextOptions, callback?: (result: AsyncResult) => void): void;
|
||||
/**
|
||||
* Project documents only. Get the WSS Url and list name for the Tasks List, the MPP is synced too.
|
||||
* @param options Provides an option for preserving context data of any type, unchanged, for use in a callback.
|
||||
* @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type AsyncResult.
|
||||
*/
|
||||
getWSSUrlAsync(options?: AsyncContextOptions, callback?: (result: AsyncResult) => void): void;
|
||||
}
|
||||
/**
|
||||
* Provides information about the document that raised the SelectionChanged event.
|
||||
@@ -2437,11 +2549,10 @@ declare namespace Office {
|
||||
* Additional remark for Excel Online: The total number of cells in the TableData object passed to the data parameter can't exceed 20,000 in a single call to this method.
|
||||
*
|
||||
* @param tableData An array of arrays ("matrix") or a TableData object that contains one or more columns of data to add to the table. Required.
|
||||
* @param options Syntax example: {asyncContext:context}
|
||||
* asyncContext: A user-defined item of any type that is returned in the AsyncResult object without being altered.
|
||||
* @param options Provides an option for preserving context data of any type, unchanged, for use in a callback.
|
||||
* @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type AsyncResult.
|
||||
*/
|
||||
addColumnsAsync(tableData: TableData | any[][], options?: any, callback?: (result: AsyncResult) => void): void;
|
||||
addColumnsAsync(tableData: TableData | any[][], options?: AsyncContextOptions, callback?: (result: AsyncResult) => void): void;
|
||||
/**
|
||||
* Adds the specified data to the table as additional rows.
|
||||
*
|
||||
@@ -4692,63 +4803,6 @@ declare namespace Office {
|
||||
*/
|
||||
Timeline
|
||||
}
|
||||
// Objects
|
||||
interface Document {
|
||||
/**
|
||||
* Get Project field (Ex. ProjectWebAccessURL).
|
||||
* @param fieldId Project level fields.
|
||||
* @param options Provides an option for preserving context data of any type, unchanged, for use in a callback.
|
||||
* @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type AsyncResult.
|
||||
*/
|
||||
getProjectFieldAsync(fieldId: number, options?: AsyncContextOptions, callback?: (result: AsyncResult) => void): void;
|
||||
/**
|
||||
* Get resource field for provided resource Id. (Ex.ResourceName)
|
||||
* @param resourceId Either a string or value of the Resource Id.
|
||||
* @param fieldId Resource Fields.
|
||||
* @param options Provides an option for preserving context data of any type, unchanged, for use in a callback.
|
||||
* @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type AsyncResult.
|
||||
*/
|
||||
getResourceFieldAsync(resourceId: string, fieldId: number, options?: AsyncContextOptions, callback?: (result: AsyncResult) => void): void;
|
||||
/**
|
||||
* Get the current selected Resource's Id.
|
||||
* @param options Provides an option for preserving context data of any type, unchanged, for use in a callback.
|
||||
* @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type AsyncResult.
|
||||
*/
|
||||
getSelectedResourceAsync(options?: AsyncContextOptions, callback?: (result: AsyncResult) => void): void;
|
||||
/**
|
||||
* Get the current selected Task's Id.
|
||||
* @param options Provides an option for preserving context data of any type, unchanged, for use in a callback.
|
||||
* @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type AsyncResult.
|
||||
*/
|
||||
getSelectedTaskAsync(options?: AsyncContextOptions, callback?: (result: AsyncResult) => void): void;
|
||||
/**
|
||||
* Get the current selected View Type (Ex. Gantt) and View Name.
|
||||
* @param options Provides an option for preserving context data of any type, unchanged, for use in a callback.
|
||||
* @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type AsyncResult.
|
||||
*/
|
||||
getSelectedViewAsync(options?: AsyncContextOptions, callback?: (result: AsyncResult) => void): void;
|
||||
/**
|
||||
* Get the Task Name, WSS Task Id, and ResourceNames for given taskId.
|
||||
* @param taskId Either a string or value of the Task Id.
|
||||
* @param options Provides an option for preserving context data of any type, unchanged, for use in a callback.
|
||||
* @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type AsyncResult.
|
||||
*/
|
||||
getTaskAsync(taskId: string, options?: AsyncContextOptions, callback?: (result: AsyncResult) => void): void;
|
||||
/**
|
||||
* Get task field for provided task Id. (Ex. StartDate).
|
||||
* @param taskId Either a string or value of the Task Id.
|
||||
* @param fieldId Task Fields.
|
||||
* @param options Provides an option for preserving context data of any type, unchanged, for use in a callback.
|
||||
* @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type AsyncResult.
|
||||
*/
|
||||
getTaskFieldAsync(taskId: string, fieldId: number, options?: AsyncContextOptions, callback?: (result: AsyncResult) => void): void;
|
||||
/**
|
||||
* Get the WSS Url and list name for the Tasks List, the MPP is synced too.
|
||||
* @param options Provides an option for preserving context data of any type, unchanged, for use in a callback.
|
||||
* @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type AsyncResult.
|
||||
*/
|
||||
getWSSUrlAsync(options?: AsyncContextOptions, callback?: (result: AsyncResult) => void): void;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -6088,61 +6142,6 @@ declare namespace Office {
|
||||
*/
|
||||
urls: Array<string>;
|
||||
}
|
||||
/**
|
||||
* The Office.context namespace provides shared interfaces that are used by add-ins in all of the Office apps. This listing documents only those interfaces that are used by Outlook add-ins.
|
||||
*
|
||||
* [Api set: Mailbox 1.0]
|
||||
*
|
||||
* @remarks
|
||||
* For a full listing of the Office.context namespace, see the [Office.context reference in the Shared API](https://dev.office.com/reference/add-ins/shared/office.context.htm).
|
||||
*
|
||||
* Applicable Outlook mode: Compose or read
|
||||
*/
|
||||
interface Context {
|
||||
/**
|
||||
* Gets the locale (language) in RFC 1766 Language tag format specified by the user for the UI of the Office host application.
|
||||
*
|
||||
* The displayLanguage value reflects the current Display Language setting specified with File > Options > Language in the Office host application.
|
||||
*
|
||||
* [Api set: Mailbox 1.0]
|
||||
*
|
||||
* @remarks
|
||||
* Applicable Outlook mode: Compose or read
|
||||
*/
|
||||
displayLanguage: string;
|
||||
/**
|
||||
* Provides access to the Outlook Add-in object model for Microsoft Outlook and Microsoft Outlook on the web.
|
||||
*
|
||||
* Namespaces:
|
||||
*
|
||||
* - diagnostics: Provides diagnostic information to an Outlook add-in.
|
||||
*
|
||||
* - item: Provides methods and properties for accessing a message or appointment in an Outlook add-in.
|
||||
*
|
||||
* - userProfile: Provides information about the user in an Outlook add-in.
|
||||
*
|
||||
* [Api set: Mailbox 1.0]
|
||||
*
|
||||
* @remarks
|
||||
* Minimum permission level: Restricted
|
||||
*
|
||||
* Applicable Outlook mode: Compose or read
|
||||
*/
|
||||
mailbox: Mailbox;
|
||||
/**
|
||||
* Gets an object that represents the custom settings or state of a mail add-in saved to a user's mailbox.
|
||||
*
|
||||
* The RoamingSettings object lets you store and access data for a mail add-in that is stored in a user's mailbox, so that is available to that add-in when it is running from any host client application used to access that mailbox.
|
||||
*
|
||||
* [Api set: Mailbox 1.0]
|
||||
*
|
||||
* @remarks
|
||||
* Minimum permission level: Restricted
|
||||
*
|
||||
* Applicable Outlook mode: Compose or read
|
||||
*/
|
||||
roamingSettings: RoamingSettings;
|
||||
}
|
||||
/**
|
||||
* The CustomProperties object represents custom properties that are specific to a particular item and specific to a mail add-in for Outlook. For example, there might be a need for a mail add-in to save some data that is specific to the current email message that activated the add-in. If the user revisits the same message in the future and activates the mail add-in again, the add-in will be able to retrieve the data that had been saved as custom properties.
|
||||
*
|
||||
@@ -8345,11 +8344,10 @@ declare namespace Office {
|
||||
*
|
||||
* @param eventType The event that should invoke the handler.
|
||||
* @param handler The function to handle the event. The function must accept a single parameter, which is an object literal. The type property on the parameter will match the eventType parameter passed to addHandlerAsync.
|
||||
* @param options Optional. An object literal that contains one or more of the following properties.
|
||||
* asyncContext: Developers can provide any object they wish to access in the callback method.
|
||||
* @param options Optional. Provides an option for preserving context data of any type, unchanged, for use in a callback.
|
||||
* @param callback Optional. When the method completes, the function passed in the callback parameter is called with a single parameter of type AsyncResult.
|
||||
*/
|
||||
addHandlerAsync(eventType: Office.EventType, handler: (type: Office.EventType) => void, options?: any, callback?: (result: AsyncResult) => void): void;
|
||||
addHandlerAsync(eventType: Office.EventType, handler: (type: Office.EventType) => void, options?: AsyncContextOptions, callback?: (result: AsyncResult) => void): void;
|
||||
/**
|
||||
* Converts an item ID formatted for REST into EWS format.
|
||||
*
|
||||
@@ -11312,15 +11310,11 @@ declare namespace Excel {
|
||||
* Copy a worksheet and place it at the specified position. Return the copied worksheet.
|
||||
*
|
||||
* [Api set: ExcelApi 1.7]
|
||||
*
|
||||
* @param positionType Specifies where to put the copy relative to the worksheet specified in relativeTo param. Can be Excel.WorksheetPositionType or string equivalent. Must not be Excel.WorksheetPositionType.none or "None".
|
||||
* @param relativeTo Specifies the worksheet that is the basis for intepreting the positionType param. If not specified, the worksheet on which the copy() is called is assumed.
|
||||
*/
|
||||
copy(positionType?: Excel.WorksheetPositionType, relativeTo?: Excel.Worksheet): Excel.Worksheet;
|
||||
/**
|
||||
*
|
||||
* Copy a worksheet and place it at the specified position. Return the copied worksheet.
|
||||
*
|
||||
* [Api set: ExcelApi 1.7]
|
||||
*/
|
||||
copy(positionType?: "None" | "Before" | "After" | "Beginning" | "End", relativeTo?: Excel.Worksheet): Excel.Worksheet;
|
||||
copy(positionType?: Excel.WorksheetPositionType | string, relativeTo?: Excel.Worksheet): Excel.Worksheet;
|
||||
/**
|
||||
*
|
||||
* Deletes the worksheet from the workbook.
|
||||
|
||||
Vendored
+1
@@ -397,6 +397,7 @@ export interface ScatterData {
|
||||
'z+x' | 'z+x+text' | 'z+x+name' |
|
||||
'z+y+x' | 'z+y+x+text' | 'z+y+x+name' |
|
||||
'z+x+y' | 'z+x+y+text' | 'z+x+y+name';
|
||||
hoverlabel: Partial<Label>;
|
||||
fill: 'none' | 'tozeroy' | 'tozerox' | 'tonexty' | 'tonextx' | 'toself' | 'tonext';
|
||||
fillcolor: string;
|
||||
legendgroup: string;
|
||||
|
||||
Vendored
+11
@@ -3,6 +3,13 @@
|
||||
// Definitions by: Tomek Łaziuk <https://github.com/tlaziuk>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/**
|
||||
* Returns `-1` when unsatisfiable and `-2` when syntactically invalid.
|
||||
*
|
||||
* When ranges are returned, the array has a "type" property which is the type of
|
||||
* range that is required (most commonly, "bytes"). Each array element is an object
|
||||
* with a "start" and "end" property for the portion of the range.
|
||||
*/
|
||||
declare function RangeParser(size: number, str: string, options?: RangeParser.Options): RangeParser.Result | RangeParser.Ranges;
|
||||
|
||||
declare namespace RangeParser {
|
||||
@@ -14,6 +21,10 @@ declare namespace RangeParser {
|
||||
end: number;
|
||||
}
|
||||
interface Options {
|
||||
/**
|
||||
* The "combine" option can be set to `true` and overlapping & adjacent ranges
|
||||
* will be combined into a single range.
|
||||
*/
|
||||
combine?: boolean;
|
||||
}
|
||||
const enum Result {
|
||||
|
||||
Vendored
+122
-89
@@ -1,6 +1,7 @@
|
||||
// Type definitions for react-dates v16.0.0
|
||||
// Project: https://github.com/airbnb/react-dates
|
||||
// Definitions by: Artur Ampilogov <https://github.com/Artur-A>
|
||||
// Definitions by: Artur Ampilogov <https://github.com/Artur-A>
|
||||
// Nathan Holland <https://github.com/NathanNZ>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.6
|
||||
|
||||
@@ -21,8 +22,66 @@ declare namespace ReactDates {
|
||||
type FocusedInputShape = 'startDate' | 'endDate';
|
||||
type OrientationShape = 'horizontal' | 'vertical';
|
||||
type ScrollableOrientationShape = 'horizontal' | 'vertical' | 'verticalScrollable';
|
||||
type CalendarInfoPositionShape = 'top' | 'bottom' | 'before' | 'after';
|
||||
|
||||
//https://github.com/airbnb/react-dates/blob/v16.0.1/src/defaultPhrases.js
|
||||
type SingleDatePickerPhrases = {
|
||||
closeDatePicker: string,
|
||||
clearDate: string,
|
||||
jumpToPrevMonth: string,
|
||||
jumpToNextMonth: string,
|
||||
keyboardShortcuts: string,
|
||||
showKeyboardShortcutsPanel: string,
|
||||
hideKeyboardShortcutsPanel: string,
|
||||
openThisPanel: string,
|
||||
enterKey: string,
|
||||
leftArrowRightArrow: string,
|
||||
upArrowDownArrow: string,
|
||||
pageUpPageDown: string,
|
||||
homeEnd: string,
|
||||
escape: string,
|
||||
questionMark: string,
|
||||
selectFocusedDate: string,
|
||||
moveFocusByOneDay: string,
|
||||
moveFocusByOneWeek: string,
|
||||
moveFocusByOneMonth: string,
|
||||
moveFocustoStartAndEndOfWeek: string,
|
||||
returnFocusToInput: string,
|
||||
keyboardNavigationInstructions: string,
|
||||
chooseAvailableDate: (date: string) => string,
|
||||
dateIsUnavailable: (date: string) => string,
|
||||
};
|
||||
|
||||
//https://github.com/airbnb/react-dates/blob/v16.0.1/src/defaultPhrases.js
|
||||
type DateRangePickerPhrases = {
|
||||
calendarLabel?: string,
|
||||
jumpToPrevMonth?: string,
|
||||
jumpToNextMonth?: string,
|
||||
keyboardShortcuts?: string,
|
||||
showKeyboardShortcutsPanel?: string,
|
||||
hideKeyboardShortcutsPanel?: string,
|
||||
openThisPanel?: string,
|
||||
enterKey?: string,
|
||||
leftArrowRightArrow?: string,
|
||||
upArrowDownArrow?: string,
|
||||
pageUpPageDown?: string,
|
||||
homeEnd?: string,
|
||||
escape?: string,
|
||||
questionMark?: string,
|
||||
selectFocusedDate?: string,
|
||||
moveFocusByOneDay?: string,
|
||||
moveFocusByOneWeek?: string,
|
||||
moveFocusByOneMonth?: string,
|
||||
moveFocustoStartAndEndOfWeek?: string,
|
||||
returnFocusToInput?: string,
|
||||
chooseAvailableStartDate?: (date: string) => string,
|
||||
chooseAvailableEndDate?: (date: string) => string,
|
||||
chooseAvailableDate?: (date: string) => string,
|
||||
dateIsUnavailable?: (date: string) => string,
|
||||
dateIsSelected?: (date: string) => string
|
||||
};
|
||||
|
||||
//https://github.com/airbnb/react-dates/blob/v16.0.1/src/shapes/DateRangePickerShape.js
|
||||
interface DateRangePickerShape {
|
||||
// REQUIRED props
|
||||
startDate: momentPropTypes.momentObj | null,
|
||||
@@ -61,7 +120,7 @@ declare namespace ReactDates {
|
||||
withPortal?: boolean,
|
||||
withFullScreenPortal?: boolean,
|
||||
initialVisibleMonth?: () => momentPropTypes.momentObj,
|
||||
firstDayOfWeek? : 0 | 1 | 2 | 3 | 4 | 5 | 6,
|
||||
firstDayOfWeek?: 0 | 1 | 2 | 3 | 4 | 5 | 6,
|
||||
numberOfMonths?: number,
|
||||
keepOpenOnDateSelect?: boolean,
|
||||
reopenPickerOnClearDates?: boolean,
|
||||
@@ -92,40 +151,13 @@ declare namespace ReactDates {
|
||||
displayFormat?: (string | (() => string)),
|
||||
monthFormat?: string,
|
||||
weekDayFormat?: string,
|
||||
phrases?: {
|
||||
closeDatePicker: string,
|
||||
clearDates: string,
|
||||
focusStartDate: string,
|
||||
jumpToPrevMonth: string,
|
||||
jumpToNextMonth: string,
|
||||
keyboardShortcuts: string,
|
||||
showKeyboardShortcutsPanel: string,
|
||||
hideKeyboardShortcutsPanel: string,
|
||||
openThisPanel: string,
|
||||
enterKey: string,
|
||||
leftArrowRightArrow: string,
|
||||
upArrowDownArrow: string,
|
||||
pageUpPageDown: string,
|
||||
homeEnd: string,
|
||||
escape: string,
|
||||
questionMark: string,
|
||||
selectFocusedDate: string,
|
||||
moveFocusByOneDay: string,
|
||||
moveFocusByOneWeek: string,
|
||||
moveFocusByOneMonth: string,
|
||||
moveFocustoStartAndEndOfWeek: string,
|
||||
returnFocusToInput: string,
|
||||
keyboardNavigationInstructions: string,
|
||||
|
||||
chooseAvailableStartDate: (date: string) => string,
|
||||
chooseAvailableEndDate: (date: string) => string,
|
||||
dateIsUnavailable: (date: string) => string
|
||||
}
|
||||
phrases?: DateRangePickerPhrases
|
||||
}
|
||||
|
||||
type DateRangePicker = React.ClassicComponentClass<DateRangePickerShape>;
|
||||
var DateRangePicker: React.ClassicComponentClass<DateRangePickerShape>;
|
||||
|
||||
//https://github.com/airbnb/react-dates/blob/v16.0.1/src/shapes/SingleDatePickerShape.js
|
||||
interface SingleDatePickerShape {
|
||||
// REQUIRED props
|
||||
date: momentPropTypes.momentObj | null,
|
||||
@@ -159,7 +191,7 @@ declare namespace ReactDates {
|
||||
withPortal?: boolean,
|
||||
withFullScreenPortal?: boolean,
|
||||
initialVisibleMonth?: () => momentPropTypes.momentObj,
|
||||
firstDayOfWeek? : 0 | 1 | 2 | 3 | 4 | 5 | 6,
|
||||
firstDayOfWeek?: 0 | 1 | 2 | 3 | 4 | 5 | 6,
|
||||
numberOfMonths?: number,
|
||||
keepOpenOnDateSelect?: boolean,
|
||||
reopenPickerOnClearDates?: boolean,
|
||||
@@ -168,7 +200,7 @@ declare namespace ReactDates {
|
||||
daySize?: number,
|
||||
isRTL?: boolean,
|
||||
verticalSpacing?: number,
|
||||
verticalHeight?: number| null,
|
||||
verticalHeight?: number | null,
|
||||
|
||||
// navigation related props
|
||||
navPrev?: string | JSX.Element,
|
||||
@@ -189,39 +221,12 @@ declare namespace ReactDates {
|
||||
// internationalization props
|
||||
displayFormat?: (string | (() => string)),
|
||||
monthFormat?: string,
|
||||
phrases?: {
|
||||
closeDatePicker: string,
|
||||
clearDate: string,
|
||||
jumpToPrevMonth: string,
|
||||
jumpToNextMonth: string,
|
||||
keyboardShortcuts: string,
|
||||
showKeyboardShortcutsPanel: string,
|
||||
hideKeyboardShortcutsPanel: string,
|
||||
openThisPanel: string,
|
||||
enterKey: string,
|
||||
leftArrowRightArrow: string,
|
||||
upArrowDownArrow: string,
|
||||
pageUpPageDown: string,
|
||||
homeEnd: string,
|
||||
escape: string,
|
||||
questionMark: string,
|
||||
selectFocusedDate: string,
|
||||
moveFocusByOneDay: string,
|
||||
moveFocusByOneWeek: string,
|
||||
moveFocusByOneMonth: string,
|
||||
moveFocustoStartAndEndOfWeek: string,
|
||||
returnFocusToInput: string,
|
||||
keyboardNavigationInstructions: string,
|
||||
|
||||
chooseAvailableDate: (date: string) => string,
|
||||
dateIsUnavailable: (date: string) => string,
|
||||
},
|
||||
phrases?: SingleDatePickerPhrases
|
||||
}
|
||||
type SingleDatePicker = React.ClassicComponentClass<SingleDatePickerShape>;
|
||||
var SingleDatePicker: React.ClassicComponentClass<SingleDatePickerShape>;
|
||||
|
||||
|
||||
|
||||
//https://github.com/airbnb/react-dates/blob/v16.0.1/src/components/DayPickerRangeController.jsx
|
||||
interface DayPickerRangeControllerShape {
|
||||
// REQUIRED props
|
||||
startDate: momentPropTypes.momentObj | null,
|
||||
@@ -266,40 +271,68 @@ declare namespace ReactDates {
|
||||
|
||||
// internationalization props
|
||||
monthFormat?: string,
|
||||
phrases?: {
|
||||
calendarLabel?: string,
|
||||
jumpToPrevMonth?: string,
|
||||
jumpToNextMonth?: string,
|
||||
keyboardShortcuts?: string,
|
||||
showKeyboardShortcutsPanel?: string,
|
||||
hideKeyboardShortcutsPanel?: string,
|
||||
openThisPanel?: string,
|
||||
enterKey?: string,
|
||||
leftArrowRightArrow?: string,
|
||||
upArrowDownArrow?: string,
|
||||
pageUpPageDown?: string,
|
||||
homeEnd?: string,
|
||||
escape?: string,
|
||||
questionMark?: string,
|
||||
selectFocusedDate?: string,
|
||||
moveFocusByOneDay?: string,
|
||||
moveFocusByOneWeek?: string,
|
||||
moveFocusByOneMonth?: string,
|
||||
moveFocustoStartAndEndOfWeek?: string,
|
||||
returnFocusToInput?: string,
|
||||
chooseAvailableStartDate?: (date: string) => string,
|
||||
chooseAvailableEndDate?: (date: string) => string,
|
||||
chooseAvailableDate?: (date: string) => string,
|
||||
dateIsUnavailable?: (date: string) => string,
|
||||
dateIsSelected?: (date: string) => string,
|
||||
}
|
||||
phrases?: DateRangePickerPhrases
|
||||
}
|
||||
|
||||
type DayPickerRangeController = React.ClassicComponentClass<DayPickerRangeControllerShape>;
|
||||
var DayPickerRangeController: React.ClassicComponentClass<DayPickerRangeControllerShape>;
|
||||
|
||||
//https://github.com/airbnb/react-dates/blob/97bf16e72dbf5ce88f0181c49212080061a83f69/src/components/DayPickerSingleDateController.jsx
|
||||
interface DayPickerSingleDateControllerShape {
|
||||
date: momentPropTypes.momentObj | null,
|
||||
onDateChange: (date: momentPropTypes.momentObj | null) => void,
|
||||
focused: boolean,
|
||||
|
||||
onFocusChange: (arg: { focused: boolean | null }) => void,
|
||||
onClose?: (final: { date: momentPropTypes.momentObj }) => void,
|
||||
|
||||
keepOpenOnDateSelect?: boolean,
|
||||
isOutsideRange?: (day: any) => boolean,
|
||||
isDayBlocked?: (day: any) => boolean,
|
||||
isDayHighlighted?: (day: any) => boolean,
|
||||
|
||||
// DayPicker props
|
||||
renderMonth?: (day: momentPropTypes.momentObj) => (string | JSX.Element),
|
||||
enableOutsideDays?: boolean,
|
||||
numberOfMonths?: number,
|
||||
orientation?: ScrollableOrientationShape,
|
||||
withPortal?: boolean,
|
||||
initialVisibleMonth?: () => momentPropTypes.momentObj,
|
||||
firstDayOfWeek?: 0 | 1 | 2 | 3 | 4 | 5 | 6,
|
||||
hideKeyboardShortcutsPanel?: boolean,
|
||||
daySize?: number,
|
||||
verticalHeight?: number,
|
||||
noBorder?: boolean,
|
||||
transitionDuration?: number,
|
||||
|
||||
navPrev?: string | JSX.Element,
|
||||
navNext?: string | JSX.Element,
|
||||
|
||||
onPrevMonthClick?: (newCurrentMonth: momentPropTypes.momentObj) => void,
|
||||
onNextMonthClick?: (newCurrentMonth: momentPropTypes.momentObj) => void,
|
||||
onOutsideClick?: (e: any) => void,
|
||||
renderCalendarDay?: (day: momentPropTypes.momentObj) => (string | JSX.Element),
|
||||
renderDayContents?: (day: momentPropTypes.momentObj) => (string | JSX.Element),
|
||||
renderCalendarInfo?: () => (string | JSX.Element),
|
||||
calendarInfoPosition?: CalendarInfoPositionShape,
|
||||
|
||||
// accessibility
|
||||
onBlur?: () => void,
|
||||
isFocused?: boolean,
|
||||
showKeyboardShortcuts?: boolean,
|
||||
|
||||
// i18n
|
||||
monthFormat?: string,
|
||||
weekDayFormat?: string,
|
||||
phrases?: SingleDatePickerPhrases,
|
||||
dayAriaLabelFormat?: string,
|
||||
|
||||
isRTL?: boolean,
|
||||
|
||||
}
|
||||
|
||||
type DayPickerSingleDateController = React.ClassicComponentClass<DayPickerSingleDateControllerShape>;
|
||||
var DayPickerSingleDateController: React.ClassicComponentClass<DayPickerSingleDateControllerShape>;
|
||||
|
||||
var isInclusivelyAfterDay: (a: moment.Moment, b: moment.Moment) => boolean;
|
||||
var isInclusivelyBeforeDay: (a: moment.Moment, b: moment.Moment) => boolean;
|
||||
|
||||
@@ -5,6 +5,7 @@ import {
|
||||
SingleDatePicker,
|
||||
DateRangePicker,
|
||||
DayPickerRangeController,
|
||||
DayPickerSingleDateController,
|
||||
isInclusivelyAfterDay,
|
||||
isInclusivelyBeforeDay,
|
||||
isNextDay,
|
||||
@@ -137,16 +138,16 @@ class DayPickerRangeControllerMinimumTest extends React.Component {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
class DayPickerSingleDateControllerMinimumTest extends React.Component {
|
||||
render() {
|
||||
return <DayPickerSingleDateController
|
||||
date={moment()}
|
||||
onDateChange={(arg)=> {}}
|
||||
focused={true}
|
||||
onFocusChange={(arg) => {}}
|
||||
/>
|
||||
}
|
||||
}
|
||||
|
||||
const isInclusivelyAfterDayResult: boolean = isInclusivelyAfterDay(moment(),moment());
|
||||
const isInclusivelyBeforeDayResult: boolean = isInclusivelyBeforeDay(moment(),moment());
|
||||
|
||||
Vendored
+1
-1
@@ -19,7 +19,7 @@ import {
|
||||
export function findDOMNode(instance: ReactInstance): Element | null | Text;
|
||||
export function unmountComponentAtNode(container: Element): boolean;
|
||||
|
||||
export function createPortal(children: ReactNode, container: Element): ReactPortal;
|
||||
export function createPortal(children: ReactNode, container: Element, key?: null | string): ReactPortal;
|
||||
|
||||
export const version: string;
|
||||
export const render: Renderer;
|
||||
|
||||
@@ -42,7 +42,14 @@ describe('ReactDOM', () => {
|
||||
}
|
||||
}
|
||||
|
||||
ReactDOM.createPortal(React.createElement('div'), portalTarget);
|
||||
ReactDOM.createPortal(<div />, document.createElement('div'));
|
||||
ReactDOM.createPortal(<div />, document.createElement('div'), null);
|
||||
ReactDOM.createPortal(<div />, document.createElement('div'), 'key');
|
||||
|
||||
ReactDOM.createPortal(React.createElement('div'), document.createElement('div'));
|
||||
ReactDOM.createPortal(React.createElement('div'), document.createElement('div'), null);
|
||||
ReactDOM.createPortal(React.createElement('div'), document.createElement('div'), 'key');
|
||||
|
||||
ReactDOM.render(<ClassComponent />, rootElement);
|
||||
});
|
||||
});
|
||||
|
||||
+49
-30
@@ -4,6 +4,7 @@
|
||||
// Jon Surrell <https://github.com/sirreal>
|
||||
// Ivan Jiang <https://github.com/iplus26>
|
||||
// Kurt Preston <https://github.com/KurtPreston>
|
||||
// Philippe Bourdages <https://github.com/phbou72>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.6
|
||||
|
||||
@@ -21,6 +22,7 @@ declare module "react-jsonschema-form" {
|
||||
noValidate?: boolean;
|
||||
noHtml5Validate?: boolean;
|
||||
showErrorList?: boolean;
|
||||
ErrorList?: React.StatelessComponent<ErrorListProps>;
|
||||
validate?: (formData: T, errors: FormValidation) => FormValidation;
|
||||
onChange?: (e: IChangeEvent<T>) => any;
|
||||
onError?: (e: any) => any;
|
||||
@@ -28,7 +30,9 @@ declare module "react-jsonschema-form" {
|
||||
liveValidate?: boolean;
|
||||
FieldTemplate?: React.StatelessComponent<FieldTemplateProps>;
|
||||
ArrayFieldTemplate?: React.StatelessComponent<ArrayFieldTemplateProps>;
|
||||
ObjectFieldTemplate?: React.StatelessComponent<ObjectFieldTemplateProps>;
|
||||
ObjectFieldTemplate?: React.StatelessComponent<
|
||||
ObjectFieldTemplateProps
|
||||
>;
|
||||
safeRenderCompletion?: boolean;
|
||||
transformErrors?: (errors: AjvError[]) => AjvError[];
|
||||
|
||||
@@ -44,23 +48,23 @@ declare module "react-jsonschema-form" {
|
||||
acceptcharset?: string;
|
||||
}
|
||||
|
||||
export default class Form<T> extends React.Component<FormProps<T>> { }
|
||||
export default class Form<T> extends React.Component<FormProps<T>> {}
|
||||
|
||||
export type UiSchema = {
|
||||
'ui:field'?: Field | string;
|
||||
'ui:widget'?: Widget | string;
|
||||
'ui:options'?: object;
|
||||
'ui:order'?: string[];
|
||||
"ui:field"?: Field | string;
|
||||
"ui:widget"?: Widget | string;
|
||||
"ui:options"?: object;
|
||||
"ui:order"?: string[];
|
||||
[name: string]: any;
|
||||
};
|
||||
|
||||
export type FieldId = {
|
||||
$id: string;
|
||||
}
|
||||
};
|
||||
|
||||
export type IdSchema = FieldId & {
|
||||
[key: string]: FieldId;
|
||||
}
|
||||
};
|
||||
|
||||
export interface WidgetProps extends React.HTMLAttributes<HTMLElement> {
|
||||
id: string;
|
||||
@@ -75,7 +79,9 @@ declare module "react-jsonschema-form" {
|
||||
formContext: any;
|
||||
}
|
||||
|
||||
export type Widget = React.StatelessComponent<WidgetProps> | React.ComponentClass<WidgetProps>;
|
||||
export type Widget =
|
||||
| React.StatelessComponent<WidgetProps>
|
||||
| React.ComponentClass<WidgetProps>;
|
||||
|
||||
export interface FieldProps extends React.HTMLAttributes<HTMLElement> {
|
||||
schema: JSONSchema6;
|
||||
@@ -99,7 +105,9 @@ declare module "react-jsonschema-form" {
|
||||
[prop: string]: any;
|
||||
}
|
||||
|
||||
export type Field = React.StatelessComponent<FieldProps> | React.ComponentClass<FieldProps>;
|
||||
export type Field =
|
||||
| React.StatelessComponent<FieldProps>
|
||||
| React.ComponentClass<FieldProps>;
|
||||
|
||||
export type FieldTemplateProps = {
|
||||
id: string;
|
||||
@@ -121,7 +129,7 @@ declare module "react-jsonschema-form" {
|
||||
schema: JSONSchema6;
|
||||
uiSchema: UiSchema;
|
||||
formContext: any;
|
||||
}
|
||||
};
|
||||
|
||||
export type ArrayFieldTemplateProps = {
|
||||
DescriptionField: object;
|
||||
@@ -131,7 +139,7 @@ declare module "react-jsonschema-form" {
|
||||
disabled: boolean;
|
||||
idSchema: IdSchema;
|
||||
items: {
|
||||
children: React.ReactElement<any>,
|
||||
children: React.ReactElement<any>;
|
||||
className: string;
|
||||
disabled: boolean;
|
||||
hasMoveDown: boolean;
|
||||
@@ -140,7 +148,10 @@ declare module "react-jsonschema-form" {
|
||||
hasToolbar: boolean;
|
||||
index: number;
|
||||
onDropIndexClick: (index: number) => (event: any) => void;
|
||||
onReorderClick: (index: number, newIndex: number) => (event: any) => void;
|
||||
onReorderClick: (
|
||||
index: number,
|
||||
newIndex: number
|
||||
) => (event: any) => void;
|
||||
readonly: boolean;
|
||||
}[];
|
||||
onAddClick: (event: any) => (event: any) => void;
|
||||
@@ -151,7 +162,7 @@ declare module "react-jsonschema-form" {
|
||||
title: string;
|
||||
formContext: any;
|
||||
formData: any;
|
||||
}
|
||||
};
|
||||
|
||||
export type ObjectFieldTemplateProps = {
|
||||
DescriptionField: object;
|
||||
@@ -159,23 +170,39 @@ declare module "react-jsonschema-form" {
|
||||
title: string;
|
||||
description: string;
|
||||
properties: {
|
||||
content: React.ReactElement<any>,
|
||||
content: React.ReactElement<any>;
|
||||
name: string;
|
||||
disabled: boolean;
|
||||
readonly: boolean;
|
||||
}[],
|
||||
}[];
|
||||
required: boolean;
|
||||
schema: JSONSchema6;
|
||||
uiSchema: UiSchema;
|
||||
idSchema: IdSchema;
|
||||
formData: any;
|
||||
formContext: any;
|
||||
}
|
||||
};
|
||||
|
||||
export type AjvError = {
|
||||
message: string;
|
||||
name: string;
|
||||
params: any;
|
||||
property: string;
|
||||
stack: string;
|
||||
};
|
||||
|
||||
export type ErrorListProps = {
|
||||
errorSchema: FormValidation;
|
||||
errors: AjvError[];
|
||||
formContext: any;
|
||||
schema: JSONSchema6;
|
||||
uiSchema: UiSchema;
|
||||
};
|
||||
|
||||
export interface IChangeEvent<T = any> {
|
||||
edit: boolean;
|
||||
formData: T;
|
||||
errors: { stack: string }[];
|
||||
errors: AjvError[];
|
||||
errorSchema: FormValidation;
|
||||
idSchema: IdSchema;
|
||||
schema: JSONSchema6;
|
||||
@@ -185,26 +212,18 @@ declare module "react-jsonschema-form" {
|
||||
|
||||
export type ISubmitEvent<T> = IChangeEvent<T>;
|
||||
|
||||
export type AjvError = {
|
||||
message: string;
|
||||
name: string;
|
||||
params: any;
|
||||
property: string;
|
||||
stack: string;
|
||||
}
|
||||
|
||||
export type FieldError = string
|
||||
export type FieldError = string;
|
||||
|
||||
type FieldValidation = {
|
||||
__errors: FieldError[];
|
||||
addError: (message: string) => void;
|
||||
}
|
||||
};
|
||||
|
||||
type FormValidation = FieldValidation & {
|
||||
[fieldName: string]: FieldValidation;
|
||||
}
|
||||
};
|
||||
|
||||
type FormSubmit<T> = {
|
||||
formData: T;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1,38 +1,35 @@
|
||||
import * as React from "react";
|
||||
import Form, { UiSchema } from "react-jsonschema-form";
|
||||
import Form, { UiSchema, ErrorListProps } from "react-jsonschema-form";
|
||||
import { JSONSchema6 } from "json-schema";
|
||||
|
||||
// example taken from the react-jsonschema-form playground:
|
||||
// https://github.com/mozilla-services/react-jsonschema-form/blob/fedd830294417969d88e38fb9f6b3a85e6ad105e/playground/samples/simple.js
|
||||
|
||||
const schema: JSONSchema6 = {
|
||||
"title": "A registration form",
|
||||
"type": "object",
|
||||
"required": [
|
||||
"firstName",
|
||||
"lastName"
|
||||
],
|
||||
"properties": {
|
||||
"firstName": {
|
||||
"type": "string",
|
||||
"title": "First name"
|
||||
const schema: JSONSchema6 = {
|
||||
title: "A registration form",
|
||||
type: "object",
|
||||
required: ["firstName", "lastName"],
|
||||
properties: {
|
||||
firstName: {
|
||||
type: "string",
|
||||
title: "First name"
|
||||
},
|
||||
"lastName": {
|
||||
"type": "string",
|
||||
"title": "Last name"
|
||||
lastName: {
|
||||
type: "string",
|
||||
title: "Last name"
|
||||
},
|
||||
"age": {
|
||||
"type": "integer",
|
||||
"title": "Age"
|
||||
age: {
|
||||
type: "integer",
|
||||
title: "Age"
|
||||
},
|
||||
"bio": {
|
||||
"type": "string",
|
||||
"title": "Bio"
|
||||
bio: {
|
||||
type: "string",
|
||||
title: "Bio"
|
||||
},
|
||||
"password": {
|
||||
"type": "string",
|
||||
"title": "Password",
|
||||
"minLength": 3
|
||||
password: {
|
||||
type: "string",
|
||||
title: "Password",
|
||||
minLength: 3
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -57,6 +54,26 @@ interface IExampleState {
|
||||
formData: any;
|
||||
}
|
||||
|
||||
export default function ErrorListExample(props: ErrorListProps) {
|
||||
const { errors } = props;
|
||||
return (
|
||||
<div className="panel panel-danger errors">
|
||||
<div className="panel-heading">
|
||||
<h3 className="panel-title">Errors</h3>
|
||||
</div>
|
||||
<ul className="list-group">
|
||||
{errors.map((error, i) => {
|
||||
return (
|
||||
<li key={i} className="list-group-item text-danger">
|
||||
{error.stack}
|
||||
</li>
|
||||
);
|
||||
})}
|
||||
</ul>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export class Example extends React.Component<any, IExampleState> {
|
||||
public state: IExampleState = {
|
||||
formData: {
|
||||
@@ -66,23 +83,28 @@ export class Example extends React.Component<any, IExampleState> {
|
||||
bio: "Roundhouse kicking asses since 1940",
|
||||
password: "noneed"
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
constructor(props: any) {
|
||||
super(props);
|
||||
}
|
||||
|
||||
public render() {
|
||||
return (
|
||||
<div className="react-jsonschema-form-example">
|
||||
{ <Form schema={schema}
|
||||
return (
|
||||
<div className="react-jsonschema-form-example">
|
||||
{
|
||||
<Form
|
||||
schema={schema}
|
||||
uiSchema={uiSchema}
|
||||
showErrorList={false}
|
||||
noValidate={false}
|
||||
noHtml5Validate={false}
|
||||
formData={this.state}
|
||||
onChange={(formData) => this.setState({formData})} /> }
|
||||
</div>
|
||||
);
|
||||
ErrorList={ErrorListExample}
|
||||
onChange={formData => this.setState({ formData })}
|
||||
/>
|
||||
}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
+275
@@ -0,0 +1,275 @@
|
||||
// Type definitions for react-native-svg-charts 5.0
|
||||
// Project: https://github.com/JesperLekland/react-native-svg-charts
|
||||
// Definitions by: Krzysztof Miemiec <https://github.com/krzysztof-miemiec>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.8
|
||||
|
||||
import { ScaleBand, ScaleLinear, ScaleLogarithmic, ScalePower, ScaleTime } from 'd3-scale';
|
||||
import { CurveFactory, Series } from 'd3-shape';
|
||||
import * as React from 'react';
|
||||
import { StyleProp, ViewStyle } from 'react-native';
|
||||
import {
|
||||
CommonPathProps,
|
||||
LinearGradientProps,
|
||||
LineProps,
|
||||
PathProps,
|
||||
RadialGradientProps,
|
||||
TextProps
|
||||
} from 'react-native-svg';
|
||||
|
||||
export type ScaleType<Range, Output> =
|
||||
| ScaleLinear<Range, Output>
|
||||
| ScaleLogarithmic<Range, Output>
|
||||
| ScalePower<Range, Output>
|
||||
| ScaleTime<Range, Output>;
|
||||
|
||||
export type ScaleFunction = () => ScaleType<any, any> | ScaleBand<any>;
|
||||
export type AccessorFunction<T, U> = (props: { item: T, index: number }) => U;
|
||||
export type SortFunction<T> = (a: T, b: T) => number;
|
||||
export type OffsetFunction = (series: Series<any, any>, order: number[]) => void;
|
||||
export type OrderFunction = (series: Series<any, any>) => number[];
|
||||
|
||||
// Chart
|
||||
|
||||
export interface ChartProps<T> {
|
||||
data: T[];
|
||||
style?: StyleProp<ViewStyle>;
|
||||
animate?: boolean;
|
||||
animationDuration?: number;
|
||||
svg?: Partial<PathProps>;
|
||||
width?: number;
|
||||
height?: number;
|
||||
curve?: CurveFactory;
|
||||
contentInset?: {
|
||||
top?: number,
|
||||
left?: number,
|
||||
right?: number,
|
||||
bottom?: number,
|
||||
};
|
||||
gridMin?: number;
|
||||
gridMax?: number;
|
||||
gridProps?: GridProps<any>;
|
||||
numberOfTicks?: number;
|
||||
xScale?: ScaleFunction;
|
||||
yScale?: ScaleFunction;
|
||||
xAccessor?: AccessorFunction<T, number>;
|
||||
yAccessor?: AccessorFunction<T, number>;
|
||||
}
|
||||
|
||||
// Line Chart
|
||||
|
||||
export class LineChart<T> extends React.PureComponent<ChartProps<T>> {
|
||||
}
|
||||
|
||||
// Pie Chart
|
||||
|
||||
export interface PieChartData {
|
||||
svg?: Partial<PathProps>;
|
||||
key: string | number;
|
||||
value?: number;
|
||||
arc?: {
|
||||
outerRadius?: number | string;
|
||||
cornerRadius?: number | string;
|
||||
};
|
||||
}
|
||||
|
||||
export interface PieChartProps<T extends PieChartData> extends ChartProps<T> {
|
||||
innerRadius?: number | string;
|
||||
outerRadius?: number | string;
|
||||
labelRadius?: number | string;
|
||||
padAngle?: number;
|
||||
sort?: SortFunction<T>;
|
||||
valueAccessor?: AccessorFunction<T, number>;
|
||||
}
|
||||
|
||||
export class PieChart<T extends PieChartData> extends React.PureComponent<PieChartProps<T>> {
|
||||
}
|
||||
|
||||
// Area Chart
|
||||
|
||||
export interface AreaChartProps<T> extends ChartProps<T> {
|
||||
start?: number;
|
||||
}
|
||||
|
||||
export class AreaChart<T> extends React.PureComponent<AreaChartProps<T>> {
|
||||
}
|
||||
|
||||
// Stacked Area Chart
|
||||
|
||||
export interface StackedAreaChartProps<T> extends ChartProps<T> {
|
||||
keys: ReadonlyArray<keyof T>;
|
||||
colors: string[];
|
||||
offset?: OffsetFunction;
|
||||
order?: OrderFunction;
|
||||
renderGradient?: (props: {
|
||||
id: string,
|
||||
width: number,
|
||||
height: number,
|
||||
x: number,
|
||||
y: number,
|
||||
index: number,
|
||||
key: keyof T,
|
||||
color: string,
|
||||
}) => React.Component<LinearGradientProps | RadialGradientProps>;
|
||||
showGrid?: boolean;
|
||||
extras?: any[];
|
||||
renderDecorator?: () => {};
|
||||
}
|
||||
|
||||
export class StackedAreaChart<T> extends React.PureComponent<StackedAreaChartProps<T>> {
|
||||
static extractDataPoints<T>(data: T[], keys: ReadonlyArray<keyof T>, order?: OrderFunction, offset?: OffsetFunction): number[];
|
||||
}
|
||||
|
||||
// Stacked Bar Chart
|
||||
|
||||
export interface StackedBarChartProps<T> extends ChartProps<T> {
|
||||
keys: ReadonlyArray<keyof T>;
|
||||
colors: string[];
|
||||
offset?: OffsetFunction;
|
||||
order?: OrderFunction;
|
||||
strokeColor?: string;
|
||||
renderGradient: (props: { id: string }) => React.Component<LinearGradientProps | RadialGradientProps>;
|
||||
spacingInner?: number;
|
||||
spacingOuter?: number;
|
||||
showGrid?: boolean;
|
||||
extras?: any[];
|
||||
extra?: () => {};
|
||||
}
|
||||
|
||||
export class StackedBarChart<T> extends React.PureComponent<StackedBarChartProps<T>> {
|
||||
static extractDataPoints<T>(data: T, keys: ReadonlyArray<keyof T>, order?: OrderFunction, offset?: OffsetFunction): number[];
|
||||
}
|
||||
|
||||
// Bar Chart
|
||||
|
||||
export interface BarChartProps<T> extends ChartProps<T> {
|
||||
spacingInner?: number;
|
||||
spacingOuter?: number;
|
||||
}
|
||||
|
||||
export class BarChart<T> extends React.PureComponent<BarChartProps<T>> {
|
||||
}
|
||||
|
||||
// Axis
|
||||
|
||||
export interface AxisProps<T> {
|
||||
style?: StyleProp<ViewStyle>;
|
||||
data: T[];
|
||||
spacingInner?: number;
|
||||
spacingOuter?: number;
|
||||
formatLabel?: (value: any, index: number) => number | string;
|
||||
scale?: ScaleFunction;
|
||||
numberOfTicks?: number;
|
||||
svg?: Partial<TextProps>;
|
||||
}
|
||||
|
||||
// XAxis
|
||||
|
||||
export interface XAxisProps<T> extends AxisProps<T> {
|
||||
contentInset?: {
|
||||
left?: number;
|
||||
right?: number
|
||||
};
|
||||
xAccessor?: AccessorFunction<T, any>;
|
||||
}
|
||||
|
||||
export class XAxis<T> extends React.PureComponent<XAxisProps<T>> {
|
||||
}
|
||||
|
||||
// YAxis
|
||||
|
||||
export interface YAxisProps<T> extends AxisProps<T> {
|
||||
style?: StyleProp<ViewStyle>;
|
||||
contentInset?: {
|
||||
top?: number;
|
||||
bottom?: number;
|
||||
};
|
||||
min?: number;
|
||||
max?: number;
|
||||
yAccessor?: AccessorFunction<T, any>;
|
||||
}
|
||||
|
||||
export class YAxis<T> extends React.PureComponent<YAxisProps<T>> {
|
||||
}
|
||||
|
||||
// Progress Circle
|
||||
|
||||
export interface ProgressCircleProps {
|
||||
progress: number;
|
||||
style?: StyleProp<ViewStyle>;
|
||||
progressColor?: string;
|
||||
backgroundColor?: string;
|
||||
strokeWidth?: number;
|
||||
startAngle?: number;
|
||||
endAngle?: number;
|
||||
animate?: boolean;
|
||||
animateDuration?: number;
|
||||
}
|
||||
|
||||
export class ProgressCircle extends React.PureComponent<ProgressCircleProps> {
|
||||
}
|
||||
|
||||
// Horizontal Line
|
||||
|
||||
export interface HorizontalLineProps {
|
||||
stroke: string;
|
||||
}
|
||||
|
||||
// Point
|
||||
|
||||
export interface PointProps {
|
||||
x: (index: number) => number;
|
||||
y: (value: number) => number;
|
||||
value?: number;
|
||||
radius?: number;
|
||||
index?: number;
|
||||
color: string;
|
||||
}
|
||||
|
||||
// Tooltip
|
||||
|
||||
export interface TooltipProps {
|
||||
x: (index: number) => number;
|
||||
y: (value: number) => number;
|
||||
value?: number;
|
||||
index?: number;
|
||||
height?: number;
|
||||
stroke?: string;
|
||||
text: string;
|
||||
pointStroke?: string;
|
||||
}
|
||||
|
||||
export namespace Decorators {
|
||||
class HorizontalLine extends React.Component<HorizontalLineProps> {}
|
||||
class Point extends React.Component<PointProps> {}
|
||||
class Tooltip extends React.Component<TooltipProps> {}
|
||||
}
|
||||
|
||||
export type GridDirection = 'VERTICAL' | 'HORIZONTAL' | 'BOTH';
|
||||
|
||||
export interface GridProps<T> {
|
||||
direction?: GridDirection;
|
||||
belowChart?: boolean;
|
||||
svg?: Partial<LineProps>;
|
||||
ticks?: T[];
|
||||
x?: (t: T) => number;
|
||||
y?: (t: T) => number;
|
||||
}
|
||||
|
||||
// Export as Component despite it's SFC.
|
||||
export class Grid<T> extends React.Component<GridProps<T>> {
|
||||
static Direction: {
|
||||
VERTICAL: 'VERTICAL',
|
||||
HORIZONTAL: 'HORIZONTAL',
|
||||
BOTH: 'BOTH',
|
||||
};
|
||||
}
|
||||
|
||||
export interface AnimatedPathProps extends CommonPathProps {
|
||||
animated?: boolean;
|
||||
animationDuration?: number;
|
||||
renderPlaceholder?: () => any;
|
||||
}
|
||||
|
||||
export class Path extends React.Component<AnimatedPathProps> {
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"private": true,
|
||||
"dependencies": {
|
||||
"react-native-svg": "^6.2.1"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,74 @@
|
||||
import * as React from 'react';
|
||||
import { Defs, LinearGradient, Stop } from 'react-native-svg';
|
||||
import { StackedAreaChart, XAxis, Grid } from 'react-native-svg-charts';
|
||||
import { curveNatural } from 'd3-shape';
|
||||
import { scaleTime } from 'd3-scale';
|
||||
|
||||
interface Data {
|
||||
time: number;
|
||||
cpuUsage: number;
|
||||
totalMemoryConsumption: number;
|
||||
privateMemoryConsumption: number;
|
||||
}
|
||||
|
||||
interface Props {
|
||||
data: Data[];
|
||||
width: number;
|
||||
}
|
||||
|
||||
class Example extends React.Component<Props> {
|
||||
render() {
|
||||
const { data, width } = this.props;
|
||||
return (
|
||||
<StackedAreaChart
|
||||
style={{ height: 200 }}
|
||||
data={data}
|
||||
keys={['totalMemoryConsumption', 'privateMemoryConsumption']}
|
||||
colors={['url(#totalMemoryConsumption)', 'url(#privateMemoryConsumption)']}
|
||||
contentInset={{ top: 20 }}
|
||||
curve={curveNatural}
|
||||
showGrid={true}
|
||||
animate={true}
|
||||
animationDuration={350}
|
||||
numberOfTicks={10}
|
||||
|
||||
>
|
||||
<Defs key="defs">
|
||||
<LinearGradient id="totalMemoryConsumption" x1="0%" y1="0%" x2="0%" y2="100%">
|
||||
<Stop offset="0%" stopColor="#4ccfef" stopOpacity={0.9} />
|
||||
<Stop offset="100%" stopColor="#182b41" stopOpacity={0.9} />
|
||||
</LinearGradient>
|
||||
<LinearGradient id="privateMemoryConsumption" x1="0%" y1="0%" x2="0%" y2="100%">
|
||||
<Stop offset="0%" stopColor="#a1d343" stopOpacity={0.8} />
|
||||
<Stop offset="100%" stopColor="#a1d343" stopOpacity={0.3} />
|
||||
</LinearGradient>
|
||||
</Defs>
|
||||
<XAxis
|
||||
data={data}
|
||||
formatLabel={(value) => new Date(value).toTimeString()}
|
||||
numberOfTicks={8}
|
||||
scale={scaleTime}
|
||||
contentInset={{ left: 10, right: 10 }}
|
||||
svg={{
|
||||
fillOpacity: .2,
|
||||
fill: '#fff',
|
||||
fontFamily: 'Regular',
|
||||
fontSize: 10,
|
||||
}}
|
||||
xAccessor={({ item }) => item.time}
|
||||
/>
|
||||
<Grid
|
||||
direction="BOTH"
|
||||
ticks={[20, 40, 60, 80]}
|
||||
x={x => x * width}
|
||||
y={y => y * width}
|
||||
svg={{
|
||||
stroke: '#fff',
|
||||
strokeOpacity: .2,
|
||||
}}
|
||||
belowChart={true}
|
||||
/>
|
||||
</StackedAreaChart>
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6",
|
||||
"dom"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"jsx": "react"
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"react-native-svg-charts-tests.tsx"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
+17
-17
@@ -1,9 +1,9 @@
|
||||
// Type definitions for react-native-tab-view 0.0
|
||||
// Type definitions for react-native-tab-view 1.0
|
||||
// Project: https://github.com/react-native-community/react-native-tab-view
|
||||
// Definitions by: Kalle Ott <https://github.com/kaoDev>
|
||||
// Kyle Roach <https://github.com/iRoachie>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.6
|
||||
|
||||
import { PureComponent, ReactNode, ComponentType } from 'react'
|
||||
import {
|
||||
Animated,
|
||||
@@ -39,7 +39,7 @@ export type SceneRendererProps<T extends RouteBase = RouteBase> = {
|
||||
}
|
||||
navigationState: NavigationState<T>
|
||||
position: Animated.Value
|
||||
jumpToIndex: (index: number) => void
|
||||
jumpTo: (key: string) => void
|
||||
getLastPosition: () => number
|
||||
subscribe: (
|
||||
event: SubscriptionName,
|
||||
@@ -75,24 +75,24 @@ export type PagerProps = {
|
||||
children?: ReactNode
|
||||
}
|
||||
|
||||
export type TabViewAnimatedProps<
|
||||
export type TabViewProps<
|
||||
T extends RouteBase = RouteBase
|
||||
> = PagerProps & {
|
||||
navigationState: NavigationState<T>
|
||||
tabBarPosition?: 'bottom' | 'top'
|
||||
onIndexChange: (index: number) => void
|
||||
onPositionChange?: (props: { value: number }) => void
|
||||
initialLayout?: Layout
|
||||
canJumpToTab?: (route: T) => boolean
|
||||
renderPager?: (props: SceneRendererProps<T> & PagerProps) => ReactNode
|
||||
renderScene: (props: SceneRendererProps<T> & Scene<T>) => ReactNode
|
||||
renderHeader?: (props: SceneRendererProps<T>) => ReactNode
|
||||
renderFooter?: (props: SceneRendererProps<T>) => ReactNode
|
||||
renderTabBar?: (props: SceneRendererProps<T>) => ReactNode
|
||||
lazy?: boolean
|
||||
style?: StyleProp<ViewStyle>
|
||||
}
|
||||
|
||||
export class TabViewAnimated<T extends Route = Route> extends PureComponent<
|
||||
TabViewAnimatedProps<T>,
|
||||
export class TabView<T extends Route = Route> extends PureComponent<
|
||||
TabViewProps<T>,
|
||||
any
|
||||
> {}
|
||||
|
||||
@@ -125,7 +125,7 @@ export type GestureState = {
|
||||
|
||||
export type GestureHandler = (event: GestureEvent, state: GestureState) => void
|
||||
|
||||
export type TabViewPagerPanProps<
|
||||
export type PagerPanProps<
|
||||
T extends RouteBase = RouteBase
|
||||
> = SceneRendererProps<T> & {
|
||||
configureTransition?: TransitionConfigurator
|
||||
@@ -144,8 +144,8 @@ export type DefaultTransitionSpec = {
|
||||
friction: 35
|
||||
}
|
||||
|
||||
export class TabViewPagerPan<T extends Route = Route> extends PureComponent<
|
||||
TabViewPagerPanProps<T>,
|
||||
export class PagerPan<T extends Route = Route> extends PureComponent<
|
||||
PagerPanProps<T>,
|
||||
void
|
||||
> {
|
||||
static defaultProps: {
|
||||
@@ -168,7 +168,7 @@ export type ScrollEvent = {
|
||||
}
|
||||
}
|
||||
|
||||
export type TabViewPagerScrollProps<
|
||||
export type PagerScrollProps<
|
||||
T extends RouteBase = RouteBase
|
||||
> = SceneRendererProps<T> & {
|
||||
animationEnabled?: boolean
|
||||
@@ -176,8 +176,8 @@ export type TabViewPagerScrollProps<
|
||||
children?: ReactNode
|
||||
}
|
||||
|
||||
export class TabViewPagerScroll<T extends Route = Route> extends PureComponent<
|
||||
TabViewPagerScrollProps<T>,
|
||||
export class PagerScroll<T extends Route = Route> extends PureComponent<
|
||||
PagerScrollProps<T>,
|
||||
any
|
||||
> {}
|
||||
|
||||
@@ -190,7 +190,7 @@ export type PageScrollEvent = {
|
||||
|
||||
export type PageScrollState = 'dragging' | 'settling' | 'idle'
|
||||
|
||||
export type TabViewPagerAndroidProps<
|
||||
export type PagerAndroidProps<
|
||||
T extends RouteBase = RouteBase
|
||||
> = SceneRendererProps<T> & {
|
||||
animationEnabled?: boolean
|
||||
@@ -198,8 +198,8 @@ export type TabViewPagerAndroidProps<
|
||||
children?: ReactNode
|
||||
}
|
||||
|
||||
export class TabViewPagerAndroid<T extends Route = Route> extends PureComponent<
|
||||
TabViewPagerAndroidProps<T>,
|
||||
export class PagerAndroid<T extends Route = Route> extends PureComponent<
|
||||
PagerAndroidProps<T>,
|
||||
void
|
||||
> {}
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { PureComponent, Component } from 'react'
|
||||
import { View, StyleSheet } from 'react-native'
|
||||
import {
|
||||
TabViewAnimated,
|
||||
TabView,
|
||||
TabBar,
|
||||
SceneMap,
|
||||
TabBarProps,
|
||||
@@ -31,7 +31,7 @@ class TabViewExample extends PureComponent {
|
||||
|
||||
_handleIndexChange = (index: number) => this.setState({ index })
|
||||
|
||||
_renderHeader = (props: TabBarProps) => <TabBar {...props} />
|
||||
_renderTabBar = (props: TabBarProps) => <TabBar {...props} />
|
||||
|
||||
_renderScene = SceneMap({
|
||||
first: FirstRoute,
|
||||
@@ -40,11 +40,12 @@ class TabViewExample extends PureComponent {
|
||||
|
||||
render() {
|
||||
return (
|
||||
<TabViewAnimated
|
||||
<TabView
|
||||
style={styles.container}
|
||||
navigationState={this.state}
|
||||
renderScene={this._renderScene}
|
||||
renderHeader={this._renderHeader}
|
||||
renderTabBar={this._renderTabBar}
|
||||
tabBarPosition="top"
|
||||
onIndexChange={this._handleIndexChange}
|
||||
/>
|
||||
)
|
||||
|
||||
Vendored
+2
@@ -479,6 +479,8 @@ export namespace AppRegistry {
|
||||
function runApplication(appKey: string, appParameters: any): void;
|
||||
|
||||
function registerHeadlessTask(appKey: string, task: TaskProvider): void;
|
||||
|
||||
function getRunnable(appKey: string): Runnable | undefined;
|
||||
}
|
||||
|
||||
export interface LayoutAnimationTypes {
|
||||
|
||||
Vendored
+321
-176
@@ -1,4 +1,4 @@
|
||||
// Type definitions for react-navigation 1.5
|
||||
// Type definitions for react-navigation 2.0
|
||||
// Project: https://github.com/react-navigation/react-navigation
|
||||
// Definitions by: Huhuanming <https://github.com/huhuanming>
|
||||
// mhcgrq <https://github.com/mhcgrq>
|
||||
@@ -16,11 +16,12 @@
|
||||
// Armando Assuncao <https://github.com/ArmandoAssuncao>
|
||||
// Ciaran Liedeman <https://github.com/cliedeman>
|
||||
// Edward Sammut Alessi <https://github.com/Slessi>
|
||||
// Jérémy Magrin <https://github.com/magrinj>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.6
|
||||
|
||||
/**
|
||||
* Reference: https://github.com/react-navigation/react-navigation/tree/3f3ef6485c8932f49fddc3dd2c508629110bf2b6
|
||||
* Reference: https://github.com/react-navigation/react-navigation/tree/a37473c5e4833f48796ee6c7c9cb4a8ac49d9c06
|
||||
*
|
||||
* NOTE: Please update the commit/link above when updating to a new Flow
|
||||
* react-navigation/flow/react-navigation.js reference, so we can conveniently just look at diffs on
|
||||
@@ -43,15 +44,24 @@ export type AnimatedValue = any;
|
||||
|
||||
export type HeaderMode = 'float' | 'screen' | 'none';
|
||||
|
||||
export interface HeaderForceInset {
|
||||
horizontal?: string;
|
||||
vertical?: string;
|
||||
left?: string;
|
||||
right?: string;
|
||||
top?: string;
|
||||
bottom?: string;
|
||||
}
|
||||
|
||||
export interface HeaderProps extends NavigationSceneRendererProps {
|
||||
mode: HeaderMode;
|
||||
router: NavigationRouter<
|
||||
NavigationState,
|
||||
NavigationStackScreenOptions
|
||||
>;
|
||||
getScreenDetails: (navigationScene: NavigationScene) => NavigationScreenDetails<
|
||||
NavigationStackScreenOptions
|
||||
>;
|
||||
router: NavigationRouter<NavigationState, NavigationStackScreenOptions>;
|
||||
getScreenDetails: (
|
||||
navigationScene: NavigationScene
|
||||
) => NavigationScreenDetails<NavigationStackScreenOptions>;
|
||||
leftInterpolator: (props: NavigationSceneRendererProps) => {};
|
||||
titleInterpolator: (props: NavigationSceneRendererProps) => {};
|
||||
rightInterpolator: (props: NavigationSceneRendererProps) => {};
|
||||
style: StyleProp<ViewStyle>;
|
||||
}
|
||||
|
||||
@@ -73,12 +83,14 @@ export interface NavigationState {
|
||||
* Index refers to the active child route in the routes array.
|
||||
*/
|
||||
index: number;
|
||||
routes: any[];
|
||||
routes: NavigationRoute[];
|
||||
}
|
||||
|
||||
export type NavigationRoute<Params = NavigationParams> = NavigationLeafRoute<Params> | NavigationStateRoute<Params>;
|
||||
export type NavigationRoute<Params = NavigationParams> =
|
||||
| NavigationLeafRoute<Params>
|
||||
| NavigationStateRoute<Params>;
|
||||
|
||||
export interface NavigationLeafRoute<Params> {
|
||||
export interface NavigationLeafRoute<Params = NavigationParams> {
|
||||
/**
|
||||
* React's key used by some navigators. No need to specify these manually,
|
||||
* they will be defined by the router.
|
||||
@@ -100,7 +112,9 @@ export interface NavigationLeafRoute<Params> {
|
||||
params?: Params;
|
||||
}
|
||||
|
||||
export type NavigationStateRoute<NavigationLeafRouteParams> = NavigationLeafRoute<NavigationLeafRouteParams> & NavigationState;
|
||||
export type NavigationStateRoute<
|
||||
NavigationLeafRouteParams
|
||||
> = NavigationLeafRoute<NavigationLeafRouteParams> & NavigationState;
|
||||
|
||||
export type NavigationScreenOptionsGetter<Options> = (
|
||||
navigation: NavigationScreenProp<NavigationRoute<any>>,
|
||||
@@ -113,7 +127,10 @@ export interface NavigationRouter<State = NavigationState, Options = {}> {
|
||||
* an optional previous state. When the action is considered handled but the
|
||||
* state is unchanged, the output state is null.
|
||||
*/
|
||||
getStateForAction: (action: NavigationAction, lastState?: State) => (State | null);
|
||||
getStateForAction: (
|
||||
action: NavigationAction,
|
||||
lastState?: State
|
||||
) => State | null;
|
||||
|
||||
/**
|
||||
* Maps a URI-like string to an action. This can be mapped to a state
|
||||
@@ -122,14 +139,14 @@ export interface NavigationRouter<State = NavigationState, Options = {}> {
|
||||
getActionForPathAndParams: (
|
||||
path: string,
|
||||
params?: NavigationParams
|
||||
) => (NavigationAction | null);
|
||||
) => NavigationAction | null;
|
||||
|
||||
getPathAndParamsForState: (
|
||||
state: State
|
||||
) => {
|
||||
path: string,
|
||||
params?: NavigationParams,
|
||||
};
|
||||
path: string;
|
||||
params?: NavigationParams;
|
||||
};
|
||||
|
||||
getComponentForRouteName: (routeName: string) => NavigationComponent;
|
||||
|
||||
@@ -147,11 +164,8 @@ export interface NavigationRouter<State = NavigationState, Options = {}> {
|
||||
}
|
||||
|
||||
export type NavigationScreenOption<T> =
|
||||
T
|
||||
| ((
|
||||
navigation: NavigationScreenProp<NavigationRoute>,
|
||||
config: T
|
||||
) => T);
|
||||
| T
|
||||
| ((navigation: NavigationScreenProp<NavigationRoute>, config: T) => T);
|
||||
|
||||
export interface NavigationScreenDetails<T> {
|
||||
options: T;
|
||||
@@ -159,7 +173,9 @@ export interface NavigationScreenDetails<T> {
|
||||
navigation: NavigationScreenProp<NavigationRoute>;
|
||||
}
|
||||
|
||||
export type NavigationScreenOptions = NavigationStackScreenOptions & NavigationTabScreenOptions & NavigationDrawerScreenOptions;
|
||||
export type NavigationScreenOptions = NavigationStackScreenOptions &
|
||||
NavigationTabScreenOptions &
|
||||
NavigationDrawerScreenOptions;
|
||||
|
||||
export interface NavigationScreenConfigProps {
|
||||
navigation: NavigationScreenProp<NavigationRoute>;
|
||||
@@ -167,30 +183,34 @@ export interface NavigationScreenConfigProps {
|
||||
}
|
||||
|
||||
export type NavigationScreenConfig<Options> =
|
||||
Options
|
||||
| ((navigationOptionsContainer: NavigationScreenConfigProps & {
|
||||
navigationOptions: NavigationScreenProp<NavigationRoute>,
|
||||
}) => Options);
|
||||
| Options
|
||||
| ((
|
||||
navigationOptionsContainer: NavigationScreenConfigProps & {
|
||||
navigationOptions: NavigationScreenProp<NavigationRoute>;
|
||||
}
|
||||
) => Options);
|
||||
|
||||
export type NavigationComponent =
|
||||
NavigationScreenComponent<any, any, any>
|
||||
| NavigationNavigator<any, any, any>;
|
||||
| NavigationScreenComponent<NavigationParams, any, any>
|
||||
| NavigationNavigator<any, any, any>
|
||||
| any;
|
||||
|
||||
export type NavigationScreenComponent<
|
||||
Params = NavigationParams,
|
||||
Options = {},
|
||||
Props = {}
|
||||
> = React.ComponentType<NavigationScreenProps<Params, Options> & Props> &
|
||||
{ navigationOptions?: NavigationScreenConfig<Options> };
|
||||
Params = NavigationParams,
|
||||
Options = {},
|
||||
Props = {}
|
||||
> = React.ComponentType<NavigationScreenProps<Params, Options> & Props> & {
|
||||
navigationOptions?: NavigationScreenConfig<Options>;
|
||||
};
|
||||
|
||||
export type NavigationNavigator<
|
||||
State = NavigationState,
|
||||
Options = {},
|
||||
Props = {}
|
||||
> = React.ComponentType<NavigationNavigatorProps<Options, State> & Props> & {
|
||||
router: NavigationRouter<State, Options>,
|
||||
navigationOptions?: NavigationScreenConfig<Options>,
|
||||
};
|
||||
State = NavigationState,
|
||||
Options = {},
|
||||
Props = {}
|
||||
> = React.ComponentType<NavigationNavigatorProps<Options, State> & Props> & {
|
||||
router: NavigationRouter<State, Options>;
|
||||
navigationOptions?: NavigationScreenConfig<Options>;
|
||||
};
|
||||
|
||||
export interface NavigationParams {
|
||||
[key: string]: any;
|
||||
@@ -206,7 +226,8 @@ export interface NavigationNavigateActionPayload {
|
||||
key?: string;
|
||||
}
|
||||
|
||||
export interface NavigationNavigateAction extends NavigationNavigateActionPayload {
|
||||
export interface NavigationNavigateAction
|
||||
extends NavigationNavigateActionPayload {
|
||||
type: 'Navigation/NAVIGATE';
|
||||
}
|
||||
|
||||
@@ -226,7 +247,8 @@ export interface NavigationSetParamsActionPayload {
|
||||
params?: NavigationParams;
|
||||
}
|
||||
|
||||
export interface NavigationSetParamsAction extends NavigationSetParamsActionPayload {
|
||||
export interface NavigationSetParamsAction
|
||||
extends NavigationSetParamsActionPayload {
|
||||
type: 'Navigation/SET_PARAMS';
|
||||
}
|
||||
|
||||
@@ -271,40 +293,70 @@ export interface NavigationPopToTopActionPayload {
|
||||
immediate?: boolean;
|
||||
}
|
||||
|
||||
export interface NavigationPopToTopAction extends NavigationPopToTopActionPayload {
|
||||
export interface NavigationPopToTopAction
|
||||
extends NavigationPopToTopActionPayload {
|
||||
type: 'Navigation/POP_TO_TOP';
|
||||
}
|
||||
|
||||
export interface NavigationStackViewConfig {
|
||||
mode?: 'card' | 'modal';
|
||||
headerMode?: HeaderMode;
|
||||
headerTransitionPreset?: 'fade-in-place' | 'uikit';
|
||||
cardStyle?: StyleProp<ViewStyle>;
|
||||
transitionConfig?: (
|
||||
transitionProps: NavigationTransitionProps,
|
||||
prevTransitionProps: NavigationTransitionProps,
|
||||
isModal: boolean,
|
||||
isModal: boolean
|
||||
) => TransitionConfig;
|
||||
onTransitionStart?: (transitionProps: NavigationTransitionProps, prevTransitionProps?: NavigationTransitionProps) => Promise<void> | void;
|
||||
onTransitionEnd?: (transitionProps: NavigationTransitionProps, prevTransitionProps?: NavigationTransitionProps) => void;
|
||||
onTransitionStart?: (
|
||||
transitionProps: NavigationTransitionProps,
|
||||
prevTransitionProps?: NavigationTransitionProps
|
||||
) => Promise<void> | void;
|
||||
onTransitionEnd?: (
|
||||
transitionProps: NavigationTransitionProps,
|
||||
prevTransitionProps?: NavigationTransitionProps
|
||||
) => void;
|
||||
}
|
||||
|
||||
/**
|
||||
* Switch Navigator
|
||||
*/
|
||||
|
||||
export interface NavigationSwitchRouterConfig {
|
||||
initialRouteName?: string;
|
||||
initialRouteParams?: NavigationParams;
|
||||
paths?: NavigationPathsConfig;
|
||||
navigationOptions?: NavigationScreenConfig<NavigationScreenOptions>;
|
||||
order?: string[];
|
||||
backBehavior?: 'none' | 'initialRoute'; // defaults to `'none'`
|
||||
resetOnBlur?: boolean; // defaults to `true`
|
||||
}
|
||||
|
||||
export interface NavigationStackScreenOptions {
|
||||
title?: string;
|
||||
header?: (React.ReactElement<any> | ((headerProps: HeaderProps) => React.ReactElement<any>)) | null;
|
||||
header?:
|
||||
| (
|
||||
| React.ReactElement<any>
|
||||
| ((headerProps: HeaderProps) => React.ReactElement<any>))
|
||||
| null;
|
||||
headerTransparent?: boolean;
|
||||
headerTitle?: string | React.ReactElement<any>;
|
||||
headerTitleStyle?: StyleProp<TextStyle>;
|
||||
headerTitleAllowFontScaling?: boolean;
|
||||
headerTintColor?: string;
|
||||
headerLeft?: React.ReactElement<any>;
|
||||
headerBackTitle?: string | null;
|
||||
headerBackImage?: React.ReactElement<any>;
|
||||
headerTruncatedBackTitle?: string;
|
||||
headerBackTitleStyle?: StyleProp<TextStyle>;
|
||||
headerPressColorAndroid?: string;
|
||||
headerRight?: React.ReactElement<any>;
|
||||
headerStyle?: StyleProp<ViewStyle>;
|
||||
headerForceInset?: HeaderForceInset;
|
||||
headerBackground?: React.ReactNode | React.ReactType;
|
||||
gesturesEnabled?: boolean;
|
||||
gestureResponseDistance?: { vertical?: number; horizontal?: number };
|
||||
gestureDirection?: 'default' | 'inverted';
|
||||
}
|
||||
|
||||
export interface NavigationStackRouterConfig {
|
||||
@@ -317,7 +369,7 @@ export interface NavigationStackRouterConfig {
|
||||
}
|
||||
|
||||
export type NavigationStackAction =
|
||||
NavigationInitAction
|
||||
| NavigationInitAction
|
||||
| NavigationNavigateAction
|
||||
| NavigationBackAction
|
||||
| NavigationSetParamsAction
|
||||
@@ -326,25 +378,30 @@ export type NavigationStackAction =
|
||||
| NavigationPopToTopAction;
|
||||
|
||||
export type NavigationTabAction =
|
||||
NavigationInitAction
|
||||
| NavigationInitAction
|
||||
| NavigationNavigateAction
|
||||
| NavigationBackAction;
|
||||
|
||||
export type NavigationAction =
|
||||
NavigationInitAction
|
||||
| NavigationInitAction
|
||||
| NavigationStackAction
|
||||
| NavigationTabAction;
|
||||
|
||||
export type NavigationRouteConfig = NavigationComponent | ({
|
||||
navigationOptions?: NavigationScreenConfig<any>,
|
||||
path?: string,
|
||||
} & NavigationScreenRouteConfig);
|
||||
export type NavigationRouteConfig =
|
||||
| NavigationComponent
|
||||
| ({
|
||||
navigationOptions?: NavigationScreenConfig<any>;
|
||||
path?: string;
|
||||
} & NavigationScreenRouteConfig);
|
||||
|
||||
export type NavigationScreenRouteConfig = NavigationComponent | {
|
||||
screen: NavigationComponent,
|
||||
} | {
|
||||
getScreen: () => NavigationComponent,
|
||||
};
|
||||
export type NavigationScreenRouteConfig =
|
||||
| NavigationComponent
|
||||
| {
|
||||
screen: NavigationComponent;
|
||||
}
|
||||
| {
|
||||
getScreen: () => NavigationComponent;
|
||||
};
|
||||
|
||||
export interface NavigationPathsConfig {
|
||||
[routeName: string]: string;
|
||||
@@ -352,6 +409,7 @@ export interface NavigationPathsConfig {
|
||||
|
||||
export interface NavigationTabRouterConfig {
|
||||
initialRouteName?: string;
|
||||
initialRouteParams?: NavigationParams;
|
||||
paths?: NavigationPathsConfig;
|
||||
navigationOptions?: NavigationScreenConfig<NavigationScreenOptions>;
|
||||
order?: string[]; // todo: type these as the real route names rather than 'string'
|
||||
@@ -360,45 +418,48 @@ export interface NavigationTabRouterConfig {
|
||||
backBehavior?: 'none' | 'initialRoute'; // defaults `initialRoute`
|
||||
}
|
||||
export interface TabScene {
|
||||
route: NavigationRoute;
|
||||
focused: boolean;
|
||||
index: number;
|
||||
tintColor?: string;
|
||||
route: NavigationRoute;
|
||||
focused: boolean;
|
||||
index: number;
|
||||
tintColor?: string;
|
||||
}
|
||||
export interface NavigationTabScreenOptions {
|
||||
title?: string;
|
||||
tabBarIcon?:
|
||||
React.ReactElement<any>
|
||||
| ((options: { tintColor: (string | null), focused: boolean }) => (React.ReactElement<
|
||||
any
|
||||
> | null));
|
||||
| React.ReactElement<any>
|
||||
| ((
|
||||
options: { tintColor: string | null; focused: boolean }
|
||||
) => React.ReactElement<any> | null);
|
||||
tabBarLabel?:
|
||||
string
|
||||
| React.ReactElement<any>
|
||||
| ((options: { tintColor: (string | null), focused: boolean }) => (React.ReactElement<
|
||||
any
|
||||
> | string | null));
|
||||
| string
|
||||
| React.ReactElement<any>
|
||||
| ((
|
||||
options: { tintColor: string | null; focused: boolean }
|
||||
) => React.ReactElement<any> | string | null);
|
||||
tabBarVisible?: boolean;
|
||||
tabBarTestIDProps?: { testID?: string, accessibilityLabel?: string };
|
||||
tabBarOnPress?: (options: {
|
||||
scene: TabScene,
|
||||
jumpToIndex: (index: number) => void
|
||||
}) => void;
|
||||
tabBarTestIDProps?: { testID?: string; accessibilityLabel?: string };
|
||||
tabBarOnPress?: (
|
||||
options: {
|
||||
scene: TabScene;
|
||||
jumpToIndex: (index: number) => void;
|
||||
}
|
||||
) => void;
|
||||
}
|
||||
|
||||
export interface NavigationDrawerScreenOptions {
|
||||
title?: string;
|
||||
drawerIcon?:
|
||||
React.ReactElement<any>
|
||||
| ((options: { tintColor: (string | null), focused: boolean }) => (React.ReactElement<
|
||||
any
|
||||
> | null));
|
||||
| React.ReactElement<any>
|
||||
| ((
|
||||
options: { tintColor: string | null; focused: boolean }
|
||||
) => React.ReactElement<any> | null);
|
||||
drawerLabel?:
|
||||
string
|
||||
| React.ReactElement<any>
|
||||
| ((options: { tintColor: (string | null), focused: boolean }) => (React.ReactElement<
|
||||
any
|
||||
> | null));
|
||||
| string
|
||||
| React.ReactElement<any>
|
||||
| ((
|
||||
options: { tintColor: string | null; focused: boolean }
|
||||
) => React.ReactElement<any> | null);
|
||||
drawerLockMode?: 'unlocked' | 'locked-closed' | 'locked-open';
|
||||
}
|
||||
|
||||
export interface NavigationRouteConfigMap {
|
||||
@@ -413,22 +474,20 @@ export interface NavigationProp<S> {
|
||||
}
|
||||
|
||||
export type EventType =
|
||||
| 'willFocus'
|
||||
| 'didFocus'
|
||||
| 'willBlur'
|
||||
| 'didBlur'
|
||||
| 'action';
|
||||
| 'willFocus'
|
||||
| 'didFocus'
|
||||
| 'willBlur'
|
||||
| 'didBlur'
|
||||
| 'action';
|
||||
|
||||
export interface NavigationEventPayload {
|
||||
type: EventType;
|
||||
action: NavigationAction;
|
||||
state: NavigationState;
|
||||
lastState: NavigationState;
|
||||
lastState: NavigationState | null | undefined;
|
||||
}
|
||||
|
||||
export type NavigationEventCallback = (
|
||||
payload: NavigationEventPayload
|
||||
) => void;
|
||||
export type NavigationEventCallback = (payload: NavigationEventPayload) => void;
|
||||
|
||||
export interface NavigationEventSubscription {
|
||||
remove: () => void;
|
||||
@@ -438,8 +497,14 @@ export interface NavigationScreenProp<S, P = NavigationParams> {
|
||||
state: S;
|
||||
dispatch: NavigationDispatch;
|
||||
goBack: (routeKey?: string | null) => boolean;
|
||||
dismiss: () => boolean;
|
||||
navigate(options: {
|
||||
routeName: string;
|
||||
routeName: string | {
|
||||
routeName: string;
|
||||
params?: NavigationParams;
|
||||
action?: NavigationNavigateAction;
|
||||
key?: string;
|
||||
};
|
||||
params?: NavigationParams;
|
||||
action?: NavigationAction;
|
||||
key?: string;
|
||||
@@ -447,8 +512,11 @@ export interface NavigationScreenProp<S, P = NavigationParams> {
|
||||
navigate(
|
||||
routeNameOrOptions: string,
|
||||
params?: NavigationParams,
|
||||
action?: NavigationAction,
|
||||
action?: NavigationAction
|
||||
): boolean;
|
||||
openDrawer: () => any;
|
||||
closeDrawer: () => any;
|
||||
toggleDrawer: () => any;
|
||||
getParam: <T extends keyof P>(param: T, fallback?: P[T]) => P[T];
|
||||
setParams: (newParams: P) => boolean;
|
||||
addListener: (
|
||||
@@ -467,6 +535,7 @@ export interface NavigationScreenProp<S, P = NavigationParams> {
|
||||
) => boolean;
|
||||
pop: (n?: number, params?: { immediate?: boolean }) => boolean;
|
||||
popToTop: (params?: { immediate?: boolean }) => boolean;
|
||||
isFocused: () => boolean;
|
||||
}
|
||||
|
||||
export interface NavigationNavigatorProps<O = {}, S = {}> {
|
||||
@@ -550,6 +619,14 @@ export interface TransitionConfig {
|
||||
// How to animate position and opacity of the screen
|
||||
// based on the value generated by the transitionSpec
|
||||
screenInterpolator?: (props: NavigationSceneRendererProps) => any;
|
||||
// How to animate position and opacity of the header componetns
|
||||
// based on the value generated by the transitionSpec
|
||||
headerLeftInterpolator?: (props: NavigationSceneRendererProps) => any;
|
||||
headerTitleInterpolator?: (props: NavigationSceneRendererProps) => any;
|
||||
headerRightInterpolator?: (props: NavigationSceneRendererProps) => any;
|
||||
// The style of the container. Useful when a scene doesn't have
|
||||
// 100% opacity and the underlying container is visible.
|
||||
containerStyle?: StyleProp<ViewStyle>;
|
||||
}
|
||||
|
||||
export type NavigationAnimationSetter = (
|
||||
@@ -558,7 +635,7 @@ export type NavigationAnimationSetter = (
|
||||
lastState: NavigationState
|
||||
) => void;
|
||||
|
||||
export type NavigationSceneRenderer = () => (React.ReactElement<any> | null);
|
||||
export type NavigationSceneRenderer = () => React.ReactElement<any> | null;
|
||||
|
||||
export type NavigationStyleInterpolator = (
|
||||
props: NavigationSceneRendererProps
|
||||
@@ -567,50 +644,49 @@ export type NavigationStyleInterpolator = (
|
||||
export interface LayoutEvent {
|
||||
nativeEvent: {
|
||||
layout: {
|
||||
x: number,
|
||||
y: number,
|
||||
width: number,
|
||||
height: number,
|
||||
},
|
||||
x: number;
|
||||
y: number;
|
||||
width: number;
|
||||
height: number;
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
export type NavigatorType =
|
||||
| 'react-navigation/STACK'
|
||||
| 'react-navigation/TABS'
|
||||
| 'react-navigation/DRAWER';
|
||||
| 'react-navigation/STACK'
|
||||
| 'react-navigation/TABS'
|
||||
| 'react-navigation/DRAWER';
|
||||
|
||||
export function addNavigationHelpers<S = {}>(
|
||||
navigation: {
|
||||
state: S;
|
||||
dispatch: (action: NavigationAction) => any;
|
||||
addListener?: (
|
||||
eventName: string,
|
||||
callback: NavigationEventCallback
|
||||
) => NavigationEventSubscription;
|
||||
}
|
||||
): NavigationScreenProp<S>;
|
||||
|
||||
export interface NavigationContainerProps {
|
||||
export interface NavigationContainerProps<S = {}, O = {}> {
|
||||
uriPrefix?: string | RegExp;
|
||||
onNavigationStateChange?: (
|
||||
prevNavigationState: NavigationState,
|
||||
nextNavigationState: NavigationState,
|
||||
action: NavigationAction,
|
||||
) => void;
|
||||
action: NavigationAction
|
||||
) => void | null | undefined;
|
||||
navigation?: NavigationScreenProp<S>;
|
||||
persistenceKey?: string | null;
|
||||
renderLoadingExperimental?: React.ComponentType;
|
||||
screenProps?: any;
|
||||
navigationOptions?: O;
|
||||
style?: StyleProp<ViewStyle>;
|
||||
}
|
||||
|
||||
export interface NavigationContainerComponent extends React.Component<
|
||||
export interface NavigationContainerComponent
|
||||
extends React.Component<
|
||||
NavigationContainerProps & NavigationNavigatorProps<any>
|
||||
> {
|
||||
dispatch: NavigationDispatch;
|
||||
}
|
||||
|
||||
export interface NavigationContainer extends React.ComponentClass<
|
||||
export interface NavigationContainer
|
||||
extends React.ComponentClass<
|
||||
NavigationContainerProps & NavigationNavigatorProps<any>
|
||||
> {
|
||||
new(props: NavigationContainerProps & NavigationNavigatorProps<any>, context?: any): NavigationContainerComponent;
|
||||
new(
|
||||
props: NavigationContainerProps & NavigationNavigatorProps<any>,
|
||||
context?: any
|
||||
): NavigationContainerComponent;
|
||||
|
||||
router: NavigationRouter<any, any>;
|
||||
screenProps: { [key: string]: any };
|
||||
@@ -618,14 +694,21 @@ export interface NavigationContainer extends React.ComponentClass<
|
||||
state: { nav: NavigationState | null };
|
||||
}
|
||||
|
||||
export interface StackNavigatorConfig extends NavigationStackViewConfig, NavigationStackRouterConfig {
|
||||
export interface StackNavigatorConfig
|
||||
extends NavigationStackViewConfig,
|
||||
NavigationStackRouterConfig {
|
||||
containerOptions?: any;
|
||||
}
|
||||
|
||||
// Return createNavigationContainer
|
||||
export function StackNavigator(
|
||||
routeConfigMap: NavigationRouteConfigMap,
|
||||
stackConfig?: StackNavigatorConfig,
|
||||
stackConfig?: StackNavigatorConfig
|
||||
): NavigationContainer;
|
||||
|
||||
export function createStackNavigator(
|
||||
routeConfigMap: NavigationRouteConfigMap,
|
||||
stackConfig?: StackNavigatorConfig
|
||||
): NavigationContainer;
|
||||
|
||||
export interface SwitchNavigatorConfig {
|
||||
@@ -636,11 +719,18 @@ export interface SwitchNavigatorConfig {
|
||||
}
|
||||
|
||||
// Return createNavigationContainer
|
||||
export type _SwitchNavigatorConfig = NavigationSwitchRouterConfig;
|
||||
|
||||
export function SwitchNavigator(
|
||||
routeConfigMap: NavigationRouteConfigMap,
|
||||
switchConfig?: SwitchNavigatorConfig
|
||||
): NavigationContainer;
|
||||
|
||||
export function createSwitchNavigator(
|
||||
routeConfigMap: NavigationRouteConfigMap,
|
||||
switchConfig?: SwitchNavigatorConfig
|
||||
): NavigationContainer;
|
||||
|
||||
// DrawerItems
|
||||
export const DrawerItems: React.ReactType;
|
||||
|
||||
@@ -655,21 +745,28 @@ export interface DrawerViewConfig {
|
||||
contentOptions?: any;
|
||||
style?: StyleProp<ViewStyle>;
|
||||
}
|
||||
export interface DrawerNavigatorConfig extends NavigationTabRouterConfig, DrawerViewConfig {
|
||||
export interface DrawerNavigatorConfig
|
||||
extends NavigationTabRouterConfig,
|
||||
DrawerViewConfig {
|
||||
containerConfig?: any;
|
||||
contentOptions?: {
|
||||
activeTintColor?: string,
|
||||
activeBackgroundColor?: string,
|
||||
inactiveTintColor?: string,
|
||||
inactiveBackgroundColor?: string,
|
||||
style?: StyleProp<ViewStyle>,
|
||||
labelStyle?: StyleProp<TextStyle>,
|
||||
activeTintColor?: string;
|
||||
activeBackgroundColor?: string;
|
||||
inactiveTintColor?: string;
|
||||
inactiveBackgroundColor?: string;
|
||||
style?: StyleProp<ViewStyle>;
|
||||
labelStyle?: StyleProp<TextStyle>;
|
||||
};
|
||||
}
|
||||
|
||||
export function DrawerNavigator(
|
||||
routeConfigMap: NavigationRouteConfigMap,
|
||||
drawerConfig?: DrawerNavigatorConfig,
|
||||
drawerConfig?: DrawerNavigatorConfig
|
||||
): NavigationContainer;
|
||||
|
||||
export function createDrawerNavigator(
|
||||
routeConfigMap: NavigationRouteConfigMap,
|
||||
drawerConfig?: DrawerNavigatorConfig
|
||||
): NavigationContainer;
|
||||
|
||||
/**
|
||||
@@ -681,23 +778,23 @@ export interface TabViewConfig {
|
||||
tabBarComponent?: React.ReactType;
|
||||
tabBarPosition?: 'top' | 'bottom';
|
||||
tabBarOptions?: {
|
||||
activeTintColor?: string,
|
||||
allowFontScaling?: boolean,
|
||||
activeBackgroundColor?: string,
|
||||
inactiveTintColor?: string,
|
||||
inactiveBackgroundColor?: string,
|
||||
showLabel?: boolean,
|
||||
style?: StyleProp<ViewStyle>,
|
||||
labelStyle?: StyleProp<TextStyle>,
|
||||
iconStyle?: StyleProp<ViewStyle>,
|
||||
activeTintColor?: string;
|
||||
allowFontScaling?: boolean;
|
||||
activeBackgroundColor?: string;
|
||||
inactiveTintColor?: string;
|
||||
inactiveBackgroundColor?: string;
|
||||
showLabel?: boolean;
|
||||
style?: StyleProp<ViewStyle>;
|
||||
labelStyle?: StyleProp<TextStyle>;
|
||||
iconStyle?: StyleProp<ViewStyle>;
|
||||
// Top
|
||||
showIcon?: boolean,
|
||||
upperCaseLabel?: boolean,
|
||||
pressColor?: string,
|
||||
pressOpacity?: number,
|
||||
scrollEnabled?: boolean,
|
||||
tabStyle?: StyleProp<ViewStyle>,
|
||||
indicatorStyle?: StyleProp<ViewStyle>,
|
||||
showIcon?: boolean;
|
||||
upperCaseLabel?: boolean;
|
||||
pressColor?: string;
|
||||
pressOpacity?: number;
|
||||
scrollEnabled?: boolean;
|
||||
tabStyle?: StyleProp<ViewStyle>;
|
||||
indicatorStyle?: StyleProp<ViewStyle>;
|
||||
};
|
||||
swipeEnabled?: boolean;
|
||||
animationEnabled?: boolean;
|
||||
@@ -705,16 +802,33 @@ export interface TabViewConfig {
|
||||
}
|
||||
|
||||
// From navigators/TabNavigator.js
|
||||
export interface TabNavigatorConfig extends NavigationTabRouterConfig, TabViewConfig {
|
||||
export interface TabNavigatorConfig
|
||||
extends NavigationTabRouterConfig,
|
||||
TabViewConfig {
|
||||
lazy?: boolean;
|
||||
removeClippedSubviews?: boolean;
|
||||
initialLayout?: { height: number, width: number };
|
||||
initialLayout?: { height: number; width: number };
|
||||
}
|
||||
|
||||
// From navigators/TabNavigator.js
|
||||
export function TabNavigator(
|
||||
routeConfigMap: NavigationRouteConfigMap,
|
||||
drawConfig?: TabNavigatorConfig,
|
||||
drawConfig?: TabNavigatorConfig
|
||||
): NavigationContainer;
|
||||
|
||||
export function createTabNavigator(
|
||||
routeConfigMap: NavigationRouteConfigMap,
|
||||
drawConfig?: TabNavigatorConfig
|
||||
): NavigationContainer;
|
||||
|
||||
export function createBottomTabNavigator(
|
||||
routeConfigMap: NavigationRouteConfigMap,
|
||||
drawConfig?: TabNavigatorConfig
|
||||
): NavigationContainer;
|
||||
|
||||
export function createMaterialTopTabNavigator(
|
||||
routeConfigMap: NavigationRouteConfigMap,
|
||||
drawConfig?: TabNavigatorConfig
|
||||
): NavigationContainer;
|
||||
|
||||
export interface TabBarTopProps {
|
||||
@@ -729,15 +843,17 @@ export interface TabBarTopProps {
|
||||
tabBarPosition: string;
|
||||
navigation: NavigationScreenProp<NavigationState>;
|
||||
jumpToIndex: (index: number) => void;
|
||||
getLabel: (scene: TabScene) => (React.ReactNode | string);
|
||||
getLabel: (scene: TabScene) => React.ReactNode | string;
|
||||
getOnPress: (
|
||||
previousScene: NavigationRoute,
|
||||
scene: TabScene
|
||||
) => (args: {
|
||||
previousScene: NavigationRoute,
|
||||
scene: TabScene,
|
||||
jumpToIndex: (index: number) => void,
|
||||
}) => void;
|
||||
) => (
|
||||
args: {
|
||||
previousScene: NavigationRoute;
|
||||
scene: TabScene;
|
||||
jumpToIndex: (index: number) => void;
|
||||
}
|
||||
) => void;
|
||||
renderIcon: (scene: TabScene) => React.ReactElement<any>;
|
||||
labelStyle?: TextStyle;
|
||||
iconStyle?: ViewStyle;
|
||||
@@ -754,15 +870,17 @@ export interface TabBarBottomProps {
|
||||
position: AnimatedValue;
|
||||
navigation: NavigationScreenProp<NavigationState>;
|
||||
jumpToIndex: (index: number) => void;
|
||||
getLabel: (scene: TabScene) => (React.ReactNode | string);
|
||||
getLabel: (scene: TabScene) => React.ReactNode | string;
|
||||
getOnPress: (
|
||||
previousScene: NavigationRoute,
|
||||
scene: TabScene
|
||||
) => (args: {
|
||||
previousScene: NavigationRoute,
|
||||
scene: TabScene,
|
||||
jumpToIndex: (index: number) => void,
|
||||
}) => void;
|
||||
) => (
|
||||
args: {
|
||||
previousScene: NavigationRoute;
|
||||
scene: TabScene;
|
||||
jumpToIndex: (index: number) => void;
|
||||
}
|
||||
) => void;
|
||||
getTestIDProps: (scene: TabScene) => (scene: TabScene) => any;
|
||||
renderIcon: (scene: TabScene) => React.ReactNode;
|
||||
style?: ViewStyle;
|
||||
@@ -789,12 +907,18 @@ export namespace NavigationActions {
|
||||
const POP_TO_TOP: 'Navigation/POP_TO_TOP';
|
||||
|
||||
function init(options?: NavigationInitActionPayload): NavigationInitAction;
|
||||
function navigate(options: NavigationNavigateActionPayload): NavigationNavigateAction;
|
||||
function navigate(
|
||||
options: NavigationNavigateActionPayload
|
||||
): NavigationNavigateAction;
|
||||
function reset(options: NavigationResetActionPayload): NavigationResetAction;
|
||||
function back(options?: NavigationBackActionPayload): NavigationBackAction;
|
||||
function setParams(options: NavigationSetParamsActionPayload): NavigationSetParamsAction;
|
||||
function setParams(
|
||||
options: NavigationSetParamsActionPayload
|
||||
): NavigationSetParamsAction;
|
||||
function pop(options: NavigationPopActionPayload): NavigationPopAction;
|
||||
function popToTop(options: NavigationPopToTopActionPayload): NavigationPopToTopAction;
|
||||
function popToTop(
|
||||
options: NavigationPopToTopActionPayload
|
||||
): NavigationPopToTopAction;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -807,8 +931,14 @@ export interface TransitionerProps {
|
||||
prevTransitionProps?: NavigationTransitionProps
|
||||
) => NavigationTransitionSpec;
|
||||
navigation: NavigationScreenProp<NavigationState>;
|
||||
onTransitionStart?: (transitionProps: NavigationTransitionProps, prevTransitionProps?: NavigationTransitionProps) => Promise<void> | void;
|
||||
onTransitionEnd?: (transitionProps: NavigationTransitionProps, prevTransitionProps?: NavigationTransitionProps) => void;
|
||||
onTransitionStart?: (
|
||||
transitionProps: NavigationTransitionProps,
|
||||
prevTransitionProps?: NavigationTransitionProps
|
||||
) => Promise<void> | void;
|
||||
onTransitionEnd?: (
|
||||
transitionProps: NavigationTransitionProps,
|
||||
prevTransitionProps?: NavigationTransitionProps
|
||||
) => void;
|
||||
render: (
|
||||
transitionProps: NavigationTransitionProps,
|
||||
prevTransitionProps?: NavigationTransitionProps
|
||||
@@ -826,7 +956,7 @@ export interface TransitionerState {
|
||||
export class Transitioner extends React.Component<
|
||||
TransitionerProps,
|
||||
TransitionerState
|
||||
> { }
|
||||
> { }
|
||||
|
||||
/**
|
||||
* Tab Router
|
||||
@@ -853,12 +983,23 @@ export function StackRouter(
|
||||
*
|
||||
* @see https://github.com/react-navigation/react-navigation/blob/master/src/navigators/createNavigator.js
|
||||
*/
|
||||
export function createNavigator<C, S, Options>(
|
||||
export interface NavigationDescriptor<Params = NavigationParams> {
|
||||
key: string;
|
||||
state: NavigationLeafRoute<Params> | NavigationStateRoute<Params>;
|
||||
navigation: NavigationScreenProp<any>;
|
||||
getComponent: () => React.ComponentType;
|
||||
}
|
||||
|
||||
export type NavigationView<O, S> = React.ComponentType<{
|
||||
descriptors: { [key: string]: NavigationDescriptor };
|
||||
} & NavigationInjectedProps>;
|
||||
|
||||
export function createNavigator<S, Options>(
|
||||
view: NavigationView<Options, S>,
|
||||
router: NavigationRouter<S, Options>,
|
||||
routeConfigs?: NavigationRouteConfigMap,
|
||||
navigatorConfig?: {} | null,
|
||||
navigatorType?: NavigatorType
|
||||
): (NavigationView: React.ComponentClass<C>) => NavigationNavigator<C, S, Options>;
|
||||
): any;
|
||||
|
||||
/**
|
||||
* Create an HOC that injects the navigation and manages the navigation state
|
||||
@@ -879,7 +1020,10 @@ export function createNavigationContainer(
|
||||
* BEGIN CUSTOM CONVENIENCE INTERFACES
|
||||
*/
|
||||
|
||||
export interface NavigationScreenProps<Params = NavigationParams, Options = any> {
|
||||
export interface NavigationScreenProps<
|
||||
Params = NavigationParams,
|
||||
Options = any
|
||||
> {
|
||||
navigation: NavigationScreenProp<NavigationRoute<Params>, Params>;
|
||||
screenProps?: { [key: string]: any };
|
||||
navigationOptions?: NavigationScreenConfig<Options>;
|
||||
@@ -936,6 +1080,7 @@ export interface SafeAreaViewProps extends ViewProps {
|
||||
horizontal?: SafeAreaViewForceInsetValue;
|
||||
vertical?: SafeAreaViewForceInsetValue;
|
||||
};
|
||||
children?: React.ReactNode;
|
||||
}
|
||||
|
||||
export const SafeAreaView: React.ComponentClass<SafeAreaViewProps>;
|
||||
|
||||
@@ -5,7 +5,7 @@ import {
|
||||
ViewStyle,
|
||||
} from 'react-native';
|
||||
import {
|
||||
DrawerNavigator,
|
||||
createDrawerNavigator,
|
||||
DrawerNavigatorConfig,
|
||||
NavigationAction,
|
||||
NavigationActions,
|
||||
@@ -22,15 +22,14 @@ import {
|
||||
NavigationStackScreenOptions,
|
||||
NavigationTabScreenOptions,
|
||||
NavigationTransitionProps,
|
||||
StackNavigator,
|
||||
createStackNavigator,
|
||||
StackNavigatorConfig,
|
||||
SwitchNavigator,
|
||||
createSwitchNavigator,
|
||||
SwitchNavigatorConfig,
|
||||
TabBarTop,
|
||||
TabNavigator,
|
||||
createTabNavigator,
|
||||
TabNavigatorConfig,
|
||||
Transitioner,
|
||||
addNavigationHelpers,
|
||||
HeaderBackButton,
|
||||
Header,
|
||||
NavigationContainer,
|
||||
@@ -128,7 +127,7 @@ const routeConfigMap: NavigationRouteConfigMap = {
|
||||
screen: NextScreen,
|
||||
},
|
||||
};
|
||||
export const AppNavigator = StackNavigator(
|
||||
export const AppNavigator = createStackNavigator(
|
||||
routeConfigMap,
|
||||
{
|
||||
initialRouteName: ROUTE_NAME_START_SCREEN,
|
||||
@@ -147,7 +146,7 @@ const StatelessScreen: NavigationScreenComponent<StatelessScreenParams> = (props
|
||||
|
||||
StatelessScreen.navigationOptions = { title: 'Stateless' };
|
||||
|
||||
const SimpleStackNavigator = StackNavigator(
|
||||
const SimpleStackNavigator = createStackNavigator(
|
||||
{
|
||||
simple: {
|
||||
screen: StatelessScreen,
|
||||
@@ -155,20 +154,6 @@ const SimpleStackNavigator = StackNavigator(
|
||||
}
|
||||
);
|
||||
|
||||
/**
|
||||
* Router.
|
||||
*/
|
||||
const Router = (props: any) => (
|
||||
<AppNavigator
|
||||
navigation={
|
||||
addNavigationHelpers({
|
||||
dispatch: (action: NavigationStackAction): boolean => true,
|
||||
state: {},
|
||||
})
|
||||
}
|
||||
/>
|
||||
);
|
||||
|
||||
/**
|
||||
* Tab navigator.
|
||||
*/
|
||||
@@ -204,7 +189,7 @@ const tabNavigatorConfigWithNavigationOptions: TabNavigatorConfig = {
|
||||
},
|
||||
};
|
||||
|
||||
const BasicTabNavigator = TabNavigator(
|
||||
const BasicTabNavigator = createTabNavigator(
|
||||
routeConfigMap,
|
||||
tabNavigatorConfig,
|
||||
);
|
||||
@@ -232,7 +217,7 @@ const stackNavigatorConfig: StackNavigatorConfig = {
|
||||
navigationOptions: stackNavigatorScreenOptions,
|
||||
};
|
||||
|
||||
const BasicStackNavigator = StackNavigator(
|
||||
const BasicStackNavigator = createStackNavigator(
|
||||
routeConfigMap,
|
||||
stackNavigatorConfig,
|
||||
);
|
||||
@@ -252,7 +237,7 @@ const stackNavigatorConfigWithNavigationOptionsAsFunction: StackNavigatorConfig
|
||||
navigationOptions: ({navigationOptions, navigation, screenProps}) => (stackNavigatorScreenOptions),
|
||||
};
|
||||
|
||||
const AdvancedStackNavigator = StackNavigator(
|
||||
const AdvancedStackNavigator = createStackNavigator(
|
||||
routeConfigMap,
|
||||
stackNavigatorConfigWithNavigationOptionsAsFunction
|
||||
);
|
||||
@@ -276,7 +261,7 @@ const switchNavigatorConfig: SwitchNavigatorConfig = {
|
||||
backBehavior: 'none'
|
||||
};
|
||||
|
||||
const BasicSwitchNavigator = SwitchNavigator(
|
||||
const BasicSwitchNavigator = createSwitchNavigator(
|
||||
routeConfigMap,
|
||||
switchNavigatorConfig,
|
||||
);
|
||||
@@ -296,7 +281,7 @@ const switchNavigatorConfigWithInitialRoute: SwitchNavigatorConfig = {
|
||||
backBehavior: 'initialRoute'
|
||||
};
|
||||
|
||||
const SwitchNavigatorWithInitialRoute = SwitchNavigator(
|
||||
const SwitchNavigatorWithInitialRoute = createSwitchNavigator(
|
||||
routeConfigMap,
|
||||
switchNavigatorConfigWithInitialRoute,
|
||||
);
|
||||
@@ -326,7 +311,7 @@ const drawerNavigatorConfig: DrawerNavigatorConfig = {
|
||||
},
|
||||
};
|
||||
|
||||
const BasicDrawerNavigator = DrawerNavigator(
|
||||
const BasicDrawerNavigator = createDrawerNavigator(
|
||||
routeConfigMap,
|
||||
stackNavigatorConfig,
|
||||
);
|
||||
@@ -449,7 +434,7 @@ const popToTopAction: NavigationPopToTopAction = NavigationActions.popToTop({
|
||||
|
||||
class Page1 extends React.Component { }
|
||||
|
||||
const RootNavigator: NavigationContainer = SwitchNavigator({
|
||||
const RootNavigator: NavigationContainer = createSwitchNavigator({
|
||||
default: { getScreen: () => Page1 },
|
||||
});
|
||||
|
||||
|
||||
@@ -22,4 +22,4 @@
|
||||
"index.d.ts",
|
||||
"react-navigation-tests.tsx"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1 +1,7 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
{
|
||||
"extends": "dtslint/dt.json",
|
||||
"rules": {
|
||||
// TODO
|
||||
"no-any-union": false
|
||||
}
|
||||
}
|
||||
|
||||
+176
-321
@@ -1,4 +1,4 @@
|
||||
// Type definitions for react-navigation 2.0
|
||||
// Type definitions for react-navigation 1.5
|
||||
// Project: https://github.com/react-navigation/react-navigation
|
||||
// Definitions by: Huhuanming <https://github.com/huhuanming>
|
||||
// mhcgrq <https://github.com/mhcgrq>
|
||||
@@ -16,12 +16,11 @@
|
||||
// Armando Assuncao <https://github.com/ArmandoAssuncao>
|
||||
// Ciaran Liedeman <https://github.com/cliedeman>
|
||||
// Edward Sammut Alessi <https://github.com/Slessi>
|
||||
// Jérémy Magrin <https://github.com/magrinj>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.6
|
||||
|
||||
/**
|
||||
* Reference: https://github.com/react-navigation/react-navigation/tree/a37473c5e4833f48796ee6c7c9cb4a8ac49d9c06
|
||||
* Reference: https://github.com/react-navigation/react-navigation/tree/3f3ef6485c8932f49fddc3dd2c508629110bf2b6
|
||||
*
|
||||
* NOTE: Please update the commit/link above when updating to a new Flow
|
||||
* react-navigation/flow/react-navigation.js reference, so we can conveniently just look at diffs on
|
||||
@@ -44,24 +43,15 @@ export type AnimatedValue = any;
|
||||
|
||||
export type HeaderMode = 'float' | 'screen' | 'none';
|
||||
|
||||
export interface HeaderForceInset {
|
||||
horizontal?: string;
|
||||
vertical?: string;
|
||||
left?: string;
|
||||
right?: string;
|
||||
top?: string;
|
||||
bottom?: string;
|
||||
}
|
||||
|
||||
export interface HeaderProps extends NavigationSceneRendererProps {
|
||||
mode: HeaderMode;
|
||||
router: NavigationRouter<NavigationState, NavigationStackScreenOptions>;
|
||||
getScreenDetails: (
|
||||
navigationScene: NavigationScene
|
||||
) => NavigationScreenDetails<NavigationStackScreenOptions>;
|
||||
leftInterpolator: (props: NavigationSceneRendererProps) => {};
|
||||
titleInterpolator: (props: NavigationSceneRendererProps) => {};
|
||||
rightInterpolator: (props: NavigationSceneRendererProps) => {};
|
||||
router: NavigationRouter<
|
||||
NavigationState,
|
||||
NavigationStackScreenOptions
|
||||
>;
|
||||
getScreenDetails: (navigationScene: NavigationScene) => NavigationScreenDetails<
|
||||
NavigationStackScreenOptions
|
||||
>;
|
||||
style: StyleProp<ViewStyle>;
|
||||
}
|
||||
|
||||
@@ -83,14 +73,12 @@ export interface NavigationState {
|
||||
* Index refers to the active child route in the routes array.
|
||||
*/
|
||||
index: number;
|
||||
routes: NavigationRoute[];
|
||||
routes: any[];
|
||||
}
|
||||
|
||||
export type NavigationRoute<Params = NavigationParams> =
|
||||
| NavigationLeafRoute<Params>
|
||||
| NavigationStateRoute<Params>;
|
||||
export type NavigationRoute<Params = NavigationParams> = NavigationLeafRoute<Params> | NavigationStateRoute<Params>;
|
||||
|
||||
export interface NavigationLeafRoute<Params = NavigationParams> {
|
||||
export interface NavigationLeafRoute<Params> {
|
||||
/**
|
||||
* React's key used by some navigators. No need to specify these manually,
|
||||
* they will be defined by the router.
|
||||
@@ -112,9 +100,7 @@ export interface NavigationLeafRoute<Params = NavigationParams> {
|
||||
params?: Params;
|
||||
}
|
||||
|
||||
export type NavigationStateRoute<
|
||||
NavigationLeafRouteParams
|
||||
> = NavigationLeafRoute<NavigationLeafRouteParams> & NavigationState;
|
||||
export type NavigationStateRoute<NavigationLeafRouteParams> = NavigationLeafRoute<NavigationLeafRouteParams> & NavigationState;
|
||||
|
||||
export type NavigationScreenOptionsGetter<Options> = (
|
||||
navigation: NavigationScreenProp<NavigationRoute<any>>,
|
||||
@@ -127,10 +113,7 @@ export interface NavigationRouter<State = NavigationState, Options = {}> {
|
||||
* an optional previous state. When the action is considered handled but the
|
||||
* state is unchanged, the output state is null.
|
||||
*/
|
||||
getStateForAction: (
|
||||
action: NavigationAction,
|
||||
lastState?: State
|
||||
) => State | null;
|
||||
getStateForAction: (action: NavigationAction, lastState?: State) => (State | null);
|
||||
|
||||
/**
|
||||
* Maps a URI-like string to an action. This can be mapped to a state
|
||||
@@ -139,14 +122,14 @@ export interface NavigationRouter<State = NavigationState, Options = {}> {
|
||||
getActionForPathAndParams: (
|
||||
path: string,
|
||||
params?: NavigationParams
|
||||
) => NavigationAction | null;
|
||||
) => (NavigationAction | null);
|
||||
|
||||
getPathAndParamsForState: (
|
||||
state: State
|
||||
) => {
|
||||
path: string;
|
||||
params?: NavigationParams;
|
||||
};
|
||||
path: string,
|
||||
params?: NavigationParams,
|
||||
};
|
||||
|
||||
getComponentForRouteName: (routeName: string) => NavigationComponent;
|
||||
|
||||
@@ -164,8 +147,11 @@ export interface NavigationRouter<State = NavigationState, Options = {}> {
|
||||
}
|
||||
|
||||
export type NavigationScreenOption<T> =
|
||||
| T
|
||||
| ((navigation: NavigationScreenProp<NavigationRoute>, config: T) => T);
|
||||
T
|
||||
| ((
|
||||
navigation: NavigationScreenProp<NavigationRoute>,
|
||||
config: T
|
||||
) => T);
|
||||
|
||||
export interface NavigationScreenDetails<T> {
|
||||
options: T;
|
||||
@@ -173,9 +159,7 @@ export interface NavigationScreenDetails<T> {
|
||||
navigation: NavigationScreenProp<NavigationRoute>;
|
||||
}
|
||||
|
||||
export type NavigationScreenOptions = NavigationStackScreenOptions &
|
||||
NavigationTabScreenOptions &
|
||||
NavigationDrawerScreenOptions;
|
||||
export type NavigationScreenOptions = NavigationStackScreenOptions & NavigationTabScreenOptions & NavigationDrawerScreenOptions;
|
||||
|
||||
export interface NavigationScreenConfigProps {
|
||||
navigation: NavigationScreenProp<NavigationRoute>;
|
||||
@@ -183,34 +167,30 @@ export interface NavigationScreenConfigProps {
|
||||
}
|
||||
|
||||
export type NavigationScreenConfig<Options> =
|
||||
| Options
|
||||
| ((
|
||||
navigationOptionsContainer: NavigationScreenConfigProps & {
|
||||
navigationOptions: NavigationScreenProp<NavigationRoute>;
|
||||
}
|
||||
) => Options);
|
||||
Options
|
||||
| ((navigationOptionsContainer: NavigationScreenConfigProps & {
|
||||
navigationOptions: NavigationScreenProp<NavigationRoute>,
|
||||
}) => Options);
|
||||
|
||||
export type NavigationComponent =
|
||||
| NavigationScreenComponent<NavigationParams, any, any>
|
||||
| NavigationNavigator<any, any, any>
|
||||
| any;
|
||||
NavigationScreenComponent<any, any, any>
|
||||
| NavigationNavigator<any, any, any>;
|
||||
|
||||
export type NavigationScreenComponent<
|
||||
Params = NavigationParams,
|
||||
Options = {},
|
||||
Props = {}
|
||||
> = React.ComponentType<NavigationScreenProps<Params, Options> & Props> & {
|
||||
navigationOptions?: NavigationScreenConfig<Options>;
|
||||
};
|
||||
Params = NavigationParams,
|
||||
Options = {},
|
||||
Props = {}
|
||||
> = React.ComponentType<NavigationScreenProps<Params, Options> & Props> &
|
||||
{ navigationOptions?: NavigationScreenConfig<Options> };
|
||||
|
||||
export type NavigationNavigator<
|
||||
State = NavigationState,
|
||||
Options = {},
|
||||
Props = {}
|
||||
> = React.ComponentType<NavigationNavigatorProps<Options, State> & Props> & {
|
||||
router: NavigationRouter<State, Options>;
|
||||
navigationOptions?: NavigationScreenConfig<Options>;
|
||||
};
|
||||
State = NavigationState,
|
||||
Options = {},
|
||||
Props = {}
|
||||
> = React.ComponentType<NavigationNavigatorProps<Options, State> & Props> & {
|
||||
router: NavigationRouter<State, Options>,
|
||||
navigationOptions?: NavigationScreenConfig<Options>,
|
||||
};
|
||||
|
||||
export interface NavigationParams {
|
||||
[key: string]: any;
|
||||
@@ -226,8 +206,7 @@ export interface NavigationNavigateActionPayload {
|
||||
key?: string;
|
||||
}
|
||||
|
||||
export interface NavigationNavigateAction
|
||||
extends NavigationNavigateActionPayload {
|
||||
export interface NavigationNavigateAction extends NavigationNavigateActionPayload {
|
||||
type: 'Navigation/NAVIGATE';
|
||||
}
|
||||
|
||||
@@ -247,8 +226,7 @@ export interface NavigationSetParamsActionPayload {
|
||||
params?: NavigationParams;
|
||||
}
|
||||
|
||||
export interface NavigationSetParamsAction
|
||||
extends NavigationSetParamsActionPayload {
|
||||
export interface NavigationSetParamsAction extends NavigationSetParamsActionPayload {
|
||||
type: 'Navigation/SET_PARAMS';
|
||||
}
|
||||
|
||||
@@ -293,70 +271,40 @@ export interface NavigationPopToTopActionPayload {
|
||||
immediate?: boolean;
|
||||
}
|
||||
|
||||
export interface NavigationPopToTopAction
|
||||
extends NavigationPopToTopActionPayload {
|
||||
export interface NavigationPopToTopAction extends NavigationPopToTopActionPayload {
|
||||
type: 'Navigation/POP_TO_TOP';
|
||||
}
|
||||
|
||||
export interface NavigationStackViewConfig {
|
||||
mode?: 'card' | 'modal';
|
||||
headerMode?: HeaderMode;
|
||||
headerTransitionPreset?: 'fade-in-place' | 'uikit';
|
||||
cardStyle?: StyleProp<ViewStyle>;
|
||||
transitionConfig?: (
|
||||
transitionProps: NavigationTransitionProps,
|
||||
prevTransitionProps: NavigationTransitionProps,
|
||||
isModal: boolean
|
||||
isModal: boolean,
|
||||
) => TransitionConfig;
|
||||
onTransitionStart?: (
|
||||
transitionProps: NavigationTransitionProps,
|
||||
prevTransitionProps?: NavigationTransitionProps
|
||||
) => Promise<void> | void;
|
||||
onTransitionEnd?: (
|
||||
transitionProps: NavigationTransitionProps,
|
||||
prevTransitionProps?: NavigationTransitionProps
|
||||
) => void;
|
||||
}
|
||||
|
||||
/**
|
||||
* Switch Navigator
|
||||
*/
|
||||
|
||||
export interface NavigationSwitchRouterConfig {
|
||||
initialRouteName?: string;
|
||||
initialRouteParams?: NavigationParams;
|
||||
paths?: NavigationPathsConfig;
|
||||
navigationOptions?: NavigationScreenConfig<NavigationScreenOptions>;
|
||||
order?: string[];
|
||||
backBehavior?: 'none' | 'initialRoute'; // defaults to `'none'`
|
||||
resetOnBlur?: boolean; // defaults to `true`
|
||||
onTransitionStart?: (transitionProps: NavigationTransitionProps, prevTransitionProps?: NavigationTransitionProps) => Promise<void> | void;
|
||||
onTransitionEnd?: (transitionProps: NavigationTransitionProps, prevTransitionProps?: NavigationTransitionProps) => void;
|
||||
}
|
||||
|
||||
export interface NavigationStackScreenOptions {
|
||||
title?: string;
|
||||
header?:
|
||||
| (
|
||||
| React.ReactElement<any>
|
||||
| ((headerProps: HeaderProps) => React.ReactElement<any>))
|
||||
| null;
|
||||
header?: (React.ReactElement<any> | ((headerProps: HeaderProps) => React.ReactElement<any>)) | null;
|
||||
headerTransparent?: boolean;
|
||||
headerTitle?: string | React.ReactElement<any>;
|
||||
headerTitleStyle?: StyleProp<TextStyle>;
|
||||
headerTitleAllowFontScaling?: boolean;
|
||||
headerTintColor?: string;
|
||||
headerLeft?: React.ReactElement<any>;
|
||||
headerBackTitle?: string | null;
|
||||
headerBackImage?: React.ReactElement<any>;
|
||||
headerTruncatedBackTitle?: string;
|
||||
headerBackTitleStyle?: StyleProp<TextStyle>;
|
||||
headerPressColorAndroid?: string;
|
||||
headerRight?: React.ReactElement<any>;
|
||||
headerStyle?: StyleProp<ViewStyle>;
|
||||
headerForceInset?: HeaderForceInset;
|
||||
headerBackground?: React.ReactNode | React.ReactType;
|
||||
gesturesEnabled?: boolean;
|
||||
gestureResponseDistance?: { vertical?: number; horizontal?: number };
|
||||
gestureDirection?: 'default' | 'inverted';
|
||||
}
|
||||
|
||||
export interface NavigationStackRouterConfig {
|
||||
@@ -369,7 +317,7 @@ export interface NavigationStackRouterConfig {
|
||||
}
|
||||
|
||||
export type NavigationStackAction =
|
||||
| NavigationInitAction
|
||||
NavigationInitAction
|
||||
| NavigationNavigateAction
|
||||
| NavigationBackAction
|
||||
| NavigationSetParamsAction
|
||||
@@ -378,30 +326,25 @@ export type NavigationStackAction =
|
||||
| NavigationPopToTopAction;
|
||||
|
||||
export type NavigationTabAction =
|
||||
| NavigationInitAction
|
||||
NavigationInitAction
|
||||
| NavigationNavigateAction
|
||||
| NavigationBackAction;
|
||||
|
||||
export type NavigationAction =
|
||||
| NavigationInitAction
|
||||
NavigationInitAction
|
||||
| NavigationStackAction
|
||||
| NavigationTabAction;
|
||||
|
||||
export type NavigationRouteConfig =
|
||||
| NavigationComponent
|
||||
| ({
|
||||
navigationOptions?: NavigationScreenConfig<any>;
|
||||
path?: string;
|
||||
} & NavigationScreenRouteConfig);
|
||||
export type NavigationRouteConfig = NavigationComponent | ({
|
||||
navigationOptions?: NavigationScreenConfig<any>,
|
||||
path?: string,
|
||||
} & NavigationScreenRouteConfig);
|
||||
|
||||
export type NavigationScreenRouteConfig =
|
||||
| NavigationComponent
|
||||
| {
|
||||
screen: NavigationComponent;
|
||||
}
|
||||
| {
|
||||
getScreen: () => NavigationComponent;
|
||||
};
|
||||
export type NavigationScreenRouteConfig = NavigationComponent | {
|
||||
screen: NavigationComponent,
|
||||
} | {
|
||||
getScreen: () => NavigationComponent,
|
||||
};
|
||||
|
||||
export interface NavigationPathsConfig {
|
||||
[routeName: string]: string;
|
||||
@@ -409,7 +352,6 @@ export interface NavigationPathsConfig {
|
||||
|
||||
export interface NavigationTabRouterConfig {
|
||||
initialRouteName?: string;
|
||||
initialRouteParams?: NavigationParams;
|
||||
paths?: NavigationPathsConfig;
|
||||
navigationOptions?: NavigationScreenConfig<NavigationScreenOptions>;
|
||||
order?: string[]; // todo: type these as the real route names rather than 'string'
|
||||
@@ -418,48 +360,45 @@ export interface NavigationTabRouterConfig {
|
||||
backBehavior?: 'none' | 'initialRoute'; // defaults `initialRoute`
|
||||
}
|
||||
export interface TabScene {
|
||||
route: NavigationRoute;
|
||||
focused: boolean;
|
||||
index: number;
|
||||
tintColor?: string;
|
||||
route: NavigationRoute;
|
||||
focused: boolean;
|
||||
index: number;
|
||||
tintColor?: string;
|
||||
}
|
||||
export interface NavigationTabScreenOptions {
|
||||
title?: string;
|
||||
tabBarIcon?:
|
||||
| React.ReactElement<any>
|
||||
| ((
|
||||
options: { tintColor: string | null; focused: boolean }
|
||||
) => React.ReactElement<any> | null);
|
||||
React.ReactElement<any>
|
||||
| ((options: { tintColor: (string | null), focused: boolean }) => (React.ReactElement<
|
||||
any
|
||||
> | null));
|
||||
tabBarLabel?:
|
||||
| string
|
||||
| React.ReactElement<any>
|
||||
| ((
|
||||
options: { tintColor: string | null; focused: boolean }
|
||||
) => React.ReactElement<any> | string | null);
|
||||
string
|
||||
| React.ReactElement<any>
|
||||
| ((options: { tintColor: (string | null), focused: boolean }) => (React.ReactElement<
|
||||
any
|
||||
> | string | null));
|
||||
tabBarVisible?: boolean;
|
||||
tabBarTestIDProps?: { testID?: string; accessibilityLabel?: string };
|
||||
tabBarOnPress?: (
|
||||
options: {
|
||||
scene: TabScene;
|
||||
jumpToIndex: (index: number) => void;
|
||||
}
|
||||
) => void;
|
||||
tabBarTestIDProps?: { testID?: string, accessibilityLabel?: string };
|
||||
tabBarOnPress?: (options: {
|
||||
scene: TabScene,
|
||||
jumpToIndex: (index: number) => void
|
||||
}) => void;
|
||||
}
|
||||
|
||||
export interface NavigationDrawerScreenOptions {
|
||||
title?: string;
|
||||
drawerIcon?:
|
||||
| React.ReactElement<any>
|
||||
| ((
|
||||
options: { tintColor: string | null; focused: boolean }
|
||||
) => React.ReactElement<any> | null);
|
||||
React.ReactElement<any>
|
||||
| ((options: { tintColor: (string | null), focused: boolean }) => (React.ReactElement<
|
||||
any
|
||||
> | null));
|
||||
drawerLabel?:
|
||||
| string
|
||||
| React.ReactElement<any>
|
||||
| ((
|
||||
options: { tintColor: string | null; focused: boolean }
|
||||
) => React.ReactElement<any> | null);
|
||||
drawerLockMode?: 'unlocked' | 'locked-closed' | 'locked-open';
|
||||
string
|
||||
| React.ReactElement<any>
|
||||
| ((options: { tintColor: (string | null), focused: boolean }) => (React.ReactElement<
|
||||
any
|
||||
> | null));
|
||||
}
|
||||
|
||||
export interface NavigationRouteConfigMap {
|
||||
@@ -474,20 +413,22 @@ export interface NavigationProp<S> {
|
||||
}
|
||||
|
||||
export type EventType =
|
||||
| 'willFocus'
|
||||
| 'didFocus'
|
||||
| 'willBlur'
|
||||
| 'didBlur'
|
||||
| 'action';
|
||||
| 'willFocus'
|
||||
| 'didFocus'
|
||||
| 'willBlur'
|
||||
| 'didBlur'
|
||||
| 'action';
|
||||
|
||||
export interface NavigationEventPayload {
|
||||
type: EventType;
|
||||
action: NavigationAction;
|
||||
state: NavigationState;
|
||||
lastState: NavigationState | null | undefined;
|
||||
lastState: NavigationState;
|
||||
}
|
||||
|
||||
export type NavigationEventCallback = (payload: NavigationEventPayload) => void;
|
||||
export type NavigationEventCallback = (
|
||||
payload: NavigationEventPayload
|
||||
) => void;
|
||||
|
||||
export interface NavigationEventSubscription {
|
||||
remove: () => void;
|
||||
@@ -497,14 +438,8 @@ export interface NavigationScreenProp<S, P = NavigationParams> {
|
||||
state: S;
|
||||
dispatch: NavigationDispatch;
|
||||
goBack: (routeKey?: string | null) => boolean;
|
||||
dismiss: () => boolean;
|
||||
navigate(options: {
|
||||
routeName: string | {
|
||||
routeName: string;
|
||||
params?: NavigationParams;
|
||||
action?: NavigationNavigateAction;
|
||||
key?: string;
|
||||
};
|
||||
routeName: string;
|
||||
params?: NavigationParams;
|
||||
action?: NavigationAction;
|
||||
key?: string;
|
||||
@@ -512,11 +447,8 @@ export interface NavigationScreenProp<S, P = NavigationParams> {
|
||||
navigate(
|
||||
routeNameOrOptions: string,
|
||||
params?: NavigationParams,
|
||||
action?: NavigationAction
|
||||
action?: NavigationAction,
|
||||
): boolean;
|
||||
openDrawer: () => any;
|
||||
closeDrawer: () => any;
|
||||
toggleDrawer: () => any;
|
||||
getParam: <T extends keyof P>(param: T, fallback?: P[T]) => P[T];
|
||||
setParams: (newParams: P) => boolean;
|
||||
addListener: (
|
||||
@@ -535,7 +467,6 @@ export interface NavigationScreenProp<S, P = NavigationParams> {
|
||||
) => boolean;
|
||||
pop: (n?: number, params?: { immediate?: boolean }) => boolean;
|
||||
popToTop: (params?: { immediate?: boolean }) => boolean;
|
||||
isFocused: () => boolean;
|
||||
}
|
||||
|
||||
export interface NavigationNavigatorProps<O = {}, S = {}> {
|
||||
@@ -619,14 +550,6 @@ export interface TransitionConfig {
|
||||
// How to animate position and opacity of the screen
|
||||
// based on the value generated by the transitionSpec
|
||||
screenInterpolator?: (props: NavigationSceneRendererProps) => any;
|
||||
// How to animate position and opacity of the header componetns
|
||||
// based on the value generated by the transitionSpec
|
||||
headerLeftInterpolator?: (props: NavigationSceneRendererProps) => any;
|
||||
headerTitleInterpolator?: (props: NavigationSceneRendererProps) => any;
|
||||
headerRightInterpolator?: (props: NavigationSceneRendererProps) => any;
|
||||
// The style of the container. Useful when a scene doesn't have
|
||||
// 100% opacity and the underlying container is visible.
|
||||
containerStyle?: StyleProp<ViewStyle>;
|
||||
}
|
||||
|
||||
export type NavigationAnimationSetter = (
|
||||
@@ -635,7 +558,7 @@ export type NavigationAnimationSetter = (
|
||||
lastState: NavigationState
|
||||
) => void;
|
||||
|
||||
export type NavigationSceneRenderer = () => React.ReactElement<any> | null;
|
||||
export type NavigationSceneRenderer = () => (React.ReactElement<any> | null);
|
||||
|
||||
export type NavigationStyleInterpolator = (
|
||||
props: NavigationSceneRendererProps
|
||||
@@ -644,49 +567,50 @@ export type NavigationStyleInterpolator = (
|
||||
export interface LayoutEvent {
|
||||
nativeEvent: {
|
||||
layout: {
|
||||
x: number;
|
||||
y: number;
|
||||
width: number;
|
||||
height: number;
|
||||
};
|
||||
x: number,
|
||||
y: number,
|
||||
width: number,
|
||||
height: number,
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
export type NavigatorType =
|
||||
| 'react-navigation/STACK'
|
||||
| 'react-navigation/TABS'
|
||||
| 'react-navigation/DRAWER';
|
||||
| 'react-navigation/STACK'
|
||||
| 'react-navigation/TABS'
|
||||
| 'react-navigation/DRAWER';
|
||||
|
||||
export interface NavigationContainerProps<S = {}, O = {}> {
|
||||
export function addNavigationHelpers<S = {}>(
|
||||
navigation: {
|
||||
state: S;
|
||||
dispatch: (action: NavigationAction) => any;
|
||||
addListener?: (
|
||||
eventName: string,
|
||||
callback: NavigationEventCallback
|
||||
) => NavigationEventSubscription;
|
||||
}
|
||||
): NavigationScreenProp<S>;
|
||||
|
||||
export interface NavigationContainerProps {
|
||||
uriPrefix?: string | RegExp;
|
||||
onNavigationStateChange?: (
|
||||
prevNavigationState: NavigationState,
|
||||
nextNavigationState: NavigationState,
|
||||
action: NavigationAction
|
||||
) => void | null | undefined;
|
||||
navigation?: NavigationScreenProp<S>;
|
||||
persistenceKey?: string | null;
|
||||
renderLoadingExperimental?: React.ComponentType;
|
||||
screenProps?: any;
|
||||
navigationOptions?: O;
|
||||
action: NavigationAction,
|
||||
) => void;
|
||||
style?: StyleProp<ViewStyle>;
|
||||
}
|
||||
|
||||
export interface NavigationContainerComponent
|
||||
extends React.Component<
|
||||
export interface NavigationContainerComponent extends React.Component<
|
||||
NavigationContainerProps & NavigationNavigatorProps<any>
|
||||
> {
|
||||
dispatch: NavigationDispatch;
|
||||
}
|
||||
|
||||
export interface NavigationContainer
|
||||
extends React.ComponentClass<
|
||||
export interface NavigationContainer extends React.ComponentClass<
|
||||
NavigationContainerProps & NavigationNavigatorProps<any>
|
||||
> {
|
||||
new(
|
||||
props: NavigationContainerProps & NavigationNavigatorProps<any>,
|
||||
context?: any
|
||||
): NavigationContainerComponent;
|
||||
new(props: NavigationContainerProps & NavigationNavigatorProps<any>, context?: any): NavigationContainerComponent;
|
||||
|
||||
router: NavigationRouter<any, any>;
|
||||
screenProps: { [key: string]: any };
|
||||
@@ -694,21 +618,14 @@ export interface NavigationContainer
|
||||
state: { nav: NavigationState | null };
|
||||
}
|
||||
|
||||
export interface StackNavigatorConfig
|
||||
extends NavigationStackViewConfig,
|
||||
NavigationStackRouterConfig {
|
||||
export interface StackNavigatorConfig extends NavigationStackViewConfig, NavigationStackRouterConfig {
|
||||
containerOptions?: any;
|
||||
}
|
||||
|
||||
// Return createNavigationContainer
|
||||
export function StackNavigator(
|
||||
routeConfigMap: NavigationRouteConfigMap,
|
||||
stackConfig?: StackNavigatorConfig
|
||||
): NavigationContainer;
|
||||
|
||||
export function createStackNavigator(
|
||||
routeConfigMap: NavigationRouteConfigMap,
|
||||
stackConfig?: StackNavigatorConfig
|
||||
stackConfig?: StackNavigatorConfig,
|
||||
): NavigationContainer;
|
||||
|
||||
export interface SwitchNavigatorConfig {
|
||||
@@ -719,18 +636,11 @@ export interface SwitchNavigatorConfig {
|
||||
}
|
||||
|
||||
// Return createNavigationContainer
|
||||
export type _SwitchNavigatorConfig = NavigationSwitchRouterConfig;
|
||||
|
||||
export function SwitchNavigator(
|
||||
routeConfigMap: NavigationRouteConfigMap,
|
||||
switchConfig?: SwitchNavigatorConfig
|
||||
): NavigationContainer;
|
||||
|
||||
export function createSwitchNavigator(
|
||||
routeConfigMap: NavigationRouteConfigMap,
|
||||
switchConfig?: SwitchNavigatorConfig
|
||||
): NavigationContainer;
|
||||
|
||||
// DrawerItems
|
||||
export const DrawerItems: React.ReactType;
|
||||
|
||||
@@ -745,28 +655,21 @@ export interface DrawerViewConfig {
|
||||
contentOptions?: any;
|
||||
style?: StyleProp<ViewStyle>;
|
||||
}
|
||||
export interface DrawerNavigatorConfig
|
||||
extends NavigationTabRouterConfig,
|
||||
DrawerViewConfig {
|
||||
export interface DrawerNavigatorConfig extends NavigationTabRouterConfig, DrawerViewConfig {
|
||||
containerConfig?: any;
|
||||
contentOptions?: {
|
||||
activeTintColor?: string;
|
||||
activeBackgroundColor?: string;
|
||||
inactiveTintColor?: string;
|
||||
inactiveBackgroundColor?: string;
|
||||
style?: StyleProp<ViewStyle>;
|
||||
labelStyle?: StyleProp<TextStyle>;
|
||||
activeTintColor?: string,
|
||||
activeBackgroundColor?: string,
|
||||
inactiveTintColor?: string,
|
||||
inactiveBackgroundColor?: string,
|
||||
style?: StyleProp<ViewStyle>,
|
||||
labelStyle?: StyleProp<TextStyle>,
|
||||
};
|
||||
}
|
||||
|
||||
export function DrawerNavigator(
|
||||
routeConfigMap: NavigationRouteConfigMap,
|
||||
drawerConfig?: DrawerNavigatorConfig
|
||||
): NavigationContainer;
|
||||
|
||||
export function createDrawerNavigator(
|
||||
routeConfigMap: NavigationRouteConfigMap,
|
||||
drawerConfig?: DrawerNavigatorConfig
|
||||
drawerConfig?: DrawerNavigatorConfig,
|
||||
): NavigationContainer;
|
||||
|
||||
/**
|
||||
@@ -778,23 +681,23 @@ export interface TabViewConfig {
|
||||
tabBarComponent?: React.ReactType;
|
||||
tabBarPosition?: 'top' | 'bottom';
|
||||
tabBarOptions?: {
|
||||
activeTintColor?: string;
|
||||
allowFontScaling?: boolean;
|
||||
activeBackgroundColor?: string;
|
||||
inactiveTintColor?: string;
|
||||
inactiveBackgroundColor?: string;
|
||||
showLabel?: boolean;
|
||||
style?: StyleProp<ViewStyle>;
|
||||
labelStyle?: StyleProp<TextStyle>;
|
||||
iconStyle?: StyleProp<ViewStyle>;
|
||||
activeTintColor?: string,
|
||||
allowFontScaling?: boolean,
|
||||
activeBackgroundColor?: string,
|
||||
inactiveTintColor?: string,
|
||||
inactiveBackgroundColor?: string,
|
||||
showLabel?: boolean,
|
||||
style?: StyleProp<ViewStyle>,
|
||||
labelStyle?: StyleProp<TextStyle>,
|
||||
iconStyle?: StyleProp<ViewStyle>,
|
||||
// Top
|
||||
showIcon?: boolean;
|
||||
upperCaseLabel?: boolean;
|
||||
pressColor?: string;
|
||||
pressOpacity?: number;
|
||||
scrollEnabled?: boolean;
|
||||
tabStyle?: StyleProp<ViewStyle>;
|
||||
indicatorStyle?: StyleProp<ViewStyle>;
|
||||
showIcon?: boolean,
|
||||
upperCaseLabel?: boolean,
|
||||
pressColor?: string,
|
||||
pressOpacity?: number,
|
||||
scrollEnabled?: boolean,
|
||||
tabStyle?: StyleProp<ViewStyle>,
|
||||
indicatorStyle?: StyleProp<ViewStyle>,
|
||||
};
|
||||
swipeEnabled?: boolean;
|
||||
animationEnabled?: boolean;
|
||||
@@ -802,33 +705,16 @@ export interface TabViewConfig {
|
||||
}
|
||||
|
||||
// From navigators/TabNavigator.js
|
||||
export interface TabNavigatorConfig
|
||||
extends NavigationTabRouterConfig,
|
||||
TabViewConfig {
|
||||
export interface TabNavigatorConfig extends NavigationTabRouterConfig, TabViewConfig {
|
||||
lazy?: boolean;
|
||||
removeClippedSubviews?: boolean;
|
||||
initialLayout?: { height: number; width: number };
|
||||
initialLayout?: { height: number, width: number };
|
||||
}
|
||||
|
||||
// From navigators/TabNavigator.js
|
||||
export function TabNavigator(
|
||||
routeConfigMap: NavigationRouteConfigMap,
|
||||
drawConfig?: TabNavigatorConfig
|
||||
): NavigationContainer;
|
||||
|
||||
export function createTabNavigator(
|
||||
routeConfigMap: NavigationRouteConfigMap,
|
||||
drawConfig?: TabNavigatorConfig
|
||||
): NavigationContainer;
|
||||
|
||||
export function createBottomTabNavigator(
|
||||
routeConfigMap: NavigationRouteConfigMap,
|
||||
drawConfig?: TabNavigatorConfig
|
||||
): NavigationContainer;
|
||||
|
||||
export function createMaterialTopNavigator(
|
||||
routeConfigMap: NavigationRouteConfigMap,
|
||||
drawConfig?: TabNavigatorConfig
|
||||
drawConfig?: TabNavigatorConfig,
|
||||
): NavigationContainer;
|
||||
|
||||
export interface TabBarTopProps {
|
||||
@@ -843,17 +729,15 @@ export interface TabBarTopProps {
|
||||
tabBarPosition: string;
|
||||
navigation: NavigationScreenProp<NavigationState>;
|
||||
jumpToIndex: (index: number) => void;
|
||||
getLabel: (scene: TabScene) => React.ReactNode | string;
|
||||
getLabel: (scene: TabScene) => (React.ReactNode | string);
|
||||
getOnPress: (
|
||||
previousScene: NavigationRoute,
|
||||
scene: TabScene
|
||||
) => (
|
||||
args: {
|
||||
previousScene: NavigationRoute;
|
||||
scene: TabScene;
|
||||
jumpToIndex: (index: number) => void;
|
||||
}
|
||||
) => void;
|
||||
) => (args: {
|
||||
previousScene: NavigationRoute,
|
||||
scene: TabScene,
|
||||
jumpToIndex: (index: number) => void,
|
||||
}) => void;
|
||||
renderIcon: (scene: TabScene) => React.ReactElement<any>;
|
||||
labelStyle?: TextStyle;
|
||||
iconStyle?: ViewStyle;
|
||||
@@ -870,17 +754,15 @@ export interface TabBarBottomProps {
|
||||
position: AnimatedValue;
|
||||
navigation: NavigationScreenProp<NavigationState>;
|
||||
jumpToIndex: (index: number) => void;
|
||||
getLabel: (scene: TabScene) => React.ReactNode | string;
|
||||
getLabel: (scene: TabScene) => (React.ReactNode | string);
|
||||
getOnPress: (
|
||||
previousScene: NavigationRoute,
|
||||
scene: TabScene
|
||||
) => (
|
||||
args: {
|
||||
previousScene: NavigationRoute;
|
||||
scene: TabScene;
|
||||
jumpToIndex: (index: number) => void;
|
||||
}
|
||||
) => void;
|
||||
) => (args: {
|
||||
previousScene: NavigationRoute,
|
||||
scene: TabScene,
|
||||
jumpToIndex: (index: number) => void,
|
||||
}) => void;
|
||||
getTestIDProps: (scene: TabScene) => (scene: TabScene) => any;
|
||||
renderIcon: (scene: TabScene) => React.ReactNode;
|
||||
style?: ViewStyle;
|
||||
@@ -907,18 +789,12 @@ export namespace NavigationActions {
|
||||
const POP_TO_TOP: 'Navigation/POP_TO_TOP';
|
||||
|
||||
function init(options?: NavigationInitActionPayload): NavigationInitAction;
|
||||
function navigate(
|
||||
options: NavigationNavigateActionPayload
|
||||
): NavigationNavigateAction;
|
||||
function navigate(options: NavigationNavigateActionPayload): NavigationNavigateAction;
|
||||
function reset(options: NavigationResetActionPayload): NavigationResetAction;
|
||||
function back(options?: NavigationBackActionPayload): NavigationBackAction;
|
||||
function setParams(
|
||||
options: NavigationSetParamsActionPayload
|
||||
): NavigationSetParamsAction;
|
||||
function setParams(options: NavigationSetParamsActionPayload): NavigationSetParamsAction;
|
||||
function pop(options: NavigationPopActionPayload): NavigationPopAction;
|
||||
function popToTop(
|
||||
options: NavigationPopToTopActionPayload
|
||||
): NavigationPopToTopAction;
|
||||
function popToTop(options: NavigationPopToTopActionPayload): NavigationPopToTopAction;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -931,14 +807,8 @@ export interface TransitionerProps {
|
||||
prevTransitionProps?: NavigationTransitionProps
|
||||
) => NavigationTransitionSpec;
|
||||
navigation: NavigationScreenProp<NavigationState>;
|
||||
onTransitionStart?: (
|
||||
transitionProps: NavigationTransitionProps,
|
||||
prevTransitionProps?: NavigationTransitionProps
|
||||
) => Promise<void> | void;
|
||||
onTransitionEnd?: (
|
||||
transitionProps: NavigationTransitionProps,
|
||||
prevTransitionProps?: NavigationTransitionProps
|
||||
) => void;
|
||||
onTransitionStart?: (transitionProps: NavigationTransitionProps, prevTransitionProps?: NavigationTransitionProps) => Promise<void> | void;
|
||||
onTransitionEnd?: (transitionProps: NavigationTransitionProps, prevTransitionProps?: NavigationTransitionProps) => void;
|
||||
render: (
|
||||
transitionProps: NavigationTransitionProps,
|
||||
prevTransitionProps?: NavigationTransitionProps
|
||||
@@ -956,7 +826,7 @@ export interface TransitionerState {
|
||||
export class Transitioner extends React.Component<
|
||||
TransitionerProps,
|
||||
TransitionerState
|
||||
> { }
|
||||
> { }
|
||||
|
||||
/**
|
||||
* Tab Router
|
||||
@@ -983,23 +853,12 @@ export function StackRouter(
|
||||
*
|
||||
* @see https://github.com/react-navigation/react-navigation/blob/master/src/navigators/createNavigator.js
|
||||
*/
|
||||
export interface NavigationDescriptor<Params = NavigationParams> {
|
||||
key: string;
|
||||
state: NavigationLeafRoute<Params> | NavigationStateRoute<Params>;
|
||||
navigation: NavigationScreenProp<any>;
|
||||
getComponent: () => React.ComponentType;
|
||||
}
|
||||
|
||||
export type NavigationView<O, S> = React.ComponentType<{
|
||||
descriptors: { [key: string]: NavigationDescriptor };
|
||||
} & NavigationInjectedProps>;
|
||||
|
||||
export function createNavigator<S, Options>(
|
||||
view: NavigationView<Options, S>,
|
||||
export function createNavigator<C, S, Options>(
|
||||
router: NavigationRouter<S, Options>,
|
||||
routeConfigs?: NavigationRouteConfigMap,
|
||||
navigatorConfig?: {} | null,
|
||||
navigatorType?: NavigatorType
|
||||
): any;
|
||||
): (NavigationView: React.ComponentClass<C>) => NavigationNavigator<C, S, Options>;
|
||||
|
||||
/**
|
||||
* Create an HOC that injects the navigation and manages the navigation state
|
||||
@@ -1020,10 +879,7 @@ export function createNavigationContainer(
|
||||
* BEGIN CUSTOM CONVENIENCE INTERFACES
|
||||
*/
|
||||
|
||||
export interface NavigationScreenProps<
|
||||
Params = NavigationParams,
|
||||
Options = any
|
||||
> {
|
||||
export interface NavigationScreenProps<Params = NavigationParams, Options = any> {
|
||||
navigation: NavigationScreenProp<NavigationRoute<Params>, Params>;
|
||||
screenProps?: { [key: string]: any };
|
||||
navigationOptions?: NavigationScreenConfig<Options>;
|
||||
@@ -1080,7 +936,6 @@ export interface SafeAreaViewProps extends ViewProps {
|
||||
horizontal?: SafeAreaViewForceInsetValue;
|
||||
vertical?: SafeAreaViewForceInsetValue;
|
||||
};
|
||||
children?: React.ReactNode;
|
||||
}
|
||||
|
||||
export const SafeAreaView: React.ComponentClass<SafeAreaViewProps>;
|
||||
+28
-13
@@ -5,7 +5,7 @@ import {
|
||||
ViewStyle,
|
||||
} from 'react-native';
|
||||
import {
|
||||
createDrawerNavigator,
|
||||
DrawerNavigator,
|
||||
DrawerNavigatorConfig,
|
||||
NavigationAction,
|
||||
NavigationActions,
|
||||
@@ -22,14 +22,15 @@ import {
|
||||
NavigationStackScreenOptions,
|
||||
NavigationTabScreenOptions,
|
||||
NavigationTransitionProps,
|
||||
createStackNavigator,
|
||||
StackNavigator,
|
||||
StackNavigatorConfig,
|
||||
createSwitchNavigator,
|
||||
SwitchNavigator,
|
||||
SwitchNavigatorConfig,
|
||||
TabBarTop,
|
||||
createTabNavigator,
|
||||
TabNavigator,
|
||||
TabNavigatorConfig,
|
||||
Transitioner,
|
||||
addNavigationHelpers,
|
||||
HeaderBackButton,
|
||||
Header,
|
||||
NavigationContainer,
|
||||
@@ -127,7 +128,7 @@ const routeConfigMap: NavigationRouteConfigMap = {
|
||||
screen: NextScreen,
|
||||
},
|
||||
};
|
||||
export const AppNavigator = createStackNavigator(
|
||||
export const AppNavigator = StackNavigator(
|
||||
routeConfigMap,
|
||||
{
|
||||
initialRouteName: ROUTE_NAME_START_SCREEN,
|
||||
@@ -146,7 +147,7 @@ const StatelessScreen: NavigationScreenComponent<StatelessScreenParams> = (props
|
||||
|
||||
StatelessScreen.navigationOptions = { title: 'Stateless' };
|
||||
|
||||
const SimpleStackNavigator = createStackNavigator(
|
||||
const SimpleStackNavigator = StackNavigator(
|
||||
{
|
||||
simple: {
|
||||
screen: StatelessScreen,
|
||||
@@ -154,6 +155,20 @@ const SimpleStackNavigator = createStackNavigator(
|
||||
}
|
||||
);
|
||||
|
||||
/**
|
||||
* Router.
|
||||
*/
|
||||
const Router = (props: any) => (
|
||||
<AppNavigator
|
||||
navigation={
|
||||
addNavigationHelpers({
|
||||
dispatch: (action: NavigationStackAction): boolean => true,
|
||||
state: {},
|
||||
})
|
||||
}
|
||||
/>
|
||||
);
|
||||
|
||||
/**
|
||||
* Tab navigator.
|
||||
*/
|
||||
@@ -189,7 +204,7 @@ const tabNavigatorConfigWithNavigationOptions: TabNavigatorConfig = {
|
||||
},
|
||||
};
|
||||
|
||||
const BasicTabNavigator = createTabNavigator(
|
||||
const BasicTabNavigator = TabNavigator(
|
||||
routeConfigMap,
|
||||
tabNavigatorConfig,
|
||||
);
|
||||
@@ -217,7 +232,7 @@ const stackNavigatorConfig: StackNavigatorConfig = {
|
||||
navigationOptions: stackNavigatorScreenOptions,
|
||||
};
|
||||
|
||||
const BasicStackNavigator = createStackNavigator(
|
||||
const BasicStackNavigator = StackNavigator(
|
||||
routeConfigMap,
|
||||
stackNavigatorConfig,
|
||||
);
|
||||
@@ -237,7 +252,7 @@ const stackNavigatorConfigWithNavigationOptionsAsFunction: StackNavigatorConfig
|
||||
navigationOptions: ({navigationOptions, navigation, screenProps}) => (stackNavigatorScreenOptions),
|
||||
};
|
||||
|
||||
const AdvancedStackNavigator = createStackNavigator(
|
||||
const AdvancedStackNavigator = StackNavigator(
|
||||
routeConfigMap,
|
||||
stackNavigatorConfigWithNavigationOptionsAsFunction
|
||||
);
|
||||
@@ -261,7 +276,7 @@ const switchNavigatorConfig: SwitchNavigatorConfig = {
|
||||
backBehavior: 'none'
|
||||
};
|
||||
|
||||
const BasicSwitchNavigator = createSwitchNavigator(
|
||||
const BasicSwitchNavigator = SwitchNavigator(
|
||||
routeConfigMap,
|
||||
switchNavigatorConfig,
|
||||
);
|
||||
@@ -281,7 +296,7 @@ const switchNavigatorConfigWithInitialRoute: SwitchNavigatorConfig = {
|
||||
backBehavior: 'initialRoute'
|
||||
};
|
||||
|
||||
const SwitchNavigatorWithInitialRoute = createSwitchNavigator(
|
||||
const SwitchNavigatorWithInitialRoute = SwitchNavigator(
|
||||
routeConfigMap,
|
||||
switchNavigatorConfigWithInitialRoute,
|
||||
);
|
||||
@@ -311,7 +326,7 @@ const drawerNavigatorConfig: DrawerNavigatorConfig = {
|
||||
},
|
||||
};
|
||||
|
||||
const BasicDrawerNavigator = createDrawerNavigator(
|
||||
const BasicDrawerNavigator = DrawerNavigator(
|
||||
routeConfigMap,
|
||||
stackNavigatorConfig,
|
||||
);
|
||||
@@ -434,7 +449,7 @@ const popToTopAction: NavigationPopToTopAction = NavigationActions.popToTop({
|
||||
|
||||
class Page1 extends React.Component { }
|
||||
|
||||
const RootNavigator: NavigationContainer = createSwitchNavigator({
|
||||
const RootNavigator: NavigationContainer = SwitchNavigator({
|
||||
default: { getScreen: () => Page1 },
|
||||
});
|
||||
|
||||
@@ -17,10 +17,10 @@
|
||||
"types": [],
|
||||
"paths": {
|
||||
"react-navigation": [
|
||||
"react-navigation/v2"
|
||||
"react-navigation/v1"
|
||||
],
|
||||
"react-navigation/*": [
|
||||
"react-navigation/v2/*"
|
||||
"react-navigation/v1/*"
|
||||
]
|
||||
},
|
||||
"noEmit": true,
|
||||
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
@@ -2,7 +2,7 @@ import * as React from "react";
|
||||
import { View } from "react-native";
|
||||
import { TabStack, renderSubView } from "react-router-navigation-core";
|
||||
import { TabBarProps, TabProps } from "react-router-navigation";
|
||||
import { TabViewAnimated } from "react-native-tab-view";
|
||||
import { TabView } from "react-native-tab-view";
|
||||
|
||||
type Props = TabBarProps & {
|
||||
children?: Array<React.ReactElement<TabProps>>;
|
||||
@@ -24,7 +24,7 @@ class BottomNavigation extends React.Component<Props, State> {
|
||||
render={props => {
|
||||
const ownProps = { ...this.props, ...props };
|
||||
return (
|
||||
<TabViewAnimated
|
||||
<TabView
|
||||
{...props}
|
||||
key={`transitioner_${this.state.key}`}
|
||||
animationEnabled={false}
|
||||
@@ -32,10 +32,11 @@ class BottomNavigation extends React.Component<Props, State> {
|
||||
sceneProps => <View />,
|
||||
ownProps
|
||||
)}
|
||||
renderFooter={renderSubView(
|
||||
renderTabBar={renderSubView(
|
||||
sceneProps => <View />,
|
||||
ownProps
|
||||
)}
|
||||
tabBarPosition="bottom"
|
||||
renderScene={renderSubView(
|
||||
sceneProps => <View />,
|
||||
ownProps
|
||||
|
||||
@@ -7,10 +7,10 @@
|
||||
"types": [],
|
||||
"paths": {
|
||||
"react-navigation": [
|
||||
"react-navigation/v2"
|
||||
"react-navigation/v1"
|
||||
],
|
||||
"react-navigation/*": [
|
||||
"react-navigation/v2/*"
|
||||
"react-navigation/v1/*"
|
||||
]
|
||||
},
|
||||
"module": "commonjs",
|
||||
|
||||
-1
@@ -6,7 +6,6 @@
|
||||
|
||||
import { Component, ReactNode, ReactElement, ComponentClass } from "react";
|
||||
import { StyleProp, ViewProps, ViewStyle, TextStyle } from "react-native";
|
||||
import { TabViewAnimated, TabViewPagerPan } from "react-native-tab-view";
|
||||
import { RouteProps } from "react-router-navigation-core";
|
||||
import {
|
||||
NavigationTransitionProps,
|
||||
|
||||
@@ -7,10 +7,10 @@
|
||||
"types": [],
|
||||
"paths": {
|
||||
"react-navigation": [
|
||||
"react-navigation/v2"
|
||||
"react-navigation/v1"
|
||||
],
|
||||
"react-navigation/*": [
|
||||
"react-navigation/v2/*"
|
||||
"react-navigation/v1/*"
|
||||
]
|
||||
},
|
||||
"module": "commonjs",
|
||||
|
||||
Vendored
+134
@@ -0,0 +1,134 @@
|
||||
// Type definitions for react-sticky-el 1.0
|
||||
// Project: https://github.com/gm0t/react-sticky-el
|
||||
// Definitions by: Justin Braithwaite <https://github.com/jbraithwaite>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.6
|
||||
|
||||
import * as React from "react";
|
||||
|
||||
export default Sticky;
|
||||
|
||||
declare class Sticky extends React.Component<Sticky.Props> {}
|
||||
|
||||
declare namespace Sticky {
|
||||
interface Props<HolderProps extends object = {}>
|
||||
extends React.HTMLAttributes<HTMLElement> {
|
||||
/**
|
||||
* 'top' or 'bottom' - to which side element should stick.
|
||||
*
|
||||
* Defaults to 'top'.
|
||||
*/
|
||||
mode?: "top" | "bottom";
|
||||
|
||||
/**
|
||||
* Allows you to disable sticking by setting this prop to `true`.
|
||||
*
|
||||
* Defaults to `false`.
|
||||
*/
|
||||
disabled?: boolean;
|
||||
|
||||
/**
|
||||
* This handler will be called right before changing `fixed` state.
|
||||
*
|
||||
* Defaults to `null`.
|
||||
*/
|
||||
onFixedToggle?: (fixed: boolean) => void;
|
||||
|
||||
/**
|
||||
* Anything that can be used by `React.createElement`. Used for `wrapper
|
||||
* element`. If you want to use some custom component, please be sure that
|
||||
* you don't lose `style` and `className` props.
|
||||
*
|
||||
* Defaults to 'div'.
|
||||
*/
|
||||
wrapperCmp?: keyof React.ReactHTML | React.ReactElement<any>;
|
||||
|
||||
/**
|
||||
* Anything that can be used by React.createElement. Used for holder
|
||||
* element. If you want to use some custom component, please be sure that
|
||||
* you don't lose style and className props.
|
||||
*
|
||||
* Defaults to 'div'.
|
||||
*/
|
||||
holderCmp?: keyof React.ReactHTML | React.ReactElement<HolderProps>;
|
||||
|
||||
/**
|
||||
* These props will be used to create `holderElement`.
|
||||
*/
|
||||
holderProps?: HolderProps;
|
||||
|
||||
/**
|
||||
* Selector to define a `boundaryElement`. It should be one of the parents
|
||||
* of the current element.
|
||||
*
|
||||
* Defaults to `null`.
|
||||
*/
|
||||
boundaryElement?: string;
|
||||
|
||||
/**
|
||||
* Selector to define a `scrollElement`. All position checks will be
|
||||
* performed according to this element, also it will be listened for
|
||||
* 'scroll' event.
|
||||
*
|
||||
* It should be one of the parents of the current element. Possible
|
||||
* selectors: 'body', 'window', '#{id}', anything suitable for
|
||||
* `Element.matches`.
|
||||
*
|
||||
* Defaults to `window`.
|
||||
*/
|
||||
scrollElement?: string;
|
||||
|
||||
/**
|
||||
* If your DOM structure is mutating (you are adding/removing elements), it
|
||||
* will be usefull to provide `positionRecheckInterval` greater than zero,
|
||||
* in this case position check will be also performed using setInterval in
|
||||
* addition to scroll events.
|
||||
*
|
||||
* Defaults to `0`.
|
||||
*/
|
||||
positionRecheckInterval?: number;
|
||||
|
||||
/**
|
||||
* In the event that you wish to override the style rules applied, simply
|
||||
* pass in the style object as a prop.
|
||||
*
|
||||
* Note: You likely want to avoid messing with the following attributes in
|
||||
* your stickyStyle: `left`, `top`, and `width`.
|
||||
*/
|
||||
stickyStyle?: React.CSSProperties;
|
||||
|
||||
/**
|
||||
* You can also specify a class name to be applied when the element becomes
|
||||
* sticky.
|
||||
*
|
||||
* Defaults to 'sticky'.
|
||||
*/
|
||||
stickyClassName?: string;
|
||||
|
||||
/**
|
||||
* Sticky state will be triggered when the top of the element is `topOffset`
|
||||
* pixels from the top of the `scrollElement`. Positive numbers give the
|
||||
* impression of a lazy sticky state, whereas negative numbers are more
|
||||
* eager in their attachment.
|
||||
*
|
||||
* Defaults to `0`.
|
||||
*/
|
||||
topOffset?: number;
|
||||
|
||||
/**
|
||||
* Sticky state will be triggered when the bottom of the element is
|
||||
* `bottomOffset` pixels from the bottom of the `scrollElement`.
|
||||
*
|
||||
* Defaults to `0`.
|
||||
*/
|
||||
bottomOffset?: number;
|
||||
|
||||
/**
|
||||
* If `false` then boundaryEl should have position: relative. In this case
|
||||
* sticky element won't disappear on reaching it's boundaries.
|
||||
*
|
||||
* Defaults to `true`.
|
||||
*/
|
||||
hideOnBoundaryHit?: boolean;
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user