Merge remote-tracking branch 'upstream/master'

This commit is contained in:
Romain Faust
2018-08-01 12:15:40 +02:00
172 changed files with 12909 additions and 1500 deletions
+1
View File
@@ -4293,6 +4293,7 @@
/types/timer-machine/ @dolanmiu
/types/timezone-js/ @bonnici
/types/tinajs__tina/ @Jimexist
/types/tinajs__tina-redux/ @Jimexist
/types/tinder/ @pingec
/types/tiny-slider-react/ @screendriver
/types/tinycolor2/ @M-Zuber @geertjansen @nvh
+3
View File
@@ -67,6 +67,9 @@ var mongoConnectionString = "mongodb://127.0.0.1/agenda";
await job.save();
const jobs = await agenda.jobs({ name: 'printAnalyticsReport' });
jobs.forEach((job) => {
job.save();
});
let numRemoved = await agenda.cancel({ name: 'printAnalyticsReport' });
+1 -1
View File
@@ -96,7 +96,7 @@ declare class Agenda extends EventEmitter {
* Find all Jobs matching `query` and pass same back in cb().
* @param query
*/
jobs<T extends Agenda.JobAttributesData = Agenda.JobAttributesData>(query: any): Promise<void>;
jobs<T extends Agenda.JobAttributesData = Agenda.JobAttributesData>(query: any): Promise<Agenda.Job<T>[]>;
/**
* Removes all jobs in the database without defined behaviors. Useful if you change a definition name and want
+3 -3
View File
@@ -10,10 +10,10 @@ import { GeneratorOptions } from "@babel/generator";
import traverse, { Visitor, NodePath } from "@babel/traverse";
import template from "@babel/template";
import * as t from "@babel/types";
import { BabylonOptions } from "babylon";
import { ParseOptions } from "@babel/parser";
export {
BabylonOptions,
ParseOptions,
GeneratorOptions,
t as types,
template,
@@ -217,7 +217,7 @@ export interface TransformOptions {
*
* Default: `{}`
*/
parserOpts?: BabylonOptions | null;
parserOpts?: ParseOptions | null;
/**
* List of plugins to load and use
+3
View File
@@ -22,6 +22,9 @@
"@babel/generator": [
"babel__generator"
],
"@babel/parser": [
"babel__parser"
],
"@babel/template": [
"babel__template"
],
@@ -135,6 +135,15 @@ class MyView extends Marionette.View<MyModel> {
}
}
class MyOtherView extends MyView {
private readonly foo: string;
constructor(model: MyModel) {
super(model);
this.foo = 'bar';
}
}
class MainRegion extends Marionette.Region {
constructor() {
super();
@@ -185,10 +194,20 @@ class MyHtmlElRegion extends Marionette.Region {
}
}
class MyCollectionView extends Marionette.CollectionView<MyModel, MyView> {
class MyCollectionView extends Marionette.CollectionView<MyModel, MyView | MyOtherView> {
constructor() {
super();
this.childView = (model: MyModel) => {
if (model.get('isFoo')) {
return MyView;
}
return MyOtherView;
};
this.childView = MyView;
this.childViewEvents = {
render() {
console.log('a childView has been rendered');
@@ -282,7 +301,7 @@ function CollectionViewTests() {
cv.collection.add(new MyModel());
app.mainRegion.show(cv);
cv.emptyView = MyView;
const view: Marionette.CollectionView<MyModel, MyView> = cv.destroy();
const view: Marionette.CollectionView<MyModel, MyView | MyOtherView> = cv.destroy();
}
class MyController {
+4 -3
View File
@@ -3,7 +3,8 @@
// Definitions by: Zeeshan Hamid <https://github.com/zhamid>,
// Natan Vivo <https://github.com/nvivo>,
// Sven Tschui <https://github.com/sventschui>,
// Volker Nauruhn <https://github.com/razorness>
// Volker Nauruhn <https://github.com/razorness>,
// Ard Timmerman <https://github.com/confususs>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
@@ -1157,7 +1158,7 @@ export interface CollectionViewOptions<
/**
* Specify a child view to use.
*/
childView?: (() => typeof Backbone.View) | typeof Backbone.View;
childView?: ((model: TModel) => typeof Backbone.View) | typeof Backbone.View;
/**
* Define options to pass to the childView constructor.
@@ -1219,7 +1220,7 @@ export class CollectionView<TModel extends Backbone.Model, TView extends View<TM
/**
* Specify a child view to use.
*/
childView: (() => { new(...args: any[]): TView }) | { new(...args: any[]): TView };
childView: ((model: TModel) => { new(...args: any[]): TView }) | { new(...args: any[]): TView };
/**
* Define options to pass to the childView constructor.
+4 -1
View File
@@ -6,7 +6,10 @@ import Redis = require("ioredis");
import Queue = require("bull");
const videoQueue = new Queue('video transcoding', 'redis://127.0.0.1:6379');
const audioQueue = new Queue('audio transcoding', {redis: {port: 6379, host: '127.0.0.1'}}); // Specify Redis connection using object
const audioQueue = new Queue('audio transcoding', {
redis: {port: 6379, host: '127.0.0.1'}, // Specify Redis connection using object
settings: {},
});
const imageQueue: Queue.Queue<{ image: string }> = new Queue('image transcoding');
videoQueue.process((job, done) => {
+1 -1
View File
@@ -88,7 +88,7 @@ declare namespace Bull {
/**
* Define a custom backoff strategy
*/
backoffStrategies: {
backoffStrategies?: {
[key: string]: (attemptsMade: number, err: typeof Error) => number;
};
}
+1 -1
View File
@@ -6,7 +6,7 @@
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": false,
"strictNullChecks": true,
"strictFunctionTypes": true,
"baseUrl": "../",
"typeRoots": [
+1 -1
View File
@@ -3593,7 +3593,7 @@ declare namespace Cesium {
cull?: boolean;
asynchronous?: boolean;
debugShowBoundingVolume?: boolean;
shadows: ShadowMode
shadows?: ShadowMode
});
destroy(): void;
getGeometryInstanceAttributes(id: any): any;
+6
View File
@@ -14,6 +14,12 @@ const cb5 = new ClipboardJS(".btn", {
action: elem => "copy",
target: elem => null
});
const cb6 = new ClipboardJS(".btn", {
action: elem => "copy",
text: trigger => trigger.getAttribute('aria-label'),
target: trigger => trigger.nextElementSibling,
container: document.getElementById('modal')
});
cb1.destroy();
ClipboardJS.isSupported();
+8
View File
@@ -49,6 +49,14 @@ declare namespace ClipboardJS {
* @returns Text to be copied.
*/
text?(elem: Element): string;
/**
* For use in Bootstrap Modals or with any
* other library that changes the focus
* you'll want to set the focused element
* as the container value.
*/
container?: Element;
}
interface Event {
+8 -7
View File
@@ -189,6 +189,10 @@ stratificatorizer = d3Hierarchy.stratify<TabularHierarchyDatum>();
// id(...)
stratificatorizer = stratificatorizer.id((d) => {
return d.name; // d is of type TabularHierarchyDatum
});
stratificatorizer = stratificatorizer.id((d, i, data) => {
console.log('Length of tabular array: ', data.length);
console.log('Name of first entry in tabular array: ', data[0].name); // data of type Array<TabularHierarchyDatum>
@@ -199,6 +203,10 @@ idStringAccessor = stratificatorizer.id();
// parentId(...)
stratificatorizer = stratificatorizer.parentId((d) => {
return d.parentId; // d is of type TabularHierarchyDatum
});
stratificatorizer = stratificatorizer.parentId((d, i, data) => {
console.log('Length of tabular array: ', data.length);
console.log('Name of first entry in tabular array: ', data[0].name); // data of type Array<TabularHierarchyDatum>
@@ -225,14 +233,12 @@ clusterLayout = d3Hierarchy.cluster<HierarchyDatumWithParentId>();
// size() ----------------------------------------------------------------
clusterLayout = clusterLayout.size(null);
clusterLayout = clusterLayout.size([200, 200]);
size = clusterLayout.size();
// nodeSize() ------------------------------------------------------------
clusterLayout = clusterLayout.nodeSize(null);
clusterLayout = clusterLayout.nodeSize([10, 10]);
size = clusterLayout.nodeSize();
@@ -358,14 +364,12 @@ treeLayout = d3Hierarchy.tree<HierarchyDatumWithParentId>();
// size() ----------------------------------------------------------------
treeLayout = treeLayout.size(null);
treeLayout = treeLayout.size([200, 200]);
size = treeLayout.size();
// nodeSize() ------------------------------------------------------------
treeLayout = treeLayout.nodeSize(null);
treeLayout = treeLayout.nodeSize([10, 10]);
size = treeLayout.nodeSize();
@@ -416,7 +420,6 @@ tilingFn = treemapLayout.tile();
// size() ----------------------------------------------------------------
treemapLayout = treemapLayout.size(null);
treemapLayout = treemapLayout.size([400, 200]);
size = treemapLayout.size();
@@ -635,7 +638,6 @@ partitionLayout = d3Hierarchy.partition<HierarchyDatumWithParentId>();
// size() ----------------------------------------------------------------
partitionLayout = partitionLayout.size(null);
partitionLayout = partitionLayout.size([400, 200]);
size = partitionLayout.size();
@@ -674,7 +676,6 @@ packLayout = d3Hierarchy.pack<HierarchyDatumWithParentId>();
// size() ----------------------------------------------------------------
packLayout = packLayout.size(null);
packLayout = packLayout.size([400, 400]);
size = packLayout.size();
+626 -98
View File
@@ -1,65 +1,208 @@
// Type definitions for D3JS d3-hierarchy module 1.1
// Project: https://github.com/d3/d3-hierarchy/
// Definitions by: Tom Wanzek <https://github.com/tomwanzek>, Alex Ford <https://github.com/gustavderdrache>, Boris Yankov <https://github.com/borisyankov>
// Definitions by: Tom Wanzek <https://github.com/tomwanzek>
// Alex Ford <https://github.com/gustavderdrache>
// Boris Yankov <https://github.com/borisyankov>
// denisname <https://github.com/denisname>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// Last module patch version validated against: 1.1.1
// Last module patch version validated against: 1.1.6
// -----------------------------------------------------------------------
// Hierarchy
// -----------------------------------------------------------------------
export interface HierarchyLink<Datum> {
/**
* The source of the link.
*/
source: HierarchyNode<Datum>;
/**
* The target of the link.
*/
target: HierarchyNode<Datum>;
}
export interface HierarchyNode<Datum> {
data: Datum;
readonly depth: number;
readonly height: number;
parent: HierarchyNode<Datum> | null;
children?: Array<HierarchyNode<Datum>>;
/**
* Aggregated numeric value as calculated by sum(value) or count(),
* if previously invoked.
* The associated data, as specified to the constructor.
*/
data: Datum;
/**
* Zero for the root node, and increasing by one for each descendant generation.
*/
readonly depth: number;
/**
* Zero for leaf nodes, and the greatest distance from any descendant leaf for internal nodes.
*/
readonly height: number;
/**
* The parent node, or null for the root node.
*/
parent: this | null;
/**
* An array of child nodes, if any; undefined for leaf nodes.
*/
children?: this[];
/**
* Aggregated numeric value as calculated by `sum(value)` or `count()`, if previously invoked.
*/
readonly value?: number;
/**
* Optional Node Id string set by StratifyOperator, if
* hierarchical data was created from tabular data using stratify()
* Optional node id string set by `StratifyOperator`, if hierarchical data was created from tabular data using stratify().
*/
readonly id?: string;
ancestors(): Array<HierarchyNode<Datum>>;
descendants(): Array<HierarchyNode<Datum>>;
leaves(): Array<HierarchyNode<Datum>>;
path(target: HierarchyNode<Datum>): Array<HierarchyNode<Datum>>;
/**
* Returns the array of ancestors nodes, starting with this node, then followed by each parent up to the root.
*/
ancestors(): this[];
/**
* Returns the array of descendant nodes, starting with this node, then followed by each child in topological order.
*/
descendants(): this[];
/**
* Returns the array of leaf nodes in traversal order; leaves are nodes with no children.
*/
leaves(): this[];
/**
* Returns the shortest path through the hierarchy from this node to the specified target node.
* The path starts at this node, ascends to the least common ancestor of this node and the target node, and then descends to the target node.
*
* @param target The target node.
*/
path(target: this): this[];
/**
* Returns an array of links for this node, where each link is an object that defines source and target properties.
* The source of each link is the parent node, and the target is a child node.
*/
links(): Array<HierarchyLink<Datum>>;
/**
* Evaluates the specified value function for this node and each descendant in post-order traversal, and returns this node.
* The `node.value` property of each node is set to the numeric value returned by the specified function plus the combined value of all descendants.
*
* @param value The value function is passed the node’s data, and must return a non-negative number.
*/
sum(value: (d: Datum) => number): this;
/**
* Computes the number of leaves under this node and assigns it to `node.value`, and similarly for every descendant of node.
* If this node is a leaf, its count is one. Returns this node.
*/
count(): this;
sort(compare: (a: HierarchyNode<Datum>, b: HierarchyNode<Datum>) => number): this;
each(func: (node: HierarchyNode<Datum>) => void): this;
eachAfter(func: (node: HierarchyNode<Datum>) => void): this;
eachBefore(func: (node: HierarchyNode<Datum>) => void): this;
copy(): HierarchyNode<Datum>;
/**
* Sorts the children of this node, if any, and each of this node’s descendants’ children,
* in pre-order traversal using the specified compare function, and returns this node.
*
* @param compare The compare function is passed two nodes a and b to compare.
* If a should be before b, the function must return a value less than zero;
* if b should be before a, the function must return a value greater than zero;
* otherwise, the relative order of a and b are not specified. See `array.sort` for more.
*/
sort(compare: (a: this, b: this) => number): this;
/**
* Invokes the specified function for node and each descendant in breadth-first order,
* such that a given node is only visited if all nodes of lesser depth have already been visited,
* as well as all preceding nodes of the same depth.
*
* @param func The specified function is passed the current node.
*/
each(func: (node: this) => void): this;
/**
* Invokes the specified function for node and each descendant in post-order traversal,
* such that a given node is only visited after all of its descendants have already been visited.
*
* @param func The specified function is passed the current node.
*/
eachAfter(func: (node: this) => void): this;
/**
* Invokes the specified function for node and each descendant in pre-order traversal,
* such that a given node is only visited after all of its ancestors have already been visited.
*
* @param func The specified function is passed the current node.
*/
eachBefore(func: (node: this) => void): this;
/**
* Return a deep copy of the subtree starting at this node. The returned deep copy shares the same data, however.
* The returned node is the root of a new tree; the returned node’s parent is always null and its depth is always zero.
*/
copy(): this;
}
/**
* Constructs a root node from the specified hierarchical data.
*
* @param data The root specified data.
* @param children The specified children accessor function invoked for each datum, starting with the root data.
* Must return an array of data representing the children, and return null or undefined if the current datum has no children.
* If children is not specified, it defaults to: `(d) => d.children`.
*/
export function hierarchy<Datum>(data: Datum, children?: (d: Datum) => (Datum[] | null)): HierarchyNode<Datum>;
// -----------------------------------------------------------------------
// Stratify
// -----------------------------------------------------------------------
// TODO: Review the comment in the API documentation related to 'reserved properties': id, parentId, children. If this is referring to the element on node, it should be 'parent'?
export interface StratifyOperator<Datum> {
/**
* Generates a new hierarchy from the specified tabular data. Each node in the returned object has a shallow copy of the properties
* from the corresponding data object, excluding the following reserved properties: id, parentId, children.
*
* @param data The root specified data.
* @throws Error on missing id, ambiguous id, cycle, multiple roots or no root.
*/
(data: Datum[]): HierarchyNode<Datum>;
/**
* Returns the current id accessor, which defaults to: `(d) => d.id`.
*/
id(): (d: Datum, i: number, data: Datum[]) => (string | null | '' | undefined);
/**
* Sets the id accessor to the given function.
* The id accessor is invoked for each element in the input data passed to the stratify operator.
* The returned string is then used to identify the node's relationships in conjunction with the parent id.
* For leaf nodes, the id may be undefined, null or the empty string; otherwise, the id must be unique.
*
* @param id The id accessor.
*/
id(id: (d: Datum, i?: number, data?: Datum[]) => (string | null | '' | undefined)): this;
/**
* Returns the current parent id accessor, which defaults to: `(d) => d.parentId`.
*/
parentId(): (d: Datum, i: number, data: Datum[]) => (string | null | '' | undefined);
/**
* Sets the parent id accessor to the given function.
* The parent id accessor is invoked for each element in the input data passed to the stratify operator.
* The returned string is then used to identify the node's relationships in conjunction with the id.
* For the root node, the parent id should be undefined, null or the empty string.
* There must be exactly one root node in the input data, and no circular relationships.
*
* @param parentId The parent id accessor.
*/
parentId(parentId: (d: Datum, i?: number, data?: Datum[]) => (string | null | '' | undefined)): this;
}
/**
* Constructs a new stratify operator with the default settings.
*/
export function stratify<Datum>(): StratifyOperator<Datum>;
// -----------------------------------------------------------------------
@@ -67,52 +210,86 @@ export function stratify<Datum>(): StratifyOperator<Datum>;
// -----------------------------------------------------------------------
export interface HierarchyPointLink<Datum> {
/**
* The source of the link.
*/
source: HierarchyPointNode<Datum>;
/**
* The target of the link.
*/
target: HierarchyPointNode<Datum>;
}
export interface HierarchyPointNode<Datum> {
export interface HierarchyPointNode<Datum> extends HierarchyNode<Datum> {
/**
* The x-coordinate of the node.
*/
x: number;
/**
* The y-coordinate of the node.
*/
y: number;
data: Datum;
readonly depth: number;
readonly height: number;
parent: HierarchyPointNode<Datum> | null;
children?: Array<HierarchyPointNode<Datum>>;
/**
* Aggregated numeric value as calculated by sum(value) or count(),
* if previously invoked.
* Returns an array of links for this node, where each link is an object that defines source and target properties.
* The source of each link is the parent node, and the target is a child node.
*/
readonly value?: number;
/**
* Optional Node Id string set by StratifyOperator, if
* hierarchical data was created from tabular data using stratify()
*/
readonly id?: string;
ancestors(): Array<HierarchyPointNode<Datum>>;
descendants(): Array<HierarchyPointNode<Datum>>;
leaves(): Array<HierarchyPointNode<Datum>>;
path(target: HierarchyPointNode<Datum>): Array<HierarchyPointNode<Datum>>;
links(): Array<HierarchyPointLink<Datum>>;
sum(value: (d: Datum) => number): this;
count(): this;
sort(compare: (a: HierarchyPointNode<Datum>, b: HierarchyPointNode<Datum>) => number): this;
each(func: (node: HierarchyPointNode<Datum>) => void): this;
eachAfter(func: (node: HierarchyPointNode<Datum>) => void): this;
eachBefore(func: (node: HierarchyPointNode<Datum>) => void): this;
copy(): HierarchyPointNode<Datum>;
}
export interface ClusterLayout<Datum> {
/**
* Lays out the specified root hierarchy.
* You may want to call `root.sort` before passing the hierarchy to the cluster layout.
*
* @param root The specified root hierarchy.
*/
(root: HierarchyNode<Datum>): HierarchyPointNode<Datum>;
/**
* Returns the current layout size, which defaults to [1, 1]. A layout size of null indicates that a node size will be used instead.
*/
size(): [number, number] | null;
/**
* Sets this cluster layout’s size to the specified [width, height] array and returns the cluster layout.
* The size represent an arbitrary coordinate system; for example, to produce a radial layout,
* a size of [360, radius] corresponds to a breadth of 360° and a depth of radius.
*
* @param size The specified two-element size array.
*/
size(size: [number, number]): this;
/**
* Returns the current node size, which defaults to null. A node size of null indicates that a layout size will be used instead.
*/
nodeSize(): [number, number] | null;
/**
* Sets this cluster layout’s node size to the specified [width, height] array and returns this cluster layout.
* When a node size is specified, the root node is always positioned at <0, 0>.
*
* @param size The specified two-element size array.
*/
nodeSize(size: [number, number]): this;
/**
* Returns the current separation accessor, which defaults to: `(a, b) => a.parent == b.parent ? 1 : 2`.
*/
separation(): (a: HierarchyPointNode<Datum>, b: HierarchyPointNode<Datum>) => number;
/**
* Sets the separation accessor to the specified function and returns this cluster layout.
* The separation accessor is used to separate neighboring leaves.
*
* @param separation The separation function is passed two leaves a and b, and must return the desired separation.
* The nodes are typically siblings, though the nodes may be more distantly related if the layout decides to place such nodes adjacent.
*/
separation(separation: (a: HierarchyPointNode<Datum>, b: HierarchyPointNode<Datum>) => number): this;
}
/**
* Creates a new cluster layout with default settings.
*/
export function cluster<Datum>(): ClusterLayout<Datum>;
// -----------------------------------------------------------------------
@@ -120,15 +297,56 @@ export function cluster<Datum>(): ClusterLayout<Datum>;
// -----------------------------------------------------------------------
export interface TreeLayout<Datum> {
/**
* Lays out the specified root hierarchy.
* You may want to call `root.sort` before passing the hierarchy to the tree layout.
*
* @param root The specified root hierarchy.
*/
(root: HierarchyNode<Datum>): HierarchyPointNode<Datum>;
/**
* Returns the current layout size, which defaults to [1, 1]. A layout size of null indicates that a node size will be used instead.
*/
size(): [number, number] | null;
/**
* Sets this tree layout’s size to the specified [width, height] array and returns the tree layout.
* The size represent an arbitrary coordinate system; for example, to produce a radial layout,
* a size of [360, radius] corresponds to a breadth of 360° and a depth of radius.
*
* @param size The specified two-element size array.
*/
size(size: [number, number]): this;
/**
* Returns the current node size, which defaults to null. A node size of null indicates that a layout size will be used instead.
*/
nodeSize(): [number, number] | null;
/**
* Sets this tree layout’s node size to the specified [width, height] array and returns this tree layout.
* When a node size is specified, the root node is always positioned at <0, 0>.
*
* @param size The specified two-element size array.
*/
nodeSize(size: [number, number]): this;
/**
* Returns the current separation accessor, which defaults to: `(a, b) => a.parent == b.parent ? 1 : 2`.
*/
separation(): (a: HierarchyPointNode<Datum>, b: HierarchyPointNode<Datum>) => number;
/**
* Sets the separation accessor to the specified function and returns this tree layout.
* The separation accessor is used to separate neighboring nodes.
*
* @param separation The separation function is passed two nodes a and b, and must return the desired separation.
* The nodes are typically siblings, though the nodes may be more distantly related if the layout decides to place such nodes adjacent.
*/
separation(separation: (a: HierarchyPointNode<Datum>, b: HierarchyPointNode<Datum>) => number): this;
}
/**
* Creates a new tree layout with default settings.
*/
export function tree<Datum>(): TreeLayout<Datum>;
// -----------------------------------------------------------------------
@@ -136,91 +354,283 @@ export function tree<Datum>(): TreeLayout<Datum>;
// -----------------------------------------------------------------------
export interface HierarchyRectangularLink<Datum> {
/**
* The source of the link.
*/
source: HierarchyRectangularNode<Datum>;
/**
* The target of the link.
*/
target: HierarchyRectangularNode<Datum>;
}
export interface HierarchyRectangularNode<Datum> {
export interface HierarchyRectangularNode<Datum> extends HierarchyNode<Datum> {
/**
* The left edge of the rectangle.
*/
x0: number;
/**
* The top edge of the rectangle
*/
y0: number;
/**
* The right edge of the rectangle.
*/
x1: number;
/**
* The bottom edge of the rectangle.
*/
y1: number;
data: Datum;
readonly depth: number;
readonly height: number;
parent: HierarchyRectangularNode<Datum> | null;
children?: Array<HierarchyRectangularNode<Datum>>;
/**
* Aggregated numeric value as calculated by sum(value) or count(),
* if previously invoked.
* Returns an array of links for this node, where each link is an object that defines source and target properties.
* The source of each link is the parent node, and the target is a child node.
*/
readonly value?: number;
/**
* Optional Node Id string set by StratifyOperator, if
* hierarchical data was created from tabular data using stratify()
*/
readonly id?: string;
ancestors(): Array<HierarchyRectangularNode<Datum>>;
descendants(): Array<HierarchyRectangularNode<Datum>>;
leaves(): Array<HierarchyRectangularNode<Datum>>;
path(target: HierarchyRectangularNode<Datum>): Array<HierarchyRectangularNode<Datum>>;
links(): Array<HierarchyRectangularLink<Datum>>;
sum(value: (d: Datum) => number): this;
count(): this;
sort(compare: (a: HierarchyRectangularNode<Datum>, b: HierarchyRectangularNode<Datum>) => number): this;
each(func: (node: HierarchyRectangularNode<Datum>) => void): this;
eachAfter(func: (node: HierarchyRectangularNode<Datum>) => void): this;
eachBefore(func: (node: HierarchyRectangularNode<Datum>) => void): this;
copy(): HierarchyRectangularNode<Datum>;
}
export interface TreemapLayout<Datum> {
/**
* Lays out the specified root hierarchy.
* You must call `root.sum` before passing the hierarchy to the treemap layout.
* You probably also want to call `root.sort` to order the hierarchy before computing the layout.
*
* @param root The specified root hierarchy.
*/
(root: HierarchyNode<Datum>): HierarchyRectangularNode<Datum>;
/**
* Returns the current tiling method, which defaults to `d3.treemapSquarify` with the golden ratio.
*/
tile(): (node: HierarchyRectangularNode<Datum>, x0: number, y0: number, x1: number, y1: number) => void;
/**
* Sets the tiling method to the specified function and returns this treemap layout.
*
* @param tile The specified tiling function.
*/
tile(tile: (node: HierarchyRectangularNode<Datum>, x0: number, y0: number, x1: number, y1: number) => void): this;
/**
* Returns the current size, which defaults to [1, 1].
*/
size(): [number, number];
/**
* Sets this treemap layout’s size to the specified [width, height] array and returns this treemap layout.
*
* @param size The specified two-element size array.
*/
size(size: [number, number]): this;
/**
* Returns the current rounding state, which defaults to false.
*/
round(): boolean;
/**
* Enables or disables rounding according to the given boolean and returns this treemap layout.
*
* @param round The specified boolean flag.
*/
round(round: boolean): this;
/**
* Returns the current inner padding function.
*/
padding(): (node: HierarchyRectangularNode<Datum>) => number;
/**
* Sets the inner and outer padding to the specified number and returns this treemap layout.
*
* @param padding The specified padding value.
*/
padding(padding: number): this;
/**
* Sets the inner and outer padding to the specified function and returns this treemap layout.
*
* @param padding The specified padding function.
*/
padding(padding: (node: HierarchyRectangularNode<Datum>) => number): this;
/**
* Returns the current inner padding function, which defaults to the constant zero.
*/
paddingInner(): (node: HierarchyRectangularNode<Datum>) => number;
/**
* Sets the inner padding to the specified number and returns this treemap layout.
* The inner padding is used to separate a node’s adjacent children.
*
* @param padding The specified inner padding value.
*/
paddingInner(padding: number): this;
/**
* Sets the inner padding to the specified function and returns this treemap layout.
* The function is invoked for each node with children, being passed the current node.
* The inner padding is used to separate a node’s adjacent children.
*
* @param padding The specified inner padding function.
*/
paddingInner(padding: (node: HierarchyRectangularNode<Datum>) => number): this;
/**
* Returns the current top padding function.
*/
paddingOuter(): (node: HierarchyRectangularNode<Datum>) => number;
/**
* Sets the top, right, bottom and left padding to the specified function and returns this treemap layout.
*
* @param padding The specified padding outer value.
*/
paddingOuter(padding: number): this;
/**
* Sets the top, right, bottom and left padding to the specified function and returns this treemap layout.
*
* @param padding The specified padding outer function.
*/
paddingOuter(padding: (node: HierarchyRectangularNode<Datum>) => number): this;
/**
* Returns the current top padding function, which defaults to the constant zero.
*/
paddingTop(): (node: HierarchyRectangularNode<Datum>) => number;
/**
* Sets the top padding to the specified number and returns this treemap layout.
* The top padding is used to separate the top edge of a node from its children.
*
* @param padding The specified top padding value.
*/
paddingTop(padding: number): this;
/**
* Sets the top padding to the specified function and returns this treemap layout.
* The function is invoked for each node with children, being passed the current node.
* The top padding is used to separate the top edge of a node from its children.
*
* @param padding The specified top padding function.
*/
paddingTop(padding: (node: HierarchyRectangularNode<Datum>) => number): this;
/**
* Returns the current right padding function, which defaults to the constant zero.
*/
paddingRight(): (node: HierarchyRectangularNode<Datum>) => number;
/**
* Sets the right padding to the specified number and returns this treemap layout.
* The right padding is used to separate the right edge of a node from its children.
*
* @param padding The specified right padding value.
*/
paddingRight(padding: number): this;
/**
* Sets the right padding to the specified function and returns this treemap layout.
* The function is invoked for each node with children, being passed the current node.
* The right padding is used to separate the right edge of a node from its children.
*
* @param padding The specified right padding function.
*/
paddingRight(padding: (node: HierarchyRectangularNode<Datum>) => number): this;
/**
* Returns the current bottom padding function, which defaults to the constant zero.
*/
paddingBottom(): (node: HierarchyRectangularNode<Datum>) => number;
/**
* Sets the bottom padding to the specified number and returns this treemap layout.
* The bottom padding is used to separate the bottom edge of a node from its children.
*
* @param padding The specified bottom padding value.
*/
paddingBottom(padding: number): this;
/**
* Sets the bottom padding to the specified function and returns this treemap layout.
* The function is invoked for each node with children, being passed the current node.
* The bottom padding is used to separate the bottom edge of a node from its children.
*
* @param padding The specified bottom padding function.
*/
paddingBottom(padding: (node: HierarchyRectangularNode<Datum>) => number): this;
/**
* Returns the current left padding function, which defaults to the constant zero.
*/
paddingLeft(): (node: HierarchyRectangularNode<Datum>) => number;
/**
* Sets the left padding to the specified number and returns this treemap layout.
* The left padding is used to separate the left edge of a node from its children.
*
* @param padding The specified left padding value.
*/
paddingLeft(padding: number): this;
/**
* Sets the left padding to the specified function and returns this treemap layout.
* The function is invoked for each node with children, being passed the current node.
* The left padding is used to separate the left edge of a node from its children.
*
* @param padding The specified left padding function.
*/
paddingLeft(padding: (node: HierarchyRectangularNode<Datum>) => number): this;
}
/**
* Creates a new treemap layout with default settings.
*/
export function treemap<Datum>(): TreemapLayout<Datum>;
// Tiling functions ---------------------------------------------------------------------------------
// Tiling functions -----------------------------------------------------------------------
/**
* Recursively partitions the specified nodes into an approximately-balanced binary tree,
* choosing horizontal partitioning for wide rectangles and vertical partitioning for tall rectangles.
*/
export function treemapBinary(node: HierarchyRectangularNode<any>, x0: number, y0: number, x1: number, y1: number): void;
/**
* Divides the rectangular area specified by x0, y0, x1, y1 horizontally according the value of each of the specified node’s children.
* The children are positioned in order, starting with the left edge (x0) of the given rectangle.
* If the sum of the children’s values is less than the specified node’s value (i.e., if the specified node has a non-zero internal value),
* the remaining empty space will be positioned on the right edge (x1) of the given rectangle.
*/
export function treemapDice(node: HierarchyRectangularNode<any>, x0: number, y0: number, x1: number, y1: number): void;
/**
* Divides the rectangular area specified by x0, y0, x1, y1 vertically according the value of each of the specified node’s children.
* The children are positioned in order, starting with the top edge (y0) of the given rectangle.
* If the sum of the children’s values is less than the specified node’s value (i.e., if the specified node has a non-zero internal value),
* the remaining empty space will be positioned on the bottom edge (y1) of the given rectangle.
*/
export function treemapSlice(node: HierarchyRectangularNode<any>, x0: number, y0: number, x1: number, y1: number): void;
/**
* If the specified node has odd depth, delegates to treemapSlice; otherwise delegates to treemapDice.
*/
export function treemapSliceDice(node: HierarchyRectangularNode<any>, x0: number, y0: number, x1: number, y1: number): void;
// TODO: Test Factory code
export interface RatioSquarifyTilingFactory {
(node: HierarchyRectangularNode<any>, x0: number, y0: number, x1: number, y1: number): void;
/**
* Specifies the desired aspect ratio of the generated rectangles.
* Note that the orientation of the generated rectangles (tall or wide) is not implied by the ratio.
* Furthermore, the rectangles ratio are not guaranteed to have the exact specified aspect ratio.
* If not specified, the aspect ratio defaults to the golden ratio, φ = (1 + sqrt(5)) / 2, per Kong et al.
*
* @param ratio The specified ratio value greater than or equal to one.
*/
ratio(ratio: number): RatioSquarifyTilingFactory;
}
/**
* Implements the squarified treemap algorithm by Bruls et al., which seeks to produce rectangles of a given aspect ratio.
*/
export const treemapSquarify: RatioSquarifyTilingFactory;
/**
* Like `d3.treemapSquarify`, except preserves the topology (node adjacencies) of the previous layout computed by `d3.treemapResquarify`,
* if there is one and it used the same target aspect ratio. This tiling method is good for animating changes to treemaps because
* it only changes node sizes and not their relative positions, thus avoiding distracting shuffling and occlusion.
* The downside of a stable update, however, is a suboptimal layout for subsequent updates: only the first layout uses the Bruls et al. squarified algorithm.
*/
export const treemapResquarify: RatioSquarifyTilingFactory;
// -----------------------------------------------------------------------
@@ -228,15 +638,53 @@ export const treemapResquarify: RatioSquarifyTilingFactory;
// -----------------------------------------------------------------------
export interface PartitionLayout<Datum> {
/**
* Lays out the specified root hierarchy.
* You must call `root.sum` before passing the hierarchy to the partition layout.
* You probably also want to call `root.sort` to order the hierarchy before computing the layout.
*
* @param root The specified root hierarchy.
*/
(root: HierarchyNode<Datum>): HierarchyRectangularNode<Datum>;
/**
* Returns the current size, which defaults to [1, 1].
*/
size(): [number, number];
/**
* Sets this partition layout’s size to the specified [width, height] array and returns this partition layout.
*
* @param size The specified two-element size array.
*/
size(size: [number, number]): this;
/**
* Returns the current rounding state, which defaults to false.
*/
round(): boolean;
/**
* Enables or disables rounding according to the given boolean and returns this partition layout.
*
* @param round The specified boolean flag.
*/
round(round: boolean): this;
/**
* Returns the current padding, which defaults to zero.
*/
padding(): number;
/**
* Sets the padding to the specified number and returns this partition layout.
* The padding is used to separate a node’s adjacent children.
*
* @param padding The specified padding value.
*/
padding(padding: number): this;
}
/**
* Creates a new partition layout with the default settings.
*/
export function partition<Datum>(): PartitionLayout<Datum>;
// -----------------------------------------------------------------------
@@ -244,54 +692,110 @@ export function partition<Datum>(): PartitionLayout<Datum>;
// -----------------------------------------------------------------------
export interface HierarchyCircularLink<Datum> {
/**
* The source of the link.
*/
source: HierarchyCircularNode<Datum>;
/**
* The target of the link.
*/
target: HierarchyCircularNode<Datum>;
}
export interface HierarchyCircularNode<Datum> {
export interface HierarchyCircularNode<Datum> extends HierarchyNode<Datum> {
/**
* The x-coordinate of the circle’s center.
*/
x: number;
/**
* The y-coordinate of the circle’s center.
*/
y: number;
/**
* The radius of the circle.
*/
r: number;
data: Datum;
readonly depth: number;
readonly height: number;
parent: HierarchyCircularNode<Datum> | null;
children?: Array<HierarchyCircularNode<Datum>>;
/**
* Aggregated numeric value as calculated by sum(value) or count(),
* if previously invoked.
* Returns an array of links for this node, where each link is an object that defines source and target properties.
* The source of each link is the parent node, and the target is a child node.
*/
readonly value?: number;
/**
* Optional Node Id string set by StratifyOperator, if
* hierarchical data was created from tabular data using stratify()
*/
readonly id?: string;
ancestors(): Array<HierarchyCircularNode<Datum>>;
descendants(): Array<HierarchyCircularNode<Datum>>;
leaves(): Array<HierarchyCircularNode<Datum>>;
path(target: HierarchyCircularNode<Datum>): Array<HierarchyCircularNode<Datum>>;
links(): Array<HierarchyCircularLink<Datum>>;
sum(value: (d: Datum) => number): this;
count(): this;
sort(compare: (a: HierarchyCircularNode<Datum>, b: HierarchyCircularNode<Datum>) => number): this;
each(func: (node: HierarchyCircularNode<Datum>) => void): this;
eachAfter(func: (node: HierarchyCircularNode<Datum>) => void): this;
eachBefore(func: (node: HierarchyCircularNode<Datum>) => void): this;
copy(): HierarchyCircularNode<Datum>;
}
export interface PackLayout<Datum> {
/**
* Lays out the specified root hierarchy.
* You must call `root.sum` before passing the hierarchy to the pack layout.
* You probably also want to call `root.sort` to order the hierarchy before computing the layout.
*
* @param root The specified root hierarchy.
*/
(root: HierarchyNode<Datum>): HierarchyCircularNode<Datum>;
/**
* Returns the current radius accessor, which defaults to null.
*/
radius(): null | ((node: HierarchyCircularNode<Datum>) => number);
/**
* Sets the pack layout’s radius accessor to the specified function and returns this pack layout.
* If the radius accessor is null, the radius of each leaf circle is derived from the leaf `node.value` (computed by `node.sum`);
* the radii are then scaled proportionally to fit the layout size.
* If the radius accessor is not null, the radius of each leaf circle is specified exactly by the function.
*
* @param radius The specified radius accessor.
*/
radius(radius: (node: HierarchyCircularNode<Datum>) => number): this;
/**
* Returns the current size, which defaults to [1, 1].
*/
size(): [number, number];
/**
* Sets this pack layout’s size to the specified [width, height] array and returns this pack layout.
*
* @param size The specified two-element size array.
*/
size(size: [number, number]): this;
/**
* Returns the current padding accessor, which defaults to the constant zero.
*/
padding(): (node: HierarchyCircularNode<Datum>) => number;
/**
* Sets this pack layout’s padding accessor to the specified number and returns this pack layout.
* Returns the current padding accessor, which defaults to the constant zero.
*
* When siblings are packed, tangent siblings will be separated by approximately the specified padding;
* the enclosing parent circle will also be separated from its children by approximately the specified padding.
* If an explicit radius is not specified, the padding is approximate because a two-pass algorithm
* is needed to fit within the layout size: the circles are first packed without padding;
* a scaling factor is computed and applied to the specified padding; and lastly the circles are re-packed with padding.
*
* @param padding The specified padding value.
*/
padding(padding: number): this;
/**
* Sets this pack layout’s padding accessor to the specified function and returns this pack layout.
* Returns the current padding accessor, which defaults to the constant zero.
*
* When siblings are packed, tangent siblings will be separated by approximately the specified padding;
* the enclosing parent circle will also be separated from its children by approximately the specified padding.
* If an explicit radius is not specified, the padding is approximate because a two-pass algorithm
* is needed to fit within the layout size: the circles are first packed without padding;
* a scaling factor is computed and applied to the specified padding; and lastly the circles are re-packed with padding.
*
* @param padding The specified padding function.
*/
padding(padding: (node: HierarchyCircularNode<Datum>) => number): this;
}
/**
* Creates a new pack layout with the default settings.
*/
export function pack<Datum>(): PackLayout<Datum>;
// -----------------------------------------------------------------------
@@ -299,8 +803,19 @@ export function pack<Datum>(): PackLayout<Datum>;
// -----------------------------------------------------------------------
export interface PackCircle {
/**
* The radius of the circle.
*/
r: number;
/**
* The x-coordinate of the circle’s center.
*/
x?: number;
/**
* The y-coordinate of the circle’s center.
*/
y?: number;
}
@@ -309,6 +824,19 @@ export interface PackCircle {
// For invocation of packEnclose the x and y coordinates are mandatory. It seems easier to just comment
// on the mandatory nature, then to create separate interfaces and having to deal with recasting.
/**
* Packs the specified array of circles, each of which must have a `circle.r` property specifying the circle’s radius.
* The circles are positioned according to the front-chain packing algorithm by Wang et al.
*
* @param circles The specified array of circles to pack.
*/
export function packSiblings<Datum extends PackCircle>(circles: Datum[]): Datum[];
/**
* Computes the smallest circle that encloses the specified array of circles, each of which must have
* a `circle.r` property specifying the circle’s radius, and `circle.x` and `circle.y` properties specifying the circle’s center.
* The enclosing circle is computed using the Matoušek-Sharir-Welzl algorithm. (See also Apollonius’ Problem.)
*
* @param circles The specified array of circles to pack.
*/
export function packEnclose<Datum extends PackCircle>(circles: Datum[]): { r: number, x: number, y: number };
+3
View File
@@ -0,0 +1,3 @@
import isNode = require("detect-node");
isNode;
+8
View File
@@ -0,0 +1,8 @@
// Type definitions for detect-node 2.0
// Project: https://github.com/iliakan/detect-node
// Definitions by: Leonid Logvinov <https://github.com/LogvinovLeon>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.4
declare const isNode: boolean;
export = isNode;
+16
View File
@@ -0,0 +1,16 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": ["es6"],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
"baseUrl": "../",
"typeRoots": ["../"],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": ["index.d.ts", "detect-node-tests.ts"]
}
+1
View File
@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }
+49 -3
View File
@@ -328,11 +328,11 @@ declare module 'ember' {
*/
resolveRegistration(fullName: string): Function;
/**
* Registers a factory that can be used for dependency injection (with
* Registers a factory or value that can be used for dependency injection (with
* `inject`) or for service lookup. Each factory is registered with
* a full name including two parts: `type:name`.
*/
register(fullName: string, factory: Function, options?: { singleton?: boolean, instantiate?: boolean }): any;
register(fullName: string, factory: any, options?: { singleton?: boolean, instantiate?: boolean }): any;
/**
* Unregister a factory.
*/
@@ -3372,7 +3372,48 @@ declare module 'ember' {
/**
* The Router service is the public API that provides component/view layer access to the router.
*/
class RouterService extends Ember.Service {
export class RouterService extends Ember.Service {
//
/**
Name of the current route.
This property represent the logical name of the route,
which is comma separated.
For the following router:
```app/router.js
Router.map(function() {
this.route('about');
this.route('blog', function () {
this.route('post', { path: ':post_id' });
});
});
```
It will return:
* `index` when you visit `/`
* `about` when you visit `/about`
* `blog.index` when you visit `/blog`
* `blog.post` when you visit `/blog/some-post-id`
*/
readonly currentRouteName: string;
//
/**
Current URL for the application.
This property represent the URL path for this route.
For the following router:
```app/router.js
Router.map(function() {
this.route('about');
this.route('blog', function () {
this.route('post', { path: ':post_id' });
});
});
```
It will return:
* `/` when you visit `/`
* `/about` when you visit `/about`
* `/blog` when you visit `/blog`
* `/blog/some-post-id` when you visit `/blog/some-post-id`
*/
readonly currentURL: string;
//
/**
* Determines whether a route is active.
@@ -3776,6 +3817,11 @@ declare module '@ember/routing/router' {
export default class EmberRouter extends Ember.Router { }
}
declare module '@ember/routing/router-service' {
import { RouterService } from 'ember';
export default class extends RouterService { }
}
declare module '@ember/runloop' {
import Ember from 'ember';
export const begin: typeof Ember.run.begin;
+3
View File
@@ -1,4 +1,5 @@
import ApplicationInstance from '@ember/application/instance';
import hbs from 'htmlbars-inline-precompile';
const appInstance = ApplicationInstance.create();
appInstance.register('some:injection', class Foo {});
@@ -11,6 +12,8 @@ appInstance.register('some:injection', class Foo {}, {
instantiate: false,
});
appInstance.register('templates:foo/bar', hbs`<h1>Hello World</h1>`);
appInstance.register('some:injection', class Foo {}, {
singleton: false,
instantiate: true,
+7
View File
@@ -1,4 +1,5 @@
import Ember from 'ember';
import { assertType } from './lib/assert';
const AppRouter = Ember.Router.extend({
});
@@ -25,6 +26,12 @@ AppRouter.map(function() {
const RouterServiceConsumer = Ember.Service.extend({
router: Ember.inject.service('router'),
currentRouteName() {
const x: string = Ember.get(this, 'router').currentRouteName;
},
currentURL() {
const x: string = Ember.get(this, 'router').currentURL;
},
transitionWithoutModel() {
Ember.get(this, 'router')
.transitionTo('some-route');
+3
View File
@@ -10,5 +10,8 @@ wifi.startAP('ssid', { password: 'pass', authMode: 'wpa_wpa2' }, err => {
console.log("created");
});
digitalWrite(D2, false);
digitalWrite(D2, true);
I2C1.setup({ scl: D4, sda: D0 });
Serial2.setup(9600, { rx: D16, tx: D17 });
+1 -1
View File
@@ -3600,7 +3600,7 @@ declare function digitalPulse(pin: Pin, value: boolean, time: any): void;
* @param value
* @url http://www.espruino.com/Reference#l__global_digitalWrite
*/
declare function digitalWrite(pin: Pin, value: number): void;
declare function digitalWrite(pin: Pin, value: number | boolean): void;
/**
* <p>Get the digital value of the given pin.</p>
@@ -0,0 +1,3 @@
import * as lw from "eth-lightwallet";
lw.keystore.createVault({});
+64
View File
@@ -0,0 +1,64 @@
// Type definitions for eth-lightwallet 3.0
// Project: https://github.com/ConsenSys/eth-lightwallet#readme
// Definitions by: Leonid Logvinov <https://github.com/LogvinovLeon>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.4
/// <reference types="node" />
export interface ECSignatureBuffer {
v: number;
r: Buffer;
s: Buffer;
}
export namespace signing {
function signTx(
keystore: keystore,
pwDerivedKey: Uint8Array,
rawTx: string,
signingAddress: string
): string;
function signMsg(
keystore: keystore,
pwDerivedKey: Uint8Array,
rawMsg: string,
signingAddress: string
): ECSignatureBuffer;
function signMsgHash(
keystore: keystore,
pwDerivedKey: Uint8Array,
msgHash: string,
signingAddress: string
): ECSignatureBuffer;
function concatSig(signature: any): string;
}
export class keystore {
static createVault(
options: any,
callback?: (error: Error, keystore: keystore) => void
): keystore;
static generateRandomSeed(): string;
static isSeedValid(seed: string): boolean;
static deserialize(keystore: string): keystore;
serialize(): string;
keyFromPassword(
password: string,
callback?: (error: Error, pwDerivedKey: Uint8Array) => void
): Uint8Array;
isDerivedKeyCorrect(pwDerivedKey: Uint8Array): boolean;
generateNewAddress(
pwDerivedKey: Uint8Array,
numberOfAddresses: number
): void;
getSeed(pwDerivedKey: Uint8Array): string;
exportPrivateKey(address: string, pwDerivedKey: Uint8Array): string;
getAddresses(): string[];
}
export interface VaultOptions {
password: string;
seedPhrase: string;
salt?: string;
hdPathString: string;
}
+23
View File
@@ -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",
"eth-lightwallet-tests.ts"
]
}
+1
View File
@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }
+95
View File
@@ -0,0 +1,95 @@
import figlet = require('figlet');
figlet('abc', (err, str) => {
// $ExpectType Error | null
err;
// $ExpectType string | undefined
str;
});
figlet('My World', '1Row', (err, str) => {
// $ExpectType Error | null
err;
// $ExpectType string | undefined
str;
});
// $ExpectError
figlet('fweGWEPewfe', 'What is the font? I cannot get it');
// $ExpectError
figlet('qweoqw');
// $ExpectError
figlet('qweoqw', '1Row');
// $ExpectError
figlet('qweoqw', '1Row', undefined as any, undefined as any);
figlet.text('tokiyo tomare', (err, str) => {
// $ExpectType Error | null
err;
// $ExpectType string | undefined
str;
});
figlet.text('Hi', 'Flower Power', (err, str) => {
// $ExpectType Error | null
err;
// $ExpectType string | undefined
str;
});
figlet.text('Annyeong', {
font: 'Fun Face',
horizontalLayout: 'full',
verticalLayout: 'fitted',
}, (err, str) => {
// $ExpectType Error | null
err;
// $ExpectType string | undefined
str;
});
figlet.text('Oreehe', {
font: 'Fun Face',
// $ExpectError
value: 'abc',
}, undefined as any);
// $ExpectError
figlet.text('It cannot make sense');
// $ExpectType string
figlet.textSync('test text');
// $ExpectType string
figlet.textSync('text desu', 'Fuzzy');
// $ExpectType string
figlet.textSync('oho', {
font: 'Invita',
});
// $ExpectError
figlet.textSync();
figlet.metadata('JS Block Letters', (err, fontOptions, headerComment) => {
// $ExpectType Error | null
err;
// $ExpectType FontOptions | undefined
fontOptions;
// $ExpectType string | undefined
headerComment;
});
// $ExpectError
figlet.metadata('This is random font name which cannot make sense', undefined as any);
// $ExpectError
figlet.metadata('Alligator', undefined as any, undefined as any);
// $ExpectType Defaults
figlet.defaults();
// $ExpectType Defaults
figlet.defaults({});
// $ExpectType Defaults
figlet.defaults({
font: 'Patorjk\'s Cheese'
});
figlet.fonts((err, fonts) => {
// $ExpectType Error | null
err;
// $ExpectType Fonts[] | undefined
fonts;
});
// $ExpectType Fonts[]
figlet.fontsSync();
+406
View File
@@ -0,0 +1,406 @@
// Type definitions for figlet 1.2
// Project: https://github.com/patorjk/figlet.js
// Definitions by: Junyoung Clare Jang <https://github.com/Ailrun>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.1
declare namespace figlet {
type Fonts =
| '1Row'
| '3-D'
| '3D Diagonal'
| '3D-ASCII'
| '3x5'
| '4Max'
| '5 Line Oblique'
| 'AMC 3 Line'
| 'AMC 3 Liv1'
| 'AMC AAA01'
| 'AMC Neko'
| 'AMC Razor'
| 'AMC Razor2'
| 'AMC Slash'
| 'AMC Slider'
| 'AMC Thin'
| 'AMC Tubes'
| 'AMC Untitled'
| 'ANSI Shadow'
| 'ASCII New Roman'
| 'Acrobatic'
| 'Alligator'
| 'Alligator2'
| 'Alpha'
| 'Alphabet'
| 'Arrows'
| 'Avatar'
| 'B1FF'
| 'B1FF'
| 'Banner'
| 'Banner3-D'
| 'Banner3'
| 'Banner4'
| 'Barbwire'
| 'Basic'
| 'Bear'
| 'Bell'
| 'Benjamin'
| 'Big Chief'
| 'Big Money-ne'
| 'Big Money-nw'
| 'Big Money-se'
| 'Big Money-sw'
| 'Big'
| 'Bigfig'
| 'Binary'
| 'Block'
| 'Blocks'
| 'Bloody'
| 'Bolger'
| 'Braced'
| 'Bright'
| 'Broadway KB'
| 'Broadway'
| 'Bubble'
| 'Bulbhead'
| 'Caligraphy'
| 'Caligraphy2'
| 'Calvin S'
| 'Cards'
| 'Catwalk'
| 'Chiseled'
| 'Chunky'
| 'Coinstak'
| 'Cola'
| 'Colossal'
| 'Computer'
| 'Contessa'
| 'Contrast'
| 'Cosmike'
| 'Crawford'
| 'Crawford2'
| 'Crazy'
| 'Cricket'
| 'Cursive'
| 'Cyberlarge'
| 'Cybermedium'
| 'Cybersmall'
| 'Cygnet'
| 'DANC4'
| 'DOS Rebel'
| 'DWhistled'
| 'Dancing Font'
| 'Decimal'
| 'Def Leppard'
| 'Delta Corps Priest 1'
| 'Diamond'
| 'Diet Cola'
| 'Digital'
| 'Doh'
| 'Doom'
| 'Dot Matrix'
| 'Double Shorts'
| 'Double'
| 'Dr Pepper'
| 'Efti Chess'
| 'Efti Font'
| 'Efti Italic'
| 'Efti Piti'
| 'Efti Robot'
| 'Efti Wall'
| 'Efti Water'
| 'Electronic'
| 'Elite'
| 'Epic'
| 'Fender'
| 'Filter'
| 'Fire Font-k'
| 'Fire Font-s'
| 'Flipped'
| 'Flower Power'
| 'Four Tops'
| 'Fraktur'
| 'Fun Face'
| 'Fun Faces'
| 'Fuzzy'
| 'Georgi16'
| 'Georgia11'
| 'Ghost'
| 'Ghoulish'
| 'Glenyn'
| 'Goofy'
| 'Gothic'
| 'Graceful'
| 'Gradient'
| 'Graffiti'
| 'Greek'
| 'Heart Left'
| 'Heart Right'
| 'Henry 3D'
| 'Hex'
| 'Hieroglyphs'
| 'Hollywood'
| 'Horizontal Left'
| 'Horizontal Right'
| 'ICL-1900'
| 'Impossible'
| 'Invita'
| 'Isometric1'
| 'Isometric2'
| 'Isometric3'
| 'Isometric4'
| 'Italic'
| 'Ivrit'
| 'JS Block Letters'
| 'JS Bracket Letters'
| 'JS Capital Curves'
| 'JS Cursive'
| 'JS Stick Letters'
| 'Jacky'
| 'Jazmine'
| 'Jerusalem'
| 'Katakana'
| 'Kban'
| 'Keyboard'
| 'Knob'
| 'Konto Slant'
| 'Konto'
| 'LCD'
| 'Larry 3D 2'
| 'Larry 3D'
| 'Lean'
| 'Letters'
| 'Lil Devil'
| 'Line Blocks'
| 'Linux'
| 'Lockergnome'
| 'Madrid'
| 'Marquee'
| 'Maxfour'
| 'Merlin1'
| 'Merlin2'
| 'Mike'
| 'Mini'
| 'Mirror'
| 'Mnemonic'
| 'Modular'
| 'Morse'
| 'Morse2'
| 'Moscow'
| 'Mshebrew210'
| 'Muzzle'
| 'NScript'
| 'NT Greek'
| 'NV Script'
| 'Nancyj-Fancy'
| 'Nancyj-Improved'
| 'Nancyj-Underlined'
| 'Nancyj'
| 'Nipples'
| 'O8'
| 'OS2'
| 'Octal'
| 'Ogre'
| 'Old Banner'
| 'Patorjk\'s Cheese'
| 'Patorjk-HeX'
| 'Pawp'
| 'Peaks Slant'
| 'Peaks'
| 'Pebbles'
| 'Pepper'
| 'Poison'
| 'Puffy'
| 'Puzzle'
| 'Pyramid'
| 'Rammstein'
| 'Rectangles'
| 'Red Phoenix'
| 'Relief'
| 'Relief2'
| 'Reverse'
| 'Roman'
| 'Rot13'
| 'Rot13'
| 'Rotated'
| 'Rounded'
| 'Rowan Cap'
| 'Rozzo'
| 'Runic'
| 'Runyc'
| 'S Blood'
| 'SL Script'
| 'Santa Clara'
| 'Script'
| 'Serifcap'
| 'Shadow'
| 'Shimrod'
| 'Short'
| 'Slant Relief'
| 'Slant'
| 'Slide'
| 'Small Caps'
| 'Small Isometric1'
| 'Small Keyboard'
| 'Small Poison'
| 'Small Script'
| 'Small Shadow'
| 'Small Slant'
| 'Small Tengwar'
| 'Small'
| 'Soft'
| 'Speed'
| 'Spliff'
| 'Stacey'
| 'Stampate'
| 'Stampatello'
| 'Standard'
| 'Star Strips'
| 'Star Wars'
| 'Stellar'
| 'Stforek'
| 'Stick Letters'
| 'Stop'
| 'Straight'
| 'Stronger Than All'
| 'Sub-Zero'
| 'Swamp Land'
| 'Swan'
| 'Sweet'
| 'THIS'
| 'Tanja'
| 'Tengwar'
| 'Term'
| 'Test1'
| 'The Edge'
| 'Thick'
| 'Thin'
| 'Thorned'
| 'Three Point'
| 'Ticks Slant'
| 'Ticks'
| 'Tiles'
| 'Tinker-Toy'
| 'Tombstone'
| 'Train'
| 'Trek'
| 'Tsalagi'
| 'Tubular'
| 'Twisted'
| 'Two Point'
| 'USA Flag'
| 'Univers'
| 'Varsity'
| 'Wavy'
| 'Weird'
| 'Wet Letter'
| 'Whimsy'
| 'Wow'
;
type KerningMethods =
| 'default'
| 'full'
| 'fitted'
| 'controlled smushing'
| 'universal smushing'
;
type PrintDirection = number;
interface FittingRules {
vLayout: number;
vRule5: boolean;
vRule4: boolean;
vRule3: boolean;
vRule2: boolean;
vRule1: boolean;
hLayout: number;
hRule6: boolean;
hRule5: boolean;
hRule4: boolean;
hRule3: boolean;
hRule2: boolean;
hRule1: boolean;
}
interface Options {
font?: Fonts;
horizontalLayout?: KerningMethods;
verticalLayout?: KerningMethods;
printDirection?: PrintDirection;
showHardBlanks?: boolean;
}
interface FontOptions {
hardBlank: string;
height: number;
baseline: number;
maxLength: number;
oldLayout: number;
numCommentLines: number;
printDirection: PrintDirection;
fullLayout: number | null;
codeTagCount: number | null;
fittingRules: FittingRules;
}
interface Defaults {
font: Fonts;
fontPath: string;
}
function text(txt: string, cb: (error: Error | null, result?: string) => void): void;
function text(txt: string, font: Fonts, cb: (error: Error | null, result?: string) => void): void;
/**
* @desc
* This `unified-signatures` is disabled because `Fonts` type is too long
*/
// tslint:disable-next-line: unified-signatures
function text(txt: string, options: Options | undefined, cb: (error: Error | null, result?: string) => void): void;
function textSync(txt: string, font?: Fonts): string;
/**
* @desc
* This `unified-signatures` is disabled because `Fonts` type is too long
*/
// tslint:disable-next-line: unified-signatures
function textSync(txt: string, options: Options): string;
function metadata(font: Fonts, cb: (error: Error | null, fontOptions?: FontOptions, headerComment?: string) => void): void;
function defaults(opt?: Partial<Defaults>): Defaults;
function loadFont(font: Fonts, cb: (error: Error | null, fontOptions?: FontOptions) => void): void;
/**
* @todo
* Use 'node' namespace to add following methods only in node environment.
*/
/**
* @warn
* This method works in node environment only.
* In browser environment, this method does not work.
*/
function loadFontSync(font: Fonts): FontOptions;
/**
* @warn
* This method exists in node environment only.
* In browser environment, this method does not exist.
*/
function fonts(cb: (error: Error | null, fontList?: Fonts[]) => void): void;
/**
* @warn
* This method exists in node environment only.
* In browser environment, this method does not exist.
*/
function fontsSync(): Fonts[];
}
declare function figlet(txt: string, cb: (error: Error | null, result?: string) => void): void;
declare function figlet(txt: string, font: figlet.Fonts, cb: (error: Error | null, result?: string) => void): void;
/**
* @desc
* This `unified-signatures` is disabled because `Fonts` type is too long
*/
// tslint:disable-next-line: unified-signatures
declare function figlet(txt: string, options: figlet.Options | undefined, cb: (error: Error | null, result?: string) => void): void;
export as namespace figlet;
export = figlet;
+23
View File
@@ -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",
"figlet-tests.ts"
]
}
+3
View File
@@ -0,0 +1,3 @@
{
"extends": "dtslint/dt.json"
}
+8 -3
View File
@@ -1,7 +1,8 @@
// Type definitions for @google-cloud/pubsub 0.18
// Project: https://github.com/GoogleCloudPlatform/google-cloud-node/tree/master/packages/pubsub
// Project: https://github.com/googleapis/nodejs-pubsub
// Definitions by: Paul Huynh <https://github.com/pheromonez>
// LunaPg <https://github.com/LunaPg>
// Marco Siviero <https://github.com/msiviero>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.2
@@ -115,11 +116,15 @@ declare namespace PubSub {
interface Publisher {
publish(data: Buffer, callback: Publisher.PublishCallback): void;
publish(data: Buffer, attributes: object, callback: Publisher.PublishCallback): void;
publish(data: Buffer, attributes?: object): Promise<string>;
publish(data: Buffer, attributes: Publisher.Attributes, callback: Publisher.PublishCallback): void;
publish(data: Buffer, attributes?: Publisher.Attributes): Promise<string>;
}
namespace Publisher {
type PublishCallback = (error: Error | null, messageId: string) => void;
interface Attributes {
[key: string]: string | Buffer | ArrayBuffer;
}
}
interface Snapshot {
@@ -0,0 +1,20 @@
import * as GulpImagemin from 'gulp-imagemin';
GulpImagemin();
GulpImagemin([
GulpImagemin.gifsicle({ interlaced: true }),
GulpImagemin.jpegtran({ progressive: true }),
GulpImagemin.optipng({ optimizationLevel: 5 }),
GulpImagemin.svgo({
plugins: [{ removeViewBox: true }, { cleanupIDs: false }]
})
]);
GulpImagemin({ verbose: true });
GulpImagemin([
GulpImagemin.svgo({
plugins: [{ removeViewBox: true }]
})
], { verbose: true });
+27
View File
@@ -0,0 +1,27 @@
// Type definitions for gulp-imagemin 4.1
// Project: https://github.com/sindresorhus/gulp-imagemin#readme
// Definitions by: Romain Faust <https://github.com/romain-faust>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference types="node" />
import { Transform } from 'stream';
declare function imagemin(pluginsOrOptions?: imagemin.Plugin[] | imagemin.Options): Transform;
declare function imagemin(plugins?: imagemin.Plugin[], options?: imagemin.Options): Transform;
declare namespace imagemin {
interface Options {
verbose?: boolean;
}
type Plugin = (input: any) => Promise<any>;
type PluginFactory = (options?: any) => Plugin;
const gifsicle: PluginFactory;
const jpegtran: PluginFactory;
const optipng: PluginFactory;
const svgo: PluginFactory;
}
export = imagemin;
+23
View File
@@ -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",
"gulp-imagemin-tests.ts"
]
}
+1
View File
@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }
+8 -7
View File
@@ -1,7 +1,8 @@
// Type definitions for history 4.6.2
// Type definitions for history 4.7.2
// Project: https://github.com/mjackson/history
// Definitions by: Sergey Buturlakin <https://github.com/sergey-buturlakin>, Nathan Brown <https://github.com/ngbrown>, Young Rok Kim <https://github.com/rokoroku>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
export as namespace History;
export type Action = 'PUSH' | 'POP' | 'REPLACE';
@@ -23,24 +24,24 @@ export interface History {
createHref(location: LocationDescriptorObject): Href;
}
export interface Location {
export interface Location<S = LocationState> {
pathname: Pathname;
search: Search;
state: LocationState;
state: S;
hash: Hash;
key?: LocationKey;
}
export interface LocationDescriptorObject {
export interface LocationDescriptorObject<S = LocationState> {
pathname?: Pathname;
search?: Search;
state?: LocationState;
state?: S;
hash?: Hash;
key?: LocationKey;
}
export namespace History {
export type LocationDescriptor = Path | LocationDescriptorObject;
export type LocationDescriptor<S = LocationState> = Path | LocationDescriptorObject<S>;
export type LocationKey = string;
export type LocationListener = (location: Location, action: Action) => void;
export type LocationState = any;
@@ -53,7 +54,7 @@ export namespace History {
export type Href = string;
}
export type LocationDescriptor = History.LocationDescriptor;
export type LocationDescriptor<S = LocationState> = History.LocationDescriptor<S>;
export type LocationKey = History.LocationKey;
export type LocationListener = History.LocationListener;
export type LocationState = History.LocationState;
@@ -0,0 +1,31 @@
import * as React from 'react';
import hoistNonReactStatics = require('hoist-non-react-statics');
class A extends React.Component {
static a = 'a';
getA() {
return A.a;
}
}
class B extends React.Component {
static b = 'b';
getB() {
return B.b;
}
}
const C = hoistNonReactStatics(A, B);
C.a !== C.b;
C.prototype.getA(); // should work
// C.prototype.getB(); // should emit an error
const D = hoistNonReactStatics(A, B, { b: true });
D.a;
// D.b; // should emit an error
+28
View File
@@ -0,0 +1,28 @@
// Type definitions for hoist-non-react-statics 3.0
// Project: https://github.com/mridgway/hoist-non-react-statics#readme
// Definitions by: JounQin <https://github.com/JounQin>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.8
import * as React from 'react';
declare function hoistNonReactStatics<
T extends React.ComponentType,
S extends React.ComponentType,
C extends {
[key: string]: true
} = {}
>(
TargetComponent: T,
SourceComponent: S,
customStatic?: C,
): T &
{
[key in Exclude<
keyof S,
// only extends static properties, exclude instance properties
'prototype' | keyof C
>]: S[key]
};
export = hoistNonReactStatics;
@@ -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",
"hoist-non-react-statics-tests.ts"
]
}
@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }
+35 -15
View File
@@ -1,4 +1,4 @@
// Type definitions for jQuery File Upload Plugin 5.40.1
// Type definitions for jQuery File Upload Plugin 9.22.0
// Project: https://github.com/blueimp/jQuery-File-Upload
// Definitions by: Rob Alarcon <https://github.com/rob-alarcon/>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
@@ -6,7 +6,7 @@
/// <reference types="jquery"/>
// Interface options for the plugin
// Interface options for the plugin
interface JQueryFileInputOptions {
/**
@@ -106,8 +106,8 @@ interface JQueryFileInputOptions {
*/
redirectParamName?: string;
// The HTTP request method must be "POST" or "PUT"
type?: string,
// The HTTP request method must be "POST" or "PUT"
type?: string,
/**
* Set the following option to the location of a postMessage window,
@@ -199,7 +199,7 @@ interface JQueryFileInputOptions {
* handlers using jQuery's Deferred callbacks:
* data.submit().done(func).fail(func).always(func);
*/
add?: (e: JQueryEventObject, data: JQueryFileInputOptions) => void;
add?: (e: JQueryEventObject, data: JqueryFileUploadAddObject) => void;
// The plugin options are used as settings object for the ajax calls.
// The following are jQuery ajax settings required for the file uploads:
@@ -209,7 +209,7 @@ interface JQueryFileInputOptions {
cache?: boolean;
timeout?: number;
active?: Function;
progress?: (e: JQueryEventObject, data: JQueryFileUploadProgressObject) => void;
send?: (e: JQueryEventObject, data: JQueryFileUploadProgressObject) => void;
@@ -217,13 +217,13 @@ interface JQueryFileInputOptions {
// Validation
/**
* The maximum allowed file size in bytes.
* Type: integer
* Default: undefined
* Example: 10000000 // 10 MB
* Note: This option has only an effect for browsers supporting the File API.
* @see https://github.com/blueimp/jQuery-File-Upload/wiki/Options#maxfilesize
*/
* The maximum allowed file size in bytes.
* Type: integer
* Default: undefined
* Example: 10000000 // 10 MB
* Note: This option has only an effect for browsers supporting the File API.
* @see https://github.com/blueimp/jQuery-File-Upload/wiki/Options#maxfilesize
*/
maxFileSize?: number;
// Other callbacks:
@@ -243,7 +243,7 @@ interface JQueryFileInputOptions {
chunkfail?: (e: JQueryEventObject, data: JQueryFileUploadChunkObject) => void;
chunkalways?: (e: JQueryEventObject, data: JQueryFileUploadChunkObject) => void;
// Others
// Others
url?: string;
files?: any;
@@ -263,6 +263,12 @@ interface JQuery {
fileupload(action: string, message:string, settings: JQueryFileInputOptions | string): JQueryFileUpload;
}
interface JqueryFileUploadEnhancedPromise<T> extends JQueryPromise<T>{
success: JQueryPromise<T>['done'],
error: JQueryPromise<T>['fail'],
complete: JQueryPromise<T>['always'],
}
interface JQuerySupport {
fileInput?: boolean;
}
@@ -275,6 +281,20 @@ interface JQueryFileUploadChangeObject {
originalFiles: File[];
}
interface JqueryFileUploadConvenienceObject {
abort: () => JqueryFileUploadEnhancedPromise<any>;
process: (resolveFunc?: Function, rejectFunc?: Function) => JqueryFileUploadEnhancedPromise<any>;
processing: () => JqueryFileUploadEnhancedPromise<any>;
progress: () => JqueryFileUploadEnhancedPromise<any>;
response: () => JqueryFileUploadEnhancedPromise<any>;
submit<T>(): JqueryFileUploadEnhancedPromise<T>;
state: () => JqueryFileUploadEnhancedPromise<any>;
}
interface JqueryFileUploadAddObject extends JQueryFileUploadChangeObject, JqueryFileUploadConvenienceObject {
paramName?: string | string[];
}
interface JQueryFileUploadProgressAllObject {
loaded?: number;
total?: number;
@@ -304,4 +324,4 @@ interface JQueryFileUploadProgressObject extends JQueryFileInputOptions, JQueryF
}
interface JQueryFileUploadDone extends JQueryFileInputOptions, JQueryFileUploadXhr {
}
}
+15 -15
View File
@@ -10,23 +10,23 @@ gridster-0.1.0.d.ts may be freely distributed under the MIT license.
Copyright (c) 2013 Josh Baldwin https://github.com/jbaldwin/gridster.d.ts
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the "Software"), to deal in the Software without
restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the
obtaining a copy of this software and associated documentation
files (the "Software"), to deal in the Software without
restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.
*/
@@ -104,7 +104,7 @@ interface GridsterOptions {
* Base widget dimensions in pixels. The first index for the width and the second for the height.
* Default = [400, 225]
**/
widget_base_dimensions?: number[];
widget_base_dimensions?: ('auto'|number)[];
/**
* Add more columns in addition to those that have been calculated.
@@ -292,7 +292,7 @@ interface Gridster {
* @return Returns the instance of the Gridster class.
**/
enable(): Gridster;
/**
* Disables dragging.
* @return Returns the instance of the Gridster class.
@@ -28,6 +28,9 @@ var position = coords.col + coords.row;
options.widget_base_dimensions = [100, 200];
gridster.resize_widget_dimensions(options);
options.widget_base_dimensions = ['auto', 200];
gridster.resize_widget_dimensions(options);
gridster.set_widget_min_size(0, [1, 2]);
function noOptions() {
@@ -48,13 +51,13 @@ function widgetSelectorString() {
};
var grid: Gridster = $('.gridster ul').gridster(opts).data('gridster')
}
}
function withNamespace() {
var grid: Gridster = $('.gridster ul').gridster({
namespace: 'custom-gridster'
}).data('gridster')
}
}
function withStylesheet() {
var grid: Gridster = $('.gridster ul').gridster({
+2 -7
View File
@@ -286,12 +286,6 @@ declare namespace Knex {
(columnName: string): QueryBuilder;
}
interface WhereIn {
(columnName: string, values: Value[]): QueryBuilder;
(columnName: string, callback: QueryCallback): QueryBuilder;
(columnName: string, query: QueryBuilder): QueryBuilder;
}
interface WhereBetween {
(columnName: string, range: [Value, Value]): QueryBuilder;
}
@@ -306,7 +300,8 @@ declare namespace Knex {
}
interface WhereIn {
(columnName: string, values: Value[]): QueryBuilder;
(columnName: string, values: Value[] | QueryBuilder | QueryCallback): QueryBuilder;
(columnNames: string[], values: Value[][] | QueryBuilder | QueryCallback): QueryBuilder;
}
interface GroupBy extends RawQueryBuilder, ColumnNameQueryBuilder {
+22
View File
@@ -1123,3 +1123,25 @@ knex({
table1Id: 'table1.id',
table2Id: 'table2.id'
});
knex('characters')
.select()
.whereIn(['name', 'class'], [['Bar', 'Fighter'], ['Foo', 'Druid']]);
knex('characters')
.select()
.whereIn('name', knex('characters').select('name'));
knex('characters')
.select()
.whereIn(['name', 'class'], knex('characters').select('name', 'class'));
knex('characters')
.select()
.whereIn('name', function() {
this.select('name').from('characters');
});
knex('characters')
.select()
.whereIn(['name', 'class'], function() {
this.select('name', 'class').from('characters');
});
+14
View File
@@ -0,0 +1,14 @@
// Type definitions for koa-html-minifier 1.0
// Project: https://github.com/koajs/html-minifier
// Definitions by: Romain Faust <https://github.com/romain-faust>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
import { Middleware } from 'koa';
import { Options } from 'html-minifier';
declare function minifier(options?: Options): Middleware;
declare namespace minifier {}
export = minifier;
@@ -0,0 +1,8 @@
import * as Koa from 'koa';
import * as KoaHtmlMinifier from 'koa-html-minifier';
const app = new Koa()
.use(KoaHtmlMinifier())
.use(KoaHtmlMinifier({
collapseWhitespace: true
}));
+23
View File
@@ -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",
"koa-html-minifier-tests.ts"
]
}
+1
View File
@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }
+18 -12
View File
@@ -1,30 +1,36 @@
// Type definitions for koa-joi-router 5.0
// Project: https://github.com/koajs/joi-router
// Definitions by: Matthew Bull <https://github.com/wingsbob>
// Dave Welsh <https://github.com/move-zig>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.4
import * as Koa from 'koa';
import * as Joi from 'joi';
interface Spec {
method: string;
path: string|RegExp;
handler: (ctx: createRouter.Context) => void;
validate?: {
type: string;
body?: Joi.AnySchema;
params?: Joi.AnySchema;
output?: {[status: number]: Joi.AnySchema};
};
}
interface createRouter {
(): createRouter.Router;
Joi: typeof Joi;
}
declare namespace createRouter {
interface Spec {
method: string;
path: string|RegExp;
handler: (ctx: Context) => void;
validate?: {
header?: Joi.AnySchema|{[key: string]: Joi.AnySchema};
query?: Joi.AnySchema|{[key: string]: Joi.AnySchema};
params?: Joi.AnySchema|{[key: string]: Joi.AnySchema};
body?: Joi.AnySchema|{[key: string]: Joi.AnySchema};
maxBody?: number;
failure?: number;
type?: 'form'|'json'|'multipart';
output?: {[status: number]: Joi.AnySchema};
continueOnError?: boolean;
};
}
interface Request extends Koa.Request {
body: any;
params: {[key: string]: string};
+39 -6
View File
@@ -2,7 +2,7 @@ import router = require('koa-joi-router');
const { Joi } = router;
const spec1 = {
const spec1: router.Spec = {
path: '/user',
method: 'POST',
handler: (ctx: router.Context) => ctx.body = '',
@@ -10,7 +10,7 @@ const spec1 = {
router().route(spec1);
const spec2 = {
const spec2: router.Spec = {
method: 'PATCH',
path: '/user',
validate: {
@@ -21,7 +21,7 @@ const spec2 = {
router().route(spec2);
const spec3 = {
const spec3: router.Spec = {
method: 'PATCH',
path: '/user',
validate: {
@@ -33,7 +33,7 @@ const spec3 = {
router().route(spec3);
const spec4 = {
const spec4: router.Spec = {
method: 'PATCH',
path: '/user',
validate: {
@@ -50,7 +50,7 @@ const spec4 = {
router().route(spec4);
const spec5 = {
const spec5: router.Spec = {
method: 'PUT',
path: '/user',
handler: (ctx: router.Context) => {
@@ -61,7 +61,7 @@ const spec5 = {
router().route(spec5);
const spec6 = {
const spec6: router.Spec = {
method: 'GET',
path: '/user',
handler: (ctx: router.Context) => {
@@ -72,6 +72,39 @@ const spec6 = {
router().route(spec6);
const spec7: router.Spec = {
method: 'GET',
path: '/user',
validate: {
query: {
id: Joi.number(),
name: Joi.string(),
}
},
handler: (ctx: router.Context) => {
ctx.status = 201;
ctx.body = ctx.request.params;
},
};
router().route(spec7);
const spec8: router.Spec = {
method: 'POST',
path: '/user',
validate: {
header: {
authentication: Joi.string(),
}
},
handler: (ctx: router.Context) => {
ctx.status = 201;
ctx.body = ctx.request.params;
},
};
router().route(spec8);
router().route([spec1, spec2, spec3]);
router().routes.map(({ path }) => path);
+6 -3
View File
@@ -1,10 +1,13 @@
// Type definitions for @koa/cors 2.2
// Project: https://github.com/koajs/cors
// Definitions by: Xavier Stouder <https://github.com/Xstoudi>, Izayoi Ko <https://github.com/izayoiko>, Steve Hipwell <https://github.com/stevehipwell>
// Definitions by: Xavier Stouder <https://github.com/Xstoudi>
// Izayoi Ko <https://github.com/izayoiko>
// Steve Hipwell <https://github.com/stevehipwell>
// Steven McDowall <https://github.com/sjmcdowall>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
import * as Koa from "koa";
import * as Koa from 'koa';
export = cors;
@@ -12,7 +15,7 @@ declare function cors(options?: cors.Options): Koa.Middleware;
declare namespace cors {
interface Options {
origin?: ((req: Koa.Request) => string) | string;
origin?: ((ctx: Koa.Context) => string) | string;
allowMethods?: string[] | string;
exposeHeaders?: string[] | string;
allowHeaders?: string[] | string;
+8
View File
@@ -3,3 +3,11 @@ import cors = require('@koa/cors');
const app = new Koa();
app.use(cors());
// Trying using cors() passing in a function ..
function testCorsFunction(ctx: Koa.Context) {
const requestOrigin = ctx.request.origin;
return requestOrigin;
}
app.use(cors({ origin: testCorsFunction }));
+221 -197
View File
@@ -4,259 +4,283 @@
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare namespace LazyJS {
interface LazyStatic {
(value: string): StringLikeSequence;
<T>(value: T[]): ArrayLikeSequence<T>;
(value: any[]): ArrayLikeSequence<any>;
<T>(value: Object): ObjectLikeSequence<T>;
(value: Object): ObjectLikeSequence<any>;
strict(): LazyStatic;
generate<T>(generatorFn: GeneratorCallback<T>, length?: number): GeneratedSequence<T>;
range(to: number): GeneratedSequence<number>;
range(from: number, to: number, step?: number): GeneratedSequence<number>;
repeat<T>(value: T, count?: number): GeneratedSequence<T>;
on<T>(eventType: string): Sequence<T>;
readFile(path: string): StringLikeSequence;
makeHttpRequest(path: string): StringLikeSequence;
(value: string): StringLikeSequence;
<T>(value: T[]): ArrayLikeSequence<T>;
(value: any[]): ArrayLikeSequence<any>;
<T>(value: Object): ObjectLikeSequence<T>;
(value: Object): ObjectLikeSequence<any>;
strict(): LazyStatic;
generate<T>(
generatorFn: GeneratorCallback<T>,
length?: number
): GeneratedSequence<T>;
range(to: number): GeneratedSequence<number>;
range(from: number, to: number, step?: number): GeneratedSequence<number>;
repeat<T>(value: T, count?: number): GeneratedSequence<T>;
on<T>(eventType: string): Sequence<T>;
readFile(path: string): StringLikeSequence;
makeHttpRequest(path: string): StringLikeSequence;
}
interface ArrayLike<T> {
length: number;
[index: number]: T;
length: number;
[index: number]: T;
}
interface Callback {
(): void;
(): void;
}
interface ErrorCallback {
(error: any): void;
(error: any): void;
}
interface ValueCallback<T> {
(value: T): void;
(value: T): void;
}
interface GetKeyCallback<T> {
(value: T): string;
(value: T): string;
}
interface TestCallback<T> {
(value: T): boolean;
interface TestCallback<T, U> {
(value: T, index: U): boolean;
}
interface MapCallback<T, U> {
(value: T): U;
(value: T): U;
}
interface MapStringCallback {
(value: string): string;
(value: string): string;
}
interface NumberCallback<T> {
(value: T): number;
(value: T): number;
}
interface MemoCallback<T, U> {
(memo: U, value: T): U;
(memo: U, value: T): U;
}
interface GeneratorCallback<T> {
(index: number): T;
(index: number): T;
}
interface CompareCallback {
(x: any, y: any): number;
(x: any, y: any): number;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
interface Iterator<T> {
new (sequence: Sequence<T>): Iterator<T>;
current(): T;
moveNext(): boolean;
new (sequence: Sequence<T>): Iterator<T>;
current(): T;
moveNext(): boolean;
}
interface GeneratedSequence<T> extends Sequence<T> {
new(generatorFn: GeneratorCallback<T>, length: number): GeneratedSequence<T>;
length(): number;
new (generatorFn: GeneratorCallback<T>, length: number): GeneratedSequence<
T
>;
length(): number;
}
interface AsyncSequence<T> extends SequenceBase<T> {
each(callback: ValueCallback<T>): AsyncHandle<T>;
each(callback: ValueCallback<T>): AsyncHandle<T>;
}
interface AsyncHandle<T> {
cancel(): void;
onComplete(callback: Callback): void;
onError(callback: ErrorCallback): void;
cancel(): void;
onComplete(callback: Callback): void;
onError(callback: ErrorCallback): void;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
namespace Sequence {
function define(methodName: string[], overrides: Object): Function;
function define(methodName: string[], overrides: Object): Function;
}
interface Sequence<T> extends SequenceBase<T> {
each(eachFn: ValueCallback<T>): Sequence<T>;
each(eachFn: ValueCallback<T>): Sequence<T>;
}
interface SequenceBase<T> extends SequenceBaser<T> {
first(): any;
first(count: number): Sequence<T>;
indexOf(value: any, startIndex?: number): Sequence<T>;
last(): any;
last(count: number): Sequence<T>;
lastIndexOf(value: any): Sequence<T>;
reverse(): Sequence<T>;
first(): any;
first(count: number): Sequence<T>;
indexOf(value: any, startIndex?: number): Sequence<T>;
last(): any;
last(count: number): Sequence<T>;
lastIndexOf(value: any): Sequence<T>;
reverse(): Sequence<T>;
}
interface SequenceBaser<T> {
// TODO improve define() (needs ugly overload)
async(interval: number): AsyncSequence<T>;
chunk(size: number): Sequence<T>;
compact(): Sequence<T>;
concat(var_args: T[]): Sequence<T>;
consecutive(length: number): Sequence<T>;
contains(value: T): boolean;
countBy(keyFn: GetKeyCallback<T>): ObjectLikeSequence<T>;
countBy(propertyName: string): ObjectLikeSequence<T>;
dropWhile(predicateFn: TestCallback<T>): Sequence<T>;
every(predicateFn: TestCallback<T>): boolean;
filter(predicateFn: TestCallback<T>): Sequence<T>;
find(predicateFn: TestCallback<T>): T;
findWhere(properties: Object): T;
flatten(): Sequence<T>;
groupBy(keyFn: GetKeyCallback<T>): ObjectLikeSequence<T>;
initial(count?: number): Sequence<T>;
intersection(var_args: T[]): Sequence<T>;
invoke(methodName: string): Sequence<T>;
isEmpty(): boolean;
join(delimiter?: string): string;
map<U>(mapFn: MapCallback<T, U>): Sequence<U>;
max(valueFn?: NumberCallback<T>): T;
min(valueFn?: NumberCallback<T>): T;
none(valueFn?: TestCallback<T>): boolean;
pluck(propertyName: string): Sequence<any>;
reduce<U>(aggregatorFn: MemoCallback<T, U>, memo?: U): U;
reduceRight<U>(aggregatorFn: MemoCallback<T, U>, memo: U): U;
reject(predicateFn: TestCallback<T>): Sequence<T>;
rest(count?: number): Sequence<T>;
shuffle(): Sequence<T>;
some(predicateFn?: TestCallback<T>): boolean;
sort(sortFn?: CompareCallback, descending?: boolean): Sequence<T>;
sortBy(sortFn: string, descending?: boolean): Sequence<T>;
sortBy(sortFn: NumberCallback<T>, descending?: boolean): Sequence<T>;
sortedIndex(value: T): Sequence<T>;
size(): number;
sum(valueFn?: NumberCallback<T>): T;
takeWhile(predicateFn: TestCallback<T>): Sequence<T>;
union(var_args: T[]): Sequence<T>;
uniq(): Sequence<T>;
where(properties: Object): Sequence<T>;
without(...var_args: T[]): Sequence<T>;
without(var_args: T[]): Sequence<T>;
zip(var_args: T[]): Sequence<T>;
toArray(): T[];
toObject(): Object;
// TODO improve define() (needs ugly overload)
async(interval: number): AsyncSequence<T>;
chunk(size: number): Sequence<T>;
compact(): Sequence<T>;
concat(var_args: T[]): Sequence<T>;
consecutive(length: number): Sequence<T>;
contains(value: T): boolean;
countBy(keyFn: GetKeyCallback<T>): ObjectLikeSequence<T>;
countBy(propertyName: string): ObjectLikeSequence<T>;
dropWhile(predicateFn: TestCallback<T, string | number>): Sequence<T>;
every(predicateFn: TestCallback<T, string | number>): boolean;
filter(predicateFn: TestCallback<T, string | number>): Sequence<T>;
find(predicateFn: TestCallback<T, string | number>): T;
findWhere(properties: Object): T;
flatten(): Sequence<T>;
groupBy(keyFn: GetKeyCallback<T>): ObjectLikeSequence<T>;
initial(count?: number): Sequence<T>;
intersection(var_args: T[]): Sequence<T>;
invoke(methodName: string): Sequence<T>;
isEmpty(): boolean;
join(delimiter?: string): string;
map<U>(mapFn: MapCallback<T, U>): Sequence<U>;
max(valueFn?: NumberCallback<T>): T;
min(valueFn?: NumberCallback<T>): T;
none(valueFn?: TestCallback<T, string | number>): boolean;
pluck(propertyName: string): Sequence<any>;
reduce<U>(aggregatorFn: MemoCallback<T, U>, memo?: U): U;
reduceRight<U>(aggregatorFn: MemoCallback<T, U>, memo: U): U;
reject(predicateFn: TestCallback<T, string | number>): Sequence<T>;
rest(count?: number): Sequence<T>;
shuffle(): Sequence<T>;
size(): number;
some(predicateFn?: TestCallback<T, string | number>): boolean;
sort(sortFn?: CompareCallback, descending?: boolean): Sequence<T>;
sortBy(sortFn: NumberCallback<T>, descending?: boolean): Sequence<T>;
sortBy(sortFn: string, descending?: boolean): Sequence<T>;
sortedIndex(value: T): Sequence<T>;
sum(valueFn?: NumberCallback<T>): T;
takeWhile(predicateFn: TestCallback<T, string | number>): Sequence<T>;
toArray(): T[];
toObject(): Object;
union(var_args: T[]): Sequence<T>;
uniq(): Sequence<T>;
where(properties: Object): Sequence<T>;
without(...var_args: T[]): Sequence<T>;
without(var_args: T[]): Sequence<T>;
zip(var_args: T[]): Sequence<T>;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
namespace ArrayLikeSequence {
function define(methodName: string[], overrides: Object): Function;
function define(methodName: string[], overrides: Object): Function;
}
interface ArrayLikeSequence<T> extends Sequence<T> {
// define()X;
concat(var_args: T[]): ArrayLikeSequence<T>;
first(count?: number): ArrayLikeSequence<T>;
get(index: number): T;
length(): number;
map<U>(mapFn: MapCallback<T, U>): ArrayLikeSequence<U>;
pop(): ArrayLikeSequence<T>;
rest(count?: number): ArrayLikeSequence<T>;
reverse(): ArrayLikeSequence<T>;
shift(): ArrayLikeSequence<T>;
slice(begin: number, end?: number): ArrayLikeSequence<T>;
// define()X;
concat(var_args: T[]): ArrayLikeSequence<T>;
first(count?: number): ArrayLikeSequence<T>;
get(index: number): T;
length(): number;
map<U>(mapFn: MapCallback<T, U>): ArrayLikeSequence<U>;
pop(): ArrayLikeSequence<T>;
push(value: T): ArrayLikeSequence<T>;
rest(count?: number): ArrayLikeSequence<T>;
reverse(): ArrayLikeSequence<T>;
shift(): ArrayLikeSequence<T>;
slice(begin: number, end?: number): ArrayLikeSequence<T>;
unshift(value: T): ArrayLikeSequence<T>;
dropWhile(predicateFn: TestCallback<T, number>): Sequence<T>;
every(predicateFn: TestCallback<T, number>): boolean;
filter(predicateFn: TestCallback<T, number>): Sequence<T>;
find(predicateFn: TestCallback<T, number>): T;
none(valueFn?: TestCallback<T, number>): boolean;
reject(predicateFn: TestCallback<T, number>): Sequence<T>;
some(predicateFn?: TestCallback<T, number>): boolean;
takeWhile(predicateFn: TestCallback<T, number>): Sequence<T>;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
namespace ObjectLikeSequence {
function define(methodName: string[], overrides: Object): Function;
function define(methodName: string[], overrides: Object): Function;
}
interface ObjectLikeSequence<T> extends Sequence<T> {
assign(other: Object): ObjectLikeSequence<T>;
// throws error
//async(): X;
defaults(defaults: Object): ObjectLikeSequence<T>;
functions(): Sequence<T>;
get(property: string): ObjectLikeSequence<T>;
invert(): ObjectLikeSequence<T>;
keys(): Sequence<string>;
merge(others: Object | ObjectLikeSequence<T>, mergeFn?: Function): ObjectLikeSequence<T>;
omit(properties: string[]): ObjectLikeSequence<T>;
pairs(): Sequence<T>;
pick(properties: string[]): ObjectLikeSequence<T>;
toArray(): T[];
toObject(): Object;
values(): Sequence<T>;
assign(other: Object): ObjectLikeSequence<T>;
// throws error
//async(): X;
defaults(defaults: Object): ObjectLikeSequence<T>;
functions(): Sequence<T>;
get(property: string): ObjectLikeSequence<T>;
invert(): ObjectLikeSequence<T>;
keys(): Sequence<string>;
merge(others: Object | ObjectLikeSequence<T>, mergeFn?: Function): ObjectLikeSequence<T>;
omit(properties: string[]): ObjectLikeSequence<T>;
pairs(): Sequence<T>;
pick(properties: string[]): ObjectLikeSequence<T>;
toArray(): T[];
toObject(): Object;
values(): Sequence<T>;
watch(propertyNames: string | string[]): Sequence<{property: string; value: any;}>;
dropWhile(predicateFn: TestCallback<T, string>): Sequence<T>;
every(predicateFn: TestCallback<T, string>): boolean;
filter(predicateFn: TestCallback<T, string>): Sequence<T>;
find(predicateFn: TestCallback<T, string>): T;
none(valueFn?: TestCallback<T, string>): boolean;
reject(predicateFn: TestCallback<T, string>): Sequence<T>;
some(predicateFn?: TestCallback<T, string>): boolean;
takeWhile(predicateFn: TestCallback<T, string>): Sequence<T>;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
namespace StringLikeSequence {
function define(methodName: string[], overrides: Object): Function;
function define(methodName: string[], overrides: Object): Function;
}
interface StringLikeSequence extends SequenceBaser<string> {
charAt(index: number): string;
charCodeAt(index: number): number;
contains(value: string): boolean;
endsWith(suffix: string): boolean;
charAt(index: number): string;
charCodeAt(index: number): number;
contains(value: string): boolean;
endsWith(suffix: string): boolean;
first(): string;
indexOf(substring: string, startIndex?: number): number;
last(): string;
last(count: number): StringLikeSequence;
lastIndexOf(substring: string, startIndex?: number): number;
mapString(mapFn: MapStringCallback): StringLikeSequence;
match(pattern: RegExp): StringLikeSequence;
reverse(): StringLikeSequence;
split(delimiter: RegExp): StringLikeSequence;
split(delimiter: string): StringLikeSequence;
startsWith(prefix: string): boolean;
substring(start: number, stop?: number): StringLikeSequence;
toLowerCase(): StringLikeSequence;
toUpperCase(): StringLikeSequence;
first(): string;
first(count: number): StringLikeSequence;
indexOf(substring: string, startIndex?: number): number;
last(): string;
last(count: number): StringLikeSequence;
lastIndexOf(substring: string, startIndex?: number): number;
mapString(mapFn: MapStringCallback): StringLikeSequence;
match(pattern: RegExp): StringLikeSequence;
reverse(): StringLikeSequence;
split(delimiter: string): StringLikeSequence;
split(delimiter: RegExp): StringLikeSequence;
startsWith(prefix: string): boolean;
substring(start: number, stop?: number): StringLikeSequence;
toLowerCase(): StringLikeSequence;
toUpperCase(): StringLikeSequence;
dropWhile(predicateFn: TestCallback<string, number>): Sequence<string>;
every(predicateFn: TestCallback<string, number>): boolean;
filter(predicateFn: TestCallback<string, number>): Sequence<string>;
find(predicateFn: TestCallback<string, number>): string;
first(count: number): StringLikeSequence;
none(valueFn?: TestCallback<string, number>): boolean;
reject(predicateFn: TestCallback<string, number>): Sequence<string>;
some(predicateFn?: TestCallback<string, number>): boolean;
takeWhile(predicateFn: TestCallback<string, number>): Sequence<string>;
}
}
declare var Lazy: LazyJS.LazyStatic;
declare module 'lazy.js' {
export = Lazy;
}
}
declare var Lazy: LazyJS.LazyStatic;
declare module 'lazy.js' {
export = Lazy;
}
+21 -4
View File
@@ -52,6 +52,11 @@ declare namespace Less {
interface StaticOptions {
async: boolean;
fileAsync: boolean;
modifyVars: { [variable: string]: string };
}
interface ImportManager {
contents: { [fileName: string]: string };
}
interface Options {
@@ -76,21 +81,33 @@ declare namespace Less {
map: string;
imports: string[];
}
interface RefreshOutput {
endTime: Date;
startTime: Date;
sheets: number;
totalMilliseconds: number;
}
}
interface LessStatic {
options: Less.StaticOptions;
modifyVars(vars: { [name: string]: string }): void;
importManager?: Less.ImportManager;
sheets: HTMLLinkElement[];
modifyVars(vars: { [name: string]: string }): Promise<Less.RefreshOutput>;
refreshStyles(): void;
render(input: string, callback: (error: Less.RenderError, output: Less.RenderOutput) => void): void;
render(input: string, options: Less.Options, callback: (error: Less.RenderError, output: Less.RenderOutput) => void): void;
render(input: string): Promise<Less.RenderOutput>;
render(input: string, options: Less.Options): Promise<Less.RenderOutput>;
refresh(reload?: boolean, modifyVars?: { [variable: string]: string }, clearFileCache?: boolean): Promise<Less.RefreshOutput>;
version: number[];
watch(): void;
+14
View File
@@ -39,8 +39,22 @@ less.render("h1 { background: red; }", options);
less.modifyVars({
'@buttonFace': '#5B83AD',
'@buttonText': '#D9EEF2'
}).then((output) => {
console.log('Successfully modified vars.');
});
less.refreshStyles();
less.watch();
less.refresh(true, {
'@buttonFace': '#5B83AD'
}, true).then((output) => {
console.log('successfully refreshed less files');
});
if (less.importManager) {
for (let fileName in less.importManager.contents) {
let fileContents = less.importManager.contents[fileName];
}
}
+1 -1
View File
@@ -22,7 +22,7 @@ export function connect(uri: string, options?: MongoClientOptions): Promise<Db>;
export function connect(uri: string, callback: MongoCallback<Db>): void;
export function connect(uri: string, options: MongoClientOptions, callback: MongoCallback<Db>): void;
export { Binary, Double, Long, Decimal128, MaxKey, MinKey, ObjectID, ObjectId, Timestamp, DBRef } from 'bson';
export { Binary, Double, Long, Decimal128, MaxKey, MinKey, ObjectID, ObjectId, Timestamp, DBRef, Int32 } from 'bson';
// Class documentation : http://mongodb.github.io/node-mongodb-native/2.1/api/MongoClient.html
export class MongoClient {
+2 -2
View File
@@ -22,11 +22,11 @@ declare namespace Moon {
}
interface MoonConstructor {
new <Props extends string, Data, Methods>(options?: ConstructorOptions<Props, Data, Methods>): Instance<Data & Methods & Record<Props, any>>;
new <Props extends string = never, Data = {}, Methods = {}>(options?: ConstructorOptions<Props, Data, Methods>): Instance<Data & Methods & Record<Props, any>>;
}
interface MoonStatic extends MoonConstructor {
component<Props extends string, Data, Methods>(name: string, options: ComponentOptions<Props, Data, Methods>): MoonConstructor;
component<Props extends string = never, Data = {}, Methods = {}>(name: string, options: ComponentOptions<Props, Data, Methods>): MoonConstructor;
config: MoonConfig;
use(plugin: object): void;
compile(template: string): void;
+1
View File
@@ -17,6 +17,7 @@ const count = app.get("count");
count; // $ExpectType number
app.get("increment")(); // $ExpectType void
app.callMethod("increment"); // $ExpectType any
app.get("blahblahblah"); // $ExpectError
app.destroy();
+2
View File
@@ -201,6 +201,7 @@ export declare class ConnectionPool extends events.EventEmitter {
public close(): Promise<void>;
public close(callback: (err: any) => void): void;
public request(): Request;
public transaction(): Transaction;
}
export declare class ConnectionError implements Error {
@@ -297,6 +298,7 @@ export declare class Transaction extends events.EventEmitter {
public commit(callback: (err?: any) => void): void;
public rollback(): Promise<void>;
public rollback(callback: (err?: any) => void): void;
public request(): Request;
}
export declare class TransactionError implements Error {
+10 -1
View File
@@ -62,7 +62,16 @@ export interface RouterProps {
options?: EventChangeOptions,
): Promise<boolean>;
// events
// events (deprecated soonish)
onAppUpdated?(nextRoute: string): void;
onBeforeHistoryChange?(as: string): void;
onHashChangeStart?(url: string): void;
onHashChangeComplete?(url: string): void;
onRouteChangeComplete?(url: string): void;
onRouteChangeError?(error: RouteChangeError, url: string): void;
onRouteChangeStart?(url: string): void;
// events API (6.1.1+)
readonly events: {
on: (eventName: EventName, handler: EventHandler | ErrorEventHandler) => void;
off: (eventName: EventName, handler: (url: string) => any) => void;
+69
View File
@@ -0,0 +1,69 @@
// Type definitions for node-zopfli-es 0.0
// Project: https://github.com/jaeh/node-zopfli-es
// Definitions by: Alorel <https://github.com/Alorel>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
/// <reference types="node" />
import { Transform } from 'stream';
declare class Zopfli extends Transform {
constructor(format?: Zopfli.Format, options?: Zopfli.Options);
static createGzip(options?: Zopfli.Options): Zopfli;
static createDeflate(options?: Zopfli.Options): Zopfli;
static createZlib(options?: Zopfli.Options): Zopfli;
static gzipSync(options?: Zopfli.Options): Buffer;
static deflateSync(options?: Zopfli.Options): Buffer;
static zlibSync(options?: Zopfli.Options): Buffer;
static deflate(input: Buffer, options: Zopfli.Options, cb: (err: Error, out: Buffer) => void): void;
static deflate(input: Buffer, cb: (err: Error, out: Buffer) => void): void;
static deflate(input: Buffer, options?: Zopfli.Options): Promise<Buffer>;
static gzip(input: Buffer, options: Zopfli.Options, cb: (err: Error, out: Buffer) => void): void;
static gzip(input: Buffer, cb: (err: Error, out: Buffer) => void): void;
static gzip(input: Buffer, options?: Zopfli.Options): Promise<Buffer>;
static zlib(input: Buffer, options: Zopfli.Options, cb: (err: Error, out: Buffer) => void): void;
static zlib(input: Buffer, cb: (err: Error, out: Buffer) => void): void;
static zlib(input: Buffer, options?: Zopfli.Options): Promise<Buffer>;
static compress(input: Buffer, format: Zopfli.Format, options: Zopfli.Options, cb: (err: Error, out: Buffer) => void): void;
static compress(input: Buffer, format: Zopfli.Format, cb: (err: Error, out: Buffer) => void): void;
static compress(input: Buffer, format: Zopfli.Format, options?: Zopfli.Options): Promise<Buffer>;
}
declare namespace Zopfli {
type Format = 'deflate' | 'gzip' | 'zlib';
interface Options {
verbose?: boolean;
verbose_more?: boolean;
/**
* Maximum amount of times to rerun forward and backward pass to optimize LZ77 compression cost.
* Good values: 10, 15 for small files, 5 for files over several MB in size or it will be too slow.
*/
numiterations?: number;
/**
* If true, splits the data in multiple deflate blocks with optimal choice for the block boundaries.
* Block splitting gives better compression.
*/
blocksplitting?: boolean;
/**
* If true, chooses the optimal block split points only after doing the iterative LZ77 compression.
* If false, chooses the block split points first, then does iterative LZ77 on each individual block.
* Depending on the file, either first or last gives the best compression.
*/
blocksplittinglast?: boolean;
/**
* Maximum amount of blocks to split into (0 for unlimited,
* but this can give extreme results that hurt compression on some files).
*/
blocksplittingmax?: number;
}
}
export = Zopfli;
@@ -0,0 +1,51 @@
import * as Zopfli from 'node-zopfli-es';
import * as fs from 'fs';
const opts: Zopfli.Options = {
verbose: true,
numiterations: 1
};
let input: Buffer = Buffer.from('foo');
const read = fs.createReadStream('foo');
const write = fs.createWriteStream('foo');
function cb(e: Error, b: Buffer): void {}
function then(b: Buffer): void {}
Zopfli.zlib(input, cb);
Zopfli.zlib(input, opts, cb);
Zopfli.zlib(input, opts).then(then);
Zopfli.zlib(input).then(then);
Zopfli.gzip(input, cb);
Zopfli.gzip(input, opts, cb);
Zopfli.gzip(input, opts).then(then);
Zopfli.gzip(input).then(then);
Zopfli.deflate(input, cb);
Zopfli.deflate(input, opts, cb);
Zopfli.deflate(input, opts).then(then);
Zopfli.deflate(input).then(then);
Zopfli.compress(input, 'zlib', cb);
Zopfli.compress(input, 'zlib', opts, cb);
Zopfli.compress(input, 'zlib', opts).then(then);
Zopfli.compress(input, 'zlib').then(then);
input = Zopfli.gzipSync();
input = Zopfli.gzipSync(opts);
input = Zopfli.deflateSync();
input = Zopfli.deflateSync(opts);
input = Zopfli.zlibSync();
input = Zopfli.zlibSync(opts);
read.pipe(Zopfli.createGzip()).pipe(write);
read.pipe(Zopfli.createGzip(opts)).pipe(write);
read.pipe(Zopfli.createDeflate()).pipe(write);
read.pipe(Zopfli.createDeflate(opts)).pipe(write);
read.pipe(Zopfli.createZlib()).pipe(write);
read.pipe(Zopfli.createZlib(opts)).pipe(write);
+23
View File
@@ -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",
"node-zopfli-es-tests.ts"
]
}
+1
View File
@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }
+14 -7
View File
@@ -2225,24 +2225,31 @@ declare module "child_process" {
encoding: string | null; // specify `null`.
}
export interface ExecException extends Error {
cmd?: string;
killed?: boolean;
code?: number;
signal?: string;
}
// no `options` definitely means stdout/stderr are `string`.
export function exec(command: string, callback?: (error: Error | null, stdout: string, stderr: string) => void): ChildProcess;
export function exec(command: string, callback?: (error: ExecException | null, stdout: string, stderr: string) => void): ChildProcess;
// `options` with `"buffer"` or `null` for `encoding` means stdout/stderr are definitely `Buffer`.
export function exec(command: string, options: { encoding: "buffer" | null } & ExecOptions, callback?: (error: Error | null, stdout: Buffer, stderr: Buffer) => void): ChildProcess;
export function exec(command: string, options: { encoding: "buffer" | null } & ExecOptions, callback?: (error: ExecException | null, stdout: Buffer, stderr: Buffer) => void): ChildProcess;
// `options` with well known `encoding` means stdout/stderr are definitely `string`.
export function exec(command: string, options: { encoding: BufferEncoding } & ExecOptions, callback?: (error: Error | null, stdout: string, stderr: string) => void): ChildProcess;
export function exec(command: string, options: { encoding: BufferEncoding } & ExecOptions, callback?: (error: ExecException | null, stdout: string, stderr: string) => void): ChildProcess;
// `options` with an `encoding` whose type is `string` means stdout/stderr could either be `Buffer` or `string`.
// There is no guarantee the `encoding` is unknown as `string` is a superset of `BufferEncoding`.
export function exec(command: string, options: { encoding: string } & ExecOptions, callback?: (error: Error | null, stdout: string | Buffer, stderr: string | Buffer) => void): ChildProcess;
export function exec(command: string, options: { encoding: string } & ExecOptions, callback?: (error: ExecException | null, stdout: string | Buffer, stderr: string | Buffer) => void): ChildProcess;
// `options` without an `encoding` means stdout/stderr are definitely `string`.
export function exec(command: string, options: ExecOptions, callback?: (error: Error | null, stdout: string, stderr: string) => void): ChildProcess;
export function exec(command: string, options: ExecOptions, callback?: (error: ExecException | null, stdout: string, stderr: string) => void): ChildProcess;
// fallback if nothing else matches. Worst case is always `string | Buffer`.
export function exec(command: string, options: ({ encoding?: string | null } & ExecOptions) | undefined | null, callback?: (error: Error | null, stdout: string | Buffer, stderr: string | Buffer) => void): ChildProcess;
export function exec(command: string, options: ({ encoding?: string | null } & ExecOptions) | undefined | null, callback?: (error: ExecException | null, stdout: string | Buffer, stderr: string | Buffer) => void): ChildProcess;
// NOTE: This namespace provides design-time support for util.promisify. Exported members do not exist at runtime.
export namespace exec {
@@ -2503,7 +2510,7 @@ declare module "url" {
append(name: string, value: string): void;
delete(name: string): void;
entries(): IterableIterator<[string, string]>;
forEach(callback: (value: string, name: string) => void): void;
forEach(callback: (value: string, name: string, searchParams: this) => void): void;
get(name: string): string | null;
getAll(name: string): string[];
has(name: string): boolean;
+2 -1
View File
@@ -690,9 +690,10 @@ namespace url_tests {
const searchParams = new url.URLSearchParams('abc=123');
assert.equal(searchParams.toString(), 'abc=123');
searchParams.forEach((value: string, name: string): void => {
searchParams.forEach((value: string, name: string, me: url.URLSearchParams): void => {
assert.equal(name, 'abc');
assert.equal(value, '123');
assert.equal(me, searchParams);
});
assert.equal(searchParams.get('abc'), '123');
+1 -1
View File
@@ -2002,7 +2002,7 @@ declare module "url" {
append(name: string, value: string): void;
delete(name: string): void;
entries(): Iterator<string[]>;
forEach(callback: (value: string, name: string) => void): void;
forEach(callback: (value: string, name: string, searchParams: this) => void): void;
get(name: string): string | null;
getAll(name: string): string[];
has(name: string): boolean;
+2 -1
View File
@@ -538,9 +538,10 @@ namespace url_tests {
const searchParams = new url.URLSearchParams('abc=123');
assert.equal(searchParams.toString(), 'abc=123');
searchParams.forEach((value: string, name: string): void => {
searchParams.forEach((value: string, name: string, me: url.URLSearchParams): void => {
assert.equal(name, 'abc');
assert.equal(value, '123');
assert.equal(me, searchParams);
});
assert.equal(searchParams.get('abc'), '123');
+1 -1
View File
@@ -2045,7 +2045,7 @@ declare module "url" {
append(name: string, value: string): void;
delete(name: string): void;
entries(): Iterator<string[]>;
forEach(callback: (value: string, name: string) => void): void;
forEach(callback: (value: string, name: string, searchParams: this) => void): void;
get(name: string): string | null;
getAll(name: string): string[];
has(name: string): boolean;
+2 -1
View File
@@ -520,9 +520,10 @@ namespace url_tests {
const searchParams = new url.URLSearchParams('abc=123');
assert.equal(searchParams.toString(), 'abc=123');
searchParams.forEach((value: string, name: string): void => {
searchParams.forEach((value: string, name: string, me: url.URLSearchParams): void => {
assert.equal(name, 'abc');
assert.equal(value, '123');
assert.equal(me, searchParams);
});
assert.equal(searchParams.get('abc'), '123');
+1 -1
View File
@@ -2378,7 +2378,7 @@ declare module "url" {
append(name: string, value: string): void;
delete(name: string): void;
entries(): IterableIterator<[string, string]>;
forEach(callback: (value: string, name: string) => void): void;
forEach(callback: (value: string, name: string, searchParams: this) => void): void;
get(name: string): string | null;
getAll(name: string): string[];
has(name: string): boolean;
+2 -1
View File
@@ -654,9 +654,10 @@ namespace url_tests {
const searchParams = new url.URLSearchParams('abc=123');
assert.equal(searchParams.toString(), 'abc=123');
searchParams.forEach((value: string, name: string): void => {
searchParams.forEach((value: string, name: string, me: url.URLSearchParams): void => {
assert.equal(name, 'abc');
assert.equal(value, '123');
assert.equal(me, searchParams);
});
assert.equal(searchParams.get('abc'), '123');
+1 -1
View File
@@ -2459,7 +2459,7 @@ declare module "url" {
append(name: string, value: string): void;
delete(name: string): void;
entries(): IterableIterator<[string, string]>;
forEach(callback: (value: string, name: string) => void): void;
forEach(callback: (value: string, name: string, searchParams: this) => void): void;
get(name: string): string | null;
getAll(name: string): string[];
has(name: string): boolean;
+2 -1
View File
@@ -680,9 +680,10 @@ namespace url_tests {
const searchParams = new url.URLSearchParams('abc=123');
assert.equal(searchParams.toString(), 'abc=123');
searchParams.forEach((value: string, name: string): void => {
searchParams.forEach((value: string, name: string, me: url.URLSearchParams): void => {
assert.equal(name, 'abc');
assert.equal(value, '123');
assert.equal(me, searchParams);
});
assert.equal(searchParams.get('abc'), '123');
+13 -13
View File
@@ -8708,7 +8708,7 @@ declare namespace Office {
*/
getInitializationContextAsync(callback?: (result: AsyncResult) => void): void;
/**
* Gets the entities found in the selected item.
* Gets the entities found in the selected item's body.
*
* Note: This method is not supported in Outlook for iOS or Outlook for Android.
*
@@ -8722,7 +8722,7 @@ declare namespace Office {
*/
getEntities(): Entities;
/**
* Gets an array of all the entities of the specified entity type found in the selected item.
* Gets an array of all the entities of the specified entity type found in the selected item's body.
*
* Note: This method is not supported in Outlook for iOS or Outlook for Android.
*
@@ -8731,7 +8731,7 @@ declare namespace Office {
* @param entityType One of the EntityType enumeration values.
*
* @returns
* If the value passed in entityType is not a valid member of the EntityType enumeration, the method returns null. If no entities of the specified type are present on the item, the method returns an empty array. Otherwise, the type of the objects in the returned array depends on the type of entity requested in the entityType parameter.
* If the value passed in entityType is not a valid member of the EntityType enumeration, the method returns null. If no entities of the specified type are present in the item's body, the method returns an empty array. Otherwise, the type of the objects in the returned array depends on the type of entity requested in the entityType parameter.
*
* @remarks
* <table><tr><td>{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}</td><td>Restricted</td></tr>
@@ -9989,7 +9989,7 @@ declare namespace Office {
*/
getInitializationContextAsync(callback?: (result: AsyncResult) => void): void;
/**
* Gets the entities found in the selected item.
* Gets the entities found in the selected item's body.
*
* Note: This method is not supported in Outlook for iOS or Outlook for Android.
*
@@ -10003,7 +10003,7 @@ declare namespace Office {
*/
getEntities(): Entities;
/**
* Gets an array of all the entities of the specified entity type found in the selected item.
* Gets an array of all the entities of the specified entity type found in the selected item's body.
*
* Note: This method is not supported in Outlook for iOS or Outlook for Android.
*
@@ -10012,7 +10012,7 @@ declare namespace Office {
* @param entityType One of the EntityType enumeration values.
*
* @returns
* If the value passed in entityType is not a valid member of the EntityType enumeration, the method returns null. If no entities of the specified type are present on the item, the method returns an empty array. Otherwise, the type of the objects in the returned array depends on the type of entity requested in the entityType parameter.
* If the value passed in entityType is not a valid member of the EntityType enumeration, the method returns null. If no entities of the specified type are present in the item's body, the method returns an empty array. Otherwise, the type of the objects in the returned array depends on the type of entity requested in the entityType parameter.
*
* @remarks
* <table><tr><td>{@link https://docs.microsoft.com/outlook/add-ins/understanding-outlook-add-in-permissions | Minimum permission level}</td><td>Restricted</td></tr>
@@ -11523,7 +11523,7 @@ declare namespace Office {
*/
getInitializationContextAsync(callback?: (result: AsyncResult) => void): void;
/**
* Gets the entities found in the selected item.
* Gets the entities found in the selected item's body.
*
* Note: This method is not supported in Outlook for iOS or Outlook for Android.
*
@@ -11537,7 +11537,7 @@ declare namespace Office {
*/
getEntities(): Entities;
/**
* Gets an array of all the entities of the specified entity type found in the selected item.
* Gets an array of all the entities of the specified entity type found in the selected item's body.
*
* Note: This method is not supported in Outlook for iOS or Outlook for Android.
*
@@ -11546,7 +11546,7 @@ declare namespace Office {
* @param entityType One of the EntityType enumeration values.
*
* @returns
* If the value passed in entityType is not a valid member of the EntityType enumeration, the method returns null. If no entities of the specified type are present on the item, the method returns an empty array. Otherwise, the type of the objects in the returned array depends on the type of entity requested in the entityType parameter.
* If the value passed in entityType is not a valid member of the EntityType enumeration, the method returns null. If no entities of the specified type are present in the item's body, the method returns an empty array. Otherwise, the type of the objects in the returned array depends on the type of entity requested in the entityType parameter.
*
* @remarks
*
@@ -18430,7 +18430,7 @@ declare namespace Excel {
* @param sourceData The Range object corresponding to the source data.
* @param seriesBy Optional. Specifies the way columns or rows are used as data series on the chart. See Excel.ChartSeriesBy for details.
*/
add(type: Excel.ChartType, sourceData: Range | string, seriesBy?: Excel.ChartSeriesBy): Excel.Chart;
add(type: Excel.ChartType, sourceData: Range, seriesBy?: Excel.ChartSeriesBy): Excel.Chart;
/**
*
* Creates a new chart.
@@ -18441,7 +18441,7 @@ declare namespace Excel {
* @param sourceData The Range object corresponding to the source data.
* @param seriesBy Optional. Specifies the way columns or rows are used as data series on the chart. See Excel.ChartSeriesBy for details.
*/
add(type: "Invalid" | "ColumnClustered" | "ColumnStacked" | "ColumnStacked100" | "3DColumnClustered" | "3DColumnStacked" | "3DColumnStacked100" | "BarClustered" | "BarStacked" | "BarStacked100" | "3DBarClustered" | "3DBarStacked" | "3DBarStacked100" | "LineStacked" | "LineStacked100" | "LineMarkers" | "LineMarkersStacked" | "LineMarkersStacked100" | "PieOfPie" | "PieExploded" | "3DPieExploded" | "BarOfPie" | "XYScatterSmooth" | "XYScatterSmoothNoMarkers" | "XYScatterLines" | "XYScatterLinesNoMarkers" | "AreaStacked" | "AreaStacked100" | "3DAreaStacked" | "3DAreaStacked100" | "DoughnutExploded" | "RadarMarkers" | "RadarFilled" | "Surface" | "SurfaceWireframe" | "SurfaceTopView" | "SurfaceTopViewWireframe" | "Bubble" | "Bubble3DEffect" | "StockHLC" | "StockOHLC" | "StockVHLC" | "StockVOHLC" | "CylinderColClustered" | "CylinderColStacked" | "CylinderColStacked100" | "CylinderBarClustered" | "CylinderBarStacked" | "CylinderBarStacked100" | "CylinderCol" | "ConeColClustered" | "ConeColStacked" | "ConeColStacked100" | "ConeBarClustered" | "ConeBarStacked" | "ConeBarStacked100" | "ConeCol" | "PyramidColClustered" | "PyramidColStacked" | "PyramidColStacked100" | "PyramidBarClustered" | "PyramidBarStacked" | "PyramidBarStacked100" | "PyramidCol" | "3DColumn" | "Line" | "3DLine" | "3DPie" | "Pie" | "XYScatter" | "3DArea" | "Area" | "Doughnut" | "Radar" | "Histogram" | "Pareto" | "RegionMap", sourceData: Range | string, seriesBy?: "Auto" | "Columns" | "Rows"): Excel.Chart;
add(type: "Invalid" | "ColumnClustered" | "ColumnStacked" | "ColumnStacked100" | "3DColumnClustered" | "3DColumnStacked" | "3DColumnStacked100" | "BarClustered" | "BarStacked" | "BarStacked100" | "3DBarClustered" | "3DBarStacked" | "3DBarStacked100" | "LineStacked" | "LineStacked100" | "LineMarkers" | "LineMarkersStacked" | "LineMarkersStacked100" | "PieOfPie" | "PieExploded" | "3DPieExploded" | "BarOfPie" | "XYScatterSmooth" | "XYScatterSmoothNoMarkers" | "XYScatterLines" | "XYScatterLinesNoMarkers" | "AreaStacked" | "AreaStacked100" | "3DAreaStacked" | "3DAreaStacked100" | "DoughnutExploded" | "RadarMarkers" | "RadarFilled" | "Surface" | "SurfaceWireframe" | "SurfaceTopView" | "SurfaceTopViewWireframe" | "Bubble" | "Bubble3DEffect" | "StockHLC" | "StockOHLC" | "StockVHLC" | "StockVOHLC" | "CylinderColClustered" | "CylinderColStacked" | "CylinderColStacked100" | "CylinderBarClustered" | "CylinderBarStacked" | "CylinderBarStacked100" | "CylinderCol" | "ConeColClustered" | "ConeColStacked" | "ConeColStacked100" | "ConeBarClustered" | "ConeBarStacked" | "ConeBarStacked100" | "ConeCol" | "PyramidColClustered" | "PyramidColStacked" | "PyramidColStacked100" | "PyramidBarClustered" | "PyramidBarStacked" | "PyramidBarStacked100" | "PyramidCol" | "3DColumn" | "Line" | "3DLine" | "3DPie" | "Pie" | "XYScatter" | "3DArea" | "Area" | "Doughnut" | "Radar" | "Histogram" | "Pareto" | "RegionMap", sourceData: Range, seriesBy?: "Auto" | "Columns" | "Rows"): Excel.Chart;
/**
*
* Returns the number of charts in the worksheet.
@@ -18663,7 +18663,7 @@ declare namespace Excel {
* @param sourceData The range corresponding to the source data.
* @param seriesBy Specifies the way columns or rows are used as data series on the chart. Can be one of the following: Auto (default), Rows, and Columns. See Excel.ChartSeriesBy for details.
*/
setData(sourceData: Range | string, seriesBy?: Excel.ChartSeriesBy): void;
setData(sourceData: Range, seriesBy?: Excel.ChartSeriesBy): void;
/**
*
* Resets the source data for the chart.
@@ -18673,7 +18673,7 @@ declare namespace Excel {
* @param sourceData The range corresponding to the source data.
* @param seriesBy Specifies the way columns or rows are used as data series on the chart. Can be one of the following: Auto (default), Rows, and Columns. See Excel.ChartSeriesBy for details.
*/
setData(sourceData: Range | string, seriesBy?: "Auto" | "Columns" | "Rows"): void;
setData(sourceData: Range, seriesBy?: "Auto" | "Columns" | "Rows"): void;
/**
*
* Positions the chart relative to cells on the worksheet.
+2 -2
View File
@@ -19,7 +19,7 @@ export = P;
* relative protocol is enabled. Default: process.stdout
* @returns a new logger instance.
*/
declare function P(optionsOrStream?: P.LoggerOptions | stream.Writable | stream.Duplex | stream.Transform): P.Logger;
declare function P(optionsOrStream?: P.LoggerOptions | stream.Writable | stream.Duplex | stream.Transform | NodeJS.WritableStream): P.Logger;
/**
* @param [options]: an options object
@@ -27,7 +27,7 @@ declare function P(optionsOrStream?: P.LoggerOptions | stream.Writable | stream.
* relative protocol is enabled. Default: process.stdout
* @returns a new logger instance.
*/
declare function P(options: P.LoggerOptions, stream: stream.Writable | stream.Duplex | stream.Transform): P.Logger;
declare function P(options: P.LoggerOptions, stream: stream.Writable | stream.Duplex | stream.Transform | NodeJS.WritableStream): P.Logger;
declare namespace P {
/**
+3
View File
@@ -93,3 +93,6 @@ log.level = 'info';
pino.levels.values.error === 50;
pino.levels.labels[50] === 'error';
const logstderr: pino.Logger = pino(process.stderr);
logstderr.error('on stderr instead of stdout');
+19 -11
View File
@@ -1,4 +1,4 @@
// Type definitions for puppeteer 1.5
// Type definitions for puppeteer 1.6
// Project: https://github.com/GoogleChrome/puppeteer#readme
// Definitions by: Marvin Hagemeister <https://github.com/marvinhagemeister>
// Christopher Deutsch <https://github.com/cdeutsch>
@@ -727,6 +727,10 @@ export interface ElementHandle<E extends Element = Element> extends JSHandle, Ev
* If the element is detached from DOM, the method throws an error.
*/
hover(): Promise<void>;
/**
* Resolves to true if the element is visible in the current viewport.
*/
isIntersectingViewport(): Promise<boolean>;
/**
* Focuses the element, and then uses keyboard.down and keyboard.up.
* @param key Name of key to press, such as ArrowLeft. See USKeyboardLayout for a list of all key names.
@@ -860,6 +864,8 @@ export type ErrorCode =
| "aborted"
| "accessdenied"
| "addressunreachable"
| "blockedbyclient"
| "blockedbyresponse"
| "connectionaborted"
| "connectionclosed"
| "connectionfailed"
@@ -1107,16 +1113,6 @@ export interface FrameBase extends Evalable {
...args: any[]
): Promise<any>;
waitForRequest(
urlOrPredicate: string | ((req: Request) => boolean),
options?: { timeout?: number }
): Promise<Request>;
waitForResponse(
urlOrPredicate: string | ((res: Response) => boolean),
options?: { timeout?: number }
): Promise<Response>;
waitForSelector(
selector: string,
options?: { visible?: boolean; hidden?: boolean; timeout?: number }
@@ -1447,6 +1443,16 @@ export interface Page extends EventEmitter, FrameBase {
*/
waitForNavigation(options?: NavigationOptions): Promise<Response>;
waitForRequest(
urlOrPredicate: string | ((req: Request) => boolean),
options?: { timeout?: number }
): Promise<Request>;
waitForResponse(
urlOrPredicate: string | ((res: Response) => boolean),
options?: { timeout?: number }
): Promise<Response>;
/** This method returns all of the dedicated WebWorkers associated with the page. */
workers(): Worker[];
}
@@ -1705,6 +1711,8 @@ export interface Coverage {
export interface StartCoverageOptions {
/** Whether to reset coverage on every navigation. Defaults to `true`. */
resetOnNavigation?: boolean;
/** Whether anonymous scripts generated by the page should be reported. Defaults to `false`. */
reportAnonymousScripts?: boolean;
}
export interface CoverageEntry {
+1 -1
View File
@@ -2,7 +2,7 @@
// Project: https://github.com/pshrmn/qhistory#readme
// Definitions by: Diogo Franco <https://github.com/Kovensky>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.2
// TypeScript Version: 2.3
export as namespace qhistory;
+65 -21
View File
@@ -1,6 +1,7 @@
// Type definitions for QUnit v2.5.0
// Project: http://qunitjs.com/
// Definitions by: James Bracy <https://github.com/waratuman>
// Mike North <https://github.com/mike-north>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
interface Assert {
@@ -234,6 +235,32 @@ interface Assert {
*/
throws(block: () => void, expected?: any, message?: any): void;
raises(block: () => void, expected?: any, message?: any): void;
/**
* A marker for progress in a given test.
*
* The `step()` assertion registers a passing assertion with a provided message. This makes
* it easy to check that specific portions of code are being executed, especially in
* asynchronous test cases and when used with `verifySteps()`.
*
* Together with the `verifySteps()` method, `step()` assertions give you an easy way
* to verify both the count and order of code execution.
*
* @param message Message to display for the step
*/
step(message: string): void;
/**
* A helper assertion to verify the order and number of steps in a test.
*
* The assert.verifySteps() assertion compares a given array of string values (representing steps)
* with the order and values of previous step() calls. This assertion is helpful for verifying
* the order and count of portions of code paths, especially asynchronous ones.
*
* @param steps Array of strings representing steps to verify
* @param message A short description of the assertion
*/
verifySteps(steps: string[], message?: string): void;
}
@@ -313,6 +340,38 @@ interface NestedHooks {
}
declare namespace QUnit {
interface BeginDetails { totalTests: number }
interface DoneDetails { failed: number, passed: number, total: number, runtime: number }
interface LogDetails {
result: boolean,
actual: any;
expected: any;
message: string;
source: string;
module: string;
name: string;
runtime: number;
}
interface ModuleDoneDetails {
name: string;
failed: number;
passed: number;
total: number;
runtime: number;
}
interface ModuleStartDetails { name: string }
interface TestDoneDetails {
name: string;
module: string;
failed: number;
passed: number;
total: number;
runtime: number;
}
interface TestStartDetails { name: string; module: string; }
}
interface QUnit {
/**
@@ -333,7 +392,7 @@ interface QUnit {
*
* @callback callback Callback to execute.
*/
begin(callback: (details: { totalTests: number }) => void): void;
begin(callback: (details: QUnit.BeginDetails) => void): void;
/**
* Configuration for QUnit
@@ -348,7 +407,7 @@ interface QUnit {
*
* @param callback Callback to execute
*/
done(callback: (details: { failed: number, passed: number, total: number, runtime: number }) => void): void;
done(callback: (details: QUnit.DoneDetails) => void): void;
/**
* Advanced and extensible data dumping for JavaScript.
@@ -392,16 +451,7 @@ interface QUnit {
*
* @param callback Callback to execute
*/
log(callback: (details: {
result: boolean,
actual: any;
expected: any;
message: string;
source: string;
module: string;
name: string;
runtime: number;
}) => void): void;
log(callback: (details: QUnit.LogDetails) => void): void;
/**
* Group related tests under a single label.
@@ -449,20 +499,14 @@ interface QUnit {
*
* @param callback Callback to execute
*/
moduleDone(callback: (details: {
name: string;
failed: number;
passed: number;
total: number;
runtime: number;
}) => void): void;
moduleDone(callback: (details: QUnit.ModuleDoneDetails) => void): void;
/**
* Register a callback to fire whenever a module begins.
*
* @param callback Callback to execute
*/
moduleStart(callback: (details: { name: string }) => void): void;
moduleStart(callback: (details: QUnit.ModuleStartDetails) => void): void;
/**
* Adds a test to exclusively run, preventing all other tests from running.
@@ -578,7 +622,7 @@ interface QUnit {
*
* @param callback Callback to execute
*/
testStart(callback: (details: { name: string; module: string;}) => void): void;
testStart(callback: (details: QUnit.TestStartDetails) => void): void;
/**
* Adds a test which expects at least one failing assertion during its run.
+31 -3
View File
@@ -214,13 +214,33 @@ QUnit.log(function( details ) {
console.log( output );
});
QUnit.moduleDone(function( details ) {
console.log( "Finished running: ", details.name, "Failed/total: ", details.failed, details.total );
QUnit.log(function( details: QUnit.LogDetails ) {
let x: { actual: number; expected: number; message: string; module: string; name: string; result: boolean; runtime: number; source: string } = details;
x = details;
});
QUnit.moduleStart(function( details ) {
QUnit.begin(function( details: QUnit.BeginDetails ) {
console.log( "Total tests running: ", details.totalTests);
});
QUnit.done(function( details: QUnit.DoneDetails ) {
console.log( "Finished. Failed/total: ", details.failed, details.total, details.passed, details.runtime );
});
QUnit.moduleDone(function( details: QUnit.ModuleDoneDetails ) {
console.log( "Finished running: ", details.name, "Failed/total: ", details.failed, details.total, details.passed, details.runtime );
});
QUnit.moduleStart(function( details: QUnit.ModuleStartDetails ) {
console.log( "Now running: ", details.name );
});
QUnit.testDone(function( details: QUnit.TestDoneDetails ) {
console.log( "Finished running: ", details.name, "Failed/total: ", details.failed, details.total, details.passed, details.runtime);
});
QUnit.testStart(function( details: QUnit.TestStartDetails ) {
console.log( "Now running: ", details.name, ' from module ', details.module );
});
let Robot: any = () => {};
@@ -562,3 +582,11 @@ equivResult = QUnit.equiv({}, {});
equivResult = QUnit.equiv(1, 2);
equivResult = QUnit.equiv('foo', 'bar');
equivResult = QUnit.equiv(['foo'], ['bar']);
QUnit.test('steps', assert => {
assert.step('one');
assert.step('two');
assert.step('three');
assert.verifySteps(['one', 'two', 'three'], 'Counting to three correctly');
});
-1
View File
@@ -9,7 +9,6 @@
// Vítor Castro <https://github.com/teves-castro>
// Jordan Quagliatini <https://github.com/1M0reBug>
// Simon Højberg <https://github.com/hojberg>
// Charles-Philippe Clermont <https://github.com/charlespwd>
// Samson Keung <https://github.com/samsonkeung>
// Angelo Ocana <https://github.com/angeloocana>
// Rayner Pupo <https://github.com/raynerd>
+411
View File
@@ -0,0 +1,411 @@
// Type definitions for react-adal 0.4
// Project: https://github.com/salvoravida/react-adal#readme
// Definitions by: Dmitry Korolev <https://github.com/dkorolev1>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.6
import * as React from 'react';
export type TokenCallback = (
errorDesc: string | null,
token: string | null,
error: any
) => void;
export type UserCallback = (
errorDesc: string | null,
user: UserInfo | null
) => void;
export interface AdalConfig {
/**
* Client ID assigned to your app by Azure Active Directory.
*/
clientId: string;
/**
* Endpoint at which you expect to receive tokens.Defaults to `window.location.href`.
*/
redirectUri?: string;
/**
* Azure Active Directory instance. Defaults to `https://login.microsoftonline.com/`.
*/
instance?: string;
/**
* Your target tenant. Defaults to `common`.
*/
tenant?: string;
/**
* Query parameters to add to the authentication request.
*/
extraQueryParameter?: string;
/**
* Unique identifier used to map the request with the response. Defaults to RFC4122 version 4 guid (128 bits).
*/
correlationId?: string;
/**
* User defined function of handling the navigation to Azure AD authorization endpoint in case of login.
*/
displayCall?: (url: string) => void;
/**
* Set this to true to enable login in a popup winodow instead of a full redirect. Defaults to `false`.
*/
popUp?: boolean;
/**
* Set this to the resource to request on login. Defaults to `clientId`.
*/
loginResource?: string;
/**
* Set this to redirect the user to a custom login page.
*/
localLoginUrl?: string;
/**
* Redirects to start page after login. Defaults to `true`.
*/
navigateToLoginRequestUrl?: boolean;
/**
* Set this to redirect the user to a custom logout page.
*/
logOutUri?: string;
/**
* Redirects the user to postLogoutRedirectUri after logout. Defaults to `redirectUri`.
*/
postLogoutRedirectUri?: string;
/**
* Sets browser storage to either 'localStorage' or sessionStorage'. Defaults to `sessionStorage`.
*/
cacheLocation?: "localStorage" | "sessionStorage";
/**
* Array of keywords or URIs. Adal will attach a token to outgoing requests that have these keywords or URIs.
*/
endpoints?: { [resource: string]: string };
/**
* Array of keywords or URIs. Adal will not attach a token to outgoing requests that have these keywords or URIs.
*/
anonymousEndpoints?: string[];
/**
* If the cached token is about to be expired in the expireOffsetSeconds (in seconds), Adal will renew the token instead of using the cached token. Defaults to 300 seconds.
*/
expireOffsetSeconds?: number;
/**
* The number of milliseconds of inactivity before a token renewal response from AAD should be considered timed out. Defaults to 6 seconds.
*/
loadFrameTimeout?: number;
/**
* Callback to be invoked when a token is acquired.
*/
callback?: TokenCallback;
}
export type LoggingLevel = 0 | 1 | 2 | 3;
export interface RequestInfo {
/**
* Object comprising of fields such as id_token/error, session_state, state, e.t.c.
*/
parameters: any;
/**
* Request type.
*/
requestType: RequestType;
/**
* Whether state is valid.
*/
stateMatch: boolean;
/**
* Unique guid used to match the response with the request.
*/
stateResponse: string;
/**
* Whether `requestType` contains `id_token`, `access_token` or error.
*/
valid: boolean;
}
export type RequestType = "LOGIN" | "RENEW_TOKEN" | "UNKNOWN";
export type ResponseType = "id_token token" | "token";
export interface UserInfo {
/**
* Username assigned from UPN or email.
*/
userName: string;
/**
* Properties parsed from `id_token`.
*/
profile: any;
}
export interface Constants {
ACCESS_TOKEN: 'access_token';
EXPIRES_IN: 'expires_in';
ID_TOKEN: 'id_token';
ERROR_DESCRIPTION: 'error_description';
SESSION_STATE: 'session_state';
STORAGE: {
TOKEN_KEYS: 'adal.token.keys';
ACCESS_TOKEN_KEY: 'adal.access.token.key';
EXPIRATION_KEY: 'adal.expiration.key';
STATE_LOGIN: 'adal.state.login';
STATE_RENEW: 'adal.state.renew';
NONCE_IDTOKEN: 'adal.nonce.idtoken';
SESSION_STATE: 'adal.session.state';
USERNAME: 'adal.username';
IDTOKEN: 'adal.idtoken';
ERROR: 'adal.error';
ERROR_DESCRIPTION: 'adal.error.description';
LOGIN_REQUEST: 'adal.login.request';
LOGIN_ERROR: 'adal.login.error';
RENEW_STATUS: 'adal.token.renew.status';
};
RESOURCE_DELIMETER: '|';
LOADFRAME_TIMEOUT: '6000';
TOKEN_RENEW_STATUS_CANCELED: 'Canceled';
TOKEN_RENEW_STATUS_COMPLETED: 'Completed';
TOKEN_RENEW_STATUS_IN_PROGRESS: 'In Progress';
LOGGING_LEVEL: {
ERROR: 0;
WARN: 1;
INFO: 2;
VERBOSE: 3;
};
LEVEL_STRING_MAP: {
0: 'ERROR:';
1: 'WARNING:';
2: 'INFO:';
3: 'VERBOSE:';
};
POPUP_WIDTH: 483;
POPUP_HEIGHT: 600;
}
export class AuthenticationContext {
instance: string;
config: AdalConfig;
callback: TokenCallback;
popUp: boolean;
isAngular: boolean;
/**
* Enum for request type
*/
REQUEST_TYPE: RequestType;
RESPONSE_TYPE: ResponseType;
CONSTANTS: Constants;
constructor(options: AdalConfig);
/**
* Initiates the login process by redirecting the user to Azure AD authorization endpoint.
*/
login(): void;
/**
* Returns whether a login is in progress.
*/
loginInProgress(): boolean;
/**
* Gets token for the specified resource from the cache.
* @param resource A URI that identifies the resource for which the token is requested.
*/
getCachedToken(resource: string): string;
/**
* If user object exists, returns it. Else creates a new user object by decoding `id_token` from the cache.
*/
getCachedUser(): UserInfo;
/**
* Adds the passed callback to the array of callbacks for the specified resource.
* @param resource A URI that identifies the resource for which the token is requested.
* @param expectedState A unique identifier (guid).
* @param callback The callback provided by the caller. It will be called with token or error.
*/
registerCallback(
expectedState: string,
resource: string,
callback: TokenCallback
): void;
/**
* Acquires token from the cache if it is not expired. Otherwise sends request to AAD to obtain a new token.
* @param resource Resource URI identifying the target resource.
* @param callback The callback provided by the caller. It will be called with token or error.
*/
acquireToken(resource: string, callback: TokenCallback): void;
/**
* Acquires token (interactive flow using a popup window) by sending request to AAD to obtain a new token.
* @param resource Resource URI identifying the target resource.
* @param extraQueryParameters Query parameters to add to the authentication request.
* @param claims Claims to add to the authentication request.
* @param callback The callback provided by the caller. It will be called with token or error.
*/
acquireTokenPopup(
resource: string,
extraQueryParameters: string | null | undefined,
claims: string | null | undefined,
callback: TokenCallback
): void;
/**
* Acquires token (interactive flow using a redirect) by sending request to AAD to obtain a new token. In this case the callback passed in the authentication request constructor will be called.
* @param resource Resource URI identifying the target resource.
* @param extraQueryParameters Query parameters to add to the authentication request.
* @param claims Claims to add to the authentication request.
*/
acquireTokenRedirect(
resource: string,
extraQueryParameters?: string | null,
claims?: string | null
): void;
/**
* Redirects the browser to Azure AD authorization endpoint.
* @param urlNavigate URL of the authorization endpoint.
*/
promptUser(urlNavigate: string): void;
/**
* Clears cache items.
*/
clearCache(): void;
/**
* Clears cache items for a given resource.
* @param resource Resource URI identifying the target resource.
*/
clearCacheForResource(resource: string): void;
/**
* Redirects user to logout endpoint. After logout, it will redirect to `postLogoutRedirectUri` if added as a property on the config object.
*/
logOut(): void;
/**
* Calls the passed in callback with the user object or error message related to the user.
* @param callback The callback provided by the caller. It will be called with user or error.
*/
getUser(callback: UserCallback): void;
/**
* Checks if the URL fragment contains access token, id token or error description.
* @param hash Hash passed from redirect page.
*/
isCallback(hash: string): boolean;
/**
* Gets login error.
*/
getLoginError(): string;
/**
* Creates a request info object from the URL fragment and returns it.
*/
getRequestInfo(hash: string): RequestInfo;
/**
* Saves token or error received in the response from AAD in the cache. In case of `id_token`, it also creates the user object.
*/
saveTokenFromHash(requestInfo: RequestInfo): void;
/**
* Gets resource for given endpoint if mapping is provided with config.
* @param endpoint Resource URI identifying the target resource.
*/
getResourceForEndpoint(resource: string): string;
/**
* This method must be called for processing the response received from AAD. It extracts the hash, processes the token or error, saves it in the cache and calls the callbacks with the result.
* @param hash Hash fragment of URL. Defaults to `window.location.hash`.
*/
handleWindowCallback(hash?: string): void;
/**
* Checks the logging Level, constructs the log message and logs it. Users need to implement/override this method to turn on logging.
* @param level Level can be set 0, 1, 2 and 3 which turns on 'error', 'warning', 'info' or 'verbose' level logging respectively.
* @param message Message to log.
* @param error Error to log.
*/
log(level: LoggingLevel, message: string, error: any): void;
/**
* Logs messages when logging level is set to 0.
* @param message Message to log.
* @param error Error to log.
*/
error(message: string, error: any): void;
/**
* Logs messages when logging level is set to 1.
* @param message Message to log.
*/
warn(message: string): void;
/**
* Logs messages when logging level is set to 2.
* @param message Message to log.
*/
info(message: string): void;
/**
* Logs messages when logging level is set to 3.
* @param message Message to log.
*/
verbose(message: string): void;
/**
* Logs Pii messages when Logging Level is set to 0 and window.piiLoggingEnabled is set to true.
* @param message Message to log.
* @param error Error to log.
*/
errorPii(message: string, error: any): void;
/**
* Logs Pii messages when Logging Level is set to 1 and window.piiLoggingEnabled is set to true.
* @param message Message to log.
*/
warnPii(message: string): void;
/**
* Logs messages when Logging Level is set to 2 and window.piiLoggingEnabled is set to true.
* @param message Message to log.
*/
infoPii(message: string): void;
/**
* Logs messages when Logging Level is set to 3 and window.piiLoggingEnabled is set to true.
* @param message Message to log.
*/
verbosePii(message: string): void;
}
/**
* Return user token
* @param authContext Authentication context
* @param resource Resource GUID ot URI identifying the target resource.
*/
export function adalGetToken(
authContext: AuthenticationContext,
resourceUrl: string
): Promise<string | null>;
/**
* Allows to make requests with adal token
* @param authContext Authentication context
* @param resource Resource GUID ot URI identifying the target resource.
* @param fetch Fetch client
* @param url Request url
* @param options Fetch options
*/
export function adalFetch(
authContext: AuthenticationContext,
resource: string,
fetch: (input: string, init: any) => Promise<any>,
url: string,
options: any
): Promise<any>;
/**
* Wrap for the app
* @param authContext Authentication context
* @param app Render app callback
* @param doNotLogin Don`t need to login?
*/
export function runWithAdal(
authContext: AuthenticationContext,
app: () => void,
doNotLogin: boolean
): void;
/**
* Creates a HOC that can be used to manage authentication for the certain components
* @param authContext Authentication context
* @param resource Resource GUID ot URI identifying the target resource.
*/
export function withAdalLogin(
authContext: AuthenticationContext,
resource: string
): (
wrappedComponent: React.ComponentClass | React.StatelessComponent,
renderLoading: () => JSX.Element | null,
renderError: (error: any) => JSX.Element | null
) => React.ComponentClass;
+75
View File
@@ -0,0 +1,75 @@
import * as React from 'react';
import { AuthenticationContext, adalFetch, adalGetToken, runWithAdal, withAdalLogin, AdalConfig } from 'react-adal';
const resourceUrl = 'https://graph.microsoft.net';
const adalConfig: AdalConfig = {
cacheLocation: "localStorage",
clientId: '9ha8cqc6-4668-459a-9272-f48c80a053y5',
endpoints: {
api: resourceUrl
},
postLogoutRedirectUri: 'https://localhost:3000',
tenant: 'tenantname.onmicrosoft.com'
};
const authContext = new AuthenticationContext(adalConfig);
const adalApiFetch = (fetch: any, url: string, options: any) => {
return adalFetch(authContext, resourceUrl, fetch, url, options);
};
const getToken = () => adalGetToken(authContext, resourceUrl);
class App extends React.Component {
render() {
return null;
}
}
// user must login to use the app
runWithAdal(authContext, () => {
// ReactDOM.render(<App />, document.getElementById('react-app') as HTMLElement);
}, false);
const withAdalLoginApi = withAdalLogin(authContext, resourceUrl);
const Loading: React.SFC = (props) => {
return null;
};
const ErrorPage: React.SFC = (props) => {
return null;
};
class SignInPage extends React.Component {
render() {
return null;
}
}
class ProtectedPage1 extends React.Component {
render() {
return null;
}
}
const ProtectedPage2: React.SFC = (props) => {
return null;
};
const AdalProtectedPage1 = withAdalLoginApi(ProtectedPage1, () => <Loading />, () => <ErrorPage/>);
const AdalProtectedPage2 = withAdalLoginApi(ProtectedPage2, () => <h4>loading...</h4>, () => <h4>It seems something went wrong...</h4>);
// user must login to use only specific pages
runWithAdal(authContext, () => {
const routes = <div>
<Route exact={true} path='/' component={SignInPage} /> // $ExpectError
<Route path='/private1' component={AdalProtectedPage1} /> // $ExpectError
<Route path='/private2' component={AdalProtectedPage2} /> // $ExpectError
</div>;
// $ExpectError
const App = <ConnectedRouter history={({} as any)} children={routes} />;
// $ExpectError
ReactDOM.render(<App />, document.getElementById('react-app') as HTMLElement);
}, true);
+24
View File
@@ -0,0 +1,24 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
],
"jsx": "react",
"noImplicitAny": true,
"noImplicitThis": true,
"strictFunctionTypes": true,
"strictNullChecks": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"react-adal-tests.tsx"
]
}
+1
View File
@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }
+12
View File
@@ -86,11 +86,23 @@ export interface Format {
eventTimeRangeEndFormat?: string;
}
export interface HeaderProps {
culture: BigCalendarProps['culture'];
date: Date;
format: string;
label: string;
localizer: object;
}
export interface Components {
event?: React.SFC | React.Component | React.ComponentClass | JSX.Element;
eventWrapper?: React.SFC | React.Component | React.ComponentClass | JSX.Element;
dayWrapper?: React.SFC | React.Component | React.ComponentClass | JSX.Element;
dateCellWrapper?: React.SFC | React.Component | React.ComponentClass | JSX.Element;
/**
* component used as a header for each column in the TimeGridHeader
*/
header?: React.ComponentType<HeaderProps>;
toolbar?: React.SFC | React.Component | React.ComponentClass | JSX.Element;
agenda?: {
date?: React.SFC | React.Component | React.ComponentClass | JSX.Element;
+2 -2
View File
@@ -46,7 +46,7 @@ export interface MeasuredComponentProps {
type MeasuredComponent<T> = React.ComponentType<T & MeasuredComponentProps>;
export interface MeasureProps<T> {
export interface MeasureProps {
client?: boolean;
offset?: boolean;
scroll?: boolean;
@@ -60,5 +60,5 @@ export interface MeasureProps<T> {
export declare function withContentRect(types: ReadonlyArray<MeasurementType> | MeasurementType):
<T extends {}>(fn: MeasuredComponent<T>) => React.ComponentType<T>;
declare class Measure<T> extends React.Component<MeasureProps<T>> {}
declare class Measure extends React.Component<MeasureProps> {}
export default Measure;
+418
View File
@@ -0,0 +1,418 @@
// Type definitions for react-native-calendars 1.20
// Project: https://github.com/wix/react-native-calendars#readme
// Definitions by: Tyler Zhang <https://github.com/Tyler-Zhang>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.6
import * as React from 'react';
import { ViewProps, StyleProp } from 'react-native';
export interface DateObject {
year: number;
month: number;
day: number;
timestamp: number;
dateString: string;
}
export interface CalendarTheme {
backgroundColor?: string;
calendarBackground?: string;
textSectionTitleColor?: string;
selectedDayBackgroundColor?: string;
selectedDayTextColor?: string;
todayTextColor?: string;
dayTextColor?: string;
textDisabledColor?: string;
dotColor?: string;
selectedDotColor?: string;
arrowColor?: string;
monthTextColor?: string;
textDayFontFamily?: string;
textMonthFontFamily?: string;
textDayHeaderFontFamily?: string;
textMonthFontWeight?: string;
textDayFontSize?: number;
textMonthFontSize?: number;
textDayHeaderFontSize?: number;
}
export interface DayComponentProps {
state: '' | 'selected' | 'disabled' | 'today';
theme: CalendarTheme;
onPress: () => any;
onLongPress: () => any;
date: DateObject;
marking: false | Marking[];
}
export interface CalendarBaseProps {
/**
* Styles for the view
*/
style?: StyleProp<ViewProps>;
/**
* Specify theme properties to override specific styles for calendar parts. Default = {}
*/
theme?: CalendarTheme;
/**
* Initially visible month. Default = Date()
*/
current?: Date | string;
/**
* Minimum date that can be selected, dates before minDate will be grayed out. Default = undefined
*/
minDate?: Date | string;
/**
* Maximum date that can be selected, dates after maxDate will be grayed out. Default = undefined
*/
maxDate?: Date | string;
/**
* Handler which gets executed on day press. Default = undefined
*/
onDayPress?: (day: number) => void;
/**
* Handler which gets executed on day long press. Default = undefined
*/
onDayLongPress?: (day: number) => void;
/**
* Month format in calendar title. Formatting values: http://arshaw.com/xdate/#Formatting
*/
monthFormat?: string;
/**
* Handler which gets executed when visible month changes in calendar. Default = undefined
*/
onMonthChange?: (month: number) => void;
/**
* Hide month navigation arrows. Default = false
*/
hideArrows?: boolean;
/**
* Replace default arrows with custom ones (direction can be 'left' or 'right')
*/
renderArrow?: (direction: 'left' | 'right') => React.ReactNode;
/**
* Do not show days of other months in month page. Default = false
*/
hideExtraDays?: boolean;
/**
* If hideArrows=false and hideExtraDays=false do not switch month when tapping on greyed out
* day from another month that is visible in calendar page. Default = false
*/
disableMonthChange?: boolean;
/**
* If firstDay=1 week starts from Monday. Note that dayNames and dayNamesShort should still start from Sunday.
*/
firstDay?: number;
/**
* Hide day names. Default = false
*/
hideDayNames?: boolean;
/**
* Show week numbers to the left. Default = false
*/
showWeekNumbers?: boolean;
/**
* Handler which gets executed when press arrow icon left. It receive a callback can go back month
*/
onPressArrowLeft?: (month: number) => void;
/**
* Handler which gets executed when press arrow icon left. It receive a callback can go next month
*/
onPressArrowRight?: (month: number) => void;
/**
* Custom day renderer
*/
dayComponent?: React.Component<DayComponentProps> | React.SFC<DayComponentProps>;
}
export interface DotForMultiDot {
key: string;
color: string;
selectedDotColor?: string;
}
export interface MultiDotMarking {
dots: DotForMultiDot[];
selected?: boolean;
selectedColor?: string;
disabled?: boolean;
}
export interface DotMarking {
selected?: boolean;
marked?: boolean;
selectedColor?: string;
dotColor?: string;
activeOpacity?: number;
disabled?: boolean;
disableTouchEvent?: boolean;
}
export interface PeriodMarking {
textColor?: string;
startingDay?: boolean;
color?: string;
selected?: boolean;
endingDay?: boolean;
disabled?: boolean;
}
export interface MultiPeriodMarking {
periods: Array<{
startingDay?: boolean;
endingDay?: boolean;
color?: string;
}>;
}
export interface CustomMarking {
customStyles: any;
}
export type Marking =
MultiDotMarking |
DotMarking |
PeriodMarking |
MultiPeriodMarking |
CustomMarking;
export interface MultiDotMarkingProps {
markingType: 'multi-dot';
markedDates: {
[date: string]: MultiDotMarking;
};
}
export interface DotMarkingProps {
markingType?: 'simple';
markedDates: {
[date: string]: DotMarking;
};
}
export interface PeriodMarkingProps {
markingType: 'period';
markedDates: {
[date: string]: PeriodMarking;
};
}
export interface CustomMarkingProps {
markingType: 'custom';
markedDates: {
[date: string]: CustomMarking;
};
}
/**
* This type of marking is only fully supported by <Calendar/> as it will expand the height
* of the component
*/
export interface MultiPeriodMarkingProps {
markingType: 'multi-period';
markedDates: {
[date: string]: MultiPeriodMarking
};
}
export type CalendarMarkingProps =
MultiDotMarkingProps |
DotMarkingProps |
PeriodMarkingProps |
MultiPeriodMarkingProps |
CustomMarkingProps |
{};
export class Calendar extends React.Component<CalendarMarkingProps & CalendarBaseProps> {}
export interface CalendarListBaseProps extends CalendarBaseProps {
/**
* Callback which gets executed when visible months change in scroll view. Default = undefined
*/
onVisibleMonthsChange?: (months: number) => void;
/**
* Max amount of months allowed to scroll to the past. Default = 50
*/
pastScrollRange?: number;
/**
* Max amount of months allowed to scroll to the future. Default = 50
*/
futureScrollRange?: number;
/**
* Enable or disable scrolling of calendar list
*/
scrollEnabled?: boolean;
/**
* Enable or disable vertical scroll indicator. Default = false
*/
showScrollIndicator?: boolean;
/**
* Enable horizontal scrolling, default = false
*/
horizontal?: boolean;
/**
* Enable paging on horizontal, default = false
*/
pagingEnabled?: boolean;
/**
* Set custom calendarWidth.
*/
calendarWidth?: boolean;
}
export class CalendarList extends React.Component<CalendarListBaseProps & CalendarMarkingProps> {}
export interface AgendaProps<T> {
/**
* the list of items that have to be displayed in agenda. If you want to render item as empty date
* the value of date key kas to be an empty array []. If there exists no value for date key it is
* considered that the date in question is not yet loaded
*/
items: {
[key: string]: T[];
};
/**
* callback that gets called when items for a certain month should be loaded (month became visible)
*/
loadItemsForMonth?: (date: DateObject) => void;
/**
* callback that fires when the calendar is opened or closed
*/
onCalendarToggled?: (calendarOpened: boolean) => void;
/**
* callback that gets called on day press
*/
onDayPress?: (day: number) => void;
/**
* callback that gets called when day changes while scrolling agenda list
*/
onDayChange?: (day: number) => void;
/**
* initially selected day
*/
selected?: Date | string;
/**
* Minimum date that can be selected, dates before minDate will be grayed out. Default = undefined
*/
minDate?: Date | string;
/**
* Maximum date that can be selected, dates after maxDate will be grayed out. Default = undefined
*/
maxDate?: Date | string;
/**
* Max amount of months allowed to scroll to the past. Default = 50
*/
pastScrollRange?: number;
/**
* Max amount of months allowed to scroll to the future. Default = 50
*/
futureScrollRange?: number;
/**
* specify how each item should be rendered in agenda
*/
renderItem: (item: T, firstItemInDay?: T) => React.ReactNode;
/**
* specify how each date should be rendered. day can be undefined if the item is not first in that day.
*/
renderDay?: (day: DateObject | undefined, item: T) => React.ReactNode;
/**
* specify how empty date content with no items should be rendered
*/
renderEmptyDate?: () => React.ReactNode;
/**
* specify how agenda knob should look like
*/
renderKnob?: () => React.ReactNode;
/**
* specify what should be rendered instead of ActivityIndicator
*/
renderEmptyData?: () => React.ReactNode;
/**
* specify your item comparison function for increased performance
*/
rowHasChanged?: (r1: any, r2: any) => boolean;
/**
* Hide knob button. Default = false
*/
hideKnob?: boolean;
/**
* A RefreshControl component, used to provide pull-to-refresh funtionality for the ScrollView
*/
refreshControl?: React.ReactNode;
/**
* If provided, a standard RefreshControl will be added for "Pull to Refresh" functionality.
* Make sure to also set the refreshing prop correctly.
*/
onRefresh?: () => any;
/**
* Set this true while waiting for new data from a refresh
*/
refreshing?: boolean;
/**
* Display loading indicator. Default = false
*/
displayLoadingIndicator?: boolean;
/**
* agenda theme
*/
theme?: {
agendaDayTextColor?: string;
agendaDayNumColor?: string;
agendaTodayColor?: string;
agendaKnobColor?: string;
} & CalendarTheme;
/**
* agenda container style
*/
style?: StyleProp<ViewProps>;
}
export class Agenda<T> extends React.Component<AgendaProps<T> & CalendarMarkingProps> {}
@@ -0,0 +1,374 @@
import * as React from "react";
import { Text, View } from "react-native";
import { Calendar, CalendarList, Agenda } from "react-native-calendars";
<Calendar
// Initially visible month. Default = Date()
current={"2012-03-01"}
// Minimum date that can be selected, dates before minDate will be grayed out. Default = undefined
minDate={"2012-05-10"}
// Maximum date that can be selected, dates after maxDate will be grayed out. Default = undefined
maxDate={"2012-05-30"}
// Handler which gets executed on day press. Default = undefined
onDayPress={day => {
console.log("selected day", day);
}}
// Handler which gets executed on day long press. Default = undefined
onDayLongPress={day => {
console.log("selected day", day);
}}
// Month format in calendar title. Formatting values: http://arshaw.com/xdate/#Formatting
monthFormat={"yyyy MM"}
// Handler which gets executed when visible month changes in calendar. Default = undefined
onMonthChange={month => {
console.log("month changed", month);
}}
// Hide month navigation arrows. Default = false
hideArrows={true}
// Replace default arrows with custom ones (direction can be 'left' or 'right')
renderArrow={direction => <div />}
// Do not show days of other months in month page. Default = false
hideExtraDays={true}
// If hideArrows=false and hideExtraDays=false do not switch month when tapping on greyed out
// day from another month that is visible in calendar page. Default = false
disableMonthChange={true}
// If firstDay=1 week starts from Monday. Note that dayNames and dayNamesShort should still start from Sunday.
firstDay={1}
// Hide day names. Default = false
hideDayNames={true}
// Show week numbers to the left. Default = false
showWeekNumbers={true}
// Handler which gets executed when press arrow icon left. It receive a callback can go back month
onPressArrowLeft={substractMonth => console.log(substractMonth)}
// Handler which gets executed when press arrow icon left. It receive a callback can go next month
onPressArrowRight={addMonth => console.log(addMonth)}
/>;
<Calendar
// Initially visible month. Default = Date()
current={"2012-03-01"}
// Minimum date that can be selected, dates before minDate will be grayed out. Default = undefined
minDate={"2012-05-10"}
// Maximum date that can be selected, dates after maxDate will be grayed out. Default = undefined
maxDate={"2012-05-30"}
// Handler which gets executed on day press. Default = undefined
onDayPress={day => {
console.log("selected day", day);
}}
// Handler which gets executed on day long press. Default = undefined
onDayLongPress={day => {
console.log("selected day", day);
}}
// Month format in calendar title. Formatting values: http://arshaw.com/xdate/#Formatting
monthFormat={"yyyy MM"}
// Handler which gets executed when visible month changes in calendar. Default = undefined
onMonthChange={month => {
console.log("month changed", month);
}}
// Hide month navigation arrows. Default = false
hideArrows={true}
// Replace default arrows with custom ones (direction can be 'left' or 'right')
renderArrow={direction => <div />}
// Do not show days of other months in month page. Default = false
hideExtraDays={true}
// If hideArrows=false and hideExtraDays=false do not switch month when tapping on greyed out
// day from another month that is visible in calendar page. Default = false
disableMonthChange={true}
// If firstDay=1 week starts from Monday. Note that dayNames and dayNamesShort should still start from Sunday.
firstDay={1}
// Hide day names. Default = false
hideDayNames={true}
// Show week numbers to the left. Default = false
showWeekNumbers={true}
// Handler which gets executed when press arrow icon left. It receive a callback can go back month
onPressArrowLeft={substractMonth => console.log(substractMonth)}
// Handler which gets executed when press arrow icon left. It receive a callback can go next month
onPressArrowRight={addMonth => console.log(addMonth)}
markedDates={{
"2012-05-16": { selected: true, marked: true, selectedColor: "blue" },
"2012-05-17": { marked: true },
"2012-05-18": { marked: true, dotColor: "red", activeOpacity: 0 },
"2012-05-19": { disabled: true, disableTouchEvent: true }
}}
/>;
const vacation = { key: "vacation", color: "red", selectedDotColor: "blue" };
const massage = { key: "massage", color: "blue", selectedDotColor: "blue" };
const workout = { key: "workout", color: "green" };
<Calendar
markedDates={{
"2017-10-25": {
dots: [vacation, massage, workout],
selected: true,
selectedColor: "red"
},
"2017-10-26": { dots: [massage, workout], disabled: true }
}}
markingType={"multi-dot"}
/>;
<Calendar
// Collection of dates that have to be colored in a special way. Default = {}
markedDates={{
"2012-05-20": { textColor: "green" },
"2012-05-22": { startingDay: true, color: "green" },
"2012-05-23": {
selected: true,
endingDay: true,
color: "green",
textColor: "gray"
},
"2012-05-04": {
disabled: true,
startingDay: true,
color: "green",
endingDay: true
}
}}
// Date marking style [simple/period/multi-dot/custom]. Default = 'simple'
markingType={"period"}
/>;
<Calendar
markedDates={{
"2017-12-14": {
periods: [
{ startingDay: false, endingDay: true, color: "#5f9ea0" },
{ startingDay: false, endingDay: true, color: "#ffa500" },
{ startingDay: true, endingDay: false, color: "#f0e68c" }
]
},
"2017-12-15": {
periods: [
{ startingDay: true, endingDay: false, color: "#ffa500" },
{ color: "transparent" },
{ startingDay: false, endingDay: false, color: "#f0e68c" }
]
}
}}
// Date marking style [simple/period/multi-dot/custom]. Default = 'simple'
markingType="multi-period"
/>;
<Calendar
// Date marking style [simple/period/multi-dot/single]. Default = 'simple'
markingType="custom"
markedDates={{
"2018-03-28": {
customStyles: {
container: {
backgroundColor: "green"
},
text: {
color: "black",
fontWeight: "bold"
}
}
},
"2018-03-29": {
customStyles: {
container: {
backgroundColor: "white",
elevation: 2
},
text: {
color: "blue"
}
}
}
}}
/>;
<Calendar
// Specify style for calendar container element. Default = {}
style={{
borderWidth: 1,
borderColor: "gray",
height: 350
}}
// Specify theme properties to override specific styles for calendar parts. Default = {}
theme={{
backgroundColor: "#ffffff",
calendarBackground: "#ffffff",
textSectionTitleColor: "#b6c1cd",
selectedDayBackgroundColor: "#00adf5",
selectedDayTextColor: "#ffffff",
todayTextColor: "#00adf5",
dayTextColor: "#2d4150",
textDisabledColor: "#d9e1e8",
dotColor: "#00adf5",
selectedDotColor: "#ffffff",
arrowColor: "orange",
monthTextColor: "blue",
textDayFontFamily: "monospace",
textMonthFontFamily: "monospace",
textDayHeaderFontFamily: "monospace",
textMonthFontWeight: "bold",
textDayFontSize: 16,
textMonthFontSize: 16,
textDayHeaderFontSize: 16
}}
/>;
<Calendar
style={[{}, { height: 300 }]}
dayComponent={({ date, state }) => {
return (
<View style={{ flex: 1 }}>
<Text
style={{
textAlign: "center",
color: state === "disabled" ? "gray" : "black"
}}
>
{date.day}
</Text>
</View>
);
}}
/>;
<CalendarList
// Callback which gets executed when visible months change in scroll view. Default = undefined
onVisibleMonthsChange={months => {
console.log("now these months are visible", months);
}}
// Max amount of months allowed to scroll to the past. Default = 50
pastScrollRange={50}
// Horizontal
horizontal={true}
// Max amount of months allowed to scroll to the future. Default = 50
futureScrollRange={50}
// Enable or disable scrolling of calendar list
scrollEnabled={true}
// Enable or disable vertical scroll indicator. Default = false
showScrollIndicator={true}
// Initially visible month. Default = Date()
current={"2012-03-01"}
// Minimum date that can be selected, dates before minDate will be grayed out. Default = undefined
minDate={"2012-05-10"}
// Maximum date that can be selected, dates after maxDate will be grayed out. Default = undefined
maxDate={"2012-05-30"}
// Handler which gets executed on day press. Default = undefined
onDayPress={day => {
console.log("selected day", day);
}}
// Handler which gets executed on day long press. Default = undefined
onDayLongPress={day => {
console.log("selected day", day);
}}
// Month format in calendar title. Formatting values: http://arshaw.com/xdate/#Formatting
monthFormat={"yyyy MM"}
// Handler which gets executed when visible month changes in calendar. Default = undefined
onMonthChange={month => {
console.log("month changed", month);
}}
// Hide month navigation arrows. Default = false
hideArrows={true}
// Replace default arrows with custom ones (direction can be 'left' or 'right')
renderArrow={direction => <div />}
// Do not show days of other months in month page. Default = false
hideExtraDays={true}
// If hideArrows=false and hideExtraDays=false do not switch month when tapping on greyed out
// day from another month that is visible in calendar page. Default = false
disableMonthChange={true}
// If firstDay=1 week starts from Monday. Note that dayNames and dayNamesShort should still start from Sunday.
firstDay={1}
// Hide day names. Default = false
hideDayNames={true}
// Show week numbers to the left. Default = false
showWeekNumbers={true}
// Handler which gets executed when press arrow icon left. It receive a callback can go back month
onPressArrowLeft={substractMonth => console.log(substractMonth)}
// Handler which gets executed when press arrow icon left. It receive a callback can go next month
onPressArrowRight={addMonth => console.log(addMonth)}
/>;
<Agenda
// the list of items that have to be displayed in agenda. If you want to render item as empty date
// the value of date key kas to be an empty array []. If there exists no value for date key it is
// considered that the date in question is not yet loaded
items={{
"2012-05-22": [{ text: "item 1 - any js object" }],
"2012-05-23": [{ text: "item 2 - any js object" }],
"2012-05-24": [],
"2012-05-25": [
{ text: "item 3 - any js object" },
{ text: "any js object" }
]
}}
// callback that gets called when items for a certain month should be loaded (month became visible)
loadItemsForMonth={month => {
console.log("trigger items loading");
}}
// callback that fires when the calendar is opened or closed
onCalendarToggled={calendarOpened => {
console.log(calendarOpened);
}}
// callback that gets called on day press
onDayPress={day => {
console.log("day pressed");
}}
// callback that gets called when day changes while scrolling agenda list
onDayChange={day => {
console.log("day changed");
}}
// initially selected day
selected={"2012-05-16"}
// Minimum date that can be selected, dates before minDate will be grayed out. Default = undefined
minDate={"2012-05-10"}
// Maximum date that can be selected, dates after maxDate will be grayed out. Default = undefined
maxDate={"2012-05-30"}
// Max amount of months allowed to scroll to the past. Default = 50
pastScrollRange={50}
// Max amount of months allowed to scroll to the future. Default = 50
futureScrollRange={50}
// specify how each item should be rendered in agenda
renderItem={(item, firstItemInDay) => {
return <View />;
}}
// specify how each date should be rendered. day can be undefined if the item is not first in that day.
renderDay={(day, item) => {
return <View />;
}}
// specify how empty date content with no items should be rendered
renderEmptyDate={() => {
return <View />;
}}
// specify how agenda knob should look like
renderKnob={() => {
return <View />;
}}
// specify what should be rendered instead of ActivityIndicator
renderEmptyData={() => {
return <View />;
}}
// specify your item comparison function for increased performance
rowHasChanged={(r1, r2) => {
return r1.text !== r2.text;
}}
// Hide knob button. Default = false
hideKnob={true}
// By default, agenda dates are marked if they have at least one item, but you can override this if needed
markedDates={{
"2012-05-16": { selected: true, marked: true },
"2012-05-17": { marked: true },
"2012-05-18": { disabled: true }
}}
// If provided, a standard RefreshControl will be added for "Pull to Refresh" functionality. Make sure to also set the refreshing prop correctly.
onRefresh={() => console.log("refreshing...")}
// Set this true while waiting for new data from a refresh
refreshing={false}
// Add a custom RefreshControl component, used to provide pull-to-refresh functionality for the ScrollView.
refreshControl={null}
// agenda theme
theme={{
agendaDayTextColor: "yellow",
agendaDayNumColor: "green",
agendaTodayColor: "red",
agendaKnobColor: "blue"
}}
// agenda container style
style={{}}
/>;
@@ -0,0 +1,24 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true,
"jsx": "react",
"strictFunctionTypes": true
},
"files": [
"index.d.ts",
"react-native-calendars-tests.tsx"
]
}
+1
View File
@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }
+11
View File
@@ -0,0 +1,11 @@
// Type definitions for react-no-ssr 1.1
// Project: https://github.com/kadirahq/react-no-ssr
// Definitions by: Rafał Filipek <https://github.com/rafalfilipek>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.6
import * as React from 'react';
export default class NoSSR extends React.Component<{
onSSR?: React.ReactChild;
}> {}
+17
View File
@@ -0,0 +1,17 @@
import * as React from 'react';
import NoSSR from 'react-no-ssr';
export class NoSSRTest extends React.Component {
render() {
return (
<div>
<NoSSR>
<div />
</NoSSR>
<NoSSR onSSR={<span />}>
<div />
</NoSSR>
</div>
);
}
}
+18
View File
@@ -0,0 +1,18 @@
{
"files": ["index.d.ts", "react-no-ssr-tests.tsx"],
"compilerOptions": {
"module": "commonjs",
"lib": ["es6", "dom"],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
"baseUrl": "../",
"jsx": "react",
"experimentalDecorators": true,
"typeRoots": ["../"],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
}
}
+1
View File
@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }
+21 -11
View File
@@ -1,25 +1,35 @@
// Type definitions for react-portal 3.0
// Type definitions for react-portal 4.0
// Project: https://github.com/tajo/react-portal#readme
// Definitions by: Shun Takahashi <https://github.com/shuntksh>
// Horus Lugo <https://github.com/HorusGoul>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.6
import * as React from "react";
interface CallBackProps extends React.Props<any> {
closePortal(): void;
export interface PortalProps extends React.Props<any> {
children: React.ReactNode;
node?: Element | null;
}
interface ReactPortalProps {
isOpened?: boolean;
openByClickOn?: React.ReactElement<CallBackProps>;
export const Portal: React.ComponentClass<PortalProps>;
export interface PortalFunctionParams {
openPortal: (event?: any) => void;
closePortal: () => void;
portal: (children: React.ReactNode) => React.ReactElement<React.ComponentClass<PortalProps>>;
isOpen: boolean;
}
export interface PortalWithStateProps extends React.Props<any> {
children: (params: PortalFunctionParams) => React.ReactNode;
node?: Element | null;
defaultOpen?: boolean;
openByClickOn?: React.ReactElement<any>;
closeOnEsc?: boolean;
closeOnOutsideClick?: boolean;
onOpen?(node: HTMLDivElement): void;
beforeClose?(node: HTMLDivElement, resetPortalState: () => void): void;
onOpen?(): void;
onClose?(): void;
onUpdate?(): void;
}
declare const ReactPortal: React.ComponentClass<ReactPortalProps>;
export = ReactPortal;
export const PortalWithState: React.ComponentClass<PortalWithStateProps>;

Some files were not shown because too many files have changed in this diff Show More