Merge remote-tracking branch 'upstream/master'

This commit is contained in:
Alex Jerabek
2018-06-15 13:09:07 -07:00
34 changed files with 6180 additions and 3205 deletions
View File
Vendored Executable → Regular
View File
+27 -6
View File
@@ -8,6 +8,7 @@
// Umidbek Karimov <https://github.com/umidbekkarimov>
// Moshe Feuchtwanger <https://github.com/moshfeu>
// Michael Prokopchuk <https://github.com/prokopcm>
// Tina Roh <https://github.com/tinaroh>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.6
@@ -789,11 +790,31 @@ export interface CameraProps extends ViewProps {
}
export interface CameraConstants {
readonly Type: string;
readonly FlashMode: string;
readonly AutoFocus: string;
readonly WhiteBalance: string;
readonly VideoQuality: string;
readonly Type: {
back: string;
front: string;
};
readonly FlashMode: {
on: string;
off: string;
auto: string;
torch: string;
};
readonly AutoFocus: {
on: string;
off: string;
};
readonly WhiteBalance: {
auto: string;
sunny: string;
cloudy: string;
shadow: string;
fluorescent: string;
incandescent: string;
};
readonly VideoQuality: {
[videoQuality: string]: number;
};
readonly BarCodeType: {
aztec: string;
codabar: string;
@@ -879,7 +900,7 @@ export namespace Constants {
};
appKey?: string;
androidStatusBar?: {
barStyle?: 'lignt-content' | 'dark-content',
barStyle?: 'light-content' | 'dark-content',
backgroundColor?: string
};
androidShowExponentNotificationInShellApp?: boolean;
+27 -6
View File
@@ -6,6 +6,7 @@
// Sergio Sánchez <https://github.com/ssanchezmarc>
// Fernando Helwanger <https://github.com/fhelwanger>
// Umidbek Karimov <https://github.com/umidbekkarimov>
// Tina Roh <https://github.com/tinaroh>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.6
@@ -787,11 +788,31 @@ export interface CameraProps extends ViewProps {
}
export interface CameraConstants {
readonly Type: string;
readonly FlashMode: string;
readonly AutoFocus: string;
readonly WhiteBalance: string;
readonly VideoQuality: string;
readonly Type: {
back: string;
front: string;
};
readonly FlashMode: {
on: string;
off: string;
auto: string;
torch: string;
};
readonly AutoFocus: {
on: string;
off: string;
};
readonly WhiteBalance: {
auto: string;
sunny: string;
cloudy: string;
shadow: string;
fluorescent: string;
incandescent: string;
};
readonly VideoQuality: {
[videoQuality: string]: number;
};
readonly BarCodeType: {
aztec: string;
codabar: string;
@@ -877,7 +898,7 @@ export namespace Constants {
};
appKey?: string;
androidStatusBar?: {
barStyle?: 'lignt-content' | 'dark-content',
barStyle?: 'light-content' | 'dark-content',
backgroundColor?: string
};
androidShowExponentNotificationInShellApp?: boolean;
+11 -3
View File
@@ -67,19 +67,19 @@ declare namespace ExpressBrute {
* @summary Allows you to override the value of failCallback for this middleware.
* @type {Function}
*/
failCallback: Function;
failCallback?: Function;
/**
* @summary Disregard IP address when matching requests if set to true. Defaults to false.
* @type {boolean}
*/
ignoreIP: boolean;
ignoreIP?: boolean;
/**
* @summary Key.
* @type {any}
*/
key: any;
key?: any;
}
/**
@@ -156,5 +156,13 @@ declare namespace ExpressBrute {
reset(key: string, callback: (error: any) => void): void;
}
}
declare module "express-serve-static-core" {
export interface Request {
brute?: {
reset?: (callback?: () => void) => void
};
}
}
export = ExpressBrute;
@@ -26,3 +26,19 @@ io.use(sharedsession(session));
io.use(sharedsession(session, { autoSave: true, saveUninitialized: true }));
io.use(sharedsession(session, cookieParser));
io.use(sharedsession(session, cookieParser, { autoSave: true, saveUninitialized: true }));
io.on('connection', (socket) => {
const sessionID = [
socket.handshake.sessionID,
socket.handshake.session!.id
];
const sessionData = [
socket.handshake.session!['sessionEntry'],
socket.handshake.session!.anotherSessionEntry
];
socket.handshake.session!.touch(() => {});
socket.handshake.session!.regenerate(() => {});
socket.handshake.session!.save(() => {});
socket.handshake.session!.reload(() => {});
socket.handshake.session!.destroy(() => {});
});
+7
View File
@@ -7,6 +7,13 @@
import socketio = require('socket.io');
import express = require('express');
declare module "socket.io" {
interface Handshake {
session?: Express.Session;
sessionID?: string;
}
}
declare function sharedsession(
expressSessionMiddleware: express.RequestHandler,
cookieParserMiddleware: express.RequestHandler,
+1 -1
View File
@@ -1387,7 +1387,7 @@ interface hasStartAndEndDateBuilder<B> {
}
interface hasStats {
getStatsFor(dateRange: DayOfWeekString): AdWordsStats;
getStatsFor(dateRange: DateRange): AdWordsStats;
getStatsFor(dateFrom: AdWordsDate | string, dateTo: AdWordsDate | string): AdWordsStats;
}
+3
View File
@@ -4,8 +4,10 @@ const params: ReCaptchaV2.Parameters = {
type: "image",
size: "normal",
tabindex: 5,
isolated: false,
callback: (response: string) => { },
"expired-callback": () => { },
"error-callback": () => { },
};
const size1: ReCaptchaV2.Size = "compact";
@@ -25,6 +27,7 @@ const id1: number = grecaptcha.render("foo");
const id2: number = grecaptcha.render("foo", params);
const id3: number = grecaptcha.render(document.getElementById("foo"));
const id4: number = grecaptcha.render(document.getElementById("foo"), params);
const id5: number = grecaptcha.render(document.getElementById("foo"), params, true);
// response takes a number and returns a string
const response1: string = grecaptcha.getResponse(id1);
+28 -9
View File
@@ -1,19 +1,24 @@
// Type definitions for Google Recaptcha 2.0
// Project: https://www.google.com/recaptcha
// Definitions by: Kristof Mattei <http://kristofmattei.be>, Martin Costello <https://martincostello.com/>, Ruslan Arkhipau <https://github.com/DethAriel>
// Definitions by: Kristof Mattei <http://kristofmattei.be>
// Martin Costello <https://martincostello.com/>
// Ruslan Arkhipau <https://github.com/DethAriel>
// Rafael Tavares <https://github.com/rafaeltavares>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare var grecaptcha: ReCaptchaV2.ReCaptcha;
declare namespace ReCaptchaV2 {
class ReCaptcha {
interface ReCaptcha {
/**
* Renders the container as a reCAPTCHA widget and returns the ID of the newly created widget.
* @param container The HTML element to render the reCAPTCHA widget. Specify either the ID of the container (string) or the DOM element itself.
* @param parameters An object containing parameters as key=value pairs, for example, {"sitekey": "your_site_key", "theme": "light"}. See @see render parameters.
* @param inherit Invisible reCAPTCHA only. Use existing data-* attributes on the element if the corresponding parameter is not specified.
* The values in parameters will take precedence over the attributes.
* @return the ID of the newly created widget.
*/
render(container: (string | HTMLElement), parameters?: Parameters): number;
render(container: (string | HTMLElement), parameters?: Parameters, inherit?: boolean): number;
/**
* Resets the reCAPTCHA widget.
* @param opt_widget_id Optional widget ID, defaults to the first widget created if unspecified.
@@ -65,11 +70,6 @@ declare namespace ReCaptchaV2 {
* If other elements in your page use tabindex, it should be set to make user navigation easier.
*/
tabindex?: number;
/**
* Optional. Your callback function that's executed when the user submits a successful CAPTCHA response.
* The user's response, g-recaptcha-response, will be the input for your callback function.
*/
callback?(response: string): void;
/**
* Optional. The badge location for g-recaptcha with size of "invisible".
*
@@ -77,10 +77,29 @@ declare namespace ReCaptchaV2 {
*/
badge?: Badge;
/**
* Optional. Your callback function that's executed when the recaptcha response expires and the user needs to solve a new CAPTCHA.
* Optional. Invisible reCAPTCHA only. For plugin owners to not interfere with existing reCAPTCHA installations on a page.
* If true, this reCAPTCHA instance will be part of a separate ID space.
*
* @default false
*/
isolated?: boolean;
/**
* Optional. Your callback function that's executed when the user submits a successful CAPTCHA response.
* The user's response, g-recaptcha-response, will be the input for your callback function.
*/
callback?(response: string): void;
/**
* Optional. Your callback function that's executed when the reCAPTCHA response expires and the user needs to solve a new CAPTCHA.
*/
// Notice to the reader
// I need to surround this object with quotes, this will however break intellisense in VS 2013.
"expired-callback"?(): void;
/**
* Optional. Your callback function that's executed when reCAPTCHA encounters an error (usually network connectivity) and cannot continue until connectivity is restored.
* If you specify this function, you are responsible for informing the user that they should retry.
*/
// Notice to the reader
// I need to surround this object with quotes, this will however break intellisense in VS 2013.
"error-callback"?(): void;
}
}
+918 -744
View File
File diff suppressed because it is too large Load Diff
+49 -38
View File
@@ -1,7 +1,8 @@
// Type definitions for Marked 0.3
// Type definitions for Marked 0.4
// Project: https://github.com/chjj/marked
// Definitions by: William Orr <https://github.com/worr>
// BendingBender <https://github.com/BendingBender>
// CrossR <https://github.com/CrossR>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
export as namespace marked;
@@ -202,21 +203,9 @@ declare namespace marked {
interface MarkedOptions {
/**
* Type: object Default: new Renderer()
*
* An object containing functions to render tokens to HTML.
* A prefix URL for any relative link.
*/
renderer?: Renderer;
/**
* Enable GitHub flavored markdown.
*/
gfm?: boolean;
/**
* Enable GFM tables. This option requires the gfm option to be true.
*/
tables?: boolean;
baseUrl?: string;
/**
* Enable GFM line breaks. This option requires the gfm option to be true.
@@ -224,34 +213,19 @@ declare namespace marked {
breaks?: boolean;
/**
* Conform to obscure parts of markdown.pl as much as possible. Don't fix any of the original markdown bugs or poor behavior.
* Enable GitHub flavored markdown.
*/
pedantic?: boolean;
gfm?: boolean;
/**
* Sanitize the output. Ignore any HTML that has been input.
* Include an id attribute when emitting headings.
*/
sanitize?: boolean;
headerIds?: boolean;
/**
* Optionally sanitize found HTML with a sanitizer function.
* Set the prefix for header tag ids.
*/
sanitizer?(html: string): string;
/**
* Mangle autolinks (<email@domain.com>).
*/
mangle?: boolean;
/**
* Use smarter list behavior than the original markdown. May eventually be default with the old behavior moved into pedantic.
*/
smartLists?: boolean;
/**
* Shows an HTML error message when rendering fails.
*/
silent?: boolean;
headerPrefix?: string;
/**
* A function to highlight code blocks. The function takes three arguments: code, lang, and callback.
@@ -263,15 +237,52 @@ declare namespace marked {
*/
langPrefix?: string;
/**
* Mangle autolinks (<email@domain.com>).
*/
mangle?: boolean;
/**
* Conform to obscure parts of markdown.pl as much as possible. Don't fix any of the original markdown bugs or poor behavior.
*/
pedantic?: boolean;
/**
* Type: object Default: new Renderer()
*
* An object containing functions to render tokens to HTML.
*/
renderer?: Renderer;
/**
* Sanitize the output. Ignore any HTML that has been input.
*/
sanitize?: boolean;
/**
* Optionally sanitize found HTML with a sanitizer function.
*/
sanitizer?(html: string): string;
/**
* Shows an HTML error message when rendering fails.
*/
silent?: boolean;
/**
* Use smarter list behavior than the original markdown. May eventually be default with the old behavior moved into pedantic.
*/
smartLists?: boolean;
/**
* Use "smart" typograhic punctuation for things like quotes and dashes.
*/
smartypants?: boolean;
/**
* Set the prefix for header tag ids.
* Enable GFM tables. This option requires the gfm option to be true.
*/
headerPrefix?: string;
tables?: boolean;
/**
* Generate closing slash for self-closing tags (<br/> instead of <br>)
+13 -11
View File
@@ -1,6 +1,7 @@
import * as marked from 'marked';
const options: marked.MarkedOptions = {
baseUrl: '',
gfm: true,
tables: true,
breaks: false,
@@ -16,23 +17,24 @@ const options: marked.MarkedOptions = {
renderer: new marked.Renderer()
};
function callback() {
console.log('callback called');
function callback(err: string, markdown: string) {
console.log("Callback called!");
return markdown;
}
const myOldMarked: typeof marked = marked.setOptions(options);
console.log(marked('i am using __markdown__.'));
console.log(marked('i am using __markdown__.', options));
console.log(marked('i am using __markdown__.', callback));
console.log(marked('i am using __markdown__.', options, callback));
console.log(marked('1) I am using __markdown__.'));
console.log(marked('2) I am using __markdown__.', options));
console.log(marked('3) I am using __markdown__.', callback));
console.log(marked('4) I am using __markdown__.', options, callback));
console.log(marked.parse('i am using __markdown__.'));
console.log(marked.parse('i am using __markdown__.', options));
console.log(marked.parse('i am using __markdown__.', callback));
console.log(marked.parse('i am using __markdown__.', options, callback));
console.log(marked.parse('5) I am using __markdown__.'));
console.log(marked.parse('6) I am using __markdown__.', options));
console.log(marked.parse('7) I am using __markdown__.', callback));
console.log(marked.parse('8) I am using __markdown__.', options, callback));
const text = 'something';
const text = 'Something';
const tokens: marked.TokensList = marked.lexer(text, options);
console.log(marked.parser(tokens));
+4467 -2181
View File
File diff suppressed because it is too large Load Diff
+18 -17
View File
@@ -33,7 +33,7 @@ Bignumbers examples
{
// configure the default type of numbers as BigNumbers
math.config({
number: 'bignumber',
number: 'BigNumber',
precision: 20,
});
@@ -108,16 +108,13 @@ Complex numbers examples
// create a complex number from polar coordinates
{
const p: math.PolarCoordinates = { r: math.sqrt(2), phi: math.pi / 4 };
const c: math.Complex = math
.complex(p);
const p: math.PolarCoordinates = { r: math.sqrt(2), phi: math.pi / 4 };
const c: math.Complex = math.complex(p);
}
// get polar coordinates of a complex number
{
const p: math.PolarCoordinates = math
.complex(3, 4)
.toPolar();
const p: math.PolarCoordinates = math.complex(3, 4).toPolar();
}
}
@@ -175,6 +172,11 @@ Expressions examples
// get and set variables and functions
{
parser.eval('x = 7 / 2'); // 3.5
parser.eval('x + 3'); // 6.5
parser.eval('f(x, y) = x^y'); // f(x, y)
parser.eval('f(2, 3)'); // 8
const x = parser.get('x');
const f = parser.get('f');
const g = f(3, 3);
@@ -193,7 +195,7 @@ Fractions examples
{
// configure the default type of numbers as Fractions
math.config({
number: 'fraction',
number: 'Fraction',
});
const x = math.fraction(0.125);
@@ -205,9 +207,6 @@ Fractions examples
// output formatting
const a = math.fraction('2/3');
console.log(math.format(a));
console.log(math.format(a, {fraction: 'ratio'}));
console.log(math.format(a, {fraction: 'decimal'}));
}
/*
@@ -237,7 +236,8 @@ Matrices examples
b.subset(math.index(1, [0, 1]), [[7, 8]]);
const c = math.multiply(a, b);
const d: math.Matrix = c.subset(math.index(1, 0));
const f: math.Matrix = math.matrix([1, 0]);
const d: math.Matrix = f.subset(math.index(1, 0));
}
// get a sub matrix
@@ -282,8 +282,9 @@ Sparse matrices examples
// do operations with a sparse matrix
const b = math.multiply(a, a);
const c = math.multiply(b, math.complex(2, 2));
const d = math.transpose(c);
const e = math.multiply(d, a);
const d = math.matrix([0, 1]);
const e = math.transpose(d);
const f = math.multiply(e, a);
}
/*
@@ -299,8 +300,8 @@ Units examples
math.createUnit('foo');
math.createUnit('furlong', '220 yards');
math.createUnit('furlong', '220 yards', {override: true});
math.createUnit('fahrenheit', {definition: '0.555556 kelvin', offset: 459.67});
math.createUnit('fahrenheit', {definition: '0.555556 kelvin', offset: 459.67}, {override: true});
math.createUnit('testunit', {definition: '0.555556 kelvin', offset: 459.67});
math.createUnit('testunit', {definition: '0.555556 kelvin', offset: 459.67}, {override: true});
math.createUnit('knot', {definition: '0.514444 m/s', aliases: ['knots', 'kt', 'kts']});
math.createUnit('knot', {definition: '0.514444 m/s', aliases: ['knots', 'kt', 'kts']}, {override: true});
math.createUnit('knot', {
@@ -309,7 +310,7 @@ Units examples
prefixes: 'long'
}, {override: true});
math.createUnit({
foo: {
foo_2: {
prefixes: 'long'
},
bar: '40 foo',
+1 -1
View File
@@ -1252,7 +1252,7 @@ export class Cursor<T = Default> extends Readable {
/** http://mongodb.github.io/node-mongodb-native/3.0/api/Cursor.html#limit */
limit(value: number): Cursor<T>;
/** http://mongodb.github.io/node-mongodb-native/3.0/api/Cursor.html#map */
map(transform: Function): Cursor<T>;
map<U>(transform: (T) => U): Cursor<U>;
/** http://mongodb.github.io/node-mongodb-native/3.0/api/Cursor.html#max */
max(max: number): Cursor<T>;
/** http://mongodb.github.io/node-mongodb-native/3.0/api/Cursor.html#maxAwaitTimeMS */
+38 -6
View File
@@ -240,8 +240,20 @@ declare namespace Office {
*/
var context: Context;
/**
* This method is called after the Office API was loaded.
* @param reason Indicates how the app was initialized
* Occurs when the runtime environment is loaded and the add-in is ready to start interacting with the application and hosted document.
*
* The reason parameter of the initialize event listener function returns an `InitializationReason` enumeration value that specifies how initialization occurred. A task pane or content add-in can be initialized in two ways:
*
* - The user just inserted it from Recently Used Add-ins section of the Add-in drop-down list on the Insert tab of the ribbon in the Office host application, or from Insert add-in dialog box.
*
* - The user opened a document that already contains the add-in.
*
* *Note*: The reason parameter of the initialize event listener function only returns an `InitializationReason` enumeration value for task pane and content add-ins. It does not return a value for Outlook add-ins.
*
* @remarks
* Hosts: Access, Excel, Outlook, PowerPoint, Project, Word
*
* @param reason Indicates how the app was initialized.
*/
function initialize(reason: InitializationReason): void;
/**
@@ -252,8 +264,12 @@ declare namespace Office {
*/
function onReady(callback?: (info: { host: HostType, platform: PlatformType }) => any): Promise<{ host: HostType, platform: PlatformType }>;
/**
* Indicates if the large namespace for objects will be used or not.
* @param useShortNamespace Indicates if 'true' that the short namespace will be used
* Toggles on and off the `Office` alias for the full `Microsoft.Office.WebExtension` namespace.
*
* @remarks
* Hosts: Access, Excel, Outlook, PowerPoint, Project, Word
*
* @param useShortNamespace True to use the shortcut alias; otherwise false to disable it. The default is true.
*/
function useShortNamespace(useShortNamespace: boolean): void;
// Enumerations
@@ -523,7 +539,7 @@ declare namespace Office {
*/
name: string;
}
export namespace AddinCommands {
namespace AddinCommands {
/**
* The event object is passed as a parameter to add-in functions invoked by UI-less command buttons. The object allows the add-in to identify which button was clicked and to signal the host that it has completed its processing.
*
@@ -539,8 +555,13 @@ declare namespace Office {
*
* Applicable Outlook mode: Compose or Read
*/
export interface Event {
interface Event {
/**
* Information about the control that triggered calling this function
*/
source:Source;
/**
* Indicates that the add-in has completed processing that was triggered by an add-in command button or event handler.
*
@@ -561,6 +582,17 @@ declare namespace Office {
*/
completed(options?: any): void;
}
/**
* Encapsulates source data for add-in events.
*/
interface Source {
/**
* The id of the control that triggered calling this function. The id comes from the manifest and is the unique ID of your Office Add-in as a GUID.
*/
id: string;
}
}
/**
* Provides objects and methods that you can use to create and manipulate UI components, such as dialog boxes, in your Office Add-ins.
Vendored Executable → Regular
View File
View File
+1
View File
@@ -1545,6 +1545,7 @@ declare namespace React {
interface OlHTMLAttributes<T> extends HTMLAttributes<T> {
reversed?: boolean;
start?: number;
type?: '1' | 'a' | 'A' | 'i' | 'I';
}
interface OptgroupHTMLAttributes<T> extends HTMLAttributes<T> {
+4 -1
View File
@@ -1,4 +1,4 @@
// Type definitions for reactstrap 5.0
// Type definitions for reactstrap 6.0
// Project: https://github.com/reactstrap/reactstrap#readme
// Definitions by: Ali Hammad Baig <https://github.com/alihammad>
// Marco Falkenberg <https://github.com/mfal>
@@ -101,6 +101,9 @@ export { CollapseProps } from './lib/Collapse';
import { default as Container_ } from './lib/Container';
export class Container<T = {}> extends Container_<T> {}
export { ContainerProps } from './lib/Container';
import { default as CustomInput_ } from './lib/CustomInput';
export class CustomInput<T = {}> extends CustomInput_<T> {}
export { CustomInputProps } from './lib/CustomInput';
import { default as Dropdown_ } from './lib/Dropdown';
export class Dropdown<T = {}> extends Dropdown_<T> {}
export { DropdownProps } from './lib/Dropdown';
+22
View File
@@ -0,0 +1,22 @@
import * as React from 'react';
import { CSSModule } from '../index';
export type CustomInputType =
| 'select'
| 'file'
| 'radio'
| 'checkbox';
export type CustomInputProps<T = {}> = React.InputHTMLAttributes<HTMLInputElement> & {
type: CustomInputType;
label?: string;
inline?: boolean;
bsSize?: 'lg' | 'sm';
valid?: boolean;
invalid?: boolean;
className?: string;
cssModule?: CSSModule;
} & T;
declare class CustomInput<T = {[key: string]: any}> extends React.Component<CustomInputProps<T>> {}
export default CustomInput;
+3
View File
@@ -14,7 +14,9 @@ export type UncontrolledProps<T = {}> = React.HTMLAttributes<HTMLElement> & {
cssModule?: CSSModule;
nav?: boolean;
inNavbar?: boolean;
setActiveFromChild?: boolean;
} & T;
export type UncontrolledDropdownProps<T = {}> = UncontrolledProps<T>;
export type Props<T = {}> = UncontrolledProps<T> & {
@@ -25,6 +27,7 @@ export type Props<T = {}> = UncontrolledProps<T> & {
tag?: React.ReactType;
addonType?: boolean | 'prepend' | 'append';
};
export type DropdownProps<T = {}> = Props<T>;
declare class Dropdown<T = {[key: string]: any}> extends React.Component<DropdownProps<T>> {}
+3
View File
@@ -1,4 +1,5 @@
import * as React from 'react';
import * as Popper from 'popper.js';
import { CSSModule } from '../index';
export type DropdownMenuProps<T = {}> = React.HTMLAttributes<HTMLElement> & {
@@ -7,6 +8,8 @@ export type DropdownMenuProps<T = {}> = React.HTMLAttributes<HTMLElement> & {
className?: string;
cssModule?: CSSModule;
flip?: boolean;
modifiers?: Popper.Modifiers;
persist?: boolean;
} & T;
declare class DropdownMenu<T = {[key: string]: any}> extends React.Component<DropdownMenuProps<T>> {}
+1 -1
View File
@@ -1,6 +1,6 @@
import * as React from 'react';
import * as Popper from 'popper.js';
import { CSSModule } from '../index';
import { Popper } from './Popper';
export type PopoverProps<T = {}> = React.HTMLAttributes<HTMLElement> & {
isOpen?: boolean;
-134
View File
@@ -1,134 +0,0 @@
// Type definitions for popper.js 1.10
// Project: https://github.com/FezVrasta/popper.js/
// Definitions by: edcarroll <https://github.com/edcarroll>, ggray <https://github.com/giladgray>, rhysd <https://rhysd.github.io>, joscha <https://github.com/joscha>, seckardt <https://github.com/seckardt>, marcfallows <https://github.com/marcfallows>
// This file only declares the public portions of the API.
// It should not define internal pieces such as utils or modifier details.
// It has been copied from: https://raw.githubusercontent.com/FezVrasta/popper.js/master/packages/popper/index.d.ts
export as namespace Popper;
export type Position = "top" | "right" | "bottom" | "left";
export type Placement =
| "auto-start"
| "auto"
| "auto-end"
| "top-start"
| "top"
| "top-end"
| "right-start"
| "right"
| "right-end"
| "bottom-end"
| "bottom"
| "bottom-start"
| "left-end"
| "left"
| "left-start";
export type Boundary = "scrollParent" | "viewport" | "window";
export type ModifierFn = (data: Data, options: Object) => Data;
export interface BaseModifier {
order?: number;
enabled?: boolean;
fn?: ModifierFn;
}
export interface Modifiers {
shift?: BaseModifier;
offset?: BaseModifier & {
offset?: number | string;
};
preventOverflow?: BaseModifier & {
priority?: Position[];
padding?: number;
boundariesElement?: Boundary | Element;
escapeWithReference?: boolean;
};
keepTogether?: BaseModifier;
arrow?: BaseModifier & {
element?: string | Element;
};
flip?: BaseModifier & {
behavior?: "flip" | "clockwise" | "counterclockwise" | Position[];
padding?: number;
boundariesElement?: Boundary | Element;
};
inner?: BaseModifier;
hide?: BaseModifier;
applyStyle?: BaseModifier & {
onLoad?: Function;
gpuAcceleration?: boolean;
};
computeStyle?: BaseModifier & {
gpuAcceleration?: boolean;
x?: "bottom" | "top";
y?: "left" | "right";
};
[name: string]: (BaseModifier & Record<string, any>) | undefined;
}
export interface Offset {
top: number;
left: number;
width: number;
height: number;
}
export interface Data {
instance: Popper;
placement: Placement;
originalPlacement: Placement;
flipped: boolean;
hide: boolean;
arrowElement: Element;
styles: CSSStyleDeclaration;
boundaries: Object;
offsets: {
popper: Offset;
reference: Offset;
arrow: {
top: number;
left: number;
};
};
}
export interface PopperOptions {
placement?: Placement;
positionFixed: boolean;
eventsEnabled?: boolean;
modifiers?: Modifiers;
removeOnDestroy?: boolean;
onCreate?(data: Data): void;
onUpdate?(data: Data): void;
}
export interface ReferenceObject {
clientHeight: number;
clientWidth: number;
getBoundingClientRect(): ClientRect;
}
export class Popper {
static modifiers: (Popper.BaseModifier & { name: string })[];
static placements: Popper.Placement[];
static Defaults: Popper.PopperOptions;
options: Popper.PopperOptions;
constructor(
reference: Element | Popper.ReferenceObject,
popper: Element,
options?: Popper.PopperOptions
);
destroy(): void;
update(): void;
scheduleUpdate(): void;
enableEventListeners(): void;
disableEventListeners(): void;
}
+1
View File
@@ -6,6 +6,7 @@ export type TableProps<T = {}> = React.HTMLAttributes<HTMLElement> & {
cssModule?: CSSModule;
size?: string;
bordered?: boolean;
borderless?: boolean;
striped?: boolean;
inverse?: boolean;
hover?: boolean;
+1 -1
View File
@@ -1,6 +1,6 @@
import * as React from 'react';
import * as Popper from 'popper.js';
import { CSSModule } from '../index';
import {Popper} from './Popper';
export type UncontrolledProps<T = {}> = React.HTMLAttributes<HTMLElement> & {
target: string | HTMLElement;
+6
View File
@@ -0,0 +1,6 @@
{
"private": true,
"dependencies": {
"popper.js": "^1.14.1"
}
}
+183
View File
@@ -35,6 +35,7 @@ import {
Col,
Container,
Collapse,
CustomInput,
Fade,
Form,
FormFeedback,
@@ -3752,6 +3753,7 @@ import { default as CarouselCaption_ } from './lib/CarouselCaption'; /* tslint:d
import { default as Col_ } from './lib/Col'; /* tslint:disable-line: no-relative-import-in-test */
import { default as Collapse_ } from './lib/Collapse'; /* tslint:disable-line: no-relative-import-in-test */
import { default as Container_ } from './lib/Container'; /* tslint:disable-line: no-relative-import-in-test */
import { default as CustomInput_ } from './lib/CustomInput'; /* tslint:disable-line: no-relative-import-in-test */
import { default as Dropdown_ } from './lib/Dropdown'; /* tslint:disable-line: no-relative-import-in-test */
import { default as DropdownItem_ } from './lib/DropdownItem'; /* tslint:disable-line: no-relative-import-in-test */
import { default as DropdownMenu_ } from './lib/DropdownMenu'; /* tslint:disable-line: no-relative-import-in-test */
@@ -3833,6 +3835,7 @@ function AnyPropExample() {
<Col_ foo={1} bar={false} foobar="example" />
<Collapse_ foo={1} bar={false} foobar="example" />
<Container_ foo={1} bar={false} foobar="example" />
<CustomInput_ foo={1} bar={false} foobar="example" type="file" />
<Dropdown_ foo={1} bar={false} foobar="example" />
<DropdownItem_ foo={1} bar={false} foobar="example" />
<DropdownMenu_ foo={1} bar={false} foobar="example" />
@@ -3919,6 +3922,7 @@ class CarouselCaptionGeneric extends CarouselCaption<GenericInterface> {}
class ColGeneric extends Col<GenericInterface> {}
class CollapseGeneric extends Collapse<GenericInterface> {}
class ContainerGeneric extends Container<GenericInterface> {}
class CustomInputGeneric extends CustomInput<GenericInterface> {}
class DropdownGeneric extends Dropdown<GenericInterface> {}
class DropdownItemGeneric extends DropdownItem<GenericInterface> {}
class DropdownMenuGeneric extends DropdownMenu<GenericInterface> {}
@@ -4000,6 +4004,7 @@ function GenericPropExample() {
<ColGeneric foo={1} bar={false} foobar="example" />
<CollapseGeneric foo={1} bar={false} foobar="example" />
<ContainerGeneric foo={1} bar={false} foobar="example" />
<CustomInputGeneric foo={1} bar={false} foobar="example" type="file" />
<DropdownGeneric foo={1} bar={false} foobar="example" />
<DropdownItemGeneric foo={1} bar={false} foobar="example" />
<DropdownMenuGeneric foo={1} bar={false} foobar="example" />
@@ -4051,3 +4056,181 @@ function GenericPropExample() {
</React.Fragment >
);
}
class Example119 extends React.Component<any, any> {
render() {
return (
<Form>
<FormGroup>
<Label for="exampleCheckbox">Checkboxes</Label>
<div>
<CustomInput type="checkbox" id="exampleCustomCheckbox" label="Check this custom checkbox" />
<CustomInput type="checkbox" id="exampleCustomCheckbox2" label="Or this one" />
<CustomInput type="checkbox" id="exampleCustomCheckbox3" label="But not this disabled one" disabled />
</div>
</FormGroup>
<FormGroup>
<Label for="exampleCheckbox">Radios</Label>
<div>
<CustomInput type="radio" id="exampleCustomRadio" name="customRadio" label="Select this custom radio" />
<CustomInput type="radio" id="exampleCustomRadio2" name="customRadio" label="Or this one" />
<CustomInput type="radio" id="exampleCustomRadio3" label="But not this disabled one" disabled />
</div>
</FormGroup>
<FormGroup>
<Label for="exampleCheckbox">Inline</Label>
<div>
<CustomInput type="checkbox" id="exampleCustomInline" label="An inline custom input" inline />
<CustomInput type="checkbox" id="exampleCustomInline2" label="and another one" inline />
</div>
</FormGroup>
<FormGroup>
<Label for="exampleCustomSelect">Custom Select</Label>
<CustomInput type="select" id="exampleCustomSelect" name="customSelect">
<option value="">Select</option>
<option>Value 1</option>
<option>Value 2</option>
<option>Value 3</option>
<option>Value 4</option>
<option>Value 5</option>
</CustomInput>
</FormGroup>
<FormGroup>
<Label for="exampleCustomMutlipleSelect">Custom Multiple Select</Label>
<CustomInput type="select" id="exampleCustomMutlipleSelect" name="customSelect" multiple>
<option value="">Select</option>
<option>Value 1</option>
<option>Value 2</option>
<option>Value 3</option>
<option>Value 4</option>
<option>Value 5</option>
</CustomInput>
</FormGroup>
<FormGroup>
<Label for="exampleCustomSelectDisabled">Custom Select Disabled</Label>
<CustomInput type="select" id="exampleCustomSelectDisabled" name="customSelect" disabled>
<option value="">Select</option>
<option>Value 1</option>
<option>Value 2</option>
<option>Value 3</option>
<option>Value 4</option>
<option>Value 5</option>
</CustomInput>
</FormGroup>
<FormGroup>
<Label for="exampleCustomMutlipleSelectDisabled">Custom Multiple Select Disabled</Label>
<CustomInput type="select" id="exampleCustomMutlipleSelectDisabled" name="customSelect" multiple disabled>
<option value="">Select</option>
<option>Value 1</option>
<option>Value 2</option>
<option>Value 3</option>
<option>Value 4</option>
<option>Value 5</option>
</CustomInput>
</FormGroup>
<FormGroup>
<Label for="exampleCustomFileBrowser">File Browser</Label>
<CustomInput type="file" id="exampleCustomFileBrowser" name="customFile" />
</FormGroup>
<FormGroup>
<Label for="exampleCustomFileBrowser">File Browser with Custom Label</Label>
<CustomInput type="file" id="exampleCustomFileBrowser" name="customFile" label="Yo, pick a file!" />
</FormGroup>
<FormGroup>
<Label for="exampleCustomFileBrowser">File Browser Disabled</Label>
<CustomInput type="file" id="exampleCustomFileBrowser" name="customFile" disabled />
</FormGroup>
</Form>
);
}
}
class Example120 extends React.Component<any, any> {
render() {
return (
<Table borderless>
<thead>
<tr>
<th>#</th>
<th>First Name</th>
<th>Last Name</th>
<th>Username</th>
</tr>
</thead>
<tbody>
<tr>
<th scope="row">1</th>
<td>Mark</td>
<td>Otto</td>
<td>@mdo</td>
</tr>
<tr>
<th scope="row">2</th>
<td>Jacob</td>
<td>Thornton</td>
<td>@fat</td>
</tr>
<tr>
<th scope="row">3</th>
<td>Larry</td>
<td>the Bird</td>
<td>@twitter</td>
</tr>
</tbody>
</Table>
);
}
}
class Example121 extends React.Component<any, any> {
render() {
return (
<UncontrolledDropdown className="some-class" setActiveFromChild>
<DropdownToggle caret>
Dropdown
</DropdownToggle>
<DropdownMenu>
<DropdownItem header>Header</DropdownItem>
<DropdownItem disabled>Action</DropdownItem>
<DropdownItem>Another Action</DropdownItem>
<DropdownItem divider />
<DropdownItem>Another Action</DropdownItem>
</DropdownMenu>
</UncontrolledDropdown>
);
}
}
class Example122 extends React.Component<any, any> {
constructor(props: any) {
super(props);
this.toggle = this.toggle.bind(this);
this.state = {
dropdownOpen: false
};
}
toggle() {
this.setState({
dropdownOpen: !this.state.dropdownOpen
});
}
render() {
return (
<Dropdown isOpen={this.state.dropdownOpen} toggle={this.toggle}>
<DropdownToggle caret>
Dropdown
</DropdownToggle>
<DropdownMenu persist>
<DropdownItem header>Header</DropdownItem>
<DropdownItem disabled>Action</DropdownItem>
<DropdownItem>Another Action</DropdownItem>
<DropdownItem divider />
<DropdownItem>Another Action</DropdownItem>
</DropdownMenu>
</Dropdown>
);
}
}
+2
View File
@@ -7,6 +7,7 @@
// Christopher Currens <https://github.com/ccurrens>,
// Jon Stevens <https://github.com/lookfirst>,
// Matt R. Wilson <https://github.com/mastermatt>
// Jose Colella <https://github.com/josecolella>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
@@ -139,6 +140,7 @@ declare namespace request {
method?: string;
headers?: Headers;
body?: any;
family?: 4 | 6;
followRedirect?: boolean | ((response: http.IncomingMessage) => boolean);
followAllRedirects?: boolean;
followOriginalHttpMethod?: boolean;
+45 -44
View File
@@ -553,49 +553,7 @@ declare namespace SocketIO {
/**
* The object used when negociating the handshake
*/
handshake: {
/**
* The headers passed along with the request. e.g. 'host',
* 'connection', 'accept', 'referer', 'cookie'
*/
headers: any;
/**
* The current time, as a string
*/
time: string;
/**
* The remote address of the connection request
*/
address: string;
/**
* Is this a cross-domain request?
*/
xdomain: boolean;
/**
* Is this a secure request?
*/
secure: boolean;
/**
* The timestamp for when this was issued
*/
issued: number;
/**
* The request url
*/
url: string;
/**
* Any query string parameters in the request url
*/
query: any;
};
handshake: Handshake;
/**
* Sets the 'json' flag when emitting an event
*/
@@ -629,7 +587,7 @@ declare namespace SocketIO {
/**
* Registers a middleware, which is a function that gets executed for every incoming Packet and receives as parameter the packet and a function to optionally defer execution to the next registered middleware.
*
*
* Errors passed to middleware callbacks are sent as special error packets to clients.
*/
use( fn: ( packet: Packet, next: (err?: any) => void ) => void ): Socket;
@@ -690,6 +648,49 @@ declare namespace SocketIO {
compress( compress: boolean ): Socket;
}
interface Handshake {
/**
* The headers passed along with the request. e.g. 'host',
* 'connection', 'accept', 'referer', 'cookie'
*/
headers: any;
/**
* The current time, as a string
*/
time: string;
/**
* The remote address of the connection request
*/
address: string;
/**
* Is this a cross-domain request?
*/
xdomain: boolean;
/**
* Is this a secure request?
*/
secure: boolean;
/**
* The timestamp for when this was issued
*/
issued: number;
/**
* The request url
*/
url: string;
/**
* Any query string parameters in the request url
*/
query: any;
}
/**
* The interface used when dealing with rooms etc
*/
+2 -1
View File
@@ -18,6 +18,7 @@
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts"
"index.d.ts",
"youtube-tests.ts"
]
}
+282
View File
@@ -0,0 +1,282 @@
const players: YT.Player[] = [
new YT.Player(document.body, {}),
new YT.Player(document.body, {
width: 100,
height: 100,
}),
new YT.Player("id", {
width: "100%",
height: "100%",
videoId: "videoId",
playerVars: {},
events: {},
}),
new YT.Player("id", {
playerVars: {
autohide: YT.AutoHide.AlwaysVisible,
autoplay: YT.AutoPlay.AutoPlay,
cc_load_policy: YT.ClosedCaptionsLoadPolicy.ForceOn,
color: "red",
controls: YT.Controls.Hide,
disablekb: YT.KeyboardControls.Disable,
enablejsapi: YT.JsApi.Disable,
end: 9001,
fs: YT.FullscreenButton.Hide,
hl: "en-us",
iv_load_policy: YT.IvLoadPolicy.Hide,
list: "my query",
listType: "search",
loop: YT.Loop.Loop,
modestbranding: YT.ModestBranding.Full,
origin: "localhost",
playlist: "1,2",
playsinline: YT.PlaysInline.Fullscreen,
rel: YT.RelatedVideos.Hide,
showinfo: YT.ShowInfo.Hide,
start: 0,
},
}),
new YT.Player("id", {
events: {
onReady(event: YT.PlayerEvent) {
const targetPlayer: YT.Player = event.target;
},
onStateChange(event: YT.OnStateChangeEvent) {
const targetPlayer: YT.Player = event.target;
const playerData: YT.PlayerState = event.data;
},
onPlaybackQualityChange(event: YT.OnPlaybackQualityChangeEvent) {
const targetPlayer: YT.Player = event.target;
const newQuality: string = event.data;
},
onPlaybackRateChange(event: YT.OnPlaybackRateChangeEvent) {
const targetPlayer: YT.Player = event.target;
const newRate: number = event.data;
},
onError(event: YT.OnErrorEvent) {
const targetPlayer: YT.Player = event.target;
const error: YT.PlayerError = event.data;
},
onApiChange(event: YT.PlayerEvent) {
const targetPlayer: YT.Player = event.target;
},
}
}),
];
const ensureNumeric = <TValue extends number>() => {};
ensureNumeric<YT.PlayerState>();
ensureNumeric<YT.PlayerError>();
ensureNumeric<YT.AutoHide>();
ensureNumeric<YT.AutoPlay>();
ensureNumeric<YT.ClosedCaptionsLoadPolicy>();
ensureNumeric<YT.Controls>();
ensureNumeric<YT.KeyboardControls>();
ensureNumeric<YT.JsApi>();
ensureNumeric<YT.FullscreenButton>();
ensureNumeric<YT.IvLoadPolicy>();
ensureNumeric<YT.Loop>();
ensureNumeric<YT.ModestBranding>();
ensureNumeric<YT.PlaysInline>();
ensureNumeric<YT.RelatedVideos>();
ensureNumeric<YT.ShowInfo>();
const ensureString = <TValue extends string>() => {}
ensureString<YT.ProgressBarColor>();
ensureString<YT.ListType>();
ensureString<YT.ListTypePlayer>();
ensureString<YT.ListTypeSearch>();
ensureString<YT.ListTypeUserUploads>();
ensureString<YT.SuggestedVideoQuality>();
const player = new YT.Player("", {});
player.cueVideoById("id");
player.cueVideoById("id", 0);
player.cueVideoById("id", 9001, "default");
player.cueVideoById("id", 9001, "small");
player.cueVideoById({
videoId: "id",
});
player.cueVideoById({
startSeconds: 0,
endSeconds: 9001,
suggestedQuality: "highres",
videoId: "id",
});
player.loadVideoById("id");
player.loadVideoById("id", 0);
player.loadVideoById("id", 0, "medium");
player.loadVideoById("id", 0, "large");
player.loadVideoById({
videoId: "id",
});
player.loadVideoById({
endSeconds: 9001,
startSeconds: 0,
suggestedQuality: "hd720",
videoId: "id",
});
player.cueVideoByUrl("url");
player.cueVideoByUrl("url", 0);
player.cueVideoByUrl("url", 0, "hd1080");
player.cueVideoByUrl("url", 0, "highres");
player.cueVideoByUrl({
mediaContentUrl: "url",
});
player.cueVideoByUrl({
endSeconds: 9001,
mediaContentUrl: "url",
startSeconds: 0,
suggestedQuality: "hd720",
});
player.loadVideoByUrl("url");
player.loadVideoByUrl("url", 0);
player.loadVideoByUrl("url", 0, "hd1080");
player.loadVideoByUrl("url", 0, "highres");
player.loadVideoByUrl({
mediaContentUrl: "url",
});
player.loadVideoByUrl({
endSeconds: 9001,
mediaContentUrl: "url",
startSeconds: 0,
suggestedQuality: "hd720",
});
player.cuePlaylist(["play", "list"]);
player.cuePlaylist(["play", "list"], 7);
player.cuePlaylist(["play", "list"], 7, 0);
player.cuePlaylist(["play", "list"], 7, 0, "default");
player.cuePlaylist({
list: "playlist",
listType: "player",
});
player.cuePlaylist({
index: 7,
list: "playlist",
listType: "search",
});
player.cuePlaylist({
endSeconds: 9001,
index: 7,
list: "playlist",
listType: "search",
startSeconds: 0,
suggestedQuality: "hd720",
});
player.loadPlaylist(["play", "list"]);
player.loadPlaylist(["play", "list"], 7);
player.loadPlaylist(["play", "list"], 7, 0);
player.loadPlaylist(["play", "list"], 7, 0, "default");
player.loadPlaylist({
list: "playlist",
listType: "player",
});
player.loadPlaylist({
index: 7,
listType: "search",
list: "playlist",
});
player.loadPlaylist({
endSeconds: 9001,
index: 7,
listType: "search",
list: "playlist",
startSeconds: 0,
suggestedQuality: "hd720",
});
player.playVideo();
player.pauseVideo();
player.stopVideo();
player.seekTo(9001, true);
player.nextVideo();
player.previousVideo();
player.playVideoAt(0);
player.mute();
player.unMute();
const muted: boolean = player.isMuted();
player.setVolume(49);
const volume: number = player.getVolume();
player.setSize(350, 490);
const playbackRate: number = player.getPlaybackRate();
player.setPlaybackRate(2);
const playbackRates: number[] = player.getAvailablePlaybackRates();
player.setLoop(true);
player.setShuffle(false);
const fraction: number = player.getVideoLoadedFraction();
const state: YT.PlayerState = player.getPlayerState();
const time: number = player.getCurrentTime();
const quality: YT.SuggestedVideoQuality = player.getPlaybackQuality();
player.setPlaybackQuality(quality);
player.setPlaybackQuality("medium");
const qualities: YT.SuggestedVideoQuality[] = player.getAvailableQualityLevels();
for (const quality of player.getAvailableQualityLevels()) {
player.setPlaybackQuality(quality)
}
const duration: number = player.getDuration();
const videoUrl: string = player.getVideoUrl();
const videoEmbed: string = player.getVideoEmbedCode();
const playlist: string[] = player.getPlaylist();
const playlistIndex: number = player.getPlaylistIndex();
player.addEventListener("onReady", (event: YT.PlayerEvent) => {});
player.addEventListener("onStateChange", (event: YT.OnStateChangeEvent) => {});
player.addEventListener("onPlaybackQualityChange", (event: YT.OnPlaybackQualityChangeEvent) => {});
player.addEventListener("onPlaybackRateChange", (event: YT.OnPlaybackRateChangeEvent) => {});
player.addEventListener("onError", (event: YT.OnErrorEvent) => {});
player.addEventListener("onApiChange", (event: YT.PlayerEvent) => {});
const frame: HTMLIFrameElement = player.getIframe();
player.destroy();